react-autoql 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import e from"lodash.get";import t from"lodash.filter";import n from"dayjs";import a from"dayjs/plugin/advancedFormat";import o from"dayjs/plugin/localizedFormat";import r from"dayjs/plugin/utc";import i from"dayjs/plugin/timezone";import l from"axios";import s,{Fragment as c,Component as u}from"react";import p from"prop-types";import{v4 as d}from"uuid";import{AiFillCaretDown as m}from"@react-icons/all-files/ai/AiFillCaretDown";import{AiFillCaretLeft as f}from"@react-icons/all-files/ai/AiFillCaretLeft";import{AiFillCaretRight as g}from"@react-icons/all-files/ai/AiFillCaretRight";import{AiFillCaretUp as h}from"@react-icons/all-files/ai/AiFillCaretUp";import{AiOutlineBook as v}from"@react-icons/all-files/ai/AiOutlineBook";import{AiOutlineBulb as y}from"@react-icons/all-files/ai/AiOutlineBulb";import{AiOutlineDashboard as b}from"@react-icons/all-files/ai/AiOutlineDashboard";import{AiOutlineEdit as C}from"@react-icons/all-files/ai/AiOutlineEdit";import{AiOutlineFileText as E}from"@react-icons/all-files/ai/AiOutlineFileText";import{AiOutlineMenu as S}from"@react-icons/all-files/ai/AiOutlineMenu";import{AiOutlineQuestionCircle as T}from"@react-icons/all-files/ai/AiOutlineQuestionCircle";import{BiLineChart as D}from"@react-icons/all-files/bi/BiLineChart";import{BsArrowBarDown as x}from"@react-icons/all-files/bs/BsArrowBarDown";import{BsArrowBarUp as k}from"@react-icons/all-files/bs/BsArrowBarUp";import{FaMicrophoneAlt as w}from"@react-icons/all-files/fa/FaMicrophoneAlt";import{FiAlertTriangle as A}from"@react-icons/all-files/fi/FiAlertTriangle";import{FiArrowLeft as N}from"@react-icons/all-files/fi/FiArrowLeft";import{FiBell as R}from"@react-icons/all-files/fi/FiBell";import{FiBellOff as M}from"@react-icons/all-files/fi/FiBellOff";import{FiCalendar as V}from"@react-icons/all-files/fi/FiCalendar";import{FiCheck as q}from"@react-icons/all-files/fi/FiCheck";import{FiDatabase as I}from"@react-icons/all-files/fi/FiDatabase";import{FiDownload as P}from"@react-icons/all-files/fi/FiDownload";import{FiEye as L}from"@react-icons/all-files/fi/FiEye";import{FiFilter as O}from"@react-icons/all-files/fi/FiFilter";import{FiMoreHorizontal as F}from"@react-icons/all-files/fi/FiMoreHorizontal";import{FiMoreVertical as Q}from"@react-icons/all-files/fi/FiMoreVertical";import{FiPauseCircle as z}from"@react-icons/all-files/fi/FiPauseCircle";import{FiPlus as H}from"@react-icons/all-files/fi/FiPlus";import{FiSend as B}from"@react-icons/all-files/fi/FiSend";import{FiSettings as _}from"@react-icons/all-files/fi/FiSettings";import{FiTrash2 as U}from"@react-icons/all-files/fi/FiTrash2";import{FiMaximize as j}from"@react-icons/all-files/fi/FiMaximize";import{FiMinimize as K}from"@react-icons/all-files/fi/FiMinimize";import{FiRefreshCw as G}from"@react-icons/all-files/fi/FiRefreshCw";import{GoReport as W}from"@react-icons/all-files/go/GoReport";import{IoIosCloseCircleOutline as Y}from"@react-icons/all-files/io/IoIosCloseCircleOutline";import{IoIosGlobe as X}from"@react-icons/all-files/io/IoIosGlobe";import{IoIosHourglass as J}from"@react-icons/all-files/io/IoIosHourglass";import{IoIosSearch as Z}from"@react-icons/all-files/io/IoIosSearch";import{MdClose as $}from"@react-icons/all-files/md/MdClose";import{MdContentCopy as ee}from"@react-icons/all-files/md/MdContentCopy";import{MdError as te}from"@react-icons/all-files/md/MdError";import{MdInfoOutline as ne}from"@react-icons/all-files/md/MdInfoOutline";import{MdLock as ae}from"@react-icons/all-files/md/MdLock";import{MdLockOpen as oe}from"@react-icons/all-files/md/MdLockOpen";import{MdPlayCircleOutline as re}from"@react-icons/all-files/md/MdPlayCircleOutline";import{TiSortNumerically as ie}from"@react-icons/all-files/ti/TiSortNumerically";import le from"react-tooltip";import se from"lodash.isequal";import ce from"lodash.clonedeep";import ue from"react-infinite-scroller";import pe from"lodash.isempty";import de from"parse-num";import me from"react-tiny-popover";import fe from"moment-timezone";import ge from"react-select";import he from"react-modal";import{Scrollbars as ve}from"react-custom-scrollbars-2";import ye from"disable-scroll";import be from"html-react-parser";import{scaleOrdinal as Ce,scaleBand as Ee,scaleLinear as Se}from"d3-scale";import{ReactTabulator as Te}from"react-tabulator";import"react-tabulator/lib/styles.css";import"react-tabulator/css/bootstrap/tabulator_bootstrap.min.css";import De from"lodash.sortby";import{select as xe}from"d3-selection";import{max as ke,min as we}from"d3-array";import{axisBottom as Ae,axisLeft as Ne}from"d3-axis";import{legendColor as Re}from"d3-svg-legend";import{symbol as Me,symbolCircle as Ve,arc as qe,pie as Ie}from"d3-shape";import{entries as Pe}from"d3-collection";import"d3-transition";import Le from"react-autosuggest";import Oe from"react-speech-recognition";import Fe from"rc-drawer";import Qe from"lodash.has";import ze from"react-localization";import"rc-drawer/assets/index.css";import{toast as He,ToastContainer as Be,Slide as _e}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import{format as Ue}from"sql-formatter";import je,{WidthProvider as Ke}from"react-grid-layout";import Ge from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import We from"lodash.omit";import Ye from"lodash.functions";import Xe,{StereoAudioRecorder as Je}from"recordrtc";function Ze(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 $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){lt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function et(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3
- et=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",r=a.asyncIterator||"@@asyncIterator",i=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function s(e,t,n,a){var o=t&&t.prototype instanceof p?t:p,r=Object.create(o.prototype),i=new T(a||[]);return r._invoke=function(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 x()}for(n.method=o,n.arg=r;;){var i=n.delegate;if(i){var l=C(i,n);if(l){if(l===u)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=c(e,t,n);if("normal"===s.type){if(a=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a="completed",n.method="throw",n.arg=s.arg)}}}(e,n,i),r}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function p(){}function d(){}function m(){}var f={};l(f,o,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(D([])));h&&h!==t&&n.call(h,o)&&(f=h);var v=m.prototype=p.prototype=Object.create(f);function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var a;this._invoke=function(o,r){function i(){return new t((function(a,i){!function a(o,r,i,l){var s=c(e[o],e,r);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){a("next",e,i,l)}),(function(e){a("throw",e,i,l)})):t.resolve(p).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,l)}))}l(s.arg)}(o,r,a,i)}))}return a=a?a.then(i,i):i()}}function C(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var a=c(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,u;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function E(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 S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function D(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,r=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 r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return d.prototype=m,l(v,"constructor",m),l(m,"constructor",d),d.displayName=l(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,r,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,a,o,r){void 0===r&&(r=Promise);var i=new b(s(t,n,a,o),r);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(v),l(v,i,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},e.values=D,T.prototype={constructor:T,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(S),!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,u):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),u},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),S(n),u}},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;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:D(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function tt(e){return(tt="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,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 at(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var r=e.apply(t,n);function i(e){nt(r,a,o,i,l,"next",e)}function l(e){nt(r,a,o,i,l,"throw",e)}i(void 0)}))}}function ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(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,a.key,a)}}function it(e,t,n){return t&&rt(e.prototype,t),n&&rt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(){return(st=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 ct(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&&pt(e,t)}function ut(e){return(ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pt(e,t){return(pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function dt(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 mt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ft(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 mt(e)}function gt(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=ut(e);if(t){var o=ut(this).constructor;n=Reflect.construct(a,arguments,o)}else n=a.apply(this,arguments);return ft(this,n)}}function ht(e){return function(e){if(Array.isArray(e))return vt(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 vt(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 vt(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 vt(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}var yt=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{hasError:!1}),lt(mt(e),"componentDidCatch",(function(t,n){e.setState({hasError:!0}),console.error(t),console.error(n)})),lt(mt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),lt(mt(e),"render",(function(){return e.state.hasError?s.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return it(n)}();lt(yt,"propTypes",{message:p.string}),lt(yt,"defaultProps",{message:null});var bt=p.shape({token:p.string,apiKey:p.string,domain:p.string}),Ct=p.shape({currencyCode:p.string,languageCode:p.string,currencyDecimals:p.number,quantityDecimals:p.number,comparisonDisplay:p.string,monthYearFormat:p.string,dayMonthYearFormat:p.string}),Et=p.shape({debug:p.bool,test:p.bool,enableAutocomplete:p.bool,enableQueryValidation:p.bool,enableDrilldowns:p.bool,enableQuerySuggestions:p.bool,enableColumnVisibilityManager:p.bool,enableNotifications:p.bool}),St=p.shape({theme:p.oneOf(["light","dark"]),chartColors:p.arrayOf(p.string),accentColor:p.string,fontFamily:p.string,dashboardBackground:p.string});p.shape({stringColumnIndices:p.arrayOf(p.number),numberColumnIndices:p.arrayOf(p.number),stringColumnIndex:p.number,legendColumnIndex:p.number,numberColumnIndex:p.number});var Tt={GENERAL_QUERY:s.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:s.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:s.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.")},Dt="Request cancelled",xt=new ze({en:{introPrompt:"Some things you can ask me: ",use:"Use",exploreQueries:"Explore Queries",explorePrompt:"to further explore the possibilities.",run:"We run on AutoQL by Chata",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"},sp:{introPrompt:"Cosas que puedes preguntarme:",use:"Utiliza",exploreQueries:"Explorar Consultas",explorePrompt:"para ampliar las posibilidades.",run:"Corremos en AutoQL de Chata",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"}}),kt=s.createElement("svg",{x:"0px",y:"0px",width:"23px",height:"23px",viewBox:"0 0 23 23",style:{strokeWidth:"1.4px",marginBottom:"2px",marginLeft:"1px"}},s.createElement("g",null,s.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"}),s.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"}),s.createElement("path",{className:"react-autoql-icon-outlined",d:"M5.134,11.903"}),s.createElement("ellipse",{className:"react-autoql-icon-outlined",cx:"11.425",cy:"9.005",rx:"0.91",ry:"0.611"}),s.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"}))),wt=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.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"}),s.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"})),At=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.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"}))))),Nt=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.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"})))),Rt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),Mt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),Vt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),qt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),It=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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 "})),Pt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"}),s.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"})),Lt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),s.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"}),s.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),s.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"}),s.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),s.createElement("g",null,s.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),s.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"}),s.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),Ot=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),s.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"}),s.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),s.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"}),s.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),s.createElement("g",null,s.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),s.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"}),s.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Ft=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",{className:"st2"},s.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"})),s.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"}),s.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"})),Qt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),s.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),s.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),s.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),s.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),s.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),s.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),s.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),s.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),s.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),s.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),s.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),s.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),s.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),s.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),zt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Ht=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),s.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"}),s.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"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Bt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"}),s.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),_t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO8AAADvCAMAAAAtrnOLAAACE1BMVEUAAAAutn0utn7gHlrssy42xfA1xfHfHlrssy4fzq0yvZM2xfDhIFPzsi7/Uk4utn3gHlrssi4utn3gHlrssi4utn3gHlrssi4utn0utn03yPIwxv82xfAttnzssi3tsi0stHzfIFjqsiwttn01xfHgHVngHVo0w+/eIFwstX7usyw1xfLwtC3gHlrssi02xfA1xfDgHlo2xfDhHlrgHlkttn3ssi02xO82xfAutn3ssi7hHlrssi42xvDgHlout33hHVnjGlg2xvDgHlrssi4ttn3ssi7hHls2xfHgH1rgHVrssi3gH1riHVrusS8vuH8stn8ytXwutn02xfDgHlrssi42xe/ssi42xfDssy42xvDhHVoutn0utnwut3w1xe/gHVrssi4utn4ttn0ut3w2xe82xfAttn3gHVrtsi01xfEtt37ssy3hHVstuHwut30ttnw1xvI2xfDgHloutn3ssy01xfA3xPA2xPDssy42xfE3yO00uX7tsjQutn3gHloutn42xfDssy7ssi7gHlrssi7hHlrtsi7ssy42xfA2xfHssi42xvDtsi02xfHgH1nrsy01xu/cI1k2xfAttn7tsi01xu/fHlrrsi01x/Dusy3stC3qsSvstC3jHFopunw2xPA1xfHssi4vt37hHlvgHVntsi43w/DrtC0ttX3gHlrhHlrqFVU2xfDgHlrssi4utn1qLWRTAAAArXRSTlMA8JDw8PCQkJABBfcFBQL4+Pja2tj29vbUcRgGo3t6cBcXF+Z7e3AeHh0dExPm5tnR0bS0dGxsK/TOzaKib1pWJBPV1dK0iIdsbEFBOS0rKiMU/u3t7ebg3NzLx6ymoZOTk4yFdnJiYmJiW1tbVUg/NiXg4N+2q4d1dDkNDQ3szcjGxrKsrKamjYtXV1RUSkpKPw6YmJiAgIBDOicjIRoS5+XJxZiLODMzLd+XDNu6FUIAAAoKSURBVHja7NzNaxpBGMfxn0KF3T0IC4KvICiIeFAEUQ9BEALezAuEEPICeYUE8kZIQhJKckwogdBS6KktPZQeHpg/sfTm6rrOjLvTaXc/94X9sgw7CzsPIpFIJBIa5t1t/mn92+plo/n8oQYhy73dze5VrGT/2N4/N6E/40u+Q6M2BjXu2Nbj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",Ut="data:image/png;base64,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",jt=["type","size","showBadge","warning","danger"],Kt=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(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=dt(t,jt),a=null;switch(e.props.type){case"back":a=s.createElement(N,null);break;case"bar-chart":a=qt;break;case"stacked-bar-chart":a=Lt;break;case"bubble-chart":a=zt;break;case"calendar":a=s.createElement(V,null);break;case"caret-right":a=s.createElement(g,null);break;case"caret-left":a=s.createElement(f,null);break;case"caret-down":a=s.createElement(m,null);break;case"caret-up":a=s.createElement(h,null);break;case"react-autoql-bubbles-outlined":a=wt;break;case"react-autoql-bubbles-filled":a=Nt;break;case"react-autoql-bubbles-filled-alt":a=At;break;case"chart":a=s.createElement(D,null);break;case"check":a=s.createElement(q,null);break;case"close":a=s.createElement($,null);break;case"maximize":a=s.createElement(j,null);break;case"minimize":a=s.createElement(K,null);break;case"close-circle":a=s.createElement(Y,null);break;case"collapse":a=s.createElement(k,null);break;case"column-chart":a=Vt;break;case"stacked-column-chart":a=Ot;break;case"copy":a=s.createElement(ee,null);break;case"dashboard":a=s.createElement(b,null);break;case"database":a=s.createElement(I,null);break;case"description":a=s.createElement(E,null);break;case"download":a=s.createElement(P,null);break;case"edit":a=s.createElement(C,null);break;case"expand":a=s.createElement(x,null);break;case"eye":a=s.createElement(L,null);break;case"filter":a=s.createElement(O,null);break;case"grad-cap":a=kt;break;case"globe":a=s.createElement(X,null);break;case"heatmap":a=Qt;break;case"hour-glass":a=s.createElement(J,null);break;case"info":a=s.createElement(ne,null);break;case"light-bulb":a=s.createElement(y,null);break;case"line-chart":a=It;break;case"lock":a=s.createElement(ae,null);break;case"stacked-line-chart":a=Ft;break;case"teams":a=s.createElement("img",{className:"slack-logo",src:Ut,alt:"Slack",style:$e($e({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"menu":a=s.createElement(S,null);break;case"microphone":a=s.createElement(w,null);break;case"more-vertical":a=s.createElement(Q,null);break;case"more-horizontal":a=s.createElement(F,null);break;case"notification":a=s.createElement(R,null);break;case"notification-off":a=s.createElement(M,null);break;case"notification-pause":a=s.createElement(z,null);break;case"numbers":a=s.createElement(ie,null);break;case"pie-chart":a=Pt;break;case"play":a=s.createElement(re,null);break;case"pivot-table":a=Mt;break;case"plus":a=s.createElement(H,null);break;case"question":a=s.createElement(T,null);break;case"refresh":a=s.createElement(G,null);break;case"report":a=s.createElement(W,null);break;case"search":a=s.createElement(Z,null);break;case"send":a=s.createElement(B,null);break;case"settings":a=s.createElement(_,null);break;case"slack":a=s.createElement("img",{className:"slack-logo",src:_t,alt:"Slack",style:$e($e({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"split-view":a=Ht;break;case"single-view":a=Bt;break;case"table":a=Rt;break;case"title":a=s.createElement(v,null);break;case"trash":a=s.createElement(U,null);break;case"unlock":a=s.createElement(oe,null);break;case"warning":a=s.createElement(te,null);break;case"warning-triangle":a=s.createElement(A,null)}return s.createElement(yt,null,s.createElement("span",st({},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:$e({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),a,e.props.showBadge&&s.createElement("div",{className:"react-autoql-badge"})))})),e}return it(n)}();lt(Kt,"propTypes",{type:p.string.isRequired,size:p.number,showBadge:p.bool,color:p.string,warning:p.bool,danger:p.bool}),lt(Kt,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var Gt={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},Wt={currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMM YYYY",dayMonthYearFormat:"ll"},Yt={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableSlackSharing:!0,enableTeamsSharing:!0,enableCSVDownload:!1,enableReportProblem:!0},Xt={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",titleColor:"#356f90",dashboardBackground:"#fafafa"},Jt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Gt),e)},Zt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Wt),e)},$t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Yt),e)},en=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Xt),e)};n.extend(r),n.extend(i),n.extend(a),n.extend(o),function(){var e=window.navigator.language||"en",t=e.split("-")[0];try{require("dayjs/locale/".concat(e,".js")),n.locale(e)}catch(e){try{require("dayjs/locale/".concat(t,".js")),n.locale(t)}catch(e){}}}();var tn=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],nn=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line"],an=["January","February","March","April","May","June","July","August","September","October","November","December"],on=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],rn={"accent-color":"#28a8e0","background-color-primary":"#fff","background-color-secondary":"#F1F3F5","background-color-tertiary":"#cccccc","border-color":"#e6e6e6","hover-color":"#ececec","text-color-primary":"#5d5d5d","accent-text-color":"#ffffff","text-color-placeholder":"#00000036","font-family":"sans-serif","highlight-color":"#000","danger-color":"#ca0b00","warning-color":"#ffcc00","success-color":"#2aca4d"},ln={"accent-color":"#193a48","background-color-primary":"#3B3F46","background-color-secondary":"#20252A","background-color-tertiary":"#292929","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#fff","accent-text-color":"#ffffff","text-color-placeholder":"#ffffff9c","font-family":"sans-serif","highlight-color":"#FFF","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#2aca4d"},sn=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},cn=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},un=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t},pn=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},dn=function(e){var t=[],n=[],a=[];return e.forEach((function(e,o){var r=e.type;e.is_visible&&!e.pivot&&("DOLLAR_AMT"===r?t.push(o):"QUANTITY"===r?n.push(o):"PERCENT"!==r&&"RATIO"!==r||a.push(o))})),t.length?{numberColumnIndices:t,numberColumnIndex:t[0]}:n.length?{numberColumnIndices:n,numberColumnIndex:n[0]}:a.length?{numberColumnIndices:a,numberColumnIndex:a[0]}:{numberColumnIndices:[],numberColumnIndex:void 0}},mn=function(e){if(e&&function(e){return!sn(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}))},fn=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},gn=function(t,n){if(t){var a=mn(t),o=fn(t),r=[];t.forEach((function(e,t){(un(e)||e.groupable)&&t!==a&&e.is_visible&&r.push(t)}));var i=r[0];if(n)i=e(t[o],"groupable")?o:t.findIndex((function(e){return e.groupable}));else o>=0?i=o:r[1]>=0&&(i=r[1]);return{stringColumnIndex:i,stringColumnIndices:r}}},hn=function(e){var t=0,n=0;return e.forEach((function(e){cn(e)&&e.is_visible?n+=1:un(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},vn=function(e,t,n){return n.indexOf(e)===t},yn=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},bn=function(e){return"Invalid Date"!==e},Cn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e)try{var o=a.monthYearFormat,r=a.dayMonthYearFormat,i="YYYY",l=o||"MMM YYYY",s=r||"ll",c=t.title,u=n.unix(e).utc().format(s);return Number.isNaN(Number(e))?(c&&c.toLowerCase().includes("year")?u=n(e).format(i):c&&c.toLowerCase().includes("month")&&(u=n(e).format(l)),u=n(e).format(s)):c&&c.toLowerCase().includes("year")?u=n.unix(e).utc().format(i):c&&c.toLowerCase().includes("month")&&(u=n.unix(e).utc().format(l)),bn(u)?u:e}catch(t){return console.error(t),e}},En=function(t,a){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=a.monthYearFormat||"MMM YYYY",u=a.dayMonthYearFormat||"ll";if(s){var p=n(t).format(u);if(bn(p))return p}else if(o){var d=n(t).format(c);if(bn(d))return d}else{if(r)return t;if(l)return l}}return t}},Sn=function(e){var t=e.d,n=e.col,a=void 0===n?{}:n,o=e.config,r=void 0===o?{}:o;if(null==t)return{fullWidthLabel:"Untitled Category",formattedLabel:"Untitled Category",isTruncated:!1};if(!a||!a.type)return{fullWidthLabel:t,formattedLabel:t,isTruncated:!1};var i=r.currencyCode,l=r.languageCode,s=t;switch(a.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var c=i||"USD";try{s=new Intl.NumberFormat(l,{style:"currency",currency:"".concat(c),minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}catch(e){console.error(e),s=new Intl.NumberFormat(l,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}}break;case"QUANTITY":Number(t)&&(s=new Intl.NumberFormat(l).format(t));break;case"DATE":s=Cn(t,a,r);break;case"DATE_STRING":s=En(t,r);break;case"PERCENT":if(Number(t)){var u=Number(t)/100;s=new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:0}).format(u)}}var p=s,d=!1;return"string"==typeof s&&s.length>20&&(s="".concat(s.substring(0,20),"..."),d=!0),{fullWidthLabel:p,formattedLabel:s,isTruncated:d}},Tn=function(e){var t=e.element,n=e.column,a=e.config,o=void 0===a?{}:a,r=e.htmlElement;try{var i=t,l=o.currencyCode,s=o.languageCode,c=o.currencyDecimals,u=o.quantityDecimals;if(n)switch(n.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var p=l||"USD",d=c||0===c?c:void 0;try{i=new Intl.NumberFormat(s,{style:"currency",currency:"".concat(p),minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}catch(e){console.error(e),i=new Intl.NumberFormat(s,{style:"currency",currency:"USD",minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}}break;case"QUANTITY":var m=u||0===u?u:1;if(Number(t)){var f=Number(t)%1!=0?m:0;i=new Intl.NumberFormat(s,{minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}break;case"DATE":i=Cn(t,n,o);break;case"DATE_STRING":i=En(t,o);break;case"RATIO":Number(t)&&(i=new Intl.NumberFormat(s,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(Number(t)){var g=Number(t)/100;i=new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(g),r&&r.classList.add("comparison-value-".concat(t<0?"negative":"positive"))}}return i}catch(e){return console.error(e),t}},Dn=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}},xn=function(e){var t;try{e&&(t=e.getBBox())}catch(e){console.error(e)}return t},kn=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=Dn(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"),p=new Image;p.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))},p.onerror=function(e){o("failed to load image with that url"+url)},p.src=r}catch(e){console.error(e),o("failed to convert svg to png "+e)}}))},wn=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},An=function(e){return nn.includes(e)},Nn=function(e){return tn.includes(e)},Rn=function(e){return 2===wn(e)&&3===e.length},Mn=function(e){var t=hn(e),n=t.amountOfNumberColumns,a=t.amountOfStringColumns;return n>0&&a>0},Vn=function(n){return t(e(n,"data.data.columns"),(function(e){return e.is_visible}))},qn=function(n){var a=e(n,"data.data.columns.length"),o=function(n){return t(e(n,"data.data.columns"),(function(e){return!e.is_visible}))}(n);return a&&!!o.length},In=function(t){var n=e(t,"data.data.columns.length"),a=Vn(t);return n&&!a.length},Pn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,a=t.dataLength,o=t.pivotDataLength;try{if(!e(n,"data.data.display_type"))return[];var r=n.data.data.display_type;if("suggestion"===r||"help"===r||"html"===r)return[r];var i=e(n,"data.data.rows",[]),l=Vn(n);if(!e(l,"length")||!e(i,"length"))return["text"];if(jn(n))return["single-value"];var s=1e3,c=10,u=a||i.length,p=0===a,d=0===o;if(Rn(l)&&!p){var m=["table"];return u<=s&&m.push("pivot_table"),u<=s&&!d?m.push("stacked_column","stacked_bar","stacked_line","column","bar","line","bubble","heatmap"):u>s&&console.warn("Supported Display Types: Rows exceeded 1000, only allowing regular table display type"),m}if(Mn(l)&&!p){var f,g=["table","column","bar","line"];u>1&&u<=c&&g.push("pie");var h=l.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),v=l[h];if(v&&null!=v&&null!==(f=v.display_name)&&void 0!==f&&f.toLowerCase().includes("month")&&2===(null==l?void 0:l.length)){var y=e(n,"data.data.rows"),b=[];y.forEach((function(e){var t=Tn({element:e[h],column:v,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});b.includes(t)||b.push(t)})),b.length>1&&g.push("pivot_table")}return g}return["table"]}catch(e){return console.error(e),["table"]}},Ln=function(e,t,n,a){var o=Pn({response:e,dataLength:n,pivotDataLength:a});return t&&o.includes(t)},On=function(e,t){var n=e.find((function(e){return An(e)}));return n||t},Fn=function(t,n){var a=Pn({response:t}),o=e(t,"data.data.display_type");if("suggestion"===o||"help"===o||"html"===o)return o;if(1===a.length)return a[0];if(a.includes("pivot_table")){var r="pivot_table";return n&&(r=sn(e(t,"data.data.columns"))?On(a,"pivot_table"):"pivot_table"),r}if(!o&&Kn(t)||"data"===o){var i="table";return n&&(i=sn(e(t,"data.data.columns"))?On(a,"table"):"table"),i}return"text"},Qn=function(e){try{var t=document.createElement("DIV");t.innerHTML=e,t.style.display="inline-block",t.style.position="absolute",t.style.visibility="hidden",t.style.fontSize="11px",document.body.appendChild(t);var n=t.clientWidth;return document.body.removeChild(t),n}catch(e){return console.error(e),0}},zn=function(e,t,n){if(null==e||!e.length||!t)return 0;var a=Qn(Sn({d:e[0],col:t,config:n}));return e.forEach((function(e){var o=Sn({d:e,col:t,config:n}).formattedLabel,r=Qn(o);r>a&&(a=r)})),a},Hn=function(e,t){if(!isNaN(e)&&!isNaN(t)){var n=e-t;return Math.abs(n)<5||e<t}},Bn=function(e,t){try{return e.bandwidth()+t*e.bandwidth()*2}catch(e){return console.error(e),0}},_n=function(e){var t=en(e),n=t.theme,a=t.accentColor,o=t.fontFamily,r=t.accentTextColor,i="light"===n?rn:ln;if(a&&(i["accent-color"]=a),o&&(i["font-family"]=o),r)i["accent-text-color"]=r;else{var l=a;"#"===l.slice(0,1)&&(l=l.slice(1)),3===l.length&&(l=l.split("").map((function(e){return e+e})).join(""));var s=(299*parseInt(l.substr(0,2),16)+587*parseInt(l.substr(2,2),16)+114*parseInt(l.substr(4,2),16))/1e3;i["accent-text-color"]=s>=140?"black":"white"}for(var c in i)document.documentElement.style.setProperty("--react-autoql-".concat(c),i[c])},Un=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},jn=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},Kn=function(t){if(!t)return!1;var n=e(t,"data.data.rows.length")&&e(t,"data.data.rows.length");return n},Gn=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)}},Wn=function(e){try{return e.join(".")}catch(e){return}},Yn=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,value_label:e.value_label||"ORIGINAL_TEXT",canonical:e.canonical||"ORIGINAL_TEXT"})})),t}},Xn=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},Jn=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;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)}};return l.get(s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},Zn=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,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={headers:{Authorization:"Bearer ".concat(r)}};return l.post(s,{},c).then((function(t){if(t.data&&"string"==typeof t.data)throw new Error("Parse error");return Promise.resolve($e($e({},e(t,"data.data",{})),{},{page:i}))})).catch((function(t){return"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"})}))},$n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.userSelection,o=t.debug,r=t.test,i=t.domain,s=t.apiKey,c=t.token,u=t.source,p=t.filters,d=t.orders,m=t.tableFilters,f=t.pageSize,g=t.cancelToken,h="".concat(i,"/autoql/api/v1/query?key=").concat(s),v=Yn(a),y={text:n,source:Wn(u),translation:o?"include":"exclude",user_selection:v,test:r,session_filter_locks:p,orders:d,filters:m,page_size:f};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!s||!i||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var b={headers:{Authorization:"Bearer ".concat(c)},cancelToken:g};return l.post(h,y,b).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)===Dt)return Promise.reject({data:{message:Dt}});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 l=null==t||null===(o=t.response)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.reference_id;if("1.1.430"===l||"1.1.431"===l||Xn(l)){var u,p,d,m=null==t||null===(u=t.response)||void 0===u||null===(p=u.data)||void 0===p||null===(d=p.data)||void 0===d?void 0:d.query_id;return Jn({query:n,queryId:m,domain:i,apiKey:s,token:c})}return Promise.reject(e(t,"response"))}))},ea=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?$n(t):na({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):$n(t)})).catch((function(e){return console.error(e),Promise.reject(e)}))},ta=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 s="".concat(a,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(o),c={headers:{Authorization:"Bearer ".concat(r)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return l.post(s,{},c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},na=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),s={headers:{Authorization:"Bearer ".concat(r)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},aa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryID,a=t.groupBys,o=t.debug,r=t.test,i=t.domain,s=t.apiKey,c=t.token;if(!n)return Promise.reject(new Error("Query ID not supplied"));if(!c||!i||!s)return Promise.reject(new Error("Unauthenticated"));var u={translation:o?"include":"exclude",columns:a,test:r},p={headers:{Authorization:"Bearer ".concat(c)}},d="".concat(i,"/autoql/api/v1/query/").concat(n,"/drilldown?key=").concat(s);return l.post(d,u,p).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},oa=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),s={headers:{Authorization:"Bearer ".concat(r)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ra=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,o=t.token,r=t.apiKey;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!a||!r||!o)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(o)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ia=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),s={headers:{Authorization:"Bearer ".concat(a)}},c={columns:r};return l.put(i,c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},la=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),s={columns:r};if(!a||!o||!n)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(a)}};return l.put(i,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},sa=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,s=t.token,c=t.skipQueryValidation,u=n?n.split(" "):[],p="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(u),"&page_size=").concat(a,"&page=").concat(o);if(!s||!r||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(s)}};return c?l.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):na({text:n,domain:r,apiKey:i,token:s}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):l.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return l.get(p,d).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.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 s="".concat(o,"/autoql/api/v1/query/").concat(a,"?key=").concat(r),c={headers:{Authorization:"Bearer ".concat(i)}},u={is_correct:!1,message:n};return l.put(s,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ua=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(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)})),lt(mt(e),"onMouseDown",(function(){le.hide(),e.props.startListening()})),lt(mt(e),"render",(function(){var t=e.props;t.transcript,t.interimTranscript,t.resetTranscript;var n=t.browserSupportsSpeechRecognition;t.startListening;var a=t.stopListening,o=t.listening;return n?s.createElement(yt,null,s.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(o?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},s.createElement(Kt,{type:"microphone"})),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return it(n)}();lt(ua,"propTypes",{transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,browserSupportsSpeechRecognition:p.bool,startListening:p.func,stopListening:p.func,listening:p.bool,onTranscriptChange:p.func,onFinalTranscript:p.func}),lt(ua,"defaultProps",{});var pa=Oe({autoStart:!1,continuous:!1})(ua);function da(){return s.createElement("div",{className:"response-loading","data-test":"loading-dots"},s.createElement("div",null),s.createElement("div",null),s.createElement("div",null),s.createElement("div",null))}var ma=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.focus()})),lt(mt(o),"componentDidUpdate",(function(e){se(en(o.props.themeConfig),en(e.themeConfig))||_n(o.props.themeConfig),o.props.inputValue!==e.inputValue&&o.setState({inputValue:o.props.inputValue})})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.queryValidationTimer&&clearTimeout(o.queryValidationTimer)})),lt(mt(o),"animateInputTextAndSubmit",(function(t){var n=t.query,a=t.userSelection,r=t.source;if((null==n?void 0:n.length)>0){var i=Math.round(1e3/n.length);if("string"==typeof n&&e(n,"length"))for(var l=function(e){setTimeout((function(){o._isMounted&&o.setState({inputValue:n.slice(0,e)}),e===n.length&&setTimeout((function(){o.submitQuery({queryText:n,userSelection:a,skipQueryValidation:!0,source:r})}),300)}),e*i)},s=1;s<=n.length;s++)l(s)}})),lt(mt(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),s={query:n};r||console.warn("No session ID was supplied to DPR. Using a randomly generated UUID instead");var c={headers:(t={},lt(t,"AutoAE-Referer-URL",window.location.origin),lt(t,"AutoAE-Session-ID",r||d()),t)};return l.post(i,s,c)})({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(e){console.error(e),o.onResponse(e)}))})),lt(mt(o),"onResponse",(function(e,t,n){var a;o.props.onResponseCallback(e,t,n);var r={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(a=o.state)||void 0===a?void 0:a.lastQuery)};o._isMounted&&o.setState(r)})),lt(mt(o),"cancelQuery",(function(){o.axiosSource.cancel(Dt)})),lt(mt(o),"submitQuery",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.queryText,n=e.userSelection,a=e.skipQueryValidation,r=e.source,i=t||o.state.inputValue;if(i){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer);var s={isQueryRunning:!0,suggestions:[],queryValidationResponse:void 0,queryValidationComponentId:d()};o.props.clearQueryOnSubmit&&(s.inputValue=""),o._isMounted&&o.setState(s);var c=o.props.source;null!=r&&r.length?c=[].concat(ht(o.props.source),ht(r)):r&&c.push("user"),o.axiosSource=l.CancelToken.source();var u,p,m=$e($e($e({query:i,userSelection:n},Jt(o.props.authentication)),$t(o.props.autoQLConfig)),{},{source:c,AutoAEId:o.props.AutoAEId,filters:o.props.queryFilters,pageSize:o.props.dataPageSize,cancelToken:o.axiosSource.token});if(i.trim())o.props.onSubmit(i),localStorage.setItem("inputValue",i),null!==(u=o.props.authentication)&&void 0!==u&&u.token||null===(p=o.props.authentication)||void 0===p||!p.dprKey?a?$n(m).then((function(e){return o.onResponse(e,i,m)})).catch((function(e){return console.error(e)})):ea(m).then((function(e){return o.onResponse(e,i,m)})).catch((function(e){var t=e||{error:"Unauthenticated"};o.onResponse(t)})):o.submitDprQuery(i)}})),lt(mt(o),"onKeyDown",(function(t){if("ArrowUp"===t.key&&!e(o.state.suggestions,"length")){var n=localStorage.getItem("inputValue");n&&o.setState({inputValue:n})}})),lt(mt(o),"onKeyPress",(function(e){"Enter"==e.key&&o.submitQuery()})),lt(mt(o),"onTranscriptChange",(function(e){o.setState({inputValue:e})})),lt(mt(o),"onFinalTranscript",(function(){o.focus()})),lt(mt(o),"setInputRef",(function(e){o.inputRef=e})),lt(mt(o),"focus",(function(){if(o.inputRef)o.inputRef.focus();else{var e=document.getElementsByClassName("".concat(o.UNIQUE_ID));e&&e[0]&&e[0].focus()}})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&o._isMounted&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"runValidation",(function(t){var n=t.text;o.setState({queryValidationResponse:void 0,queryValidationComponentId:d()}),o.queryValidationTimer&&clearTimeout(o.queryValidationTimer),o.queryValidationTimer=setTimeout((function(){na($e({text:n},Jt(o.props.authentication))).then((function(t){o.state.inputValue===e(t,"data.data.query")&&o.setState({queryValidationResponse:t,queryValidationComponentId:d()})})).catch((function(e){console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e({suggestion:n},Jt(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)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"onInputChange",(function(e){(!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:""}))})),lt(mt(o),"moveCaretAtEnd",(function(e){var t=e.target.value;e.target.value="",e.target.value=t})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-bar-container ".concat(o.props.className," ").concat("below"===o.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},s.createElement("div",{className:"react-autoql-chatbar-input-container"},$t(o.props.autoQLConfig).enableAutocomplete?s.createElement(Le,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return s.createElement(c,null,e.name)},inputProps:{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,autoFocus:!0}}):s.createElement("input",{className:"react-autoql-chatbar-input".concat(o.props.showChataIcon?" left-padding":""),placeholder:o.props.placeholder||"Type your queries here",value:o.state.inputValue,onChange:function(e){o.setState({inputValue:e.target.value})},"data-test":"chat-bar-input",onKeyPress:o.onKeyPress,onKeyDown:o.onKeyDown,disabled:o.props.isDisabled,ref:o.setInputRef,onFocus:o.moveCaretAtEnd,autoFocus:!0})),o.props.showChataIcon&&s.createElement("div",{className:"chat-bar-input-icon"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"})),o.props.showLoadingDots&&o.state.isQueryRunning&&s.createElement("div",{className:"input-response-loading-container"},s.createElement(da,null)),o.props.enableVoiceRecord&&s.createElement(pa,{onTranscriptChange:o.onTranscriptChange,onFinalTranscript:o.onFinalTranscript,themeConfig:o.props.themeConfig,authentication:o.props.authentication})))})),_n(t.themeConfig),o.UNIQUE_ID=d(),o.autoCompleteTimer=void 0,o.autoCompleteArray=[],o.state={inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1},o}return it(a)}();lt(ma,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,enableVoiceRecord:p.bool,isDisabled:p.bool,onSubmit:p.func,onResponseCallback:p.func,className:p.string,autoCompletePlacement:p.string,showLoadingDots:p.bool,showChataIcon:p.bool,inputValue:p.string,queryFilters:p.arrayOf(p.shape({})),placeholder:p.string.isRequired,clearQueryOnSubmit:p.bool,sessionId:p.string,dataPageSize:p.number}),lt(ma,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,dataPageSize:void 0,onSubmit:function(){},onResponseCallback:function(){}});var fa=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"shouldComponentUpdate",(function(){return!1})),lt(mt(e),"render",(function(){return s.createElement(Te,st({},e.props,{key:e.props.tableKey,ref:e.props.tableRef}))})),e}return it(n)}();lt(fa,"defaultProps",{});var ga=function(e,t){return{sorters:ha(e,t),filters:va(e,t),page:null==e?void 0:e.page}},ha=function(e,t){var n,a=[];return(null==e||null===(n=e.sorters)||void 0===n?void 0:n.length)>0&&e.sorters.forEach((function(e){try{var n=t.table.getColumn(e.field).getDefinition().name,o=e.dir.toUpperCase();n&&o&&a.push({name:n,sort:o})}catch(e){console.error(e)}})),a},va=function(e,t){var n,a=[];return(null==e||null===(n=e.filters)||void 0===n?void 0:n.length)>0&&e.filters.forEach((function(e){try{var n=t.table.getColumn(e.field).getDefinition(),o={name:n.name,value:e.value,operator:"like"};if(cn(n)){var r=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=r.operator,o.value=r.value}a.push(o)}catch(e){console.warn(e)}})),a};function ya(e){return s.createElement(yt,null,s.createElement("div",st({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}var ba=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.firstRender=!1,o.setTableHeaderValues=setTimeout((function(){o.setInitialHeaderFilters(),o.setFilterTags({isFilteringTable:!1})}),100)})),lt(mt(o),"componentDidUpdate",(function(t,n){if(o.ref&&(o.setDimensionsTimeout=setTimeout((function(){if(o._isMounted){var t=e(o.ref,"ref.offsetHeight");t&&(o.tableHeight=t)}}),0)),o.props.isResizing&&(o.isResizing=!0),!o.state.isFilteringTable&&n.isFilteringTable)try{o.setFilterTags({isFilteringTable:o.state.isFilteringTable})}catch(e){console.error(e),o.props.onErrorCallback(e)}})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.setTableHeaderValues),clearTimeout(o.setDimensionsTimeout),o.resetFilterTags(),o.existingFilterTag=void 0,o.filterTagElements=void 0})),lt(mt(o),"setInitialHeaderFilters",(function(){e(o.props,"headerFilters.length")&&e(o.ref,"table")&&o.props.headerFilters.forEach((function(e){o.ref.table.setHeaderFilterValue(e.field,e.value)}))})),lt(mt(o),"cellClick",(function(e,t){o.props.onCellClick(t)})),lt(mt(o),"copyToClipboard",(function(){var e;o._isMounted&&null!==(e=o.ref)&&void 0!==e&&e.table&&o.ref.table.copyToClipboard("active",!0)})),lt(mt(o),"saveAsCSV",(function(e){try{var t;if(o._isMounted&&null!==(t=o.ref)&&void 0!==t&&t.table){var n=ce(o.ref.table);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()})),lt(mt(o),"resetFilterTags",(function(){var e;null!==(e=o.filterTagElements)&&void 0!==e&&e.length&&o.filterTagElements.forEach((function(e){try{e.parentNode&&o._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),lt(mt(o),"setFilterTags",(function(){var e,t;o.resetFilterTags(),o._isMounted&&null!==(e=o.ref)&&void 0!==e&&e.table&&(t=o.ref.table.getHeaderFilters()),t&&t.forEach((function(e,t){try{var n=e.field;o.filterTagElements[n]=document.createElement("span"),o.filterTagElements[n].innerText="F",o.filterTagElements[n].setAttribute("class","filter-tag"),o.columnTitleEl=document.querySelector("#react-autoql-table-container-".concat(o.TABLE_ID,' .tabulator-col[tabulator-field="').concat(n,'"] .tabulator-col-title')),o.columnTitleEl.insertBefore(o.filterTagElements[n],o.columnTitleEl.firstChild)}catch(e){console.error(e),o.props.onErrorCallback(e)}}))})),lt(mt(o),"toggleTableFilter",(function(e){var t=e.isFilteringTable;o.setState({isFilteringTable:t})})),lt(mt(o),"getTableHeight",(function(){return o.tableHeight?"".concat(o.tableHeight,"px"):"".concat(e(o.props,"style.height"),"px")})),lt(mt(o),"renderPageLoader",(function(){return s.createElement("div",{className:"table-loader table-page-loader"},s.createElement(ya,null))})),lt(mt(o),"renderScrollLoader",(function(){return s.createElement("div",{className:"table-loader table-scroll-loader"},s.createElement(ya,null))})),lt(mt(o),"render",(function(){var e=o.getTableHeight();return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-table-container-".concat(o.TABLE_ID),ref:function(e){return o.tableContainer=e},"data-test":"react-autoql-table",className:"react-autoql-table-container \n ".concat(o.props.supportsDrilldowns?"supports-drilldown":"","\n ").concat(o.state.isFilteringTable?"filtering":"","\n ").concat(o.props.isResizing?"resizing":"","\n ").concat(o.supportsInfiniteScroll?"infinite":"limited","\n ").concat(o.state.isLastPage?"last-page":""),style:$e($e({},o.props.style),{},{flexBasis:e})},o.props.data&&o.props.columns&&s.createElement(fa,{tableRef:function(e){return o.ref=e},tableKey:"react-autoql-table-".concat(o.TABLE_ID),id:"react-autoql-table-".concat(o.TABLE_ID),key:"react-autoql-table-wrapper-".concat(o.TABLE_ID),"data-test":"autoql-tabulator-table",columns:o.props.columns,data:o.supportsInfiniteScroll?[]:o.props.data,cellClick:o.cellClick,options:o.tableOptions,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",clipboard:!0,download:!0}),o.state.pageLoading&&o.renderPageLoader(),o.state.scrollLoading&&o.renderScrollLoader()))})),o.TABLE_ID=d(),o.firstRender=!0,o.hasSetInitialData=!1,o.ref=null,o.currentPage=1,o.filterTagElements=[],o.headerFilters=[],o.queryID=t.queryID,o.supportsInfiniteScroll=t.useInfiniteScroll&&!!t.pageSize,o.tableOptions={dataLoadError:function(e){console.error(e)},selectableCheck:function(){return!1},layout:"fitDataFill",textSize:"9px",clipboard:!0,download:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1},cellClick:o.cellClick,dataSorting:function(e){},dataFiltering:function(){var e,t,n=null===(e=o.ref)||void 0===e||null===(t=e.table)||void 0===t?void 0:t.getData();null!=n&&n.length&&(o.data=n)},dataFiltered:function(e,n){var a,r,i=null===(a=o.ref)||void 0===a||null===(r=a.table)||void 0===r?void 0:r.getHeaderFilters();o.supportsInfiniteScroll?t.onFilterCallback(i,n):!o.supportsInfiniteScroll&&o._isMounted&&o.ref&&!o.firstRender&&(se(i,o.headerFilters)||(o.headerFilters=i,t.onFilterCallback(i,n)))},downloadReady:function(e,t){return t}},o.supportsInfiniteScroll&&(o.tableOptions.ajaxProgressiveLoad=o.supportsInfiniteScroll?"scroll":void 0,o.tableOptions.ajaxProgressiveLoadScrollMargin=800,o.tableOptions.ajaxURL="https://required-placeholder-url.com",o.tableOptions.ajaxSorting=!0,o.tableOptions.ajaxFiltering=!0,o.tableOptions.virtualDomHoz=!0,o.tableOptions.progressiveRenderSize=5,o.tableOptions.progressiveRenderMargin=100,o.tableOptions.ajaxLoader=!0,o.tableOptions.ajaxLoaderLoading="",o.tableOptions.ajaxLoaderError="",o.tableOptions.ajaxRequestFunc=function(){var n=at(et().mark((function n(a,r,i){var l,s,c,u,p,d,m;return et().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,l=ga(i,o.ref),!se(o.previousTableConfigState,l)){n.next=4;break}return n.abrupt("return",Promise.resolve());case 4:if(o.previousTableConfigState=l,o.hasSetInitialData){n.next=8;break}return o.hasSetInitialData=!0,n.abrupt("return",Promise.resolve({rows:o.props.data,page:1}));case 8:if(!((null==i?void 0:i.page)>1)){n.next=16;break}return o.setState({scrollLoading:!0}),n.next=12,Zn($e($e($e({},Jt(t.authentication)),l),{},{queryId:o.queryID}));case 12:s=n.sent,o.props.onNewPage(null===(c=s)||void 0===c?void 0:c.rows),n.next=27;break;case 16:if(t.queryRequestData){n.next=20;break}console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),n.next=27;break;case 20:return o.setState({pageLoading:!0}),n.next=23,$n($e($e($e({},Jt(t.authentication)),t.queryRequestData),{},{pageSize:t.pageSize,orders:null==l?void 0:l.sorters,tableFilters:null==l?void 0:l.filters}));case 23:m=n.sent,o.queryID=null==m||null===(u=m.data)||void 0===u||null===(p=u.data)||void 0===p?void 0:p.query_id,s=$e($e({},e(m,"data.data",{})),{},{page:1}),o.props.onNewData(null===(d=s)||void 0===d?void 0:d.rows);case 27:return o.setState({scrollLoading:!1,pageLoading:!1}),n.abrupt("return",s);case 31:return n.prev=31,n.t0=n.catch(0),o.setState({scrollLoading:!1,pageLoading:!1}),n.abrupt("return",Promise.resolve());case 35:case"end":return n.stop()}}),n,null,[[0,31]])})));return function(e,t,a){return n.apply(this,arguments)}}(),o.tableOptions.ajaxResponse=function(n,a,r){if(!r)return{data:o.data,last_page:o.lastPage};o.currentPage=r.page;var i=e(r,"rows.length",0)<t.pageSize;o.lastPage=i?o.currentPage:o.currentPage+1,i?o.setState({isLastPage:!0}):o.setState({isLastPage:!1});var l={};return l.data=r.rows,l.last_page=o.lastPage,l},o.tableOptions.ajaxError=function(e){console.error(e)}),o.state={isFilteringTable:!1,pageLoading:!1,scrollLoading:!1,isLastPage:!1},o}return it(a)}();lt(ba,"propTypes",{themeConfig:St,data:p.arrayOf(p.array),columns:p.arrayOf(p.shape({})),onFilterCallback:p.func,isResizing:p.bool,pageSize:p.number,useInfiniteScroll:p.bool}),lt(ba,"defaultProps",{themeConfig:Xt,queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:0,useInfiniteScroll:!0,source:[],onFilterCallback:function(){},onCellClick:function(){},onErrorCallback:function(){}});var Ca={themeConfig:St,dataFormatting:Ct,data:p.arrayOf(p.array).isRequired,columns:p.arrayOf(p.shape({})).isRequired,numberColumnIndices:p.arrayOf(p.number).isRequired,stringColumnIndices:p.arrayOf(p.number).isRequired,stringColumnIndex:p.number.isRequired,numberColumnIndex:p.number.isRequired,legendColumnIndex:p.number,enableDynamicCharting:p.bool,isResizing:p.bool,onLegendClick:p.func,onLabelChange:p.func,onXAxisClick:p.func,onYAxisClick:p.func},Ea={themeConfig:Xt,dataFormatting:Wt,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},Sa=$e($e({},Ca),{},{visibleSeriesIndices:p.arrayOf(p.number).isRequired,height:p.number.isRequired,width:p.number.isRequired,leftMargin:p.number,rightMargin:p.number,topMargin:p.number,bottomMargin:p.number}),Ta=$e($e({},Ea),{},{leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0}),Da=$e($e({},Sa),{},{xScale:p.func.isRequired,yScale:p.func.isRequired,xCol:p.shape({}).isRequired,yCol:p.shape({}).isRequired,xTicks:p.array,yTicks:p.array,xGridLines:p.bool,yGridLines:p.bool,rotateLabels:p.bool,hasRightLegend:p.bool,hasBottomLegend:p.bool,hasXDropdown:p.bool,hasYDropdown:p.bool,xAxisTitle:p.string,yAxisTitle:p.string,legendTitle:p.string}),xa=$e($e({},Ta),{},{xTicks:void 0,yTicks:void 0,xGridLines:!1,yGridLines:!1,rotateLabels:!1,hasRightLegend:!1,hasBottomLegend:!1,hasXDropdown:!1,hasYDropdown:!1,xAxisTitle:void 0,yAxisTitle:void 0,legendTitle:void 0}),ka=$e($e({},Sa),{},{xScale:p.func.isRequired,yScale:p.func.isRequired}),wa={activeKey:void 0,onChartClick:function(){}},Aa=function(e,t){var n,a;return(null===(n=e.data)||void 0===n?void 0:n.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||e.stringColumnIndex!==t.stringColumnIndex||e.numberColumnIndex!==t.numberColumnIndex||!se(e.legendColumn,t.legendColumn)||!se(e.columns,t.columns)||!se(e.numberColumnIndices,t.numberColumnIndices)||!se(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!se(e.data,t.data)},Na=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)},Ra=function(e,t){return"".concat(e,"-").concat(t)},Ma=function(e,t){var n,a;return t.marginAdjustmentFinished&&((null==e||null===(n=e.data)||void 0===n?void 0:n.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||!se(e.numberColumnIndices,t.numberColumnIndices)||!se(e.legendLabels,t.legendLabels)||e.stringColumnIndex!==t.stringColumnIndex)},Va=function(e){var t=e.row,n=e.columns,a=e.colIndex,o=e.stringColumnIndex,r=e.legendColumn,i=e.dataFormatting;try{var l=n[o],s=n[a],c=l.title,u=s.origColumn?s.origColumn.title:s.title,p=Tn({element:t[o],column:l,config:i}),d=Tn({element:t[a]||0,column:n[a],config:i}),m=n[a],f=r&&null!=m&&m.origColumn?"<div><strong>".concat(r.title,":</strong> ").concat(m.title,"</div>"):"",g="<div><strong>".concat(c,":</strong> ").concat(p,"</div>"),h="<div><strong>".concat(u,":</strong> ").concat(d,"</div>");return"<div>\n ".concat(f,"\n ").concat(g,"\n ").concat(h,"\n </div>")}catch(e){return console.error(e),null}},qa=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return 0}},Ia=function(e,t,n){var a={},o={};return e.forEach((function(e){var r=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?a[r]?a[r]+=i:a[r]=i:i<0&&(o[r]?o[r]-=i:o[r]=i)}))})),{maxValue:La(a),minValue:Oa(o)}},Pa=function(e){if("object"===tt(e))return Object.keys(e).length},La=function(e){var t=Pa(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=ht(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.max.apply(Math,ht(a))}return n},Oa=function(e){var t=Pa(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=ht(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.min.apply(Math,ht(a))}return n},Fa=function(e,t){try{var n=[],a=[];t.forEach((function(t,o){n.push(ke(e,(function(e){return qa(e[t])}))),a.push(we(e,(function(e){return qa(e[t])})))}));var o=ke(n),r=we(a);return o===r&&(r>0?r=0:o<0&&(o=0)),{minValue:r,maxValue:o}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},Qa=function(t,n){if(!((null==t?void 0:t.length)<2)&&"pie"!==n&&"heatmap"!==n&&"bubble"!==n)return"stacked_column"===n||"stacked_bar"===n||"stacked_line"===n||e(t,"length")>2||e(t,"length")>1?"right":void 0},za=function(e,t,n){try{var a=Math.ceil(30*n.length/t);if(e<30){var o=[];return n.forEach((function(e,t){t%a==0&&o.push(e)})),o}}catch(e){console.error(e)}return n},Ha=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"openSelector",(function(){a.setState({isOpen:!0})})),lt(mt(a),"closeSelector",(function(){a.setState({isOpen:!1})})),lt(mt(a),"renderSelectorContent",(function(){return s.createElement("div",{className:"axis-selector-container",id:"legend-selector-content",onClick:function(e){e.stopPropagation()}},s.createElement("ul",{className:"axis-selector-content"},a.props.stringColumnIndices.map((function(e,t){return s.createElement("li",{className:"string-select-list-item",key:d(),onClick:function(){a.props.onChangeLegendColumnIndex(t),a.closeSelector()}},e.label)}))))})),lt(mt(a),"render",(function(){return s.createElement(me,{isOpen:a.state.isOpen,content:a.renderSelectorContent(),onClickOutside:a.closeSelector,position:a.props.position,align:a.props.align},s.createElement("rect",st({},a.props.childProps,{className:"legend-title-border","data-test":"legend-title-border",onClick:a.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),a.state={isOpen:!1},a}return it(n)}();lt(Ha,"propTypes",Da),lt(Ha,"defaultProps",xa);var Ba=function(t){ct(a,u);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o.renderAxis(),(o.props.hasRightLegend||o.props.hasBottomLegend)&&o.renderLegend(),o.props.onLabelChange()})),lt(mt(o),"componentDidUpdate",(function(e){o.renderAxis(),!o.props.hasRightLegend&&!o.props.hasBottomLegend||se(o.props.legendLabels,e.legendLabels)||o.renderLegend(),o.props.rotateLabels!==e.rotateLabels&&o.props.onLabelChange()})),lt(mt(o),"componentWillUnmount",(function(){Gn(o.legendElement),Gn(o.legendSwatchElements),Gn(o.swatchElements)})),lt(mt(o),"styleLegendTitleNoBorder",(function(e){e.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").attr("data-test","legend-title")})),lt(mt(o),"styleLegendTitleWithBorder",(function(t){t.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").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=t.select(".legendTitle").node().getBBox()}catch(e){console.error(e)}xe(o.legendBorder).attr("class","legend-title-border").attr("width",e(o.titleBBox,"width",0)+20).attr("height",e(o.titleBBox,"height",0)+10).attr("x",e(o.titleBBox,"x",0)-10).attr("y",e(o.titleBBox,"y",0)-10).attr("stroke","transparent").attr("stroke-width","1px").attr("fill","transparent").attr("rx",4),o.legendElement=xe(o.legendBorder).node(),o.legendElement.parentNode.appendChild(o.legendElement)})),lt(mt(o),"renderLegend",(function(){try{var e=mt(o),t=o.props.legendLabels;if(!t)return;var n=o.getLegendScale(t);if(o.props.hasRightLegend){o.legendSVG=xe(o.rightLegendElement),o.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");var a=Re().shape("path",Me().type(Ve).size(75)()).orient("vertical").shapePadding(5).labelWrap(100).scale(n).on("cellclick",(function(n){e.props.onLabelChange({setLoading:!1}),e.props.onLegendClick(t.find((function(e){return e.label===n})))}));o.props.legendTitle&&a.title(o.props.legendTitle).titleWidth(100),o.legendSVG.call(a).style("font-family","inherit"),o.props.legendTitle&&(o.props.onLegendTitleClick?o.styleLegendTitleWithBorder(o.legendSVG):o.styleLegendTitleNoBorder(o.legendSVG));var r=xe(o.rightLegendElement).node().getBBox().width;xe(o.legendClippingContainer).attr("width",r+30),o.legendSVG.attr("clip-path","url(#legend-clip-area-".concat(o.LEGEND_ID,")"))}else if(o.props.hasBottomLegend){o.legendSVG=xe(o.bottomLegendElement),o.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");a=Re().shape("path",Me().type(Ve).size(75)()).orient("horizontal").shapePadding(e.LEGEND_PADDING).labelWrap(120).labelAlign("left").scale(n).on("cellclick",(function(t){e.props.onLegendClick(t)}));o.legendSVG.call(a).style("font-family","inherit")}o.applyStylesForHiddenSeries(t)}catch(e){console.error(e)}})),lt(mt(o),"applyStylesForHiddenSeries",(function(e){try{var t=e.filter((function(e){return e.hidden})).map((function(e){return e.label}));o.legendSwatchElements=document.querySelectorAll("#".concat(o.LEGEND_ID," .label")),o.legendSwatchElements&&o.legendSwatchElements.forEach((function(e,n){var a=[];e.querySelectorAll("tspan").forEach((function(e){a.push(e.textContent)}));var r=a.join(" ");o.swatchElements[n]=e.parentElement.querySelector(".swatch"),t.includes(r)?o.swatchElements[n].style.opacity=.3:o.swatchElements[n].style.opacity=1}))}catch(e){console.error(e)}})),lt(mt(o),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return Ce().domain(e.map((function(e){return e.label}))).range(t)})),lt(mt(o),"renderAxis",(function(){var e,t=mt(o),n="Bottom"===o.props.orient?Ae():Ne();n.scale(o.props.scale).tickSizeOuter(0).tickFormat((function(e){return Sn({d:e,col:t.props.col,config:t.props.dataFormatting}).formattedLabel})),null!==(e=o.props.ticks)&&void 0!==e&&e.length&&n.tickValues(o.props.ticks),o.props.showGridLines&&n.tickSizeInner(o.props.tickSizeInner),o.axisElement&&xe(o.axisElement).call(n),"Bottom"===o.props.orient&&o.props.rotateLabels?xe(o.axisElement).selectAll(".tick text").style("transform","rotate(-45deg)").style("text-anchor","end").attr("dy","0.5em").attr("dx","-0.5em").attr("fill-opacity","0.7").style("font-family","inherit"):"Bottom"!==o.props.orient||o.props.rotateLabels||xe(o.axisElement).selectAll(".tick text").style("transform","rotate(0deg)").style("text-anchor","middle").attr("dy","10px").attr("dx","0").attr("fill-opacity","0.7").style("font-family","inherit"),xe(o.axisElement).selectAll(".axis text").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").attr("data-for",o.props.tooltipID).attr("data-tip",(function(e){var n=Sn({d:e,col:t.props.col,config:t.props.dataFormatting}),a=n.fullWidthLabel;return n.isTruncated?a:null})).attr("data-effect","float"),xe(o.axisElement).selectAll(".axis path").style("display","none"),xe(o.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.15").style("shape-rendering","crispedges"),xe(o.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.4)})),lt(mt(o),"render",(function(){var t,n=(null===(t=o.props.numberColumnIndices)||void 0===t?void 0:t.length)||0,a=o.LEGEND_PADDING*(n-1)/2,r=o.props.leftMargin||0,i=o.props.height-o.props.topMargin-(o.props.rotateLabels?44:o.props.bottomMargin)+20;return i<0&&(i=0),s.createElement("g",{"data-test":"axis"},s.createElement("g",{className:"axis axis-".concat(o.props.orient,"\n ").concat(o.props.rotateLabels?" rotated":""),ref:function(e){o.axisElement=e},transform:o.props.translate}),o.props.hasRightLegend&&s.createElement("g",{ref:function(e){o.rightLegendElement=e},id:o.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(o.props.width+15,", ").concat(o.props.legendTitle?"30":"25",")")},s.createElement("clipPath",{id:"legend-clip-area-".concat(o.LEGEND_ID)},s.createElement("rect",{ref:function(e){o.legendClippingContainer=e},id:"legend-bounding-box-".concat(o.LEGEND_ID),height:i,width:o.props.rightMargin+30,style:{transform:"translate(-30px, -30px)"}})),o.props.legendColumn&&s.createElement(Ha,st({},o.props,{column:o.props.legendColumn,position:"bottom",align:"end",childProps:{ref:function(e){return o.legendBorder=e},x:e(o.titleBBox,"x",0)-10,y:e(o.titleBBox,"y",0)-10,width:e(o.titleBBox,"width",0)+20,height:e(o.titleBBox,"height",0)+10}}))),o.props.hasBottomLegend&&s.createElement("g",{ref:function(e){o.bottomLegendElement=e},"data-test":"bottom-legend",id:o.LEGEND_ID,className:"legendOrdinal",transform:"translate(".concat((o.props.width-r)/2+r-a,",").concat(o.props.height-30,")")}))})),o.LEGEND_PADDING=130,o.LEGEND_ID="axis-".concat(d()),o.swatchElements=[],o}return it(a)}();lt(Ba,"propTypes",$e($e({},Da),{},{scale:p.func.isRequired,col:p.shape({}).isRequired,ticks:p.array,orient:p.string,tickSizeInner:p.number,translate:p.string})),lt(Ba,"defaultProps",$e($e({},xa),{},{orient:"Bottom",ticks:void 0,tickSizeInner:void 0,translate:void 0}));var _a=["label","type","indeterminate","hasError","style","onChange","checked"],Ua=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),lt(mt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),lt(mt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),lt(mt(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=dt(t,_a),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":"","\n ").concat(o?"react-autoql-checkbox--has-error__input":"","\n ");return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox",style:e.props.style},s.createElement("div",{className:i},s.createElement("input",st({},r,{type:"checkbox",className:l,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&s.createElement("div",{className:"react-autoql-checkbox-tick"},s.createElement(Kt,{type:"check"})),n&&s.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return it(n)}();lt(Ua,"propTypes",{hasError:p.bool,indeterminate:p.bool,label:p.string,type:p.oneOf(["default","switch"]),checked:p.bool,onChange:p.func}),lt(Ua,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var ja=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",{selected:[]}),lt(mt(t),"unselectAll",(function(){t.setState({selected:[]})})),lt(mt(t),"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})),lt(mt(t),"handleShiftSelect",(function(e){if(t.state.selected.length){var n=Math.min.apply(Math,ht(t.state.selected)),a=[e];e<n?a=t.interpolateArray(e,n):e>n&&(a=t.interpolateArray(n,e)),t.props.onSelect(a),t.setState({selected:a})}else t.props.onSelect([e]),t.setState({selected:[e]})})),lt(mt(t),"handleCtrlSelect",(function(e){var n=[];n=t.state.selected.includes(e)?t.state.selected.filter((function(t){return t!==e})):[].concat(ht(t.state.selected),[e]),t.props.onSelect(n),t.setState({selected:n})})),lt(mt(t),"handleMultipleCheck",(function(e){t.state.selected.every((function(t){return e[t].checked}))?t.state.selected.forEach((function(t){e[t].checked=!1})):t.state.selected.forEach((function(t){e[t].checked=!0})),t.props.onChange(e)})),lt(mt(t),"render",(function(){var n=ce(t.props.items);return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list",onClick:function(e){e.stopPropagation()}},!!e(t.props.columns,"length")&&s.createElement("div",{className:"col-visibility-header"},t.props.columns.map((function(e,a){if(a===t.props.columns.length-1){var o=n.every((function(e){return e.checked}));return s.createElement("div",{key:"list-header-".concat(d())},e.name,s.createElement(Ua,{checked:o,style:{marginLeft:"10px"},onChange:function(){o?n.forEach((function(e){e.checked=!1})):n.forEach((function(e){e.checked=!0})),t.props.onChange(n)}}))}return s.createElement("div",{key:"list-header-".concat(d())},e.name)}))),n.map((function(e,a){return s.createElement("div",{key:"list-item-".concat(d()),className:"react-autoql-list-item".concat(t.state.selected.includes(a)?" selected":""),onClick:function(e){e.shiftKey?t.handleShiftSelect(a):e.ctrlKey||e.metaKey?t.handleCtrlSelect(a):(t.props.onSelect([a]),t.setState({selected:[a]}))}},s.createElement("div",null,e.content," "),s.createElement("div",null,s.createElement(Ua,{checked:e.checked,onChange:function(){t.state.selected.length>1&&t.state.selected.includes(a)?t.handleMultipleCheck(n):(e.checked=!e.checked,t.props.onChange(n))}})))}))))})),t}return it(a)}();lt(ja,"propTypes",{themeConfig:St,columns:p.arrayOf(p.shape({})),items:p.arrayOf(p.shape({}))}),lt(ja,"defaultProps",{themeConfig:Xt,onChange:function(){},onSelect:function(){},columns:[],items:[]});var Ka=["default","primary","danger"],Ga=["small","large"],Wa=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"COMPONENT_KEY","react-autoql-btn-".concat(d())),lt(mt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Ka.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),lt(mt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(Ga.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),lt(mt(e),"render",(function(){var t=e.getType(),n=e.getSize(),a=e.props.loading||e.props.disabled;return s.createElement(yt,null,s.createElement("button",{className:"react-autoql-btn\n ".concat(e.props.className||"","\n ").concat(t,"\n ").concat(n,"\n ").concat(a?" disabled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:$e({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.COMPONENT_KEY},e.props.loading&&s.createElement(ya,{"data-test":"react-autoql-btn-loading"}),e.props.children),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:e.COMPONENT_KEY,effect:"solid",delayShow:500,place:"top"}))})),e}return it(n)}();lt(Wa,"propTypes",{type:p.oneOf(Ka),size:p.oneOf(Ga),onClick:p.func,loading:p.bool,disabled:p.bool,multiline:p.bool,tooltip:p.string}),lt(Wa,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var Ya=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidUpdate",(function(e){Aa(o.props,e)&&o.setState($e({},o.getSelectorState(o.props)))})),lt(mt(o),"openSelector",(function(){o.setState({isOpen:!0})})),lt(mt(o),"closeSelector",(function(){o.setState({isOpen:!1})})),lt(mt(o),"getSelectorState",(function(t){var n=t.columns,a=t.numberColumnIndices;if(n&&a){var o=[],r=[],i=[];return n.forEach((function(e,t){if(e.is_visible&&!e.pivot){var n={content:e.title,checked:a.includes(t),columnIndex:t};"DOLLAR_AMT"===e.type?o.push(n):"QUANTITY"===e.type?r.push(n):"RATIO"!==e.type&&"PERCENT"!==e.type||i.push(n)}})),{activeNumberType:e(n,"[".concat(a[0],"].type")),currencySelectorState:o,quantitySelectorState:r,ratioSelectorState:i}}})),lt(mt(o),"renderSelectorContent",(function(e){var t=o.state,n=t.currencySelectorState,a=t.quantitySelectorState,r=t.ratioSelectorState;return s.createElement("div",{id:"chata-chart-popover",onClick:function(e){e.stopPropagation()}},s.createElement("div",{className:"axis-selector-container"},!!n.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"},o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Currency"),s.createElement(ja,{ref:function(e){return o.currencySelectRef=e},items:n,onSelect:function(){o.quantitySelectRef&&o.quantitySelectRef.unselectAll(),o.ratioSelectRef&&o.ratioSelectRef.unselectAll()},onChange:function(e){var t=a.map((function(e){return $e($e({},e),{},{checked:!1})})),n=r.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"DOLLAR_AMT",currencySelectorState:e,quantitySelectorState:t,ratioSelectorState:n})}})),!!a.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"}," ",o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Quantity"),s.createElement(ja,{ref:function(e){return o.quantitySelectRef=e},items:a,onSelect:function(){o.currencySelectRef&&o.currencySelectRef.unselectAll(),o.ratioSelectRef&&o.ratioSelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return $e($e({},e),{},{checked:!1})})),a=r.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"QUANTITY",quantitySelectorState:e,currencySelectorState:t,ratioSelectorState:a})}})),!!r.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"}," ",o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Ratio"),s.createElement(ja,{ref:function(e){return o.ratioSelectRef=e},items:r,onSelect:function(){o.currencySelectRef&&o.currencySelectRef.unselectAll(),o.quantitySelectRef&&o.quantitySelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return $e($e({},e),{},{checked:!1})})),r=a.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"RATIO",ratioSelectorState:e,currencySelectorState:t,quantitySelectorState:r})}}))),s.createElement("div",{className:"axis-selector-apply-btn"},s.createElement(Wa,{style:{width:"calc(100% - 10px)"},type:"primary",disabled:o.state.ratioSelectorState.every((function(e){return!e.checked}))&&o.state.currencySelectorState.every((function(e){return!e.checked}))&&o.state.quantitySelectorState.every((function(e){return!e.checked})),onClick:function(){var e=[];if("DOLLAR_AMT"===o.state.activeNumberType?e=o.state.currencySelectorState:"QUANTITY"===o.state.activeNumberType?e=o.state.quantitySelectorState:"RATIO"===o.state.activeNumberType&&(e=o.state.ratioSelectorState),e.length){o.closeSelector();var t=e.filter((function(e){return e.checked})).map((function(e){return e.columnIndex}));o.props.changeNumberColumnIndices(t)}}},"Apply")))})),lt(mt(o),"render",(function(){return s.createElement(me,{isOpen:o.state.isOpen,content:o.renderSelectorContent(),onClickOutside:o.closeSelector,position:o.props.position,align:o.props.align},s.createElement("rect",st({},o.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:o.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),o.currencySelectRef,o.quantitySelectRef,o.ratioSelectRef,o.state=$e($e({},o.getSelectorState(t)),{},{isOpen:!1}),o}return it(a)}();lt(Ya,"propTypes",Da),lt(Ya,"defaultProps",xa);var Xa=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"openSelector",(function(){o.setState({isOpen:!0})})),lt(mt(o),"closeSelector",(function(){o.setState({isOpen:!1})})),lt(mt(o),"renderSelectorContent",(function(){return s.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},s.createElement("ul",{className:"axis-selector-content"},o.props.stringColumnIndices.map((function(t,n){return s.createElement("li",{className:"string-select-list-item ".concat(t===o.props.stringColumnIndex?"active":""),key:d(),onClick:function(){o.closeSelector(),o.props.changeStringColumnIndex(t)}},e(o.props.columns,"[".concat(t,"].title")))}))))})),lt(mt(o),"render",(function(){return s.createElement(me,{isOpen:o.state.isOpen,content:o.renderSelectorContent(),onClickOutside:o.closeSelector,position:o.props.position,align:o.props.align},s.createElement("rect",st({},o.props.childProps,{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 it(a)}();lt(Xa,"propTypes",Da),lt(Xa,"defaultProps",xa);var Ja=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"render",(function(){return cn(e.props.column)?s.createElement(Ya,st({"data-test":"number-axis-selector"},e.props)):un(e.props.column)?s.createElement(Xa,st({"data-test":"string-axis-selector"},e.props)):null})),e}return it(n)}();lt(Ja,"propTypes",Da),lt(Ja,"defaultProps",xa);var Za=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"renderAxisLabel",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e.length>35?s.createElement("tspan",{"data-tip":e,"data-for":a.props.tooltipID,"data-test":"axis-label"},"".concat(e.substring(0,35),"...")):s.createElement("tspan",{"data-test":"axis-label"},e,t&&s.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),lt(mt(a),"renderXAxisLabel",(function(e){var t=(a.props.width-a.props.leftMargin)/2+a.props.leftMargin,n=a.props.height-(a.props.bottomLegendMargin||0)-15,o=xn(a.xLabelRef),r=o?o.width:0,i=o?o.height:0;return s.createElement("g",null,s.createElement("text",{ref:function(e){return a.xLabelRef=e},className:"x-axis-label","data-test":"x-axis-label",textAnchor:"middle",fontWeight:"bold",y:n,x:t,style:a.labelInlineStyles},a.renderAxisLabel(e,a.props.hasXDropdown)),a.props.hasXDropdown&&s.createElement(Ja,st({},a.props,{column:a.props.xCol,position:"top",align:"end",childProps:{x:t-r/2-10,y:n-16,width:r+20,height:i+10}})))})),lt(mt(a),"renderYAxisLabel",(function(e){var t=-(a.props.height-a.props.bottomMargin)/2,n=xn(a.yLabelRef),o=n?n.width:0,r=n?n.height:0;return s.createElement("g",null,s.createElement("text",{ref:function(e){return a.yLabelRef=e},className:"y-axis-label","data-test":"y-axis-label",textAnchor:"middle",transform:"rotate(-90)",fontWeight:"bold",x:t,y:20,style:a.labelInlineStyles},a.renderAxisLabel(e,a.props.hasYDropdown)),a.props.hasYDropdown&&s.createElement(Ja,st({},a.props,{column:a.props.yCol,position:"right",align:"center",childProps:{x:t-o/2-10,y:4,width:o+20,height:r+10,transform:"rotate(-90)"}})))})),lt(mt(a),"renderXAxis",(function(e){return s.createElement(Ba,st({},a.props,{key:a.xAxisKey,orient:"Bottom",scale:a.props.xScale,translate:"translate(0, ".concat(a.props.height-a.props.bottomMargin,")"),tickSizeInner:-a.props.height+a.props.topMargin+a.props.bottomMargin,ticks:a.props.xTicks,width:a.props.width-a.props.rightMargin,col:a.props.xCol,title:e,showGridLines:a.props.xGridLines}))})),lt(mt(a),"renderYAxis",(function(e){return s.createElement(Ba,st({},a.props,{key:a.yAxisKey,orient:"Left",scale:a.props.yScale,translate:"translate(".concat(a.props.leftMargin,", 0)"),tickSizeInner:-a.props.width+a.props.leftMargin+a.props.rightMargin,ticks:a.props.yTicks,height:a.props.height,width:a.props.width-a.props.rightMargin,col:a.props.yCol,title:e,showGridLines:a.props.yGridLines}))})),lt(mt(a),"render",(function(){var e,t;if(!(a.props.yScale&&a.props.xScale&&a.props.height&&a.props.width&&a.props.xCol&&a.props.yCol))return null;var n=a.props.xAxisTitle||(null===(e=a.props.xCol)||void 0===e?void 0:e.display_name),o=a.props.yAxisTitle||(null===(t=a.props.yCol)||void 0===t?void 0:t.display_name);return s.createElement("g",null,a.renderYAxisLabel(o),a.renderXAxisLabel(n),s.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},a.renderXAxis(n),a.renderYAxis(o)))})),a.xAxisKey=d(),a.yAxisKey=d(),a.labelInlineStyles={fontSize:12,fontFamily:"inherit",fill:"currentColor",fillOpacity:.7,cursor:"default"},a}return it(n)}();lt(Za,"propTypes",Da),lt(Za,"defaultProps",xa);var $a=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,o=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.xScale,c=t.yScale,u=o.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=l.bandwidth()/u.length,m=0;return o.forEach((function(t,o){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=f<0?Na(c):c(f),h=Math.abs(c(f)-Na(c));if((isNaN(h)||isNaN(f))&&(g=Na(c),h=0),h<.05)return null;var v=l(u[r])+m*d,y=Va({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:a,dataFormatting:i}),b=Ra(t,p);return s.createElement("rect",{key:b,className:"bar".concat(e.state.activeKey===b?" active":""),"data-test":"bar-".concat(o,"-").concat(p),x:v,y:g,height:h,width:d,onClick:function(){return e.onColumnClick(u,t,p)},"data-tip":y,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(o),fillOpacity:.7}})}))),m+=1)})),s.createElement("g",{"data-test":"columns"},p)})),e}return it(n)}();lt($a,"propTypes",ka),lt($a,"defaultProps",wa);var eo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Fa(e.data,n),r=o.minValue,i=o.maxValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yScale=Se().domain([r,i]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=Bn(a.xScale,e.innerPadding),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-column-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,xAxisTitle:a.props.stringAxisTitle,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement($a,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(eo,"propTypes",Sa),lt(eo,"defaultProps",Ta);var to=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onBarClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale,u=o.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=l.bandwidth()/u.length,m=0;return o.forEach((function(t,o){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=Math.abs(c(f)-Na(c));if(Number.isNaN(g)&&(g=0),g<.05)return null;var h=l(u[r])+m*d,v=Va({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(t,p),className:"bar".concat(e.state.activeKey===Ra(t,p)?" active":""),"data-test":"bar-".concat(o,"-").concat(p),y:h,x:f>0?Na(c):c(f),width:g,height:d,onClick:function(){return e.onBarClick(u,t,p)},"data-tip":v,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(o),fillOpacity:.7}})}))),m+=1)})),s.createElement("g",{"data-test":"bars"},p)})),e}return it(n)}();lt(to,"propTypes",ka),lt(to,"defaultProps",wa);var no=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=Hn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xLabelArray,e.columns[e.numberColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Fa(e.data,n),r=o.minValue,i=o.maxValue;a.xScale=Se().domain([r,i]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yLabelArray=e.data.map((function(t){return t[e.stringColumnIndex]})),a.xLabelArray=a.xScale.ticks(),a.barHeight=e.height/e.data.length,a.yTickValues=za(a.barHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-bar-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.numberColumnIndex],yCol:a.props.columns[a.props.stringColumnIndex],yTicks:a.yTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,xAxisTitle:a.props.numberAxisTitle,yAxisTitle:a.props.stringAxisTitle,xGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(to,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(no,"propTypes",Sa),lt(no,"defaultProps",Ta);var ao=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onDotClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"makePolyline",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,o=t.stringColumnIndex,r=t.yScale,i=t.xScale,l=[];return a.forEach((function(t,a){var c=[];n[t].isSeriesHidden||e.props.data.forEach((function(n,a){var l=n[t],s=e.props.data[a-1],u=e.props.data[a+1];if(!(!(0===a||a===e.props.data.length-1)&&Math.abs(r(l)-r(null==s?void 0:s[t]))<.05&&Math.abs(r(null==s?void 0:s[t])-r(null==u?void 0:u[t]))<.05)){var p=i.bandwidth()/2,d=r.domain()[0],m=[i(n[o])+p,r(l||d)];c.push(m)}}));var u=c.map((function(e){return e.join(",")})).join(" "),p=s.createElement("polyline",{key:"line-".concat(Ra(0,a)),className:"line",points:u,fill:"none",stroke:e.props.colorScale(a),strokeWidth:1,opacity:.7});l.push(p)})),l})),lt(mt(e),"makeDots",(function(t){var n=e.props,a=n.columns,o=n.legendColumn,r=n.numberColumnIndices,i=n.stringColumnIndex,l=n.dataFormatting,c=n.yScale,u=n.xScale,p=[];return r.forEach((function(t,n){a[t].isSeriesHidden||e.props.data.forEach((function(r,d){var m=r[t];if(m){var f=c(m);if(!(f<.05)){var g=u.bandwidth()/2,h=Va({row:r,columns:a,colIndex:t,stringColumnIndex:i,legendColumn:o,dataFormatting:l});p.push(s.createElement("circle",{key:Ra(t,d),className:"line-dot".concat(e.state.activeKey===Ra(t,d)?" active":""),cy:f,cx:u(r[i])+g,r:3,onClick:function(){return e.onDotClick(r,t,d)},"data-tip":h,"data-for":e.props.tooltipID,style:{cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:2,strokeOpacity:.7,fillOpacity:1,opacity:0,fill:e.state.activeKey===Ra(t,d)?e.props.colorScale(n):e.props.backgroundColor||"#fff"}}))}}}))})),p})),lt(mt(e),"render",(function(){var t=e.props.numberColumnIndices.filter((function(t){return!e.props.columns[t].isSeriesHidden})).length;return t?s.createElement("g",{"data-test":"line"},e.makePolyline(),e.makeDots(t)):null})),e}return it(n)}();lt(ao,"propTypes",ka),lt(ao,"defaultProps",wa);var oo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n,o,r=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(r=e.visibleSeriesIndices);var i=Fa(e.data,r),l=i.minValue,s=i.maxValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Se().domain([l,s]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(o=n.domain())||void 0===o?void 0:o.length)||1),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-line-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,xAxisTitle:a.props.stringAxisTitle,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(ao,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(oo,"propTypes",Sa),lt(oo,"defaultProps",Ta);var ro=function(t){ct(a,u);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o.renderPie()})),lt(mt(o),"shouldComponentUpdate",(function(e,t){return!o.props.isResizing||!e.isResizing})),lt(mt(o),"componentDidUpdate",(function(){o.renderPie()})),lt(mt(o),"componentWillUnmount",(function(){Gn(o.legend),Gn(o.pieChartContainer)})),lt(mt(o),"renderPie",(function(){Gn(o.pieChartContainer);var e=mt(o);o.setPieRadius(),o.outerArc=qe().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=Ie().value((function(t,n){return t.value[e.props.numberColumnIndex]}));o.dataReady=t(Pe(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()})),lt(mt(o),"renderPieContainer",(function(){var e=o.props,t=e.width,n=e.height;o.pieChartContainer=xe(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,")"))})),lt(mt(o),"onSliceClick",(function(e){var t=e.data.key;t===o.state.activeKey?o.setState({activeKey:null}):(o.props.onChartClick(e.data.value,o.props.numberColumnIndex,o.props.columns,o.props.stringColumnIndex,o.props.legendColumn,o.props.numberColumnIndex,t),o.setState({activeKey:t}))})),lt(mt(o),"renderPieSlices",(function(){var e=mt(o);o.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",qe().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for",o.props.tooltipID).attr("data-tip",(function(t){return Va({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){xe(this).style("fill-opacity",1)})).on("mouseout",(function(e){xe(this).style("fill-opacity",.85)})).on("click",o.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){xe(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)+")"}}))}))})),lt(mt(o),"centerVisualization",(function(){var t,n=xe("#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;xe("#pie-chart-container-".concat(o.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),lt(mt(o),"onLegendClick",(function(e){var t,n=JSON.parse(e),a=null==n?void 0:n.dataIndex;if(null!==(t=o.state.legendLabels)&&void 0!==t&&t[a]){var r=ce(o.state.legendLabels);r[a].hidden=!o.state.legendLabels[a].hidden,o.setState({legendLabels:r})}le.rebuild()})),lt(mt(o),"renderLegend",(function(){var t,n=mt(o),a=o.props.height,r=en(o.props.themeConfig).chartColors;if(o.state.legendLabels){t=Ce().domain(o.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(r);var i=o.props.width/2-70;o.legend=xe(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=Re().shape("path",Me().type(Ve).size(75)()).orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).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),p=e(l,"width",0),d=o.props.width/2-p-20,m=u<a-20?(a-u)/2:15;o.legend.select(".legendOrdinal").attr("transform","translate(".concat(d,", ").concat(m,")")),o.applyStylesForHiddenSeries()}})),lt(mt(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}))})),lt(mt(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})),lt(mt(o),"render",(function(){return s.createElement("g",{id:"pie-chart-container-".concat(o.CHART_ID),"data-test":"react-autoql-pie-chart"},s.createElement("svg",{className:"pie-chart",ref:function(e){o.chartElement=e},width:o.props.width,height:o.props.height}),s.createElement("g",{ref:function(e){o.legendElement=e},id:o.LEGEND_ID,className:"legendOrdinal"}))})),o.CHART_ID=d(),o.LEGEND_ID="react-autoql-pie-legend-".concat(d()),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=en(t.themeConfig).chartColors;o.colorScale=Ce().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(Tn({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(o=t.columns)||void 0===o?void 0:o[t.stringColumnIndex]}),": ").concat(Tn({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 it(a)}();lt(ro,"propTypes",$e($e({},Sa),{},{backgroundColor:p.string,margin:p.number})),lt(ro,"defaultProps",$e($e({},Ta),{},{backgroundColor:"transparent",margin:40}));var io=function(e){ct(n,u);var t=gt(n);function n(e){var a;ot(this,n),lt(mt(a=t.call(this,e)),"onSquareClick",(function(e,t,n){var o=Ra(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,o),a.setState({activeKey:o})})),lt(mt(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,c=e.colorScale,u=e.yScale,p=e.xScale;if(!o.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){o.forEach((function(o,f){if(!t[o].isSeriesHidden){var g=e[o],h=Number(g),v=Number.isNaN(h)?0:h,y=e[r],b=l[f].label,C=v>=0?c(0):"rgba(221, 106, 106)",E=c(1),S=Va({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i});d.push(s.createElement("rect",{key:Ra(o,m),"data-test":"squares",className:"square".concat(a.state.activeKey===Ra(o,m)?" active":""),x:p(y),y:u(b),width:p.bandwidth(),height:u.bandwidth(),onClick:function(){return a.onSquareClick(e,o,m)},"data-tip":S,"data-for":a.props.tooltipID,stroke:E,strokeWidth:"2px",strokeOpacity:a.state.activeKey===Ra(o,m)?1:0,fill:a.state.activeKey===Ra(o,m)?E:C,fillOpacity:a.state.activeKey===Ra(o,m)?1:a.opacityScale(Math.abs(v))}))}}))})),s.createElement("g",null,d)}));var o=ke(e.data.map((function(t){return ke(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=we(e.data.map((function(t){return we(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.opacityScale=Se().domain([r,o]).range([0,1]),a.state={activeKey:a.props.activeChartElementKey},a}return it(n)}();lt(io,"propTypes",ka),lt(io,"defaultProps",wa);var lo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.squareHeight=e.height/a.yLabelArray.length,a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin+10,e.width-e.rightMargin]).paddingInner(.01),a.yScale=Ee().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(.01),a.xTickValues=za(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=za(a.squareHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-heatmap-chart",className:"react-autoql-heatmap-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn,xTicks:a.xTickValues,yTicks:a.yTickValues,rotateLabels:a.rotateLabels,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(io,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(lo,"propTypes",Sa),lt(lo,"defaultProps",Ta);var so=function(e){ct(n,u);var t=gt(n);function n(e){var a;ot(this,n),lt(mt(a=t.call(this,e)),"state",{activeKey:a.props.activeChartElementKey}),lt(mt(a),"onCircleClick",(function(e,t,n){var o=Ra(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,o),a.setState({activeKey:o})})),lt(mt(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,c=e.colorScale,u=e.yScale,p=e.xScale;if(!o.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){o.forEach((function(o,f){if(!t[o].isSeriesHidden){var g=e[o],h=Number(g),v=Number.isNaN(h)?0:h,y=e[r],b=l[f].label,C=Va({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i});d.push(s.createElement("circle",{key:Ra(o,m),"data-test":"circles",className:"circle".concat(a.state.activeKey===Ra(o,m)?" active":""),cx:p(y)+p.bandwidth()/2,cy:u(b)+u.bandwidth()/2,r:v<0?0:a.radiusScale(v)/2,onClick:function(){return a.onCircleClick(e,o,m)},"data-tip":C,"data-for":a.props.tooltipID,style:{stroke:"transparent",strokeWidth:10,fill:a.state.activeKey===Ra(o,m)?c(1):c(0),fillOpacity:.7}}))}}))})),s.createElement("g",null,d)}));var o=ke(e.data.map((function(t){return ke(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=we(e.data.map((function(t){return we(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.radiusScale=Se().domain([r,o]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),a}return it(n)}();lt(so,"propTypes",ka),lt(so,"defaultProps",wa);var co=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.circleHeight=e.height/a.yLabelArray.length,a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingOuter(.5),a.yScale=Ee().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]),a.xTickValues=za(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=za(a.circleHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{className:"react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn,xTicks:a.xTickValues,yTicks:a.yTickValues,rotateLabels:a.rotateLabels,yGridLines:!0})),s.createElement(so,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(co,"propTypes",Sa),lt(co,"defaultProps",Ta);var uo=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var u=e.props.data.map((function(t,u){var p=0,d=0;return o.map((function(o,m){if(!n[o].isSeriesHidden){var f,g,h=t[o],v=Number(h),y=Number.isNaN(v)?0:v;if(!y)return null;if(y>=0){var b=p+y;g=Math.abs(c(y)-c(0)-.5),f=c(p),p=b}else{var C=d+y;g=Math.abs(c(Math.abs(y))-c(0)-.5),f=c(C),d=C}if(g<.05)return null;var E=Va({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(o,u),className:"column".concat(e.state.activeKey===Ra(o,u)?" active":""),x:f,y:l(t[r]),width:g,height:l.bandwidth(),onClick:function(){return e.onColumnClick(t,o,u)},"data-tip":E,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return s.createElement("g",{"data-test":"stacked-bars"},u)})),e}return it(n)}();lt(uo,"propTypes",ka),lt(uo,"defaultProps",wa);var po=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=Hn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xLabelArray,e.columns[e.numberColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Ia(e.data,e.stringColumnIndex,n),r=o.maxValue,i=o.minValue;a.xScale=Se().domain([i,r]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yLabelArray=e.data.map((function(t){return t[e.stringColumnIndex]})),a.xLabelArray=a.xScale.ticks(),a.barHeight=e.height/e.data.length,a.yTickValues=za(a.barHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-bar-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.numberColumnIndex],yCol:a.props.columns[a.props.stringColumnIndex],yTicks:a.yTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,xAxisTitle:a.props.numberAxisTitle,yAxisTitle:a.props.stringAxisTitle,xGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(uo,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(po,"propTypes",Sa),lt(po,"defaultProps",Ta);var mo=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var u=e.props.data.map((function(t,u){var p=0,d=0;return o.map((function(o,m){if(!n[o].isSeriesHidden){var f,g,h=t[o],v=Number(h),y=Number.isNaN(v)?0:v;if(!y)return null;if(y>=0){var b=p+y;g=Math.abs(l(y)-l(0))-.5,f=l(b)+.5,p=b}else{var C=d+y;g=Math.abs(l(y)-l(0))-.5,f=l(d)+.5,d=C}if(g<.05)return null;var E=Va({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(o,u),className:"bar".concat(e.state.activeKey===Ra(o,u)?" active":""),x:c(t[r]),y:f,width:c.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,o,u)},"data-tip":E,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return s.createElement("g",{"data-test":"stacked-columns"},u)})),e}return it(n)}();lt(mo,"propTypes",ka),lt(mo,"defaultProps",wa);var fo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Ia(e.data,e.stringColumnIndex,n),r=o.maxValue,i=o.minValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yScale=Se().domain([i,r]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=Bn(a.xScale,e.innerPadding),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-column-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(mo,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(fo,"propTypes",Sa),lt(fo,"defaultProps",Ta);var go=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onDotClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"createPolygonVertexDot",(function(t,n,a,o,r,i){var l=Va({row:t,columns:e.props.columns,colIndex:r,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return s.createElement("circle",{key:"dot-".concat(Ra(r,i)),className:"vertex-dot".concat(e.state.activeKey===Ra(r,i)?" active":""),cy:o,cx:a,r:4,onClick:function(){return e.onDotClick(t,r,n)},"data-tip":l,"data-for":e.props.tooltipID,style:{opacity:e.state.activeKey===Ra(r,i)?1:0,cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),lt(mt(e),"createPolygon",(function(t,n){var a=e.props.stringColumnIndex,o=n.map((function(e){return e.join(",")})).join(" ");return s.createElement("polygon",{key:"polygon-".concat(Ra(a,t)),points:o,"data-tip":"\n <div>\n <strong>".concat(e.props.legendTitle,"</strong>: ").concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":e.props.tooltipID,"data-effect":"float",style:{fill:e.props.colorScale(t),fillOpacity:1}})})),lt(mt(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=[],c=[],u=r.domain()[0];u<0&&(u=0);var p=[],d=[];return i.domain().forEach((function(e){p.push(u),d.push([i(e),r(u)])})),a.forEach((function(t,a){var s=[],u=[];if(!n[t].isSeriesHidden){e.props.data.forEach((function(n,l){var d=n[t],m=Number(d),f=isNaN(m)?0:m,g=i(n[o]),h=p[l]+f,v=r(h);if(s[l]=h,u.push([g,v]),0!==f){var y=e.createPolygonVertexDot(n,a,g,v,t,l);c.push(y)}}));var m=d.reverse().concat(u);l.push(e.createPolygon(a,m)),p=s,d=u}})),s.createElement("g",{"data-test":"stacked-lines"},l,c)})),e}return it(n)}();lt(go,"propTypes",ka),lt(go,"defaultProps",wa);var ho=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n,o,r=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(r=e.visibleSeriesIndices);var i=Ia(e.data,e.stringColumnIndex,r),l=i.maxValue,s=i.minValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Se().domain([s,l]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(o=n.domain())||void 0===o?void 0:o.length)||1),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-line-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(go,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(ho,"propTypes",Sa),lt(ho,"defaultProps",Ta);var vo=function(t){ct(a,u);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"INNER_PADDING",.25),lt(mt(o),"OUTER_PADDING",.5),lt(mt(o),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),lt(mt(o),"componentDidMount",(function(){o.firstRender=!1,o.props.isResizing||o.props.isAnimatingContainer||o.forceUpdate(),o.props.isAnimatingContainer?o.rebuildTooltips(1e3):o.rebuildTooltips()})),lt(mt(o),"shouldComponentUpdate",(function(e,t){return(!e.isResizing||!o.props.isResizing)&&(!o.state.isLoading||!t.isLoading)})),lt(mt(o),"componentDidUpdate",(function(e,t){var n={},a=!1,r=!1,i=o.getChartHeightAndWidth(),l=i.chartHeight,s=i.chartWidth;if(!o.state.isLoading&&o.recursiveUpdateCount<2&&(s!==o.chartWidth||l!==o.chartHeight)&&(a=!0,o.recursiveUpdateCount++,clearTimeout(o.recursiveUpdateTimeout),o.recursiveUpdateTimeout=setTimeout((function(){o.recursiveUpdateCount=0}),500)),o.chartHeight=l,o.chartWidth=s,!o.props.isResizing&&e.isResizing&&o.chartContainerRef&&(o.chartContainerRef.style.flexBasis="100vh",a=!0),o.props.type!==e.type&&o.rebuildTooltips(),Aa(o.props,e)&&(r=!0,o.props.isPivot||(n.aggregatedData=o.aggregateRowData(o.props)),o.rebuildTooltips()),!pe(n))return a=!1,void o.setState(n,(function(){r&&o.updateMargins()}));r?o.updateMargins():a&&o.forceUpdate()})),lt(mt(o),"componentWillUnmount",(function(){clearTimeout(o.recursiveUpdateTimeout),o.getNewMargins&&o.getNewMargins.cancel(),o.legend=void 0,o.xAxis=void 0,o.axes=void 0})),lt(mt(o),"getChartHeightAndWidth",(function(){var e,t,n,a,r=(null===(e=o.chartContainerRef)||void 0===e?void 0:e.offsetWidth)>=0?null===(t=o.chartContainerRef)||void 0===t?void 0:t.offsetWidth:0;return{chartHeight:(null===(n=o.chartContainerRef)||void 0===n?void 0:n.offsetHeight)>=0?null===(a=o.chartContainerRef)||void 0===a?void 0:a.offsetHeight:0,chartWidth:r}})),lt(mt(o),"aggregateRowData",(function(e){var t=e.stringColumnIndex,n=e.numberColumnIndices,a=De(e.data,(function(e){return null==e?void 0:e[t]})),o=[],r=ce(a[0]);return a.forEach((function(e,i){var l;if(!(0===i&&i<a.length-1)){if((null==e?void 0:e[t])!==(null===(l=r)||void 0===l?void 0:l[t]))o.push(r),r=ce(e);else{var s=ce(e);n.forEach((function(e){var t=Number(s[e]),n=Number(r[e]);isNaN(t)&&(t=0),isNaN(n)&&(n=0),s[e]=t+n})),r=s}i===a.length-1&&o.push(r)}})),o})),lt(mt(o),"getNewLeftMargin",(function(e,t){var n=e.x,a=t.x+n,r=o.state.leftMargin;return r+=n-a+o.Y_AXIS_LABEL_WIDTH+o.PADDING})),lt(mt(o),"getNewRightMargin",(function(e,t,n){var a=t.x+e.x+t.width-(e.x+e.width),r=n-o.state.leftMargin,i=e.width-r,l=o.state.rightMargin+a+o.PADDING;o.state.rightMargin;return l<i?l:o.PADDING})),lt(mt(o),"getLegendLabels",(function(){return 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(n,a){var o=e[n];return{label:o.title,color:t(a),hidden:o.isSeriesHidden,columnIndex:n,column:o}}));return a}catch(e){return console.error(e),[]}}(o.props.columns,o.colorScale,o.props.numberColumnIndices)})),lt(mt(o),"getNewBottomMargin",(function(t){var n;o.legend=xe(o.chartRef).select(".legendOrdinal").node(),n=o.legend?o.legend.getBBox():void 0;var a=0;"bottom"===Qa(o.props.numberColumnIndices,o.props.type)&&e(n,"height")&&(a=n.height+10),o.xAxis=xe(o.chartRef).select(".axis-Bottom").node();var r=o.xAxis?o.xAxis.getBBox():{},i=Math.ceil(r.height)+a+40;(0===r.height&&(i=463),"bar"===o.props.type||"stacked_bar"===o.props.type)&&(i=i-(t.height-o.state.topMargin-o.state.bottomMargin)+10);return i||o.state.bottomMargin})),lt(mt(o),"getNewTopMargin",(function(){return o.PADDING})),lt(mt(o),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;o.props.rebuildTooltips?o.props.rebuildTooltips(e):(clearTimeout(o.rebuildTooltipsTimer),o.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e))})),lt(mt(o),"updateMargins",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.setLoading,n=void 0===t||t,a=e.delay,r=void 0===a?100:a;!o.state.isLoading&&n&&o.setState({isLoading:!0}),clearTimeout(o.updateMarginsDebounced),o.updateMarginsDebounced=setTimeout((function(){o.updateMarginsToDebounce()}),r)})),lt(mt(o),"updateMarginsToDebounce",(function(){o.newMargins=void 0;try{if(o.axes=document.querySelector("#react-autoql-chart-".concat(o.CHART_ID," .react-autoql-axes")),!o.chartContainerRef||!o.axes)return void o.clearLoading();var e=o.chartContainerRef.getBoundingClientRect(),t=o.axes.getBBox(),n=o.getNewLeftMargin(e,t),a=o.getNewRightMargin(e,t,n),r=o.getNewTopMargin(),i=o.getNewBottomMargin(e,t);o.newMargins={leftMargin:n,topMargin:r,rightMargin:a,bottomMargin:i},o.isMarginDiffSignificant=o.isMarginDifferenceSignificant(),o.isMarginDiffSignificant?(o.marginAdjustmentFinished=!0,o.setState($e({},o.newMargins),(function(){o.clearLoading()}))):(o.marginAdjustmentFinished=!0,o.clearLoading())}catch(e){console.error(e),o.marginAdjustmentFinished=!0,o.clearLoading()}})),lt(mt(o),"clearLoading",(function(){clearTimeout(o.loadingTimeout),o.loadingTimeout=setTimeout((function(){o.setState({isLoading:!1})}),100)})),lt(mt(o),"isMarginDifferenceSignificant",(function(){if(!o.newMargins)return!1;var e=o.newMargins,t=e.leftMargin,n=e.topMargin,a=e.rightMargin,r=e.bottomMargin,i=Math.abs(t-o.state.leftMargin),l=Math.abs(n-o.state.topMargin),s=Math.abs(a-o.state.rightMargin),c=Math.abs(r-o.state.bottomMargin);return i>10||l>10||s>10||c>10})),lt(mt(o),"getBase64Data",(function(){var e=o.chartRef;return e?kn(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),lt(mt(o),"saveAsPNG",(function(){var e=o.chartRef;e&&kn(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)}))})),lt(mt(o),"getStringAxisTitle",(function(){var e,t=o.props,n=t.columns,a=t.stringColumnIndex;return null==n||null===(e=n[a])||void 0===e?void 0:e.display_name})),lt(mt(o),"getNumberAxisTitle",(function(){var t=o.props,n=t.columns,a=t.numberColumnIndices;try{var r=n.filter((function(e,t){return a.includes(t)}));if(null==r||!r.length)return;if(!r.find((function(e){return e.display_name!==r[0].display_name})))return e(r,"[0].display_name");var i=e(r,"[0].type");return"DOLLAR_AMT"===i?"Amount":"QUANTITY"===i?"Quantity":"RATIO"===i?"Ratio":"PERCENT"===i?"Percent":void 0}catch(e){return void console.error(e)}})),lt(mt(o),"getCommonChartProps",(function(){var e,t,n=o.state,a=n.topMargin,r=n.bottomMargin,i=n.rightMargin,l=n.leftMargin,s=n.bottomLegendMargin,c=o.props,u=c.numberColumnIndices,p=c.columns,d=o.INNER_PADDING;u.length>1&&(d=.1);var m=hn(p),f=m.amountOfNumberColumns>1,g=m.amountOfStringColumns>1,h=u.filter((function(e){return(null==p?void 0:p[e])&&!p[e].isSeriesHidden})),v=o.getChartHeightAndWidth(),y=v.chartHeight,b=v.chartWidth;return $e($e({},o.props),{},(lt(t={key:void 0,data:o.state.aggregatedData||o.props.data,colorScale:o.colorScale,innerPadding:d,outerPadding:o.OUTER_PADDING},"colorScale",o.colorScale),lt(t,"height",y),lt(t,"width",b),lt(t,"topMargin",a),lt(t,"bottomMargin",r),lt(t,"rightMargin",i),lt(t,"leftMargin",l),lt(t,"bottomLegendMargin",s),lt(t,"hasMultipleNumberColumns",f),lt(t,"hasMultipleStringColumns",g),lt(t,"marginAdjustmentFinished",o.state.loading),lt(t,"legendTitle",(null===(e=o.props.legendColumn)||void 0===e?void 0:e.title)||"Category"),lt(t,"legendLocation",Qa(u,o.props.type)),lt(t,"legendLabels",o.getLegendLabels()),lt(t,"visibleSeriesIndices",h),lt(t,"numberAxisTitle",o.getNumberAxisTitle()),lt(t,"stringAxisTitle",o.getStringAxisTitle()),lt(t,"onStringColumnSelect",o.onStringColumnSelect),lt(t,"onLabelChange",o.updateMargins),lt(t,"tooltipID",o.props.tooltipID),t))})),lt(mt(o),"moveIndexToFront",(function(e,t){var n=ce(t),a=t[e];return n.slice(e,e+1),n.unshift(a),n})),lt(mt(o),"renderColumnChart",(function(e){return s.createElement(eo,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderBarChart",(function(e){return s.createElement(no,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderLineChart",(function(e){return s.createElement(oo,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderPieChart",(function(){return s.createElement(ro,o.getCommonChartProps())})),lt(mt(o),"renderHeatmapChart",(function(){return s.createElement(lo,o.getCommonChartProps())})),lt(mt(o),"renderBubbleChart",(function(){return s.createElement(co,o.getCommonChartProps())})),lt(mt(o),"renderStackedColumnChart",(function(){return s.createElement(fo,o.getCommonChartProps())})),lt(mt(o),"renderStackedBarChart",(function(e){return s.createElement(po,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderStackedLineChart",(function(){return s.createElement(ho,o.getCommonChartProps())})),lt(mt(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();default:return"Unknown Display Type"}})),lt(mt(o),"render",(function(){var t=o.getChartHeightAndWidth(),n=t.chartHeight,a=t.chartWidth;return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-chart-".concat(o.CHART_ID),ref:function(e){return o.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container ".concat(o.state.isLoading||o.props.isAnimatingContainer||o.props.isResizing?"loading":""),style:{flexBasis:n?"".concat(n,"px"):"100vh"}},!o.firstRender&&!o.props.isAnimatingContainer&&s.createElement(c,null,s.createElement("svg",{ref:function(e){return o.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:a,height:n,style:{fontFamily:e(en(o.props.themeConfig),"font-family","sans-serif"),color:e(en(o.props.themeConfig),"text-color-primary","inherit"),background:e(en(o.props.themeConfig),"background-color","inherit")}},s.createElement("g",{className:"react-autoql-chart-content-container"},o.renderChart())))))}));var r=en(t.themeConfig).chartColors;return o.CHART_ID=d(),o.Y_AXIS_LABEL_WIDTH=15,o.X_AXIS_LABEL_HEIGHT=15,o.PADDING=20,o.firstRender=!0,o.recursiveUpdateCount=0,o.colorScale=Ce().range(r),o.state={aggregatedData:t.isPivot?void 0:o.aggregateRowData(t),leftMargin:o.PADDING,rightMargin:o.PADDING,topMargin:o.PADDING,bottomMargin:o.PADDING,bottomLegendMargin:0,loading:!0},o}return it(a)}();lt(vo,"propTypes",$e($e({},Ca),{},{rebuildTooltips:p.func,type:p.string.isRequired})),lt(vo,"defaultProps",Ea);var yo=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"ID",d()),lt(mt(t),"state",{isOpen:!1}),lt(mt(t),"render",(function(){return t.props.options?s.createElement(yt,null,s.createElement(me,{isOpen:t.state.isOpen,position:"bottom",padding:0,onClickOutside:function(){return t.setState({isOpen:!1})},content:function(e){return e.position,e.nudgedLeft,e.nudgedTop,e.targetRect,e.popoverRect,s.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},s.createElement(le,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-drawer-tooltip",effect:"solid",delayShow:500}),s.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){return s.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":"select-tooltip-".concat(t.ID)},e.listLabel||e.label)}))))}},s.createElement("div",{className:"react-autoql-select ".concat(t.props.className),"data-test":"react-autoql-select",onClick:function(){return t.setState({isOpen:!t.state.isOpen})},style:t.props.style},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",s.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item"))))):null})),t}return it(a)}();lt(yo,"propTypes",{themeConfig:St,onChange:p.func,options:p.arrayOf(p.shape({})),popupClassname:p.string,value:p.string,label:p.string,size:p.string}),lt(yo,"defaultProps",{themeConfig:Xt,onChange:function(){},options:[],popupClassname:void 0,value:void 0,label:void 0,size:"large",style:{}});var bo=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),lt(mt(t),"suggestionLists",[]),lt(mt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),lt(mt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),lt(mt(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 $e({id:d(),hidden:!1},e)})),r=[].concat(ht(o),[{id:d(),text:a}]);n.push(r)})),n})),lt(mt(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})),lt(mt(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})),lt(mt(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)}}))}})),lt(mt(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||d()})),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:ce(e)})})),lt(mt(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()})),lt(mt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var a=t.suggestionLists[n].find((function(t){return t.id===e})),o=ce(t.state.selectedSuggestions);o[n]=a,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(o),o),t.updateStartAndEndIndexes(o),t.setState({selectedSuggestions:ce(o)})}else t.deleteQueryValidationSuggestion(n)})),lt(mt(t),"deleteQueryValidationSuggestion",(function(e){var n=ce(t.state.selectedSuggestions.map((function(t,n){return n===e?$e($e({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:ce(n)})})),lt(mt(t),"renderWordSelector",(function(e){var n=ce(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="".concat(n.label," (Original term)"):n.listLabel="".concat(e.text).concat(e.value_label?" (".concat(e.value_label,")"):""),o.push(n)}})),o.push({value:"remove-word",label:s.createElement("span",null,s.createElement(Kt,{type:"trash"})," Remove term")}),s.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},s.createElement(yo,{themeConfig:t.props.themeConfig,options:o,key:d(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),lt(mt(t),"renderQueryValidationQuery",(function(){return s.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var a=s.createElement("span",{key:"query-element-".concat(n)},e),o=t.renderWordSelector(n);return s.createElement("span",{key:d()},a,o)})))})),lt(mt(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})),lt(mt(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?s.createElement("div",{className:"react-autoql-query-validation-container"},s.createElement("div",{className:"react-autoql-query-validation-description"},s.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:")),s.createElement("div",null,t.renderQueryValidationQuery(),s.createElement("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},s.createElement(Kt,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return it(a)}();lt(bo,"propTypes",{themeConfig:St,response:p.shape({}),onSuggestionClick:p.func,autoSelectSuggestion:p.bool,isQueryRunning:p.bool,initialSelections:p.arrayOf(p.shape({})),onQueryValidationSelectOption:p.func,message:p.string}),lt(bo,"defaultProps",{themeConfig:Xt,response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var Co=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=r[0].length+r.index,c=e.substring(r.index,s),u=So(c);if(a=s,o.push({c_type:n,eng:u}),i===t.length-1&&s<e.length){var p=e.substring(s,e.length);o.push({c_type:"TEXT",eng:p})}})),o}(a,o,"VALUE_LABEL"):[Eo(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}},Eo=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=n(e).utc().format("ll");if("Invalid Date"!==t)return t}return e})).join(" ")}}catch(t){return{c_type:"TEXT",eng:e.eng}}},So=function(e){return e.substring(1,e.length-1).replace("''","'")},To=function(n){ct(o,s.Component);var a=gt(o);function o(n){var r;return ot(this,o),lt(mt(r=a.call(this,n)),"componentDidMount",(function(){r._isMounted=!0,r.props.onValueLabelClick&&r.validateAndUpdateValueLabels()})),lt(mt(r),"shouldComponentUpdate",(function(e){return!r.props.isResizing||!e.isResizing})),lt(mt(r),"componentWillUnmount",(function(){r._isMounted=!1})),lt(mt(r),"validateAndUpdateValueLabels",(function(){if(r.reverseTranslationArray.length){var n=[],a=t(r.reverseTranslationArray);r.reverseTranslationArray.forEach((function(t,o){"VALUE_LABEL"===t.c_type&&n.push(ra($e({suggestion:t.eng},Jt(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.reverseTranslationArray=a,r.setState({isValidated:!0}))}))}})),lt(mt(r),"renderFilterLockLink",(function(e){return s.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)&&s.createElement(Kt,{type:"lock"})," ",s.createElement("span",null,e))})),lt(mt(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)}})),lt(mt(r),"render",(function(){return e(r.reverseTranslationArray,"length")?s.createElement(yt,null,s.createElement("div",{id:r.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},s.createElement("div",{className:"react-autoql-reverse-translation"},s.createElement(Kt,{type:"info"}),s.createElement("strong",null," Interpreted as: "),r.reverseTranslationArray.map((function(e,t){return s.createElement("span",{key:"rt-item-".concat(r.COMPONENT_KEY,"-").concat(t)},r.renderInterpretationChunk(e))}))))):null})),r.COMPONENT_KEY=d(),r.reverseTranslationArray=function(t){try{if(!t)return;var n=[];return e(t,"length")&&t.forEach((function(e){"FILTER"===e.c_type?Co(e).forEach((function(e){n.push(e)})):n.push(e)})),n}catch(e){return void console.error(e)}}(n.reverseTranslation),r.state={isValidated:!1},r}return it(o)}();lt(To,"propTypes",{authentication:bt,themeConfig:St,interpretation:p.array,onValueLabelClick:p.func,appliedFilters:p.array,reverseTranslation:p.array}),lt(To,"defaultProps",{authentication:Gt,themeConfig:Xt,interpretation:[],appliedFilters:[],reverseTranslation:[],onValueLabelClick:void 0}),String.prototype.isUpperCase=function(){return this.valueOf().toUpperCase()===this.valueOf()},String.prototype.toProperCase=function(){return this.replace(/\w\S*/g,(function(e){return e.isUpperCase()?e:e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};var Do=function(t){ct(o,s.Component);var a=gt(o);function o(t){var r,i,u;if(ot(this,o),lt(mt(u=a.call(this,t)),"componentDidMount",(function(){u._isMounted=!0,u.props.onUpdate();try{var e;null!==(e=u.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&u.props.optionsToolbarRef.forceUpdate(),u.isCurrentDisplayTypeValid(u.props)||u.onRecommendedDisplayType(Fn(u.queryResponse,u.props.autoChartAggregations)),u.props.onSupportedDisplayTypesChange(u.supportedDisplayTypes)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),lt(mt(u),"shouldComponentUpdate",(function(e){return!u.props.isResizing||!e.isResizing})),lt(mt(u),"componentDidUpdate",(function(e,t){try{var n;if(!se(u.props.tableConfigs,{tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig})&&u.props.onTableConfigChange&&u.props.onTableConfigChange({tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig}),e.themeConfig&&u.props.themeConfig&&!se(en(u.props.themeConfig),en(e.themeConfig))&&_n(u.props.themeConfig),u.props.queryResponse&&!u.queryResponse)if(u.queryResponse=ce(u.props.queryResponse),u.isCurrentDisplayTypeValid(u.props))u.setResponseData(),u.forceUpdate();else{var a=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(a)}if(!e.displayType&&u.props.displayType)if(le.hide(),u.isCurrentDisplayTypeValid(u.props))u.tableData||(u.setResponseData(),u.forceUpdate());else{var o=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(o)}if(u.props.displayType!==e.displayType&&!u.isCurrentDisplayTypeValid(u.props)){var r=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(r)}!t.isContextMenuOpen&&u.state.isContextMenuOpen?ye.on():t.isContextMenuOpen&&!u.state.isContextMenuOpen&&ye.off(),u.state.visibleRows!==t.visibleRows?(u.shouldGeneratePivotData(u.state.visibleRows)&&u.generatePivotData({isFirstGeneration:!0,newTableData:u.state.visibleRows}),u.setSupportedDisplayTypes(u.getCurrentSupportedDisplayTypes())):u.usePivotDataForChart()&&u.state.visiblePivotRows!==t.visiblePivotRows&&u.setSupportedDisplayTypes(u.getCurrentSupportedDisplayTypes()),null!==(n=u.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&u.props.optionsToolbarRef.forceUpdate(),u.props.onUpdate()}catch(e){console.error(e)}})),lt(mt(u),"componentWillUnmount",(function(){u._isMounted=!1,le.hide(),clearTimeout(u.rebuildTooltipsTimer)})),lt(mt(u),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;u.props.rebuildTooltips?u.props.rebuildTooltips(e):(clearTimeout(u.rebuildTooltipsTimer),u.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e))})),lt(mt(u),"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})),lt(mt(u),"supportsPivot",(function(){return u.supportedDisplayTypes.includes("pivot_table")})),lt(mt(u),"supportsDatePivot",(function(){return u.supportsPivot()&&2===u.tableColumns.length})),lt(mt(u),"usePivotDataForChart",(function(){return u.supportsPivot()&&!u.supportsDatePivot()})),lt(mt(u),"onRecommendedDisplayType",(function(e){u.props.onRecommendedDisplayType(e,u.supportedDisplayTypes)})),lt(mt(u),"isTableConfigValid",(function(t){try{if(!t||!t.numberColumnIndices||!t.stringColumnIndices||Number.isNaN(Number(t.numberColumnIndex))||Number.isNaN(Number(t.stringColumnIndex)))return!1;if(!Array.isArray(t.numberColumnIndices)||!Array.isArray(t.stringColumnIndices))return!1;var n=e(u.queryResponse,"data.data.columns");return!!t.numberColumnIndices.every((function(e){return n[e]&&cn(n[e])}))&&!!t.stringColumnIndices.every((function(e){return n[e]&&un(n[e])}))}catch(e){return!1}})),lt(mt(u),"updateColumns",(function(t){var n;e(u.queryResponse,"data.data.columns")&&(u.queryResponse.data.data.columns=t);var a=u.getCurrentSupportedDisplayTypes();u.setSupportedDisplayTypes(a,void 0,"table"),u.tableConfig=void 0,u.shouldGenerateTableData()&&(u.generateTableData(t),u.shouldGeneratePivotData()&&u.generatePivotTableData({isFirstGeneration:!0})),e(u.tableRef,"ref.table")&&u.tableRef.ref.table.setColumns(u.tableColumns),null!==(n=u.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&u.props.optionsToolbarRef.forceUpdate(),"text"===u.props.displayType?u.onRecommendedDisplayType("table"):u.forceUpdate()})),lt(mt(u),"generateAllData",(function(t,n){e(t,"data.data")&&n&&u.shouldGenerateTableData()&&(u.generateTableData(),u.shouldGeneratePivotData()&&u.generatePivotData({isFirstGeneration:!0}))})),lt(mt(u),"setResponseData",(function(){u.queryID=e(u.queryResponse,"data.data.query_id"),u.interpretation=e(u.queryResponse,"data.data.interpretation"),u.generateAllData(u.queryResponse,u.props.displayType)})),lt(mt(u),"shouldGeneratePivotData",(function(e){return(e||u.tableData)&&u.supportsPivot()})),lt(mt(u),"shouldGenerateTableData",(function(){return e(u.queryResponse,"data.data.rows.length")})),lt(mt(u),"dateSortFn",(function(e,t){try{if(!e&&!t)return 0;if(!e&&t)return 1;if(e&&!t)return-1;var a=Number(e),o=Number(t);if((Number.isNaN(a)||Number.isNaN(o))&&(a=n(e).unix(),o=n(t).unix()),!a||!o){if(e.includes("-W")){var r=e.substring(0,4),i=t.substring(0,4);if(r!==i)return i-r;var l=e.substring(6,8);return t.substring(6,8)-l}if(on.includes(e.trim())){var s=on.findIndex((function(t){return t===e.trim()})),c=on.findIndex((function(e){return e===t.trim()}));return s>=0&&c>=0?c-s:t-e}if(an.includes(e.trim())){var u=an.findIndex((function(t){return t===e.trim()})),p=an.findIndex((function(e){return e===t.trim()}));return u>=0&&p>=0?p-u:t-e}}return o-a}catch(e){return console.error(e),-1}})),lt(mt(u),"sortTableDataByDate",(function(e){try{if(!e||"object"!==tt(e))return;var t=fn(u.tableColumns);return t>=0?ht(e).sort((function(e,n){return u.dateSortFn(e[t],n[t])})):e}catch(t){return console.error(t),e}})),lt(mt(u),"generateTableData",(function(e,t){var n,a,o;t?u.tableData=t:(u.tableID=d(),u.tableColumns=u.formatColumnsForTable(e),u.tableData=u.sortTableDataByDate(null===(n=u.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.rows),u.setTableConfig())})),lt(mt(u),"generatePivotData",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isFirstGeneration,n=e.newTableData;try{u.pivotTableID=d();var a=n||u.tableData;2===u.tableColumns.length?u.generateDatePivotData(a):u.generatePivotTableData({isFirstGeneration:t,newTableData:n})}catch(e){console.error(e),u.props.onErrorCallback(e),u.pivotTableData=void 0}})),lt(mt(u),"renderSuggestionMessage",(function(e,t){var n;try{n=s.createElement("div",{className:"react-autoql-suggestion-message"},s.createElement("div",{className:"react-autoql-suggestions-container"},u.props.renderSuggestionsAsDropdown?s.createElement("select",{key:d(),onChange:function(e){u._isMounted&&(u.setState({selectedSuggestion:e.target.value}),u.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:u.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return s.createElement("option",{key:d(),value:e},e)}))):e.map((function(e){return s.createElement("div",{key:d()},s.createElement("button",{onClick:function(){return u.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t})},className:"react-autoql-suggestion-btn"},e),s.createElement("br",null))}))))}catch(e){return s.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return u.props.renderFullSuggestionMessage?s.createElement("div",{style:{textAlign:"center"}},u.renderError(u.queryResponse),n):n})),lt(mt(u),"renderSingleValueResponse",(function(){return s.createElement("div",{className:"single-value-response-container"},s.createElement("a",{className:"single-value-response ".concat($t(u.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){return u.processDrilldown({groupBys:[],supportedByAPI:!0})}},Tn({element:e(u.queryResponse,"data.data.rows[0][0]"),column:e(u.queryResponse,"data.data.columns[0]"),config:Zt(u.props.dataFormatting)})))})),lt(mt(u),"copyTableToClipboard",(function(){var e,t;"table"===u.props.displayType&&null!==(e=u.tableRef)&&void 0!==e&&e._isMounted?u.tableRef.copyToClipboard():"pivot_table"===u.props.displayType&&null!==(t=u.pivotTableRef)&&void 0!==t&&t._isMounted&&u.pivotTableRef.copyToClipboard()})),lt(mt(u),"getBase64Data",(function(){var e,t;if(u.chartRef&&An(u.props.displayType))return u.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=u.tableRef)&&void 0!==e&&e._isMounted&&"table"===u.props.displayType){var n=u.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=u.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===u.props.displayType){var a=u.pivotTableRef.getBase64Data();return Promise.resolve(a)}})),lt(mt(u),"saveChartAsPNG",(function(){u.chartRef&&u.chartRef.saveAsPNG()})),lt(mt(u),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var a,o=null===(a=u.tableData)||void 0===a?void 0:a.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=ce(u.queryResponse);return r.data.data.rows=o,r}catch(e){console.error(e)}})),lt(mt(u),"processDrilldown",function(){var e=at(et().mark((function e(t){var n,a,o,r,i,l,s;return et().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,!$t(u.props.autoQLConfig).enableDrilldowns){e.next=24;break}if(e.prev=2,!a){e.next=17;break}return u.props.onDrilldownStart(r),e.prev=5,e.next=8,aa($e($e($e({},Jt(u.props.authentication)),$t(u.props.autoQLConfig)),{},{queryID:u.queryID,groupBys:n}));case 8:l=e.sent,u.props.onDrilldownEnd({response:l}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),u.props.onDrilldownEnd({response:e.t0});case 15:e.next=18;break;case 17:!isNaN(i)&&null!=o&&o.length&&(u.props.onDrilldownStart(r),s=u.getFilterDrilldown({stringColumnIndex:i,row:o}),setTimeout((function(){u.props.onDrilldownEnd({response:s})}),1500));case 18:e.next=24;break;case 20:e.prev=20,e.t1=e.catch(2),console.error(e.t1),u.props.onDrilldownEnd({error:"Error processing drilldown"});case 24:case"end":return e.stop()}}),e,null,[[2,20],[5,12]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(u),"onTableCellClick",(function(e){var t={};t=u.pivotTableColumns&&"pivot_table"===u.props.displayType?function(e){try{var t,n,a,o=[],r=null==e||null===(t=e.getColumn())||void 0===t?void 0:t.getDefinition(),i=e.getData()[0],l=null===(n=r.origValues)||void 0===n?void 0:n[i].name,s=null===(a=r.origValues)||void 0===a?void 0:a[i].value;if(o.push({name:l,value:s}),null!=r&&r.origPivotColumn){var c,u=r.name,p=null===(c=r.origPivotColumn)||void 0===c?void 0:c.name;o.push({name:p,value:u})}return o}catch(e){return void console.error(e)}}(e):function(e,t){if(e&&t){var n=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t}(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,u.tableColumns),u.processDrilldown({groupBys:t,supportedByAPI:!!t})})),lt(mt(u),"onChartClick",(function(e,t,n,a,o,r){var i,l,s=[],c=n[t],p=(null==n||null===(i=n[a])||void 0===i?void 0:i.origColumn)||(null==n?void 0:n[a]);if(null!=n&&null!==(l=n[a])&&void 0!==l&&l.datePivot){var d,m,f,g=Number(null==n||null===(d=n[t])||void 0===d?void 0:d.name),h=null==e?void 0:e[a],v="".concat(null===(m=u.pivotOriginalColumnData)||void 0===m||null===(f=m[g])||void 0===f?void 0:f[h]);s.push({name:p.name,value:v})}else null!=p&&p.groupable&&s.push({name:p.name,value:"".concat(null==e?void 0:e[a])});null!=o&&o.groupable&&c.origColumn&&s.push({name:o.name,value:"".concat(null==c?void 0:c.name)}),s.length,u.processDrilldown({groupBys:s,supportedByAPI:!!s.length,row:e,activeKey:r,stringColumnIndex:a})})),lt(mt(u),"toggleTableFilter",(function(e){var t,n,a=e.isFilteringTable;"table"===u.props.displayType&&((null===(t=u.tableRef)||void 0===t?void 0:t._isMounted)&&u.tableRef.toggleTableFilter({isFilteringTable:a}));"pivot_table"===u.props.displayType&&((null===(n=u.pivotTableRef)||void 0===n?void 0:n._isMounted)&&u.pivotTableRef.toggleTableFilter({isFilteringTable:a}))})),lt(mt(u),"onNewPage",(function(e){try{u.tableData=[].concat(ht(u.tableData),ht(e))}catch(e){console.error(e)}})),lt(mt(u),"onNewData",(function(e){u.tableData=e})),lt(mt(u),"onTableFilter",function(){var e=at(et().mark((function e(t,n){var a,o;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t&&t.length||null!=n&&n.length){e.next=2;break}return e.abrupt("return");case 2:"table"!==(a=u.props.displayType)&&"pivot_table"!==a||(o=[],n.forEach((function(e){o.push(e.getData())})),"table"===a?(u.headerFilters=t,u.setState({visibleRows:o})):"pivot_table"===a&&(u.pivotHeaderFilters=t,u.setState({visiblePivotRows:o})));case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),lt(mt(u),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex;if("pie"===u.props.displayType)u.onPieChartLegendClick(e);else{var n=u.supportsPivot()?ht(u.pivotTableColumns):ht(u.tableColumns);n[t].isSeriesHidden=!n[t].isSeriesHidden,u.supportsPivot()?u.pivotTableColumns=n:u.tableColumns=n}u.forceUpdate()})),lt(mt(u),"onPieChartLegendClick",(function(e){})),lt(mt(u),"onChangeStringColumnIndex",(function(e){u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.legendColumnIndex===e&&(u.pivotTableConfig.legendColumnIndex=void 0),u.pivotTableConfig.stringColumnIndex=e,u.generatePivotTableData()):(u.tableConfig.legendColumnIndex===e&&(u.tableConfig.legendColumnIndex=void 0),u.tableConfig.stringColumnIndex=e),u.forceUpdate()})),lt(mt(u),"onChangeLegendColumnIndex",(function(e){u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.stringColumnIndex===e&&(u.pivotTableConfig.stringColumnIndex=void 0),u.pivotTableConfig.legendColumnIndex=e,u.generatePivotTableData()):(u.tableConfig.stringColumnIndex===e&&(u.tableConfig.stringColumnIndex=void 0),u.tableConfig.legendColumnIndex=e),u.forceUpdate()})),lt(mt(u),"onChangeNumberColumnIndices",(function(e){e&&(u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.numberColumnIndices=e,u.pivotTableConfig.numberColumnIndex=e[0]):(u.tableConfig.numberColumnIndices=e,u.tableConfig.numberColumnIndex=e[0]),u.forceUpdate())})),lt(mt(u),"setPivotTableConfig",(function(e){var t=u.pivotTableColumns;if(t){if(u.pivotTableConfig||(u.pivotTableConfig={}),e||!u.pivotTableConfig.stringColumnIndices||!(u.pivotTableConfig.stringColumnIndex>=0)){var n=gn(t),a=n.stringColumnIndices,o=n.stringColumnIndex;u.pivotTableConfig.stringColumnIndices=a,u.pivotTableConfig.stringColumnIndex=o}if(e||!u.pivotTableConfig.numberColumnIndices){var r=dn(t),i=r.numberColumnIndex,l=r.numberColumnIndices;u.pivotTableConfig.numberColumnIndices=l,u.pivotTableConfig.numberColumnIndex=i}}})),lt(mt(u),"setTableConfig",(function(){var e=u.tableColumns;if(e){if(u.tableConfig||(u.tableConfig={}),!(u.tableConfig.stringColumnIndices&&u.tableConfig.stringColumnIndex>=0)){var t=gn(e),n=t.stringColumnIndices,a=t.stringColumnIndex;u.tableConfig.stringColumnIndices=n,u.tableConfig.stringColumnIndex=a}if(!(u.tableConfig.numberColumnIndices&&u.tableConfig.numberColumnIndex>=0)){var o=dn(e),r=o.numberColumnIndex,i=o.numberColumnIndices;u.tableConfig.numberColumnIndices=i,u.tableConfig.numberColumnIndex=r}var l=u.tableColumns.findIndex((function(e,t){return e.groupable&&t!==u.tableConfig.stringColumnIndex}));l>=0&&(u.tableConfig.legendColumnIndex=l),u.props.onTableConfigChange({tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig})}})),lt(mt(u),"isCurrentDisplayTypeValid",(function(e,t){var n,a,o,r,i,l,s,c,p=null!==(n=u.state)&&void 0!==n&&n.visibleRows?null===(a=u.state)||void 0===a||null===(o=a.visibleRows)||void 0===o?void 0:o.length:null===(r=u.tableData)||void 0===r?void 0:r.length,d=null!==(i=u.state)&&void 0!==i&&i.visiblePivotRows?null===(l=u.state)||void 0===l||null===(s=l.visiblePivotRows)||void 0===s?void 0:s.length:null===(c=u.pivotTableData)||void 0===c?void 0:c.length;return Ln(u.queryResponse,e.displayType,p,d)})),lt(mt(u),"getCurrentSupportedDisplayTypes",(function(){var e,t,n,a,o,r,i,l,s=null!==(e=u.state)&&void 0!==e&&e.visibleRows?null===(t=u.state)||void 0===t||null===(n=t.visibleRows)||void 0===n?void 0:n.length:null===(a=u.tableData)||void 0===a?void 0:a.length,c=null!==(o=u.state)&&void 0!==o&&o.visiblePivotRows?null===(r=u.state)||void 0===r||null===(i=r.visiblePivotRows)||void 0===i?void 0:i.length:null===(l=u.pivotTableData)||void 0===l?void 0:l.length;return Pn({response:u.queryResponse,dataLength:s,pivotDataLength:c})})),lt(mt(u),"setSupportedDisplayTypes",(function(e,t,n){!e||!t&&se(e,u.supportedDisplayTypes)||(u.supportedDisplayTypes=e,n&&n!==u.props.displayType&&u.supportedDisplayTypes.includes(n)?u.onRecommendedDisplayType(n):u.supportedDisplayTypes.includes(u.props.displayType)||u.onRecommendedDisplayType(Fn(u.queryResponse)),u.props.onSupportedDisplayTypesChange(u.supportedDisplayTypes))})),lt(mt(u),"getTooltipDataForCell",(function(e,t,n){var a=null;try{if(u.supportsPivot()){var o=u.tableColumns[u.tableConfig.stringColumnIndex],r=u.tableColumns[u.tableConfig.numberColumnIndex],i=u.tableColumns[u.tableConfig.legendColumnIndex],l="<div>\n <strong>".concat(u.pivotTableColumns[0].title,":</strong>").concat(Tn({element:e[0],column:u.pivotTableColumns[0],config:Zt(u.props.dataFormatting)}),"\n </div>"),s="<span></span>";i?s="<div><strong>".concat(i.title,":</strong> ").concat(u.pivotTableColumns[t].title,"</div>"):o&&(s="<div><strong>".concat(o.title,":</strong> ").concat(u.pivotTableColumns[t].title,"</div>"));var c="<div>\n <strong>".concat(r.title,":</strong> ").concat(Tn({element:e[t]||0,column:r,config:Zt(u.props.dataFormatting)}),"\n </div>");a="<div>\n ".concat(l,"\n ").concat(s,"\n ").concat(c,"\n </div>")}else{var p=u.tableColumns[u.tableConfig.stringColumnIndex],d=u.tableColumns[t];a="<div>\n <div>\n <strong>".concat(p.title,":</strong> ").concat(Tn({element:e[u.tableConfig.stringColumnIndex],column:p,config:Zt(u.props.dataFormatting)}),"\n </div>\n <div>\n <div>\n <strong>").concat(d.title,":</strong> ").concat(Tn({element:n||e[t]||0,column:d,config:Zt(u.props.dataFormatting)}),"\n </div>\n </div>")}return a}catch(e){return console.error(e),null}})),lt(mt(u),"getDrilldownDataForCell",(function(t,n){var a=wn(u.tableColumns)>0;return u.supportsPivot()?{supportedByAPI:a,data:[{name:e(u.pivotTableColumns,"[0].name"),value:"".concat(t[0])},{name:e(u.tableColumns,"[".concat(u.tableConfig.legendColumnIndex,"].name")),value:"".concat(e(u.pivotTableColumns,"[".concat(n,"].name")))}]}:{supportedByAPI:a,data:[{name:e(u.tableColumns,"[".concat(u.tableConfig.stringColumnIndex,"].name")),value:"".concat(e(t,"[".concat(u.tableConfig.stringColumnIndex,"]")))}]}})),lt(mt(u),"isStringColumnDateType",(function(){var e=u.tableColumns[u.tableConfig.stringColumnIndex];return pn(e)})),lt(mt(u),"getMultiSeriesData",(function(t,n){var a,o=gn(t).stringColumnIndex,r=mn(t),i=dn(t).numberColumnIndex,l=ce(n).sort((function(e,t){var n=e[o],a=t[o];return n&&a?a-n:t-e})),s={};u.tableColumns.forEach((function(e,t){e.seriesCategory&&(s[e.seriesCategory]=t)}));var c=[];return l.forEach((function(t,n){var l=t[o],p=e(a,"[".concat(o,"]")),d=t[r];if(p!==l){var m=yn(u.tableColumns.length,1,0);m[0]=l,c.push(m)}var f=c[c.length-1][s[d]]||0;c[c.length-1][s[d]]=t[i]+f,a=t})),c})),lt(mt(u),"setFilterFunction",(function(e){var t=mt(u);return"DATE"===e.type||"DATE_STRING"===e.type?function(n,a,o,r){try{var i=Tn({element:a,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),u.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,a){try{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=e.replace(/[^0-9.]/g,"");return t.toString().includes(i)}catch(e){return console.error(e),u.props.onErrorCallback(e),!1}}:void 0})),lt(mt(u),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(e,t){return u.dateSortFn(t,e)}:"STRING"===e.type?"string":void 0})),lt(mt(u),"formatColumnsForTable",(function(e){var t,n,a,o=e||(null===(t=u.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.columns);return o?o.map((function(e,t){var n=ce(e);return n.field="".concat(t),n.title=e.display_name,n.id=d(),n.visible=e.is_visible,"DOLLAR_AMT"===n.type||"RATIO"===n.type||"NUMBER"===n.type?n.hozAlign="right":n.hozAlign="center",n.cssClass=n.type,n.formatter=function(e,t,a){return Tn({element:e.getValue(),column:n,config:Zt(u.props.dataFormatting),htmlElement:e.getElement()})},n.headerFilter="input",n.headerFilterFunc=u.setFilterFunction(n),n.sorter=u.setSorterFunction(n),pn(e)&&u.props.enableAjaxTableData&&(n.headerSort=!1),n})):null})),lt(mt(u),"formatDatePivotYear",(function(e,t){return"DATE"===u.tableColumns[t].type?n.unix(e[t]).utc().format("YYYY"):n(e[t]).format("YYYY")})),lt(mt(u),"formatDatePivotMonth",(function(e,t){return"DATE"===u.tableColumns[t].type?n.unix(e[t]).format("MMMM"):n(e[t]).format("MMMM")})),lt(mt(u),"generateDatePivotData",(function(t){try{var a=fn(u.tableColumns),o=u.tableConfig.numberColumnIndex;o>=0||(o=u.tableColumns.findIndex((function(e,t){return t!==a&&cn(e)})));var r=t||e(u.queryResponse,"data.data.rows"),i=ht(r.map((function(e){return"DATE"===u.tableColumns[a].type?Number(n.unix(e[a]).utc().format("YYYY")):Number(n(e[a]).format("YYYY"))}))).filter(vn).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),l=[{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:u.tableColumns[a],pivot:!0,headerSort:!0,sorter:u.dateSortFn}];Object.keys(i).forEach((function(e,t){l.push($e($e({},u.tableColumns[o]),{},{origColumn:u.tableColumns[o],origValues:{},name:e,title:e,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0,headerSort:!0}))}));var s=yn(Object.keys(i).length,12),c={};an.forEach((function(e,t){s[t][0]=e})),r.forEach((function(e){var t,n=u.formatDatePivotYear(e,a),r=u.formatDatePivotMonth(e,a),p=i[n],d=an.findIndex((function(e){return r===e})),m=l.findIndex((function(e){return e.name===n}));d>=0&&p&&(s[d][p]=e[o],c[n]=$e($e({},c[n]),{},lt({},r,e[a])),l[m].origValues[r]={name:null===(t=u.tableColumns[a])||void 0===t?void 0:t.name,value:e[a]})})),u.pivotOriginalColumnData=c,u.pivotTableColumns=l,u.pivotTableData=s,u.numberOfPivotTableRows=12,u.setPivotTableConfig()}catch(e){console.error(e),u.setSupportedDisplayTypes(u.supportedDisplayTypes.filter((function(e){return"pivot_table"!==e}))),u.onRecommendedDisplayType("table")}})),lt(mt(u),"getColumnFromIndexString",(function(t){return e(u.tableColumns,"[".concat(e(u.tableConfig,"[".concat(t,"]")),"]"))})),lt(mt(u),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,a=t.newTableData;try{var o=a||u.tableData||e(u.queryResponse,"data.data.rows");o=o.filter((function(e){return null!==e[0]}));var r=u.tableConfig,i=r.legendColumnIndex,l=r.stringColumnIndex,s=r.numberColumnIndex,c=u.sortTableDataByDate(o).map((function(e){return e[l]})).filter(vn).reduce((function(e,t,n){return e[t]=n,e}),{}),p=u.sortTableDataByDate(o).map((function(e){return e[i]})).filter(vn).reduce((function(e,t,n){return e[t]=n,e}),{}),d=l,m=i;if(n&&Object.keys(p).length>Object.keys(c).length&&!pn(u.getColumnFromIndexString("stringColumnIndex"))){d=i,m=l;var f=ce(c);c=ce(p),p=ce(f)}u.tableConfig.legendColumnIndex=m;var g=[$e($e({},u.tableColumns[d]),{},{frozen:!0,headerContext:void 0,visible:!0,is_visible:!0,field:"0",pivot:!0,headerSort:!0})];Object.keys(p).forEach((function(e,t){var n=Tn({element:e,column:u.tableColumns[m],config:Zt(u.props.dataFormatting)});g.push($e($e({},u.tableColumns[s]),{},{origColumn:u.tableColumns[s],origPivotColumn:u.tableColumns[m],origValues:{},name:e,title:n,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0,headerSort:!0}))}));var h=yn(Object.keys(p).length+1,Object.keys(c).length);o.forEach((function(e){var t,n=c[e[d]],a=e[d];h[n][0]=a;var o=p[e[m]]+1,r=e[s];h[n][o]=r,g[o].origValues[a]={name:null===(t=u.tableColumns[d])||void 0===t?void 0:t.name,value:a}}));var v=u.getCurrentSupportedDisplayTypes();se(v,u.supportedDisplayTypes)||u.setSupportedDisplayTypes(v),u.pivotTableColumns=g,u.pivotTableData=h,u.numberOfPivotTableRows=e(u.pivotTableData,"length",0),u.setPivotTableConfig(n)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),lt(mt(u),"onSuggestionClick",(function(t){var n=t.query,a=t.queryId,o=t.userSelection,r=t.isButtonClick,i=t.skipQueryValidation,c=t.source;o||function(t){var n=t.queryId,a=t.suggestion,o=t.apiKey,r=t.domain,i=t.token,s="".concat(r,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(o),c={suggestion:a};if(!i||!r||!o)return Promise.reject(new Error("Unauthenticated"));var u={headers:{Authorization:"Bearer ".concat(i)}};l.put(s,c,u).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}($e($e({},Jt(u.props.authentication)),{},{queryId:a,suggestion:n})),"None of these"===n?u.props.onNoneOfTheseClick?u.props.onNoneOfTheseClick():u.setState({customResponse:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")}):(u.props.onSuggestionClick&&u.props.onSuggestionClick({query:n,userSelection:o,isButtonClick:r,skipQueryValidation:i,source:c}),u.props.queryInputRef&&u.props.queryInputRef.submitQuery({queryText:n,userSelection:o,skipQueryValidation:!0,source:c}))})),lt(mt(u),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return s.createElement("div",{className:"query-output-error-message"},t.map((function(e,n){return s.createElement("span",{key:"error-message-part-".concat(u.COMPONENT_KEY,"-").concat(n)},s.createElement("span",null,e),n!==t.length-1&&s.createElement("button",{className:"report-like-text-button",onClick:u.props.reportProblemCallback},"report"))})))}catch(t){return s.createElement("span",null,e)}})),lt(mt(u),"isDrilldown",(function(){try{var e,t,n;return"Drilldown"===((null===(e=u.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}})),lt(mt(u),"renderAllColumnsHiddenMessage",(function(){return s.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},s.createElement("div",null,s.createElement(Kt,{className:"warning-icon",type:"warning-triangle"}),s.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",s.createElement(Kt,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),lt(mt(u),"renderTable",(function(){if(In(u.queryResponse))return u.renderAllColumnsHiddenMessage();if(!u.tableData||"pivot_table"===u.props.displayType&&!u.pivotTableData)return u.renderMessage("Error: There was no data supplied for this table");if("pivot_table"===u.props.displayType)return s.createElement(yt,null,s.createElement(ba,{themeConfig:u.props.themeConfig,key:u.pivotTableID,ref:function(e){return u.pivotTableRef=e},columns:u.pivotTableColumns,data:u.pivotTableData,onCellClick:u.onTableCellClick,headerFilters:u.pivotHeaderFilters,onFilterCallback:u.onTableFilter,isResizing:u.props.isResizing,useInfiniteScroll:!1,supportsDrilldowns:!0,enableColumnHeaderContextMenu:u.props.enableColumnHeaderContextMenu}));var t=u.props.enableAjaxTableData&&u.isDataLimited();return s.createElement(ba,{authentication:u.props.authentication,themeConfig:u.props.themeConfig,key:u.tableID,ref:function(e){return u.tableRef=e},columns:u.tableColumns,data:u.tableData,onCellClick:u.onTableCellClick,queryID:u.queryID,headerFilters:u.headerFilters,onFilterCallback:u.onTableFilter,onNewPage:u.onNewPage,onNewData:u.onNewData,isResizing:u.props.isResizing,pageSize:e(u.queryResponse,"data.data.row_limit"),useInfiniteScroll:t,queryRequestData:u.props.queryRequestData,supportsDrilldowns:sn(u.tableColumns)&&2===u.tableColumns.length})})),lt(mt(u),"renderChart",(function(e){var t;if(!u.tableData||!u.tableColumns||!u.tableConfig)return console.error("Required table data was missing"),u.renderMessage("Error: There was no data supplied for this chart");var n=u.usePivotDataForChart();if(n&&(!u.pivotTableData||!u.pivotTableColumns||!u.pivotTableConfig))return console.error("Required pivot table data was missing"),u.renderMessage("Error: There was no data supplied for this chart");var a=n?u.pivotTableConfig:u.tableConfig;return s.createElement(yt,null,s.createElement(vo,st({themeConfig:u.props.themeConfig,dataLength:u.tableData.length,ref:function(e){return u.chartRef=e},type:e||u.props.displayType},a,{data:n?u.state.visiblePivotRows||u.pivotTableData:u.state.visibleRows||u.tableData,columns:n?u.pivotTableColumns:u.tableColumns,isPivot:n,dataFormatting:Zt(u.props.dataFormatting),backgroundColor:u.props.backgroundColor,activeChartElementKey:u.props.activeChartElementKey,onLegendClick:u.onLegendClick,legendColumn:u.tableColumns[null===(t=u.tableConfig)||void 0===t?void 0:t.legendColumnIndex],changeStringColumnIndex:u.onChangeStringColumnIndex,changeLegendColumnIndex:u.onChangeLegendColumnIndex,changeNumberColumnIndices:u.onChangeNumberColumnIndices,onChartClick:u.onChartClick,isResizing:u.props.isResizing,isAnimatingContainer:u.props.isAnimatingContainer,enableDynamicCharting:u.props.enableDynamicCharting,tooltipID:"react-autoql-chart-tooltip-".concat(u.COMPONENT_KEY),rebuildTooltips:u.rebuildTooltips})))})),lt(mt(u),"renderHelpResponse",(function(){var t=e(u.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 s.createElement(c,null,"Great news, I can help with that:",s.createElement("br",null),s.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},s.createElement(Kt,{type:"globe",className:"react-autoql-help-link-icon"}),a))})),lt(mt(u),"renderError",(function(t){return t?e(t,"data.message")?u.renderMessage(t.data):u.renderMessage():(console.warn("Warning: No response object supplied"),u.renderMessage("No response supplied"))})),lt(mt(u),"isDataLimited",(function(){var e,t,n,a,o,r,i,l=null===(e=u.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,s=null===(o=u.queryResponse)||void 0===o||null===(r=o.data)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.row_limit;return!(!l||!s)&&l===s})),lt(mt(u),"noDataFound",(function(){var e,t,n,a;return 0===(null===(e=u.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)})),lt(mt(u),"renderDataLimitWarning",(function(){var e,t,n,a=u.isDataLimited(),o=u.props.enableAjaxTableData&&"table"===u.props.displayType;if(!a||o)return null;var r=$t(u.props.autoQLConfig).enableQueryInterpretation&&u.props.showQueryInterpretation;return s.createElement("div",{className:"dashboard-data-limit-warning-icon"},s.createElement(Kt,{type:"warning","data-tip":"The display limit of ".concat(null===(e=u.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.<br />\n Try querying a smaller time-frame to ensure<br />\n all your data is displayed."),"data-for":"react-autoql-query-output-tooltip-".concat(u.COMPONENT_KEY),"data-place":r?"left":"right"}))})),lt(mt(u),"renderMessage",(function(e){try{if("object"===tt(e)){var t=Tt.GENERAL_QUERY;return e.message&&(t=e.message,t=u.props.reportProblemCallback?u.replaceErrorTextWithLinks(e.message):t.replace("<report>","report")),s.createElement("div",{className:"query-output-error-message"},s.createElement("div",null,t),e.reference_id&&s.createElement(c,null,s.createElement("br",null),s.createElement("div",null,"Error ID: ",e.reference_id)))}var n=e||Tt.GENERAL_QUERY;return s.createElement("div",{className:"query-output-error-message"},n)}catch(e){return console.warn(e),s.createElement("div",{className:"query-output-error-message"},Tt.GENERAL_QUERY)}})),lt(mt(u),"renderHTMLMessage",(function(){var e,t,n,a=null===(e=u.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.answer;return a?be(a,{}):s.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),lt(mt(u),"renderTextResponse",(function(){return In(u.queryResponse)?u.renderAllColumnsHiddenMessage():null})),lt(mt(u),"renderResponse",(function(){var t=u.props.displayType;return u.hasError(u.queryResponse)?u.renderError(u.queryResponse):"html"===t?u.renderHTMLMessage():u.state.customResponse?u.state.customResponse:!!e(u.queryResponse,"data.data.items")?u.renderSuggestionMessage(u.queryResponse.data.data.items,u.queryResponse.data.data.query_id):e(u.queryResponse,"data.data.replacements")?s.createElement(bo,{themeConfig:u.props.themeConfig,key:u.QUERY_VALIDATION_KEY,response:u.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return u.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"]})},onQueryValidationSelectOption:u.props.onQueryValidationSelectOption,initialSelections:u.props.queryValidationSelections,autoSelectSuggestion:u.props.autoSelectQueryValidationSuggestion}):u.noDataFound()?u.replaceErrorTextWithLinks(u.queryResponse.data.message):t&&e(u.queryResponse,"data.data.rows")?"help"===t?u.renderHelpResponse():"text"===t?u.renderTextResponse():"single-value"===t?u.renderSingleValueResponse():Nn(t)?u.renderTable():An(t)?u.renderChart():(console.warn("display type not recognized: ".concat(u.props.displayType," - rendering as plain text")),u.renderMessage("display type not recognized: ".concat(u.props.displayType))):null})),lt(mt(u),"renderReverseTranslation",(function(){var t,n,a;return $t(u.props.autoQLConfig).enableQueryInterpretation&&u.props.showQueryInterpretation&&null!==(t=u.queryResponse)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.data)&&void 0!==a&&a.interpretation?s.createElement(To,{authentication:u.props.authentication,onValueLabelClick:u.props.onRTValueLabelClick,appliedFilters:u.props.appliedFilters,isResizing:u.props.isResizing,reverseTranslation:e(u.queryResponse,"data.data.parsed_interpretation")}):null})),lt(mt(u),"renderFooter",(function(){return s.createElement("div",{className:"query-output-footer"},u.renderReverseTranslation(),u.renderDataLimitWarning())})),lt(mt(u),"render",(function(){return s.createElement(yt,null,s.createElement("div",{key:u.COMPONENT_KEY,ref:function(e){return u.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(u.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(Nn(u.props.displayType)?"table":"")},u.renderResponse(),u.renderFooter()),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-query-output-tooltip-".concat(u.COMPONENT_KEY),effect:"solid",place:"left",html:!0}),s.createElement(le,{className:"react-autoql-chart-tooltip",id:"react-autoql-chart-tooltip-".concat(u.COMPONENT_KEY),effect:"solid",html:!0}))})),u.COMPONENT_KEY=d(),u.QUERY_VALIDATION_KEY=d(),u.queryResponse=ce(t.queryResponse),u.supportedDisplayTypes=u.getCurrentSupportedDisplayTypes(),u.queryID=e(u.queryResponse,"data.data.query_id"),u.interpretation=e(u.queryResponse,"data.data.interpretation"),u.tableID=d(),u.pivotTableID=d(),null!==(r=t.tableConfigs)&&void 0!==r&&r.tableConfig&&u.isTableConfigValid(null===(i=t.tableConfigs)||void 0===i?void 0:i.tableConfig)){var p=t.tableConfigs,m=p.tableConfig,f=p.pivotTableConfig;u.tableConfig=ce(m),u.pivotTableConfig=ce(f)}var g=u.isCurrentDisplayTypeValid(t),h=t.displayType;g||(h=Fn(u.queryResponse,t.autoChartAggregations),u.onRecommendedDisplayType(h));var v=en(t.themeConfig).chartColors;return u.colorScale=Ce().range(v),_n(t.themeConfig),u.generateAllData(u.queryResponse,h),u.state={displayType:h,tableFilters:[],selectedSuggestion:t.selectedSuggestion},u}return it(o)}();lt(Do,"propTypes",{queryResponse:p.shape({}),queryInputRef:p.instanceOf(ma),authentication:bt,themeConfig:St,autoQLConfig:Et,dataFormatting:Ct,tableConfig:p.shape({}),onSuggestionClick:p.func,displayType:p.string,onQueryValidationSelectOption:p.func,autoSelectQueryValidationSuggestion:p.bool,queryValidationSelections:p.arrayOf(p.shape({})),renderSuggestionsAsDropdown:p.bool,selectedSuggestion:p.string,activeChartElementKey:p.string,enableColumnHeaderContextMenu:p.bool,isResizing:p.bool,enableDynamicCharting:p.bool,onTableConfigChange:p.func,onNoneOfTheseClick:p.func,autoChartAggregations:p.bool,onSupportedDisplayTypesChange:p.func,onRTValueLabelClick:p.func,isTaskModule:p.bool,onUpdate:p.func,onDrilldownStart:p.func,onDrilldownEnd:p.func,enableAjaxTableData:p.bool,rebuildTooltips:p.func}),lt(Do,"defaultProps",{authentication:Gt,themeConfig:Xt,autoQLConfig:Yt,dataFormatting:Wt,tableConfig:void 0,queryResponse:void 0,displayType:void 0,queryInputRef:void 0,onSuggestionClick:void 0,autoSelectQueryValidationSuggestion:!0,queryValidationSelections:void 0,renderSuggestionsAsDropdown:!1,selectedSuggestion:void 0,activeChartElementKey:void 0,enableColumnHeaderContextMenu:!1,isResizing:!1,enableDynamicCharting:!0,onNoneOfTheseClick:void 0,autoChartAggregations:!0,enableFilterLocking:!1,showQueryInterpretation:!1,isTaskModule:!1,enableAjaxTableData:!1,onRTValueLabelClick:void 0,onTableConfigChange:function(){},onQueryValidationSelectOption:function(){},onSupportedDisplayTypesChange:function(){},onErrorCallback:function(){},onRecommendedDisplayType:function(){},onUpdate:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){}});var xo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"showDisplayTypeButton",(function(t){return(!e.props.disableCharts||!nn.includes(t))&&(e.props.supportedDisplayTypes&&e.props.supportedDisplayTypes.includes(t)&&e.props.displayType!==t)})),lt(mt(e),"createVisButton",(function(t,n,a){return e.showDisplayTypeButton(t)?s.createElement("button",{onClick:function(){return e.props.onDisplayTypeChange(t)},className:"react-autoql-toolbar-btn","data-tip":n,"data-for":"react-autoql-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},a):null})),lt(mt(e),"render",(function(){var t=e.props,n=t.displayType,a=t.supportedDisplayTypes;return!a||a.length<=1||!a.includes("pivot_table")&&e.props.disableCharts?null:tn.includes(n)||nn.includes(n)?s.createElement(yt,null,s.createElement("div",{className:"".concat(e.props.className||""," viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",s.createElement(Kt,{type:"table"})),e.createVisButton("pivot_table","Pivot Table",s.createElement(Kt,{type:"pivot-table"})),e.createVisButton("column","Column Chart",s.createElement(Kt,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",s.createElement(Kt,{type:"bar-chart"})),e.createVisButton("line","Line Chart",s.createElement(Kt,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",s.createElement(Kt,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",s.createElement(Kt,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",s.createElement(Kt,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",s.createElement(Kt,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",s.createElement(Kt,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",s.createElement(Kt,{type:"stacked-line-chart"})))):null})),e}return it(n)}();lt(xo,"propTypes",{themeConfig:St,supportedDisplayTypes:p.arrayOf(p.string).isRequired,onDisplayTypeChange:p.func.isRequired,displayType:p.string,disableCharts:p.bool,vertical:p.bool}),lt(xo,"defaultProps",{themeConfig:Xt,displayType:void 0,disableCharts:!1,vertical:!1});var ko=xo,wo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),lt(mt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:s.createElement("div",null,s.createElement(Wa,{type:"default",onClick:e.props.onClose},"Back"),s.createElement(Wa,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading},e.props.confirmText||"Continue"))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(he,{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:$e($e({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},s.createElement("div",{className:"react-autoql-modal-body"},e.props.children),s.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return it(n)}();lt(wo,"propTypes",{isVisible:p.bool,onClose:p.func,onConfirm:p.func,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),confirmLoading:p.bool,confirmText:p.string,footer:p.element}),lt(wo,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var Ao=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),lt(mt(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()})),lt(mt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:s.createElement("div",null,e.props.showCancelButton&&s.createElement(Wa,{type:"default",onClick:e.onClose},"Cancel"),s.createElement(Wa,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(he,{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:$e($e({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},s.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,s.createElement(Kt,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),s.createElement("div",{className:"react-autoql-modal-body",style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&s.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())),s.createElement(wo,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.setState({isConfirmCloseModalVisible:!1}),e.props.onClose()}},s.createElement("h3",null,"Are you sure you want to leave this page?"),s.createElement("p",null,"All unsaved changes will be lost.")))})),e}return it(n)}();lt(Ao,"propTypes",{themeConfig:St,title:p.oneOfType([p.element,p.string]),titleIcon:p.oneOfType([p.element,p.instanceOf(Kt)]),isVisible:p.bool,onClose:p.func,onConfirm:p.func,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),showCancelButton:p.bool,showFooter:p.bool,enableBodyScroll:p.bool,confirmLoading:p.bool,confirmText:p.string,confirmDisabled:p.bool,footer:p.element,confirmOnClose:p.bool}),lt(Ao,"defaultProps",{themeConfig:Xt,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,onClose:function(){},onConfirm:function(){}});var No=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{columns:e.props.columns}),lt(mt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),lt(mt(e),"render",(function(){return s.createElement(Ao,{isVisible:e.props.isVisible,onClose:e.props.onClose,onConfirm:function(){return e.props.onConfirm(e.state.columns)},title:"Show/Hide Columns",enableBodyScroll:!0,width:"600px",confirmText:"Apply",style:{marginTop:"45px"},confirmLoading:e.props.isSettingColumns},s.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},s.createElement(ja,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:function(t){e.setState({columns:t})}})))})),e}return it(n)}();lt(No,"propTypes",{themeConfig:St,isSettingColumns:p.bool}),lt(No,"defaultProps",{themeConfig:Xt,isSettingColumns:!1});var Ro=["id"],Mo=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 s={headers:{Authorization:"Bearer ".concat(o)}};return l.post(r,i,s)},Vo=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 s=l.create({headers:{Authorization:"Bearer ".concat(o)}}),c="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a,"&offset=").concat(r,"&limit=").concat(i);return s.get(c).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},qo=function(t){var n=t.domain,a=t.apiKey,o=t.token,r=t.channelType;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=l.create({headers:{Authorization:"Bearer ".concat(o)}}),s="".concat(n,"/autoql/api/v1/notifications/channels?key=").concat(a,"&type=").concat(r);return i.get(s).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return 404===e(t,"response.status")?Promise.resolve({data:[]}):Promise.reject(e(t,"response.data"))}))},Io=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=l.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"))}))},Po=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=l.create({headers:{Authorization:"Bearer ".concat(o)}}),s="".concat(n,"/autoql/api/v1/data-alerts/").concat(r,"?key=").concat(a);return i.get(s).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Lo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.delete(s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Oo=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=l.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"))}))},Fo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.put(s,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Qo=function(e){var t=e.dataAlertId,n=e.status,a=e.type,o=e.domain,r=e.apiKey,i=e.token;return i&&r&&o?t?"PROJECT"===a?_o({dataAlertId:t,status:n,token:i,domain:o,apiKey:r}):zo({dataAlertId:t,status:n,token:i,domain:o,apiKey:r}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},zo=function(t){var n=t.dataAlertId,a=t.status,o=t.token,r=t.domain,i=t.apiKey,s={status:a},c={headers:{Authorization:"Bearer ".concat(o)}},u="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return l.put(u,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ho=function(t){var n=t.token,a=t.domain,o=t.apiKey,r=t.channelType,i=t.channelName,s=t.channelEmail,c=t.userName,u=t.userEmail;if(!n||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var p={headers:{Authorization:"Bearer ".concat(n)}},d={channel_type:r,channel_name:i,channel_email:s,sender_name:c,sender_email:u},m="".concat(a,"/autoql/api/v1/notifications/channels?key=").concat(o);return l.post(m,d,p).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Bo=function(t){var n=t.token,a=t.domain,o=t.apiKey,r=t.channelId,i=t.fileName,s=t.base64Data;if(!n||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var c={headers:{Authorization:"Bearer ".concat(n)}},u={attachment_name:i,attachment:s},p="".concat(a,"/autoql/api/v1/notifications/channels/").concat(r,"/send?key=").concat(o);return l.post(p,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},_o=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)}},s="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return l.delete(s,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)}},s="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return l.post(s,{},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})},Uo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(o);return i.put(s,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},jo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}});n.id;var s=dt(n,Ro),c="".concat(a,"/autoql/api/v1/data-alerts?key=").concat(o);return i.post(c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ko=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s={expression:n},c="".concat(a,"/autoql/api/v1/data-alerts/validate?key=").concat(o);return i.post(c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Go=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(o);return i.delete(s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Wo=function(t){var n=t.channelId,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/notifications/channels/").concat(n,"?key=").concat(o);return i.delete(s).then((function(){return Promise.resolve()})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Yo=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",at(et().mark((function e(){return et().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)})))),lt(mt(o),"componentDidUpdate",(function(e,t){o.state.count!==t.count&&o.props.onCount(o.state.count)})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.clearPollingComponent(),clearInterval(o.pollInterval)})),lt(mt(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=l.create({headers:{Authorization:"Bearer ".concat(a)}}),s="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(r);return i.get(s,{timeout:18e4}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}($e($e({},Jt(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 Promise.reject(e)}))})),lt(mt(o),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),lt(mt(o),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",o.COMPONENT_KEY)})),lt(mt(o),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),lt(mt(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.");throw console.error(n),o.props.onErrorCallback(n),clearInterval(o.pollInterval),new Error(n)}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))})),lt(mt(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=l.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"))}))})($e({},Jt(o.props.authentication))).catch((function(e){console.error(e)})).finally((function(){o.setState({count:0})}))})),lt(mt(o),"getCurrentCount",(function(){return"number"==typeof o.props.count?o.props.count:o.state.count})),lt(mt(o),"renderBadge",(function(){var e=o.props.overflowCount,t=o.getCurrentCount();if(!t)return null;if(o.props.useDot)return s.createElement("div",{className:"react-autoql-notifications-badge-dot"});var n=t;return t>e&&(n="".concat(e,"+")),s.createElement("div",{className:"react-autoql-notifications-badge"},n)})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.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:$e({},o.props.style),onClick:function(){o.props.clearCountOnClick&&o.resetCount()}},s.createElement(Kt,{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=d(),o.HAS_FETCHED_COUNT=!1,o.pollInterval=void 0,o.state={count:0},o}return it(a)}();lt(Yo,"propTypes",{authentication:bt,overflowCount:p.number,style:p.shape({}),size:p.number,useDot:p.bool,clearCountOnClick:p.bool,onNewNotification:p.func,onErrorCallback:p.func,pausePolling:p.bool,count:p.number,onCount:p.func}),lt(Yo,"defaultProps",{authentication:Gt,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var Xo=["icon","type"],Jo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{focused:!1}),lt(mt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),lt(mt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),lt(mt(e),"focus",(function(){e.inputRef&&e.inputRef.focus()})),lt(mt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var a=dt(t,Xo),o=a.className;return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(o," "),"data-test":"react-autoql-input"},"multi"===e.props.type?s.createElement("textarea",st({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):s.createElement(c,null,s.createElement("input",st({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&s.createElement(Kt,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return it(n)}();lt(Jo,"propTypes",{icon:p.string,type:p.string}),lt(Jo,"defaultProps",{icon:void 0,type:"single"});var Zo=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"autoCompleteTimer",void 0),lt(mt(o),"state",$e({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{}}(o.props.initialData))),lt(mt(o),"componentDidMount",(function(){o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state,t)||o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentWillUnmount",(function(){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer)})),lt(mt(o),"parseJSON",(function(e){1===e.length?(o.TERM_ID_1=e[0].id,o.TERM_ID_2=d(),o.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(o.TERM_ID_1=e[0].id,o.TERM_ID_2=e[1].id,o.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),lt(mt(o),"getJSON",(function(){if("EXISTS"===o.state.conditionSelectValue)return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value}];var e=o.state.input2Value;return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value},{id:o.TERM_ID_2,term_type:o.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:o.isNumerical(e)?de(e):e}]})),lt(mt(o),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=de(e);return!Number.isNaN(Number(n))})),lt(mt(o),"isComplete",(function(){return"EXISTS"===o.state.conditionSelectValue?!!o.state.input1Value:!!e(o.state.input1Value,"length")&&!!e(o.state.input2Value,"length")})),lt(mt(o),"isValid",(function(){return!0})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"onSuggestionsFetchRequested",(function(e){var t=e.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e($e($e({},Jt(o.props.authentication)),getAutoQLConfig(o.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var r=0;r<t.length&&(n.push(t[r]),4!==r);r++);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)}o.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),lt(mt(o),"renderReadOnlyRule",(function(){return s.createElement(yt,null,s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},"".concat(Un(o.state.input1Value))),s.createElement("span",{className:"read-only-rule-term"},"".concat(o.renderConditionOperator(o.state.conditionSelectValue))),"EXISTS"!==o.state.conditionSelectValue&&s.createElement("span",{className:"read-only-rule-term"},Un(o.state.input2Value)),o.props.andOrValue&&s.createElement("span",{className:"read-only-rule-term"},o.props.andOrValue)))})),lt(mt(o),"renderValidationError",(function(){return s.createElement("div",{className:"expression-term-validation-error"},s.createElement(Kt,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),lt(mt(o),"renderCompareBtn",(function(){return"EXISTS"===o.state.conditionSelectValue?s.createElement(Wa,{onClick:function(){o.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),lt(mt(o),"renderConditionSelector",(function(){return s.createElement(yo,{themeConfig:o.props.themeConfig,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:o.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){o.setState({conditionSelectValue:e})}})})),lt(mt(o),"renderRule",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},s.createElement("div",{className:"react-autoql-rule-first-input-container"},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query",value:o.state.input1Value,onChange:function(e){return o.setState({input1Value:e.target.value})}}),!o.state.isFirstTermValid&&o.renderValidationError()),o.renderCompareBtn()),s.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===o.state.conditionSelectValue?" hidden":"")},o.renderConditionSelector(),s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query or number",value:o.state.input2Value,onChange:function(e){return o.setState({input2Value:e.target.value})}}),!o.state.isSecondTermValid&&o.renderValidationError()),s.createElement(Kt,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return o.setState({conditionSelectValue:"EXISTS"})}}))))})),lt(mt(o),"render",(function(){return o.props.readOnly?o.renderReadOnlyRule():o.renderRule()})),o.initialData={},o.TERM_ID_1=d(),o.TERM_ID_2=d();var r=t.initialData;return r&&1===r.length?(o.TERM_ID_1=r[0].id,o.TERM_ID_2=d()):r&&r.length>1&&(o.TERM_ID_1=r[0].id,o.TERM_ID_2=r[1].id),o}return it(a)}();lt(Zo,"propTypes",{authentication:bt,themeConfig:St,ruleId:p.string,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool}),lt(Zo,"defaultProps",{authentication:Gt,themeConfig:Xt,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var $o=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=ce(t[0].term_value[0].term_value):a=!0),{expression:n,expressionError:a}},er=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"ruleRef",void 0),lt(mt(t),"state",$e({},$o(t.props.expression))),lt(mt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(t),"componentDidUpdate",(function(e,n){se(e.expression,t.props.expression)||t.setState($e({},$o(t.props.expression))),se(n,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),lt(mt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),lt(mt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),lt(mt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),lt(mt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(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})),lt(mt(t),"renderExpressionErrorMessage",(function(){return s.createElement("div",{className:"expression-error-message"},s.createElement(Kt,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported."," ",s.createElement("a",{onClick:t.resetConditions},"Reset Conditions"))})),lt(mt(t),"renderReadOnlyRule",(function(){return s.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():s.createElement(Zo,{themeConfig:t.props.themeConfig,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",d()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),lt(mt(t),"renderRule",(function(){return s.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},s.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():s.createElement(Zo,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",d()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return it(a)}();lt(er,"propTypes",{authentication:bt,themeConfig:St,expression:p.oneOfType([p.shape({}),p.array]),readOnly:p.bool,onChange:p.func}),lt(er,"defaultProps",{authentication:Gt,themeConfig:Xt,expression:void 0,readOnly:!1,onChange:function(){}}),n.extend(a);var tr=function(t){ct(o,s.Component);var a=gt(o);function o(){var t;ot(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return lt(mt(t=a.call.apply(a,[this].concat(i))),"COMPONENT_KEY",d()),lt(mt(t),"supportedDisplayTypes",[]),lt(mt(t),"state",{supportedDisplayTypes:[],ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),lt(mt(t),"componentDidUpdate",(function(e){if(!e.activeNotificationData&&t.props.activeNotificationData){var n={data:t.props.activeNotificationData},a=t.props.autoChartAggregations&&t.state.supportedDisplayTypes.includes("column")?"column":Fn(n,t.props.autoChartAggregations);t.setState({displayType:a})}})),lt(mt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),lt(mt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),Po($e({dataAlertId:n.data_alert_id},Jt(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),lt(mt(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)})),lt(mt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),Fo($e($e({},Jt(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDismissSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),Lo($e($e({},Jt(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"changeRuleStatus",(function(e,n){Qo($e({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Jt(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"formatTimestamp",(function(e){var t=n.unix(e).format("h:mma"),a=n.unix(e).format("MM-DD-YY"),o=n().format("MM-DD-YY"),r=n().subtract(1,"d").format("MM-DD-YY");return a===o?"Today at ".concat(t):a===r?"Yesterday at ".concat(t):n().isSame(e,"year")?"".concat(n.unix(e).format("MMMM Do")," at ").concat(t):"".concat(n.unix(e).format("MMMM Do, YYYY")," at ").concat(t)})),lt(mt(t),"renderAlertColorStrip",(function(){return s.createElement("div",{className:"react-autoql-notification-alert-strip"})})),lt(mt(t),"renderNotificationHeader",(function(e){return s.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},s.createElement("div",{className:"react-autoql-notification-display-name-container"},s.createElement("div",{className:"react-autoql-notification-display-name"},e.title),s.createElement("div",{className:"react-autoql-notification-description"},e.message),s.createElement("div",{className:"react-autoql-notification-timestamp"},s.createElement(Kt,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?s.createElement("div",{className:"react-autoql-notification-dismiss-btn"},s.createElement(Kt,{type:"notification-off",className:"react-autoql-notification-dismiss-icon","data-tip":"Dismiss","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDismissClick(n,e),le.hide()}})):s.createElement("div",{className:"react-autoql-notification-dismiss-btn"},s.createElement(Kt,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),le.hide()}})))})),lt(mt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?s.createElement(Wa,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},s.createElement(Kt,{type:"notification-off"})," Turn Data Alert Off"):s.createElement(Wa,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},s.createElement(Kt,{type:"notification"})," Turn Data Alert On"):s.createElement("div",null)})),lt(mt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?pe(t.state.ruleDetails)?s.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):s.createElement(Wa,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},s.createElement(Kt,{type:"edit"})," Edit Data Alert"):s.createElement("div",null)})),lt(mt(t),"renderNotificationFooter",(function(e){return s.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),lt(mt(t),"renderNotificationContent",(function(n){var a,o=n.data_return_query,r=Un(o);return a=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},s.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},s.createElement("div",{className:"react-autoql-notification-details-container"},s.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},s.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?s.createElement(c,null,s.createElement("div",{className:"react-autoql-notification-query-title"},r),s.createElement(Do,{authentication:t.props.authentication,ref:function(e){return t.OUTPUT_REF=e},queryResponse:a,autoQLConfig:{enableDrilldowns:!1},themeConfig:t.props.themeConfig,displayType:t.state.displayType,autoChartAggregations:t.props.autoChartAggregations,style:{flex:"1"},enableAjaxTableData:t.props.enableAjaxTableData,onSupportedDisplayTypesChange:function(e){return t.setState({supportedDisplayTypes:e})},onRecommendedDisplayType:function(e){return t.setState({displayType:e})}})):s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null))),e(t.state.supportedDisplayTypes,"length")>1&&s.createElement("div",{className:"react-autoql-notification-viz-switcher"},s.createElement(ko,{themeConfig:t.props.themeConfig,supportedDisplayTypes:t.state.supportedDisplayTypes,displayType:t.state.displayType,onDisplayTypeChange:function(e){return t.setState({displayType:e})},vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&s.createElement("div",{className:"react-autoql-notification-details"},s.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),s.createElement(er,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),lt(mt(t),"render",(function(){var e=t.props.notification;return s.createElement(yt,null,s.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 it(o)}();lt(tr,"propTypes",{authentication:bt,themeConfig:St,notification:p.shape({}).isRequired,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onRuleFetchCallback:p.func,onExpandCallback:p.func,onDismissCallback:p.func,onDeleteCallback:p.func,onDeleteSuccessCallback:p.func,onDismissSuccessCallback:p.func,onErrorCallback:p.func,autoChartAggregations:p.bool,enableAjaxTableData:p.bool.isRequired}),lt(tr,"defaultProps",{authentication:Gt,themeConfig:Xt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onErrorCallback:function(){}});var nr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{activeStep:t.props.initialActiveStep||0}),lt(mt(t),"componentDidMount",(function(){t.props.steps&&t.props.steps.length?null==t.props.initialActiveStep||Number.isNaN(t.props.initialActiveStep)||e(t.props.steps,"".concat(t.props.initialActiveStep))||(console.error(new Error("Initial active step provided is invalid")),t.setState({activeStep:0})):console.error(new Error("No steps were provided"))})),lt(mt(t),"prevStep",(function(){t.state.activeStep>=1&&t.onStepTitleClick(t.state.activeStep-1)})),lt(mt(t),"nextStep",(function(){var e=Number.isNaN(t.state.activeStep)?0:t.state.activeStep+1;t.onStepTitleClick(e)})),lt(mt(t),"setStep",(function(e){t.setState({activeStep:e})})),lt(mt(t),"getHeightOfStepContent",(function(e){if(t.props.collapsible){var n=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));if(n)return n.scrollHeight+15}})),lt(mt(t),"onStepTitleClick",(function(e,n){try{n&&n.onClick&&n.onClick(),t.autoHideTimeout&&clearTimeout(t.autoHideTimeout);var a=e,o=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(t.state.activeStep));if(o&&(o.style.height="".concat(t.getHeightOfStepContent(t.state.activeStep),"px"),setTimeout((function(){o.style.height="10px"}),0)),e!==t.state.activeStep){var r=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));r&&(r.style.height="".concat(t.getHeightOfStepContent(e),"px"),clearTimeout(t.autoHideTimeout),t.autoHideTimeout=setTimeout((function(){var n=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));n&&(n.style.height="auto")}),500))}else a=void 0;t.setState({activeStep:a})}catch(e){console.error(e)}})),lt(mt(t),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),lt(mt(t),"render",(function(){return t.props.steps&&t.props.steps.length?s.createElement(yt,null,s.createElement("div",{id:"react-autoql-steps-".concat(t.COMPONENT_KEY),className:"react-autoql-steps-container","data-test":"react-autoql-steps"},t.props.steps.map((function(e,n){return s.createElement("div",{key:"react-autoql-steps-".concat(t.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},s.createElement("div",{className:"react-autoql-step-container\n ".concat(t.getStepStatus(e),"\n ").concat(t.props.collapsible&&n===t.state.activeStep?" active":""),"data-test":"react-autoql-step-container-".concat(n)},s.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return t.onStepTitleClick(n,e)}},s.createElement("div",{className:"react-autoql-step-title"},e.title)),s.createElement("div",{id:"react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},s.createElement("div",{className:"react-autoql-step-subtitle"},e.subtitle||null),s.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},e.content)),s.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),t}return it(a)}();lt(nr,"propTypes",{themeConfig:St,steps:p.arrayOf(p.shape({})),initialActiveStep:p.number,collapsible:p.bool}),lt(nr,"defaultProps",{themeConfig:Xt,steps:void 0,initialActiveStep:void 0,collapsible:!0});var ar=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"renderButtonType",(function(){return s.createElement(yt,null,s.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)),s.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(o?" active":""),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},s.createElement("div",null,e))}))))})),lt(mt(t),"renderOriginalType",(function(){return s.createElement(yt,null,s.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)),s.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},s.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:a}),s.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),lt(mt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return it(a)}();lt(ar,"propTypes",{options:p.arrayOf(p.string),onChange:p.func,value:p.string,multiSelect:p.bool,type:p.string,tooltips:p.arrayOf(p.string),tooltipId:p.string}),lt(ar,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var or=["onChange","options","selectedOption","className"],rr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),lt(mt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),lt(mt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=dt(t,or);return s.createElement(yt,null,s.createElement(ge,st({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 it(n)}();lt(rr,"propTypes",{onChange:p.func,options:p.arrayOf(p.shape({})),selectedOption:p.shape({})}),lt(rr,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var ir=fe.tz.guess(),lr=fe.tz.names().map((function(e){return{value:e,label:e}})),sr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),lt(mt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||ir;return lr.find((function(e){return e.label===t}))})),lt(mt(e),"render",(function(){var t=e.getSelectedOption();return s.createElement(rr,{className:"react-autoql-timezone-select",options:lr,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return it(n)}();lt(sr,"propTypes",{onChange:p.func,defaultSelection:p.string}),lt(sr,"defaultProps",{onChange:function(){},defaultSelection:void 0});var cr=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}},ur=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{frequencySelectValue:cr(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),lt(mt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),lt(mt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),lt(mt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),lt(mt(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}})),lt(mt(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})),lt(mt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),lt(mt(t),"renderTimezoneComponent",(function(){return s.createElement("div",null,s.createElement("span",null,"Time zone: "),s.createElement(sr,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},s.createElement("div",{className:"frequency-settings-container"},s.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),s.createElement(ar,{themeConfig:t.props.themeConfig,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})}}))),s.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return it(a)}();lt(ur,"propTypes",{themeConfig:St,dataAlert:p.shape({}),onChange:p.func,onCompletedChange:p.func,onErrorCallback:p.func}),lt(ur,"defaultProps",{themeConfig:Xt,dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var pr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"NEW_NOTIFICATION_MODAL_ID",d()),lt(mt(t),"state",{titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1}),lt(mt(t),"componentDidMount",(function(){_n(t.props.themeConfig),t.initializeFields()})),lt(mt(t),"componentDidUpdate",(function(e,n){if(se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig),!t.props.isVisible&&e.isVisible&&setTimeout(t.resetFields,500),t.props.isVisible&&!e.isVisible&&t.initializeFields(),t.props.initialQuery&&t.props.initialQuery!==e.initialQuery){t.resetFields();var a=t.createExpressionJSONFromQuery(t.props.initialQuery);t.setState({isExpressionSectionComplete:!0,expressionJSON:a})}t.state.frequencyCategorySelectValue!==n.frequencyCategorySelectValue&&t.setState({everyCheckboxValue:!1,frequencySelectValue:"MONTH",weekSelectValue:[2],monthSelectValue:[1],yearSelectValue:[1]})})),lt(mt(t),"resetFields",(function(){t.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),lt(mt(t),"initializeFields",(function(){if(pe(t.props.currentDataAlert)){if(t.props.initialQuery&&"string"==typeof t.props.initialQuery){var n=t.createExpressionJSONFromQuery(t.props.initialQuery);t.setState({isExpressionSectionComplete:!0,expressionJSON:n})}}else{var a=t.props.currentDataAlert;t.setState({titleInput:a.title,messageInput:a.message,dataReturnQuery:a.data_return_query,isDataReturnDirty:!0,expressionJSON:e(t.props.currentDataAlert,"expression")})}})),lt(mt(t),"createExpressionJSONFromQuery",(function(e){return[{condition:"TERMINATOR",id:d(),term_type:"group",term_value:[{id:d(),term_type:"group",condition:"TERMINATOR",term_value:[{id:d(),condition:"EXISTS",term_type:"query",term_value:e}]}]}]})),lt(mt(t),"getDataAlertData",(function(){try{var n,a=t.state,o=a.titleInput,r=a.messageInput,i=ce(t.state.expressionJSON);t.expressionRef&&(i=t.expressionRef.getJSON(),n=t.expressionRef.getFirstQuery());var l={};return t.scheduleBuilderRef&&(l=t.scheduleBuilderRef.getData()),{id:e(t.props.currentDataAlert,"id"),title:o,data_return_query:n,message:r,expression:i,notification_type:l.notificationType,reset_period:l.resetPeriod,time_zone:l.timezone}}catch(e){console.error(e)}})),lt(mt(t),"onExpressionChange",(function(e,n,a){t.setState({isExpressionSectionComplete:e,isFirstSectionComplete:t.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:a})})),lt(mt(t),"isFirstSectionComplete",(function(){var e=!1;return t.expressionRef&&(e=t.expressionRef.isComplete()),t.props.enableQueryValidation?e&&!!t.state.titleInput&&t.state.isExpressionValidated&&t.state.isExpressionValid:e&&!!t.state.titleInput})),lt(mt(t),"onDataAlertSave",(function(){t.setState({isSavingDataAlert:!0});var e=$e($e({},t.getDataAlertData()),{},{project_id:t.props.selectedDemoProjectId}),n=$e({dataAlert:e},Jt(t.props.authentication));t.props.isManagement?(t.props.onManagementCreateDataAlert(e),t.setState({isSavingDataAlert:!1})):e.id?Uo($e({},n)).then((function(e){t.props.onSave(e),t.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isSavingDataAlert:!1})})):jo($e({},n)).then((function(e){t.props.onSave(e),t.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isSavingDataAlert:!1})}))})),lt(mt(t),"validateFn",t.props.onValidate||Ko),lt(mt(t),"validateExpression",(function(){try{if(t.setState({isValidating:!0,isExpressionValidated:!1}),t.expressionRef){var n=t.expressionRef.getJSON();t.validateFn($e($e({},t.props.authentication),{},{expression:n})).then((function(){t.setState({isValidating:!1,isExpressionValid:!0,isExpressionValidated:!0}),t.stepsRef&&t.stepsRef.nextStep()})).catch((function(n){t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0,expressionError:e(n,"message")})}))}else t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}catch(e){console.error(e),t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}})),lt(mt(t),"renderValidateBtn",(function(){var n;return t.expressionRef&&t.expressionRef.state.expressionError?null:s.createElement(c,null,t.state.isExpressionValidated&&t.state.isExpressionValid&&s.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},s.createElement(Kt,{className:"expression-valid-checkmark",type:"check","data-for":"react-autoql-data-alert-modal-tooltip","data-tip":"Expression is valid"})),t.state.isExpressionValidated&&!t.state.isExpressionValid&&!!t.state.expressionError&&s.createElement("div",{className:"expression-invalid-message-container"},s.createElement("span",{className:"expression-invalid-message"},s.createElement(Kt,{type:"warning-triangle"}))," ",s.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},t.state.expressionError)),s.createElement(Wa,(lt(n={type:"default",onClick:t.validateExpression,loading:t.state.isValidating},"type","primary"),lt(n,"disabled",!t.state.titleInput||!e(t.expressionRef,"state.expression[0].term_value")),lt(n,"style",{position:"absolute",right:0}),n),"Check Alert & continue"))})),lt(mt(t),"setStep",(function(e){t.stepsRef&&t.stepsRef.setStep(e)})),lt(mt(t),"renderNextBtn",(function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=arguments.length>3?arguments[3]:void 0;return s.createElement(Wa,{className:e,onClick:function(){a(),t.stepsRef&&t.stepsRef.nextStep()},disabled:n,type:"primary"},o||"Continue")})),lt(mt(t),"renderBackBtn",(function(e){return s.createElement(Wa,{className:e,onClick:function(){t.stepsRef&&t.stepsRef.prevStep()}},"Back")})),lt(mt(t),"renderSetUpDataAlertStep",(function(){return s.createElement("div",null,s.createElement("div",{style:{display:"flex"}},s.createElement("div",{style:{width:"80%"}},s.createElement("p",null,"Name your Data Alert:"),s.createElement(Jo,{className:"react-autoql-notification-display-name-input",placeholder:"Add an Alert Name",icon:"title",maxLength:"50",value:t.state.titleInput,onChange:function(e){var n=t.state.isExpressionSectionComplete&&!!e.target.value;t.setState({titleInput:e.target.value,isFirstSectionComplete:n})}})),s.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),s.createElement(Kt,{"data-for":"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,color:"#26A7Df"}))),s.createElement("div",{style:{display:"flex"}},s.createElement("div",{style:{width:"80%"}},s.createElement("p",null,"Notify me when:"),s.createElement(er,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,ref:function(e){return t.expressionRef=e},key:"expression-".concat(t.NEW_NOTIFICATION_MODAL_ID),onChange:t.onExpressionChange,enableQueryValidation:t.props.enableQueryValidation,expression:e(t.props.currentDataAlert,"expression",t.state.expressionJSON)})),s.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),s.createElement(Kt,{"data-for":"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,color:"#26A7Df"}))),s.createElement("div",{className:"step-btn-container"},t.props.enableQueryValidation?t.renderValidateBtn():t.renderNextBtn("first-step-next-btn",t.props.enableQueryValidation&&(!t.state.isExpressionValidated||!t.state.isExpressionValid))))})),lt(mt(t),"renderFrequencyStep",(function(){return s.createElement("div",null,s.createElement(ur,{themeConfig:t.props.themeConfig,ref:function(e){return t.scheduleBuilderRef=e},key:"schedule-".concat(t.NEW_NOTIFICATION_MODAL_ID),dataAlert:t.props.currentDataAlert,onCompletedChange:function(e){t.setState({isScheduleSectionComplete:e})},onErrorCallback:t.props.onErrorCallback}),s.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn"),t.renderNextBtn("second-step-next-btn",!t.state.isScheduleSectionComplete,(function(){return t.setState({isThirdSectionDirty:!0})}))))})),lt(mt(t),"renderAlertPreferencesStep",(function(){return s.createElement("div",null,s.createElement("p",null,"Optional:"),s.createElement(Jo,{className:"react-autoql-notification-message-input",placeholder:"This message will be visible when a notification is sent.",type:"multi",maxLength:"200",value:t.state.messageInput,onChange:function(e){return t.setState({messageInput:e.target.value})}}),s.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn")))})),lt(mt(t),"onDataAlertDelete",(function(){var n=e(t.props.currentDataAlert,"id");n&&(t.setState({isDeletingDataAlert:!0}),Go(n,Jt(t.props.authentication)).then((function(){t.setState({isDeletingDataAlert:!1,isConfirmDeleteModalVisible:!1}),t.props.onDelete(n),t.props.onClose(!1)})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isDeletingDataAlert:!1})})))})),lt(mt(t),"getModalContent",(function(){return t.props.isVisible?[{title:"Set Up Your Alert",content:t.renderSetUpDataAlertStep(),complete:t.isFirstSectionComplete(),error:t.props.enableQueryValidation&&t.state.isExpressionValidated&&!t.state.isExpressionValid},{title:"Set Notification Preferences",content:t.renderFrequencyStep(),complete:t.state.isScheduleSectionComplete},{title:"Compose Notification Message",content:t.renderAlertPreferencesStep(),complete:t.state.isThirdSectionDirty||!!t.props.currentDataAlert,onClick:function(){t.setState({isThirdSectionDirty:!0})}}]:null})),lt(mt(t),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),lt(mt(t),"render",(function(){var e=t.getModalContent();return s.createElement(yt,null,s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-modal-tooltip",effect:"solid",delayShow:500,html:!0}),s.createElement(Ao,{themeConfig:t.props.themeConfig,title:t.props.title,titleIcon:pe(t.props.currentDataAlert)?s.createElement("span",null):s.createElement(Kt,{type:"edit"}),ref:function(e){return t.modalRef=e},isVisible:t.props.isVisible,onClose:t.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:s.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},s.createElement("div",null,t.props.currentDataAlert&&t.props.allowDelete&&s.createElement(Wa,{type:"danger",onClick:function(){t.setState({isConfirmDeleteModalVisible:!0})},loading:t.state.isDeletingDataAlert},"Delete Data Alert")),s.createElement("div",null,s.createElement(Wa,{onClick:function(){t.modalRef&&t.modalRef.onClose()}},"Cancel"),s.createElement(Wa,{type:"primary",loading:t.state.isSavingDataAlert,onClick:t.onDataAlertSave,disabled:t.isSaveButtonDisabled(e)},"Finish & Save")))},t.props.isVisible&&s.createElement("div",{className:"notification-modal-content"},s.createElement(nr,{themeConfig:t.props.themeConfig,ref:function(e){return t.stepsRef=e},steps:e}))),s.createElement(wo,{isVisible:t.state.isConfirmDeleteModalVisible,onConfirm:t.onDataAlertDelete,confirmLoading:t.state.isDeletingDataAlert,onClose:function(){t.setState({isConfirmDeleteModalVisible:!1})},confirmText:"Delete",width:"450px"},s.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),s.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),t}return it(a)}();lt(pr,"propTypes",{authentication:bt,onErrorCallback:p.func,onSave:p.func,initialQuery:p.string,currentDataAlert:p.shape({}),isVisible:p.bool,allowDelete:p.bool,onClose:p.func,themeConfig:St,isManagement:p.bool,onManagementCreateDataAlert:p.func,onManagementDeleteDataAlert:p.func,title:p.string,titleIcon:p.oneOfType([p.element,p.instanceOf(Kt)]),enableQueryValidation:p.bool,onValidate:p.func}),lt(pr,"defaultProps",{authentication:Gt,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},themeConfig:Xt,isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var dr=["style"],mr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{}),lt(mt(e),"render",(function(){return s.createElement(ve,{className:e.props.className,ref:e.props.innerRef,renderTrackHorizontal:function(e){var t=e.style,n=dt(e,dr);return s.createElement("div",st({},n,{style:$e($e({},t),{},{left:"50%",width:"100px",top:0,transform:"translateX(-50%)"})}))}},e.props.children)})),e}return it(n)}();lt(mr,"propTypes",{}),lt(mr,"defaultProps",{});var fr="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==",gr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"MODAL_COMPONENT_KEY",d()),lt(mt(t),"NOTIFICATION_FETCH_LIMIT",10),lt(mt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0,hasMore:!0}),lt(mt(t),"componentDidMount",(function(){t.getNotifications(),_n(t.props.themeConfig)})),lt(mt(t),"componentDidUpdate",(function(e){se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig)})),lt(mt(t),"getNotifications",(function(){Vo($e($e({},t.props.authentication),{},{offset:t.state.nextOffset,limit:t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var a,o,r,i=ce(t.state.notificationList),l=t.state.nextOffset,s=t.state.pagination;e(n,"items.length")&&(i=[].concat(ht(i),ht(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.setState({notificationList:i,pagination:s,nextOffset:l,hasMore:c,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),lt(mt(t),"refreshNotifications",(function(){Vo($e($e({},Jt(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var n=t.detectNewNotifications(e.items);if(!se(e.items,t.state.notificationList))if(null!=n&&n.length&&10!==(null==n?void 0:n.length)){var a=[].concat(ht(n),ht(t.state.notificationList));t.setState({notificationList:a,pagination:$e({},e.pagination),nextOffset:a.length-1})}else t.setState({notificationList:e.items,pagination:e.pagination})}))})),lt(mt(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})),lt(mt(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),$e($e({},t),{},{expanded:!t.expanded})):$e($e({},t),{},{expanded:!1})}));t.setState({notificationList:a,activeNotificationId:n})})),lt(mt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return $e($e({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Oo($e({},Jt(t.props.authentication))).then((function(){t.props.onDismissCallback(e),t.props.onChange(e)})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?$e($e({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n},(function(){t.props.onDismissCallback(n)}))})),lt(mt(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)}))})),lt(mt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),lt(mt(t),"renderDismissAllButton",(function(){return s.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},s.createElement("span",{onClick:t.onDismissAllClick},s.createElement(Kt,{type:"notification-off",style:{verticalAlign:"middle"}})," ","Dismiss All"))})),lt(mt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),lt(mt(t),"renderEditDataAlertModal",(function(){return s.createElement(pr,{key:t.MODAL_COMPONENT_KEY,authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:t.state.isEditModalVisible,onClose:function(){return t.setState({isEditModalVisible:!1})},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?s.createElement(Kt,{type:"edit"}):s.createElement("span",null)})})),lt(mt(t),"render",(function(){return t.props.shouldRender?t.state.isFetchingFirstNotifications?s.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?s.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",s.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},s.createElement(Wa,{onClick:t.getInitialNotifications},"Try Again"))):s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-list-container","data-test":"notification-list"},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?s.createElement(c,null,t.renderDismissAllButton(),s.createElement(mr,null,s.createElement(ue,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,loader:s.createElement("div",{className:"loader",key:0},s.createElement(ya,null)),useWindow:!1},s.createElement("div",{className:"notification-feed-list"},t.state.notificationList.map((function(e,n){return s.createElement(tr,{key:"notification-item-".concat(n),authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,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})})))))):s.createElement("div",{className:"empty-notifications-message"},s.createElement("img",{className:"empty-notifications-img",src:fr}),s.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),s.createElement("div",null,"Stay tuned!"),s.createElement("br",null),t.props.showCreateAlertBtn&&s.createElement(Wa,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal())):null})),t}return it(a)}();lt(gr,"propTypes",{authentication:bt,themeConfig:St,onCollapseCallback:p.func,onExpandCallback:p.func,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,onDismissCallback:p.func,onDeleteCallback:p.func,onChange:p.func,autoChartAggregations:p.bool,showCreateAlertBtn:p.bool,enableAjaxTableData:p.bool,shouldRender:p.bool}),lt(gr,"defaultProps",{authentication:Gt,themeConfig:Xt,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(){},onChange:function(){}});var hr=function(e){var t=n(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},vr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts(),_n(t.props.themeConfig)})),lt(mt(t),"componentDidUpdate",(function(e,n){se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig),se(Jt(t.props.authentication),Jt(e.authentication))||t.getDataAlerts()})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1})),lt(mt(t),"getDataAlerts",(function(n){Io($e($e({},Jt(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)}))})),lt(mt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),lt(mt(t),"onAddClick",(function(){t.setState({isEditModalVisible:!0,activeDataAlert:void 0})})),lt(mt(t),"onDataAlertSave",(function(){t.getDataAlerts(),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1})})),lt(mt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),lt(mt(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?$e($e({},e),{},{status:a}):e}));t.setState(lt({},"".concat(o),r)),Qo($e({dataAlertId:n.id,type:n.type,status:a},Jt(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.getDataAlerts()}))})),lt(mt(t),"renderNotificationEditModal",(function(){return s.createElement(pr,{ref:function(e){return t.editModalRef=e},themeConfig:t.props.themeConfig,key:t.COMPONENT_KEY,authentication:Jt(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?s.createElement(Kt,{type:"edit"}):s.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),lt(mt(t),"renderNotificationGroupTitle",(function(e,n,a){return s.createElement("div",{className:"react-autoql-notification-title-container"},s.createElement("div",{style:{paddingLeft:"10px"}},s.createElement("div",{style:{fontSize:"17px"}},e),s.createElement("div",{style:{fontSize:"11px",opacity:.6}},n)),a&&t.props.showCreateAlertBtn&&s.createElement("div",{className:"react-autoql-notification-add-btn",onClick:t.onAddClick,"data-tip":"Create Data Alert","data-for":"react-autoql-notification-settings-tooltip"},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon"})))})),lt(mt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),lt(mt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),lt(mt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),lt(mt(t),"renderNotificationlist",(function(n,a){return"project"!==n||e(a,"length")?s.createElement("div",{className:"data-alerts-list-container"},"custom"===n&&t.renderNotificationGroupTitle("Custom Data Alerts","View and manage your custom Data Alerts",!0),"custom"===n&&!e(a,"length")&&t.renderEmptyListMessage(),"project"===n&&t.renderNotificationGroupTitle("Subscribe to a Data Alert","Choose from a range of ready-to-use Alerts that have been set up for you"),s.createElement("div",{className:"react-autoql-notification-settings-container"},a&&a.map((function(e,n){return s.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},s.createElement("div",{className:"react-autoql-notification-setting-item-header"},s.createElement("div",{className:"react-autoql-notification-setting-display-name"},s.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},s.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?s.createElement(Kt,{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}):s.createElement(Kt,{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)),s.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&s.createElement("span",null," - ",e.message))),s.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&s.createElement(Kt,{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&&s.createElement(Kt,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat(hr(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?s.createElement(s.Fragment,null,"CUSTOM"===e.type&&s.createElement(Wa,{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()}},s.createElement("span",{className:"react-autoql-re-initialize-btn-text"},s.createElement(Kt,{type:"warning-triangle"})," Resend")),s.createElement(Ua,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):s.createElement(Ua,{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),le.hide()}}))))})))):null})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},s.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),s.createElement("br",null),t.props.showCreateAlertBtn&&s.createElement(Wa,{type:"primary",onClick:t.onAddClick,style:{marginTop:"10px"}},"Create Data Alert"))})),lt(mt(t),"render",(function(){if(!t.state.customAlertsList)return s.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},s.createElement(da,null));var n=e(t.state,"projectAlertsList",[]),a=e(t.state,"customAlertsList",[]);return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",a),t.renderNotificationEditModal(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return it(a)}();lt(vr,"propTypes",{authentication:bt,themeConfig:St,onErrorCallback:p.func,showCreateAlertBtn:p.bool,onSuccessAlert:p.func}),lt(vr,"defaultProps",{authentication:Gt,themeConfig:Xt,showCreateAlertBtn:!1,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var yr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"autoCompleteTimer",void 0),lt(mt(o),"state",$e({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{}}(o.props.initialData))),lt(mt(o),"componentDidMount",(function(){o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state,t)||o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentWillUnmount",(function(){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer)})),lt(mt(o),"parseJSON",(function(e){1===e.length?(o.TERM_ID_1=e[0].id,o.TERM_ID_2=d(),o.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(o.TERM_ID_1=e[0].id,o.TERM_ID_2=e[1].id,o.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),lt(mt(o),"getJSON",(function(){if("EXISTS"===o.state.conditionSelectValue)return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value}];var e=o.state.input2Value;return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value},{id:o.TERM_ID_2,term_type:o.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:o.isNumerical(e)?Number(e):e}]})),lt(mt(o),"isNumerical",(function(e){return!Number.isNaN(Number(e))})),lt(mt(o),"isComplete",(function(){return"EXISTS"===o.state.conditionSelectValue?!!o.state.input1Value:!!e(o.state.input1Value,"length")&&!!e(o.state.input2Value,"length")})),lt(mt(o),"isValid",(function(){return!o.props.enableQueryValidation||("EXISTS"===o.state.conditionSelectValue?o.state.isFirstTermValid:o.state.isFirstTermValid&&o.state.isSecondTermValid)})),lt(mt(o),"validateFirstTerm",(function(){o.props.enableQueryValidation?o.state.input1Value&&!o.state.isValidatingFirstTerm&&o.state.lastCheckedFirstTermValue!==o.state.input1Value&&(o.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:o.state.input1Value,isValidatingFirstTerm:!0}),Mo($e({query:o.state.input1Value},Jt(o.props.authentication))).then((function(){o.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){o.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):o.setState({isFirstTermValid:!0})})),lt(mt(o),"validateSecondTerm",(function(){o.props.enableQueryValidation?o.state.input2Value&&Number.isNaN(Number(o.state.input2Value))?o.state.isValidatingSecondTerm||o.state.lastCheckedSecondTermValue===o.state.input2Value||(o.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:o.state.input2Value,isValidatingSecondTerm:!0}),Mo($e({query:o.state.input2Value},Jt(o.props.authentication))).then((function(){o.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){o.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):o.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:o.state.input2Value}):o.setState({isSecondTermValid:!0})})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"onSuggestionsFetchRequested",(function(e){var t=e.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e($e($e({},Jt(o.props.authentication)),getAutoQLConfig(o.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var r=0;r<t.length&&(n.push(t[r]),4!==r);r++);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)}o.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),lt(mt(o),"renderReadOnlyRule",(function(){return s.createElement(yt,null,s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},"".concat(Un(o.state.input1Value))),s.createElement("span",{className:"read-only-rule-term"},"".concat(o.renderConditionOperator(o.state.conditionSelectValue))),"EXISTS"!==o.state.conditionSelectValue&&s.createElement("span",{className:"read-only-rule-term"},Un(o.state.input2Value)),o.props.andOrValue&&s.createElement("span",{className:"read-only-rule-term"},o.props.andOrValue)))})),lt(mt(o),"renderValidationError",(function(){return s.createElement("div",{className:"expression-term-validation-error"},s.createElement(Kt,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),lt(mt(o),"renderRule",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query",value:o.state.input1Value,onChange:function(e){return o.setState({input1Value:e.target.value})},onBlur:o.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&o.validateFirstTerm()}}),!o.state.isFirstTermValid&&o.renderValidationError()),s.createElement(yo,{themeConfig:o.props.themeConfig,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:s.createElement("span",null,"∃"),tooltip:"Exists"}],value:o.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){o.setState({conditionSelectValue:e})}}),s.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===o.state.conditionSelectValue?" hidden":"")},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query or number",value:o.state.input2Value,onChange:function(e){return o.setState({input2Value:e.target.value})},onBlur:o.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&o.validateSecondTerm()}}),!o.state.isSecondTermValid&&o.renderValidationError())),s.createElement(Kt,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){o.props.onDelete(o.props.ruleId)}})))})),lt(mt(o),"render",(function(){return o.props.readOnly?o.renderReadOnlyRule():o.renderRule()})),o.initialData={},o.TERM_ID_1=d(),o.TERM_ID_2=d();var r=t.initialData;return r&&1===r.length?(o.TERM_ID_1=r[0].id,o.TERM_ID_2=d()):r&&r.length>1&&(o.TERM_ID_1=r[0].id,o.TERM_ID_2=r[1].id),o}return it(a)}();lt(yr,"propTypes",{authentication:bt,themeConfig:St,ruleId:p.string,onAdd:p.func,onDelete:p.func,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool,enableQueryValidation:p.bool}),lt(yr,"defaultProps",{authentication:Gt,themeConfig:Xt,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var br=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,a=e.id||d();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:d(),type:"rule",isComplete:!1}),t={rules:n}),t},Cr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"ruleRefs",[]),lt(mt(e),"state",$e({rules:[],andOrSelectValue:"ALL"},br(e.props.initialData))),lt(mt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),lt(mt(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||d(),term_type:"group",condition:a,term_value:r}}))})),lt(mt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isComplete()}))})),lt(mt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isValid()}))})),lt(mt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),lt(mt(e),"onRuleUpdate",(function(t,n,a){var o=e.state.rules.map((function(e){return e.id===t?$e($e({},e),{},{isComplete:n,termValue:a}):e}));e.setState({rules:o}),e.props.onUpdate(e.props.groupId,e.isComplete())})),lt(mt(e),"addRule",(function(){var t=d(),n=[].concat(ht(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),lt(mt(e),"addGroup",(function(){var t=d(),n=[].concat(ht(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),lt(mt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),lt(mt(e),"renderAllAnySelect",(function(){return s.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",s.createElement(ar,{themeConfig:e.props.themeConfig,options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),lt(mt(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:s.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},s.createElement(Kt,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),lt(mt(e),"renderAddBtn",(function(){return e.props.readOnly?null:s.createElement("div",{className:"notification-rule-btn-container"},s.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),lt(mt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return s.createElement(yt,null,s.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&s.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&&s.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")),s.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?s.createElement(yr,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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?s.createElement(n,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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())))})),lt(mt(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"),s.createElement(yt,null,s.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,o){return"rule"===t.type?s.createElement(yr,{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?s.createElement("div",{key:"group-".concat(t.id)},s.createElement(n,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),o!==e.state.rules.length-1&&s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},a))):void 0}))))})),lt(mt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return it(n)}();lt(Cr,"propTypes",{authentication:bt,themeConfig:St,groupId:p.string,onDelete:p.func,onUpdate:p.func,disableAddGroupBtn:p.bool,hideTopCondition:p.bool,readOnly:p.bool,enableQueryValidation:p.bool}),lt(Cr,"defaultProps",{authentication:Gt,themeConfig:Xt,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Er=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:d(),isComplete:!1}),n={groups:a}),n},Sr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"groupRefs",[]),lt(mt(e),"state",$e({groups:[],andOrValue:"ALL"},Er(e.props.expression))),lt(mt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(e),"componentDidUpdate",(function(t,n){se(t.expression,e.props.expression)||e.setState($e({},Er(e.props.expression))),se(n,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isComplete()}))})),lt(mt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isValid()}))})),lt(mt(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||d(),term_type:"group",condition:a,term_value:r}}))})),lt(mt(e),"addGroup",(function(t){var n=t.initialData,a=t.isComplete,o=t.id||d(),r=[].concat(ht(e.state.groups),[{initialData:n,isComplete:a,id:o}]);e.setState({groups:r})})),lt(mt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),lt(mt(e),"getAndOrValue",(function(){return e.state.andOrValue})),lt(mt(e),"onGroupUpdate",(function(t,n){var a=e.state.groups.map((function(e){return e.id===t?$e($e({},e),{},{isComplete:n}):e}));e.setState({groups:a}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(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"),s.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(a,o){return s.createElement("div",{key:"expression-group-readonly-".concat(a.id,"-").concat(o)},s.createElement(Cr,{themeConfig:e.props.themeConfig,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&&s.createElement("div",{style:{textAlign:"center",margin:"2px"}},s.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),lt(mt(e),"renderRules",(function(){var t=e.state.groups.length<=1;return s.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&s.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",s.createElement(ar,{themeConfig:e.props.themeConfig,options:["ALL","ANY"],value:e.state.andOrValue,type:"button",onChange:function(t){return e.setState({andOrValue:t})}})," ","of the following conditions are met:"),s.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,a){return s.createElement(Cr,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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&&s.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return it(n)}();lt(Sr,"propTypes",{authentication:bt,themeConfig:St,expression:p.arrayOf(p.shape({})),readOnly:p.bool,onChange:p.func}),lt(Sr,"defaultProps",{authentication:Gt,themeConfig:Xt,expression:void 0,readOnly:!1,onChange:function(){}});var Tr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",lt({themeConfig:Xt,channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),lt(mt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),lt(mt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),qo($e($e({},Jt(t.props.authentication)),{},{channelType:"slack"})).then((function(e){t.setState({channels:e.data.items,isFetchingChannels:!1,activePage:"channel-list"})})).catch((function(e){t.setState({activePage:"fetch-error",isFetchingChannels:!1})}))})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{className:"slack-modal-empty-list-message"},s.createElement("div",null,"You don't have any ",s.createElement(Kt,{type:"slack"})," Slack channels connected yet."),s.createElement(Wa,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},s.createElement(Kt,{type:"plus"})," Connect a Channel"))})),lt(mt(t),"getAttachmentToSend",(function(){t.attachment=void 0;try{t.props.responseRef.getBase64Data().then((function(e){t.attachment=e})).catch((function(){}))}catch(e){t.props.onErrorCallback(e)}})),lt(mt(t),"getVizType",(function(){return An(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),lt(mt(t),"sendDataToSlack",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Bo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id,fileName:"chart"===t.getVizType()?"chart.png":"table.csv",base64Data:t.attachment})).then((function(){t.setState({isSendingData:!1}),t.props.onClose()})).catch((function(){t.setState({isSendingData:!1})})):(t.setState({isSendingData:!1}),t.props.onErrorCallback())})),lt(mt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Wo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=ce(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),lt(mt(t),"renderRemoveChannelBtn",(function(){return s.createElement(me,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:s.createElement("div",{className:"remove-channel-popover"},s.createElement("div",{className:"react-autoql-confirm-text"},s.createElement(Kt,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),s.createElement(Wa,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},s.createElement(Kt,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),lt(mt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null));if(0===t.state.channels.length)return t.renderEmptyListMessage();var e=t.state.channels.map((function(e,t){return{value:t,label:"# ".concat(e.channel_name)}}));e.push({value:"connect-channel",label:s.createElement("span",null,s.createElement(Kt,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return s.createElement("div",{className:"slack-channel-list-container"},s.createElement("div",{className:"slack-channel-list"},s.createElement("div",null,"AutoQL will post an email to the selected Slack channel with the"," ",n," attached."),s.createElement("br",null),s.createElement("div",{className:"select-channel-titles"},"Post to:"," ",s.createElement(yo,{themeConfig:t.props.themeConfig,options:e,value:t.state.selectedChannel,style:{width:"300px"},selectionPlaceholder:"Select a Slack Channel",onChange:function(e){"connect-channel"===e?t.setState({activePage:"connect-channel"}):t.setState({selectedChannel:e})}}),!Number.isNaN(Number(t.state.selectedChannel))&&t.renderRemoveChannelBtn())))})),lt(mt(t),"renderFetchErrorMessage",(function(){return s.createElement("div",{className:"slack-modal-error-container"},s.createElement("div",null,Tt.GENERAL_HTML),s.createElement(Wa,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),lt(mt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),Ho($e($e({},Jt(t.props.authentication)),{},{channelType:"slack",channelName:t.state.channelName,channelEmail:t.state.channelEmail,userName:t.state.userName,userEmail:t.state.userEmail})).then((function(e){var n=e.data.data,a=[].concat(ht(t.state.channels),[n]);t.setState({isConnectingChannel:!1,channels:a,activePage:"channel-list",channelEmail:void 0,channelName:void 0,userEmail:void 0,userName:void 0})})).catch((function(e){t.props.onErrorCallback(e),t.setState({isConnectingChannel:!1})}))})),lt(mt(t),"renderConnectChannelPage",(function(){return s.createElement("div",{className:"connect-channel-form-container"},s.createElement("div",{className:"connect-channel-form"},s.createElement("div",{className:"connect-channel-title"},"Connect a Slack Channel"),s.createElement(Kt,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),s.createElement("div",null,"Channel Name"),s.createElement(Jo,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),s.createElement("div",null,"Channel Email Address"," ",s.createElement(me,{isOpen:t.state.isSlackEmailInstructionVisible,onClickOutside:function(){return t.setState({isSlackEmailInstructionVisible:!1})},position:"top",content:s.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},s.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isSlackEmailInstructionVisible:!0})}},s.createElement(Kt,{type:"question"})," How do I find this?"))),s.createElement(Jo,{placeholder:"e.g. 1234@slack.com",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),s.createElement("div",null,"Your Name"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Slack)")),s.createElement(Jo,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),s.createElement("div",null,"Your Email"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Slack)")),s.createElement(Jo,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),s.createElement("div",{className:"connect-channel-btn"},s.createElement(Wa,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),lt(mt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),lt(mt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?s.createElement("div",null,s.createElement(Wa,{type:"primary",className:"send-to-slack-btn",disabled:!e(t.state.channels,"".concat(t.state.selectedChannel))||!t.attachment,onClick:t.sendDataToSlack,loading:t.state.isSendingData},s.createElement(Kt,{type:"send"})," Send to Slack")):null})),t}return it(a,[{key:"render",value:function(){return s.createElement(Ao,{themeConfig:this.props.themeConfig,isVisible:this.props.isVisible,onClose:this.props.onClose,title:s.createElement("span",null,"Send to ",s.createElement(Kt,{type:"slack"})," Slack"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();lt(Tr,"propTypes",{themeConfig:St,authentication:bt,isVisible:p.bool}),lt(Tr,"defaultProps",{authentication:Gt,isVisible:!1});var Dr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",lt({channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),lt(mt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),lt(mt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),qo($e($e({},Jt(t.props.authentication)),{},{channelType:"teams"})).then((function(e){t.setState({channels:e.data.items,isFetchingChannels:!1,activePage:"channel-list"})})).catch((function(e){t.setState({activePage:"fetch-error",isFetchingChannels:!1})}))})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{className:"slack-modal-empty-list-message"},s.createElement("div",null,"You don't have any ",s.createElement(Kt,{type:"teams"})," Teams channels connected yet."),s.createElement(Wa,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},s.createElement(Kt,{type:"plus"})," Connect a Channel"))})),lt(mt(t),"getAttachmentToSend",(function(){t.attachment=void 0;try{t.props.responseRef.getBase64Data().then((function(e){t.attachment=e})).catch((function(){}))}catch(e){t.props.onErrorCallback(e)}})),lt(mt(t),"getVizType",(function(){return An(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),lt(mt(t),"sendDataToTeams",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Bo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id,fileName:"chart"===t.getVizType()?"chart.png":"table.csv",base64Data:t.attachment})).then((function(){t.setState({isSendingData:!1}),t.props.onClose()})).catch((function(){t.setState({isSendingData:!1})})):(t.setState({isSendingData:!1}),t.props.onErrorCallback())})),lt(mt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Wo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=ce(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),lt(mt(t),"renderRemoveChannelBtn",(function(){return s.createElement(me,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:s.createElement("div",{className:"remove-channel-popover"},s.createElement("div",{className:"react-autoql-confirm-text"},s.createElement(Kt,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),s.createElement(Wa,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},s.createElement(Kt,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),lt(mt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null));if(0===t.state.channels.length)return t.renderEmptyListMessage();var e=t.state.channels.map((function(e,t){return{value:t,label:"".concat(e.channel_name)}}));e.push({value:"connect-channel",label:s.createElement("span",null,s.createElement(Kt,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return s.createElement("div",{className:"slack-channel-list-container"},s.createElement("div",{className:"slack-channel-list"},s.createElement("div",null,"AutoQL will post an email to the selected Teams channel with the"," ",n," attached."),s.createElement("br",null),s.createElement("div",{className:"select-channel-titles"},"Post to:"," ",s.createElement(yo,{themeConfig:t.props.themeConfig,options:e,value:t.state.selectedChannel,style:{width:"300px"},selectionPlaceholder:"Select a Teams Channel",onChange:function(e){"connect-channel"===e?t.setState({activePage:"connect-channel"}):t.setState({selectedChannel:e})}}),!Number.isNaN(Number(t.state.selectedChannel))&&t.renderRemoveChannelBtn())))})),lt(mt(t),"renderFetchErrorMessage",(function(){return s.createElement("div",{className:"slack-modal-error-container"},s.createElement("div",null,Tt.GENERAL_HTML),s.createElement(Wa,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),lt(mt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),Ho($e($e({},Jt(t.props.authentication)),{},{channelType:"teams",channelName:t.state.channelName,channelEmail:t.state.channelEmail,userName:t.state.userName,userEmail:t.state.userEmail})).then((function(e){var n=e.data.data,a=[].concat(ht(t.state.channels),[n]);t.setState({isConnectingChannel:!1,channels:a,activePage:"channel-list",channelEmail:void 0,channelName:void 0,userEmail:void 0,userName:void 0})})).catch((function(e){t.props.onErrorCallback(e),t.setState({isConnectingChannel:!1})}))})),lt(mt(t),"renderConnectChannelPage",(function(){return s.createElement("div",{className:"connect-channel-form-container"},s.createElement("div",{className:"connect-channel-form"},s.createElement("div",{className:"connect-channel-title"},"Connect a Teams Channel"),s.createElement(Kt,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),s.createElement("div",null,"Channel Name"),s.createElement(Jo,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),s.createElement("div",null,"Channel Email Address"," ",s.createElement(me,{isOpen:t.state.isTeamsEmailInstructionVisible,onClickOutside:function(){return t.setState({isTeamsEmailInstructionVisible:!1})},position:"top",content:s.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},s.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isTeamsEmailInstructionVisible:!0})}},s.createElement(Kt,{type:"question"})," How do I find this?"))),s.createElement(Jo,{placeholder:"e.g. 1234@amer.teams.ms",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),s.createElement("div",null,"Your Name"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Teams)")),s.createElement(Jo,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),s.createElement("div",null,"Your Email"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Teams)")),s.createElement(Jo,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),s.createElement("div",{className:"connect-channel-btn"},s.createElement(Wa,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),lt(mt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),lt(mt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?s.createElement("div",null,s.createElement(Wa,{type:"primary",className:"send-to-slack-btn",disabled:!e(t.state.channels,"".concat(t.state.selectedChannel))||!t.attachment,onClick:t.sendDataToTeams,loading:t.state.isSendingData},s.createElement(Kt,{type:"send"})," Send to Teams")):null})),t}return it(a,[{key:"render",value:function(){return s.createElement(Ao,{themeConfig:this.props.themeConfig,isVisible:this.props.isVisible,onClose:this.props.onClose,title:s.createElement("span",null,"Send to ",s.createElement(Kt,{type:"teams"})," Teams"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();lt(Dr,"propTypes",{authentication:bt,themeConfig:St,isVisible:p.bool}),lt(Dr,"defaultProps",{authentication:Gt,themeConfig:Xt,isVisible:!1});var xr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1})),lt(mt(t),"reportQueryProblem",(function(n){var a=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),ca($e({message:n,queryId:a},Jt(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})}))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement(Ao,{className:t.props.className,contentClassName:t.props.contentClassName,isVisible:t.props.isVisible,onClose:function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})},onConfirm:function(){t.reportQueryProblem(t.state.reportProblemMessage),t.setState({reportProblemMessage:void 0})},confirmLoading:t.state.isReportingProblem,title:"Report a Problem",enableBodyScroll:!0,width:"600px",confirmText:"Report",confirmDisabled:!t.state.reportProblemMessage},"Please tell us more about the problem you are experiencing:",s.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}})))})),t}return it(a)}();lt(xr,"propTypes",{authentication:bt,responseRef:p.instanceOf(Do),onReportProblem:p.func,isVisible:p.bool}),lt(xr,"defaultProps",{authentication:Gt,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var kr,wr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t.rebuildTooltips()})),lt(mt(t),"componentDidUpdate",(function(e,n){"sql"===n.activeMenu&&"sql"!==t.state.activeMenu&&t.setState({sqlCopySuccess:!1}),t.rebuildTooltips()})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearTimeout(t.temporaryStateTimeout),clearTimeout(t.pivotTableCSVDownloadTimeout)})),lt(mt(t),"rebuildTooltips",(function(){t.props.rebuildTooltips?t.props.rebuildTooltips():le.rebuild()})),lt(mt(t),"onTableFilter",(function(n){"table"===e(t.props.responseRef,"props.displayType")&&t.setState({disableChartingOptions:e(n,"length")<2})})),lt(mt(t),"toggleTableFilter",(function(){t.filtering=!t.filtering,t.props.onFilterClick({isFilteringTable:t.filtering})})),lt(mt(t),"setTemporaryState",(function(e,n,a){t.setState(lt({},e,n)),t.temporaryStateTimeout=setTimeout((function(){t.setState(lt({},e,void 0))}),a)})),lt(mt(t),"copyTableToClipboard",(function(){t.props.responseRef?(t.props.responseRef.copyTableToClipboard(),t.props.onSuccessAlert("Successfully copied table to clipboard!"),t.setTemporaryState("copiedTable",!0,1e3),le.hide()):t.setTemporaryState("copiedTable",!1,1e3)})),lt(mt(t),"fetchCSVAndExport",(function(){var e,n,a,o,r,i,l,s,c=null===(e=t.props.responseRef)||void 0===e||null===(n=e.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.query_id,u=null===(r=t.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?void 0:s.text,p=d();t.props.onCSVDownloadStart({id:p,queryId:c,query:u}),ta($e($e({queryId:c},Jt(t.props.authentication)),{},{csvProgressCallback:function(e){return t.props.onCSVDownloadProgress({id:p,progress:e})}})).then((function(e){var n,a,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===(n=e.headers)||void 0===n?void 0:n.export_limit),s="true"==(null==e||null===(a=e.headers)||void 0===a||null===(o=a.limit_reached)||void 0===o?void 0:o.toLowerCase());t.props.onCSVDownloadFinish({id:p,exportLimit:l,limitReached:s})})).catch((function(e){t.props.onCSVDownloadFinish({id:p,error:e}),console.error(e)}))})),lt(mt(t),"onCSVMenuButtonClick",(function(){t.setState({activeMenu:void 0});var n,a,o="pivot_table"===e(t.props.responseRef,"props.displayType"),r=d();o?e(t.props,"responseRef.pivotTableRef._isMounted")&&(t.props.onCSVDownloadStart({id:r}),null===(n=t.props.responseRef)||void 0===n||null===(a=n.pivotTableRef)||void 0===a||a.saveAsCSV(2e3).then((function(){t.props.onCSVDownloadProgress({id:r,progress:100}),t.props.onCSVDownloadFinish({id:r})})).catch((function(e){console.error(e),t.props.onCSVDownloadFinish({id:r})}))):t.fetchCSVAndExport()})),lt(mt(t),"saveChartAsPNG",(function(){t.props.responseRef&&t.props.responseRef.saveChartAsPNG()})),lt(mt(t),"deleteMessage",(function(){le.hide(),t.props.deleteMessageCallback()})),lt(mt(t),"copySQL",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql"),a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),document.execCommand("copy"),t.setTemporaryState("copiedSQL",!0,1e3),t.props.onSuccessAlert("Successfully copied generated query to clipboard!"),t.setState({sqlCopySuccess:!0}),le.hide()})),lt(mt(t),"showHideColumnsModal",(function(){t.setState({isHideColumnsModalVisible:!0})})),lt(mt(t),"onColumnVisibilitySave",(function(e){var n=t.props.authentication,a=e.map((function(e){var t=$e($e({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));t.setState({isSettingColumnVisibility:!0}),la($e($e({},n),{},{columns:a})).then((function(){t._isMounted&&t.setState({isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1}),t.props.responseRef&&t.props.responseRef.updateColumns(a),t.props.onColumnVisibilitySave(a)})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t._isMounted&&t.setState({isSettingColumnVisibility:!1})}))})),lt(mt(t),"renderHideColumnsModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.columns");if(!n||!n.length)return null;var a=n.map((function(e){return $e($e({},e),{},{content:e.display_name,checked:e.is_visible})}));return s.createElement(yt,null,s.createElement(No,{themeConfig:t.props.themeConfig,columns:a,isVisible:t.state.isHideColumnsModalVisible,onClose:function(){return t.setState({isHideColumnsModalVisible:!1})},isSettingColumns:t.state.isSettingColumnVisibility,onConfirm:t.onColumnVisibilitySave}))})),lt(mt(t),"renderDataAlertModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.text");return s.createElement(yt,null,s.createElement(pr,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:"notification"===t.state.activeMenu,initialQuery:n,onClose:function(){return t.setState({activeMenu:void 0})},onErrorCallback:t.props.onErrorCallback,onSave:function(){t.props.onSuccessAlert("Successfully created a notification"),t.setState({activeMenu:void 0})}}))})),lt(mt(t),"renderReportProblemModal",(function(){return s.createElement(xr,{ref:function(e){return t.reportProblemRef=e},authentication:t.props.authentication,onClose:function(){t.setState({activeMenu:void 0})},onReportProblem:function(e){var n=e.successMessage,a=e.error;n?(t.props.onSuccessAlert(n),t._isMounted&&t.setState({activeMenu:void 0})):a&&t.props.onErrorCallback(a)},responseRef:t.props.responseRef,isVisible:"other-problem"===t.state.activeMenu})})),lt(mt(t),"reportQueryProblem",(function(e){var n;null!==(n=t.reportProblemRef)&&void 0!==n&&n._isMounted&&t.reportProblemRef.reportQueryProblem(e)})),lt(mt(t),"renderReportProblemMenu",(function(){return s.createElement("div",{className:"report-problem-menu"},s.createElement("ul",{className:"context-menu-list"},s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incorrect")}},"The data is incorrect"),s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incomplete")}},"The data is incomplete"),s.createElement("li",{onClick:function(){return t.setState({activeMenu:"other-problem"})}},"Other...")))})),lt(mt(t),"refreshData",(function(){})),lt(mt(t),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn"})),lt(mt(t),"renderMoreOptionsMenu",(function(e,n){return s.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},s.createElement("ul",{className:"context-menu-list"},n.showSaveAsCSVButton&&s.createElement("li",{onClick:t.onCSVMenuButtonClick,style:t.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},s.createElement(Kt,{type:"download",style:{marginRight:"7px"}}),t.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),n.showSaveAsPNGButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.saveChartAsPNG()}},s.createElement(Kt,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),n.showCopyButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.copyTableToClipboard()}},s.createElement(Kt,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),n.showSQLButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"sql"})}},s.createElement(Kt,{type:"database"})," View generated SQL"),n.showCreateNotificationIcon&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"notification"})}},s.createElement(Kt,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert..."),n.showShareToSlackButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"slack"})}},s.createElement(Kt,{style:{marginRight:"5px"},type:"slack"}),"Send to Slack..."),n.showShareToTeamsButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"teams"})}},s.createElement(Kt,{style:{display:"inline-block",marginRight:"5px",marginTop:"-2px"},type:"teams"}),"Send to Teams...")))})),lt(mt(t),"isDrilldownResponse",(function(){try{return"Drilldown:"===e(t.props.responseRef,"queryResponse.data.data.text").split(" ")[0]}catch(e){return!1}})),lt(mt(t),"renderSendToSlackModal",(function(){return $t(t.props.autoQLConfig).enableSlackSharing?s.createElement(Tr,{themeConfig:t.props.themeConfig,authentication:Jt(t.props.authentication),isVisible:"slack"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),lt(mt(t),"renderSendToTeamsModal",(function(){return $t(t.props.autoQLConfig).enableTeamsSharing?s.createElement(Dr,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:"teams"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),lt(mt(t),"renderSQLModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql[0]");return n?s.createElement(yt,null,s.createElement(Ao,{themeConfig:t.props.themeConfig,isVisible:"sql"===t.state.activeMenu,footer:s.createElement("div",null,s.createElement(Wa,{type:"primary",onClick:function(){return t.setState({activeMenu:void 0})}},"Ok")),onClose:function(){return t.setState({activeMenu:void 0})},title:"Generated SQL",enableBodyScroll:!1,width:"600px"},s.createElement("div",{className:"copy-sql-modal-content"},s.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(Ue(n)),disabled:!0}),s.createElement(Wa,{className:"copy-sql-btn ".concat(t.state.sqlCopySuccess?"sql-copied":""),onClick:t.copySQL,tooltip:"Copy to Clipboard"},s.createElement(Kt,{type:"copy"}),t.state.sqlCopySuccess&&s.createElement(Kt,{type:"check",className:"sql-copied"}))))):null})),lt(mt(t),"renderToolbar",(function(e){return s.createElement(yt,null,s.createElement("div",{className:"autoql-options-toolbar\n ".concat(t.state.activeMenu?"active":"","\n ").concat(t.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&s.createElement("button",{onClick:t.toggleTableFilter,className:t.getMenuItemClass(e.showFilterButton),"data-tip":"Filter table","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY)},s.createElement(Kt,{type:"filter"})),e.showHideColumnsButton&&s.createElement("button",{onClick:t.showHideColumnsModal,className:t.getMenuItemClass(e.showHideColumnsButton),"data-tip":"Show/hide columns","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-col-vis"},s.createElement(Kt,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&s.createElement(me,{key:d(),isOpen:"report-problem"===t.state.activeMenu,padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},position:"bottom",content:function(e){return t.renderReportProblemMenu(e)}},s.createElement("button",{onClick:function(){t.setState({activeMenu:"report-problem"})},className:t.getMenuItemClass(e.showReportProblemButton),"data-tip":"Report a problem","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY)},s.createElement(Kt,{type:"warning-triangle"}))),e.showRefreshDataButton&&s.createElement("button",{onClick:t.refreshData,className:t.getMenuItemClass(e.showRefreshDataButton),"data-tip":"Re-run query","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-trash-btn"},s.createElement(Kt,{type:"refresh"})),e.showDeleteButton&&s.createElement("button",{onClick:t.deleteMessage,className:t.getMenuItemClass(e.showDeleteButton),"data-tip":"Delete data response","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-trash-btn"},s.createElement(Kt,{type:"trash"})),e.showMoreOptionsButton&&s.createElement(me,{key:d(),isOpen:"more-options"===t.state.activeMenu,position:"bottom",padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},content:function(n){return t.renderMoreOptionsMenu(n,e)}},s.createElement("button",{onClick:function(){le.hide(),t.setState({activeMenu:"more-options"})},className:t.getMenuItemClass(e.showMoreOptionsButton),"data-tip":"More options","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"react-autoql-toolbar-more-options-btn"},s.createElement(Kt,{type:"more-vertical"})))))})),lt(mt(t),"getShouldShowButtonObj",(function(){var n={};try{var a=e(t.props.responseRef,"props.displayType"),o=Nn(a),r=An(a),i=e(t.props.responseRef,"queryResponse"),l="data"===e(i,"data.data.display_type"),s=In(i),c=qn(i),u=e(i,"data.data.rows.length"),p=u>0,d=u>1,m=$t(t.props.autoQLConfig);(n={showFilterButton:o&&!s&&d,showCopyButton:o&&!s,showSaveAsPNGButton:r,showHideColumnsButton:m.enableColumnVisibilityManager&&p&&("table"===a||"text"===a&&s),showHiddenColsBadge:c,showSQLButton:l&&m.debug,showSaveAsCSVButton:o&&d&&m.enableCSVDownload,showDeleteButton:t.props.enableDeleteBtn,showReportProblemButton:m.enableReportProblem&&!!e(i,"data.data.query_id"),showCreateNotificationIcon:l&&m.enableNotifications&&!t.isDrilldownResponse(),showRefreshDataButton:!1,showShareToSlackButton:!1,showShareToTeamsButton:!1}).showMoreOptionsButton=n.showCopyButton||n.showSQLButton||n.showCreateNotificationIcon||n.showSaveAsCSVButton||n.showSaveAsPNGButton||n.showShareToSlackButton||n.showShareToTeamsButton}catch(e){console.error(e)}return n})),lt(mt(t),"render",(function(){var e=t.getShouldShowButtonObj();return Object.values(e).find((function(e){return!0===e}))?s.createElement(yt,null,t.renderToolbar(e),e.showHideColumnsButton&&t.renderHideColumnsModal(),e.showReportProblemButton&&t.renderReportProblemModal(),e.showMoreOptionsButton&&t.renderDataAlertModal(),e.showSQLButton&&t.renderSQLModal(),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),t}return it(a)}();lt(wr,"propTypes",{authentication:bt,autoQLConfig:Et,themeConfig:St,responseRef:p.instanceOf(Do),enableDeleteBtn:p.bool,onSuccessAlert:p.func,onErrorCallback:p.func,onNewNotificationCallback:p.func,deleteMessageCallback:p.func,onFilterClick:p.func,onCSVDownloadStart:p.func,onCSVDownloadFinish:p.func,onCSVDownloadProgress:p.func,rebuildTooltips:p.func}),lt(wr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,themeConfig:Xt,responseRef:void 0,enableDeleteBtn:!1,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},onFilterClick:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var Ar=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.scrollToBottomTimeout=setTimeout((function(){o.props.scrollToBottom()}),100),clearTimeout(o.animationTimeout),o.animationTimeout=setTimeout((function(){o.setState({isAnimatingMessageBubble:!1}),o.props.scrollToBottom()}),500),o.calculatedQueryOutputStyle=e(o.responseRef,"style"),o.calculatedQueryOutputHeight=e(o.responseRef,"offsetHeight")})),lt(mt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),lt(mt(o),"componentDidUpdate",(function(e,t){le.hide()})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.scrollToBottomTimeout),clearTimeout(o.scrollIntoViewTimeout),clearTimeout(o.animationTimeout)})),lt(mt(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 c=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:s.createElement(s.Fragment,null,"Your file has successfully been downloaded with the query"," ",s.createElement("b",null,s.createElement("i",null,c)),".",l?s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement("p",null,s.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)})})),lt(mt(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})),lt(mt(o),"scrollIntoView",(function(){clearTimeout(o.scrollIntoViewTimeout),o.scrollIntoViewTimeout=setTimeout((function(){o.messageContainerRef&&!o.isScrolledIntoView(o.messageContainerRef)&&(o.scrollIntoViewTimer=o.messageContainerRef.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"}))}),0)})),lt(mt(o),"switchView",(function(e){o.filtering=!1,o.setState({displayType:e},o.scrollIntoView)})),lt(mt(o),"onSupportedDisplayTypesChange",(function(e){o.setState({supportedDisplayTypes:e})})),lt(mt(o),"renderFetchingFileMessage",(function(){return s.createElement("div",null,"Fetching your file ",s.createElement(ya,null))})),lt(mt(o),"renderCSVProgressMessage",(function(){return isNaN(o.state.csvDownloadProgress)?o.renderFetchingFileMessage():"Downloading your file ... ".concat(o.state.csvDownloadProgress,"%")})),lt(mt(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")?Tt.UNAUTHENTICATED:o.props.response?s.createElement(Do,{ref:function(e){return o.responseRef=e},authentication:Jt(o.props.authentication),autoQLConfig:$t(o.props.autoQLConfig),queryResponse:o.props.response,displayType:o.state.displayType,onSuggestionClick:o.props.onSuggestionClick,isQueryRunning:o.props.isChataThinking,themeConfig:o.props.themeConfig,copyToClipboard:o.copyToClipboard,dataFormatting:Zt(o.props.dataFormatting),appliedFilters:o.props.appliedFilters,onDrilldownStart:o.props.onDrilldownStart,onDrilldownEnd:o.props.onDrilldownEnd,demo:Jt(o.props.authentication).demo,enableAjaxTableData:o.props.enableAjaxTableData,onSupportedDisplayTypesChange:o.onSupportedDisplayTypesChange,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),onErrorCallback:o.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isResizing:o.props.isResizing,isAnimatingContainer:o.state.isAnimatingMessageBubble,enableDynamicCharting:o.props.enableDynamicCharting,optionsToolbarRef:o.optionsToolbarRef,onNoneOfTheseClick:o.props.onNoneOfTheseClick,queryRequestData:o.props.queryRequestData,autoChartAggregations:o.props.autoChartAggregations,showQueryInterpretation:!0,onRecommendedDisplayType:o.switchView,enableFilterLocking:o.props.enableFilterLocking,onRTValueLabelClick:o.props.onRTValueLabelClick,rebuildTooltips:o.props.rebuildTooltips,source:o.props.source,reportProblemCallback:function(){var e;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.optionsToolbarRef.setState({activeMenu:"other-problem"})}}):Tt.GENERAL_QUERY})),lt(mt(o),"toggleTableFilter",(function(e){var t=e.isFilteringTable;o.responseRef&&o.responseRef.toggleTableFilter({isFilteringTable:t})})),lt(mt(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})})),lt(mt(o),"onDisplayTypeChange",(function(e){var t;o.toggleTableFilter({isFilteringTable:!1}),null!==(t=o.optionsToolbarRef)&&void 0!==t&&t._isMounted&&(o.optionsToolbarRef.filtering=!1),o.switchView(e)})),lt(mt(o),"renderRightToolbar",(function(){return s.createElement("div",{className:"chat-message-toolbar right"},o.props.isResponse&&"help"!==o.state.displayType&&"suggestion"!==o.state.displayType?s.createElement(wr,{ref:function(e){return o.optionsToolbarRef=e},authentication:o.props.authentication,autoQLConfig:$t(o.props.autoQLConfig),themeConfig:o.props.themeConfig,responseRef:o.responseRef,displayType:o.state.displayType,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadFinish:o.onCSVDownloadFinish,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onSuccessAlert:o.props.onSuccessAlert,onErrorCallback:o.props.onErrorCallback,enableDeleteBtn:!o.props.isIntroMessage,deleteMessageCallback:function(){return o.props.deleteMessageCallback(o.props.id)},rebuildTooltips:o.props.rebuildTooltips,onFilterClick:o.toggleTableFilter}):null)})),lt(mt(o),"renderLeftToolbar",(function(){var e=o.state.displayType;return o.state.supportedDisplayTypes&&!o.state.supportedDisplayTypes.includes(o.state.displayType)&&(e="table"),s.createElement("div",{className:"chat-message-toolbar left"},o.props.isResponse&&"text"!==o.props.type?s.createElement(ko,{themeConfig:o.props.themeConfig,supportedDisplayTypes:o.state.supportedDisplayTypes||[],displayType:e,onDisplayTypeChange:o.onDisplayTypeChange,disableCharts:o.state.disableChartingOptions}):null)})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.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 ")},s.createElement("div",{ref:function(e){return o.ref=e},className:"chat-message-bubble\n ".concat(An(o.state.displayType)?" full-width":"","\n ").concat("text"===o.props.type?" text":"","\n ").concat(o.state.displayType,"\n ").concat(o.props.isActive?" active":"")},o.renderContent(),!o.props.isResizing&&s.createElement("div",{className:"chat-message-toolbars-container"},o.renderLeftToolbar(),o.renderRightToolbar()))))})),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;var r=Fn(t.response,t.autoChartAggregations);return o.state=lt({csvDownloadProgress:o.props.initialCSVDownloadProgress,displayType:Fn(t.response,t.autoChartAggregations),supportedDisplayTypes:Pn({response:t.response}),isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},"displayType",r),o}return it(a)}();lt(Ar,"propTypes",(lt(kr={authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,isResponse:p.bool.isRequired,isIntroMessage:p.bool,isDataMessengerOpen:p.bool,isActive:p.bool,type:p.string,text:p.string,id:p.string.isRequired,displayType:p.string,onSuggestionClick:p.func,response:p.shape({}),content:p.oneOfType([p.string,p.shape({})]),enableColumnVisibilityManager:p.bool},"dataFormatting",Ct),lt(kr,"onErrorCallback",p.func),lt(kr,"onSuccessAlert",p.func),lt(kr,"isResizing",p.bool),lt(kr,"enableDynamicCharting",p.bool),lt(kr,"scrollToBottom",p.func),lt(kr,"onNoneOfTheseClick",p.func),lt(kr,"autoChartAggregations",p.bool),lt(kr,"onConditionClickCallback",p.func),lt(kr,"addMessageToDM",p.func),lt(kr,"csvDownloadProgress",p.number),lt(kr,"onRTValueLabelClick",p.func),lt(kr,"enableAjaxTableData",p.bool),lt(kr,"source",p.arrayOf(p.string)),kr)),lt(Ar,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,enableAjaxTableData:!1,isDataMessengerOpen:!1,isIntroMessage:!1,source:[],displayType:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,onRTValueLabelClick:void 0,onSuggestionClick:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){}});var Nr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(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)})),lt(mt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.feedbackTimeout)})),lt(mt(a),"escFunction",(function(e){a.state.isVisible&&e.keyCode})),lt(mt(a),"scrollToBottom",(function(){a.messengerScrollComponent&&a.messengerScrollComponent.scrollToBottom()})),lt(mt(a),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;a.csvProgressLog[t]=n,a.messageRefs[t]&&a.messageRefs[t].setState({csvDownloadProgress:n})})),lt(mt(a),"clearMessages",(function(){a.setState({messages:a.getIntroMessages(a.props.introMessages)})})),lt(mt(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)}})),lt(mt(a),"onNoneOfTheseClick",(function(){a.addRequestMessage("None of these"),a.setState({isChataThinking:!0}),clearTimeout(a.feedbackTimeout),a.feedbackTimeout=setTimeout((function(){a._isMounted&&(a.setState({isChataThinking:!1}),a.addResponseMessage({content:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")}))}),1e3)})),lt(mt(a),"onDrilldownStart",(function(){a.setState({isChataThinking:!0})})),lt(mt(a),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error;a._isMounted&&(a.setState({isChataThinking:!1}),t?a.addResponseMessage({response:t}):n&&a.addResponseMessage({content:n}))})),lt(mt(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)})),lt(mt(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})})),lt(mt(a),"getIntroMessages",(function(e){return e.map((function(e){return a.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),lt(mt(a),"addIntroMessage",(function(e){a.addIntroMessages([e])})),lt(mt(a),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&a.addMessages(a.getIntroMessages(e))})),lt(mt(a),"addMessage",(function(e){a.addMessages([e])})),lt(mt(a),"addMessages",(function(e){var t=[].concat(ht(a.state.messages),ht(e));t.length>a.props.maxMessages&&(t=t.slice(-a.props.maxMessages)),a.setState({messages:t})})),lt(mt(a),"addRequestMessage",(function(e){a.addMessage(a.createMessage({content:e,isResponse:!1}))})),lt(mt(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(Tt.UNAUTHENTICATED);else if("Parse error"===(null==o||null===(t=o.response)||void 0===t?void 0:t.error))n=a.createErrorMessage(Tt.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($e($e({},o),{},{appliedFilters:r}))}else n=a.createErrorMessage();n&&a.addMessage(n)})),lt(mt(a),"onInputSubmit",(function(e){a.addRequestMessage(e),a.setState({isChataThinking:!0})})),lt(mt(a),"onResponse",(function(e,t,n){var o,r;a._isMounted&&(a.getIsSuggestionResponse(e)&&a.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),Qe(null==e||null===(o=e.data)||void 0===o?void 0:o.data,"authorization_url")?a.addResponseMessage({content:s.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source.",s.createElement("a",{href:e.data.data.authorization_url,target:"_blank"},"Click here to authorize access then try querying again."))}):a.addResponseMessage({response:e,query:t,queryRequestData:n}),a.setState({isChataThinking:!1}),null!==(r=a.queryInputRef)&&void 0!==r&&r._isMounted&&a.queryInputRef.focus())})),lt(mt(a),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:d(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),lt(mt(a),"createMessage",(function(){var e,t,n,a,o,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=i.id||d();return $e({id:l,displayType:i.displayType||(null===(e=i.response)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.display_type),type:null===(a=i.response)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.display_type},i)})),lt(mt(a),"createErrorMessage",(function(e){return a.createMessage({content:e||Tt.GENERAL_QUERY,isResponse:!0,type:"error"})})),lt(mt(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(ht(r),ht(i))}catch(e){return[]}})),lt(mt(a),"render",(function(){return a.props.shouldRender&&a.props.isDataMessengerOpen?s.createElement(yt,null,s.createElement(mr,{innerRef:function(e){a.messengerScrollComponent=e},className:"chat-message-container",renderView:function(e){return s.createElement("div",st({},e,{className:"custom-scrollbar-container"}))}},a.state.messages.map((function(e){return s.createElement(Ar,{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,themeConfig:a.props.themeConfig,isCSVProgressMessage:e.isCSVProgressMessage,initialCSVDownloadProgress:a.csvProgressLog[e.id],onCSVDownloadProgress:a.onCSVDownloadProgress,queryId:e.queryId,queryText:e.query,scrollRef:a.messengerScrollComponent,isDataMessengerOpen:a.props.isDataMessengerOpen,isActive:a.state.activeMessageId===e.id,addMessageToDM:a.addResponseMessage,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.onDrilldownEnd,isResponse:e.isResponse,isChataThinking:a.state.isChataThinking,onSuggestionClick:a.animateInputTextAndSubmit,content:e.content,scrollToBottom:a.scrollToBottom,dataFormatting:a.props.dataFormatting,displayType:e.displayType,response:e.response,type:e.type,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessAlert,deleteMessageCallback:a.deleteMessage,scrollContainerRef:a.messengerScrollComponent,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,rebuildTooltips:a.props.rebuildTooltips,queryRequestData:e.queryRequestData,source:a.props.source})}))),a.state.isChataThinking&&s.createElement("div",{className:"response-loading-container"},s.createElement(da,null)),s.createElement("div",{className:"chat-bar-container"},s.createElement("div",{className:"watermark"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"}),xt.run),s.createElement(ma,{ref:function(e){return a.queryInputRef=e},className:"chat-drawer-chat-bar",authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,themeConfig:a.props.themeConfig,onSubmit:a.onInputSubmit,onResponseCallback:a.onResponse,isDisabled:a.state.isChataThinking,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}))):null})),a.messageRefs={},a.csvProgressLog={},a.state={messages:[]},a}return it(n)}();lt(Nr,"propTypes",{authentication:bt.isRequired,autoQLConfig:Et.isRequired,dataFormatting:Ct.isRequired,themeConfig:St.isRequired,clearOnClose:p.bool.isRequired,enableVoiceRecord:p.bool.isRequired,maxMessages:p.number.isRequired,introMessage:p.string.isRequired,inputPlaceholder:p.string.isRequired,enableDynamicCharting:p.bool.isRequired,autoChartAggregations:p.bool.isRequired,enableFilterLocking:p.bool.isRequired,onErrorCallback:p.func.isRequired,onSuccessAlert:p.func.isRequired,onRTValueLabelClick:p.func,disableMaxMessageHeight:p.bool,enableAjaxTableData:p.bool,isDataMessengerOpen:p.bool,dataPageSize:p.number,sessionId:p.string,isResizing:p.bool,source:p.arrayOf(p.string)}),lt(Nr,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isDataMessengerOpen:!0,isResizing:!1,dataPageSize:void 0,source:[],onRTValueLabelClick:void 0});var Rr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_ID",d()),lt(mt(t),"state",{activeKeys:[],optionsArray:[{options:t.props.options}]}),lt(mt(t),"renderOptionsList",(function(n){var a=n.options,o=n.active,r=n.index,i=r===e(t.state.optionsArray,"length",0)-1,l=0===r,u=e(t.state.mostRecentOption,"label"),p=a.every((function(e){return!e.children}));return s.createElement("div",{key:"options-list-".concat(r,"-").concat(t.COMPONENT_ID),className:"options-container\n ".concat(i?"visible":"hidden"),"data-test":"options-list-".concat(r)},!l&&s.createElement(c,null,s.createElement("div",{className:"cascader-back-arrow","data-test":"cascader-back-arrow-".concat(r),onClick:function(){var e=ht(t.state.optionsArray);e.pop(),t.setState({optionsArray:e})}},s.createElement(Kt,{type:"caret-left"})),s.createElement("div",{className:"options-title","data-test":"options-title"},u)),a.map((function(n,a){return s.createElement("div",{key:"options-".concat(a,"-").concat(t.COMPONENT_ID),className:"option\n ".concat(n.value===o?"active":""),onClick:function(){return t.onOptionClick(n,r)},"data-test":"options-item-".concat(r,"-").concat(a)},s.createElement("span",{"data-test":"options-item-".concat(r,"-").concat(a,"-text")},n.label),!e(n,"children.length")&&s.createElement(Kt,{className:"option-execute-icon",type:"play"}),!!e(n,"children.length")&&s.createElement(Kt,{className:"option-arrow",type:"caret-right"}))})),t.props.showSeeMoreButton&&p&&u&&t.props.onSeeMoreClick&&s.createElement("div",{className:"option","data-test":"see-more-option",onClick:function(){t.props.onSeeMoreClick(u)}},s.createElement("span",null,s.createElement(Kt,{type:"light-bulb"})," See more...")))})),lt(mt(t),"onOptionClick",(function(e,n){if(e.children){var a=t.state.optionsArray.slice(0,n+1);a[n].active=e.value,a.push({options:e.children}),t.setState({optionsArray:a,mostRecentOption:e})}else{t.props.onFinalOptionClick(e);var o=[].concat(ht(t.state.activeKeys),[e.value]);t.setState({activeKeys:o})}})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-cascader-".concat(t.COMPONENT_ID),className:"react-autoql-cascader","data-test":"react-autoql-cascader"},t.state.optionsArray.map((function(e,n){return t.renderOptionsList({options:e.options,active:e.active,index:n})}))))})),t}return it(a)}();lt(Rr,"propTypes",{options:p.arrayOf(p.shape({})),onFinalOptionClick:p.func,onSeeMoreClick:p.func,showSeeMoreButton:p.bool}),lt(Rr,"defaultProps",{options:[],onFinalOptionClick:function(){},onSeeMoreClick:void 0,showSeeMoreButton:!0});var Mr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"render",(function(){return Array.isArray(a.topics)?s.createElement(yt,null,s.createElement("div",null,xt.introPrompt,s.createElement("br",null),s.createElement("div",{className:"topics-container"},s.createElement(Rr,{options:a.topics,onFinalOptionClick:function(e){a.props.onTopicClick({query:e.label,source:["data_messenger","welcome_prompt"]})},showSeeMoreButton:a.props.enableExploreQueriesTab,onSeeMoreClick:function(e){return a.props.onExploreQueriesClick(e)}})),a.props.enableExploreQueriesTab&&s.createElement("div",null,xt.use," ",s.createElement("span",{className:"intro-qi-link",onClick:a.props.onExploreQueriesClick},s.createElement(Kt,{type:"light-bulb",style:{marginRight:"-3px"}})," ",xt.exploreQueries)," ",xt.explorePrompt))):null})),Array.isArray(e.topics)&&(a.topics=e.topics.map((function(e){return{label:e.name,value:d(),children:e.queries.map((function(e){return{label:e.query,value:d()}}))}}))),a.state={},a}return it(n)}();lt(Mr,"propTypes",{topics:p.arrayOf(p.shape({})).isRequired,enableExploreQueriesTab:p.bool.isRequired,onTopicClick:p.func.isRequired,onExploreQueriesClick:p.func.isRequired}),lt(Mr,"defaultProps",{});var Vr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidUpdate",(function(e){var t;a.props.shouldRender&&!e.shouldRender&&(null===(t=a.inputRef)||void 0===t||t.focus())})),lt(mt(a),"loadMore",(function(e,t){if(!a.state.loading){var n={validationResponse:void 0};1===e?(n.initialLoading=!0,n.hasMore=!0):n.loading=!0;var o=a.state.inputValue;o!==a.state.keywords&&(n.queryList=void 0),a.setState(n),sa($e($e({},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,p,d,m,f,g,h;((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===(p=u.pagination)||void 0===p?void 0:p.total_pages)||null==e||null===(d=e.data)||void 0===d||null===(m=d.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var v=(null==e||null===(g=e.data)||void 0===g||null===(h=g.data)||void 0===h?void 0:h.items)||[];if(a.state.queryList){var y=a.state.queryList.concat(v);r.queryList=y}else r.queryList=v;r.keywords=o}a.setState(r)})).catch((function(e){a.setState({loading:!1,initialLoading:!1}),console.error(e)}))}})),lt(mt(a),"onInputChange",(function(e){a.setState({inputValue:e.target.value})})),lt(mt(a),"onKeyPress",(function(e){"Enter"==e.key&&a.loadMore(1)})),lt(mt(a),"onValidationSuggestionClick",(function(e){var t=e.query;a.animateQITextAndSubmit(t)})),lt(mt(a),"animateQITextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length){clearTimeout(a.animateTextTimeout);for(var t=function(t){a.animateTextTimeout=setTimeout((function(){a.setState({inputValue:e.slice(0,t)},(function(){t===e.length&&a.loadMore(1)}))}),50*t)},n=1;n<=e.length;n++)t(n)}})),lt(mt(a),"clearExploreQueries",(function(){a.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){var e;null===(e=a.inputRef)||void 0===e||e.focus()}))})),lt(mt(a),"renderIntroMessage",(function(){return s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement("h2",null,"Welcome to Explore Queries"),a.props.introMessage?s.createElement("p",null,a.props.introMessage):s.createElement(s.Fragment,null,s.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),s.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger.")))})),lt(mt(a),"renderQueryList",(function(){var e;return a.state.initialLoading?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement(da,null)):a.state.validationResponse?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement(bo,{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)?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):s.createElement(mr,null,s.createElement(ue,{pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:s.createElement("div",{className:"loader",key:0},s.createElement(ya,{style:{width:"19px",height:"20px",color:"#999"}}))},a.state.queryList.map((function(e,t){return s.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()})),lt(mt(a),"render",(function(){var e;return a.props.shouldRender?s.createElement(yt,null,s.createElement("div",{ref:function(e){return a.exploreQueriesPage=e},className:"query-tips-page-container","data-test":"query-tips-tab"},s.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},s.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,ref:function(e){return a.inputRef=e},autoFocus:!0}),s.createElement("div",{className:"chat-bar-input-icon"},s.createElement(Kt,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}})),s.createElement("div",{className:"chat-bar-clear-btn ".concat(null!==(e=a.state.queryList)&&void 0!==e&&e.length||a.state.inputValue?"visible":""),"data-for":"explore-queries-tooltips","data-tip":"Clear Search"},s.createElement(Kt,{type:"close",onClick:a.clearExploreQueries}))),s.createElement("div",{className:"query-tips-result-container"},a.renderQueryList())),s.createElement(le,{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 it(n)}();lt(Vr,"propTypes",{shouldRender:p.bool,executeQuery:p.func,inputPlaceholder:p.string}),lt(Vr,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var qr=[],Ir=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.initialize()})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state.filters,t.filters)||(o.props.onChange(o.state.filters),o.props.rebuildTooltips()),!o.props.isOpen&&e.isOpen&&o.setState({inputValue:""})})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.animateTextTimeout),clearTimeout(o.focusInputTimeout),clearTimeout(o.highlightFilterEndTimeout),clearTimeout(o.highlightFilterStartTimeout)})),lt(mt(o),"initialize",(function(){o.setState({isFetchingFilters:!0}),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 l.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Jt(o.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.data)||[];o._isMounted&&o.setState({filters:a,isFetchingFilters:!1})})).catch((function(e){console.error(e),o._isMounted&&o.setState({isFetchingFilters:!1})}))})),lt(mt(o),"animateInputTextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=2e3/t.length,a=function(e){o.animateTextTimeout=setTimeout((function(){o.setState({inputValue:t.slice(0,e)}),e===t.length&&(o.focusInputTimeout=setTimeout((function(){var e;o.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=o.inputElement)||void 0===e||e.focus()}),300))}),n)},r=1;r<=t.length;r++)a(r)})),lt(mt(o),"insertFilter",(function(e){var t=o.findFilter({filterText:e});e&&t?o.handleHighlightFilterRow(o.getKey(t)):o.animateInputTextAndSubmit(e)})),lt(mt(o),"getAllFilters",(function(){return o.state.filters})),lt(mt(o),"getPersistedFilters",(function(){return ce(o.state.filters.filter((function(e){return!e.isSession})))})),lt(mt(o),"findFilter",(function(e){var t=e.filterText,n=e.value,a=e.key,r=o.state.filters;return n&&a?r.find((function(e){return e.key===a&&e.value===n})):t?r.find((function(e){return e.value===t})):void 0})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){ra($e($e({},Jt(o.props.authentication)),{},{suggestion:n})).then((function(t){var n,a=e(t,"data.data"),r=[];qr=[],n=a.matches;for(var i=0;i<n.length;i++)r.push(n[i]);r.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<r.length;l++){var s={name:r[l]};qr.push(s)}o.setState({suggestions:qr})})).catch((function(e){return console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"createNewFilterFromSuggestion",(function(e){var t="include",n=o.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}})),lt(mt(o),"setFilterTypes",(function(e,t){var n=Jt(o.props.authentication),a=e.filter((function(e){return!e.isSession}));return null!=a&&a.length?ia($e($e({},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,r=o.state.filters.map((function(e){var t=a.find((function(t){return o.getKey(e)===o.getKey(t)}));return t||e}));return o.setState({filters:r}),Promise.resolve(e)})).catch((function(e){return console.error(e),o.setState({filters:t}),He.error("Something went wrong. Please try again."),Promise.reject()})):Promise.resolve()})),lt(mt(o),"setFilter",(function(e){var t=Jt(o.props.authentication);return ia($e($e({},t),{},{filters:[e]})).then((function(t){var n,a,r=null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.data;if(null==r||!r.length)throw new Error("No filters in the api response");var i=r.find((function(t){return o.getKey(t)===o.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(o.findFilter(e)){var l=o.state.filters.map((function(e){return o.getKey(e)===o.getKey(i)?i:e}));o.setState({filters:l})}else o.setState({filters:[].concat(ht(o.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),Promise.reject()}))})),lt(mt(o),"unsetFilter",(function(t){try{return 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),s={headers:{Authorization:"Bearer ".concat(a)}};return l.delete(i,s,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}($e($e({},Jt(o.props.authentication)),{},{filter:t}))}catch(e){return Promise.reject(e)}})),lt(mt(o),"getSuggestionValue",(function(e){return o.createNewFilterFromSuggestion(e)})),lt(mt(o),"handlePersistToggle",function(){var e=at(et().mark((function e(t){var n,a,r;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.state.filters,a=$e($e({},t),{},{isSession:!t.isSession,id:void 0}),r=o.state.filters.map((function(e){return o.getKey(e)===o.getKey(t)?a:e})),o.setState({filters:r}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,o.setFilter(a);case 8:e.next=12;break;case 10:return e.next=12,o.unsetFilter(t);case 12:e.next=19;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),He.error("Something went wrong. Please try again."),o.setState({filters:n});case 19:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(o),"handleExcludeToggle",(function(e,t){if(t)try{var n=o.state.filters.map((function(n){return n.show_message===e?$e($e({},n),{},{filter_type:t.toLowerCase()}):n})),a=n.filter((function(t){return t.show_message===e}));o.setFilterTypes(a,ce(o.state.filters)),o.setState({filters:n})}catch(e){console.error(e)}})),lt(mt(o),"removeFilter",function(){var e=at(et().mark((function e(t){var n,a;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.state.filters,a=o.state.filters.filter((function(e){return o.getKey(e)!==o.getKey(t)})),o.setState({filters:a}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,o.unsetFilter(t);case 7:e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),He.error("Something went wrong. Please try again."),o.setState({filters:n});case 14:He.success("Filter removed."),le.hide();case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(o),"onInputChange",(function(e,t){var n,a=t.newValue,r=t.method;"up"!==r&&"down"!==r&&("enter"!==r&&"click"!==r||(o.findFilter(a)?o.handleHighlightFilterRow(o.getKey(a)):o.setFilter(a).then((function(){return He.success("".concat(a.value," has been locked."))})).catch((function(){return He.error("Something went wrong. Please try again.")}))),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&o.setState({inputValue:e.target.value}))})),lt(mt(o),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),lt(mt(o),"renderTitle",(function(){return s.createElement("div",{className:"react-autoql-filter-locking-title"},s.createElement("h3",null,xt.filterLockingTitle," ",s.createElement(Kt,{type:"info","data-place":"right","data-for":"filter-locking-tooltip","data-tip":" Filters can be applied to narrow down<br /> your query results. Locking a filter<br /> ensures that only the specific data<br /> you wish to see is returned."})))})),lt(mt(o),"renderHeader",(function(){return s.createElement("div",{className:"filter-lock-menu-header"},o.renderTitle(),o.renderCloseBtn())})),lt(mt(o),"renderCloseBtn",(function(){return s.createElement(Wa,{onClick:o.props.onClose,className:"filter-locking-close-btn","data-tip":xt.closeFilterLocking,"data-for":"filter-locking-tooltip",size:"small"},s.createElement(Kt,{type:"close"}))})),lt(mt(o),"renderFooter",(function(){return s.createElement("div",{className:"filter-lock-menu-footer"},s.createElement(Wa,{onClick:o.props.onClose,size:"small"},"Continue"))})),lt(mt(o),"renderVLInput",(function(){return s.createElement(Le,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:o.state.suggestions,onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:function(e){return o.getSuggestionValue(e.name)},renderSuggestion:function(e){return s.createElement("ul",{className:"filter-lock-suggestion-item"},s.createElement("li",null,e.name.keyword),s.createElement("li",null,e.name.show_message))},inputProps:{onChange:o.onInputChange,value:o.state.inputValue,disabled:o.state.isFetchingFilters,placeholder:"Search & select a filter",className:"react-autoql-condition-locking-input",id:"react-autoql-filter-menu-input"}})})),lt(mt(o),"renderFilterListCategory",(function(e,t){return s.createElement("div",{key:e},o.renderFilterListCategoryHeader(e,t),s.createElement("div",{className:"react-autoql-filter-list"},o.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return o.renderFilterListItem(e)}))))})),lt(mt(o),"renderFilterListCategoryHeader",(function(e,t){var n,a=null===(n=o.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return s.createElement("div",{className:"react-autoql-filter-list-title flex "},s.createElement("div",null,s.createElement("h4",null,s.createElement("span",{className:"filter-lock-category-title"},e),s.createElement(ar,{className:"include-exclude-toggle-group",options:["INCLUDE","EXCLUDE"],tooltips:["Only show results with these values","Show results without these values"],tooltipId:"filter-locking-tooltip",value:a,type:"button",onChange:function(t){return o.handleExcludeToggle(e,t)}}))),0===t?s.createElement("div",{className:"persist-toggle-column"},s.createElement("h4",null,"Persist"," ",s.createElement(Kt,{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)})),lt(mt(o),"renderFilterListItem",(function(e){var t=o.getKey(e);return s.createElement("div",{key:t,className:"flex ".concat(o.state.highlightedFilter===t?"react-autoql-highlight-row":"")},s.createElement("div",{className:"react-autoql-condition-table-list-item"},e.value),s.createElement("div",{id:"react-autoql-condition-table-settings"},s.createElement(Ua,{className:"persist-toggle-column",type:"switch",checked:!e.isSession,onChange:function(){return o.handlePersistToggle(e)}}),s.createElement(Kt,{className:"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return o.removeFilter(e)}})))})),lt(mt(o),"renderFilterList",(function(){var e;if(o.state.isFetchingFilters)return s.createElement("div",{className:"react-autoql-condition-list-loading-container"},s.createElement(da,null));if(null===(e=o.state.filters)||void 0===e||!e.length)return s.createElement("div",{className:"react-autoql-empty-condition-list"},s.createElement("i",null,xt.noFiltersLocked));var t=ht(new Set(o.state.filters.map((function(e){return e.show_message}))));return s.createElement("div",{className:"react-autoql-filter-list-container"},t.map((function(e,t){return o.renderFilterListCategory(e,t)})))})),lt(mt(o),"renderContent",(function(){return s.createElement(yt,null,s.createElement(Be,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:_e,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1,theme:en(o.props.themeConfig).theme}),s.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},o.renderHeader(),o.renderVLInput(),o.renderFilterList(),o.renderFooter(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0})))})),lt(mt(o),"render",(function(){return o.props.isOpen?s.createElement(me,{isOpen:o.props.isOpen,onClickOutside:o.props.onClose,position:o.props.position,align:o.props.align,content:o.renderContent(),containerClassName:"filter-lock-menu",padding:0},s.createElement(yt,null,o.props.children||null)):o.props.children||null})),o.contentKey=d(),o.state={filters:[],suggestions:[],inputValue:""},o}return it(a,[{key:"handleHighlightFilterRow",value:function(e){var t=this;He.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}();lt(Ir,"propTypes",{authentication:bt,themeConfig:St,isOpen:p.bool,position:p.string,align:p.string,onChange:p.func,rebuildTooltips:p.func}),lt(Ir,"defaultProps",{authentication:Gt,themeConfig:Xt,isOpen:!1,position:"bottom",align:"center",rebuildTooltips:function(){},onChange:function(){}});var Pr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0;try{document.addEventListener("visibilitychange",o.onWindowResize),window.addEventListener("resize",o.onWindowResize),o.props.enableQueryQuickStartTopics&&o.setQueryTopics()}catch(e){console.error(e),o.setState({hasError:!0})}setTimeout(o.rebuildTooltips,1e3)})),lt(mt(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:d()}),se(en(o.props.themeConfig),en(e.themeConfig))||_n(o.props.themeConfig),o.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),pe(n)||o.setState($e({},n))}catch(e){console.error(e),o.setState({hasError:!0})}})),lt(mt(o),"setQueryTopics",(function(){(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.domain,a=t.token,o=t.apiKey;if(!n||!o||!a)return Promise.reject(new Error("Unauthenticated"));var r="".concat(n,"/autoql/api/v1/topic-set?key=").concat(o),i={headers:{Authorization:"Bearer ".concat(a)}};return l.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(Jt(o.props.authentication)).then((function(e){var t,n,a,r;if(null!==(t=o.dataMessengerContentRef)&&void 0!==t&&t._isMounted&&null!=e&&null!==(n=e.data)&&void 0!==n&&null!==(a=n.data)&&void 0!==a&&null!==(r=a.topics)&&void 0!==r&&r.length){var i,l,c=s.createElement(Mr,{topics:e.data.data.topics,enableExploreQueriesTab:o.props.enableExploreQueriesTab,onTopicClick:o.onTopicClick,onExploreQueriesClick:o.openExploreQueries});if(o.dataMessengerIntroMessages.push(c),null!==(i=o.dataMessengerContentRef)&&void 0!==i&&i._isMounted)null===(l=o.dataMessengerContentRef)||void 0===l||l.addIntroMessage(c)}})).catch((function(e){console.error(e)}))})),lt(mt(o),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;clearTimeout(o.rebuildTooltipsTimer),o.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e)})),lt(mt(o),"refreshNotifications",(function(){var e;null===(e=o.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),lt(mt(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}})),lt(mt(o),"onWindowResize",(function(){o.state.isWindowResizing||o.setState({isWindowResizing:!0}),clearTimeout(o.windowResizeTimer),o.windowResizeTimer=setTimeout((function(){o.setState({isWindowResizing:!1})}),300)})),lt(mt(o),"openExploreQueries",(function(e){o.setState({activePage:"explore-queries"}),e&&(clearTimeout(o.exploreQueriesTimeout),o.exploreQueriesTimeout=setTimeout((function(){var t;null===(t=o.exploreQueriesRef)||void 0===t||t.animateQITextAndSubmit(e)}),500))})),lt(mt(o),"toggleFullScreen",(function(e,t,n){o.setState({width:e?o.props.width:t,height:e?o.props.height:n,isSizeMaximum:!e}),le.hide()})),lt(mt(o),"getHandleProp",(function(){return void 0!==o.props.customHandle?o.props.customHandle:!!o.props.showHandle&&s.createElement("div",{className:"drawer-handle\n ".concat(o.state.isVisible?" hide":"","\n ").concat(o.props.handleImage?"":" default-logo"),style:o.props.handleStyles},o.props.handleImage?s.createElement("img",{src:o.props.handleImage,height:"22px",width:"22px",draggable:"false"}):s.createElement(Kt,{type:"react-autoql-bubbles-outlined",size:26}))})),lt(mt(o),"getDrawerHeight",(function(){return"right"===o.state.placement||"left"===o.state.placement?null:o.state.height})),lt(mt(o),"getDrawerWidth",(function(){return"right"===o.state.placement||"left"===o.state.placement?o.state.width:null})),lt(mt(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})),lt(mt(o),"onDrawerChange",(function(e){e?o.setState({isVisible:!0}):o.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),lt(mt(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)})),lt(mt(o),"handleClearQueriesDropdown",(function(){o.clearQueriesDropdown&&("block"===o.clearQueriesDropdown.style.display?o.clearQueriesDropdown.style.display="none":o.clearQueriesDropdown.style.display="block")})),lt(mt(o),"onRTValueLabelClick",(function(e){o.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=o.filterLockRef)||void 0===t||t.insertFilter(e)}))})),lt(mt(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})})),lt(mt(o),"renderTabs",(function(){var e=o.state.activePage;return s.createElement("div",{className:"data-messenger-tab-container ".concat(o.props.placement," ").concat(o.state.isVisible?"visible":"hidden")},s.createElement("div",{className:"page-switcher-shadow-container ".concat(o.props.placement)},s.createElement("div",{className:"page-switcher-container ".concat(o.props.placement)},s.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return o.setState({activePage:"data-messenger"})},"data-tip":"Data Messenger","data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"})),o.props.enableExploreQueriesTab&&s.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return o.setState({activePage:"explore-queries"})},"data-tip":xt.exploreQueries,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"light-bulb",size:22})),o.props.enableNotificationsTab&&$t(o.props.autoQLConfig).enableNotifications&&s.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){o.setState({activePage:"notifications"}),o.notificationBadgeRef&&o.notificationBadgeRef.resetCount()},"data-tip":"Notifications","data-for":"react-autoql-header-tooltip"},s.createElement("div",{className:"data-messenger-notification-btn"},s.createElement(Yo,{ref:function(e){return o.notificationBadgeRef=e},authentication:Jt(Jt(o.props.authentication)),themeConfig:o.props.themeConfig,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&&s.createElement("div",{className:"tab".concat("dpr"===e?" active":""," react-autoql-dpr"),onClick:function(){return o.setState({activePage:"dpr"})},"data-tip":"Education","data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"grad-cap",size:22})))))})),lt(mt(o),"renderRightHeaderContent",(function(){return s.createElement(s.Fragment,null,$t(o.props.autoQLConfig).enableFilterLocking&&o.renderFilterLockPopover(),s.createElement(me,{isOpen:o.state.isOptionsDropdownOpen,onClickOutside:function(){o.setState({isOptionsDropdownOpen:!1})},position:"bottom",content:s.createElement("div",null,s.createElement("div",{className:"clear-messages-confirm-popover"},s.createElement("div",{className:"react-autoql-menu-text",onClick:o.handleClearQueriesDropdown},s.createElement(Kt,{type:"trash"}),s.createElement("span",{style:{marginLeft:5}},xt.clearDataResponses)),s.createElement("div",{ref:function(e){return o.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},s.createElement(Wa,{type:"default",size:"small",onClick:function(){return o.setState({isOptionsDropdownOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return o.clearMessages()}},"Clear"))))},s.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":xt.clearDataResponses,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"trash"}))))})),lt(mt(o),"renderHeaderTitle",(function(){var e="";switch(o.state.activePage){case"data-messenger":e=o.props.title;break;case"explore-queries":e=xt.exploreQueries;break;case"notifications":e=xt.notifications;break;case"dpr":e="Education"}return s.createElement("div",{className:"header-title"},e)})),lt(mt(o),"openFilterLockMenu",(function(){o.state.isFilterLockMenuOpen||o.setState({isFilterLockMenuOpen:!0})})),lt(mt(o),"closeFilterLockMenu",(function(){o.state.isFilterLockMenuOpen&&o.setState({isFilterLockMenuOpen:!1})})),lt(mt(o),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));o.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),lt(mt(o),"renderFilterLockPopover",(function(){return s.createElement(Ir,{ref:function(e){return o.filterLockRef=e},authentication:o.props.authentication,themeConfig:o.props.themeConfig,isOpen:o.state.isFilterLockMenuOpen,onChange:o.onFilterChange,onClose:o.closeFilterLockMenu,rebuildTooltips:o.rebuildTooltips,position:"bottom",align:"end"},s.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===o.state.activePage?"visible":"hidden"),"data-tip":xt.openFilterLocking,"data-for":"react-autoql-header-tooltip",onClick:o.state.isFilterLockMenuOpen?o.closeFilterLockMenu:o.openFilterLockMenu},s.createElement(Kt,{type:o.state.hasFilters?"lock":"unlock"})))})),lt(mt(o),"renderHeaderContent",(function(){var e=o.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,a=o.state.width===t;return s.createElement(c,null,s.createElement("div",{className:"react-autoql-header-left-container"},s.createElement("button",{onClick:function(){o.dmRef.setState({open:!1}),o.setState({isVisible:!1})},className:"react-autoql-drawer-header-btn close","data-tip":xt.closeDataMessenger,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"close"})),s.createElement("button",{onClick:function(){return o.toggleFullScreen(a,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":a?xt.minimizeDataMessenger:xt.maximizeDataMessenger,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:a?"minimize":"maximize"}))),s.createElement("div",{className:"react-autoql-header-center-container"},o.renderHeaderTitle()),s.createElement("div",{className:"react-autoql-header-right-container"},o.renderRightHeaderContent()))})),lt(mt(o),"renderBodyContent",(function(){return s.createElement(s.Fragment,null,o.renderDataMessengerContent(),o.renderExploreQueriesContent(),o.renderNotificationsContent(),o.renderDPRContent())})),lt(mt(o),"renderDataMessengerContent",(function(){var e,t,n=o.props.dataPageSize;o.props.enableAjaxTableData&&!n&&(n=o.DEFAULT_AJAX_PAGE_SIZE);var a=$t(o.props.autoQLConfig).enableFilterLocking?o.onRTValueLabelClick:void 0;return s.createElement(yt,null,s.createElement(Nr,st({},o.props,{shouldRender:"data-messenger"===o.state.activePage,key:o.state.dataMessengerId,ref:function(e){return o.dataMessengerContentRef=e},authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,themeConfig:o.props.themeConfig,isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],rebuildTooltips:o.rebuildTooltips,onRTValueLabelClick:a,queryFilters:o.state.sessionFilters,isDataMessengerOpen:!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open),introMessages:o.dataMessengerIntroMessages,inputPlaceholder:o.props.inputPlaceholder,enableAjaxTableData:o.props.enableAjaxTableData,autoChartAggregations:o.props.autoChartAggregations,dataPageSize:n})))})),lt(mt(o),"renderDPRContent",(function(){var e,t,n,a;return s.createElement(yt,null,s.createElement(Nr,st({},o.props,{shouldRender:"dpr"===o.state.activePage,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},themeConfig:o.props.themeConfig,isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],rebuildTooltips:o.rebuildTooltips,isDataMessengerOpen:!(null===(n=o.dmRef)||void 0===n||null===(a=n.state)||void 0===a||!a.open),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}})))})),lt(mt(o),"renderExploreQueriesContent",(function(){var e,t;return s.createElement(yt,null,s.createElement(Vr,{ref:function(e){return o.exploreQueriesRef=e},authentication:o.props.authentication,shouldRender:"explore-queries"===o.state.activePage&&!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open),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)}}))})),lt(mt(o),"renderNotificationsContent",(function(){var e,t;return s.createElement(yt,null,s.createElement(gr,{ref:function(e){return o.notificationListRef=e},authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,onExpandCallback:o.props.onNotificationExpandCallback,onCollapseCallback:o.props.onNotificationCollapseCallback,activeNotificationData:o.props.activeNotificationData,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,showNotificationDetails:!1,shouldRender:!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open)&&"notifications"===o.state.activePage}))})),lt(mt(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,containerWidth: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,containerWidth:u,isSizeMaximum:!1})}else if("bottom"===n){var p=e(o.state.startingResizePosition,"y")-t.pageY,d=e(o.state.startingResizePosition,"height")+p;d>i&&(d=i),d<o.minHeight&&(d=o.minHeight),Number(d)&&o.setState({height:d,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})}})),lt(mt(o),"stopResizingDrawer",(function(){"right"===o.state.placement||"left"===o.state.placement?o.setState({isResizing:!1,containerWidth:o.state.width}):"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)})),lt(mt(o),"renderResizeHandle",(function(){var e=mt(o);if(o.state.isVisible){var t=o.getPlacementProp();return s.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})),lt(mt(o),"renderTooltips",(function(){return s.createElement(c,null,s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-header-tooltip",effect:"solid",delayShow:800,place:"top",html:!0}),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-toolbar-btn-tooltip",effect:"solid",delayShow:500,place:"top",html:!0}))})),lt(mt(o),"renderDataAlertModal",(function(){return s.createElement(pr,{authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,isVisible:o.state.isDataAlertModalVisible,onClose:function(){return o.setState({isDataAlertModalVisible:!1})},onSave:function(){o.props.onSuccessAlert("Notification created!"),o.setState({isDataAlertModalVisible:!1})},onErrorCallback:function(){return o.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")},initialQuery:o.state.activeQuery})})),lt(mt(o),"render",(function(){return o.state.hasError?null:s.createElement(yt,null,void((navigator.language||navigator.userLanguage).includes("sp")?xt.setLanguage("sp"):xt.setLanguage("en")),s.createElement(Fe,{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.props.enableExploreQueriesTab||o.props.enableNotificationsTab)&&o.renderTabs(),s.createElement("div",{className:"react-autoql-drawer-content-container"},s.createElement("div",{className:"chat-header-container"},o.renderHeaderContent()),o.renderBodyContent())),o.renderDataAlertModal(),o.renderTooltips())})),o.minWidth=400,o.minHeight=400,o.COMPONENT_KEY=d(),o.HEADER_THICKNESS=70,o.TAB_THICKNESS=45,o.DEFAULT_AJAX_PAGE_SIZE=50,_n(t.themeConfig),o.dataMessengerIntroMessages=[t.introMessage?"".concat(t.introMessage):"Hi ".concat(t.userDisplayName||"there","! Let’s dive into your data. What can I help you discover today?")],o.dprMessengerIntroMessages=[s.createElement(s.Fragment,null,s.createElement("span",null,"Ask questions, get answers."),s.createElement("br",null),s.createElement("br",null),s.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"," ",s.createElement("a",{href:"https://www.investopedia.com/",target:"_blank",rel:"noopener"},"Investopedia®"),", including applicable reference links."))],o.state={dataMessengerId:d(),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 it(a,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),document.removeEventListener("visibilitychange",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.feedbackTimeout),clearTimeout(this.animateTextTimeout),clearTimeout(this.exploreQueriesTimeout),clearTimeout(this.executeQueryTimeout),clearTimeout(this.rebuildTooltipsTimer)}catch(e){}}}]),a}();lt(Pr,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,placement:p.string,maskClosable:p.bool,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),showHandle:p.bool,handleImage:p.string,handleStyles:p.shape({}),shiftScreen:p.bool,userDisplayName:p.string,clearOnClose:p.bool,enableVoiceRecord:p.bool,title:p.string,maxMessages:p.number,introMessage:p.string,enableExploreQueriesTab:p.bool,enableNotificationsTab:p.bool,resizable:p.bool,inputPlaceholder:p.string,enableDPRTab:p.bool,dataPageSize:p.number,notificationCount:p.number,enableDynamicCharting:p.bool,defaultTab:p.string,autoChartAggregations:p.bool,enableFilterLocking:p.bool,enableQueryQuickStartTopics:p.bool,enableAjaxTableData:p.bool,onNotificationExpandCallback:p.func,onNewNotification:p.func,onNotificationCount:p.func,onVisibleChange:p.func,onErrorCallback:p.func,onSuccessAlert:p.func}),lt(Pr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,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,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 Lr=["style","className","key"],Or=[],Fr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0})),lt(mt(o),"shouldComponentUpdate",(function(e,t){var n=o.getFilteredProps(o.props),a=o.getFilteredProps(e);return!se(We(n,Ye(n)),We(a,Ye(a)))||!se(o.state,t)})),lt(mt(o),"componentDidUpdate",(function(t,n){var a,r;e(o.props,"tile.query")!==e(t,"tile.query")&&o.setState({query:e(o.props,"tile.query")},(function(){o.setState({supportedDisplayTypes:Pn({response:e(o.props,"queryResponse")})})})),e(o.props,"tile.title")!==e(t,"tile.title")&&o.setState({title:e(o.props,"tile.title")}),null!==(a=o.secondOptionsToolbarRef)&&void 0!==a&&a._isMounted&&o.secondOptionsToolbarRef.forceUpdate(),null!==(r=o.optionsToolbarRef)&&void 0!==r&&r._isMounted&&o.optionsToolbarRef.forceUpdate()})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.autoCompleteTimer),clearTimeout(o.dragEndTimeout),o.cancelAllQueries()})),lt(mt(o),"cancelAllQueries",(function(){var e,t;null===(e=o.axiosSource)||void 0===e||e.cancel(Dt),null===(t=o.secondAxiosSource)||void 0===t||t.cancel(Dt)})),lt(mt(o),"debouncedSetParamsForTile",(function(e,t){o.paramsToSet=$e($e({},o.paramsToSet),e),"function"==typeof t&&(o.callbackArray=[].concat(ht(o.callbackArray),[t])),clearTimeout(o.setParamsForTileTimout),o.setParamsForTileTimout=setTimeout((function(){o.props.setParamsForTile(o.paramsToSet,o.props.tile.i,ce(o.callbackArray)),o.paramsToSet={},o.callbackArray=[]}),o.debounceTime)})),lt(mt(o),"getFilteredProps",(function(e){return $e($e({},e),{},{children:void 0})})),lt(mt(o),"toggleTableFilter",(function(e,t){null==e||e.toggleTableFilter({isFilteringTable:t})})),lt(mt(o),"isQueryValid",(function(e){return!!e&&!!e.trim()})),lt(mt(o),"setTopExecuted",(function(){o._isMounted&&o.setState({isTopExecuting:!1,isTopExecuted:!0})})),lt(mt(o),"endTopQuery",(function(e){var t=e.response;o.QUERY_RESPONSE_KEY=d(),o.debouncedSetParamsForTile({queryResponse:t,selectedSuggestion:void 0},o.setTopExecuted)})),lt(mt(o),"setBottomExecuted",(function(){o._isMounted&&o.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),lt(mt(o),"endBottomQuery",(function(e){var t=e.response;o.debouncedSetParamsForTile({secondQueryResponse:t,secondSelectedSuggestion:void 0},o.setBottomExecuted)})),lt(mt(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=["dashboards"];null!=r&&r.length?l=[].concat(ht(l),ht(r)):l.push("user");var s=$e($e($e({query:t,userSelection:n},Jt(o.props.authentication)),$t(o.props.autoQLConfig)),{},{enableQueryValidation:!!o.props.isEditing&&$t(o.props.autoQLConfig).enableQueryValidation,source:l,pageSize:o.props.dataPageSize,skipQueryValidation:a,cancelToken:i?o.secondAxiosSource.token:o.axiosSource.token});return ea(s).then((function(e){return i?o.bottomRequestData=s:o.topRequestData=s,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),lt(mt(o),"processTileTop",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source,l=t.pageSize;o.setState({isTopExecuting:!0,customMessage:void 0});var s=!!r||!(o.props.tile.query!==n||!o.props.tile.skipQueryValidation),c=a||(o.props.tile.query===n?e(o.props.tile,"queryValidationSelections"):void 0);o.debouncedSetParamsForTile({query:n,dataConfig:o.props.tile.query===n?void 0:o.props.tile.dataConfig,skipQueryValidation:s,queryResponse:null,selectedSuggestion:void 0,queryValidationSelections:c}),o.processQuery({query:n,userSelection:c,skipQueryValidation:r,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){o._isMounted&&o.endTopQuery({response:e})})).catch((function(e){o._isMounted&&o.endTopQuery({response:e})}))})),lt(mt(o),"processTileBottom",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source;o.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondCustomMessage:void 0});var l=r||!(o.props.tile.secondQuery!==n||!o.props.tile.secondskipQueryValidation),s=a||(o.props.tile.secondQuery===n?e(o.props.tile,"secondQueryValidationSelections"):void 0);o.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:o.props.tile.secondQuery===n?void 0:o.props.tile.secondDataConfig,secondskipQueryValidation:l,secondQueryResponse:null,secondSelectedSuggestion:void 0,secondQueryValidationSelections:s}),o.processQuery({query:n,userSelection:s,skipQueryValidation:r,source:i,isSecondHalf:!0}).then((function(e){o._isMounted&&o.endBottomQuery({response:e})})).catch((function(e){o._isMounted&&o.endBottomQuery({response:e})}))})),lt(mt(o),"clearQueryResponses",(function(){o.setState({isTopExecuting:!1,isTopExecuted:!1,customMessage:void 0}),o.debouncedSetParamsForTile({queryResponse:void 0,secondQueryResponse:void 0})})),lt(mt(o),"processTile",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.query,n=e.secondQuery,a=e.skipQueryValidation,r=e.secondskipQueryValidation,i=e.source;o.axiosSource=l.CancelToken.source(),o.secondAxiosSource=l.CancelToken.source();var s=t||o.props.tile.selectedSuggestion||o.state.query,c=n||o.props.tile.secondSelectedSuggestion||o.state.secondQuery;o.processTileTop({query:s,skipQueryValidation:a,source:i}),o.getIsSplitView()&&c&&s!==c&&o.processTileBottom({query:c,skipQueryValidation:r,source:i})})),lt(mt(o),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(o.processTile({query:e.target.value}),e.target.blur())})),lt(mt(o),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(o.processTileBottom({query:e.target.value}),e.target.blur())})),lt(mt(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({selectedSuggestion:t})})),lt(mt(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})})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e({suggestion:n},Jt(o.props.authentication))).then((function(t){if(o._isMounted){var n,a=e(t,"data.data"),r=[];Or=[],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]};Or.push(s)}o.setState({suggestions:Or})}})).catch((function(e){console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){if(e&&e.name){var t=e.name;o.userSelectedValue=t,o.userSelectedSuggestion=!0,o.setState({query:t}),o.debouncedSetParamsForTile({query:t})}})),lt(mt(o),"onQueryInputChange",(function(t){(!o.userSelectedSuggestion||38!==t.keyCode&&40!==t.keyCode)&&(e(t,"target.value")||""===e(t,"target.value")?o.setState({query:t.target.value}):o.processTile({query:o.userSelectedValue}))})),lt(mt(o),"onDisplayTypeChange",(function(e){o.debouncedSetParamsForTile({displayType:e})})),lt(mt(o),"onSecondDisplayTypeChange",(function(e){o.debouncedSetParamsForTile({secondDisplayType:e})})),lt(mt(o),"getIsSplitView",(function(){return e(o.props.tile,"splitView")})),lt(mt(o),"toggleSecondQueryInput",(function(){o.setState({isSecondQueryInputOpen:!o.state.isSecondQueryInputOpen})})),lt(mt(o),"renderHeader",(function(){return o.props.isEditing?s.createElement("div",{className:"dashboard-tile-edit-wrapper"},s.createElement("div",{className:"dashboard-tile-input-container\n ".concat(o.state.isQueryInputFocused?"query-focused":"","\n ").concat(o.state.isTitleInputFocused?"title-focused":""),onMouseDown:function(e){return e.stopPropagation()}},s.createElement("div",{className:"dashboard-tile-left-input-container"},s.createElement(Kt,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),$t(o.props.autoQLConfig).enableAutocomplete?s.createElement(Le,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return s.createElement(c,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(){return o.setState({isQueryInputFocused:!0})},onChange:o.onQueryInputChange,onKeyDown:o.onQueryTextKeyDown,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})}}}):s.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",onChange:function(e){o.setState({query:e.target.value})},onKeyDown:o.onQueryTextKeyDown,onFocus:function(){return 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})}})),s.createElement("div",{className:"dashboard-tile-right-input-container"},s.createElement(Kt,{className:"title-input-icon",type:"title"}),s.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)",value:o.state.title,"data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){return o.setState({title:e.target.value})},onFocus:function(){return o.setState({isTitleInputFocused:!0})},onBlur:function(e){o.debouncedSetParamsForTile({title:e.target.value}),o.setState({isTitleInputFocused:!1})}}))),s.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-play-button".concat(o.isQueryValid(o.state.query)?"":" disabled")},s.createElement(Kt,{type:"play",onClick:function(){return o.processTile()},"data-tip":"Run tile","data-place":"left"})),s.createElement("div",{className:"dashboard-tile-delete-button",onMouseDown:function(e){return e.stopPropagation()},onClick:function(){return o.props.deleteTile(o.props.tile.i)}},s.createElement(Kt,{style:{fontSize:"18px"},type:"close"}))):s.createElement("div",{className:"dashboard-tile-title-container"},s.createElement("span",{className:"dashboard-tile-title"},o.props.tile.title||o.props.tile.query||"Untitled"),s.createElement("div",{className:"dashboard-tile-title-divider"}))})),lt(mt(o),"renderDraggingPlaceholder",(function(){return s.createElement("div",{className:"react-autoql-db-dragging-placeholder-container"},s.createElement("div",{className:"react-autoql-db-dragging-placeholder-title"}),s.createElement("div",{className:"react-autoql-db-dragging-placeholder-content"}))})),lt(mt(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?s.createElement(da,null):!o.props.isEditing&&a?s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,"No query was supplied for this tile.")):o.props.isEditing&&!e(o.state.query,"trim()")?s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,"To get started, enter a query and click"," ",s.createElement(Kt,{className:"play-icon",type:"play"}))):s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,o.props.isEditing?s.createElement("span",null,"Hit ",s.createElement(Kt,{className:"edit-mode-placeholder-icon",type:"play"})," ","to run this tile"):s.createElement("span",null,o.props.notExecutedText))),s.createElement("div",{className:"loading-container-centered"},r)})),lt(mt(o),"onQueryValidationSelectOption",(function(e,t){o.setState({query:e}),o.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),lt(mt(o),"onSecondQueryValidationSelectOption",(function(e,t){o.setState({secondQuery:e}),o.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),lt(mt(o),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),lt(mt(o),"onDataConfigChange",(function(e){o.debouncedSetParamsForTile({dataConfig:e})})),lt(mt(o),"onSecondDataConfigChange",(function(e){o.debouncedSetParamsForTile({secondDataConfig:e})})),lt(mt(o),"reportProblemCallback",(function(){var e;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.optionsToolbarRef.setState({activeMenu:"other-problem"})})),lt(mt(o),"secondReportProblemCallback",(function(){var e;null!==(e=o.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&o.secondOptionsToolbarRef.setState({activeMenu:"other-problem"})})),lt(mt(o),"onNoneOfTheseClick",(function(){o.setState({customMessage:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")})})),lt(mt(o),"secondOnNoneOfTheseClick",(function(){o.setState({secondCustomMessage:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")})})),lt(mt(o),"renderSuggestionPrefix",(function(){return s.createElement("div",null,"I want to make sure I understood your query. Did you mean:")})),lt(mt(o),"renderSplitResponse",(function(){var t=e(o.tileInnerDiv,"clientWidth")?"".concat(o.tileInnerDiv.clientWidth-70,"px"):"0px";return s.createElement(Ge,{vertical:!0,percentage:!0,secondaryInitialSize:o.props.secondDisplayPercentage||50,onDragEnd:function(){o.dragEndTimeout=setTimeout((function(){var t=e(o.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));Number.isNaN(n)||o.debouncedSetParamsForTile({secondDisplayPercentage:n})}),1e3)}},s.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderTopResponse()),s.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderBottomResponse(),o.props.isEditing&&s.createElement("div",{className:"viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},s.createElement("button",{onClick:function(){o.toggleSecondQueryInput(),le.hide()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"}),s.createElement(Kt,{type:o.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),s.createElement("input",{className:"dashboard-tile-input query second ".concat(o.state.isSecondQueryInputOpen?"open":""),value:o.state.secondQuery,onChange:function(e){o.setState({secondQuery:e.target.value})},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"}}))))})),lt(mt(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}),le.hide()})),lt(mt(o),"renderSplitViewBtn",(function(){return s.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},s.createElement("button",{onClick:o.onSplitViewClick,className:"react-autoql-toolbar-btn","data-tip":o.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},s.createElement(Kt,{type:o.getIsSplitView()?"single-view":"split-view",style:{color:o.props.tile.splitView?en(o.props.themeConfig).accentColor:"inherit"}})))})),lt(mt(o),"onSupportedDisplayTypesChange",(function(e){o.setState({supportedDisplayTypes:e}),o.debouncedSetParamsForTile({dataConfig:void 0})})),lt(mt(o),"onSecondSupportedDisplayTypesChange",(function(e){o.setState({secondSupportedDisplayTypes:e}),o.debouncedSetParamsForTile({secondDataConfig:void 0})})),lt(mt(o),"onCSVDownloadStart",(function(e){return o.props.onCSVDownloadStart($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"onCSVDownloadProgress",(function(e){return o.props.onCSVDownloadProgress($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"onCSVDownloadFinish",(function(e){return o.props.onCSVDownloadFinish($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"renderSuggestionMessage",(function(e){return e||s.createElement("div",{style:{paddingTop:"20px"}},o.renderSuggestionPrefix())})),lt(mt(o),"renderToolbars",(function(e){var t=e.queryOutputProps,n=e.vizToolbarProps,a=e.optionsToolbarProps,r=e.isSecondHalf,i=document.querySelector("#".concat(t.key," .dashboard-data-limit-warning-icon"));return s.createElement("div",{className:"dashboard-tile-toolbars-container ".concat(i?"left-padding":"")},s.createElement("div",{className:"dashboard-tile-toolbars-left-container"},o.props.isEditing&&(r||!o.getIsSplitView())&&o.renderSplitViewBtn(),!o.props.isDragging&&o.props.isEditing&&s.createElement(ko,st({themeConfig:o.props.themeConfig},n))),s.createElement("div",{className:"dashboard-tile-toolbars-right-container"},!o.props.isDragging&&s.createElement(wr,st({authentication:Jt(o.props.authentication),autoQLConfig:$t(o.props.autoQLConfig),themeConfig:en(o.props.themeConfig),onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessCallback,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadProgress:o.onCSVDownloadProgress,onCSVDownloadFinish:o.onCSVDownloadFinish,rebuildTooltips:o.props.rebuildTooltips},a))))})),lt(mt(o),"renderResponseContent",(function(e){var t=e.queryOutputProps,n=e.isExecuting,a=e.isExecuted,r=e.renderPlaceholder,i=e.isSecondHalf;if(r)return o.renderContentPlaceholder({isExecuting:n,isExecuted:a});var l=o.state.customMessage;return i&&(l=o.state.secondCustomMessage),s.createElement(s.Fragment,null,o.getIsSuggestionResponse(t.queryResponse)&&o.renderSuggestionMessage(t.customMessage),!l&&s.createElement(Do,st({authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,autoQLConfig:$t(o.props.autoQLConfig),dataFormatting:Zt(o.props.dataFormatting),renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:o.props.autoChartAggregations,isResizing:o.props.isDragging,renderSuggestionsAsDropdown:o.props.tile.h<4,enableDynamicCharting:o.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),enableAjaxTableData:o.props.enableAjaxTableData,rebuildTooltips:o.props.rebuildTooltips},t)))})),lt(mt(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,c=e.isSecondHalf,u=e.isExecuting,p=e.isExecuted,d=e.renderPlaceholder;return s.createElement("div",{className:"loading-container-centered",id:n.key},o.renderResponseContent({queryOutputProps:n,isExecuting:u,isExecuted:p,renderPlaceholder:d,isSecondHalf:c}),o.renderToolbars({queryOutputProps:n,vizToolbarProps:r,optionsToolbarProps:l,isSecondHalf:c}))})),lt(mt(o),"renderTopResponse",(function(){var t=o.state.isTopExecuting,n=o.state.isTopExecuted,a=!o.props.queryResponse||t||!n,r=e(o.props,"tile.displayType");return o.renderResponse({renderPlaceholder:a,isExecuting:t,isExecuted:n,queryOutputProps:{ref:function(e){return o.setState({responseRef:e})},optionsToolbarRef:o.optionsToolbarRef,key:"dashboard-tile-query-top-".concat(o.QUERY_RESPONSE_KEY),displayType:r,queryResponse:o.props.queryResponse,tableConfigs:o.props.tile.dataConfig,onTableConfigChange:o.onDataConfigChange,queryValidationSelections:o.props.tile.queryValidationSelections,onSuggestionClick:o.onSuggestionClick,selectedSuggestion:e(o.props.tile,"selectedSuggestion"),onNoneOfTheseClick:o.onNoneOfTheseClick,onDrilldownStart:function(e){return o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!1,activeKey:e})},onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onQueryValidationSelectOption,onSupportedDisplayTypesChange:o.onSupportedDisplayTypesChange,onRecommendedDisplayType:function(e){o.onDisplayTypeChange(e)},reportProblemCallback:o.reportProblemCallback,customMessage:o.state.customMessage,queryRequestData:o.topRequestData},vizToolbarProps:{ref:function(e){return o.vizToolbarRef=e},key:"viz-toolbar-".concat(o.QUERY_RESPONSE_KEY),displayType:r,onDisplayTypeChange:o.onDisplayTypeChange,supportedDisplayTypes:o.state.supportedDisplayTypes},optionsToolbarProps:{ref:function(e){return o.optionsToolbarRef=e},key:"options-toolbar-".concat(o.QUERY_RESPONSE_KEY),responseRef:o.state.responseRef,queryResponse:o.props.queryResponse,onFilterClick:function(e){var t=e.isFilteringTable;return o.toggleTableFilter(o.state.responseRef,t)},displayType:r}})})),lt(mt(o),"renderBottomResponse",(function(){var t,n,a,r,i=null===(t=o.props)||void 0===t||null===(n=t.tile)||void 0===n?void 0:n.query,l=null===(a=o.props)||void 0===a||null===(r=a.tile)||void 0===r?void 0:r.secondQuery,s=!l||i===l,c=o.state.isBottomExecuting,u=o.state.isBottomExecuted,p=o.bottomRequestData;s&&(c=o.state.isTopExecuting,u=o.state.isTopExecuted,p=o.topRequestData);var d=!s&&!o.props.secondQueryResponse||s&&!o.props.queryResponse||c||!u,m=e(o.props,"tile.secondDisplayType","table");return o.renderResponse({renderPlaceholder:d,isExecuting:c,isExecuted:u,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(o.QUERY_RESPONSE_KEY),ref:function(e){return o.setState({secondResponseRef:e})},optionsToolbarRef:o.secondOptionsToolbarRef,displayType:m,queryResponse:o.props.secondQueryResponse||o.props.queryResponse,tableConfigs:o.props.tile.secondDataConfig,onTableConfigChange:o.onSecondDataConfigChange,queryValidationSelections:o.props.tile.secondqueryValidationSelections,onSuggestionClick:o.onSecondSuggestionClick,selectedSuggestion:e(o.props.tile,"secondSelectedSuggestion"),reportProblemCallback:o.secondReportProblemCallback,onSupportedDisplayTypesChange:o.onSecondSupportedDisplayTypesChange,onRecommendedDisplayType:function(e){o.onSecondDisplayTypeChange(e)},onNoneOfTheseClick:o.secondOnNoneOfTheseClick,onDrilldownStart:function(e){o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!0,activeKey:e})},onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onSecondQueryValidationSelectOption,queryRequestData:p},vizToolbarProps:{ref:function(e){return o.secondVizToolbarRef=e},key:"viz-toolbar-".concat(o.QUERY_RESPONSE_KEY),displayType:m,onDisplayTypeChange:o.onSecondDisplayTypeChange,supportedDisplayTypes:o.state.secondSupportedDisplayTypes},optionsToolbarProps:{ref:function(e){return o.secondOptionsToolbarRef=e},key:"options-toolbar-".concat(o.QUERY_RESPONSE_KEY),queryResponse:o.props.secondQueryResponse||o.props.queryResponse,responseRef:o.state.secondResponseRef,onFilterClick:function(e){var t=e.isFilteringTable;return o.toggleTableFilter(o.state.secondResponseRef,t)},displayType:m},isSecondHalf:!0})})),lt(mt(o),"renderContent",(function(){return s.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(o.props.isEditing?" editing":"","\n ").concat(o.props.tile.h<4?" small":"")},s.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-response-container"},o.getIsSplitView()?o.renderSplitResponse():o.renderTopResponse()))})),lt(mt(o),"renderDragHandles",(function(){return s.createElement(c,null,s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle top"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle bottom"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle left"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle right"}))})),lt(mt(o),"render",(function(){var e=o.props,t={onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onTouchStart:e.onTouchStart,onTouchEnd:e.onTouchEnd};return s.createElement(yt,null,s.createElement("div",st({className:o.props.className,style:$e({},o.props.style),"data-grid":o.props.tile},t),o.props.children,s.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":"")},s.createElement(c,null,o.renderHeader(),o.renderContent())),o.props.isEditing&&o.renderDragHandles()))})),o.COMPONENT_KEY=d(),o.QUERY_RESPONSE_KEY=d(),o.autoCompleteTimer=void 0,o.debounceTime=50,o.paramsToSet={},o.callbackArray=[];var r=Pn({response:t.queryResponse})||[],i=Pn({response:t.secondQueryResponse})||[];return 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,supportedDisplayTypes:r,secondSupportedDisplayTypes:i},o}return it(a)}();lt(Fr,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,isEditing:p.bool.isRequired,tile:p.shape({}).isRequired,deleteTile:p.func.isRequired,dataPageSize:p.number,queryResponse:p.shape({}),notExecutedText:p.string,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func,enableAjaxTableData:p.bool.isRequired}),lt(Fr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,query:"",title:"",displayType:"table",dataPageSize:void 0,queryValidationSelections:void 0,selectedSuggestion:void 0,notExecutedText:'Hit "Execute" to run this dashboard',autoChartAggregations:!0,onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Qr=s.forwardRef((function(e,t){var n=e.style,a=e.className;e.key;var o=dt(e,Lr);return s.createElement("div",{style:$e({},n),className:a,ref:t},s.createElement(Fr,st({},o,{ref:o.tileRef,className:"".concat(o.innerDivClass," ").concat(o.isEditing?"editing":""),"data-test":"react-autoql-dashboard-tile"})))})),zr=Ke(je),Hr=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},Br=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},_r=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"tileRefs",{}),lt(mt(t),"debounceTime",50),lt(mt(t),"onChangeTiles",null),lt(mt(t),"callbackSubsciptions",[]),lt(mt(t),"DEFAULT_AJAX_PAGE_SIZE",50),lt(mt(t),"state",{isDragging:!1,drilldownDisplayType:"table",isReportProblemOpen:!1}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t.props.executeOnMount&&t.executeDashboard(),t.setStyles(),window.addEventListener("resize",t.onWindowResize)})),lt(mt(t),"componentDidUpdate",(function(n){se(en(t.props.themeConfig),en(n.themeConfig))||t.setStyles(),n.isEditing&&!t.props.isEditing&&t.props.executeOnStopEditing&&t.executeDashboard(),t.getChangeDetection(t.props.tiles,n.tiles)&&e(n,"tiles[".concat(n.tiles.length," - 1].y"))!==Number.MAX_VALUE&&t.setState({justPerformedUndo:!1})})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1,window.removeEventListener("resize",t.onWindowResize),clearTimeout(t.scrollToNewTileTimeout),clearTimeout(t.rebuildTooltipsTimer),clearTimeout(t.stopDraggingTimeout),clearTimeout(t.drillingDownTimeout),clearTimeout(t.animationTimeout)})),lt(mt(t),"getMostRecentTiles",(function(){return t.onChangeTiles?t.onChangeTiles:t.props.tiles})),lt(mt(t),"rebuildTooltips",(function(){clearTimeout(t.rebuildTooltipsTimer),t.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),500)})),lt(mt(t),"subscribeToCallback",(function(e){t.callbackSubsciptions=[].concat(ht(t.callbackSubsciptions),ht(e))})),lt(mt(t),"debouncedOnChange",(function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];n&&(t.previousTileState=ce(t.getMostRecentTiles())),t.onChangeTiles=ce(e);var o=new Promise((function(e,n){try{t.subscribeToCallback([e]),null!=a&&a.length&&t.subscribeToCallback(a),t.onChangeTimer&&clearTimeout(t.onChangeTimer),t.onChangeTimer=setTimeout((function(){if(t.onChangeTiles){var n;if(t.props.onChange(t.onChangeTiles),t.onChangeTiles=null,null!==(n=t.callbackSubsciptions)&&void 0!==n&&n.length){var a=ce(t.callbackSubsciptions);return t.callbackSubsciptions=[],void a.forEach((function(e,n){t.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(n+1))}))}return e()}return e()}),t.debounceTime)}catch(e){return console.error(e),t.callbackSubsciptions=[],n()}}));return o})),lt(mt(t),"setStyles",(function(){_n(t.props.themeConfig)})),lt(mt(t),"onWindowResize",(function(e){t.currentWindowWidth||(t.currentWindowWidth=window.innerWidth);var n=e.target.innerWidth!==t.currentWindowWidth;n&&(t.state.isWindowResizing||(t.currentWindowWidth=window.innerWidth,t.setState({isWindowResizing:!0})),n&&(t.windowResizeTimer=setTimeout((function(){n&&(t.currentWindowWidth=void 0,t.setState({isWindowResizing:!1}))}),300)))})),lt(mt(t),"executeDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].processTile()}catch(e){console.error(e)}})),lt(mt(t),"unExecuteDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),lt(mt(t),"getChangeDetection",(function(e,n,a){return!se(t.getChangeDetectionTileStructure(e,a),t.getChangeDetectionTileStructure(n,a))})),lt(mt(t),"getChangeDetectionTileStructure",(function(e,t){try{return e.map((function(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)}})),lt(mt(t),"scrollToNewTile",(function(){t.scrollToNewTileTimeout=setTimeout((function(){t.ref&&t.ref.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"})}),200)})),lt(mt(t),"onMoveStart",(function(){t.state.isDragging||t.setState({isDragging:!0})})),lt(mt(t),"onMoveEnd",(function(e){try{var n=t.getMostRecentTiles();t.getChangeDetection(n,e,!0)&&(t.previousTileState=n),t.stopDraggingTimeout=setTimeout((function(){t.setState({isDragging:!1})}),100)}catch(e){console.error(e)}})),lt(mt(t),"updateTileLayout",(function(e){try{var n=t.getMostRecentTiles().map((function(t,n){return $e($e({},t),e[n])}));t.debouncedOnChange(n,!1)}catch(e){console.error(e)}})),lt(mt(t),"addTile",(function(){try{var e=ce(t.getMostRecentTiles()),n=d();e.push({key:n,i:n,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),t.debouncedOnChange(e).then((function(){t.scrollToNewTile()})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),lt(mt(t),"undo",(function(){try{t.debouncedOnChange(t.previousTileState,!1),t.setState({justPerformedUndo:!0})}catch(e){console.error(e)}})),lt(mt(t),"deleteTile",(function(e){try{var n=ce(t.getMostRecentTiles()),a=n.map((function(e){return e.i})).indexOf(e);~a&&n.splice(a,1),t.debouncedOnChange(n)}catch(e){console.error(e)}})),lt(mt(t),"setParamsForTile",(function(e,n,a){try{var o=t.getMostRecentTiles(),r=ce(t.getMostRecentTiles()),i=r.map((function(e){return e.i})).indexOf(n);r[i]=$e($e({},r[i]),e),Object.keys(e).includes("query")&&e.query!==o[i].query?(r[i].dataConfig=void 0,r[i].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==o[i].secondQuery&&(r[i].secondDataConfig=void 0,r[i].secondskipQueryValidation=!1),t.debouncedOnChange(r,void 0,a)}catch(e){console.error(e)}})),lt(mt(t),"onDrilldownStart",(function(e){var n=e.tileId,a=e.activeKey,o=e.isSecondHalf;$t(t.props.autoQLConfig).enableDrilldowns&&(t.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:o,activeDrilldownTile:n||t.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:a,isAnimatingModal:!t.state.isDrilldownModalVisible}),t.animationTimeout=setTimeout((function(){t.setState({isAnimatingModal:!1})}),500))})),lt(mt(t),"onDrilldownEnd",(function(e){var n=e.response,a=e.error;n?t._isMounted&&t.setState({activeDrilldownResponse:n,isDrilldownRunning:!1}):a&&(console.error(a),t._isMounted&&t.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),lt(mt(t),"shouldShowOriginalQuery",(function(e){if(!e)return!1;var n=t.state.isDrilldownSecondHalf?e.secondDisplayType:e.displayType;return nn.includes(n)})),lt(mt(t),"reportProblemCallback",(function(){t.setState({isReportProblemOpen:!0})})),lt(mt(t),"renderDrilldownTable",(function(){return s.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},t.state.isDrilldownRunning?s.createElement("div",{className:"dashboard-tile-loading-container"},s.createElement(da,null)):s.createElement(Do,{ref:function(e){return t.drilldownTableRef=e},displayType:t.state.drilldownDisplayType,onRecommendedDisplayType:function(e){t.setState({drilldownDisplayType:e})},authentication:Jt(t.props.authentication),autoQLConfig:$t(t.props.autoQLConfig),themeConfig:t.props.themeConfig,dataFormatting:Zt(t.props.dataFormatting),queryResponse:t.state.activeDrilldownResponse,renderTooltips:!1,onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),reportProblemCallback:t.reportProblemCallback,enableAjaxTableData:t.props.enableAjaxTableData,rebuildTooltips:t.rebuildTooltips}))})),lt(mt(t),"renderChartCollapseBtn",(function(e){return s.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},s.createElement(Wa,{onClick:function(){t.setState({isDrilldownChartHidden:!t.state.isDrilldownChartHidden})},tooltip:t.state.isDrilldownChartHidden?"Show Chart":"Hide Chart"},s.createElement(Kt,{type:"chart"}),s.createElement(Kt,{type:t.state.isDrilldownChartHidden?"expand":"collapse"})))})),lt(mt(t),"renderReportProblemModal",(function(){return s.createElement(xr,{authentication:t.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:function(){t.setState({isReportProblemOpen:!1})},onReportProblem:function(e){var n=e.successMessage,a=e.error;n?(t.props.onSuccessCallback(n),t._isMounted&&t.setState({isReportProblemOpen:!1})):a&&t.props.onErrorCallback(a)},responseRef:t.drilldownTableRef,isVisible:t.state.isReportProblemOpen})})),lt(mt(t),"renderDrilldownModal",(function(){try{var e,n,a,o,r=t.getMostRecentTiles().find((function(e){return e.i===t.state.activeDrilldownTile}));r&&t.state.isDrilldownSecondHalf?(e=r.secondQuery,n=r.secondQueryResponse||r.queryResponse,a=r.secondDisplayType,o=r.secondDataConfig):r&&!t.state.isDrilldownSecondHalf&&(e=r.title||r.query,n=r.queryResponse,a=r.displayType,o=r.dataConfig);var i=t.state.isDrilldownChartHidden||!t.shouldShowOriginalQuery(r);return s.createElement(Ao,{themeConfig:t.props.themeConfig,className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(t.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(t.shouldShowOriginalQuery(r)?"":"top-hidden"),title:e,isVisible:t.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,onClose:function(){t.setState({isDrilldownModalVisible:!1,drilldownDisplayType:"table",activeDrilldownTile:null})}},t.state.isDrilldownModalVisible&&s.createElement(c,null,r&&s.createElement(Ge,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:i?0:35,onDragEnd:function(){t.setState({})}},s.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},t.shouldShowOriginalQuery(r)&&s.createElement(s.Fragment,null,s.createElement(Do,{key:"dashboard-drilldown-chart-".concat(t.state.activeDrilldownTile),authentication:t.props.authentication,autoQLConfig:t.props.autoQLConfig,themeConfig:t.props.themeConfig,dataFormatting:Zt(t.props.dataFormatting),queryResponse:ce(n),displayType:a,tableConfigs:ce(o),onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:function(e){return t.onDrilldownStart({tileId:r.i,activeKey:e,isSecondHalf:t.state.isDrilldownSecondHalf})},onDrilldownEnd:t.onDrilldownEnd,activeChartElementKey:t.state.activeDrilldownChartElementKey,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),enableAjaxTableData:t.props.enableAjaxTableData,reportProblemCallback:t.reportProblemCallback}),t.renderChartCollapseBtn("bottom"))),t.renderDrilldownTable()),t.shouldShowOriginalQuery(r)&&t.state.isDrilldownChartHidden&&t.renderChartCollapseBtn("top")))}catch(e){console.error(e),t.props.onErrorCallback(e)}})),lt(mt(t),"renderEmptyDashboardMessage",(function(){return t.props.isEditable&&!t.props.isEditing?s.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",s.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.props.startEditingCallback()}},"New Dashboard")):t.props.isEditing?s.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",s.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.addTile()}},"New Tile")," ","to get started"):s.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),lt(mt(t),"renderTiles",(function(){var e=t.getMostRecentTiles().map((function(e){return $e($e({},e),{},{i:e.key,maxH:12,minH:2,minW:3})})),n=t.props.dataPageSize;return t.props.enableAjaxTableData&&!n&&(n=t.DEFAULT_AJAX_PAGE_SIZE),s.createElement(zr,{onLayoutChange:function(e){t.updateTileLayout(e),t.setState({layout:e})},onDrag:t.onMoveStart,onResizeStart:t.onMoveStart,onDragStop:t.onMoveEnd,onResizeStop:t.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:t.props.isEditing,isResizable:t.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return s.createElement(Qr,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(n){return t.tileRefs[e.key]=n},key:e.key,authentication:Jt(t.props.authentication),autoQLConfig:$t(t.props.autoQLConfig),themeConfig:t.props.themeConfig,tile:$e($e({},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:t.props.isEditing,isDragging:t.state.isDragging||t.state.isWindowResizing,isWindowResizing:t.state.isWindowResizing,setParamsForTile:t.setParamsForTile,deleteTile:t.deleteTile,dataFormatting:Zt(t.props.dataFormatting),notExecutedText:t.props.notExecutedText,enableDynamicCharting:t.props.enableDynamicCharting,onErrorCallback:t.props.onErrorCallback,onSuccessCallback:t.props.onSuccessCallback,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:t.onDrilldownStart,onDrilldownEnd:t.onDrilldownEnd,onCSVDownloadStart:t.props.onCSVDownloadStart,onCSVDownloadProgress:t.props.onCSVDownloadProgress,onCSVDownloadFinish:t.props.onCSVDownloadFinish,enableAjaxTableData:t.props.enableAjaxTableData,rebuildTooltips:t.rebuildTooltips,dataPageSize:n})})))})),lt(mt(t),"render",(function(){var e=t.getMostRecentTiles();return s.createElement(yt,null,s.createElement(c,null,s.createElement("div",{ref:function(e){return t.ref=e},className:"react-autoql-dashboard-container".concat(t.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?t.renderTiles():t.renderEmptyDashboardMessage()),!t.state.isDragging&&t.renderDrilldownModal(),t.renderReportProblemModal(),s.createElement(le,{className:"react-autoql-dashboard-tooltip",id:"react-autoql-dashboard-toolbar-btn-tooltip",effect:"solid",delayShow:500,html:!0}),s.createElement(le,{place:"left",className:"react-autoql-chart-tooltip",id:"dashboard-data-limit-warning-tooltip",effect:"solid",html:!0})))})),t}return it(a)}();lt(_r,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,tiles:p.arrayOf(p.shape({})),executeOnMount:p.bool,dataPageSize:p.number,executeOnStopEditing:p.bool,isEditing:p.bool,isEditable:p.bool,notExecutedText:p.string,onChange:p.func,enableDynamicCharting:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func,enableAjaxTableData:p.bool}),lt(_r,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,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 Ur=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),lt(mt(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)})),lt(mt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=Xe(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:Je,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),lt(mt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),lt(mt(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)}}))})),lt(mt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),lt(mt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),lt(mt(e),"onMouseDown",(function(){le.hide(),e.startRecording()})),lt(mt(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};l.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})}))}))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(me,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return s.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},s.createElement(Kt,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},s.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},s.createElement(Kt,{type:"microphone"}))),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return it(n)}();lt(Ur,"propTypes",{authentication:bt,themeConfig:St,transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,onTranscriptChange:p.func,onFinalTranscript:p.func}),lt(Ur,"defaultProps",{authentication:Gt,themeConfig:Xt});export{_r as Dashboard,Qr as DashboardTile,pr as DataAlertModal,vr as DataAlerts,Pr as DataMessenger,Vr as ExploreQueries,Sr as ExpressionBuilder,er as ExpressionBuilderSimple,Ir as FilterLockPopover,Kt as Icon,da as LoadingDots,gr as NotificationFeed,Yo as NotificationIcon,tr as NotificationItem,wr as OptionsToolbar,ma as QueryInput,Do as QueryOutput,xr as ReportProblemModal,To as ReverseTranslation,ur as ScheduleBuilder,Ur as SpeechToTextButton,pa as SpeechToTextButtonBrowser,ko as VizToolbar,Hr as executeDashboard,sa as fetchExploreQueries,Fn as getDefaultDisplayType,Pn as getSupportedDisplayTypes,Ln as isDisplayTypeValid,Br as unExecuteDashboard};
3
+ et=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",r=a.asyncIterator||"@@asyncIterator",i=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function s(e,t,n,a){var o=t&&t.prototype instanceof p?t:p,r=Object.create(o.prototype),i=new T(a||[]);return r._invoke=function(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 x()}for(n.method=o,n.arg=r;;){var i=n.delegate;if(i){var l=C(i,n);if(l){if(l===u)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=c(e,t,n);if("normal"===s.type){if(a=n.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a="completed",n.method="throw",n.arg=s.arg)}}}(e,n,i),r}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function p(){}function d(){}function m(){}var f={};l(f,o,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(D([])));h&&h!==t&&n.call(h,o)&&(f=h);var v=m.prototype=p.prototype=Object.create(f);function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var a;this._invoke=function(o,r){function i(){return new t((function(a,i){!function a(o,r,i,l){var s=c(e[o],e,r);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){a("next",e,i,l)}),(function(e){a("throw",e,i,l)})):t.resolve(p).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,l)}))}l(s.arg)}(o,r,a,i)}))}return a=a?a.then(i,i):i()}}function C(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var a=c(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,u;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function E(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 S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function D(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,r=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 r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return d.prototype=m,l(v,"constructor",m),l(m,"constructor",d),d.displayName=l(m,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,r,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,a,o,r){void 0===r&&(r=Promise);var i=new b(s(t,n,a,o),r);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(v),l(v,i,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},e.values=D,T.prototype={constructor:T,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(S),!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,u):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),u},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),S(n),u}},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;S(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:D(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function tt(e){return(tt="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,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 at(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var r=e.apply(t,n);function i(e){nt(r,a,o,i,l,"next",e)}function l(e){nt(r,a,o,i,l,"throw",e)}i(void 0)}))}}function ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(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,a.key,a)}}function it(e,t,n){return t&&rt(e.prototype,t),n&&rt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(){return(st=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 ct(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&&pt(e,t)}function ut(e){return(ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pt(e,t){return(pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function dt(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 mt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ft(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 mt(e)}function gt(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=ut(e);if(t){var o=ut(this).constructor;n=Reflect.construct(a,arguments,o)}else n=a.apply(this,arguments);return ft(this,n)}}function ht(e){return function(e){if(Array.isArray(e))return vt(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 vt(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 vt(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 vt(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}var yt=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{hasError:!1}),lt(mt(e),"componentDidCatch",(function(t,n){e.setState({hasError:!0}),console.error(t),console.error(n)})),lt(mt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),lt(mt(e),"render",(function(){return e.state.hasError?s.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return it(n)}();lt(yt,"propTypes",{message:p.string}),lt(yt,"defaultProps",{message:null});var bt=p.shape({token:p.string,apiKey:p.string,domain:p.string}),Ct=p.shape({currencyCode:p.string,languageCode:p.string,currencyDecimals:p.number,quantityDecimals:p.number,comparisonDisplay:p.string,monthYearFormat:p.string,dayMonthYearFormat:p.string}),Et=p.shape({debug:p.bool,test:p.bool,enableAutocomplete:p.bool,enableQueryValidation:p.bool,enableDrilldowns:p.bool,enableQuerySuggestions:p.bool,enableColumnVisibilityManager:p.bool,enableNotifications:p.bool}),St=p.shape({theme:p.oneOf(["light","dark"]),chartColors:p.arrayOf(p.string),accentColor:p.string,fontFamily:p.string,dashboardBackground:p.string});p.shape({stringColumnIndices:p.arrayOf(p.number),numberColumnIndices:p.arrayOf(p.number),stringColumnIndex:p.number,legendColumnIndex:p.number,numberColumnIndex:p.number});var Tt={GENERAL_QUERY:s.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:s.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:s.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.")},Dt="Request cancelled",xt=new ze({en:{introPrompt:"Some things you can ask me: ",use:"Use",exploreQueries:"Explore Queries",explorePrompt:"to further explore the possibilities.",run:"We run on AutoQL by Chata",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"},sp:{introPrompt:"Cosas que puedes preguntarme:",use:"Utiliza",exploreQueries:"Explorar Consultas",explorePrompt:"para ampliar las posibilidades.",run:"Corremos en AutoQL de Chata",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"}}),kt=s.createElement("svg",{x:"0px",y:"0px",width:"23px",height:"23px",viewBox:"0 0 23 23",style:{strokeWidth:"1.4px",marginBottom:"2px",marginLeft:"1px"}},s.createElement("g",null,s.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"}),s.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"}),s.createElement("path",{className:"react-autoql-icon-outlined",d:"M5.134,11.903"}),s.createElement("ellipse",{className:"react-autoql-icon-outlined",cx:"11.425",cy:"9.005",rx:"0.91",ry:"0.611"}),s.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"}))),wt=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.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"}),s.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"})),At=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.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"}))))),Nt=s.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},s.createElement("g",null,s.createElement("g",null,s.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"})),s.createElement("g",null,s.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"})))),Rt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),Mt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),Vt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),qt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"})),It=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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 "})),Pt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"}),s.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"})),Lt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),s.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"}),s.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),s.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"}),s.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),s.createElement("g",null,s.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),s.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"}),s.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),Ot=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),s.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"}),s.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),s.createElement("g",null,s.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),s.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"}),s.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),s.createElement("g",null,s.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),s.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"}),s.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Ft=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",{className:"st2"},s.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"})),s.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"}),s.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"})),Qt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),s.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),s.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),s.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),s.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),s.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),s.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),s.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),s.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),s.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),s.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),s.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),s.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),s.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),s.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),s.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),zt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),s.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Ht=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.createElement("g",null,s.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),s.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"}),s.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"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),s.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Bt=s.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},s.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"}),s.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),_t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO8AAADvCAMAAAAtrnOLAAACE1BMVEUAAAAutn0utn7gHlrssy42xfA1xfHfHlrssy4fzq0yvZM2xfDhIFPzsi7/Uk4utn3gHlrssi4utn3gHlrssi4utn3gHlrssi4utn0utn03yPIwxv82xfAttnzssi3tsi0stHzfIFjqsiwttn01xfHgHVngHVo0w+/eIFwstX7usyw1xfLwtC3gHlrssi02xfA1xfDgHlo2xfDhHlrgHlkttn3ssi02xO82xfAutn3ssi7hHlrssi42xvDgHlout33hHVnjGlg2xvDgHlrssi4ttn3ssi7hHls2xfHgH1rgHVrssi3gH1riHVrusS8vuH8stn8ytXwutn02xfDgHlrssi42xe/ssi42xfDssy42xvDhHVoutn0utnwut3w1xe/gHVrssi4utn4ttn0ut3w2xe82xfAttn3gHVrtsi01xfEtt37ssy3hHVstuHwut30ttnw1xvI2xfDgHloutn3ssy01xfA3xPA2xPDssy42xfE3yO00uX7tsjQutn3gHloutn42xfDssy7ssi7gHlrssi7hHlrtsi7ssy42xfA2xfHssi42xvDtsi02xfHgH1nrsy01xu/cI1k2xfAttn7tsi01xu/fHlrrsi01x/Dusy3stC3qsSvstC3jHFopunw2xPA1xfHssi4vt37hHlvgHVntsi43w/DrtC0ttX3gHlrhHlrqFVU2xfDgHlrssi4utn1qLWRTAAAArXRSTlMA8JDw8PCQkJABBfcFBQL4+Pja2tj29vbUcRgGo3t6cBcXF+Z7e3AeHh0dExPm5tnR0bS0dGxsK/TOzaKib1pWJBPV1dK0iIdsbEFBOS0rKiMU/u3t7ebg3NzLx6ymoZOTk4yFdnJiYmJiW1tbVUg/NiXg4N+2q4d1dDkNDQ3szcjGxrKsrKamjYtXV1RUSkpKPw6YmJiAgIBDOicjIRoS5+XJxZiLODMzLd+XDNu6FUIAAAoKSURBVHja7NzNaxpBGMfxn0KF3T0IC4KvICiIeFAEUQ9BEALezAuEEPICeYUE8kZIQhJKckwogdBS6KktPZQeHpg/sfTm6rrOjLvTaXc/94X9sgw7CzsPIpFIJBIa5t1t/mn92+plo/n8oQYhy73dze5VrGT/2N4/N6E/40u+Q6M2BjXu2Nbj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",Ut="data:image/png;base64,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",jt=["type","size","showBadge","warning","danger"],Kt=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(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=dt(t,jt),a=null;switch(e.props.type){case"back":a=s.createElement(N,null);break;case"bar-chart":a=qt;break;case"stacked-bar-chart":a=Lt;break;case"bubble-chart":a=zt;break;case"calendar":a=s.createElement(V,null);break;case"caret-right":a=s.createElement(g,null);break;case"caret-left":a=s.createElement(f,null);break;case"caret-down":a=s.createElement(m,null);break;case"caret-up":a=s.createElement(h,null);break;case"react-autoql-bubbles-outlined":a=wt;break;case"react-autoql-bubbles-filled":a=Nt;break;case"react-autoql-bubbles-filled-alt":a=At;break;case"chart":a=s.createElement(D,null);break;case"check":a=s.createElement(q,null);break;case"close":a=s.createElement($,null);break;case"maximize":a=s.createElement(j,null);break;case"minimize":a=s.createElement(K,null);break;case"close-circle":a=s.createElement(Y,null);break;case"collapse":a=s.createElement(k,null);break;case"column-chart":a=Vt;break;case"stacked-column-chart":a=Ot;break;case"copy":a=s.createElement(ee,null);break;case"dashboard":a=s.createElement(b,null);break;case"database":a=s.createElement(I,null);break;case"description":a=s.createElement(E,null);break;case"download":a=s.createElement(P,null);break;case"edit":a=s.createElement(C,null);break;case"expand":a=s.createElement(x,null);break;case"eye":a=s.createElement(L,null);break;case"filter":a=s.createElement(O,null);break;case"grad-cap":a=kt;break;case"globe":a=s.createElement(X,null);break;case"heatmap":a=Qt;break;case"hour-glass":a=s.createElement(J,null);break;case"info":a=s.createElement(ne,null);break;case"light-bulb":a=s.createElement(y,null);break;case"line-chart":a=It;break;case"lock":a=s.createElement(ae,null);break;case"stacked-line-chart":a=Ft;break;case"teams":a=s.createElement("img",{className:"slack-logo",src:Ut,alt:"Slack",style:$e($e({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"menu":a=s.createElement(S,null);break;case"microphone":a=s.createElement(w,null);break;case"more-vertical":a=s.createElement(Q,null);break;case"more-horizontal":a=s.createElement(F,null);break;case"notification":a=s.createElement(R,null);break;case"notification-off":a=s.createElement(M,null);break;case"notification-pause":a=s.createElement(z,null);break;case"numbers":a=s.createElement(ie,null);break;case"pie-chart":a=Pt;break;case"play":a=s.createElement(re,null);break;case"pivot-table":a=Mt;break;case"plus":a=s.createElement(H,null);break;case"question":a=s.createElement(T,null);break;case"refresh":a=s.createElement(G,null);break;case"report":a=s.createElement(W,null);break;case"search":a=s.createElement(Z,null);break;case"send":a=s.createElement(B,null);break;case"settings":a=s.createElement(_,null);break;case"slack":a=s.createElement("img",{className:"slack-logo",src:_t,alt:"Slack",style:$e($e({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"split-view":a=Ht;break;case"single-view":a=Bt;break;case"table":a=Rt;break;case"title":a=s.createElement(v,null);break;case"trash":a=s.createElement(U,null);break;case"unlock":a=s.createElement(oe,null);break;case"warning":a=s.createElement(te,null);break;case"warning-triangle":a=s.createElement(A,null)}return s.createElement(yt,null,s.createElement("span",st({},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:$e({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),a,e.props.showBadge&&s.createElement("div",{className:"react-autoql-badge"})))})),e}return it(n)}();lt(Kt,"propTypes",{type:p.string.isRequired,size:p.number,showBadge:p.bool,color:p.string,warning:p.bool,danger:p.bool}),lt(Kt,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var Gt={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},Wt={currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMM YYYY",dayMonthYearFormat:"ll"},Yt={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableSlackSharing:!0,enableTeamsSharing:!0,enableCSVDownload:!1,enableReportProblem:!0},Xt={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",titleColor:"#356f90",dashboardBackground:"#fafafa"},Jt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Gt),e)},Zt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Wt),e)},$t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Yt),e)},en=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $e($e({},Xt),e)};n.extend(r),n.extend(i),n.extend(a),n.extend(o),function(){var e=window.navigator.language||"en",t=e.split("-")[0];try{require("dayjs/locale/".concat(e,".js")),n.locale(e)}catch(e){try{require("dayjs/locale/".concat(t,".js")),n.locale(t)}catch(e){}}}();var tn=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],nn=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line"],an=["January","February","March","April","May","June","July","August","September","October","November","December"],on=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],rn={"accent-color":"#28a8e0","background-color-primary":"#fff","background-color-secondary":"#F1F3F5","background-color-tertiary":"#cccccc","border-color":"#e6e6e6","hover-color":"#ececec","text-color-primary":"#5d5d5d","accent-text-color":"#ffffff","text-color-placeholder":"#00000036","font-family":"sans-serif","highlight-color":"#000","danger-color":"#ca0b00","warning-color":"#ffcc00","success-color":"#2aca4d"},ln={"accent-color":"#193a48","background-color-primary":"#3B3F46","background-color-secondary":"#20252A","background-color-tertiary":"#292929","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#fff","accent-text-color":"#ffffff","text-color-placeholder":"#ffffff9c","font-family":"sans-serif","highlight-color":"#FFF","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#2aca4d"},sn=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},cn=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},un=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t},pn=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},dn=function(e){var t=[],n=[],a=[];return e.forEach((function(e,o){var r=e.type;e.is_visible&&!e.pivot&&("DOLLAR_AMT"===r?t.push(o):"QUANTITY"===r?n.push(o):"PERCENT"!==r&&"RATIO"!==r||a.push(o))})),t.length?{numberColumnIndices:t,numberColumnIndex:t[0]}:n.length?{numberColumnIndices:n,numberColumnIndex:n[0]}:a.length?{numberColumnIndices:a,numberColumnIndex:a[0]}:{numberColumnIndices:[],numberColumnIndex:void 0}},mn=function(e){if(e&&function(e){return!sn(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}))},fn=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},gn=function(t,n){if(t){var a=mn(t),o=fn(t),r=[];t.forEach((function(e,t){(un(e)||e.groupable)&&t!==a&&e.is_visible&&r.push(t)}));var i=r[0];if(n)i=e(t[o],"groupable")?o:t.findIndex((function(e){return e.groupable}));else o>=0?i=o:r[1]>=0&&(i=r[1]);return{stringColumnIndex:i,stringColumnIndices:r}}},hn=function(e){var t=0,n=0;return e.forEach((function(e){cn(e)&&e.is_visible?n+=1:un(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},vn=function(e,t,n){return n.indexOf(e)===t},yn=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},bn=function(e){return"Invalid Date"!==e},Cn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e)try{var o=a.monthYearFormat,r=a.dayMonthYearFormat,i="YYYY",l=o||"MMM YYYY",s=r||"ll",c=t.title,u=n.unix(e).utc().format(s);return Number.isNaN(Number(e))?(c&&c.toLowerCase().includes("year")?u=n(e).format(i):c&&c.toLowerCase().includes("month")&&(u=n(e).format(l)),u=n(e).format(s)):c&&c.toLowerCase().includes("year")?u=n.unix(e).utc().format(i):c&&c.toLowerCase().includes("month")&&(u=n.unix(e).utc().format(l)),bn(u)?u:e}catch(t){return console.error(t),e}},En=function(t,a){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=a.monthYearFormat||"MMM YYYY",u=a.dayMonthYearFormat||"ll";if(s){var p=n(t).format(u);if(bn(p))return p}else if(o){var d=n(t).format(c);if(bn(d))return d}else{if(r)return t;if(l)return l}}return t}},Sn=function(e){var t=e.d,n=e.col,a=void 0===n?{}:n,o=e.config,r=void 0===o?{}:o;if(null==t)return{fullWidthLabel:"Untitled Category",formattedLabel:"Untitled Category",isTruncated:!1};if(!a||!a.type)return{fullWidthLabel:t,formattedLabel:t,isTruncated:!1};var i=r.currencyCode,l=r.languageCode,s=t;switch(a.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var c=i||"USD";try{s=new Intl.NumberFormat(l,{style:"currency",currency:"".concat(c),minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}catch(e){console.error(e),s=new Intl.NumberFormat(l,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}}break;case"QUANTITY":Number(t)&&(s=new Intl.NumberFormat(l).format(t));break;case"DATE":s=Cn(t,a,r);break;case"DATE_STRING":s=En(t,r);break;case"PERCENT":if(Number(t)){var u=Number(t)/100;s=new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:0}).format(u)}}var p=s,d=!1;return"string"==typeof s&&s.length>20&&(s="".concat(s.substring(0,20),"..."),d=!0),{fullWidthLabel:p,formattedLabel:s,isTruncated:d}},Tn=function(e){var t=e.element,n=e.column,a=e.config,o=void 0===a?{}:a,r=e.htmlElement;try{var i=t,l=o.currencyCode,s=o.languageCode,c=o.currencyDecimals,u=o.quantityDecimals;if(n)switch(n.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var p=l||"USD",d=c||0===c?c:void 0;try{i=new Intl.NumberFormat(s,{style:"currency",currency:"".concat(p),minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}catch(e){console.error(e),i=new Intl.NumberFormat(s,{style:"currency",currency:"USD",minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}}break;case"QUANTITY":var m=u||0===u?u:1;if(Number(t)){var f=Number(t)%1!=0?m:0;i=new Intl.NumberFormat(s,{minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}break;case"DATE":i=Cn(t,n,o);break;case"DATE_STRING":i=En(t,o);break;case"RATIO":Number(t)&&(i=new Intl.NumberFormat(s,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(Number(t)){var g=Number(t)/100;i=new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(g),r&&r.classList.add("comparison-value-".concat(t<0?"negative":"positive"))}}return i}catch(e){return console.error(e),t}},Dn=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}},xn=function(e){var t;try{e&&(t=e.getBBox())}catch(e){console.error(e)}return t},kn=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=Dn(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"),p=new Image;p.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))},p.onerror=function(e){o("failed to load image with that url"+url)},p.src=r}catch(e){console.error(e),o("failed to convert svg to png "+e)}}))},wn=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},An=function(e){return nn.includes(e)},Nn=function(e){return tn.includes(e)},Rn=function(e){return 2===wn(e)&&3===e.length},Mn=function(e){var t=hn(e),n=t.amountOfNumberColumns,a=t.amountOfStringColumns;return n>0&&a>0},Vn=function(n){return t(e(n,"data.data.columns"),(function(e){return e.is_visible}))},qn=function(n){var a=e(n,"data.data.columns.length"),o=function(n){return t(e(n,"data.data.columns"),(function(e){return!e.is_visible}))}(n);return a&&!!o.length},In=function(t){var n=e(t,"data.data.columns.length"),a=Vn(t);return n&&!a.length},Pn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,a=t.dataLength,o=t.pivotDataLength;try{if(!e(n,"data.data.display_type"))return[];var r=n.data.data.display_type;if("suggestion"===r||"help"===r||"html"===r)return[r];var i=e(n,"data.data.rows",[]),l=Vn(n);if(!e(l,"length")||!e(i,"length"))return["text"];if(jn(n))return["single-value"];var s=1e3,c=10,u=a||i.length,p=0===a,d=0===o;if(Rn(l)&&!p){var m=["table"];return u<=s&&m.push("pivot_table"),u<=s&&!d?m.push("stacked_column","stacked_bar","stacked_line","column","bar","line","bubble","heatmap"):u>s&&console.warn("Supported Display Types: Rows exceeded 1000, only allowing regular table display type"),m}if(Mn(l)&&!p){var f,g=["table","column","bar","line"];u>1&&u<=c&&g.push("pie");var h=l.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),v=l[h];if(v&&null!=v&&null!==(f=v.display_name)&&void 0!==f&&f.toLowerCase().includes("month")&&2===(null==l?void 0:l.length)){var y=e(n,"data.data.rows"),b=[];y.forEach((function(e){var t=Tn({element:e[h],column:v,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});b.includes(t)||b.push(t)})),b.length>1&&g.push("pivot_table")}return g}return["table"]}catch(e){return console.error(e),["table"]}},Ln=function(e,t,n,a){var o=Pn({response:e,dataLength:n,pivotDataLength:a});return t&&o.includes(t)},On=function(e,t){var n=e.find((function(e){return An(e)}));return n||t},Fn=function(t,n){var a=Pn({response:t}),o=e(t,"data.data.display_type");if("suggestion"===o||"help"===o||"html"===o)return o;if(1===a.length)return a[0];if(a.includes("pivot_table")){var r="pivot_table";return n&&(r=sn(e(t,"data.data.columns"))?On(a,"pivot_table"):"pivot_table"),r}if(!o&&Kn(t)||"data"===o){var i="table";return n&&(i=sn(e(t,"data.data.columns"))?On(a,"table"):"table"),i}return"text"},Qn=function(e){try{var t=document.createElement("DIV");t.innerHTML=e,t.style.display="inline-block",t.style.position="absolute",t.style.visibility="hidden",t.style.fontSize="11px",document.body.appendChild(t);var n=t.clientWidth;return document.body.removeChild(t),n}catch(e){return console.error(e),0}},zn=function(e,t,n){if(null==e||!e.length||!t)return 0;var a=Qn(Sn({d:e[0],col:t,config:n}));return e.forEach((function(e){var o=Sn({d:e,col:t,config:n}).formattedLabel,r=Qn(o);r>a&&(a=r)})),a},Hn=function(e,t){if(!isNaN(e)&&!isNaN(t)){var n=e-t;return Math.abs(n)<5||e<t}},Bn=function(e,t){try{return e.bandwidth()+t*e.bandwidth()*2}catch(e){return console.error(e),0}},_n=function(e){var t=en(e),n=t.theme,a=t.accentColor,o=t.fontFamily,r=t.accentTextColor,i="light"===n?rn:ln;if(a&&(i["accent-color"]=a),o&&(i["font-family"]=o),r)i["accent-text-color"]=r;else{var l=a;"#"===l.slice(0,1)&&(l=l.slice(1)),3===l.length&&(l=l.split("").map((function(e){return e+e})).join(""));var s=(299*parseInt(l.substr(0,2),16)+587*parseInt(l.substr(2,2),16)+114*parseInt(l.substr(4,2),16))/1e3;i["accent-text-color"]=s>=140?"black":"white"}for(var c in i)document.documentElement.style.setProperty("--react-autoql-".concat(c),i[c])},Un=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},jn=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},Kn=function(t){if(!t)return!1;var n=e(t,"data.data.rows.length")&&e(t,"data.data.rows.length");return n},Gn=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)}},Wn=function(e){try{return e.join(".")}catch(e){return}},Yn=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,value_label:e.value_label||"ORIGINAL_TEXT",canonical:e.canonical||"ORIGINAL_TEXT"})})),t}},Xn=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},Jn=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;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)}};return l.get(s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},Zn=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,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={headers:{Authorization:"Bearer ".concat(r)}};return l.post(s,{},c).then((function(t){if(t.data&&"string"==typeof t.data)throw new Error("Parse error");return Promise.resolve($e($e({},e(t,"data.data",{})),{},{page:i}))})).catch((function(t){return"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"})}))},$n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.userSelection,o=t.debug,r=t.test,i=t.domain,s=t.apiKey,c=t.token,u=t.source,p=t.filters,d=t.orders,m=t.tableFilters,f=t.pageSize,g=t.cancelToken,h="".concat(i,"/autoql/api/v1/query?key=").concat(s),v=Yn(a),y={text:n,source:Wn(u),translation:o?"include":"exclude",user_selection:v,test:r,session_filter_locks:p,orders:d,filters:m,page_size:f};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!s||!i||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var b={headers:{Authorization:"Bearer ".concat(c)},cancelToken:g};return l.post(h,y,b).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)===Dt)return Promise.reject({data:{message:Dt}});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 l=null==t||null===(o=t.response)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.reference_id;if("1.1.430"===l||"1.1.431"===l||Xn(l)){var u,p,d,m=null==t||null===(u=t.response)||void 0===u||null===(p=u.data)||void 0===p||null===(d=p.data)||void 0===d?void 0:d.query_id;return Jn({query:n,queryId:m,domain:i,apiKey:s,token:c})}return Promise.reject(e(t,"response"))}))},ea=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?$n(t):na({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):$n(t)})).catch((function(e){return console.error(e),Promise.reject(e)}))},ta=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 s="".concat(a,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(o),c={headers:{Authorization:"Bearer ".concat(r)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return l.post(s,{},c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},na=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),s={headers:{Authorization:"Bearer ".concat(r)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},aa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryID,a=t.groupBys,o=t.debug,r=t.test,i=t.domain,s=t.apiKey,c=t.token;if(!n)return Promise.reject(new Error("Query ID not supplied"));if(!c||!i||!s)return Promise.reject(new Error("Unauthenticated"));var u={translation:o?"include":"exclude",columns:a,test:r},p={headers:{Authorization:"Bearer ".concat(c)}},d="".concat(i,"/autoql/api/v1/query/").concat(n,"/drilldown?key=").concat(s);return l.post(d,u,p).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.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),s={headers:{Authorization:"Bearer ".concat(r)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ra=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,o=t.token,r=t.apiKey;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!a||!r||!o)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(o)}};return l.get(i,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ia=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),s={headers:{Authorization:"Bearer ".concat(a)}},c={columns:r};return l.put(i,c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},la=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),s={columns:r};if(!a||!o||!n)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(a)}};return l.put(i,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},sa=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,s=t.token,c=t.skipQueryValidation,u=n?n.split(" "):[],p="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(u),"&page_size=").concat(a,"&page=").concat(o);if(!s||!r||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(s)}};return c?l.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):na({text:n,domain:r,apiKey:i,token:s}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):l.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return l.get(p,d).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.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 s="".concat(o,"/autoql/api/v1/query/").concat(a,"?key=").concat(r),c={headers:{Authorization:"Bearer ".concat(i)}},u={is_correct:!1,message:n};return l.put(s,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ua=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(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)})),lt(mt(e),"onMouseDown",(function(){le.hide(),e.props.startListening()})),lt(mt(e),"render",(function(){var t=e.props;t.transcript,t.interimTranscript,t.resetTranscript;var n=t.browserSupportsSpeechRecognition;t.startListening;var a=t.stopListening,o=t.listening;return n?s.createElement(yt,null,s.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(o?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},s.createElement(Kt,{type:"microphone"})),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return it(n)}();lt(ua,"propTypes",{transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,browserSupportsSpeechRecognition:p.bool,startListening:p.func,stopListening:p.func,listening:p.bool,onTranscriptChange:p.func,onFinalTranscript:p.func}),lt(ua,"defaultProps",{});var pa=Oe({autoStart:!1,continuous:!1})(ua);function da(){return s.createElement("div",{className:"response-loading","data-test":"loading-dots"},s.createElement("div",null),s.createElement("div",null),s.createElement("div",null),s.createElement("div",null))}var ma=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.focus()})),lt(mt(o),"componentDidUpdate",(function(e){se(en(o.props.themeConfig),en(e.themeConfig))||_n(o.props.themeConfig),o.props.inputValue!==e.inputValue&&o.setState({inputValue:o.props.inputValue})})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.queryValidationTimer&&clearTimeout(o.queryValidationTimer)})),lt(mt(o),"animateInputTextAndSubmit",(function(t){var n=t.query,a=t.userSelection,r=t.source;if((null==n?void 0:n.length)>0){var i=Math.round(1e3/n.length);if("string"==typeof n&&e(n,"length"))for(var l=function(e){setTimeout((function(){o._isMounted&&o.setState({inputValue:n.slice(0,e)}),e===n.length&&setTimeout((function(){o.submitQuery({queryText:n,userSelection:a,skipQueryValidation:!0,source:r})}),300)}),e*i)},s=1;s<=n.length;s++)l(s)}})),lt(mt(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),s={query:n};r||console.warn("No session ID was supplied to DPR. Using a randomly generated UUID instead");var c={headers:(t={},lt(t,"AutoAE-Referer-URL",window.location.origin),lt(t,"AutoAE-Session-ID",r||d()),t)};return l.post(i,s,c)})({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(e){console.error(e),o.onResponse(e)}))})),lt(mt(o),"onResponse",(function(e,t,n){var a;o.props.onResponseCallback(e,t,n);var r={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(a=o.state)||void 0===a?void 0:a.lastQuery)};o._isMounted&&o.setState(r)})),lt(mt(o),"cancelQuery",(function(){o.axiosSource.cancel(Dt)})),lt(mt(o),"submitQuery",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.queryText,n=e.userSelection,a=e.skipQueryValidation,r=e.source,i=t||o.state.inputValue;if(i){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer);var s={isQueryRunning:!0,suggestions:[],queryValidationResponse:void 0,queryValidationComponentId:d()};o.props.clearQueryOnSubmit&&(s.inputValue=""),o._isMounted&&o.setState(s);var c=o.props.source;null!=r&&r.length?c=[].concat(ht(o.props.source),ht(r)):r&&c.push("user"),o.axiosSource=l.CancelToken.source();var u,p,m=$e($e($e({query:i,userSelection:n},Jt(o.props.authentication)),$t(o.props.autoQLConfig)),{},{source:c,AutoAEId:o.props.AutoAEId,filters:o.props.queryFilters,pageSize:o.props.dataPageSize,cancelToken:o.axiosSource.token});if(i.trim())o.props.onSubmit(i),localStorage.setItem("inputValue",i),null!==(u=o.props.authentication)&&void 0!==u&&u.token||null===(p=o.props.authentication)||void 0===p||!p.dprKey?a?$n(m).then((function(e){return o.onResponse(e,i,m)})).catch((function(e){return console.error(e)})):ea(m).then((function(e){return o.onResponse(e,i,m)})).catch((function(e){var t=e||{error:"Unauthenticated"};o.onResponse(t)})):o.submitDprQuery(i)}})),lt(mt(o),"onKeyDown",(function(t){if("ArrowUp"===t.key&&!e(o.state.suggestions,"length")){var n=localStorage.getItem("inputValue");n&&o.setState({inputValue:n})}})),lt(mt(o),"onKeyPress",(function(e){"Enter"==e.key&&o.submitQuery()})),lt(mt(o),"onTranscriptChange",(function(e){o.setState({inputValue:e})})),lt(mt(o),"onFinalTranscript",(function(){o.focus()})),lt(mt(o),"setInputRef",(function(e){o.inputRef=e})),lt(mt(o),"focus",(function(){if(o.inputRef)o.inputRef.focus();else{var e=document.getElementsByClassName("".concat(o.UNIQUE_ID));e&&e[0]&&e[0].focus()}})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&o._isMounted&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"runValidation",(function(t){var n=t.text;o.setState({queryValidationResponse:void 0,queryValidationComponentId:d()}),o.queryValidationTimer&&clearTimeout(o.queryValidationTimer),o.queryValidationTimer=setTimeout((function(){na($e({text:n},Jt(o.props.authentication))).then((function(t){o.state.inputValue===e(t,"data.data.query")&&o.setState({queryValidationResponse:t,queryValidationComponentId:d()})})).catch((function(e){console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e({suggestion:n},Jt(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)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"onInputChange",(function(e){(!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:""}))})),lt(mt(o),"moveCaretAtEnd",(function(e){var t=e.target.value;e.target.value="",e.target.value=t})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-bar-container ".concat(o.props.className," ").concat("below"===o.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},s.createElement("div",{className:"react-autoql-chatbar-input-container"},$t(o.props.autoQLConfig).enableAutocomplete?s.createElement(Le,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return s.createElement(c,null,e.name)},inputProps:{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,autoFocus:!0}}):s.createElement("input",{className:"react-autoql-chatbar-input".concat(o.props.showChataIcon?" left-padding":""),placeholder:o.props.placeholder||"Type your queries here",value:o.state.inputValue,onChange:function(e){o.setState({inputValue:e.target.value})},"data-test":"chat-bar-input",onKeyPress:o.onKeyPress,onKeyDown:o.onKeyDown,disabled:o.props.isDisabled,ref:o.setInputRef,onFocus:o.moveCaretAtEnd,autoFocus:!0})),o.props.showChataIcon&&s.createElement("div",{className:"chat-bar-input-icon"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"})),o.props.showLoadingDots&&o.state.isQueryRunning&&s.createElement("div",{className:"input-response-loading-container"},s.createElement(da,null)),o.props.enableVoiceRecord&&s.createElement(pa,{onTranscriptChange:o.onTranscriptChange,onFinalTranscript:o.onFinalTranscript,themeConfig:o.props.themeConfig,authentication:o.props.authentication})))})),_n(t.themeConfig),o.UNIQUE_ID=d(),o.autoCompleteTimer=void 0,o.autoCompleteArray=[],o.state={inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1},o}return it(a)}();lt(ma,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,enableVoiceRecord:p.bool,isDisabled:p.bool,onSubmit:p.func,onResponseCallback:p.func,className:p.string,autoCompletePlacement:p.string,showLoadingDots:p.bool,showChataIcon:p.bool,inputValue:p.string,queryFilters:p.arrayOf(p.shape({})),placeholder:p.string.isRequired,clearQueryOnSubmit:p.bool,sessionId:p.string,dataPageSize:p.number}),lt(ma,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,dataPageSize:void 0,onSubmit:function(){},onResponseCallback:function(){}});var fa=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"shouldComponentUpdate",(function(){return!1})),lt(mt(e),"render",(function(){return s.createElement(Te,st({},e.props,{key:e.props.tableKey,ref:e.props.tableRef}))})),e}return it(n)}();lt(fa,"defaultProps",{});var ga=function(e,t){return{sorters:ha(e,t),filters:va(e,t),page:null==e?void 0:e.page}},ha=function(e,t){var n,a=[];return(null==e||null===(n=e.sorters)||void 0===n?void 0:n.length)>0&&e.sorters.forEach((function(e){try{var n=t.table.getColumn(e.field).getDefinition().name,o=e.dir.toUpperCase();n&&o&&a.push({name:n,sort:o})}catch(e){console.error(e)}})),a},va=function(e,t){var n,a=[];return(null==e||null===(n=e.filters)||void 0===n?void 0:n.length)>0&&e.filters.forEach((function(e){try{var n=t.table.getColumn(e.field).getDefinition(),o={name:n.name,value:e.value,operator:"like"};if(cn(n)){var r=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=r.operator,o.value=r.value}a.push(o)}catch(e){console.warn(e)}})),a};function ya(e){return s.createElement(yt,null,s.createElement("div",st({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}var ba=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.firstRender=!1,o.setTableHeaderValues=setTimeout((function(){o.setInitialHeaderFilters(),o.setFilterTags({isFilteringTable:!1})}),100)})),lt(mt(o),"componentDidUpdate",(function(t,n){if(o.ref&&(o.setDimensionsTimeout=setTimeout((function(){if(o._isMounted){var t=e(o.ref,"ref.offsetHeight");t&&(o.tableHeight=t)}}),0)),o.props.isResizing&&(o.isResizing=!0),!o.state.isFilteringTable&&n.isFilteringTable)try{o.setFilterTags({isFilteringTable:o.state.isFilteringTable})}catch(e){console.error(e),o.props.onErrorCallback(e)}})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.setTableHeaderValues),clearTimeout(o.setDimensionsTimeout),o.resetFilterTags(),o.existingFilterTag=void 0,o.filterTagElements=void 0})),lt(mt(o),"setInitialHeaderFilters",(function(){e(o.props,"headerFilters.length")&&e(o.ref,"table")&&o.props.headerFilters.forEach((function(e){o.ref.table.setHeaderFilterValue(e.field,e.value)}))})),lt(mt(o),"cellClick",(function(e,t){o.props.onCellClick(t)})),lt(mt(o),"copyToClipboard",(function(){var e;o._isMounted&&null!==(e=o.ref)&&void 0!==e&&e.table&&o.ref.table.copyToClipboard("active",!0)})),lt(mt(o),"saveAsCSV",(function(e){try{var t;if(o._isMounted&&null!==(t=o.ref)&&void 0!==t&&t.table){var n=ce(o.ref.table);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()})),lt(mt(o),"resetFilterTags",(function(){var e;null!==(e=o.filterTagElements)&&void 0!==e&&e.length&&o.filterTagElements.forEach((function(e){try{e.parentNode&&o._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),lt(mt(o),"setFilterTags",(function(){var e,t;o.resetFilterTags(),o._isMounted&&null!==(e=o.ref)&&void 0!==e&&e.table&&(t=o.ref.table.getHeaderFilters()),t&&t.forEach((function(e,t){try{var n=e.field;o.filterTagElements[n]=document.createElement("span"),o.filterTagElements[n].innerText="F",o.filterTagElements[n].setAttribute("class","filter-tag"),o.columnTitleEl=document.querySelector("#react-autoql-table-container-".concat(o.TABLE_ID,' .tabulator-col[tabulator-field="').concat(n,'"] .tabulator-col-title')),o.columnTitleEl.insertBefore(o.filterTagElements[n],o.columnTitleEl.firstChild)}catch(e){console.error(e),o.props.onErrorCallback(e)}}))})),lt(mt(o),"toggleTableFilter",(function(e){var t=e.isFilteringTable;o.setState({isFilteringTable:t})})),lt(mt(o),"getTableHeight",(function(){return o.tableHeight?"".concat(o.tableHeight,"px"):"".concat(e(o.props,"style.height"),"px")})),lt(mt(o),"renderPageLoader",(function(){return s.createElement("div",{className:"table-loader table-page-loader"},s.createElement(ya,null))})),lt(mt(o),"renderScrollLoader",(function(){return s.createElement("div",{className:"table-loader table-scroll-loader"},s.createElement(ya,null))})),lt(mt(o),"render",(function(){var e=o.getTableHeight();return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-table-container-".concat(o.TABLE_ID),ref:function(e){return o.tableContainer=e},"data-test":"react-autoql-table",className:"react-autoql-table-container \n ".concat(o.props.supportsDrilldowns?"supports-drilldown":"","\n ").concat(o.state.isFilteringTable?"filtering":"","\n ").concat(o.props.isResizing?"resizing":"","\n ").concat(o.supportsInfiniteScroll?"infinite":"limited","\n ").concat(o.state.isLastPage?"last-page":""),style:$e($e({},o.props.style),{},{flexBasis:e})},o.props.data&&o.props.columns&&s.createElement(fa,{tableRef:function(e){return o.ref=e},tableKey:"react-autoql-table-".concat(o.TABLE_ID),id:"react-autoql-table-".concat(o.TABLE_ID),key:"react-autoql-table-wrapper-".concat(o.TABLE_ID),"data-test":"autoql-tabulator-table",columns:o.props.columns,data:o.supportsInfiniteScroll?[]:o.props.data,cellClick:o.cellClick,options:o.tableOptions,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",clipboard:!0,download:!0}),o.state.pageLoading&&o.renderPageLoader(),o.state.scrollLoading&&o.renderScrollLoader()))})),o.TABLE_ID=d(),o.firstRender=!0,o.hasSetInitialData=!1,o.ref=null,o.currentPage=1,o.filterTagElements=[],o.headerFilters=[],o.queryID=t.queryID,o.supportsInfiniteScroll=t.useInfiniteScroll&&!!t.pageSize,o.tableOptions={dataLoadError:function(e){console.error(e)},selectableCheck:function(){return!1},layout:"fitDataFill",textSize:"9px",clipboard:!0,download:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1},cellClick:o.cellClick,dataSorting:function(e){},dataFiltering:function(){var e,t,n=null===(e=o.ref)||void 0===e||null===(t=e.table)||void 0===t?void 0:t.getData();null!=n&&n.length&&(o.data=n)},dataFiltered:function(e,n){var a,r,i=null===(a=o.ref)||void 0===a||null===(r=a.table)||void 0===r?void 0:r.getHeaderFilters();o.supportsInfiniteScroll?t.onFilterCallback(i,n):!o.supportsInfiniteScroll&&o._isMounted&&o.ref&&!o.firstRender&&(se(i,o.headerFilters)||(o.headerFilters=i,t.onFilterCallback(i,n)))},downloadReady:function(e,t){return t}},o.supportsInfiniteScroll&&(o.tableOptions.ajaxProgressiveLoad=o.supportsInfiniteScroll?"scroll":void 0,o.tableOptions.ajaxProgressiveLoadScrollMargin=800,o.tableOptions.ajaxURL="https://required-placeholder-url.com",o.tableOptions.ajaxSorting=!0,o.tableOptions.ajaxFiltering=!0,o.tableOptions.virtualDomHoz=!0,o.tableOptions.progressiveRenderSize=5,o.tableOptions.progressiveRenderMargin=100,o.tableOptions.ajaxLoader=!0,o.tableOptions.ajaxLoaderLoading="",o.tableOptions.ajaxLoaderError="",o.tableOptions.ajaxRequestFunc=function(){var n=at(et().mark((function n(a,r,i){var l,s,c,u,p,d,m;return et().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,l=ga(i,o.ref),!se(o.previousTableConfigState,l)){n.next=4;break}return n.abrupt("return",Promise.resolve());case 4:if(o.previousTableConfigState=l,o.hasSetInitialData){n.next=8;break}return o.hasSetInitialData=!0,n.abrupt("return",Promise.resolve({rows:o.props.data,page:1}));case 8:if(!((null==i?void 0:i.page)>1)){n.next=16;break}return o.setState({scrollLoading:!0}),n.next=12,Zn($e($e($e({},Jt(t.authentication)),l),{},{queryId:o.queryID}));case 12:s=n.sent,o.props.onNewPage(null===(c=s)||void 0===c?void 0:c.rows),n.next=27;break;case 16:if(t.queryRequestData){n.next=20;break}console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),n.next=27;break;case 20:return o.setState({pageLoading:!0}),n.next=23,$n($e($e($e({},Jt(t.authentication)),t.queryRequestData),{},{pageSize:t.pageSize,orders:null==l?void 0:l.sorters,tableFilters:null==l?void 0:l.filters}));case 23:m=n.sent,o.queryID=null==m||null===(u=m.data)||void 0===u||null===(p=u.data)||void 0===p?void 0:p.query_id,s=$e($e({},e(m,"data.data",{})),{},{page:1}),o.props.onNewData(null===(d=s)||void 0===d?void 0:d.rows);case 27:return o.setState({scrollLoading:!1,pageLoading:!1}),n.abrupt("return",s);case 31:return n.prev=31,n.t0=n.catch(0),o.setState({scrollLoading:!1,pageLoading:!1}),n.abrupt("return",Promise.resolve());case 35:case"end":return n.stop()}}),n,null,[[0,31]])})));return function(e,t,a){return n.apply(this,arguments)}}(),o.tableOptions.ajaxResponse=function(n,a,r){if(!r)return{data:o.data,last_page:o.lastPage};o.currentPage=r.page;var i=e(r,"rows.length",0)<t.pageSize;o.lastPage=i?o.currentPage:o.currentPage+1,i?o.setState({isLastPage:!0}):o.setState({isLastPage:!1});var l={};return l.data=r.rows,l.last_page=o.lastPage,l},o.tableOptions.ajaxError=function(e){console.error(e)}),o.state={isFilteringTable:!1,pageLoading:!1,scrollLoading:!1,isLastPage:!1},o}return it(a)}();lt(ba,"propTypes",{themeConfig:St,data:p.arrayOf(p.array),columns:p.arrayOf(p.shape({})),onFilterCallback:p.func,isResizing:p.bool,pageSize:p.number,useInfiniteScroll:p.bool}),lt(ba,"defaultProps",{themeConfig:Xt,queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:0,useInfiniteScroll:!0,source:[],onFilterCallback:function(){},onCellClick:function(){},onErrorCallback:function(){}});var Ca={themeConfig:St,dataFormatting:Ct,data:p.arrayOf(p.array).isRequired,columns:p.arrayOf(p.shape({})).isRequired,numberColumnIndices:p.arrayOf(p.number).isRequired,stringColumnIndices:p.arrayOf(p.number).isRequired,stringColumnIndex:p.number.isRequired,numberColumnIndex:p.number.isRequired,legendColumnIndex:p.number,enableDynamicCharting:p.bool,isResizing:p.bool,onLegendClick:p.func,onLabelChange:p.func,onXAxisClick:p.func,onYAxisClick:p.func},Ea={themeConfig:Xt,dataFormatting:Wt,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},Sa=$e($e({},Ca),{},{visibleSeriesIndices:p.arrayOf(p.number).isRequired,height:p.number.isRequired,width:p.number.isRequired,leftMargin:p.number,rightMargin:p.number,topMargin:p.number,bottomMargin:p.number}),Ta=$e($e({},Ea),{},{leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0}),Da=$e($e({},Sa),{},{xScale:p.func.isRequired,yScale:p.func.isRequired,xCol:p.shape({}).isRequired,yCol:p.shape({}).isRequired,xTicks:p.array,yTicks:p.array,xGridLines:p.bool,yGridLines:p.bool,rotateLabels:p.bool,hasRightLegend:p.bool,hasBottomLegend:p.bool,hasXDropdown:p.bool,hasYDropdown:p.bool,xAxisTitle:p.string,yAxisTitle:p.string,legendTitle:p.string}),xa=$e($e({},Ta),{},{xTicks:void 0,yTicks:void 0,xGridLines:!1,yGridLines:!1,rotateLabels:!1,hasRightLegend:!1,hasBottomLegend:!1,hasXDropdown:!1,hasYDropdown:!1,xAxisTitle:void 0,yAxisTitle:void 0,legendTitle:void 0}),ka=$e($e({},Sa),{},{xScale:p.func.isRequired,yScale:p.func.isRequired}),wa={activeKey:void 0,onChartClick:function(){}},Aa=function(e,t){var n,a;return(null===(n=e.data)||void 0===n?void 0:n.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||e.stringColumnIndex!==t.stringColumnIndex||e.numberColumnIndex!==t.numberColumnIndex||!se(e.legendColumn,t.legendColumn)||!se(e.columns,t.columns)||!se(e.numberColumnIndices,t.numberColumnIndices)||!se(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!se(e.data,t.data)},Na=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)},Ra=function(e,t){return"".concat(e,"-").concat(t)},Ma=function(e,t){var n,a;return t.marginAdjustmentFinished&&((null==e||null===(n=e.data)||void 0===n?void 0:n.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||!se(e.numberColumnIndices,t.numberColumnIndices)||!se(e.legendLabels,t.legendLabels)||e.stringColumnIndex!==t.stringColumnIndex)},Va=function(e){var t=e.row,n=e.columns,a=e.colIndex,o=e.stringColumnIndex,r=e.legendColumn,i=e.dataFormatting;try{var l=n[o],s=n[a],c=l.title,u=s.origColumn?s.origColumn.title:s.title,p=Tn({element:t[o],column:l,config:i}),d=Tn({element:t[a]||0,column:n[a],config:i}),m=n[a],f=r&&null!=m&&m.origColumn?"<div><strong>".concat(r.title,":</strong> ").concat(m.title,"</div>"):"",g="<div><strong>".concat(c,":</strong> ").concat(p,"</div>"),h="<div><strong>".concat(u,":</strong> ").concat(d,"</div>");return"<div>\n ".concat(f,"\n ").concat(g,"\n ").concat(h,"\n </div>")}catch(e){return console.error(e),null}},qa=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return 0}},Ia=function(e,t,n){var a={},o={};return e.forEach((function(e){var r=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?a[r]?a[r]+=i:a[r]=i:i<0&&(o[r]?o[r]-=i:o[r]=i)}))})),{maxValue:La(a),minValue:Oa(o)}},Pa=function(e){if("object"===tt(e))return Object.keys(e).length},La=function(e){var t=Pa(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=ht(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.max.apply(Math,ht(a))}return n},Oa=function(e){var t=Pa(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=ht(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.min.apply(Math,ht(a))}return n},Fa=function(e,t){try{var n=[],a=[];t.forEach((function(t,o){n.push(ke(e,(function(e){return qa(e[t])}))),a.push(we(e,(function(e){return qa(e[t])})))}));var o=ke(n),r=we(a);return o===r&&(r>0?r=0:o<0&&(o=0)),{minValue:r,maxValue:o}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},Qa=function(t,n){if(!((null==t?void 0:t.length)<2)&&"pie"!==n&&"heatmap"!==n&&"bubble"!==n)return"stacked_column"===n||"stacked_bar"===n||"stacked_line"===n||e(t,"length")>2||e(t,"length")>1?"right":void 0},za=function(e,t,n){try{var a=Math.ceil(30*n.length/t);if(e<30){var o=[];return n.forEach((function(e,t){t%a==0&&o.push(e)})),o}}catch(e){console.error(e)}return n},Ha=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"openSelector",(function(){a.setState({isOpen:!0})})),lt(mt(a),"closeSelector",(function(){a.setState({isOpen:!1})})),lt(mt(a),"renderSelectorContent",(function(){return s.createElement("div",{className:"axis-selector-container",id:"legend-selector-content",onClick:function(e){e.stopPropagation()}},s.createElement("ul",{className:"axis-selector-content"},a.props.stringColumnIndices.map((function(e,t){return s.createElement("li",{className:"string-select-list-item",key:d(),onClick:function(){a.props.onChangeLegendColumnIndex(t),a.closeSelector()}},e.label)}))))})),lt(mt(a),"render",(function(){return s.createElement(me,{isOpen:a.state.isOpen,content:a.renderSelectorContent(),onClickOutside:a.closeSelector,position:a.props.position,align:a.props.align},s.createElement("rect",st({},a.props.childProps,{className:"legend-title-border","data-test":"legend-title-border",onClick:a.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),a.state={isOpen:!1},a}return it(n)}();lt(Ha,"propTypes",Da),lt(Ha,"defaultProps",xa);var Ba=function(t){ct(a,u);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o.renderAxis(),(o.props.hasRightLegend||o.props.hasBottomLegend)&&o.renderLegend(),o.props.onLabelChange()})),lt(mt(o),"componentDidUpdate",(function(e){o.renderAxis(),!o.props.hasRightLegend&&!o.props.hasBottomLegend||se(o.props.legendLabels,e.legendLabels)||o.renderLegend(),o.props.rotateLabels!==e.rotateLabels&&o.props.onLabelChange()})),lt(mt(o),"componentWillUnmount",(function(){Gn(o.legendElement),Gn(o.legendSwatchElements),Gn(o.swatchElements)})),lt(mt(o),"styleLegendTitleNoBorder",(function(e){e.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").attr("data-test","legend-title")})),lt(mt(o),"styleLegendTitleWithBorder",(function(t){t.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").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=t.select(".legendTitle").node().getBBox()}catch(e){console.error(e)}xe(o.legendBorder).attr("class","legend-title-border").attr("width",e(o.titleBBox,"width",0)+20).attr("height",e(o.titleBBox,"height",0)+10).attr("x",e(o.titleBBox,"x",0)-10).attr("y",e(o.titleBBox,"y",0)-10).attr("stroke","transparent").attr("stroke-width","1px").attr("fill","transparent").attr("rx",4),o.legendElement=xe(o.legendBorder).node(),o.legendElement.parentNode.appendChild(o.legendElement)})),lt(mt(o),"renderLegend",(function(){try{var e=mt(o),t=o.props.legendLabels;if(!t)return;var n=o.getLegendScale(t);if(o.props.hasRightLegend){o.legendSVG=xe(o.rightLegendElement),o.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");var a=Re().shape("path",Me().type(Ve).size(75)()).orient("vertical").shapePadding(5).labelWrap(100).scale(n).on("cellclick",(function(n){e.props.onLabelChange({setLoading:!1}),e.props.onLegendClick(t.find((function(e){return e.label===n})))}));o.props.legendTitle&&a.title(o.props.legendTitle).titleWidth(100),o.legendSVG.call(a).style("font-family","inherit"),o.props.legendTitle&&(o.props.onLegendTitleClick?o.styleLegendTitleWithBorder(o.legendSVG):o.styleLegendTitleNoBorder(o.legendSVG));var r=xe(o.rightLegendElement).node().getBBox().width;xe(o.legendClippingContainer).attr("width",r+30),o.legendSVG.attr("clip-path","url(#legend-clip-area-".concat(o.LEGEND_ID,")"))}else if(o.props.hasBottomLegend){o.legendSVG=xe(o.bottomLegendElement),o.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");a=Re().shape("path",Me().type(Ve).size(75)()).orient("horizontal").shapePadding(e.LEGEND_PADDING).labelWrap(120).labelAlign("left").scale(n).on("cellclick",(function(t){e.props.onLegendClick(t)}));o.legendSVG.call(a).style("font-family","inherit")}o.applyStylesForHiddenSeries(t)}catch(e){console.error(e)}})),lt(mt(o),"applyStylesForHiddenSeries",(function(e){try{var t=e.filter((function(e){return e.hidden})).map((function(e){return e.label}));o.legendSwatchElements=document.querySelectorAll("#".concat(o.LEGEND_ID," .label")),o.legendSwatchElements&&o.legendSwatchElements.forEach((function(e,n){var a=[];e.querySelectorAll("tspan").forEach((function(e){a.push(e.textContent)}));var r=a.join(" ");o.swatchElements[n]=e.parentElement.querySelector(".swatch"),t.includes(r)?o.swatchElements[n].style.opacity=.3:o.swatchElements[n].style.opacity=1}))}catch(e){console.error(e)}})),lt(mt(o),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return Ce().domain(e.map((function(e){return e.label}))).range(t)})),lt(mt(o),"renderAxis",(function(){var e,t=mt(o),n="Bottom"===o.props.orient?Ae():Ne();n.scale(o.props.scale).tickSizeOuter(0).tickFormat((function(e){return Sn({d:e,col:t.props.col,config:t.props.dataFormatting}).formattedLabel})),null!==(e=o.props.ticks)&&void 0!==e&&e.length&&n.tickValues(o.props.ticks),o.props.showGridLines&&n.tickSizeInner(o.props.tickSizeInner),o.axisElement&&xe(o.axisElement).call(n),"Bottom"===o.props.orient&&o.props.rotateLabels?xe(o.axisElement).selectAll(".tick text").style("transform","rotate(-45deg)").style("text-anchor","end").attr("dy","0.5em").attr("dx","-0.5em").attr("fill-opacity","0.7").style("font-family","inherit"):"Bottom"!==o.props.orient||o.props.rotateLabels||xe(o.axisElement).selectAll(".tick text").style("transform","rotate(0deg)").style("text-anchor","middle").attr("dy","10px").attr("dx","0").attr("fill-opacity","0.7").style("font-family","inherit"),xe(o.axisElement).selectAll(".axis text").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").attr("data-for",o.props.tooltipID).attr("data-tip",(function(e){var n=Sn({d:e,col:t.props.col,config:t.props.dataFormatting}),a=n.fullWidthLabel;return n.isTruncated?a:null})).attr("data-effect","float"),xe(o.axisElement).selectAll(".axis path").style("display","none"),xe(o.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.15").style("shape-rendering","crispedges"),xe(o.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.4)})),lt(mt(o),"render",(function(){var t,n=(null===(t=o.props.numberColumnIndices)||void 0===t?void 0:t.length)||0,a=o.LEGEND_PADDING*(n-1)/2,r=o.props.leftMargin||0,i=o.props.height-o.props.topMargin-(o.props.rotateLabels?44:o.props.bottomMargin)+20;return i<0&&(i=0),s.createElement("g",{"data-test":"axis"},s.createElement("g",{className:"axis axis-".concat(o.props.orient,"\n ").concat(o.props.rotateLabels?" rotated":""),ref:function(e){o.axisElement=e},transform:o.props.translate}),o.props.hasRightLegend&&s.createElement("g",{ref:function(e){o.rightLegendElement=e},id:o.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(o.props.width+15,", ").concat(o.props.legendTitle?"30":"25",")")},s.createElement("clipPath",{id:"legend-clip-area-".concat(o.LEGEND_ID)},s.createElement("rect",{ref:function(e){o.legendClippingContainer=e},id:"legend-bounding-box-".concat(o.LEGEND_ID),height:i,width:o.props.rightMargin+30,style:{transform:"translate(-30px, -30px)"}})),o.props.legendColumn&&s.createElement(Ha,st({},o.props,{column:o.props.legendColumn,position:"bottom",align:"end",childProps:{ref:function(e){return o.legendBorder=e},x:e(o.titleBBox,"x",0)-10,y:e(o.titleBBox,"y",0)-10,width:e(o.titleBBox,"width",0)+20,height:e(o.titleBBox,"height",0)+10}}))),o.props.hasBottomLegend&&s.createElement("g",{ref:function(e){o.bottomLegendElement=e},"data-test":"bottom-legend",id:o.LEGEND_ID,className:"legendOrdinal",transform:"translate(".concat((o.props.width-r)/2+r-a,",").concat(o.props.height-30,")")}))})),o.LEGEND_PADDING=130,o.LEGEND_ID="axis-".concat(d()),o.swatchElements=[],o}return it(a)}();lt(Ba,"propTypes",$e($e({},Da),{},{scale:p.func.isRequired,col:p.shape({}).isRequired,ticks:p.array,orient:p.string,tickSizeInner:p.number,translate:p.string})),lt(Ba,"defaultProps",$e($e({},xa),{},{orient:"Bottom",ticks:void 0,tickSizeInner:void 0,translate:void 0}));var _a=["label","type","indeterminate","hasError","style","onChange","checked"],Ua=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),lt(mt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),lt(mt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),lt(mt(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=dt(t,_a),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":"","\n ").concat(o?"react-autoql-checkbox--has-error__input":"","\n ");return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox",style:e.props.style},s.createElement("div",{className:i},s.createElement("input",st({},r,{type:"checkbox",className:l,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&s.createElement("div",{className:"react-autoql-checkbox-tick"},s.createElement(Kt,{type:"check"})),n&&s.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return it(n)}();lt(Ua,"propTypes",{hasError:p.bool,indeterminate:p.bool,label:p.string,type:p.oneOf(["default","switch"]),checked:p.bool,onChange:p.func}),lt(Ua,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var ja=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",{selected:[]}),lt(mt(t),"unselectAll",(function(){t.setState({selected:[]})})),lt(mt(t),"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})),lt(mt(t),"handleShiftSelect",(function(e){if(t.state.selected.length){var n=Math.min.apply(Math,ht(t.state.selected)),a=[e];e<n?a=t.interpolateArray(e,n):e>n&&(a=t.interpolateArray(n,e)),t.props.onSelect(a),t.setState({selected:a})}else t.props.onSelect([e]),t.setState({selected:[e]})})),lt(mt(t),"handleCtrlSelect",(function(e){var n=[];n=t.state.selected.includes(e)?t.state.selected.filter((function(t){return t!==e})):[].concat(ht(t.state.selected),[e]),t.props.onSelect(n),t.setState({selected:n})})),lt(mt(t),"handleMultipleCheck",(function(e){t.state.selected.every((function(t){return e[t].checked}))?t.state.selected.forEach((function(t){e[t].checked=!1})):t.state.selected.forEach((function(t){e[t].checked=!0})),t.props.onChange(e)})),lt(mt(t),"render",(function(){var n=ce(t.props.items);return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list",onClick:function(e){e.stopPropagation()}},!!e(t.props.columns,"length")&&s.createElement("div",{className:"col-visibility-header"},t.props.columns.map((function(e,a){if(a===t.props.columns.length-1){var o=n.every((function(e){return e.checked}));return s.createElement("div",{key:"list-header-".concat(d())},e.name,s.createElement(Ua,{checked:o,style:{marginLeft:"10px"},onChange:function(){o?n.forEach((function(e){e.checked=!1})):n.forEach((function(e){e.checked=!0})),t.props.onChange(n)}}))}return s.createElement("div",{key:"list-header-".concat(d())},e.name)}))),n.map((function(e,a){return s.createElement("div",{key:"list-item-".concat(d()),className:"react-autoql-list-item".concat(t.state.selected.includes(a)?" selected":""),onClick:function(e){e.shiftKey?t.handleShiftSelect(a):e.ctrlKey||e.metaKey?t.handleCtrlSelect(a):(t.props.onSelect([a]),t.setState({selected:[a]}))}},s.createElement("div",null,e.content," "),s.createElement("div",null,s.createElement(Ua,{checked:e.checked,onChange:function(){t.state.selected.length>1&&t.state.selected.includes(a)?t.handleMultipleCheck(n):(e.checked=!e.checked,t.props.onChange(n))}})))}))))})),t}return it(a)}();lt(ja,"propTypes",{themeConfig:St,columns:p.arrayOf(p.shape({})),items:p.arrayOf(p.shape({}))}),lt(ja,"defaultProps",{themeConfig:Xt,onChange:function(){},onSelect:function(){},columns:[],items:[]});var Ka=["default","primary","danger"],Ga=["small","large"],Wa=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"COMPONENT_KEY","react-autoql-btn-".concat(d())),lt(mt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Ka.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),lt(mt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(Ga.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),lt(mt(e),"render",(function(){var t=e.getType(),n=e.getSize(),a=e.props.loading||e.props.disabled;return s.createElement(yt,null,s.createElement("button",{className:"react-autoql-btn\n ".concat(e.props.className||"","\n ").concat(t,"\n ").concat(n,"\n ").concat(a?" disabled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:$e({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.COMPONENT_KEY},e.props.loading&&s.createElement(ya,{"data-test":"react-autoql-btn-loading"}),e.props.children),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:e.COMPONENT_KEY,effect:"solid",delayShow:500,place:"top"}))})),e}return it(n)}();lt(Wa,"propTypes",{type:p.oneOf(Ka),size:p.oneOf(Ga),onClick:p.func,loading:p.bool,disabled:p.bool,multiline:p.bool,tooltip:p.string}),lt(Wa,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var Ya=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidUpdate",(function(e){Aa(o.props,e)&&o.setState($e({},o.getSelectorState(o.props)))})),lt(mt(o),"openSelector",(function(){o.setState({isOpen:!0})})),lt(mt(o),"closeSelector",(function(){o.setState({isOpen:!1})})),lt(mt(o),"getSelectorState",(function(t){var n=t.columns,a=t.numberColumnIndices;if(n&&a){var o=[],r=[],i=[];return n.forEach((function(e,t){if(e.is_visible&&!e.pivot){var n={content:e.title,checked:a.includes(t),columnIndex:t};"DOLLAR_AMT"===e.type?o.push(n):"QUANTITY"===e.type?r.push(n):"RATIO"!==e.type&&"PERCENT"!==e.type||i.push(n)}})),{activeNumberType:e(n,"[".concat(a[0],"].type")),currencySelectorState:o,quantitySelectorState:r,ratioSelectorState:i}}})),lt(mt(o),"renderSelectorContent",(function(e){var t=o.state,n=t.currencySelectorState,a=t.quantitySelectorState,r=t.ratioSelectorState;return s.createElement("div",{id:"chata-chart-popover",onClick:function(e){e.stopPropagation()}},s.createElement("div",{className:"axis-selector-container"},!!n.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"},o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Currency"),s.createElement(ja,{ref:function(e){return o.currencySelectRef=e},items:n,onSelect:function(){o.quantitySelectRef&&o.quantitySelectRef.unselectAll(),o.ratioSelectRef&&o.ratioSelectRef.unselectAll()},onChange:function(e){var t=a.map((function(e){return $e($e({},e),{},{checked:!1})})),n=r.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"DOLLAR_AMT",currencySelectorState:e,quantitySelectorState:t,ratioSelectorState:n})}})),!!a.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"}," ",o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Quantity"),s.createElement(ja,{ref:function(e){return o.quantitySelectRef=e},items:a,onSelect:function(){o.currencySelectRef&&o.currencySelectRef.unselectAll(),o.ratioSelectRef&&o.ratioSelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return $e($e({},e),{},{checked:!1})})),a=r.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"QUANTITY",quantitySelectorState:e,currencySelectorState:t,ratioSelectorState:a})}})),!!r.length&&s.createElement(c,null,s.createElement("div",{className:"number-selector-header"}," ",o.props.columns&&void 0!==o.props.legendColumn?o.props.legendColumn.display_name:"Ratio"),s.createElement(ja,{ref:function(e){return o.ratioSelectRef=e},items:r,onSelect:function(){o.currencySelectRef&&o.currencySelectRef.unselectAll(),o.quantitySelectRef&&o.quantitySelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return $e($e({},e),{},{checked:!1})})),r=a.map((function(e){return $e($e({},e),{},{checked:!1})}));o.setState({activeNumberType:"RATIO",ratioSelectorState:e,currencySelectorState:t,quantitySelectorState:r})}}))),s.createElement("div",{className:"axis-selector-apply-btn"},s.createElement(Wa,{style:{width:"calc(100% - 10px)"},type:"primary",disabled:o.state.ratioSelectorState.every((function(e){return!e.checked}))&&o.state.currencySelectorState.every((function(e){return!e.checked}))&&o.state.quantitySelectorState.every((function(e){return!e.checked})),onClick:function(){var e=[];if("DOLLAR_AMT"===o.state.activeNumberType?e=o.state.currencySelectorState:"QUANTITY"===o.state.activeNumberType?e=o.state.quantitySelectorState:"RATIO"===o.state.activeNumberType&&(e=o.state.ratioSelectorState),e.length){o.closeSelector();var t=e.filter((function(e){return e.checked})).map((function(e){return e.columnIndex}));o.props.changeNumberColumnIndices(t)}}},"Apply")))})),lt(mt(o),"render",(function(){return s.createElement(me,{isOpen:o.state.isOpen,content:o.renderSelectorContent(),onClickOutside:o.closeSelector,position:o.props.position,align:o.props.align},s.createElement("rect",st({},o.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:o.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),o.currencySelectRef,o.quantitySelectRef,o.ratioSelectRef,o.state=$e($e({},o.getSelectorState(t)),{},{isOpen:!1}),o}return it(a)}();lt(Ya,"propTypes",Da),lt(Ya,"defaultProps",xa);var Xa=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"openSelector",(function(){o.setState({isOpen:!0})})),lt(mt(o),"closeSelector",(function(){o.setState({isOpen:!1})})),lt(mt(o),"renderSelectorContent",(function(){return s.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},s.createElement("ul",{className:"axis-selector-content"},o.props.stringColumnIndices.map((function(t,n){return s.createElement("li",{className:"string-select-list-item ".concat(t===o.props.stringColumnIndex?"active":""),key:d(),onClick:function(){o.closeSelector(),o.props.changeStringColumnIndex(t)}},e(o.props.columns,"[".concat(t,"].title")))}))))})),lt(mt(o),"render",(function(){return s.createElement(me,{isOpen:o.state.isOpen,content:o.renderSelectorContent(),onClickOutside:o.closeSelector,position:o.props.position,align:o.props.align},s.createElement("rect",st({},o.props.childProps,{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 it(a)}();lt(Xa,"propTypes",Da),lt(Xa,"defaultProps",xa);var Ja=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"render",(function(){return cn(e.props.column)?s.createElement(Ya,st({"data-test":"number-axis-selector"},e.props)):un(e.props.column)?s.createElement(Xa,st({"data-test":"string-axis-selector"},e.props)):null})),e}return it(n)}();lt(Ja,"propTypes",Da),lt(Ja,"defaultProps",xa);var Za=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"renderAxisLabel",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e.length>35?s.createElement("tspan",{"data-tip":e,"data-for":a.props.tooltipID,"data-test":"axis-label"},"".concat(e.substring(0,35),"...")):s.createElement("tspan",{"data-test":"axis-label"},e,t&&s.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),lt(mt(a),"renderXAxisLabel",(function(e){var t=(a.props.width-a.props.leftMargin)/2+a.props.leftMargin,n=a.props.height-(a.props.bottomLegendMargin||0)-15,o=xn(a.xLabelRef),r=o?o.width:0,i=o?o.height:0;return s.createElement("g",null,s.createElement("text",{ref:function(e){return a.xLabelRef=e},className:"x-axis-label","data-test":"x-axis-label",textAnchor:"middle",fontWeight:"bold",y:n,x:t,style:a.labelInlineStyles},a.renderAxisLabel(e,a.props.hasXDropdown)),a.props.hasXDropdown&&s.createElement(Ja,st({},a.props,{column:a.props.xCol,position:"top",align:"end",childProps:{x:t-r/2-10,y:n-16,width:r+20,height:i+10}})))})),lt(mt(a),"renderYAxisLabel",(function(e){var t=-(a.props.height-a.props.bottomMargin)/2,n=xn(a.yLabelRef),o=n?n.width:0,r=n?n.height:0;return s.createElement("g",null,s.createElement("text",{ref:function(e){return a.yLabelRef=e},className:"y-axis-label","data-test":"y-axis-label",textAnchor:"middle",transform:"rotate(-90)",fontWeight:"bold",x:t,y:20,style:a.labelInlineStyles},a.renderAxisLabel(e,a.props.hasYDropdown)),a.props.hasYDropdown&&s.createElement(Ja,st({},a.props,{column:a.props.yCol,position:"right",align:"center",childProps:{x:t-o/2-10,y:4,width:o+20,height:r+10,transform:"rotate(-90)"}})))})),lt(mt(a),"renderXAxis",(function(e){return s.createElement(Ba,st({},a.props,{key:a.xAxisKey,orient:"Bottom",scale:a.props.xScale,translate:"translate(0, ".concat(a.props.height-a.props.bottomMargin,")"),tickSizeInner:-a.props.height+a.props.topMargin+a.props.bottomMargin,ticks:a.props.xTicks,width:a.props.width-a.props.rightMargin,col:a.props.xCol,title:e,showGridLines:a.props.xGridLines}))})),lt(mt(a),"renderYAxis",(function(e){return s.createElement(Ba,st({},a.props,{key:a.yAxisKey,orient:"Left",scale:a.props.yScale,translate:"translate(".concat(a.props.leftMargin,", 0)"),tickSizeInner:-a.props.width+a.props.leftMargin+a.props.rightMargin,ticks:a.props.yTicks,height:a.props.height,width:a.props.width-a.props.rightMargin,col:a.props.yCol,title:e,showGridLines:a.props.yGridLines}))})),lt(mt(a),"render",(function(){var e,t;if(!(a.props.yScale&&a.props.xScale&&a.props.height&&a.props.width&&a.props.xCol&&a.props.yCol))return null;var n=a.props.xAxisTitle||(null===(e=a.props.xCol)||void 0===e?void 0:e.display_name),o=a.props.yAxisTitle||(null===(t=a.props.yCol)||void 0===t?void 0:t.display_name);return s.createElement("g",null,a.renderYAxisLabel(o),a.renderXAxisLabel(n),s.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},a.renderXAxis(n),a.renderYAxis(o)))})),a.xAxisKey=d(),a.yAxisKey=d(),a.labelInlineStyles={fontSize:12,fontFamily:"inherit",fill:"currentColor",fillOpacity:.7,cursor:"default"},a}return it(n)}();lt(Za,"propTypes",Da),lt(Za,"defaultProps",xa);var $a=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,o=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.xScale,c=t.yScale,u=o.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=l.bandwidth()/u.length,m=0;return o.forEach((function(t,o){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=f<0?Na(c):c(f),h=Math.abs(c(f)-Na(c));if((isNaN(h)||isNaN(f))&&(g=Na(c),h=0),h<.05)return null;var v=l(u[r])+m*d,y=Va({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:a,dataFormatting:i}),b=Ra(t,p);return s.createElement("rect",{key:b,className:"bar".concat(e.state.activeKey===b?" active":""),"data-test":"bar-".concat(o,"-").concat(p),x:v,y:g,height:h,width:d,onClick:function(){return e.onColumnClick(u,t,p)},"data-tip":y,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(o),fillOpacity:.7}})}))),m+=1)})),s.createElement("g",{"data-test":"columns"},p)})),e}return it(n)}();lt($a,"propTypes",ka),lt($a,"defaultProps",wa);var eo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Fa(e.data,n),r=o.minValue,i=o.maxValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yScale=Se().domain([r,i]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=Bn(a.xScale,e.innerPadding),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-column-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,xAxisTitle:a.props.stringAxisTitle,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement($a,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(eo,"propTypes",Sa),lt(eo,"defaultProps",Ta);var to=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onBarClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale,u=o.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=l.bandwidth()/u.length,m=0;return o.forEach((function(t,o){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=Math.abs(c(f)-Na(c));if(Number.isNaN(g)&&(g=0),g<.05)return null;var h=l(u[r])+m*d,v=Va({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(t,p),className:"bar".concat(e.state.activeKey===Ra(t,p)?" active":""),"data-test":"bar-".concat(o,"-").concat(p),y:h,x:f>0?Na(c):c(f),width:g,height:d,onClick:function(){return e.onBarClick(u,t,p)},"data-tip":v,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(o),fillOpacity:.7}})}))),m+=1)})),s.createElement("g",{"data-test":"bars"},p)})),e}return it(n)}();lt(to,"propTypes",ka),lt(to,"defaultProps",wa);var no=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=Hn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xLabelArray,e.columns[e.numberColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Fa(e.data,n),r=o.minValue,i=o.maxValue;a.xScale=Se().domain([r,i]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yLabelArray=e.data.map((function(t){return t[e.stringColumnIndex]})),a.xLabelArray=a.xScale.ticks(),a.barHeight=e.height/e.data.length,a.yTickValues=za(a.barHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-bar-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.numberColumnIndex],yCol:a.props.columns[a.props.stringColumnIndex],yTicks:a.yTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,xAxisTitle:a.props.numberAxisTitle,yAxisTitle:a.props.stringAxisTitle,xGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(to,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(no,"propTypes",Sa),lt(no,"defaultProps",Ta);var ao=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onDotClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"makePolyline",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,o=t.stringColumnIndex,r=t.yScale,i=t.xScale,l=[];return a.forEach((function(t,a){var c=[];n[t].isSeriesHidden||e.props.data.forEach((function(n,a){var l=n[t],s=e.props.data[a-1],u=e.props.data[a+1];if(!(!(0===a||a===e.props.data.length-1)&&Math.abs(r(l)-r(null==s?void 0:s[t]))<.05&&Math.abs(r(null==s?void 0:s[t])-r(null==u?void 0:u[t]))<.05)){var p=i.bandwidth()/2,d=r.domain()[0],m=[i(n[o])+p,r(l||d)];c.push(m)}}));var u=c.map((function(e){return e.join(",")})).join(" "),p=s.createElement("polyline",{key:"line-".concat(Ra(0,a)),className:"line",points:u,fill:"none",stroke:e.props.colorScale(a),strokeWidth:1,opacity:.7});l.push(p)})),l})),lt(mt(e),"makeDots",(function(t){var n=e.props,a=n.columns,o=n.legendColumn,r=n.numberColumnIndices,i=n.stringColumnIndex,l=n.dataFormatting,c=n.yScale,u=n.xScale,p=[];return r.forEach((function(t,n){a[t].isSeriesHidden||e.props.data.forEach((function(r,d){var m=r[t];if(m){var f=c(m);if(!(f<.05)){var g=u.bandwidth()/2,h=Va({row:r,columns:a,colIndex:t,stringColumnIndex:i,legendColumn:o,dataFormatting:l});p.push(s.createElement("circle",{key:Ra(t,d),className:"line-dot".concat(e.state.activeKey===Ra(t,d)?" active":""),cy:f,cx:u(r[i])+g,r:3,onClick:function(){return e.onDotClick(r,t,d)},"data-tip":h,"data-for":e.props.tooltipID,style:{cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:2,strokeOpacity:.7,fillOpacity:1,opacity:0,fill:e.state.activeKey===Ra(t,d)?e.props.colorScale(n):e.props.backgroundColor||"#fff"}}))}}}))})),p})),lt(mt(e),"render",(function(){var t=e.props.numberColumnIndices.filter((function(t){return!e.props.columns[t].isSeriesHidden})).length;return t?s.createElement("g",{"data-test":"line"},e.makePolyline(),e.makeDots(t)):null})),e}return it(n)}();lt(ao,"propTypes",ka),lt(ao,"defaultProps",wa);var oo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n,o,r=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(r=e.visibleSeriesIndices);var i=Fa(e.data,r),l=i.minValue,s=i.maxValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Se().domain([l,s]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(o=n.domain())||void 0===o?void 0:o.length)||1),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-line-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,xAxisTitle:a.props.stringAxisTitle,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(ao,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(oo,"propTypes",Sa),lt(oo,"defaultProps",Ta);var ro=function(t){ct(a,u);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o.renderPie()})),lt(mt(o),"shouldComponentUpdate",(function(e,t){return!o.props.isResizing||!e.isResizing})),lt(mt(o),"componentDidUpdate",(function(){o.renderPie()})),lt(mt(o),"componentWillUnmount",(function(){Gn(o.legend),Gn(o.pieChartContainer)})),lt(mt(o),"renderPie",(function(){Gn(o.pieChartContainer);var e=mt(o);o.setPieRadius(),o.outerArc=qe().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=Ie().value((function(t,n){return t.value[e.props.numberColumnIndex]}));o.dataReady=t(Pe(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()})),lt(mt(o),"renderPieContainer",(function(){var e=o.props,t=e.width,n=e.height;o.pieChartContainer=xe(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,")"))})),lt(mt(o),"onSliceClick",(function(e){var t=e.data.key;t===o.state.activeKey?o.setState({activeKey:null}):(o.props.onChartClick(e.data.value,o.props.numberColumnIndex,o.props.columns,o.props.stringColumnIndex,o.props.legendColumn,o.props.numberColumnIndex,t),o.setState({activeKey:t}))})),lt(mt(o),"renderPieSlices",(function(){var e=mt(o);o.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",qe().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for",o.props.tooltipID).attr("data-tip",(function(t){return Va({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){xe(this).style("fill-opacity",1)})).on("mouseout",(function(e){xe(this).style("fill-opacity",.85)})).on("click",o.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){xe(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)+")"}}))}))})),lt(mt(o),"centerVisualization",(function(){var t,n=xe("#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;xe("#pie-chart-container-".concat(o.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),lt(mt(o),"onLegendClick",(function(e){var t,n=JSON.parse(e),a=null==n?void 0:n.dataIndex;if(null!==(t=o.state.legendLabels)&&void 0!==t&&t[a]){var r=ce(o.state.legendLabels);r[a].hidden=!o.state.legendLabels[a].hidden,o.setState({legendLabels:r})}le.rebuild()})),lt(mt(o),"renderLegend",(function(){var t,n=mt(o),a=o.props.height,r=en(o.props.themeConfig).chartColors;if(o.state.legendLabels){t=Ce().domain(o.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(r);var i=o.props.width/2-70;o.legend=xe(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=Re().shape("path",Me().type(Ve).size(75)()).orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).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),p=e(l,"width",0),d=o.props.width/2-p-20,m=u<a-20?(a-u)/2:15;o.legend.select(".legendOrdinal").attr("transform","translate(".concat(d,", ").concat(m,")")),o.applyStylesForHiddenSeries()}})),lt(mt(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}))})),lt(mt(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})),lt(mt(o),"render",(function(){return s.createElement("g",{id:"pie-chart-container-".concat(o.CHART_ID),"data-test":"react-autoql-pie-chart"},s.createElement("svg",{className:"pie-chart",ref:function(e){o.chartElement=e},width:o.props.width,height:o.props.height}),s.createElement("g",{ref:function(e){o.legendElement=e},id:o.LEGEND_ID,className:"legendOrdinal"}))})),o.CHART_ID=d(),o.LEGEND_ID="react-autoql-pie-legend-".concat(d()),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=en(t.themeConfig).chartColors;o.colorScale=Ce().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(Tn({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(o=t.columns)||void 0===o?void 0:o[t.stringColumnIndex]}),": ").concat(Tn({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 it(a)}();lt(ro,"propTypes",$e($e({},Sa),{},{backgroundColor:p.string,margin:p.number})),lt(ro,"defaultProps",$e($e({},Ta),{},{backgroundColor:"transparent",margin:40}));var io=function(e){ct(n,u);var t=gt(n);function n(e){var a;ot(this,n),lt(mt(a=t.call(this,e)),"onSquareClick",(function(e,t,n){var o=Ra(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,o),a.setState({activeKey:o})})),lt(mt(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,c=e.colorScale,u=e.yScale,p=e.xScale;if(!o.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){o.forEach((function(o,f){if(!t[o].isSeriesHidden){var g=e[o],h=Number(g),v=Number.isNaN(h)?0:h,y=e[r],b=l[f].label,C=v>=0?c(0):"rgba(221, 106, 106)",E=c(1),S=Va({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i});d.push(s.createElement("rect",{key:Ra(o,m),"data-test":"squares",className:"square".concat(a.state.activeKey===Ra(o,m)?" active":""),x:p(y),y:u(b),width:p.bandwidth(),height:u.bandwidth(),onClick:function(){return a.onSquareClick(e,o,m)},"data-tip":S,"data-for":a.props.tooltipID,stroke:E,strokeWidth:"2px",strokeOpacity:a.state.activeKey===Ra(o,m)?1:0,fill:a.state.activeKey===Ra(o,m)?E:C,fillOpacity:a.state.activeKey===Ra(o,m)?1:a.opacityScale(Math.abs(v))}))}}))})),s.createElement("g",null,d)}));var o=ke(e.data.map((function(t){return ke(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=we(e.data.map((function(t){return we(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.opacityScale=Se().domain([r,o]).range([0,1]),a.state={activeKey:a.props.activeChartElementKey},a}return it(n)}();lt(io,"propTypes",ka),lt(io,"defaultProps",wa);var lo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.squareHeight=e.height/a.yLabelArray.length,a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin+10,e.width-e.rightMargin]).paddingInner(.01),a.yScale=Ee().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(.01),a.xTickValues=za(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=za(a.squareHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-heatmap-chart",className:"react-autoql-heatmap-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn,xTicks:a.xTickValues,yTicks:a.yTickValues,rotateLabels:a.rotateLabels,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(io,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(lo,"propTypes",Sa),lt(lo,"defaultProps",Ta);var so=function(e){ct(n,u);var t=gt(n);function n(e){var a;ot(this,n),lt(mt(a=t.call(this,e)),"state",{activeKey:a.props.activeChartElementKey}),lt(mt(a),"onCircleClick",(function(e,t,n){var o=Ra(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,o),a.setState({activeKey:o})})),lt(mt(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,c=e.colorScale,u=e.yScale,p=e.xScale;if(!o.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){o.forEach((function(o,f){if(!t[o].isSeriesHidden){var g=e[o],h=Number(g),v=Number.isNaN(h)?0:h,y=e[r],b=l[f].label,C=Va({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i});d.push(s.createElement("circle",{key:Ra(o,m),"data-test":"circles",className:"circle".concat(a.state.activeKey===Ra(o,m)?" active":""),cx:p(y)+p.bandwidth()/2,cy:u(b)+u.bandwidth()/2,r:v<0?0:a.radiusScale(v)/2,onClick:function(){return a.onCircleClick(e,o,m)},"data-tip":C,"data-for":a.props.tooltipID,style:{stroke:"transparent",strokeWidth:10,fill:a.state.activeKey===Ra(o,m)?c(1):c(0),fillOpacity:.7}}))}}))})),s.createElement("g",null,d)}));var o=ke(e.data.map((function(t){return ke(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=we(e.data.map((function(t){return we(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.radiusScale=Se().domain([r,o]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),a}return it(n)}();lt(so,"propTypes",ka),lt(so,"defaultProps",wa);var co=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.circleHeight=e.height/a.yLabelArray.length,a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingOuter(.5),a.yScale=Ee().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]),a.xTickValues=za(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=za(a.circleHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{className:"react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn,xTicks:a.xTickValues,yTicks:a.yTickValues,rotateLabels:a.rotateLabels,yGridLines:!0})),s.createElement(so,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(co,"propTypes",Sa),lt(co,"defaultProps",Ta);var uo=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var u=e.props.data.map((function(t,u){var p=0,d=0;return o.map((function(o,m){if(!n[o].isSeriesHidden){var f,g,h=t[o],v=Number(h),y=Number.isNaN(v)?0:v;if(!y)return null;if(y>=0){var b=p+y;g=Math.abs(c(y)-c(0)-.5),f=c(p),p=b}else{var C=d+y;g=Math.abs(c(Math.abs(y))-c(0)-.5),f=c(C),d=C}if(g<.05)return null;var E=Va({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(o,u),className:"column".concat(e.state.activeKey===Ra(o,u)?" active":""),x:f,y:l(t[r]),width:g,height:l.bandwidth(),onClick:function(){return e.onColumnClick(t,o,u)},"data-tip":E,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return s.createElement("g",{"data-test":"stacked-bars"},u)})),e}return it(n)}();lt(uo,"propTypes",ka),lt(uo,"defaultProps",wa);var po=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=Hn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xLabelArray,e.columns[e.numberColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Ia(e.data,e.stringColumnIndex,n),r=o.maxValue,i=o.minValue;a.xScale=Se().domain([i,r]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yLabelArray=e.data.map((function(t){return t[e.stringColumnIndex]})),a.xLabelArray=a.xScale.ticks(),a.barHeight=e.height/e.data.length,a.yTickValues=za(a.barHeight,e.height,a.yLabelArray)})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-bar-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.numberColumnIndex],yCol:a.props.columns[a.props.stringColumnIndex],yTicks:a.yTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,xAxisTitle:a.props.numberAxisTitle,yAxisTitle:a.props.stringAxisTitle,xGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(uo,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(po,"propTypes",Sa),lt(po,"defaultProps",Ta);var mo=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onColumnClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(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,c=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var u=e.props.data.map((function(t,u){var p=0,d=0;return o.map((function(o,m){if(!n[o].isSeriesHidden){var f,g,h=t[o],v=Number(h),y=Number.isNaN(v)?0:v;if(!y)return null;if(y>=0){var b=p+y;g=Math.abs(l(y)-l(0))-.5,f=l(b)+.5,p=b}else{var C=d+y;g=Math.abs(l(y)-l(0))-.5,f=l(d)+.5,d=C}if(g<.05)return null;var E=Va({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return s.createElement("rect",{key:Ra(o,u),className:"bar".concat(e.state.activeKey===Ra(o,u)?" active":""),x:c(t[r]),y:f,width:c.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,o,u)},"data-tip":E,"data-for":e.props.tooltipID,style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return s.createElement("g",{"data-test":"stacked-columns"},u)})),e}return it(n)}();lt(mo,"propTypes",ka),lt(mo,"defaultProps",wa);var fo=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var o=Ia(e.data,e.stringColumnIndex,n),r=o.maxValue,i=o.minValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(e.innerPadding).paddingOuter(e.outerPadding),a.yScale=Se().domain([i,r]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=Bn(a.xScale,e.innerPadding),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-column-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(mo,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(fo,"propTypes",Sa),lt(fo,"defaultProps",Ta);var go=function(e){ct(n,u);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),lt(mt(e),"onDotClick",(function(t,n,a){var o=Ra(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,o),e.setState({activeKey:o})})),lt(mt(e),"createPolygonVertexDot",(function(t,n,a,o,r,i){var l=Va({row:t,columns:e.props.columns,colIndex:r,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return s.createElement("circle",{key:"dot-".concat(Ra(r,i)),className:"vertex-dot".concat(e.state.activeKey===Ra(r,i)?" active":""),cy:o,cx:a,r:4,onClick:function(){return e.onDotClick(t,r,n)},"data-tip":l,"data-for":e.props.tooltipID,style:{opacity:e.state.activeKey===Ra(r,i)?1:0,cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),lt(mt(e),"createPolygon",(function(t,n){var a=e.props.stringColumnIndex,o=n.map((function(e){return e.join(",")})).join(" ");return s.createElement("polygon",{key:"polygon-".concat(Ra(a,t)),points:o,"data-tip":"\n <div>\n <strong>".concat(e.props.legendTitle,"</strong>: ").concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":e.props.tooltipID,"data-effect":"float",style:{fill:e.props.colorScale(t),fillOpacity:1}})})),lt(mt(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=[],c=[],u=r.domain()[0];u<0&&(u=0);var p=[],d=[];return i.domain().forEach((function(e){p.push(u),d.push([i(e),r(u)])})),a.forEach((function(t,a){var s=[],u=[];if(!n[t].isSeriesHidden){e.props.data.forEach((function(n,l){var d=n[t],m=Number(d),f=isNaN(m)?0:m,g=i(n[o]),h=p[l]+f,v=r(h);if(s[l]=h,u.push([g,v]),0!==f){var y=e.createPolygonVertexDot(n,a,g,v,t,l);c.push(y)}}));var m=d.reverse().concat(u);l.push(e.createPolygon(a,m)),p=s,d=u}})),s.createElement("g",{"data-test":"stacked-lines"},l,c)})),e}return it(n)}();lt(go,"propTypes",ka),lt(go,"defaultProps",wa);var ho=function(e){ct(n,u);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),lt(mt(a),"shouldComponentUpdate",(function(){return!0})),lt(mt(a),"componentDidUpdate",(function(e){Ma(e,a.props)&&a.setLongestLabelWidth(a.props)})),lt(mt(a),"setLabelRotationValue",(function(e){var t=Hn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),lt(mt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=zn(a.xTickValues,e.columns[e.stringColumnIndex],Zt(e.dataFormatting))})),lt(mt(a),"setChartData",(function(e){var t,n,o,r=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(r=e.visibleSeriesIndices);var i=Ia(e.data,e.stringColumnIndex,r),l=i.maxValue,s=i.minValue;a.xScale=Ee().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Se().domain([s,l]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(o=n.domain())||void 0===o?void 0:o.length)||1),a.xTickValues=za(a.tickWidth,e.width,a.xScale.domain())})),lt(mt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),s.createElement("g",{"data-test":"react-autoql-stacked-line-chart"},s.createElement(Za,st({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.columns[a.props.numberColumnIndex],xTicks:a.xTickValues,rotateLabels:a.rotateLabels,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,hasXDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleStringColumns,hasYDropdown:a.props.enableDynamicCharting&&a.props.hasMultipleNumberColumns,yAxisTitle:a.props.numberAxisTitle,yGridLines:!0})),a.props.marginAdjustmentFinished&&s.createElement(go,st({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return it(n)}();lt(ho,"propTypes",Sa),lt(ho,"defaultProps",Ta);var vo=function(t){ct(a,u);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"INNER_PADDING",.25),lt(mt(o),"OUTER_PADDING",.5),lt(mt(o),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),lt(mt(o),"componentDidMount",(function(){o.firstRender=!1,o.props.isResizing||o.props.isAnimatingContainer||o.forceUpdate(),o.props.isAnimatingContainer?o.rebuildTooltips(1e3):o.rebuildTooltips()})),lt(mt(o),"shouldComponentUpdate",(function(e,t){return(!e.isResizing||!o.props.isResizing)&&(!o.state.isLoading||!t.isLoading)})),lt(mt(o),"componentDidUpdate",(function(e,t){var n={},a=!1,r=!1,i=o.getChartHeightAndWidth(),l=i.chartHeight,s=i.chartWidth;if(!o.state.isLoading&&o.recursiveUpdateCount<2&&(s!==o.chartWidth||l!==o.chartHeight)&&(a=!0,o.recursiveUpdateCount++,clearTimeout(o.recursiveUpdateTimeout),o.recursiveUpdateTimeout=setTimeout((function(){o.recursiveUpdateCount=0}),500)),o.chartHeight=l,o.chartWidth=s,!o.props.isResizing&&e.isResizing&&o.chartContainerRef&&(o.chartContainerRef.style.flexBasis="100vh",a=!0),o.props.type!==e.type&&o.rebuildTooltips(),Aa(o.props,e)&&(r=!0,o.props.isPivot||(n.aggregatedData=o.aggregateRowData(o.props)),o.rebuildTooltips()),!pe(n))return a=!1,void o.setState(n,(function(){r&&o.updateMargins()}));r?o.updateMargins():a&&o.forceUpdate()})),lt(mt(o),"componentWillUnmount",(function(){clearTimeout(o.recursiveUpdateTimeout),o.getNewMargins&&o.getNewMargins.cancel(),o.legend=void 0,o.xAxis=void 0,o.axes=void 0})),lt(mt(o),"getChartHeightAndWidth",(function(){var e,t,n,a,r=(null===(e=o.chartContainerRef)||void 0===e?void 0:e.offsetWidth)>=0?null===(t=o.chartContainerRef)||void 0===t?void 0:t.offsetWidth:0;return{chartHeight:(null===(n=o.chartContainerRef)||void 0===n?void 0:n.offsetHeight)>=0?null===(a=o.chartContainerRef)||void 0===a?void 0:a.offsetHeight:0,chartWidth:r}})),lt(mt(o),"aggregateRowData",(function(e){var t=e.stringColumnIndex,n=e.numberColumnIndices,a=De(e.data,(function(e){return null==e?void 0:e[t]})),o=[],r=ce(a[0]);return a.forEach((function(e,i){var l;if(!(0===i&&i<a.length-1)){if((null==e?void 0:e[t])!==(null===(l=r)||void 0===l?void 0:l[t]))o.push(r),r=ce(e);else{var s=ce(e);n.forEach((function(e){var t=Number(s[e]),n=Number(r[e]);isNaN(t)&&(t=0),isNaN(n)&&(n=0),s[e]=t+n})),r=s}i===a.length-1&&o.push(r)}})),o})),lt(mt(o),"getNewLeftMargin",(function(e,t){var n=e.x,a=t.x+n,r=o.state.leftMargin;return r+=n-a+o.Y_AXIS_LABEL_WIDTH+o.PADDING})),lt(mt(o),"getNewRightMargin",(function(e,t,n){var a=t.x+e.x+t.width-(e.x+e.width),r=n-o.state.leftMargin,i=e.width-r,l=o.state.rightMargin+a+o.PADDING;o.state.rightMargin;return l<i?l:o.PADDING})),lt(mt(o),"getLegendLabels",(function(){return 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(n,a){var o=e[n];return{label:o.title,color:t(a),hidden:o.isSeriesHidden,columnIndex:n,column:o}}));return a}catch(e){return console.error(e),[]}}(o.props.columns,o.colorScale,o.props.numberColumnIndices)})),lt(mt(o),"getNewBottomMargin",(function(t){var n;o.legend=xe(o.chartRef).select(".legendOrdinal").node(),n=o.legend?o.legend.getBBox():void 0;var a=0;"bottom"===Qa(o.props.numberColumnIndices,o.props.type)&&e(n,"height")&&(a=n.height+10),o.xAxis=xe(o.chartRef).select(".axis-Bottom").node();var r=o.xAxis?o.xAxis.getBBox():{},i=Math.ceil(r.height)+a+40;(0===r.height&&(i=463),"bar"===o.props.type||"stacked_bar"===o.props.type)&&(i=i-(t.height-o.state.topMargin-o.state.bottomMargin)+10);return i||o.state.bottomMargin})),lt(mt(o),"getNewTopMargin",(function(){return o.PADDING})),lt(mt(o),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;o.props.rebuildTooltips?o.props.rebuildTooltips(e):(clearTimeout(o.rebuildTooltipsTimer),o.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e))})),lt(mt(o),"updateMargins",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.setLoading,n=void 0===t||t,a=e.delay,r=void 0===a?100:a;!o.state.isLoading&&n&&o.setState({isLoading:!0}),clearTimeout(o.updateMarginsDebounced),o.updateMarginsDebounced=setTimeout((function(){o.updateMarginsToDebounce()}),r)})),lt(mt(o),"updateMarginsToDebounce",(function(){o.newMargins=void 0;try{if(o.axes=document.querySelector("#react-autoql-chart-".concat(o.CHART_ID," .react-autoql-axes")),!o.chartContainerRef||!o.axes)return void o.clearLoading();var e=o.chartContainerRef.getBoundingClientRect(),t=o.axes.getBBox(),n=o.getNewLeftMargin(e,t),a=o.getNewRightMargin(e,t,n),r=o.getNewTopMargin(),i=o.getNewBottomMargin(e,t);o.newMargins={leftMargin:n,topMargin:r,rightMargin:a,bottomMargin:i},o.isMarginDiffSignificant=o.isMarginDifferenceSignificant(),o.isMarginDiffSignificant?(o.marginAdjustmentFinished=!0,o.setState($e({},o.newMargins),(function(){o.clearLoading()}))):(o.marginAdjustmentFinished=!0,o.clearLoading())}catch(e){console.error(e),o.marginAdjustmentFinished=!0,o.clearLoading()}})),lt(mt(o),"clearLoading",(function(){clearTimeout(o.loadingTimeout),o.loadingTimeout=setTimeout((function(){o.setState({isLoading:!1})}),100)})),lt(mt(o),"isMarginDifferenceSignificant",(function(){if(!o.newMargins)return!1;var e=o.newMargins,t=e.leftMargin,n=e.topMargin,a=e.rightMargin,r=e.bottomMargin,i=Math.abs(t-o.state.leftMargin),l=Math.abs(n-o.state.topMargin),s=Math.abs(a-o.state.rightMargin),c=Math.abs(r-o.state.bottomMargin);return i>10||l>10||s>10||c>10})),lt(mt(o),"getBase64Data",(function(){var e=o.chartRef;return e?kn(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),lt(mt(o),"saveAsPNG",(function(){var e=o.chartRef;e&&kn(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)}))})),lt(mt(o),"getStringAxisTitle",(function(){var e,t=o.props,n=t.columns,a=t.stringColumnIndex;return null==n||null===(e=n[a])||void 0===e?void 0:e.display_name})),lt(mt(o),"getNumberAxisTitle",(function(){var t=o.props,n=t.columns,a=t.numberColumnIndices;try{var r=n.filter((function(e,t){return a.includes(t)}));if(null==r||!r.length)return;if(!r.find((function(e){return e.display_name!==r[0].display_name})))return e(r,"[0].display_name");var i=e(r,"[0].type");return"DOLLAR_AMT"===i?"Amount":"QUANTITY"===i?"Quantity":"RATIO"===i?"Ratio":"PERCENT"===i?"Percent":void 0}catch(e){return void console.error(e)}})),lt(mt(o),"getCommonChartProps",(function(){var e,t,n=o.state,a=n.topMargin,r=n.bottomMargin,i=n.rightMargin,l=n.leftMargin,s=n.bottomLegendMargin,c=o.props,u=c.numberColumnIndices,p=c.columns,d=o.INNER_PADDING;u.length>1&&(d=.1);var m=hn(p),f=m.amountOfNumberColumns>1,g=m.amountOfStringColumns>1,h=u.filter((function(e){return(null==p?void 0:p[e])&&!p[e].isSeriesHidden})),v=o.getChartHeightAndWidth(),y=v.chartHeight,b=v.chartWidth;return $e($e({},o.props),{},(lt(t={key:void 0,data:o.state.aggregatedData||o.props.data,colorScale:o.colorScale,innerPadding:d,outerPadding:o.OUTER_PADDING},"colorScale",o.colorScale),lt(t,"height",y),lt(t,"width",b),lt(t,"topMargin",a),lt(t,"bottomMargin",r),lt(t,"rightMargin",i),lt(t,"leftMargin",l),lt(t,"bottomLegendMargin",s),lt(t,"hasMultipleNumberColumns",f),lt(t,"hasMultipleStringColumns",g),lt(t,"marginAdjustmentFinished",o.state.loading),lt(t,"legendTitle",(null===(e=o.props.legendColumn)||void 0===e?void 0:e.title)||"Category"),lt(t,"legendLocation",Qa(u,o.props.type)),lt(t,"legendLabels",o.getLegendLabels()),lt(t,"visibleSeriesIndices",h),lt(t,"numberAxisTitle",o.getNumberAxisTitle()),lt(t,"stringAxisTitle",o.getStringAxisTitle()),lt(t,"onStringColumnSelect",o.onStringColumnSelect),lt(t,"onLabelChange",o.updateMargins),lt(t,"tooltipID",o.props.tooltipID),t))})),lt(mt(o),"moveIndexToFront",(function(e,t){var n=ce(t),a=t[e];return n.slice(e,e+1),n.unshift(a),n})),lt(mt(o),"renderColumnChart",(function(e){return s.createElement(eo,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderBarChart",(function(e){return s.createElement(no,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderLineChart",(function(e){return s.createElement(oo,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderPieChart",(function(){return s.createElement(ro,o.getCommonChartProps())})),lt(mt(o),"renderHeatmapChart",(function(){return s.createElement(lo,o.getCommonChartProps())})),lt(mt(o),"renderBubbleChart",(function(){return s.createElement(co,o.getCommonChartProps())})),lt(mt(o),"renderStackedColumnChart",(function(){return s.createElement(fo,o.getCommonChartProps())})),lt(mt(o),"renderStackedBarChart",(function(e){return s.createElement(po,o.getCommonChartProps({dataType:e}))})),lt(mt(o),"renderStackedLineChart",(function(){return s.createElement(ho,o.getCommonChartProps())})),lt(mt(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();default:return"Unknown Display Type"}})),lt(mt(o),"render",(function(){var t=o.getChartHeightAndWidth(),n=t.chartHeight,a=t.chartWidth;return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-chart-".concat(o.CHART_ID),ref:function(e){return o.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container ".concat(o.state.isLoading||o.props.isAnimatingContainer||o.props.isResizing?"loading":""),style:{flexBasis:n?"".concat(n,"px"):"100vh"}},!o.firstRender&&!o.props.isAnimatingContainer&&s.createElement(c,null,s.createElement("svg",{ref:function(e){return o.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:a,height:n,style:{fontFamily:e(en(o.props.themeConfig),"font-family","sans-serif"),color:e(en(o.props.themeConfig),"text-color-primary","inherit"),background:e(en(o.props.themeConfig),"background-color","inherit")}},s.createElement("g",{className:"react-autoql-chart-content-container"},o.renderChart())))))}));var r=en(t.themeConfig).chartColors;return o.CHART_ID=d(),o.Y_AXIS_LABEL_WIDTH=15,o.X_AXIS_LABEL_HEIGHT=15,o.PADDING=20,o.firstRender=!0,o.recursiveUpdateCount=0,o.colorScale=Ce().range(r),o.state={aggregatedData:t.isPivot?void 0:o.aggregateRowData(t),leftMargin:o.PADDING,rightMargin:o.PADDING,topMargin:o.PADDING,bottomMargin:o.PADDING,bottomLegendMargin:0,loading:!0},o}return it(a)}();lt(vo,"propTypes",$e($e({},Ca),{},{rebuildTooltips:p.func,type:p.string.isRequired})),lt(vo,"defaultProps",Ea);var yo=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"ID",d()),lt(mt(t),"state",{isOpen:!1}),lt(mt(t),"render",(function(){return t.props.options?s.createElement(yt,null,s.createElement(me,{isOpen:t.state.isOpen,position:"bottom",padding:0,onClickOutside:function(){return t.setState({isOpen:!1})},content:function(e){return e.position,e.nudgedLeft,e.nudgedTop,e.targetRect,e.popoverRect,s.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},s.createElement(le,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-drawer-tooltip",effect:"solid",delayShow:500}),s.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){return s.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":"select-tooltip-".concat(t.ID)},e.listLabel||e.label)}))))}},s.createElement("div",{className:"react-autoql-select ".concat(t.props.className),"data-test":"react-autoql-select",onClick:function(){return t.setState({isOpen:!t.state.isOpen})},style:t.props.style},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",s.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item"))))):null})),t}return it(a)}();lt(yo,"propTypes",{themeConfig:St,onChange:p.func,options:p.arrayOf(p.shape({})),popupClassname:p.string,value:p.string,label:p.string,size:p.string}),lt(yo,"defaultProps",{themeConfig:Xt,onChange:function(){},options:[],popupClassname:void 0,value:void 0,label:void 0,size:"large",style:{}});var bo=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),lt(mt(t),"suggestionLists",[]),lt(mt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),lt(mt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),lt(mt(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 $e({id:d(),hidden:!1},e)})),r=[].concat(ht(o),[{id:d(),text:a}]);n.push(r)})),n})),lt(mt(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})),lt(mt(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})),lt(mt(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)}}))}})),lt(mt(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||d()})),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:ce(e)})})),lt(mt(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()})),lt(mt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var a=t.suggestionLists[n].find((function(t){return t.id===e})),o=ce(t.state.selectedSuggestions);o[n]=a,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(o),o),t.updateStartAndEndIndexes(o),t.setState({selectedSuggestions:ce(o)})}else t.deleteQueryValidationSuggestion(n)})),lt(mt(t),"deleteQueryValidationSuggestion",(function(e){var n=ce(t.state.selectedSuggestions.map((function(t,n){return n===e?$e($e({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:ce(n)})})),lt(mt(t),"renderWordSelector",(function(e){var n=ce(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="".concat(n.label," (Original term)"):n.listLabel="".concat(e.text).concat(e.value_label?" (".concat(e.value_label,")"):""),o.push(n)}})),o.push({value:"remove-word",label:s.createElement("span",null,s.createElement(Kt,{type:"trash"})," Remove term")}),s.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},s.createElement(yo,{themeConfig:t.props.themeConfig,options:o,key:d(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),lt(mt(t),"renderQueryValidationQuery",(function(){return s.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var a=s.createElement("span",{key:"query-element-".concat(n)},e),o=t.renderWordSelector(n);return s.createElement("span",{key:d()},a,o)})))})),lt(mt(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})),lt(mt(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?s.createElement("div",{className:"react-autoql-query-validation-container"},s.createElement("div",{className:"react-autoql-query-validation-description"},s.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:")),s.createElement("div",null,t.renderQueryValidationQuery(),s.createElement("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},s.createElement(Kt,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return it(a)}();lt(bo,"propTypes",{themeConfig:St,response:p.shape({}),onSuggestionClick:p.func,autoSelectSuggestion:p.bool,isQueryRunning:p.bool,initialSelections:p.arrayOf(p.shape({})),onQueryValidationSelectOption:p.func,message:p.string}),lt(bo,"defaultProps",{themeConfig:Xt,response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var Co=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=r[0].length+r.index,c=e.substring(r.index,s),u=So(c);if(a=s,o.push({c_type:n,eng:u}),i===t.length-1&&s<e.length){var p=e.substring(s,e.length);o.push({c_type:"TEXT",eng:p})}})),o}(a,o,"VALUE_LABEL"):[Eo(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}},Eo=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=n(e).utc().format("ll");if("Invalid Date"!==t)return t}return e})).join(" ")}}catch(t){return{c_type:"TEXT",eng:e.eng}}},So=function(e){return e.substring(1,e.length-1).replace("''","'")},To=function(n){ct(o,s.Component);var a=gt(o);function o(n){var r;return ot(this,o),lt(mt(r=a.call(this,n)),"componentDidMount",(function(){r._isMounted=!0,r.props.onValueLabelClick&&r.validateAndUpdateValueLabels()})),lt(mt(r),"shouldComponentUpdate",(function(e){return!r.props.isResizing||!e.isResizing})),lt(mt(r),"componentWillUnmount",(function(){r._isMounted=!1})),lt(mt(r),"validateAndUpdateValueLabels",(function(){if(r.reverseTranslationArray.length){var n=[],a=t(r.reverseTranslationArray);r.reverseTranslationArray.forEach((function(t,o){"VALUE_LABEL"===t.c_type&&n.push(ra($e({suggestion:t.eng},Jt(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.reverseTranslationArray=a,r.setState({isValidated:!0}))}))}})),lt(mt(r),"renderFilterLockLink",(function(e){return s.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)&&s.createElement(Kt,{type:"lock"})," ",s.createElement("span",null,e))})),lt(mt(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)}})),lt(mt(r),"render",(function(){return e(r.reverseTranslationArray,"length")?s.createElement(yt,null,s.createElement("div",{id:r.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},s.createElement("div",{className:"react-autoql-reverse-translation"},s.createElement(Kt,{type:"info"}),s.createElement("strong",null," Interpreted as: "),r.reverseTranslationArray.map((function(e,t){return s.createElement("span",{key:"rt-item-".concat(r.COMPONENT_KEY,"-").concat(t)},r.renderInterpretationChunk(e))}))))):null})),r.COMPONENT_KEY=d(),r.reverseTranslationArray=function(t){try{if(!t)return;var n=[];return e(t,"length")&&t.forEach((function(e){"FILTER"===e.c_type?Co(e).forEach((function(e){n.push(e)})):n.push(e)})),n}catch(e){return void console.error(e)}}(n.reverseTranslation),r.state={isValidated:!1},r}return it(o)}();lt(To,"propTypes",{authentication:bt,themeConfig:St,interpretation:p.array,onValueLabelClick:p.func,appliedFilters:p.array,reverseTranslation:p.array}),lt(To,"defaultProps",{authentication:Gt,themeConfig:Xt,interpretation:[],appliedFilters:[],reverseTranslation:[],onValueLabelClick:void 0}),String.prototype.isUpperCase=function(){return this.valueOf().toUpperCase()===this.valueOf()},String.prototype.toProperCase=function(){return this.replace(/\w\S*/g,(function(e){return e.isUpperCase()?e:e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}))};var Do=function(t){ct(o,s.Component);var a=gt(o);function o(t){var r,i,u;if(ot(this,o),lt(mt(u=a.call(this,t)),"componentDidMount",(function(){u._isMounted=!0,u.props.onUpdate();try{var e;null!==(e=u.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&u.props.optionsToolbarRef.forceUpdate(),u.isCurrentDisplayTypeValid(u.props)||u.onRecommendedDisplayType(Fn(u.queryResponse,u.props.autoChartAggregations)),u.props.onSupportedDisplayTypesChange(u.supportedDisplayTypes)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),lt(mt(u),"shouldComponentUpdate",(function(e){return!u.props.isResizing||!e.isResizing})),lt(mt(u),"componentDidUpdate",(function(e,t){try{var n;if(!se(u.props.tableConfigs,{tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig})&&u.props.onTableConfigChange&&u.props.onTableConfigChange({tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig}),e.themeConfig&&u.props.themeConfig&&!se(en(u.props.themeConfig),en(e.themeConfig))&&_n(u.props.themeConfig),u.props.queryResponse&&!u.queryResponse)if(u.queryResponse=ce(u.props.queryResponse),u.isCurrentDisplayTypeValid(u.props))u.setResponseData(),u.forceUpdate();else{var a=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(a)}if(!e.displayType&&u.props.displayType)if(le.hide(),u.isCurrentDisplayTypeValid(u.props))u.tableData||(u.setResponseData(),u.forceUpdate());else{var o=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(o)}if(u.props.displayType!==e.displayType&&!u.isCurrentDisplayTypeValid(u.props)){var r=Fn(u.queryResponse,u.props.autoChartAggregations);u.onRecommendedDisplayType(r)}!t.isContextMenuOpen&&u.state.isContextMenuOpen?ye.on():t.isContextMenuOpen&&!u.state.isContextMenuOpen&&ye.off(),u.state.visibleRows!==t.visibleRows?(u.shouldGeneratePivotData(u.state.visibleRows)&&u.generatePivotData({isFirstGeneration:!0,newTableData:u.state.visibleRows}),u.setSupportedDisplayTypes(u.getCurrentSupportedDisplayTypes())):u.usePivotDataForChart()&&u.state.visiblePivotRows!==t.visiblePivotRows&&u.setSupportedDisplayTypes(u.getCurrentSupportedDisplayTypes()),null!==(n=u.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&u.props.optionsToolbarRef.forceUpdate(),u.props.onUpdate()}catch(e){console.error(e)}})),lt(mt(u),"componentWillUnmount",(function(){u._isMounted=!1,le.hide(),clearTimeout(u.rebuildTooltipsTimer)})),lt(mt(u),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;u.props.rebuildTooltips?u.props.rebuildTooltips(e):(clearTimeout(u.rebuildTooltipsTimer),u.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e))})),lt(mt(u),"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})),lt(mt(u),"supportsPivot",(function(){return u.supportedDisplayTypes.includes("pivot_table")})),lt(mt(u),"supportsDatePivot",(function(){return u.supportsPivot()&&2===u.tableColumns.length})),lt(mt(u),"usePivotDataForChart",(function(){return u.supportsPivot()&&!u.supportsDatePivot()})),lt(mt(u),"onRecommendedDisplayType",(function(e){u.props.onRecommendedDisplayType(e,u.supportedDisplayTypes)})),lt(mt(u),"isTableConfigValid",(function(t){try{if(!t||!t.numberColumnIndices||!t.stringColumnIndices||Number.isNaN(Number(t.numberColumnIndex))||Number.isNaN(Number(t.stringColumnIndex)))return!1;if(!Array.isArray(t.numberColumnIndices)||!Array.isArray(t.stringColumnIndices))return!1;var n=e(u.queryResponse,"data.data.columns");return!!t.numberColumnIndices.every((function(e){return n[e]&&cn(n[e])}))&&!!t.stringColumnIndices.every((function(e){return n[e]&&un(n[e])}))}catch(e){return!1}})),lt(mt(u),"updateColumns",(function(t){var n;e(u.queryResponse,"data.data.columns")&&(u.queryResponse.data.data.columns=t);var a=u.getCurrentSupportedDisplayTypes();u.setSupportedDisplayTypes(a,void 0,"table"),u.tableConfig=void 0,u.shouldGenerateTableData()&&(u.generateTableData(t),u.shouldGeneratePivotData()&&u.generatePivotTableData({isFirstGeneration:!0})),e(u.tableRef,"ref.table")&&u.tableRef.ref.table.setColumns(u.tableColumns),null!==(n=u.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&u.props.optionsToolbarRef.forceUpdate(),"text"===u.props.displayType?u.onRecommendedDisplayType("table"):u.forceUpdate()})),lt(mt(u),"generateAllData",(function(t,n){e(t,"data.data")&&n&&u.shouldGenerateTableData()&&(u.generateTableData(),u.shouldGeneratePivotData()&&u.generatePivotData({isFirstGeneration:!0}))})),lt(mt(u),"setResponseData",(function(){u.queryID=e(u.queryResponse,"data.data.query_id"),u.interpretation=e(u.queryResponse,"data.data.interpretation"),u.generateAllData(u.queryResponse,u.props.displayType)})),lt(mt(u),"shouldGeneratePivotData",(function(e){return(e||u.tableData)&&u.supportsPivot()})),lt(mt(u),"shouldGenerateTableData",(function(){return e(u.queryResponse,"data.data.rows.length")})),lt(mt(u),"dateSortFn",(function(e,t){try{if(!e&&!t)return 0;if(!e&&t)return 1;if(e&&!t)return-1;var a=Number(e),o=Number(t);if((Number.isNaN(a)||Number.isNaN(o))&&(a=n(e).unix(),o=n(t).unix()),!a||!o){if(e.includes("-W")){var r=e.substring(0,4),i=t.substring(0,4);if(r!==i)return i-r;var l=e.substring(6,8);return t.substring(6,8)-l}if(on.includes(e.trim())){var s=on.findIndex((function(t){return t===e.trim()})),c=on.findIndex((function(e){return e===t.trim()}));return s>=0&&c>=0?c-s:t-e}if(an.includes(e.trim())){var u=an.findIndex((function(t){return t===e.trim()})),p=an.findIndex((function(e){return e===t.trim()}));return u>=0&&p>=0?p-u:t-e}}return o-a}catch(e){return console.error(e),-1}})),lt(mt(u),"sortTableDataByDate",(function(e){try{if(!e||"object"!==tt(e))return;var t=fn(u.tableColumns);return t>=0?ht(e).sort((function(e,n){return u.dateSortFn(e[t],n[t])})):e}catch(t){return console.error(t),e}})),lt(mt(u),"generateTableData",(function(e,t){var n,a,o;t?u.tableData=t:(u.tableID=d(),u.tableColumns=u.formatColumnsForTable(e),u.tableData=u.sortTableDataByDate(null===(n=u.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.rows),u.setTableConfig())})),lt(mt(u),"generatePivotData",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isFirstGeneration,n=e.newTableData;try{u.pivotTableID=d();var a=n||u.tableData;2===u.tableColumns.length?u.generateDatePivotData(a):u.generatePivotTableData({isFirstGeneration:t,newTableData:n})}catch(e){console.error(e),u.props.onErrorCallback(e),u.pivotTableData=void 0}})),lt(mt(u),"renderSuggestionMessage",(function(e,t){var n;try{n=s.createElement("div",{className:"react-autoql-suggestion-message"},s.createElement("div",{className:"react-autoql-suggestions-container"},u.props.renderSuggestionsAsDropdown?s.createElement("select",{key:d(),onChange:function(e){u._isMounted&&(u.setState({selectedSuggestion:e.target.value}),u.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:u.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return s.createElement("option",{key:d(),value:e},e)}))):e.map((function(e){return s.createElement("div",{key:d()},s.createElement("button",{onClick:function(){return u.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t})},className:"react-autoql-suggestion-btn"},e),s.createElement("br",null))}))))}catch(e){return s.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return u.props.renderFullSuggestionMessage?s.createElement("div",{style:{textAlign:"center"}},u.renderError(u.queryResponse),n):n})),lt(mt(u),"renderSingleValueResponse",(function(){return s.createElement("div",{className:"single-value-response-container"},s.createElement("a",{className:"single-value-response ".concat($t(u.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){return u.processDrilldown({groupBys:[],supportedByAPI:!0})}},Tn({element:e(u.queryResponse,"data.data.rows[0][0]"),column:e(u.queryResponse,"data.data.columns[0]"),config:Zt(u.props.dataFormatting)})))})),lt(mt(u),"copyTableToClipboard",(function(){var e,t;"table"===u.props.displayType&&null!==(e=u.tableRef)&&void 0!==e&&e._isMounted?u.tableRef.copyToClipboard():"pivot_table"===u.props.displayType&&null!==(t=u.pivotTableRef)&&void 0!==t&&t._isMounted&&u.pivotTableRef.copyToClipboard()})),lt(mt(u),"getBase64Data",(function(){var e,t;if(u.chartRef&&An(u.props.displayType))return u.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=u.tableRef)&&void 0!==e&&e._isMounted&&"table"===u.props.displayType){var n=u.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=u.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===u.props.displayType){var a=u.pivotTableRef.getBase64Data();return Promise.resolve(a)}})),lt(mt(u),"saveChartAsPNG",(function(){u.chartRef&&u.chartRef.saveAsPNG()})),lt(mt(u),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var a,o=null===(a=u.tableData)||void 0===a?void 0:a.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=ce(u.queryResponse);return r.data.data.rows=o,r}catch(e){console.error(e)}})),lt(mt(u),"processDrilldown",function(){var e=at(et().mark((function e(t){var n,a,o,r,i,l,s;return et().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,!$t(u.props.autoQLConfig).enableDrilldowns){e.next=24;break}if(e.prev=2,!a){e.next=17;break}return u.props.onDrilldownStart(r),e.prev=5,e.next=8,aa($e($e($e({},Jt(u.props.authentication)),$t(u.props.autoQLConfig)),{},{queryID:u.queryID,groupBys:n}));case 8:l=e.sent,u.props.onDrilldownEnd({response:l}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),u.props.onDrilldownEnd({response:e.t0});case 15:e.next=18;break;case 17:!isNaN(i)&&null!=o&&o.length&&(u.props.onDrilldownStart(r),s=u.getFilterDrilldown({stringColumnIndex:i,row:o}),setTimeout((function(){u.props.onDrilldownEnd({response:s})}),1500));case 18:e.next=24;break;case 20:e.prev=20,e.t1=e.catch(2),console.error(e.t1),u.props.onDrilldownEnd({error:"Error processing drilldown"});case 24:case"end":return e.stop()}}),e,null,[[2,20],[5,12]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(u),"onTableCellClick",(function(e){var t={};t=u.pivotTableColumns&&"pivot_table"===u.props.displayType?function(e){try{var t,n,a,o=[],r=null==e||null===(t=e.getColumn())||void 0===t?void 0:t.getDefinition(),i=e.getData()[0],l=null===(n=r.origValues)||void 0===n?void 0:n[i].name,s=null===(a=r.origValues)||void 0===a?void 0:a[i].value;if(o.push({name:l,value:s}),null!=r&&r.origPivotColumn){var c,u=r.name,p=null===(c=r.origPivotColumn)||void 0===c?void 0:c.name;o.push({name:p,value:u})}return o}catch(e){return void console.error(e)}}(e):function(e,t){if(e&&t){var n=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t}(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,u.tableColumns),u.processDrilldown({groupBys:t,supportedByAPI:!!t})})),lt(mt(u),"onChartClick",(function(e,t,n,a,o,r){var i,l,s=[],c=n[t],p=(null==n||null===(i=n[a])||void 0===i?void 0:i.origColumn)||(null==n?void 0:n[a]);if(null!=n&&null!==(l=n[a])&&void 0!==l&&l.datePivot){var d,m,f,g=Number(null==n||null===(d=n[t])||void 0===d?void 0:d.name),h=null==e?void 0:e[a],v="".concat(null===(m=u.pivotOriginalColumnData)||void 0===m||null===(f=m[g])||void 0===f?void 0:f[h]);s.push({name:p.name,value:v})}else null!=p&&p.groupable&&s.push({name:p.name,value:"".concat(null==e?void 0:e[a])});null!=o&&o.groupable&&c.origColumn&&s.push({name:o.name,value:"".concat(null==c?void 0:c.name)}),s.length,u.processDrilldown({groupBys:s,supportedByAPI:!!s.length,row:e,activeKey:r,stringColumnIndex:a})})),lt(mt(u),"toggleTableFilter",(function(e){var t,n,a=e.isFilteringTable;"table"===u.props.displayType&&((null===(t=u.tableRef)||void 0===t?void 0:t._isMounted)&&u.tableRef.toggleTableFilter({isFilteringTable:a}));"pivot_table"===u.props.displayType&&((null===(n=u.pivotTableRef)||void 0===n?void 0:n._isMounted)&&u.pivotTableRef.toggleTableFilter({isFilteringTable:a}))})),lt(mt(u),"onNewPage",(function(e){try{u.tableData=[].concat(ht(u.tableData),ht(e))}catch(e){console.error(e)}})),lt(mt(u),"onNewData",(function(e){u.tableData=e})),lt(mt(u),"onTableFilter",function(){var e=at(et().mark((function e(t,n){var a,o;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t&&t.length||null!=n&&n.length){e.next=2;break}return e.abrupt("return");case 2:"table"!==(a=u.props.displayType)&&"pivot_table"!==a||(o=[],n.forEach((function(e){o.push(e.getData())})),"table"===a?(u.headerFilters=t,u.setState({visibleRows:o})):"pivot_table"===a&&(u.pivotHeaderFilters=t,u.setState({visiblePivotRows:o})));case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),lt(mt(u),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex;if("pie"===u.props.displayType)u.onPieChartLegendClick(e);else{var n=u.supportsPivot()?ht(u.pivotTableColumns):ht(u.tableColumns);n[t].isSeriesHidden=!n[t].isSeriesHidden,u.supportsPivot()?u.pivotTableColumns=n:u.tableColumns=n}u.forceUpdate()})),lt(mt(u),"onPieChartLegendClick",(function(e){})),lt(mt(u),"onChangeStringColumnIndex",(function(e){u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.legendColumnIndex===e&&(u.pivotTableConfig.legendColumnIndex=void 0),u.pivotTableConfig.stringColumnIndex=e,u.generatePivotTableData()):(u.tableConfig.legendColumnIndex===e&&(u.tableConfig.legendColumnIndex=void 0),u.tableConfig.stringColumnIndex=e),u.forceUpdate()})),lt(mt(u),"onChangeLegendColumnIndex",(function(e){u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.stringColumnIndex===e&&(u.pivotTableConfig.stringColumnIndex=void 0),u.pivotTableConfig.legendColumnIndex=e,u.generatePivotTableData()):(u.tableConfig.stringColumnIndex===e&&(u.tableConfig.stringColumnIndex=void 0),u.tableConfig.legendColumnIndex=e),u.forceUpdate()})),lt(mt(u),"onChangeNumberColumnIndices",(function(e){e&&(u.supportsPivot()&&!u.supportsDatePivot()?(u.pivotTableConfig.numberColumnIndices=e,u.pivotTableConfig.numberColumnIndex=e[0]):(u.tableConfig.numberColumnIndices=e,u.tableConfig.numberColumnIndex=e[0]),u.forceUpdate())})),lt(mt(u),"setPivotTableConfig",(function(e){var t=u.pivotTableColumns;if(t){if(u.pivotTableConfig||(u.pivotTableConfig={}),e||!u.pivotTableConfig.stringColumnIndices||!(u.pivotTableConfig.stringColumnIndex>=0)){var n=gn(t),a=n.stringColumnIndices,o=n.stringColumnIndex;u.pivotTableConfig.stringColumnIndices=a,u.pivotTableConfig.stringColumnIndex=o}if(e||!u.pivotTableConfig.numberColumnIndices){var r=dn(t),i=r.numberColumnIndex,l=r.numberColumnIndices;u.pivotTableConfig.numberColumnIndices=l,u.pivotTableConfig.numberColumnIndex=i}}})),lt(mt(u),"setTableConfig",(function(){var e=u.tableColumns;if(e){if(u.tableConfig||(u.tableConfig={}),!(u.tableConfig.stringColumnIndices&&u.tableConfig.stringColumnIndex>=0)){var t=gn(e),n=t.stringColumnIndices,a=t.stringColumnIndex;u.tableConfig.stringColumnIndices=n,u.tableConfig.stringColumnIndex=a}if(!(u.tableConfig.numberColumnIndices&&u.tableConfig.numberColumnIndex>=0)){var o=dn(e),r=o.numberColumnIndex,i=o.numberColumnIndices;u.tableConfig.numberColumnIndices=i,u.tableConfig.numberColumnIndex=r}var l=u.tableColumns.findIndex((function(e,t){return e.groupable&&t!==u.tableConfig.stringColumnIndex}));l>=0&&(u.tableConfig.legendColumnIndex=l),u.props.onTableConfigChange({tableConfig:u.tableConfig,pivotTableConfig:u.pivotTableConfig})}})),lt(mt(u),"isCurrentDisplayTypeValid",(function(e,t){var n,a,o,r,i,l,s,c,p=null!==(n=u.state)&&void 0!==n&&n.visibleRows?null===(a=u.state)||void 0===a||null===(o=a.visibleRows)||void 0===o?void 0:o.length:null===(r=u.tableData)||void 0===r?void 0:r.length,d=null!==(i=u.state)&&void 0!==i&&i.visiblePivotRows?null===(l=u.state)||void 0===l||null===(s=l.visiblePivotRows)||void 0===s?void 0:s.length:null===(c=u.pivotTableData)||void 0===c?void 0:c.length;return Ln(u.queryResponse,e.displayType,p,d)})),lt(mt(u),"getCurrentSupportedDisplayTypes",(function(){var e,t,n,a,o,r,i,l,s=null!==(e=u.state)&&void 0!==e&&e.visibleRows?null===(t=u.state)||void 0===t||null===(n=t.visibleRows)||void 0===n?void 0:n.length:null===(a=u.tableData)||void 0===a?void 0:a.length,c=null!==(o=u.state)&&void 0!==o&&o.visiblePivotRows?null===(r=u.state)||void 0===r||null===(i=r.visiblePivotRows)||void 0===i?void 0:i.length:null===(l=u.pivotTableData)||void 0===l?void 0:l.length;return Pn({response:u.queryResponse,dataLength:s,pivotDataLength:c})})),lt(mt(u),"setSupportedDisplayTypes",(function(e,t,n){!e||!t&&se(e,u.supportedDisplayTypes)||(u.supportedDisplayTypes=e,n&&n!==u.props.displayType&&u.supportedDisplayTypes.includes(n)?u.onRecommendedDisplayType(n):u.supportedDisplayTypes.includes(u.props.displayType)||u.onRecommendedDisplayType(Fn(u.queryResponse)),u.props.onSupportedDisplayTypesChange(u.supportedDisplayTypes))})),lt(mt(u),"getTooltipDataForCell",(function(e,t,n){var a=null;try{if(u.supportsPivot()){var o=u.tableColumns[u.tableConfig.stringColumnIndex],r=u.tableColumns[u.tableConfig.numberColumnIndex],i=u.tableColumns[u.tableConfig.legendColumnIndex],l="<div>\n <strong>".concat(u.pivotTableColumns[0].title,":</strong>").concat(Tn({element:e[0],column:u.pivotTableColumns[0],config:Zt(u.props.dataFormatting)}),"\n </div>"),s="<span></span>";i?s="<div><strong>".concat(i.title,":</strong> ").concat(u.pivotTableColumns[t].title,"</div>"):o&&(s="<div><strong>".concat(o.title,":</strong> ").concat(u.pivotTableColumns[t].title,"</div>"));var c="<div>\n <strong>".concat(r.title,":</strong> ").concat(Tn({element:e[t]||0,column:r,config:Zt(u.props.dataFormatting)}),"\n </div>");a="<div>\n ".concat(l,"\n ").concat(s,"\n ").concat(c,"\n </div>")}else{var p=u.tableColumns[u.tableConfig.stringColumnIndex],d=u.tableColumns[t];a="<div>\n <div>\n <strong>".concat(p.title,":</strong> ").concat(Tn({element:e[u.tableConfig.stringColumnIndex],column:p,config:Zt(u.props.dataFormatting)}),"\n </div>\n <div>\n <div>\n <strong>").concat(d.title,":</strong> ").concat(Tn({element:n||e[t]||0,column:d,config:Zt(u.props.dataFormatting)}),"\n </div>\n </div>")}return a}catch(e){return console.error(e),null}})),lt(mt(u),"getDrilldownDataForCell",(function(t,n){var a=wn(u.tableColumns)>0;return u.supportsPivot()?{supportedByAPI:a,data:[{name:e(u.pivotTableColumns,"[0].name"),value:"".concat(t[0])},{name:e(u.tableColumns,"[".concat(u.tableConfig.legendColumnIndex,"].name")),value:"".concat(e(u.pivotTableColumns,"[".concat(n,"].name")))}]}:{supportedByAPI:a,data:[{name:e(u.tableColumns,"[".concat(u.tableConfig.stringColumnIndex,"].name")),value:"".concat(e(t,"[".concat(u.tableConfig.stringColumnIndex,"]")))}]}})),lt(mt(u),"isStringColumnDateType",(function(){var e=u.tableColumns[u.tableConfig.stringColumnIndex];return pn(e)})),lt(mt(u),"getMultiSeriesData",(function(t,n){var a,o=gn(t).stringColumnIndex,r=mn(t),i=dn(t).numberColumnIndex,l=ce(n).sort((function(e,t){var n=e[o],a=t[o];return n&&a?a-n:t-e})),s={};u.tableColumns.forEach((function(e,t){e.seriesCategory&&(s[e.seriesCategory]=t)}));var c=[];return l.forEach((function(t,n){var l=t[o],p=e(a,"[".concat(o,"]")),d=t[r];if(p!==l){var m=yn(u.tableColumns.length,1,0);m[0]=l,c.push(m)}var f=c[c.length-1][s[d]]||0;c[c.length-1][s[d]]=t[i]+f,a=t})),c})),lt(mt(u),"setFilterFunction",(function(e){var t=mt(u);return"DATE"===e.type||"DATE_STRING"===e.type?function(n,a,o,r){try{var i=Tn({element:a,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),u.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,a){try{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=e.replace(/[^0-9.]/g,"");return t.toString().includes(i)}catch(e){return console.error(e),u.props.onErrorCallback(e),!1}}:void 0})),lt(mt(u),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(e,t){return u.dateSortFn(t,e)}:"STRING"===e.type?"string":void 0})),lt(mt(u),"formatColumnsForTable",(function(e){var t,n,a,o=e||(null===(t=u.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.columns);return o?o.map((function(e,t){var n=ce(e);return n.field="".concat(t),n.title=e.display_name,n.id=d(),n.visible=e.is_visible,"DOLLAR_AMT"===n.type||"RATIO"===n.type||"NUMBER"===n.type?n.hozAlign="right":n.hozAlign="center",n.cssClass=n.type,n.formatter=function(e,t,a){return Tn({element:e.getValue(),column:n,config:Zt(u.props.dataFormatting),htmlElement:e.getElement()})},n.headerFilter="input",n.headerFilterFunc=u.setFilterFunction(n),n.sorter=u.setSorterFunction(n),pn(e)&&u.props.enableAjaxTableData&&(n.headerSort=!1),n})):null})),lt(mt(u),"formatDatePivotYear",(function(e,t){return"DATE"===u.tableColumns[t].type?n.unix(e[t]).utc().format("YYYY"):n(e[t]).format("YYYY")})),lt(mt(u),"formatDatePivotMonth",(function(e,t){return"DATE"===u.tableColumns[t].type?n.unix(e[t]).format("MMMM"):n(e[t]).format("MMMM")})),lt(mt(u),"generateDatePivotData",(function(t){try{var a=fn(u.tableColumns),o=u.tableConfig.numberColumnIndex;o>=0||(o=u.tableColumns.findIndex((function(e,t){return t!==a&&cn(e)})));var r=t||e(u.queryResponse,"data.data.rows"),i=ht(r.map((function(e){return"DATE"===u.tableColumns[a].type?Number(n.unix(e[a]).utc().format("YYYY")):Number(n(e[a]).format("YYYY"))}))).filter(vn).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),l=[{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:u.tableColumns[a],pivot:!0,headerSort:!0,sorter:u.dateSortFn}];Object.keys(i).forEach((function(e,t){l.push($e($e({},u.tableColumns[o]),{},{origColumn:u.tableColumns[o],origValues:{},name:e,title:e,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0,headerSort:!0}))}));var s=yn(Object.keys(i).length,12),c={};an.forEach((function(e,t){s[t][0]=e})),r.forEach((function(e){var t,n=u.formatDatePivotYear(e,a),r=u.formatDatePivotMonth(e,a),p=i[n],d=an.findIndex((function(e){return r===e})),m=l.findIndex((function(e){return e.name===n}));d>=0&&p&&(s[d][p]=e[o],c[n]=$e($e({},c[n]),{},lt({},r,e[a])),l[m].origValues[r]={name:null===(t=u.tableColumns[a])||void 0===t?void 0:t.name,value:e[a]})})),u.pivotOriginalColumnData=c,u.pivotTableColumns=l,u.pivotTableData=s,u.numberOfPivotTableRows=12,u.setPivotTableConfig()}catch(e){console.error(e),u.setSupportedDisplayTypes(u.supportedDisplayTypes.filter((function(e){return"pivot_table"!==e}))),u.onRecommendedDisplayType("table")}})),lt(mt(u),"getColumnFromIndexString",(function(t){return e(u.tableColumns,"[".concat(e(u.tableConfig,"[".concat(t,"]")),"]"))})),lt(mt(u),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,a=t.newTableData;try{var o=a||u.tableData||e(u.queryResponse,"data.data.rows");o=o.filter((function(e){return null!==e[0]}));var r=u.tableConfig,i=r.legendColumnIndex,l=r.stringColumnIndex,s=r.numberColumnIndex,c=u.sortTableDataByDate(o).map((function(e){return e[l]})).filter(vn).reduce((function(e,t,n){return e[t]=n,e}),{}),p=u.sortTableDataByDate(o).map((function(e){return e[i]})).filter(vn).reduce((function(e,t,n){return e[t]=n,e}),{}),d=l,m=i;if(n&&Object.keys(p).length>Object.keys(c).length&&!pn(u.getColumnFromIndexString("stringColumnIndex"))){d=i,m=l;var f=ce(c);c=ce(p),p=ce(f)}u.tableConfig.legendColumnIndex=m;var g=[$e($e({},u.tableColumns[d]),{},{frozen:!0,headerContext:void 0,visible:!0,is_visible:!0,field:"0",pivot:!0,headerSort:!0})];Object.keys(p).forEach((function(e,t){var n=Tn({element:e,column:u.tableColumns[m],config:Zt(u.props.dataFormatting)});g.push($e($e({},u.tableColumns[s]),{},{origColumn:u.tableColumns[s],origPivotColumn:u.tableColumns[m],origValues:{},name:e,title:n,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0,headerSort:!0}))}));var h=yn(Object.keys(p).length+1,Object.keys(c).length);o.forEach((function(e){var t,n=c[e[d]],a=e[d];h[n][0]=a;var o=p[e[m]]+1,r=e[s];h[n][o]=r,g[o].origValues[a]={name:null===(t=u.tableColumns[d])||void 0===t?void 0:t.name,value:a}}));var v=u.getCurrentSupportedDisplayTypes();se(v,u.supportedDisplayTypes)||u.setSupportedDisplayTypes(v),u.pivotTableColumns=g,u.pivotTableData=h,u.numberOfPivotTableRows=e(u.pivotTableData,"length",0),u.setPivotTableConfig(n)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),lt(mt(u),"onSuggestionClick",(function(t){var n=t.query,a=t.queryId,o=t.userSelection,r=t.isButtonClick,i=t.skipQueryValidation,c=t.source;o||function(t){var n=t.queryId,a=t.suggestion,o=t.apiKey,r=t.domain,i=t.token,s="".concat(r,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(o),c={suggestion:a};if(!i||!r||!o)return Promise.reject(new Error("Unauthenticated"));var u={headers:{Authorization:"Bearer ".concat(i)}};l.put(s,c,u).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}($e($e({},Jt(u.props.authentication)),{},{queryId:a,suggestion:n})),"None of these"===n?u.props.onNoneOfTheseClick?u.props.onNoneOfTheseClick():u.setState({customResponse:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")}):(u.props.onSuggestionClick&&u.props.onSuggestionClick({query:n,userSelection:o,isButtonClick:r,skipQueryValidation:i,source:c}),u.props.queryInputRef&&u.props.queryInputRef.submitQuery({queryText:n,userSelection:o,skipQueryValidation:!0,source:c}))})),lt(mt(u),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return s.createElement("div",{className:"query-output-error-message"},t.map((function(e,n){return s.createElement("span",{key:"error-message-part-".concat(u.COMPONENT_KEY,"-").concat(n)},s.createElement("span",null,e),n!==t.length-1&&s.createElement("button",{className:"report-like-text-button",onClick:u.props.reportProblemCallback},"report"))})))}catch(t){return s.createElement("span",null,e)}})),lt(mt(u),"isDrilldown",(function(){try{var e,t,n;return"Drilldown"===((null===(e=u.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}})),lt(mt(u),"renderAllColumnsHiddenMessage",(function(){return s.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},s.createElement("div",null,s.createElement(Kt,{className:"warning-icon",type:"warning-triangle"}),s.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",s.createElement(Kt,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),lt(mt(u),"renderTable",(function(){if(In(u.queryResponse))return u.renderAllColumnsHiddenMessage();if(!u.tableData||"pivot_table"===u.props.displayType&&!u.pivotTableData)return u.renderMessage("Error: There was no data supplied for this table");if("pivot_table"===u.props.displayType)return s.createElement(yt,null,s.createElement(ba,{themeConfig:u.props.themeConfig,key:u.pivotTableID,ref:function(e){return u.pivotTableRef=e},columns:u.pivotTableColumns,data:u.pivotTableData,onCellClick:u.onTableCellClick,headerFilters:u.pivotHeaderFilters,onFilterCallback:u.onTableFilter,isResizing:u.props.isResizing,useInfiniteScroll:!1,supportsDrilldowns:!0,enableColumnHeaderContextMenu:u.props.enableColumnHeaderContextMenu}));var t=u.props.enableAjaxTableData&&u.isDataLimited();return s.createElement(ba,{authentication:u.props.authentication,themeConfig:u.props.themeConfig,key:u.tableID,ref:function(e){return u.tableRef=e},columns:u.tableColumns,data:u.tableData,onCellClick:u.onTableCellClick,queryID:u.queryID,headerFilters:u.headerFilters,onFilterCallback:u.onTableFilter,onNewPage:u.onNewPage,onNewData:u.onNewData,isResizing:u.props.isResizing,pageSize:e(u.queryResponse,"data.data.row_limit"),useInfiniteScroll:t,queryRequestData:u.props.queryRequestData,supportsDrilldowns:sn(u.tableColumns)&&2===u.tableColumns.length})})),lt(mt(u),"renderChart",(function(e){var t;if(!u.tableData||!u.tableColumns||!u.tableConfig)return console.error("Required table data was missing"),u.renderMessage("Error: There was no data supplied for this chart");var n=u.usePivotDataForChart();if(n&&(!u.pivotTableData||!u.pivotTableColumns||!u.pivotTableConfig))return console.error("Required pivot table data was missing"),u.renderMessage("Error: There was no data supplied for this chart");var a=n?u.pivotTableConfig:u.tableConfig;return s.createElement(yt,null,s.createElement(vo,st({themeConfig:u.props.themeConfig,dataLength:u.tableData.length,ref:function(e){return u.chartRef=e},type:e||u.props.displayType},a,{data:n?u.state.visiblePivotRows||u.pivotTableData:u.state.visibleRows||u.tableData,columns:n?u.pivotTableColumns:u.tableColumns,isPivot:n,dataFormatting:Zt(u.props.dataFormatting),backgroundColor:u.props.backgroundColor,activeChartElementKey:u.props.activeChartElementKey,onLegendClick:u.onLegendClick,legendColumn:u.tableColumns[null===(t=u.tableConfig)||void 0===t?void 0:t.legendColumnIndex],changeStringColumnIndex:u.onChangeStringColumnIndex,changeLegendColumnIndex:u.onChangeLegendColumnIndex,changeNumberColumnIndices:u.onChangeNumberColumnIndices,onChartClick:u.onChartClick,isResizing:u.props.isResizing,isAnimatingContainer:u.props.isAnimatingContainer,enableDynamicCharting:u.props.enableDynamicCharting,tooltipID:"react-autoql-chart-tooltip-".concat(u.COMPONENT_KEY),rebuildTooltips:u.rebuildTooltips})))})),lt(mt(u),"renderHelpResponse",(function(){var t=e(u.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 s.createElement(c,null,"Great news, I can help with that:",s.createElement("br",null),s.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},s.createElement(Kt,{type:"globe",className:"react-autoql-help-link-icon"}),a))})),lt(mt(u),"renderError",(function(t){return t?e(t,"data.message")?u.renderMessage(t.data):u.renderMessage():(console.warn("Warning: No response object supplied"),u.renderMessage("No response supplied"))})),lt(mt(u),"isDataLimited",(function(){var e,t,n,a,o,r,i,l=null===(e=u.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,s=null===(o=u.queryResponse)||void 0===o||null===(r=o.data)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.row_limit;return!(!l||!s)&&l===s})),lt(mt(u),"noDataFound",(function(){var e,t,n,a;return 0===(null===(e=u.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)})),lt(mt(u),"renderDataLimitWarning",(function(){var e,t,n,a=u.isDataLimited(),o=u.props.enableAjaxTableData&&"table"===u.props.displayType;if(!a||o)return null;var r=$t(u.props.autoQLConfig).enableQueryInterpretation&&u.props.showQueryInterpretation;return s.createElement("div",{className:"dashboard-data-limit-warning-icon"},s.createElement(Kt,{type:"warning","data-tip":"The display limit of ".concat(null===(e=u.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.<br />\n Try querying a smaller time-frame to ensure<br />\n all your data is displayed."),"data-for":"react-autoql-query-output-tooltip-".concat(u.COMPONENT_KEY),"data-place":r?"left":"right"}))})),lt(mt(u),"renderMessage",(function(e){try{if("object"===tt(e)){var t=Tt.GENERAL_QUERY;return e.message&&(t=e.message,t=u.props.reportProblemCallback?u.replaceErrorTextWithLinks(e.message):t.replace("<report>","report")),s.createElement("div",{className:"query-output-error-message"},s.createElement("div",null,t),e.reference_id&&s.createElement(c,null,s.createElement("br",null),s.createElement("div",null,"Error ID: ",e.reference_id)))}var n=e||Tt.GENERAL_QUERY;return s.createElement("div",{className:"query-output-error-message"},n)}catch(e){return console.warn(e),s.createElement("div",{className:"query-output-error-message"},Tt.GENERAL_QUERY)}})),lt(mt(u),"renderHTMLMessage",(function(){var e,t,n,a=null===(e=u.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.answer;return a?be(a,{}):s.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),lt(mt(u),"renderTextResponse",(function(){return In(u.queryResponse)?u.renderAllColumnsHiddenMessage():null})),lt(mt(u),"renderResponse",(function(){var t=u.props.displayType;return u.hasError(u.queryResponse)?u.renderError(u.queryResponse):"html"===t?u.renderHTMLMessage():u.state.customResponse?u.state.customResponse:!!e(u.queryResponse,"data.data.items")?u.renderSuggestionMessage(u.queryResponse.data.data.items,u.queryResponse.data.data.query_id):e(u.queryResponse,"data.data.replacements")?s.createElement(bo,{themeConfig:u.props.themeConfig,key:u.QUERY_VALIDATION_KEY,response:u.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return u.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"]})},onQueryValidationSelectOption:u.props.onQueryValidationSelectOption,initialSelections:u.props.queryValidationSelections,autoSelectSuggestion:u.props.autoSelectQueryValidationSuggestion}):u.noDataFound()?u.replaceErrorTextWithLinks(u.queryResponse.data.message):t&&e(u.queryResponse,"data.data.rows")?"help"===t?u.renderHelpResponse():"text"===t?u.renderTextResponse():"single-value"===t?u.renderSingleValueResponse():Nn(t)?u.renderTable():An(t)?u.renderChart():(console.warn("display type not recognized: ".concat(u.props.displayType," - rendering as plain text")),u.renderMessage("display type not recognized: ".concat(u.props.displayType))):null})),lt(mt(u),"renderReverseTranslation",(function(){var t,n,a;return $t(u.props.autoQLConfig).enableQueryInterpretation&&u.props.showQueryInterpretation&&null!==(t=u.queryResponse)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.data)&&void 0!==a&&a.interpretation?s.createElement(To,{authentication:u.props.authentication,onValueLabelClick:u.props.onRTValueLabelClick,appliedFilters:u.props.appliedFilters,isResizing:u.props.isResizing,reverseTranslation:e(u.queryResponse,"data.data.parsed_interpretation")}):null})),lt(mt(u),"renderFooter",(function(){return s.createElement("div",{className:"query-output-footer"},u.renderReverseTranslation(),u.renderDataLimitWarning())})),lt(mt(u),"render",(function(){return s.createElement(yt,null,s.createElement("div",{key:u.COMPONENT_KEY,ref:function(e){return u.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(u.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(Nn(u.props.displayType)?"table":"")},u.renderResponse(),u.renderFooter()),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-query-output-tooltip-".concat(u.COMPONENT_KEY),effect:"solid",place:"left",html:!0}),s.createElement(le,{className:"react-autoql-chart-tooltip",id:"react-autoql-chart-tooltip-".concat(u.COMPONENT_KEY),effect:"solid",html:!0}))})),u.COMPONENT_KEY=d(),u.QUERY_VALIDATION_KEY=d(),u.queryResponse=ce(t.queryResponse),u.supportedDisplayTypes=u.getCurrentSupportedDisplayTypes(),u.queryID=e(u.queryResponse,"data.data.query_id"),u.interpretation=e(u.queryResponse,"data.data.interpretation"),u.tableID=d(),u.pivotTableID=d(),null!==(r=t.tableConfigs)&&void 0!==r&&r.tableConfig&&u.isTableConfigValid(null===(i=t.tableConfigs)||void 0===i?void 0:i.tableConfig)){var p=t.tableConfigs,m=p.tableConfig,f=p.pivotTableConfig;u.tableConfig=ce(m),u.pivotTableConfig=ce(f)}var g=u.isCurrentDisplayTypeValid(t),h=t.displayType;g||(h=Fn(u.queryResponse,t.autoChartAggregations),u.onRecommendedDisplayType(h));var v=en(t.themeConfig).chartColors;return u.colorScale=Ce().range(v),_n(t.themeConfig),u.generateAllData(u.queryResponse,h),u.state={displayType:h,tableFilters:[],selectedSuggestion:t.selectedSuggestion},u}return it(o)}();lt(Do,"propTypes",{queryResponse:p.shape({}),queryInputRef:p.instanceOf(ma),authentication:bt,themeConfig:St,autoQLConfig:Et,dataFormatting:Ct,tableConfig:p.shape({}),onSuggestionClick:p.func,displayType:p.string,onQueryValidationSelectOption:p.func,autoSelectQueryValidationSuggestion:p.bool,queryValidationSelections:p.arrayOf(p.shape({})),renderSuggestionsAsDropdown:p.bool,selectedSuggestion:p.string,activeChartElementKey:p.string,enableColumnHeaderContextMenu:p.bool,isResizing:p.bool,enableDynamicCharting:p.bool,onTableConfigChange:p.func,onNoneOfTheseClick:p.func,autoChartAggregations:p.bool,onSupportedDisplayTypesChange:p.func,onRTValueLabelClick:p.func,isTaskModule:p.bool,onUpdate:p.func,onDrilldownStart:p.func,onDrilldownEnd:p.func,enableAjaxTableData:p.bool,rebuildTooltips:p.func}),lt(Do,"defaultProps",{authentication:Gt,themeConfig:Xt,autoQLConfig:Yt,dataFormatting:Wt,tableConfig:void 0,queryResponse:void 0,displayType:void 0,queryInputRef:void 0,onSuggestionClick:void 0,autoSelectQueryValidationSuggestion:!0,queryValidationSelections:void 0,renderSuggestionsAsDropdown:!1,selectedSuggestion:void 0,activeChartElementKey:void 0,enableColumnHeaderContextMenu:!1,isResizing:!1,enableDynamicCharting:!0,onNoneOfTheseClick:void 0,autoChartAggregations:!0,enableFilterLocking:!1,showQueryInterpretation:!1,isTaskModule:!1,enableAjaxTableData:!1,onRTValueLabelClick:void 0,onTableConfigChange:function(){},onQueryValidationSelectOption:function(){},onSupportedDisplayTypesChange:function(){},onErrorCallback:function(){},onRecommendedDisplayType:function(){},onUpdate:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){}});var xo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"showDisplayTypeButton",(function(t){return(!e.props.disableCharts||!nn.includes(t))&&(e.props.supportedDisplayTypes&&e.props.supportedDisplayTypes.includes(t)&&e.props.displayType!==t)})),lt(mt(e),"createVisButton",(function(t,n,a){return e.showDisplayTypeButton(t)?s.createElement("button",{onClick:function(){return e.props.onDisplayTypeChange(t)},className:"react-autoql-toolbar-btn","data-tip":n,"data-for":"react-autoql-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},a):null})),lt(mt(e),"render",(function(){var t=e.props,n=t.displayType,a=t.supportedDisplayTypes;return!a||a.length<=1||!a.includes("pivot_table")&&e.props.disableCharts?null:tn.includes(n)||nn.includes(n)?s.createElement(yt,null,s.createElement("div",{className:"".concat(e.props.className||""," viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",s.createElement(Kt,{type:"table"})),e.createVisButton("pivot_table","Pivot Table",s.createElement(Kt,{type:"pivot-table"})),e.createVisButton("column","Column Chart",s.createElement(Kt,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",s.createElement(Kt,{type:"bar-chart"})),e.createVisButton("line","Line Chart",s.createElement(Kt,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",s.createElement(Kt,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",s.createElement(Kt,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",s.createElement(Kt,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",s.createElement(Kt,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",s.createElement(Kt,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",s.createElement(Kt,{type:"stacked-line-chart"})))):null})),e}return it(n)}();lt(xo,"propTypes",{themeConfig:St,supportedDisplayTypes:p.arrayOf(p.string).isRequired,onDisplayTypeChange:p.func.isRequired,displayType:p.string,disableCharts:p.bool,vertical:p.bool}),lt(xo,"defaultProps",{themeConfig:Xt,displayType:void 0,disableCharts:!1,vertical:!1});var ko=xo,wo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),lt(mt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:s.createElement("div",null,s.createElement(Wa,{type:"default",onClick:e.props.onClose},"Back"),s.createElement(Wa,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading},e.props.confirmText||"Continue"))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(he,{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:$e($e({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},s.createElement("div",{className:"react-autoql-modal-body"},e.props.children),s.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return it(n)}();lt(wo,"propTypes",{isVisible:p.bool,onClose:p.func,onConfirm:p.func,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),confirmLoading:p.bool,confirmText:p.string,footer:p.element}),lt(wo,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var Ao=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),lt(mt(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()})),lt(mt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:s.createElement("div",null,e.props.showCancelButton&&s.createElement(Wa,{type:"default",onClick:e.onClose},"Cancel"),s.createElement(Wa,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(he,{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:$e($e({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},s.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,s.createElement(Kt,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),s.createElement("div",{className:"react-autoql-modal-body",style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&s.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())),s.createElement(wo,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.setState({isConfirmCloseModalVisible:!1}),e.props.onClose()}},s.createElement("h3",null,"Are you sure you want to leave this page?"),s.createElement("p",null,"All unsaved changes will be lost.")))})),e}return it(n)}();lt(Ao,"propTypes",{themeConfig:St,title:p.oneOfType([p.element,p.string]),titleIcon:p.oneOfType([p.element,p.instanceOf(Kt)]),isVisible:p.bool,onClose:p.func,onConfirm:p.func,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),showCancelButton:p.bool,showFooter:p.bool,enableBodyScroll:p.bool,confirmLoading:p.bool,confirmText:p.string,confirmDisabled:p.bool,footer:p.element,confirmOnClose:p.bool}),lt(Ao,"defaultProps",{themeConfig:Xt,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,onClose:function(){},onConfirm:function(){}});var No=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{columns:e.props.columns}),lt(mt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),lt(mt(e),"render",(function(){return s.createElement(Ao,{isVisible:e.props.isVisible,onClose:e.props.onClose,onConfirm:function(){return e.props.onConfirm(e.state.columns)},title:"Show/Hide Columns",enableBodyScroll:!0,width:"600px",confirmText:"Apply",style:{marginTop:"45px"},confirmLoading:e.props.isSettingColumns},s.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},s.createElement(ja,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:function(t){e.setState({columns:t})}})))})),e}return it(n)}();lt(No,"propTypes",{themeConfig:St,isSettingColumns:p.bool}),lt(No,"defaultProps",{themeConfig:Xt,isSettingColumns:!1});var Ro=["id"],Mo=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 s={headers:{Authorization:"Bearer ".concat(o)}};return l.post(r,i,s)},Vo=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 s=l.create({headers:{Authorization:"Bearer ".concat(o)}}),c="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a,"&offset=").concat(r,"&limit=").concat(i);return s.get(c).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},qo=function(t){var n=t.domain,a=t.apiKey,o=t.token,r=t.channelType;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=l.create({headers:{Authorization:"Bearer ".concat(o)}}),s="".concat(n,"/autoql/api/v1/notifications/channels?key=").concat(a,"&type=").concat(r);return i.get(s).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return 404===e(t,"response.status")?Promise.resolve({data:[]}):Promise.reject(e(t,"response.data"))}))},Io=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=l.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"))}))},Po=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=l.create({headers:{Authorization:"Bearer ".concat(o)}}),s="".concat(n,"/autoql/api/v1/data-alerts/").concat(r,"?key=").concat(a);return i.get(s).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Lo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.delete(s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Oo=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=l.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"))}))},Fo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.put(s,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Qo=function(e){var t=e.dataAlertId,n=e.status,a=e.type,o=e.domain,r=e.apiKey,i=e.token;return i&&r&&o?t?"PROJECT"===a?_o({dataAlertId:t,status:n,token:i,domain:o,apiKey:r}):zo({dataAlertId:t,status:n,token:i,domain:o,apiKey:r}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},zo=function(t){var n=t.dataAlertId,a=t.status,o=t.token,r=t.domain,i=t.apiKey,s={status:a},c={headers:{Authorization:"Bearer ".concat(o)}},u="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return l.put(u,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ho=function(t){var n=t.token,a=t.domain,o=t.apiKey,r=t.channelType,i=t.channelName,s=t.channelEmail,c=t.userName,u=t.userEmail;if(!n||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var p={headers:{Authorization:"Bearer ".concat(n)}},d={channel_type:r,channel_name:i,channel_email:s,sender_name:c,sender_email:u},m="".concat(a,"/autoql/api/v1/notifications/channels?key=").concat(o);return l.post(m,d,p).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Bo=function(t){var n=t.token,a=t.domain,o=t.apiKey,r=t.channelId,i=t.fileName,s=t.base64Data;if(!n||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var c={headers:{Authorization:"Bearer ".concat(n)}},u={attachment_name:i,attachment:s},p="".concat(a,"/autoql/api/v1/notifications/channels/").concat(r,"/send?key=").concat(o);return l.post(p,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},_o=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)}},s="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return l.delete(s,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)}},s="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return l.post(s,{},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})},Uo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(o);return i.put(s,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},jo=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=l.create({headers:{Authorization:"Bearer ".concat(r)}});n.id;var s=dt(n,Ro),c="".concat(a,"/autoql/api/v1/data-alerts?key=").concat(o);return i.post(c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ko=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s={expression:n},c="".concat(a,"/autoql/api/v1/data-alerts/validate?key=").concat(o);return i.post(c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Go=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=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(o);return i.delete(s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Wo=function(t){var n=t.channelId,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=l.create({headers:{Authorization:"Bearer ".concat(r)}}),s="".concat(a,"/autoql/api/v1/notifications/channels/").concat(n,"?key=").concat(o);return i.delete(s).then((function(){return Promise.resolve()})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Yo=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",at(et().mark((function e(){return et().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)})))),lt(mt(o),"componentDidUpdate",(function(e,t){o.state.count!==t.count&&o.props.onCount(o.state.count)})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.clearPollingComponent(),clearInterval(o.pollInterval)})),lt(mt(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=l.create({headers:{Authorization:"Bearer ".concat(a)}}),s="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(r);return i.get(s,{timeout:18e4}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}($e($e({},Jt(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 Promise.reject(e)}))})),lt(mt(o),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),lt(mt(o),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",o.COMPONENT_KEY)})),lt(mt(o),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),lt(mt(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))})),lt(mt(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=l.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"))}))})($e({},Jt(o.props.authentication))).catch((function(e){console.error(e)})).finally((function(){o.setState({count:0})}))})),lt(mt(o),"getCurrentCount",(function(){return"number"==typeof o.props.count?o.props.count:o.state.count})),lt(mt(o),"renderBadge",(function(){var e=o.props.overflowCount,t=o.getCurrentCount();if(!t)return null;if(o.props.useDot)return s.createElement("div",{className:"react-autoql-notifications-badge-dot"});var n=t;return t>e&&(n="".concat(e,"+")),s.createElement("div",{className:"react-autoql-notifications-badge"},n)})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.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:$e({},o.props.style),onClick:function(){o.props.clearCountOnClick&&o.resetCount()}},s.createElement(Kt,{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=d(),o.HAS_FETCHED_COUNT=!1,o.pollInterval=void 0,o.state={count:0},o}return it(a)}();lt(Yo,"propTypes",{authentication:bt,overflowCount:p.number,style:p.shape({}),size:p.number,useDot:p.bool,clearCountOnClick:p.bool,onNewNotification:p.func,onErrorCallback:p.func,pausePolling:p.bool,count:p.number,onCount:p.func}),lt(Yo,"defaultProps",{authentication:Gt,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var Xo=["icon","type"],Jo=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{focused:!1}),lt(mt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),lt(mt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),lt(mt(e),"focus",(function(){e.inputRef&&e.inputRef.focus()})),lt(mt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var a=dt(t,Xo),o=a.className;return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(o," "),"data-test":"react-autoql-input"},"multi"===e.props.type?s.createElement("textarea",st({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):s.createElement(c,null,s.createElement("input",st({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&s.createElement(Kt,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return it(n)}();lt(Jo,"propTypes",{icon:p.string,type:p.string}),lt(Jo,"defaultProps",{icon:void 0,type:"single"});var Zo=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"autoCompleteTimer",void 0),lt(mt(o),"state",$e({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{}}(o.props.initialData))),lt(mt(o),"componentDidMount",(function(){o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state,t)||o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentWillUnmount",(function(){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer)})),lt(mt(o),"parseJSON",(function(e){1===e.length?(o.TERM_ID_1=e[0].id,o.TERM_ID_2=d(),o.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(o.TERM_ID_1=e[0].id,o.TERM_ID_2=e[1].id,o.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),lt(mt(o),"getJSON",(function(){if("EXISTS"===o.state.conditionSelectValue)return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value}];var e=o.state.input2Value;return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value},{id:o.TERM_ID_2,term_type:o.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:o.isNumerical(e)?de(e):e}]})),lt(mt(o),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=de(e);return!Number.isNaN(Number(n))})),lt(mt(o),"isComplete",(function(){return"EXISTS"===o.state.conditionSelectValue?!!o.state.input1Value:!!e(o.state.input1Value,"length")&&!!e(o.state.input2Value,"length")})),lt(mt(o),"isValid",(function(){return!0})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"onSuggestionsFetchRequested",(function(e){var t=e.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e($e($e({},Jt(o.props.authentication)),getAutoQLConfig(o.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var r=0;r<t.length&&(n.push(t[r]),4!==r);r++);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)}o.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),lt(mt(o),"renderReadOnlyRule",(function(){return s.createElement(yt,null,s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},"".concat(Un(o.state.input1Value))),s.createElement("span",{className:"read-only-rule-term"},"".concat(o.renderConditionOperator(o.state.conditionSelectValue))),"EXISTS"!==o.state.conditionSelectValue&&s.createElement("span",{className:"read-only-rule-term"},Un(o.state.input2Value)),o.props.andOrValue&&s.createElement("span",{className:"read-only-rule-term"},o.props.andOrValue)))})),lt(mt(o),"renderValidationError",(function(){return s.createElement("div",{className:"expression-term-validation-error"},s.createElement(Kt,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),lt(mt(o),"renderCompareBtn",(function(){return"EXISTS"===o.state.conditionSelectValue?s.createElement(Wa,{onClick:function(){o.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),lt(mt(o),"renderConditionSelector",(function(){return s.createElement(yo,{themeConfig:o.props.themeConfig,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:o.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){o.setState({conditionSelectValue:e})}})})),lt(mt(o),"renderRule",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},s.createElement("div",{className:"react-autoql-rule-first-input-container"},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query",value:o.state.input1Value,onChange:function(e){return o.setState({input1Value:e.target.value})}}),!o.state.isFirstTermValid&&o.renderValidationError()),o.renderCompareBtn()),s.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===o.state.conditionSelectValue?" hidden":"")},o.renderConditionSelector(),s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query or number",value:o.state.input2Value,onChange:function(e){return o.setState({input2Value:e.target.value})}}),!o.state.isSecondTermValid&&o.renderValidationError()),s.createElement(Kt,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return o.setState({conditionSelectValue:"EXISTS"})}}))))})),lt(mt(o),"render",(function(){return o.props.readOnly?o.renderReadOnlyRule():o.renderRule()})),o.initialData={},o.TERM_ID_1=d(),o.TERM_ID_2=d();var r=t.initialData;return r&&1===r.length?(o.TERM_ID_1=r[0].id,o.TERM_ID_2=d()):r&&r.length>1&&(o.TERM_ID_1=r[0].id,o.TERM_ID_2=r[1].id),o}return it(a)}();lt(Zo,"propTypes",{authentication:bt,themeConfig:St,ruleId:p.string,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool}),lt(Zo,"defaultProps",{authentication:Gt,themeConfig:Xt,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var $o=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=ce(t[0].term_value[0].term_value):a=!0),{expression:n,expressionError:a}},er=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"ruleRef",void 0),lt(mt(t),"state",$e({},$o(t.props.expression))),lt(mt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(t),"componentDidUpdate",(function(e,n){se(e.expression,t.props.expression)||t.setState($e({},$o(t.props.expression))),se(n,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),lt(mt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),lt(mt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),lt(mt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),lt(mt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),lt(mt(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})),lt(mt(t),"renderExpressionErrorMessage",(function(){return s.createElement("div",{className:"expression-error-message"},s.createElement(Kt,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported."," ",s.createElement("a",{onClick:t.resetConditions},"Reset Conditions"))})),lt(mt(t),"renderReadOnlyRule",(function(){return s.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():s.createElement(Zo,{themeConfig:t.props.themeConfig,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",d()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),lt(mt(t),"renderRule",(function(){return s.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},s.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():s.createElement(Zo,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",d()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return it(a)}();lt(er,"propTypes",{authentication:bt,themeConfig:St,expression:p.oneOfType([p.shape({}),p.array]),readOnly:p.bool,onChange:p.func}),lt(er,"defaultProps",{authentication:Gt,themeConfig:Xt,expression:void 0,readOnly:!1,onChange:function(){}}),n.extend(a);var tr=function(t){ct(o,s.Component);var a=gt(o);function o(){var t;ot(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return lt(mt(t=a.call.apply(a,[this].concat(i))),"COMPONENT_KEY",d()),lt(mt(t),"supportedDisplayTypes",[]),lt(mt(t),"state",{supportedDisplayTypes:[],ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),lt(mt(t),"componentDidUpdate",(function(e){if(!e.activeNotificationData&&t.props.activeNotificationData){var n={data:t.props.activeNotificationData},a=t.props.autoChartAggregations&&t.state.supportedDisplayTypes.includes("column")?"column":Fn(n,t.props.autoChartAggregations);t.setState({displayType:a})}})),lt(mt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),lt(mt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),Po($e({dataAlertId:n.data_alert_id},Jt(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),lt(mt(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)})),lt(mt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),Fo($e($e({},Jt(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDismissSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),Lo($e($e({},Jt(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"changeRuleStatus",(function(e,n){Qo($e({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Jt(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"formatTimestamp",(function(e){var t=n.unix(e).format("h:mma"),a=n.unix(e).format("MM-DD-YY"),o=n().format("MM-DD-YY"),r=n().subtract(1,"d").format("MM-DD-YY");return a===o?"Today at ".concat(t):a===r?"Yesterday at ".concat(t):n().isSame(e,"year")?"".concat(n.unix(e).format("MMMM Do")," at ").concat(t):"".concat(n.unix(e).format("MMMM Do, YYYY")," at ").concat(t)})),lt(mt(t),"renderAlertColorStrip",(function(){return s.createElement("div",{className:"react-autoql-notification-alert-strip"})})),lt(mt(t),"renderNotificationHeader",(function(e){return s.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},s.createElement("div",{className:"react-autoql-notification-display-name-container"},s.createElement("div",{className:"react-autoql-notification-display-name"},e.title),s.createElement("div",{className:"react-autoql-notification-description"},e.message),s.createElement("div",{className:"react-autoql-notification-timestamp"},s.createElement(Kt,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?s.createElement("div",{className:"react-autoql-notification-dismiss-btn"},s.createElement(Kt,{type:"notification-off",className:"react-autoql-notification-dismiss-icon","data-tip":"Dismiss","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDismissClick(n,e),le.hide()}})):s.createElement("div",{className:"react-autoql-notification-dismiss-btn"},s.createElement(Kt,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),le.hide()}})))})),lt(mt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?s.createElement(Wa,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},s.createElement(Kt,{type:"notification-off"})," Turn Data Alert Off"):s.createElement(Wa,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},s.createElement(Kt,{type:"notification"})," Turn Data Alert On"):s.createElement("div",null)})),lt(mt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?pe(t.state.ruleDetails)?s.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):s.createElement(Wa,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},s.createElement(Kt,{type:"edit"})," Edit Data Alert"):s.createElement("div",null)})),lt(mt(t),"renderNotificationFooter",(function(e){return s.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),lt(mt(t),"renderNotificationContent",(function(n){var a,o=n.data_return_query,r=Un(o);return a=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},s.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},s.createElement("div",{className:"react-autoql-notification-details-container"},s.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},s.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?s.createElement(c,null,s.createElement("div",{className:"react-autoql-notification-query-title"},r),s.createElement(Do,{authentication:t.props.authentication,ref:function(e){return t.OUTPUT_REF=e},queryResponse:a,autoQLConfig:{enableDrilldowns:!1},themeConfig:t.props.themeConfig,displayType:t.state.displayType,autoChartAggregations:t.props.autoChartAggregations,style:{flex:"1"},enableAjaxTableData:t.props.enableAjaxTableData,onSupportedDisplayTypesChange:function(e){return t.setState({supportedDisplayTypes:e})},onRecommendedDisplayType:function(e){return t.setState({displayType:e})}})):s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null))),e(t.state.supportedDisplayTypes,"length")>1&&s.createElement("div",{className:"react-autoql-notification-viz-switcher"},s.createElement(ko,{themeConfig:t.props.themeConfig,supportedDisplayTypes:t.state.supportedDisplayTypes,displayType:t.state.displayType,onDisplayTypeChange:function(e){return t.setState({displayType:e})},vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&s.createElement("div",{className:"react-autoql-notification-details"},s.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),s.createElement(er,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),lt(mt(t),"render",(function(){var e=t.props.notification;return s.createElement(yt,null,s.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 it(o)}();lt(tr,"propTypes",{authentication:bt,themeConfig:St,notification:p.shape({}).isRequired,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onRuleFetchCallback:p.func,onExpandCallback:p.func,onDismissCallback:p.func,onDeleteCallback:p.func,onDeleteSuccessCallback:p.func,onDismissSuccessCallback:p.func,onErrorCallback:p.func,autoChartAggregations:p.bool,enableAjaxTableData:p.bool.isRequired}),lt(tr,"defaultProps",{authentication:Gt,themeConfig:Xt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onErrorCallback:function(){}});var nr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{activeStep:t.props.initialActiveStep||0}),lt(mt(t),"componentDidMount",(function(){t.props.steps&&t.props.steps.length?null==t.props.initialActiveStep||Number.isNaN(t.props.initialActiveStep)||e(t.props.steps,"".concat(t.props.initialActiveStep))||(console.error(new Error("Initial active step provided is invalid")),t.setState({activeStep:0})):console.error(new Error("No steps were provided"))})),lt(mt(t),"prevStep",(function(){t.state.activeStep>=1&&t.onStepTitleClick(t.state.activeStep-1)})),lt(mt(t),"nextStep",(function(){var e=Number.isNaN(t.state.activeStep)?0:t.state.activeStep+1;t.onStepTitleClick(e)})),lt(mt(t),"setStep",(function(e){t.setState({activeStep:e})})),lt(mt(t),"getHeightOfStepContent",(function(e){if(t.props.collapsible){var n=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));if(n)return n.scrollHeight+15}})),lt(mt(t),"onStepTitleClick",(function(e,n){try{n&&n.onClick&&n.onClick(),t.autoHideTimeout&&clearTimeout(t.autoHideTimeout);var a=e,o=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(t.state.activeStep));if(o&&(o.style.height="".concat(t.getHeightOfStepContent(t.state.activeStep),"px"),setTimeout((function(){o.style.height="10px"}),0)),e!==t.state.activeStep){var r=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));r&&(r.style.height="".concat(t.getHeightOfStepContent(e),"px"),clearTimeout(t.autoHideTimeout),t.autoHideTimeout=setTimeout((function(){var n=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));n&&(n.style.height="auto")}),500))}else a=void 0;t.setState({activeStep:a})}catch(e){console.error(e)}})),lt(mt(t),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),lt(mt(t),"render",(function(){return t.props.steps&&t.props.steps.length?s.createElement(yt,null,s.createElement("div",{id:"react-autoql-steps-".concat(t.COMPONENT_KEY),className:"react-autoql-steps-container","data-test":"react-autoql-steps"},t.props.steps.map((function(e,n){return s.createElement("div",{key:"react-autoql-steps-".concat(t.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},s.createElement("div",{className:"react-autoql-step-container\n ".concat(t.getStepStatus(e),"\n ").concat(t.props.collapsible&&n===t.state.activeStep?" active":""),"data-test":"react-autoql-step-container-".concat(n)},s.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return t.onStepTitleClick(n,e)}},s.createElement("div",{className:"react-autoql-step-title"},e.title)),s.createElement("div",{id:"react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},s.createElement("div",{className:"react-autoql-step-subtitle"},e.subtitle||null),s.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},e.content)),s.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),t}return it(a)}();lt(nr,"propTypes",{themeConfig:St,steps:p.arrayOf(p.shape({})),initialActiveStep:p.number,collapsible:p.bool}),lt(nr,"defaultProps",{themeConfig:Xt,steps:void 0,initialActiveStep:void 0,collapsible:!0});var ar=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"renderButtonType",(function(){return s.createElement(yt,null,s.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)),s.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(o?" active":""),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},s.createElement("div",null,e))}))))})),lt(mt(t),"renderOriginalType",(function(){return s.createElement(yt,null,s.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)),s.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},s.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:a}),s.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),lt(mt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return it(a)}();lt(ar,"propTypes",{options:p.arrayOf(p.string),onChange:p.func,value:p.string,multiSelect:p.bool,type:p.string,tooltips:p.arrayOf(p.string),tooltipId:p.string}),lt(ar,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var or=["onChange","options","selectedOption","className"],rr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),lt(mt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),lt(mt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=dt(t,or);return s.createElement(yt,null,s.createElement(ge,st({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 it(n)}();lt(rr,"propTypes",{onChange:p.func,options:p.arrayOf(p.shape({})),selectedOption:p.shape({})}),lt(rr,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var ir=fe.tz.guess(),lr=fe.tz.names().map((function(e){return{value:e,label:e}})),sr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),lt(mt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||ir;return lr.find((function(e){return e.label===t}))})),lt(mt(e),"render",(function(){var t=e.getSelectedOption();return s.createElement(rr,{className:"react-autoql-timezone-select",options:lr,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return it(n)}();lt(sr,"propTypes",{onChange:p.func,defaultSelection:p.string}),lt(sr,"defaultProps",{onChange:function(){},defaultSelection:void 0});var cr=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}},ur=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{frequencySelectValue:cr(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),lt(mt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),lt(mt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),lt(mt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),lt(mt(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}})),lt(mt(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})),lt(mt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),lt(mt(t),"renderTimezoneComponent",(function(){return s.createElement("div",null,s.createElement("span",null,"Time zone: "),s.createElement(sr,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},s.createElement("div",{className:"frequency-settings-container"},s.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),s.createElement(ar,{themeConfig:t.props.themeConfig,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})}}))),s.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return it(a)}();lt(ur,"propTypes",{themeConfig:St,dataAlert:p.shape({}),onChange:p.func,onCompletedChange:p.func,onErrorCallback:p.func}),lt(ur,"defaultProps",{themeConfig:Xt,dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var pr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"NEW_NOTIFICATION_MODAL_ID",d()),lt(mt(t),"state",{titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1}),lt(mt(t),"componentDidMount",(function(){_n(t.props.themeConfig),t.initializeFields()})),lt(mt(t),"componentDidUpdate",(function(e,n){if(se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig),!t.props.isVisible&&e.isVisible&&setTimeout(t.resetFields,500),t.props.isVisible&&!e.isVisible&&t.initializeFields(),t.props.initialQuery&&t.props.initialQuery!==e.initialQuery){t.resetFields();var a=t.createExpressionJSONFromQuery(t.props.initialQuery);t.setState({isExpressionSectionComplete:!0,expressionJSON:a})}t.state.frequencyCategorySelectValue!==n.frequencyCategorySelectValue&&t.setState({everyCheckboxValue:!1,frequencySelectValue:"MONTH",weekSelectValue:[2],monthSelectValue:[1],yearSelectValue:[1]})})),lt(mt(t),"resetFields",(function(){t.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),lt(mt(t),"initializeFields",(function(){if(pe(t.props.currentDataAlert)){if(t.props.initialQuery&&"string"==typeof t.props.initialQuery){var n=t.createExpressionJSONFromQuery(t.props.initialQuery);t.setState({isExpressionSectionComplete:!0,expressionJSON:n})}}else{var a=t.props.currentDataAlert;t.setState({titleInput:a.title,messageInput:a.message,dataReturnQuery:a.data_return_query,isDataReturnDirty:!0,expressionJSON:e(t.props.currentDataAlert,"expression")})}})),lt(mt(t),"createExpressionJSONFromQuery",(function(e){return[{condition:"TERMINATOR",id:d(),term_type:"group",term_value:[{id:d(),term_type:"group",condition:"TERMINATOR",term_value:[{id:d(),condition:"EXISTS",term_type:"query",term_value:e}]}]}]})),lt(mt(t),"getDataAlertData",(function(){try{var n,a=t.state,o=a.titleInput,r=a.messageInput,i=ce(t.state.expressionJSON);t.expressionRef&&(i=t.expressionRef.getJSON(),n=t.expressionRef.getFirstQuery());var l={};return t.scheduleBuilderRef&&(l=t.scheduleBuilderRef.getData()),{id:e(t.props.currentDataAlert,"id"),title:o,data_return_query:n,message:r,expression:i,notification_type:l.notificationType,reset_period:l.resetPeriod,time_zone:l.timezone}}catch(e){console.error(e)}})),lt(mt(t),"onExpressionChange",(function(e,n,a){t.setState({isExpressionSectionComplete:e,isFirstSectionComplete:t.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:a})})),lt(mt(t),"isFirstSectionComplete",(function(){var e=!1;return t.expressionRef&&(e=t.expressionRef.isComplete()),t.props.enableQueryValidation?e&&!!t.state.titleInput&&t.state.isExpressionValidated&&t.state.isExpressionValid:e&&!!t.state.titleInput})),lt(mt(t),"onDataAlertSave",(function(){t.setState({isSavingDataAlert:!0});var e=$e($e({},t.getDataAlertData()),{},{project_id:t.props.selectedDemoProjectId}),n=$e({dataAlert:e},Jt(t.props.authentication));t.props.isManagement?(t.props.onManagementCreateDataAlert(e),t.setState({isSavingDataAlert:!1})):e.id?Uo($e({},n)).then((function(e){t.props.onSave(e),t.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isSavingDataAlert:!1})})):jo($e({},n)).then((function(e){t.props.onSave(e),t.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isSavingDataAlert:!1})}))})),lt(mt(t),"validateFn",t.props.onValidate||Ko),lt(mt(t),"validateExpression",(function(){try{if(t.setState({isValidating:!0,isExpressionValidated:!1}),t.expressionRef){var n=t.expressionRef.getJSON();t.validateFn($e($e({},t.props.authentication),{},{expression:n})).then((function(){t.setState({isValidating:!1,isExpressionValid:!0,isExpressionValidated:!0}),t.stepsRef&&t.stepsRef.nextStep()})).catch((function(n){t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0,expressionError:e(n,"message")})}))}else t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}catch(e){console.error(e),t.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}})),lt(mt(t),"renderValidateBtn",(function(){var n;return t.expressionRef&&t.expressionRef.state.expressionError?null:s.createElement(c,null,t.state.isExpressionValidated&&t.state.isExpressionValid&&s.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},s.createElement(Kt,{className:"expression-valid-checkmark",type:"check","data-for":"react-autoql-data-alert-modal-tooltip","data-tip":"Expression is valid"})),t.state.isExpressionValidated&&!t.state.isExpressionValid&&!!t.state.expressionError&&s.createElement("div",{className:"expression-invalid-message-container"},s.createElement("span",{className:"expression-invalid-message"},s.createElement(Kt,{type:"warning-triangle"}))," ",s.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},t.state.expressionError)),s.createElement(Wa,(lt(n={type:"default",onClick:t.validateExpression,loading:t.state.isValidating},"type","primary"),lt(n,"disabled",!t.state.titleInput||!e(t.expressionRef,"state.expression[0].term_value")),lt(n,"style",{position:"absolute",right:0}),n),"Check Alert & continue"))})),lt(mt(t),"setStep",(function(e){t.stepsRef&&t.stepsRef.setStep(e)})),lt(mt(t),"renderNextBtn",(function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=arguments.length>3?arguments[3]:void 0;return s.createElement(Wa,{className:e,onClick:function(){a(),t.stepsRef&&t.stepsRef.nextStep()},disabled:n,type:"primary"},o||"Continue")})),lt(mt(t),"renderBackBtn",(function(e){return s.createElement(Wa,{className:e,onClick:function(){t.stepsRef&&t.stepsRef.prevStep()}},"Back")})),lt(mt(t),"renderSetUpDataAlertStep",(function(){return s.createElement("div",null,s.createElement("div",{style:{display:"flex"}},s.createElement("div",{style:{width:"80%"}},s.createElement("p",null,"Name your Data Alert:"),s.createElement(Jo,{className:"react-autoql-notification-display-name-input",placeholder:"Add an Alert Name",icon:"title",maxLength:"50",value:t.state.titleInput,onChange:function(e){var n=t.state.isExpressionSectionComplete&&!!e.target.value;t.setState({titleInput:e.target.value,isFirstSectionComplete:n})}})),s.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),s.createElement(Kt,{"data-for":"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,color:"#26A7Df"}))),s.createElement("div",{style:{display:"flex"}},s.createElement("div",{style:{width:"80%"}},s.createElement("p",null,"Notify me when:"),s.createElement(er,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,ref:function(e){return t.expressionRef=e},key:"expression-".concat(t.NEW_NOTIFICATION_MODAL_ID),onChange:t.onExpressionChange,enableQueryValidation:t.props.enableQueryValidation,expression:e(t.props.currentDataAlert,"expression",t.state.expressionJSON)})),s.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),s.createElement(Kt,{"data-for":"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,color:"#26A7Df"}))),s.createElement("div",{className:"step-btn-container"},t.props.enableQueryValidation?t.renderValidateBtn():t.renderNextBtn("first-step-next-btn",t.props.enableQueryValidation&&(!t.state.isExpressionValidated||!t.state.isExpressionValid))))})),lt(mt(t),"renderFrequencyStep",(function(){return s.createElement("div",null,s.createElement(ur,{themeConfig:t.props.themeConfig,ref:function(e){return t.scheduleBuilderRef=e},key:"schedule-".concat(t.NEW_NOTIFICATION_MODAL_ID),dataAlert:t.props.currentDataAlert,onCompletedChange:function(e){t.setState({isScheduleSectionComplete:e})},onErrorCallback:t.props.onErrorCallback}),s.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn"),t.renderNextBtn("second-step-next-btn",!t.state.isScheduleSectionComplete,(function(){return t.setState({isThirdSectionDirty:!0})}))))})),lt(mt(t),"renderAlertPreferencesStep",(function(){return s.createElement("div",null,s.createElement("p",null,"Optional:"),s.createElement(Jo,{className:"react-autoql-notification-message-input",placeholder:"This message will be visible when a notification is sent.",type:"multi",maxLength:"200",value:t.state.messageInput,onChange:function(e){return t.setState({messageInput:e.target.value})}}),s.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn")))})),lt(mt(t),"onDataAlertDelete",(function(){var n=e(t.props.currentDataAlert,"id");n&&(t.setState({isDeletingDataAlert:!0}),Go(n,Jt(t.props.authentication)).then((function(){t.setState({isDeletingDataAlert:!1,isConfirmDeleteModalVisible:!1}),t.props.onDelete(n),t.props.onClose(!1)})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isDeletingDataAlert:!1})})))})),lt(mt(t),"getModalContent",(function(){return t.props.isVisible?[{title:"Set Up Your Alert",content:t.renderSetUpDataAlertStep(),complete:t.isFirstSectionComplete(),error:t.props.enableQueryValidation&&t.state.isExpressionValidated&&!t.state.isExpressionValid},{title:"Set Notification Preferences",content:t.renderFrequencyStep(),complete:t.state.isScheduleSectionComplete},{title:"Compose Notification Message",content:t.renderAlertPreferencesStep(),complete:t.state.isThirdSectionDirty||!!t.props.currentDataAlert,onClick:function(){t.setState({isThirdSectionDirty:!0})}}]:null})),lt(mt(t),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),lt(mt(t),"render",(function(){var e=t.getModalContent();return s.createElement(yt,null,s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-modal-tooltip",effect:"solid",delayShow:500,html:!0}),s.createElement(Ao,{themeConfig:t.props.themeConfig,title:t.props.title,titleIcon:pe(t.props.currentDataAlert)?s.createElement("span",null):s.createElement(Kt,{type:"edit"}),ref:function(e){return t.modalRef=e},isVisible:t.props.isVisible,onClose:t.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:s.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},s.createElement("div",null,t.props.currentDataAlert&&t.props.allowDelete&&s.createElement(Wa,{type:"danger",onClick:function(){t.setState({isConfirmDeleteModalVisible:!0})},loading:t.state.isDeletingDataAlert},"Delete Data Alert")),s.createElement("div",null,s.createElement(Wa,{onClick:function(){t.modalRef&&t.modalRef.onClose()}},"Cancel"),s.createElement(Wa,{type:"primary",loading:t.state.isSavingDataAlert,onClick:t.onDataAlertSave,disabled:t.isSaveButtonDisabled(e)},"Finish & Save")))},t.props.isVisible&&s.createElement("div",{className:"notification-modal-content"},s.createElement(nr,{themeConfig:t.props.themeConfig,ref:function(e){return t.stepsRef=e},steps:e}))),s.createElement(wo,{isVisible:t.state.isConfirmDeleteModalVisible,onConfirm:t.onDataAlertDelete,confirmLoading:t.state.isDeletingDataAlert,onClose:function(){t.setState({isConfirmDeleteModalVisible:!1})},confirmText:"Delete",width:"450px"},s.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),s.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),t}return it(a)}();lt(pr,"propTypes",{authentication:bt,onErrorCallback:p.func,onSave:p.func,initialQuery:p.string,currentDataAlert:p.shape({}),isVisible:p.bool,allowDelete:p.bool,onClose:p.func,themeConfig:St,isManagement:p.bool,onManagementCreateDataAlert:p.func,onManagementDeleteDataAlert:p.func,title:p.string,titleIcon:p.oneOfType([p.element,p.instanceOf(Kt)]),enableQueryValidation:p.bool,onValidate:p.func}),lt(pr,"defaultProps",{authentication:Gt,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},themeConfig:Xt,isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var dr=["style"],mr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{}),lt(mt(e),"render",(function(){return s.createElement(ve,{className:e.props.className,ref:e.props.innerRef,renderTrackHorizontal:function(e){var t=e.style,n=dt(e,dr);return s.createElement("div",st({},n,{style:$e($e({},t),{},{left:"50%",width:"100px",top:0,transform:"translateX(-50%)"})}))}},e.props.children)})),e}return it(n)}();lt(mr,"propTypes",{}),lt(mr,"defaultProps",{});var fr="data:image/png;base64,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",gr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"MODAL_COMPONENT_KEY",d()),lt(mt(t),"NOTIFICATION_FETCH_LIMIT",10),lt(mt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0,hasMore:!0}),lt(mt(t),"componentDidMount",(function(){t.getNotifications(),_n(t.props.themeConfig)})),lt(mt(t),"componentDidUpdate",(function(e){se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig)})),lt(mt(t),"getNotifications",(function(){Vo($e($e({},t.props.authentication),{},{offset:t.state.nextOffset,limit:t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var a,o,r,i=ce(t.state.notificationList),l=t.state.nextOffset,s=t.state.pagination;e(n,"items.length")&&(i=[].concat(ht(i),ht(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.setState({notificationList:i,pagination:s,nextOffset:l,hasMore:c,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),lt(mt(t),"refreshNotifications",(function(){Vo($e($e({},Jt(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var n=t.detectNewNotifications(e.items);if(!se(e.items,t.state.notificationList))if(null!=n&&n.length&&10!==(null==n?void 0:n.length)){var a=[].concat(ht(n),ht(t.state.notificationList));t.setState({notificationList:a,pagination:$e({},e.pagination),nextOffset:a.length-1})}else t.setState({notificationList:e.items,pagination:e.pagination})}))})),lt(mt(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})),lt(mt(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),$e($e({},t),{},{expanded:!t.expanded})):$e($e({},t),{},{expanded:!1})}));t.setState({notificationList:a,activeNotificationId:n})})),lt(mt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return $e($e({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Oo($e({},Jt(t.props.authentication))).then((function(){t.props.onDismissCallback(e),t.props.onChange(e)})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),lt(mt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?$e($e({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n},(function(){t.props.onDismissCallback(n)}))})),lt(mt(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)}))})),lt(mt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),lt(mt(t),"renderDismissAllButton",(function(){return s.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},s.createElement("span",{onClick:t.onDismissAllClick},s.createElement(Kt,{type:"notification-off",style:{verticalAlign:"middle"}})," ","Dismiss All"))})),lt(mt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),lt(mt(t),"renderEditDataAlertModal",(function(){return s.createElement(pr,{key:t.MODAL_COMPONENT_KEY,authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:t.state.isEditModalVisible,onClose:function(){return t.setState({isEditModalVisible:!1})},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?s.createElement(Kt,{type:"edit"}):s.createElement("span",null)})})),lt(mt(t),"render",(function(){return t.props.shouldRender?t.state.isFetchingFirstNotifications?s.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?s.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",s.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},s.createElement(Wa,{onClick:t.getInitialNotifications},"Try Again"))):s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-list-container","data-test":"notification-list"},s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?s.createElement(c,null,t.renderDismissAllButton(),s.createElement(mr,null,s.createElement(ue,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,loader:s.createElement("div",{className:"loader",key:0},s.createElement(ya,null)),useWindow:!1},s.createElement("div",{className:"notification-feed-list"},t.state.notificationList.map((function(e,n){return s.createElement(tr,{key:"notification-item-".concat(n),authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,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})})))))):s.createElement("div",{className:"empty-notifications-message"},s.createElement("img",{className:"empty-notifications-img",src:fr}),s.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),s.createElement("div",null,"Stay tuned!"),s.createElement("br",null),t.props.showCreateAlertBtn&&s.createElement(Wa,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal())):null})),t}return it(a)}();lt(gr,"propTypes",{authentication:bt,themeConfig:St,onCollapseCallback:p.func,onExpandCallback:p.func,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,onDismissCallback:p.func,onDeleteCallback:p.func,onChange:p.func,autoChartAggregations:p.bool,showCreateAlertBtn:p.bool,enableAjaxTableData:p.bool,shouldRender:p.bool}),lt(gr,"defaultProps",{authentication:Gt,themeConfig:Xt,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(){},onChange:function(){}});var hr=function(e){var t=n(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},vr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts(),_n(t.props.themeConfig)})),lt(mt(t),"componentDidUpdate",(function(e,n){se(en(t.props.themeConfig),en(e.themeConfig))||_n(t.props.themeConfig),se(Jt(t.props.authentication),Jt(e.authentication))||t.getDataAlerts()})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1})),lt(mt(t),"getDataAlerts",(function(n){Io($e($e({},Jt(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)}))})),lt(mt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),lt(mt(t),"onAddClick",(function(){t.setState({isEditModalVisible:!0,activeDataAlert:void 0})})),lt(mt(t),"onDataAlertSave",(function(){t.getDataAlerts(),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1})})),lt(mt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),lt(mt(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?$e($e({},e),{},{status:a}):e}));t.setState(lt({},"".concat(o),r)),Qo($e({dataAlertId:n.id,type:n.type,status:a},Jt(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.getDataAlerts()}))})),lt(mt(t),"renderNotificationEditModal",(function(){return s.createElement(pr,{ref:function(e){return t.editModalRef=e},themeConfig:t.props.themeConfig,key:t.COMPONENT_KEY,authentication:Jt(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?s.createElement(Kt,{type:"edit"}):s.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),lt(mt(t),"renderNotificationGroupTitle",(function(e,n,a){return s.createElement("div",{className:"react-autoql-notification-title-container"},s.createElement("div",{style:{paddingLeft:"10px"}},s.createElement("div",{style:{fontSize:"17px"}},e),s.createElement("div",{style:{fontSize:"11px",opacity:.6}},n)),a&&t.props.showCreateAlertBtn&&s.createElement("div",{className:"react-autoql-notification-add-btn",onClick:t.onAddClick,"data-tip":"Create Data Alert","data-for":"react-autoql-notification-settings-tooltip"},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon"})))})),lt(mt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),lt(mt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),lt(mt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),lt(mt(t),"renderNotificationlist",(function(n,a){return"project"!==n||e(a,"length")?s.createElement("div",{className:"data-alerts-list-container"},"custom"===n&&t.renderNotificationGroupTitle("Custom Data Alerts","View and manage your custom Data Alerts",!0),"custom"===n&&!e(a,"length")&&t.renderEmptyListMessage(),"project"===n&&t.renderNotificationGroupTitle("Subscribe to a Data Alert","Choose from a range of ready-to-use Alerts that have been set up for you"),s.createElement("div",{className:"react-autoql-notification-settings-container"},a&&a.map((function(e,n){return s.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},s.createElement("div",{className:"react-autoql-notification-setting-item-header"},s.createElement("div",{className:"react-autoql-notification-setting-display-name"},s.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},s.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?s.createElement(Kt,{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}):s.createElement(Kt,{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)),s.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&s.createElement("span",null," - ",e.message))),s.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&s.createElement(Kt,{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&&s.createElement(Kt,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat(hr(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?s.createElement(s.Fragment,null,"CUSTOM"===e.type&&s.createElement(Wa,{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()}},s.createElement("span",{className:"react-autoql-re-initialize-btn-text"},s.createElement(Kt,{type:"warning-triangle"})," Resend")),s.createElement(Ua,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):s.createElement(Ua,{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),le.hide()}}))))})))):null})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},s.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),s.createElement("br",null),t.props.showCreateAlertBtn&&s.createElement(Wa,{type:"primary",onClick:t.onAddClick,style:{marginTop:"10px"}},"Create Data Alert"))})),lt(mt(t),"render",(function(){if(!t.state.customAlertsList)return s.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},s.createElement(da,null));var n=e(t.state,"projectAlertsList",[]),a=e(t.state,"customAlertsList",[]);return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",a),t.renderNotificationEditModal(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return it(a)}();lt(vr,"propTypes",{authentication:bt,themeConfig:St,onErrorCallback:p.func,showCreateAlertBtn:p.bool,onSuccessAlert:p.func}),lt(vr,"defaultProps",{authentication:Gt,themeConfig:Xt,showCreateAlertBtn:!1,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var yr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"autoCompleteTimer",void 0),lt(mt(o),"state",$e({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{}}(o.props.initialData))),lt(mt(o),"componentDidMount",(function(){o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state,t)||o.props.onUpdate(o.props.ruleId,o.isComplete(),o.isValid())})),lt(mt(o),"componentWillUnmount",(function(){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer)})),lt(mt(o),"parseJSON",(function(e){1===e.length?(o.TERM_ID_1=e[0].id,o.TERM_ID_2=d(),o.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(o.TERM_ID_1=e[0].id,o.TERM_ID_2=e[1].id,o.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),lt(mt(o),"getJSON",(function(){if("EXISTS"===o.state.conditionSelectValue)return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value}];var e=o.state.input2Value;return[{id:o.TERM_ID_1,term_type:"query",condition:o.state.conditionSelectValue,term_value:o.state.input1Value},{id:o.TERM_ID_2,term_type:o.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:o.isNumerical(e)?Number(e):e}]})),lt(mt(o),"isNumerical",(function(e){return!Number.isNaN(Number(e))})),lt(mt(o),"isComplete",(function(){return"EXISTS"===o.state.conditionSelectValue?!!o.state.input1Value:!!e(o.state.input1Value,"length")&&!!e(o.state.input2Value,"length")})),lt(mt(o),"isValid",(function(){return!o.props.enableQueryValidation||("EXISTS"===o.state.conditionSelectValue?o.state.isFirstTermValid:o.state.isFirstTermValid&&o.state.isSecondTermValid)})),lt(mt(o),"validateFirstTerm",(function(){o.props.enableQueryValidation?o.state.input1Value&&!o.state.isValidatingFirstTerm&&o.state.lastCheckedFirstTermValue!==o.state.input1Value&&(o.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:o.state.input1Value,isValidatingFirstTerm:!0}),Mo($e({query:o.state.input1Value},Jt(o.props.authentication))).then((function(){o.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){o.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):o.setState({isFirstTermValid:!0})})),lt(mt(o),"validateSecondTerm",(function(){o.props.enableQueryValidation?o.state.input2Value&&Number.isNaN(Number(o.state.input2Value))?o.state.isValidatingSecondTerm||o.state.lastCheckedSecondTermValue===o.state.input2Value||(o.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:o.state.input2Value,isValidatingSecondTerm:!0}),Mo($e({query:o.state.input2Value},Jt(o.props.authentication))).then((function(){o.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){o.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):o.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:o.state.input2Value}):o.setState({isSecondTermValid:!0})})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),lt(mt(o),"onSuggestionsFetchRequested",(function(e){var t=e.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e($e($e({},Jt(o.props.authentication)),getAutoQLConfig(o.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var r=0;r<t.length&&(n.push(t[r]),4!==r);r++);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)}o.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),lt(mt(o),"renderReadOnlyRule",(function(){return s.createElement(yt,null,s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},"".concat(Un(o.state.input1Value))),s.createElement("span",{className:"read-only-rule-term"},"".concat(o.renderConditionOperator(o.state.conditionSelectValue))),"EXISTS"!==o.state.conditionSelectValue&&s.createElement("span",{className:"read-only-rule-term"},Un(o.state.input2Value)),o.props.andOrValue&&s.createElement("span",{className:"read-only-rule-term"},o.props.andOrValue)))})),lt(mt(o),"renderValidationError",(function(){return s.createElement("div",{className:"expression-term-validation-error"},s.createElement(Kt,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),lt(mt(o),"renderRule",(function(){return s.createElement(yt,null,s.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query",value:o.state.input1Value,onChange:function(e){return o.setState({input1Value:e.target.value})},onBlur:o.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&o.validateFirstTerm()}}),!o.state.isFirstTermValid&&o.renderValidationError()),s.createElement(yo,{themeConfig:o.props.themeConfig,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:s.createElement("span",null,"∃"),tooltip:"Exists"}],value:o.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){o.setState({conditionSelectValue:e})}}),s.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===o.state.conditionSelectValue?" hidden":"")},s.createElement("div",{className:"react-autoql-rule-input"},s.createElement(Jo,{placeholder:"Type a query or number",value:o.state.input2Value,onChange:function(e){return o.setState({input2Value:e.target.value})},onBlur:o.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&o.validateSecondTerm()}}),!o.state.isSecondTermValid&&o.renderValidationError())),s.createElement(Kt,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){o.props.onDelete(o.props.ruleId)}})))})),lt(mt(o),"render",(function(){return o.props.readOnly?o.renderReadOnlyRule():o.renderRule()})),o.initialData={},o.TERM_ID_1=d(),o.TERM_ID_2=d();var r=t.initialData;return r&&1===r.length?(o.TERM_ID_1=r[0].id,o.TERM_ID_2=d()):r&&r.length>1&&(o.TERM_ID_1=r[0].id,o.TERM_ID_2=r[1].id),o}return it(a)}();lt(yr,"propTypes",{authentication:bt,themeConfig:St,ruleId:p.string,onAdd:p.func,onDelete:p.func,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool,enableQueryValidation:p.bool}),lt(yr,"defaultProps",{authentication:Gt,themeConfig:Xt,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var br=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,a=e.id||d();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:d(),type:"rule",isComplete:!1}),t={rules:n}),t},Cr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"ID",d()),lt(mt(e),"ruleRefs",[]),lt(mt(e),"state",$e({rules:[],andOrSelectValue:"ALL"},br(e.props.initialData))),lt(mt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),lt(mt(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||d(),term_type:"group",condition:a,term_value:r}}))})),lt(mt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isComplete()}))})),lt(mt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isValid()}))})),lt(mt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),lt(mt(e),"onRuleUpdate",(function(t,n,a){var o=e.state.rules.map((function(e){return e.id===t?$e($e({},e),{},{isComplete:n,termValue:a}):e}));e.setState({rules:o}),e.props.onUpdate(e.props.groupId,e.isComplete())})),lt(mt(e),"addRule",(function(){var t=d(),n=[].concat(ht(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),lt(mt(e),"addGroup",(function(){var t=d(),n=[].concat(ht(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),lt(mt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),lt(mt(e),"renderAllAnySelect",(function(){return s.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",s.createElement(ar,{themeConfig:e.props.themeConfig,options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),lt(mt(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:s.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},s.createElement(Kt,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),lt(mt(e),"renderAddBtn",(function(){return e.props.readOnly?null:s.createElement("div",{className:"notification-rule-btn-container"},s.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),lt(mt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return s.createElement(yt,null,s.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&s.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&&s.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")),s.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?s.createElement(yr,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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?s.createElement(n,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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())))})),lt(mt(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"),s.createElement(yt,null,s.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,o){return"rule"===t.type?s.createElement(yr,{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?s.createElement("div",{key:"group-".concat(t.id)},s.createElement(n,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),o!==e.state.rules.length-1&&s.createElement("div",null,s.createElement("span",{className:"read-only-rule-term"},a))):void 0}))))})),lt(mt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return it(n)}();lt(Cr,"propTypes",{authentication:bt,themeConfig:St,groupId:p.string,onDelete:p.func,onUpdate:p.func,disableAddGroupBtn:p.bool,hideTopCondition:p.bool,readOnly:p.bool,enableQueryValidation:p.bool}),lt(Cr,"defaultProps",{authentication:Gt,themeConfig:Xt,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Er=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:d(),isComplete:!1}),n={groups:a}),n},Sr=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"groupRefs",[]),lt(mt(e),"state",$e({groups:[],andOrValue:"ALL"},Er(e.props.expression))),lt(mt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(e),"componentDidUpdate",(function(t,n){se(t.expression,e.props.expression)||e.setState($e({},Er(e.props.expression))),se(n,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isComplete()}))})),lt(mt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isValid()}))})),lt(mt(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||d(),term_type:"group",condition:a,term_value:r}}))})),lt(mt(e),"addGroup",(function(t){var n=t.initialData,a=t.isComplete,o=t.id||d(),r=[].concat(ht(e.state.groups),[{initialData:n,isComplete:a,id:o}]);e.setState({groups:r})})),lt(mt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),lt(mt(e),"getAndOrValue",(function(){return e.state.andOrValue})),lt(mt(e),"onGroupUpdate",(function(t,n){var a=e.state.groups.map((function(e){return e.id===t?$e($e({},e),{},{isComplete:n}):e}));e.setState({groups:a}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),lt(mt(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"),s.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(a,o){return s.createElement("div",{key:"expression-group-readonly-".concat(a.id,"-").concat(o)},s.createElement(Cr,{themeConfig:e.props.themeConfig,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&&s.createElement("div",{style:{textAlign:"center",margin:"2px"}},s.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),lt(mt(e),"renderRules",(function(){var t=e.state.groups.length<=1;return s.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&s.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",s.createElement(ar,{themeConfig:e.props.themeConfig,options:["ALL","ANY"],value:e.state.andOrValue,type:"button",onChange:function(t){return e.setState({andOrValue:t})}})," ","of the following conditions are met:"),s.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,a){return s.createElement(Cr,{authentication:Jt(e.props.authentication),themeConfig:e.props.themeConfig,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&&s.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},s.createElement(Kt,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return it(n)}();lt(Sr,"propTypes",{authentication:bt,themeConfig:St,expression:p.arrayOf(p.shape({})),readOnly:p.bool,onChange:p.func}),lt(Sr,"defaultProps",{authentication:Gt,themeConfig:Xt,expression:void 0,readOnly:!1,onChange:function(){}});var Tr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",lt({themeConfig:Xt,channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),lt(mt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),lt(mt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),qo($e($e({},Jt(t.props.authentication)),{},{channelType:"slack"})).then((function(e){t.setState({channels:e.data.items,isFetchingChannels:!1,activePage:"channel-list"})})).catch((function(e){t.setState({activePage:"fetch-error",isFetchingChannels:!1})}))})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{className:"slack-modal-empty-list-message"},s.createElement("div",null,"You don't have any ",s.createElement(Kt,{type:"slack"})," Slack channels connected yet."),s.createElement(Wa,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},s.createElement(Kt,{type:"plus"})," Connect a Channel"))})),lt(mt(t),"getAttachmentToSend",(function(){t.attachment=void 0;try{t.props.responseRef.getBase64Data().then((function(e){t.attachment=e})).catch((function(){}))}catch(e){t.props.onErrorCallback(e)}})),lt(mt(t),"getVizType",(function(){return An(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),lt(mt(t),"sendDataToSlack",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Bo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id,fileName:"chart"===t.getVizType()?"chart.png":"table.csv",base64Data:t.attachment})).then((function(){t.setState({isSendingData:!1}),t.props.onClose()})).catch((function(){t.setState({isSendingData:!1})})):(t.setState({isSendingData:!1}),t.props.onErrorCallback())})),lt(mt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Wo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=ce(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),lt(mt(t),"renderRemoveChannelBtn",(function(){return s.createElement(me,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:s.createElement("div",{className:"remove-channel-popover"},s.createElement("div",{className:"react-autoql-confirm-text"},s.createElement(Kt,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),s.createElement(Wa,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},s.createElement(Kt,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),lt(mt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null));if(0===t.state.channels.length)return t.renderEmptyListMessage();var e=t.state.channels.map((function(e,t){return{value:t,label:"# ".concat(e.channel_name)}}));e.push({value:"connect-channel",label:s.createElement("span",null,s.createElement(Kt,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return s.createElement("div",{className:"slack-channel-list-container"},s.createElement("div",{className:"slack-channel-list"},s.createElement("div",null,"AutoQL will post an email to the selected Slack channel with the"," ",n," attached."),s.createElement("br",null),s.createElement("div",{className:"select-channel-titles"},"Post to:"," ",s.createElement(yo,{themeConfig:t.props.themeConfig,options:e,value:t.state.selectedChannel,style:{width:"300px"},selectionPlaceholder:"Select a Slack Channel",onChange:function(e){"connect-channel"===e?t.setState({activePage:"connect-channel"}):t.setState({selectedChannel:e})}}),!Number.isNaN(Number(t.state.selectedChannel))&&t.renderRemoveChannelBtn())))})),lt(mt(t),"renderFetchErrorMessage",(function(){return s.createElement("div",{className:"slack-modal-error-container"},s.createElement("div",null,Tt.GENERAL_HTML),s.createElement(Wa,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),lt(mt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),Ho($e($e({},Jt(t.props.authentication)),{},{channelType:"slack",channelName:t.state.channelName,channelEmail:t.state.channelEmail,userName:t.state.userName,userEmail:t.state.userEmail})).then((function(e){var n=e.data.data,a=[].concat(ht(t.state.channels),[n]);t.setState({isConnectingChannel:!1,channels:a,activePage:"channel-list",channelEmail:void 0,channelName:void 0,userEmail:void 0,userName:void 0})})).catch((function(e){t.props.onErrorCallback(e),t.setState({isConnectingChannel:!1})}))})),lt(mt(t),"renderConnectChannelPage",(function(){return s.createElement("div",{className:"connect-channel-form-container"},s.createElement("div",{className:"connect-channel-form"},s.createElement("div",{className:"connect-channel-title"},"Connect a Slack Channel"),s.createElement(Kt,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),s.createElement("div",null,"Channel Name"),s.createElement(Jo,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),s.createElement("div",null,"Channel Email Address"," ",s.createElement(me,{isOpen:t.state.isSlackEmailInstructionVisible,onClickOutside:function(){return t.setState({isSlackEmailInstructionVisible:!1})},position:"top",content:s.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},s.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isSlackEmailInstructionVisible:!0})}},s.createElement(Kt,{type:"question"})," How do I find this?"))),s.createElement(Jo,{placeholder:"e.g. 1234@slack.com",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),s.createElement("div",null,"Your Name"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Slack)")),s.createElement(Jo,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),s.createElement("div",null,"Your Email"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Slack)")),s.createElement(Jo,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),s.createElement("div",{className:"connect-channel-btn"},s.createElement(Wa,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),lt(mt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),lt(mt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?s.createElement("div",null,s.createElement(Wa,{type:"primary",className:"send-to-slack-btn",disabled:!e(t.state.channels,"".concat(t.state.selectedChannel))||!t.attachment,onClick:t.sendDataToSlack,loading:t.state.isSendingData},s.createElement(Kt,{type:"send"})," Send to Slack")):null})),t}return it(a,[{key:"render",value:function(){return s.createElement(Ao,{themeConfig:this.props.themeConfig,isVisible:this.props.isVisible,onClose:this.props.onClose,title:s.createElement("span",null,"Send to ",s.createElement(Kt,{type:"slack"})," Slack"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();lt(Tr,"propTypes",{themeConfig:St,authentication:bt,isVisible:p.bool}),lt(Tr,"defaultProps",{authentication:Gt,isVisible:!1});var Dr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",lt({channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),lt(mt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),lt(mt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),qo($e($e({},Jt(t.props.authentication)),{},{channelType:"teams"})).then((function(e){t.setState({channels:e.data.items,isFetchingChannels:!1,activePage:"channel-list"})})).catch((function(e){t.setState({activePage:"fetch-error",isFetchingChannels:!1})}))})),lt(mt(t),"renderEmptyListMessage",(function(){return s.createElement("div",{className:"slack-modal-empty-list-message"},s.createElement("div",null,"You don't have any ",s.createElement(Kt,{type:"teams"})," Teams channels connected yet."),s.createElement(Wa,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},s.createElement(Kt,{type:"plus"})," Connect a Channel"))})),lt(mt(t),"getAttachmentToSend",(function(){t.attachment=void 0;try{t.props.responseRef.getBase64Data().then((function(e){t.attachment=e})).catch((function(){}))}catch(e){t.props.onErrorCallback(e)}})),lt(mt(t),"getVizType",(function(){return An(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),lt(mt(t),"sendDataToTeams",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Bo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id,fileName:"chart"===t.getVizType()?"chart.png":"table.csv",base64Data:t.attachment})).then((function(){t.setState({isSendingData:!1}),t.props.onClose()})).catch((function(){t.setState({isSendingData:!1})})):(t.setState({isSendingData:!1}),t.props.onErrorCallback())})),lt(mt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Wo($e($e({},Jt(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=ce(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),lt(mt(t),"renderRemoveChannelBtn",(function(){return s.createElement(me,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:s.createElement("div",{className:"remove-channel-popover"},s.createElement("div",{className:"react-autoql-confirm-text"},s.createElement(Kt,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),s.createElement(Wa,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},s.createElement(Kt,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),lt(mt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null));if(0===t.state.channels.length)return t.renderEmptyListMessage();var e=t.state.channels.map((function(e,t){return{value:t,label:"".concat(e.channel_name)}}));e.push({value:"connect-channel",label:s.createElement("span",null,s.createElement(Kt,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return s.createElement("div",{className:"slack-channel-list-container"},s.createElement("div",{className:"slack-channel-list"},s.createElement("div",null,"AutoQL will post an email to the selected Teams channel with the"," ",n," attached."),s.createElement("br",null),s.createElement("div",{className:"select-channel-titles"},"Post to:"," ",s.createElement(yo,{themeConfig:t.props.themeConfig,options:e,value:t.state.selectedChannel,style:{width:"300px"},selectionPlaceholder:"Select a Teams Channel",onChange:function(e){"connect-channel"===e?t.setState({activePage:"connect-channel"}):t.setState({selectedChannel:e})}}),!Number.isNaN(Number(t.state.selectedChannel))&&t.renderRemoveChannelBtn())))})),lt(mt(t),"renderFetchErrorMessage",(function(){return s.createElement("div",{className:"slack-modal-error-container"},s.createElement("div",null,Tt.GENERAL_HTML),s.createElement(Wa,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),lt(mt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),Ho($e($e({},Jt(t.props.authentication)),{},{channelType:"teams",channelName:t.state.channelName,channelEmail:t.state.channelEmail,userName:t.state.userName,userEmail:t.state.userEmail})).then((function(e){var n=e.data.data,a=[].concat(ht(t.state.channels),[n]);t.setState({isConnectingChannel:!1,channels:a,activePage:"channel-list",channelEmail:void 0,channelName:void 0,userEmail:void 0,userName:void 0})})).catch((function(e){t.props.onErrorCallback(e),t.setState({isConnectingChannel:!1})}))})),lt(mt(t),"renderConnectChannelPage",(function(){return s.createElement("div",{className:"connect-channel-form-container"},s.createElement("div",{className:"connect-channel-form"},s.createElement("div",{className:"connect-channel-title"},"Connect a Teams Channel"),s.createElement(Kt,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),s.createElement("div",null,"Channel Name"),s.createElement(Jo,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),s.createElement("div",null,"Channel Email Address"," ",s.createElement(me,{isOpen:t.state.isTeamsEmailInstructionVisible,onClickOutside:function(){return t.setState({isTeamsEmailInstructionVisible:!1})},position:"top",content:s.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},s.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isTeamsEmailInstructionVisible:!0})}},s.createElement(Kt,{type:"question"})," How do I find this?"))),s.createElement(Jo,{placeholder:"e.g. 1234@amer.teams.ms",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),s.createElement("div",null,"Your Name"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Teams)")),s.createElement(Jo,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),s.createElement("div",null,"Your Email"," ",s.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Teams)")),s.createElement(Jo,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),s.createElement("div",{className:"connect-channel-btn"},s.createElement(Wa,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),lt(mt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?s.createElement("div",{className:"loading-container-centered"},s.createElement(da,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),lt(mt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?s.createElement("div",null,s.createElement(Wa,{type:"primary",className:"send-to-slack-btn",disabled:!e(t.state.channels,"".concat(t.state.selectedChannel))||!t.attachment,onClick:t.sendDataToTeams,loading:t.state.isSendingData},s.createElement(Kt,{type:"send"})," Send to Teams")):null})),t}return it(a,[{key:"render",value:function(){return s.createElement(Ao,{themeConfig:this.props.themeConfig,isVisible:this.props.isVisible,onClose:this.props.onClose,title:s.createElement("span",null,"Send to ",s.createElement(Kt,{type:"teams"})," Teams"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();lt(Dr,"propTypes",{authentication:bt,themeConfig:St,isVisible:p.bool}),lt(Dr,"defaultProps",{authentication:Gt,themeConfig:Xt,isVisible:!1});var xr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1})),lt(mt(t),"reportQueryProblem",(function(n){var a=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),ca($e({message:n,queryId:a},Jt(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})}))})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement(Ao,{className:t.props.className,contentClassName:t.props.contentClassName,isVisible:t.props.isVisible,onClose:function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})},onConfirm:function(){t.reportQueryProblem(t.state.reportProblemMessage),t.setState({reportProblemMessage:void 0})},confirmLoading:t.state.isReportingProblem,title:"Report a Problem",enableBodyScroll:!0,width:"600px",confirmText:"Report",confirmDisabled:!t.state.reportProblemMessage},"Please tell us more about the problem you are experiencing:",s.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}})))})),t}return it(a)}();lt(xr,"propTypes",{authentication:bt,responseRef:p.instanceOf(Do),onReportProblem:p.func,isVisible:p.bool}),lt(xr,"defaultProps",{authentication:Gt,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var kr,wr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",d()),lt(mt(t),"state",{isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t.rebuildTooltips()})),lt(mt(t),"componentDidUpdate",(function(e,n){"sql"===n.activeMenu&&"sql"!==t.state.activeMenu&&t.setState({sqlCopySuccess:!1}),t.rebuildTooltips()})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearTimeout(t.temporaryStateTimeout),clearTimeout(t.pivotTableCSVDownloadTimeout)})),lt(mt(t),"rebuildTooltips",(function(){t.props.rebuildTooltips?t.props.rebuildTooltips():le.rebuild()})),lt(mt(t),"onTableFilter",(function(n){"table"===e(t.props.responseRef,"props.displayType")&&t.setState({disableChartingOptions:e(n,"length")<2})})),lt(mt(t),"toggleTableFilter",(function(){t.filtering=!t.filtering,t.props.onFilterClick({isFilteringTable:t.filtering})})),lt(mt(t),"setTemporaryState",(function(e,n,a){t.setState(lt({},e,n)),t.temporaryStateTimeout=setTimeout((function(){t.setState(lt({},e,void 0))}),a)})),lt(mt(t),"copyTableToClipboard",(function(){t.props.responseRef?(t.props.responseRef.copyTableToClipboard(),t.props.onSuccessAlert("Successfully copied table to clipboard!"),t.setTemporaryState("copiedTable",!0,1e3),le.hide()):t.setTemporaryState("copiedTable",!1,1e3)})),lt(mt(t),"fetchCSVAndExport",(function(){var e,n,a,o,r,i,l,s,c=null===(e=t.props.responseRef)||void 0===e||null===(n=e.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.query_id,u=null===(r=t.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?void 0:s.text,p=d();t.props.onCSVDownloadStart({id:p,queryId:c,query:u}),ta($e($e({queryId:c},Jt(t.props.authentication)),{},{csvProgressCallback:function(e){return t.props.onCSVDownloadProgress({id:p,progress:e})}})).then((function(e){var n,a,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===(n=e.headers)||void 0===n?void 0:n.export_limit),s="true"==(null==e||null===(a=e.headers)||void 0===a||null===(o=a.limit_reached)||void 0===o?void 0:o.toLowerCase());t.props.onCSVDownloadFinish({id:p,exportLimit:l,limitReached:s})})).catch((function(e){t.props.onCSVDownloadFinish({id:p,error:e}),console.error(e)}))})),lt(mt(t),"onCSVMenuButtonClick",(function(){t.setState({activeMenu:void 0});var n,a,o="pivot_table"===e(t.props.responseRef,"props.displayType"),r=d();o?e(t.props,"responseRef.pivotTableRef._isMounted")&&(t.props.onCSVDownloadStart({id:r}),null===(n=t.props.responseRef)||void 0===n||null===(a=n.pivotTableRef)||void 0===a||a.saveAsCSV(2e3).then((function(){t.props.onCSVDownloadProgress({id:r,progress:100}),t.props.onCSVDownloadFinish({id:r})})).catch((function(e){console.error(e),t.props.onCSVDownloadFinish({id:r})}))):t.fetchCSVAndExport()})),lt(mt(t),"saveChartAsPNG",(function(){t.props.responseRef&&t.props.responseRef.saveChartAsPNG()})),lt(mt(t),"deleteMessage",(function(){le.hide(),t.props.deleteMessageCallback()})),lt(mt(t),"copySQL",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql"),a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),document.execCommand("copy"),t.setTemporaryState("copiedSQL",!0,1e3),t.props.onSuccessAlert("Successfully copied generated query to clipboard!"),t.setState({sqlCopySuccess:!0}),le.hide()})),lt(mt(t),"showHideColumnsModal",(function(){t.setState({isHideColumnsModalVisible:!0})})),lt(mt(t),"onColumnVisibilitySave",(function(e){var n=t.props.authentication,a=e.map((function(e){var t=$e($e({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));t.setState({isSettingColumnVisibility:!0}),la($e($e({},n),{},{columns:a})).then((function(){t._isMounted&&t.setState({isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1}),t.props.responseRef&&t.props.responseRef.updateColumns(a),t.props.onColumnVisibilitySave(a)})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t._isMounted&&t.setState({isSettingColumnVisibility:!1})}))})),lt(mt(t),"renderHideColumnsModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.columns");if(!n||!n.length)return null;var a=n.map((function(e){return $e($e({},e),{},{content:e.display_name,checked:e.is_visible})}));return s.createElement(yt,null,s.createElement(No,{themeConfig:t.props.themeConfig,columns:a,isVisible:t.state.isHideColumnsModalVisible,onClose:function(){return t.setState({isHideColumnsModalVisible:!1})},isSettingColumns:t.state.isSettingColumnVisibility,onConfirm:t.onColumnVisibilitySave}))})),lt(mt(t),"renderDataAlertModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.text");return s.createElement(yt,null,s.createElement(pr,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:"notification"===t.state.activeMenu,initialQuery:n,onClose:function(){return t.setState({activeMenu:void 0})},onErrorCallback:t.props.onErrorCallback,onSave:function(){t.props.onSuccessAlert("Successfully created a notification"),t.setState({activeMenu:void 0})}}))})),lt(mt(t),"renderReportProblemModal",(function(){return s.createElement(xr,{ref:function(e){return t.reportProblemRef=e},authentication:t.props.authentication,onClose:function(){t.setState({activeMenu:void 0})},onReportProblem:function(e){var n=e.successMessage,a=e.error;n?(t.props.onSuccessAlert(n),t._isMounted&&t.setState({activeMenu:void 0})):a&&t.props.onErrorCallback(a)},responseRef:t.props.responseRef,isVisible:"other-problem"===t.state.activeMenu})})),lt(mt(t),"reportQueryProblem",(function(e){var n;null!==(n=t.reportProblemRef)&&void 0!==n&&n._isMounted&&t.reportProblemRef.reportQueryProblem(e)})),lt(mt(t),"renderReportProblemMenu",(function(){return s.createElement("div",{className:"report-problem-menu"},s.createElement("ul",{className:"context-menu-list"},s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incorrect")}},"The data is incorrect"),s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incomplete")}},"The data is incomplete"),s.createElement("li",{onClick:function(){return t.setState({activeMenu:"other-problem"})}},"Other...")))})),lt(mt(t),"refreshData",(function(){})),lt(mt(t),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn"})),lt(mt(t),"renderMoreOptionsMenu",(function(e,n){return s.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},s.createElement("ul",{className:"context-menu-list"},n.showSaveAsCSVButton&&s.createElement("li",{onClick:t.onCSVMenuButtonClick,style:t.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},s.createElement(Kt,{type:"download",style:{marginRight:"7px"}}),t.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),n.showSaveAsPNGButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.saveChartAsPNG()}},s.createElement(Kt,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),n.showCopyButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.copyTableToClipboard()}},s.createElement(Kt,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),n.showSQLButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"sql"})}},s.createElement(Kt,{type:"database"})," View generated SQL"),n.showCreateNotificationIcon&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"notification"})}},s.createElement(Kt,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert..."),n.showShareToSlackButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"slack"})}},s.createElement(Kt,{style:{marginRight:"5px"},type:"slack"}),"Send to Slack..."),n.showShareToTeamsButton&&s.createElement("li",{onClick:function(){t.setState({activeMenu:"teams"})}},s.createElement(Kt,{style:{display:"inline-block",marginRight:"5px",marginTop:"-2px"},type:"teams"}),"Send to Teams...")))})),lt(mt(t),"isDrilldownResponse",(function(){try{return"Drilldown:"===e(t.props.responseRef,"queryResponse.data.data.text").split(" ")[0]}catch(e){return!1}})),lt(mt(t),"renderSendToSlackModal",(function(){return $t(t.props.autoQLConfig).enableSlackSharing?s.createElement(Tr,{themeConfig:t.props.themeConfig,authentication:Jt(t.props.authentication),isVisible:"slack"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),lt(mt(t),"renderSendToTeamsModal",(function(){return $t(t.props.autoQLConfig).enableTeamsSharing?s.createElement(Dr,{authentication:Jt(t.props.authentication),themeConfig:t.props.themeConfig,isVisible:"teams"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),lt(mt(t),"renderSQLModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql[0]");return n?s.createElement(yt,null,s.createElement(Ao,{themeConfig:t.props.themeConfig,isVisible:"sql"===t.state.activeMenu,footer:s.createElement("div",null,s.createElement(Wa,{type:"primary",onClick:function(){return t.setState({activeMenu:void 0})}},"Ok")),onClose:function(){return t.setState({activeMenu:void 0})},title:"Generated SQL",enableBodyScroll:!1,width:"600px"},s.createElement("div",{className:"copy-sql-modal-content"},s.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(Ue(n)),disabled:!0}),s.createElement(Wa,{className:"copy-sql-btn ".concat(t.state.sqlCopySuccess?"sql-copied":""),onClick:t.copySQL,tooltip:"Copy to Clipboard"},s.createElement(Kt,{type:"copy"}),t.state.sqlCopySuccess&&s.createElement(Kt,{type:"check",className:"sql-copied"}))))):null})),lt(mt(t),"renderToolbar",(function(e){return s.createElement(yt,null,s.createElement("div",{className:"autoql-options-toolbar\n ".concat(t.state.activeMenu?"active":"","\n ").concat(t.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&s.createElement("button",{onClick:t.toggleTableFilter,className:t.getMenuItemClass(e.showFilterButton),"data-tip":"Filter table","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY)},s.createElement(Kt,{type:"filter"})),e.showHideColumnsButton&&s.createElement("button",{onClick:t.showHideColumnsModal,className:t.getMenuItemClass(e.showHideColumnsButton),"data-tip":"Show/hide columns","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-col-vis"},s.createElement(Kt,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&s.createElement(me,{key:d(),isOpen:"report-problem"===t.state.activeMenu,padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},position:"bottom",content:function(e){return t.renderReportProblemMenu(e)}},s.createElement("button",{onClick:function(){t.setState({activeMenu:"report-problem"})},className:t.getMenuItemClass(e.showReportProblemButton),"data-tip":"Report a problem","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY)},s.createElement(Kt,{type:"warning-triangle"}))),e.showRefreshDataButton&&s.createElement("button",{onClick:t.refreshData,className:t.getMenuItemClass(e.showRefreshDataButton),"data-tip":"Re-run query","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-trash-btn"},s.createElement(Kt,{type:"refresh"})),e.showDeleteButton&&s.createElement("button",{onClick:t.deleteMessage,className:t.getMenuItemClass(e.showDeleteButton),"data-tip":"Delete data response","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"options-toolbar-trash-btn"},s.createElement(Kt,{type:"trash"})),e.showMoreOptionsButton&&s.createElement(me,{key:d(),isOpen:"more-options"===t.state.activeMenu,position:"bottom",padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},content:function(n){return t.renderMoreOptionsMenu(n,e)}},s.createElement("button",{onClick:function(){le.hide(),t.setState({activeMenu:"more-options"})},className:t.getMenuItemClass(e.showMoreOptionsButton),"data-tip":"More options","data-for":"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),"data-test":"react-autoql-toolbar-more-options-btn"},s.createElement(Kt,{type:"more-vertical"})))))})),lt(mt(t),"getShouldShowButtonObj",(function(){var n={};try{var a=e(t.props.responseRef,"props.displayType"),o=Nn(a),r=An(a),i=e(t.props.responseRef,"queryResponse"),l="data"===e(i,"data.data.display_type"),s=In(i),c=qn(i),u=e(i,"data.data.rows.length"),p=u>0,d=u>1,m=$t(t.props.autoQLConfig);(n={showFilterButton:o&&!s&&d,showCopyButton:o&&!s,showSaveAsPNGButton:r,showHideColumnsButton:m.enableColumnVisibilityManager&&p&&("table"===a||"text"===a&&s),showHiddenColsBadge:c,showSQLButton:l&&m.debug,showSaveAsCSVButton:o&&d&&m.enableCSVDownload,showDeleteButton:t.props.enableDeleteBtn,showReportProblemButton:m.enableReportProblem&&!!e(i,"data.data.query_id"),showCreateNotificationIcon:l&&m.enableNotifications&&!t.isDrilldownResponse(),showRefreshDataButton:!1,showShareToSlackButton:!1,showShareToTeamsButton:!1}).showMoreOptionsButton=n.showCopyButton||n.showSQLButton||n.showCreateNotificationIcon||n.showSaveAsCSVButton||n.showSaveAsPNGButton||n.showShareToSlackButton||n.showShareToTeamsButton}catch(e){console.error(e)}return n})),lt(mt(t),"render",(function(){var e=t.getShouldShowButtonObj();return Object.values(e).find((function(e){return!0===e}))?s.createElement(yt,null,t.renderToolbar(e),e.showHideColumnsButton&&t.renderHideColumnsModal(),e.showReportProblemButton&&t.renderReportProblemModal(),e.showMoreOptionsButton&&t.renderDataAlertModal(),e.showSQLButton&&t.renderSQLModal(),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-options-toolbar-tooltip-".concat(t.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),t}return it(a)}();lt(wr,"propTypes",{authentication:bt,autoQLConfig:Et,themeConfig:St,responseRef:p.instanceOf(Do),enableDeleteBtn:p.bool,onSuccessAlert:p.func,onErrorCallback:p.func,onNewNotificationCallback:p.func,deleteMessageCallback:p.func,onFilterClick:p.func,onCSVDownloadStart:p.func,onCSVDownloadFinish:p.func,onCSVDownloadProgress:p.func,rebuildTooltips:p.func}),lt(wr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,themeConfig:Xt,responseRef:void 0,enableDeleteBtn:!1,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},onFilterClick:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var Ar=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.scrollToBottomTimeout=setTimeout((function(){o.props.scrollToBottom()}),100),clearTimeout(o.animationTimeout),o.animationTimeout=setTimeout((function(){o.setState({isAnimatingMessageBubble:!1}),o.props.scrollToBottom()}),500),o.calculatedQueryOutputStyle=e(o.responseRef,"style"),o.calculatedQueryOutputHeight=e(o.responseRef,"offsetHeight")})),lt(mt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),lt(mt(o),"componentDidUpdate",(function(e,t){le.hide()})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.scrollToBottomTimeout),clearTimeout(o.scrollIntoViewTimeout),clearTimeout(o.animationTimeout)})),lt(mt(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 c=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:s.createElement(s.Fragment,null,"Your file has successfully been downloaded with the query"," ",s.createElement("b",null,s.createElement("i",null,c)),".",l?s.createElement(s.Fragment,null,s.createElement("br",null),s.createElement("p",null,s.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)})})),lt(mt(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})),lt(mt(o),"scrollIntoView",(function(){clearTimeout(o.scrollIntoViewTimeout),o.scrollIntoViewTimeout=setTimeout((function(){o.messageContainerRef&&!o.isScrolledIntoView(o.messageContainerRef)&&(o.scrollIntoViewTimer=o.messageContainerRef.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"}))}),0)})),lt(mt(o),"switchView",(function(e){o.filtering=!1,o.setState({displayType:e},o.scrollIntoView)})),lt(mt(o),"onSupportedDisplayTypesChange",(function(e){o.setState({supportedDisplayTypes:e})})),lt(mt(o),"renderFetchingFileMessage",(function(){return s.createElement("div",null,"Fetching your file ",s.createElement(ya,null))})),lt(mt(o),"renderCSVProgressMessage",(function(){return isNaN(o.state.csvDownloadProgress)?o.renderFetchingFileMessage():"Downloading your file ... ".concat(o.state.csvDownloadProgress,"%")})),lt(mt(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")?Tt.UNAUTHENTICATED:o.props.response?s.createElement(Do,{ref:function(e){return o.responseRef=e},authentication:Jt(o.props.authentication),autoQLConfig:$t(o.props.autoQLConfig),queryResponse:o.props.response,displayType:o.state.displayType,onSuggestionClick:o.props.onSuggestionClick,isQueryRunning:o.props.isChataThinking,themeConfig:o.props.themeConfig,copyToClipboard:o.copyToClipboard,dataFormatting:Zt(o.props.dataFormatting),appliedFilters:o.props.appliedFilters,onDrilldownStart:o.props.onDrilldownStart,onDrilldownEnd:o.props.onDrilldownEnd,demo:Jt(o.props.authentication).demo,enableAjaxTableData:o.props.enableAjaxTableData,onSupportedDisplayTypesChange:o.onSupportedDisplayTypesChange,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),onErrorCallback:o.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isResizing:o.props.isResizing,isAnimatingContainer:o.state.isAnimatingMessageBubble,enableDynamicCharting:o.props.enableDynamicCharting,optionsToolbarRef:o.optionsToolbarRef,onNoneOfTheseClick:o.props.onNoneOfTheseClick,queryRequestData:o.props.queryRequestData,autoChartAggregations:o.props.autoChartAggregations,showQueryInterpretation:!0,onRecommendedDisplayType:o.switchView,enableFilterLocking:o.props.enableFilterLocking,onRTValueLabelClick:o.props.onRTValueLabelClick,rebuildTooltips:o.props.rebuildTooltips,source:o.props.source,reportProblemCallback:function(){var e;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.optionsToolbarRef.setState({activeMenu:"other-problem"})}}):Tt.GENERAL_QUERY})),lt(mt(o),"toggleTableFilter",(function(e){var t=e.isFilteringTable;o.responseRef&&o.responseRef.toggleTableFilter({isFilteringTable:t})})),lt(mt(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})})),lt(mt(o),"onDisplayTypeChange",(function(e){var t;o.toggleTableFilter({isFilteringTable:!1}),null!==(t=o.optionsToolbarRef)&&void 0!==t&&t._isMounted&&(o.optionsToolbarRef.filtering=!1),o.switchView(e)})),lt(mt(o),"renderRightToolbar",(function(){return s.createElement("div",{className:"chat-message-toolbar right"},o.props.isResponse&&"help"!==o.state.displayType&&"suggestion"!==o.state.displayType?s.createElement(wr,{ref:function(e){return o.optionsToolbarRef=e},authentication:o.props.authentication,autoQLConfig:$t(o.props.autoQLConfig),themeConfig:o.props.themeConfig,responseRef:o.responseRef,displayType:o.state.displayType,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadFinish:o.onCSVDownloadFinish,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onSuccessAlert:o.props.onSuccessAlert,onErrorCallback:o.props.onErrorCallback,enableDeleteBtn:!o.props.isIntroMessage,deleteMessageCallback:function(){return o.props.deleteMessageCallback(o.props.id)},rebuildTooltips:o.props.rebuildTooltips,onFilterClick:o.toggleTableFilter}):null)})),lt(mt(o),"renderLeftToolbar",(function(){var e=o.state.displayType;return o.state.supportedDisplayTypes&&!o.state.supportedDisplayTypes.includes(o.state.displayType)&&(e="table"),s.createElement("div",{className:"chat-message-toolbar left"},o.props.isResponse&&"text"!==o.props.type?s.createElement(ko,{themeConfig:o.props.themeConfig,supportedDisplayTypes:o.state.supportedDisplayTypes||[],displayType:e,onDisplayTypeChange:o.onDisplayTypeChange,disableCharts:o.state.disableChartingOptions}):null)})),lt(mt(o),"render",(function(){return s.createElement(yt,null,s.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 ")},s.createElement("div",{ref:function(e){return o.ref=e},className:"chat-message-bubble\n ".concat(An(o.state.displayType)?" full-width":"","\n ").concat("text"===o.props.type?" text":"","\n ").concat(o.state.displayType,"\n ").concat(o.props.isActive?" active":"")},o.renderContent(),!o.props.isResizing&&s.createElement("div",{className:"chat-message-toolbars-container"},o.renderLeftToolbar(),o.renderRightToolbar()))))})),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;var r=Fn(t.response,t.autoChartAggregations);return o.state=lt({csvDownloadProgress:o.props.initialCSVDownloadProgress,displayType:Fn(t.response,t.autoChartAggregations),supportedDisplayTypes:Pn({response:t.response}),isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},"displayType",r),o}return it(a)}();lt(Ar,"propTypes",(lt(kr={authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,isResponse:p.bool.isRequired,isIntroMessage:p.bool,isDataMessengerOpen:p.bool,isActive:p.bool,type:p.string,text:p.string,id:p.string.isRequired,displayType:p.string,onSuggestionClick:p.func,response:p.shape({}),content:p.oneOfType([p.string,p.shape({})]),enableColumnVisibilityManager:p.bool},"dataFormatting",Ct),lt(kr,"onErrorCallback",p.func),lt(kr,"onSuccessAlert",p.func),lt(kr,"isResizing",p.bool),lt(kr,"enableDynamicCharting",p.bool),lt(kr,"scrollToBottom",p.func),lt(kr,"onNoneOfTheseClick",p.func),lt(kr,"autoChartAggregations",p.bool),lt(kr,"onConditionClickCallback",p.func),lt(kr,"addMessageToDM",p.func),lt(kr,"csvDownloadProgress",p.number),lt(kr,"onRTValueLabelClick",p.func),lt(kr,"enableAjaxTableData",p.bool),lt(kr,"source",p.arrayOf(p.string)),kr)),lt(Ar,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,enableAjaxTableData:!1,isDataMessengerOpen:!1,isIntroMessage:!1,source:[],displayType:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,onRTValueLabelClick:void 0,onSuggestionClick:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){}});var Nr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(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)})),lt(mt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.feedbackTimeout)})),lt(mt(a),"escFunction",(function(e){a.state.isVisible&&e.keyCode})),lt(mt(a),"scrollToBottom",(function(){a.messengerScrollComponent&&a.messengerScrollComponent.scrollToBottom()})),lt(mt(a),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;a.csvProgressLog[t]=n,a.messageRefs[t]&&a.messageRefs[t].setState({csvDownloadProgress:n})})),lt(mt(a),"clearMessages",(function(){a.setState({messages:a.getIntroMessages(a.props.introMessages)})})),lt(mt(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)}})),lt(mt(a),"onNoneOfTheseClick",(function(){a.addRequestMessage("None of these"),a.setState({isChataThinking:!0}),clearTimeout(a.feedbackTimeout),a.feedbackTimeout=setTimeout((function(){a._isMounted&&(a.setState({isChataThinking:!1}),a.addResponseMessage({content:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")}))}),1e3)})),lt(mt(a),"onDrilldownStart",(function(){a.setState({isChataThinking:!0})})),lt(mt(a),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error;a._isMounted&&(a.setState({isChataThinking:!1}),t?a.addResponseMessage({response:t}):n&&a.addResponseMessage({content:n}))})),lt(mt(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)})),lt(mt(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})})),lt(mt(a),"getIntroMessages",(function(e){return e.map((function(e){return a.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),lt(mt(a),"addIntroMessage",(function(e){a.addIntroMessages([e])})),lt(mt(a),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&a.addMessages(a.getIntroMessages(e))})),lt(mt(a),"addMessage",(function(e){a.addMessages([e])})),lt(mt(a),"addMessages",(function(e){var t=[].concat(ht(a.state.messages),ht(e));t.length>a.props.maxMessages&&(t=t.slice(-a.props.maxMessages)),a.setState({messages:t})})),lt(mt(a),"addRequestMessage",(function(e){a.addMessage(a.createMessage({content:e,isResponse:!1}))})),lt(mt(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(Tt.UNAUTHENTICATED);else if("Parse error"===(null==o||null===(t=o.response)||void 0===t?void 0:t.error))n=a.createErrorMessage(Tt.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($e($e({},o),{},{appliedFilters:r}))}else n=a.createErrorMessage();n&&a.addMessage(n)})),lt(mt(a),"onInputSubmit",(function(e){a.addRequestMessage(e),a.setState({isChataThinking:!0})})),lt(mt(a),"onResponse",(function(e,t,n){var o,r;a._isMounted&&(a.getIsSuggestionResponse(e)&&a.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),Qe(null==e||null===(o=e.data)||void 0===o?void 0:o.data,"authorization_url")?a.addResponseMessage({content:s.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source.",s.createElement("a",{href:e.data.data.authorization_url,target:"_blank"},"Click here to authorize access then try querying again."))}):a.addResponseMessage({response:e,query:t,queryRequestData:n}),a.setState({isChataThinking:!1}),null!==(r=a.queryInputRef)&&void 0!==r&&r._isMounted&&a.queryInputRef.focus())})),lt(mt(a),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:d(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),lt(mt(a),"createMessage",(function(){var e,t,n,a,o,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=i.id||d();return $e({id:l,displayType:i.displayType||(null===(e=i.response)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.display_type),type:null===(a=i.response)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.display_type},i)})),lt(mt(a),"createErrorMessage",(function(e){return a.createMessage({content:e||Tt.GENERAL_QUERY,isResponse:!0,type:"error"})})),lt(mt(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(ht(r),ht(i))}catch(e){return[]}})),lt(mt(a),"render",(function(){return a.props.shouldRender&&a.props.isDataMessengerOpen?s.createElement(yt,null,s.createElement(mr,{innerRef:function(e){a.messengerScrollComponent=e},className:"chat-message-container",renderView:function(e){return s.createElement("div",st({},e,{className:"custom-scrollbar-container"}))}},a.state.messages.map((function(e){return s.createElement(Ar,{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,themeConfig:a.props.themeConfig,isCSVProgressMessage:e.isCSVProgressMessage,initialCSVDownloadProgress:a.csvProgressLog[e.id],onCSVDownloadProgress:a.onCSVDownloadProgress,queryId:e.queryId,queryText:e.query,scrollRef:a.messengerScrollComponent,isDataMessengerOpen:a.props.isDataMessengerOpen,isActive:a.state.activeMessageId===e.id,addMessageToDM:a.addResponseMessage,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.onDrilldownEnd,isResponse:e.isResponse,isChataThinking:a.state.isChataThinking,onSuggestionClick:a.animateInputTextAndSubmit,content:e.content,scrollToBottom:a.scrollToBottom,dataFormatting:a.props.dataFormatting,displayType:e.displayType,response:e.response,type:e.type,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessAlert,deleteMessageCallback:a.deleteMessage,scrollContainerRef:a.messengerScrollComponent,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,rebuildTooltips:a.props.rebuildTooltips,queryRequestData:e.queryRequestData,source:a.props.source})}))),a.state.isChataThinking&&s.createElement("div",{className:"response-loading-container"},s.createElement(da,null)),s.createElement("div",{className:"chat-bar-container"},s.createElement("div",{className:"watermark"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"}),xt.run),s.createElement(ma,{ref:function(e){return a.queryInputRef=e},className:"chat-drawer-chat-bar",authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,themeConfig:a.props.themeConfig,onSubmit:a.onInputSubmit,onResponseCallback:a.onResponse,isDisabled:a.state.isChataThinking,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}))):null})),a.messageRefs={},a.csvProgressLog={},a.state={messages:[]},a}return it(n)}();lt(Nr,"propTypes",{authentication:bt.isRequired,autoQLConfig:Et.isRequired,dataFormatting:Ct.isRequired,themeConfig:St.isRequired,clearOnClose:p.bool.isRequired,enableVoiceRecord:p.bool.isRequired,maxMessages:p.number.isRequired,introMessage:p.string.isRequired,inputPlaceholder:p.string.isRequired,enableDynamicCharting:p.bool.isRequired,autoChartAggregations:p.bool.isRequired,enableFilterLocking:p.bool.isRequired,onErrorCallback:p.func.isRequired,onSuccessAlert:p.func.isRequired,onRTValueLabelClick:p.func,disableMaxMessageHeight:p.bool,enableAjaxTableData:p.bool,isDataMessengerOpen:p.bool,dataPageSize:p.number,sessionId:p.string,isResizing:p.bool,source:p.arrayOf(p.string)}),lt(Nr,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isDataMessengerOpen:!0,isResizing:!1,dataPageSize:void 0,source:[],onRTValueLabelClick:void 0});var Rr=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_ID",d()),lt(mt(t),"state",{activeKeys:[],optionsArray:[{options:t.props.options}]}),lt(mt(t),"renderOptionsList",(function(n){var a=n.options,o=n.active,r=n.index,i=r===e(t.state.optionsArray,"length",0)-1,l=0===r,u=e(t.state.mostRecentOption,"label"),p=a.every((function(e){return!e.children}));return s.createElement("div",{key:"options-list-".concat(r,"-").concat(t.COMPONENT_ID),className:"options-container\n ".concat(i?"visible":"hidden"),"data-test":"options-list-".concat(r)},!l&&s.createElement(c,null,s.createElement("div",{className:"cascader-back-arrow","data-test":"cascader-back-arrow-".concat(r),onClick:function(){var e=ht(t.state.optionsArray);e.pop(),t.setState({optionsArray:e})}},s.createElement(Kt,{type:"caret-left"})),s.createElement("div",{className:"options-title","data-test":"options-title"},u)),a.map((function(n,a){return s.createElement("div",{key:"options-".concat(a,"-").concat(t.COMPONENT_ID),className:"option\n ".concat(n.value===o?"active":""),onClick:function(){return t.onOptionClick(n,r)},"data-test":"options-item-".concat(r,"-").concat(a)},s.createElement("span",{"data-test":"options-item-".concat(r,"-").concat(a,"-text")},n.label),!e(n,"children.length")&&s.createElement(Kt,{className:"option-execute-icon",type:"play"}),!!e(n,"children.length")&&s.createElement(Kt,{className:"option-arrow",type:"caret-right"}))})),t.props.showSeeMoreButton&&p&&u&&t.props.onSeeMoreClick&&s.createElement("div",{className:"option","data-test":"see-more-option",onClick:function(){t.props.onSeeMoreClick(u)}},s.createElement("span",null,s.createElement(Kt,{type:"light-bulb"})," See more...")))})),lt(mt(t),"onOptionClick",(function(e,n){if(e.children){var a=t.state.optionsArray.slice(0,n+1);a[n].active=e.value,a.push({options:e.children}),t.setState({optionsArray:a,mostRecentOption:e})}else{t.props.onFinalOptionClick(e);var o=[].concat(ht(t.state.activeKeys),[e.value]);t.setState({activeKeys:o})}})),lt(mt(t),"render",(function(){return s.createElement(yt,null,s.createElement("div",{id:"react-autoql-cascader-".concat(t.COMPONENT_ID),className:"react-autoql-cascader","data-test":"react-autoql-cascader"},t.state.optionsArray.map((function(e,n){return t.renderOptionsList({options:e.options,active:e.active,index:n})}))))})),t}return it(a)}();lt(Rr,"propTypes",{options:p.arrayOf(p.shape({})),onFinalOptionClick:p.func,onSeeMoreClick:p.func,showSeeMoreButton:p.bool}),lt(Rr,"defaultProps",{options:[],onFinalOptionClick:function(){},onSeeMoreClick:void 0,showSeeMoreButton:!0});var Mr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"render",(function(){return Array.isArray(a.topics)?s.createElement(yt,null,s.createElement("div",null,xt.introPrompt,s.createElement("br",null),s.createElement("div",{className:"topics-container"},s.createElement(Rr,{options:a.topics,onFinalOptionClick:function(e){a.props.onTopicClick({query:e.label,source:["data_messenger","welcome_prompt"]})},showSeeMoreButton:a.props.enableExploreQueriesTab,onSeeMoreClick:function(e){return a.props.onExploreQueriesClick(e)}})),a.props.enableExploreQueriesTab&&s.createElement("div",null,xt.use," ",s.createElement("span",{className:"intro-qi-link",onClick:a.props.onExploreQueriesClick},s.createElement(Kt,{type:"light-bulb",style:{marginRight:"-3px"}})," ",xt.exploreQueries)," ",xt.explorePrompt))):null})),Array.isArray(e.topics)&&(a.topics=e.topics.map((function(e){return{label:e.name,value:d(),children:e.queries.map((function(e){return{label:e.query,value:d()}}))}}))),a.state={},a}return it(n)}();lt(Mr,"propTypes",{topics:p.arrayOf(p.shape({})).isRequired,enableExploreQueriesTab:p.bool.isRequired,onTopicClick:p.func.isRequired,onExploreQueriesClick:p.func.isRequired}),lt(Mr,"defaultProps",{});var Vr=function(e){ct(n,s.Component);var t=gt(n);function n(e){var a;return ot(this,n),lt(mt(a=t.call(this,e)),"componentDidUpdate",(function(e){var t;a.props.shouldRender&&!e.shouldRender&&(null===(t=a.inputRef)||void 0===t||t.focus())})),lt(mt(a),"loadMore",(function(e,t){if(!a.state.loading){var n={validationResponse:void 0};1===e?(n.initialLoading=!0,n.hasMore=!0):n.loading=!0;var o=a.state.inputValue;o!==a.state.keywords&&(n.queryList=void 0),a.setState(n),sa($e($e({},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,p,d,m,f,g,h;((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===(p=u.pagination)||void 0===p?void 0:p.total_pages)||null==e||null===(d=e.data)||void 0===d||null===(m=d.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var v=(null==e||null===(g=e.data)||void 0===g||null===(h=g.data)||void 0===h?void 0:h.items)||[];if(a.state.queryList){var y=a.state.queryList.concat(v);r.queryList=y}else r.queryList=v;r.keywords=o}a.setState(r)})).catch((function(e){a.setState({loading:!1,initialLoading:!1}),console.error(e)}))}})),lt(mt(a),"onInputChange",(function(e){a.setState({inputValue:e.target.value})})),lt(mt(a),"onKeyPress",(function(e){"Enter"==e.key&&a.loadMore(1)})),lt(mt(a),"onValidationSuggestionClick",(function(e){var t=e.query;a.animateQITextAndSubmit(t)})),lt(mt(a),"animateQITextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length){clearTimeout(a.animateTextTimeout);for(var t=function(t){a.animateTextTimeout=setTimeout((function(){a.setState({inputValue:e.slice(0,t)},(function(){t===e.length&&a.loadMore(1)}))}),50*t)},n=1;n<=e.length;n++)t(n)}})),lt(mt(a),"clearExploreQueries",(function(){a.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){var e;null===(e=a.inputRef)||void 0===e||e.focus()}))})),lt(mt(a),"renderIntroMessage",(function(){return s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement("h2",null,"Welcome to Explore Queries"),a.props.introMessage?s.createElement("p",null,a.props.introMessage):s.createElement(s.Fragment,null,s.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),s.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger.")))})),lt(mt(a),"renderQueryList",(function(){var e;return a.state.initialLoading?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement(da,null)):a.state.validationResponse?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement(bo,{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)?s.createElement("div",{className:"query-tips-result-placeholder"},s.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):s.createElement(mr,null,s.createElement(ue,{pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:s.createElement("div",{className:"loader",key:0},s.createElement(ya,{style:{width:"19px",height:"20px",color:"#999"}}))},a.state.queryList.map((function(e,t){return s.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()})),lt(mt(a),"render",(function(){var e;return a.props.shouldRender?s.createElement(yt,null,s.createElement("div",{ref:function(e){return a.exploreQueriesPage=e},className:"query-tips-page-container","data-test":"query-tips-tab"},s.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},s.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,ref:function(e){return a.inputRef=e},autoFocus:!0}),s.createElement("div",{className:"chat-bar-input-icon"},s.createElement(Kt,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}})),s.createElement("div",{className:"chat-bar-clear-btn ".concat(null!==(e=a.state.queryList)&&void 0!==e&&e.length||a.state.inputValue?"visible":""),"data-for":"explore-queries-tooltips","data-tip":"Clear Search"},s.createElement(Kt,{type:"close",onClick:a.clearExploreQueries}))),s.createElement("div",{className:"query-tips-result-container"},a.renderQueryList())),s.createElement(le,{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 it(n)}();lt(Vr,"propTypes",{shouldRender:p.bool,executeQuery:p.func,inputPlaceholder:p.string}),lt(Vr,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var qr=[],Ir=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.initialize()})),lt(mt(o),"componentDidUpdate",(function(e,t){se(o.state.filters,t.filters)||(o.props.onChange(o.state.filters),o.props.rebuildTooltips()),!o.props.isOpen&&e.isOpen&&o.setState({inputValue:""})})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.animateTextTimeout),clearTimeout(o.focusInputTimeout),clearTimeout(o.highlightFilterEndTimeout),clearTimeout(o.highlightFilterStartTimeout)})),lt(mt(o),"initialize",(function(){o.setState({isFetchingFilters:!0}),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 l.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Jt(o.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.data)||[];o._isMounted&&o.setState({filters:a,isFetchingFilters:!1})})).catch((function(e){console.error(e),o._isMounted&&o.setState({isFetchingFilters:!1})}))})),lt(mt(o),"animateInputTextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=2e3/t.length,a=function(e){o.animateTextTimeout=setTimeout((function(){o.setState({inputValue:t.slice(0,e)}),e===t.length&&(o.focusInputTimeout=setTimeout((function(){var e;o.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=o.inputElement)||void 0===e||e.focus()}),300))}),n)},r=1;r<=t.length;r++)a(r)})),lt(mt(o),"insertFilter",(function(e){var t=o.findFilter({filterText:e});e&&t?o.handleHighlightFilterRow(o.getKey(t)):o.animateInputTextAndSubmit(e)})),lt(mt(o),"getAllFilters",(function(){return o.state.filters})),lt(mt(o),"getPersistedFilters",(function(){return ce(o.state.filters.filter((function(e){return!e.isSession})))})),lt(mt(o),"findFilter",(function(e){var t=e.filterText,n=e.value,a=e.key,r=o.state.filters;return n&&a?r.find((function(e){return e.key===a&&e.value===n})):t?r.find((function(e){return e.value===t})):void 0})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){ra($e($e({},Jt(o.props.authentication)),{},{suggestion:n})).then((function(t){var n,a=e(t,"data.data"),r=[];qr=[],n=a.matches;for(var i=0;i<n.length;i++)r.push(n[i]);r.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<r.length;l++){var s={name:r[l]};qr.push(s)}o.setState({suggestions:qr})})).catch((function(e){return console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"createNewFilterFromSuggestion",(function(e){var t="include",n=o.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}})),lt(mt(o),"setFilterTypes",(function(e,t){var n=Jt(o.props.authentication),a=e.filter((function(e){return!e.isSession}));return null!=a&&a.length?ia($e($e({},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,r=o.state.filters.map((function(e){var t=a.find((function(t){return o.getKey(e)===o.getKey(t)}));return t||e}));return o.setState({filters:r}),Promise.resolve(e)})).catch((function(e){return console.error(e),o.setState({filters:t}),He.error("Something went wrong. Please try again."),Promise.reject()})):Promise.resolve()})),lt(mt(o),"setFilter",(function(e){var t=Jt(o.props.authentication);return ia($e($e({},t),{},{filters:[e]})).then((function(t){var n,a,r=null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.data;if(null==r||!r.length)throw new Error("No filters in the api response");var i=r.find((function(t){return o.getKey(t)===o.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(o.findFilter(e)){var l=o.state.filters.map((function(e){return o.getKey(e)===o.getKey(i)?i:e}));o.setState({filters:l})}else o.setState({filters:[].concat(ht(o.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),Promise.reject()}))})),lt(mt(o),"unsetFilter",(function(t){try{return 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),s={headers:{Authorization:"Bearer ".concat(a)}};return l.delete(i,s,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}($e($e({},Jt(o.props.authentication)),{},{filter:t}))}catch(e){return Promise.reject(e)}})),lt(mt(o),"getSuggestionValue",(function(e){return o.createNewFilterFromSuggestion(e)})),lt(mt(o),"handlePersistToggle",function(){var e=at(et().mark((function e(t){var n,a,r;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.state.filters,a=$e($e({},t),{},{isSession:!t.isSession,id:void 0}),r=o.state.filters.map((function(e){return o.getKey(e)===o.getKey(t)?a:e})),o.setState({filters:r}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,o.setFilter(a);case 8:e.next=12;break;case 10:return e.next=12,o.unsetFilter(t);case 12:e.next=19;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),He.error("Something went wrong. Please try again."),o.setState({filters:n});case 19:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(o),"handleExcludeToggle",(function(e,t){if(t)try{var n=o.state.filters.map((function(n){return n.show_message===e?$e($e({},n),{},{filter_type:t.toLowerCase()}):n})),a=n.filter((function(t){return t.show_message===e}));o.setFilterTypes(a,ce(o.state.filters)),o.setState({filters:n})}catch(e){console.error(e)}})),lt(mt(o),"removeFilter",function(){var e=at(et().mark((function e(t){var n,a;return et().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.state.filters,a=o.state.filters.filter((function(e){return o.getKey(e)!==o.getKey(t)})),o.setState({filters:a}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,o.unsetFilter(t);case 7:e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),He.error("Something went wrong. Please try again."),o.setState({filters:n});case 14:He.success("Filter removed."),le.hide();case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),lt(mt(o),"onInputChange",(function(e,t){var n,a=t.newValue,r=t.method;"up"!==r&&"down"!==r&&("enter"!==r&&"click"!==r||(o.findFilter(a)?o.handleHighlightFilterRow(o.getKey(a)):o.setFilter(a).then((function(){return He.success("".concat(a.value," has been locked."))})).catch((function(){return He.error("Something went wrong. Please try again.")}))),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&o.setState({inputValue:e.target.value}))})),lt(mt(o),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),lt(mt(o),"renderTitle",(function(){return s.createElement("div",{className:"react-autoql-filter-locking-title"},s.createElement("h3",null,xt.filterLockingTitle," ",s.createElement(Kt,{type:"info","data-place":"right","data-for":"filter-locking-tooltip","data-tip":" Filters can be applied to narrow down<br /> your query results. Locking a filter<br /> ensures that only the specific data<br /> you wish to see is returned."})))})),lt(mt(o),"renderHeader",(function(){return s.createElement("div",{className:"filter-lock-menu-header"},o.renderTitle(),o.renderCloseBtn())})),lt(mt(o),"renderCloseBtn",(function(){return s.createElement(Wa,{onClick:o.props.onClose,className:"filter-locking-close-btn","data-tip":xt.closeFilterLocking,"data-for":"filter-locking-tooltip",size:"small"},s.createElement(Kt,{type:"close"}))})),lt(mt(o),"renderFooter",(function(){return s.createElement("div",{className:"filter-lock-menu-footer"},s.createElement(Wa,{onClick:o.props.onClose,size:"small"},"Continue"))})),lt(mt(o),"renderVLInput",(function(){return s.createElement(Le,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:o.state.suggestions,onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:function(e){return o.getSuggestionValue(e.name)},renderSuggestion:function(e){return s.createElement("ul",{className:"filter-lock-suggestion-item"},s.createElement("li",null,e.name.keyword),s.createElement("li",null,e.name.show_message))},inputProps:{onChange:o.onInputChange,value:o.state.inputValue,disabled:o.state.isFetchingFilters,placeholder:"Search & select a filter",className:"react-autoql-condition-locking-input",id:"react-autoql-filter-menu-input"}})})),lt(mt(o),"renderFilterListCategory",(function(e,t){return s.createElement("div",{key:e},o.renderFilterListCategoryHeader(e,t),s.createElement("div",{className:"react-autoql-filter-list"},o.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return o.renderFilterListItem(e)}))))})),lt(mt(o),"renderFilterListCategoryHeader",(function(e,t){var n,a=null===(n=o.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return s.createElement("div",{className:"react-autoql-filter-list-title flex "},s.createElement("div",null,s.createElement("h4",null,s.createElement("span",{className:"filter-lock-category-title"},e),s.createElement(ar,{className:"include-exclude-toggle-group",options:["INCLUDE","EXCLUDE"],tooltips:["Only show results with these values","Show results without these values"],tooltipId:"filter-locking-tooltip",value:a,type:"button",onChange:function(t){return o.handleExcludeToggle(e,t)}}))),0===t?s.createElement("div",{className:"persist-toggle-column"},s.createElement("h4",null,"Persist"," ",s.createElement(Kt,{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)})),lt(mt(o),"renderFilterListItem",(function(e){var t=o.getKey(e);return s.createElement("div",{key:t,className:"flex ".concat(o.state.highlightedFilter===t?"react-autoql-highlight-row":"")},s.createElement("div",{className:"react-autoql-condition-table-list-item"},e.value),s.createElement("div",{id:"react-autoql-condition-table-settings"},s.createElement(Ua,{className:"persist-toggle-column",type:"switch",checked:!e.isSession,onChange:function(){return o.handlePersistToggle(e)}}),s.createElement(Kt,{className:"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return o.removeFilter(e)}})))})),lt(mt(o),"renderFilterList",(function(){var e;if(o.state.isFetchingFilters)return s.createElement("div",{className:"react-autoql-condition-list-loading-container"},s.createElement(da,null));if(null===(e=o.state.filters)||void 0===e||!e.length)return s.createElement("div",{className:"react-autoql-empty-condition-list"},s.createElement("i",null,xt.noFiltersLocked));var t=ht(new Set(o.state.filters.map((function(e){return e.show_message}))));return s.createElement("div",{className:"react-autoql-filter-list-container"},t.map((function(e,t){return o.renderFilterListCategory(e,t)})))})),lt(mt(o),"renderContent",(function(){return s.createElement(yt,null,s.createElement(Be,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:_e,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1,theme:en(o.props.themeConfig).theme}),s.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},o.renderHeader(),o.renderVLInput(),o.renderFilterList(),o.renderFooter(),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0})))})),lt(mt(o),"render",(function(){return o.props.isOpen?s.createElement(me,{isOpen:o.props.isOpen,onClickOutside:o.props.onClose,position:o.props.position,align:o.props.align,content:o.renderContent(),containerClassName:"filter-lock-menu",padding:0},s.createElement(yt,null,o.props.children||null)):o.props.children||null})),o.contentKey=d(),o.state={filters:[],suggestions:[],inputValue:""},o}return it(a,[{key:"handleHighlightFilterRow",value:function(e){var t=this;He.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}();lt(Ir,"propTypes",{authentication:bt,themeConfig:St,isOpen:p.bool,position:p.string,align:p.string,onChange:p.func,rebuildTooltips:p.func}),lt(Ir,"defaultProps",{authentication:Gt,themeConfig:Xt,isOpen:!1,position:"bottom",align:"center",rebuildTooltips:function(){},onChange:function(){}});var Pr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;return ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0;try{document.addEventListener("visibilitychange",o.onWindowResize),window.addEventListener("resize",o.onWindowResize),o.props.enableQueryQuickStartTopics&&o.setQueryTopics()}catch(e){console.error(e),o.setState({hasError:!0})}setTimeout(o.rebuildTooltips,1e3)})),lt(mt(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:d()}),se(en(o.props.themeConfig),en(e.themeConfig))||_n(o.props.themeConfig),o.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),pe(n)||o.setState($e({},n))}catch(e){console.error(e),o.setState({hasError:!0})}})),lt(mt(o),"setQueryTopics",(function(){(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.domain,a=t.token,o=t.apiKey;if(!n||!o||!a)return Promise.reject(new Error("Unauthenticated"));var r="".concat(n,"/autoql/api/v1/topic-set?key=").concat(o),i={headers:{Authorization:"Bearer ".concat(a)}};return l.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(Jt(o.props.authentication)).then((function(e){var t,n,a,r;if(null!==(t=o.dataMessengerContentRef)&&void 0!==t&&t._isMounted&&null!=e&&null!==(n=e.data)&&void 0!==n&&null!==(a=n.data)&&void 0!==a&&null!==(r=a.topics)&&void 0!==r&&r.length){var i,l,c=s.createElement(Mr,{topics:e.data.data.topics,enableExploreQueriesTab:o.props.enableExploreQueriesTab,onTopicClick:o.onTopicClick,onExploreQueriesClick:o.openExploreQueries});if(o.dataMessengerIntroMessages.push(c),null!==(i=o.dataMessengerContentRef)&&void 0!==i&&i._isMounted)null===(l=o.dataMessengerContentRef)||void 0===l||l.addIntroMessage(c)}})).catch((function(e){console.error(e)}))})),lt(mt(o),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;clearTimeout(o.rebuildTooltipsTimer),o.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),e)})),lt(mt(o),"refreshNotifications",(function(){var e;null===(e=o.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),lt(mt(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}})),lt(mt(o),"onWindowResize",(function(){o.state.isWindowResizing||o.setState({isWindowResizing:!0}),clearTimeout(o.windowResizeTimer),o.windowResizeTimer=setTimeout((function(){o.setState({isWindowResizing:!1})}),300)})),lt(mt(o),"openExploreQueries",(function(e){o.setState({activePage:"explore-queries"}),e&&(clearTimeout(o.exploreQueriesTimeout),o.exploreQueriesTimeout=setTimeout((function(){var t;null===(t=o.exploreQueriesRef)||void 0===t||t.animateQITextAndSubmit(e)}),500))})),lt(mt(o),"toggleFullScreen",(function(e,t,n){o.setState({width:e?o.props.width:t,height:e?o.props.height:n,isSizeMaximum:!e}),le.hide()})),lt(mt(o),"getHandleProp",(function(){return void 0!==o.props.customHandle?o.props.customHandle:!!o.props.showHandle&&s.createElement("div",{className:"drawer-handle\n ".concat(o.state.isVisible?" hide":"","\n ").concat(o.props.handleImage?"":" default-logo"),style:o.props.handleStyles},o.props.handleImage?s.createElement("img",{src:o.props.handleImage,height:"22px",width:"22px",draggable:"false"}):s.createElement(Kt,{type:"react-autoql-bubbles-outlined",size:26}))})),lt(mt(o),"getDrawerHeight",(function(){return"right"===o.state.placement||"left"===o.state.placement?null:o.state.height})),lt(mt(o),"getDrawerWidth",(function(){return"right"===o.state.placement||"left"===o.state.placement?o.state.width:null})),lt(mt(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})),lt(mt(o),"onDrawerChange",(function(e){e?o.setState({isVisible:!0}):o.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),lt(mt(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)})),lt(mt(o),"handleClearQueriesDropdown",(function(){o.clearQueriesDropdown&&("block"===o.clearQueriesDropdown.style.display?o.clearQueriesDropdown.style.display="none":o.clearQueriesDropdown.style.display="block")})),lt(mt(o),"onRTValueLabelClick",(function(e){o.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=o.filterLockRef)||void 0===t||t.insertFilter(e)}))})),lt(mt(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})})),lt(mt(o),"renderTabs",(function(){var e=o.state.activePage;return s.createElement("div",{className:"data-messenger-tab-container ".concat(o.props.placement," ").concat(o.state.isVisible?"visible":"hidden")},s.createElement("div",{className:"page-switcher-shadow-container ".concat(o.props.placement)},s.createElement("div",{className:"page-switcher-container ".concat(o.props.placement)},s.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return o.setState({activePage:"data-messenger"})},"data-tip":"Data Messenger","data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"})),o.props.enableExploreQueriesTab&&s.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return o.setState({activePage:"explore-queries"})},"data-tip":xt.exploreQueries,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"light-bulb",size:22})),o.props.enableNotificationsTab&&$t(o.props.autoQLConfig).enableNotifications&&s.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){o.setState({activePage:"notifications"}),o.notificationBadgeRef&&o.notificationBadgeRef.resetCount()},"data-tip":"Notifications","data-for":"react-autoql-header-tooltip"},s.createElement("div",{className:"data-messenger-notification-btn"},s.createElement(Yo,{ref:function(e){return o.notificationBadgeRef=e},authentication:Jt(Jt(o.props.authentication)),themeConfig:o.props.themeConfig,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&&s.createElement("div",{className:"tab".concat("dpr"===e?" active":""," react-autoql-dpr"),onClick:function(){return o.setState({activePage:"dpr"})},"data-tip":"Education","data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"grad-cap",size:22})))))})),lt(mt(o),"renderRightHeaderContent",(function(){return s.createElement(s.Fragment,null,$t(o.props.autoQLConfig).enableFilterLocking&&o.renderFilterLockPopover(),s.createElement(me,{isOpen:o.state.isOptionsDropdownOpen,onClickOutside:function(){o.setState({isOptionsDropdownOpen:!1})},position:"bottom",content:s.createElement("div",null,s.createElement("div",{className:"clear-messages-confirm-popover"},s.createElement("div",{className:"react-autoql-menu-text",onClick:o.handleClearQueriesDropdown},s.createElement(Kt,{type:"trash"}),s.createElement("span",{style:{marginLeft:5}},xt.clearDataResponses)),s.createElement("div",{ref:function(e){return o.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},s.createElement(Wa,{type:"default",size:"small",onClick:function(){return o.setState({isOptionsDropdownOpen:!1})}},"Cancel"),s.createElement(Wa,{type:"primary",size:"small",onClick:function(){return o.clearMessages()}},"Clear"))))},s.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":xt.clearDataResponses,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"trash"}))))})),lt(mt(o),"renderHeaderTitle",(function(){var e="";switch(o.state.activePage){case"data-messenger":e=o.props.title;break;case"explore-queries":e=xt.exploreQueries;break;case"notifications":e=xt.notifications;break;case"dpr":e="Education"}return s.createElement("div",{className:"header-title"},e)})),lt(mt(o),"openFilterLockMenu",(function(){o.state.isFilterLockMenuOpen||o.setState({isFilterLockMenuOpen:!0})})),lt(mt(o),"closeFilterLockMenu",(function(){o.state.isFilterLockMenuOpen&&o.setState({isFilterLockMenuOpen:!1})})),lt(mt(o),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));o.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),lt(mt(o),"renderFilterLockPopover",(function(){return s.createElement(Ir,{ref:function(e){return o.filterLockRef=e},authentication:o.props.authentication,themeConfig:o.props.themeConfig,isOpen:o.state.isFilterLockMenuOpen,onChange:o.onFilterChange,onClose:o.closeFilterLockMenu,rebuildTooltips:o.rebuildTooltips,position:"bottom",align:"end"},s.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===o.state.activePage?"visible":"hidden"),"data-tip":xt.openFilterLocking,"data-for":"react-autoql-header-tooltip",onClick:o.state.isFilterLockMenuOpen?o.closeFilterLockMenu:o.openFilterLockMenu},s.createElement(Kt,{type:o.state.hasFilters?"lock":"unlock"})))})),lt(mt(o),"renderHeaderContent",(function(){var e=o.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,a=o.state.width===t;return s.createElement(c,null,s.createElement("div",{className:"react-autoql-header-left-container"},s.createElement("button",{onClick:function(){o.dmRef.setState({open:!1}),o.setState({isVisible:!1})},className:"react-autoql-drawer-header-btn close","data-tip":xt.closeDataMessenger,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:"close"})),s.createElement("button",{onClick:function(){return o.toggleFullScreen(a,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":a?xt.minimizeDataMessenger:xt.maximizeDataMessenger,"data-for":"react-autoql-header-tooltip"},s.createElement(Kt,{type:a?"minimize":"maximize"}))),s.createElement("div",{className:"react-autoql-header-center-container"},o.renderHeaderTitle()),s.createElement("div",{className:"react-autoql-header-right-container"},o.renderRightHeaderContent()))})),lt(mt(o),"renderBodyContent",(function(){return s.createElement(s.Fragment,null,o.renderDataMessengerContent(),o.renderExploreQueriesContent(),o.renderNotificationsContent(),o.renderDPRContent())})),lt(mt(o),"renderDataMessengerContent",(function(){var e,t,n=o.props.dataPageSize;o.props.enableAjaxTableData&&!n&&(n=o.DEFAULT_AJAX_PAGE_SIZE);var a=$t(o.props.autoQLConfig).enableFilterLocking?o.onRTValueLabelClick:void 0;return s.createElement(yt,null,s.createElement(Nr,st({},o.props,{shouldRender:"data-messenger"===o.state.activePage,key:o.state.dataMessengerId,ref:function(e){return o.dataMessengerContentRef=e},authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,themeConfig:o.props.themeConfig,isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],rebuildTooltips:o.rebuildTooltips,onRTValueLabelClick:a,queryFilters:o.state.sessionFilters,isDataMessengerOpen:!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open),introMessages:o.dataMessengerIntroMessages,inputPlaceholder:o.props.inputPlaceholder,enableAjaxTableData:o.props.enableAjaxTableData,autoChartAggregations:o.props.autoChartAggregations,dataPageSize:n})))})),lt(mt(o),"renderDPRContent",(function(){var e,t,n,a;return s.createElement(yt,null,s.createElement(Nr,st({},o.props,{shouldRender:"dpr"===o.state.activePage,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},themeConfig:o.props.themeConfig,isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],rebuildTooltips:o.rebuildTooltips,isDataMessengerOpen:!(null===(n=o.dmRef)||void 0===n||null===(a=n.state)||void 0===a||!a.open),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}})))})),lt(mt(o),"renderExploreQueriesContent",(function(){var e,t;return s.createElement(yt,null,s.createElement(Vr,{ref:function(e){return o.exploreQueriesRef=e},authentication:o.props.authentication,shouldRender:"explore-queries"===o.state.activePage&&!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open),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)}}))})),lt(mt(o),"renderNotificationsContent",(function(){var e,t;return s.createElement(yt,null,s.createElement(gr,{ref:function(e){return o.notificationListRef=e},authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,onExpandCallback:o.props.onNotificationExpandCallback,onCollapseCallback:o.props.onNotificationCollapseCallback,activeNotificationData:o.props.activeNotificationData,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,showNotificationDetails:!1,shouldRender:!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open)&&"notifications"===o.state.activePage}))})),lt(mt(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,containerWidth: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,containerWidth:u,isSizeMaximum:!1})}else if("bottom"===n){var p=e(o.state.startingResizePosition,"y")-t.pageY,d=e(o.state.startingResizePosition,"height")+p;d>i&&(d=i),d<o.minHeight&&(d=o.minHeight),Number(d)&&o.setState({height:d,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})}})),lt(mt(o),"stopResizingDrawer",(function(){"right"===o.state.placement||"left"===o.state.placement?o.setState({isResizing:!1,containerWidth:o.state.width}):"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)})),lt(mt(o),"renderResizeHandle",(function(){var e=mt(o);if(o.state.isVisible){var t=o.getPlacementProp();return s.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})),lt(mt(o),"renderTooltips",(function(){return s.createElement(c,null,s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-header-tooltip",effect:"solid",delayShow:800,place:"top",html:!0}),s.createElement(le,{className:"react-autoql-drawer-tooltip",id:"react-autoql-toolbar-btn-tooltip",effect:"solid",delayShow:500,place:"top",html:!0}))})),lt(mt(o),"renderDataAlertModal",(function(){return s.createElement(pr,{authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,isVisible:o.state.isDataAlertModalVisible,onClose:function(){return o.setState({isDataAlertModalVisible:!1})},onSave:function(){o.props.onSuccessAlert("Notification created!"),o.setState({isDataAlertModalVisible:!1})},onErrorCallback:function(){return o.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")},initialQuery:o.state.activeQuery})})),lt(mt(o),"render",(function(){return o.state.hasError?null:s.createElement(yt,null,void((navigator.language||navigator.userLanguage).includes("sp")?xt.setLanguage("sp"):xt.setLanguage("en")),s.createElement(Fe,{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.props.enableExploreQueriesTab||o.props.enableNotificationsTab)&&o.renderTabs(),s.createElement("div",{className:"react-autoql-drawer-content-container"},s.createElement("div",{className:"chat-header-container"},o.renderHeaderContent()),o.renderBodyContent())),o.renderDataAlertModal(),o.renderTooltips())})),o.minWidth=400,o.minHeight=400,o.COMPONENT_KEY=d(),o.HEADER_THICKNESS=70,o.TAB_THICKNESS=45,o.DEFAULT_AJAX_PAGE_SIZE=50,_n(t.themeConfig),o.dataMessengerIntroMessages=[t.introMessage?"".concat(t.introMessage):"Hi ".concat(t.userDisplayName||"there","! Let’s dive into your data. What can I help you discover today?")],o.dprMessengerIntroMessages=[s.createElement(s.Fragment,null,s.createElement("span",null,"Ask questions, get answers."),s.createElement("br",null),s.createElement("br",null),s.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"," ",s.createElement("a",{href:"https://www.investopedia.com/",target:"_blank",rel:"noopener"},"Investopedia®"),", including applicable reference links."))],o.state={dataMessengerId:d(),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 it(a,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),document.removeEventListener("visibilitychange",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.feedbackTimeout),clearTimeout(this.animateTextTimeout),clearTimeout(this.exploreQueriesTimeout),clearTimeout(this.executeQueryTimeout),clearTimeout(this.rebuildTooltipsTimer)}catch(e){}}}]),a}();lt(Pr,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,placement:p.string,maskClosable:p.bool,width:p.oneOfType([p.string,p.number]),height:p.oneOfType([p.string,p.number]),showHandle:p.bool,handleImage:p.string,handleStyles:p.shape({}),shiftScreen:p.bool,userDisplayName:p.string,clearOnClose:p.bool,enableVoiceRecord:p.bool,title:p.string,maxMessages:p.number,introMessage:p.string,enableExploreQueriesTab:p.bool,enableNotificationsTab:p.bool,resizable:p.bool,inputPlaceholder:p.string,enableDPRTab:p.bool,dataPageSize:p.number,notificationCount:p.number,enableDynamicCharting:p.bool,defaultTab:p.string,autoChartAggregations:p.bool,enableFilterLocking:p.bool,enableQueryQuickStartTopics:p.bool,enableAjaxTableData:p.bool,onNotificationExpandCallback:p.func,onNewNotification:p.func,onNotificationCount:p.func,onVisibleChange:p.func,onErrorCallback:p.func,onSuccessAlert:p.func}),lt(Pr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,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,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 Lr=["style","className","key"],Or=[],Fr=function(t){ct(a,s.Component);var n=gt(a);function a(t){var o;ot(this,a),lt(mt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0})),lt(mt(o),"shouldComponentUpdate",(function(e,t){var n=o.getFilteredProps(o.props),a=o.getFilteredProps(e);return!se(We(n,Ye(n)),We(a,Ye(a)))||!se(o.state,t)})),lt(mt(o),"componentDidUpdate",(function(t,n){var a,r;e(o.props,"tile.query")!==e(t,"tile.query")&&o.setState({query:e(o.props,"tile.query")},(function(){o.setState({supportedDisplayTypes:Pn({response:e(o.props,"queryResponse")})})})),e(o.props,"tile.title")!==e(t,"tile.title")&&o.setState({title:e(o.props,"tile.title")}),null!==(a=o.secondOptionsToolbarRef)&&void 0!==a&&a._isMounted&&o.secondOptionsToolbarRef.forceUpdate(),null!==(r=o.optionsToolbarRef)&&void 0!==r&&r._isMounted&&o.optionsToolbarRef.forceUpdate()})),lt(mt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.autoCompleteTimer),clearTimeout(o.dragEndTimeout),o.cancelAllQueries()})),lt(mt(o),"cancelAllQueries",(function(){var e,t;null===(e=o.axiosSource)||void 0===e||e.cancel(Dt),null===(t=o.secondAxiosSource)||void 0===t||t.cancel(Dt)})),lt(mt(o),"debouncedSetParamsForTile",(function(e,t){o.paramsToSet=$e($e({},o.paramsToSet),e),"function"==typeof t&&(o.callbackArray=[].concat(ht(o.callbackArray),[t])),clearTimeout(o.setParamsForTileTimout),o.setParamsForTileTimout=setTimeout((function(){o.props.setParamsForTile(o.paramsToSet,o.props.tile.i,ce(o.callbackArray)),o.paramsToSet={},o.callbackArray=[]}),o.debounceTime)})),lt(mt(o),"getFilteredProps",(function(e){return $e($e({},e),{},{children:void 0})})),lt(mt(o),"toggleTableFilter",(function(e,t){null==e||e.toggleTableFilter({isFilteringTable:t})})),lt(mt(o),"isQueryValid",(function(e){return!!e&&!!e.trim()})),lt(mt(o),"setTopExecuted",(function(){o._isMounted&&o.setState({isTopExecuting:!1,isTopExecuted:!0})})),lt(mt(o),"endTopQuery",(function(e){var t=e.response;o.QUERY_RESPONSE_KEY=d(),o.debouncedSetParamsForTile({queryResponse:t,selectedSuggestion:void 0},o.setTopExecuted)})),lt(mt(o),"setBottomExecuted",(function(){o._isMounted&&o.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),lt(mt(o),"endBottomQuery",(function(e){var t=e.response;o.debouncedSetParamsForTile({secondQueryResponse:t,secondSelectedSuggestion:void 0},o.setBottomExecuted)})),lt(mt(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=["dashboards"];null!=r&&r.length?l=[].concat(ht(l),ht(r)):l.push("user");var s=$e($e($e({query:t,userSelection:n},Jt(o.props.authentication)),$t(o.props.autoQLConfig)),{},{enableQueryValidation:!!o.props.isEditing&&$t(o.props.autoQLConfig).enableQueryValidation,source:l,pageSize:o.props.dataPageSize,skipQueryValidation:a,cancelToken:i?o.secondAxiosSource.token:o.axiosSource.token});return ea(s).then((function(e){return i?o.bottomRequestData=s:o.topRequestData=s,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),lt(mt(o),"processTileTop",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source,l=t.pageSize;o.setState({isTopExecuting:!0,customMessage:void 0});var s=!!r||!(o.props.tile.query!==n||!o.props.tile.skipQueryValidation),c=a||(o.props.tile.query===n?e(o.props.tile,"queryValidationSelections"):void 0);o.debouncedSetParamsForTile({query:n,dataConfig:o.props.tile.query===n?void 0:o.props.tile.dataConfig,skipQueryValidation:s,queryResponse:null,selectedSuggestion:void 0,queryValidationSelections:c}),o.processQuery({query:n,userSelection:c,skipQueryValidation:r,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){o._isMounted&&o.endTopQuery({response:e})})).catch((function(e){o._isMounted&&o.endTopQuery({response:e})}))})),lt(mt(o),"processTileBottom",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source;o.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondCustomMessage:void 0});var l=r||!(o.props.tile.secondQuery!==n||!o.props.tile.secondskipQueryValidation),s=a||(o.props.tile.secondQuery===n?e(o.props.tile,"secondQueryValidationSelections"):void 0);o.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:o.props.tile.secondQuery===n?void 0:o.props.tile.secondDataConfig,secondskipQueryValidation:l,secondQueryResponse:null,secondSelectedSuggestion:void 0,secondQueryValidationSelections:s}),o.processQuery({query:n,userSelection:s,skipQueryValidation:r,source:i,isSecondHalf:!0}).then((function(e){o._isMounted&&o.endBottomQuery({response:e})})).catch((function(e){o._isMounted&&o.endBottomQuery({response:e})}))})),lt(mt(o),"clearQueryResponses",(function(){o.setState({isTopExecuting:!1,isTopExecuted:!1,customMessage:void 0}),o.debouncedSetParamsForTile({queryResponse:void 0,secondQueryResponse:void 0})})),lt(mt(o),"processTile",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.query,n=e.secondQuery,a=e.skipQueryValidation,r=e.secondskipQueryValidation,i=e.source;o.axiosSource=l.CancelToken.source(),o.secondAxiosSource=l.CancelToken.source();var s=t||o.props.tile.selectedSuggestion||o.state.query,c=n||o.props.tile.secondSelectedSuggestion||o.state.secondQuery;o.processTileTop({query:s,skipQueryValidation:a,source:i}),o.getIsSplitView()&&c&&s!==c&&o.processTileBottom({query:c,skipQueryValidation:r,source:i})})),lt(mt(o),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(o.processTile({query:e.target.value}),e.target.blur())})),lt(mt(o),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(o.processTileBottom({query:e.target.value}),e.target.blur())})),lt(mt(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({selectedSuggestion:t})})),lt(mt(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})})),lt(mt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){oa($e({suggestion:n},Jt(o.props.authentication))).then((function(t){if(o._isMounted){var n,a=e(t,"data.data"),r=[];Or=[],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]};Or.push(s)}o.setState({suggestions:Or})}})).catch((function(e){console.error(e)}))}),300)})),lt(mt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),lt(mt(o),"userSelectedSuggestionHandler",(function(e){if(e&&e.name){var t=e.name;o.userSelectedValue=t,o.userSelectedSuggestion=!0,o.setState({query:t}),o.debouncedSetParamsForTile({query:t})}})),lt(mt(o),"onQueryInputChange",(function(t){(!o.userSelectedSuggestion||38!==t.keyCode&&40!==t.keyCode)&&(e(t,"target.value")||""===e(t,"target.value")?o.setState({query:t.target.value}):o.processTile({query:o.userSelectedValue}))})),lt(mt(o),"onDisplayTypeChange",(function(e){o.debouncedSetParamsForTile({displayType:e})})),lt(mt(o),"onSecondDisplayTypeChange",(function(e){o.debouncedSetParamsForTile({secondDisplayType:e})})),lt(mt(o),"getIsSplitView",(function(){return e(o.props.tile,"splitView")})),lt(mt(o),"toggleSecondQueryInput",(function(){o.setState({isSecondQueryInputOpen:!o.state.isSecondQueryInputOpen})})),lt(mt(o),"renderHeader",(function(){return o.props.isEditing?s.createElement("div",{className:"dashboard-tile-edit-wrapper"},s.createElement("div",{className:"dashboard-tile-input-container\n ".concat(o.state.isQueryInputFocused?"query-focused":"","\n ").concat(o.state.isTitleInputFocused?"title-focused":""),onMouseDown:function(e){return e.stopPropagation()}},s.createElement("div",{className:"dashboard-tile-left-input-container"},s.createElement(Kt,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),$t(o.props.autoQLConfig).enableAutocomplete?s.createElement(Le,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return s.createElement(c,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(){return o.setState({isQueryInputFocused:!0})},onChange:o.onQueryInputChange,onKeyDown:o.onQueryTextKeyDown,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})}}}):s.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",onChange:function(e){o.setState({query:e.target.value})},onKeyDown:o.onQueryTextKeyDown,onFocus:function(){return 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})}})),s.createElement("div",{className:"dashboard-tile-right-input-container"},s.createElement(Kt,{className:"title-input-icon",type:"title"}),s.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)",value:o.state.title,"data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){return o.setState({title:e.target.value})},onFocus:function(){return o.setState({isTitleInputFocused:!0})},onBlur:function(e){o.debouncedSetParamsForTile({title:e.target.value}),o.setState({isTitleInputFocused:!1})}}))),s.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-play-button".concat(o.isQueryValid(o.state.query)?"":" disabled")},s.createElement(Kt,{type:"play",onClick:function(){return o.processTile()},"data-tip":"Run tile","data-place":"left"})),s.createElement("div",{className:"dashboard-tile-delete-button",onMouseDown:function(e){return e.stopPropagation()},onClick:function(){return o.props.deleteTile(o.props.tile.i)}},s.createElement(Kt,{style:{fontSize:"18px"},type:"close"}))):s.createElement("div",{className:"dashboard-tile-title-container"},s.createElement("span",{className:"dashboard-tile-title"},o.props.tile.title||o.props.tile.query||"Untitled"),s.createElement("div",{className:"dashboard-tile-title-divider"}))})),lt(mt(o),"renderDraggingPlaceholder",(function(){return s.createElement("div",{className:"react-autoql-db-dragging-placeholder-container"},s.createElement("div",{className:"react-autoql-db-dragging-placeholder-title"}),s.createElement("div",{className:"react-autoql-db-dragging-placeholder-content"}))})),lt(mt(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?s.createElement(da,null):!o.props.isEditing&&a?s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,"No query was supplied for this tile.")):o.props.isEditing&&!e(o.state.query,"trim()")?s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,"To get started, enter a query and click"," ",s.createElement(Kt,{className:"play-icon",type:"play"}))):s.createElement("div",{className:"dashboard-tile-placeholder-text"},s.createElement("em",null,o.props.isEditing?s.createElement("span",null,"Hit ",s.createElement(Kt,{className:"edit-mode-placeholder-icon",type:"play"})," ","to run this tile"):s.createElement("span",null,o.props.notExecutedText))),s.createElement("div",{className:"loading-container-centered"},r)})),lt(mt(o),"onQueryValidationSelectOption",(function(e,t){o.setState({query:e}),o.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),lt(mt(o),"onSecondQueryValidationSelectOption",(function(e,t){o.setState({secondQuery:e}),o.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),lt(mt(o),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),lt(mt(o),"onDataConfigChange",(function(e){o.debouncedSetParamsForTile({dataConfig:e})})),lt(mt(o),"onSecondDataConfigChange",(function(e){o.debouncedSetParamsForTile({secondDataConfig:e})})),lt(mt(o),"reportProblemCallback",(function(){var e;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.optionsToolbarRef.setState({activeMenu:"other-problem"})})),lt(mt(o),"secondReportProblemCallback",(function(){var e;null!==(e=o.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&o.secondOptionsToolbarRef.setState({activeMenu:"other-problem"})})),lt(mt(o),"onNoneOfTheseClick",(function(){o.setState({customMessage:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")})})),lt(mt(o),"secondOnNoneOfTheseClick",(function(){o.setState({secondCustomMessage:s.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",s.createElement("br",null),"To continue, try asking another query.")})})),lt(mt(o),"renderSuggestionPrefix",(function(){return s.createElement("div",null,"I want to make sure I understood your query. Did you mean:")})),lt(mt(o),"renderSplitResponse",(function(){var t=e(o.tileInnerDiv,"clientWidth")?"".concat(o.tileInnerDiv.clientWidth-70,"px"):"0px";return s.createElement(Ge,{vertical:!0,percentage:!0,secondaryInitialSize:o.props.secondDisplayPercentage||50,onDragEnd:function(){o.dragEndTimeout=setTimeout((function(){var t=e(o.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));Number.isNaN(n)||o.debouncedSetParamsForTile({secondDisplayPercentage:n})}),1e3)}},s.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderTopResponse()),s.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderBottomResponse(),o.props.isEditing&&s.createElement("div",{className:"viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},s.createElement("button",{onClick:function(){o.toggleSecondQueryInput(),le.hide()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},s.createElement(Kt,{type:"react-autoql-bubbles-outlined"}),s.createElement(Kt,{type:o.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),s.createElement("input",{className:"dashboard-tile-input query second ".concat(o.state.isSecondQueryInputOpen?"open":""),value:o.state.secondQuery,onChange:function(e){o.setState({secondQuery:e.target.value})},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"}}))))})),lt(mt(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}),le.hide()})),lt(mt(o),"renderSplitViewBtn",(function(){return s.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},s.createElement("button",{onClick:o.onSplitViewClick,className:"react-autoql-toolbar-btn","data-tip":o.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},s.createElement(Kt,{type:o.getIsSplitView()?"single-view":"split-view",style:{color:o.props.tile.splitView?en(o.props.themeConfig).accentColor:"inherit"}})))})),lt(mt(o),"onSupportedDisplayTypesChange",(function(e){o.setState({supportedDisplayTypes:e}),o.debouncedSetParamsForTile({dataConfig:void 0})})),lt(mt(o),"onSecondSupportedDisplayTypesChange",(function(e){o.setState({secondSupportedDisplayTypes:e}),o.debouncedSetParamsForTile({secondDataConfig:void 0})})),lt(mt(o),"onCSVDownloadStart",(function(e){return o.props.onCSVDownloadStart($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"onCSVDownloadProgress",(function(e){return o.props.onCSVDownloadProgress($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"onCSVDownloadFinish",(function(e){return o.props.onCSVDownloadFinish($e($e({},e),{},{tileId:o.props.tile.i}))})),lt(mt(o),"renderSuggestionMessage",(function(e){return e||s.createElement("div",{style:{paddingTop:"20px"}},o.renderSuggestionPrefix())})),lt(mt(o),"renderToolbars",(function(e){var t=e.queryOutputProps,n=e.vizToolbarProps,a=e.optionsToolbarProps,r=e.isSecondHalf,i=document.querySelector("#".concat(t.key," .dashboard-data-limit-warning-icon"));return s.createElement("div",{className:"dashboard-tile-toolbars-container ".concat(i?"left-padding":"")},s.createElement("div",{className:"dashboard-tile-toolbars-left-container"},o.props.isEditing&&(r||!o.getIsSplitView())&&o.renderSplitViewBtn(),!o.props.isDragging&&o.props.isEditing&&s.createElement(ko,st({themeConfig:o.props.themeConfig},n))),s.createElement("div",{className:"dashboard-tile-toolbars-right-container"},!o.props.isDragging&&s.createElement(wr,st({authentication:Jt(o.props.authentication),autoQLConfig:$t(o.props.autoQLConfig),themeConfig:en(o.props.themeConfig),onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessCallback,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadProgress:o.onCSVDownloadProgress,onCSVDownloadFinish:o.onCSVDownloadFinish,rebuildTooltips:o.props.rebuildTooltips},a))))})),lt(mt(o),"renderResponseContent",(function(e){var t=e.queryOutputProps,n=e.isExecuting,a=e.isExecuted,r=e.renderPlaceholder,i=e.isSecondHalf;if(r)return o.renderContentPlaceholder({isExecuting:n,isExecuted:a});var l=o.state.customMessage;return i&&(l=o.state.secondCustomMessage),s.createElement(s.Fragment,null,o.getIsSuggestionResponse(t.queryResponse)&&o.renderSuggestionMessage(t.customMessage),!l&&s.createElement(Do,st({authentication:Jt(o.props.authentication),themeConfig:o.props.themeConfig,autoQLConfig:$t(o.props.autoQLConfig),dataFormatting:Zt(o.props.dataFormatting),renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:o.props.autoChartAggregations,isResizing:o.props.isDragging,renderSuggestionsAsDropdown:o.props.tile.h<4,enableDynamicCharting:o.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),enableAjaxTableData:o.props.enableAjaxTableData,rebuildTooltips:o.props.rebuildTooltips},t)))})),lt(mt(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,c=e.isSecondHalf,u=e.isExecuting,p=e.isExecuted,d=e.renderPlaceholder;return s.createElement("div",{className:"loading-container-centered",id:n.key},o.renderResponseContent({queryOutputProps:n,isExecuting:u,isExecuted:p,renderPlaceholder:d,isSecondHalf:c}),o.renderToolbars({queryOutputProps:n,vizToolbarProps:r,optionsToolbarProps:l,isSecondHalf:c}))})),lt(mt(o),"renderTopResponse",(function(){var t=o.state.isTopExecuting,n=o.state.isTopExecuted,a=!o.props.queryResponse||t||!n,r=e(o.props,"tile.displayType");return o.renderResponse({renderPlaceholder:a,isExecuting:t,isExecuted:n,queryOutputProps:{ref:function(e){return o.setState({responseRef:e})},optionsToolbarRef:o.optionsToolbarRef,key:"dashboard-tile-query-top-".concat(o.QUERY_RESPONSE_KEY),displayType:r,queryResponse:o.props.queryResponse,tableConfigs:o.props.tile.dataConfig,onTableConfigChange:o.onDataConfigChange,queryValidationSelections:o.props.tile.queryValidationSelections,onSuggestionClick:o.onSuggestionClick,selectedSuggestion:e(o.props.tile,"selectedSuggestion"),onNoneOfTheseClick:o.onNoneOfTheseClick,onDrilldownStart:function(e){return o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!1,activeKey:e})},onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onQueryValidationSelectOption,onSupportedDisplayTypesChange:o.onSupportedDisplayTypesChange,onRecommendedDisplayType:function(e){o.onDisplayTypeChange(e)},reportProblemCallback:o.reportProblemCallback,customMessage:o.state.customMessage,queryRequestData:o.topRequestData},vizToolbarProps:{ref:function(e){return o.vizToolbarRef=e},key:"viz-toolbar-".concat(o.QUERY_RESPONSE_KEY),displayType:r,onDisplayTypeChange:o.onDisplayTypeChange,supportedDisplayTypes:o.state.supportedDisplayTypes},optionsToolbarProps:{ref:function(e){return o.optionsToolbarRef=e},key:"options-toolbar-".concat(o.QUERY_RESPONSE_KEY),responseRef:o.state.responseRef,queryResponse:o.props.queryResponse,onFilterClick:function(e){var t=e.isFilteringTable;return o.toggleTableFilter(o.state.responseRef,t)},displayType:r}})})),lt(mt(o),"renderBottomResponse",(function(){var t,n,a,r,i=null===(t=o.props)||void 0===t||null===(n=t.tile)||void 0===n?void 0:n.query,l=null===(a=o.props)||void 0===a||null===(r=a.tile)||void 0===r?void 0:r.secondQuery,s=!l||i===l,c=o.state.isBottomExecuting,u=o.state.isBottomExecuted,p=o.bottomRequestData;s&&(c=o.state.isTopExecuting,u=o.state.isTopExecuted,p=o.topRequestData);var d=!s&&!o.props.secondQueryResponse||s&&!o.props.queryResponse||c||!u,m=e(o.props,"tile.secondDisplayType","table");return o.renderResponse({renderPlaceholder:d,isExecuting:c,isExecuted:u,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(o.QUERY_RESPONSE_KEY),ref:function(e){return o.setState({secondResponseRef:e})},optionsToolbarRef:o.secondOptionsToolbarRef,displayType:m,queryResponse:o.props.secondQueryResponse||o.props.queryResponse,tableConfigs:o.props.tile.secondDataConfig,onTableConfigChange:o.onSecondDataConfigChange,queryValidationSelections:o.props.tile.secondqueryValidationSelections,onSuggestionClick:o.onSecondSuggestionClick,selectedSuggestion:e(o.props.tile,"secondSelectedSuggestion"),reportProblemCallback:o.secondReportProblemCallback,onSupportedDisplayTypesChange:o.onSecondSupportedDisplayTypesChange,onRecommendedDisplayType:function(e){o.onSecondDisplayTypeChange(e)},onNoneOfTheseClick:o.secondOnNoneOfTheseClick,onDrilldownStart:function(e){o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!0,activeKey:e})},onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onSecondQueryValidationSelectOption,queryRequestData:p},vizToolbarProps:{ref:function(e){return o.secondVizToolbarRef=e},key:"viz-toolbar-".concat(o.QUERY_RESPONSE_KEY),displayType:m,onDisplayTypeChange:o.onSecondDisplayTypeChange,supportedDisplayTypes:o.state.secondSupportedDisplayTypes},optionsToolbarProps:{ref:function(e){return o.secondOptionsToolbarRef=e},key:"options-toolbar-".concat(o.QUERY_RESPONSE_KEY),queryResponse:o.props.secondQueryResponse||o.props.queryResponse,responseRef:o.state.secondResponseRef,onFilterClick:function(e){var t=e.isFilteringTable;return o.toggleTableFilter(o.state.secondResponseRef,t)},displayType:m},isSecondHalf:!0})})),lt(mt(o),"renderContent",(function(){return s.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(o.props.isEditing?" editing":"","\n ").concat(o.props.tile.h<4?" small":"")},s.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-response-container"},o.getIsSplitView()?o.renderSplitResponse():o.renderTopResponse()))})),lt(mt(o),"renderDragHandles",(function(){return s.createElement(c,null,s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle top"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle bottom"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle left"}),s.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle right"}))})),lt(mt(o),"render",(function(){var e=o.props,t={onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onTouchStart:e.onTouchStart,onTouchEnd:e.onTouchEnd};return s.createElement(yt,null,s.createElement("div",st({className:o.props.className,style:$e({},o.props.style),"data-grid":o.props.tile},t),o.props.children,s.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":"")},s.createElement(c,null,o.renderHeader(),o.renderContent())),o.props.isEditing&&o.renderDragHandles()))})),o.COMPONENT_KEY=d(),o.QUERY_RESPONSE_KEY=d(),o.autoCompleteTimer=void 0,o.debounceTime=50,o.paramsToSet={},o.callbackArray=[];var r=Pn({response:t.queryResponse})||[],i=Pn({response:t.secondQueryResponse})||[];return 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,supportedDisplayTypes:r,secondSupportedDisplayTypes:i},o}return it(a)}();lt(Fr,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,isEditing:p.bool.isRequired,tile:p.shape({}).isRequired,deleteTile:p.func.isRequired,dataPageSize:p.number,queryResponse:p.shape({}),notExecutedText:p.string,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func,enableAjaxTableData:p.bool.isRequired}),lt(Fr,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,query:"",title:"",displayType:"table",dataPageSize:void 0,queryValidationSelections:void 0,selectedSuggestion:void 0,notExecutedText:'Hit "Execute" to run this dashboard',autoChartAggregations:!0,onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Qr=s.forwardRef((function(e,t){var n=e.style,a=e.className;e.key;var o=dt(e,Lr);return s.createElement("div",{style:$e({},n),className:a,ref:t},s.createElement(Fr,st({},o,{ref:o.tileRef,className:"".concat(o.innerDivClass," ").concat(o.isEditing?"editing":""),"data-test":"react-autoql-dashboard-tile"})))})),zr=Ke(je),Hr=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},Br=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},_r=function(t){ct(a,s.Component);var n=gt(a);function a(){var t;ot(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return lt(mt(t=n.call.apply(n,[this].concat(r))),"tileRefs",{}),lt(mt(t),"debounceTime",50),lt(mt(t),"onChangeTiles",null),lt(mt(t),"callbackSubsciptions",[]),lt(mt(t),"DEFAULT_AJAX_PAGE_SIZE",50),lt(mt(t),"state",{isDragging:!1,drilldownDisplayType:"table",isReportProblemOpen:!1}),lt(mt(t),"componentDidMount",(function(){t._isMounted=!0,t.props.executeOnMount&&t.executeDashboard(),t.setStyles(),window.addEventListener("resize",t.onWindowResize)})),lt(mt(t),"componentDidUpdate",(function(n){se(en(t.props.themeConfig),en(n.themeConfig))||t.setStyles(),n.isEditing&&!t.props.isEditing&&t.props.executeOnStopEditing&&t.executeDashboard(),t.getChangeDetection(t.props.tiles,n.tiles)&&e(n,"tiles[".concat(n.tiles.length," - 1].y"))!==Number.MAX_VALUE&&t.setState({justPerformedUndo:!1})})),lt(mt(t),"componentWillUnmount",(function(){t._isMounted=!1,window.removeEventListener("resize",t.onWindowResize),clearTimeout(t.scrollToNewTileTimeout),clearTimeout(t.rebuildTooltipsTimer),clearTimeout(t.stopDraggingTimeout),clearTimeout(t.drillingDownTimeout),clearTimeout(t.animationTimeout)})),lt(mt(t),"getMostRecentTiles",(function(){return t.onChangeTiles?t.onChangeTiles:t.props.tiles})),lt(mt(t),"rebuildTooltips",(function(){clearTimeout(t.rebuildTooltipsTimer),t.rebuildTooltipsTimer=setTimeout((function(){le.rebuild()}),500)})),lt(mt(t),"subscribeToCallback",(function(e){t.callbackSubsciptions=[].concat(ht(t.callbackSubsciptions),ht(e))})),lt(mt(t),"debouncedOnChange",(function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];n&&(t.previousTileState=ce(t.getMostRecentTiles())),t.onChangeTiles=ce(e);var o=new Promise((function(e,n){try{t.subscribeToCallback([e]),null!=a&&a.length&&t.subscribeToCallback(a),t.onChangeTimer&&clearTimeout(t.onChangeTimer),t.onChangeTimer=setTimeout((function(){if(t.onChangeTiles){var n;if(t.props.onChange(t.onChangeTiles),t.onChangeTiles=null,null!==(n=t.callbackSubsciptions)&&void 0!==n&&n.length){var a=ce(t.callbackSubsciptions);return t.callbackSubsciptions=[],void a.forEach((function(e,n){t.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(n+1))}))}return e()}return e()}),t.debounceTime)}catch(e){return console.error(e),t.callbackSubsciptions=[],n()}}));return o})),lt(mt(t),"setStyles",(function(){_n(t.props.themeConfig)})),lt(mt(t),"onWindowResize",(function(e){t.currentWindowWidth||(t.currentWindowWidth=window.innerWidth);var n=e.target.innerWidth!==t.currentWindowWidth;n&&(t.state.isWindowResizing||(t.currentWindowWidth=window.innerWidth,t.setState({isWindowResizing:!0})),n&&(t.windowResizeTimer=setTimeout((function(){n&&(t.currentWindowWidth=void 0,t.setState({isWindowResizing:!1}))}),300)))})),lt(mt(t),"executeDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].processTile()}catch(e){console.error(e)}})),lt(mt(t),"unExecuteDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),lt(mt(t),"getChangeDetection",(function(e,n,a){return!se(t.getChangeDetectionTileStructure(e,a),t.getChangeDetectionTileStructure(n,a))})),lt(mt(t),"getChangeDetectionTileStructure",(function(e,t){try{return e.map((function(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)}})),lt(mt(t),"scrollToNewTile",(function(){t.scrollToNewTileTimeout=setTimeout((function(){t.ref&&t.ref.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"})}),200)})),lt(mt(t),"onMoveStart",(function(){t.state.isDragging||t.setState({isDragging:!0})})),lt(mt(t),"onMoveEnd",(function(e){try{var n=t.getMostRecentTiles();t.getChangeDetection(n,e,!0)&&(t.previousTileState=n),t.stopDraggingTimeout=setTimeout((function(){t.setState({isDragging:!1})}),100)}catch(e){console.error(e)}})),lt(mt(t),"updateTileLayout",(function(e){try{var n=t.getMostRecentTiles().map((function(t,n){return $e($e({},t),e[n])}));t.debouncedOnChange(n,!1)}catch(e){console.error(e)}})),lt(mt(t),"addTile",(function(){try{var e=ce(t.getMostRecentTiles()),n=d();e.push({key:n,i:n,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),t.debouncedOnChange(e).then((function(){t.scrollToNewTile()})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),lt(mt(t),"undo",(function(){try{t.debouncedOnChange(t.previousTileState,!1),t.setState({justPerformedUndo:!0})}catch(e){console.error(e)}})),lt(mt(t),"deleteTile",(function(e){try{var n=ce(t.getMostRecentTiles()),a=n.map((function(e){return e.i})).indexOf(e);~a&&n.splice(a,1),t.debouncedOnChange(n)}catch(e){console.error(e)}})),lt(mt(t),"setParamsForTile",(function(e,n,a){try{var o=t.getMostRecentTiles(),r=ce(t.getMostRecentTiles()),i=r.map((function(e){return e.i})).indexOf(n);r[i]=$e($e({},r[i]),e),Object.keys(e).includes("query")&&e.query!==o[i].query?(r[i].dataConfig=void 0,r[i].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==o[i].secondQuery&&(r[i].secondDataConfig=void 0,r[i].secondskipQueryValidation=!1),t.debouncedOnChange(r,void 0,a)}catch(e){console.error(e)}})),lt(mt(t),"onDrilldownStart",(function(e){var n=e.tileId,a=e.activeKey,o=e.isSecondHalf;$t(t.props.autoQLConfig).enableDrilldowns&&(t.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:o,activeDrilldownTile:n||t.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:a,isAnimatingModal:!t.state.isDrilldownModalVisible}),t.animationTimeout=setTimeout((function(){t.setState({isAnimatingModal:!1})}),500))})),lt(mt(t),"onDrilldownEnd",(function(e){var n=e.response,a=e.error;n?t._isMounted&&t.setState({activeDrilldownResponse:n,isDrilldownRunning:!1}):a&&(console.error(a),t._isMounted&&t.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),lt(mt(t),"shouldShowOriginalQuery",(function(e){if(!e)return!1;var n=t.state.isDrilldownSecondHalf?e.secondDisplayType:e.displayType;return nn.includes(n)})),lt(mt(t),"reportProblemCallback",(function(){t.setState({isReportProblemOpen:!0})})),lt(mt(t),"renderDrilldownTable",(function(){return s.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},t.state.isDrilldownRunning?s.createElement("div",{className:"dashboard-tile-loading-container"},s.createElement(da,null)):s.createElement(Do,{ref:function(e){return t.drilldownTableRef=e},displayType:t.state.drilldownDisplayType,onRecommendedDisplayType:function(e){t.setState({drilldownDisplayType:e})},authentication:Jt(t.props.authentication),autoQLConfig:$t(t.props.autoQLConfig),themeConfig:t.props.themeConfig,dataFormatting:Zt(t.props.dataFormatting),queryResponse:t.state.activeDrilldownResponse,renderTooltips:!1,onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),reportProblemCallback:t.reportProblemCallback,enableAjaxTableData:t.props.enableAjaxTableData,rebuildTooltips:t.rebuildTooltips}))})),lt(mt(t),"renderChartCollapseBtn",(function(e){return s.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},s.createElement(Wa,{onClick:function(){t.setState({isDrilldownChartHidden:!t.state.isDrilldownChartHidden})},tooltip:t.state.isDrilldownChartHidden?"Show Chart":"Hide Chart"},s.createElement(Kt,{type:"chart"}),s.createElement(Kt,{type:t.state.isDrilldownChartHidden?"expand":"collapse"})))})),lt(mt(t),"renderReportProblemModal",(function(){return s.createElement(xr,{authentication:t.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:function(){t.setState({isReportProblemOpen:!1})},onReportProblem:function(e){var n=e.successMessage,a=e.error;n?(t.props.onSuccessCallback(n),t._isMounted&&t.setState({isReportProblemOpen:!1})):a&&t.props.onErrorCallback(a)},responseRef:t.drilldownTableRef,isVisible:t.state.isReportProblemOpen})})),lt(mt(t),"renderDrilldownModal",(function(){try{var e,n,a,o,r=t.getMostRecentTiles().find((function(e){return e.i===t.state.activeDrilldownTile}));r&&t.state.isDrilldownSecondHalf?(e=r.secondQuery,n=r.secondQueryResponse||r.queryResponse,a=r.secondDisplayType,o=r.secondDataConfig):r&&!t.state.isDrilldownSecondHalf&&(e=r.title||r.query,n=r.queryResponse,a=r.displayType,o=r.dataConfig);var i=t.state.isDrilldownChartHidden||!t.shouldShowOriginalQuery(r);return s.createElement(Ao,{themeConfig:t.props.themeConfig,className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(t.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(t.shouldShowOriginalQuery(r)?"":"top-hidden"),title:e,isVisible:t.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,onClose:function(){t.setState({isDrilldownModalVisible:!1,drilldownDisplayType:"table",activeDrilldownTile:null})}},t.state.isDrilldownModalVisible&&s.createElement(c,null,r&&s.createElement(Ge,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:i?0:35,onDragEnd:function(){t.setState({})}},s.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},t.shouldShowOriginalQuery(r)&&s.createElement(s.Fragment,null,s.createElement(Do,{key:"dashboard-drilldown-chart-".concat(t.state.activeDrilldownTile),authentication:t.props.authentication,autoQLConfig:t.props.autoQLConfig,themeConfig:t.props.themeConfig,dataFormatting:Zt(t.props.dataFormatting),queryResponse:ce(n),displayType:a,tableConfigs:ce(o),onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:function(e){return t.onDrilldownStart({tileId:r.i,activeKey:e,isSecondHalf:t.state.isDrilldownSecondHalf})},onDrilldownEnd:t.onDrilldownEnd,activeChartElementKey:t.state.activeDrilldownChartElementKey,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),enableAjaxTableData:t.props.enableAjaxTableData,reportProblemCallback:t.reportProblemCallback}),t.renderChartCollapseBtn("bottom"))),t.renderDrilldownTable()),t.shouldShowOriginalQuery(r)&&t.state.isDrilldownChartHidden&&t.renderChartCollapseBtn("top")))}catch(e){console.error(e),t.props.onErrorCallback(e)}})),lt(mt(t),"renderEmptyDashboardMessage",(function(){return t.props.isEditable&&!t.props.isEditing?s.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",s.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.props.startEditingCallback()}},"New Dashboard")):t.props.isEditing?s.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",s.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.addTile()}},"New Tile")," ","to get started"):s.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),lt(mt(t),"renderTiles",(function(){var e=t.getMostRecentTiles().map((function(e){return $e($e({},e),{},{i:e.key,maxH:12,minH:2,minW:3})})),n=t.props.dataPageSize;return t.props.enableAjaxTableData&&!n&&(n=t.DEFAULT_AJAX_PAGE_SIZE),s.createElement(zr,{onLayoutChange:function(e){t.updateTileLayout(e),t.setState({layout:e})},onDrag:t.onMoveStart,onResizeStart:t.onMoveStart,onDragStop:t.onMoveEnd,onResizeStop:t.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:t.props.isEditing,isResizable:t.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return s.createElement(Qr,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(n){return t.tileRefs[e.key]=n},key:e.key,authentication:Jt(t.props.authentication),autoQLConfig:$t(t.props.autoQLConfig),themeConfig:t.props.themeConfig,tile:$e($e({},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:t.props.isEditing,isDragging:t.state.isDragging||t.state.isWindowResizing,isWindowResizing:t.state.isWindowResizing,setParamsForTile:t.setParamsForTile,deleteTile:t.deleteTile,dataFormatting:Zt(t.props.dataFormatting),notExecutedText:t.props.notExecutedText,enableDynamicCharting:t.props.enableDynamicCharting,onErrorCallback:t.props.onErrorCallback,onSuccessCallback:t.props.onSuccessCallback,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:t.onDrilldownStart,onDrilldownEnd:t.onDrilldownEnd,onCSVDownloadStart:t.props.onCSVDownloadStart,onCSVDownloadProgress:t.props.onCSVDownloadProgress,onCSVDownloadFinish:t.props.onCSVDownloadFinish,enableAjaxTableData:t.props.enableAjaxTableData,rebuildTooltips:t.rebuildTooltips,dataPageSize:n})})))})),lt(mt(t),"render",(function(){var e=t.getMostRecentTiles();return s.createElement(yt,null,s.createElement(c,null,s.createElement("div",{ref:function(e){return t.ref=e},className:"react-autoql-dashboard-container".concat(t.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?t.renderTiles():t.renderEmptyDashboardMessage()),!t.state.isDragging&&t.renderDrilldownModal(),t.renderReportProblemModal(),s.createElement(le,{className:"react-autoql-dashboard-tooltip",id:"react-autoql-dashboard-toolbar-btn-tooltip",effect:"solid",delayShow:500,html:!0}),s.createElement(le,{place:"left",className:"react-autoql-chart-tooltip",id:"dashboard-data-limit-warning-tooltip",effect:"solid",html:!0})))})),t}return it(a)}();lt(_r,"propTypes",{authentication:bt,autoQLConfig:Et,dataFormatting:Ct,themeConfig:St,tiles:p.arrayOf(p.shape({})),executeOnMount:p.bool,dataPageSize:p.number,executeOnStopEditing:p.bool,isEditing:p.bool,isEditable:p.bool,notExecutedText:p.string,onChange:p.func,enableDynamicCharting:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func,enableAjaxTableData:p.bool}),lt(_r,"defaultProps",{authentication:Gt,autoQLConfig:Yt,dataFormatting:Wt,themeConfig:Xt,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 Ur=function(e){ct(n,s.Component);var t=gt(n);function n(){var e;ot(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return lt(mt(e=t.call.apply(t,[this].concat(o))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),lt(mt(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)})),lt(mt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=Xe(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:Je,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),lt(mt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),lt(mt(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)}}))})),lt(mt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),lt(mt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),lt(mt(e),"onMouseDown",(function(){le.hide(),e.startRecording()})),lt(mt(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};l.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})}))}))})),lt(mt(e),"render",(function(){return s.createElement(yt,null,s.createElement(me,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return s.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},s.createElement(Kt,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},s.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},s.createElement(Kt,{type:"microphone"}))),s.createElement(le,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return it(n)}();lt(Ur,"propTypes",{authentication:bt,themeConfig:St,transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,onTranscriptChange:p.func,onFinalTranscript:p.func}),lt(Ur,"defaultProps",{authentication:Gt,themeConfig:Xt});export{_r as Dashboard,Qr as DashboardTile,pr as DataAlertModal,vr as DataAlerts,Pr as DataMessenger,Vr as ExploreQueries,Sr as ExpressionBuilder,er as ExpressionBuilderSimple,Ir as FilterLockPopover,Kt as Icon,da as LoadingDots,gr as NotificationFeed,Yo as NotificationIcon,tr as NotificationItem,wr as OptionsToolbar,ma as QueryInput,Do as QueryOutput,xr as ReportProblemModal,To as ReverseTranslation,ur as ScheduleBuilder,Ur as SpeechToTextButton,pa as SpeechToTextButtonBrowser,ko as VizToolbar,Hr as executeDashboard,sa as fetchExploreQueries,Fn as getDefaultDisplayType,Pn as getSupportedDisplayTypes,Ln as isDisplayTypeValid,Br as unExecuteDashboard};