react-autoql 4.2.0 → 4.2.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 r from"dayjs/plugin/localizedFormat";import o from"dayjs/plugin/utc";import i from"dayjs/plugin/timezone";import s from"axios";import l,{Fragment as c,Component as u}from"react";import p,{shape as d,string as m,number as f,bool as g,oneOf as h,arrayOf as y,instanceOf as v,func as C,oneOfType as b}from"prop-types";import{AiOutlineBook as E,AiOutlineQuestionCircle as S,AiOutlineMenu as T,AiOutlineBulb as D,AiOutlineEdit as x,AiOutlineFileText as w,AiOutlineDashboard as k,AiFillCaretUp as A,AiFillCaretDown as N,AiFillCaretLeft as R,AiFillCaretRight as V}from"react-icons/ai";import{BiLineChart as M}from"react-icons/bi";import{BsArrowBarDown as I,BsArrowBarUp as q}from"react-icons/bs";import{FaMicrophoneAlt as L}from"react-icons/fa";import{FiAlertTriangle as P,FiTrash2 as O,FiSettings as F,FiSend as Q,FiPlus as H,FiPauseCircle as B,FiBellOff as z,FiBell as U,FiMoreHorizontal as _,FiMoreVertical as j,FiFilter as K,FiEye as G,FiDownload as W,FiDatabase as Y,FiMinimize as X,FiMaximize as J,FiCheck as Z,FiCalendar as $,FiArrowLeft as ee}from"react-icons/fi";import{GoReport as te}from"react-icons/go";import{IoIosSearch as ne,IoIosHourglass as ae,IoIosGlobe as re,IoIosCloseCircleOutline as oe}from"react-icons/io";import{MdError as ie,MdLockOpen as se,MdPlayCircleOutline as le,MdLock as ce,MdInfoOutline as ue,MdContentCopy as pe,MdClose as de}from"react-icons/md";import{TiSortNumerically as me}from"react-icons/ti";import fe from"react-tooltip";import ge from"lodash.isequal";import he from"lodash.clonedeep";import ye from"react-infinite-scroller";import{v4 as ve}from"uuid";import Ce from"lodash.isempty";import be from"parse-num";import Ee from"react-tiny-popover";import Se from"moment-timezone";import Te from"react-select";import De from"react-modal";import xe from"disable-scroll";import we from"html-react-parser";import{scaleOrdinal as ke,scaleBand as Ae,scaleLinear as Ne}from"d3-scale";import{ReactTabulator as Re}from"react-tabulator";import"react-tabulator/lib/styles.css";import"react-tabulator/css/bootstrap/tabulator_bootstrap.min.css";import"lodash.reduce";import Ve from"lodash.sortby";import{select as Me}from"d3-selection";import{max as Ie,min as qe}from"d3-array";import{axisBottom as Le,axisLeft as Pe}from"d3-axis";import{legendColor as Oe}from"d3-svg-legend";import{symbol as Fe,symbolCircle as Qe,arc as He,pie as Be}from"d3-shape";import{entries as ze}from"d3-collection";import"d3-transition";import Ue from"react-autosuggest";import _e from"react-speech-recognition";import je from"rc-drawer";import Ke from"lodash.has";import Ge from"react-localization";import"rc-drawer/assets/index.css";import{toast as We,ToastContainer as Ye,Slide as Xe}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import{Scrollbars as Je}from"react-custom-scrollbars-2";import{format as Ze}from"sql-formatter";import{Scrollbars as $e}from"react-custom-scrollbars";import et from"react-paginate";import tt,{WidthProvider as nt}from"react-grid-layout";import at from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import rt from"lodash.omit";import ot from"lodash.functions";import it,{StereoAudioRecorder as st}from"recordrtc";function lt(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 ct(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(n),!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ut(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3
- ut=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",i=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,a){var r=t&&t.prototype instanceof p?t:p,o=Object.create(r.prototype),i=new T(a||[]);return o._invoke=function(e,t,n){var a="suspendedStart";return function(r,o){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var i=n.delegate;if(i){var s=b(i,n);if(s){if(s===u)continue;return s}}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 l=c(e,t,n);if("normal"===l.type){if(a=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function p(){}function d(){}function m(){}var f={};s(f,r,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(D([])));h&&h!==t&&n.call(h,r)&&(f=h);var y=m.prototype=p.prototype=Object.create(f);function v(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){var a;this._invoke=function(r,o){function i(){return new t((function(a,i){!function a(r,o,i,s){var l=c(e[r],e,o);if("throw"!==l.type){var u=l.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){a("next",e,i,s)}),(function(e){a("throw",e,i,s)})):t.resolve(p).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,s)}))}s(l.arg)}(r,o,a,i)}))}return a=a?a.then(i,i):i()}}function b(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,b(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 r=a.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(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[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function t(){for(;++a<e.length;)if(n.call(e,a))return t.value=e[a],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return d.prototype=m,s(y,"constructor",m),s(m,"constructor",d),d.displayName=s(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,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},v(C.prototype),s(C.prototype,o,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,a,r,o){void 0===o&&(o=Promise);var i=new C(l(t,n,a,r),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},v(y),s(y,i,"Generator"),s(y,r,(function(){return this})),s(y,"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 r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.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 r=a.arg;S(n)}return r}}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 pt(e){return(pt="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 dt(e,t,n,a,r,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(a,r)}function mt(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var o=e.apply(t,n);function i(e){dt(o,a,r,i,s,"next",e)}function s(e){dt(o,a,r,i,s,"throw",e)}i(void 0)}))}}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(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 ht(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=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&&Et(e,t)}function bt(e){return(bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t){return(Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function St(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dt(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 Tt(e)}function xt(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=bt(e);if(t){var r=bt(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return Dt(this,n)}}function wt(e){return function(e){if(Array.isArray(e))return kt(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 kt(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 kt(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 kt(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 At=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{hasError:!1}),yt(Tt(e),"componentDidCatch",(function(t,n){e.setState({hasError:!0})})),yt(Tt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),yt(Tt(e),"render",(function(){return e.state.hasError?l.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return ht(n)}();yt(At,"propTypes",{message:p.string}),yt(At,"defaultProps",{message:null});var Nt=d({token:m,apiKey:m,domain:m}),Rt=d({currencyCode:m,languageCode:m,currencyDecimals:f,quantityDecimals:f,comparisonDisplay:m,monthYearFormat:m,dayMonthYearFormat:m}),Vt=d({debug:g,test:g,enableAutocomplete:g,enableQueryValidation:g,enableDrilldowns:g,enableQuerySuggestions:g,enableColumnVisibilityManager:g,enableNotifications:g}),Mt=d({theme:h(["light","dark"]),chartColors:y(m),accentColor:m,fontFamily:m,dashboardBackground:m});d({stringColumnIndices:y(f),numberColumnIndices:y(f),stringColumnIndex:f,legendColumnIndex:f,numberColumnIndex:f});var It={token:void 0,apiKey:void 0,domain:void 0},qt={currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMM YYYY",dayMonthYearFormat:"ll"},Lt={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,defaultShowInterpretation:!1,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableSlackSharing:!0,enableTeamsSharing:!0,enableCSVDownload:!1},Pt={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",titleColor:"#356f90",dashboardBackground:"#fafafa"},Ot=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},It),e)},Ft=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},qt),e)},Qt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},Lt),e)},Ht=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},Pt),e)};n.extend(o),n.extend(i),n.extend(a),n.extend(r),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 Bt=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],zt=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line"],Ut={1:n("2020-1-1").format("MMMM"),2:n("2020-2-2").format("MMMM"),3:n("2020-3-3").format("MMMM"),4:n("2020-4-4").format("MMMM"),5:n("2020-5-5").format("MMMM"),6:n("2020-6-6").format("MMMM"),7:n("2020-7-7").format("MMMM"),8:n("2020-8-8").format("MMMM"),9:n("2020-9-9").format("MMMM"),10:n("2020-10-10").format("MMMM"),11:n("2020-11-11").format("MMMM"),12:n("2020-12-12").format("MMMM")},_t={"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"},jt={"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"},Kt=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},Gt=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Wt=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t},Yt=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Xt=function(e){var t=[],n=[],a=[];return e.forEach((function(e,r){var o=e.type;e.is_visible&&("DOLLAR_AMT"===o?t.push(r):"QUANTITY"===o?n.push(r):"PERCENT"!==o&&"RATIO"!==o||a.push(r))})),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}},Jt=function(e){if(e&&function(e){return!Kt(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}))},Zt=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},$t=function(t,n){if(t){var a=Jt(t),r=Zt(t),o=[];t.forEach((function(e,t){(Wt(e)||e.groupable)&&t!==a&&e.is_visible&&o.push(t)}));var i=o[0];if(n)i=e(t[r],"groupable")?r:t.findIndex((function(e){return e.groupable}));else r>=0?i=r:o[1]>=0&&(i=o[1]);return{stringColumnIndex:i,stringColumnIndices:o}}},en=function(e){var t=0,n=0;return e.forEach((function(e){Gt(e)&&e.is_visible?n+=1:Wt(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},tn=function(e,t,n){return n.indexOf(e)===t},nn=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=[],r=0;r<t;r++){a[r]=[];for(var o=0;o<e;o++)a[r][o]=n}return a},an=function(e){return"Invalid Date"!==e},rn=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 r=a.monthYearFormat,o=a.dayMonthYearFormat,i="YYYY",s=r||"MMM YYYY",l=o||"ll",c=t.title,u=n.unix(e).utc().format(l);return Number.isNaN(Number(e))?(c&&c.toLowerCase().includes("year")?u=n(e).format(i):c&&c.toLowerCase().includes("month")&&(u=n(e).format(s)),u=n(e).format(l)):c&&c.toLowerCase().includes("year")?u=n.unix(e).utc().format(i):c&&c.toLowerCase().includes("month")&&(u=n.unix(e).utc().format(s)),an(u)?u:e}catch(t){return console.error(t),e}},on=function(t,a){if(t){if(t&&"string"==typeof t){var r,o,i=t.split("-"),s=e(i,"[0]"),l=e(i,"[2]");e(i,"[1]","").includes("W")?o=e(i,"[1]"):r=e(i,"[1]");var c=a.monthYearFormat||"MMM YYYY",u=a.dayMonthYearFormat||"ll";if(l){var p=n(t).format(u);if(an(p))return p}else if(r){var d=n(t).format(c);if(an(d))return d}else{if(o)return t;if(s)return s}}return t}},sn=function(e){var t=e.d,n=e.col,a=void 0===n?{}:n,r=e.config,o=void 0===r?{}:r;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=o.currencyCode,s=o.languageCode,l=t;switch(a.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var c=i||"USD";try{l=new Intl.NumberFormat(s,{style:"currency",currency:"".concat(c),minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(s,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}}break;case"QUANTITY":Number(t)&&(l=new Intl.NumberFormat(s).format(t));break;case"DATE":l=rn(t,a,o);break;case"DATE_STRING":l=on(t,o);break;case"PERCENT":if(Number(t)){var u=Number(t)/100;l=new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:0}).format(u)}}var p=l,d=!1;return"string"==typeof l&&l.length>20&&(l="".concat(l.substring(0,20),"..."),d=!0),{fullWidthLabel:p,formattedLabel:l,isTruncated:d}},ln=function(e){var t=e.element,n=e.column,a=e.config,r=void 0===a?{}:a,o=e.htmlElement;try{var i=t,s=r.currencyCode,l=r.languageCode,c=r.currencyDecimals,u=r.quantityDecimals;if(n)switch(n.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var p=s||"USD",d=c||0===c?c:void 0;try{i=new Intl.NumberFormat(l,{style:"currency",currency:"".concat(p),minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}catch(e){console.error(e),i=new Intl.NumberFormat(l,{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(l,{minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}break;case"DATE":i=rn(t,n,r);break;case"DATE_STRING":i=on(t,r);break;case"RATIO":Number(t)&&(i=new Intl.NumberFormat(l,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(Number(t)){var g=Number(t)/100;i=new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(g),o&&o.classList.add("comparison-value-".concat(t<0?"negative":"positive"))}}return i}catch(e){return console.error(e),t}},cn=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}},un=function(e){var t;try{e&&(t=e.getBBox())}catch(e){console.error(e)}return t},pn=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,r){try{var o=cn(e),i=e.getBoundingClientRect(),s=2*i.width,l=2*i.height,c=document.createElement("canvas");c.width=s+t,c.height=l+t;var u=c.getContext("2d"),p=new Image;p.onload=function(){if(u.drawImage(this,t,t,s,l),n){var e=document.createElement("canvas");e.width=c.width,e.height=c.height;var r=e.getContext("2d");r.save(),r.fillStyle=n,r.fillRect(0,0,c.width,c.height),r.strokeRect(0,0,c.width,c.height),r.restore(),r.drawImage(c,0,0),c=e}a(c.toDataURL("image/png",1))},p.onerror=function(e){r("failed to load image with that url"+url)},p.src=o}catch(e){console.error(e),r("failed to convert svg to png "+e)}}))},dn=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},mn=function(e){return zt.includes(e)},fn=function(e){return Bt.includes(e)},gn=function(e){return 2===dn(e)&&3===e.length},hn=function(e){var t=en(e),n=t.amountOfNumberColumns,a=t.amountOfStringColumns;return n>0&&a>0},yn=function(n){return t(e(n,"data.data.columns"),(function(e){return e.is_visible}))},vn=function(n){var a=e(n,"data.data.columns.length"),r=function(n){return t(e(n,"data.data.columns"),(function(e){return!e.is_visible}))}(n);return a&&!!r.length},Cn=function(t){var n=e(t,"data.data.columns.length"),a=yn(t);return n&&!a.length},bn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,a=t.shouldExcludePieChart,r=t.dataLength;try{if(!e(n,"data.data.display_type"))return[];var o=n.data.data.display_type;if("suggestion"===o||"help"===o||"html"===o)return[o];var i=e(n,"data.data.rows",[]),s=yn(n);if(!e(s,"length")||!e(i,"length"))return["text"];if(Rn(n))return["single-value"];var l=r||i.length,c=0===r;if(gn(s)&&!c){var u=["table"];return i.length<1e3?u.push("pivot_table","stacked_column","stacked_bar","stacked_line","column","bar","line","bubble","heatmap"):console.warn("Supported Display Types: Rows exceeded 1000, only allowing regular table display type"),u}if(hn(s)&&!c){var p=["table","column","bar","line"];l<=10&&!a&&p.push("pie");var d=s.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),m=s[d];if(m&&m.display_name.toLowerCase().includes("month")&&2===s.length){var f=e(n,"data.data.rows"),g=[];f.forEach((function(e){var t=ln({element:e[d],column:m,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});g.includes(t)||g.push(t)})),g.length>1&&p.push("pivot_table")}return p}return["table"]}catch(e){return console.error(e),["table"]}},En=function(e,t){var n=bn({response:e});return t&&n.includes(t)},Sn=function(e,t){var n=e.find((function(e){return mn(e)}));return n||t},Tn=function(t,n){var a=bn({response:t}),r=e(t,"data.data.display_type");if("suggestion"===r||"help"===r||"html"===r)return r;if(1===a.length)return a[0];if(a.includes("pivot_table")){var o="pivot_table";return n&&(o=Kt(e(t,"data.data.columns"))?Sn(a,"pivot_table"):"pivot_table"),o}if(!r&&Vn(t)||"data"===r){var i="table";return n&&(i=Kt(e(t,"data.data.columns"))?Sn(a,"table"):"table"),i}return"text"},Dn=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}},xn=function(e,t,n){if(null==e||!e.length||!t)return 0;var a=Dn(sn({d:e[0],col:t,config:n}));return e.forEach((function(e){var r=sn({d:e,col:t,config:n}).formattedLabel,o=Dn(r);o>a&&(a=o)})),a},wn=function(e,t){if(!isNaN(e)&&!isNaN(t)){var n=e-t;return Math.abs(n)<5||e<t}},kn=function(e,t){try{return e.bandwidth()+t*e.bandwidth()*2}catch(e){return console.error(e),0}},An=function(e){if(e){var t=e.theme,n=e.accentColor,a=e.fontFamily,r=e.accentTextColor,o="light"===t?_t:jt;if(n&&(o["accent-color"]=n),a&&(o["font-family"]=a),r)o["accent-text-color"]=r;else{var i=n;"#"===i.slice(0,1)&&(i=i.slice(1)),3===i.length&&(i=i.split("").map((function(e){return e+e})).join(""));var s=(299*parseInt(i.substr(0,2),16)+587*parseInt(i.substr(2,2),16)+114*parseInt(i.substr(4,2),16))/1e3;o["accent-text-color"]=s>=140?"black":"white"}for(var l in o)document.documentElement.style.setProperty("--react-autoql-".concat(l),o[l])}},Nn=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},Rn=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},Vn=function(t){if(!t)return!1;var n=e(t,"data.data.rows.length")&&e(t,"data.data.rows.length");return n},Mn=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)}},In={GENERAL_QUERY:l.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:l.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:l.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.")},qn=new Ge({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",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",filterColumn:"Columna de filtro",columnName:"Nombre de columna",visibility:"Visibilidad",cancel:"Cancelar",apply:"Aplicar"}}),Ln=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.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"}),l.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"})),Pn=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.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"}))))),On=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.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"})))),Fn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Qn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Hn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Bn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),zn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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 "})),Un=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"}),l.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"})),_n=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),l.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"}),l.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),l.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"}),l.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),l.createElement("g",null,l.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),l.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"}),l.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),jn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),l.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"}),l.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),l.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"}),l.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),l.createElement("g",null,l.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),l.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"}),l.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Kn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",{className:"st2"},l.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"})),l.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"}),l.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"})),Gn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),l.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),l.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),l.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),l.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),l.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),l.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),l.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),l.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),l.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),l.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),l.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),l.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),l.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),l.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),Wn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Yn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),l.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"}),l.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"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Xn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"}),l.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),Jn="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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",Zn="data:image/png;base64,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",$n=["type","size","showBadge","warning","danger"],ea=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger;var n=St(t,$n),a=null;switch(e.props.type){case"back":a=l.createElement(ee,null);break;case"bar-chart":a=Bn;break;case"stacked-bar-chart":a=_n;break;case"bubble-chart":a=Wn;break;case"calendar":a=l.createElement($,null);break;case"caret-right":a=l.createElement(V,null);break;case"caret-left":a=l.createElement(R,null);break;case"caret-down":a=l.createElement(N,null);break;case"caret-up":a=l.createElement(A,null);break;case"react-autoql-bubbles-outlined":a=Ln;break;case"react-autoql-bubbles-filled":a=On;break;case"react-autoql-bubbles-filled-alt":a=Pn;break;case"chart":a=l.createElement(M,null);break;case"check":a=l.createElement(Z,null);break;case"close":a=l.createElement(de,null);break;case"maximize":a=l.createElement(J,null);break;case"minimize":a=l.createElement(X,null);break;case"close-circle":a=l.createElement(oe,null);break;case"collapse":a=l.createElement(q,null);break;case"column-chart":a=Hn;break;case"stacked-column-chart":a=jn;break;case"copy":a=l.createElement(pe,null);break;case"dashboard":a=l.createElement(k,null);break;case"database":a=l.createElement(Y,null);break;case"description":a=l.createElement(w,null);break;case"download":a=l.createElement(W,null);break;case"edit":a=l.createElement(x,null);break;case"expand":a=l.createElement(I,null);break;case"eye":a=l.createElement(G,null);break;case"filter":a=l.createElement(K,null);break;case"globe":a=l.createElement(re,null);break;case"heatmap":a=Gn;break;case"hour-glass":a=l.createElement(ae,null);break;case"info":a=l.createElement(ue,null);break;case"light-bulb":a=l.createElement(D,null);break;case"line-chart":a=zn;break;case"lock":a=l.createElement(ce,null);break;case"stacked-line-chart":a=Kn;break;case"teams":a=l.createElement("img",{className:"slack-logo",src:Zn,alt:"Slack",style:ct(ct({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"menu":a=l.createElement(T,null);break;case"microphone":a=l.createElement(L,null);break;case"more-vertical":a=l.createElement(j,null);break;case"more-horizontal":a=l.createElement(_,null);break;case"notification":a=l.createElement(U,null);break;case"notification-off":a=l.createElement(z,null);break;case"notification-pause":a=l.createElement(B,null);break;case"numbers":a=l.createElement(me,null);break;case"pie-chart":a=Un;break;case"play":a=l.createElement(le,null);break;case"pivot-table":a=Qn;break;case"plus":a=l.createElement(H,null);break;case"question":a=l.createElement(S,null);break;case"report":a=l.createElement(te,null);break;case"search":a=l.createElement(ne,null);break;case"send":a=l.createElement(Q,null);break;case"settings":a=l.createElement(F,null);break;case"slack":a=l.createElement("img",{className:"slack-logo",src:Jn,alt:"Slack",style:ct(ct({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"split-view":a=Yn;break;case"single-view":a=Xn;break;case"table":a=Fn;break;case"title":a=l.createElement(E,null);break;case"trash":a=l.createElement(O,null);break;case"unlock":a=l.createElement(se,null);break;case"warning":a=l.createElement(ie,null);break;case"warning-triangle":a=l.createElement(P,null)}return l.createElement(At,null,l.createElement("span",vt({},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:ct({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),a,e.props.showBadge&&l.createElement("div",{className:"react-autoql-badge"})))})),e}return ht(n)}();yt(ea,"propTypes",{type:p.string.isRequired,size:p.number,showBadge:p.bool,color:p.string,warning:p.bool,danger:p.bool}),yt(ea,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var ta=function(t){try{var n=e(t,"data.data.parsed_interpretation");if(!n)return;var a=[];return e(n,"length")&&n.forEach((function(e){"FILTER"===e.c_type?na(e).forEach((function(e){a.push(e)})):a.push(e)})),a}catch(e){return void console.error(e)}},na=function(e){try{for(var t,n=/'(''|[^'])*'/g,a=e.eng,r=[];null!=(t=n.exec(a));)r.push(t);return r.length?function(e,t,n){var a=0,r=[];return t.forEach((function(o,i){if(o.index>a){var s=e.substring(a,o.index);r.push({c_type:"TEXT",eng:s})}var l=o[0].length+o.index,c=e.substring(o.index,l),u=ra(c);if(a=l,r.push({c_type:n,eng:u}),i===t.length-1&&l<e.length){var p=e.substring(l,e.length);r.push({c_type:"TEXT",eng:p})}})),r}(a,r,"VALUE_LABEL"):[aa(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}},aa=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}}},ra=function(e){return e.substring(1,e.length-1).replace("''","'")},oa=function(e){try{return e.join(".")}catch(e){return}},ia=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}},sa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.queryId,r=t.domain,o=t.apiKey,i=t.token;if(!n)return Promise.reject(new Error("No query supplied"));if(!r||!i||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(o,"&search=").concat(encodeURIComponent(n),"&scope=narrow&query_id=").concat(a),c={headers:{Authorization:"Bearer ".concat(i)}};return s.get(l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},la=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.userSelection,r=t.debug,o=t.test,i=t.domain,l=t.apiKey,c=t.token,u=t.source,p=t.filters,d="".concat(i,"/autoql/api/v1/query?key=").concat(l),m=ia(a),f={text:n,source:oa(u),translation:r?"include":"exclude",user_selection:m,test:o,session_filter_locks:p};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!l||!i||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var g={headers:{Authorization:"Bearer ".concat(c)}};return s.post(d,f,g).then((function(e){if(e.data&&"string"==typeof e.data)throw new Error("Parse error");var t=ta(e);return t&&(e.data.data.reverse_translation=t),Promise.resolve(e)})).catch((function(t){if(console.error(t),"Parse error"===t.message)return Promise.reject({error:"Parse error"});if(401===t.response||!e(t,"response.data"))return Promise.reject({error:"Unauthenticated"});if("1.1.430"===e(t,"response.data.reference_id")||"1.1.431"===e(t,"response.data.reference_id")){var a=e(t,"response.data.data.query_id");return sa({query:n,queryId:a,domain:i,apiKey:l,token:c})}return Promise.reject(e(t,"response"))}))},ca=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?la(t):pa({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):la(t)})).catch((function(e){return console.error(e),Promise.reject(e)}))},ua=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,a=t.domain,r=t.apiKey,o=t.token,i=t.csvProgressCallback;if(!o||!a||!r)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(r),c={headers:{Authorization:"Bearer ".concat(o)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return s.post(l,{},c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},pa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.text,a=t.domain,r=t.apiKey,o=t.token;if(!n)return Promise.reject(new Error("No text supplied"));if(!o||!a||!r)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/validate?text=").concat(encodeURIComponent(n),"&key=").concat(r),l={headers:{Authorization:"Bearer ".concat(o)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},da=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryID,a=t.groupBys,r=t.debug,o=t.test,i=t.domain,l=t.apiKey,c=t.token;if(!n)return Promise.reject(new Error("Query ID not supplied"));if(!c||!i||!l)return Promise.reject(new Error("Unauthenticated"));var u={translation:r?"include":"exclude",columns:a,test:o},p={headers:{Authorization:"Bearer ".concat(c)}},d="".concat(i,"/autoql/api/v1/query/").concat(n,"/drilldown?key=").concat(l);return s.post(d,u,p).then((function(e){var t=ta(e);return t&&(e.data.data.reverse_translation=t),Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ma=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,r=t.apiKey,o=t.token;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/autocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),l={headers:{Authorization:"Bearer ".concat(o)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},fa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,r=t.token,o=t.apiKey;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/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(o),l={headers:{Authorization:"Bearer ".concat(r)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ga=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.filters;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));if(null==o||!o.length)return Promise.reject(new Error("No filters provided"));var i="".concat(r,"/autoql/api/v1/query/filter-locking?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}},c={columns:o};return s.put(i,c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ha=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.columns,i="".concat(r,"/autoql/api/v1/query/column-visibility?key=").concat(n),l={columns:o};if(!a||!r||!n)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(a)}};return s.put(i,l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ya=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.keywords,a=t.pageSize,r=t.pageNumber,o=t.domain,i=t.apiKey,l=t.token,c=t.skipQueryValidation,u=n?n.split(" "):[],p="".concat(o,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(u),"&page_size=").concat(a,"&page=").concat(r);if(!l||!o||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(l)}};return c?s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):pa({text:n,domain:o,apiKey:i,token:l}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}))},va=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.message,a=t.queryId,r=t.domain,o=t.apiKey,i=t.token;if(!a)return Promise.reject(new Error("No query ID supplied"));if(!i||!r||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(r,"/autoql/api/v1/query/").concat(a,"?key=").concat(o),c={headers:{Authorization:"Bearer ".concat(i)}},u={is_correct:!1,message:n};return s.put(l,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ca=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"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)})),yt(Tt(e),"onMouseDown",(function(){fe.hide(),e.props.startListening()})),yt(Tt(e),"render",(function(){var t=e.props;t.transcript,t.interimTranscript,t.resetTranscript;var n=t.browserSupportsSpeechRecognition;t.startListening;var a=t.stopListening,r=t.listening;return n?l.createElement(At,null,l.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(r?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},l.createElement(ea,{type:"microphone"})),l.createElement(fe,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return ht(n)}();yt(Ca,"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}),yt(Ca,"defaultProps",{});var ba=_e({autoStart:!1,continuous:!1})(Ca);function Ea(){return l.createElement("div",{className:"response-loading","data-test":"loading-dots"},l.createElement("div",null),l.createElement("div",null),l.createElement("div",null),l.createElement("div",null))}var Sa=[],Ta=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"UNIQUE_ID",ve()),yt(Tt(t),"autoCompleteTimer",void 0),yt(Tt(t),"state",{inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1}),yt(Tt(t),"componentDidMount",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig)),t.props.inputValue!==e.inputValue&&t.setState({inputValue:t.props.inputValue})})),yt(Tt(t),"componentWillUnmount",(function(){t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer),t.queryValidationTimer&&clearTimeout(t.queryValidationTimer)})),yt(Tt(t),"animateInputTextAndSubmit",(function(n){var a=n.query,r=n.userSelection;n.skipQueryValidation;var o=n.source;if("string"==typeof a&&e(a,"length"))for(var i=function(e){setTimeout((function(){t.setState({inputValue:a.slice(0,e)}),e===a.length&&setTimeout((function(){t.submitQuery({queryText:a,userSelection:r,skipQueryValidation:!0,source:o})}),300)}),50*e)},s=1;s<=a.length;s++)i(s)})),yt(Tt(t),"submitQuery",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.queryText,a=e.userSelection,r=e.skipQueryValidation,o=e.source;t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer);var i={isQueryRunning:!0,suggestions:[],queryValidationResponse:void 0,queryValidationComponentId:ve()};t.props.clearQueryOnSubmit&&(i.inputValue=""),t.setState(i);var s=n||t.state.inputValue,l=[].concat(wt(t.props.source),[o||"user"]);s.trim()&&(t.props.onSubmit(s),r?la(ct(ct(ct({query:s,userSelection:a},Ot(t.props.authentication)),Qt(t.props.autoQLConfig)),{},{source:l,AutoAEId:t.props.AutoAEId,filters:t.props.queryFilters})).then((function(e){t.props.onResponseCallback(e,s),t.setState({isQueryRunning:!1})})).catch((function(e){console.error(e),t.props.onResponseCallback(e),t.setState({isQueryRunning:!1})})):ca(ct(ct(ct({query:s},Ot(t.props.authentication)),Qt(t.props.autoQLConfig)),{},{source:l,AutoAEId:t.props.AutoAEId,filters:t.props.queryFilters})).then((function(e){t.props.onResponseCallback(e,s),t.setState({isQueryRunning:!1})})).catch((function(e){var n=e||{error:"Unauthenticated"};t.props.onResponseCallback(n),t.setState({isQueryRunning:!1})})),t.setState({lastQuery:s,suggestions:[]}),localStorage.setItem("inputValue",s))})),yt(Tt(t),"onKeyDown",(function(n){"ArrowUp"!==n.key||e(t.state.suggestions,"length")||t.setState({inputValue:localStorage.getItem("inputValue")})})),yt(Tt(t),"onKeyPress",(function(e){"Enter"==e.key&&t.submitQuery()})),yt(Tt(t),"onTranscriptChange",(function(e){t.setState({inputValue:e})})),yt(Tt(t),"onFinalTranscript",(function(){t.focus()})),yt(Tt(t),"setInputRef",(function(e){t.inputRef=e})),yt(Tt(t),"focus",(function(){if(t.inputRef)t.inputRef.focus();else{var e=document.getElementsByClassName("".concat(t.UNIQUE_ID));e&&e[0]&&e[0].focus()}})),yt(Tt(t),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(t.userSelectedValue=e.name,t.userSelectedSuggestion=!0,t.setState({inputValue:e.name}))})),yt(Tt(t),"runQueryValidation",(function(n){var a=n.text;t.setState({queryValidationResponse:void 0,queryValidationComponentId:ve()}),t.queryValidationTimer&&clearTimeout(t.queryValidationTimer),t.queryValidationTimer=setTimeout((function(){pa(ct({text:a},Ot(t.props.authentication))).then((function(n){t.state.inputValue===e(n,"data.data.query")&&t.setState({queryValidationResponse:n,queryValidationComponentId:ve()})})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(t),"onSuggestionsFetchRequested",(function(n){var a=n.value;t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer),t.autoCompleteTimer=setTimeout((function(){ma(ct({suggestion:a},Ot(t.props.authentication))).then((function(n){var a,r=e(n,"data.data"),o=[];Sa=[],a=r.matches;for(var i=0;i<a.length&&(o.push(a[i]),4!==i);i++);o.sort((function(e,t){return t.length-e.length}));for(var s=0;s<o.length;s++){var l={name:o[s]};Sa.push(l)}t.setState({suggestions:Sa})})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(t),"onSuggestionsClearRequested",(function(){t.setState({suggestions:[]})})),yt(Tt(t),"onInputChange",(function(e){(!t.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(e&&e.target&&(e.target.value||""===e.target.value)?t.setState({inputValue:e.target.value}):t.submitQuery({queryText:t.userSelectedValue}),t.props.isBackButtonClicked&&t.setState({inputValue:""}))})),yt(Tt(t),"moveCaretAtEnd",(function(e){var t=e.target.value;e.target.value="",e.target.value=t})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-bar-container ".concat(t.props.className," ").concat("below"===t.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},l.createElement("div",{className:"react-autoql-chatbar-input-container"},Qt(t.props.autoQLConfig).enableAutocomplete?l.createElement(Ue,{lassName:"auto-complete-chata",onSuggestionsFetchRequested:t.onSuggestionsFetchRequested,onSuggestionsClearRequested:t.onSuggestionsClearRequested,getSuggestionValue:t.userSelectedSuggestionHandler,suggestions:t.state.suggestions,ref:function(e){t.autoSuggest=e},renderSuggestion:function(e){return l.createElement(c,null,e.name)},inputProps:{className:"".concat(t.UNIQUE_ID," react-autoql-chatbar-input").concat(t.props.showChataIcon?" left-padding":""),placeholder:t.props.placeholder||"Type your queries here",disabled:t.props.isDisabled,onChange:t.onInputChange,onKeyPress:t.onKeyPress,onKeyDown:t.onKeyDown,value:t.state.inputValue,onFocus:t.moveCaretAtEnd,autoFocus:!0}}):l.createElement("input",{className:"react-autoql-chatbar-input".concat(t.props.showChataIcon?" left-padding":""),placeholder:t.props.placeholder||"Type your queries here",value:t.state.inputValue,onChange:function(e){return t.setState({inputValue:e.target.value})},"data-test":"chat-bar-input",onKeyPress:t.onKeyPress,onKeyDown:t.onKeyDown,disabled:t.props.isDisabled,ref:t.setInputRef,onFocus:t.moveCaretAtEnd,autoFocus:!0})),t.props.showChataIcon&&l.createElement("div",{className:"chat-bar-input-icon"},l.createElement(ea,{type:"react-autoql-bubbles-outlined"})),t.props.showLoadingDots&&t.state.isQueryRunning&&l.createElement("div",{className:"input-response-loading-container"},l.createElement(Ea,null)),t.props.enableVoiceRecord&&l.createElement(ba,{onTranscriptChange:t.onTranscriptChange,onFinalTranscript:t.onFinalTranscript,themeConfig:t.props.themeConfig,authentication:Ot(t.props.authentication)})))})),t}return ht(a)}();yt(Ta,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,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({})),clearQueryOnSubmit:p.bool}),yt(Ta,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,onSubmit:function(){},onResponseCallback:function(){}});var Da=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.firstRender=!1,r.setTableHeaderValues=setTimeout((function(){r.setInitialHeaderFilters(),r.setFilterTags({isFilteringTable:!1})}),100)})),yt(Tt(r),"componentDidUpdate",(function(t,n){if(ge(Ht(r.props.themeConfig),Ht(t.themeConfig))||An(Ht(r.props.themeConfig)),r.ref&&(r.setDimensionsTimeout=setTimeout((function(){if(r._isMounted){var t=e(r.ref,"ref.offsetHeight");t&&(r.tableHeight=t)}}),0)),r.props.isResizing&&(r.isResizing=!0),!r.state.isFilteringTable&&n.isFilteringTable)try{r.setFilterTags({isFilteringTable:r.state.isFilteringTable})}catch(e){console.error(e),r.props.onErrorCallback(e)}})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.setTableHeaderValues),clearTimeout(r.setDimensionsTimeout),r.resetFilterTags(),r.existingFilterTag=void 0,r.filterTagElements=void 0})),yt(Tt(r),"setInitialHeaderFilters",(function(){e(r.props,"headerFilters.length")&&e(r.ref,"table")&&r.props.headerFilters.forEach((function(e){r.ref.table.setHeaderFilterValue(e.field,e.value)}))})),yt(Tt(r),"cellClick",(function(e,t){r.props.onCellClick(t)})),yt(Tt(r),"copyToClipboard",(function(){var e;r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table&&r.ref.table.copyToClipboard("active",!0)})),yt(Tt(r),"saveAsCSV",(function(){var e;return r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table?(r.ref.table.download("csv","export.csv",{delimiter:","}),Promise.resolve()):Promise.reject()})),yt(Tt(r),"resetFilterTags",(function(){r.filterTagElements.length&&r.filterTagElements.forEach((function(e){try{e.parentNode&&r._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),yt(Tt(r),"setFilterTags",(function(){var e,t;r.resetFilterTags(),r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table&&(t=r.ref.table.getHeaderFilters()),t&&t.forEach((function(e,t){try{var n=e.field;r.filterTagElements[n]=document.createElement("span"),r.filterTagElements[n].innerText="F",r.filterTagElements[n].setAttribute("class","filter-tag"),r.columnTitleEl=document.querySelector("#react-autoql-table-container-".concat(r.TABLE_ID,' .tabulator-col[tabulator-field="').concat(n,'"] .tabulator-col-title')),r.columnTitleEl.insertBefore(r.filterTagElements[n],r.columnTitleEl.firstChild)}catch(e){console.error(e),r.props.onErrorCallback(e)}}))})),yt(Tt(r),"toggleTableFilter",(function(e){var t=e.isFilteringTable;r.setState({isFilteringTable:t})})),yt(Tt(r),"getTableHeight",(function(){return r.tableHeight?"".concat(r.tableHeight,"px"):"".concat(e(r.props,"style.height"),"px")})),yt(Tt(r),"render",(function(){var e=r.getTableHeight();return l.createElement(At,null,l.createElement("div",{id:"react-autoql-table-container-".concat(r.TABLE_ID),ref:function(e){return r.tableContainer=e},"data-test":"react-autoql-table",className:"react-autoql-table-container \n ".concat(r.supportsDrilldown?"supports-drilldown":"","\n ").concat(r.state.isFilteringTable?" filtering":"","\n ").concat(r.props.isResizing?" resizing":""),style:ct(ct({},r.props.style),{},{flexBasis:e})},r.props.data&&r.props.columns&&l.createElement(Re,{ref:function(e){return r.ref=e},id:"react-autoql-table-".concat(r.TABLE_ID),columns:r.state.columns,data:r.props.data,cellClick:r.cellClick,options:r.tableOptions,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",clipboard:!0,download:!0})))})),r.TABLE_ID=ve(),r.firstRender=!0,r.ref=null,r.filterTagElements=[],r.supportsDrilldown=Kt(t.columns),r.tableOptions={layout:"fitDataStretch",textSize:"9px",movableColumns:!0,progressiveRender:!0,progressiveRenderSize:5,progressiveRenderMargin:100,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1},dataFiltered:function(e,n){if(r._isMounted&&r.ref&&!r.firstRender){var a=r.ref.table.getHeaderFilters();t.onFilterCallback(a,n)}},downloadReady:function(e,t){return t}},An(Ht(t.themeConfig)),r.state={columns:r.props.columns,isFilteringTable:!1},r}return ht(a)}();yt(Da,"propTypes",{themeConfig:Mt,data:p.arrayOf(p.array),columns:p.arrayOf(p.shape({})),onFilterCallback:p.func,isResizing:p.bool}),yt(Da,"defaultProps",{themeConfig:Pt,data:void 0,columns:void 0,isResizing:!1,onFilterCallback:function(){},onCellClick:function(){},onErrorCallback:function(){}});var xa={themeConfig:Mt,dataFormatting:Rt,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},wa={themeConfig:Pt,dataFormatting:qt,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},ka=ct(ct({},xa),{},{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}),Aa=ct(ct({},wa),{},{leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0}),Na=ct(ct({},ka),{},{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}),Ra=ct(ct({},Aa),{},{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}),Va=ct(ct({},ka),{},{xScale:p.func.isRequired,yScale:p.func.isRequired}),Ma={activeKey:void 0,onChartClick:function(){}},Ia=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||!ge(e.legendColumn,t.legendColumn)||!ge(e.columns,t.columns)||!ge(e.numberColumnIndices,t.numberColumnIndices)||!ge(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!ge(e.data,t.data)},qa=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)},La=function(e,t){return"".concat(e,"-").concat(t)},Pa=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)||!ge(e.numberColumnIndices,t.numberColumnIndices)||!ge(e.legendLabels,t.legendLabels)||e.stringColumnIndex!==t.stringColumnIndex)},Oa=function(e){var t=e.row,n=e.columns,a=e.colIndex,r=e.stringColumnIndex,o=e.legendColumn,i=e.dataFormatting;try{var s,l=n[r],c=n[a],u=l.title,p=c.origColumn?c.origColumn.title:c.title,d=ln({element:t[r],column:l,config:i}),m=ln({element:t[a]||0,column:n[a],config:i}),f=o?"<div><strong>".concat(o.title,":</strong> ").concat(null==n||null===(s=n[a])||void 0===s?void 0:s.title,"</div>"):"",g="<div><strong>".concat(u,":</strong> ").concat(d,"</div>"),h="<div><strong>".concat(p,":</strong> ").concat(m,"</div>");return"<div>\n ".concat(f,"\n ").concat(g,"\n ").concat(h,"\n </div>")}catch(e){return console.error(e),null}},Fa=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return 0}},Qa=function(e,t,n){var a={},r={};return e.forEach((function(e){var o=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?a[o]?a[o]+=i:a[o]=i:i<0&&(r[o]?r[o]-=i:r[o]=i)}))})),{maxValue:Ba(a),minValue:za(r)}},Ha=function(e){if("object"===pt(e))return Object.keys(e).length},Ba=function(e){var t=Ha(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=wt(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.max.apply(Math,wt(a))}return n},za=function(e){var t=Ha(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=wt(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.min.apply(Math,wt(a))}return n},Ua=function(e,t){try{var n=[],a=[];t.forEach((function(t,r){n.push(Ie(e,(function(e){return Fa(e[t])}))),a.push(qe(e,(function(e){return Fa(e[t])})))}));var r=Ie(n),o=qe(a);return r===o&&(o>0?o=0:r<0&&(r=0)),{minValue:o,maxValue:r}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},_a=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},ja=function(e,t,n){try{var a=Math.ceil(20*n.length/t);if(e<20){var r=[];return n.forEach((function(e,t){t%a==0&&r.push(e)})),r}}catch(e){console.error(e)}return n},Ka=function(e){Ct(n,l.Component);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"openSelector",(function(){a.setState({isOpen:!0})})),yt(Tt(a),"closeSelector",(function(){a.setState({isOpen:!1})})),yt(Tt(a),"renderSelectorContent",(function(){return l.createElement("div",{className:"axis-selector-container",id:"legend-selector-content",onClick:function(e){e.stopPropagation()}},l.createElement("ul",{className:"axis-selector-content"},a.props.stringColumnIndices.map((function(e,t){return l.createElement("li",{className:"string-select-list-item",key:ve(),onClick:function(){a.props.onChangeLegendColumnIndex(t),a.closeSelector()}},e.label)}))))})),yt(Tt(a),"render",(function(){return l.createElement(Ee,{isOpen:a.state.isOpen,content:a.renderSelectorContent(),onClickOutside:a.closeSelector,position:a.props.position,align:a.props.align},l.createElement("rect",vt({},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 ht(n)}();yt(Ka,"propTypes",Na),yt(Ka,"defaultProps",Ra);var Ga=function(t){Ct(a,u);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.renderAxis(),(r.props.hasRightLegend||r.props.hasBottomLegend)&&r.renderLegend(),r.props.onLabelChange()})),yt(Tt(r),"componentDidUpdate",(function(e){r.renderAxis(),!r.props.hasRightLegend&&!r.props.hasBottomLegend||ge(r.props.legendLabels,e.legendLabels)||r.renderLegend(),r.props.rotateLabels!==e.rotateLabels&&r.props.onLabelChange()})),yt(Tt(r),"componentWillUnmount",(function(){Mn(r.legendElement),Mn(r.legendSwatchElements),Mn(r.swatchElements)})),yt(Tt(r),"styleLegendTitleNoBorder",(function(e){e.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").attr("data-test","legend-title")})),yt(Tt(r),"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"),r.titleBBox={};try{r.titleBBox=t.select(".legendTitle").node().getBBox()}catch(e){}Me(r.legendBorder).attr("class","legend-title-border").attr("width",e(r.titleBBox,"width",0)+20).attr("height",e(r.titleBBox,"height",0)+10).attr("x",e(r.titleBBox,"x",0)-10).attr("y",e(r.titleBBox,"y",0)-10).attr("stroke","transparent").attr("stroke-width","1px").attr("fill","transparent").attr("rx",4),r.legendElement=Me(r.legendBorder).node(),r.legendElement.parentNode.appendChild(r.legendElement)})),yt(Tt(r),"renderLegend",(function(){try{var e=Tt(r),t=r.props.legendLabels;if(!t)return;var n=r.getLegendScale(t);if(r.props.hasRightLegend){r.legendSVG=Me(r.rightLegendElement),r.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");var a=Oe().shape("path",Fe().type(Qe).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})))}));r.props.legendTitle&&a.title(r.props.legendTitle).titleWidth(100),r.legendSVG.call(a).style("font-family","inherit"),r.props.legendTitle&&(r.props.onLegendTitleClick?r.styleLegendTitleWithBorder(r.legendSVG):r.styleLegendTitleNoBorder(r.legendSVG));var o=Me(r.rightLegendElement).node().getBBox().width;Me(r.legendClippingContainer).attr("width",o+30),r.legendSVG.attr("clip-path","url(#legend-clip-area-".concat(r.LEGEND_ID,")"))}else if(r.props.hasBottomLegend){r.legendSVG=Me(r.bottomLegendElement),r.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");a=Oe().shape("path",Fe().type(Qe).size(75)()).orient("horizontal").shapePadding(e.LEGEND_PADDING).labelWrap(120).labelAlign("left").scale(n).on("cellclick",(function(t){e.props.onLegendClick(t)}));r.legendSVG.call(a).style("font-family","inherit")}r.applyStylesForHiddenSeries(t)}catch(e){console.error(e)}})),yt(Tt(r),"applyStylesForHiddenSeries",(function(e){try{var t=e.filter((function(e){return e.hidden})).map((function(e){return e.label}));r.legendSwatchElements=document.querySelectorAll("#".concat(r.LEGEND_ID," .label")),r.legendSwatchElements&&r.legendSwatchElements.forEach((function(e,n){var a=[];e.querySelectorAll("tspan").forEach((function(e){a.push(e.textContent)}));var o=a.join(" ");r.swatchElements[n]=e.parentElement.querySelector(".swatch"),t.includes(o)?r.swatchElements[n].style.opacity=.3:r.swatchElements[n].style.opacity=1}))}catch(e){console.error(e)}})),yt(Tt(r),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return ke().domain(e.map((function(e){return e.label}))).range(t)})),yt(Tt(r),"renderAxis",(function(){var e=Tt(r),t="Bottom"===r.props.orient?Le():Pe();t.scale(r.props.scale).tickSizeOuter(0).tickFormat((function(t){return sn({d:t,col:e.props.col,config:e.props.dataFormatting}).formattedLabel})),r.props.ticks&&t.tickValues(r.props.ticks),r.props.showGridLines&&t.tickSizeInner(r.props.tickSizeInner),r.axisElement&&Me(r.axisElement).call(t),"Bottom"===r.props.orient&&r.props.rotateLabels?Me(r.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"!==r.props.orient||r.props.rotateLabels||Me(r.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"),Me(r.axisElement).selectAll(".axis text").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").attr("data-for","chart-element-tooltip").attr("data-tip",(function(t){var n=sn({d:t,col:e.props.col,config:e.props.dataFormatting}),a=n.fullWidthLabel;return n.isTruncated?a:null})).attr("data-effect","float"),Me(r.axisElement).selectAll(".axis path").style("display","none"),Me(r.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.15").style("shape-rendering","crispedges"),Me(r.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.4)})),yt(Tt(r),"render",(function(){var t,n=(null===(t=r.props.numberColumnIndices)||void 0===t?void 0:t.length)||0,a=r.LEGEND_PADDING*(n-1)/2,o=r.props.leftMargin||0;return l.createElement("g",{"data-test":"axis"},l.createElement("g",{className:"axis axis-".concat(r.props.orient,"\n ").concat(r.props.rotateLabels?" rotated":""),ref:function(e){r.axisElement=e},transform:r.props.translate}),r.props.hasRightLegend&&l.createElement("g",{ref:function(e){r.rightLegendElement=e},id:r.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(r.props.width+15,", ").concat(r.props.legendTitle?"30":"25",")")},l.createElement("clipPath",{id:"legend-clip-area-".concat(r.LEGEND_ID)},l.createElement("rect",{ref:function(e){r.legendClippingContainer=e},id:"legend-bounding-box-".concat(r.LEGEND_ID),height:r.props.height-r.props.topMargin-(r.props.rotateLabels?44:r.props.bottomMargin)+20,width:r.props.rightMargin+30,style:{transform:"translate(-30px, -30px)"}})),r.props.legendColumn&&l.createElement(Ka,vt({},r.props,{column:r.props.legendColumn,position:"bottom",align:"end",childProps:{ref:function(e){return r.legendBorder=e},x:e(r.titleBBox,"x",0)-10,y:e(r.titleBBox,"y",0)-10,width:e(r.titleBBox,"width",0)+20,height:e(r.titleBBox,"height",0)+10}}))),r.props.hasBottomLegend&&l.createElement("g",{ref:function(e){r.bottomLegendElement=e},"data-test":"bottom-legend",id:r.LEGEND_ID,className:"legendOrdinal",transform:"translate(".concat((r.props.width-o)/2+o-a,",").concat(r.props.height-30,")")}))})),r.LEGEND_PADDING=130,r.LEGEND_ID="axis-".concat(ve()),r.swatchElements=[],r}return ht(a)}();yt(Ga,"propTypes",ct(ct({},Na),{},{scale:p.func.isRequired,col:p.shape({}).isRequired,ticks:p.array,orient:p.string,tickSizeInner:p.number,translate:p.string})),yt(Ga,"defaultProps",ct(ct({},Ra),{},{orient:"Bottom",ticks:void 0,tickSizeInner:void 0,translate:void 0}));var Wa=["label","type","indeterminate","hasError","style","onChange","checked"],Ya=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),yt(Tt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),yt(Tt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),yt(Tt(e),"render",(function(){var t=e.props,n=t.label,a=t.type;t.indeterminate;var r=t.hasError;t.style,t.onChange,t.checked;var o=St(t,Wa),i="\n react-autoql-checkbox\n ".concat("switch"===a&&"react-autoql-checkbox--switch","\n ").concat(r&&"react-autoql-checkbox--has-error","\n "),s="\n react-autoql-checkbox__input\n ".concat("switch"===a?"react-autoql-checkbox--switch__input":"","\n ").concat(r?"react-autoql-checkbox--has-error__input":"","\n ");return l.createElement(At,null,l.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox",style:e.props.style},l.createElement("div",{className:i},l.createElement("input",vt({},o,{type:"checkbox",className:s,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&l.createElement("div",{className:"react-autoql-checkbox-tick"},l.createElement(ea,{type:"check"})),n&&l.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return ht(n)}();yt(Ya,"propTypes",{hasError:p.bool,indeterminate:p.bool,label:p.string,type:p.oneOf(["default","switch"]),checked:p.bool,onChange:p.func}),yt(Ya,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Xa=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",{selected:[]}),yt(Tt(t),"unselectAll",(function(){t.setState({selected:[]})})),yt(Tt(t),"interpolateArray",(function(e,t){for(var n=Math.min(e,t),a=Math.max(e,t),r=[],o=n;o<=a;o++)r.push(o);return r})),yt(Tt(t),"handleShiftSelect",(function(e){if(t.state.selected.length){var n=Math.min.apply(Math,wt(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]})})),yt(Tt(t),"handleCtrlSelect",(function(e){var n=[];n=t.state.selected.includes(e)?t.state.selected.filter((function(t){return t!==e})):[].concat(wt(t.state.selected),[e]),t.props.onSelect(n),t.setState({selected:n})})),yt(Tt(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)})),yt(Tt(t),"render",(function(){var n=he(t.props.items);return l.createElement(At,null,l.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list",onClick:function(e){e.stopPropagation()}},!!e(t.props.columns,"length")&&l.createElement("div",{className:"col-visibility-header"},t.props.columns.map((function(e,a){if(a===t.props.columns.length-1){var r=n.every((function(e){return e.checked}));return l.createElement("div",{key:"list-header-".concat(ve())},e.name,l.createElement(Ya,{themeConfig:Ht(t.props.themeConfig),checked:r,style:{marginLeft:"10px"},onChange:function(){r?n.forEach((function(e){e.checked=!1})):n.forEach((function(e){e.checked=!0})),t.props.onChange(n)}}))}return l.createElement("div",{key:"list-header-".concat(ve())},e.name)}))),n.map((function(e,a){return l.createElement("div",{key:"list-item-".concat(ve()),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]}))}},l.createElement("div",null,e.content," "),l.createElement("div",null,l.createElement(Ya,{themeConfig:Ht(t.props.themeConfig),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 ht(a)}();function Ja(e){return l.createElement(At,null,l.createElement("div",vt({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}yt(Xa,"propTypes",{themeConfig:Mt,columns:p.arrayOf(p.shape({})),items:p.arrayOf(p.shape({}))}),yt(Xa,"defaultProps",{themeConfig:Pt,onChange:function(){},onSelect:function(){},columns:[],items:[]});var Za=["default","primary","danger"],$a=["small","large"],er=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY","react-autoql-btn-".concat(ve())),yt(Tt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Za.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),yt(Tt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if($a.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),yt(Tt(e),"render",(function(){var t=e.getType(),n=e.getSize(),a=e.props.loading||e.props.disabled;return l.createElement(At,null,l.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:ct({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.COMPONENT_KEY},e.props.loading&&l.createElement(Ja,{"data-test":"react-autoql-btn-loading"}),e.props.children),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:e.COMPONENT_KEY,effect:"solid",delayShow:500,place:"top"}))})),e}return ht(n)}();yt(er,"propTypes",{type:p.oneOf(Za),size:p.oneOf($a),onClick:p.func,loading:p.bool,disabled:p.bool,multiline:p.bool,tooltip:p.string}),yt(er,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var tr=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidUpdate",(function(e){Ia(r.props,e)&&r.setState(ct({},r.getSelectorState(r.props)))})),yt(Tt(r),"openSelector",(function(){r.setState({isOpen:!0})})),yt(Tt(r),"closeSelector",(function(){r.setState({isOpen:!1})})),yt(Tt(r),"getSelectorState",(function(t){var n=t.columns,a=t.numberColumnIndices;if(n&&a){var r=[],o=[],i=[];return n.forEach((function(e,t){if(e.is_visible){var n={content:e.title,checked:a.includes(t),columnIndex:t};"DOLLAR_AMT"===e.type?r.push(n):"QUANTITY"===e.type?o.push(n):"RATIO"!==e.type&&"PERCENT"!==e.type||i.push(n)}})),{activeNumberType:e(n,"[".concat(a[0],"].type")),currencySelectorState:r,quantitySelectorState:o,ratioSelectorState:i}}})),yt(Tt(r),"renderSelectorContent",(function(e){var t=r.state,n=t.currencySelectorState,a=t.quantitySelectorState,o=t.ratioSelectorState;return l.createElement("div",{id:"chata-chart-popover",onClick:function(e){e.stopPropagation()}},l.createElement("div",{className:"axis-selector-container"},!!n.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"},r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Currency"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.currencySelectRef=e},items:n,onSelect:function(){r.quantitySelectRef&&r.quantitySelectRef.unselectAll(),r.ratioSelectRef&&r.ratioSelectRef.unselectAll()},onChange:function(e){var t=a.map((function(e){return ct(ct({},e),{},{checked:!1})})),n=o.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"DOLLAR_AMT",currencySelectorState:e,quantitySelectorState:t,ratioSelectorState:n})}})),!!a.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"}," ",r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Quantity"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.quantitySelectRef=e},items:a,onSelect:function(){r.currencySelectRef&&r.currencySelectRef.unselectAll(),r.ratioSelectRef&&r.ratioSelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return ct(ct({},e),{},{checked:!1})})),a=o.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"QUANTITY",quantitySelectorState:e,currencySelectorState:t,ratioSelectorState:a})}})),!!o.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"}," ",r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Ratio"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.ratioSelectRef=e},items:o,onSelect:function(){r.currencySelectRef&&r.currencySelectRef.unselectAll(),r.quantitySelectRef&&r.quantitySelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return ct(ct({},e),{},{checked:!1})})),o=a.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"RATIO",ratioSelectorState:e,currencySelectorState:t,quantitySelectorState:o})}}))),l.createElement("div",{className:"axis-selector-apply-btn"},l.createElement(er,{style:{width:"calc(100% - 10px)"},type:"primary",disabled:r.state.ratioSelectorState.every((function(e){return!e.checked}))&&r.state.currencySelectorState.every((function(e){return!e.checked}))&&r.state.quantitySelectorState.every((function(e){return!e.checked})),onClick:function(){var e=[];if("DOLLAR_AMT"===r.state.activeNumberType?e=r.state.currencySelectorState:"QUANTITY"===r.state.activeNumberType?e=r.state.quantitySelectorState:"RATIO"===r.state.activeNumberType&&(e=r.state.ratioSelectorState),e.length){r.closeSelector();var t=e.filter((function(e){return e.checked})).map((function(e){return e.columnIndex}));r.props.changeNumberColumnIndices(t)}}},"Apply")))})),yt(Tt(r),"render",(function(){return l.createElement(Ee,{isOpen:r.state.isOpen,content:r.renderSelectorContent(),onClickOutside:r.closeSelector,position:r.props.position,align:r.props.align},l.createElement("rect",vt({},r.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),r.currencySelectRef,r.quantitySelectRef,r.ratioSelectRef,r.state=ct(ct({},r.getSelectorState(t)),{},{isOpen:!1}),r}return ht(a)}();yt(tr,"propTypes",Na),yt(tr,"defaultProps",Ra);var nr=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"openSelector",(function(){r.setState({isOpen:!0})})),yt(Tt(r),"closeSelector",(function(){r.setState({isOpen:!1})})),yt(Tt(r),"renderSelectorContent",(function(){return l.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},l.createElement("ul",{className:"axis-selector-content"},r.props.stringColumnIndices.map((function(t,n){return l.createElement("li",{className:"string-select-list-item ".concat(t===r.props.stringColumnIndex?"active":""),key:ve(),onClick:function(){r.closeSelector(),r.props.changeStringColumnIndex(t)}},e(r.props.columns,"[".concat(t,"].title")))}))))})),yt(Tt(r),"render",(function(){return l.createElement(Ee,{isOpen:r.state.isOpen,content:r.renderSelectorContent(),onClickOutside:r.closeSelector,position:r.props.position,align:r.props.align},l.createElement("rect",vt({},r.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),r.state={isOpen:!1},r}return ht(a)}();yt(nr,"propTypes",Na),yt(nr,"defaultProps",Ra);var ar=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"render",(function(){return Gt(e.props.column)?l.createElement(tr,vt({"data-test":"number-axis-selector"},e.props)):Wt(e.props.column)?l.createElement(nr,vt({"data-test":"string-axis-selector"},e.props)):null})),e}return ht(n)}();yt(ar,"propTypes",Na),yt(ar,"defaultProps",Ra);var rr=function(e){Ct(n,l.Component);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(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?l.createElement("tspan",{"data-tip":e,"data-for":"chart-element-tooltip","data-test":"axis-label"},"".concat(e.substring(0,35),"...")):l.createElement("tspan",{"data-test":"axis-label"},e,t&&l.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),yt(Tt(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,r=un(a.xLabelRef),o=r?r.width:0,i=r?r.height:0;return l.createElement("g",null,l.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&&l.createElement(ar,vt({},a.props,{column:a.props.xCol,position:"top",align:"end",childProps:{x:t-o/2-10,y:n-16,width:o+20,height:i+10}})))})),yt(Tt(a),"renderYAxisLabel",(function(e){var t=-(a.props.height-a.props.bottomMargin)/2,n=un(a.yLabelRef),r=n?n.width:0,o=n?n.height:0;return l.createElement("g",null,l.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&&l.createElement(ar,vt({},a.props,{column:a.props.yCol,position:"right",align:"center",childProps:{x:t-r/2-10,y:4,width:r+20,height:o+10,transform:"rotate(-90)"}})))})),yt(Tt(a),"renderXAxis",(function(e){return l.createElement(Ga,vt({},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}))})),yt(Tt(a),"renderYAxis",(function(e){return l.createElement(Ga,vt({},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}))})),yt(Tt(a),"render",(function(){if(!(a.props.yScale&&a.props.xScale&&a.props.height&&a.props.width))return null;var e=a.props.xAxisTitle||a.props.xCol.display_name,t=a.props.yAxisTitle||a.props.yCol.display_name;return l.createElement("g",null,a.renderYAxisLabel(t),a.renderXAxisLabel(e),l.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},a.renderXAxis(e),a.renderYAxis(t)))})),a.xAxisKey=ve(),a.yAxisKey=ve(),a.labelInlineStyles={fontSize:12,fontFamily:"inherit",fill:"currentColor",fillOpacity:.7,cursor:"default"},a}return ht(n)}();yt(rr,"propTypes",Na),yt(rr,"defaultProps",Ra);var or=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.xScale,c=t.yScale,u=r.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=s.bandwidth()/u.length,m=0;return r.forEach((function(t,r){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=f<0?qa(c):c(f),h=Math.abs(c(f)-qa(c));if((isNaN(h)||isNaN(f))&&(g=qa(c),h=0),h<.05)return null;var y=s(u[o])+m*d,v=Oa({row:u,columns:n,colIndex:t,stringColumnIndex:o,legendColumn:a,dataFormatting:i}),C=La(t,p);return l.createElement("rect",{key:C,className:"bar".concat(e.state.activeKey===C?" active":""),"data-test":"bar-".concat(r,"-").concat(p),x:y,y:g,height:h,width:d,onClick:function(){return e.onColumnClick(u,t,p)},"data-tip":v,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(r),fillOpacity:.7}})}))),m+=1)})),l.createElement("g",{"data-test":"columns"},p)})),e}return ht(n)}();yt(or,"propTypes",Va),yt(or,"defaultProps",Ma);var ir=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Ua(e.data,n),o=r.minValue,i=r.maxValue;a.xScale=Ae().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=Ne().domain([o,i]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=kn(a.xScale,e.innerPadding),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-column-chart"},l.createElement(rr,vt({},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&&l.createElement(or,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(ir,"propTypes",ka),yt(ir,"defaultProps",Aa);var sr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onBarClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale,u=r.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=s.bandwidth()/u.length,m=0;return r.forEach((function(t,r){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)-qa(c));if(Number.isNaN(g)&&(g=0),g<.05)return null;var h=s(u[o])+m*d,y=Oa({row:u,columns:n,colIndex:t,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(t,p),className:"bar".concat(e.state.activeKey===La(t,p)?" active":""),"data-test":"bar-".concat(r,"-").concat(p),y:h,x:f>0?qa(c):c(f),width:g,height:d,onClick:function(){return e.onBarClick(u,t,p)},"data-tip":y,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(r),fillOpacity:.7}})}))),m+=1)})),l.createElement("g",{"data-test":"bars"},p)})),e}return ht(n)}();yt(sr,"propTypes",Va),yt(sr,"defaultProps",Ma);var lr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=wn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xLabelArray,e.columns[e.numberColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Ua(e.data,n),o=r.minValue,i=r.maxValue;a.xScale=Ne().domain([o,i]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ae().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=ja(a.barHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-bar-chart"},l.createElement(rr,vt({},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&&l.createElement(sr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(lr,"propTypes",ka),yt(lr,"defaultProps",Aa);var cr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onDotClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"makePolyline",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,r=t.stringColumnIndex,o=t.yScale,i=t.xScale,s=[];return a.forEach((function(t,a){var c=[];n[t].isSeriesHidden||e.props.data.forEach((function(n,a){var s=n[t],l=e.props.data[a-1],u=e.props.data[a+1];if(!(!(0===a||a===e.props.data.length-1)&&Math.abs(o(s)-o(null==l?void 0:l[t]))<.05&&Math.abs(o(null==l?void 0:l[t])-o(null==u?void 0:u[t]))<.05)){var p=i.bandwidth()/2,d=o.domain()[0],m=[i(n[r])+p,o(s||d)];c.push(m)}}));var u=c.map((function(e){return e.join(",")})).join(" "),p=l.createElement("polyline",{key:"line-".concat(La(0,a)),className:"line",points:u,fill:"none",stroke:e.props.colorScale(a),strokeWidth:1,opacity:.7});s.push(p)})),s})),yt(Tt(e),"makeDots",(function(t){var n=e.props,a=n.columns,r=n.legendColumn,o=n.numberColumnIndices,i=n.stringColumnIndex,s=n.dataFormatting,c=n.yScale,u=n.xScale,p=[];return o.forEach((function(t,n){a[t].isSeriesHidden||e.props.data.forEach((function(o,d){var m=o[t];if(m){var f=c(m);if(!(f<.05)){var g=u.bandwidth()/2,h=Oa({row:o,columns:a,colIndex:t,stringColumnIndex:i,legendColumn:r,dataFormatting:s});p.push(l.createElement("circle",{key:La(t,d),className:"line-dot".concat(e.state.activeKey===La(t,d)?" active":""),cy:f,cx:u(o[i])+g,r:3,onClick:function(){return e.onDotClick(o,t,d)},"data-tip":h,"data-for":"chart-element-tooltip",style:{cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:2,strokeOpacity:.7,fillOpacity:1,opacity:0,fill:e.state.activeKey===La(t,d)?e.props.colorScale(n):e.props.backgroundColor||"#fff"}}))}}}))})),p})),yt(Tt(e),"render",(function(){var t=e.props.numberColumnIndices.filter((function(t){return!e.props.columns[t].isSeriesHidden})).length;return t?l.createElement("g",{"data-test":"line"},e.makePolyline(),e.makeDots(t)):null})),e}return ht(n)}();yt(cr,"propTypes",Va),yt(cr,"defaultProps",Ma);var ur=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n,r,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices);var i=Ua(e.data,o),s=i.minValue,l=i.maxValue;a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Ne().domain([s,l]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(r=n.domain())||void 0===r?void 0:r.length)||1),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-line-chart"},l.createElement(rr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[0],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&&l.createElement(cr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(ur,"propTypes",ka),yt(ur,"defaultProps",Aa);var pr=function(t){Ct(a,u);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.renderPie()})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){return!r.props.isResizing||!e.isResizing})),yt(Tt(r),"componentDidUpdate",(function(){r.renderPie()})),yt(Tt(r),"componentWillUnmount",(function(){Mn(r.legend),Mn(r.pieChartContainer)})),yt(Tt(r),"renderPie",(function(){Mn(r.pieChartContainer);var e=Tt(r);r.setPieRadius(),r.outerArc=He().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=Be().value((function(t,n){return t.value[e.props.numberColumnIndex]}));r.dataReady=t(ze(e.sortedData.filter((function(e,t){var n,a;return!(null!==(n=r.state.legendLabels)&&void 0!==n&&null!==(a=n[t])&&void 0!==a&&a.hidden)})))),r.renderPieContainer(),r.renderPieSlices(),r.renderLegend(),r.centerVisualization()})),yt(Tt(r),"renderPieContainer",(function(){var e=r.props,t=e.width,n=e.height;r.pieChartContainer=Me(r.chartElement).append("svg").attr("width",t).attr("height",n).append("g").attr("class","slices").attr("transform","translate(".concat(t/2+r.outerRadius,",").concat(n/2,")"))})),yt(Tt(r),"onSliceClick",(function(e){var t=e.data.key;t===r.state.activeKey?r.setState({activeKey:null}):(r.props.onChartClick(e.data.value,r.props.numberColumnIndex,r.props.columns,r.props.stringColumnIndex,r.props.legendColumn,r.props.numberColumnIndex,t),r.setState({activeKey:t}))})),yt(Tt(r),"renderPieSlices",(function(){var e=Tt(r);r.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",He().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for","chart-element-tooltip").attr("data-tip",(function(t){return Oa({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",r.props.backgroundColor).on("mouseover",(function(e){Me(this).style("fill-opacity",1)})).on("mouseout",(function(e){Me(this).style("fill-opacity",.85)})).on("click",r.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){Me(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)+")"}}))}))})),yt(Tt(r),"centerVisualization",(function(){var t,n=Me("#pie-chart-container-".concat(r.CHART_ID)).node();n&&(t=n.getBBox());var a=e(t,"width",0),o=e(t,"x",0),i=(r.props.width-a)/2-o;Me("#pie-chart-container-".concat(r.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),yt(Tt(r),"onLegendClick",(function(e){var t,n=JSON.parse(e),a=null==n?void 0:n.dataIndex;if(null!==(t=r.state.legendLabels)&&void 0!==t&&t[a]){var o=he(r.state.legendLabels);o[a].hidden=!r.state.legendLabels[a].hidden,r.setState({legendLabels:o})}fe.rebuild()})),yt(Tt(r),"renderLegend",(function(){var t,n=Tt(r),a=r.props.height,o=Ht(r.props.themeConfig).chartColors;if(r.state.legendLabels){t=ke().domain(r.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(o);var i=r.props.width/2-70;r.legend=Me(r.legendElement),r.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 s,l=Oe().shape("path",Fe().type(Qe).size(75)()).orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).scale(t).on("cellclick",r.onLegendClick);r.legend.select(".legendOrdinal").call(l);var c=r.legend.select(".legendOrdinal").node();c&&(s=c.getBBox());var u=e(s,"height",0),p=e(s,"width",0),d=r.props.width/2-p-20,m=u<a-20?(a-u)/2:15;r.legend.select(".legendOrdinal").attr("transform","translate(".concat(d,", ").concat(m,")")),r.applyStylesForHiddenSeries()}})),yt(Tt(r),"applyStylesForHiddenSeries",(function(){var e=r.state.legendLabels.filter((function(e){return e.hidden})).map((function(e){return e.label}));r.legendSwatchElements=document.querySelectorAll("#".concat(r.LEGEND_ID," .label tspan")),r.legendSwatchElements&&r.legendSwatchElements.forEach((function(t){var n=t.parentElement.parentElement.querySelector(".swatch");n.style.strokeWidth="2px",e.includes(t.textContent)?n.style.opacity=.3:n.style.opacity=1}))})),yt(Tt(r),"setPieRadius",(function(){var e,t=r.props,n=t.width,a=t.height,o=t.margin;e=n<a?n/2-o:2*a<n?a-o:n/2-o,r.outerRadius=e/2,r.innerRadius=r.outerRadius-50>15?r.outerRadius-50:0})),yt(Tt(r),"render",(function(){return l.createElement("g",{id:"pie-chart-container-".concat(r.CHART_ID),"data-test":"react-autoql-pie-chart"},l.createElement("svg",{className:"pie-chart",ref:function(e){r.chartElement=e},width:r.props.width,height:r.props.height}),l.createElement("g",{ref:function(e){r.legendElement=e},id:r.LEGEND_ID,className:"legendOrdinal"}))})),r.CHART_ID=ve(),r.LEGEND_ID="react-autoql-pie-legend-".concat(ve()),r.sortedData=t.data.concat().sort((function(e,n){var a=e[t.numberColumnIndex]||0,r=n[t.numberColumnIndex]||0;return parseFloat(r)-parseFloat(a)}));var o=Ht(t.themeConfig).chartColors;r.colorScale=ke().domain(r.sortedData.map((function(e){return e[t.stringColumnIndex]}))).range(o);var i=r.sortedData.map((function(n,a){var r,o;return{label:"".concat(ln({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(r=t.columns)||void 0===r?void 0:r[t.stringColumnIndex]}),": ").concat(ln({element:n[t.numberColumnIndex]||0,column:e(t,"columns[".concat(t.numberColumnIndex,"]")),config:null===(o=t.columns)||void 0===o?void 0:o[t.dataFormatting]})).trim(),hidden:!1,dataIndex:a}}));return r.state={activeKey:r.props.activeChartElementKey,legendLabels:i},r}return ht(a)}();yt(pr,"propTypes",ct(ct({},ka),{},{backgroundColor:p.string,margin:p.number})),yt(pr,"defaultProps",ct(ct({},Aa),{},{backgroundColor:"transparent",margin:40}));var dr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;ft(this,n),yt(Tt(a=t.call(this,e)),"onSquareClick",(function(e,t,n){var r=La(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,r),a.setState({activeKey:r})})),yt(Tt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,r=e.numberColumnIndices,o=e.stringColumnIndex,i=e.dataFormatting,s=e.legendLabels,c=e.colorScale,u=e.yScale,p=e.xScale;if(!r.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){r.forEach((function(r,f){if(!t[r].isSeriesHidden){var g=e[r],h=Number(g),y=Number.isNaN(h)?0:h,v=e[o],C=s[f].label,b=y>=0?c(0):"rgba(221, 106, 106)",E=c(1),S=Oa({row:e,columns:t,colIndex:r,stringColumnIndex:o,legendColumn:n,dataFormatting:i});d.push(l.createElement("rect",{key:La(r,m),"data-test":"squares",className:"square".concat(a.state.activeKey===La(r,m)?" active":""),x:p(v),y:u(C),width:p.bandwidth(),height:u.bandwidth(),onClick:function(){return a.onSquareClick(e,r,m)},"data-tip":S,"data-for":"chart-element-tooltip",stroke:E,strokeWidth:"2px",strokeOpacity:a.state.activeKey===La(r,m)?1:0,fill:a.state.activeKey===La(r,m)?E:b,fillOpacity:a.state.activeKey===La(r,m)?1:a.opacityScale(Math.abs(y))}))}}))})),l.createElement("g",null,d)}));var r=Ie(e.data.map((function(t){return Ie(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),o=qe(e.data.map((function(t){return qe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.opacityScale=Ne().domain([o,r]).range([0,1]),a.state={activeKey:a.props.activeChartElementKey},a}return ht(n)}();yt(dr,"propTypes",Va),yt(dr,"defaultProps",Ma);var mr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.squareHeight=e.height/a.yLabelArray.length,a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin+10,e.width-e.rightMargin]).paddingInner(.01),a.yScale=Ae().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(.01),a.xTickValues=ja(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=ja(a.squareHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-heatmap-chart",className:"react-autoql-heatmap-chart"},l.createElement(rr,vt({},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&&l.createElement(dr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(mr,"propTypes",ka),yt(mr,"defaultProps",Aa);var fr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;ft(this,n),yt(Tt(a=t.call(this,e)),"state",{activeKey:a.props.activeChartElementKey}),yt(Tt(a),"onCircleClick",(function(e,t,n){var r=La(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,r),a.setState({activeKey:r})})),yt(Tt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,r=e.numberColumnIndices,o=e.stringColumnIndex,i=e.dataFormatting,s=e.legendLabels,c=e.colorScale,u=e.yScale,p=e.xScale;if(!r.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){r.forEach((function(r,f){if(!t[r].isSeriesHidden){var g=e[r],h=Number(g),y=Number.isNaN(h)?0:h,v=e[o],C=s[f].label,b=Oa({row:e,columns:t,colIndex:r,stringColumnIndex:o,legendColumn:n,dataFormatting:i});d.push(l.createElement("circle",{key:La(r,m),"data-test":"circles",className:"circle".concat(a.state.activeKey===La(r,m)?" active":""),cx:p(v)+p.bandwidth()/2,cy:u(C)+u.bandwidth()/2,r:y<0?0:a.radiusScale(y)/2,onClick:function(){return a.onCircleClick(e,r,m)},"data-tip":b,"data-for":"chart-element-tooltip",style:{stroke:"transparent",strokeWidth:10,fill:a.state.activeKey===La(r,m)?c(1):c(0),fillOpacity:.7}}))}}))})),l.createElement("g",null,d)}));var r=Ie(e.data.map((function(t){return Ie(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),o=qe(e.data.map((function(t){return qe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.radiusScale=Ne().domain([o,r]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),a}return ht(n)}();yt(fr,"propTypes",Va),yt(fr,"defaultProps",Ma);var gr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.circleHeight=e.height/a.yLabelArray.length,a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingOuter(.5),a.yScale=Ae().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]),a.xTickValues=ja(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=ja(a.circleHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{className:"react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},l.createElement(rr,vt({},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})),l.createElement(fr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(gr,"propTypes",ka),yt(gr,"defaultProps",Aa);var hr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale;if(!r.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 r.map((function(r,m){if(!n[r].isSeriesHidden){var f,g,h=t[r],y=Number(h),v=Number.isNaN(y)?0:y;if(!v)return null;if(v>=0){var C=p+v;g=Math.abs(c(v)-c(0)-.5),f=c(p),p=C}else{var b=d+v;g=Math.abs(c(Math.abs(v))-c(0)-.5),f=c(b),d=b}if(g<.05)return null;var E=Oa({row:t,columns:n,colIndex:r,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(r,u),className:"column".concat(e.state.activeKey===La(r,u)?" active":""),x:f,y:s(t[o]),width:g,height:s.bandwidth(),onClick:function(){return e.onColumnClick(t,r,u)},"data-tip":E,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return l.createElement("g",{"data-test":"stacked-bars"},u)})),e}return ht(n)}();yt(hr,"propTypes",Va),yt(hr,"defaultProps",Ma);var yr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=wn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xLabelArray,e.columns[e.numberColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Qa(e.data,e.stringColumnIndex,n),o=r.maxValue,i=r.minValue;a.xScale=Ne().domain([i,o]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ae().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=ja(a.barHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-bar-chart"},l.createElement(rr,vt({},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&&l.createElement(hr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(yr,"propTypes",ka),yt(yr,"defaultProps",Aa);var vr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale;if(!r.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 r.map((function(r,m){if(!n[r].isSeriesHidden){var f,g,h=t[r],y=Number(h),v=Number.isNaN(y)?0:y;if(!v)return null;if(v>=0){var C=p+v;g=Math.abs(s(v)-s(0))-.5,f=s(C)+.5,p=C}else{var b=d+v;g=Math.abs(s(v)-s(0))-.5,f=s(d)+.5,d=b}if(g<.05)return null;var E=Oa({row:t,columns:n,colIndex:r,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(r,u),className:"bar".concat(e.state.activeKey===La(r,u)?" active":""),x:c(t[o]),y:f,width:c.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,r,u)},"data-tip":E,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return l.createElement("g",{"data-test":"stacked-columns"},u)})),e}return ht(n)}();yt(vr,"propTypes",Va),yt(vr,"defaultProps",Ma);var Cr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Qa(e.data,e.stringColumnIndex,n),o=r.maxValue,i=r.minValue;a.xScale=Ae().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=Ne().domain([i,o]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=kn(a.xScale,e.innerPadding),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-column-chart"},l.createElement(rr,vt({},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&&l.createElement(vr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(Cr,"propTypes",ka),yt(Cr,"defaultProps",Aa);var br=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onDotClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"createPolygonVertexDot",(function(t,n,a,r,o,i){var s=Oa({row:t,columns:e.props.columns,colIndex:o,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return l.createElement("circle",{key:"dot-".concat(La(o,i)),className:"vertex-dot".concat(e.state.activeKey===La(o,i)?" active":""),cy:r,cx:a,r:4,onClick:function(){return e.onDotClick(t,o,n)},"data-tip":s,"data-for":"chart-element-tooltip",style:{opacity:e.state.activeKey===La(o,i)?1:0,cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),yt(Tt(e),"createPolygon",(function(t,n){var a=e.props.stringColumnIndex,r=n.map((function(e){return e.join(",")})).join(" ");return l.createElement("polygon",{key:"polygon-".concat(La(a,t)),points:r,"data-tip":"\n <div>\n <strong>".concat(e.props.legendTitle,"</strong>: ").concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":"chart-element-tooltip","data-effect":"float",style:{fill:e.props.colorScale(t),fillOpacity:1}})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,r=t.stringColumnIndex,o=t.yScale,i=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var s=[],c=[],u=o.domain()[0];u<0&&(u=0);var p=[],d=[];return i.domain().forEach((function(e){p.push(u),d.push([i(e),o(u)])})),a.forEach((function(t,a){var l=[],u=[];if(!n[t].isSeriesHidden){e.props.data.forEach((function(n,s){var d=n[t],m=Number(d),f=isNaN(m)?0:m,g=i(n[r]),h=p[s]+f,y=o(h);if(l[s]=h,u.push([g,y]),0!==f){var v=e.createPolygonVertexDot(n,a,g,y,t,s);c.push(v)}}));var m=d.reverse().concat(u);s.push(e.createPolygon(a,m)),p=l,d=u}})),l.createElement("g",{"data-test":"stacked-lines"},s,c)})),e}return ht(n)}();yt(br,"propTypes",Va),yt(br,"defaultProps",Ma);var Er=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n,r,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices);var i=Qa(e.data,e.stringColumnIndex,o),s=i.maxValue,l=i.minValue;a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Ne().domain([l,s]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(r=n.domain())||void 0===r?void 0:r.length)||1),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-line-chart"},l.createElement(rr,vt({},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&&l.createElement(br,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(Er,"propTypes",ka),yt(Er,"defaultProps",Aa);var Sr=function(t){Ct(a,u);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"INNER_PADDING",.25),yt(Tt(r),"OUTER_PADDING",.5),yt(Tt(r),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),yt(Tt(r),"componentDidMount",(function(){r.firstRender=!1,r.props.isResizing||r.props.isAnimatingContainer||r.forceUpdate(),r.rebuildTooltips()})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){return(!e.isResizing||!r.props.isResizing)&&(!r.state.isLoading||!t.isLoading)})),yt(Tt(r),"componentDidUpdate",(function(t,n){var a={},o=!1,i=!1,s=e(r.chartContainerRef,"offsetWidth",0),l=e(r.chartContainerRef,"offsetHeight",0);if(!r.state.isLoading&&r.recursiveUpdateCount<2&&(s!==r.chartWidth||l!==r.chartHeight)&&(o=!0,r.recursiveUpdateCount++,clearTimeout(r.recursiveUpdateTimeout),r.recursiveUpdateTimeout=setTimeout((function(){r.recursiveUpdateCount=0}),500)),!r.props.isResizing&&t.isResizing&&r.chartContainerRef&&(r.chartContainerRef.style.flexBasis="100vh",o=!0),Ia(r.props,t)&&(i=!0,r.props.isPivot||(a.aggregatedData=r.aggregateRowData(r.props)),r.rebuildTooltips()),!Ce(a))return o=!1,void r.setState(a,(function(){i&&r.updateMargins()}));i?r.updateMargins():o&&r.forceUpdate()})),yt(Tt(r),"componentWillUnmount",(function(){clearTimeout(r.recursiveUpdateTimeout),r.getNewMargins&&r.getNewMargins.cancel(),r.legend=void 0,r.xAxis=void 0,r.axes=void 0})),yt(Tt(r),"aggregateRowData",(function(e){var t=e.stringColumnIndex,n=e.numberColumnIndices,a=Ve(e.data,(function(e){return null==e?void 0:e[t]})),r=[],o=he(a[0]);return a.forEach((function(e,i){var s;if(i===a.length-1)r.push(o);else{if(0===i)return;if((null==e?void 0:e[t])!==(null===(s=o)||void 0===s?void 0:s[t]))r.push(o),o=he(e);else{var l=he(e);n.forEach((function(e){var t=Number(l[e]),n=Number(o[e]);isNaN(t)&&(t=0),isNaN(n)&&(n=0),l[e]=t+n})),o=l}}})),r})),yt(Tt(r),"getNewLeftMargin",(function(e,t){var n=e.x,a=t.x+n,o=r.state.leftMargin;return o+=n-a+r.Y_AXIS_LABEL_WIDTH+r.PADDING})),yt(Tt(r),"getNewRightMargin",(function(e,t,n){var a=t.x+e.x+t.width-(e.x+e.width),o=n-r.state.leftMargin,i=e.width-o,s=r.state.rightMargin+a+r.PADDING;r.state.rightMargin;return s<i?s:r.PADDING})),yt(Tt(r),"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 r=e[n];return{label:r.title,color:t(a),hidden:r.isSeriesHidden,columnIndex:n,column:r}}));return a}catch(e){return console.error(e),[]}}(r.props.columns,r.colorScale,r.props.numberColumnIndices)})),yt(Tt(r),"getNewBottomMargin",(function(t){var n;r.legend=Me(r.chartRef).select(".legendOrdinal").node(),n=r.legend?r.legend.getBBox():void 0;var a=0;"bottom"===_a(r.props.numberColumnIndices,r.props.type)&&e(n,"height")&&(a=n.height+10),r.xAxis=Me(r.chartRef).select(".axis-Bottom").node();var o=r.xAxis?r.xAxis.getBBox():{},i=Math.ceil(o.height)+a+40;(0===o.height&&(i=463),"bar"===r.props.type||"stacked_bar"===r.props.type)&&(i=i-(t.height-r.state.topMargin-r.state.bottomMargin)+10);return i||r.state.bottomMargin})),yt(Tt(r),"getNewTopMargin",(function(){return r.state.topMargin})),yt(Tt(r),"rebuildTooltips",(function(){clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),1e3)})),yt(Tt(r),"updateMargins",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.setLoading,n=void 0===t||t,a=e.delay,o=void 0===a?100:a;!r.state.isLoading&&n&&r.setState({isLoading:!0}),clearTimeout(r.updateMarginsThrottled),r.updateMarginsThrottled=setTimeout((function(){r.updateMarginsToThrottle()}),o)})),yt(Tt(r),"updateMarginsToThrottle",(function(){r.newMargins=void 0;try{if(r.axes=document.querySelector("#react-autoql-chart-".concat(r.CHART_ID," .react-autoql-axes")),!r.chartContainerRef||!r.axes)return void r.clearLoading();var e=r.chartContainerRef.getBoundingClientRect(),t=r.axes.getBBox(),n=r.getNewLeftMargin(e,t),a=r.getNewRightMargin(e,t,n),o=r.getNewTopMargin(),i=r.getNewBottomMargin(e,t);r.newMargins={leftMargin:n,topMargin:o,rightMargin:a,bottomMargin:i},r.isMarginDiffSignificant=r.isMarginDifferenceSignificant(),r.isMarginDiffSignificant?(r.marginAdjustmentFinished=!0,r.setState(ct({},r.newMargins),(function(){r.clearLoading()}))):(r.marginAdjustmentFinished=!0,r.clearLoading())}catch(e){console.error(e),r.marginAdjustmentFinished=!0,r.clearLoading()}})),yt(Tt(r),"clearLoading",(function(){clearTimeout(r.loadingTimeout),r.loadingTimeout=setTimeout((function(){r.setState({isLoading:!1})}),100)})),yt(Tt(r),"isMarginDifferenceSignificant",(function(){if(!r.newMargins)return!1;var e=r.newMargins,t=e.leftMargin,n=e.topMargin,a=e.rightMargin,o=e.bottomMargin,i=Math.abs(t-r.state.leftMargin),s=Math.abs(n-r.state.topMargin),l=Math.abs(a-r.state.rightMargin),c=Math.abs(o-r.state.bottomMargin);return i>10||s>10||l>10||c>10})),yt(Tt(r),"getBase64Data",(function(){var e=r.chartRef;return e?pn(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),yt(Tt(r),"saveAsPNG",(function(){var e=r.chartRef;e&&pn(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)}))})),yt(Tt(r),"getStringAxisTitle",(function(){var e,t=r.props,n=t.columns,a=t.stringColumnIndex;return null==n||null===(e=n[a])||void 0===e?void 0:e.display_name})),yt(Tt(r),"getNumberAxisTitle",(function(){var t=r.props,n=t.columns,a=t.numberColumnIndices;try{var o=n.filter((function(e,t){return a.includes(t)}));if(null==o||!o.length)return;if(!o.find((function(e){return e.display_name!==o[0].display_name})))return e(o,"[0].display_name");var i=e(o,"[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)}})),yt(Tt(r),"getCommonChartProps",(function(){var e,t,n=r.state,a=n.topMargin,o=n.bottomMargin,i=n.rightMargin,s=n.leftMargin,l=n.bottomLegendMargin,c=r.props,u=c.numberColumnIndices,p=c.columns,d=r.INNER_PADDING;u.length>1&&(d=.1);var m=en(p),f=m.amountOfNumberColumns>1,g=m.amountOfStringColumns>1,h=u.filter((function(e){return!p[e].isSeriesHidden}));return ct(ct({},r.props),{},(yt(t={key:void 0,data:r.state.aggregatedData||r.props.data,colorScale:r.colorScale,innerPadding:d,outerPadding:r.OUTER_PADDING},"colorScale",r.colorScale),yt(t,"height",r.chartHeight),yt(t,"width",r.chartWidth),yt(t,"topMargin",a),yt(t,"bottomMargin",o),yt(t,"rightMargin",i),yt(t,"leftMargin",s),yt(t,"bottomLegendMargin",l),yt(t,"hasMultipleNumberColumns",f),yt(t,"hasMultipleStringColumns",g),yt(t,"marginAdjustmentFinished",r.state.loading),yt(t,"legendTitle",(null===(e=r.props.legendColumn)||void 0===e?void 0:e.title)||"Category"),yt(t,"legendLocation",_a(u,r.props.type)),yt(t,"legendLabels",r.getLegendLabels()),yt(t,"visibleSeriesIndices",h),yt(t,"numberAxisTitle",r.getNumberAxisTitle()),yt(t,"stringAxisTitle",r.getStringAxisTitle()),yt(t,"onStringColumnSelect",r.onStringColumnSelect),yt(t,"onLabelChange",r.updateMargins),t))})),yt(Tt(r),"moveIndexToFront",(function(e,t){var n=he(t),a=t[e];return n.slice(e,e+1),n.unshift(a),n})),yt(Tt(r),"renderColumnChart",(function(e){return l.createElement(ir,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderBarChart",(function(e){return l.createElement(lr,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderLineChart",(function(e){return l.createElement(ur,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderPieChart",(function(){return l.createElement(pr,r.getCommonChartProps())})),yt(Tt(r),"renderHeatmapChart",(function(){return l.createElement(mr,r.getCommonChartProps())})),yt(Tt(r),"renderBubbleChart",(function(){return l.createElement(gr,r.getCommonChartProps())})),yt(Tt(r),"renderStackedColumnChart",(function(){return l.createElement(Cr,r.getCommonChartProps())})),yt(Tt(r),"renderStackedBarChart",(function(e){return l.createElement(yr,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderStackedLineChart",(function(){return l.createElement(Er,r.getCommonChartProps())})),yt(Tt(r),"renderChart",(function(){switch(r.props.type){case"column":return r.renderColumnChart();case"bar":return r.renderBarChart();case"line":return r.renderLineChart();case"pie":return r.renderPieChart();case"bubble":return r.renderBubbleChart();case"heatmap":return r.renderHeatmapChart();case"stacked_column":return r.renderStackedColumnChart();case"stacked_bar":return r.renderStackedBarChart();case"stacked_line":return r.renderStackedLineChart();default:return"Unknown Display Type"}})),yt(Tt(r),"render",(function(){return r.chartWidth=e(r.chartContainerRef,"offsetWidth",0),r.chartHeight=e(r.chartContainerRef,"offsetHeight",0),l.createElement(At,null,l.createElement("div",{id:"react-autoql-chart-".concat(r.CHART_ID),ref:function(e){return r.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container ".concat(r.state.isLoading||r.props.isAnimatingContainer||r.props.isResizing?"loading":""),style:{flexBasis:r.chartHeight?"".concat(r.chartHeight,"px"):"100vh"}},!r.firstRender&&!r.props.isAnimatingContainer&&l.createElement(c,null,l.createElement("svg",{ref:function(e){return r.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:r.chartWidth,height:r.chartHeight,style:{fontFamily:e(Ht(r.props.themeConfig),"font-family","sans-serif"),color:e(Ht(r.props.themeConfig),"text-color-primary","inherit"),background:e(Ht(r.props.themeConfig),"background-color","inherit")}},l.createElement("g",{className:"react-autoql-chart-content-container"},r.renderChart())))))}));var o=t.themeConfig.chartColors;return r.CHART_ID=ve(),r.Y_AXIS_LABEL_WIDTH=15,r.X_AXIS_LABEL_HEIGHT=15,r.PADDING=20,r.firstRender=!0,r.recursiveUpdateCount=0,r.colorScale=ke().range(o),r.state={aggregatedData:t.isPivot?void 0:r.aggregateRowData(t),leftMargin:r.PADDING,rightMargin:r.PADDING,topMargin:r.PADDING,bottomMargin:r.PADDING,bottomLegendMargin:0,loading:!0},r}return ht(a)}();yt(Sr,"propTypes",ct(ct({},xa),{},{type:p.string.isRequired})),yt(Sr,"defaultProps",wa);var Tr=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"ID",ve()),yt(Tt(t),"state",{isOpen:!1}),yt(Tt(t),"componentDidMount",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"render",(function(){return t.props.options?l.createElement(At,null,l.createElement(Ee,{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,l.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},l.createElement(fe,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-drawer-tooltip",effect:"solid",delayShow:500}),l.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){return l.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)}))))}},l.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",l.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item"))))):null})),t}return ht(a)}();yt(Tr,"propTypes",{themeConfig:Mt,onChange:p.func,options:p.arrayOf(p.shape({})),popupClassname:p.string,value:p.string,label:p.string,size:p.string}),yt(Tr,"defaultProps",{themeConfig:Pt,onChange:function(){},options:[],popupClassname:void 0,value:void 0,label:void 0,size:"large",style:{}});var Dr=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"originalReplaceWords",[]),yt(Tt(t),"suggestionLists",[]),yt(Tt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),yt(Tt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),yt(Tt(t),"getSuggestionLists",(function(e,t){var n=[];return t.length&&t.forEach((function(t){var a=e.slice(t.start,t.end),r=t.suggestions.map((function(e){return ct({id:ve(),hidden:!1},e)})),o=[].concat(wt(r),[{id:ve(),text:a}]);n.push(o)})),n})),yt(Tt(t),"getPlainTextList",(function(e,t){var n=[],a=0;return t.forEach((function(r,o){n.push(e.slice(a,r.start)),o===t.length-1&&n.push(e.slice(r.end,e.length)),a=r.end})),n})),yt(Tt(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})),yt(Tt(t),"updateStartAndEndIndexes",(function(n){if(e(n,"length")){var a="";t.plainTextList.forEach((function(e,t){a=a.concat(e);var r=n[t];if(r&&!r.hidden){var o=a.length;r.start=o,r.end=o+r.text.length,a=a.concat(r.text)}}))}})),yt(Tt(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||ve()})),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:he(e)})})),yt(Tt(t),"initializeQueryValidationOptions",(function(e){var n=e.data,a=n.replacements,r=n.query;if(!a||!r)return[];t.suggestionLists=t.getSuggestionLists(r,a),t.plainTextList=t.getPlainTextList(r,a),t.setInitialSelections()})),yt(Tt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var a=t.suggestionLists[n].find((function(t){return t.id===e})),r=he(t.state.selectedSuggestions);r[n]=a,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(r),r),t.updateStartAndEndIndexes(r),t.setState({selectedSuggestions:he(r)})}else t.deleteQueryValidationSuggestion(n)})),yt(Tt(t),"deleteQueryValidationSuggestion",(function(e){var n=he(t.state.selectedSuggestions.map((function(t,n){return n===e?ct(ct({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:he(n)})})),yt(Tt(t),"renderWordSelector",(function(e){var n=he(t.state.selectedSuggestions[e]);if(!n||n.hidden)return null;var a=t.suggestionLists[e],r=a.map((function(e,t){var n={value:e.id,label:e.text};return t===a.length-1?n.listLabel="".concat(n.label," (Original term)"):n.listLabel="".concat(e.text).concat(e.value_label?" (".concat(e.value_label,")"):""),n}));return r.push({value:"remove-word",label:l.createElement("span",null,l.createElement(ea,{type:"trash"})," Remove term")}),l.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},l.createElement(Tr,{themeConfig:Ht(t.props.themeConfig),options:r,key:ve(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),yt(Tt(t),"renderQueryValidationQuery",(function(){return l.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var a=l.createElement("span",{key:"query-element-".concat(n)},e),r=t.renderWordSelector(n);return l.createElement("span",{key:ve()},a,r)})))})),yt(Tt(t),"getQueryValidationQueryText",(function(e){var n="";return t.plainTextList.forEach((function(t,a){n=n.concat(t);var r=e[a];r&&!r.hidden&&(n=n.concat(r.text))})),n})),yt(Tt(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?l.createElement("div",{className:"react-autoql-query-validation-container"},l.createElement("div",{className:"react-autoql-query-validation-description"},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:"),l.createElement("span",null,t.renderQueryValidationQuery(),l.createElement("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},l.createElement(ea,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return ht(a)}();yt(Dr,"propTypes",{themeConfig:Mt,response:p.shape({}),onSuggestionClick:p.func,autoSelectSuggestion:p.bool,isQueryRunning:p.bool,initialSelections:p.arrayOf(p.shape({})),onQueryValidationSelectOption:p.func,message:p.string}),yt(Dr,"defaultProps",{themeConfig:Pt,response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var xr=function(n){Ct(r,l.Component);var a=xt(r);function r(n){var o;return ft(this,r),yt(Tt(o=a.call(this,n)),"componentDidMount",(function(){An(Ht(o.props.themeConfig)),o.props.onValueLabelClick&&o.validateAndUpdateValueLabels()})),yt(Tt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),yt(Tt(o),"componentDidUpdate",(function(e,t){ge(Ht(o.props.themeConfig),Ht(e.themeConfig))||An(Ht(o.props.themeConfig))})),yt(Tt(o),"validateAndUpdateValueLabels",(function(){if(o.reverseTranslationArray.length){var n=[],a=t(o.reverseTranslationArray);o.reverseTranslationArray.forEach((function(t,r){"VALUE_LABEL"===t.c_type&&n.push(fa(ct({suggestion:t.eng},Ot(o.props.authentication))).then((function(t){e(t,"data.data.matches.length")&&(a[r].c_type="VALIDATED_VALUE_LABEL")})))})),Promise.all(n).then((function(){o.reverseTranslationArray=a,o.setState({isValidated:!0})}))}})),yt(Tt(o),"renderFilterLockLink",(function(e){return l.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(),o.props.onValueLabelClick(e)}}," ",o.props.appliedFilters.includes(e)&&l.createElement(ea,{type:"lock"})," ",l.createElement("span",null,e))})),yt(Tt(o),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return o.props.onValueLabelClick?o.renderFilterLockLink(e.eng):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),yt(Tt(o),"render",(function(){return e(o.reverseTranslationArray,"length")?l.createElement(At,null,l.createElement("div",{id:o.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},l.createElement("div",{className:"react-autoql-reverse-translation"},l.createElement(ea,{type:"info"}),l.createElement("strong",null," Interpreted as: "),o.reverseTranslationArray.map((function(e,t){return l.createElement("span",{key:"rt-item-".concat(o.COMPONENT_KEY,"-").concat(t)},o.renderInterpretationChunk(e))}))))):null})),o.COMPONENT_KEY=ve(),o.reverseTranslationArray=n.reverseTranslation,o.state={isValidated:!1},o}return ht(r)}();yt(xr,"propTypes",{authentication:Nt,themeConfig:Mt,interpretation:p.array,onValueLabelClick:p.func,appliedFilters:p.array,reverseTranslation:p.array}),yt(xr,"defaultProps",{authentication:It,themeConfig:Pt,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 wr=function(t){Ct(r,l.Component);var a=xt(r);function r(t){var o;ft(this,r),yt(Tt(o=a.call(this,t)),"componentDidMount",(function(){o._isMounted=!0;try{var e;null!==(e=o.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.props.optionsToolbarRef.forceUpdate(),En(o.props.queryResponse,o.props.displayType)?o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes):o.onRecommendedDisplayType(Tn(o.props.queryResponse,o.props.autoChartAggregations))}catch(e){console.error(e),o.props.onErrorCallback(e)}})),yt(Tt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),yt(Tt(o),"componentDidUpdate",(function(e,t){try{var n;if(ge(o.props.tableConfig,e.tableConfig)||(o.props.tableConfig?o.tableConfig=he(o.props.tableConfig):o.setTableConfig()),!ge(o.props.tableConfig,o.tableConfig)&&o.props.onTableConfigChange&&o.props.onTableConfigChange(o.tableConfig),!ge(o.props.columns,e.columns)&&o.props.onTableConfigChange&&o.props.onTableConfigChange({}),ge(Ht(o.props.themeConfig),Ht(e.themeConfig))&&An(Ht(o.props.themeConfig)),o.props.queryResponse&&!o.queryResponse)if(En(o.props.queryResponse,o.props.displayType))o.setResponseData(),o.forceUpdate();else{var a=Tn(o.props.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(a)}if(!e.displayType&&o.props.displayType)if(fe.hide(),En(o.queryResponse,o.props.displayType))o.setResponseData(),o.forceUpdate();else{var r=Tn(o.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(r)}if(o.props.displayType!==e.displayType&&!En(o.queryResponse,o.props.displayType)){var i=Tn(o.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(i)}!t.isContextMenuOpen&&o.state.isContextMenuOpen?xe.on():t.isContextMenuOpen&&!o.state.isContextMenuOpen&&xe.off(),t.isShowingInterpretation!==o.state.isShowingInterpretation&&o.forceUpdate(),null!==(n=o.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&o.props.optionsToolbarRef.forceUpdate(),o.props.onUpdate()}catch(e){console.error(e)}})),yt(Tt(o),"componentWillUnmount",(function(){clearTimeout(o.filterDrilldownTimeout),o._isMounted=!1,fe.hide()})),yt(Tt(o),"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})),yt(Tt(o),"supportsPivot",(function(){return o.supportedDisplayTypes.includes("pivot_table")})),yt(Tt(o),"onRecommendedDisplayType",(function(e){o.props.onRecommendedDisplayType(e,o.supportedDisplayTypes)})),yt(Tt(o),"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(o.queryResponse,"data.data.columns");return!!t.numberColumnIndices.every((function(e){return n[e]&&Gt(n[e])}))&&!!t.stringColumnIndices.every((function(e){return n[e]&&Wt(n[e])}))}catch(e){return!1}})),yt(Tt(o),"updateColumns",(function(t){var n;e(o.queryResponse,"data.data.columns")&&(o.queryResponse.data.data.columns=t);var a=bn({response:o.queryResponse});o.setSupportedDisplayTypes(a),o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes),Cn(o.queryResponse)?o.onRecommendedDisplayType("text"):(o.tableConfig=void 0,o.shouldGenerateTableData()&&(o.generateTableData(),o.shouldGeneratePivotData()?o.generatePivotTableData({isFirstGeneration:!0}):(o.pivotTableColumns=void 0,o.pivotTableData=void 0)),e(o.tableRef,"ref.table")&&o.tableRef.ref.table.setColumns(o.tableColumns),null!==(n=o.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&o.props.optionsToolbarRef.forceUpdate(),"text"===o.props.displayType?o.onRecommendedDisplayType("table"):o.forceUpdate())})),yt(Tt(o),"generateAllData",(function(t,n){e(t,"data.data")&&n&&o.shouldGenerateTableData()&&(o.generateTableData(),o.shouldGeneratePivotData()&&o.generatePivotData({isFirstGeneration:!0}))})),yt(Tt(o),"setResponseData",(function(){o.queryID=e(o.queryResponse,"data.data.query_id"),o.interpretation=e(o.queryResponse,"data.data.interpretation"),o.generateAllData(o.queryResponse,o.props.displayType)})),yt(Tt(o),"shouldGeneratePivotData",(function(e){return(e||o.tableData)&&o.supportsPivot()})),yt(Tt(o),"shouldGenerateTableData",(function(){return e(o.queryResponse,"data.data.rows.length")})),yt(Tt(o),"dateSortFn",(function(e,t){var a=Number(e),r=Number(t);if((Number.isNaN(a)||Number.isNaN(r))&&(a=n(e).unix(),r=n(t).unix()),!a||!r){if(e.includes("-W")){var o=e.substring(0,4),i=t.substring(0,4);if(o!==i)return i-o;var s=e.substring(6,8);return t.substring(6,8)-s}var l=[{description:"Sunday",value:1,label:"S"},{description:"Monday",value:2,label:"M"},{description:"Tuesday",value:3,label:"T"},{description:"Wednesday",value:4,label:"W"},{description:"Thursday",value:5,label:"T"},{description:"Friday",value:6,label:"F"},{description:"Saturday",value:7,label:"S"}],c=null,u=null;return l.forEach((function(t){if(e.trim()===t.description)return c=t.value})),l.forEach((function(e){if(t.trim()===e.description)return u=e.value})),null===c||null===u?t-e:u-c}return r-a})),yt(Tt(o),"sortTableDataByDate",(function(e){try{if(!e||"object"!==pt(e))return;var t=Zt(o.tableColumns);return t>=0?wt(e).sort((function(e,n){return o.dateSortFn(e[t],n[t])})):e}catch(e){return void console.error(e)}})),yt(Tt(o),"generateTableData",(function(e){var t,n,a;o.tableColumns=e||o.formatColumnsForTable(),o.tableData=o.sortTableDataByDate(null===(t=o.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.rows),o.setTableConfig()})),yt(Tt(o),"generatePivotData",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isFirstGeneration,n=e.newTableData;try{var a=n||o.tableData;2===o.tableColumns.length?o.generateDatePivotData(a):o.generatePivotTableData({isFirstGeneration:t,newTableData:n})}catch(e){console.error(e),o.props.onErrorCallback(e),o.pivotTableData=void 0}})),yt(Tt(o),"renderSuggestionMessage",(function(e,t){var n;try{n=l.createElement("div",{className:"react-autoql-suggestion-message"},l.createElement("div",{className:"react-autoql-suggestions-container"},o.props.renderSuggestionsAsDropdown?l.createElement("select",{key:ve(),onChange:function(e){o._isMounted&&(o.setState({suggestionSelection:e.target.value}),o.onSuggestionClick({query:e.target.value,source:"suggestion",queryId:t}))},value:o.state.suggestionSelection,className:"react-autoql-suggestions-select"},e.map((function(e,t){return l.createElement("option",{key:ve(),value:e},e)}))):e.map((function(e){return l.createElement("div",{key:ve()},l.createElement("button",{onClick:function(){return o.onSuggestionClick({query:e,isButtonClick:!0,source:"suggestion",queryId:t})},className:"react-autoql-suggestion-btn"},e),l.createElement("br",null))}))))}catch(e){n=l.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return n})),yt(Tt(o),"renderSingleValueResponse",(function(){return l.createElement("div",{className:"single-value-response-container"},l.createElement("a",{className:"single-value-response ".concat(Qt(o.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){return o.processDrilldown({groupBys:[],supportedByAPI:!0})}},ln({element:e(o.queryResponse,"data.data.rows[0][0]"),column:e(o.queryResponse,"data.data.columns[0]"),config:Ft(o.props.dataFormatting)})))})),yt(Tt(o),"copyTableToClipboard",(function(){var e,t;"table"===o.props.displayType&&null!==(e=o.tableRef)&&void 0!==e&&e._isMounted?o.tableRef.copyToClipboard():"pivot_table"===o.props.displayType&&null!==(t=o.pivotTableRef)&&void 0!==t&&t._isMounted&&o.pivotTableRef.copyToClipboard()})),yt(Tt(o),"getBase64Data",(function(){var e,t;if(o.chartRef&&mn(o.props.displayType))return o.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=o.tableRef)&&void 0!==e&&e._isMounted&&"table"===o.props.displayType){var n=o.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=o.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===o.props.displayType){var a=o.pivotTableRef.getBase64Data();return Promise.resolve(a)}})),yt(Tt(o),"saveChartAsPNG",(function(){o.chartRef&&o.chartRef.saveAsPNG()})),yt(Tt(o),"getFilterDrilldown",(function(e){var t,n=e.stringColumnIndex,a=e.row,r=null===(t=o.tableData)||void 0===t?void 0:t.filter((function(e){return"".concat(e[n])==="".concat(a[n])})),i=he(o.queryResponse);return i.data.data.rows=r,i})),yt(Tt(o),"processDrilldown",function(){var e=mt(ut().mark((function e(t){var n,a,r,i,s,l,c;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.groupBys,a=t.supportedByAPI,r=t.row,i=t.activeKey,s=t.stringColumnIndex,!Qt(o.props.autoQLConfig).enableDrilldowns){e.next=24;break}if(e.prev=2,!a){e.next=17;break}return o.props.onDrilldownStart(i),e.prev=5,e.next=8,da(ct(ct(ct({},Ot(Ot(o.props.authentication))),Qt(Qt(o.props.autoQLConfig))),{},{queryID:o.queryID,groupBys:n}));case 8:l=e.sent,o.props.onDrilldownEnd({response:l}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),o.props.onDrilldownEnd({response:e.t0});case 15:e.next=18;break;case 17:!isNaN(s)&&null!=r&&r.length&&(o.props.onDrilldownStart(i),c=o.getFilterDrilldown({stringColumnIndex:s,row:r}),o.filterDrilldownTimeout=setTimeout((function(){o.props.onDrilldownEnd({response:c})}),1500));case 18:e.next=24;break;case 20:e.prev=20,e.t1=e.catch(2),console.error(e.t1),o.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)}}()),yt(Tt(o),"onTableCellClick",(function(e){var t={};t=o.pivotTableColumns&&"pivot_table"===o.props.displayType?function(e,t,n,a){try{var r=[];if(e&&e.getColumn()&&e.getColumn().getDefinition()&&e.getColumn().getDefinition().drilldownData&&(r=e.getColumn().getDefinition().drilldownData),!r.length)return;if(2===t.length){var o=Number(n[e.getField()].name),i=e.getData()[0];r[0].value="".concat(a[o][i])}else r[0].value="".concat(e.getData()[0]);return r}catch(e){return void console.error(e)}}(e,o.tableColumns,o.pivotTableColumns,o.pivotOriginalColumnData):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(),r=[];return n.forEach((function(e){var n=t[e].name,o="".concat(a[e]);r.push({name:n,value:o})})),r}}}(e,o.tableColumns),o.processDrilldown({groupBys:t,supportedByAPI:!!t})})),yt(Tt(o),"onChartClick",(function(e,t,n,a,r,i,s){var l,c,u,p=[],d=(null==n||null===(l=n[a])||void 0===l?void 0:l.origColumn)||(null==n?void 0:n[a]);if(null!=n&&null!==(c=n[a])&&void 0!==c&&c.datePivot){var m,f,g,h=Number(null==n||null===(m=n[t])||void 0===m?void 0:m.name),y=null==e?void 0:e[a],v="".concat(null===(f=o.pivotOriginalColumnData)||void 0===f||null===(g=f[h])||void 0===g?void 0:g[y]);p.push({name:d.name,value:v})}else null!=d&&d.groupable&&p.push({name:d.name,value:"".concat(null==e?void 0:e[a])});null!=r&&r.groupable&&p.push({name:r.name,value:"".concat(null==n||null===(u=n[i])||void 0===u?void 0:u.name)});p.length,o.processDrilldown({groupBys:p,supportedByAPI:!!p.length,row:e,activeKey:s,stringColumnIndex:a})})),yt(Tt(o),"toggleTableFilter",(function(e){var t,n,a=e.isFilteringTable;"table"===o.props.displayType&&((null===(t=o.tableRef)||void 0===t?void 0:t._isMounted)&&o.tableRef.toggleTableFilter({isFilteringTable:a}));"pivot_table"===o.props.displayType&&((null===(n=o.pivotTableRef)||void 0===n?void 0:n._isMounted)&&o.pivotTableRef.toggleTableFilter({isFilteringTable:a}))})),yt(Tt(o),"onTableFilter",function(){var e=mt(ut().mark((function e(t,n){var a,r,i,s,l;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"table"===o.props.displayType&&(o.headerFilters=t,r=[],n.forEach((function(e){r.push(e.getData())})),i=r.length,s=o.prevRows>=0?o.prevRows:null===(a=o.tableData)||void 0===a?void 0:a.length,i!==s&&(o.shouldGeneratePivotData(r)&&o.generatePivotData({newTableData:r}),null!==(l=o.props.optionsToolbarRef)&&void 0!==l&&l._isMounted&&o.props.optionsToolbarRef.forceUpdate(),o.prevRows=i));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),yt(Tt(o),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex;if("pie"===o.props.displayType)o.onPieChartLegendClick(e);else{var n=o.supportsPivot()?wt(o.pivotTableColumns):wt(o.tableColumns);n[t].isSeriesHidden=!n[t].isSeriesHidden,o.supportsPivot()?o.pivotTableColumns=n:o.tableColumns=n}o.forceUpdate()})),yt(Tt(o),"onPieChartLegendClick",(function(e){})),yt(Tt(o),"onChangeStringColumnIndex",(function(e){o.supportsPivot()?(o.pivotTableConfig.legendColumnIndex===e&&(o.pivotTableConfig.legendColumnIndex=void 0),o.pivotTableConfig.stringColumnIndex=e,o.generatePivotTableData()):(o.tableConfig.legendColumnIndex===e&&(o.tableConfig.legendColumnIndex=void 0),o.tableConfig.stringColumnIndex=e),o.forceUpdate()})),yt(Tt(o),"onChangeLegendColumnIndex",(function(e){o.supportsPivot()?(o.pivotTableConfig.stringColumnIndex===e&&(o.pivotTableConfig.stringColumnIndex=void 0),o.pivotTableConfig.legendColumnIndex=e,o.generatePivotTableData()):(o.tableConfig.stringColumnIndex===e&&(o.tableConfig.stringColumnIndex=void 0),o.tableConfig.legendColumnIndex=e),o.forceUpdate()})),yt(Tt(o),"onChangeNumberColumnIndices",(function(e){e&&(o.supportsPivot()?(o.pivotTableConfig.numberColumnIndices=e,o.pivotTableConfig.numberColumnIndex=e[0]):(o.tableConfig.numberColumnIndices=e,o.tableConfig.numberColumnIndex=e[0]),o.forceUpdate())})),yt(Tt(o),"setPivotTableConfig",(function(){var e=o.pivotTableColumns;if(e){if(o.pivotTableConfig||(o.pivotTableConfig={}),!(o.pivotTableConfig.stringColumnIndices&&o.pivotTableConfig.stringColumnIndex>=0)){var t=$t(e),n=t.stringColumnIndices,a=t.stringColumnIndex;o.pivotTableConfig.stringColumnIndices=n,o.pivotTableConfig.stringColumnIndex=a}if(!o.pivotTableConfig.numberColumnIndices){var r=Xt(e),i=r.numberColumnIndex,s=r.numberColumnIndices;o.pivotTableConfig.numberColumnIndices=s,o.pivotTableConfig.numberColumnIndex=i}}})),yt(Tt(o),"setTableConfig",(function(){var e=o.tableColumns;if(e){if(o.tableConfig||(o.tableConfig={}),!(o.tableConfig.stringColumnIndices&&o.tableConfig.stringColumnIndex>=0)){var t=$t(e),n=t.stringColumnIndices,a=t.stringColumnIndex;o.tableConfig.stringColumnIndices=n,o.tableConfig.stringColumnIndex=a}if(!(o.tableConfig.numberColumnIndices&&o.tableConfig.numberColumnIndex>=0)){var r=Xt(e),i=r.numberColumnIndex,s=r.numberColumnIndices;o.tableConfig.numberColumnIndices=s,o.tableConfig.numberColumnIndex=i}var l=o.tableColumns.findIndex((function(e,t){return e.groupable&&t!==o.tableConfig.stringColumnIndex}));l>=0&&(o.tableConfig.legendColumnIndex=l)}})),yt(Tt(o),"setSupportedDisplayTypes",(function(e,t){!e||!t&&ge(e,o.supportedDisplayTypes)||(o.supportedDisplayTypes=e,o.supportedDisplayTypes.includes(o.props.displayType)?o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes):o.onRecommendedDisplayType(Tn(o.queryResponse,o.props.autoChartAggregations)))})),yt(Tt(o),"getTooltipDataForCell",(function(e,t,n){var a=null;try{if(o.supportsPivot()){var r=o.tableColumns[o.tableConfig.stringColumnIndex],i=o.tableColumns[o.tableConfig.numberColumnIndex],s=o.tableColumns[o.tableConfig.legendColumnIndex],l="<div>\n <strong>".concat(o.pivotTableColumns[0].title,":</strong>").concat(ln({element:e[0],column:o.pivotTableColumns[0],config:Ft(o.props.dataFormatting)}),"\n </div>"),c="<span></span>";s?c="<div><strong>".concat(s.title,":</strong> ").concat(o.pivotTableColumns[t].title,"</div>"):r&&(c="<div><strong>".concat(r.title,":</strong> ").concat(o.pivotTableColumns[t].title,"</div>"));var u="<div>\n <strong>".concat(i.title,":</strong> ").concat(ln({element:e[t]||0,column:i,config:Ft(o.props.dataFormatting)}),"\n </div>");a="<div>\n ".concat(l,"\n ").concat(c,"\n ").concat(u,"\n </div>")}else{var p=o.tableColumns[o.tableConfig.stringColumnIndex],d=o.tableColumns[t];a="<div>\n <div>\n <strong>".concat(p.title,":</strong> ").concat(ln({element:e[o.tableConfig.stringColumnIndex],column:p,config:Ft(o.props.dataFormatting)}),"\n </div>\n <div>\n <div>\n <strong>").concat(d.title,":</strong> ").concat(ln({element:n||e[t]||0,column:d,config:Ft(o.props.dataFormatting)}),"\n </div>\n </div>")}return a}catch(e){return console.error(e),null}})),yt(Tt(o),"getDrilldownDataForCell",(function(t,n){var a=dn(o.tableColumns)>0;return o.supportsPivot()?{supportedByAPI:a,data:[{name:e(o.pivotTableColumns,"[0].name"),value:"".concat(t[0])},{name:e(o.tableColumns,"[".concat(o.tableConfig.legendColumnIndex,"].name")),value:"".concat(e(o.pivotTableColumns,"[".concat(n,"].name")))}]}:{supportedByAPI:a,data:[{name:e(o.tableColumns,"[".concat(o.tableConfig.stringColumnIndex,"].name")),value:"".concat(e(t,"[".concat(o.tableConfig.stringColumnIndex,"]")))}]}})),yt(Tt(o),"isStringColumnDateType",(function(){var e=o.tableColumns[o.tableConfig.stringColumnIndex];return Yt(e)})),yt(Tt(o),"getMultiSeriesData",(function(t,n){var a,r=$t(t).stringColumnIndex,i=Jt(t),s=Xt(t).numberColumnIndex,l=he(n).sort((function(e,t){var n=e[r],a=t[r];return n&&a?a-n:t-e})),c={};o.tableColumns.forEach((function(e,t){e.seriesCategory&&(c[e.seriesCategory]=t)}));var u=[];return l.forEach((function(t,n){var l=t[r],p=e(a,"[".concat(r,"]")),d=t[i];if(p!==l){var m=nn(o.tableColumns.length,1,0);m[0]=l,u.push(m)}var f=u[u.length-1][c[d]]||0;u[u.length-1][c[d]]=t[s]+f,a=t})),u})),yt(Tt(o),"setFilterFunction",(function(e){var t=Tt(o);return"DATE"===e.type||"DATE_STRING"===e.type?function(n,a,r,i){try{var s=ln({element:a,column:e,config:t.props.dataFormatting});return"".concat(s).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),o.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,a){try{var r=e.trim();if(r.length>=2){var i=Number(r.substr(1).replace(/[^0-9.]/g,""));if(">"===r[0]&&"="===r[1])return t>=i;if(">"===r[0])return t>i;if("<"===r[0]&&"="===r[1])return t<=i;if("<"===r[0])return t<i;if("!"===r[0]&&"="===r[1])return t!==i;if("="===r[0])return t===i}var s=e.replace(/[^0-9.]/g,"");return t.toString().includes(s)}catch(e){return console.error(e),o.props.onErrorCallback(e),!1}}:void 0})),yt(Tt(o),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(e,t){return o.dateSortFn(t,e)}:"STRING"===e.type?"string":void 0})),yt(Tt(o),"formatColumnsForTable",(function(e){var t,n,a,r=e||(null===(t=o.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.columns);return r?r.map((function(e,t){return e.field="".concat(t),e.title=e.display_name,e.id=ve(),e.visible=e.is_visible,"DOLLAR_AMT"===e.type||"RATIO"===e.type||"NUMBER"===e.type?e.hozAlign="right":e.hozAlign="center",e.formatter=function(t,n,a){return ln({element:t.getValue(),column:e,config:Ft(o.props.dataFormatting),htmlElement:t.getElement()})},e.headerFilter="input",e.headerFilterFunc=o.setFilterFunction(e),e.sorter=o.setSorterFunction(e),e.headerContext=function(e,t){e.preventDefault(),o.setState({isContextMenuOpen:!0,activeColumn:t,contextMenuPosition:{top:e.clientY+10,left:e.clientX-20}})},e})):null})),yt(Tt(o),"formatDatePivotYear",(function(e,t){return"DATE"===o.tableColumns[t].type?n.unix(e[t]).utc().format("YYYY"):n(e[t]).format("YYYY")})),yt(Tt(o),"formatDatePivotMonth",(function(e,t){return"DATE"===o.tableColumns[t].type?n.unix(e[t]).format("MMMM"):n(e[t]).format("MMMM")})),yt(Tt(o),"generateDatePivotData",(function(t){try{var a,r=(yt(a={},Ut[1],0),yt(a,Ut[2],1),yt(a,Ut[3],2),yt(a,Ut[4],3),yt(a,Ut[5],4),yt(a,Ut[6],5),yt(a,Ut[7],6),yt(a,Ut[8],7),yt(a,Ut[9],8),yt(a,Ut[10],9),yt(a,Ut[11],10),yt(a,Ut[12],11),a),i=Zt(o.tableColumns),s=o.tableConfig.numberColumnIndex;s>=0||(s=o.tableColumns.findIndex((function(e,t){return t!==i&&Gt(e)})));var l=t||e(o.queryResponse,"data.data.rows"),c=wt(l.map((function(e){return"DATE"===o.tableColumns[i].type?Number(n.unix(e[i]).utc().format("YYYY")):Number(n(e[i]).format("YYYY"))}))).filter(tn).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),u=[{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:o.tableColumns[i]}];Object.keys(c).forEach((function(e,t){u.push(ct(ct({},o.tableColumns[s]),{},{origColumn:o.tableColumns[s],name:e,title:e,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0}))}));var p=nn(Object.keys(c).length,12),d={};Object.keys(r).forEach((function(e,t){p[t][0]=e})),l.forEach((function(e){var t=o.formatDatePivotYear(e,i),n=o.formatDatePivotMonth(e,i),a=c[t],l=r[n];l&&a&&(p[l][a]=e[s],d[t]=ct(ct({},d[t]),{},yt({},n,e[i])))})),o.pivotOriginalColumnData=d,o.pivotTableColumns=u,o.pivotTableData=p,o.numberOfPivotTableRows=12,o.setPivotTableConfig()}catch(e){console.error(e),o.setSupportedDisplayTypes(o.supportedDisplayTypes.filter((function(e){return"pivot_table"!==e}))),o.onRecommendedDisplayType("table")}})),yt(Tt(o),"getColumnFromIndexString",(function(t){return e(o.tableColumns,"[".concat(e(o.tableConfig,"[".concat(t,"]")),"]"))})),yt(Tt(o),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,a=t.newTableData;try{var r=a||o.tableData||e(o.queryResponse,"data.data.rows");r=r.filter((function(e){return null!==e[0]}));var i=o.tableConfig,s=i.legendColumnIndex,l=i.stringColumnIndex,c=i.numberColumnIndex,u=o.sortTableDataByDate(r).map((function(e){return e[l]})).filter(tn).reduce((function(e,t,n){return e[t]=n,e}),{}),p=o.sortTableDataByDate(r).map((function(e){return e[s]})).filter(tn).reduce((function(e,t,n){return e[t]=n,e}),{}),d=l,m=s;if(n&&Object.keys(p).length>Object.keys(u).length&&!Yt(o.getColumnFromIndexString("stringColumnIndex"))){d=s,m=l;var f=he(u);u=he(p),p=he(f)}o.tableConfig.legendColumnIndex=m;var g=[ct(ct({},o.tableColumns[d]),{},{frozen:!0,headerContext:void 0,visible:!0,is_visible:!0,field:"0"})];Object.keys(p).forEach((function(e,t){var n=ln({element:e,column:o.tableColumns[m],config:Ft(o.props.dataFormatting)});g.push(ct(ct({},o.tableColumns[c]),{},{origColumn:o.tableColumns[c],name:e,title:n,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0}))}));var h=nn(Object.keys(p).length+1,Object.keys(u).length);r.forEach((function(e){h[u[e[d]]][0]=e[d],h[u[e[d]]][p[e[m]]+1]=e[c]}));var y=bn({response:o.queryResponse});ge(y,o.supportedDisplayTypes)||o.setSupportedDisplayTypes(y),o.pivotTableColumns=g,o.pivotTableData=h,o.numberOfPivotTableRows=e(o.pivotTableData,"length",0),o.setPivotTableConfig()}catch(e){console.error(e),o.props.onErrorCallback(e)}})),yt(Tt(o),"onSuggestionClick",(function(t){var n=t.query,a=t.queryId,r=t.userSelection,i=t.isButtonClick,l=t.skipQueryValidation,c=t.source;r||function(t){var n=t.queryId,a=t.suggestion,r=t.apiKey,o=t.domain,i=t.token,l="".concat(o,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(r),c={suggestion:a};if(!i||!o||!r)return Promise.reject(new Error("Unauthenticated"));var u={headers:{Authorization:"Bearer ".concat(i)}};s.put(l,c,u).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(ct(ct({},Ot(o.props.authentication)),{},{queryId:a,suggestion:n})),"None of these"===n?o.props.onNoneOfTheseClick?o.props.onNoneOfTheseClick():o.setState({customResponse:"Thank you for your feedback."}):(o.props.onSuggestionClick&&o.props.onSuggestionClick({query:n,userSelection:r,isButtonClick:i,skipQueryValidation:l,source:c}),o.props.queryInputRef&&o.props.queryInputRef.submitQuery({queryText:n,userSelection:r,skipQueryValidation:!0,source:c}))})),yt(Tt(o),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return l.createElement("div",null,t.map((function(e,n){return l.createElement("span",{key:"error-message-part-".concat(o.COMPONENT_KEY,"-").concat(n)},l.createElement("span",null,e),n!==t.length-1&&l.createElement("button",{className:"report-like-text-button",onClick:o.props.reportProblemCallback},"report"))})))}catch(t){return l.createElement("span",null,e)}})),yt(Tt(o),"renderAllColumnsHiddenMessage",(function(){return l.createElement("div",{className:"no-columns-error-message"},l.createElement("div",null,l.createElement(ea,{className:"warning-icon",type:"warning-triangle"}),l.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",l.createElement(ea,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),yt(Tt(o),"renderTable",(function(){return!o.tableData||"pivot_table"===o.props.displayType&&!o.pivotTableData?"Error: There was no data supplied for this table":"pivot_table"===o.props.displayType?l.createElement(At,null,l.createElement(Da,{themeConfig:Ht(o.props.themeConfig),key:o.pivotTableID,ref:function(e){return o.pivotTableRef=e},columns:o.pivotTableColumns,data:o.pivotTableData,onCellClick:o.onTableCellClick,headerFilters:o.pivotHeaderFilters,onFilterCallback:o.onTableFilter,isResizing:o.props.isResizing,enableColumnHeaderContextMenu:o.props.enableColumnHeaderContextMenu})):l.createElement(Da,{themeConfig:Ht(o.props.themeConfig),key:o.tableID,ref:function(e){return o.tableRef=e},columns:o.tableColumns,data:o.tableData,onCellClick:o.onTableCellClick,headerFilters:o.headerFilters,onFilterCallback:o.onTableFilter,isResizing:o.props.isResizing})})),yt(Tt(o),"renderChart",(function(e){var t;if(!o.tableData||!o.tableColumns||!o.tableConfig)return console.error("Required table data was missing"),"Error: There was no data supplied for this chart";var n=o.supportsPivot();if(n&&(!o.pivotTableData||!o.pivotTableColumns||!o.pivotTableConfig))return console.error("Required pivot table data was missing"),"Error: There was no data supplied for this chart";var a=n?o.pivotTableConfig:o.tableConfig;return l.createElement(At,null,l.createElement(Sr,vt({themeConfig:Ht(o.props.themeConfig),dataLength:o.tableData.length,ref:function(e){return o.chartRef=e},type:e||o.props.displayType},a,{data:n?o.pivotTableData:o.tableData,columns:n?o.pivotTableColumns:o.tableColumns,isPivot:n,isShowingInterpretation:o.state.isShowingInterpretation,dataFormatting:Ft(o.props.dataFormatting),backgroundColor:o.props.backgroundColor,activeChartElementKey:o.props.activeChartElementKey,onLegendClick:o.onLegendClick,legendColumn:o.tableColumns[null===(t=o.tableConfig)||void 0===t?void 0:t.legendColumnIndex],changeStringColumnIndex:o.onChangeStringColumnIndex,changeLegendColumnIndex:o.onChangeLegendColumnIndex,changeNumberColumnIndices:o.onChangeNumberColumnIndices,onChartClick:o.onChartClick,isResizing:o.props.isResizing,isAnimatingContainer:o.props.isAnimatingContainer,enableDynamicCharting:o.props.enableDynamicCharting})))})),yt(Tt(o),"renderHelpResponse",(function(){var t=e(o.queryResponse,"data.data.rows[0]");if(!t)return null;var n=t.includes("#"),a=t;if(n){var r=t.split("#")[1].replace(/-/g," ");a=r.charAt(0).toUpperCase()+r.substr(1)}return l.createElement(c,null,"Great news, I can help with that:",l.createElement("br",null),l.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},l.createElement(ea,{type:"globe",className:"react-autoql-help-link-icon"}),a))})),yt(Tt(o),"renderError",(function(t){return t?e(t,"data.message")?o.renderMessage(t.data):o.renderMessage():(console.warn("Warning: No response object supplied"),o.renderMessage("No response supplied"))})),yt(Tt(o),"renderDataLimitWarning",(function(){var e,t,n,a,r,i,s,c=null===(e=o.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,u=null===(r=o.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(s=i.data)||void 0===s?void 0:s.row_limit,p=Qt(o.props.autoQLConfig).enableQueryInterpretation&&o.props.showQueryInterpretation;return u&&c===u?l.createElement("div",{className:"dashboard-data-limit-warning-icon"},l.createElement(ea,{type:"warning","data-tip":"The display limit of ".concat(c," 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(o.COMPONENT_KEY),"data-place":p?"left":"right"})):null})),yt(Tt(o),"renderMessage",(function(e){try{if("object"===pt(e)){var t=In.GENERAL_QUERY;return e.message&&(t=e.message,t=o.props.reportProblemCallback?o.replaceErrorTextWithLinks(e.message):t.replace("<report>","report")),l.createElement("div",{className:"query-output-error-message"},l.createElement("div",null,t),e.reference_id&&l.createElement(c,null,l.createElement("br",null),l.createElement("div",null,"Error ID: ",e.reference_id)))}var n=e||In.GENERAL_QUERY;return l.createElement("div",null,n)}catch(e){return console.warn(e),l.createElement("div",null,In.GENERAL_QUERY)}})),yt(Tt(o),"renderHTMLMessage",(function(t){return null!==e(t,"data.data.answer",null)?we(e(t,"data.data.answer"),{replace:function(e){if("a"===e.name){var t=e.attribs||{};return l.createElement("a",vt({},t,{target:"_blank"}),e.children)}}}):l.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),yt(Tt(o),"renderTextResponse",(function(){return Cn(o.queryResponse)?o.renderAllColumnsHiddenMessage():null})),yt(Tt(o),"renderResponse",(function(){var t=o.props.displayType;return o.hasError(o.queryResponse)?o.renderError(o.queryResponse):o.state.customResponse?o.state.customResponse:!!e(o.queryResponse,"data.data.items")?o.renderSuggestionMessage(o.queryResponse.data.data.items,o.queryResponse.data.data.query_id):e(o.queryResponse,"data.data.replacements")?l.createElement(Dr,{themeConfig:Ht(o.props.themeConfig),key:o.QUERY_VALIDATION_KEY,response:o.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return o.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:"validation"})},onQueryValidationSelectOption:o.props.onQueryValidationSelectOption,initialSelections:o.props.queryValidationSelections,autoSelectSuggestion:o.props.autoSelectQueryValidationSuggestion}):e(o.queryResponse,"data.data.rows.length")?t&&e(o.queryResponse,"data.data.rows")?"help"===t?o.renderHelpResponse():"text"===t?o.renderTextResponse():"single-value"===t?o.renderSingleValueResponse():fn(t)?o.renderTable():mn(t)?o.renderChart():(console.warn("display type not recognized: ".concat(o.props.displayType," - rendering as plain text")),o.renderMessage("display type not recognized: ".concat(o.props.displayType))):null:o.replaceErrorTextWithLinks(o.queryResponse.data.message)})),yt(Tt(o),"renderReverseTranslation",(function(){return Qt(o.props.autoQLConfig).enableQueryInterpretation&&o.props.showQueryInterpretation?l.createElement(xr,{authentication:o.props.authentication,onValueLabelClick:o.props.onRTValueLabelClick,appliedFilters:o.props.appliedFilters,isResizing:o.props.isResizing,reverseTranslation:e(o.queryResponse,"data.data.reverse_translation")}):null})),yt(Tt(o),"renderFooter",(function(){return l.createElement("div",{className:"query-output-footer"},o.renderReverseTranslation(),o.renderDataLimitWarning())})),yt(Tt(o),"render",(function(){return l.createElement(At,null,l.createElement("div",{key:o.COMPONENT_KEY,ref:function(e){return o.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(o.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(fn(o.props.displayType)?"table":"")},o.renderResponse(),o.renderFooter()),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-query-output-tooltip-".concat(o.COMPONENT_KEY),effect:"solid",place:"left",html:!0}))})),o.COMPONENT_KEY=ve(),o.QUERY_VALIDATION_KEY=ve(),o.queryResponse=t.queryResponse,o.supportedDisplayTypes=bn({response:t.queryResponse}),o.queryID=e(t.queryResponse,"data.data.query_id"),o.interpretation=e(t.queryResponse,"data.data.interpretation"),o.tableID=ve(),o.pivotTableID=ve(),t.tableConfig&&o.isTableConfigValid(t.tableConfig)&&(o.tableConfig=he(t.tableConfig));var i=En(t.queryResponse,t.displayType)?t.displayType:Tn(t.queryResponse,t.autoChartAggregations),u=Ht(t.themeConfig).chartColors;o.colorScale=ke().range(u),An(Ht(t.themeConfig)),o.generateAllData(t.queryResponse,i);var p=Qt(t.autoQLConfig).defaultShowInterpretation;return o.state={displayType:i,tableFilters:[],suggestionSelection:t.selectedSuggestion,isShowingInterpretation:p},o}return ht(r)}();yt(wr,"propTypes",{queryResponse:d({}),queryInputRef:v(Ta),authentication:Nt,themeConfig:Mt,autoQLConfig:Vt,dataFormatting:Rt,tableConfig:d({}),onSuggestionClick:C,displayType:m,renderTooltips:g,onQueryValidationSelectOption:C,autoSelectQueryValidationSuggestion:g,queryValidationSelections:y(d({})),renderSuggestionsAsDropdown:g,suggestionSelection:m,activeChartElementKey:m,enableColumnHeaderContextMenu:g,isResizing:g,enableDynamicCharting:g,onTableConfigChange:C,onNoneOfTheseClick:C,autoChartAggregations:g,onSupportedDisplayTypesChange:C,onRTValueLabelClick:C,enableQueryInterpretation:g,defaultShowInterpretation:g,isTaskModule:g,onUpdate:C,onDrilldownStart:C,onDrilldownEnd:C}),yt(wr,"defaultProps",{authentication:It,themeConfig:Pt,autoQLConfig:Lt,dataFormatting:qt,tableConfig:void 0,queryResponse:void 0,displayType:void 0,queryInputRef:void 0,onSuggestionClick:void 0,renderTooltips:!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,onQueryValidationSelectOption:function(){},onSupportedDisplayTypesChange:function(){},onErrorCallback:function(){},onRTValueLabelClick:function(){},onRecommendedDisplayType:function(){},onUpdate:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){}});var kr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"componentDidMount",(function(){An(Ht(e.props.themeConfig))})),yt(Tt(e),"componentDidUpdate",(function(t){ge(Ht(e.props.themeConfig),Ht(t.themeConfig))||An(Ht(e.props.themeConfig))})),yt(Tt(e),"showDisplayTypeButton",(function(t){return(!e.props.disableCharts||!zt.includes(t))&&(e.props.supportedDisplayTypes&&e.props.supportedDisplayTypes.includes(t)&&e.props.displayType!==t)})),yt(Tt(e),"createVisButton",(function(t,n,a){return e.showDisplayTypeButton(t)?l.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})),yt(Tt(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:Bt.includes(n)||zt.includes(n)?l.createElement(At,null,l.createElement("div",{className:"".concat(e.props.className||""," viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",l.createElement(ea,{type:"table"})),e.createVisButton("pivot_table","Pivot Table",l.createElement(ea,{type:"pivot-table"})),e.createVisButton("column","Column Chart",l.createElement(ea,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",l.createElement(ea,{type:"bar-chart"})),e.createVisButton("line","Line Chart",l.createElement(ea,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",l.createElement(ea,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",l.createElement(ea,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",l.createElement(ea,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",l.createElement(ea,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",l.createElement(ea,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",l.createElement(ea,{type:"stacked-line-chart"})))):null})),e}return ht(n)}();yt(kr,"propTypes",{themeConfig:Mt,supportedDisplayTypes:p.arrayOf(p.string).isRequired,onDisplayTypeChange:p.func.isRequired,displayType:p.string,disableCharts:p.bool,vertical:p.bool}),yt(kr,"defaultProps",{themeConfig:Pt,displayType:void 0,disableCharts:!1,vertical:!1});var Ar=kr,Nr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isConfirmCloseModalVisible:!1}),yt(Tt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:l.createElement("div",null,l.createElement(er,{type:"default",onClick:e.props.onClose},"Back"),l.createElement(er,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading},e.props.confirmText||"Continue"))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(De,{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:ct(ct({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},l.createElement("div",{className:"react-autoql-modal-body"},e.props.children),l.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return ht(n)}();yt(Nr,"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}),yt(Nr,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var Rr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isConfirmCloseModalVisible:!1}),yt(Tt(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()})),yt(Tt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:l.createElement("div",null,e.props.showCancelButton&&l.createElement(er,{type:"default",onClick:e.onClose},"Cancel"),l.createElement(er,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(De,{isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:ct(ct({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},l.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,l.createElement(ea,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),l.createElement("div",{className:"react-autoql-modal-body",style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&l.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())),l.createElement(Nr,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.setState({isConfirmCloseModalVisible:!1}),e.props.onClose()}},l.createElement("h3",null,"Are you sure you want to leave this page?"),l.createElement("p",null,"All unsaved changes will be lost.")))})),e}return ht(n)}();yt(Rr,"propTypes",{themeConfig:Mt,title:p.oneOfType([p.element,p.string]),titleIcon:p.oneOfType([p.element,p.instanceOf(ea)]),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}),yt(Rr,"defaultProps",{themeConfig:Pt,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 Vr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{columns:e.props.columns}),yt(Tt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),yt(Tt(e),"render",(function(){return l.createElement(Rr,{themeConfig:Ht(e.props.themeConfig),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},l.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},l.createElement(Xa,{themeConfig:Ht(e.props.themeConfig),columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:function(t){e.setState({columns:t})}})))})),e}return ht(n)}();yt(Vr,"propTypes",{themeConfig:Mt,isSettingColumns:p.bool}),yt(Vr,"defaultProps",{themeConfig:Pt,isSettingColumns:!1});var Mr=["id"],Ir=function(e){var t=e.query,n=e.domain,a=e.apiKey,r=e.token,o="".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||!r)return Promise.reject({error:"Unauthenticated"});var l={headers:{Authorization:"Bearer ".concat(r)}};return s.post(o,i,l)},qr=function(e){var t=e.domain,n=e.apiKey,a=e.token,r=e.unacknowledged,o=void 0===r?0:r;if(!a||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(a)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(o);return i.get(l,{timeout:18e4}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))},Lr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.offset,i=t.limit;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var l=s.create({headers:{Authorization:"Bearer ".concat(r)}}),c="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a,"&offset=").concat(o,"&limit=").concat(i);return l.get(c).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Pr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.channelType;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(n,"/autoql/api/v1/notifications/channels?key=").concat(a,"&type=").concat(o);return i.get(l).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"))}))},Or=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(t.type,!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(a);return o.get(i).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Fr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.dataAlertId;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(n,"/autoql/api/v1/data-alerts/").concat(o,"?key=").concat(a);return i.get(l).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Qr=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return o.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"))}))},Hr=function(t){var n=t.notificationId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(r);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Br=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return o.put(i,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},zr=function(t){var n=t.notificationId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(r);return i.put(l,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ur=function(e){var t=e.dataAlertId,n=e.status,a=e.type,r=e.domain,o=e.apiKey,i=e.token;return i&&o&&r?t?"PROJECT"===a?Gr({dataAlertId:t,status:n,token:i,domain:r,apiKey:o}):_r({dataAlertId:t,status:n,token:i,domain:r,apiKey:o}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},_r=function(t){var n=t.dataAlertId,a=t.status,r=t.token,o=t.domain,i=t.apiKey,l={status:a},c={headers:{Authorization:"Bearer ".concat(r)}},u="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return s.put(u,l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},jr=function(t){var n=t.token,a=t.domain,r=t.apiKey,o=t.channelType,i=t.channelName,l=t.channelEmail,c=t.userName,u=t.userEmail;if(!n||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var p={headers:{Authorization:"Bearer ".concat(n)}},d={channel_type:o,channel_name:i,channel_email:l,sender_name:c,sender_email:u},m="".concat(a,"/autoql/api/v1/notifications/channels?key=").concat(r);return s.post(m,d,p).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Kr=function(t){var n=t.token,a=t.domain,r=t.apiKey,o=t.channelId,i=t.fileName,l=t.base64Data;if(!n||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var c={headers:{Authorization:"Bearer ".concat(n)}},u={attachment_name:i,attachment:l},p="".concat(a,"/autoql/api/v1/notifications/channels/").concat(o,"/send?key=").concat(r);return s.post(p,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Gr=function(t){var n=t.dataAlertId,a=t.status,r=t.token,o=t.domain,i=t.apiKey;return"INACTIVE"===a?function(t){var n=t.dataAlertId,a=t.token,r=t.domain,o=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(o);return s.delete(l,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:r,domain:o,apiKey:i}):function(t){var n=t.dataAlertId,a=t.token,r=t.domain,o=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(o);return s.post(l,{},i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:r,domain:o,apiKey:i})},Wr=function(t){var n=t.dataAlert,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No rule to update"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(r);return i.put(l,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Yr=function(t){var n=t.dataAlert,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}});n.id;var l=St(n,Mr),c="".concat(a,"/autoql/api/v1/data-alerts?key=").concat(r);return i.post(c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Xr=function(t){var n=t.expression,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l={expression:n},c="".concat(a,"/autoql/api/v1/data-alerts/validate?key=").concat(r);return i.post(c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Jr=function(t,n){var a=n.domain,r=n.apiKey,o=n.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(r);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Zr=function(t){var n=t.channelId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/notifications/channels/").concat(n,"?key=").concat(r);return i.delete(l).then((function(){return Promise.resolve()})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},$r=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"NUMBER_OF_NOTIFICATIONS_TO_FETCH",10),yt(Tt(t),"FAILED_POLL_ATTEMPTS",0),yt(Tt(t),"state",{count:0}),yt(Tt(t),"timerID",void 0),yt(Tt(t),"componentDidMount",mt(ut().mark((function e(){return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t._isMounted=!0,t.props.isAlreadyMountedInDOM||t.subscribeToNotificationCount();case 2:case"end":return e.stop()}}),e)})))),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearInterval(t.timerID)})),yt(Tt(t),"getNotificationCount",(function(n){var a=n||t.state.count;return qr(ct(ct({},Ot(t.props.authentication)),{},{unacknowledged:a})).then((function(n){var a=e(n,"data.data.unacknowledged");return a&&a!==t.state.count&&(t.setState({count:a}),t.props.onNewNotification()),Promise.resolve(a)})).catch((function(e){return Promise.reject(e)}))})),yt(Tt(t),"subscribeToNotificationCount",(function(n){t._isMounted&&(t.timerID&&clearInterval(t.timerID),t.timerID=setInterval((function(){t.getNotificationCount(n).then((function(e){t.subscribeToNotificationCount(e),t.FAILED_POLL_ATTEMPTS=0})).catch((function(n){if(5===t.FAILED_POLL_ATTEMPTS){var a=new Error("There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.");throw console.error(a),t.props.onErrorCallback(a),clearInterval(t.timerID),new Error(a)}504==e(n,"response.status")?t.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){t.subscribeToNotificationCount()})),t.FAILED_POLL_ATTEMPTS+=1}))}),9e4))})),yt(Tt(t),"resetCount",(function(){Qr(ct({},Ot(t.props.authentication))).catch((function(e){console.error(e)})).finally((function(){t.setState({count:0})}))})),yt(Tt(t),"renderBadge",(function(){var e=t.props.overflowCount,n=t.state.count;if(!n)return null;if(t.props.useDot)return l.createElement("div",{className:"react-autoql-notifications-badge-dot"});var a=n;return n>e&&(a="".concat(e,"+")),l.createElement("div",{className:"react-autoql-notifications-badge"},a)})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notifications-button-container ".concat(t.props.useDot?"dot":"","\n ").concat(t.state.count?"":"no-badge"),"data-test":"notification-button",style:ct({},t.props.style),onClick:function(){t.props.clearCountOnClick&&t.resetCount()}},l.createElement(ea,{type:"notification",className:"react-autoql-notifications-button"}),t.renderBadge()))})),t}return ht(a)}();yt($r,"propTypes",{authentication:Nt,overflowCount:p.number,style:p.shape({}),size:p.number,useDot:p.bool,clearCountOnClick:p.bool,onNewNotification:p.func,onErrorCallback:p.func,isAlreadyMountedInDOM:p.bool}),yt($r,"defaultProps",{authentication:It,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},isAlreadyMountedInDOM:!1});var eo=["icon","type"],to=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{focused:!1}),yt(Tt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),yt(Tt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),yt(Tt(e),"focus",(function(){e.inputRef&&e.inputRef.focus()})),yt(Tt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var a=St(t,eo),r=a.className;return l.createElement(At,null,l.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(r," "),"data-test":"react-autoql-input"},"multi"===e.props.type?l.createElement("textarea",vt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):l.createElement(c,null,l.createElement("input",vt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&l.createElement(ea,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return ht(n)}();yt(to,"propTypes",{icon:p.string,type:p.string}),yt(to,"defaultProps",{icon:void 0,type:"single"});var no=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"autoCompleteTimer",void 0),yt(Tt(r),"state",ct({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length")}}return{}}(r.props.initialData))),yt(Tt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),yt(Tt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=ve(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),yt(Tt(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?be(e):e}]})),yt(Tt(r),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=be(e);return!Number.isNaN(Number(n))})),yt(Tt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),yt(Tt(r),"isValid",(function(){return!0})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),yt(Tt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct(ct(ct({},Ot(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var s={name:n[i]};a.push(s)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),yt(Tt(r),"renderReadOnlyRule",(function(){return l.createElement(At,null,l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},"".concat(Nn(r.state.input1Value))),l.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&l.createElement("span",{className:"read-only-rule-term"},Nn(r.state.input2Value)),r.props.andOrValue&&l.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),yt(Tt(r),"renderValidationError",(function(){return l.createElement("div",{className:"expression-term-validation-error"},l.createElement(ea,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),yt(Tt(r),"renderCompareBtn",(function(){return"EXISTS"===r.state.conditionSelectValue?l.createElement(er,{onClick:function(){r.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),yt(Tt(r),"renderConditionSelector",(function(){return l.createElement(Tr,{themeConfig:Ht(r.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:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}})})),yt(Tt(r),"renderRule",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},l.createElement("div",{className:"react-autoql-rule-first-input-container"},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})}}),!r.state.isFirstTermValid&&r.renderValidationError()),r.renderCompareBtn()),l.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},r.renderConditionSelector(),l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})}}),!r.state.isSecondTermValid&&r.renderValidationError()),l.createElement(ea,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return r.setState({conditionSelectValue:"EXISTS"})}}))))})),yt(Tt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=ve(),r.TERM_ID_2=ve();var o=t.initialData;return o&&1===o.length?(r.TERM_ID_1=o[0].id,r.TERM_ID_2=ve()):o&&o.length>1&&(r.TERM_ID_1=o[0].id,r.TERM_ID_2=o[1].id),r}return ht(a)}();yt(no,"propTypes",{authentication:Nt,themeConfig:Mt,ruleId:p.string,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool}),yt(no,"defaultProps",{authentication:It,themeConfig:Pt,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var ao=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=he(t[0].term_value[0].term_value):a=!0),{expression:n,expressionError:a}},ro=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"ruleRef",void 0),yt(Tt(t),"state",ct({},ao(t.props.expression))),yt(Tt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(t),"componentDidUpdate",(function(e,n){ge(e.expression,t.props.expression)||t.setState(ct({},ao(t.props.expression))),ge(n,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),yt(Tt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),yt(Tt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),yt(Tt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),yt(Tt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(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})),yt(Tt(t),"renderExpressionErrorMessage",(function(){return l.createElement("div",{className:"expression-error-message"},l.createElement(ea,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported."," ",l.createElement("a",{onClick:t.resetConditions},"Reset Conditions"))})),yt(Tt(t),"renderReadOnlyRule",(function(){return l.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():l.createElement(no,{themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",ve()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),yt(Tt(t),"renderRule",(function(){return l.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},l.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():l.createElement(no,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",ve()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return ht(a)}();yt(ro,"propTypes",{authentication:Nt,themeConfig:Mt,expression:p.oneOfType([p.shape({}),p.array]),readOnly:p.bool,onChange:p.func}),yt(ro,"defaultProps",{authentication:It,themeConfig:Pt,expression:void 0,readOnly:!1,onChange:function(){}}),n.extend(a);var oo=function(t){Ct(r,l.Component);var a=xt(r);function r(){var t;ft(this,r);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return yt(Tt(t=a.call.apply(a,[this].concat(i))),"COMPONENT_KEY",ve()),yt(Tt(t),"supportedDisplayTypes",[]),yt(Tt(t),"state",{ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),yt(Tt(t),"componentDidUpdate",(function(e){if(!e.activeNotificationData&&t.props.activeNotificationData){var n={data:t.props.activeNotificationData};t.supportedDisplayTypes=bn({response:n});var a=t.props.autoChartAggregations&&t.supportedDisplayTypes.includes("column")?"column":Tn(n,t.props.autoChartAggregations);t.setState({displayType:a})}})),yt(Tt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),yt(Tt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),Fr(ct({dataAlertId:n.data_alert_id},Ot(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),yt(Tt(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)})),yt(Tt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),zr(ct(ct({},Ot(t.props.authentication)),{},{notificationId:n.id})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),Hr(ct(ct({},Ot(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"changeRuleStatus",(function(e,n){Ur(ct({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Ot(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"formatTimestamp",(function(e){var t=n.unix(e).format("h:mma"),a=n.unix(e).format("MM-DD-YY"),r=n().format("MM-DD-YY"),o=n().subtract(1,"d").format("MM-DD-YY");return a===r?"Today at ".concat(t):a===o?"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)})),yt(Tt(t),"renderAlertColorStrip",(function(){return l.createElement("div",{className:"react-autoql-notification-alert-strip"})})),yt(Tt(t),"renderNotificationHeader",(function(e){return l.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},l.createElement("div",{className:"react-autoql-notification-display-name-container"},l.createElement("div",{className:"react-autoql-notification-display-name"},e.title),l.createElement("div",{className:"react-autoql-notification-description"},e.message),l.createElement("div",{className:"react-autoql-notification-timestamp"},l.createElement(ea,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?l.createElement("div",{className:"react-autoql-notification-dismiss-btn"},l.createElement(ea,{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),fe.hide()}})):l.createElement("div",{className:"react-autoql-notification-dismiss-btn"},l.createElement(ea,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),fe.hide()}})))})),yt(Tt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?l.createElement(er,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},l.createElement(ea,{type:"notification-off"})," Turn Data Alert Off"):l.createElement(er,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},l.createElement(ea,{type:"notification"})," Turn Data Alert On"):l.createElement("div",null)})),yt(Tt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?Ce(t.state.ruleDetails)?l.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):l.createElement(er,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},l.createElement(ea,{type:"edit"})," Edit Data Alert"):l.createElement("div",null)})),yt(Tt(t),"renderNotificationFooter",(function(e){return l.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),yt(Tt(t),"renderNotificationContent",(function(n){var a,r=n.data_return_query,o=Nn(r);return a=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},l.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},l.createElement("div",{className:"react-autoql-notification-details-container"},l.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},l.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?l.createElement(c,null,l.createElement("div",{className:"react-autoql-notification-query-title"},o),l.createElement(wr,{authentication:Ot(t.props.authentication),ref:function(e){return t.OUTPUT_REF=e},queryResponse:a,autoQLConfig:{enableDrilldowns:!1},themeConfig:Ht(t.props.themeConfig),displayType:t.state.displayType,autoChartAggregations:t.props.autoChartAggregations,style:{flex:"1"}})):l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null))),e(t.supportedDisplayTypes,"length")>1&&l.createElement("div",{className:"react-autoql-notification-viz-switcher"},l.createElement(Ar,{themeConfig:Ht(t.props.themeConfig),supportedDisplayTypes:t.supportedDisplayTypes,displayType:t.state.displayType,onDisplayTypeChange:function(e){return t.setState({displayType:e})},vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&l.createElement("div",{className:"react-autoql-notification-details"},l.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),l.createElement(ro,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),yt(Tt(t),"render",(function(){var e=t.props.notification;return l.createElement(At,null,l.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 ht(r)}();yt(oo,"propTypes",{authentication:Nt,themeConfig:Mt,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,onErrorCallback:p.func,autoChartAggregations:p.bool}),yt(oo,"defaultProps",{authentication:It,themeConfig:Pt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onErrorCallback:function(){}});var io=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{activeStep:t.props.initialActiveStep||0}),yt(Tt(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")),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"prevStep",(function(){t.state.activeStep>=1&&t.onStepTitleClick(t.state.activeStep-1)})),yt(Tt(t),"nextStep",(function(){var e=Number.isNaN(t.state.activeStep)?0:t.state.activeStep+1;t.onStepTitleClick(e)})),yt(Tt(t),"setStep",(function(e){t.setState({activeStep:e})})),yt(Tt(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}})),yt(Tt(t),"onStepTitleClick",(function(e,n){try{n&&n.onClick&&n.onClick(),t.autoHideTimeout&&clearTimeout(t.autoHideTimeout);var a=e,r=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(t.state.activeStep));if(r&&(r.style.height="".concat(t.getHeightOfStepContent(t.state.activeStep),"px"),setTimeout((function(){r.style.height="10px"}),0)),e!==t.state.activeStep){var o=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));o&&(o.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)}})),yt(Tt(t),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),yt(Tt(t),"render",(function(){return t.props.steps&&t.props.steps.length?l.createElement(At,null,l.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 l.createElement("div",{key:"react-autoql-steps-".concat(t.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},l.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)},l.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return t.onStepTitleClick(n,e)}},l.createElement("div",{className:"react-autoql-step-title"},e.title)),l.createElement("div",{id:"react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},l.createElement("div",{className:"react-autoql-step-subtitle"},e.subtitle||null),l.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},e.content)),l.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),t}return ht(a)}();yt(io,"propTypes",{themeConfig:Mt,steps:p.arrayOf(p.shape({})),initialActiveStep:p.number,collapsible:p.bool}),yt(io,"defaultProps",{themeConfig:Pt,steps:void 0,initialActiveStep:void 0,collapsible:!0});var so=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"renderButtonType",(function(){return l.createElement(At,null,l.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,r=t.props.value===e;return t.props.multiSelect&&(r=t.props.value.includes(e)),l.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(r?" 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},l.createElement("div",null,e))}))))})),yt(Tt(t),"renderOriginalType",(function(){return l.createElement(At,null,l.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)),l.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},l.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:a}),l.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),yt(Tt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return ht(a)}();yt(so,"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}),yt(so,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var lo=["onChange","options","selectedOption","className"],co=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),yt(Tt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),yt(Tt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=St(t,lo);return l.createElement(At,null,l.createElement(Te,vt({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 ht(n)}();yt(co,"propTypes",{onChange:p.func,options:p.arrayOf(p.shape({})),selectedOption:p.shape({})}),yt(co,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var uo=Se.tz.guess(),po=Se.tz.names().map((function(e){return{value:e,label:e}})),mo=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),yt(Tt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||uo;return po.find((function(e){return e.label===t}))})),yt(Tt(e),"render",(function(){var t=e.getSelectedOption();return l.createElement(co,{className:"react-autoql-timezone-select",options:po,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return ht(n)}();yt(mo,"propTypes",{onChange:p.func,defaultSelection:p.string}),yt(mo,"defaultProps",{onChange:function(){},defaultSelection:void 0});var fo=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}},go=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{frequencySelectValue:fo(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),yt(Tt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),yt(Tt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),yt(Tt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),yt(Tt(t),"getData",(function(){var e=t.state,n=e.frequencySelectValue,a="PERIODIC",r=null;return"Every time this happens"===n?a="CONTINUOUS":"Only once per day"===n?r="DAY":"Only once per week"===n?r="WEEK":"Only once per month"===n&&(r="MONTH"),{notificationType:a,resetPeriod:r,timezone:e.timezone}})),yt(Tt(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})),yt(Tt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),yt(Tt(t),"renderTimezoneComponent",(function(){return l.createElement("div",null,l.createElement("span",null,"Time zone: "),l.createElement(mo,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},l.createElement("div",{className:"frequency-settings-container"},l.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),l.createElement(so,{themeConfig:Ht(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})}}))),l.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return ht(a)}();yt(go,"propTypes",{themeConfig:Mt,dataAlert:p.shape({}),onChange:p.func,onCompletedChange:p.func,onErrorCallback:p.func}),yt(go,"defaultProps",{themeConfig:Pt,dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var ho=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"NEW_NOTIFICATION_MODAL_ID",ve()),yt(Tt(t),"state",{titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1}),yt(Tt(t),"componentDidMount",(function(){t.initializeFields()})),yt(Tt(t),"componentDidUpdate",(function(e,n){if(!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]})})),yt(Tt(t),"resetFields",(function(){t.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),yt(Tt(t),"initializeFields",(function(){if(Ce(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")})}})),yt(Tt(t),"createExpressionJSONFromQuery",(function(e){return[{condition:"TERMINATOR",id:ve(),term_type:"group",term_value:[{id:ve(),term_type:"group",condition:"TERMINATOR",term_value:[{id:ve(),condition:"EXISTS",term_type:"query",term_value:e}]}]}]})),yt(Tt(t),"getDataAlertData",(function(){try{var n,a=t.state,r=a.titleInput,o=a.messageInput,i=he(t.state.expressionJSON);t.expressionRef&&(i=t.expressionRef.getJSON(),n=t.expressionRef.getFirstQuery());var s={};return t.scheduleBuilderRef&&(s=t.scheduleBuilderRef.getData()),{id:e(t.props.currentDataAlert,"id"),title:r,data_return_query:n,message:o,expression:i,notification_type:s.notificationType,reset_period:s.resetPeriod,time_zone:s.timezone}}catch(e){console.error(e)}})),yt(Tt(t),"onExpressionChange",(function(e,n,a){t.setState({isExpressionSectionComplete:e,isFirstSectionComplete:t.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:a})})),yt(Tt(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})),yt(Tt(t),"onDataAlertSave",(function(){t.setState({isSavingDataAlert:!0});var e=ct(ct({},t.getDataAlertData()),{},{project_id:t.props.selectedDemoProjectId}),n=ct({dataAlert:e},Ot(t.props.authentication));t.props.isManagement?(t.props.onManagementCreateDataAlert(e),t.setState({isSavingDataAlert:!1})):e.id?Wr(ct({},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})})):Yr(ct({},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})}))})),yt(Tt(t),"validateFn",t.props.onValidate||Xr),yt(Tt(t),"validateExpression",(function(){try{if(t.setState({isValidating:!0,isExpressionValidated:!1}),t.expressionRef){var n=t.expressionRef.getJSON();t.validateFn(ct(ct({},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})}})),yt(Tt(t),"renderValidateBtn",(function(){var n;return t.expressionRef&&t.expressionRef.state.expressionError?null:l.createElement(c,null,t.state.isExpressionValidated&&t.state.isExpressionValid&&l.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},l.createElement(ea,{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&&l.createElement("div",{className:"expression-invalid-message-container"},l.createElement("span",{className:"expression-invalid-message"},l.createElement(ea,{type:"warning-triangle"}))," ",l.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},t.state.expressionError)),l.createElement(er,(yt(n={type:"default",onClick:t.validateExpression,loading:t.state.isValidating},"type","primary"),yt(n,"disabled",!t.state.titleInput||!e(t.expressionRef,"state.expression[0].term_value")),yt(n,"style",{position:"absolute",right:0}),n),"Check Alert & continue"))})),yt(Tt(t),"setStep",(function(e){t.stepsRef&&t.stepsRef.setStep(e)})),yt(Tt(t),"renderNextBtn",(function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=arguments.length>3?arguments[3]:void 0;return l.createElement(er,{className:e,onClick:function(){a(),t.stepsRef&&t.stepsRef.nextStep()},disabled:n,type:"primary"},r||"Continue")})),yt(Tt(t),"renderBackBtn",(function(e){return l.createElement(er,{className:e,onClick:function(){t.stepsRef&&t.stepsRef.prevStep()}},"Back")})),yt(Tt(t),"renderSetUpDataAlertStep",(function(){return l.createElement("div",null,l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement("p",null,"Name your Data Alert:"),l.createElement(to,{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})}})),l.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(ea,{"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"}))),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement("p",null,"Notify me when:"),l.createElement(ro,{authentication:Ot(t.props.authentication),themeConfig:Ht(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)})),l.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(ea,{"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"}))),l.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))))})),yt(Tt(t),"renderFrequencyStep",(function(){return l.createElement("div",null,l.createElement(go,{themeConfig:Ht(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}),l.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})}))))})),yt(Tt(t),"renderAlertPreferencesStep",(function(){return l.createElement("div",null,l.createElement("p",null,"Optional:"),l.createElement(to,{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})}}),l.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn")))})),yt(Tt(t),"onDataAlertDelete",(function(){var n=e(t.props.currentDataAlert,"id");n&&(t.setState({isDeletingDataAlert:!0}),Jr(n,Ot(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})})))})),yt(Tt(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})),yt(Tt(t),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),yt(Tt(t),"render",(function(){var e=t.getModalContent();return l.createElement(At,null,l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-modal-tooltip",effect:"solid",delayShow:500,html:!0}),l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),title:t.props.title,titleIcon:Ce(t.props.currentDataAlert)?l.createElement("span",null):l.createElement(ea,{type:"edit"}),ref:function(e){return t.modalRef=e},isVisible:t.props.isVisible,onClose:t.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement("div",null,t.props.currentDataAlert&&t.props.allowDelete&&l.createElement(er,{type:"danger",onClick:function(){t.setState({isConfirmDeleteModalVisible:!0})},loading:t.state.isDeletingDataAlert},"Delete Data Alert")),l.createElement("div",null,l.createElement(er,{onClick:function(){t.modalRef&&t.modalRef.onClose()}},"Cancel"),l.createElement(er,{type:"primary",loading:t.state.isSavingDataAlert,onClick:t.onDataAlertSave,disabled:t.isSaveButtonDisabled(e)},"Finish & Save")))},t.props.isVisible&&l.createElement("div",{className:"notification-modal-content"},l.createElement(io,{themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.stepsRef=e},steps:e}))),l.createElement(Nr,{isVisible:t.state.isConfirmDeleteModalVisible,onConfirm:t.onDataAlertDelete,confirmLoading:t.state.isDeletingDataAlert,onClose:function(){t.setState({isConfirmDeleteModalVisible:!1})},confirmText:"Delete",width:"450px"},l.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),l.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),t}return ht(a)}();yt(ho,"propTypes",{authentication:Nt,onErrorCallback:p.func,onSave:p.func,initialQuery:p.string,currentDataAlert:p.shape({}),isVisible:p.bool,allowDelete:p.bool,onClose:p.func,themeConfig:Mt,isManagement:p.bool,onManagementCreateDataAlert:p.func,onManagementDeleteDataAlert:p.func,title:p.string,titleIcon:p.oneOfType([p.element,p.instanceOf(ea)]),enableQueryValidation:p.bool,onValidate:p.func}),yt(ho,"defaultProps",{authentication:It,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},themeConfig:Pt,isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var yo="data:image/png;base64,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",vo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"MODAL_COMPONENT_KEY",ve()),yt(Tt(t),"NOTIFICATION_LIST_KEY",ve()),yt(Tt(t),"NOTIFICATION_FETCH_LIMIT",10),yt(Tt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0}),yt(Tt(t),"componentDidMount",(function(){t.getNotifications(),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"getNotifications",(function(n){Lr(ct(ct({},Ot(t.props.authentication)),{},{offset:t.state.nextOffset,limit:n||t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var a=he(t.state.notificationList),r=t.state.nextOffset,o=t.state.pagination;e(n,"items.length")&&(a=[].concat(wt(a),wt(n.items)),r=t.state.nextOffset+t.NOTIFICATION_FETCH_LIMIT,o=n.pagination),t.setState({notificationList:a,pagination:o,nextOffset:r,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),yt(Tt(t),"refreshNotifications",(function(){Lr(ct(ct({},Ot(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var n=t.detectNewNotifications(e.items);if(n.length)if(10===n.length)t.setState({notificationList:e.items,pagination:e.pagination});else{var a=[].concat(wt(n),wt(t.state.notificationList));t.setState({notificationList:a,pagination:ct({},e.pagination),nextOffset:a.length-1})}}))})),yt(Tt(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})),yt(Tt(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),ct(ct({},t),{},{expanded:!t.expanded})):ct(ct({},t),{},{expanded:!1})}));t.setState({notificationList:a,activeNotificationId:n})})),yt(Tt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return ct(ct({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Br(ct({},Ot(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?ct(ct({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n})})),yt(Tt(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})})),yt(Tt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),yt(Tt(t),"renderDismissAllButton",(function(){return l.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},l.createElement("span",{onClick:t.onDismissAllClick},l.createElement(ea,{type:"notification-off",style:{verticalAlign:"middle"}})," ","Dismiss All"))})),yt(Tt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),yt(Tt(t),"renderEditDataAlertModal",(function(){var e;return l.createElement(ho,(yt(e={key:t.MODAL_COMPONENT_KEY,authentication:Ot(t.props.authentication),themeConfig:Ht(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},"themeConfig",Ht(t.props.themeConfig)),yt(e,"title",t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert"),yt(e,"titleIcon",t.state.activeDataAlert?l.createElement(ea,{type:"edit"}):l.createElement("span",null)),e))})),yt(Tt(t),"render",(function(){return t.state.isFetchingFirstNotifications?l.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?l.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",l.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},l.createElement(er,{onClick:t.getInitialNotifications},"Try Again"))):l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-list-container","data-test":"notification-list"},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?l.createElement(c,null,t.renderDismissAllButton(),l.createElement(ye,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,useWindow:!1},t.state.notificationList.map((function(e,n){return l.createElement(oo,{key:"notification-item-".concat(n),authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),notification:e,onClick:t.onItemClick,onDismissCallback:t.onDismissClick,onDeleteCallback:t.onDeleteClick,onDeleteSuccessCallback:function(){t.getNotifications(1)},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()}})})))):l.createElement("div",{className:"empty-notifications-message"},l.createElement("img",{className:"empty-notifications-img",src:yo}),l.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),l.createElement("div",null,"Stay tuned!"),l.createElement("br",null),t.props.showCreateAlertBtn&&l.createElement(er,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal()))})),t}return ht(a)}();yt(vo,"propTypes",{authentication:Nt,themeConfig:Mt,onCollapseCallback:p.func,onExpandCallback:p.func,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,showCreateAlertBtn:p.bool}),yt(vo,"defaultProps",{authentication:It,themeConfig:Pt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){}});var Co=function(e){var t=n(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},bo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts(),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e,n){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig)),ge(Ot(t.props.authentication),Ot(e.authentication))||t.getDataAlerts(),ge(t.state.projectAlertsList,n.projectAlertsList)&&ge(t.state.customAlertsList,n.customAlertsList)||t.getDataAlerts()})),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1})),yt(Tt(t),"getDataAlerts",(function(n){Or(ct(ct({},Ot(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)}))})),yt(Tt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),yt(Tt(t),"onAddClick",(function(){t.setState({isEditModalVisible:!0,activeDataAlert:void 0})})),yt(Tt(t),"onDataAlertSave",(function(n){var a=wt(t.state.customAlertsList);t.state.activeDataAlert?a=t.state.customAlertsList.map((function(a){return a.id===t.state.activeDataAlert.id?e(n,"data.data",t.state.activeDataAlert):a})):e(n,"data.data")&&a.unshift(e(n,"data.data")),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1,customAlertsList:a})})),yt(Tt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),yt(Tt(t),"onEnableSwitchChange",(function(e,n){var a=e.target.checked?"ACTIVE":"INACTIVE",r="CUSTOM"===n.type?"customAlertsList":"projectAlertsList",o=he(t.state[r]),i=t.state[r].map((function(e){return n.id===e.id?ct(ct({},e),{},{status:a}):e}));t.setState(yt({},"".concat(r),i)),Ur(ct({dataAlertId:n.id,type:n.type,status:a},Ot(t.props.authentication))).catch((function(e){t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.setState(yt({},"".concat(r),o))}))})),yt(Tt(t),"renderNotificationEditModal",(function(){return l.createElement(ho,{ref:function(e){return t.editModalRef=e},themeConfig:t.props.themeConfig,key:t.COMPONENT_KEY,authentication:Ot(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?l.createElement(ea,{type:"edit"}):l.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),yt(Tt(t),"renderNotificationGroupTitle",(function(e,n,a){return l.createElement("div",{className:"react-autoql-notification-title-container"},l.createElement("div",{style:{paddingLeft:"10px"}},l.createElement("div",{style:{fontSize:"17px"}},e),l.createElement("div",{style:{fontSize:"11px",opacity:.6}},n)),a&&t.props.showCreateAlertBtn&&l.createElement("div",{className:"react-autoql-notification-add-btn",onClick:t.onAddClick,"data-tip":"Create Data Alert","data-for":"react-autoql-notification-settings-tooltip"},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon"})))})),yt(Tt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),yt(Tt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),yt(Tt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),yt(Tt(t),"renderNotificationlist",(function(n,a){return"project"!==n||e(a,"length")?l.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"),l.createElement("div",{className:"react-autoql-notification-settings-container"},a&&a.map((function(e,n){return l.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},l.createElement("div",{className:"react-autoql-notification-setting-item-header"},l.createElement("div",{className:"react-autoql-notification-setting-display-name"},l.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},l.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?l.createElement(ea,{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}):l.createElement(ea,{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)),l.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&l.createElement("span",null," - ",e.message))),l.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&l.createElement(ea,{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&&l.createElement(ea,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat(Co(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?l.createElement(l.Fragment,null,"CUSTOM"===e.type&&l.createElement(er,{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()}},l.createElement("span",{className:"react-autoql-re-initialize-btn-text"},l.createElement(ea,{type:"warning-triangle"})," Resend")),l.createElement(Ya,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):l.createElement(Ya,{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),fe.hide()}}))))})))):null})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},l.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),l.createElement("br",null),t.props.showCreateAlertBtn&&l.createElement(er,{type:"primary",onClick:t.onAddClick,style:{marginTop:"10px"}},"Create Data Alert"))})),yt(Tt(t),"render",(function(){if(!t.state.customAlertsList)return l.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},l.createElement(Ea,null));var n=e(t.state,"projectAlertsList",[]),a=e(t.state,"customAlertsList",[]);return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",a),t.renderNotificationEditModal(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return ht(a)}();yt(bo,"propTypes",{authentication:Nt,themeConfig:Mt,onErrorCallback:p.func,showCreateAlertBtn:p.bool,onSuccessAlert:p.func}),yt(bo,"defaultProps",{authentication:It,themeConfig:Pt,showCreateAlertBtn:!1,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var Eo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"autoCompleteTimer",void 0),yt(Tt(r),"state",ct({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length")}}return{}}(r.props.initialData))),yt(Tt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),yt(Tt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=ve(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),yt(Tt(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?Number(e):e}]})),yt(Tt(r),"isNumerical",(function(e){return!Number.isNaN(Number(e))})),yt(Tt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),yt(Tt(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),yt(Tt(r),"validateFirstTerm",(function(){r.props.enableQueryValidation?r.state.input1Value&&!r.state.isValidatingFirstTerm&&r.state.lastCheckedFirstTermValue!==r.state.input1Value&&(r.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:r.state.input1Value,isValidatingFirstTerm:!0}),Ir(ct({query:r.state.input1Value},Ot(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),yt(Tt(r),"validateSecondTerm",(function(){r.props.enableQueryValidation?r.state.input2Value&&Number.isNaN(Number(r.state.input2Value))?r.state.isValidatingSecondTerm||r.state.lastCheckedSecondTermValue===r.state.input2Value||(r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value,isValidatingSecondTerm:!0}),Ir(ct({query:r.state.input2Value},Ot(r.props.authentication))).then((function(){r.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){r.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value}):r.setState({isSecondTermValid:!0})})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),yt(Tt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct(ct(ct({},Ot(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var s={name:n[i]};a.push(s)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),yt(Tt(r),"renderReadOnlyRule",(function(){return l.createElement(At,null,l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},"".concat(Nn(r.state.input1Value))),l.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&l.createElement("span",{className:"read-only-rule-term"},Nn(r.state.input2Value)),r.props.andOrValue&&l.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),yt(Tt(r),"renderValidationError",(function(){return l.createElement("div",{className:"expression-term-validation-error"},l.createElement(ea,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),yt(Tt(r),"renderRule",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})},onBlur:r.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateFirstTerm()}}),!r.state.isFirstTermValid&&r.renderValidationError()),l.createElement(Tr,{themeConfig:Ht(r.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:l.createElement("span",null,"∃"),tooltip:"Exists"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}}),l.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})},onBlur:r.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateSecondTerm()}}),!r.state.isSecondTermValid&&r.renderValidationError())),l.createElement(ea,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){r.props.onDelete(r.props.ruleId)}})))})),yt(Tt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=ve(),r.TERM_ID_2=ve();var o=t.initialData;return o&&1===o.length?(r.TERM_ID_1=o[0].id,r.TERM_ID_2=ve()):o&&o.length>1&&(r.TERM_ID_1=o[0].id,r.TERM_ID_2=o[1].id),r}return ht(a)}();yt(Eo,"propTypes",{authentication:Nt,themeConfig:Mt,ruleId:p.string,onAdd:p.func,onDelete:p.func,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool,enableQueryValidation:p.bool}),yt(Eo,"defaultProps",{authentication:It,themeConfig:Pt,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var So=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,a=e.id||ve();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:ve(),type:"rule",isComplete:!1}),t={rules:n}),t},To=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"ruleRefs",[]),yt(Tt(e),"state",ct({rules:[],andOrSelectValue:"ALL"},So(e.props.initialData))),yt(Tt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),yt(Tt(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 r=e.ruleRefs[n],o=[];return r&&(o=r.getJSON()),{id:t.id||ve(),term_type:"group",condition:a,term_value:o}}))})),yt(Tt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isComplete()}))})),yt(Tt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isValid()}))})),yt(Tt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),yt(Tt(e),"onRuleUpdate",(function(t,n,a){var r=e.state.rules.map((function(e){return e.id===t?ct(ct({},e),{},{isComplete:n,termValue:a}):e}));e.setState({rules:r}),e.props.onUpdate(e.props.groupId,e.isComplete())})),yt(Tt(e),"addRule",(function(){var t=ve(),n=[].concat(wt(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),yt(Tt(e),"addGroup",(function(){var t=ve(),n=[].concat(wt(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),yt(Tt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),yt(Tt(e),"renderAllAnySelect",(function(){return l.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",l.createElement(so,{themeConfig:Ht(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:")})),yt(Tt(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:l.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},l.createElement(ea,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),yt(Tt(e),"renderAddBtn",(function(){return e.props.readOnly?null:l.createElement("div",{className:"notification-rule-btn-container"},l.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),yt(Tt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return l.createElement(At,null,l.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&l.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&&l.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")),l.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?l.createElement(Eo,{authentication:Ot(e.props.authentication),themeConfig:Ht(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?l.createElement(n,{authentication:Ot(e.props.authentication),themeConfig:Ht(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())))})),yt(Tt(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"),l.createElement(At,null,l.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,r){return"rule"===t.type?l.createElement(Eo,{key:"rule-readonly-".concat(t.id),ref:function(t){return e.ruleRefs[r]=t},ruleId:t.id,initialData:t.termValue,andOrValue:r!==e.state.rules.length-1?a:null,enableQueryValidation:!1,readOnly:!0}):"group"===t.type?l.createElement("div",{key:"group-".concat(t.id)},l.createElement(n,{authentication:Ot(e.props.authentication),themeConfig:Ht(e.props.themeConfig),groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),r!==e.state.rules.length-1&&l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},a))):void 0}))))})),yt(Tt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return ht(n)}();yt(To,"propTypes",{authentication:Nt,themeConfig:Mt,groupId:p.string,onDelete:p.func,onUpdate:p.func,disableAddGroupBtn:p.bool,hideTopCondition:p.bool,readOnly:p.bool,enableQueryValidation:p.bool}),yt(To,"defaultProps",{authentication:It,themeConfig:Pt,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Do=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:ve(),isComplete:!1}),n={groups:a}),n},xo=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),yt(Tt(e),"state",ct({groups:[],andOrValue:"ALL"},Do(e.props.expression))),yt(Tt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(e),"componentDidUpdate",(function(t,n){ge(t.expression,e.props.expression)||e.setState(ct({},Do(e.props.expression))),ge(n,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isComplete()}))})),yt(Tt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isValid()}))})),yt(Tt(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 r=e.groupRefs[n],o=[];return r&&(o=r.getJSON()),{id:t.id||ve(),term_type:"group",condition:a,term_value:o}}))})),yt(Tt(e),"addGroup",(function(t){var n=t.initialData,a=t.isComplete,r=t.id||ve(),o=[].concat(wt(e.state.groups),[{initialData:n,isComplete:a,id:r}]);e.setState({groups:o})})),yt(Tt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),yt(Tt(e),"getAndOrValue",(function(){return e.state.andOrValue})),yt(Tt(e),"onGroupUpdate",(function(t,n){var a=e.state.groups.map((function(e){return e.id===t?ct(ct({},e),{},{isComplete:n}):e}));e.setState({groups:a}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(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"),l.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(a,r){return l.createElement("div",{key:"expression-group-readonly-".concat(a.id,"-").concat(r)},l.createElement(To,{themeConfig:Ht(e.props.themeConfig),ref:function(t){return e.groupRefs[r]=t},groupId:a.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===r,topCondition:e.state.andOrValue,onlyGroup:t,initialData:a.initialData,readOnly:e.props.readOnly,enableQueryValidation:!1}),r!==e.state.groups.length-1&&l.createElement("div",{style:{textAlign:"center",margin:"2px"}},l.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),yt(Tt(e),"renderRules",(function(){var t=e.state.groups.length<=1;return l.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&l.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",l.createElement(so,{themeConfig:Ht(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:"),l.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,a){return l.createElement(To,{authentication:Ot(e.props.authentication),themeConfig:Ht(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&&l.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return ht(n)}();yt(xo,"propTypes",{authentication:Nt,themeConfig:Mt,expression:p.arrayOf(p.shape({})),readOnly:p.bool,onChange:p.func}),yt(xo,"defaultProps",{authentication:It,themeConfig:Pt,expression:void 0,readOnly:!1,onChange:function(){}});var wo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",yt({themeConfig:Pt,channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),yt(Tt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),yt(Tt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),Pr(ct(ct({},Ot(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})}))})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{className:"slack-modal-empty-list-message"},l.createElement("div",null,"You don't have any ",l.createElement(ea,{type:"slack"})," Slack channels connected yet."),l.createElement(er,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},l.createElement(ea,{type:"plus"})," Connect a Channel"))})),yt(Tt(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)}})),yt(Tt(t),"getVizType",(function(){return mn(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),yt(Tt(t),"sendDataToSlack",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Kr(ct(ct({},Ot(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())})),yt(Tt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Zr(ct(ct({},Ot(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=he(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),yt(Tt(t),"renderRemoveChannelBtn",(function(){return l.createElement(Ee,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:l.createElement("div",{className:"remove-channel-popover"},l.createElement("div",{className:"react-autoql-confirm-text"},l.createElement(ea,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),l.createElement(er,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},l.createElement(ea,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),yt(Tt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,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:l.createElement("span",null,l.createElement(ea,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return l.createElement("div",{className:"slack-channel-list-container"},l.createElement("div",{className:"slack-channel-list"},l.createElement("div",null,"AutoQL will post an email to the selected Slack channel with the"," ",n," attached."),l.createElement("br",null),l.createElement("div",{className:"select-channel-titles"},"Post to:"," ",l.createElement(Tr,{themeConfig:Ht(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())))})),yt(Tt(t),"renderFetchErrorMessage",(function(){return l.createElement("div",{className:"slack-modal-error-container"},l.createElement("div",null,In.GENERAL_HTML),l.createElement(er,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),yt(Tt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),jr(ct(ct({},Ot(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(wt(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})}))})),yt(Tt(t),"renderConnectChannelPage",(function(){return l.createElement("div",{className:"connect-channel-form-container"},l.createElement("div",{className:"connect-channel-form"},l.createElement("div",{className:"connect-channel-title"},"Connect a Slack Channel"),l.createElement(ea,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),l.createElement("div",null,"Channel Name"),l.createElement(to,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),l.createElement("div",null,"Channel Email Address"," ",l.createElement(Ee,{isOpen:t.state.isSlackEmailInstructionVisible,onClickOutside:function(){return t.setState({isSlackEmailInstructionVisible:!1})},position:"top",content:l.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},l.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isSlackEmailInstructionVisible:!0})}},l.createElement(ea,{type:"question"})," How do I find this?"))),l.createElement(to,{placeholder:"e.g. 1234@slack.com",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),l.createElement("div",null,"Your Name"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Slack)")),l.createElement(to,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),l.createElement("div",null,"Your Email"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Slack)")),l.createElement(to,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),l.createElement("div",{className:"connect-channel-btn"},l.createElement(er,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),yt(Tt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),yt(Tt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?l.createElement("div",null,l.createElement(er,{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},l.createElement(ea,{type:"send"})," Send to Slack")):null})),t}return ht(a,[{key:"render",value:function(){return l.createElement(Rr,{themeConfig:Ht(this.props.themeConfig),isVisible:this.props.isVisible,onClose:this.props.onClose,title:l.createElement("span",null,"Send to ",l.createElement(ea,{type:"slack"})," Slack"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();yt(wo,"propTypes",{themeConfig:Mt,authentication:Nt,isVisible:p.bool}),yt(wo,"defaultProps",{authentication:It,isVisible:!1});var ko=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",yt({channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),yt(Tt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),yt(Tt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),Pr(ct(ct({},Ot(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})}))})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{className:"slack-modal-empty-list-message"},l.createElement("div",null,"You don't have any ",l.createElement(ea,{type:"teams"})," Teams channels connected yet."),l.createElement(er,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},l.createElement(ea,{type:"plus"})," Connect a Channel"))})),yt(Tt(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)}})),yt(Tt(t),"getVizType",(function(){return mn(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),yt(Tt(t),"sendDataToTeams",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Kr(ct(ct({},Ot(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())})),yt(Tt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Zr(ct(ct({},Ot(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=he(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),yt(Tt(t),"renderRemoveChannelBtn",(function(){return l.createElement(Ee,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:l.createElement("div",{className:"remove-channel-popover"},l.createElement("div",{className:"react-autoql-confirm-text"},l.createElement(ea,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),l.createElement(er,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},l.createElement(ea,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),yt(Tt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,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:l.createElement("span",null,l.createElement(ea,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return l.createElement("div",{className:"slack-channel-list-container"},l.createElement("div",{className:"slack-channel-list"},l.createElement("div",null,"AutoQL will post an email to the selected Teams channel with the"," ",n," attached."),l.createElement("br",null),l.createElement("div",{className:"select-channel-titles"},"Post to:"," ",l.createElement(Tr,{themeConfig:Ht(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())))})),yt(Tt(t),"renderFetchErrorMessage",(function(){return l.createElement("div",{className:"slack-modal-error-container"},l.createElement("div",null,In.GENERAL_HTML),l.createElement(er,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),yt(Tt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),jr(ct(ct({},Ot(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(wt(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})}))})),yt(Tt(t),"renderConnectChannelPage",(function(){return l.createElement("div",{className:"connect-channel-form-container"},l.createElement("div",{className:"connect-channel-form"},l.createElement("div",{className:"connect-channel-title"},"Connect a Teams Channel"),l.createElement(ea,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),l.createElement("div",null,"Channel Name"),l.createElement(to,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),l.createElement("div",null,"Channel Email Address"," ",l.createElement(Ee,{isOpen:t.state.isTeamsEmailInstructionVisible,onClickOutside:function(){return t.setState({isTeamsEmailInstructionVisible:!1})},position:"top",content:l.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},l.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isTeamsEmailInstructionVisible:!0})}},l.createElement(ea,{type:"question"})," How do I find this?"))),l.createElement(to,{placeholder:"e.g. 1234@amer.teams.ms",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),l.createElement("div",null,"Your Name"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Teams)")),l.createElement(to,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),l.createElement("div",null,"Your Email"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Teams)")),l.createElement(to,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),l.createElement("div",{className:"connect-channel-btn"},l.createElement(er,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),yt(Tt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),yt(Tt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?l.createElement("div",null,l.createElement(er,{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},l.createElement(ea,{type:"send"})," Send to Teams")):null})),t}return ht(a,[{key:"render",value:function(){return l.createElement(Rr,{themeConfig:Ht(this.props.themeConfig),isVisible:this.props.isVisible,onClose:this.props.onClose,title:l.createElement("span",null,"Send to ",l.createElement(ea,{type:"teams"})," Teams"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();yt(ko,"propTypes",{authentication:Nt,themeConfig:Mt,isVisible:p.bool}),yt(ko,"defaultProps",{authentication:It,themeConfig:Pt,isVisible:!1});var Ao,No=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",{isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e,n){"sql"===n.activeMenu&&"sql"!==t.state.activeMenu&&t.setState({sqlCopySuccess:!1}),ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearTimeout(t.temporaryStateTimeout),clearTimeout(t.pivotTableCSVDownloadTimeout)})),yt(Tt(t),"onTableFilter",(function(n){"table"===e(t.props.responseRef,"props.displayType")&&t.setState({disableChartingOptions:e(n,"length")<2})})),yt(Tt(t),"toggleTableFilter",(function(){t.filtering=!t.filtering,t.props.onFilterClick({isFilteringTable:t.filtering})})),yt(Tt(t),"setTemporaryState",(function(e,n,a){t.setState(yt({},e,n)),t.temporaryStateTimeout=setTimeout((function(){t.setState(yt({},e,void 0))}),a)})),yt(Tt(t),"copyTableToClipboard",(function(){t.props.responseRef?(t.props.responseRef.copyTableToClipboard(),t.props.onSuccessAlert("Successfully copied table to clipboard!"),t.setTemporaryState("copiedTable",!0,1e3),fe.hide()):t.setTemporaryState("copiedTable",!1,1e3)})),yt(Tt(t),"fetchCSVAndExport",(function(){var n,a,r,o,i,s,l,c,u=null===(n=t.props.responseRef)||void 0===n||null===(a=n.queryResponse)||void 0===a||null===(r=a.data)||void 0===r||null===(o=r.data)||void 0===o?void 0:o.query_id,p=null===(i=t.props.responseRef)||void 0===i||null===(s=i.queryResponse)||void 0===s||null===(l=s.data)||void 0===l||null===(c=l.data)||void 0===c?void 0:c.text,d=ve();t.props.onCSVDownloadStart({id:d,queryId:u,query:p}),ua(ct(ct({queryId:u},Ot(t.props.authentication)),{},{csvProgressCallback:function(e){return t.props.onCSVDownloadProgress({id:d,progress:e})}})).then((function(n){var a=window.URL.createObjectURL(new Blob([n.data])),r=document.createElement("a");r.href=a,r.setAttribute("download","export.csv"),document.body.appendChild(r),r.click();var o=e(n,"headers.content-length")/1e6,i=e(n,"headers.total_rows"),s=e(n,"headers.returned_rows"),l=e(n,"headers.export_limit");o=parseInt(o),l=parseInt(l),i=parseInt(i),s=parseInt(s),t.props.onCSVDownloadFinish({id:d,fileSizeMb:o,exportLimit:l,totalRows:i,returnedRows:s})})).catch((function(e){t.props.onCSVDownloadFinish({id:d,error:e}),console.error(e)}))})),yt(Tt(t),"onCSVMenuButtonClick",(function(){t.setState({activeMenu:void 0});var n="pivot_table"===e(t.props.responseRef,"props.displayType"),a=ve();n?e(t.props,"responseRef.pivotTableRef._isMounted")&&(t.props.onCSVDownloadStart({id:a}),t.pivotTableCSVDownloadTimeout=setTimeout((function(){t.props.responseRef.pivotTableRef.saveAsCSV().then((function(){t.props.onCSVDownloadProgress({id:a,progress:100}),t.props.onCSVDownloadFinish({id:a})}))}),2e3)):t.fetchCSVAndExport()})),yt(Tt(t),"saveChartAsPNG",(function(){t.props.responseRef&&t.props.responseRef.saveChartAsPNG()})),yt(Tt(t),"deleteMessage",(function(){fe.hide(),t.props.deleteMessageCallback()})),yt(Tt(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}),fe.hide()})),yt(Tt(t),"showHideColumnsModal",(function(){t.setState({isHideColumnsModalVisible:!0})})),yt(Tt(t),"onColumnVisibilitySave",(function(e){var n=t.props.authentication,a=e.map((function(e){var t=ct(ct({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));t.setState({isSettingColumnVisibility:!0}),ha(ct(ct({},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})}))})),yt(Tt(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 ct(ct({},e),{},{content:e.display_name,checked:e.is_visible})}));return l.createElement(At,null,l.createElement(Vr,{themeConfig:Ht(t.props.themeConfig),columns:a,isVisible:t.state.isHideColumnsModalVisible,onClose:function(){return t.setState({isHideColumnsModalVisible:!1})},isSettingColumns:t.state.isSettingColumnVisibility,onConfirm:t.onColumnVisibilitySave}))})),yt(Tt(t),"renderDataAlertModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.text");return l.createElement(At,null,l.createElement(ho,{authentication:Ot(t.props.authentication),themeConfig:Ht(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})}}))})),yt(Tt(t),"renderReportProblemModal",(function(){return l.createElement(At,null,l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),isVisible:"other-problem"===t.state.activeMenu,onClose:function(){t.setState({activeMenu:void 0,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:",l.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}})))})),yt(Tt(t),"reportQueryProblem",(function(n){var a=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),va(ct({message:n,queryId:a},Ot(t.props.authentication))).then((function(){t.props.onSuccessAlert("Thank you for your feedback."),t._isMounted&&t.setState({activeMenu:void 0,isReportingProblem:!1})})).catch((function(e){t.props.onErrorCallback(e),t._isMounted&&t.setState({isReportingProblem:!1})}))})),yt(Tt(t),"renderReportProblemMenu",(function(){return l.createElement("div",{className:"report-problem-menu"},l.createElement("ul",{className:"context-menu-list"},l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incorrect")}},"The data is incorrect"),l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incomplete")}},"The data is incomplete"),l.createElement("li",{onClick:function(){return t.setState({activeMenu:"other-problem"})}},"Other...")))})),yt(Tt(t),"renderMoreOptionsMenu",(function(e,n){return l.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},l.createElement("ul",{className:"context-menu-list"},n.showSaveAsCSVButton&&l.createElement("li",{onClick:t.onCSVMenuButtonClick,style:t.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},l.createElement(ea,{type:"download",style:{marginRight:"7px"}}),t.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),n.showSaveAsPNGButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.saveChartAsPNG()}},l.createElement(ea,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),n.showCopyButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.copyTableToClipboard()}},l.createElement(ea,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),n.showSQLButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"sql"})}},l.createElement(ea,{type:"database"})," View generated SQL"),n.showCreateNotificationIcon&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"notification"})}},l.createElement(ea,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert..."),n.showShareToSlackButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"slack"})}},l.createElement(ea,{style:{marginRight:"5px"},type:"slack"}),"Send to Slack..."),n.showShareToTeamsButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"teams"})}},l.createElement(ea,{style:{display:"inline-block",marginRight:"5px",marginTop:"-2px"},type:"teams"}),"Send to Teams...")))})),yt(Tt(t),"isDrilldownResponse",(function(){try{return"Drilldown:"===e(t.props.responseRef,"queryResponse.data.data.text").split(" ")[0]}catch(e){return!1}})),yt(Tt(t),"renderSendToSlackModal",(function(){return Qt(t.props.autoQLConfig).enableSlackSharing?l.createElement(wo,{themeConfig:Ht(t.props.themeConfig),authentication:Ot(t.props.authentication),isVisible:"slack"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),yt(Tt(t),"renderSendToTeamsModal",(function(){return Qt(t.props.autoQLConfig).enableTeamsSharing?l.createElement(ko,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),isVisible:"teams"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),yt(Tt(t),"renderSQLModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql[0]");return n?l.createElement(At,null,l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),isVisible:"sql"===t.state.activeMenu,footer:l.createElement("div",null,l.createElement(er,{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"},l.createElement("div",{className:"copy-sql-modal-content"},l.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(Ze(n)),disabled:!0}),l.createElement(er,{className:"copy-sql-btn ".concat(t.state.sqlCopySuccess?"sql-copied":""),onClick:t.copySQL,tooltip:"Copy to Clipboard"},l.createElement(ea,{type:"copy"}),t.state.sqlCopySuccess&&l.createElement(ea,{type:"check",className:"sql-copied"}))))):null})),yt(Tt(t),"renderToolbar",(function(e){return l.createElement(At,null,l.createElement("div",{className:"autoql-options-toolbar\n ".concat(t.state.activeMenu?"active":"","\n ").concat(t.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&l.createElement("button",{onClick:t.toggleTableFilter,className:"react-autoql-toolbar-btn","data-tip":"Filter table","data-for":"react-autoql-toolbar-btn-tooltip"},l.createElement(ea,{type:"filter"})),e.showHideColumnsButton&&l.createElement("button",{onClick:t.showHideColumnsModal,className:"react-autoql-toolbar-btn","data-tip":"Show/hide columns","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"options-toolbar-col-vis"},l.createElement(ea,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&l.createElement(Ee,{key:ve(),isOpen:"report-problem"===t.state.activeMenu,padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},position:"bottom",content:function(e){return t.renderReportProblemMenu(e)}},l.createElement("button",{onClick:function(){t.setState({activeMenu:"report-problem"})},className:"react-autoql-toolbar-btn","data-tip":"Report a problem","data-for":"react-autoql-toolbar-btn-tooltip"},l.createElement(ea,{type:"warning-triangle"}))),e.showDeleteButton&&l.createElement("button",{onClick:t.deleteMessage,className:"react-autoql-toolbar-btn","data-tip":"Delete data response","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"options-toolbar-trash-btn"},l.createElement(ea,{type:"trash"})),e.showMoreOptionsButton&&l.createElement(Ee,{key:ve(),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)}},l.createElement("button",{onClick:function(){fe.hide(),t.setState({activeMenu:"more-options"})},className:"react-autoql-toolbar-btn","data-tip":"More options","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"react-autoql-toolbar-more-options-btn"},l.createElement(ea,{type:"more-vertical"})))))})),yt(Tt(t),"getShouldShouldButtonObj",(function(){var n={};try{var a=e(t.props.responseRef,"props.displayType"),r=fn(a),o=mn(a),i=e(t.props.responseRef,"queryResponse"),s="data"===e(i,"data.data.display_type"),l=Cn(i),c=vn(i),u=e(i,"data.data.rows.length"),p=u>0,d=u>1,m=Qt(t.props.autoQLConfig);(n={showFilterButton:r&&!l&&d,showCopyButton:r&&!l,showSaveAsPNGButton:o,showHideColumnsButton:m.enableColumnVisibilityManager&&p&&("table"===a||"text"===a&&l),showHiddenColsBadge:c,showSQLButton:s&&m.debug,showSaveAsCSVButton:r&&d&&m.enableCSVDownload,showDeleteButton:t.props.enableDeleteBtn,showReportProblemButton:!!e(i,"data.data.query_id"),showCreateNotificationIcon:s&&m.enableNotifications&&!t.isDrilldownResponse(),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})),yt(Tt(t),"render",(function(){var e=t.getShouldShouldButtonObj();return Object.values(e).find((function(e){return!0===e}))?l.createElement(At,null,t.renderToolbar(e),e.showHideColumnsButton&&t.renderHideColumnsModal(),e.showReportProblemButton&&t.renderReportProblemModal(),e.showMoreOptionsButton&&t.renderDataAlertModal(),e.showSQLButton&&t.renderSQLModal()):null})),t}return ht(a)}();yt(No,"propTypes",{authentication:Nt,autoQLConfig:Vt,themeConfig:Mt,responseRef:p.instanceOf(wr),enableDeleteBtn:p.bool,onSuccessAlert:p.func,onErrorCallback:p.func,onNewNotificationCallback:p.func,deleteMessageCallback:p.func,onResponseCallback:p.func,onFilterClick:p.func,onCSVDownloadStart:p.func,onCSVDownloadFinish:p.func,onCSVDownloadProgress:p.func}),yt(No,"defaultProps",{authentication:It,autoQLConfig:Lt,themeConfig:Pt,responseRef:void 0,enableDeleteBtn:!1,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},onFilterClick:function(){},onColumnVisibilitySave:function(){},onResponseCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var Ro=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.scrollToBottomTimeout=setTimeout((function(){r.props.scrollToBottom()}),100),clearTimeout(r.animationTimeout),r.animationTimeout=setTimeout((function(){r.setState({isAnimatingMessageBubble:!1}),r.props.scrollToBottom()}),500),r.calculatedQueryOutputStyle=e(r.responseRef,"style"),r.calculatedQueryOutputHeight=e(r.responseRef,"offsetHeight")})),yt(Tt(r),"shouldComponentUpdate",(function(e){return!r.props.isResizing||!e.isResizing})),yt(Tt(r),"componentDidUpdate",(function(e,t){fe.hide()})),yt(Tt(r),"componentWillUnmount",(function(){clearTimeout(r.scrollToBottomTimeout),clearTimeout(r.scrollIntoViewTimeout),clearTimeout(r.animationTimeout)})),yt(Tt(r),"onCSVDownloadFinish",(function(e){var t=e.error,n=e.exportLimit,a=e.totalRows,o=e.returnedRows;if(t)return r.props.addMessageToDM({response:t});r.props.addMessageToDM({content:l.createElement(l.Fragment,null,"Your file has successfully been downloaded with the query"," ",l.createElement("b",null,l.createElement("i",null,r.props.queryText)),".",a&&o&&a>o?l.createElement(l.Fragment,null,l.createElement("br",null),l.createElement("p",null,l.createElement("br",null),"WARNING: The file you’ve requested is larger than ",n,"MB. This exceeds the maximum download size and you will only receive partial data.")):null)})})),yt(Tt(r),"isScrolledIntoView",(function(e){if(r.props.scrollContainerRef){var t=r.props.scrollContainerRef.getScrollTop(),n=t+r.props.scrollContainerRef.getClientHeight(),a=e.offsetTop;return a+e.offsetHeight<=n&&a>=t}return!1})),yt(Tt(r),"scrollIntoView",(function(){clearTimeout(r.scrollIntoViewTimeout),r.scrollIntoViewTimeout=setTimeout((function(){r.messageContainerRef&&!r.isScrolledIntoView(r.messageContainerRef)&&(r.scrollIntoViewTimer=r.messageContainerRef.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"}))}),0)})),yt(Tt(r),"switchView",(function(e){r.filtering=!1,r.setState({displayType:e},r.scrollIntoView)})),yt(Tt(r),"updateDataConfig",(function(e){r.setState({dataConfig:e})})),yt(Tt(r),"onSupportedDisplayTypesChange",(function(e){r.setState({supportedDisplayTypes:e})})),yt(Tt(r),"renderCSVProgressMessage",(function(){return isNaN(r.state.csvDownloadProgress)?l.createElement("div",null,"Fetching your file ",l.createElement(Ja,null)):"Downloading your file ... ".concat(r.state.csvDownloadProgress,"%")})),yt(Tt(r),"renderContent",(function(){return r.props.isCSVProgressMessage||void 0!==r.state.csvDownloadProgress?r.renderCSVProgressMessage():r.props.content?r.props.content:401===e(r.props.response,"status")?In.UNAUTHENTICATED:r.props.response?l.createElement(c,null,l.createElement(wr,{ref:function(e){return r.responseRef=e},authentication:Ot(r.props.authentication),autoQLConfig:Qt(r.props.autoQLConfig),queryResponse:r.props.response,displayType:r.state.displayType,onSuggestionClick:r.props.onSuggestionClick,isQueryRunning:r.props.isChataThinking,themeConfig:Ht(r.props.themeConfig),copyToClipboard:r.copyToClipboard,tableOptions:r.props.tableOptions,dataFormatting:Ft(r.props.dataFormatting),appliedFilters:r.props.appliedFilters,onUpdate:r.props.onQueryOutputUpdate,onDrilldownStart:r.props.onDrilldownStart,onDrilldownEnd:r.props.onDrilldownEnd,demo:Ot(r.props.authentication).demo,onSupportedDisplayTypesChange:r.onSupportedDisplayTypesChange,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),renderTooltips:!1,onErrorCallback:r.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isResizing:r.props.isResizing||!r.props.isDataMessengerOpen,isAnimatingContainer:r.state.isAnimatingMessageBubble,enableDynamicCharting:r.props.enableDynamicCharting,tableConfig:r.state.dataConfig,onTableConfigChange:r.updateDataConfig,optionsToolbarRef:r.optionsToolbarRef,onNoneOfTheseClick:r.props.onNoneOfTheseClick,autoChartAggregations:r.props.autoChartAggregations,enableQueryInterpretation:r.props.enableQueryInterpretation,showQueryInterpretation:!0,onRecommendedDisplayType:r.switchView,enableFilterLocking:r.props.enableFilterLocking,onRTValueLabelClick:r.props.onRTValueLabelClick,reportProblemCallback:function(){var e;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&r.optionsToolbarRef.setState({activeMenu:"other-problem"})}})):In.GENERAL_QUERY})),yt(Tt(r),"toggleTableFilter",(function(e){var t=e.isFilteringTable;r.responseRef&&r.responseRef.toggleTableFilter({isFilteringTable:t})})),yt(Tt(r),"onCSVDownloadStart",(function(e){var t=e.id,n=e.queryId,a=e.query;r.props.addMessageToDM({id:t,query:a,queryId:n,isCSVProgressMessage:!0})})),yt(Tt(r),"renderRightToolbar",(function(){return r.props.isResponse&&"help"!==r.state.displayType&&"suggestion"!==r.state.displayType?l.createElement(No,{ref:function(e){return r.optionsToolbarRef=e},className:"chat-message-toolbar right",authentication:r.props.authentication,autoQLConfig:Qt(r.props.autoQLConfig),themeConfig:Ht(r.props.themeConfig),responseRef:r.responseRef,displayType:r.state.displayType,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadFinish:r.onCSVDownloadFinish,onCSVDownloadProgress:r.props.onCSVDownloadProgress,onSuccessAlert:r.props.onSuccessAlert,onErrorCallback:r.props.onErrorCallback,enableDeleteBtn:!r.props.isIntroMessage,deleteMessageCallback:function(){return r.props.deleteMessageCallback(r.props.id)},onFilterClick:r.toggleTableFilter,onResponseCallback:r.props.onResponseCallback}):null})),yt(Tt(r),"onDisplayTypeChange",(function(e){var t;r.toggleTableFilter({isFilteringTable:!1}),null!==(t=r.optionsToolbarRef)&&void 0!==t&&t._isMounted&&(r.optionsToolbarRef.filtering=!1),r.switchView(e)})),yt(Tt(r),"renderLeftToolbar",(function(){var e=r.state.displayType;return r.state.supportedDisplayTypes&&!r.state.supportedDisplayTypes.includes(r.state.displayType)&&(e="table"),r.props.isResponse&&"text"!==r.props.type?l.createElement(Ar,{themeConfig:Ht(r.props.themeConfig),className:"chat-message-toolbar left",supportedDisplayTypes:r.state.supportedDisplayTypes||[],displayType:e,onDisplayTypeChange:r.onDisplayTypeChange,disableCharts:r.state.disableChartingOptions}):null})),yt(Tt(r),"render",(function(){return l.createElement(At,null,l.createElement("div",{id:"message-".concat(r.props.id),ref:function(e){return r.messageContainerRef=e},"data-test":"chat-message",className:"chat-single-message-container\n ".concat(r.props.isResponse?" response":" request","\n ")},l.createElement("div",{ref:function(e){return r.ref=e},className:"chat-message-bubble\n ".concat(mn(r.state.displayType)?" full-width":"","\n ").concat("text"===r.props.type?" text":"","\n ").concat(r.state.displayType,"\n ").concat(r.props.isActive?" active":"")},r.renderContent(),r.props.isDataMessengerOpen&&!r.props.isResizing&&l.createElement(c,null,r.renderRightToolbar(),r.renderLeftToolbar()))))})),r.filtering=!1,r.PIE_CHART_HEIGHT=330,r.MESSAGE_HEIGHT_MARGINS=40,r.MESSAGE_WIDTH_MARGINS=40,r.ORIGINAL_TABLE_MESSAGE_HEIGHT=void 0;var o=Tn(t.response,t.autoChartAggregations);return r.state=yt({csvDownloadProgress:r.props.initialCSVDownloadProgress,displayType:Tn(t.response,t.autoChartAggregations),supportedDisplayTypes:bn({response:t.response}),isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},"displayType",o),r}return ht(a)}();yt(Ro,"propTypes",(yt(Ao={authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,isResponse:p.bool.isRequired,isIntroMessage:p.bool,isDataMessengerOpen:p.bool,setActiveMessage:p.func,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({})]),tableOptions:p.shape({}),enableColumnVisibilityManager:p.bool},"dataFormatting",Rt),yt(Ao,"onErrorCallback",p.func),yt(Ao,"onSuccessAlert",p.func),yt(Ao,"isResizing",p.bool),yt(Ao,"enableDynamicCharting",p.bool),yt(Ao,"scrollToBottom",p.func),yt(Ao,"onNoneOfTheseClick",p.func),yt(Ao,"autoChartAggregations",p.bool),yt(Ao,"onConditionClickCallback",p.func),yt(Ao,"onResponseCallback",p.func),yt(Ao,"addMessageToDM",p.func),yt(Ao,"csvDownloadProgress",p.number),yt(Ao,"onRTValueLabelClick",p.func),yt(Ao,"messageContainerHeight",p.number),yt(Ao,"messageContainerWidth",p.number),Ao)),yt(Ro,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,isDataMessengerOpen:!1,isIntroMessage:!1,displayType:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,tableOptions:void 0,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,messageContainerHeight:void 0,messageContainerWidth:void 0,onSuggestionClick:function(){},setActiveMessage:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},onResponseCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){},onRTValueLabelClick:function(){}});var Vo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"renderQueryTipsContent",(function(){return t.props.queryTipsQueryValidationResponse?l.createElement(Dr,{themeConfig:Ht(t.props.themeConfig),response:t.props.queryTipsQueryValidationResponse,onSuggestionClick:t.props.onQueryValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"}):t.props.queryTipsList?0===e(t.props.queryTipsList,"length")?l.createElement("div",{className:"query-tips-result-placeholder"},l.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):l.createElement(c,null,l.createElement("div",{className:"query-tip-list-container"},t.props.queryTipsList.map((function(e,n){return l.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return t.props.executeQuery(e)},key:"query-tip-".concat(n),style:{display:"block"}},e)}))),l.createElement("div",{id:"react-paginate",className:"animated-item"},l.createElement(et,{pageCount:t.props.totalPages,pageRangeDisplayed:1,forcePage:t.props.currentPage-1,marginPagesDisplayed:2,containerClassName:"pagination",subContainerClassName:"pages pagination",previousLabel:"←",nextLabel:"→",onPageChange:t.props.onPageChange,nextClassName:"pagination-next",previousClassName:"pagination-previous"}))):l.createElement("div",{className:"query-tips-result-placeholder"},l.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),l.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger."))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement($e,{ref:function(e){t.queryTipsScrollComponent=e}},l.createElement("div",{ref:t.props.queryTipsPageRef,className:"query-tips-page-container","data-test":"query-tips-tab"},l.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},l.createElement("input",{className:"react-autoql-chatbar-input left-padding",placeholder:"Search relevant queries by topic",value:t.props.queryTipsInputValue,onChange:t.props.onQueryTipsInputKeyPress,onKeyPress:t.props.onQueryTipsInputKeyPress,ref:function(e){return t.queryTipsInputRef=e},autoFocus:!0}),l.createElement("div",{className:"chat-bar-input-icon"},l.createElement(ea,{type:"search",style:{width:"19px",height:"20px",color:"#999"}})),t.props.loading&&l.createElement("div",{className:"chat-bar-loading-spinner"},l.createElement(Ja,{style:{width:"19px",height:"20px",color:"#999"}}))),l.createElement("div",{className:"query-tips-result-container"},t.renderQueryTipsContent()))))})),t}return ht(a)}();yt(Vo,"propTypes",{themeConfig:Mt,onQueryTipsInputKeyPress:p.func,loading:p.bool,error:p.bool,queryTipsList:p.array,executeQuery:p.func}),yt(Vo,"defaultProps",{themeConfig:Pt,loading:!1,error:!1,queryTipsList:void 0,executeQuery:function(){},onQueryTipsInputKeyPress:function(){}});var Mo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_ID",ve()),yt(Tt(t),"state",{activeKeys:[],optionsArray:[{options:t.props.options}]}),yt(Tt(t),"renderOptionsList",(function(n){var a=n.options,r=n.active,o=n.index,i=o===e(t.state.optionsArray,"length",0)-1,s=0===o,u=e(t.state.mostRecentOption,"label"),p=a.every((function(e){return!e.children}));return l.createElement("div",{key:"options-list-".concat(o,"-").concat(t.COMPONENT_ID),className:"options-container\n ".concat(i?"visible":"hidden"),"data-test":"options-list-".concat(o)},!s&&l.createElement(c,null,l.createElement("div",{className:"cascader-back-arrow","data-test":"cascader-back-arrow-".concat(o),onClick:function(){var e=wt(t.state.optionsArray);e.pop(),t.setState({optionsArray:e})}},l.createElement(ea,{type:"caret-left"})),l.createElement("div",{className:"options-title","data-test":"options-title"},u)),a.map((function(n,a){return l.createElement("div",{key:"options-".concat(a,"-").concat(t.COMPONENT_ID),className:"option\n ".concat(n.value===r?"active":""),onClick:function(){return t.onOptionClick(n,o)},"data-test":"options-item-".concat(o,"-").concat(a)},l.createElement("span",{"data-test":"options-item-".concat(o,"-").concat(a,"-text")},n.label),!e(n,"children.length")&&l.createElement(ea,{className:"option-execute-icon",type:"play"}),!!e(n,"children.length")&&l.createElement(ea,{className:"option-arrow",type:"caret-right"}))})),p&&u&&t.props.onSeeMoreClick&&l.createElement("div",{className:"option","data-test":"see-more-option",onClick:function(){t.props.onSeeMoreClick(u)}},l.createElement("span",null,l.createElement(ea,{type:"light-bulb"})," See more...")))})),yt(Tt(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 r=[].concat(wt(t.state.activeKeys),[e.value]);t.setState({activeKeys:r})}})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.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 ht(a)}();yt(Mo,"propTypes",{options:p.arrayOf(p.shape({})),onFinalOptionClick:p.func,onSeeMoreClick:p.func}),yt(Mo,"defaultProps",{options:[],onFinalOptionClick:function(){},onSeeMoreClick:void 0});var Io=[],qo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.initialize()})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state.filters,t.filters)||(r.props.onChange(r.state.filters),r.props.rebuildTooltips()),!r.props.isOpen&&e.isOpen&&r.setState({inputValue:""})})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.animateTextTimeout),clearTimeout(r.focusInputTimeout),clearTimeout(r.highlightFilterEndTimeout),clearTimeout(r.highlightFilterStartTimeout)})),yt(Tt(r),"initialize",(function(){r.setState({isFetchingFilters:!0}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));var o="".concat(r,"/autoql/api/v1/query/filter-locking?key=").concat(n),i={headers:{Authorization:"Bearer ".concat(a)}};return s.get(o,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Ot(r.props.authentication)).then((function(e){var t,n,a=(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data)||[];r._isMounted&&r.setState({filters:a,isFetchingFilters:!1})})).catch((function(e){console.error(e),r._isMounted&&r.setState({isFetchingFilters:!1})}))})),yt(Tt(r),"animateInputTextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=2e3/t.length,a=function(e){r.animateTextTimeout=setTimeout((function(){r.setState({inputValue:t.slice(0,e)}),e===t.length&&(r.focusInputTimeout=setTimeout((function(){var e;r.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=r.inputElement)||void 0===e||e.focus()}),300))}),n)},o=1;o<=t.length;o++)a(o)})),yt(Tt(r),"insertFilter",(function(e){var t=r.findFilter({filterText:e});e&&t?r.handleHighlightFilterRow(r.getKey(t)):r.animateInputTextAndSubmit(e)})),yt(Tt(r),"getAllFilters",(function(){return r.state.filters})),yt(Tt(r),"getPersistedFilters",(function(){return he(r.state.filters.filter((function(e){return!e.isSession})))})),yt(Tt(r),"findFilter",(function(e){var t=e.filterText,n=e.value,a=e.key,o=r.state.filters;return n&&a?o.find((function(e){return e.key===a&&e.value===n})):t?o.find((function(e){return e.value===t})):void 0})),yt(Tt(r),"onSuggestionsFetchRequested",(function(t){var n=t.value;clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){fa(ct(ct({},Ot(r.props.authentication)),{},{suggestion:n})).then((function(t){var n,a=e(t,"data.data"),o=[];Io=[],n=a.matches;for(var i=0;i<n.length;i++)o.push(n[i]);o.sort((function(e,t){var n,a;return(null===(n=e.keyword)||void 0===n?void 0:n.toUpperCase())<(null===(a=t.keyword)||void 0===a?void 0:a.toUpperCase())?-1:e.keyword>t.keyword?1:0}));for(var s=0;s<o.length;s++){var l={name:o[s]};Io.push(l)}r.setState({suggestions:Io})})).catch((function(e){return console.error(e)}))}),300)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"createNewFilterFromSuggestion",(function(e){var t="include",n=r.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,show_message:e.show_message,key:e.canonical,filter_type:t}})),yt(Tt(r),"setFilterTypes",(function(e,t){var n=Ot(r.props.authentication),a=e.filter((function(e){return!e.isSession}));return null!=a&&a.length?ga(ct(ct({},n),{},{filters:a})).then((function(e){var t,n,a=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data,o=r.state.filters.map((function(e){var t=a.find((function(t){return r.getKey(e)===r.getKey(t)}));return t||e}));return r.setState({filters:o}),Promise.resolve(e)})).catch((function(e){return console.error(e),r.setState({filters:t}),We.error("Something went wrong. Please try again."),Promise.reject()})):Promise.resolve()})),yt(Tt(r),"setFilter",(function(e){var t=Ot(r.props.authentication);return ga(ct(ct({},t),{},{filters:[e]})).then((function(t){var n,a,o=null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.data;if(null==o||!o.length)throw new Error("No filters in the api response");var i=o.find((function(t){return r.getKey(t)===r.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(r.findFilter(e)){var s=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(i)?i:e}));r.setState({filters:s})}else r.setState({filters:[].concat(wt(r.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),Promise.reject()}))})),yt(Tt(r),"unsetFilter",(function(t){try{return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.filter;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));var i="".concat(r,"/autoql/api/v1/query/filter-locking/").concat(o.id,"?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}};return s.delete(i,l,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(ct(ct({},Ot(r.props.authentication)),{},{filter:t}))}catch(e){return Promise.reject(e)}})),yt(Tt(r),"getSuggestionValue",(function(e){return r.createNewFilterFromSuggestion(e)})),yt(Tt(r),"handlePersistToggle",function(){var e=mt(ut().mark((function e(t){var n,a,o;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=ct(ct({},t),{},{isSession:!t.isSession,id:void 0}),o=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(t)?a:e})),r.setState({filters:o}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,r.setFilter(a);case 8:e.next=12;break;case 10:return e.next=12,r.unsetFilter(t);case 12:e.next=19;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),We.error("Something went wrong. Please try again."),r.setState({filters:n});case 19:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),yt(Tt(r),"handleExcludeToggle",(function(e,t){if(t)try{var n=r.state.filters.map((function(n){return n.show_message===e?ct(ct({},n),{},{filter_type:t.toLowerCase()}):n})),a=n.filter((function(t){return t.show_message===e}));r.setFilterTypes(a,he(r.state.filters)),r.setState({filters:n})}catch(e){console.error(e)}})),yt(Tt(r),"removeFilter",function(){var e=mt(ut().mark((function e(t){var n,a;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=r.state.filters.filter((function(e){return r.getKey(e)!==r.getKey(t)})),r.setState({filters:a}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,r.unsetFilter(t);case 7:e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),We.error("Something went wrong. Please try again."),r.setState({filters:n});case 14:We.success("Filter removed."),fe.hide();case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),yt(Tt(r),"onInputChange",(function(e,t){var n,a=t.newValue,o=t.method;"up"!==o&&"down"!==o&&("enter"!==o&&"click"!==o||(r.findFilter(a)?r.handleHighlightFilterRow(r.getKey(a)):r.setFilter(a).then((function(){return We.success("".concat(a.value," has been locked."))})).catch((function(){return We.error("Something went wrong. Please try again.")}))),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&r.setState({inputValue:e.target.value}))})),yt(Tt(r),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),yt(Tt(r),"renderTitle",(function(){return l.createElement("div",{className:"react-autoql-filter-locking-title"},l.createElement("h3",null,qn.filterLockingTitle," ",l.createElement(ea,{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."})))})),yt(Tt(r),"renderHeader",(function(){return l.createElement("div",{className:"filter-lock-menu-header"},r.renderTitle(),r.renderCloseBtn())})),yt(Tt(r),"renderCloseBtn",(function(){return l.createElement(er,{onClick:r.props.onClose,className:"filter-locking-close-btn","data-tip":qn.closeFilterLocking,"data-for":"filter-locking-tooltip",size:"small"},l.createElement(ea,{type:"close"}))})),yt(Tt(r),"renderFooter",(function(){return l.createElement("div",{className:"filter-lock-menu-footer"},l.createElement(er,{onClick:r.props.onClose,size:"small"},"Continue"))})),yt(Tt(r),"renderVLInput",(function(){return l.createElement(Ue,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:r.state.suggestions,onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:function(e){return r.getSuggestionValue(e.name)},renderSuggestion:function(e){return l.createElement("ul",{className:"filter-lock-suggestion-item"},l.createElement("li",null,e.name.keyword),l.createElement("li",null,e.name.show_message))},inputProps:{onChange:r.onInputChange,value:r.state.inputValue,disabled:r.state.isFetchingFilters,placeholder:"Search & select a filter",className:"react-autoql-condition-locking-input",id:"react-autoql-filter-menu-input"}})})),yt(Tt(r),"renderFilterListCategory",(function(e,t){return l.createElement("div",{key:e},r.renderFilterListCategoryHeader(e,t),l.createElement("div",{className:"react-autoql-filter-list"},r.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return r.renderFilterListItem(e)}))))})),yt(Tt(r),"renderFilterListCategoryHeader",(function(e,t){var n,a=null===(n=r.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return l.createElement("div",{className:"react-autoql-filter-list-title flex "},l.createElement("div",null,l.createElement("h4",null,l.createElement("span",{className:"filter-lock-category-title"},e),l.createElement(so,{className:"include-exclude-toggle-group",themeConfig:Ht(r.props.themeConfig),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 r.handleExcludeToggle(e,t)}}))),0===t?l.createElement("div",{className:"persist-toggle-column"},l.createElement("h4",null,"Persist"," ",l.createElement(ea,{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)})),yt(Tt(r),"renderFilterListItem",(function(e){var t=r.getKey(e);return l.createElement("div",{key:t,className:"flex ".concat(r.state.highlightedFilter===t?"react-autoql-highlight-row":"")},l.createElement("div",{className:"react-autoql-condition-table-list-item"},e.value),l.createElement("div",{id:"react-autoql-condition-table-settings"},l.createElement(Ya,{className:"persist-toggle-column",type:"switch",checked:!e.isSession,onChange:function(){return r.handlePersistToggle(e)}}),l.createElement(ea,{className:"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return r.removeFilter(e)}})))})),yt(Tt(r),"renderFilterList",(function(){var e;if(r.state.isFetchingFilters)return l.createElement("div",{className:"react-autoql-condition-list-loading-container"},l.createElement(Ea,null));if(null===(e=r.state.filters)||void 0===e||!e.length)return l.createElement("div",{className:"react-autoql-empty-condition-list"},l.createElement("i",null,qn.noFiltersLocked));var t=wt(new Set(r.state.filters.map((function(e){return e.show_message}))));return l.createElement("div",{className:"react-autoql-filter-list-container"},t.map((function(e,t){return r.renderFilterListCategory(e,t)})))})),yt(Tt(r),"renderContent",(function(){return l.createElement(At,null,l.createElement(Ye,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:Xe,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1,theme:Ht(r.props.themeConfig).theme}),l.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},r.renderHeader(),r.renderVLInput(),r.renderFilterList(),r.renderFooter(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0})))})),yt(Tt(r),"render",(function(){return r.props.isOpen?l.createElement(Ee,{isOpen:r.props.isOpen,onClickOutside:r.props.onClose,position:r.props.position,align:r.props.align,content:r.renderContent(),containerClassName:"filter-lock-menu"},l.createElement(At,null,r.props.children||null)):r.props.children||null})),r.contentKey=ve(),r.state={filters:[],suggestions:[],inputValue:""},r}return ht(a,[{key:"handleHighlightFilterRow",value:function(e){var t=this;We.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}();yt(qo,"propTypes",{authentication:Nt,themeConfig:Mt,isOpen:p.bool,position:p.string,align:p.string,onChange:p.func,rebuildTooltips:p.func}),yt(qo,"defaultProps",{authentication:It,themeConfig:Pt,isOpen:!1,position:"bottom",align:"center",rebuildTooltips:function(){},onChange:function(){}});var Lo=["style"],Po=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{}),yt(Tt(e),"render",(function(){return l.createElement(Je,{className:e.props.className,ref:e.props.innerRef,renderTrackHorizontal:function(e){var t=e.style,n=St(e,Lo);return l.createElement("div",vt({},n,{style:ct(ct({},t),{},{left:"50%",width:"100px",top:0,transform:"translateX(-50%)"})}))}},e.props.children)})),e}return ht(n)}();yt(Po,"propTypes",{}),yt(Po,"defaultProps",{});var Oo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0;try{r.setIntroMessages(),document.addEventListener("visibilitychange",r.onWindowResize),window.addEventListener("resize",r.onWindowResize),r.setState({containerHeight:r.getScrollContainerHeight(),containerWidth:r.getScrollContainerWidth()})}catch(e){console.error(e),r.setState({hasError:!0})}r.props.enableQueryQuickStartTopics&&function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.domain,a=t.token,r=t.apiKey;if(!n||!r||!a)return Promise.reject(new Error("Unauthenticated"));var o="".concat(n,"/autoql/api/v1/topic-set?key=").concat(r),i={headers:{Authorization:"Bearer ".concat(a)}};return s.get(o,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Ot(r.props.authentication)).then((function(t){if(r._isMounted){var n=e(t,"data.data.topics");if(n){var a=r.createTopicsMessage(n);if(a){var o=r.createIntroMessage({content:a});r.setState({messages:[].concat(wt(r.state.messages),[o]),topicsMessageContent:a})}}}})).catch((function(e){console.error(e)}))})),yt(Tt(r),"componentDidUpdate",(function(e,t){try{var n={};r.props.placement!==e.placement&&(n.placement=r.getPlacementProp(r.props.placement),n.containerHeight=r.getScrollContainerHeight(),n.containerWidth=r.getScrollContainerWidth()),r.state.isSizeMaximum!==t.isSizeMaximum&&r.forceUpdate(),r.state.isVisible&&!t.isVisible&&(r.queryInputRef&&r.queryInputRef.focus(),n.containerHeight=r.getScrollContainerHeight(),n.containerWidth=r.getScrollContainerWidth()),!r.state.isVisible&&t.isVisible&&r.props.clearOnClose&&r.clearMessages(),0===r.state.messages.length&&r.setIntroMessages();var a=Ht(r.props.themeConfig).theme,o=Ht(e.themeConfig).theme;a&&a!==o&&An(Ht(r.props.themeConfig)),r.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),Ce(n)||r.setState(ct({},n))}catch(e){console.error(e),r.setState({hasError:!0})}})),yt(Tt(r),"rebuildTooltips",(function(){clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),1e3)})),yt(Tt(r),"setMaxWidthAndHeightFromDocument",(function(){r.maxWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-45,r.maxHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-45})),yt(Tt(r),"onWindowResize",(function(){r.state.isWindowResizing||r.setState({isWindowResizing:!0}),clearTimeout(r.windowResizeTimer),r.windowResizeTimer=setTimeout((function(){r.setMaxWidthAndHeightFromDocument(),r.setState({isWindowResizing:!1,containerHeight:r.getScrollContainerHeight(),containerWidth:r.getScrollContainerWidth()})}),300)})),yt(Tt(r),"escFunction",(function(e){r.state.isVisible&&e.keyCode})),yt(Tt(r),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:ve(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),yt(Tt(r),"createTopicsMessage",(function(e){var t=r.props.enableExploreQueriesTab,n=e.map((function(e){return{label:e.name,value:ve(),children:e.queries.map((function(e){return{label:e.query,value:ve()}}))}}));try{return l.createElement("div",null,qn.introPrompt,l.createElement("br",null),l.createElement("div",{className:"topics-container"},l.createElement(Mo,{options:n,onFinalOptionClick:function(e){r.onSuggestionClick({query:e.label,source:"welcome_prompt"})},onSeeMoreClick:t?function(e){return r.runTopicInExporeQueries(e)}:void 0})),t&&l.createElement("div",null,qn.use," ",l.createElement("span",{className:"intro-qi-link",onClick:function(){return r.setState({activePage:"explore-queries"})}},l.createElement(ea,{type:"light-bulb",style:{marginRight:"-3px"}})," ",qn.exploreQueries)," ",qn.explorePrompt))}catch(e){return void console.error(e)}})),yt(Tt(r),"setIntroMessages",(function(){var e=r.props.introMessage?"".concat(r.props.introMessage):"Hi ".concat(r.props.userDisplayName||"there","! Let’s dive into your data. What can I help you discover today?"),t=[r.createIntroMessage({type:"text",content:e})];r.state.topicsMessageContent&&t.push(r.createIntroMessage({content:r.state.topicsMessageContent})),r.setState({messages:t,lastMessageId:t[t.length-1].id,isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1})})),yt(Tt(r),"toggleFullScreen",(function(e,t,n){r.setState({width:e?r.props.width:t,height:e?r.props.height:n,isSizeMaximum:!e})})),yt(Tt(r),"getHandlerProp",(function(){return void 0!==r.props.customHandle?r.props.customHandle:!!r.props.showHandle&&l.createElement("div",{className:"drawer-handle\n ".concat(r.state.isVisible?" hide":"","\n ").concat(r.props.handleImage?"":" default-logo"),style:r.props.handleStyles},r.props.handleImage?l.createElement("img",{src:r.props.handleImage,height:"22px",width:"22px",draggable:"false"}):l.createElement(ea,{type:"react-autoql-bubbles-outlined",size:26}))})),yt(Tt(r),"getDrawerHeight",(function(){return"right"===r.state.placement||"left"===r.state.placement?null:r.state.height})),yt(Tt(r),"getDrawerWidth",(function(){return"right"===r.state.placement||"left"===r.state.placement?r.state.width:null})),yt(Tt(r),"getPlacementProp",(function(){var e,t=r.props.placement;return"string"!=typeof t||"right"!==(e=t.trim().toLowerCase())&&"left"!==e&&"bottom"!==e&&"top"!==e?"right":e})),yt(Tt(r),"onDrawerChange",(function(e){e?r.setState({isVisible:!0}):r.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),yt(Tt(r),"scrollToBottom",(function(){r.messengerScrollComponent&&r.messengerScrollComponent.scrollToBottom()})),yt(Tt(r),"onInputSubmit",(function(e){r.addRequestMessage(e),r.setState({isChataThinking:!0})})),yt(Tt(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.skipQueryValidation,o=e.source;r.queryInputRef&&r.queryInputRef.animateInputTextAndSubmit({query:t,userSelection:n,skipQueryValidation:a,source:o})})),yt(Tt(r),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),yt(Tt(r),"onResponse",(function(t,n){r.getIsSuggestionResponse(t)&&r.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),Ke(e(t,"data.data"),"authorization_url")?r.addResponseMessage({content:l.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source."," ",l.createElement("br",null),l.createElement("br",null),l.createElement("a",{href:e(t,"data.data.authorization_url"),target:"_blank"},"Click here to authorize access"),", then try querying again.")}):r.addResponseMessage({response:t,query:n}),r.setState({isChataThinking:!1}),r.queryInputRef&&r.queryInputRef.focus()})),yt(Tt(r),"clearMessages",(function(){r.queryInputRef&&r.queryInputRef.focus(),r.setIntroMessages()})),yt(Tt(r),"deleteMessage",(function(e){var t=[e],n=r.state.messages.findIndex((function(t){return t.id===e})),a=r.state.messages[n-1];a&&(a.isResponse||t.push(a.id));var o=r.state.messages.filter((function(e){return!t.includes(e.id)}));r.setState({messages:o})})),yt(Tt(r),"createErrorMessage",(function(e){return{content:e||In.GENERAL_QUERY,id:ve(),type:"error",isResponse:!0}})),yt(Tt(r),"createMessage",(function(t){var n=t.id,a=t.response,o=t.content,i=t.query,s=t.isCSVProgressMessage,l=t.queryId,c=t.appliedFilters,u=n||ve();return r.setState({lastMessageId:n}),{content:o,response:a,query:i,id:u,appliedFilters:c,type:e(a,"data.data.display_type"),isResponse:!0,isCSVProgressMessage:s,queryId:l}})),yt(Tt(r),"addRequestMessage",(function(e){var t=r.state.messages;r.props.maxMessages>1&&r.state.messages.length===r.props.maxMessages&&t.shift();var n={content:e,id:ve(),isResponse:!1};r.setState({messages:[].concat(wt(t),[n])})})),yt(Tt(r),"addResponseMessage",(function(t){var n=t.id,a=t.response,o=t.content,i=t.query,s=t.isCSVProgressMessage,l=t.queryId,c=r.state.messages;r.props.maxMessages>1&&r.state.messages.length===r.props.maxMessages&&c.shift();var u={};if("cancelled"===e(a,"error"))u=r.createErrorMessage("Query Cancelled.");else if("Unauthenticated"===e(a,"error"))u=r.createErrorMessage(In.UNAUTHENTICATED);else if("Parse error"===e(a,"error"))u=r.createErrorMessage();else if(s)u=r.createMessage({id:n,content:o,query:i,isCSVProgressMessage:s,queryId:l});else if(a||o){var p=[].concat(wt(e(a,"data.data.persistent_locked_conditions",[])),wt(e(a,"data.data.session_locked_conditions",[])));u=r.createMessage({response:a,content:o,query:i,appliedFilters:p})}else u=r.createErrorMessage();r.setState({messages:[].concat(wt(c),[u])})})),yt(Tt(r),"setActiveMessage",(function(e){r.setState({activeMessageId:e})})),yt(Tt(r),"setQueryInputRef",(function(e){r.queryInputRef=e})),yt(Tt(r),"handleClearQueriesDropdown",(function(){r.clearQueriesDropdown&&("block"===r.clearQueriesDropdown.style.display?r.clearQueriesDropdown.style.display="none":r.clearQueriesDropdown.style.display="block")})),yt(Tt(r),"getFilterMenuPosition",(function(){switch(r.state.placement){case"right":return{transform:"translate(1%, -3%)"};case"left":return{transform:"translate(-1%, -3%)"};case"top":case"bottom":return{transform:"translate(1.5%, -3%)",minWidth:"100vw"}}})),yt(Tt(r),"onRTValueLabelClick",(function(e){r.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=r.filterLockRef)||void 0===t||t.insertFilter(e)}))})),yt(Tt(r),"renderTabs",(function(){var e=r.state.activePage;if(r.state.isVisible)return l.createElement("div",{className:"data-messenger-tab-container ".concat(r.props.placement)},l.createElement("div",{className:"page-switcher-shadow-container ".concat(r.props.placement)},l.createElement("div",{className:"page-switcher-container ".concat(r.props.placement)},l.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return r.setState({activePage:"data-messenger"})},"data-tip":"Data Messenger","data-for":"react-autoql-header-tooltip","data-delay-show":1e3},l.createElement(ea,{type:"react-autoql-bubbles-outlined"})),r.props.enableExploreQueriesTab&&l.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return r.setState({activePage:"explore-queries"})},"data-tip":qn.exploreQueries,"data-for":"react-autoql-header-tooltip","data-delay-show":1e3},l.createElement(ea,{type:"light-bulb",size:22})),r.props.enableNotificationsTab&&Qt(Qt(r.props.autoQLConfig)).enableNotifications&&l.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){r.notificationBadgeRef&&r.notificationBadgeRef.resetCount(),r.setState({activePage:"notifications"})},"data-tip":"Notifications","data-for":"react-autoql-header-tooltip","data-delay-show":1e3,style:{paddingBottom:"5px",paddingLeft:"2px"}},l.createElement("div",{className:"data-messenger-notification-btn"},l.createElement($r,{ref:function(e){return r.notificationBadgeRef=e},authentication:Ot(Ot(r.props.authentication)),themeConfig:Ht(Ht(r.props.themeConfig)),clearCountOnClick:!1,style:{fontSize:"19px"},overflowCount:9,useDot:!0,isAlreadyMountedInDOM:l.isValidElement(l.createElement($r,null)),onNewNotification:function(){r.notificationListRef&&"notifications"===r.state.activePage&&r.notificationListRef.refreshNotifications()},onErrorCallback:r.props.onErrorCallback}))))))})),yt(Tt(r),"renderRightHeaderContent",(function(){return l.createElement(l.Fragment,null,Qt(r.props.autoQLConfig).enableFilterLocking&&r.renderFilterLockPopover(),l.createElement(Ee,{isOpen:r.state.isOptionsDropdownOpen,onClickOutside:function(){r.setState({isOptionsDropdownOpen:!1})},position:"bottom",content:l.createElement("div",null,l.createElement("div",{className:"clear-messages-confirm-popover"},l.createElement("div",{className:"react-autoql-menu-text",onClick:r.handleClearQueriesDropdown},l.createElement(ea,{type:"trash"}),l.createElement("span",{style:{marginLeft:5}},qn.clearDataResponses)),l.createElement("div",{ref:function(e){return r.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},l.createElement(er,{type:"default",size:"small",onClick:function(){return r.setState({isOptionsDropdownOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return r.clearMessages()}},"Clear"))))},l.createElement("button",{onClick:function(){return r.setState({isOptionsDropdownOpen:!r.state.isOptionsDropdownOpen})},className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===r.state.activePage?"visible":"hidden"),"data-tip":qn.clearDataResponses,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:"trash"}))))})),yt(Tt(r),"renderHeaderTitle",(function(){var e="";return"data-messenger"===r.state.activePage&&(e=r.props.title),"explore-queries"===r.state.activePage&&(e=qn.exploreQueries),"notifications"===r.state.activePage&&(e="Notifications"),l.createElement("div",{className:"header-title"},e)})),yt(Tt(r),"openFilterLockMenu",(function(){r.state.isFilterLockMenuOpen||r.setState({isFilterLockMenuOpen:!0})})),yt(Tt(r),"closeFilterLockMenu",(function(){r.state.isFilterLockMenuOpen&&r.setState({isFilterLockMenuOpen:!1})})),yt(Tt(r),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));r.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),yt(Tt(r),"renderFilterLockPopover",(function(){return l.createElement(qo,{ref:function(e){return r.filterLockRef=e},authentication:r.props.authentication,themeConfig:r.props.themeConfig,isOpen:r.state.isFilterLockMenuOpen,onChange:r.onFilterChange,onClose:r.closeFilterLockMenu,rebuildTooltips:r.rebuildTooltips},l.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===r.state.activePage?"visible":"hidden"),"data-tip":qn.openFilterLocking,"data-for":"react-autoql-header-tooltip",onClick:r.state.isFilterLockMenuOpen?r.closeFilterLockMenu:r.openFilterLockMenu},l.createElement(ea,{type:r.state.hasFilters?"lock":"unlock"})))})),yt(Tt(r),"renderHeaderContent",(function(){var e=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-45,t=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-45,n=r.state.width===e;return l.createElement(c,null,l.createElement("div",{className:"react-autoql-header-left-container"},l.createElement("button",{onClick:function(){r.dmRef.setState({open:!1}),r.setState({isVisible:!1})},className:"react-autoql-drawer-header-btn close","data-tip":qn.closeDataMessenger,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:"close"})),l.createElement("button",{onClick:function(){return r.toggleFullScreen(n,e,t)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":n?qn.minimizeDataMessenger:qn.maximizeDataMessenger,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:n?"minimize":"maximize"}))),l.createElement("div",{className:"react-autoql-header-center-container"},r.renderHeaderTitle()),l.createElement("div",{className:"react-autoql-header-right-container"},r.renderRightHeaderContent()))})),yt(Tt(r),"renderBodyContent",(function(){switch(r.state.activePage){case"data-messenger":return r.renderDataMessengerContent();case"explore-queries":return r.renderQueryTipsContent();case"notifications":return r.renderNotificationsContent()}})),yt(Tt(r),"onNoneOfTheseClick",(function(){r.setState({isChataThinking:!0}),clearTimeout(r.feedbackTimeout),r.feedbackTimeout=setTimeout((function(){r.setState({isChataThinking:!1}),r.addResponseMessage({content:"Thank you for your feedback"})}),1e3)})),yt(Tt(r),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;r.csvProgressLog[t]=n,r.messageRefs[t]&&r.messageRefs[t].setState({csvDownloadProgress:n})})),yt(Tt(r),"onDrilldownStart",(function(){r.setState({isChataThinking:!0})})),yt(Tt(r),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error;r.setState({isChataThinking:!1}),t?r.addResponseMessage({response:t}):n&&r.addResponseMessage({content:n})})),yt(Tt(r),"renderDataMessengerContent",(function(){return l.createElement(c,null,l.createElement(Po,{innerRef:function(e){r.messengerScrollComponent=e},className:"chat-message-container",renderView:function(e){return l.createElement("div",vt({},e,{className:"custom-scrollbar-container"}))}},r.state.messages.length>0&&r.state.messages.map((function(t){return l.createElement(Ro,{key:t.id,id:t.id,ref:function(e){return r.messageRefs[t.id]=e},isIntroMessage:t.isIntroMessage,authentication:Ot(Ot(r.props.authentication)),autoQLConfig:Qt(Qt(r.props.autoQLConfig)),themeConfig:Ht(Ht(r.props.themeConfig)),isCSVProgressMessage:t.isCSVProgressMessage,initialCSVDownloadProgress:r.csvProgressLog[t.id],onCSVDownloadProgress:r.onCSVDownloadProgress,queryId:t.queryId,queryText:t.query,scrollRef:r.messengerScrollComponent,isDataMessengerOpen:r.state.isVisible,setActiveMessage:r.setActiveMessage,isActive:r.state.activeMessageId===t.id,addMessageToDM:r.addResponseMessage,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.onDrilldownEnd,isResponse:t.isResponse,isChataThinking:r.state.isChataThinking,onSuggestionClick:r.onSuggestionClick,content:t.content,scrollToBottom:r.scrollToBottom,lastMessageId:r.state.lastMessageId,onQueryOutputUpdate:r.rebuildTooltips,dataFormatting:r.props.dataFormatting,displayType:t.displayType||e(t,"response.data.data.display_type"),onResponseCallback:r.onResponse,response:t.response,type:t.type,onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessAlert,deleteMessageCallback:r.deleteMessage,scrollContainerRef:r.messengerScrollComponent,isResizing:r.state.isResizing||r.state.isWindowResizing,enableDynamicCharting:r.props.enableDynamicCharting,onNoneOfTheseClick:r.onNoneOfTheseClick,autoChartAggregations:r.props.autoChartAggregations,messageContainerHeight:r.state.containerHeight,messageContainerWidth:r.state.containerWidth,onRTValueLabelClick:r.onRTValueLabelClick,appliedFilters:t.appliedFilters})}))),r.state.isChataThinking&&l.createElement("div",{className:"response-loading-container"},l.createElement("div",{className:"response-loading"},l.createElement("div",null),l.createElement("div",null),l.createElement("div",null),l.createElement("div",null))),l.createElement("div",{className:"chat-bar-container"},l.createElement("div",{className:"watermark"},l.createElement(ea,{type:"react-autoql-bubbles-outlined"}),qn.run),l.createElement(Ta,{authentication:Ot(Ot(r.props.authentication)),autoQLConfig:Qt(Qt(r.props.autoQLConfig)),themeConfig:Ht(Ht(r.props.themeConfig)),ref:r.setQueryInputRef,className:"chat-drawer-chat-bar",onSubmit:r.onInputSubmit,onResponseCallback:r.onResponse,isDisabled:r.state.isChataThinking,enableVoiceRecord:r.props.enableVoiceRecord,autoCompletePlacement:"above",showChataIcon:!1,showLoadingDots:!1,placeholder:r.props.inputPlaceholder,onErrorCallback:r.props.onErrorCallback,hideInput:r.props.hideInput,source:["data_messenger"],AutoAEId:r.props.AutoAEId,queryFilters:r.state.sessionFilters})))})),yt(Tt(r),"fetchQueryTipsList",(function(t,n,a){r.setState({queryTipsLoading:!0,queryTipsKeywords:t});var o=10;r.queryTipsPage&&(o=Math.floor((r.queryTipsPage.clientHeight-150)/50)),ya(ct(ct({},Ot(r.props.authentication)),{},{keywords:t,pageSize:o,pageNumber:n,skipQueryValidation:a})).then((function(t){if(e(t,"data.full_suggestion"))r.setState({queryTipsLoading:!1,queryTipsQueryValidationResponse:t});else{var n=Number(e(t,"data.data.pagination.total_items")),a=Number(e(t,"data.data.pagination.total_pages")),o=Number(e(t,"data.data.pagination.current_page"));r.setState({queryTipsList:e(t,"data.data.items"),queryTipsLoading:!1,queryTipsError:!1,queryTipsTotalPages:a,queryTipsCurrentPage:o,queryTipsTotalQueries:n,queryTipsQueryValidationResponse:void 0})}})).catch((function(e){console.error(e),r.props.onErrorCallback(e),r.setState({queryTipsLoading:!1,queryTipsError:!0,queryTipsQueryValidationResponse:void 0})}))})),yt(Tt(r),"onQueryTipsInputKeyPress",(function(e){"Enter"==e.key?r.fetchQueryTipsList(e.target.value,1):r.setState({queryTipsInputValue:e.target.value})})),yt(Tt(r),"onQueryTipsPageChange",(function(e){var t=e.selected+1;r.fetchQueryTipsList(r.state.queryTipsKeywords,t,!0)})),yt(Tt(r),"onQueryTipsQueryValidationSuggestionClick",(function(e){var t=e.query;r.setState({queryTipsInputValue:t}),r.fetchQueryTipsList(t,1,!0)})),yt(Tt(r),"animateQITextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=function(e){clearTimeout(r.animateTextTimeout),r.animateTextTimeout=setTimeout((function(){r.setState({queryTipsInputValue:t.slice(0,e)}),e===t.length&&r.fetchQueryTipsList(t,1)}),50*e)},a=1;a<=t.length;a++)n(a)})),yt(Tt(r),"runTopicInExporeQueries",(function(e){r.setState({activePage:"explore-queries"}),clearTimeout(r.exploreQueriesTimeout),r.exploreQueriesTimeout=setTimeout((function(){r.animateQITextAndSubmit(e)}),500)})),yt(Tt(r),"renderQueryTipsContent",(function(){return l.createElement(Vo,{themeConfig:Ht(Ht(r.props.themeConfig)),onQueryTipsInputKeyPress:r.onQueryTipsInputKeyPress,queryTipsQueryValidationResponse:r.state.queryTipsQueryValidationResponse,onQueryValidationSuggestionClick:r.onQueryTipsQueryValidationSuggestionClick,loading:r.state.queryTipsLoading,error:r.state.queryTipsError,queryTipsList:r.state.queryTipsList,queryTipsInputValue:r.state.queryTipsInputValue,totalPages:r.state.queryTipsTotalPages,currentPage:r.state.queryTipsCurrentPage,queryTipsPageRef:function(e){return r.queryTipsPage=e},onPageChange:r.onQueryTipsPageChange,executeQuery:function(e){r.setState({activePage:"data-messenger"}),clearTimeout(r.executeQueryTimeout),r.executeQueryTimeout=setTimeout((function(){r.onSuggestionClick({query:e,source:"explore_queries"})}),500)}})})),yt(Tt(r),"renderNotificationsContent",(function(){return l.createElement(vo,{ref:function(e){return r.notificationListRef=e},authentication:Ot(r.props.authentication),themeConfig:Ht(Ht(r.props.themeConfig)),onExpandCallback:r.props.onNotificationExpandCallback,onCollapseCallback:r.props.onNotificationCollapseCallback,activeNotificationData:r.props.activeNotificationData,onErrorCallback:r.props.onErrorCallback,onSuccessCallback:r.props.onSuccessCallback,showNotificationDetails:!1})})),yt(Tt(r),"resizeDrawer",(function(t){var n=r.state.placement;if("right"===n){var a=e(r.state.startingResizePosition,"x")-t.pageX,o=e(r.state.startingResizePosition,"width")+a;o>r.maxWidth&&(o=r.maxWidth),o<r.minWidth&&(o=r.minWidth),Number(o)&&r.setState({width:o,containerWidth:o,isSizeMaximum:!1})}else if("left"===n){var i=t.pageX-e(r.state.startingResizePosition,"x"),s=e(r.state.startingResizePosition,"width")+i;s>r.maxWidth&&(s=r.maxWidth),s<r.minWidth&&(s=r.minWidth),Number(s)&&r.setState({width:s,containerWidth:s,isSizeMaximum:!1})}else if("bottom"===n){var l=e(r.state.startingResizePosition,"y")-t.pageY,c=e(r.state.startingResizePosition,"height")+l;c>r.maxHeight&&(c=r.maxHeight),c<r.minHeight&&(c=r.minHeight),Number(c)&&r.setState({height:c,containerHeight:c,isSizeMaximum:!1})}else if("top"===n){var u=t.pageY-e(r.state.startingResizePosition,"y"),p=e(r.state.startingResizePosition,"height")+u;p>r.maxHeight&&(p=r.maxHeight),p<r.minHeight&&(p=r.minHeight),Number(p)&&r.setState({height:p,containerHeight:p,isSizeMaximum:!1})}})),yt(Tt(r),"getScrollContainerHeight",(function(){if(r.messengerScrollComponent)return r.messengerScrollComponent.getClientHeight()})),yt(Tt(r),"getScrollContainerWidth",(function(){if(r.messengerScrollComponent)return r.messengerScrollComponent.getClientWidth()})),yt(Tt(r),"stopResizingDrawer",(function(){"right"===r.state.placement||"left"===r.state.placement?r.setState({isResizing:!1,containerWidth:r.state.width}):"top"!==r.state.placement&&"bottom"!==r.state.placement||r.setState({isResizing:!1,containerHeight:r.state.height}),document.removeEventListener("mousemove",r.resizeDrawer),document.removeEventListener("mouseup",r.stopResizingDrawer),document.removeEventListener("mouseleave",r.stopResizingDrawer)})),yt(Tt(r),"renderResizeHandle",(function(){var e=Tt(r);if(r.state.isVisible){var t=r.getPlacementProp();return l.createElement("div",{className:"react-autoql-drawer-resize-handle ".concat(t),onMouseDown:function(t){r.setState({isResizing:!0,startingResizePosition:{x:t.pageX,y:t.pageY,width:r.state.width,height:r.state.height}}),document.addEventListener("mousemove",e.resizeDrawer),document.addEventListener("mouseup",e.stopResizingDrawer),document.addEventListener("mouseleave",e.stopResizingDrawer)}})}return null})),yt(Tt(r),"renderTooltips",(function(){return l.createElement(c,null,l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-header-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-toolbar-btn-tooltip",effect:"solid",delayShow:500,place:"top",html:!0}),l.createElement(fe,{className:"react-autoql-chart-tooltip",id:"chart-element-tooltip",effect:"solid",html:!0}))})),yt(Tt(r),"renderDataAlertModal",(function(){return l.createElement(ho,{authentication:Ot(r.props.authentication),themeConfig:Ht(Ht(r.props.themeConfig)),isVisible:r.state.isDataAlertModalVisible,onClose:function(){return r.setState({isDataAlertModalVisible:!1})},onSave:function(){r.props.onSuccessAlert("Notification created!"),r.setState({isDataAlertModalVisible:!1})},onErrorCallback:function(){return r.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")},initialQuery:r.state.activeQuery})})),yt(Tt(r),"render",(function(){return r.state.hasError?null:l.createElement(At,null,l.createElement(c,null,r.renderTooltips(),void((navigator.language||navigator.userLanguage).includes("sp")?qn.setLanguage("sp"):qn.setLanguage("en")),l.createElement(je,{ref:function(e){return r.dmRef=e},id:"react-autoql-drawer-".concat(r.DATA_MESSENGER_ID),"data-test":"react-autoql-drawer-test",className:"react-autoql-drawer\n ".concat(r.state.isResizing?" disable-selection":"","\n ").concat(r.state.isVisible?" open":" closed"),showMask:r.props.showMask,placement:r.getPlacementProp(),width:r.getDrawerWidth(),height:r.getDrawerHeight(),onChange:r.onDrawerChange,maskClosable:!0,handler:r.getHandlerProp(),level:r.props.shiftScreen?"all":null,keyboard:!1},r.props.resizable&&r.renderResizeHandle(),(r.props.enableExploreQueriesTab||r.props.enableNotificationsTab)&&r.renderTabs(),l.createElement("div",{className:"react-autoql-drawer-content-container"},l.createElement("div",{className:"chat-header-container"},r.renderHeaderContent()),r.renderBodyContent())),r.renderDataAlertModal()))})),r.csvProgressLog={},r.messageRefs={},r.minWidth=400,r.minHeight=400,r.DATA_MESSENGER_ID=ve(),r.HEADER_THICKNESS=70,r.setMaxWidthAndHeightFromDocument(),An(Ht(r.props.themeConfig)),r.state={hasError:!1,isVisible:!1,activePage:t.defaultTab,width:t.width,height:t.height,isResizing:!1,placement:r.getPlacementProp(t.placement),lastMessageId:void 0,isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,messages:[],topicsMessageContent:void 0,queryTipsList:void 0,queryTipsLoading:!1,queryTipsError:!1,queryTipsTotalPages:void 0,queryTipsCurrentPage:1,isSizeMaximum:!1},r}return ht(a,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,document.removeEventListener("visibilitychange",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.scrollToBottomTimeout),clearTimeout(this.windowResizeTimer),clearTimeout(this.responseTimeout),clearTimeout(this.feedbackTimeout),clearTimeout(this.animateTextTimeout),clearTimeout(this.exploreQueriesTimeout),clearTimeout(this.executeQueryTimeout),clearTimeout(this.rebuildTooltipsTimer)}catch(e){}}}]),a}();yt(Oo,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,placement:m,maskClosable:g,width:b([m,f]),height:b([m,f]),showHandle:g,handleImage:m,handleStyles:d({}),shiftScreen:g,userDisplayName:m,clearOnClose:g,enableVoiceRecord:g,title:m,maxMessages:f,introMessage:m,enableExploreQueriesTab:g,enableNotificationsTab:g,resizable:g,inputPlaceholder:m,enableDynamicCharting:g,defaultTab:m,autoChartAggregations:g,enableQueryInterpretation:g,defaultShowInterpretation:g,enableFilterLocking:g,enableQueryQuickStartTopics:g,onVisibleChange:C,onHandleClick:C,onErrorCallback:C,onSuccessAlert:C}),yt(Oo,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,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:void 0,introMessage:void 0,enableExploreQueriesTab:!0,enableNotificationsTab:!1,resizable:!0,inputPlaceholder:void 0,enableDynamicCharting:!0,defaultTab:"data-messenger",autoChartAggregations:!0,enableQueryInterpretation:!1,defaultShowInterpretation:!1,enableFilterLocking:!1,enableQueryQuickStartTopics:!0,onHandleClick:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var Fo=["style","className","key"],Qo=[],Ho=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){var n=r.getFilteredProps(r.props),a=r.getFilteredProps(e);return!ge(rt(n,ot(n)),rt(a,ot(a)))||!ge(r.state,t)})),yt(Tt(r),"componentDidUpdate",(function(t){e(r.props,"tile.query")!==e(t,"tile.query")&&r.setState({query:e(r.props,"tile.query")},(function(){r.setState({supportedDisplayTypes:bn({response:e(r.props,"queryResponse")})})})),e(r.props,"tile.title")!==e(t,"tile.title")&&r.setState({title:e(r.props,"tile.title")})})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.dragEndTimeout)})),yt(Tt(r),"getFilteredProps",(function(e){return ct(ct({},e),{},{children:void 0})})),yt(Tt(r),"toggleTableFilter",(function(e,t){null==e||e.toggleTableFilter({isFilteringTable:t})})),yt(Tt(r),"isQueryValid",(function(e){return!!e&&!!e.trim()})),yt(Tt(r),"endTopQuery",(function(e){var t=e.response;r.QUERY_RESPONSE_KEY=ve(),r.props.setParamsForTile({queryResponse:t,selectedSuggestion:void 0},r.props.tile.i),r._isMounted&&r.setState({isTopExecuting:!1,isTopExecuted:!0})})),yt(Tt(r),"endBottomQuery",(function(e){var t=e.response;r.props.setParamsForTile({secondQueryResponse:t,secondSelectedSuggestion:void 0},r.props.tile.i),r.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),yt(Tt(r),"processQuery",(function(e){var t=e.query,n=e.userSelection,a=e.skipQueryValidation,o=e.source;if(r.isQueryValid(t)){var i=["dashboards"];return o?i.push(o):i.push("user"),ca(ct(ct(ct({query:t,userSelection:n},Ot(r.props.authentication)),Qt(r.props.autoQLConfig)),{},{enableQueryValidation:!!r.props.isEditing&&Qt(r.props.autoQLConfig).enableQueryValidation,source:i,skipQueryValidation:a})).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),yt(Tt(r),"processTileTop",(function(t){var n=t.query,a=t.userSelection,o=t.skipQueryValidation,i=t.source;r.setState({isTopExecuting:!0,customMessage:void 0});var s=!!o||!(r.props.tile.query!==n||!r.props.tile.skipQueryValidation),l=a||(r.props.tile.query===n?e(r.props.tile,"queryValidationSelections"):void 0);r.props.setParamsForTile({query:n,dataConfig:r.props.tile.query===n?void 0:r.props.tile.dataConfig,skipQueryValidation:s,queryResponse:null,selectedSuggestion:void 0,queryValidationSelections:l},r.props.tile.i),r.processQuery({query:n,userSelection:l,skipQueryValidation:o,source:i}).then((function(e){r._isMounted&&r.endTopQuery({response:e})})).catch((function(e){r._isMounted&&r.endTopQuery({response:e})}))})),yt(Tt(r),"processTileBottom",(function(t){var n=t.query,a=t.userSelection,o=t.skipQueryValidation,i=t.source;r.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondCustomMessage:void 0});var s=o||!(r.props.tile.secondQuery!==n||!r.props.tile.secondskipQueryValidation),l=a||(r.props.tile.secondQuery===n?e(r.props.tile,"secondQueryValidationSelections"):void 0);r.props.setParamsForTile({secondQuery:n,secondDataConfig:r.props.tile.secondQuery===n?void 0:r.props.tile.secondDataConfig,secondskipQueryValidation:s,secondQueryResponse:null,secondSelectedSuggestion:void 0,secondQueryValidationSelections:l},r.props.tile.i),r.processQuery({query:n,userSelection:l,skipQueryValidation:o,source:i}).then((function(e){r._isMounted&&r.endBottomQuery({response:e})})).catch((function(e){r._isMounted&&r.endBottomQuery({response:e})}))})),yt(Tt(r),"clearQueryResponses",(function(){r.setState({isTopExecuting:!1,isTopExecuted:!1,customMessage:void 0}),r.props.setParamsForTile({queryResponse:void 0,secondQueryResponse:void 0},r.props.tile.i)})),yt(Tt(r),"processTile",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.query,n=e.secondQuery,a=e.skipQueryValidation,o=e.secondskipQueryValidation,i=e.source,s=t||r.props.tile.selectedSuggestion||r.state.query,l=n||r.props.tile.secondSelectedSuggestion||r.state.secondQuery;r.processTileTop({query:s,skipQueryValidation:a,source:i}),r.getIsSplitView()&&l&&s!==l&&r.processTileBottom({query:l,skipQueryValidation:o,source:i})})),yt(Tt(r),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(r.processTile({query:e.target.value}),e.target.blur())})),yt(Tt(r),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(r.processTileBottom({query:e.target.value}),e.target.blur())})),yt(Tt(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,o=e.source;r.setState({query:t}),a?r.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:o}):r.props.setParamsForTile({selectedSuggestion:t},r.props.tile.i)})),yt(Tt(r),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,o=e.source;r.setState({secondQuery:t}),a?(r.props.setParamsForTile({secondQuery:t,secondQueryValidationSelections:n},r.props.tile.i),r.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:o})):r.props.setParamsForTile({secondQuery:t},r.props.tile.i)})),yt(Tt(r),"onSuggestionsFetchRequested",(function(t){var n=t.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct({suggestion:n},Ot(r.props.authentication))).then((function(t){if(r._isMounted){var n,a=e(t,"data.data"),o=[];Qo=[],n=a.matches;for(var i=0;i<n.length&&(o.push(n[i]),4!==i);i++);o.sort((function(e,t){return t.length-e.length}));for(var s=0;s<o.length;s++){var l={name:o[s]};Qo.push(l)}r.setState({suggestions:Qo})}})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){if(e&&e.name){var t=e.name;r.userSelectedValue=t,r.userSelectedSuggestion=!0,r.setState({query:t}),r.props.setParamsForTile({query:t},r.props.tile.i)}})),yt(Tt(r),"onQueryInputChange",(function(t){(!r.userSelectedSuggestion||38!==t.keyCode&&40!==t.keyCode)&&(e(t,"target.value")||""===e(t,"target.value")?r.setState({query:t.target.value}):r.processTile({query:r.userSelectedValue}))})),yt(Tt(r),"onDisplayTypeChange",(function(e){r.props.setParamsForTile({displayType:e},r.props.tile.i)})),yt(Tt(r),"onSecondDisplayTypeChange",(function(e){r.props.setParamsForTile({secondDisplayType:e},r.props.tile.i)})),yt(Tt(r),"getIsSplitView",(function(){return e(r.props.tile,"splitView")})),yt(Tt(r),"toggleSecondQueryInput",(function(){r.setState({isSecondQueryInputOpen:!r.state.isSecondQueryInputOpen})})),yt(Tt(r),"renderHeader",(function(){return r.props.isEditing?l.createElement("div",{className:"dashboard-tile-edit-wrapper"},l.createElement("div",{className:"dashboard-tile-input-container\n ".concat(r.state.isQueryInputFocused?"query-focused":"","\n ").concat(r.state.isTitleInputFocused?"title-focused":""),onMouseDown:function(e){return e.stopPropagation()}},l.createElement("div",{className:"dashboard-tile-left-input-container"},l.createElement(ea,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),Qt(r.props.autoQLConfig).enableAutocomplete?l.createElement(Ue,{onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,suggestions:r.state.suggestions,ref:function(e){r.autoSuggest=e},renderSuggestion:function(e){return l.createElement(c,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onFocus:function(){return r.setState({isQueryInputFocused:!0})},onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onBlur:function(t){e(r.props,"tile.query")!==t.target.value&&r.props.setParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0},r.props.tile.i),r.setState({isQueryInputFocused:!1})}}}):l.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){r.setState({query:e.target.value})},onKeyDown:r.onQueryTextKeyDown,onFocus:function(){return r.setState({isQueryInputFocused:!0})},onBlur:function(t){e(r.props,"tile.query")!==t.target.value&&r.props.setParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0},r.props.tile.i),r.setState({isQueryInputFocused:!1})}})),l.createElement("div",{className:"dashboard-tile-right-input-container"},l.createElement(ea,{className:"title-input-icon",type:"title"}),l.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)",value:r.state.title,"data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){return r.setState({title:e.target.value})},onFocus:function(){return r.setState({isTitleInputFocused:!0})},onBlur:function(e){r.props.setParamsForTile({title:e.target.value},r.props.tile.i),r.setState({isTitleInputFocused:!1})}}))),l.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-play-button".concat(r.isQueryValid(r.state.query)?"":" disabled")},l.createElement(ea,{type:"play",onClick:function(){return r.processTile()},"data-tip":"Run tile","data-place":"left"})),l.createElement("div",{className:"dashboard-tile-delete-button",onMouseDown:function(e){return e.stopPropagation()},onClick:function(){return r.props.deleteTile(r.props.tile.i)}},l.createElement(ea,{style:{fontSize:"18px"},type:"close"}))):l.createElement("div",{className:"dashboard-tile-title-container"},l.createElement("span",{className:"dashboard-tile-title"},r.props.tile.title||r.props.tile.query||"Untitled"),l.createElement("div",{className:"dashboard-tile-title-divider"}))})),yt(Tt(r),"renderDraggingPlaceholder",(function(){return l.createElement("div",{className:"react-autoql-db-dragging-placeholder-container"},l.createElement("div",{className:"react-autoql-db-dragging-placeholder-title"}),l.createElement("div",{className:"react-autoql-db-dragging-placeholder-content"}))})),yt(Tt(r),"renderContentPlaceholder",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting,a=t.isExecuted,o=t.showSplitViewBtn,i=null;return i=n?l.createElement(Ea,null):!r.props.isEditing&&a?l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,"No query was supplied for this tile.")):r.props.isEditing&&!e(r.state.query,"trim()")?l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,"To get started, enter a query and click"," ",l.createElement(ea,{className:"play-icon",type:"play"}))):l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,r.props.isEditing?l.createElement("span",null,"Hit ",l.createElement(ea,{className:"edit-mode-placeholder-icon",type:"play"})," ","to run this tile"):l.createElement("span",null,r.props.notExecutedText))),l.createElement("div",{className:"loading-container-centered"},i,!r.props.isDragging&&r.props.isEditing&&l.createElement("div",{className:"dashboard-tile-viz-toolbar-container"},r.props.isEditing&&o&&r.renderSplitViewBtn()))})),yt(Tt(r),"onQueryValidationSelectOption",(function(e,t){r.setState({query:e}),r.props.setParamsForTile({query:e,queryValidationSelections:t},r.props.tile.i)})),yt(Tt(r),"onSecondQueryValidationSelectOption",(function(e,t){r.setState({secondQuery:e}),r.props.setParamsForTile({secondQuery:e,secondqueryValidationSelections:t},r.props.tile.i)})),yt(Tt(r),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),yt(Tt(r),"onDataConfigChange",(function(e){r.props.setParamsForTile({dataConfig:e},r.props.tile.i)})),yt(Tt(r),"onSecondDataConfigChange",(function(e){r.props.setParamsForTile({secondDataConfig:e},r.props.tile.i)})),yt(Tt(r),"reportProblemCallback",(function(){var e;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&r.optionsToolbarRef.setState({activeMenu:"other-problem"})})),yt(Tt(r),"secondReportProblemCallback",(function(){var e;null!==(e=r.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&r.secondOptionsToolbarRef.setState({activeMenu:"other-problem"})})),yt(Tt(r),"onNoneOfTheseClick",(function(){r.setState({customMessage:"Thank you for your feedback"})})),yt(Tt(r),"secondOnNoneOfTheseClick",(function(){r.setState({secondCustomMessage:"Thank you for your feedback"})})),yt(Tt(r),"renderSuggestionPrefix",(function(){return l.createElement("div",null,"I want to make sure I understood your query. Did you mean:")})),yt(Tt(r),"renderSplitResponse",(function(){var t=e(r.tileInnerDiv,"clientWidth")?"".concat(r.tileInnerDiv.clientWidth-70,"px"):"0px";return l.createElement(at,{vertical:!0,percentage:!0,secondaryInitialSize:r.props.secondDisplayPercentage||50,onDragEnd:function(){r.dragEndTimeout=setTimeout((function(){var t=e(r.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));Number.isNaN(n)||r.props.setParamsForTile({secondDisplayPercentage:n},r.props.tile.i)}),1e3)}},l.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderTopResponse()),l.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderBottomResponse(),r.props.isEditing&&l.createElement("div",{className:"viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},l.createElement("button",{onClick:function(){r.toggleSecondQueryInput(),fe.hide()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},l.createElement(ea,{type:"react-autoql-bubbles-outlined"}),l.createElement(ea,{type:r.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),l.createElement("input",{className:"dashboard-tile-input query second ".concat(r.state.isSecondQueryInputOpen?"open":""),value:r.state.secondQuery,onChange:function(e){r.setState({secondQuery:e.target.value})},onKeyDown:r.onSecondQueryTextKeyDown,onBlur:function(t){e(r.props,"tile.secondQuery")!==t.target.value&&r.props.setParamsForTile({secondQuery:t.target.value,secondDataConfig:void 0,secondQueryValidationSelections:void 0},r.props.tile.i)},placeholder:r.props.tile.query||"Type a query in your own words",style:{width:r.state.isSecondQueryInputOpen?t:"0px"}}))))})),yt(Tt(r),"onSplitViewClick",(function(){var e,t,n,a=!(null!==(e=r.props.tile)&&void 0!==e&&e.splitView),o=null===(t=r.props.tile)||void 0===t?void 0:t.secondQuery;a&&!o&&(o=null===(n=r.props.tile)||void 0===n?void 0:n.query);r.props.setParamsForTile({splitView:a,secondQuery:o},r.props.tile.i),fe.hide()})),yt(Tt(r),"renderSplitViewBtn",(function(){return l.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},l.createElement("button",{onClick:r.onSplitViewClick,className:"react-autoql-toolbar-btn","data-tip":r.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},l.createElement(ea,{type:r.getIsSplitView()?"single-view":"split-view",style:{color:r.props.tile.splitView?Ht(r.props.themeConfig).accentColor:"inherit"}})))})),yt(Tt(r),"onSupportedDisplayTypesChange",(function(e){r.setState({supportedDisplayTypes:e})})),yt(Tt(r),"onSecondSupportedDisplayTypesChange",(function(e){r.setState({secondSupportedDisplayTypes:e}),r.props.setParamsForTile({secondDataConfig:void 0})})),yt(Tt(r),"onCSVDownloadStart",(function(e){return r.props.onCSVDownloadStart(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"onCSVDownloadProgress",(function(e){return r.props.onCSVDownloadProgress(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"onCSVDownloadFinish",(function(e){return r.props.onCSVDownloadFinish(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"renderSuggestionMessage",(function(e){return e||l.createElement("div",{style:{paddingTop:"20px"}},r.renderSuggestionPrefix())})),yt(Tt(r),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,a=e.vizToolbarProps,o=void 0===a?{}:a,i=e.optionsToolbarProps,s=void 0===i?{}:i,c=e.showSplitViewBtn,u=e.isSecondHalf,p=r.state.customMessage;return u&&(p=r.state.secondCustomMessage),l.createElement("div",{className:"loading-container-centered"},r.getIsSuggestionResponse(n.queryResponse)&&r.renderSuggestionMessage(p),!p&&l.createElement(wr,vt({authentication:Ot(r.props.authentication),themeConfig:Ht(r.props.themeConfig),autoQLConfig:Qt(r.props.autoQLConfig),dataFormatting:Ft(r.props.dataFormatting),renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:r.props.autoChartAggregations,isResizing:r.props.isDragging,renderSuggestionsAsDropdown:r.props.tile.h<4,enableDynamicCharting:r.props.enableDynamicCharting,onUpdate:r.props.onQueryOutputUpdate,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary")},n)),!r.props.isDragging&&r.props.isEditing&&l.createElement("div",{className:"dashboard-tile-viz-toolbar-container"},r.props.isEditing&&c&&r.renderSplitViewBtn(),l.createElement(Ar,vt({themeConfig:Ht(r.props.themeConfig)},o))),!r.props.isDragging&&l.createElement(No,vt({authentication:Ot(r.props.authentication),autoQLConfig:Qt(r.props.autoQLConfig),themeConfig:Ht(r.props.themeConfig),onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessCallback,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadProgress:r.onCSVDownloadProgress,onCSVDownloadFinish:r.onCSVDownloadFinish},s)))})),yt(Tt(r),"renderTopResponse",(function(){var t=r.state.isTopExecuting,n=r.state.isTopExecuted;if(!r.props.queryResponse||t||!n)return r.renderContentPlaceholder({isExecuting:t,isExecuted:n,showSplitViewBtn:!r.getIsSplitView()});var a=e(r.props,"tile.displayType");return r.renderResponse({queryOutputProps:{ref:function(e){return r.responseRef=e},optionsToolbarRef:r.optionsToolbarRef,key:"dashboard-tile-query-top-".concat(r.QUERY_RESPONSE_KEY),displayType:a,queryResponse:r.props.queryResponse,dataConfig:r.props.tile.dataConfig,onDataConfigChange:r.onDataConfigChange,queryValidationSelections:r.props.tile.queryValidationSelections,onSuggestionClick:r.onSuggestionClick,selectedSuggestion:e(r.props.tile,"selectedSuggestion"),onNoneOfTheseClick:r.onNoneOfTheseClick,onDrilldownStart:function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!1,activeKey:e})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onQueryValidationSelectOption,onSupportedDisplayTypesChange:r.onSupportedDisplayTypesChange,onRecommendedDisplayType:function(e,t){r.onSupportedDisplayTypesChange(t),r.onDisplayTypeChange(e)},reportProblemCallback:r.reportProblemCallback},vizToolbarProps:{displayType:a,onDisplayTypeChange:r.onDisplayTypeChange,supportedDisplayTypes:r.state.supportedDisplayTypes},optionsToolbarProps:{ref:function(e){return r.optionsToolbarRef=e},responseRef:r.responseRef,onFilterClick:function(e){var t=e.isFilteringTable;return r.toggleTableFilter(r.responseRef,t)},displayType:a},showSplitViewBtn:!r.getIsSplitView()})})),yt(Tt(r),"renderBottomResponse",(function(){var t,n,a,o,i=null===(t=r.props)||void 0===t||null===(n=t.tile)||void 0===n?void 0:n.query,s=null===(a=r.props)||void 0===a||null===(o=a.tile)||void 0===o?void 0:o.secondQuery,l=!s||i===s,c=r.state.isBottomExecuting,u=r.state.isBottomExecuted;if(l&&(c=r.state.isTopExecuting,u=r.state.isTopExecuted),!l&&!r.props.secondQueryResponse||l&&!r.props.queryResponse||c||!u)return r.renderContentPlaceholder({isExecuting:c,isExecuted:u,showSplitViewBtn:r.getIsSplitView()});var p=e(r.props,"tile.secondDisplayType","table");return r.renderResponse({queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(r.QUERY_RESPONSE_KEY),ref:function(e){return r.secondResponseRef=e},optionsToolbarRef:r.secondOptionsToolbarRef,displayType:p,queryResponse:r.props.secondQueryResponse||r.props.queryResponse,dataConfig:r.props.tile.secondDataConfig,onDataConfigChange:r.onSecondDataConfigChange,queryValidationSelections:r.props.tile.secondqueryValidationSelections,onSuggestionClick:r.onSecondSuggestionClick,selectedSuggestion:e(r.props.tile,"secondSelectedSuggestion"),reportProblemCallback:r.secondReportProblemCallback,onSupportedDisplayTypesChange:r.onSecondSupportedDisplayTypesChange,onRecommendedDisplayType:function(e,t){r.onSecondSupportedDisplayTypesChange(t),r.onSecondDisplayTypeChange(e)},onNoneOfTheseClick:r.secondOnNoneOfTheseClick,onDrilldownStart:function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!0,activeKey:e})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onSecondQueryValidationSelectOption},vizToolbarProps:{displayType:p,onDisplayTypeChange:r.onSecondDisplayTypeChange,supportedDisplayTypes:r.state.secondSupportedDisplayTypes},optionsToolbarProps:{ref:function(e){return r.secondOptionsToolbarRef=e},responseRef:r.secondResponseRef,onFilterClick:function(e){var t=e.isFilteringTable;return r.toggleTableFilter(r.secondResponseRef,t)},displayType:p},showSplitViewBtn:r.getIsSplitView(),isSecondHalf:!0})})),yt(Tt(r),"renderContent",(function(){return l.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(r.props.isEditing?" editing":"","\n ").concat(r.props.tile.h<4?" small":"")},l.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-response-container"},r.getIsSplitView()?r.renderSplitResponse():r.renderTopResponse()))})),yt(Tt(r),"renderDragHandles",(function(){return l.createElement(c,null,l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle top"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle bottom"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle left"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle right"}))})),yt(Tt(r),"render",(function(){var e=r.props,t={onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onTouchStart:e.onTouchStart,onTouchEnd:e.onTouchEnd};return l.createElement(At,null,l.createElement("div",vt({className:r.props.className,style:ct({},r.props.style),"data-grid":r.props.tile},t),r.props.children,l.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(r.COMPONENT_KEY),ref:function(e){return r.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(r.getIsSplitView()?"split":"")},l.createElement(c,null,r.renderHeader(),r.renderContent())),r.props.isEditing&&r.renderDragHandles()))})),r.COMPONENT_KEY=ve(),r.QUERY_RESPONSE_KEY=ve(),r.autoCompleteTimer=void 0;var o=bn({response:t.queryResponse})||[],i=bn({response:t.secondQueryResponse})||[];return r.state={query:t.tile.query,secondQuery:t.tile.secondQuery||r.props.tile.query,title:t.tile.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,currentSource:"user",supportedDisplayTypes:o,secondSupportedDisplayTypes:i},r}return ht(a)}();yt(Ho,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,isEditing:p.bool.isRequired,tile:p.shape({}).isRequired,deleteTile:p.func.isRequired,queryResponse:p.shape({}),notExecutedText:p.string,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func}),yt(Ho,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,query:"",title:"",displayType:"table",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 Bo=l.forwardRef((function(e,t){var n=e.style,a=e.className;e.key;var r=St(e,Fo);return l.createElement("div",{style:ct({},n),className:a,ref:t},l.createElement(Ho,vt({},r,{ref:r.tileRef,className:"".concat(r.innerDivClass," ").concat(r.isEditing?"editing":""),"data-test":"react-autoql-dashboard-tile"})))})),zo=nt(tt),Uo=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},_o=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},jo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"tileRefs",{}),yt(Tt(t),"state",{isDragging:!1,previousTileState:t.props.tiles}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,t.props.executeOnMount&&t.executeDashboard(),t.setStyles(),window.addEventListener("resize",t.onWindowResize)})),yt(Tt(t),"componentDidUpdate",(function(n){ge(Ht(t.props.themeConfig),Ht(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"))!==1/0&&(t.props.isEditing&&n.tiles.length<t.props.tiles.length&&!t.state.justPerformedUndo&&t.scrollToNewTile(),t.setState({justPerformedUndo:!1}))})),yt(Tt(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)})),yt(Tt(t),"rebuildTooltips",(function(){clearTimeout(t.rebuildTooltipsTimer),t.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),500)})),yt(Tt(t),"setStyles",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(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)))})),yt(Tt(t),"setPreviousTileState",(function(e){t.setState({previousTileState:e})})),yt(Tt(t),"executeDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].processTile()}catch(e){console.error(e)}})),yt(Tt(t),"unExecuteDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),yt(Tt(t),"getChangeDetection",(function(e,n,a){return!ge(t.getChangeDetectionTileStructure(e,a),t.getChangeDetectionTileStructure(n,a))})),yt(Tt(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)}})),yt(Tt(t),"scrollToNewTile",(function(){t.scrollToNewTileTimeout=setTimeout((function(){t.ref&&t.ref.scrollIntoView(!1)}),200)})),yt(Tt(t),"onMoveStart",(function(){t.state.isDragging||t.setState({isDragging:!0})})),yt(Tt(t),"onMoveEnd",(function(e){try{t.getChangeDetection(t.props.tiles,e,!0)&&t.setPreviousTileState(t.props.tiles),t.stopDraggingTimeout=setTimeout((function(){t.setState({isDragging:!1})}),100)}catch(e){console.error(e)}})),yt(Tt(t),"updateTileLayout",(function(e){try{var n=t.props.tiles.map((function(t,n){return ct(ct({},t),e[n])}));t.props.onChange(n)}catch(e){console.error(e)}})),yt(Tt(t),"addTile",(function(){try{t.setPreviousTileState(t.props.tiles);var e=he(t.props.tiles),n=ve();e.push({key:n,i:n,w:6,h:5,x:6*Object.keys(e).length%12,y:1/0,query:"",title:""}),t.props.onChange(e)}catch(e){console.error(e)}})),yt(Tt(t),"undo",(function(){try{t.props.onChange(t.state.previousTileState),t.setState({previousTileState:t.props.tiles,justPerformedUndo:!0})}catch(e){console.error(e)}})),yt(Tt(t),"deleteTile",(function(e){try{t.setPreviousTileState(t.props.tiles);var n=he(t.props.tiles),a=n.map((function(e){return e.i})).indexOf(e);~a&&n.splice(a,1),t.props.onChange(n)}catch(e){console.error(e)}})),yt(Tt(t),"setParamsForTile",(function(e,n){try{t.setPreviousTileState(t.props.tiles);var a=he(t.props.tiles),r=a.map((function(e){return e.i})).indexOf(n);a[r]=ct(ct({},a[r]),e),Object.keys(e).includes("query")&&e.query!==t.props.tiles[r].query?(a[r].dataConfig=void 0,a[r].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==t.props.tiles[r].secondQuery&&(a[r].secondDataConfig=void 0,a[r].secondskipQueryValidation=!1),t.props.onChange(a)}catch(e){console.error(e)}})),yt(Tt(t),"runDrilldownFromAPI",(function(e,n){da(ct(ct({queryID:n,data:e},Ot(t.props.authentication)),Qt(t.props.autoQLConfig))).then((function(e){t._isMounted&&t.setState({activeDrilldownResponse:e,isDrilldownRunning:!1})})).catch((function(e){console.error(e),t._isMounted&&t.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0})}))})),yt(Tt(t),"onDrilldownStart",(function(e){var n=e.tileId,a=e.activeKey,r=e.isSecondHalf;Qt(t.props.autoQLConfig).enableDrilldowns&&(t.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:r,activeDrilldownTile:n||t.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:a,isAnimatingModal:!t.state.isDrilldownModalVisible}),t.animationTimeout=setTimeout((function(){t.setState({isAnimatingModal:!1})}),500))})),yt(Tt(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}))})),yt(Tt(t),"shouldShowOriginalQuery",(function(e){if(!e)return!1;var n=t.state.isDrilldownSecondHalf?e.secondDisplayType:e.displayType;return zt.includes(n)})),yt(Tt(t),"renderDrilldownTable",(function(){return l.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},t.state.isDrilldownRunning?l.createElement("div",{className:"dashboard-tile-loading-container"},l.createElement(Ea,null)):l.createElement(wr,{ref:function(e){return t.drilldownTableRef=e},displayType:"table",authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),dataFormatting:Ft(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}))})),yt(Tt(t),"renderChartCollapseBtn",(function(e){return l.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},l.createElement(er,{onClick:function(){t.setState({isDrilldownChartHidden:!t.state.isDrilldownChartHidden})},tooltip:t.state.isDrilldownChartHidden?"Show Chart":"Hide Chart"},l.createElement(ea,{type:"chart"}),l.createElement(ea,{type:t.state.isDrilldownChartHidden?"expand":"collapse"})))})),yt(Tt(t),"renderDrilldownModal",(function(){try{var e,n,a,r,o=t.props.tiles.find((function(e){return e.i===t.state.activeDrilldownTile}));return o&&t.state.isDrilldownSecondHalf?(e=o.secondQuery,n=o.secondQueryResponse||o.queryResponse,a=o.secondDisplayType,r=o.secondDataConfig):o&&!t.state.isDrilldownSecondHalf&&(e=o.title||o.query,n=o.queryResponse,a=o.displayType,r=o.dataConfig),l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),className:"dashboard-drilldown-modal",title:e,isVisible:t.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,onClose:function(){t.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})}},t.state.isDrilldownModalVisible&&l.createElement(c,null,o&&t.shouldShowOriginalQuery(o)&&!t.state.isDrilldownChartHidden&&l.createElement(at,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:t.state.isDrilldownChartHidden?0:35,onDragEnd:function(){t.setState({})}},l.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},!t.state.isDrilldownChartHidden&&l.createElement(wr,{authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),dataFormatting:Ft(t.props.dataFormatting),queryResponse:he(n),displayType:a,tableConfig:he(r),onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:function(e){return t.onDrilldownStart({tileId:o.i,activeKey:e})},onDrilldownEnd:t.onDrilldownEnd,activeChartElementKey:t.state.activeDrilldownChartElementKey,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary")}),t.renderChartCollapseBtn("bottom")),t.renderDrilldownTable()),t.shouldShowOriginalQuery(o)&&t.state.isDrilldownChartHidden&&t.renderChartCollapseBtn("top"),(!t.shouldShowOriginalQuery(o)||t.shouldShowOriginalQuery(o)&&t.state.isDrilldownChartHidden)&&t.renderDrilldownTable()))}catch(e){console.error(e),t.props.onErrorCallback(e)}})),yt(Tt(t),"renderEmptyDashboardMessage",(function(){return t.props.isEditable&&!t.props.isEditing?l.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",l.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.props.startEditingCallback()}},"New Dashboard")):t.props.isEditing?l.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",l.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.addTile()}},"New Tile")," ","to get started"):l.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),yt(Tt(t),"renderTiles",(function(){var e=t.props.tiles.map((function(e){return ct(ct({},e),{},{i:e.key,maxH:12,minH:2,minW:3})}));return l.createElement(zo,{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 l.createElement(Bo,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(n){return t.tileRefs[e.key]=n},key:e.key,authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),tile:ct(ct({},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:Ft(t.props.dataFormatting),notExecutedText:t.props.notExecutedText,enableDynamicCharting:t.props.enableDynamicCharting,onErrorCallback:t.props.onErrorCallback,onSuccessCallback:t.props.onSuccessCallback,autoChartAggregations:t.props.autoChartAggregations,onQueryOutputUpdate:t.rebuildTooltips,onDrilldownStart:t.onDrilldownStart,onDrilldownEnd:t.onDrilldownEnd,onCSVDownloadStart:t.props.onCSVDownloadStart,onCSVDownloadProgress:t.props.onCSVDownloadProgress,onCSVDownloadFinish:t.props.onCSVDownloadFinish})})))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement(c,null,l.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"},t.props.tiles.length?t.renderTiles():t.renderEmptyDashboardMessage()),!t.state.isDragging&&t.renderDrilldownModal(),l.createElement(fe,{className:"react-autoql-dashboard-tooltip",id:"react-autoql-dashboard-toolbar-btn-tooltip",effect:"solid",delayShow:500,html:!0}),l.createElement(fe,{place:"left",className:"react-autoql-chart-tooltip",id:"dashboard-data-limit-warning-tooltip",effect:"solid",html:!0})))})),t}return ht(a)}();yt(jo,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,tiles:p.arrayOf(p.shape({})),executeOnMount:p.bool,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}),yt(jo,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,tiles:[],executeOnMount:!0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Ko=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),yt(Tt(e),"componentDidMount",(function(){An(Ht(e.props.themeConfig))})),yt(Tt(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)})),yt(Tt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=it(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:st,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),yt(Tt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),yt(Tt(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)}}))})),yt(Tt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),yt(Tt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),yt(Tt(e),"onMouseDown",(function(){fe.hide(),e.startRecording()})),yt(Tt(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 r={headers:{Authorization:"Bearer ".concat(e.props.authentication.token)},timeout:3e4};s.post(n,a,r).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})}))}))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(Ee,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return l.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},l.createElement(ea,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},l.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},l.createElement(ea,{type:"microphone"}))),l.createElement(fe,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return ht(n)}();yt(Ko,"propTypes",{authentication:Nt,themeConfig:Mt,transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,onTranscriptChange:p.func,onFinalTranscript:p.func}),yt(Ko,"defaultProps",{authentication:It,themeConfig:Pt});export{jo as Dashboard,Bo as DashboardTile,ho as DataAlertModal,bo as DataAlerts,Oo as DataMessenger,xo as ExpressionBuilder,ro as ExpressionBuilderSimple,qo as FilterLockPopover,ea as Icon,Ea as LoadingDots,vo as NotificationFeed,$r as NotificationIcon,oo as NotificationItem,Ta as QueryInput,wr as QueryOutput,xr as ReverseTranslation,go as ScheduleBuilder,Ko as SpeechToTextButton,ba as SpeechToTextButtonBrowser,Uo as executeDashboard,ya as fetchQueryTips,Tn as getDefaultDisplayType,bn as getSupportedDisplayTypes,En as isDisplayTypeValid,_o as unExecuteDashboard};
3
+ ut=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",i=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,a){var r=t&&t.prototype instanceof p?t:p,o=Object.create(r.prototype),i=new T(a||[]);return o._invoke=function(e,t,n){var a="suspendedStart";return function(r,o){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var i=n.delegate;if(i){var s=b(i,n);if(s){if(s===u)continue;return s}}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 l=c(e,t,n);if("normal"===l.type){if(a=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function p(){}function d(){}function m(){}var f={};s(f,r,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(D([])));h&&h!==t&&n.call(h,r)&&(f=h);var y=m.prototype=p.prototype=Object.create(f);function v(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){var a;this._invoke=function(r,o){function i(){return new t((function(a,i){!function a(r,o,i,s){var l=c(e[r],e,o);if("throw"!==l.type){var u=l.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){a("next",e,i,s)}),(function(e){a("throw",e,i,s)})):t.resolve(p).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,s)}))}s(l.arg)}(r,o,a,i)}))}return a=a?a.then(i,i):i()}}function b(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,b(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 r=a.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):r:(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[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function t(){for(;++a<e.length;)if(n.call(e,a))return t.value=e[a],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return d.prototype=m,s(y,"constructor",m),s(m,"constructor",d),d.displayName=s(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,s(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},v(C.prototype),s(C.prototype,o,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,a,r,o){void 0===o&&(o=Promise);var i=new C(l(t,n,a,r),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},v(y),s(y,i,"Generator"),s(y,r,(function(){return this})),s(y,"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 r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.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 r=a.arg;S(n)}return r}}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 pt(e){return(pt="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 dt(e,t,n,a,r,o,i){try{var s=e[o](i),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(a,r)}function mt(e){return function(){var t=this,n=arguments;return new Promise((function(a,r){var o=e.apply(t,n);function i(e){dt(o,a,r,i,s,"next",e)}function s(e){dt(o,a,r,i,s,"throw",e)}i(void 0)}))}}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(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 ht(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=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&&Et(e,t)}function bt(e){return(bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t){return(Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function St(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dt(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 Tt(e)}function xt(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=bt(e);if(t){var r=bt(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return Dt(this,n)}}function wt(e){return function(e){if(Array.isArray(e))return kt(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 kt(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 kt(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 kt(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 At=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{hasError:!1}),yt(Tt(e),"componentDidCatch",(function(t,n){e.setState({hasError:!0})})),yt(Tt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),yt(Tt(e),"render",(function(){return e.state.hasError?l.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return ht(n)}();yt(At,"propTypes",{message:p.string}),yt(At,"defaultProps",{message:null});var Nt=d({token:m,apiKey:m,domain:m}),Rt=d({currencyCode:m,languageCode:m,currencyDecimals:f,quantityDecimals:f,comparisonDisplay:m,monthYearFormat:m,dayMonthYearFormat:m}),Vt=d({debug:g,test:g,enableAutocomplete:g,enableQueryValidation:g,enableDrilldowns:g,enableQuerySuggestions:g,enableColumnVisibilityManager:g,enableNotifications:g}),Mt=d({theme:h(["light","dark"]),chartColors:y(m),accentColor:m,fontFamily:m,dashboardBackground:m});d({stringColumnIndices:y(f),numberColumnIndices:y(f),stringColumnIndex:f,legendColumnIndex:f,numberColumnIndex:f});var It={token:void 0,apiKey:void 0,domain:void 0},qt={currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMM YYYY",dayMonthYearFormat:"ll"},Lt={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,defaultShowInterpretation:!1,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableSlackSharing:!0,enableTeamsSharing:!0,enableCSVDownload:!1},Pt={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",titleColor:"#356f90",dashboardBackground:"#fafafa"},Ot=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},It),e)},Ft=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},qt),e)},Qt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},Lt),e)},Ht=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ct(ct({},Pt),e)};n.extend(o),n.extend(i),n.extend(a),n.extend(r),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 Bt=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],zt=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line"],Ut={1:n("2020-1-1").format("MMMM"),2:n("2020-2-2").format("MMMM"),3:n("2020-3-3").format("MMMM"),4:n("2020-4-4").format("MMMM"),5:n("2020-5-5").format("MMMM"),6:n("2020-6-6").format("MMMM"),7:n("2020-7-7").format("MMMM"),8:n("2020-8-8").format("MMMM"),9:n("2020-9-9").format("MMMM"),10:n("2020-10-10").format("MMMM"),11:n("2020-11-11").format("MMMM"),12:n("2020-12-12").format("MMMM")},_t={"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"},jt={"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"},Kt=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},Gt=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Wt=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t},Yt=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Xt=function(e){var t=[],n=[],a=[];return e.forEach((function(e,r){var o=e.type;e.is_visible&&("DOLLAR_AMT"===o?t.push(r):"QUANTITY"===o?n.push(r):"PERCENT"!==o&&"RATIO"!==o||a.push(r))})),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}},Jt=function(e){if(e&&function(e){return!Kt(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}))},Zt=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},$t=function(t,n){if(t){var a=Jt(t),r=Zt(t),o=[];t.forEach((function(e,t){(Wt(e)||e.groupable)&&t!==a&&e.is_visible&&o.push(t)}));var i=o[0];if(n)i=e(t[r],"groupable")?r:t.findIndex((function(e){return e.groupable}));else r>=0?i=r:o[1]>=0&&(i=o[1]);return{stringColumnIndex:i,stringColumnIndices:o}}},en=function(e){var t=0,n=0;return e.forEach((function(e){Gt(e)&&e.is_visible?n+=1:Wt(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},tn=function(e,t,n){return n.indexOf(e)===t},nn=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=[],r=0;r<t;r++){a[r]=[];for(var o=0;o<e;o++)a[r][o]=n}return a},an=function(e){return"Invalid Date"!==e},rn=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 r=a.monthYearFormat,o=a.dayMonthYearFormat,i="YYYY",s=r||"MMM YYYY",l=o||"ll",c=t.title,u=n.unix(e).utc().format(l);return Number.isNaN(Number(e))?(c&&c.toLowerCase().includes("year")?u=n(e).format(i):c&&c.toLowerCase().includes("month")&&(u=n(e).format(s)),u=n(e).format(l)):c&&c.toLowerCase().includes("year")?u=n.unix(e).utc().format(i):c&&c.toLowerCase().includes("month")&&(u=n.unix(e).utc().format(s)),an(u)?u:e}catch(t){return console.error(t),e}},on=function(t,a){if(t){if(t&&"string"==typeof t){var r,o,i=t.split("-"),s=e(i,"[0]"),l=e(i,"[2]");e(i,"[1]","").includes("W")?o=e(i,"[1]"):r=e(i,"[1]");var c=a.monthYearFormat||"MMM YYYY",u=a.dayMonthYearFormat||"ll";if(l){var p=n(t).format(u);if(an(p))return p}else if(r){var d=n(t).format(c);if(an(d))return d}else{if(o)return t;if(s)return s}}return t}},sn=function(e){var t=e.d,n=e.col,a=void 0===n?{}:n,r=e.config,o=void 0===r?{}:r;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=o.currencyCode,s=o.languageCode,l=t;switch(a.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var c=i||"USD";try{l=new Intl.NumberFormat(s,{style:"currency",currency:"".concat(c),minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(s,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}}break;case"QUANTITY":Number(t)&&(l=new Intl.NumberFormat(s).format(t));break;case"DATE":l=rn(t,a,o);break;case"DATE_STRING":l=on(t,o);break;case"PERCENT":if(Number(t)){var u=Number(t)/100;l=new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:0}).format(u)}}var p=l,d=!1;return"string"==typeof l&&l.length>20&&(l="".concat(l.substring(0,20),"..."),d=!0),{fullWidthLabel:p,formattedLabel:l,isTruncated:d}},ln=function(e){var t=e.element,n=e.column,a=e.config,r=void 0===a?{}:a,o=e.htmlElement;try{var i=t,s=r.currencyCode,l=r.languageCode,c=r.currencyDecimals,u=r.quantityDecimals;if(n)switch(n.type){case"STRING":break;case"DOLLAR_AMT":if(Number(t)||0===Number(t)){var p=s||"USD",d=c||0===c?c:void 0;try{i=new Intl.NumberFormat(l,{style:"currency",currency:"".concat(p),minimumFractionDigits:d,maximumFractionDigits:d}).format(t)}catch(e){console.error(e),i=new Intl.NumberFormat(l,{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(l,{minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}break;case"DATE":i=rn(t,n,r);break;case"DATE_STRING":i=on(t,r);break;case"RATIO":Number(t)&&(i=new Intl.NumberFormat(l,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(Number(t)){var g=Number(t)/100;i=new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(g),o&&o.classList.add("comparison-value-".concat(t<0?"negative":"positive"))}}return i}catch(e){return console.error(e),t}},cn=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}},un=function(e){var t;try{e&&(t=e.getBBox())}catch(e){console.error(e)}return t},pn=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,r){try{var o=cn(e),i=e.getBoundingClientRect(),s=2*i.width,l=2*i.height,c=document.createElement("canvas");c.width=s+t,c.height=l+t;var u=c.getContext("2d"),p=new Image;p.onload=function(){if(u.drawImage(this,t,t,s,l),n){var e=document.createElement("canvas");e.width=c.width,e.height=c.height;var r=e.getContext("2d");r.save(),r.fillStyle=n,r.fillRect(0,0,c.width,c.height),r.strokeRect(0,0,c.width,c.height),r.restore(),r.drawImage(c,0,0),c=e}a(c.toDataURL("image/png",1))},p.onerror=function(e){r("failed to load image with that url"+url)},p.src=o}catch(e){console.error(e),r("failed to convert svg to png "+e)}}))},dn=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},mn=function(e){return zt.includes(e)},fn=function(e){return Bt.includes(e)},gn=function(e){return 2===dn(e)&&3===e.length},hn=function(e){var t=en(e),n=t.amountOfNumberColumns,a=t.amountOfStringColumns;return n>0&&a>0},yn=function(n){return t(e(n,"data.data.columns"),(function(e){return e.is_visible}))},vn=function(n){var a=e(n,"data.data.columns.length"),r=function(n){return t(e(n,"data.data.columns"),(function(e){return!e.is_visible}))}(n);return a&&!!r.length},Cn=function(t){var n=e(t,"data.data.columns.length"),a=yn(t);return n&&!a.length},bn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,a=t.shouldExcludePieChart,r=t.dataLength;try{if(!e(n,"data.data.display_type"))return[];var o=n.data.data.display_type;if("suggestion"===o||"help"===o||"html"===o)return[o];var i=e(n,"data.data.rows",[]),s=yn(n);if(!e(s,"length")||!e(i,"length"))return["text"];if(Rn(n))return["single-value"];var l=r||i.length,c=0===r;if(gn(s)&&!c){var u=["table"];return i.length<1e3?u.push("pivot_table","stacked_column","stacked_bar","stacked_line","column","bar","line","bubble","heatmap"):console.warn("Supported Display Types: Rows exceeded 1000, only allowing regular table display type"),u}if(hn(s)&&!c){var p=["table","column","bar","line"];l<=10&&!a&&p.push("pie");var d=s.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),m=s[d];if(m&&m.display_name.toLowerCase().includes("month")&&2===s.length){var f=e(n,"data.data.rows"),g=[];f.forEach((function(e){var t=ln({element:e[d],column:m,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});g.includes(t)||g.push(t)})),g.length>1&&p.push("pivot_table")}return p}return["table"]}catch(e){return console.error(e),["table"]}},En=function(e,t){var n=bn({response:e});return t&&n.includes(t)},Sn=function(e,t){var n=e.find((function(e){return mn(e)}));return n||t},Tn=function(t,n){var a=bn({response:t}),r=e(t,"data.data.display_type");if("suggestion"===r||"help"===r||"html"===r)return r;if(1===a.length)return a[0];if(a.includes("pivot_table")){var o="pivot_table";return n&&(o=Kt(e(t,"data.data.columns"))?Sn(a,"pivot_table"):"pivot_table"),o}if(!r&&Vn(t)||"data"===r){var i="table";return n&&(i=Kt(e(t,"data.data.columns"))?Sn(a,"table"):"table"),i}return"text"},Dn=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}},xn=function(e,t,n){if(null==e||!e.length||!t)return 0;var a=Dn(sn({d:e[0],col:t,config:n}));return e.forEach((function(e){var r=sn({d:e,col:t,config:n}).formattedLabel,o=Dn(r);o>a&&(a=o)})),a},wn=function(e,t){if(!isNaN(e)&&!isNaN(t)){var n=e-t;return Math.abs(n)<5||e<t}},kn=function(e,t){try{return e.bandwidth()+t*e.bandwidth()*2}catch(e){return console.error(e),0}},An=function(e){if(e){var t=e.theme,n=e.accentColor,a=e.fontFamily,r=e.accentTextColor,o="light"===t?_t:jt;if(n&&(o["accent-color"]=n),a&&(o["font-family"]=a),r)o["accent-text-color"]=r;else{var i=n;"#"===i.slice(0,1)&&(i=i.slice(1)),3===i.length&&(i=i.split("").map((function(e){return e+e})).join(""));var s=(299*parseInt(i.substr(0,2),16)+587*parseInt(i.substr(2,2),16)+114*parseInt(i.substr(4,2),16))/1e3;o["accent-text-color"]=s>=140?"black":"white"}for(var l in o)document.documentElement.style.setProperty("--react-autoql-".concat(l),o[l])}},Nn=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},Rn=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},Vn=function(t){if(!t)return!1;var n=e(t,"data.data.rows.length")&&e(t,"data.data.rows.length");return n},Mn=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)}},In={GENERAL_QUERY:l.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:l.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:l.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.")},qn=new Ge({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",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",filterColumn:"Columna de filtro",columnName:"Nombre de columna",visibility:"Visibilidad",cancel:"Cancelar",apply:"Aplicar"}}),Ln=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.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"}),l.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"})),Pn=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.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"}))))),On=l.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},l.createElement("g",null,l.createElement("g",null,l.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"})),l.createElement("g",null,l.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"})))),Fn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Qn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Hn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),Bn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"})),zn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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 "})),Un=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"}),l.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"})),_n=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),l.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"}),l.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),l.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"}),l.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),l.createElement("g",null,l.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),l.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"}),l.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),jn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),l.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"}),l.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),l.createElement("g",null,l.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),l.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"}),l.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),l.createElement("g",null,l.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),l.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"}),l.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Kn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",{className:"st2"},l.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"})),l.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"}),l.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"})),Gn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),l.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),l.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),l.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),l.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),l.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),l.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),l.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),l.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),l.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),l.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),l.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),l.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),l.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),l.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),l.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),Wn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),l.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Yn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.createElement("g",null,l.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),l.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"}),l.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"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),l.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Xn=l.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},l.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"}),l.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),Jn="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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",Zn="data:image/png;base64,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",$n=["type","size","showBadge","warning","danger"],ea=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger;var n=St(t,$n),a=null;switch(e.props.type){case"back":a=l.createElement(ee,null);break;case"bar-chart":a=Bn;break;case"stacked-bar-chart":a=_n;break;case"bubble-chart":a=Wn;break;case"calendar":a=l.createElement($,null);break;case"caret-right":a=l.createElement(V,null);break;case"caret-left":a=l.createElement(R,null);break;case"caret-down":a=l.createElement(N,null);break;case"caret-up":a=l.createElement(A,null);break;case"react-autoql-bubbles-outlined":a=Ln;break;case"react-autoql-bubbles-filled":a=On;break;case"react-autoql-bubbles-filled-alt":a=Pn;break;case"chart":a=l.createElement(M,null);break;case"check":a=l.createElement(Z,null);break;case"close":a=l.createElement(de,null);break;case"maximize":a=l.createElement(J,null);break;case"minimize":a=l.createElement(X,null);break;case"close-circle":a=l.createElement(oe,null);break;case"collapse":a=l.createElement(q,null);break;case"column-chart":a=Hn;break;case"stacked-column-chart":a=jn;break;case"copy":a=l.createElement(pe,null);break;case"dashboard":a=l.createElement(k,null);break;case"database":a=l.createElement(Y,null);break;case"description":a=l.createElement(w,null);break;case"download":a=l.createElement(W,null);break;case"edit":a=l.createElement(x,null);break;case"expand":a=l.createElement(I,null);break;case"eye":a=l.createElement(G,null);break;case"filter":a=l.createElement(K,null);break;case"globe":a=l.createElement(re,null);break;case"heatmap":a=Gn;break;case"hour-glass":a=l.createElement(ae,null);break;case"info":a=l.createElement(ue,null);break;case"light-bulb":a=l.createElement(D,null);break;case"line-chart":a=zn;break;case"lock":a=l.createElement(ce,null);break;case"stacked-line-chart":a=Kn;break;case"teams":a=l.createElement("img",{className:"slack-logo",src:Zn,alt:"Slack",style:ct(ct({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"menu":a=l.createElement(T,null);break;case"microphone":a=l.createElement(L,null);break;case"more-vertical":a=l.createElement(j,null);break;case"more-horizontal":a=l.createElement(_,null);break;case"notification":a=l.createElement(U,null);break;case"notification-off":a=l.createElement(z,null);break;case"notification-pause":a=l.createElement(B,null);break;case"numbers":a=l.createElement(me,null);break;case"pie-chart":a=Un;break;case"play":a=l.createElement(le,null);break;case"pivot-table":a=Qn;break;case"plus":a=l.createElement(H,null);break;case"question":a=l.createElement(S,null);break;case"report":a=l.createElement(te,null);break;case"search":a=l.createElement(ne,null);break;case"send":a=l.createElement(Q,null);break;case"settings":a=l.createElement(F,null);break;case"slack":a=l.createElement("img",{className:"slack-logo",src:Jn,alt:"Slack",style:ct(ct({},e.props.style),{},{height:"1em",width:"1em"}),draggable:"false"});break;case"split-view":a=Yn;break;case"single-view":a=Xn;break;case"table":a=Fn;break;case"title":a=l.createElement(E,null);break;case"trash":a=l.createElement(O,null);break;case"unlock":a=l.createElement(se,null);break;case"warning":a=l.createElement(ie,null);break;case"warning-triangle":a=l.createElement(P,null)}return l.createElement(At,null,l.createElement("span",vt({},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:ct({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),a,e.props.showBadge&&l.createElement("div",{className:"react-autoql-badge"})))})),e}return ht(n)}();yt(ea,"propTypes",{type:p.string.isRequired,size:p.number,showBadge:p.bool,color:p.string,warning:p.bool,danger:p.bool}),yt(ea,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var ta=function(t){try{var n=e(t,"data.data.parsed_interpretation");if(!n)return;var a=[];return e(n,"length")&&n.forEach((function(e){"FILTER"===e.c_type?na(e).forEach((function(e){a.push(e)})):a.push(e)})),a}catch(e){return void console.error(e)}},na=function(e){try{for(var t,n=/'(''|[^'])*'/g,a=e.eng,r=[];null!=(t=n.exec(a));)r.push(t);return r.length?function(e,t,n){var a=0,r=[];return t.forEach((function(o,i){if(o.index>a){var s=e.substring(a,o.index);r.push({c_type:"TEXT",eng:s})}var l=o[0].length+o.index,c=e.substring(o.index,l),u=ra(c);if(a=l,r.push({c_type:n,eng:u}),i===t.length-1&&l<e.length){var p=e.substring(l,e.length);r.push({c_type:"TEXT",eng:p})}})),r}(a,r,"VALUE_LABEL"):[aa(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}},aa=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}}},ra=function(e){return e.substring(1,e.length-1).replace("''","'")},oa=function(e){try{return e.join(".")}catch(e){return}},ia=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}},sa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.queryId,r=t.domain,o=t.apiKey,i=t.token;if(!n)return Promise.reject(new Error("No query supplied"));if(!r||!i||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(o,"&search=").concat(encodeURIComponent(n),"&scope=narrow&query_id=").concat(a),c={headers:{Authorization:"Bearer ".concat(i)}};return s.get(l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},la=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.userSelection,r=t.debug,o=t.test,i=t.domain,l=t.apiKey,c=t.token,u=t.source,p=t.filters,d="".concat(i,"/autoql/api/v1/query?key=").concat(l),m=ia(a),f={text:n,source:oa(u),translation:r?"include":"exclude",user_selection:m,test:o,session_filter_locks:p};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!l||!i||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var g={headers:{Authorization:"Bearer ".concat(c)}};return s.post(d,f,g).then((function(e){if(e.data&&"string"==typeof e.data)throw new Error("Parse error");var t=ta(e);return t&&(e.data.data.reverse_translation=t),Promise.resolve(e)})).catch((function(t){if(console.error(t),"Parse error"===t.message)return Promise.reject({error:"Parse error"});if(401===t.response||!e(t,"response.data"))return Promise.reject({error:"Unauthenticated"});if("1.1.430"===e(t,"response.data.reference_id")||"1.1.431"===e(t,"response.data.reference_id")){var a=e(t,"response.data.data.query_id");return sa({query:n,queryId:a,domain:i,apiKey:l,token:c})}return Promise.reject(e(t,"response"))}))},ca=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?la(t):pa({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):la(t)})).catch((function(e){return console.error(e),Promise.reject(e)}))},ua=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,a=t.domain,r=t.apiKey,o=t.token,i=t.csvProgressCallback;if(!o||!a||!r)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(r),c={headers:{Authorization:"Bearer ".concat(o)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return s.post(l,{},c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},pa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.text,a=t.domain,r=t.apiKey,o=t.token;if(!n)return Promise.reject(new Error("No text supplied"));if(!o||!a||!r)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/validate?text=").concat(encodeURIComponent(n),"&key=").concat(r),l={headers:{Authorization:"Bearer ".concat(o)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},da=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryID,a=t.groupBys,r=t.debug,o=t.test,i=t.domain,l=t.apiKey,c=t.token;if(!n)return Promise.reject(new Error("Query ID not supplied"));if(!c||!i||!l)return Promise.reject(new Error("Unauthenticated"));var u={translation:r?"include":"exclude",columns:a,test:o},p={headers:{Authorization:"Bearer ".concat(c)}},d="".concat(i,"/autoql/api/v1/query/").concat(n,"/drilldown?key=").concat(l);return s.post(d,u,p).then((function(e){var t=ta(e);return t&&(e.data.data.reverse_translation=t),Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ma=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,r=t.apiKey,o=t.token;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/autocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),l={headers:{Authorization:"Bearer ".concat(o)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},fa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,r=t.token,o=t.apiKey;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/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(o),l={headers:{Authorization:"Bearer ".concat(r)}};return s.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ga=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.filters;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));if(null==o||!o.length)return Promise.reject(new Error("No filters provided"));var i="".concat(r,"/autoql/api/v1/query/filter-locking?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}},c={columns:o};return s.put(i,c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ha=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.columns,i="".concat(r,"/autoql/api/v1/query/column-visibility?key=").concat(n),l={columns:o};if(!a||!r||!n)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(a)}};return s.put(i,l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ya=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.keywords,a=t.pageSize,r=t.pageNumber,o=t.domain,i=t.apiKey,l=t.token,c=t.skipQueryValidation,u=n?n.split(" "):[],p="".concat(o,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(u),"&page_size=").concat(a,"&page=").concat(r);if(!l||!o||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(l)}};return c?s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):pa({text:n,domain:o,apiKey:i,token:l}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return s.get(p,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}))},va=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.message,a=t.queryId,r=t.domain,o=t.apiKey,i=t.token;if(!a)return Promise.reject(new Error("No query ID supplied"));if(!i||!r||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(r,"/autoql/api/v1/query/").concat(a,"?key=").concat(o),c={headers:{Authorization:"Bearer ".concat(i)}},u={is_correct:!1,message:n};return s.put(l,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ca=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"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)})),yt(Tt(e),"onMouseDown",(function(){fe.hide(),e.props.startListening()})),yt(Tt(e),"render",(function(){var t=e.props;t.transcript,t.interimTranscript,t.resetTranscript;var n=t.browserSupportsSpeechRecognition;t.startListening;var a=t.stopListening,r=t.listening;return n?l.createElement(At,null,l.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(r?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},l.createElement(ea,{type:"microphone"})),l.createElement(fe,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return ht(n)}();yt(Ca,"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}),yt(Ca,"defaultProps",{});var ba=_e({autoStart:!1,continuous:!1})(Ca);function Ea(){return l.createElement("div",{className:"response-loading","data-test":"loading-dots"},l.createElement("div",null),l.createElement("div",null),l.createElement("div",null),l.createElement("div",null))}var Sa=[],Ta=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"UNIQUE_ID",ve()),yt(Tt(t),"autoCompleteTimer",void 0),yt(Tt(t),"state",{inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1}),yt(Tt(t),"componentDidMount",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig)),t.props.inputValue!==e.inputValue&&t.setState({inputValue:t.props.inputValue})})),yt(Tt(t),"componentWillUnmount",(function(){t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer),t.queryValidationTimer&&clearTimeout(t.queryValidationTimer)})),yt(Tt(t),"animateInputTextAndSubmit",(function(n){var a=n.query,r=n.userSelection;n.skipQueryValidation;var o=n.source;if("string"==typeof a&&e(a,"length"))for(var i=function(e){setTimeout((function(){t.setState({inputValue:a.slice(0,e)}),e===a.length&&setTimeout((function(){t.submitQuery({queryText:a,userSelection:r,skipQueryValidation:!0,source:o})}),300)}),50*e)},s=1;s<=a.length;s++)i(s)})),yt(Tt(t),"submitQuery",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.queryText,a=e.userSelection,r=e.skipQueryValidation,o=e.source;t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer);var i={isQueryRunning:!0,suggestions:[],queryValidationResponse:void 0,queryValidationComponentId:ve()};t.props.clearQueryOnSubmit&&(i.inputValue=""),t.setState(i);var s=n||t.state.inputValue,l=[].concat(wt(t.props.source),[o||"user"]);s.trim()&&(t.props.onSubmit(s),r?la(ct(ct(ct({query:s,userSelection:a},Ot(t.props.authentication)),Qt(t.props.autoQLConfig)),{},{source:l,AutoAEId:t.props.AutoAEId,filters:t.props.queryFilters})).then((function(e){t.props.onResponseCallback(e,s),t.setState({isQueryRunning:!1})})).catch((function(e){console.error(e),t.props.onResponseCallback(e),t.setState({isQueryRunning:!1})})):ca(ct(ct(ct({query:s},Ot(t.props.authentication)),Qt(t.props.autoQLConfig)),{},{source:l,AutoAEId:t.props.AutoAEId,filters:t.props.queryFilters})).then((function(e){t.props.onResponseCallback(e,s),t.setState({isQueryRunning:!1})})).catch((function(e){var n=e||{error:"Unauthenticated"};t.props.onResponseCallback(n),t.setState({isQueryRunning:!1})})),t.setState({lastQuery:s,suggestions:[]}),localStorage.setItem("inputValue",s))})),yt(Tt(t),"onKeyDown",(function(n){"ArrowUp"!==n.key||e(t.state.suggestions,"length")||t.setState({inputValue:localStorage.getItem("inputValue")})})),yt(Tt(t),"onKeyPress",(function(e){"Enter"==e.key&&t.submitQuery()})),yt(Tt(t),"onTranscriptChange",(function(e){t.setState({inputValue:e})})),yt(Tt(t),"onFinalTranscript",(function(){t.focus()})),yt(Tt(t),"setInputRef",(function(e){t.inputRef=e})),yt(Tt(t),"focus",(function(){if(t.inputRef)t.inputRef.focus();else{var e=document.getElementsByClassName("".concat(t.UNIQUE_ID));e&&e[0]&&e[0].focus()}})),yt(Tt(t),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(t.userSelectedValue=e.name,t.userSelectedSuggestion=!0,t.setState({inputValue:e.name}))})),yt(Tt(t),"runQueryValidation",(function(n){var a=n.text;t.setState({queryValidationResponse:void 0,queryValidationComponentId:ve()}),t.queryValidationTimer&&clearTimeout(t.queryValidationTimer),t.queryValidationTimer=setTimeout((function(){pa(ct({text:a},Ot(t.props.authentication))).then((function(n){t.state.inputValue===e(n,"data.data.query")&&t.setState({queryValidationResponse:n,queryValidationComponentId:ve()})})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(t),"onSuggestionsFetchRequested",(function(n){var a=n.value;t.autoCompleteTimer&&clearTimeout(t.autoCompleteTimer),t.autoCompleteTimer=setTimeout((function(){ma(ct({suggestion:a},Ot(t.props.authentication))).then((function(n){var a,r=e(n,"data.data"),o=[];Sa=[],a=r.matches;for(var i=0;i<a.length&&(o.push(a[i]),4!==i);i++);o.sort((function(e,t){return t.length-e.length}));for(var s=0;s<o.length;s++){var l={name:o[s]};Sa.push(l)}t.setState({suggestions:Sa})})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(t),"onSuggestionsClearRequested",(function(){t.setState({suggestions:[]})})),yt(Tt(t),"onInputChange",(function(e){(!t.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(e&&e.target&&(e.target.value||""===e.target.value)?t.setState({inputValue:e.target.value}):t.submitQuery({queryText:t.userSelectedValue}),t.props.isBackButtonClicked&&t.setState({inputValue:""}))})),yt(Tt(t),"moveCaretAtEnd",(function(e){var t=e.target.value;e.target.value="",e.target.value=t})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-bar-container ".concat(t.props.className," ").concat("below"===t.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},l.createElement("div",{className:"react-autoql-chatbar-input-container"},Qt(t.props.autoQLConfig).enableAutocomplete?l.createElement(Ue,{lassName:"auto-complete-chata",onSuggestionsFetchRequested:t.onSuggestionsFetchRequested,onSuggestionsClearRequested:t.onSuggestionsClearRequested,getSuggestionValue:t.userSelectedSuggestionHandler,suggestions:t.state.suggestions,ref:function(e){t.autoSuggest=e},renderSuggestion:function(e){return l.createElement(c,null,e.name)},inputProps:{className:"".concat(t.UNIQUE_ID," react-autoql-chatbar-input").concat(t.props.showChataIcon?" left-padding":""),placeholder:t.props.placeholder||"Type your queries here",disabled:t.props.isDisabled,onChange:t.onInputChange,onKeyPress:t.onKeyPress,onKeyDown:t.onKeyDown,value:t.state.inputValue,onFocus:t.moveCaretAtEnd,autoFocus:!0}}):l.createElement("input",{className:"react-autoql-chatbar-input".concat(t.props.showChataIcon?" left-padding":""),placeholder:t.props.placeholder||"Type your queries here",value:t.state.inputValue,onChange:function(e){return t.setState({inputValue:e.target.value})},"data-test":"chat-bar-input",onKeyPress:t.onKeyPress,onKeyDown:t.onKeyDown,disabled:t.props.isDisabled,ref:t.setInputRef,onFocus:t.moveCaretAtEnd,autoFocus:!0})),t.props.showChataIcon&&l.createElement("div",{className:"chat-bar-input-icon"},l.createElement(ea,{type:"react-autoql-bubbles-outlined"})),t.props.showLoadingDots&&t.state.isQueryRunning&&l.createElement("div",{className:"input-response-loading-container"},l.createElement(Ea,null)),t.props.enableVoiceRecord&&l.createElement(ba,{onTranscriptChange:t.onTranscriptChange,onFinalTranscript:t.onFinalTranscript,themeConfig:t.props.themeConfig,authentication:Ot(t.props.authentication)})))})),t}return ht(a)}();yt(Ta,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,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({})),clearQueryOnSubmit:p.bool}),yt(Ta,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,onSubmit:function(){},onResponseCallback:function(){}});var Da=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.firstRender=!1,r.setTableHeaderValues=setTimeout((function(){r.setInitialHeaderFilters(),r.setFilterTags({isFilteringTable:!1})}),100)})),yt(Tt(r),"componentDidUpdate",(function(t,n){if(ge(Ht(r.props.themeConfig),Ht(t.themeConfig))||An(Ht(r.props.themeConfig)),r.ref&&(r.setDimensionsTimeout=setTimeout((function(){if(r._isMounted){var t=e(r.ref,"ref.offsetHeight");t&&(r.tableHeight=t)}}),0)),r.props.isResizing&&(r.isResizing=!0),!r.state.isFilteringTable&&n.isFilteringTable)try{r.setFilterTags({isFilteringTable:r.state.isFilteringTable})}catch(e){console.error(e),r.props.onErrorCallback(e)}})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.setTableHeaderValues),clearTimeout(r.setDimensionsTimeout),r.resetFilterTags(),r.existingFilterTag=void 0,r.filterTagElements=void 0})),yt(Tt(r),"setInitialHeaderFilters",(function(){e(r.props,"headerFilters.length")&&e(r.ref,"table")&&r.props.headerFilters.forEach((function(e){r.ref.table.setHeaderFilterValue(e.field,e.value)}))})),yt(Tt(r),"cellClick",(function(e,t){r.props.onCellClick(t)})),yt(Tt(r),"copyToClipboard",(function(){var e;r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table&&r.ref.table.copyToClipboard("active",!0)})),yt(Tt(r),"saveAsCSV",(function(){var e;return r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table?(r.ref.table.download("csv","export.csv",{delimiter:","}),Promise.resolve()):Promise.reject()})),yt(Tt(r),"resetFilterTags",(function(){r.filterTagElements.length&&r.filterTagElements.forEach((function(e){try{e.parentNode&&r._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),yt(Tt(r),"setFilterTags",(function(){var e,t;r.resetFilterTags(),r._isMounted&&null!==(e=r.ref)&&void 0!==e&&e.table&&(t=r.ref.table.getHeaderFilters()),t&&t.forEach((function(e,t){try{var n=e.field;r.filterTagElements[n]=document.createElement("span"),r.filterTagElements[n].innerText="F",r.filterTagElements[n].setAttribute("class","filter-tag"),r.columnTitleEl=document.querySelector("#react-autoql-table-container-".concat(r.TABLE_ID,' .tabulator-col[tabulator-field="').concat(n,'"] .tabulator-col-title')),r.columnTitleEl.insertBefore(r.filterTagElements[n],r.columnTitleEl.firstChild)}catch(e){console.error(e),r.props.onErrorCallback(e)}}))})),yt(Tt(r),"toggleTableFilter",(function(e){var t=e.isFilteringTable;r.setState({isFilteringTable:t})})),yt(Tt(r),"getTableHeight",(function(){return r.tableHeight?"".concat(r.tableHeight,"px"):"".concat(e(r.props,"style.height"),"px")})),yt(Tt(r),"render",(function(){var e=r.getTableHeight();return l.createElement(At,null,l.createElement("div",{id:"react-autoql-table-container-".concat(r.TABLE_ID),ref:function(e){return r.tableContainer=e},"data-test":"react-autoql-table",className:"react-autoql-table-container \n ".concat(r.supportsDrilldown?"supports-drilldown":"","\n ").concat(r.state.isFilteringTable?" filtering":"","\n ").concat(r.props.isResizing?" resizing":""),style:ct(ct({},r.props.style),{},{flexBasis:e})},r.props.data&&r.props.columns&&l.createElement(Re,{ref:function(e){return r.ref=e},id:"react-autoql-table-".concat(r.TABLE_ID),columns:r.state.columns,data:r.props.data,cellClick:r.cellClick,options:r.tableOptions,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",clipboard:!0,download:!0})))})),r.TABLE_ID=ve(),r.firstRender=!0,r.ref=null,r.filterTagElements=[],r.supportsDrilldown=Kt(t.columns),r.tableOptions={layout:"fitDataFill",textSize:"9px",movableColumns:!0,progressiveRender:!0,progressiveRenderSize:5,progressiveRenderMargin:100,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1},dataFiltered:function(e,n){if(r._isMounted&&r.ref&&!r.firstRender){var a=r.ref.table.getHeaderFilters();t.onFilterCallback(a,n)}},downloadReady:function(e,t){return t}},An(Ht(t.themeConfig)),r.state={columns:r.props.columns,isFilteringTable:!1},r}return ht(a)}();yt(Da,"propTypes",{themeConfig:Mt,data:p.arrayOf(p.array),columns:p.arrayOf(p.shape({})),onFilterCallback:p.func,isResizing:p.bool}),yt(Da,"defaultProps",{themeConfig:Pt,data:void 0,columns:void 0,isResizing:!1,onFilterCallback:function(){},onCellClick:function(){},onErrorCallback:function(){}});var xa={themeConfig:Mt,dataFormatting:Rt,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},wa={themeConfig:Pt,dataFormatting:qt,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},ka=ct(ct({},xa),{},{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}),Aa=ct(ct({},wa),{},{leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0}),Na=ct(ct({},ka),{},{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}),Ra=ct(ct({},Aa),{},{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}),Va=ct(ct({},ka),{},{xScale:p.func.isRequired,yScale:p.func.isRequired}),Ma={activeKey:void 0,onChartClick:function(){}},Ia=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||!ge(e.legendColumn,t.legendColumn)||!ge(e.columns,t.columns)||!ge(e.numberColumnIndices,t.numberColumnIndices)||!ge(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!ge(e.data,t.data)},qa=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)},La=function(e,t){return"".concat(e,"-").concat(t)},Pa=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)||!ge(e.numberColumnIndices,t.numberColumnIndices)||!ge(e.legendLabels,t.legendLabels)||e.stringColumnIndex!==t.stringColumnIndex)},Oa=function(e){var t=e.row,n=e.columns,a=e.colIndex,r=e.stringColumnIndex,o=e.legendColumn,i=e.dataFormatting;try{var s,l=n[r],c=n[a],u=l.title,p=c.origColumn?c.origColumn.title:c.title,d=ln({element:t[r],column:l,config:i}),m=ln({element:t[a]||0,column:n[a],config:i}),f=o?"<div><strong>".concat(o.title,":</strong> ").concat(null==n||null===(s=n[a])||void 0===s?void 0:s.title,"</div>"):"",g="<div><strong>".concat(u,":</strong> ").concat(d,"</div>"),h="<div><strong>".concat(p,":</strong> ").concat(m,"</div>");return"<div>\n ".concat(f,"\n ").concat(g,"\n ").concat(h,"\n </div>")}catch(e){return console.error(e),null}},Fa=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return 0}},Qa=function(e,t,n){var a={},r={};return e.forEach((function(e){var o=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?a[o]?a[o]+=i:a[o]=i:i<0&&(r[o]?r[o]-=i:r[o]=i)}))})),{maxValue:Ba(a),minValue:za(r)}},Ha=function(e){if("object"===pt(e))return Object.keys(e).length},Ba=function(e){var t=Ha(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=wt(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.max.apply(Math,wt(a))}return n},za=function(e){var t=Ha(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=wt(Object.values(e)).filter((function(e){return!Number.isNaN(Number(e))}));n=Math.min.apply(Math,wt(a))}return n},Ua=function(e,t){try{var n=[],a=[];t.forEach((function(t,r){n.push(Ie(e,(function(e){return Fa(e[t])}))),a.push(qe(e,(function(e){return Fa(e[t])})))}));var r=Ie(n),o=qe(a);return r===o&&(o>0?o=0:r<0&&(r=0)),{minValue:o,maxValue:r}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},_a=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},ja=function(e,t,n){try{var a=Math.ceil(20*n.length/t);if(e<20){var r=[];return n.forEach((function(e,t){t%a==0&&r.push(e)})),r}}catch(e){console.error(e)}return n},Ka=function(e){Ct(n,l.Component);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"openSelector",(function(){a.setState({isOpen:!0})})),yt(Tt(a),"closeSelector",(function(){a.setState({isOpen:!1})})),yt(Tt(a),"renderSelectorContent",(function(){return l.createElement("div",{className:"axis-selector-container",id:"legend-selector-content",onClick:function(e){e.stopPropagation()}},l.createElement("ul",{className:"axis-selector-content"},a.props.stringColumnIndices.map((function(e,t){return l.createElement("li",{className:"string-select-list-item",key:ve(),onClick:function(){a.props.onChangeLegendColumnIndex(t),a.closeSelector()}},e.label)}))))})),yt(Tt(a),"render",(function(){return l.createElement(Ee,{isOpen:a.state.isOpen,content:a.renderSelectorContent(),onClickOutside:a.closeSelector,position:a.props.position,align:a.props.align},l.createElement("rect",vt({},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 ht(n)}();yt(Ka,"propTypes",Na),yt(Ka,"defaultProps",Ra);var Ga=function(t){Ct(a,u);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.renderAxis(),(r.props.hasRightLegend||r.props.hasBottomLegend)&&r.renderLegend(),r.props.onLabelChange()})),yt(Tt(r),"componentDidUpdate",(function(e){r.renderAxis(),!r.props.hasRightLegend&&!r.props.hasBottomLegend||ge(r.props.legendLabels,e.legendLabels)||r.renderLegend(),r.props.rotateLabels!==e.rotateLabels&&r.props.onLabelChange()})),yt(Tt(r),"componentWillUnmount",(function(){Mn(r.legendElement),Mn(r.legendSwatchElements),Mn(r.swatchElements)})),yt(Tt(r),"styleLegendTitleNoBorder",(function(e){e.select(".legendTitle").style("font-weight","bold").style("transform","translate(0, -5px)").attr("data-test","legend-title")})),yt(Tt(r),"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"),r.titleBBox={};try{r.titleBBox=t.select(".legendTitle").node().getBBox()}catch(e){}Me(r.legendBorder).attr("class","legend-title-border").attr("width",e(r.titleBBox,"width",0)+20).attr("height",e(r.titleBBox,"height",0)+10).attr("x",e(r.titleBBox,"x",0)-10).attr("y",e(r.titleBBox,"y",0)-10).attr("stroke","transparent").attr("stroke-width","1px").attr("fill","transparent").attr("rx",4),r.legendElement=Me(r.legendBorder).node(),r.legendElement.parentNode.appendChild(r.legendElement)})),yt(Tt(r),"renderLegend",(function(){try{var e=Tt(r),t=r.props.legendLabels;if(!t)return;var n=r.getLegendScale(t);if(r.props.hasRightLegend){r.legendSVG=Me(r.rightLegendElement),r.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");var a=Oe().shape("path",Fe().type(Qe).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})))}));r.props.legendTitle&&a.title(r.props.legendTitle).titleWidth(100),r.legendSVG.call(a).style("font-family","inherit"),r.props.legendTitle&&(r.props.onLegendTitleClick?r.styleLegendTitleWithBorder(r.legendSVG):r.styleLegendTitleNoBorder(r.legendSVG));var o=Me(r.rightLegendElement).node().getBBox().width;Me(r.legendClippingContainer).attr("width",o+30),r.legendSVG.attr("clip-path","url(#legend-clip-area-".concat(r.LEGEND_ID,")"))}else if(r.props.hasBottomLegend){r.legendSVG=Me(r.bottomLegendElement),r.legendSVG.attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px");a=Oe().shape("path",Fe().type(Qe).size(75)()).orient("horizontal").shapePadding(e.LEGEND_PADDING).labelWrap(120).labelAlign("left").scale(n).on("cellclick",(function(t){e.props.onLegendClick(t)}));r.legendSVG.call(a).style("font-family","inherit")}r.applyStylesForHiddenSeries(t)}catch(e){console.error(e)}})),yt(Tt(r),"applyStylesForHiddenSeries",(function(e){try{var t=e.filter((function(e){return e.hidden})).map((function(e){return e.label}));r.legendSwatchElements=document.querySelectorAll("#".concat(r.LEGEND_ID," .label")),r.legendSwatchElements&&r.legendSwatchElements.forEach((function(e,n){var a=[];e.querySelectorAll("tspan").forEach((function(e){a.push(e.textContent)}));var o=a.join(" ");r.swatchElements[n]=e.parentElement.querySelector(".swatch"),t.includes(o)?r.swatchElements[n].style.opacity=.3:r.swatchElements[n].style.opacity=1}))}catch(e){console.error(e)}})),yt(Tt(r),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return ke().domain(e.map((function(e){return e.label}))).range(t)})),yt(Tt(r),"renderAxis",(function(){var e=Tt(r),t="Bottom"===r.props.orient?Le():Pe();t.scale(r.props.scale).tickSizeOuter(0).tickFormat((function(t){return sn({d:t,col:e.props.col,config:e.props.dataFormatting}).formattedLabel})),r.props.ticks&&t.tickValues(r.props.ticks),r.props.showGridLines&&t.tickSizeInner(r.props.tickSizeInner),r.axisElement&&Me(r.axisElement).call(t),"Bottom"===r.props.orient&&r.props.rotateLabels?Me(r.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"!==r.props.orient||r.props.rotateLabels||Me(r.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"),Me(r.axisElement).selectAll(".axis text").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").attr("data-for","chart-element-tooltip").attr("data-tip",(function(t){var n=sn({d:t,col:e.props.col,config:e.props.dataFormatting}),a=n.fullWidthLabel;return n.isTruncated?a:null})).attr("data-effect","float"),Me(r.axisElement).selectAll(".axis path").style("display","none"),Me(r.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.15").style("shape-rendering","crispedges"),Me(r.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.4)})),yt(Tt(r),"render",(function(){var t,n=(null===(t=r.props.numberColumnIndices)||void 0===t?void 0:t.length)||0,a=r.LEGEND_PADDING*(n-1)/2,o=r.props.leftMargin||0;return l.createElement("g",{"data-test":"axis"},l.createElement("g",{className:"axis axis-".concat(r.props.orient,"\n ").concat(r.props.rotateLabels?" rotated":""),ref:function(e){r.axisElement=e},transform:r.props.translate}),r.props.hasRightLegend&&l.createElement("g",{ref:function(e){r.rightLegendElement=e},id:r.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(r.props.width+15,", ").concat(r.props.legendTitle?"30":"25",")")},l.createElement("clipPath",{id:"legend-clip-area-".concat(r.LEGEND_ID)},l.createElement("rect",{ref:function(e){r.legendClippingContainer=e},id:"legend-bounding-box-".concat(r.LEGEND_ID),height:r.props.height-r.props.topMargin-(r.props.rotateLabels?44:r.props.bottomMargin)+20,width:r.props.rightMargin+30,style:{transform:"translate(-30px, -30px)"}})),r.props.legendColumn&&l.createElement(Ka,vt({},r.props,{column:r.props.legendColumn,position:"bottom",align:"end",childProps:{ref:function(e){return r.legendBorder=e},x:e(r.titleBBox,"x",0)-10,y:e(r.titleBBox,"y",0)-10,width:e(r.titleBBox,"width",0)+20,height:e(r.titleBBox,"height",0)+10}}))),r.props.hasBottomLegend&&l.createElement("g",{ref:function(e){r.bottomLegendElement=e},"data-test":"bottom-legend",id:r.LEGEND_ID,className:"legendOrdinal",transform:"translate(".concat((r.props.width-o)/2+o-a,",").concat(r.props.height-30,")")}))})),r.LEGEND_PADDING=130,r.LEGEND_ID="axis-".concat(ve()),r.swatchElements=[],r}return ht(a)}();yt(Ga,"propTypes",ct(ct({},Na),{},{scale:p.func.isRequired,col:p.shape({}).isRequired,ticks:p.array,orient:p.string,tickSizeInner:p.number,translate:p.string})),yt(Ga,"defaultProps",ct(ct({},Ra),{},{orient:"Bottom",ticks:void 0,tickSizeInner:void 0,translate:void 0}));var Wa=["label","type","indeterminate","hasError","style","onChange","checked"],Ya=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),yt(Tt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),yt(Tt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),yt(Tt(e),"render",(function(){var t=e.props,n=t.label,a=t.type;t.indeterminate;var r=t.hasError;t.style,t.onChange,t.checked;var o=St(t,Wa),i="\n react-autoql-checkbox\n ".concat("switch"===a&&"react-autoql-checkbox--switch","\n ").concat(r&&"react-autoql-checkbox--has-error","\n "),s="\n react-autoql-checkbox__input\n ".concat("switch"===a?"react-autoql-checkbox--switch__input":"","\n ").concat(r?"react-autoql-checkbox--has-error__input":"","\n ");return l.createElement(At,null,l.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox",style:e.props.style},l.createElement("div",{className:i},l.createElement("input",vt({},o,{type:"checkbox",className:s,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&l.createElement("div",{className:"react-autoql-checkbox-tick"},l.createElement(ea,{type:"check"})),n&&l.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return ht(n)}();yt(Ya,"propTypes",{hasError:p.bool,indeterminate:p.bool,label:p.string,type:p.oneOf(["default","switch"]),checked:p.bool,onChange:p.func}),yt(Ya,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Xa=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",{selected:[]}),yt(Tt(t),"unselectAll",(function(){t.setState({selected:[]})})),yt(Tt(t),"interpolateArray",(function(e,t){for(var n=Math.min(e,t),a=Math.max(e,t),r=[],o=n;o<=a;o++)r.push(o);return r})),yt(Tt(t),"handleShiftSelect",(function(e){if(t.state.selected.length){var n=Math.min.apply(Math,wt(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]})})),yt(Tt(t),"handleCtrlSelect",(function(e){var n=[];n=t.state.selected.includes(e)?t.state.selected.filter((function(t){return t!==e})):[].concat(wt(t.state.selected),[e]),t.props.onSelect(n),t.setState({selected:n})})),yt(Tt(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)})),yt(Tt(t),"render",(function(){var n=he(t.props.items);return l.createElement(At,null,l.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list",onClick:function(e){e.stopPropagation()}},!!e(t.props.columns,"length")&&l.createElement("div",{className:"col-visibility-header"},t.props.columns.map((function(e,a){if(a===t.props.columns.length-1){var r=n.every((function(e){return e.checked}));return l.createElement("div",{key:"list-header-".concat(ve())},e.name,l.createElement(Ya,{themeConfig:Ht(t.props.themeConfig),checked:r,style:{marginLeft:"10px"},onChange:function(){r?n.forEach((function(e){e.checked=!1})):n.forEach((function(e){e.checked=!0})),t.props.onChange(n)}}))}return l.createElement("div",{key:"list-header-".concat(ve())},e.name)}))),n.map((function(e,a){return l.createElement("div",{key:"list-item-".concat(ve()),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]}))}},l.createElement("div",null,e.content," "),l.createElement("div",null,l.createElement(Ya,{themeConfig:Ht(t.props.themeConfig),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 ht(a)}();function Ja(e){return l.createElement(At,null,l.createElement("div",vt({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}yt(Xa,"propTypes",{themeConfig:Mt,columns:p.arrayOf(p.shape({})),items:p.arrayOf(p.shape({}))}),yt(Xa,"defaultProps",{themeConfig:Pt,onChange:function(){},onSelect:function(){},columns:[],items:[]});var Za=["default","primary","danger"],$a=["small","large"],er=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY","react-autoql-btn-".concat(ve())),yt(Tt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Za.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),yt(Tt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if($a.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),yt(Tt(e),"render",(function(){var t=e.getType(),n=e.getSize(),a=e.props.loading||e.props.disabled;return l.createElement(At,null,l.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:ct({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.COMPONENT_KEY},e.props.loading&&l.createElement(Ja,{"data-test":"react-autoql-btn-loading"}),e.props.children),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:e.COMPONENT_KEY,effect:"solid",delayShow:500,place:"top"}))})),e}return ht(n)}();yt(er,"propTypes",{type:p.oneOf(Za),size:p.oneOf($a),onClick:p.func,loading:p.bool,disabled:p.bool,multiline:p.bool,tooltip:p.string}),yt(er,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var tr=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidUpdate",(function(e){Ia(r.props,e)&&r.setState(ct({},r.getSelectorState(r.props)))})),yt(Tt(r),"openSelector",(function(){r.setState({isOpen:!0})})),yt(Tt(r),"closeSelector",(function(){r.setState({isOpen:!1})})),yt(Tt(r),"getSelectorState",(function(t){var n=t.columns,a=t.numberColumnIndices;if(n&&a){var r=[],o=[],i=[];return n.forEach((function(e,t){if(e.is_visible){var n={content:e.title,checked:a.includes(t),columnIndex:t};"DOLLAR_AMT"===e.type?r.push(n):"QUANTITY"===e.type?o.push(n):"RATIO"!==e.type&&"PERCENT"!==e.type||i.push(n)}})),{activeNumberType:e(n,"[".concat(a[0],"].type")),currencySelectorState:r,quantitySelectorState:o,ratioSelectorState:i}}})),yt(Tt(r),"renderSelectorContent",(function(e){var t=r.state,n=t.currencySelectorState,a=t.quantitySelectorState,o=t.ratioSelectorState;return l.createElement("div",{id:"chata-chart-popover",onClick:function(e){e.stopPropagation()}},l.createElement("div",{className:"axis-selector-container"},!!n.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"},r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Currency"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.currencySelectRef=e},items:n,onSelect:function(){r.quantitySelectRef&&r.quantitySelectRef.unselectAll(),r.ratioSelectRef&&r.ratioSelectRef.unselectAll()},onChange:function(e){var t=a.map((function(e){return ct(ct({},e),{},{checked:!1})})),n=o.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"DOLLAR_AMT",currencySelectorState:e,quantitySelectorState:t,ratioSelectorState:n})}})),!!a.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"}," ",r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Quantity"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.quantitySelectRef=e},items:a,onSelect:function(){r.currencySelectRef&&r.currencySelectRef.unselectAll(),r.ratioSelectRef&&r.ratioSelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return ct(ct({},e),{},{checked:!1})})),a=o.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"QUANTITY",quantitySelectorState:e,currencySelectorState:t,ratioSelectorState:a})}})),!!o.length&&l.createElement(c,null,l.createElement("div",{className:"number-selector-header"}," ",r.props.columns&&void 0!==r.props.legendColumn?r.props.legendColumn.display_name:"Ratio"),l.createElement(Xa,{themeConfig:r.props.themeConfig,ref:function(e){return r.ratioSelectRef=e},items:o,onSelect:function(){r.currencySelectRef&&r.currencySelectRef.unselectAll(),r.quantitySelectRef&&r.quantitySelectRef.unselectAll()},onChange:function(e){var t=n.map((function(e){return ct(ct({},e),{},{checked:!1})})),o=a.map((function(e){return ct(ct({},e),{},{checked:!1})}));r.setState({activeNumberType:"RATIO",ratioSelectorState:e,currencySelectorState:t,quantitySelectorState:o})}}))),l.createElement("div",{className:"axis-selector-apply-btn"},l.createElement(er,{style:{width:"calc(100% - 10px)"},type:"primary",disabled:r.state.ratioSelectorState.every((function(e){return!e.checked}))&&r.state.currencySelectorState.every((function(e){return!e.checked}))&&r.state.quantitySelectorState.every((function(e){return!e.checked})),onClick:function(){var e=[];if("DOLLAR_AMT"===r.state.activeNumberType?e=r.state.currencySelectorState:"QUANTITY"===r.state.activeNumberType?e=r.state.quantitySelectorState:"RATIO"===r.state.activeNumberType&&(e=r.state.ratioSelectorState),e.length){r.closeSelector();var t=e.filter((function(e){return e.checked})).map((function(e){return e.columnIndex}));r.props.changeNumberColumnIndices(t)}}},"Apply")))})),yt(Tt(r),"render",(function(){return l.createElement(Ee,{isOpen:r.state.isOpen,content:r.renderSelectorContent(),onClickOutside:r.closeSelector,position:r.props.position,align:r.props.align},l.createElement("rect",vt({},r.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),r.currencySelectRef,r.quantitySelectRef,r.ratioSelectRef,r.state=ct(ct({},r.getSelectorState(t)),{},{isOpen:!1}),r}return ht(a)}();yt(tr,"propTypes",Na),yt(tr,"defaultProps",Ra);var nr=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"openSelector",(function(){r.setState({isOpen:!0})})),yt(Tt(r),"closeSelector",(function(){r.setState({isOpen:!1})})),yt(Tt(r),"renderSelectorContent",(function(){return l.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},l.createElement("ul",{className:"axis-selector-content"},r.props.stringColumnIndices.map((function(t,n){return l.createElement("li",{className:"string-select-list-item ".concat(t===r.props.stringColumnIndex?"active":""),key:ve(),onClick:function(){r.closeSelector(),r.props.changeStringColumnIndex(t)}},e(r.props.columns,"[".concat(t,"].title")))}))))})),yt(Tt(r),"render",(function(){return l.createElement(Ee,{isOpen:r.state.isOpen,content:r.renderSelectorContent(),onClickOutside:r.closeSelector,position:r.props.position,align:r.props.align},l.createElement("rect",vt({},r.props.childProps,{className:"axis-label-border","data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"})))})),r.state={isOpen:!1},r}return ht(a)}();yt(nr,"propTypes",Na),yt(nr,"defaultProps",Ra);var ar=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"render",(function(){return Gt(e.props.column)?l.createElement(tr,vt({"data-test":"number-axis-selector"},e.props)):Wt(e.props.column)?l.createElement(nr,vt({"data-test":"string-axis-selector"},e.props)):null})),e}return ht(n)}();yt(ar,"propTypes",Na),yt(ar,"defaultProps",Ra);var rr=function(e){Ct(n,l.Component);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(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?l.createElement("tspan",{"data-tip":e,"data-for":"chart-element-tooltip","data-test":"axis-label"},"".concat(e.substring(0,35),"...")):l.createElement("tspan",{"data-test":"axis-label"},e,t&&l.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),yt(Tt(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,r=un(a.xLabelRef),o=r?r.width:0,i=r?r.height:0;return l.createElement("g",null,l.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&&l.createElement(ar,vt({},a.props,{column:a.props.xCol,position:"top",align:"end",childProps:{x:t-o/2-10,y:n-16,width:o+20,height:i+10}})))})),yt(Tt(a),"renderYAxisLabel",(function(e){var t=-(a.props.height-a.props.bottomMargin)/2,n=un(a.yLabelRef),r=n?n.width:0,o=n?n.height:0;return l.createElement("g",null,l.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&&l.createElement(ar,vt({},a.props,{column:a.props.yCol,position:"right",align:"center",childProps:{x:t-r/2-10,y:4,width:r+20,height:o+10,transform:"rotate(-90)"}})))})),yt(Tt(a),"renderXAxis",(function(e){return l.createElement(Ga,vt({},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}))})),yt(Tt(a),"renderYAxis",(function(e){return l.createElement(Ga,vt({},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}))})),yt(Tt(a),"render",(function(){if(!(a.props.yScale&&a.props.xScale&&a.props.height&&a.props.width))return null;var e=a.props.xAxisTitle||a.props.xCol.display_name,t=a.props.yAxisTitle||a.props.yCol.display_name;return l.createElement("g",null,a.renderYAxisLabel(t),a.renderXAxisLabel(e),l.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},a.renderXAxis(e),a.renderYAxis(t)))})),a.xAxisKey=ve(),a.yAxisKey=ve(),a.labelInlineStyles={fontSize:12,fontFamily:"inherit",fill:"currentColor",fillOpacity:.7,cursor:"default"},a}return ht(n)}();yt(rr,"propTypes",Na),yt(rr,"defaultProps",Ra);var or=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.xScale,c=t.yScale,u=r.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=s.bandwidth()/u.length,m=0;return r.forEach((function(t,r){n[t].isSeriesHidden||(p.push(e.props.data.map((function(u,p){var f=u[t];if(!f)return null;var g=f<0?qa(c):c(f),h=Math.abs(c(f)-qa(c));if((isNaN(h)||isNaN(f))&&(g=qa(c),h=0),h<.05)return null;var y=s(u[o])+m*d,v=Oa({row:u,columns:n,colIndex:t,stringColumnIndex:o,legendColumn:a,dataFormatting:i}),C=La(t,p);return l.createElement("rect",{key:C,className:"bar".concat(e.state.activeKey===C?" active":""),"data-test":"bar-".concat(r,"-").concat(p),x:y,y:g,height:h,width:d,onClick:function(){return e.onColumnClick(u,t,p)},"data-tip":v,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(r),fillOpacity:.7}})}))),m+=1)})),l.createElement("g",{"data-test":"columns"},p)})),e}return ht(n)}();yt(or,"propTypes",Va),yt(or,"defaultProps",Ma);var ir=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Ua(e.data,n),o=r.minValue,i=r.maxValue;a.xScale=Ae().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=Ne().domain([o,i]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=kn(a.xScale,e.innerPadding),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-column-chart"},l.createElement(rr,vt({},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&&l.createElement(or,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(ir,"propTypes",ka),yt(ir,"defaultProps",Aa);var sr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onBarClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale,u=r.filter((function(e){return!n[e].isSeriesHidden}));if(!u.length)return null;var p=[],d=s.bandwidth()/u.length,m=0;return r.forEach((function(t,r){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)-qa(c));if(Number.isNaN(g)&&(g=0),g<.05)return null;var h=s(u[o])+m*d,y=Oa({row:u,columns:n,colIndex:t,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(t,p),className:"bar".concat(e.state.activeKey===La(t,p)?" active":""),"data-test":"bar-".concat(r,"-").concat(p),y:h,x:f>0?qa(c):c(f),width:g,height:d,onClick:function(){return e.onBarClick(u,t,p)},"data-tip":y,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(r),fillOpacity:.7}})}))),m+=1)})),l.createElement("g",{"data-test":"bars"},p)})),e}return ht(n)}();yt(sr,"propTypes",Va),yt(sr,"defaultProps",Ma);var lr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=wn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xLabelArray,e.columns[e.numberColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Ua(e.data,n),o=r.minValue,i=r.maxValue;a.xScale=Ne().domain([o,i]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ae().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=ja(a.barHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-bar-chart"},l.createElement(rr,vt({},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&&l.createElement(sr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(lr,"propTypes",ka),yt(lr,"defaultProps",Aa);var cr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onDotClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"makePolyline",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,r=t.stringColumnIndex,o=t.yScale,i=t.xScale,s=[];return a.forEach((function(t,a){var c=[];n[t].isSeriesHidden||e.props.data.forEach((function(n,a){var s=n[t],l=e.props.data[a-1],u=e.props.data[a+1];if(!(!(0===a||a===e.props.data.length-1)&&Math.abs(o(s)-o(null==l?void 0:l[t]))<.05&&Math.abs(o(null==l?void 0:l[t])-o(null==u?void 0:u[t]))<.05)){var p=i.bandwidth()/2,d=o.domain()[0],m=[i(n[r])+p,o(s||d)];c.push(m)}}));var u=c.map((function(e){return e.join(",")})).join(" "),p=l.createElement("polyline",{key:"line-".concat(La(0,a)),className:"line",points:u,fill:"none",stroke:e.props.colorScale(a),strokeWidth:1,opacity:.7});s.push(p)})),s})),yt(Tt(e),"makeDots",(function(t){var n=e.props,a=n.columns,r=n.legendColumn,o=n.numberColumnIndices,i=n.stringColumnIndex,s=n.dataFormatting,c=n.yScale,u=n.xScale,p=[];return o.forEach((function(t,n){a[t].isSeriesHidden||e.props.data.forEach((function(o,d){var m=o[t];if(m){var f=c(m);if(!(f<.05)){var g=u.bandwidth()/2,h=Oa({row:o,columns:a,colIndex:t,stringColumnIndex:i,legendColumn:r,dataFormatting:s});p.push(l.createElement("circle",{key:La(t,d),className:"line-dot".concat(e.state.activeKey===La(t,d)?" active":""),cy:f,cx:u(o[i])+g,r:3,onClick:function(){return e.onDotClick(o,t,d)},"data-tip":h,"data-for":"chart-element-tooltip",style:{cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:2,strokeOpacity:.7,fillOpacity:1,opacity:0,fill:e.state.activeKey===La(t,d)?e.props.colorScale(n):e.props.backgroundColor||"#fff"}}))}}}))})),p})),yt(Tt(e),"render",(function(){var t=e.props.numberColumnIndices.filter((function(t){return!e.props.columns[t].isSeriesHidden})).length;return t?l.createElement("g",{"data-test":"line"},e.makePolyline(),e.makeDots(t)):null})),e}return ht(n)}();yt(cr,"propTypes",Va),yt(cr,"defaultProps",Ma);var ur=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n,r,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices);var i=Ua(e.data,o),s=i.minValue,l=i.maxValue;a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Ne().domain([s,l]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(r=n.domain())||void 0===r?void 0:r.length)||1),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-line-chart"},l.createElement(rr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[0],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&&l.createElement(cr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(ur,"propTypes",ka),yt(ur,"defaultProps",Aa);var pr=function(t){Ct(a,u);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.renderPie()})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){return!r.props.isResizing||!e.isResizing})),yt(Tt(r),"componentDidUpdate",(function(){r.renderPie()})),yt(Tt(r),"componentWillUnmount",(function(){Mn(r.legend),Mn(r.pieChartContainer)})),yt(Tt(r),"renderPie",(function(){Mn(r.pieChartContainer);var e=Tt(r);r.setPieRadius(),r.outerArc=He().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=Be().value((function(t,n){return t.value[e.props.numberColumnIndex]}));r.dataReady=t(ze(e.sortedData.filter((function(e,t){var n,a;return!(null!==(n=r.state.legendLabels)&&void 0!==n&&null!==(a=n[t])&&void 0!==a&&a.hidden)})))),r.renderPieContainer(),r.renderPieSlices(),r.renderLegend(),r.centerVisualization()})),yt(Tt(r),"renderPieContainer",(function(){var e=r.props,t=e.width,n=e.height;r.pieChartContainer=Me(r.chartElement).append("svg").attr("width",t).attr("height",n).append("g").attr("class","slices").attr("transform","translate(".concat(t/2+r.outerRadius,",").concat(n/2,")"))})),yt(Tt(r),"onSliceClick",(function(e){var t=e.data.key;t===r.state.activeKey?r.setState({activeKey:null}):(r.props.onChartClick(e.data.value,r.props.numberColumnIndex,r.props.columns,r.props.stringColumnIndex,r.props.legendColumn,r.props.numberColumnIndex,t),r.setState({activeKey:t}))})),yt(Tt(r),"renderPieSlices",(function(){var e=Tt(r);r.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",He().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for","chart-element-tooltip").attr("data-tip",(function(t){return Oa({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",r.props.backgroundColor).on("mouseover",(function(e){Me(this).style("fill-opacity",1)})).on("mouseout",(function(e){Me(this).style("fill-opacity",.85)})).on("click",r.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){Me(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)+")"}}))}))})),yt(Tt(r),"centerVisualization",(function(){var t,n=Me("#pie-chart-container-".concat(r.CHART_ID)).node();n&&(t=n.getBBox());var a=e(t,"width",0),o=e(t,"x",0),i=(r.props.width-a)/2-o;Me("#pie-chart-container-".concat(r.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),yt(Tt(r),"onLegendClick",(function(e){var t,n=JSON.parse(e),a=null==n?void 0:n.dataIndex;if(null!==(t=r.state.legendLabels)&&void 0!==t&&t[a]){var o=he(r.state.legendLabels);o[a].hidden=!r.state.legendLabels[a].hidden,r.setState({legendLabels:o})}fe.rebuild()})),yt(Tt(r),"renderLegend",(function(){var t,n=Tt(r),a=r.props.height,o=Ht(r.props.themeConfig).chartColors;if(r.state.legendLabels){t=ke().domain(r.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(o);var i=r.props.width/2-70;r.legend=Me(r.legendElement),r.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 s,l=Oe().shape("path",Fe().type(Qe).size(75)()).orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).scale(t).on("cellclick",r.onLegendClick);r.legend.select(".legendOrdinal").call(l);var c=r.legend.select(".legendOrdinal").node();c&&(s=c.getBBox());var u=e(s,"height",0),p=e(s,"width",0),d=r.props.width/2-p-20,m=u<a-20?(a-u)/2:15;r.legend.select(".legendOrdinal").attr("transform","translate(".concat(d,", ").concat(m,")")),r.applyStylesForHiddenSeries()}})),yt(Tt(r),"applyStylesForHiddenSeries",(function(){var e=r.state.legendLabels.filter((function(e){return e.hidden})).map((function(e){return e.label}));r.legendSwatchElements=document.querySelectorAll("#".concat(r.LEGEND_ID," .label tspan")),r.legendSwatchElements&&r.legendSwatchElements.forEach((function(t){var n=t.parentElement.parentElement.querySelector(".swatch");n.style.strokeWidth="2px",e.includes(t.textContent)?n.style.opacity=.3:n.style.opacity=1}))})),yt(Tt(r),"setPieRadius",(function(){var e,t=r.props,n=t.width,a=t.height,o=t.margin;e=n<a?n/2-o:2*a<n?a-o:n/2-o,r.outerRadius=e/2,r.innerRadius=r.outerRadius-50>15?r.outerRadius-50:0})),yt(Tt(r),"render",(function(){return l.createElement("g",{id:"pie-chart-container-".concat(r.CHART_ID),"data-test":"react-autoql-pie-chart"},l.createElement("svg",{className:"pie-chart",ref:function(e){r.chartElement=e},width:r.props.width,height:r.props.height}),l.createElement("g",{ref:function(e){r.legendElement=e},id:r.LEGEND_ID,className:"legendOrdinal"}))})),r.CHART_ID=ve(),r.LEGEND_ID="react-autoql-pie-legend-".concat(ve()),r.sortedData=t.data.concat().sort((function(e,n){var a=e[t.numberColumnIndex]||0,r=n[t.numberColumnIndex]||0;return parseFloat(r)-parseFloat(a)}));var o=Ht(t.themeConfig).chartColors;r.colorScale=ke().domain(r.sortedData.map((function(e){return e[t.stringColumnIndex]}))).range(o);var i=r.sortedData.map((function(n,a){var r,o;return{label:"".concat(ln({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(r=t.columns)||void 0===r?void 0:r[t.stringColumnIndex]}),": ").concat(ln({element:n[t.numberColumnIndex]||0,column:e(t,"columns[".concat(t.numberColumnIndex,"]")),config:null===(o=t.columns)||void 0===o?void 0:o[t.dataFormatting]})).trim(),hidden:!1,dataIndex:a}}));return r.state={activeKey:r.props.activeChartElementKey,legendLabels:i},r}return ht(a)}();yt(pr,"propTypes",ct(ct({},ka),{},{backgroundColor:p.string,margin:p.number})),yt(pr,"defaultProps",ct(ct({},Aa),{},{backgroundColor:"transparent",margin:40}));var dr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;ft(this,n),yt(Tt(a=t.call(this,e)),"onSquareClick",(function(e,t,n){var r=La(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,r),a.setState({activeKey:r})})),yt(Tt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,r=e.numberColumnIndices,o=e.stringColumnIndex,i=e.dataFormatting,s=e.legendLabels,c=e.colorScale,u=e.yScale,p=e.xScale;if(!r.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){r.forEach((function(r,f){if(!t[r].isSeriesHidden){var g=e[r],h=Number(g),y=Number.isNaN(h)?0:h,v=e[o],C=s[f].label,b=y>=0?c(0):"rgba(221, 106, 106)",E=c(1),S=Oa({row:e,columns:t,colIndex:r,stringColumnIndex:o,legendColumn:n,dataFormatting:i});d.push(l.createElement("rect",{key:La(r,m),"data-test":"squares",className:"square".concat(a.state.activeKey===La(r,m)?" active":""),x:p(v),y:u(C),width:p.bandwidth(),height:u.bandwidth(),onClick:function(){return a.onSquareClick(e,r,m)},"data-tip":S,"data-for":"chart-element-tooltip",stroke:E,strokeWidth:"2px",strokeOpacity:a.state.activeKey===La(r,m)?1:0,fill:a.state.activeKey===La(r,m)?E:b,fillOpacity:a.state.activeKey===La(r,m)?1:a.opacityScale(Math.abs(y))}))}}))})),l.createElement("g",null,d)}));var r=Ie(e.data.map((function(t){return Ie(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),o=qe(e.data.map((function(t){return qe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.opacityScale=Ne().domain([o,r]).range([0,1]),a.state={activeKey:a.props.activeChartElementKey},a}return ht(n)}();yt(dr,"propTypes",Va),yt(dr,"defaultProps",Ma);var mr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.squareHeight=e.height/a.yLabelArray.length,a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin+10,e.width-e.rightMargin]).paddingInner(.01),a.yScale=Ae().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]).paddingInner(.01),a.xTickValues=ja(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=ja(a.squareHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-heatmap-chart",className:"react-autoql-heatmap-chart"},l.createElement(rr,vt({},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&&l.createElement(dr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(mr,"propTypes",ka),yt(mr,"defaultProps",Aa);var fr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;ft(this,n),yt(Tt(a=t.call(this,e)),"state",{activeKey:a.props.activeChartElementKey}),yt(Tt(a),"onCircleClick",(function(e,t,n){var r=La(t,n);a.props.onChartClick(e,t,a.props.columns,a.props.stringColumnIndex,a.props.legendColumn,a.props.numberColumnIndex,r),a.setState({activeKey:r})})),yt(Tt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,r=e.numberColumnIndices,o=e.stringColumnIndex,i=e.dataFormatting,s=e.legendLabels,c=e.colorScale,u=e.yScale,p=e.xScale;if(!r.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var d=[];return a.props.data.forEach((function(e,m){r.forEach((function(r,f){if(!t[r].isSeriesHidden){var g=e[r],h=Number(g),y=Number.isNaN(h)?0:h,v=e[o],C=s[f].label,b=Oa({row:e,columns:t,colIndex:r,stringColumnIndex:o,legendColumn:n,dataFormatting:i});d.push(l.createElement("circle",{key:La(r,m),"data-test":"circles",className:"circle".concat(a.state.activeKey===La(r,m)?" active":""),cx:p(v)+p.bandwidth()/2,cy:u(C)+u.bandwidth()/2,r:y<0?0:a.radiusScale(y)/2,onClick:function(){return a.onCircleClick(e,r,m)},"data-tip":b,"data-for":"chart-element-tooltip",style:{stroke:"transparent",strokeWidth:10,fill:a.state.activeKey===La(r,m)?c(1):c(0),fillOpacity:.7}}))}}))})),l.createElement("g",null,d)}));var r=Ie(e.data.map((function(t){return Ie(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),o=qe(e.data.map((function(t){return qe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.radiusScale=Ne().domain([o,r]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),a}return ht(n)}();yt(fr,"propTypes",Va),yt(fr,"defaultProps",Ma);var gr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.xScale.bandwidth(),a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){a.yLabelArray=e.legendLabels.map((function(e){return e.label})),a.circleHeight=e.height/a.yLabelArray.length,a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingOuter(.5),a.yScale=Ae().domain(a.yLabelArray).range([e.height-e.bottomMargin,e.topMargin]),a.xTickValues=ja(a.xScale.bandwidth(),e.width,a.xScale.domain()),a.yTickValues=ja(a.circleHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{className:"react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},l.createElement(rr,vt({},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})),l.createElement(fr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(gr,"propTypes",ka),yt(gr,"defaultProps",Aa);var hr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale;if(!r.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 r.map((function(r,m){if(!n[r].isSeriesHidden){var f,g,h=t[r],y=Number(h),v=Number.isNaN(y)?0:y;if(!v)return null;if(v>=0){var C=p+v;g=Math.abs(c(v)-c(0)-.5),f=c(p),p=C}else{var b=d+v;g=Math.abs(c(Math.abs(v))-c(0)-.5),f=c(b),d=b}if(g<.05)return null;var E=Oa({row:t,columns:n,colIndex:r,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(r,u),className:"column".concat(e.state.activeKey===La(r,u)?" active":""),x:f,y:s(t[o]),width:g,height:s.bandwidth(),onClick:function(){return e.onColumnClick(t,r,u)},"data-tip":E,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return l.createElement("g",{"data-test":"stacked-bars"},u)})),e}return ht(n)}();yt(hr,"propTypes",Va),yt(hr,"defaultProps",Ma);var yr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=(e.width-e.leftMargin-e.rightMargin)/a.xScale.ticks().length,n=wn(t,a.longestLabelWidth);void 0!==n&&(a.rotateLabels=n)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xLabelArray,e.columns[e.numberColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Qa(e.data,e.stringColumnIndex,n),o=r.maxValue,i=r.minValue;a.xScale=Ne().domain([i,o]).range([e.leftMargin,e.width-e.rightMargin]).nice(),a.yScale=Ae().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=ja(a.barHeight,e.height,a.yLabelArray)})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-bar-chart"},l.createElement(rr,vt({},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&&l.createElement(hr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(yr,"propTypes",ka),yt(yr,"defaultProps",Aa);var vr=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onColumnClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,o=t.stringColumnIndex,i=t.dataFormatting,s=t.yScale,c=t.xScale;if(!r.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 r.map((function(r,m){if(!n[r].isSeriesHidden){var f,g,h=t[r],y=Number(h),v=Number.isNaN(y)?0:y;if(!v)return null;if(v>=0){var C=p+v;g=Math.abs(s(v)-s(0))-.5,f=s(C)+.5,p=C}else{var b=d+v;g=Math.abs(s(v)-s(0))-.5,f=s(d)+.5,d=b}if(g<.05)return null;var E=Oa({row:t,columns:n,colIndex:r,stringColumnIndex:o,legendColumn:a,dataFormatting:i});return l.createElement("rect",{key:La(r,u),className:"bar".concat(e.state.activeKey===La(r,u)?" active":""),x:c(t[o]),y:f,width:c.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,r,u)},"data-tip":E,"data-for":"chart-element-tooltip",style:{fill:e.props.colorScale(m),fillOpacity:.7}})}}))}));return l.createElement("g",{"data-test":"stacked-columns"},u)})),e}return ht(n)}();yt(vr,"propTypes",Va),yt(vr,"defaultProps",Ma);var Cr=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices);var r=Qa(e.data,e.stringColumnIndex,n),o=r.maxValue,i=r.minValue;a.xScale=Ae().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=Ne().domain([i,o]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=kn(a.xScale,e.innerPadding),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-column-chart"},l.createElement(rr,vt({},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&&l.createElement(vr,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(Cr,"propTypes",ka),yt(Cr,"defaultProps",Aa);var br=function(e){Ct(n,u);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{activeKey:e.props.activeChartElementKey}),yt(Tt(e),"onDotClick",(function(t,n,a){var r=La(n,a);e.props.onChartClick(t,n,e.props.columns,e.props.stringColumnIndex,e.props.legendColumn,e.props.numberColumnIndex,r),e.setState({activeKey:r})})),yt(Tt(e),"createPolygonVertexDot",(function(t,n,a,r,o,i){var s=Oa({row:t,columns:e.props.columns,colIndex:o,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return l.createElement("circle",{key:"dot-".concat(La(o,i)),className:"vertex-dot".concat(e.state.activeKey===La(o,i)?" active":""),cy:r,cx:a,r:4,onClick:function(){return e.onDotClick(t,o,n)},"data-tip":s,"data-for":"chart-element-tooltip",style:{opacity:e.state.activeKey===La(o,i)?1:0,cursor:"pointer",stroke:e.props.colorScale(n),strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),yt(Tt(e),"createPolygon",(function(t,n){var a=e.props.stringColumnIndex,r=n.map((function(e){return e.join(",")})).join(" ");return l.createElement("polygon",{key:"polygon-".concat(La(a,t)),points:r,"data-tip":"\n <div>\n <strong>".concat(e.props.legendTitle,"</strong>: ").concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":"chart-element-tooltip","data-effect":"float",style:{fill:e.props.colorScale(t),fillOpacity:1}})})),yt(Tt(e),"render",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,r=t.stringColumnIndex,o=t.yScale,i=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var s=[],c=[],u=o.domain()[0];u<0&&(u=0);var p=[],d=[];return i.domain().forEach((function(e){p.push(u),d.push([i(e),o(u)])})),a.forEach((function(t,a){var l=[],u=[];if(!n[t].isSeriesHidden){e.props.data.forEach((function(n,s){var d=n[t],m=Number(d),f=isNaN(m)?0:m,g=i(n[r]),h=p[s]+f,y=o(h);if(l[s]=h,u.push([g,y]),0!==f){var v=e.createPolygonVertexDot(n,a,g,y,t,s);c.push(v)}}));var m=d.reverse().concat(u);s.push(e.createPolygon(a,m)),p=l,d=u}})),l.createElement("g",{"data-test":"stacked-lines"},s,c)})),e}return ht(n)}();yt(br,"propTypes",Va),yt(br,"defaultProps",Ma);var Er=function(e){Ct(n,u);var t=xt(n);function n(e){var a;return ft(this,n),yt(Tt(a=t.call(this,e)),"componentDidMount",(function(){a.props.onLabelChange()})),yt(Tt(a),"shouldComponentUpdate",(function(){return!0})),yt(Tt(a),"componentDidUpdate",(function(e){Pa(e,a.props)&&a.setLongestLabelWidth(a.props)})),yt(Tt(a),"setLabelRotationValue",(function(e){var t=wn(a.tickWidth,a.longestLabelWidth);void 0!==t&&(a.rotateLabels=t)})),yt(Tt(a),"setLongestLabelWidth",(function(e){a.longestLabelWidth=xn(a.xTickValues,e.columns[e.stringColumnIndex],Ft(e.dataFormatting))})),yt(Tt(a),"setChartData",(function(e){var t,n,r,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices);var i=Qa(e.data,e.stringColumnIndex,o),s=i.maxValue,l=i.minValue;a.xScale=Ae().domain(e.data.map((function(t){return t[e.stringColumnIndex]}))).range([e.leftMargin,e.width-e.rightMargin]).paddingInner(1).paddingOuter(0),a.yScale=Ne().domain([l,s]).range([e.height-e.bottomMargin,e.topMargin]).nice(),a.tickWidth=e.width/((null===(n=a.xScale)||void 0===n||null===(r=n.domain())||void 0===r?void 0:r.length)||1),a.xTickValues=ja(a.tickWidth,e.width,a.xScale.domain())})),yt(Tt(a),"render",(function(){return a.setChartData(a.props),a.setLabelRotationValue(a.props),l.createElement("g",{"data-test":"react-autoql-stacked-line-chart"},l.createElement(rr,vt({},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&&l.createElement(br,vt({},a.props,{xScale:a.xScale,yScale:a.yScale})))})),a.setChartData(e),a.setLongestLabelWidth(e),a.setLabelRotationValue(e),a}return ht(n)}();yt(Er,"propTypes",ka),yt(Er,"defaultProps",Aa);var Sr=function(t){Ct(a,u);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"INNER_PADDING",.25),yt(Tt(r),"OUTER_PADDING",.5),yt(Tt(r),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),yt(Tt(r),"componentDidMount",(function(){r.firstRender=!1,r.props.isResizing||r.props.isAnimatingContainer||r.forceUpdate(),r.rebuildTooltips()})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){return(!e.isResizing||!r.props.isResizing)&&(!r.state.isLoading||!t.isLoading)})),yt(Tt(r),"componentDidUpdate",(function(t,n){var a={},o=!1,i=!1,s=e(r.chartContainerRef,"offsetWidth",0),l=e(r.chartContainerRef,"offsetHeight",0);if(!r.state.isLoading&&r.recursiveUpdateCount<2&&(s!==r.chartWidth||l!==r.chartHeight)&&(o=!0,r.recursiveUpdateCount++,clearTimeout(r.recursiveUpdateTimeout),r.recursiveUpdateTimeout=setTimeout((function(){r.recursiveUpdateCount=0}),500)),!r.props.isResizing&&t.isResizing&&r.chartContainerRef&&(r.chartContainerRef.style.flexBasis="100vh",o=!0),Ia(r.props,t)&&(i=!0,r.props.isPivot||(a.aggregatedData=r.aggregateRowData(r.props)),r.rebuildTooltips()),!Ce(a))return o=!1,void r.setState(a,(function(){i&&r.updateMargins()}));i?r.updateMargins():o&&r.forceUpdate()})),yt(Tt(r),"componentWillUnmount",(function(){clearTimeout(r.recursiveUpdateTimeout),r.getNewMargins&&r.getNewMargins.cancel(),r.legend=void 0,r.xAxis=void 0,r.axes=void 0})),yt(Tt(r),"aggregateRowData",(function(e){var t=e.stringColumnIndex,n=e.numberColumnIndices,a=Ve(e.data,(function(e){return null==e?void 0:e[t]})),r=[],o=he(a[0]);return a.forEach((function(e,i){var s;if(i===a.length-1)r.push(o);else{if(0===i)return;if((null==e?void 0:e[t])!==(null===(s=o)||void 0===s?void 0:s[t]))r.push(o),o=he(e);else{var l=he(e);n.forEach((function(e){var t=Number(l[e]),n=Number(o[e]);isNaN(t)&&(t=0),isNaN(n)&&(n=0),l[e]=t+n})),o=l}}})),r})),yt(Tt(r),"getNewLeftMargin",(function(e,t){var n=e.x,a=t.x+n,o=r.state.leftMargin;return o+=n-a+r.Y_AXIS_LABEL_WIDTH+r.PADDING})),yt(Tt(r),"getNewRightMargin",(function(e,t,n){var a=t.x+e.x+t.width-(e.x+e.width),o=n-r.state.leftMargin,i=e.width-o,s=r.state.rightMargin+a+r.PADDING;r.state.rightMargin;return s<i?s:r.PADDING})),yt(Tt(r),"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 r=e[n];return{label:r.title,color:t(a),hidden:r.isSeriesHidden,columnIndex:n,column:r}}));return a}catch(e){return console.error(e),[]}}(r.props.columns,r.colorScale,r.props.numberColumnIndices)})),yt(Tt(r),"getNewBottomMargin",(function(t){var n;r.legend=Me(r.chartRef).select(".legendOrdinal").node(),n=r.legend?r.legend.getBBox():void 0;var a=0;"bottom"===_a(r.props.numberColumnIndices,r.props.type)&&e(n,"height")&&(a=n.height+10),r.xAxis=Me(r.chartRef).select(".axis-Bottom").node();var o=r.xAxis?r.xAxis.getBBox():{},i=Math.ceil(o.height)+a+40;(0===o.height&&(i=463),"bar"===r.props.type||"stacked_bar"===r.props.type)&&(i=i-(t.height-r.state.topMargin-r.state.bottomMargin)+10);return i||r.state.bottomMargin})),yt(Tt(r),"getNewTopMargin",(function(){return r.state.topMargin})),yt(Tt(r),"rebuildTooltips",(function(){clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),1e3)})),yt(Tt(r),"updateMargins",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.setLoading,n=void 0===t||t,a=e.delay,o=void 0===a?100:a;!r.state.isLoading&&n&&r.setState({isLoading:!0}),clearTimeout(r.updateMarginsThrottled),r.updateMarginsThrottled=setTimeout((function(){r.updateMarginsToThrottle()}),o)})),yt(Tt(r),"updateMarginsToThrottle",(function(){r.newMargins=void 0;try{if(r.axes=document.querySelector("#react-autoql-chart-".concat(r.CHART_ID," .react-autoql-axes")),!r.chartContainerRef||!r.axes)return void r.clearLoading();var e=r.chartContainerRef.getBoundingClientRect(),t=r.axes.getBBox(),n=r.getNewLeftMargin(e,t),a=r.getNewRightMargin(e,t,n),o=r.getNewTopMargin(),i=r.getNewBottomMargin(e,t);r.newMargins={leftMargin:n,topMargin:o,rightMargin:a,bottomMargin:i},r.isMarginDiffSignificant=r.isMarginDifferenceSignificant(),r.isMarginDiffSignificant?(r.marginAdjustmentFinished=!0,r.setState(ct({},r.newMargins),(function(){r.clearLoading()}))):(r.marginAdjustmentFinished=!0,r.clearLoading())}catch(e){console.error(e),r.marginAdjustmentFinished=!0,r.clearLoading()}})),yt(Tt(r),"clearLoading",(function(){clearTimeout(r.loadingTimeout),r.loadingTimeout=setTimeout((function(){r.setState({isLoading:!1})}),100)})),yt(Tt(r),"isMarginDifferenceSignificant",(function(){if(!r.newMargins)return!1;var e=r.newMargins,t=e.leftMargin,n=e.topMargin,a=e.rightMargin,o=e.bottomMargin,i=Math.abs(t-r.state.leftMargin),s=Math.abs(n-r.state.topMargin),l=Math.abs(a-r.state.rightMargin),c=Math.abs(o-r.state.bottomMargin);return i>10||s>10||l>10||c>10})),yt(Tt(r),"getBase64Data",(function(){var e=r.chartRef;return e?pn(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),yt(Tt(r),"saveAsPNG",(function(){var e=r.chartRef;e&&pn(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)}))})),yt(Tt(r),"getStringAxisTitle",(function(){var e,t=r.props,n=t.columns,a=t.stringColumnIndex;return null==n||null===(e=n[a])||void 0===e?void 0:e.display_name})),yt(Tt(r),"getNumberAxisTitle",(function(){var t=r.props,n=t.columns,a=t.numberColumnIndices;try{var o=n.filter((function(e,t){return a.includes(t)}));if(null==o||!o.length)return;if(!o.find((function(e){return e.display_name!==o[0].display_name})))return e(o,"[0].display_name");var i=e(o,"[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)}})),yt(Tt(r),"getCommonChartProps",(function(){var e,t,n=r.state,a=n.topMargin,o=n.bottomMargin,i=n.rightMargin,s=n.leftMargin,l=n.bottomLegendMargin,c=r.props,u=c.numberColumnIndices,p=c.columns,d=r.INNER_PADDING;u.length>1&&(d=.1);var m=en(p),f=m.amountOfNumberColumns>1,g=m.amountOfStringColumns>1,h=u.filter((function(e){return!p[e].isSeriesHidden}));return ct(ct({},r.props),{},(yt(t={key:void 0,data:r.state.aggregatedData||r.props.data,colorScale:r.colorScale,innerPadding:d,outerPadding:r.OUTER_PADDING},"colorScale",r.colorScale),yt(t,"height",r.chartHeight),yt(t,"width",r.chartWidth),yt(t,"topMargin",a),yt(t,"bottomMargin",o),yt(t,"rightMargin",i),yt(t,"leftMargin",s),yt(t,"bottomLegendMargin",l),yt(t,"hasMultipleNumberColumns",f),yt(t,"hasMultipleStringColumns",g),yt(t,"marginAdjustmentFinished",r.state.loading),yt(t,"legendTitle",(null===(e=r.props.legendColumn)||void 0===e?void 0:e.title)||"Category"),yt(t,"legendLocation",_a(u,r.props.type)),yt(t,"legendLabels",r.getLegendLabels()),yt(t,"visibleSeriesIndices",h),yt(t,"numberAxisTitle",r.getNumberAxisTitle()),yt(t,"stringAxisTitle",r.getStringAxisTitle()),yt(t,"onStringColumnSelect",r.onStringColumnSelect),yt(t,"onLabelChange",r.updateMargins),t))})),yt(Tt(r),"moveIndexToFront",(function(e,t){var n=he(t),a=t[e];return n.slice(e,e+1),n.unshift(a),n})),yt(Tt(r),"renderColumnChart",(function(e){return l.createElement(ir,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderBarChart",(function(e){return l.createElement(lr,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderLineChart",(function(e){return l.createElement(ur,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderPieChart",(function(){return l.createElement(pr,r.getCommonChartProps())})),yt(Tt(r),"renderHeatmapChart",(function(){return l.createElement(mr,r.getCommonChartProps())})),yt(Tt(r),"renderBubbleChart",(function(){return l.createElement(gr,r.getCommonChartProps())})),yt(Tt(r),"renderStackedColumnChart",(function(){return l.createElement(Cr,r.getCommonChartProps())})),yt(Tt(r),"renderStackedBarChart",(function(e){return l.createElement(yr,r.getCommonChartProps({dataType:e}))})),yt(Tt(r),"renderStackedLineChart",(function(){return l.createElement(Er,r.getCommonChartProps())})),yt(Tt(r),"renderChart",(function(){switch(r.props.type){case"column":return r.renderColumnChart();case"bar":return r.renderBarChart();case"line":return r.renderLineChart();case"pie":return r.renderPieChart();case"bubble":return r.renderBubbleChart();case"heatmap":return r.renderHeatmapChart();case"stacked_column":return r.renderStackedColumnChart();case"stacked_bar":return r.renderStackedBarChart();case"stacked_line":return r.renderStackedLineChart();default:return"Unknown Display Type"}})),yt(Tt(r),"render",(function(){return r.chartWidth=e(r.chartContainerRef,"offsetWidth",0),r.chartHeight=e(r.chartContainerRef,"offsetHeight",0),l.createElement(At,null,l.createElement("div",{id:"react-autoql-chart-".concat(r.CHART_ID),ref:function(e){return r.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container ".concat(r.state.isLoading||r.props.isAnimatingContainer||r.props.isResizing?"loading":""),style:{flexBasis:r.chartHeight?"".concat(r.chartHeight,"px"):"100vh"}},!r.firstRender&&!r.props.isAnimatingContainer&&l.createElement(c,null,l.createElement("svg",{ref:function(e){return r.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:r.chartWidth,height:r.chartHeight,style:{fontFamily:e(Ht(r.props.themeConfig),"font-family","sans-serif"),color:e(Ht(r.props.themeConfig),"text-color-primary","inherit"),background:e(Ht(r.props.themeConfig),"background-color","inherit")}},l.createElement("g",{className:"react-autoql-chart-content-container"},r.renderChart())))))}));var o=t.themeConfig.chartColors;return r.CHART_ID=ve(),r.Y_AXIS_LABEL_WIDTH=15,r.X_AXIS_LABEL_HEIGHT=15,r.PADDING=20,r.firstRender=!0,r.recursiveUpdateCount=0,r.colorScale=ke().range(o),r.state={aggregatedData:t.isPivot?void 0:r.aggregateRowData(t),leftMargin:r.PADDING,rightMargin:r.PADDING,topMargin:r.PADDING,bottomMargin:r.PADDING,bottomLegendMargin:0,loading:!0},r}return ht(a)}();yt(Sr,"propTypes",ct(ct({},xa),{},{type:p.string.isRequired})),yt(Sr,"defaultProps",wa);var Tr=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"ID",ve()),yt(Tt(t),"state",{isOpen:!1}),yt(Tt(t),"componentDidMount",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"render",(function(){return t.props.options?l.createElement(At,null,l.createElement(Ee,{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,l.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},l.createElement(fe,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-drawer-tooltip",effect:"solid",delayShow:500}),l.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){return l.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)}))))}},l.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",l.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item"))))):null})),t}return ht(a)}();yt(Tr,"propTypes",{themeConfig:Mt,onChange:p.func,options:p.arrayOf(p.shape({})),popupClassname:p.string,value:p.string,label:p.string,size:p.string}),yt(Tr,"defaultProps",{themeConfig:Pt,onChange:function(){},options:[],popupClassname:void 0,value:void 0,label:void 0,size:"large",style:{}});var Dr=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"originalReplaceWords",[]),yt(Tt(t),"suggestionLists",[]),yt(Tt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),yt(Tt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),yt(Tt(t),"getSuggestionLists",(function(e,t){var n=[];return t.length&&t.forEach((function(t){var a=e.slice(t.start,t.end),r=t.suggestions.map((function(e){return ct({id:ve(),hidden:!1},e)})),o=[].concat(wt(r),[{id:ve(),text:a}]);n.push(o)})),n})),yt(Tt(t),"getPlainTextList",(function(e,t){var n=[],a=0;return t.forEach((function(r,o){n.push(e.slice(a,r.start)),o===t.length-1&&n.push(e.slice(r.end,e.length)),a=r.end})),n})),yt(Tt(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})),yt(Tt(t),"updateStartAndEndIndexes",(function(n){if(e(n,"length")){var a="";t.plainTextList.forEach((function(e,t){a=a.concat(e);var r=n[t];if(r&&!r.hidden){var o=a.length;r.start=o,r.end=o+r.text.length,a=a.concat(r.text)}}))}})),yt(Tt(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||ve()})),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:he(e)})})),yt(Tt(t),"initializeQueryValidationOptions",(function(e){var n=e.data,a=n.replacements,r=n.query;if(!a||!r)return[];t.suggestionLists=t.getSuggestionLists(r,a),t.plainTextList=t.getPlainTextList(r,a),t.setInitialSelections()})),yt(Tt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var a=t.suggestionLists[n].find((function(t){return t.id===e})),r=he(t.state.selectedSuggestions);r[n]=a,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(r),r),t.updateStartAndEndIndexes(r),t.setState({selectedSuggestions:he(r)})}else t.deleteQueryValidationSuggestion(n)})),yt(Tt(t),"deleteQueryValidationSuggestion",(function(e){var n=he(t.state.selectedSuggestions.map((function(t,n){return n===e?ct(ct({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:he(n)})})),yt(Tt(t),"renderWordSelector",(function(e){var n=he(t.state.selectedSuggestions[e]);if(!n||n.hidden)return null;var a=t.suggestionLists[e],r=a.map((function(e,t){var n={value:e.id,label:e.text};return t===a.length-1?n.listLabel="".concat(n.label," (Original term)"):n.listLabel="".concat(e.text).concat(e.value_label?" (".concat(e.value_label,")"):""),n}));return r.push({value:"remove-word",label:l.createElement("span",null,l.createElement(ea,{type:"trash"})," Remove term")}),l.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},l.createElement(Tr,{themeConfig:Ht(t.props.themeConfig),options:r,key:ve(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),yt(Tt(t),"renderQueryValidationQuery",(function(){return l.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var a=l.createElement("span",{key:"query-element-".concat(n)},e),r=t.renderWordSelector(n);return l.createElement("span",{key:ve()},a,r)})))})),yt(Tt(t),"getQueryValidationQueryText",(function(e){var n="";return t.plainTextList.forEach((function(t,a){n=n.concat(t);var r=e[a];r&&!r.hidden&&(n=n.concat(r.text))})),n})),yt(Tt(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?l.createElement("div",{className:"react-autoql-query-validation-container"},l.createElement("div",{className:"react-autoql-query-validation-description"},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:"),l.createElement("span",null,t.renderQueryValidationQuery(),l.createElement("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},l.createElement(ea,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return ht(a)}();yt(Dr,"propTypes",{themeConfig:Mt,response:p.shape({}),onSuggestionClick:p.func,autoSelectSuggestion:p.bool,isQueryRunning:p.bool,initialSelections:p.arrayOf(p.shape({})),onQueryValidationSelectOption:p.func,message:p.string}),yt(Dr,"defaultProps",{themeConfig:Pt,response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var xr=function(n){Ct(r,l.Component);var a=xt(r);function r(n){var o;return ft(this,r),yt(Tt(o=a.call(this,n)),"componentDidMount",(function(){An(Ht(o.props.themeConfig)),o.props.onValueLabelClick&&o.validateAndUpdateValueLabels()})),yt(Tt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),yt(Tt(o),"componentDidUpdate",(function(e,t){ge(Ht(o.props.themeConfig),Ht(e.themeConfig))||An(Ht(o.props.themeConfig))})),yt(Tt(o),"validateAndUpdateValueLabels",(function(){if(o.reverseTranslationArray.length){var n=[],a=t(o.reverseTranslationArray);o.reverseTranslationArray.forEach((function(t,r){"VALUE_LABEL"===t.c_type&&n.push(fa(ct({suggestion:t.eng},Ot(o.props.authentication))).then((function(t){e(t,"data.data.matches.length")&&(a[r].c_type="VALIDATED_VALUE_LABEL")})))})),Promise.all(n).then((function(){o.reverseTranslationArray=a,o.setState({isValidated:!0})}))}})),yt(Tt(o),"renderFilterLockLink",(function(e){return l.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(),o.props.onValueLabelClick(e)}}," ",o.props.appliedFilters.includes(e)&&l.createElement(ea,{type:"lock"})," ",l.createElement("span",null,e))})),yt(Tt(o),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return o.props.onValueLabelClick?o.renderFilterLockLink(e.eng):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),yt(Tt(o),"render",(function(){return e(o.reverseTranslationArray,"length")?l.createElement(At,null,l.createElement("div",{id:o.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},l.createElement("div",{className:"react-autoql-reverse-translation"},l.createElement(ea,{type:"info"}),l.createElement("strong",null," Interpreted as: "),o.reverseTranslationArray.map((function(e,t){return l.createElement("span",{key:"rt-item-".concat(o.COMPONENT_KEY,"-").concat(t)},o.renderInterpretationChunk(e))}))))):null})),o.COMPONENT_KEY=ve(),o.reverseTranslationArray=n.reverseTranslation,o.state={isValidated:!1},o}return ht(r)}();yt(xr,"propTypes",{authentication:Nt,themeConfig:Mt,interpretation:p.array,onValueLabelClick:p.func,appliedFilters:p.array,reverseTranslation:p.array}),yt(xr,"defaultProps",{authentication:It,themeConfig:Pt,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 wr=function(t){Ct(r,l.Component);var a=xt(r);function r(t){var o;ft(this,r),yt(Tt(o=a.call(this,t)),"componentDidMount",(function(){o._isMounted=!0;try{var e;null!==(e=o.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&o.props.optionsToolbarRef.forceUpdate(),En(o.props.queryResponse,o.props.displayType)?o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes):o.onRecommendedDisplayType(Tn(o.props.queryResponse,o.props.autoChartAggregations))}catch(e){console.error(e),o.props.onErrorCallback(e)}})),yt(Tt(o),"shouldComponentUpdate",(function(e){return!o.props.isResizing||!e.isResizing})),yt(Tt(o),"componentDidUpdate",(function(e,t){try{var n;if(ge(o.props.tableConfig,e.tableConfig)||(o.props.tableConfig?o.tableConfig=he(o.props.tableConfig):o.setTableConfig()),!ge(o.props.tableConfig,o.tableConfig)&&o.props.onTableConfigChange&&o.props.onTableConfigChange(o.tableConfig),!ge(o.props.columns,e.columns)&&o.props.onTableConfigChange&&o.props.onTableConfigChange({}),ge(Ht(o.props.themeConfig),Ht(e.themeConfig))&&An(Ht(o.props.themeConfig)),o.props.queryResponse&&!o.queryResponse)if(En(o.props.queryResponse,o.props.displayType))o.setResponseData(),o.forceUpdate();else{var a=Tn(o.props.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(a)}if(!e.displayType&&o.props.displayType)if(fe.hide(),En(o.queryResponse,o.props.displayType))o.setResponseData(),o.forceUpdate();else{var r=Tn(o.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(r)}if(o.props.displayType!==e.displayType&&!En(o.queryResponse,o.props.displayType)){var i=Tn(o.queryResponse,o.props.autoChartAggregations);o.onRecommendedDisplayType(i)}!t.isContextMenuOpen&&o.state.isContextMenuOpen?xe.on():t.isContextMenuOpen&&!o.state.isContextMenuOpen&&xe.off(),t.isShowingInterpretation!==o.state.isShowingInterpretation&&o.forceUpdate(),null!==(n=o.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&o.props.optionsToolbarRef.forceUpdate(),o.props.onUpdate()}catch(e){console.error(e)}})),yt(Tt(o),"componentWillUnmount",(function(){clearTimeout(o.filterDrilldownTimeout),o._isMounted=!1,fe.hide()})),yt(Tt(o),"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})),yt(Tt(o),"supportsPivot",(function(){return o.supportedDisplayTypes.includes("pivot_table")})),yt(Tt(o),"onRecommendedDisplayType",(function(e){o.props.onRecommendedDisplayType(e,o.supportedDisplayTypes)})),yt(Tt(o),"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(o.queryResponse,"data.data.columns");return!!t.numberColumnIndices.every((function(e){return n[e]&&Gt(n[e])}))&&!!t.stringColumnIndices.every((function(e){return n[e]&&Wt(n[e])}))}catch(e){return!1}})),yt(Tt(o),"updateColumns",(function(t){var n;e(o.queryResponse,"data.data.columns")&&(o.queryResponse.data.data.columns=t);var a=bn({response:o.queryResponse});o.setSupportedDisplayTypes(a),o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes),Cn(o.queryResponse)?o.onRecommendedDisplayType("text"):(o.tableConfig=void 0,o.shouldGenerateTableData()&&(o.generateTableData(),o.shouldGeneratePivotData()?o.generatePivotTableData({isFirstGeneration:!0}):(o.pivotTableColumns=void 0,o.pivotTableData=void 0)),e(o.tableRef,"ref.table")&&o.tableRef.ref.table.setColumns(o.tableColumns),null!==(n=o.props.optionsToolbarRef)&&void 0!==n&&n._isMounted&&o.props.optionsToolbarRef.forceUpdate(),"text"===o.props.displayType?o.onRecommendedDisplayType("table"):o.forceUpdate())})),yt(Tt(o),"generateAllData",(function(t,n){e(t,"data.data")&&n&&o.shouldGenerateTableData()&&(o.generateTableData(),o.shouldGeneratePivotData()&&o.generatePivotData({isFirstGeneration:!0}))})),yt(Tt(o),"setResponseData",(function(){o.queryID=e(o.queryResponse,"data.data.query_id"),o.interpretation=e(o.queryResponse,"data.data.interpretation"),o.generateAllData(o.queryResponse,o.props.displayType)})),yt(Tt(o),"shouldGeneratePivotData",(function(e){return(e||o.tableData)&&o.supportsPivot()})),yt(Tt(o),"shouldGenerateTableData",(function(){return e(o.queryResponse,"data.data.rows.length")})),yt(Tt(o),"dateSortFn",(function(e,t){try{if(!e&&!t)return 0;if(!e&&t)return 1;if(e&&!t)return-1;var a=Number(e),r=Number(t);if((Number.isNaN(a)||Number.isNaN(r))&&(a=n(e).unix(),r=n(t).unix()),!a||!r){if(e.includes("-W")){var o=e.substring(0,4),i=t.substring(0,4);if(o!==i)return i-o;var s=e.substring(6,8);return t.substring(6,8)-s}var l=[{description:"Sunday",value:1,label:"S"},{description:"Monday",value:2,label:"M"},{description:"Tuesday",value:3,label:"T"},{description:"Wednesday",value:4,label:"W"},{description:"Thursday",value:5,label:"T"},{description:"Friday",value:6,label:"F"},{description:"Saturday",value:7,label:"S"}],c=null,u=null;return l.forEach((function(t){if(e.trim()===t.description)return c=t.value})),l.forEach((function(e){if(t.trim()===e.description)return u=e.value})),null===c||null===u?t-e:u-c}return r-a}catch(e){return-1}})),yt(Tt(o),"sortTableDataByDate",(function(e){try{if(!e||"object"!==pt(e))return;var t=Zt(o.tableColumns);return t>=0?wt(e).sort((function(e,n){return o.dateSortFn(e[t],n[t])})):e}catch(t){return console.error(t),e}})),yt(Tt(o),"generateTableData",(function(e){var t,n,a;o.tableColumns=e||o.formatColumnsForTable(),o.tableData=o.sortTableDataByDate(null===(t=o.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.rows),o.setTableConfig()})),yt(Tt(o),"generatePivotData",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isFirstGeneration,n=e.newTableData;try{var a=n||o.tableData;2===o.tableColumns.length?o.generateDatePivotData(a):o.generatePivotTableData({isFirstGeneration:t,newTableData:n})}catch(e){console.error(e),o.props.onErrorCallback(e),o.pivotTableData=void 0}})),yt(Tt(o),"renderSuggestionMessage",(function(e,t){var n;try{n=l.createElement("div",{className:"react-autoql-suggestion-message"},l.createElement("div",{className:"react-autoql-suggestions-container"},o.props.renderSuggestionsAsDropdown?l.createElement("select",{key:ve(),onChange:function(e){o._isMounted&&(o.setState({suggestionSelection:e.target.value}),o.onSuggestionClick({query:e.target.value,source:"suggestion",queryId:t}))},value:o.state.suggestionSelection,className:"react-autoql-suggestions-select"},e.map((function(e,t){return l.createElement("option",{key:ve(),value:e},e)}))):e.map((function(e){return l.createElement("div",{key:ve()},l.createElement("button",{onClick:function(){return o.onSuggestionClick({query:e,isButtonClick:!0,source:"suggestion",queryId:t})},className:"react-autoql-suggestion-btn"},e),l.createElement("br",null))}))))}catch(e){n=l.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return n})),yt(Tt(o),"renderSingleValueResponse",(function(){return l.createElement("div",{className:"single-value-response-container"},l.createElement("a",{className:"single-value-response ".concat(Qt(o.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){return o.processDrilldown({groupBys:[],supportedByAPI:!0})}},ln({element:e(o.queryResponse,"data.data.rows[0][0]"),column:e(o.queryResponse,"data.data.columns[0]"),config:Ft(o.props.dataFormatting)})))})),yt(Tt(o),"copyTableToClipboard",(function(){var e,t;"table"===o.props.displayType&&null!==(e=o.tableRef)&&void 0!==e&&e._isMounted?o.tableRef.copyToClipboard():"pivot_table"===o.props.displayType&&null!==(t=o.pivotTableRef)&&void 0!==t&&t._isMounted&&o.pivotTableRef.copyToClipboard()})),yt(Tt(o),"getBase64Data",(function(){var e,t;if(o.chartRef&&mn(o.props.displayType))return o.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=o.tableRef)&&void 0!==e&&e._isMounted&&"table"===o.props.displayType){var n=o.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=o.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===o.props.displayType){var a=o.pivotTableRef.getBase64Data();return Promise.resolve(a)}})),yt(Tt(o),"saveChartAsPNG",(function(){o.chartRef&&o.chartRef.saveAsPNG()})),yt(Tt(o),"getFilterDrilldown",(function(e){var t,n=e.stringColumnIndex,a=e.row,r=null===(t=o.tableData)||void 0===t?void 0:t.filter((function(e){return"".concat(e[n])==="".concat(a[n])})),i=he(o.queryResponse);return i.data.data.rows=r,i})),yt(Tt(o),"processDrilldown",function(){var e=mt(ut().mark((function e(t){var n,a,r,i,s,l,c;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.groupBys,a=t.supportedByAPI,r=t.row,i=t.activeKey,s=t.stringColumnIndex,!Qt(o.props.autoQLConfig).enableDrilldowns){e.next=24;break}if(e.prev=2,!a){e.next=17;break}return o.props.onDrilldownStart(i),e.prev=5,e.next=8,da(ct(ct(ct({},Ot(Ot(o.props.authentication))),Qt(Qt(o.props.autoQLConfig))),{},{queryID:o.queryID,groupBys:n}));case 8:l=e.sent,o.props.onDrilldownEnd({response:l}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),o.props.onDrilldownEnd({response:e.t0});case 15:e.next=18;break;case 17:!isNaN(s)&&null!=r&&r.length&&(o.props.onDrilldownStart(i),c=o.getFilterDrilldown({stringColumnIndex:s,row:r}),o.filterDrilldownTimeout=setTimeout((function(){o.props.onDrilldownEnd({response:c})}),1500));case 18:e.next=24;break;case 20:e.prev=20,e.t1=e.catch(2),console.error(e.t1),o.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)}}()),yt(Tt(o),"onTableCellClick",(function(e){var t={};t=o.pivotTableColumns&&"pivot_table"===o.props.displayType?function(e,t,n,a){try{var r=[];if(e&&e.getColumn()&&e.getColumn().getDefinition()&&e.getColumn().getDefinition().drilldownData&&(r=e.getColumn().getDefinition().drilldownData),!r.length)return;if(2===t.length){var o=Number(n[e.getField()].name),i=e.getData()[0];r[0].value="".concat(a[o][i])}else r[0].value="".concat(e.getData()[0]);return r}catch(e){return void console.error(e)}}(e,o.tableColumns,o.pivotTableColumns,o.pivotOriginalColumnData):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(),r=[];return n.forEach((function(e){var n=t[e].name,o="".concat(a[e]);r.push({name:n,value:o})})),r}}}(e,o.tableColumns),o.processDrilldown({groupBys:t,supportedByAPI:!!t})})),yt(Tt(o),"onChartClick",(function(e,t,n,a,r,i,s){var l,c,u,p=[],d=(null==n||null===(l=n[a])||void 0===l?void 0:l.origColumn)||(null==n?void 0:n[a]);if(null!=n&&null!==(c=n[a])&&void 0!==c&&c.datePivot){var m,f,g,h=Number(null==n||null===(m=n[t])||void 0===m?void 0:m.name),y=null==e?void 0:e[a],v="".concat(null===(f=o.pivotOriginalColumnData)||void 0===f||null===(g=f[h])||void 0===g?void 0:g[y]);p.push({name:d.name,value:v})}else null!=d&&d.groupable&&p.push({name:d.name,value:"".concat(null==e?void 0:e[a])});null!=r&&r.groupable&&p.push({name:r.name,value:"".concat(null==n||null===(u=n[i])||void 0===u?void 0:u.name)});p.length,o.processDrilldown({groupBys:p,supportedByAPI:!!p.length,row:e,activeKey:s,stringColumnIndex:a})})),yt(Tt(o),"toggleTableFilter",(function(e){var t,n,a=e.isFilteringTable;"table"===o.props.displayType&&((null===(t=o.tableRef)||void 0===t?void 0:t._isMounted)&&o.tableRef.toggleTableFilter({isFilteringTable:a}));"pivot_table"===o.props.displayType&&((null===(n=o.pivotTableRef)||void 0===n?void 0:n._isMounted)&&o.pivotTableRef.toggleTableFilter({isFilteringTable:a}))})),yt(Tt(o),"onTableFilter",function(){var e=mt(ut().mark((function e(t,n){var a,r,i,s,l;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"table"===o.props.displayType&&(o.headerFilters=t,r=[],n.forEach((function(e){r.push(e.getData())})),i=r.length,s=o.prevRows>=0?o.prevRows:null===(a=o.tableData)||void 0===a?void 0:a.length,i!==s&&(o.shouldGeneratePivotData(r)&&o.generatePivotData({newTableData:r}),null!==(l=o.props.optionsToolbarRef)&&void 0!==l&&l._isMounted&&o.props.optionsToolbarRef.forceUpdate(),o.prevRows=i));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),yt(Tt(o),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex;if("pie"===o.props.displayType)o.onPieChartLegendClick(e);else{var n=o.supportsPivot()?wt(o.pivotTableColumns):wt(o.tableColumns);n[t].isSeriesHidden=!n[t].isSeriesHidden,o.supportsPivot()?o.pivotTableColumns=n:o.tableColumns=n}o.forceUpdate()})),yt(Tt(o),"onPieChartLegendClick",(function(e){})),yt(Tt(o),"onChangeStringColumnIndex",(function(e){o.supportsPivot()?(o.pivotTableConfig.legendColumnIndex===e&&(o.pivotTableConfig.legendColumnIndex=void 0),o.pivotTableConfig.stringColumnIndex=e,o.generatePivotTableData()):(o.tableConfig.legendColumnIndex===e&&(o.tableConfig.legendColumnIndex=void 0),o.tableConfig.stringColumnIndex=e),o.forceUpdate()})),yt(Tt(o),"onChangeLegendColumnIndex",(function(e){o.supportsPivot()?(o.pivotTableConfig.stringColumnIndex===e&&(o.pivotTableConfig.stringColumnIndex=void 0),o.pivotTableConfig.legendColumnIndex=e,o.generatePivotTableData()):(o.tableConfig.stringColumnIndex===e&&(o.tableConfig.stringColumnIndex=void 0),o.tableConfig.legendColumnIndex=e),o.forceUpdate()})),yt(Tt(o),"onChangeNumberColumnIndices",(function(e){e&&(o.supportsPivot()?(o.pivotTableConfig.numberColumnIndices=e,o.pivotTableConfig.numberColumnIndex=e[0]):(o.tableConfig.numberColumnIndices=e,o.tableConfig.numberColumnIndex=e[0]),o.forceUpdate())})),yt(Tt(o),"setPivotTableConfig",(function(){var e=o.pivotTableColumns;if(e){if(o.pivotTableConfig||(o.pivotTableConfig={}),!(o.pivotTableConfig.stringColumnIndices&&o.pivotTableConfig.stringColumnIndex>=0)){var t=$t(e),n=t.stringColumnIndices,a=t.stringColumnIndex;o.pivotTableConfig.stringColumnIndices=n,o.pivotTableConfig.stringColumnIndex=a}if(!o.pivotTableConfig.numberColumnIndices){var r=Xt(e),i=r.numberColumnIndex,s=r.numberColumnIndices;o.pivotTableConfig.numberColumnIndices=s,o.pivotTableConfig.numberColumnIndex=i}}})),yt(Tt(o),"setTableConfig",(function(){var e=o.tableColumns;if(e){if(o.tableConfig||(o.tableConfig={}),!(o.tableConfig.stringColumnIndices&&o.tableConfig.stringColumnIndex>=0)){var t=$t(e),n=t.stringColumnIndices,a=t.stringColumnIndex;o.tableConfig.stringColumnIndices=n,o.tableConfig.stringColumnIndex=a}if(!(o.tableConfig.numberColumnIndices&&o.tableConfig.numberColumnIndex>=0)){var r=Xt(e),i=r.numberColumnIndex,s=r.numberColumnIndices;o.tableConfig.numberColumnIndices=s,o.tableConfig.numberColumnIndex=i}var l=o.tableColumns.findIndex((function(e,t){return e.groupable&&t!==o.tableConfig.stringColumnIndex}));l>=0&&(o.tableConfig.legendColumnIndex=l)}})),yt(Tt(o),"setSupportedDisplayTypes",(function(e,t){!e||!t&&ge(e,o.supportedDisplayTypes)||(o.supportedDisplayTypes=e,o.supportedDisplayTypes.includes(o.props.displayType)?o.props.onSupportedDisplayTypesChange(o.supportedDisplayTypes):o.onRecommendedDisplayType(Tn(o.queryResponse,o.props.autoChartAggregations)))})),yt(Tt(o),"getTooltipDataForCell",(function(e,t,n){var a=null;try{if(o.supportsPivot()){var r=o.tableColumns[o.tableConfig.stringColumnIndex],i=o.tableColumns[o.tableConfig.numberColumnIndex],s=o.tableColumns[o.tableConfig.legendColumnIndex],l="<div>\n <strong>".concat(o.pivotTableColumns[0].title,":</strong>").concat(ln({element:e[0],column:o.pivotTableColumns[0],config:Ft(o.props.dataFormatting)}),"\n </div>"),c="<span></span>";s?c="<div><strong>".concat(s.title,":</strong> ").concat(o.pivotTableColumns[t].title,"</div>"):r&&(c="<div><strong>".concat(r.title,":</strong> ").concat(o.pivotTableColumns[t].title,"</div>"));var u="<div>\n <strong>".concat(i.title,":</strong> ").concat(ln({element:e[t]||0,column:i,config:Ft(o.props.dataFormatting)}),"\n </div>");a="<div>\n ".concat(l,"\n ").concat(c,"\n ").concat(u,"\n </div>")}else{var p=o.tableColumns[o.tableConfig.stringColumnIndex],d=o.tableColumns[t];a="<div>\n <div>\n <strong>".concat(p.title,":</strong> ").concat(ln({element:e[o.tableConfig.stringColumnIndex],column:p,config:Ft(o.props.dataFormatting)}),"\n </div>\n <div>\n <div>\n <strong>").concat(d.title,":</strong> ").concat(ln({element:n||e[t]||0,column:d,config:Ft(o.props.dataFormatting)}),"\n </div>\n </div>")}return a}catch(e){return console.error(e),null}})),yt(Tt(o),"getDrilldownDataForCell",(function(t,n){var a=dn(o.tableColumns)>0;return o.supportsPivot()?{supportedByAPI:a,data:[{name:e(o.pivotTableColumns,"[0].name"),value:"".concat(t[0])},{name:e(o.tableColumns,"[".concat(o.tableConfig.legendColumnIndex,"].name")),value:"".concat(e(o.pivotTableColumns,"[".concat(n,"].name")))}]}:{supportedByAPI:a,data:[{name:e(o.tableColumns,"[".concat(o.tableConfig.stringColumnIndex,"].name")),value:"".concat(e(t,"[".concat(o.tableConfig.stringColumnIndex,"]")))}]}})),yt(Tt(o),"isStringColumnDateType",(function(){var e=o.tableColumns[o.tableConfig.stringColumnIndex];return Yt(e)})),yt(Tt(o),"getMultiSeriesData",(function(t,n){var a,r=$t(t).stringColumnIndex,i=Jt(t),s=Xt(t).numberColumnIndex,l=he(n).sort((function(e,t){var n=e[r],a=t[r];return n&&a?a-n:t-e})),c={};o.tableColumns.forEach((function(e,t){e.seriesCategory&&(c[e.seriesCategory]=t)}));var u=[];return l.forEach((function(t,n){var l=t[r],p=e(a,"[".concat(r,"]")),d=t[i];if(p!==l){var m=nn(o.tableColumns.length,1,0);m[0]=l,u.push(m)}var f=u[u.length-1][c[d]]||0;u[u.length-1][c[d]]=t[s]+f,a=t})),u})),yt(Tt(o),"setFilterFunction",(function(e){var t=Tt(o);return"DATE"===e.type||"DATE_STRING"===e.type?function(n,a,r,i){try{var s=ln({element:a,column:e,config:t.props.dataFormatting});return"".concat(s).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),o.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,a){try{var r=e.trim();if(r.length>=2){var i=Number(r.substr(1).replace(/[^0-9.]/g,""));if(">"===r[0]&&"="===r[1])return t>=i;if(">"===r[0])return t>i;if("<"===r[0]&&"="===r[1])return t<=i;if("<"===r[0])return t<i;if("!"===r[0]&&"="===r[1])return t!==i;if("="===r[0])return t===i}var s=e.replace(/[^0-9.]/g,"");return t.toString().includes(s)}catch(e){return console.error(e),o.props.onErrorCallback(e),!1}}:void 0})),yt(Tt(o),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(e,t){return o.dateSortFn(t,e)}:"STRING"===e.type?"string":void 0})),yt(Tt(o),"formatColumnsForTable",(function(e){var t,n,a,r=e||(null===(t=o.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.columns);return r?r.map((function(e,t){return e.field="".concat(t),e.title=e.display_name,e.id=ve(),e.visible=e.is_visible,"DOLLAR_AMT"===e.type||"RATIO"===e.type||"NUMBER"===e.type?e.hozAlign="right":e.hozAlign="center",e.formatter=function(t,n,a){return ln({element:t.getValue(),column:e,config:Ft(o.props.dataFormatting),htmlElement:t.getElement()})},e.headerFilter="input",e.headerFilterFunc=o.setFilterFunction(e),e.sorter=o.setSorterFunction(e),e.headerContext=function(e,t){e.preventDefault(),o.setState({isContextMenuOpen:!0,activeColumn:t,contextMenuPosition:{top:e.clientY+10,left:e.clientX-20}})},e})):null})),yt(Tt(o),"formatDatePivotYear",(function(e,t){return"DATE"===o.tableColumns[t].type?n.unix(e[t]).utc().format("YYYY"):n(e[t]).format("YYYY")})),yt(Tt(o),"formatDatePivotMonth",(function(e,t){return"DATE"===o.tableColumns[t].type?n.unix(e[t]).format("MMMM"):n(e[t]).format("MMMM")})),yt(Tt(o),"generateDatePivotData",(function(t){try{var a,r=(yt(a={},Ut[1],0),yt(a,Ut[2],1),yt(a,Ut[3],2),yt(a,Ut[4],3),yt(a,Ut[5],4),yt(a,Ut[6],5),yt(a,Ut[7],6),yt(a,Ut[8],7),yt(a,Ut[9],8),yt(a,Ut[10],9),yt(a,Ut[11],10),yt(a,Ut[12],11),a),i=Zt(o.tableColumns),s=o.tableConfig.numberColumnIndex;s>=0||(s=o.tableColumns.findIndex((function(e,t){return t!==i&&Gt(e)})));var l=t||e(o.queryResponse,"data.data.rows"),c=wt(l.map((function(e){return"DATE"===o.tableColumns[i].type?Number(n.unix(e[i]).utc().format("YYYY")):Number(n(e[i]).format("YYYY"))}))).filter(tn).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),u=[{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:o.tableColumns[i]}];Object.keys(c).forEach((function(e,t){u.push(ct(ct({},o.tableColumns[s]),{},{origColumn:o.tableColumns[s],name:e,title:e,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0}))}));var p=nn(Object.keys(c).length,12),d={};Object.keys(r).forEach((function(e,t){p[t][0]=e})),l.forEach((function(e){var t=o.formatDatePivotYear(e,i),n=o.formatDatePivotMonth(e,i),a=c[t],l=r[n];l&&a&&(p[l][a]=e[s],d[t]=ct(ct({},d[t]),{},yt({},n,e[i])))})),o.pivotOriginalColumnData=d,o.pivotTableColumns=u,o.pivotTableData=p,o.numberOfPivotTableRows=12,o.setPivotTableConfig()}catch(e){console.error(e),o.setSupportedDisplayTypes(o.supportedDisplayTypes.filter((function(e){return"pivot_table"!==e}))),o.onRecommendedDisplayType("table")}})),yt(Tt(o),"getColumnFromIndexString",(function(t){return e(o.tableColumns,"[".concat(e(o.tableConfig,"[".concat(t,"]")),"]"))})),yt(Tt(o),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,a=t.newTableData;try{var r=a||o.tableData||e(o.queryResponse,"data.data.rows");r=r.filter((function(e){return null!==e[0]}));var i=o.tableConfig,s=i.legendColumnIndex,l=i.stringColumnIndex,c=i.numberColumnIndex,u=o.sortTableDataByDate(r).map((function(e){return e[l]})).filter(tn).reduce((function(e,t,n){return e[t]=n,e}),{}),p=o.sortTableDataByDate(r).map((function(e){return e[s]})).filter(tn).reduce((function(e,t,n){return e[t]=n,e}),{}),d=l,m=s;if(n&&Object.keys(p).length>Object.keys(u).length&&!Yt(o.getColumnFromIndexString("stringColumnIndex"))){d=s,m=l;var f=he(u);u=he(p),p=he(f)}o.tableConfig.legendColumnIndex=m;var g=[ct(ct({},o.tableColumns[d]),{},{frozen:!0,headerContext:void 0,visible:!0,is_visible:!0,field:"0"})];Object.keys(p).forEach((function(e,t){var n=ln({element:e,column:o.tableColumns[m],config:Ft(o.props.dataFormatting)});g.push(ct(ct({},o.tableColumns[c]),{},{origColumn:o.tableColumns[c],name:e,title:n,field:"".concat(t+1),headerContext:void 0,visible:!0,is_visible:!0}))}));var h=nn(Object.keys(p).length+1,Object.keys(u).length);r.forEach((function(e){h[u[e[d]]][0]=e[d],h[u[e[d]]][p[e[m]]+1]=e[c]}));var y=bn({response:o.queryResponse});ge(y,o.supportedDisplayTypes)||o.setSupportedDisplayTypes(y),o.pivotTableColumns=g,o.pivotTableData=h,o.numberOfPivotTableRows=e(o.pivotTableData,"length",0),o.setPivotTableConfig()}catch(e){console.error(e),o.props.onErrorCallback(e)}})),yt(Tt(o),"onSuggestionClick",(function(t){var n=t.query,a=t.queryId,r=t.userSelection,i=t.isButtonClick,l=t.skipQueryValidation,c=t.source;r||function(t){var n=t.queryId,a=t.suggestion,r=t.apiKey,o=t.domain,i=t.token,l="".concat(o,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(r),c={suggestion:a};if(!i||!o||!r)return Promise.reject(new Error("Unauthenticated"));var u={headers:{Authorization:"Bearer ".concat(i)}};s.put(l,c,u).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(ct(ct({},Ot(o.props.authentication)),{},{queryId:a,suggestion:n})),"None of these"===n?o.props.onNoneOfTheseClick?o.props.onNoneOfTheseClick():o.setState({customResponse:"Thank you for your feedback."}):(o.props.onSuggestionClick&&o.props.onSuggestionClick({query:n,userSelection:r,isButtonClick:i,skipQueryValidation:l,source:c}),o.props.queryInputRef&&o.props.queryInputRef.submitQuery({queryText:n,userSelection:r,skipQueryValidation:!0,source:c}))})),yt(Tt(o),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return l.createElement("div",null,t.map((function(e,n){return l.createElement("span",{key:"error-message-part-".concat(o.COMPONENT_KEY,"-").concat(n)},l.createElement("span",null,e),n!==t.length-1&&l.createElement("button",{className:"report-like-text-button",onClick:o.props.reportProblemCallback},"report"))})))}catch(t){return l.createElement("span",null,e)}})),yt(Tt(o),"renderAllColumnsHiddenMessage",(function(){return l.createElement("div",{className:"no-columns-error-message"},l.createElement("div",null,l.createElement(ea,{className:"warning-icon",type:"warning-triangle"}),l.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",l.createElement(ea,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),yt(Tt(o),"renderTable",(function(){return!o.tableData||"pivot_table"===o.props.displayType&&!o.pivotTableData?"Error: There was no data supplied for this table":"pivot_table"===o.props.displayType?l.createElement(At,null,l.createElement(Da,{themeConfig:Ht(o.props.themeConfig),key:o.pivotTableID,ref:function(e){return o.pivotTableRef=e},columns:o.pivotTableColumns,data:o.pivotTableData,onCellClick:o.onTableCellClick,headerFilters:o.pivotHeaderFilters,onFilterCallback:o.onTableFilter,isResizing:o.props.isResizing,enableColumnHeaderContextMenu:o.props.enableColumnHeaderContextMenu})):l.createElement(Da,{themeConfig:Ht(o.props.themeConfig),key:o.tableID,ref:function(e){return o.tableRef=e},columns:o.tableColumns,data:o.tableData,onCellClick:o.onTableCellClick,headerFilters:o.headerFilters,onFilterCallback:o.onTableFilter,isResizing:o.props.isResizing})})),yt(Tt(o),"renderChart",(function(e){var t;if(!o.tableData||!o.tableColumns||!o.tableConfig)return console.error("Required table data was missing"),"Error: There was no data supplied for this chart";var n=o.supportsPivot();if(n&&(!o.pivotTableData||!o.pivotTableColumns||!o.pivotTableConfig))return console.error("Required pivot table data was missing"),"Error: There was no data supplied for this chart";var a=n?o.pivotTableConfig:o.tableConfig;return l.createElement(At,null,l.createElement(Sr,vt({themeConfig:Ht(o.props.themeConfig),dataLength:o.tableData.length,ref:function(e){return o.chartRef=e},type:e||o.props.displayType},a,{data:n?o.pivotTableData:o.tableData,columns:n?o.pivotTableColumns:o.tableColumns,isPivot:n,isShowingInterpretation:o.state.isShowingInterpretation,dataFormatting:Ft(o.props.dataFormatting),backgroundColor:o.props.backgroundColor,activeChartElementKey:o.props.activeChartElementKey,onLegendClick:o.onLegendClick,legendColumn:o.tableColumns[null===(t=o.tableConfig)||void 0===t?void 0:t.legendColumnIndex],changeStringColumnIndex:o.onChangeStringColumnIndex,changeLegendColumnIndex:o.onChangeLegendColumnIndex,changeNumberColumnIndices:o.onChangeNumberColumnIndices,onChartClick:o.onChartClick,isResizing:o.props.isResizing,isAnimatingContainer:o.props.isAnimatingContainer,enableDynamicCharting:o.props.enableDynamicCharting})))})),yt(Tt(o),"renderHelpResponse",(function(){var t=e(o.queryResponse,"data.data.rows[0]");if(!t)return null;var n=t.includes("#"),a=t;if(n){var r=t.split("#")[1].replace(/-/g," ");a=r.charAt(0).toUpperCase()+r.substr(1)}return l.createElement(c,null,"Great news, I can help with that:",l.createElement("br",null),l.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},l.createElement(ea,{type:"globe",className:"react-autoql-help-link-icon"}),a))})),yt(Tt(o),"renderError",(function(t){return t?e(t,"data.message")?o.renderMessage(t.data):o.renderMessage():(console.warn("Warning: No response object supplied"),o.renderMessage("No response supplied"))})),yt(Tt(o),"renderDataLimitWarning",(function(){var e,t,n,a,r,i,s,c=null===(e=o.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,u=null===(r=o.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(s=i.data)||void 0===s?void 0:s.row_limit,p=Qt(o.props.autoQLConfig).enableQueryInterpretation&&o.props.showQueryInterpretation;return u&&c===u?l.createElement("div",{className:"dashboard-data-limit-warning-icon"},l.createElement(ea,{type:"warning","data-tip":"The display limit of ".concat(c," 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(o.COMPONENT_KEY),"data-place":p?"left":"right"})):null})),yt(Tt(o),"renderMessage",(function(e){try{if("object"===pt(e)){var t=In.GENERAL_QUERY;return e.message&&(t=e.message,t=o.props.reportProblemCallback?o.replaceErrorTextWithLinks(e.message):t.replace("<report>","report")),l.createElement("div",{className:"query-output-error-message"},l.createElement("div",null,t),e.reference_id&&l.createElement(c,null,l.createElement("br",null),l.createElement("div",null,"Error ID: ",e.reference_id)))}var n=e||In.GENERAL_QUERY;return l.createElement("div",null,n)}catch(e){return console.warn(e),l.createElement("div",null,In.GENERAL_QUERY)}})),yt(Tt(o),"renderHTMLMessage",(function(t){return null!==e(t,"data.data.answer",null)?we(e(t,"data.data.answer"),{replace:function(e){if("a"===e.name){var t=e.attribs||{};return l.createElement("a",vt({},t,{target:"_blank"}),e.children)}}}):l.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),yt(Tt(o),"renderTextResponse",(function(){return Cn(o.queryResponse)?o.renderAllColumnsHiddenMessage():null})),yt(Tt(o),"renderResponse",(function(){var t=o.props.displayType;return o.hasError(o.queryResponse)?o.renderError(o.queryResponse):o.state.customResponse?o.state.customResponse:!!e(o.queryResponse,"data.data.items")?o.renderSuggestionMessage(o.queryResponse.data.data.items,o.queryResponse.data.data.query_id):e(o.queryResponse,"data.data.replacements")?l.createElement(Dr,{themeConfig:Ht(o.props.themeConfig),key:o.QUERY_VALIDATION_KEY,response:o.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return o.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:"validation"})},onQueryValidationSelectOption:o.props.onQueryValidationSelectOption,initialSelections:o.props.queryValidationSelections,autoSelectSuggestion:o.props.autoSelectQueryValidationSuggestion}):e(o.queryResponse,"data.data.rows.length")?t&&e(o.queryResponse,"data.data.rows")?"help"===t?o.renderHelpResponse():"text"===t?o.renderTextResponse():"single-value"===t?o.renderSingleValueResponse():fn(t)?o.renderTable():mn(t)?o.renderChart():(console.warn("display type not recognized: ".concat(o.props.displayType," - rendering as plain text")),o.renderMessage("display type not recognized: ".concat(o.props.displayType))):null:o.replaceErrorTextWithLinks(o.queryResponse.data.message)})),yt(Tt(o),"renderReverseTranslation",(function(){return Qt(o.props.autoQLConfig).enableQueryInterpretation&&o.props.showQueryInterpretation?l.createElement(xr,{authentication:o.props.authentication,onValueLabelClick:o.props.onRTValueLabelClick,appliedFilters:o.props.appliedFilters,isResizing:o.props.isResizing,reverseTranslation:e(o.queryResponse,"data.data.reverse_translation")}):null})),yt(Tt(o),"renderFooter",(function(){return l.createElement("div",{className:"query-output-footer"},o.renderReverseTranslation(),o.renderDataLimitWarning())})),yt(Tt(o),"render",(function(){return l.createElement(At,null,l.createElement("div",{key:o.COMPONENT_KEY,ref:function(e){return o.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(o.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(fn(o.props.displayType)?"table":"")},o.renderResponse(),o.renderFooter()),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-query-output-tooltip-".concat(o.COMPONENT_KEY),effect:"solid",place:"left",html:!0}))})),o.COMPONENT_KEY=ve(),o.QUERY_VALIDATION_KEY=ve(),o.queryResponse=t.queryResponse,o.supportedDisplayTypes=bn({response:t.queryResponse}),o.queryID=e(t.queryResponse,"data.data.query_id"),o.interpretation=e(t.queryResponse,"data.data.interpretation"),o.tableID=ve(),o.pivotTableID=ve(),t.tableConfig&&o.isTableConfigValid(t.tableConfig)&&(o.tableConfig=he(t.tableConfig));var i=En(t.queryResponse,t.displayType)?t.displayType:Tn(t.queryResponse,t.autoChartAggregations),u=Ht(t.themeConfig).chartColors;o.colorScale=ke().range(u),An(Ht(t.themeConfig)),o.generateAllData(t.queryResponse,i);var p=Qt(t.autoQLConfig).defaultShowInterpretation;return o.state={displayType:i,tableFilters:[],suggestionSelection:t.selectedSuggestion,isShowingInterpretation:p},o}return ht(r)}();yt(wr,"propTypes",{queryResponse:d({}),queryInputRef:v(Ta),authentication:Nt,themeConfig:Mt,autoQLConfig:Vt,dataFormatting:Rt,tableConfig:d({}),onSuggestionClick:C,displayType:m,renderTooltips:g,onQueryValidationSelectOption:C,autoSelectQueryValidationSuggestion:g,queryValidationSelections:y(d({})),renderSuggestionsAsDropdown:g,suggestionSelection:m,activeChartElementKey:m,enableColumnHeaderContextMenu:g,isResizing:g,enableDynamicCharting:g,onTableConfigChange:C,onNoneOfTheseClick:C,autoChartAggregations:g,onSupportedDisplayTypesChange:C,onRTValueLabelClick:C,enableQueryInterpretation:g,defaultShowInterpretation:g,isTaskModule:g,onUpdate:C,onDrilldownStart:C,onDrilldownEnd:C}),yt(wr,"defaultProps",{authentication:It,themeConfig:Pt,autoQLConfig:Lt,dataFormatting:qt,tableConfig:void 0,queryResponse:void 0,displayType:void 0,queryInputRef:void 0,onSuggestionClick:void 0,renderTooltips:!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,onQueryValidationSelectOption:function(){},onSupportedDisplayTypesChange:function(){},onErrorCallback:function(){},onRTValueLabelClick:function(){},onRecommendedDisplayType:function(){},onUpdate:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){}});var kr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"componentDidMount",(function(){An(Ht(e.props.themeConfig))})),yt(Tt(e),"componentDidUpdate",(function(t){ge(Ht(e.props.themeConfig),Ht(t.themeConfig))||An(Ht(e.props.themeConfig))})),yt(Tt(e),"showDisplayTypeButton",(function(t){return(!e.props.disableCharts||!zt.includes(t))&&(e.props.supportedDisplayTypes&&e.props.supportedDisplayTypes.includes(t)&&e.props.displayType!==t)})),yt(Tt(e),"createVisButton",(function(t,n,a){return e.showDisplayTypeButton(t)?l.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})),yt(Tt(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:Bt.includes(n)||zt.includes(n)?l.createElement(At,null,l.createElement("div",{className:"".concat(e.props.className||""," viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",l.createElement(ea,{type:"table"})),e.createVisButton("pivot_table","Pivot Table",l.createElement(ea,{type:"pivot-table"})),e.createVisButton("column","Column Chart",l.createElement(ea,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",l.createElement(ea,{type:"bar-chart"})),e.createVisButton("line","Line Chart",l.createElement(ea,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",l.createElement(ea,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",l.createElement(ea,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",l.createElement(ea,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",l.createElement(ea,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",l.createElement(ea,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",l.createElement(ea,{type:"stacked-line-chart"})))):null})),e}return ht(n)}();yt(kr,"propTypes",{themeConfig:Mt,supportedDisplayTypes:p.arrayOf(p.string).isRequired,onDisplayTypeChange:p.func.isRequired,displayType:p.string,disableCharts:p.bool,vertical:p.bool}),yt(kr,"defaultProps",{themeConfig:Pt,displayType:void 0,disableCharts:!1,vertical:!1});var Ar=kr,Nr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isConfirmCloseModalVisible:!1}),yt(Tt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:l.createElement("div",null,l.createElement(er,{type:"default",onClick:e.props.onClose},"Back"),l.createElement(er,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading},e.props.confirmText||"Continue"))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(De,{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:ct(ct({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},l.createElement("div",{className:"react-autoql-modal-body"},e.props.children),l.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return ht(n)}();yt(Nr,"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}),yt(Nr,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var Rr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isConfirmCloseModalVisible:!1}),yt(Tt(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()})),yt(Tt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:l.createElement("div",null,e.props.showCancelButton&&l.createElement(er,{type:"default",onClick:e.onClose},"Cancel"),l.createElement(er,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(De,{isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:ct(ct({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height})}},l.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,l.createElement(ea,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),l.createElement("div",{className:"react-autoql-modal-body",style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&l.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())),l.createElement(Nr,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.setState({isConfirmCloseModalVisible:!1}),e.props.onClose()}},l.createElement("h3",null,"Are you sure you want to leave this page?"),l.createElement("p",null,"All unsaved changes will be lost.")))})),e}return ht(n)}();yt(Rr,"propTypes",{themeConfig:Mt,title:p.oneOfType([p.element,p.string]),titleIcon:p.oneOfType([p.element,p.instanceOf(ea)]),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}),yt(Rr,"defaultProps",{themeConfig:Pt,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 Vr=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{columns:e.props.columns}),yt(Tt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),yt(Tt(e),"render",(function(){return l.createElement(Rr,{themeConfig:Ht(e.props.themeConfig),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},l.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},l.createElement(Xa,{themeConfig:Ht(e.props.themeConfig),columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:function(t){e.setState({columns:t})}})))})),e}return ht(n)}();yt(Vr,"propTypes",{themeConfig:Mt,isSettingColumns:p.bool}),yt(Vr,"defaultProps",{themeConfig:Pt,isSettingColumns:!1});var Mr=["id"],Ir=function(e){var t=e.query,n=e.domain,a=e.apiKey,r=e.token,o="".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||!r)return Promise.reject({error:"Unauthenticated"});var l={headers:{Authorization:"Bearer ".concat(r)}};return s.post(o,i,l)},qr=function(e){var t=e.domain,n=e.apiKey,a=e.token,r=e.unacknowledged,o=void 0===r?0:r;if(!a||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(a)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(o);return i.get(l,{timeout:18e4}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))},Lr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.offset,i=t.limit;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var l=s.create({headers:{Authorization:"Bearer ".concat(r)}}),c="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a,"&offset=").concat(o,"&limit=").concat(i);return l.get(c).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Pr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.channelType;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(n,"/autoql/api/v1/notifications/channels?key=").concat(a,"&type=").concat(o);return i.get(l).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"))}))},Or=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(t.type,!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(a);return o.get(i).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Fr=function(t){var n=t.domain,a=t.apiKey,r=t.token,o=t.dataAlertId;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(n,"/autoql/api/v1/data-alerts/").concat(o,"?key=").concat(a);return i.get(l).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Qr=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return o.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"))}))},Hr=function(t){var n=t.notificationId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(r);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Br=function(t){var n=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var o=s.create({headers:{Authorization:"Bearer ".concat(r)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return o.put(i,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},zr=function(t){var n=t.notificationId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(r);return i.put(l,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ur=function(e){var t=e.dataAlertId,n=e.status,a=e.type,r=e.domain,o=e.apiKey,i=e.token;return i&&o&&r?t?"PROJECT"===a?Gr({dataAlertId:t,status:n,token:i,domain:r,apiKey:o}):_r({dataAlertId:t,status:n,token:i,domain:r,apiKey:o}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},_r=function(t){var n=t.dataAlertId,a=t.status,r=t.token,o=t.domain,i=t.apiKey,l={status:a},c={headers:{Authorization:"Bearer ".concat(r)}},u="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return s.put(u,l,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},jr=function(t){var n=t.token,a=t.domain,r=t.apiKey,o=t.channelType,i=t.channelName,l=t.channelEmail,c=t.userName,u=t.userEmail;if(!n||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var p={headers:{Authorization:"Bearer ".concat(n)}},d={channel_type:o,channel_name:i,channel_email:l,sender_name:c,sender_email:u},m="".concat(a,"/autoql/api/v1/notifications/channels?key=").concat(r);return s.post(m,d,p).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Kr=function(t){var n=t.token,a=t.domain,r=t.apiKey,o=t.channelId,i=t.fileName,l=t.base64Data;if(!n||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var c={headers:{Authorization:"Bearer ".concat(n)}},u={attachment_name:i,attachment:l},p="".concat(a,"/autoql/api/v1/notifications/channels/").concat(o,"/send?key=").concat(r);return s.post(p,u,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Gr=function(t){var n=t.dataAlertId,a=t.status,r=t.token,o=t.domain,i=t.apiKey;return"INACTIVE"===a?function(t){var n=t.dataAlertId,a=t.token,r=t.domain,o=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(o);return s.delete(l,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:r,domain:o,apiKey:i}):function(t){var n=t.dataAlertId,a=t.token,r=t.domain,o=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(o);return s.post(l,{},i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:r,domain:o,apiKey:i})},Wr=function(t){var n=t.dataAlert,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No rule to update"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(r);return i.put(l,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Yr=function(t){var n=t.dataAlert,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}});n.id;var l=St(n,Mr),c="".concat(a,"/autoql/api/v1/data-alerts?key=").concat(r);return i.post(c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Xr=function(t){var n=t.expression,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l={expression:n},c="".concat(a,"/autoql/api/v1/data-alerts/validate?key=").concat(r);return i.post(c,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Jr=function(t,n){var a=n.domain,r=n.apiKey,o=n.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(r);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Zr=function(t){var n=t.channelId,a=t.domain,r=t.apiKey,o=t.token;if(!o||!r||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=s.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(a,"/autoql/api/v1/notifications/channels/").concat(n,"?key=").concat(r);return i.delete(l).then((function(){return Promise.resolve()})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},$r=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"NUMBER_OF_NOTIFICATIONS_TO_FETCH",10),yt(Tt(t),"FAILED_POLL_ATTEMPTS",0),yt(Tt(t),"state",{count:0}),yt(Tt(t),"timerID",void 0),yt(Tt(t),"componentDidMount",mt(ut().mark((function e(){return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t._isMounted=!0,t.props.isAlreadyMountedInDOM||t.subscribeToNotificationCount();case 2:case"end":return e.stop()}}),e)})))),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearInterval(t.timerID)})),yt(Tt(t),"getNotificationCount",(function(n){var a=n||t.state.count;return qr(ct(ct({},Ot(t.props.authentication)),{},{unacknowledged:a})).then((function(n){var a=e(n,"data.data.unacknowledged");return a&&a!==t.state.count&&(t.setState({count:a}),t.props.onNewNotification()),Promise.resolve(a)})).catch((function(e){return Promise.reject(e)}))})),yt(Tt(t),"subscribeToNotificationCount",(function(n){t._isMounted&&(t.timerID&&clearInterval(t.timerID),t.timerID=setInterval((function(){t.getNotificationCount(n).then((function(e){t.subscribeToNotificationCount(e),t.FAILED_POLL_ATTEMPTS=0})).catch((function(n){if(5===t.FAILED_POLL_ATTEMPTS){var a=new Error("There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.");throw console.error(a),t.props.onErrorCallback(a),clearInterval(t.timerID),new Error(a)}504==e(n,"response.status")?t.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){t.subscribeToNotificationCount()})),t.FAILED_POLL_ATTEMPTS+=1}))}),9e4))})),yt(Tt(t),"resetCount",(function(){Qr(ct({},Ot(t.props.authentication))).catch((function(e){console.error(e)})).finally((function(){t.setState({count:0})}))})),yt(Tt(t),"renderBadge",(function(){var e=t.props.overflowCount,n=t.state.count;if(!n)return null;if(t.props.useDot)return l.createElement("div",{className:"react-autoql-notifications-badge-dot"});var a=n;return n>e&&(a="".concat(e,"+")),l.createElement("div",{className:"react-autoql-notifications-badge"},a)})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notifications-button-container ".concat(t.props.useDot?"dot":"","\n ").concat(t.state.count?"":"no-badge"),"data-test":"notification-button",style:ct({},t.props.style),onClick:function(){t.props.clearCountOnClick&&t.resetCount()}},l.createElement(ea,{type:"notification",className:"react-autoql-notifications-button"}),t.renderBadge()))})),t}return ht(a)}();yt($r,"propTypes",{authentication:Nt,overflowCount:p.number,style:p.shape({}),size:p.number,useDot:p.bool,clearCountOnClick:p.bool,onNewNotification:p.func,onErrorCallback:p.func,isAlreadyMountedInDOM:p.bool}),yt($r,"defaultProps",{authentication:It,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},isAlreadyMountedInDOM:!1});var eo=["icon","type"],to=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{focused:!1}),yt(Tt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),yt(Tt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),yt(Tt(e),"focus",(function(){e.inputRef&&e.inputRef.focus()})),yt(Tt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var a=St(t,eo),r=a.className;return l.createElement(At,null,l.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(r," "),"data-test":"react-autoql-input"},"multi"===e.props.type?l.createElement("textarea",vt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):l.createElement(c,null,l.createElement("input",vt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&l.createElement(ea,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return ht(n)}();yt(to,"propTypes",{icon:p.string,type:p.string}),yt(to,"defaultProps",{icon:void 0,type:"single"});var no=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"autoCompleteTimer",void 0),yt(Tt(r),"state",ct({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length")}}return{}}(r.props.initialData))),yt(Tt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),yt(Tt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=ve(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),yt(Tt(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?be(e):e}]})),yt(Tt(r),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=be(e);return!Number.isNaN(Number(n))})),yt(Tt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),yt(Tt(r),"isValid",(function(){return!0})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),yt(Tt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct(ct(ct({},Ot(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var s={name:n[i]};a.push(s)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),yt(Tt(r),"renderReadOnlyRule",(function(){return l.createElement(At,null,l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},"".concat(Nn(r.state.input1Value))),l.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&l.createElement("span",{className:"read-only-rule-term"},Nn(r.state.input2Value)),r.props.andOrValue&&l.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),yt(Tt(r),"renderValidationError",(function(){return l.createElement("div",{className:"expression-term-validation-error"},l.createElement(ea,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),yt(Tt(r),"renderCompareBtn",(function(){return"EXISTS"===r.state.conditionSelectValue?l.createElement(er,{onClick:function(){r.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),yt(Tt(r),"renderConditionSelector",(function(){return l.createElement(Tr,{themeConfig:Ht(r.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:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}})})),yt(Tt(r),"renderRule",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},l.createElement("div",{className:"react-autoql-rule-first-input-container"},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})}}),!r.state.isFirstTermValid&&r.renderValidationError()),r.renderCompareBtn()),l.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},r.renderConditionSelector(),l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})}}),!r.state.isSecondTermValid&&r.renderValidationError()),l.createElement(ea,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return r.setState({conditionSelectValue:"EXISTS"})}}))))})),yt(Tt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=ve(),r.TERM_ID_2=ve();var o=t.initialData;return o&&1===o.length?(r.TERM_ID_1=o[0].id,r.TERM_ID_2=ve()):o&&o.length>1&&(r.TERM_ID_1=o[0].id,r.TERM_ID_2=o[1].id),r}return ht(a)}();yt(no,"propTypes",{authentication:Nt,themeConfig:Mt,ruleId:p.string,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool}),yt(no,"defaultProps",{authentication:It,themeConfig:Pt,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var ao=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=he(t[0].term_value[0].term_value):a=!0),{expression:n,expressionError:a}},ro=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"ruleRef",void 0),yt(Tt(t),"state",ct({},ao(t.props.expression))),yt(Tt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(t),"componentDidUpdate",(function(e,n){ge(e.expression,t.props.expression)||t.setState(ct({},ao(t.props.expression))),ge(n,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),yt(Tt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),yt(Tt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),yt(Tt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),yt(Tt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),yt(Tt(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})),yt(Tt(t),"renderExpressionErrorMessage",(function(){return l.createElement("div",{className:"expression-error-message"},l.createElement(ea,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported."," ",l.createElement("a",{onClick:t.resetConditions},"Reset Conditions"))})),yt(Tt(t),"renderReadOnlyRule",(function(){return l.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():l.createElement(no,{themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",ve()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),yt(Tt(t),"renderRule",(function(){return l.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},l.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():l.createElement(no,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",ve()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return ht(a)}();yt(ro,"propTypes",{authentication:Nt,themeConfig:Mt,expression:p.oneOfType([p.shape({}),p.array]),readOnly:p.bool,onChange:p.func}),yt(ro,"defaultProps",{authentication:It,themeConfig:Pt,expression:void 0,readOnly:!1,onChange:function(){}}),n.extend(a);var oo=function(t){Ct(r,l.Component);var a=xt(r);function r(){var t;ft(this,r);for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return yt(Tt(t=a.call.apply(a,[this].concat(i))),"COMPONENT_KEY",ve()),yt(Tt(t),"supportedDisplayTypes",[]),yt(Tt(t),"state",{ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),yt(Tt(t),"componentDidUpdate",(function(e){if(!e.activeNotificationData&&t.props.activeNotificationData){var n={data:t.props.activeNotificationData};t.supportedDisplayTypes=bn({response:n});var a=t.props.autoChartAggregations&&t.supportedDisplayTypes.includes("column")?"column":Tn(n,t.props.autoChartAggregations);t.setState({displayType:a})}})),yt(Tt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),yt(Tt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),Fr(ct({dataAlertId:n.data_alert_id},Ot(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),yt(Tt(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)})),yt(Tt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),zr(ct(ct({},Ot(t.props.authentication)),{},{notificationId:n.id})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),Hr(ct(ct({},Ot(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"changeRuleStatus",(function(e,n){Ur(ct({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Ot(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"formatTimestamp",(function(e){var t=n.unix(e).format("h:mma"),a=n.unix(e).format("MM-DD-YY"),r=n().format("MM-DD-YY"),o=n().subtract(1,"d").format("MM-DD-YY");return a===r?"Today at ".concat(t):a===o?"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)})),yt(Tt(t),"renderAlertColorStrip",(function(){return l.createElement("div",{className:"react-autoql-notification-alert-strip"})})),yt(Tt(t),"renderNotificationHeader",(function(e){return l.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},l.createElement("div",{className:"react-autoql-notification-display-name-container"},l.createElement("div",{className:"react-autoql-notification-display-name"},e.title),l.createElement("div",{className:"react-autoql-notification-description"},e.message),l.createElement("div",{className:"react-autoql-notification-timestamp"},l.createElement(ea,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?l.createElement("div",{className:"react-autoql-notification-dismiss-btn"},l.createElement(ea,{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),fe.hide()}})):l.createElement("div",{className:"react-autoql-notification-dismiss-btn"},l.createElement(ea,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),fe.hide()}})))})),yt(Tt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?l.createElement(er,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},l.createElement(ea,{type:"notification-off"})," Turn Data Alert Off"):l.createElement(er,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},l.createElement(ea,{type:"notification"})," Turn Data Alert On"):l.createElement("div",null)})),yt(Tt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?Ce(t.state.ruleDetails)?l.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):l.createElement(er,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},l.createElement(ea,{type:"edit"})," Edit Data Alert"):l.createElement("div",null)})),yt(Tt(t),"renderNotificationFooter",(function(e){return l.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),yt(Tt(t),"renderNotificationContent",(function(n){var a,r=n.data_return_query,o=Nn(r);return a=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},l.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},l.createElement("div",{className:"react-autoql-notification-details-container"},l.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},l.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?l.createElement(c,null,l.createElement("div",{className:"react-autoql-notification-query-title"},o),l.createElement(wr,{authentication:Ot(t.props.authentication),ref:function(e){return t.OUTPUT_REF=e},queryResponse:a,autoQLConfig:{enableDrilldowns:!1},themeConfig:Ht(t.props.themeConfig),displayType:t.state.displayType,autoChartAggregations:t.props.autoChartAggregations,style:{flex:"1"}})):l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null))),e(t.supportedDisplayTypes,"length")>1&&l.createElement("div",{className:"react-autoql-notification-viz-switcher"},l.createElement(Ar,{themeConfig:Ht(t.props.themeConfig),supportedDisplayTypes:t.supportedDisplayTypes,displayType:t.state.displayType,onDisplayTypeChange:function(e){return t.setState({displayType:e})},vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&l.createElement("div",{className:"react-autoql-notification-details"},l.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),l.createElement(ro,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),yt(Tt(t),"render",(function(){var e=t.props.notification;return l.createElement(At,null,l.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 ht(r)}();yt(oo,"propTypes",{authentication:Nt,themeConfig:Mt,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,onErrorCallback:p.func,autoChartAggregations:p.bool}),yt(oo,"defaultProps",{authentication:It,themeConfig:Pt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onErrorCallback:function(){}});var io=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{activeStep:t.props.initialActiveStep||0}),yt(Tt(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")),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"prevStep",(function(){t.state.activeStep>=1&&t.onStepTitleClick(t.state.activeStep-1)})),yt(Tt(t),"nextStep",(function(){var e=Number.isNaN(t.state.activeStep)?0:t.state.activeStep+1;t.onStepTitleClick(e)})),yt(Tt(t),"setStep",(function(e){t.setState({activeStep:e})})),yt(Tt(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}})),yt(Tt(t),"onStepTitleClick",(function(e,n){try{n&&n.onClick&&n.onClick(),t.autoHideTimeout&&clearTimeout(t.autoHideTimeout);var a=e,r=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(t.state.activeStep));if(r&&(r.style.height="".concat(t.getHeightOfStepContent(t.state.activeStep),"px"),setTimeout((function(){r.style.height="10px"}),0)),e!==t.state.activeStep){var o=document.querySelector("#react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(e));o&&(o.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)}})),yt(Tt(t),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),yt(Tt(t),"render",(function(){return t.props.steps&&t.props.steps.length?l.createElement(At,null,l.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 l.createElement("div",{key:"react-autoql-steps-".concat(t.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},l.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)},l.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return t.onStepTitleClick(n,e)}},l.createElement("div",{className:"react-autoql-step-title"},e.title)),l.createElement("div",{id:"react-autoql-step-content-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},l.createElement("div",{className:"react-autoql-step-subtitle"},e.subtitle||null),l.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},e.content)),l.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),t}return ht(a)}();yt(io,"propTypes",{themeConfig:Mt,steps:p.arrayOf(p.shape({})),initialActiveStep:p.number,collapsible:p.bool}),yt(io,"defaultProps",{themeConfig:Pt,steps:void 0,initialActiveStep:void 0,collapsible:!0});var so=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"renderButtonType",(function(){return l.createElement(At,null,l.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,r=t.props.value===e;return t.props.multiSelect&&(r=t.props.value.includes(e)),l.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(r?" 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},l.createElement("div",null,e))}))))})),yt(Tt(t),"renderOriginalType",(function(){return l.createElement(At,null,l.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)),l.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},l.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:a}),l.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),yt(Tt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return ht(a)}();yt(so,"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}),yt(so,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var lo=["onChange","options","selectedOption","className"],co=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),yt(Tt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),yt(Tt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=St(t,lo);return l.createElement(At,null,l.createElement(Te,vt({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 ht(n)}();yt(co,"propTypes",{onChange:p.func,options:p.arrayOf(p.shape({})),selectedOption:p.shape({})}),yt(co,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var uo=Se.tz.guess(),po=Se.tz.names().map((function(e){return{value:e,label:e}})),mo=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),yt(Tt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||uo;return po.find((function(e){return e.label===t}))})),yt(Tt(e),"render",(function(){var t=e.getSelectedOption();return l.createElement(co,{className:"react-autoql-timezone-select",options:po,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return ht(n)}();yt(mo,"propTypes",{onChange:p.func,defaultSelection:p.string}),yt(mo,"defaultProps",{onChange:function(){},defaultSelection:void 0});var fo=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}},go=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{frequencySelectValue:fo(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),yt(Tt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),yt(Tt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),yt(Tt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),yt(Tt(t),"getData",(function(){var e=t.state,n=e.frequencySelectValue,a="PERIODIC",r=null;return"Every time this happens"===n?a="CONTINUOUS":"Only once per day"===n?r="DAY":"Only once per week"===n?r="WEEK":"Only once per month"===n&&(r="MONTH"),{notificationType:a,resetPeriod:r,timezone:e.timezone}})),yt(Tt(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})),yt(Tt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),yt(Tt(t),"renderTimezoneComponent",(function(){return l.createElement("div",null,l.createElement("span",null,"Time zone: "),l.createElement(mo,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},l.createElement("div",{className:"frequency-settings-container"},l.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),l.createElement(so,{themeConfig:Ht(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})}}))),l.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return ht(a)}();yt(go,"propTypes",{themeConfig:Mt,dataAlert:p.shape({}),onChange:p.func,onCompletedChange:p.func,onErrorCallback:p.func}),yt(go,"defaultProps",{themeConfig:Pt,dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var ho=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"NEW_NOTIFICATION_MODAL_ID",ve()),yt(Tt(t),"state",{titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1}),yt(Tt(t),"componentDidMount",(function(){t.initializeFields()})),yt(Tt(t),"componentDidUpdate",(function(e,n){if(!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]})})),yt(Tt(t),"resetFields",(function(){t.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),yt(Tt(t),"initializeFields",(function(){if(Ce(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")})}})),yt(Tt(t),"createExpressionJSONFromQuery",(function(e){return[{condition:"TERMINATOR",id:ve(),term_type:"group",term_value:[{id:ve(),term_type:"group",condition:"TERMINATOR",term_value:[{id:ve(),condition:"EXISTS",term_type:"query",term_value:e}]}]}]})),yt(Tt(t),"getDataAlertData",(function(){try{var n,a=t.state,r=a.titleInput,o=a.messageInput,i=he(t.state.expressionJSON);t.expressionRef&&(i=t.expressionRef.getJSON(),n=t.expressionRef.getFirstQuery());var s={};return t.scheduleBuilderRef&&(s=t.scheduleBuilderRef.getData()),{id:e(t.props.currentDataAlert,"id"),title:r,data_return_query:n,message:o,expression:i,notification_type:s.notificationType,reset_period:s.resetPeriod,time_zone:s.timezone}}catch(e){console.error(e)}})),yt(Tt(t),"onExpressionChange",(function(e,n,a){t.setState({isExpressionSectionComplete:e,isFirstSectionComplete:t.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:a})})),yt(Tt(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})),yt(Tt(t),"onDataAlertSave",(function(){t.setState({isSavingDataAlert:!0});var e=ct(ct({},t.getDataAlertData()),{},{project_id:t.props.selectedDemoProjectId}),n=ct({dataAlert:e},Ot(t.props.authentication));t.props.isManagement?(t.props.onManagementCreateDataAlert(e),t.setState({isSavingDataAlert:!1})):e.id?Wr(ct({},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})})):Yr(ct({},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})}))})),yt(Tt(t),"validateFn",t.props.onValidate||Xr),yt(Tt(t),"validateExpression",(function(){try{if(t.setState({isValidating:!0,isExpressionValidated:!1}),t.expressionRef){var n=t.expressionRef.getJSON();t.validateFn(ct(ct({},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})}})),yt(Tt(t),"renderValidateBtn",(function(){var n;return t.expressionRef&&t.expressionRef.state.expressionError?null:l.createElement(c,null,t.state.isExpressionValidated&&t.state.isExpressionValid&&l.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},l.createElement(ea,{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&&l.createElement("div",{className:"expression-invalid-message-container"},l.createElement("span",{className:"expression-invalid-message"},l.createElement(ea,{type:"warning-triangle"}))," ",l.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},t.state.expressionError)),l.createElement(er,(yt(n={type:"default",onClick:t.validateExpression,loading:t.state.isValidating},"type","primary"),yt(n,"disabled",!t.state.titleInput||!e(t.expressionRef,"state.expression[0].term_value")),yt(n,"style",{position:"absolute",right:0}),n),"Check Alert & continue"))})),yt(Tt(t),"setStep",(function(e){t.stepsRef&&t.stepsRef.setStep(e)})),yt(Tt(t),"renderNextBtn",(function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=arguments.length>3?arguments[3]:void 0;return l.createElement(er,{className:e,onClick:function(){a(),t.stepsRef&&t.stepsRef.nextStep()},disabled:n,type:"primary"},r||"Continue")})),yt(Tt(t),"renderBackBtn",(function(e){return l.createElement(er,{className:e,onClick:function(){t.stepsRef&&t.stepsRef.prevStep()}},"Back")})),yt(Tt(t),"renderSetUpDataAlertStep",(function(){return l.createElement("div",null,l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement("p",null,"Name your Data Alert:"),l.createElement(to,{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})}})),l.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(ea,{"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"}))),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement("p",null,"Notify me when:"),l.createElement(ro,{authentication:Ot(t.props.authentication),themeConfig:Ht(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)})),l.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(ea,{"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"}))),l.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))))})),yt(Tt(t),"renderFrequencyStep",(function(){return l.createElement("div",null,l.createElement(go,{themeConfig:Ht(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}),l.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})}))))})),yt(Tt(t),"renderAlertPreferencesStep",(function(){return l.createElement("div",null,l.createElement("p",null,"Optional:"),l.createElement(to,{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})}}),l.createElement("div",{className:"step-btn-container"},t.renderBackBtn("second-step-back-btn")))})),yt(Tt(t),"onDataAlertDelete",(function(){var n=e(t.props.currentDataAlert,"id");n&&(t.setState({isDeletingDataAlert:!0}),Jr(n,Ot(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})})))})),yt(Tt(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})),yt(Tt(t),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),yt(Tt(t),"render",(function(){var e=t.getModalContent();return l.createElement(At,null,l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-data-alert-modal-tooltip",effect:"solid",delayShow:500,html:!0}),l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),title:t.props.title,titleIcon:Ce(t.props.currentDataAlert)?l.createElement("span",null):l.createElement(ea,{type:"edit"}),ref:function(e){return t.modalRef=e},isVisible:t.props.isVisible,onClose:t.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement("div",null,t.props.currentDataAlert&&t.props.allowDelete&&l.createElement(er,{type:"danger",onClick:function(){t.setState({isConfirmDeleteModalVisible:!0})},loading:t.state.isDeletingDataAlert},"Delete Data Alert")),l.createElement("div",null,l.createElement(er,{onClick:function(){t.modalRef&&t.modalRef.onClose()}},"Cancel"),l.createElement(er,{type:"primary",loading:t.state.isSavingDataAlert,onClick:t.onDataAlertSave,disabled:t.isSaveButtonDisabled(e)},"Finish & Save")))},t.props.isVisible&&l.createElement("div",{className:"notification-modal-content"},l.createElement(io,{themeConfig:Ht(t.props.themeConfig),ref:function(e){return t.stepsRef=e},steps:e}))),l.createElement(Nr,{isVisible:t.state.isConfirmDeleteModalVisible,onConfirm:t.onDataAlertDelete,confirmLoading:t.state.isDeletingDataAlert,onClose:function(){t.setState({isConfirmDeleteModalVisible:!1})},confirmText:"Delete",width:"450px"},l.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),l.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),t}return ht(a)}();yt(ho,"propTypes",{authentication:Nt,onErrorCallback:p.func,onSave:p.func,initialQuery:p.string,currentDataAlert:p.shape({}),isVisible:p.bool,allowDelete:p.bool,onClose:p.func,themeConfig:Mt,isManagement:p.bool,onManagementCreateDataAlert:p.func,onManagementDeleteDataAlert:p.func,title:p.string,titleIcon:p.oneOfType([p.element,p.instanceOf(ea)]),enableQueryValidation:p.bool,onValidate:p.func}),yt(ho,"defaultProps",{authentication:It,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},themeConfig:Pt,isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var yo="data:image/png;base64,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",vo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"MODAL_COMPONENT_KEY",ve()),yt(Tt(t),"NOTIFICATION_LIST_KEY",ve()),yt(Tt(t),"NOTIFICATION_FETCH_LIMIT",10),yt(Tt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0}),yt(Tt(t),"componentDidMount",(function(){t.getNotifications(),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"getNotifications",(function(n){Lr(ct(ct({},Ot(t.props.authentication)),{},{offset:t.state.nextOffset,limit:n||t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var a=he(t.state.notificationList),r=t.state.nextOffset,o=t.state.pagination;e(n,"items.length")&&(a=[].concat(wt(a),wt(n.items)),r=t.state.nextOffset+t.NOTIFICATION_FETCH_LIMIT,o=n.pagination),t.setState({notificationList:a,pagination:o,nextOffset:r,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),yt(Tt(t),"refreshNotifications",(function(){Lr(ct(ct({},Ot(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var n=t.detectNewNotifications(e.items);if(n.length)if(10===n.length)t.setState({notificationList:e.items,pagination:e.pagination});else{var a=[].concat(wt(n),wt(t.state.notificationList));t.setState({notificationList:a,pagination:ct({},e.pagination),nextOffset:a.length-1})}}))})),yt(Tt(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})),yt(Tt(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),ct(ct({},t),{},{expanded:!t.expanded})):ct(ct({},t),{},{expanded:!1})}));t.setState({notificationList:a,activeNotificationId:n})})),yt(Tt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return ct(ct({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Br(ct({},Ot(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),yt(Tt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?ct(ct({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n})})),yt(Tt(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})})),yt(Tt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),yt(Tt(t),"renderDismissAllButton",(function(){return l.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},l.createElement("span",{onClick:t.onDismissAllClick},l.createElement(ea,{type:"notification-off",style:{verticalAlign:"middle"}})," ","Dismiss All"))})),yt(Tt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),yt(Tt(t),"renderEditDataAlertModal",(function(){var e;return l.createElement(ho,(yt(e={key:t.MODAL_COMPONENT_KEY,authentication:Ot(t.props.authentication),themeConfig:Ht(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},"themeConfig",Ht(t.props.themeConfig)),yt(e,"title",t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert"),yt(e,"titleIcon",t.state.activeDataAlert?l.createElement(ea,{type:"edit"}):l.createElement("span",null)),e))})),yt(Tt(t),"render",(function(){return t.state.isFetchingFirstNotifications?l.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?l.createElement("div",{className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",l.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},l.createElement(er,{onClick:t.getInitialNotifications},"Try Again"))):l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-list-container","data-test":"notification-list"},l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?l.createElement(c,null,t.renderDismissAllButton(),l.createElement(ye,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,useWindow:!1},t.state.notificationList.map((function(e,n){return l.createElement(oo,{key:"notification-item-".concat(n),authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),notification:e,onClick:t.onItemClick,onDismissCallback:t.onDismissClick,onDeleteCallback:t.onDeleteClick,onDeleteSuccessCallback:function(){t.getNotifications(1)},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()}})})))):l.createElement("div",{className:"empty-notifications-message"},l.createElement("img",{className:"empty-notifications-img",src:yo}),l.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),l.createElement("div",null,"Stay tuned!"),l.createElement("br",null),t.props.showCreateAlertBtn&&l.createElement(er,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal()))})),t}return ht(a)}();yt(vo,"propTypes",{authentication:Nt,themeConfig:Mt,onCollapseCallback:p.func,onExpandCallback:p.func,activeNotificationData:p.shape({}),showNotificationDetails:p.bool,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,showCreateAlertBtn:p.bool}),yt(vo,"defaultProps",{authentication:It,themeConfig:Pt,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){}});var Co=function(e){var t=n(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},bo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_KEY",ve()),yt(Tt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts(),An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e,n){ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig)),ge(Ot(t.props.authentication),Ot(e.authentication))||t.getDataAlerts(),ge(t.state.projectAlertsList,n.projectAlertsList)&&ge(t.state.customAlertsList,n.customAlertsList)||t.getDataAlerts()})),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1})),yt(Tt(t),"getDataAlerts",(function(n){Or(ct(ct({},Ot(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)}))})),yt(Tt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),yt(Tt(t),"onAddClick",(function(){t.setState({isEditModalVisible:!0,activeDataAlert:void 0})})),yt(Tt(t),"onDataAlertSave",(function(n){var a=wt(t.state.customAlertsList);t.state.activeDataAlert?a=t.state.customAlertsList.map((function(a){return a.id===t.state.activeDataAlert.id?e(n,"data.data",t.state.activeDataAlert):a})):e(n,"data.data")&&a.unshift(e(n,"data.data")),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1,customAlertsList:a})})),yt(Tt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),yt(Tt(t),"onEnableSwitchChange",(function(e,n){var a=e.target.checked?"ACTIVE":"INACTIVE",r="CUSTOM"===n.type?"customAlertsList":"projectAlertsList",o=he(t.state[r]),i=t.state[r].map((function(e){return n.id===e.id?ct(ct({},e),{},{status:a}):e}));t.setState(yt({},"".concat(r),i)),Ur(ct({dataAlertId:n.id,type:n.type,status:a},Ot(t.props.authentication))).catch((function(e){t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.setState(yt({},"".concat(r),o))}))})),yt(Tt(t),"renderNotificationEditModal",(function(){return l.createElement(ho,{ref:function(e){return t.editModalRef=e},themeConfig:t.props.themeConfig,key:t.COMPONENT_KEY,authentication:Ot(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?l.createElement(ea,{type:"edit"}):l.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),yt(Tt(t),"renderNotificationGroupTitle",(function(e,n,a){return l.createElement("div",{className:"react-autoql-notification-title-container"},l.createElement("div",{style:{paddingLeft:"10px"}},l.createElement("div",{style:{fontSize:"17px"}},e),l.createElement("div",{style:{fontSize:"11px",opacity:.6}},n)),a&&t.props.showCreateAlertBtn&&l.createElement("div",{className:"react-autoql-notification-add-btn",onClick:t.onAddClick,"data-tip":"Create Data Alert","data-for":"react-autoql-notification-settings-tooltip"},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon"})))})),yt(Tt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),yt(Tt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),yt(Tt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),yt(Tt(t),"renderNotificationlist",(function(n,a){return"project"!==n||e(a,"length")?l.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"),l.createElement("div",{className:"react-autoql-notification-settings-container"},a&&a.map((function(e,n){return l.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},l.createElement("div",{className:"react-autoql-notification-setting-item-header"},l.createElement("div",{className:"react-autoql-notification-setting-display-name"},l.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},l.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?l.createElement(ea,{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}):l.createElement(ea,{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)),l.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&l.createElement("span",null," - ",e.message))),l.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&l.createElement(ea,{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&&l.createElement(ea,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat(Co(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?l.createElement(l.Fragment,null,"CUSTOM"===e.type&&l.createElement(er,{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()}},l.createElement("span",{className:"react-autoql-re-initialize-btn-text"},l.createElement(ea,{type:"warning-triangle"})," Resend")),l.createElement(Ya,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):l.createElement(Ya,{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),fe.hide()}}))))})))):null})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},l.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),l.createElement("br",null),t.props.showCreateAlertBtn&&l.createElement(er,{type:"primary",onClick:t.onAddClick,style:{marginTop:"10px"}},"Create Data Alert"))})),yt(Tt(t),"render",(function(){if(!t.state.customAlertsList)return l.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},l.createElement(Ea,null));var n=e(t.state,"projectAlertsList",[]),a=e(t.state,"customAlertsList",[]);return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",a),t.renderNotificationEditModal(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return ht(a)}();yt(bo,"propTypes",{authentication:Nt,themeConfig:Mt,onErrorCallback:p.func,showCreateAlertBtn:p.bool,onSuccessAlert:p.func}),yt(bo,"defaultProps",{authentication:It,themeConfig:Pt,showCreateAlertBtn:!1,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var Eo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"autoCompleteTimer",void 0),yt(Tt(r),"state",ct({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length")}}return{}}(r.props.initialData))),yt(Tt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),yt(Tt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),yt(Tt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=ve(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),yt(Tt(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?Number(e):e}]})),yt(Tt(r),"isNumerical",(function(e){return!Number.isNaN(Number(e))})),yt(Tt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),yt(Tt(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),yt(Tt(r),"validateFirstTerm",(function(){r.props.enableQueryValidation?r.state.input1Value&&!r.state.isValidatingFirstTerm&&r.state.lastCheckedFirstTermValue!==r.state.input1Value&&(r.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:r.state.input1Value,isValidatingFirstTerm:!0}),Ir(ct({query:r.state.input1Value},Ot(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),yt(Tt(r),"validateSecondTerm",(function(){r.props.enableQueryValidation?r.state.input2Value&&Number.isNaN(Number(r.state.input2Value))?r.state.isValidatingSecondTerm||r.state.lastCheckedSecondTermValue===r.state.input2Value||(r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value,isValidatingSecondTerm:!0}),Ir(ct({query:r.state.input2Value},Ot(r.props.authentication))).then((function(){r.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){r.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value}):r.setState({isSecondTermValid:!0})})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),yt(Tt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct(ct(ct({},Ot(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var s={name:n[i]};a.push(s)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),yt(Tt(r),"renderReadOnlyRule",(function(){return l.createElement(At,null,l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},"".concat(Nn(r.state.input1Value))),l.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&l.createElement("span",{className:"read-only-rule-term"},Nn(r.state.input2Value)),r.props.andOrValue&&l.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),yt(Tt(r),"renderValidationError",(function(){return l.createElement("div",{className:"expression-term-validation-error"},l.createElement(ea,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),yt(Tt(r),"renderRule",(function(){return l.createElement(At,null,l.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})},onBlur:r.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateFirstTerm()}}),!r.state.isFirstTermValid&&r.renderValidationError()),l.createElement(Tr,{themeConfig:Ht(r.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:l.createElement("span",null,"∃"),tooltip:"Exists"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}}),l.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},l.createElement("div",{className:"react-autoql-rule-input"},l.createElement(to,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})},onBlur:r.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateSecondTerm()}}),!r.state.isSecondTermValid&&r.renderValidationError())),l.createElement(ea,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){r.props.onDelete(r.props.ruleId)}})))})),yt(Tt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=ve(),r.TERM_ID_2=ve();var o=t.initialData;return o&&1===o.length?(r.TERM_ID_1=o[0].id,r.TERM_ID_2=ve()):o&&o.length>1&&(r.TERM_ID_1=o[0].id,r.TERM_ID_2=o[1].id),r}return ht(a)}();yt(Eo,"propTypes",{authentication:Nt,themeConfig:Mt,ruleId:p.string,onAdd:p.func,onDelete:p.func,onUpdate:p.func,initialData:p.arrayOf(p.shape({})),readOnly:p.bool,enableQueryValidation:p.bool}),yt(Eo,"defaultProps",{authentication:It,themeConfig:Pt,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var So=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,a=e.id||ve();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:ve(),type:"rule",isComplete:!1}),t={rules:n}),t},To=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"ID",ve()),yt(Tt(e),"ruleRefs",[]),yt(Tt(e),"state",ct({rules:[],andOrSelectValue:"ALL"},So(e.props.initialData))),yt(Tt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),yt(Tt(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 r=e.ruleRefs[n],o=[];return r&&(o=r.getJSON()),{id:t.id||ve(),term_type:"group",condition:a,term_value:o}}))})),yt(Tt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isComplete()}))})),yt(Tt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isValid()}))})),yt(Tt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),yt(Tt(e),"onRuleUpdate",(function(t,n,a){var r=e.state.rules.map((function(e){return e.id===t?ct(ct({},e),{},{isComplete:n,termValue:a}):e}));e.setState({rules:r}),e.props.onUpdate(e.props.groupId,e.isComplete())})),yt(Tt(e),"addRule",(function(){var t=ve(),n=[].concat(wt(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),yt(Tt(e),"addGroup",(function(){var t=ve(),n=[].concat(wt(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),yt(Tt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),yt(Tt(e),"renderAllAnySelect",(function(){return l.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",l.createElement(so,{themeConfig:Ht(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:")})),yt(Tt(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:l.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},l.createElement(ea,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),yt(Tt(e),"renderAddBtn",(function(){return e.props.readOnly?null:l.createElement("div",{className:"notification-rule-btn-container"},l.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),yt(Tt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return l.createElement(At,null,l.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&l.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&&l.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")),l.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?l.createElement(Eo,{authentication:Ot(e.props.authentication),themeConfig:Ht(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?l.createElement(n,{authentication:Ot(e.props.authentication),themeConfig:Ht(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())))})),yt(Tt(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"),l.createElement(At,null,l.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,r){return"rule"===t.type?l.createElement(Eo,{key:"rule-readonly-".concat(t.id),ref:function(t){return e.ruleRefs[r]=t},ruleId:t.id,initialData:t.termValue,andOrValue:r!==e.state.rules.length-1?a:null,enableQueryValidation:!1,readOnly:!0}):"group"===t.type?l.createElement("div",{key:"group-".concat(t.id)},l.createElement(n,{authentication:Ot(e.props.authentication),themeConfig:Ht(e.props.themeConfig),groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),r!==e.state.rules.length-1&&l.createElement("div",null,l.createElement("span",{className:"read-only-rule-term"},a))):void 0}))))})),yt(Tt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return ht(n)}();yt(To,"propTypes",{authentication:Nt,themeConfig:Mt,groupId:p.string,onDelete:p.func,onUpdate:p.func,disableAddGroupBtn:p.bool,hideTopCondition:p.bool,readOnly:p.bool,enableQueryValidation:p.bool}),yt(To,"defaultProps",{authentication:It,themeConfig:Pt,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Do=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:ve(),isComplete:!1}),n={groups:a}),n},xo=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),yt(Tt(e),"state",ct({groups:[],andOrValue:"ALL"},Do(e.props.expression))),yt(Tt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(e),"componentDidUpdate",(function(t,n){ge(t.expression,e.props.expression)||e.setState(ct({},Do(e.props.expression))),ge(n,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isComplete()}))})),yt(Tt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isValid()}))})),yt(Tt(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 r=e.groupRefs[n],o=[];return r&&(o=r.getJSON()),{id:t.id||ve(),term_type:"group",condition:a,term_value:o}}))})),yt(Tt(e),"addGroup",(function(t){var n=t.initialData,a=t.isComplete,r=t.id||ve(),o=[].concat(wt(e.state.groups),[{initialData:n,isComplete:a,id:r}]);e.setState({groups:o})})),yt(Tt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),yt(Tt(e),"getAndOrValue",(function(){return e.state.andOrValue})),yt(Tt(e),"onGroupUpdate",(function(t,n){var a=e.state.groups.map((function(e){return e.id===t?ct(ct({},e),{},{isComplete:n}):e}));e.setState({groups:a}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),yt(Tt(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"),l.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(a,r){return l.createElement("div",{key:"expression-group-readonly-".concat(a.id,"-").concat(r)},l.createElement(To,{themeConfig:Ht(e.props.themeConfig),ref:function(t){return e.groupRefs[r]=t},groupId:a.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===r,topCondition:e.state.andOrValue,onlyGroup:t,initialData:a.initialData,readOnly:e.props.readOnly,enableQueryValidation:!1}),r!==e.state.groups.length-1&&l.createElement("div",{style:{textAlign:"center",margin:"2px"}},l.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),yt(Tt(e),"renderRules",(function(){var t=e.state.groups.length<=1;return l.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&l.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",l.createElement(so,{themeConfig:Ht(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:"),l.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,a){return l.createElement(To,{authentication:Ot(e.props.authentication),themeConfig:Ht(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&&l.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},l.createElement(ea,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return ht(n)}();yt(xo,"propTypes",{authentication:Nt,themeConfig:Mt,expression:p.arrayOf(p.shape({})),readOnly:p.bool,onChange:p.func}),yt(xo,"defaultProps",{authentication:It,themeConfig:Pt,expression:void 0,readOnly:!1,onChange:function(){}});var wo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",yt({themeConfig:Pt,channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),yt(Tt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),yt(Tt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),Pr(ct(ct({},Ot(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})}))})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{className:"slack-modal-empty-list-message"},l.createElement("div",null,"You don't have any ",l.createElement(ea,{type:"slack"})," Slack channels connected yet."),l.createElement(er,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},l.createElement(ea,{type:"plus"})," Connect a Channel"))})),yt(Tt(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)}})),yt(Tt(t),"getVizType",(function(){return mn(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),yt(Tt(t),"sendDataToSlack",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Kr(ct(ct({},Ot(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())})),yt(Tt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Zr(ct(ct({},Ot(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=he(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),yt(Tt(t),"renderRemoveChannelBtn",(function(){return l.createElement(Ee,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:l.createElement("div",{className:"remove-channel-popover"},l.createElement("div",{className:"react-autoql-confirm-text"},l.createElement(ea,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),l.createElement(er,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},l.createElement(ea,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),yt(Tt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,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:l.createElement("span",null,l.createElement(ea,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return l.createElement("div",{className:"slack-channel-list-container"},l.createElement("div",{className:"slack-channel-list"},l.createElement("div",null,"AutoQL will post an email to the selected Slack channel with the"," ",n," attached."),l.createElement("br",null),l.createElement("div",{className:"select-channel-titles"},"Post to:"," ",l.createElement(Tr,{themeConfig:Ht(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())))})),yt(Tt(t),"renderFetchErrorMessage",(function(){return l.createElement("div",{className:"slack-modal-error-container"},l.createElement("div",null,In.GENERAL_HTML),l.createElement(er,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),yt(Tt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),jr(ct(ct({},Ot(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(wt(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})}))})),yt(Tt(t),"renderConnectChannelPage",(function(){return l.createElement("div",{className:"connect-channel-form-container"},l.createElement("div",{className:"connect-channel-form"},l.createElement("div",{className:"connect-channel-title"},"Connect a Slack Channel"),l.createElement(ea,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),l.createElement("div",null,"Channel Name"),l.createElement(to,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),l.createElement("div",null,"Channel Email Address"," ",l.createElement(Ee,{isOpen:t.state.isSlackEmailInstructionVisible,onClickOutside:function(){return t.setState({isSlackEmailInstructionVisible:!1})},position:"top",content:l.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},l.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isSlackEmailInstructionVisible:!0})}},l.createElement(ea,{type:"question"})," How do I find this?"))),l.createElement(to,{placeholder:"e.g. 1234@slack.com",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),l.createElement("div",null,"Your Name"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Slack)")),l.createElement(to,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),l.createElement("div",null,"Your Email"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Slack)")),l.createElement(to,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),l.createElement("div",{className:"connect-channel-btn"},l.createElement(er,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),yt(Tt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),yt(Tt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?l.createElement("div",null,l.createElement(er,{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},l.createElement(ea,{type:"send"})," Send to Slack")):null})),t}return ht(a,[{key:"render",value:function(){return l.createElement(Rr,{themeConfig:Ht(this.props.themeConfig),isVisible:this.props.isVisible,onClose:this.props.onClose,title:l.createElement("span",null,"Send to ",l.createElement(ea,{type:"slack"})," Slack"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();yt(wo,"propTypes",{themeConfig:Mt,authentication:Nt,isVisible:p.bool}),yt(wo,"defaultProps",{authentication:It,isVisible:!1});var ko=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",yt({channels:void 0,activePage:void 0,selectedChannel:void 0,isConnectingChannel:void 0,isFetchingChannels:void 0,isSendingData:void 0},"selectedChannel",0)),yt(Tt(t),"componentDidUpdate",(function(e){t.props.isVisible&&!e.isVisible&&(t.fetchChannels(),t.getAttachmentToSend())})),yt(Tt(t),"fetchChannels",(function(){t.setState({isFetchingChannels:!0}),Pr(ct(ct({},Ot(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})}))})),yt(Tt(t),"renderEmptyListMessage",(function(){return l.createElement("div",{className:"slack-modal-empty-list-message"},l.createElement("div",null,"You don't have any ",l.createElement(ea,{type:"teams"})," Teams channels connected yet."),l.createElement(er,{type:"primary",onClick:function(){t.setState({activePage:"connect-channel"})}},l.createElement(ea,{type:"plus"})," Connect a Channel"))})),yt(Tt(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)}})),yt(Tt(t),"getVizType",(function(){return mn(e(t.props.responseRef,"state.displayType"))?"chart":"table"})),yt(Tt(t),"sendDataToTeams",(function(){t.setState({isSendingData:!0});var e=t.state.channels[t.state.selectedChannel];t.props.responseRef&&t.attachment?Kr(ct(ct({},Ot(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())})),yt(Tt(t),"removeSelectedChannel",(function(){var e=t.state.channels[t.state.selectedChannel];Zr(ct(ct({},Ot(t.props.authentication)),{},{channelId:e.id})).then((function(){var e=he(t.state.channels);e.splice(t.state.selectedChannel,1),t.setState({channels:e,isRemoveChannelConfirmOpen:!1})})).catch((function(){t.props.onErrorCallback()}))})),yt(Tt(t),"renderRemoveChannelBtn",(function(){return l.createElement(Ee,{isOpen:t.state.isRemoveChannelConfirmOpen,onClickOutside:function(){return t.setState({isRemoveChannelConfirmOpen:!1})},position:"bottom",content:l.createElement("div",{className:"remove-channel-popover"},l.createElement("div",{className:"react-autoql-confirm-text"},l.createElement(ea,{className:"react-autoql-confirm-icon",type:"warning"}),"Are you sure you want to disconnect this channel?"),l.createElement(er,{type:"default",size:"small",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return t.removeSelectedChannel()}},"Remove"))},l.createElement(ea,{className:"remove-channel-btn","data-tip":"Disconnect Channel","data-for":"connect-to-slack-tooltips",type:"trash",onClick:function(){return t.setState({isRemoveChannelConfirmOpen:!0})}}))})),yt(Tt(t),"renderChannelList",(function(){if(t.state.isFetchingChannels)return l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,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:l.createElement("span",null,l.createElement(ea,{type:"plus"})," Connect a New Channel")});var n="chart"===t.getVizType()?"chart image (.png)":"table (.csv)";return l.createElement("div",{className:"slack-channel-list-container"},l.createElement("div",{className:"slack-channel-list"},l.createElement("div",null,"AutoQL will post an email to the selected Teams channel with the"," ",n," attached."),l.createElement("br",null),l.createElement("div",{className:"select-channel-titles"},"Post to:"," ",l.createElement(Tr,{themeConfig:Ht(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())))})),yt(Tt(t),"renderFetchErrorMessage",(function(){return l.createElement("div",{className:"slack-modal-error-container"},l.createElement("div",null,In.GENERAL_HTML),l.createElement(er,{onClick:t.fetchChannels,type:"default",loading:t.state.isFetchingChannels},"Try again"))})),yt(Tt(t),"connectChannel",(function(){t.setState({isConnectingChannel:!0}),jr(ct(ct({},Ot(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(wt(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})}))})),yt(Tt(t),"renderConnectChannelPage",(function(){return l.createElement("div",{className:"connect-channel-form-container"},l.createElement("div",{className:"connect-channel-form"},l.createElement("div",{className:"connect-channel-title"},"Connect a Teams Channel"),l.createElement(ea,{"data-tip":"Back to List",className:"connect-channel-back-btn",onClick:function(){t.setState({activePage:"channel-list"})},type:"back"}),l.createElement("div",null,"Channel Name"),l.createElement(to,{placeholder:"e.g. general",value:t.state.channelName,onChange:function(e){t.setState({channelName:e.target.value})}}),l.createElement("div",null,"Channel Email Address"," ",l.createElement(Ee,{isOpen:t.state.isTeamsEmailInstructionVisible,onClickOutside:function(){return t.setState({isTeamsEmailInstructionVisible:!1})},position:"top",content:l.createElement("div",{className:"slack-email-instructions-popover"},"Instructions go here.")},l.createElement("span",{className:"slack-email-instructions-button",onClick:function(){t.setState({isTeamsEmailInstructionVisible:!0})}},l.createElement(ea,{type:"question"})," How do I find this?"))),l.createElement(to,{placeholder:"e.g. 1234@amer.teams.ms",value:t.state.channelEmail,onChange:function(e){t.setState({channelEmail:e.target.value})}}),l.createElement("div",null,"Your Name"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender name in Teams)")),l.createElement(to,{placeholder:"e.g. Jane Smith",value:t.state.userName,onChange:function(e){t.setState({userName:e.target.value})}}),l.createElement("div",null,"Your Email"," ",l.createElement("span",{className:"form-subtitle"},"(Displayed as sender email in Teams)")),l.createElement(to,{placeholder:"e.g. jane_smith@gmail.com",value:t.state.userEmail,onChange:function(e){t.setState({userEmail:e.target.value})}}),l.createElement("div",{className:"connect-channel-btn"},l.createElement(er,{type:"primary",onClick:t.connectChannel,loading:t.state.isConnectingChannel,disabled:!(t.state.channelName&&t.state.channelEmail&&t.state.userName&&t.state.userEmail)}," ","Connect Channel"))))})),yt(Tt(t),"renderActivePage",(function(){var e=t.state.activePage;return"fetch-error"===e?t.renderFetchErrorMessage():t.state.isFetchingChannels?l.createElement("div",{className:"loading-container-centered"},l.createElement(Ea,null)):"connect-channel"===e?t.renderConnectChannelPage():"channel-list"===e?t.renderChannelList():void 0})),yt(Tt(t),"renderFooter",(function(){return"channel-list"===t.state.activePage&&e(t.state.channels,"length")>0?l.createElement("div",null,l.createElement(er,{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},l.createElement(ea,{type:"send"})," Send to Teams")):null})),t}return ht(a,[{key:"render",value:function(){return l.createElement(Rr,{themeConfig:Ht(this.props.themeConfig),isVisible:this.props.isVisible,onClose:this.props.onClose,title:l.createElement("span",null,"Send to ",l.createElement(ea,{type:"teams"})," Teams"),enableBodyScroll:!0,width:"750px",style:{minHeight:"500px"},showFooter:!!this.renderFooter(),footer:this.renderFooter()},this.renderActivePage(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"connect-to-slack-tooltips",effect:"solid",place:"top"}))}}]),a}();yt(ko,"propTypes",{authentication:Nt,themeConfig:Mt,isVisible:p.bool}),yt(ko,"defaultProps",{authentication:It,themeConfig:Pt,isVisible:!1});var Ao,No=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"state",{isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentDidUpdate",(function(e,n){"sql"===n.activeMenu&&"sql"!==t.state.activeMenu&&t.setState({sqlCopySuccess:!1}),ge(Ht(t.props.themeConfig),Ht(e.themeConfig))||An(Ht(t.props.themeConfig))})),yt(Tt(t),"componentWillUnmount",(function(){t._isMounted=!1,clearTimeout(t.temporaryStateTimeout),clearTimeout(t.pivotTableCSVDownloadTimeout)})),yt(Tt(t),"onTableFilter",(function(n){"table"===e(t.props.responseRef,"props.displayType")&&t.setState({disableChartingOptions:e(n,"length")<2})})),yt(Tt(t),"toggleTableFilter",(function(){t.filtering=!t.filtering,t.props.onFilterClick({isFilteringTable:t.filtering})})),yt(Tt(t),"setTemporaryState",(function(e,n,a){t.setState(yt({},e,n)),t.temporaryStateTimeout=setTimeout((function(){t.setState(yt({},e,void 0))}),a)})),yt(Tt(t),"copyTableToClipboard",(function(){t.props.responseRef?(t.props.responseRef.copyTableToClipboard(),t.props.onSuccessAlert("Successfully copied table to clipboard!"),t.setTemporaryState("copiedTable",!0,1e3),fe.hide()):t.setTemporaryState("copiedTable",!1,1e3)})),yt(Tt(t),"fetchCSVAndExport",(function(){var e,n,a,r,o,i,s,l,c=null===(e=t.props.responseRef)||void 0===e||null===(n=e.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.query_id,u=null===(o=t.props.responseRef)||void 0===o||null===(i=o.queryResponse)||void 0===i||null===(s=i.data)||void 0===s||null===(l=s.data)||void 0===l?void 0:l.text,p=ve();t.props.onCSVDownloadStart({id:p,queryId:c,query:u}),ua(ct(ct({queryId:c},Ot(t.props.authentication)),{},{csvProgressCallback:function(e){return t.props.onCSVDownloadProgress({id:p,progress:e})}})).then((function(e){var n,a,r,o=window.URL.createObjectURL(new Blob([e.data])),i=document.createElement("a");i.href=o,i.setAttribute("download","export.csv"),document.body.appendChild(i),i.click();var s=parseInt(null==e||null===(n=e.headers)||void 0===n?void 0:n.export_limit),l="true"==(null==e||null===(a=e.headers)||void 0===a||null===(r=a.limit_reached)||void 0===r?void 0:r.toLowerCase());t.props.onCSVDownloadFinish({id:p,exportLimit:s,limitReached:l})})).catch((function(e){t.props.onCSVDownloadFinish({id:p,error:e}),console.error(e)}))})),yt(Tt(t),"onCSVMenuButtonClick",(function(){t.setState({activeMenu:void 0});var n="pivot_table"===e(t.props.responseRef,"props.displayType"),a=ve();n?e(t.props,"responseRef.pivotTableRef._isMounted")&&(t.props.onCSVDownloadStart({id:a}),t.pivotTableCSVDownloadTimeout=setTimeout((function(){t.props.responseRef.pivotTableRef.saveAsCSV().then((function(){t.props.onCSVDownloadProgress({id:a,progress:100}),t.props.onCSVDownloadFinish({id:a})}))}),2e3)):t.fetchCSVAndExport()})),yt(Tt(t),"saveChartAsPNG",(function(){t.props.responseRef&&t.props.responseRef.saveChartAsPNG()})),yt(Tt(t),"deleteMessage",(function(){fe.hide(),t.props.deleteMessageCallback()})),yt(Tt(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}),fe.hide()})),yt(Tt(t),"showHideColumnsModal",(function(){t.setState({isHideColumnsModalVisible:!0})})),yt(Tt(t),"onColumnVisibilitySave",(function(e){var n=t.props.authentication,a=e.map((function(e){var t=ct(ct({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));t.setState({isSettingColumnVisibility:!0}),ha(ct(ct({},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})}))})),yt(Tt(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 ct(ct({},e),{},{content:e.display_name,checked:e.is_visible})}));return l.createElement(At,null,l.createElement(Vr,{themeConfig:Ht(t.props.themeConfig),columns:a,isVisible:t.state.isHideColumnsModalVisible,onClose:function(){return t.setState({isHideColumnsModalVisible:!1})},isSettingColumns:t.state.isSettingColumnVisibility,onConfirm:t.onColumnVisibilitySave}))})),yt(Tt(t),"renderDataAlertModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.text");return l.createElement(At,null,l.createElement(ho,{authentication:Ot(t.props.authentication),themeConfig:Ht(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})}}))})),yt(Tt(t),"renderReportProblemModal",(function(){return l.createElement(At,null,l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),isVisible:"other-problem"===t.state.activeMenu,onClose:function(){t.setState({activeMenu:void 0,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:",l.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}})))})),yt(Tt(t),"reportQueryProblem",(function(n){var a=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),va(ct({message:n,queryId:a},Ot(t.props.authentication))).then((function(){t.props.onSuccessAlert("Thank you for your feedback."),t._isMounted&&t.setState({activeMenu:void 0,isReportingProblem:!1})})).catch((function(e){t.props.onErrorCallback(e),t._isMounted&&t.setState({isReportingProblem:!1})}))})),yt(Tt(t),"renderReportProblemMenu",(function(){return l.createElement("div",{className:"report-problem-menu"},l.createElement("ul",{className:"context-menu-list"},l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incorrect")}},"The data is incorrect"),l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.reportQueryProblem("The data is incomplete")}},"The data is incomplete"),l.createElement("li",{onClick:function(){return t.setState({activeMenu:"other-problem"})}},"Other...")))})),yt(Tt(t),"renderMoreOptionsMenu",(function(e,n){return l.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},l.createElement("ul",{className:"context-menu-list"},n.showSaveAsCSVButton&&l.createElement("li",{onClick:t.onCSVMenuButtonClick,style:t.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},l.createElement(ea,{type:"download",style:{marginRight:"7px"}}),t.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),n.showSaveAsPNGButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.saveChartAsPNG()}},l.createElement(ea,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),n.showCopyButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:void 0}),t.copyTableToClipboard()}},l.createElement(ea,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),n.showSQLButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"sql"})}},l.createElement(ea,{type:"database"})," View generated SQL"),n.showCreateNotificationIcon&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"notification"})}},l.createElement(ea,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert..."),n.showShareToSlackButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"slack"})}},l.createElement(ea,{style:{marginRight:"5px"},type:"slack"}),"Send to Slack..."),n.showShareToTeamsButton&&l.createElement("li",{onClick:function(){t.setState({activeMenu:"teams"})}},l.createElement(ea,{style:{display:"inline-block",marginRight:"5px",marginTop:"-2px"},type:"teams"}),"Send to Teams...")))})),yt(Tt(t),"isDrilldownResponse",(function(){try{return"Drilldown:"===e(t.props.responseRef,"queryResponse.data.data.text").split(" ")[0]}catch(e){return!1}})),yt(Tt(t),"renderSendToSlackModal",(function(){return Qt(t.props.autoQLConfig).enableSlackSharing?l.createElement(wo,{themeConfig:Ht(t.props.themeConfig),authentication:Ot(t.props.authentication),isVisible:"slack"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),yt(Tt(t),"renderSendToTeamsModal",(function(){return Qt(t.props.autoQLConfig).enableTeamsSharing?l.createElement(ko,{authentication:Ot(t.props.authentication),themeConfig:Ht(t.props.themeConfig),isVisible:"teams"===t.state.activeMenu,responseRef:t.props.responseRef,onErrorCallback:t.props.onErrorCallback,onClose:function(){t.setState({activeMenu:void 0})}}):null})),yt(Tt(t),"renderSQLModal",(function(){var n=e(t.props.responseRef,"queryResponse.data.data.sql[0]");return n?l.createElement(At,null,l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),isVisible:"sql"===t.state.activeMenu,footer:l.createElement("div",null,l.createElement(er,{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"},l.createElement("div",{className:"copy-sql-modal-content"},l.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(Ze(n)),disabled:!0}),l.createElement(er,{className:"copy-sql-btn ".concat(t.state.sqlCopySuccess?"sql-copied":""),onClick:t.copySQL,tooltip:"Copy to Clipboard"},l.createElement(ea,{type:"copy"}),t.state.sqlCopySuccess&&l.createElement(ea,{type:"check",className:"sql-copied"}))))):null})),yt(Tt(t),"renderToolbar",(function(e){return l.createElement(At,null,l.createElement("div",{className:"autoql-options-toolbar\n ".concat(t.state.activeMenu?"active":"","\n ").concat(t.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&l.createElement("button",{onClick:t.toggleTableFilter,className:"react-autoql-toolbar-btn","data-tip":"Filter table","data-for":"react-autoql-toolbar-btn-tooltip"},l.createElement(ea,{type:"filter"})),e.showHideColumnsButton&&l.createElement("button",{onClick:t.showHideColumnsModal,className:"react-autoql-toolbar-btn","data-tip":"Show/hide columns","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"options-toolbar-col-vis"},l.createElement(ea,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&l.createElement(Ee,{key:ve(),isOpen:"report-problem"===t.state.activeMenu,padding:8,onClickOutside:function(){t.setState({activeMenu:void 0})},position:"bottom",content:function(e){return t.renderReportProblemMenu(e)}},l.createElement("button",{onClick:function(){t.setState({activeMenu:"report-problem"})},className:"react-autoql-toolbar-btn","data-tip":"Report a problem","data-for":"react-autoql-toolbar-btn-tooltip"},l.createElement(ea,{type:"warning-triangle"}))),e.showDeleteButton&&l.createElement("button",{onClick:t.deleteMessage,className:"react-autoql-toolbar-btn","data-tip":"Delete data response","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"options-toolbar-trash-btn"},l.createElement(ea,{type:"trash"})),e.showMoreOptionsButton&&l.createElement(Ee,{key:ve(),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)}},l.createElement("button",{onClick:function(){fe.hide(),t.setState({activeMenu:"more-options"})},className:"react-autoql-toolbar-btn","data-tip":"More options","data-for":"react-autoql-toolbar-btn-tooltip","data-test":"react-autoql-toolbar-more-options-btn"},l.createElement(ea,{type:"more-vertical"})))))})),yt(Tt(t),"getShouldShouldButtonObj",(function(){var n={};try{var a=e(t.props.responseRef,"props.displayType"),r=fn(a),o=mn(a),i=e(t.props.responseRef,"queryResponse"),s="data"===e(i,"data.data.display_type"),l=Cn(i),c=vn(i),u=e(i,"data.data.rows.length"),p=u>0,d=u>1,m=Qt(t.props.autoQLConfig);(n={showFilterButton:r&&!l&&d,showCopyButton:r&&!l,showSaveAsPNGButton:o,showHideColumnsButton:m.enableColumnVisibilityManager&&p&&("table"===a||"text"===a&&l),showHiddenColsBadge:c,showSQLButton:s&&m.debug,showSaveAsCSVButton:r&&d&&m.enableCSVDownload,showDeleteButton:t.props.enableDeleteBtn,showReportProblemButton:!!e(i,"data.data.query_id"),showCreateNotificationIcon:s&&m.enableNotifications&&!t.isDrilldownResponse(),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})),yt(Tt(t),"render",(function(){var e=t.getShouldShouldButtonObj();return Object.values(e).find((function(e){return!0===e}))?l.createElement(At,null,t.renderToolbar(e),e.showHideColumnsButton&&t.renderHideColumnsModal(),e.showReportProblemButton&&t.renderReportProblemModal(),e.showMoreOptionsButton&&t.renderDataAlertModal(),e.showSQLButton&&t.renderSQLModal()):null})),t}return ht(a)}();yt(No,"propTypes",{authentication:Nt,autoQLConfig:Vt,themeConfig:Mt,responseRef:p.instanceOf(wr),enableDeleteBtn:p.bool,onSuccessAlert:p.func,onErrorCallback:p.func,onNewNotificationCallback:p.func,deleteMessageCallback:p.func,onResponseCallback:p.func,onFilterClick:p.func,onCSVDownloadStart:p.func,onCSVDownloadFinish:p.func,onCSVDownloadProgress:p.func}),yt(No,"defaultProps",{authentication:It,autoQLConfig:Lt,themeConfig:Pt,responseRef:void 0,enableDeleteBtn:!1,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},onFilterClick:function(){},onColumnVisibilitySave:function(){},onResponseCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var Ro=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r.scrollToBottomTimeout=setTimeout((function(){r.props.scrollToBottom()}),100),clearTimeout(r.animationTimeout),r.animationTimeout=setTimeout((function(){r.setState({isAnimatingMessageBubble:!1}),r.props.scrollToBottom()}),500),r.calculatedQueryOutputStyle=e(r.responseRef,"style"),r.calculatedQueryOutputHeight=e(r.responseRef,"offsetHeight")})),yt(Tt(r),"shouldComponentUpdate",(function(e){return!r.props.isResizing||!e.isResizing})),yt(Tt(r),"componentDidUpdate",(function(e,t){fe.hide()})),yt(Tt(r),"componentWillUnmount",(function(){clearTimeout(r.scrollToBottomTimeout),clearTimeout(r.scrollIntoViewTimeout),clearTimeout(r.animationTimeout)})),yt(Tt(r),"onCSVDownloadFinish",(function(e){var t,n,a,o=e.error,i=e.exportLimit,s=e.limitReached;if(o)return r.props.addMessageToDM({response:o});var c=null===(t=r.props.response)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.text;r.props.addMessageToDM({content:l.createElement(l.Fragment,null,"Your file has successfully been downloaded with the query"," ",l.createElement("b",null,l.createElement("i",null,c)),".",s?l.createElement(l.Fragment,null,l.createElement("br",null),l.createElement("p",null,l.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)})})),yt(Tt(r),"isScrolledIntoView",(function(e){if(r.props.scrollContainerRef){var t=r.props.scrollContainerRef.getScrollTop(),n=t+r.props.scrollContainerRef.getClientHeight(),a=e.offsetTop;return a+e.offsetHeight<=n&&a>=t}return!1})),yt(Tt(r),"scrollIntoView",(function(){clearTimeout(r.scrollIntoViewTimeout),r.scrollIntoViewTimeout=setTimeout((function(){r.messageContainerRef&&!r.isScrolledIntoView(r.messageContainerRef)&&(r.scrollIntoViewTimer=r.messageContainerRef.scrollIntoView({block:"end",inline:"nearest",behavior:"smooth"}))}),0)})),yt(Tt(r),"switchView",(function(e){r.filtering=!1,r.setState({displayType:e},r.scrollIntoView)})),yt(Tt(r),"updateDataConfig",(function(e){r.setState({dataConfig:e})})),yt(Tt(r),"onSupportedDisplayTypesChange",(function(e){r.setState({supportedDisplayTypes:e})})),yt(Tt(r),"renderCSVProgressMessage",(function(){return isNaN(r.state.csvDownloadProgress)?l.createElement("div",null,"Fetching your file ",l.createElement(Ja,null)):"Downloading your file ... ".concat(r.state.csvDownloadProgress,"%")})),yt(Tt(r),"renderContent",(function(){return r.props.isCSVProgressMessage||void 0!==r.state.csvDownloadProgress?r.renderCSVProgressMessage():r.props.content?r.props.content:401===e(r.props.response,"status")?In.UNAUTHENTICATED:r.props.response?l.createElement(c,null,l.createElement(wr,{ref:function(e){return r.responseRef=e},authentication:Ot(r.props.authentication),autoQLConfig:Qt(r.props.autoQLConfig),queryResponse:r.props.response,displayType:r.state.displayType,onSuggestionClick:r.props.onSuggestionClick,isQueryRunning:r.props.isChataThinking,themeConfig:Ht(r.props.themeConfig),copyToClipboard:r.copyToClipboard,tableOptions:r.props.tableOptions,dataFormatting:Ft(r.props.dataFormatting),appliedFilters:r.props.appliedFilters,onUpdate:r.props.onQueryOutputUpdate,onDrilldownStart:r.props.onDrilldownStart,onDrilldownEnd:r.props.onDrilldownEnd,demo:Ot(r.props.authentication).demo,onSupportedDisplayTypesChange:r.onSupportedDisplayTypesChange,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary"),renderTooltips:!1,onErrorCallback:r.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isResizing:r.props.isResizing||!r.props.isDataMessengerOpen,isAnimatingContainer:r.state.isAnimatingMessageBubble,enableDynamicCharting:r.props.enableDynamicCharting,tableConfig:r.state.dataConfig,onTableConfigChange:r.updateDataConfig,optionsToolbarRef:r.optionsToolbarRef,onNoneOfTheseClick:r.props.onNoneOfTheseClick,autoChartAggregations:r.props.autoChartAggregations,enableQueryInterpretation:r.props.enableQueryInterpretation,showQueryInterpretation:!0,onRecommendedDisplayType:r.switchView,enableFilterLocking:r.props.enableFilterLocking,onRTValueLabelClick:r.props.onRTValueLabelClick,reportProblemCallback:function(){var e;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&r.optionsToolbarRef.setState({activeMenu:"other-problem"})}})):In.GENERAL_QUERY})),yt(Tt(r),"toggleTableFilter",(function(e){var t=e.isFilteringTable;r.responseRef&&r.responseRef.toggleTableFilter({isFilteringTable:t})})),yt(Tt(r),"onCSVDownloadStart",(function(e){var t=e.id,n=e.queryId,a=e.query;r.props.addMessageToDM({id:t,query:a,queryId:n,isCSVProgressMessage:!0})})),yt(Tt(r),"renderRightToolbar",(function(){return r.props.isResponse&&"help"!==r.state.displayType&&"suggestion"!==r.state.displayType?l.createElement(No,{ref:function(e){return r.optionsToolbarRef=e},className:"chat-message-toolbar right",authentication:r.props.authentication,autoQLConfig:Qt(r.props.autoQLConfig),themeConfig:Ht(r.props.themeConfig),responseRef:r.responseRef,displayType:r.state.displayType,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadFinish:r.onCSVDownloadFinish,onCSVDownloadProgress:r.props.onCSVDownloadProgress,onSuccessAlert:r.props.onSuccessAlert,onErrorCallback:r.props.onErrorCallback,enableDeleteBtn:!r.props.isIntroMessage,deleteMessageCallback:function(){return r.props.deleteMessageCallback(r.props.id)},onFilterClick:r.toggleTableFilter,onResponseCallback:r.props.onResponseCallback}):null})),yt(Tt(r),"onDisplayTypeChange",(function(e){var t;r.toggleTableFilter({isFilteringTable:!1}),null!==(t=r.optionsToolbarRef)&&void 0!==t&&t._isMounted&&(r.optionsToolbarRef.filtering=!1),r.switchView(e)})),yt(Tt(r),"renderLeftToolbar",(function(){var e=r.state.displayType;return r.state.supportedDisplayTypes&&!r.state.supportedDisplayTypes.includes(r.state.displayType)&&(e="table"),r.props.isResponse&&"text"!==r.props.type?l.createElement(Ar,{themeConfig:Ht(r.props.themeConfig),className:"chat-message-toolbar left",supportedDisplayTypes:r.state.supportedDisplayTypes||[],displayType:e,onDisplayTypeChange:r.onDisplayTypeChange,disableCharts:r.state.disableChartingOptions}):null})),yt(Tt(r),"render",(function(){return l.createElement(At,null,l.createElement("div",{id:"message-".concat(r.props.id),ref:function(e){return r.messageContainerRef=e},"data-test":"chat-message",className:"chat-single-message-container\n ".concat(r.props.isResponse?" response":" request","\n ")},l.createElement("div",{ref:function(e){return r.ref=e},className:"chat-message-bubble\n ".concat(mn(r.state.displayType)?" full-width":"","\n ").concat("text"===r.props.type?" text":"","\n ").concat(r.state.displayType,"\n ").concat(r.props.isActive?" active":"")},r.renderContent(),r.props.isDataMessengerOpen&&!r.props.isResizing&&l.createElement(c,null,r.renderRightToolbar(),r.renderLeftToolbar()))))})),r.filtering=!1,r.PIE_CHART_HEIGHT=330,r.MESSAGE_HEIGHT_MARGINS=40,r.MESSAGE_WIDTH_MARGINS=40,r.ORIGINAL_TABLE_MESSAGE_HEIGHT=void 0;var o=Tn(t.response,t.autoChartAggregations);return r.state=yt({csvDownloadProgress:r.props.initialCSVDownloadProgress,displayType:Tn(t.response,t.autoChartAggregations),supportedDisplayTypes:bn({response:t.response}),isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},"displayType",o),r}return ht(a)}();yt(Ro,"propTypes",(yt(Ao={authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,isResponse:p.bool.isRequired,isIntroMessage:p.bool,isDataMessengerOpen:p.bool,setActiveMessage:p.func,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({})]),tableOptions:p.shape({}),enableColumnVisibilityManager:p.bool},"dataFormatting",Rt),yt(Ao,"onErrorCallback",p.func),yt(Ao,"onSuccessAlert",p.func),yt(Ao,"isResizing",p.bool),yt(Ao,"enableDynamicCharting",p.bool),yt(Ao,"scrollToBottom",p.func),yt(Ao,"onNoneOfTheseClick",p.func),yt(Ao,"autoChartAggregations",p.bool),yt(Ao,"onConditionClickCallback",p.func),yt(Ao,"onResponseCallback",p.func),yt(Ao,"addMessageToDM",p.func),yt(Ao,"csvDownloadProgress",p.number),yt(Ao,"onRTValueLabelClick",p.func),yt(Ao,"messageContainerHeight",p.number),yt(Ao,"messageContainerWidth",p.number),Ao)),yt(Ro,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,isDataMessengerOpen:!1,isIntroMessage:!1,displayType:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,tableOptions:void 0,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,messageContainerHeight:void 0,messageContainerWidth:void 0,onSuggestionClick:function(){},setActiveMessage:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},onResponseCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){},onRTValueLabelClick:function(){}});var Vo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"renderQueryTipsContent",(function(){return t.props.queryTipsQueryValidationResponse?l.createElement(Dr,{themeConfig:Ht(t.props.themeConfig),response:t.props.queryTipsQueryValidationResponse,onSuggestionClick:t.props.onQueryValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"}):t.props.queryTipsList?0===e(t.props.queryTipsList,"length")?l.createElement("div",{className:"query-tips-result-placeholder"},l.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):l.createElement(c,null,l.createElement("div",{className:"query-tip-list-container"},t.props.queryTipsList.map((function(e,n){return l.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return t.props.executeQuery(e)},key:"query-tip-".concat(n),style:{display:"block"}},e)}))),l.createElement("div",{id:"react-paginate",className:"animated-item"},l.createElement(et,{pageCount:t.props.totalPages,pageRangeDisplayed:1,forcePage:t.props.currentPage-1,marginPagesDisplayed:2,containerClassName:"pagination",subContainerClassName:"pages pagination",previousLabel:"←",nextLabel:"→",onPageChange:t.props.onPageChange,nextClassName:"pagination-next",previousClassName:"pagination-previous"}))):l.createElement("div",{className:"query-tips-result-placeholder"},l.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),l.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger."))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement($e,{ref:function(e){t.queryTipsScrollComponent=e}},l.createElement("div",{ref:t.props.queryTipsPageRef,className:"query-tips-page-container","data-test":"query-tips-tab"},l.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},l.createElement("input",{className:"react-autoql-chatbar-input left-padding",placeholder:"Search relevant queries by topic",value:t.props.queryTipsInputValue,onChange:t.props.onQueryTipsInputKeyPress,onKeyPress:t.props.onQueryTipsInputKeyPress,ref:function(e){return t.queryTipsInputRef=e},autoFocus:!0}),l.createElement("div",{className:"chat-bar-input-icon"},l.createElement(ea,{type:"search",style:{width:"19px",height:"20px",color:"#999"}})),t.props.loading&&l.createElement("div",{className:"chat-bar-loading-spinner"},l.createElement(Ja,{style:{width:"19px",height:"20px",color:"#999"}}))),l.createElement("div",{className:"query-tips-result-container"},t.renderQueryTipsContent()))))})),t}return ht(a)}();yt(Vo,"propTypes",{themeConfig:Mt,onQueryTipsInputKeyPress:p.func,loading:p.bool,error:p.bool,queryTipsList:p.array,executeQuery:p.func}),yt(Vo,"defaultProps",{themeConfig:Pt,loading:!1,error:!1,queryTipsList:void 0,executeQuery:function(){},onQueryTipsInputKeyPress:function(){}});var Mo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"COMPONENT_ID",ve()),yt(Tt(t),"state",{activeKeys:[],optionsArray:[{options:t.props.options}]}),yt(Tt(t),"renderOptionsList",(function(n){var a=n.options,r=n.active,o=n.index,i=o===e(t.state.optionsArray,"length",0)-1,s=0===o,u=e(t.state.mostRecentOption,"label"),p=a.every((function(e){return!e.children}));return l.createElement("div",{key:"options-list-".concat(o,"-").concat(t.COMPONENT_ID),className:"options-container\n ".concat(i?"visible":"hidden"),"data-test":"options-list-".concat(o)},!s&&l.createElement(c,null,l.createElement("div",{className:"cascader-back-arrow","data-test":"cascader-back-arrow-".concat(o),onClick:function(){var e=wt(t.state.optionsArray);e.pop(),t.setState({optionsArray:e})}},l.createElement(ea,{type:"caret-left"})),l.createElement("div",{className:"options-title","data-test":"options-title"},u)),a.map((function(n,a){return l.createElement("div",{key:"options-".concat(a,"-").concat(t.COMPONENT_ID),className:"option\n ".concat(n.value===r?"active":""),onClick:function(){return t.onOptionClick(n,o)},"data-test":"options-item-".concat(o,"-").concat(a)},l.createElement("span",{"data-test":"options-item-".concat(o,"-").concat(a,"-text")},n.label),!e(n,"children.length")&&l.createElement(ea,{className:"option-execute-icon",type:"play"}),!!e(n,"children.length")&&l.createElement(ea,{className:"option-arrow",type:"caret-right"}))})),p&&u&&t.props.onSeeMoreClick&&l.createElement("div",{className:"option","data-test":"see-more-option",onClick:function(){t.props.onSeeMoreClick(u)}},l.createElement("span",null,l.createElement(ea,{type:"light-bulb"})," See more...")))})),yt(Tt(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 r=[].concat(wt(t.state.activeKeys),[e.value]);t.setState({activeKeys:r})}})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.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 ht(a)}();yt(Mo,"propTypes",{options:p.arrayOf(p.shape({})),onFinalOptionClick:p.func,onSeeMoreClick:p.func}),yt(Mo,"defaultProps",{options:[],onFinalOptionClick:function(){},onSeeMoreClick:void 0});var Io=[],qo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.initialize()})),yt(Tt(r),"componentDidUpdate",(function(e,t){ge(r.state.filters,t.filters)||(r.props.onChange(r.state.filters),r.props.rebuildTooltips()),!r.props.isOpen&&e.isOpen&&r.setState({inputValue:""})})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.animateTextTimeout),clearTimeout(r.focusInputTimeout),clearTimeout(r.highlightFilterEndTimeout),clearTimeout(r.highlightFilterStartTimeout)})),yt(Tt(r),"initialize",(function(){r.setState({isFetchingFilters:!0}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));var o="".concat(r,"/autoql/api/v1/query/filter-locking?key=").concat(n),i={headers:{Authorization:"Bearer ".concat(a)}};return s.get(o,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Ot(r.props.authentication)).then((function(e){var t,n,a=(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data)||[];r._isMounted&&r.setState({filters:a,isFetchingFilters:!1})})).catch((function(e){console.error(e),r._isMounted&&r.setState({isFetchingFilters:!1})}))})),yt(Tt(r),"animateInputTextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=2e3/t.length,a=function(e){r.animateTextTimeout=setTimeout((function(){r.setState({inputValue:t.slice(0,e)}),e===t.length&&(r.focusInputTimeout=setTimeout((function(){var e;r.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=r.inputElement)||void 0===e||e.focus()}),300))}),n)},o=1;o<=t.length;o++)a(o)})),yt(Tt(r),"insertFilter",(function(e){var t=r.findFilter({filterText:e});e&&t?r.handleHighlightFilterRow(r.getKey(t)):r.animateInputTextAndSubmit(e)})),yt(Tt(r),"getAllFilters",(function(){return r.state.filters})),yt(Tt(r),"getPersistedFilters",(function(){return he(r.state.filters.filter((function(e){return!e.isSession})))})),yt(Tt(r),"findFilter",(function(e){var t=e.filterText,n=e.value,a=e.key,o=r.state.filters;return n&&a?o.find((function(e){return e.key===a&&e.value===n})):t?o.find((function(e){return e.value===t})):void 0})),yt(Tt(r),"onSuggestionsFetchRequested",(function(t){var n=t.value;clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){fa(ct(ct({},Ot(r.props.authentication)),{},{suggestion:n})).then((function(t){var n,a=e(t,"data.data"),o=[];Io=[],n=a.matches;for(var i=0;i<n.length;i++)o.push(n[i]);o.sort((function(e,t){var n,a;return(null===(n=e.keyword)||void 0===n?void 0:n.toUpperCase())<(null===(a=t.keyword)||void 0===a?void 0:a.toUpperCase())?-1:e.keyword>t.keyword?1:0}));for(var s=0;s<o.length;s++){var l={name:o[s]};Io.push(l)}r.setState({suggestions:Io})})).catch((function(e){return console.error(e)}))}),300)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"createNewFilterFromSuggestion",(function(e){var t="include",n=r.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,show_message:e.show_message,key:e.canonical,filter_type:t}})),yt(Tt(r),"setFilterTypes",(function(e,t){var n=Ot(r.props.authentication),a=e.filter((function(e){return!e.isSession}));return null!=a&&a.length?ga(ct(ct({},n),{},{filters:a})).then((function(e){var t,n,a=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data,o=r.state.filters.map((function(e){var t=a.find((function(t){return r.getKey(e)===r.getKey(t)}));return t||e}));return r.setState({filters:o}),Promise.resolve(e)})).catch((function(e){return console.error(e),r.setState({filters:t}),We.error("Something went wrong. Please try again."),Promise.reject()})):Promise.resolve()})),yt(Tt(r),"setFilter",(function(e){var t=Ot(r.props.authentication);return ga(ct(ct({},t),{},{filters:[e]})).then((function(t){var n,a,o=null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.data;if(null==o||!o.length)throw new Error("No filters in the api response");var i=o.find((function(t){return r.getKey(t)===r.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(r.findFilter(e)){var s=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(i)?i:e}));r.setState({filters:s})}else r.setState({filters:[].concat(wt(r.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),Promise.reject()}))})),yt(Tt(r),"unsetFilter",(function(t){try{return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,r=t.domain,o=t.filter;if(!r||!n||!a)return Promise.reject(new Error("Unauthenticated"));var i="".concat(r,"/autoql/api/v1/query/filter-locking/").concat(o.id,"?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}};return s.delete(i,l,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(ct(ct({},Ot(r.props.authentication)),{},{filter:t}))}catch(e){return Promise.reject(e)}})),yt(Tt(r),"getSuggestionValue",(function(e){return r.createNewFilterFromSuggestion(e)})),yt(Tt(r),"handlePersistToggle",function(){var e=mt(ut().mark((function e(t){var n,a,o;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=ct(ct({},t),{},{isSession:!t.isSession,id:void 0}),o=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(t)?a:e})),r.setState({filters:o}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,r.setFilter(a);case 8:e.next=12;break;case 10:return e.next=12,r.unsetFilter(t);case 12:e.next=19;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),We.error("Something went wrong. Please try again."),r.setState({filters:n});case 19:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),yt(Tt(r),"handleExcludeToggle",(function(e,t){if(t)try{var n=r.state.filters.map((function(n){return n.show_message===e?ct(ct({},n),{},{filter_type:t.toLowerCase()}):n})),a=n.filter((function(t){return t.show_message===e}));r.setFilterTypes(a,he(r.state.filters)),r.setState({filters:n})}catch(e){console.error(e)}})),yt(Tt(r),"removeFilter",function(){var e=mt(ut().mark((function e(t){var n,a;return ut().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=r.state.filters.filter((function(e){return r.getKey(e)!==r.getKey(t)})),r.setState({filters:a}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,r.unsetFilter(t);case 7:e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),We.error("Something went wrong. Please try again."),r.setState({filters:n});case 14:We.success("Filter removed."),fe.hide();case 16:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),yt(Tt(r),"onInputChange",(function(e,t){var n,a=t.newValue,o=t.method;"up"!==o&&"down"!==o&&("enter"!==o&&"click"!==o||(r.findFilter(a)?r.handleHighlightFilterRow(r.getKey(a)):r.setFilter(a).then((function(){return We.success("".concat(a.value," has been locked."))})).catch((function(){return We.error("Something went wrong. Please try again.")}))),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&r.setState({inputValue:e.target.value}))})),yt(Tt(r),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),yt(Tt(r),"renderTitle",(function(){return l.createElement("div",{className:"react-autoql-filter-locking-title"},l.createElement("h3",null,qn.filterLockingTitle," ",l.createElement(ea,{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."})))})),yt(Tt(r),"renderHeader",(function(){return l.createElement("div",{className:"filter-lock-menu-header"},r.renderTitle(),r.renderCloseBtn())})),yt(Tt(r),"renderCloseBtn",(function(){return l.createElement(er,{onClick:r.props.onClose,className:"filter-locking-close-btn","data-tip":qn.closeFilterLocking,"data-for":"filter-locking-tooltip",size:"small"},l.createElement(ea,{type:"close"}))})),yt(Tt(r),"renderFooter",(function(){return l.createElement("div",{className:"filter-lock-menu-footer"},l.createElement(er,{onClick:r.props.onClose,size:"small"},"Continue"))})),yt(Tt(r),"renderVLInput",(function(){return l.createElement(Ue,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:r.state.suggestions,onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:function(e){return r.getSuggestionValue(e.name)},renderSuggestion:function(e){return l.createElement("ul",{className:"filter-lock-suggestion-item"},l.createElement("li",null,e.name.keyword),l.createElement("li",null,e.name.show_message))},inputProps:{onChange:r.onInputChange,value:r.state.inputValue,disabled:r.state.isFetchingFilters,placeholder:"Search & select a filter",className:"react-autoql-condition-locking-input",id:"react-autoql-filter-menu-input"}})})),yt(Tt(r),"renderFilterListCategory",(function(e,t){return l.createElement("div",{key:e},r.renderFilterListCategoryHeader(e,t),l.createElement("div",{className:"react-autoql-filter-list"},r.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return r.renderFilterListItem(e)}))))})),yt(Tt(r),"renderFilterListCategoryHeader",(function(e,t){var n,a=null===(n=r.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return l.createElement("div",{className:"react-autoql-filter-list-title flex "},l.createElement("div",null,l.createElement("h4",null,l.createElement("span",{className:"filter-lock-category-title"},e),l.createElement(so,{className:"include-exclude-toggle-group",themeConfig:Ht(r.props.themeConfig),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 r.handleExcludeToggle(e,t)}}))),0===t?l.createElement("div",{className:"persist-toggle-column"},l.createElement("h4",null,"Persist"," ",l.createElement(ea,{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)})),yt(Tt(r),"renderFilterListItem",(function(e){var t=r.getKey(e);return l.createElement("div",{key:t,className:"flex ".concat(r.state.highlightedFilter===t?"react-autoql-highlight-row":"")},l.createElement("div",{className:"react-autoql-condition-table-list-item"},e.value),l.createElement("div",{id:"react-autoql-condition-table-settings"},l.createElement(Ya,{className:"persist-toggle-column",type:"switch",checked:!e.isSession,onChange:function(){return r.handlePersistToggle(e)}}),l.createElement(ea,{className:"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return r.removeFilter(e)}})))})),yt(Tt(r),"renderFilterList",(function(){var e;if(r.state.isFetchingFilters)return l.createElement("div",{className:"react-autoql-condition-list-loading-container"},l.createElement(Ea,null));if(null===(e=r.state.filters)||void 0===e||!e.length)return l.createElement("div",{className:"react-autoql-empty-condition-list"},l.createElement("i",null,qn.noFiltersLocked));var t=wt(new Set(r.state.filters.map((function(e){return e.show_message}))));return l.createElement("div",{className:"react-autoql-filter-list-container"},t.map((function(e,t){return r.renderFilterListCategory(e,t)})))})),yt(Tt(r),"renderContent",(function(){return l.createElement(At,null,l.createElement(Ye,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:Xe,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1,theme:Ht(r.props.themeConfig).theme}),l.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},r.renderHeader(),r.renderVLInput(),r.renderFilterList(),r.renderFooter(),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0})))})),yt(Tt(r),"render",(function(){return r.props.isOpen?l.createElement(Ee,{isOpen:r.props.isOpen,onClickOutside:r.props.onClose,position:r.props.position,align:r.props.align,content:r.renderContent(),containerClassName:"filter-lock-menu"},l.createElement(At,null,r.props.children||null)):r.props.children||null})),r.contentKey=ve(),r.state={filters:[],suggestions:[],inputValue:""},r}return ht(a,[{key:"handleHighlightFilterRow",value:function(e){var t=this;We.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}();yt(qo,"propTypes",{authentication:Nt,themeConfig:Mt,isOpen:p.bool,position:p.string,align:p.string,onChange:p.func,rebuildTooltips:p.func}),yt(qo,"defaultProps",{authentication:It,themeConfig:Pt,isOpen:!1,position:"bottom",align:"center",rebuildTooltips:function(){},onChange:function(){}});var Lo=["style"],Po=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{}),yt(Tt(e),"render",(function(){return l.createElement(Je,{className:e.props.className,ref:e.props.innerRef,renderTrackHorizontal:function(e){var t=e.style,n=St(e,Lo);return l.createElement("div",vt({},n,{style:ct(ct({},t),{},{left:"50%",width:"100px",top:0,transform:"translateX(-50%)"})}))}},e.props.children)})),e}return ht(n)}();yt(Po,"propTypes",{}),yt(Po,"defaultProps",{});var Oo=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;return ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0;try{r.setIntroMessages(),document.addEventListener("visibilitychange",r.onWindowResize),window.addEventListener("resize",r.onWindowResize),r.setState({containerHeight:r.getScrollContainerHeight(),containerWidth:r.getScrollContainerWidth()})}catch(e){console.error(e),r.setState({hasError:!0})}r.props.enableQueryQuickStartTopics&&function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.domain,a=t.token,r=t.apiKey;if(!n||!r||!a)return Promise.reject(new Error("Unauthenticated"));var o="".concat(n,"/autoql/api/v1/topic-set?key=").concat(r),i={headers:{Authorization:"Bearer ".concat(a)}};return s.get(o,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(Ot(r.props.authentication)).then((function(t){if(r._isMounted){var n=e(t,"data.data.topics");if(n){var a=r.createTopicsMessage(n);if(a){var o=r.createIntroMessage({content:a});r.setState({messages:[].concat(wt(r.state.messages),[o]),topicsMessageContent:a})}}}})).catch((function(e){console.error(e)}))})),yt(Tt(r),"componentDidUpdate",(function(e,t){try{var n={};r.props.placement!==e.placement&&(n.placement=r.getPlacementProp(r.props.placement),n.containerHeight=r.getScrollContainerHeight(),n.containerWidth=r.getScrollContainerWidth()),r.state.isSizeMaximum!==t.isSizeMaximum&&r.forceUpdate(),r.state.isVisible&&!t.isVisible&&(r.queryInputRef&&r.queryInputRef.focus(),n.containerHeight=r.getScrollContainerHeight(),n.containerWidth=r.getScrollContainerWidth()),!r.state.isVisible&&t.isVisible&&r.props.clearOnClose&&r.clearMessages(),0===r.state.messages.length&&r.setIntroMessages();var a=Ht(r.props.themeConfig).theme,o=Ht(e.themeConfig).theme;a&&a!==o&&An(Ht(r.props.themeConfig)),r.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),Ce(n)||r.setState(ct({},n))}catch(e){console.error(e),r.setState({hasError:!0})}})),yt(Tt(r),"rebuildTooltips",(function(){clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),1e3)})),yt(Tt(r),"setMaxWidthAndHeightFromDocument",(function(){r.maxWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-45,r.maxHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-45})),yt(Tt(r),"onWindowResize",(function(){r.state.isWindowResizing||r.setState({isWindowResizing:!0}),clearTimeout(r.windowResizeTimer),r.windowResizeTimer=setTimeout((function(){r.setMaxWidthAndHeightFromDocument(),r.setState({isWindowResizing:!1,containerHeight:r.getScrollContainerHeight(),containerWidth:r.getScrollContainerWidth()})}),300)})),yt(Tt(r),"escFunction",(function(e){r.state.isVisible&&e.keyCode})),yt(Tt(r),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:ve(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),yt(Tt(r),"createTopicsMessage",(function(e){var t=r.props.enableExploreQueriesTab,n=e.map((function(e){return{label:e.name,value:ve(),children:e.queries.map((function(e){return{label:e.query,value:ve()}}))}}));try{return l.createElement("div",null,qn.introPrompt,l.createElement("br",null),l.createElement("div",{className:"topics-container"},l.createElement(Mo,{options:n,onFinalOptionClick:function(e){r.onSuggestionClick({query:e.label,source:"welcome_prompt"})},onSeeMoreClick:t?function(e){return r.runTopicInExporeQueries(e)}:void 0})),t&&l.createElement("div",null,qn.use," ",l.createElement("span",{className:"intro-qi-link",onClick:function(){return r.setState({activePage:"explore-queries"})}},l.createElement(ea,{type:"light-bulb",style:{marginRight:"-3px"}})," ",qn.exploreQueries)," ",qn.explorePrompt))}catch(e){return void console.error(e)}})),yt(Tt(r),"setIntroMessages",(function(){var e=r.props.introMessage?"".concat(r.props.introMessage):"Hi ".concat(r.props.userDisplayName||"there","! Let’s dive into your data. What can I help you discover today?"),t=[r.createIntroMessage({type:"text",content:e})];r.state.topicsMessageContent&&t.push(r.createIntroMessage({content:r.state.topicsMessageContent})),r.setState({messages:t,lastMessageId:t[t.length-1].id,isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1})})),yt(Tt(r),"toggleFullScreen",(function(e,t,n){r.setState({width:e?r.props.width:t,height:e?r.props.height:n,isSizeMaximum:!e})})),yt(Tt(r),"getHandlerProp",(function(){return void 0!==r.props.customHandle?r.props.customHandle:!!r.props.showHandle&&l.createElement("div",{className:"drawer-handle\n ".concat(r.state.isVisible?" hide":"","\n ").concat(r.props.handleImage?"":" default-logo"),style:r.props.handleStyles},r.props.handleImage?l.createElement("img",{src:r.props.handleImage,height:"22px",width:"22px",draggable:"false"}):l.createElement(ea,{type:"react-autoql-bubbles-outlined",size:26}))})),yt(Tt(r),"getDrawerHeight",(function(){return"right"===r.state.placement||"left"===r.state.placement?null:r.state.height})),yt(Tt(r),"getDrawerWidth",(function(){return"right"===r.state.placement||"left"===r.state.placement?r.state.width:null})),yt(Tt(r),"getPlacementProp",(function(){var e,t=r.props.placement;return"string"!=typeof t||"right"!==(e=t.trim().toLowerCase())&&"left"!==e&&"bottom"!==e&&"top"!==e?"right":e})),yt(Tt(r),"onDrawerChange",(function(e){e?r.setState({isVisible:!0}):r.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),yt(Tt(r),"scrollToBottom",(function(){r.messengerScrollComponent&&r.messengerScrollComponent.scrollToBottom()})),yt(Tt(r),"onInputSubmit",(function(e){r.addRequestMessage(e),r.setState({isChataThinking:!0})})),yt(Tt(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.skipQueryValidation,o=e.source;r.queryInputRef&&r.queryInputRef.animateInputTextAndSubmit({query:t,userSelection:n,skipQueryValidation:a,source:o})})),yt(Tt(r),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),yt(Tt(r),"onResponse",(function(t,n){r.getIsSuggestionResponse(t)&&r.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),Ke(e(t,"data.data"),"authorization_url")?r.addResponseMessage({content:l.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source."," ",l.createElement("br",null),l.createElement("br",null),l.createElement("a",{href:e(t,"data.data.authorization_url"),target:"_blank"},"Click here to authorize access"),", then try querying again.")}):r.addResponseMessage({response:t,query:n}),r.setState({isChataThinking:!1}),r.queryInputRef&&r.queryInputRef.focus()})),yt(Tt(r),"clearMessages",(function(){r.queryInputRef&&r.queryInputRef.focus(),r.setIntroMessages()})),yt(Tt(r),"deleteMessage",(function(e){var t=[e],n=r.state.messages.findIndex((function(t){return t.id===e})),a=r.state.messages[n-1];a&&(a.isResponse||t.push(a.id));var o=r.state.messages.filter((function(e){return!t.includes(e.id)}));r.setState({messages:o})})),yt(Tt(r),"createErrorMessage",(function(e){return{content:e||In.GENERAL_QUERY,id:ve(),type:"error",isResponse:!0}})),yt(Tt(r),"createMessage",(function(t){var n=t.id,a=t.response,o=t.content,i=t.query,s=t.isCSVProgressMessage,l=t.queryId,c=t.appliedFilters,u=n||ve();return r.setState({lastMessageId:n}),{content:o,response:a,query:i,id:u,appliedFilters:c,type:e(a,"data.data.display_type"),isResponse:!0,isCSVProgressMessage:s,queryId:l}})),yt(Tt(r),"addRequestMessage",(function(e){var t=r.state.messages;r.props.maxMessages>1&&r.state.messages.length===r.props.maxMessages&&t.shift();var n={content:e,id:ve(),isResponse:!1};r.setState({messages:[].concat(wt(t),[n])})})),yt(Tt(r),"addResponseMessage",(function(t){var n=t.id,a=t.response,o=t.content,i=t.query,s=t.isCSVProgressMessage,l=t.queryId,c=r.state.messages;r.props.maxMessages>1&&r.state.messages.length===r.props.maxMessages&&c.shift();var u={};if("cancelled"===e(a,"error"))u=r.createErrorMessage("Query Cancelled.");else if("Unauthenticated"===e(a,"error"))u=r.createErrorMessage(In.UNAUTHENTICATED);else if("Parse error"===e(a,"error"))u=r.createErrorMessage();else if(s)u=r.createMessage({id:n,content:o,query:i,isCSVProgressMessage:s,queryId:l});else if(a||o){var p=[].concat(wt(e(a,"data.data.persistent_locked_conditions",[])),wt(e(a,"data.data.session_locked_conditions",[])));u=r.createMessage({response:a,content:o,query:i,appliedFilters:p})}else u=r.createErrorMessage();r.setState({messages:[].concat(wt(c),[u])})})),yt(Tt(r),"setActiveMessage",(function(e){r.setState({activeMessageId:e})})),yt(Tt(r),"setQueryInputRef",(function(e){r.queryInputRef=e})),yt(Tt(r),"handleClearQueriesDropdown",(function(){r.clearQueriesDropdown&&("block"===r.clearQueriesDropdown.style.display?r.clearQueriesDropdown.style.display="none":r.clearQueriesDropdown.style.display="block")})),yt(Tt(r),"getFilterMenuPosition",(function(){switch(r.state.placement){case"right":return{transform:"translate(1%, -3%)"};case"left":return{transform:"translate(-1%, -3%)"};case"top":case"bottom":return{transform:"translate(1.5%, -3%)",minWidth:"100vw"}}})),yt(Tt(r),"onRTValueLabelClick",(function(e){r.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=r.filterLockRef)||void 0===t||t.insertFilter(e)}))})),yt(Tt(r),"renderTabs",(function(){var e=r.state.activePage;if(r.state.isVisible)return l.createElement("div",{className:"data-messenger-tab-container ".concat(r.props.placement)},l.createElement("div",{className:"page-switcher-shadow-container ".concat(r.props.placement)},l.createElement("div",{className:"page-switcher-container ".concat(r.props.placement)},l.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return r.setState({activePage:"data-messenger"})},"data-tip":"Data Messenger","data-for":"react-autoql-header-tooltip","data-delay-show":1e3},l.createElement(ea,{type:"react-autoql-bubbles-outlined"})),r.props.enableExploreQueriesTab&&l.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return r.setState({activePage:"explore-queries"})},"data-tip":qn.exploreQueries,"data-for":"react-autoql-header-tooltip","data-delay-show":1e3},l.createElement(ea,{type:"light-bulb",size:22})),r.props.enableNotificationsTab&&Qt(Qt(r.props.autoQLConfig)).enableNotifications&&l.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){r.notificationBadgeRef&&r.notificationBadgeRef.resetCount(),r.setState({activePage:"notifications"})},"data-tip":"Notifications","data-for":"react-autoql-header-tooltip","data-delay-show":1e3,style:{paddingBottom:"5px",paddingLeft:"2px"}},l.createElement("div",{className:"data-messenger-notification-btn"},l.createElement($r,{ref:function(e){return r.notificationBadgeRef=e},authentication:Ot(Ot(r.props.authentication)),themeConfig:Ht(Ht(r.props.themeConfig)),clearCountOnClick:!1,style:{fontSize:"19px"},overflowCount:9,useDot:!0,isAlreadyMountedInDOM:l.isValidElement(l.createElement($r,null)),onNewNotification:function(){r.notificationListRef&&"notifications"===r.state.activePage&&r.notificationListRef.refreshNotifications()},onErrorCallback:r.props.onErrorCallback}))))))})),yt(Tt(r),"renderRightHeaderContent",(function(){return l.createElement(l.Fragment,null,Qt(r.props.autoQLConfig).enableFilterLocking&&r.renderFilterLockPopover(),l.createElement(Ee,{isOpen:r.state.isOptionsDropdownOpen,onClickOutside:function(){r.setState({isOptionsDropdownOpen:!1})},position:"bottom",content:l.createElement("div",null,l.createElement("div",{className:"clear-messages-confirm-popover"},l.createElement("div",{className:"react-autoql-menu-text",onClick:r.handleClearQueriesDropdown},l.createElement(ea,{type:"trash"}),l.createElement("span",{style:{marginLeft:5}},qn.clearDataResponses)),l.createElement("div",{ref:function(e){return r.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},l.createElement(er,{type:"default",size:"small",onClick:function(){return r.setState({isOptionsDropdownOpen:!1})}},"Cancel"),l.createElement(er,{type:"primary",size:"small",onClick:function(){return r.clearMessages()}},"Clear"))))},l.createElement("button",{onClick:function(){return r.setState({isOptionsDropdownOpen:!r.state.isOptionsDropdownOpen})},className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===r.state.activePage?"visible":"hidden"),"data-tip":qn.clearDataResponses,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:"trash"}))))})),yt(Tt(r),"renderHeaderTitle",(function(){var e="";return"data-messenger"===r.state.activePage&&(e=r.props.title),"explore-queries"===r.state.activePage&&(e=qn.exploreQueries),"notifications"===r.state.activePage&&(e="Notifications"),l.createElement("div",{className:"header-title"},e)})),yt(Tt(r),"openFilterLockMenu",(function(){r.state.isFilterLockMenuOpen||r.setState({isFilterLockMenuOpen:!0})})),yt(Tt(r),"closeFilterLockMenu",(function(){r.state.isFilterLockMenuOpen&&r.setState({isFilterLockMenuOpen:!1})})),yt(Tt(r),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));r.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),yt(Tt(r),"renderFilterLockPopover",(function(){return l.createElement(qo,{ref:function(e){return r.filterLockRef=e},authentication:r.props.authentication,themeConfig:r.props.themeConfig,isOpen:r.state.isFilterLockMenuOpen,onChange:r.onFilterChange,onClose:r.closeFilterLockMenu,rebuildTooltips:r.rebuildTooltips},l.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===r.state.activePage?"visible":"hidden"),"data-tip":qn.openFilterLocking,"data-for":"react-autoql-header-tooltip",onClick:r.state.isFilterLockMenuOpen?r.closeFilterLockMenu:r.openFilterLockMenu},l.createElement(ea,{type:r.state.hasFilters?"lock":"unlock"})))})),yt(Tt(r),"renderHeaderContent",(function(){var e=Math.max(document.documentElement.clientWidth,window.innerWidth||0)-45,t=Math.max(document.documentElement.clientHeight,window.innerHeight||0)-45,n=r.state.width===e;return l.createElement(c,null,l.createElement("div",{className:"react-autoql-header-left-container"},l.createElement("button",{onClick:function(){r.dmRef.setState({open:!1}),r.setState({isVisible:!1})},className:"react-autoql-drawer-header-btn close","data-tip":qn.closeDataMessenger,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:"close"})),l.createElement("button",{onClick:function(){return r.toggleFullScreen(n,e,t)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":n?qn.minimizeDataMessenger:qn.maximizeDataMessenger,"data-for":"react-autoql-header-tooltip"},l.createElement(ea,{type:n?"minimize":"maximize"}))),l.createElement("div",{className:"react-autoql-header-center-container"},r.renderHeaderTitle()),l.createElement("div",{className:"react-autoql-header-right-container"},r.renderRightHeaderContent()))})),yt(Tt(r),"renderBodyContent",(function(){switch(r.state.activePage){case"data-messenger":return r.renderDataMessengerContent();case"explore-queries":return r.renderQueryTipsContent();case"notifications":return r.renderNotificationsContent()}})),yt(Tt(r),"onNoneOfTheseClick",(function(){r.setState({isChataThinking:!0}),clearTimeout(r.feedbackTimeout),r.feedbackTimeout=setTimeout((function(){r.setState({isChataThinking:!1}),r.addResponseMessage({content:"Thank you for your feedback"})}),1e3)})),yt(Tt(r),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;r.csvProgressLog[t]=n,r.messageRefs[t]&&r.messageRefs[t].setState({csvDownloadProgress:n})})),yt(Tt(r),"onDrilldownStart",(function(){r.setState({isChataThinking:!0})})),yt(Tt(r),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error;r.setState({isChataThinking:!1}),t?r.addResponseMessage({response:t}):n&&r.addResponseMessage({content:n})})),yt(Tt(r),"renderDataMessengerContent",(function(){return l.createElement(c,null,l.createElement(Po,{innerRef:function(e){r.messengerScrollComponent=e},className:"chat-message-container",renderView:function(e){return l.createElement("div",vt({},e,{className:"custom-scrollbar-container"}))}},r.state.messages.length>0&&r.state.messages.map((function(t){return l.createElement(Ro,{key:t.id,id:t.id,ref:function(e){return r.messageRefs[t.id]=e},isIntroMessage:t.isIntroMessage,authentication:Ot(Ot(r.props.authentication)),autoQLConfig:Qt(Qt(r.props.autoQLConfig)),themeConfig:Ht(Ht(r.props.themeConfig)),isCSVProgressMessage:t.isCSVProgressMessage,initialCSVDownloadProgress:r.csvProgressLog[t.id],onCSVDownloadProgress:r.onCSVDownloadProgress,queryId:t.queryId,queryText:t.query,scrollRef:r.messengerScrollComponent,isDataMessengerOpen:r.state.isVisible,setActiveMessage:r.setActiveMessage,isActive:r.state.activeMessageId===t.id,addMessageToDM:r.addResponseMessage,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.onDrilldownEnd,isResponse:t.isResponse,isChataThinking:r.state.isChataThinking,onSuggestionClick:r.onSuggestionClick,content:t.content,scrollToBottom:r.scrollToBottom,lastMessageId:r.state.lastMessageId,onQueryOutputUpdate:r.rebuildTooltips,dataFormatting:r.props.dataFormatting,displayType:t.displayType||e(t,"response.data.data.display_type"),onResponseCallback:r.onResponse,response:t.response,type:t.type,onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessAlert,deleteMessageCallback:r.deleteMessage,scrollContainerRef:r.messengerScrollComponent,isResizing:r.state.isResizing||r.state.isWindowResizing,enableDynamicCharting:r.props.enableDynamicCharting,onNoneOfTheseClick:r.onNoneOfTheseClick,autoChartAggregations:r.props.autoChartAggregations,messageContainerHeight:r.state.containerHeight,messageContainerWidth:r.state.containerWidth,onRTValueLabelClick:r.onRTValueLabelClick,appliedFilters:t.appliedFilters})}))),r.state.isChataThinking&&l.createElement("div",{className:"response-loading-container"},l.createElement("div",{className:"response-loading"},l.createElement("div",null),l.createElement("div",null),l.createElement("div",null),l.createElement("div",null))),l.createElement("div",{className:"chat-bar-container"},l.createElement("div",{className:"watermark"},l.createElement(ea,{type:"react-autoql-bubbles-outlined"}),qn.run),l.createElement(Ta,{authentication:Ot(Ot(r.props.authentication)),autoQLConfig:Qt(Qt(r.props.autoQLConfig)),themeConfig:Ht(Ht(r.props.themeConfig)),ref:r.setQueryInputRef,className:"chat-drawer-chat-bar",onSubmit:r.onInputSubmit,onResponseCallback:r.onResponse,isDisabled:r.state.isChataThinking,enableVoiceRecord:r.props.enableVoiceRecord,autoCompletePlacement:"above",showChataIcon:!1,showLoadingDots:!1,placeholder:r.props.inputPlaceholder,onErrorCallback:r.props.onErrorCallback,hideInput:r.props.hideInput,source:["data_messenger"],AutoAEId:r.props.AutoAEId,queryFilters:r.state.sessionFilters})))})),yt(Tt(r),"fetchQueryTipsList",(function(t,n,a){r.setState({queryTipsLoading:!0,queryTipsKeywords:t});var o=10;r.queryTipsPage&&(o=Math.floor((r.queryTipsPage.clientHeight-150)/50)),ya(ct(ct({},Ot(r.props.authentication)),{},{keywords:t,pageSize:o,pageNumber:n,skipQueryValidation:a})).then((function(t){if(e(t,"data.full_suggestion"))r.setState({queryTipsLoading:!1,queryTipsQueryValidationResponse:t});else{var n=Number(e(t,"data.data.pagination.total_items")),a=Number(e(t,"data.data.pagination.total_pages")),o=Number(e(t,"data.data.pagination.current_page"));r.setState({queryTipsList:e(t,"data.data.items"),queryTipsLoading:!1,queryTipsError:!1,queryTipsTotalPages:a,queryTipsCurrentPage:o,queryTipsTotalQueries:n,queryTipsQueryValidationResponse:void 0})}})).catch((function(e){console.error(e),r.props.onErrorCallback(e),r.setState({queryTipsLoading:!1,queryTipsError:!0,queryTipsQueryValidationResponse:void 0})}))})),yt(Tt(r),"onQueryTipsInputKeyPress",(function(e){"Enter"==e.key?r.fetchQueryTipsList(e.target.value,1):r.setState({queryTipsInputValue:e.target.value})})),yt(Tt(r),"onQueryTipsPageChange",(function(e){var t=e.selected+1;r.fetchQueryTipsList(r.state.queryTipsKeywords,t,!0)})),yt(Tt(r),"onQueryTipsQueryValidationSuggestionClick",(function(e){var t=e.query;r.setState({queryTipsInputValue:t}),r.fetchQueryTipsList(t,1,!0)})),yt(Tt(r),"animateQITextAndSubmit",(function(t){if("string"==typeof t&&e(t,"length"))for(var n=function(e){clearTimeout(r.animateTextTimeout),r.animateTextTimeout=setTimeout((function(){r.setState({queryTipsInputValue:t.slice(0,e)}),e===t.length&&r.fetchQueryTipsList(t,1)}),50*e)},a=1;a<=t.length;a++)n(a)})),yt(Tt(r),"runTopicInExporeQueries",(function(e){r.setState({activePage:"explore-queries"}),clearTimeout(r.exploreQueriesTimeout),r.exploreQueriesTimeout=setTimeout((function(){r.animateQITextAndSubmit(e)}),500)})),yt(Tt(r),"renderQueryTipsContent",(function(){return l.createElement(Vo,{themeConfig:Ht(Ht(r.props.themeConfig)),onQueryTipsInputKeyPress:r.onQueryTipsInputKeyPress,queryTipsQueryValidationResponse:r.state.queryTipsQueryValidationResponse,onQueryValidationSuggestionClick:r.onQueryTipsQueryValidationSuggestionClick,loading:r.state.queryTipsLoading,error:r.state.queryTipsError,queryTipsList:r.state.queryTipsList,queryTipsInputValue:r.state.queryTipsInputValue,totalPages:r.state.queryTipsTotalPages,currentPage:r.state.queryTipsCurrentPage,queryTipsPageRef:function(e){return r.queryTipsPage=e},onPageChange:r.onQueryTipsPageChange,executeQuery:function(e){r.setState({activePage:"data-messenger"}),clearTimeout(r.executeQueryTimeout),r.executeQueryTimeout=setTimeout((function(){r.onSuggestionClick({query:e,source:"explore_queries"})}),500)}})})),yt(Tt(r),"renderNotificationsContent",(function(){return l.createElement(vo,{ref:function(e){return r.notificationListRef=e},authentication:Ot(r.props.authentication),themeConfig:Ht(Ht(r.props.themeConfig)),onExpandCallback:r.props.onNotificationExpandCallback,onCollapseCallback:r.props.onNotificationCollapseCallback,activeNotificationData:r.props.activeNotificationData,onErrorCallback:r.props.onErrorCallback,onSuccessCallback:r.props.onSuccessCallback,showNotificationDetails:!1})})),yt(Tt(r),"resizeDrawer",(function(t){var n=r.state.placement;if("right"===n){var a=e(r.state.startingResizePosition,"x")-t.pageX,o=e(r.state.startingResizePosition,"width")+a;o>r.maxWidth&&(o=r.maxWidth),o<r.minWidth&&(o=r.minWidth),Number(o)&&r.setState({width:o,containerWidth:o,isSizeMaximum:!1})}else if("left"===n){var i=t.pageX-e(r.state.startingResizePosition,"x"),s=e(r.state.startingResizePosition,"width")+i;s>r.maxWidth&&(s=r.maxWidth),s<r.minWidth&&(s=r.minWidth),Number(s)&&r.setState({width:s,containerWidth:s,isSizeMaximum:!1})}else if("bottom"===n){var l=e(r.state.startingResizePosition,"y")-t.pageY,c=e(r.state.startingResizePosition,"height")+l;c>r.maxHeight&&(c=r.maxHeight),c<r.minHeight&&(c=r.minHeight),Number(c)&&r.setState({height:c,containerHeight:c,isSizeMaximum:!1})}else if("top"===n){var u=t.pageY-e(r.state.startingResizePosition,"y"),p=e(r.state.startingResizePosition,"height")+u;p>r.maxHeight&&(p=r.maxHeight),p<r.minHeight&&(p=r.minHeight),Number(p)&&r.setState({height:p,containerHeight:p,isSizeMaximum:!1})}})),yt(Tt(r),"getScrollContainerHeight",(function(){if(r.messengerScrollComponent)return r.messengerScrollComponent.getClientHeight()})),yt(Tt(r),"getScrollContainerWidth",(function(){if(r.messengerScrollComponent)return r.messengerScrollComponent.getClientWidth()})),yt(Tt(r),"stopResizingDrawer",(function(){"right"===r.state.placement||"left"===r.state.placement?r.setState({isResizing:!1,containerWidth:r.state.width}):"top"!==r.state.placement&&"bottom"!==r.state.placement||r.setState({isResizing:!1,containerHeight:r.state.height}),document.removeEventListener("mousemove",r.resizeDrawer),document.removeEventListener("mouseup",r.stopResizingDrawer),document.removeEventListener("mouseleave",r.stopResizingDrawer)})),yt(Tt(r),"renderResizeHandle",(function(){var e=Tt(r);if(r.state.isVisible){var t=r.getPlacementProp();return l.createElement("div",{className:"react-autoql-drawer-resize-handle ".concat(t),onMouseDown:function(t){r.setState({isResizing:!0,startingResizePosition:{x:t.pageX,y:t.pageY,width:r.state.width,height:r.state.height}}),document.addEventListener("mousemove",e.resizeDrawer),document.addEventListener("mouseup",e.stopResizingDrawer),document.addEventListener("mouseleave",e.stopResizingDrawer)}})}return null})),yt(Tt(r),"renderTooltips",(function(){return l.createElement(c,null,l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-header-tooltip",effect:"solid",delayShow:500,place:"top"}),l.createElement(fe,{className:"react-autoql-drawer-tooltip",id:"react-autoql-toolbar-btn-tooltip",effect:"solid",delayShow:500,place:"top",html:!0}),l.createElement(fe,{className:"react-autoql-chart-tooltip",id:"chart-element-tooltip",effect:"solid",html:!0}))})),yt(Tt(r),"renderDataAlertModal",(function(){return l.createElement(ho,{authentication:Ot(r.props.authentication),themeConfig:Ht(Ht(r.props.themeConfig)),isVisible:r.state.isDataAlertModalVisible,onClose:function(){return r.setState({isDataAlertModalVisible:!1})},onSave:function(){r.props.onSuccessAlert("Notification created!"),r.setState({isDataAlertModalVisible:!1})},onErrorCallback:function(){return r.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")},initialQuery:r.state.activeQuery})})),yt(Tt(r),"render",(function(){return r.state.hasError?null:l.createElement(At,null,l.createElement(c,null,r.renderTooltips(),void((navigator.language||navigator.userLanguage).includes("sp")?qn.setLanguage("sp"):qn.setLanguage("en")),l.createElement(je,{ref:function(e){return r.dmRef=e},id:"react-autoql-drawer-".concat(r.DATA_MESSENGER_ID),"data-test":"react-autoql-drawer-test",className:"react-autoql-drawer\n ".concat(r.state.isResizing?" disable-selection":"","\n ").concat(r.state.isVisible?" open":" closed"),showMask:r.props.showMask,placement:r.getPlacementProp(),width:r.getDrawerWidth(),height:r.getDrawerHeight(),onChange:r.onDrawerChange,maskClosable:!0,handler:r.getHandlerProp(),level:r.props.shiftScreen?"all":null,keyboard:!1},r.props.resizable&&r.renderResizeHandle(),(r.props.enableExploreQueriesTab||r.props.enableNotificationsTab)&&r.renderTabs(),l.createElement("div",{className:"react-autoql-drawer-content-container"},l.createElement("div",{className:"chat-header-container"},r.renderHeaderContent()),r.renderBodyContent())),r.renderDataAlertModal()))})),r.csvProgressLog={},r.messageRefs={},r.minWidth=400,r.minHeight=400,r.DATA_MESSENGER_ID=ve(),r.HEADER_THICKNESS=70,r.setMaxWidthAndHeightFromDocument(),An(Ht(r.props.themeConfig)),r.state={hasError:!1,isVisible:!1,activePage:t.defaultTab,width:t.width,height:t.height,isResizing:!1,placement:r.getPlacementProp(t.placement),lastMessageId:void 0,isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,messages:[],topicsMessageContent:void 0,queryTipsList:void 0,queryTipsLoading:!1,queryTipsError:!1,queryTipsTotalPages:void 0,queryTipsCurrentPage:1,isSizeMaximum:!1},r}return ht(a,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,document.removeEventListener("visibilitychange",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.scrollToBottomTimeout),clearTimeout(this.windowResizeTimer),clearTimeout(this.responseTimeout),clearTimeout(this.feedbackTimeout),clearTimeout(this.animateTextTimeout),clearTimeout(this.exploreQueriesTimeout),clearTimeout(this.executeQueryTimeout),clearTimeout(this.rebuildTooltipsTimer)}catch(e){}}}]),a}();yt(Oo,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,placement:m,maskClosable:g,width:b([m,f]),height:b([m,f]),showHandle:g,handleImage:m,handleStyles:d({}),shiftScreen:g,userDisplayName:m,clearOnClose:g,enableVoiceRecord:g,title:m,maxMessages:f,introMessage:m,enableExploreQueriesTab:g,enableNotificationsTab:g,resizable:g,inputPlaceholder:m,enableDynamicCharting:g,defaultTab:m,autoChartAggregations:g,enableQueryInterpretation:g,defaultShowInterpretation:g,enableFilterLocking:g,enableQueryQuickStartTopics:g,onVisibleChange:C,onHandleClick:C,onErrorCallback:C,onSuccessAlert:C}),yt(Oo,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,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:void 0,introMessage:void 0,enableExploreQueriesTab:!0,enableNotificationsTab:!1,resizable:!0,inputPlaceholder:void 0,enableDynamicCharting:!0,defaultTab:"data-messenger",autoChartAggregations:!0,enableQueryInterpretation:!1,defaultShowInterpretation:!1,enableFilterLocking:!1,enableQueryQuickStartTopics:!0,onHandleClick:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var Fo=["style","className","key"],Qo=[],Ho=function(t){Ct(a,l.Component);var n=xt(a);function a(t){var r;ft(this,a),yt(Tt(r=n.call(this,t)),"componentDidMount",(function(){r._isMounted=!0})),yt(Tt(r),"shouldComponentUpdate",(function(e,t){var n=r.getFilteredProps(r.props),a=r.getFilteredProps(e);return!ge(rt(n,ot(n)),rt(a,ot(a)))||!ge(r.state,t)})),yt(Tt(r),"componentDidUpdate",(function(t){e(r.props,"tile.query")!==e(t,"tile.query")&&r.setState({query:e(r.props,"tile.query")},(function(){r.setState({supportedDisplayTypes:bn({response:e(r.props,"queryResponse")})})})),e(r.props,"tile.title")!==e(t,"tile.title")&&r.setState({title:e(r.props,"tile.title")})})),yt(Tt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.dragEndTimeout)})),yt(Tt(r),"getFilteredProps",(function(e){return ct(ct({},e),{},{children:void 0})})),yt(Tt(r),"toggleTableFilter",(function(e,t){null==e||e.toggleTableFilter({isFilteringTable:t})})),yt(Tt(r),"isQueryValid",(function(e){return!!e&&!!e.trim()})),yt(Tt(r),"endTopQuery",(function(e){var t=e.response;r.QUERY_RESPONSE_KEY=ve(),r.props.setParamsForTile({queryResponse:t,selectedSuggestion:void 0},r.props.tile.i),r._isMounted&&r.setState({isTopExecuting:!1,isTopExecuted:!0})})),yt(Tt(r),"endBottomQuery",(function(e){var t=e.response;r.props.setParamsForTile({secondQueryResponse:t,secondSelectedSuggestion:void 0},r.props.tile.i),r.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),yt(Tt(r),"processQuery",(function(e){var t=e.query,n=e.userSelection,a=e.skipQueryValidation,o=e.source;if(r.isQueryValid(t)){var i=["dashboards"];return o?i.push(o):i.push("user"),ca(ct(ct(ct({query:t,userSelection:n},Ot(r.props.authentication)),Qt(r.props.autoQLConfig)),{},{enableQueryValidation:!!r.props.isEditing&&Qt(r.props.autoQLConfig).enableQueryValidation,source:i,skipQueryValidation:a})).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),yt(Tt(r),"processTileTop",(function(t){var n=t.query,a=t.userSelection,o=t.skipQueryValidation,i=t.source;r.setState({isTopExecuting:!0,customMessage:void 0});var s=!!o||!(r.props.tile.query!==n||!r.props.tile.skipQueryValidation),l=a||(r.props.tile.query===n?e(r.props.tile,"queryValidationSelections"):void 0);r.props.setParamsForTile({query:n,dataConfig:r.props.tile.query===n?void 0:r.props.tile.dataConfig,skipQueryValidation:s,queryResponse:null,selectedSuggestion:void 0,queryValidationSelections:l},r.props.tile.i),r.processQuery({query:n,userSelection:l,skipQueryValidation:o,source:i}).then((function(e){r._isMounted&&r.endTopQuery({response:e})})).catch((function(e){r._isMounted&&r.endTopQuery({response:e})}))})),yt(Tt(r),"processTileBottom",(function(t){var n=t.query,a=t.userSelection,o=t.skipQueryValidation,i=t.source;r.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondCustomMessage:void 0});var s=o||!(r.props.tile.secondQuery!==n||!r.props.tile.secondskipQueryValidation),l=a||(r.props.tile.secondQuery===n?e(r.props.tile,"secondQueryValidationSelections"):void 0);r.props.setParamsForTile({secondQuery:n,secondDataConfig:r.props.tile.secondQuery===n?void 0:r.props.tile.secondDataConfig,secondskipQueryValidation:s,secondQueryResponse:null,secondSelectedSuggestion:void 0,secondQueryValidationSelections:l},r.props.tile.i),r.processQuery({query:n,userSelection:l,skipQueryValidation:o,source:i}).then((function(e){r._isMounted&&r.endBottomQuery({response:e})})).catch((function(e){r._isMounted&&r.endBottomQuery({response:e})}))})),yt(Tt(r),"clearQueryResponses",(function(){r.setState({isTopExecuting:!1,isTopExecuted:!1,customMessage:void 0}),r.props.setParamsForTile({queryResponse:void 0,secondQueryResponse:void 0},r.props.tile.i)})),yt(Tt(r),"processTile",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.query,n=e.secondQuery,a=e.skipQueryValidation,o=e.secondskipQueryValidation,i=e.source,s=t||r.props.tile.selectedSuggestion||r.state.query,l=n||r.props.tile.secondSelectedSuggestion||r.state.secondQuery;r.processTileTop({query:s,skipQueryValidation:a,source:i}),r.getIsSplitView()&&l&&s!==l&&r.processTileBottom({query:l,skipQueryValidation:o,source:i})})),yt(Tt(r),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(r.processTile({query:e.target.value}),e.target.blur())})),yt(Tt(r),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(r.processTileBottom({query:e.target.value}),e.target.blur())})),yt(Tt(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,o=e.source;r.setState({query:t}),a?r.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:o}):r.props.setParamsForTile({selectedSuggestion:t},r.props.tile.i)})),yt(Tt(r),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,o=e.source;r.setState({secondQuery:t}),a?(r.props.setParamsForTile({secondQuery:t,secondQueryValidationSelections:n},r.props.tile.i),r.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:o})):r.props.setParamsForTile({secondQuery:t},r.props.tile.i)})),yt(Tt(r),"onSuggestionsFetchRequested",(function(t){var n=t.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){ma(ct({suggestion:n},Ot(r.props.authentication))).then((function(t){if(r._isMounted){var n,a=e(t,"data.data"),o=[];Qo=[],n=a.matches;for(var i=0;i<n.length&&(o.push(n[i]),4!==i);i++);o.sort((function(e,t){return t.length-e.length}));for(var s=0;s<o.length;s++){var l={name:o[s]};Qo.push(l)}r.setState({suggestions:Qo})}})).catch((function(e){console.error(e)}))}),300)})),yt(Tt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),yt(Tt(r),"userSelectedSuggestionHandler",(function(e){if(e&&e.name){var t=e.name;r.userSelectedValue=t,r.userSelectedSuggestion=!0,r.setState({query:t}),r.props.setParamsForTile({query:t},r.props.tile.i)}})),yt(Tt(r),"onQueryInputChange",(function(t){(!r.userSelectedSuggestion||38!==t.keyCode&&40!==t.keyCode)&&(e(t,"target.value")||""===e(t,"target.value")?r.setState({query:t.target.value}):r.processTile({query:r.userSelectedValue}))})),yt(Tt(r),"onDisplayTypeChange",(function(e){r.props.setParamsForTile({displayType:e},r.props.tile.i)})),yt(Tt(r),"onSecondDisplayTypeChange",(function(e){r.props.setParamsForTile({secondDisplayType:e},r.props.tile.i)})),yt(Tt(r),"getIsSplitView",(function(){return e(r.props.tile,"splitView")})),yt(Tt(r),"toggleSecondQueryInput",(function(){r.setState({isSecondQueryInputOpen:!r.state.isSecondQueryInputOpen})})),yt(Tt(r),"renderHeader",(function(){return r.props.isEditing?l.createElement("div",{className:"dashboard-tile-edit-wrapper"},l.createElement("div",{className:"dashboard-tile-input-container\n ".concat(r.state.isQueryInputFocused?"query-focused":"","\n ").concat(r.state.isTitleInputFocused?"title-focused":""),onMouseDown:function(e){return e.stopPropagation()}},l.createElement("div",{className:"dashboard-tile-left-input-container"},l.createElement(ea,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),Qt(r.props.autoQLConfig).enableAutocomplete?l.createElement(Ue,{onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,suggestions:r.state.suggestions,ref:function(e){r.autoSuggest=e},renderSuggestion:function(e){return l.createElement(c,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onFocus:function(){return r.setState({isQueryInputFocused:!0})},onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onBlur:function(t){e(r.props,"tile.query")!==t.target.value&&r.props.setParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0},r.props.tile.i),r.setState({isQueryInputFocused:!1})}}}):l.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){r.setState({query:e.target.value})},onKeyDown:r.onQueryTextKeyDown,onFocus:function(){return r.setState({isQueryInputFocused:!0})},onBlur:function(t){e(r.props,"tile.query")!==t.target.value&&r.props.setParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0},r.props.tile.i),r.setState({isQueryInputFocused:!1})}})),l.createElement("div",{className:"dashboard-tile-right-input-container"},l.createElement(ea,{className:"title-input-icon",type:"title"}),l.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)",value:r.state.title,"data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onChange:function(e){return r.setState({title:e.target.value})},onFocus:function(){return r.setState({isTitleInputFocused:!0})},onBlur:function(e){r.props.setParamsForTile({title:e.target.value},r.props.tile.i),r.setState({isTitleInputFocused:!1})}}))),l.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-play-button".concat(r.isQueryValid(r.state.query)?"":" disabled")},l.createElement(ea,{type:"play",onClick:function(){return r.processTile()},"data-tip":"Run tile","data-place":"left"})),l.createElement("div",{className:"dashboard-tile-delete-button",onMouseDown:function(e){return e.stopPropagation()},onClick:function(){return r.props.deleteTile(r.props.tile.i)}},l.createElement(ea,{style:{fontSize:"18px"},type:"close"}))):l.createElement("div",{className:"dashboard-tile-title-container"},l.createElement("span",{className:"dashboard-tile-title"},r.props.tile.title||r.props.tile.query||"Untitled"),l.createElement("div",{className:"dashboard-tile-title-divider"}))})),yt(Tt(r),"renderDraggingPlaceholder",(function(){return l.createElement("div",{className:"react-autoql-db-dragging-placeholder-container"},l.createElement("div",{className:"react-autoql-db-dragging-placeholder-title"}),l.createElement("div",{className:"react-autoql-db-dragging-placeholder-content"}))})),yt(Tt(r),"renderContentPlaceholder",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting,a=t.isExecuted,o=t.showSplitViewBtn,i=null;return i=n?l.createElement(Ea,null):!r.props.isEditing&&a?l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,"No query was supplied for this tile.")):r.props.isEditing&&!e(r.state.query,"trim()")?l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,"To get started, enter a query and click"," ",l.createElement(ea,{className:"play-icon",type:"play"}))):l.createElement("div",{className:"dashboard-tile-placeholder-text"},l.createElement("em",null,r.props.isEditing?l.createElement("span",null,"Hit ",l.createElement(ea,{className:"edit-mode-placeholder-icon",type:"play"})," ","to run this tile"):l.createElement("span",null,r.props.notExecutedText))),l.createElement("div",{className:"loading-container-centered"},i,!r.props.isDragging&&r.props.isEditing&&l.createElement("div",{className:"dashboard-tile-viz-toolbar-container"},r.props.isEditing&&o&&r.renderSplitViewBtn()))})),yt(Tt(r),"onQueryValidationSelectOption",(function(e,t){r.setState({query:e}),r.props.setParamsForTile({query:e,queryValidationSelections:t},r.props.tile.i)})),yt(Tt(r),"onSecondQueryValidationSelectOption",(function(e,t){r.setState({secondQuery:e}),r.props.setParamsForTile({secondQuery:e,secondqueryValidationSelections:t},r.props.tile.i)})),yt(Tt(r),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),yt(Tt(r),"onDataConfigChange",(function(e){r.props.setParamsForTile({dataConfig:e},r.props.tile.i)})),yt(Tt(r),"onSecondDataConfigChange",(function(e){r.props.setParamsForTile({secondDataConfig:e},r.props.tile.i)})),yt(Tt(r),"reportProblemCallback",(function(){var e;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&r.optionsToolbarRef.setState({activeMenu:"other-problem"})})),yt(Tt(r),"secondReportProblemCallback",(function(){var e;null!==(e=r.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&r.secondOptionsToolbarRef.setState({activeMenu:"other-problem"})})),yt(Tt(r),"onNoneOfTheseClick",(function(){r.setState({customMessage:"Thank you for your feedback"})})),yt(Tt(r),"secondOnNoneOfTheseClick",(function(){r.setState({secondCustomMessage:"Thank you for your feedback"})})),yt(Tt(r),"renderSuggestionPrefix",(function(){return l.createElement("div",null,"I want to make sure I understood your query. Did you mean:")})),yt(Tt(r),"renderSplitResponse",(function(){var t=e(r.tileInnerDiv,"clientWidth")?"".concat(r.tileInnerDiv.clientWidth-70,"px"):"0px";return l.createElement(at,{vertical:!0,percentage:!0,secondaryInitialSize:r.props.secondDisplayPercentage||50,onDragEnd:function(){r.dragEndTimeout=setTimeout((function(){var t=e(r.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));Number.isNaN(n)||r.props.setParamsForTile({secondDisplayPercentage:n},r.props.tile.i)}),1e3)}},l.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderTopResponse()),l.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderBottomResponse(),r.props.isEditing&&l.createElement("div",{className:"viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},l.createElement("button",{onClick:function(){r.toggleSecondQueryInput(),fe.hide()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},l.createElement(ea,{type:"react-autoql-bubbles-outlined"}),l.createElement(ea,{type:r.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),l.createElement("input",{className:"dashboard-tile-input query second ".concat(r.state.isSecondQueryInputOpen?"open":""),value:r.state.secondQuery,onChange:function(e){r.setState({secondQuery:e.target.value})},onKeyDown:r.onSecondQueryTextKeyDown,onBlur:function(t){e(r.props,"tile.secondQuery")!==t.target.value&&r.props.setParamsForTile({secondQuery:t.target.value,secondDataConfig:void 0,secondQueryValidationSelections:void 0},r.props.tile.i)},placeholder:r.props.tile.query||"Type a query in your own words",style:{width:r.state.isSecondQueryInputOpen?t:"0px"}}))))})),yt(Tt(r),"onSplitViewClick",(function(){var e,t,n,a=!(null!==(e=r.props.tile)&&void 0!==e&&e.splitView),o=null===(t=r.props.tile)||void 0===t?void 0:t.secondQuery;a&&!o&&(o=null===(n=r.props.tile)||void 0===n?void 0:n.query);r.props.setParamsForTile({splitView:a,secondQuery:o},r.props.tile.i),fe.hide()})),yt(Tt(r),"renderSplitViewBtn",(function(){return l.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},l.createElement("button",{onClick:r.onSplitViewClick,className:"react-autoql-toolbar-btn","data-tip":r.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},l.createElement(ea,{type:r.getIsSplitView()?"single-view":"split-view",style:{color:r.props.tile.splitView?Ht(r.props.themeConfig).accentColor:"inherit"}})))})),yt(Tt(r),"onSupportedDisplayTypesChange",(function(e){r.setState({supportedDisplayTypes:e})})),yt(Tt(r),"onSecondSupportedDisplayTypesChange",(function(e){r.setState({secondSupportedDisplayTypes:e}),r.props.setParamsForTile({secondDataConfig:void 0})})),yt(Tt(r),"onCSVDownloadStart",(function(e){return r.props.onCSVDownloadStart(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"onCSVDownloadProgress",(function(e){return r.props.onCSVDownloadProgress(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"onCSVDownloadFinish",(function(e){return r.props.onCSVDownloadFinish(ct(ct({},e),{},{tileId:r.props.tile.i}))})),yt(Tt(r),"renderSuggestionMessage",(function(e){return e||l.createElement("div",{style:{paddingTop:"20px"}},r.renderSuggestionPrefix())})),yt(Tt(r),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,a=e.vizToolbarProps,o=void 0===a?{}:a,i=e.optionsToolbarProps,s=void 0===i?{}:i,c=e.showSplitViewBtn,u=e.isSecondHalf,p=r.state.customMessage;return u&&(p=r.state.secondCustomMessage),l.createElement("div",{className:"loading-container-centered"},r.getIsSuggestionResponse(n.queryResponse)&&r.renderSuggestionMessage(p),!p&&l.createElement(wr,vt({authentication:Ot(r.props.authentication),themeConfig:Ht(r.props.themeConfig),autoQLConfig:Qt(r.props.autoQLConfig),dataFormatting:Ft(r.props.dataFormatting),renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:r.props.autoChartAggregations,isResizing:r.props.isDragging,renderSuggestionsAsDropdown:r.props.tile.h<4,enableDynamicCharting:r.props.enableDynamicCharting,onUpdate:r.props.onQueryOutputUpdate,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary")},n)),!r.props.isDragging&&r.props.isEditing&&l.createElement("div",{className:"dashboard-tile-viz-toolbar-container"},r.props.isEditing&&c&&r.renderSplitViewBtn(),l.createElement(Ar,vt({themeConfig:Ht(r.props.themeConfig)},o))),!r.props.isDragging&&l.createElement(No,vt({authentication:Ot(r.props.authentication),autoQLConfig:Qt(r.props.autoQLConfig),themeConfig:Ht(r.props.themeConfig),onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessCallback,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadProgress:r.onCSVDownloadProgress,onCSVDownloadFinish:r.onCSVDownloadFinish},s)))})),yt(Tt(r),"renderTopResponse",(function(){var t=r.state.isTopExecuting,n=r.state.isTopExecuted;if(!r.props.queryResponse||t||!n)return r.renderContentPlaceholder({isExecuting:t,isExecuted:n,showSplitViewBtn:!r.getIsSplitView()});var a=e(r.props,"tile.displayType");return r.renderResponse({queryOutputProps:{ref:function(e){return r.responseRef=e},optionsToolbarRef:r.optionsToolbarRef,key:"dashboard-tile-query-top-".concat(r.QUERY_RESPONSE_KEY),displayType:a,queryResponse:r.props.queryResponse,dataConfig:r.props.tile.dataConfig,onDataConfigChange:r.onDataConfigChange,queryValidationSelections:r.props.tile.queryValidationSelections,onSuggestionClick:r.onSuggestionClick,selectedSuggestion:e(r.props.tile,"selectedSuggestion"),onNoneOfTheseClick:r.onNoneOfTheseClick,onDrilldownStart:function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!1,activeKey:e})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onQueryValidationSelectOption,onSupportedDisplayTypesChange:r.onSupportedDisplayTypesChange,onRecommendedDisplayType:function(e,t){r.onSupportedDisplayTypesChange(t),r.onDisplayTypeChange(e)},reportProblemCallback:r.reportProblemCallback},vizToolbarProps:{displayType:a,onDisplayTypeChange:r.onDisplayTypeChange,supportedDisplayTypes:r.state.supportedDisplayTypes},optionsToolbarProps:{ref:function(e){return r.optionsToolbarRef=e},responseRef:r.responseRef,onFilterClick:function(e){var t=e.isFilteringTable;return r.toggleTableFilter(r.responseRef,t)},displayType:a},showSplitViewBtn:!r.getIsSplitView()})})),yt(Tt(r),"renderBottomResponse",(function(){var t,n,a,o,i=null===(t=r.props)||void 0===t||null===(n=t.tile)||void 0===n?void 0:n.query,s=null===(a=r.props)||void 0===a||null===(o=a.tile)||void 0===o?void 0:o.secondQuery,l=!s||i===s,c=r.state.isBottomExecuting,u=r.state.isBottomExecuted;if(l&&(c=r.state.isTopExecuting,u=r.state.isTopExecuted),!l&&!r.props.secondQueryResponse||l&&!r.props.queryResponse||c||!u)return r.renderContentPlaceholder({isExecuting:c,isExecuted:u,showSplitViewBtn:r.getIsSplitView()});var p=e(r.props,"tile.secondDisplayType","table");return r.renderResponse({queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(r.QUERY_RESPONSE_KEY),ref:function(e){return r.secondResponseRef=e},optionsToolbarRef:r.secondOptionsToolbarRef,displayType:p,queryResponse:r.props.secondQueryResponse||r.props.queryResponse,dataConfig:r.props.tile.secondDataConfig,onDataConfigChange:r.onSecondDataConfigChange,queryValidationSelections:r.props.tile.secondqueryValidationSelections,onSuggestionClick:r.onSecondSuggestionClick,selectedSuggestion:e(r.props.tile,"secondSelectedSuggestion"),reportProblemCallback:r.secondReportProblemCallback,onSupportedDisplayTypesChange:r.onSecondSupportedDisplayTypesChange,onRecommendedDisplayType:function(e,t){r.onSecondSupportedDisplayTypesChange(t),r.onSecondDisplayTypeChange(e)},onNoneOfTheseClick:r.secondOnNoneOfTheseClick,onDrilldownStart:function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!0,activeKey:e})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onSecondQueryValidationSelectOption},vizToolbarProps:{displayType:p,onDisplayTypeChange:r.onSecondDisplayTypeChange,supportedDisplayTypes:r.state.secondSupportedDisplayTypes},optionsToolbarProps:{ref:function(e){return r.secondOptionsToolbarRef=e},responseRef:r.secondResponseRef,onFilterClick:function(e){var t=e.isFilteringTable;return r.toggleTableFilter(r.secondResponseRef,t)},displayType:p},showSplitViewBtn:r.getIsSplitView(),isSecondHalf:!0})})),yt(Tt(r),"renderContent",(function(){return l.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(r.props.isEditing?" editing":"","\n ").concat(r.props.tile.h<4?" small":"")},l.createElement("div",{onMouseDown:function(e){return e.stopPropagation()},className:"dashboard-tile-response-container"},r.getIsSplitView()?r.renderSplitResponse():r.renderTopResponse()))})),yt(Tt(r),"renderDragHandles",(function(){return l.createElement(c,null,l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle top"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle bottom"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle left"}),l.createElement("div",{className:"react-autoql-dashboard-tile-drag-handle right"}))})),yt(Tt(r),"render",(function(){var e=r.props,t={onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onTouchStart:e.onTouchStart,onTouchEnd:e.onTouchEnd};return l.createElement(At,null,l.createElement("div",vt({className:r.props.className,style:ct({},r.props.style),"data-grid":r.props.tile},t),r.props.children,l.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(r.COMPONENT_KEY),ref:function(e){return r.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(r.getIsSplitView()?"split":"")},l.createElement(c,null,r.renderHeader(),r.renderContent())),r.props.isEditing&&r.renderDragHandles()))})),r.COMPONENT_KEY=ve(),r.QUERY_RESPONSE_KEY=ve(),r.autoCompleteTimer=void 0;var o=bn({response:t.queryResponse})||[],i=bn({response:t.secondQueryResponse})||[];return r.state={query:t.tile.query,secondQuery:t.tile.secondQuery||r.props.tile.query,title:t.tile.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,currentSource:"user",supportedDisplayTypes:o,secondSupportedDisplayTypes:i},r}return ht(a)}();yt(Ho,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,isEditing:p.bool.isRequired,tile:p.shape({}).isRequired,deleteTile:p.func.isRequired,queryResponse:p.shape({}),notExecutedText:p.string,onErrorCallback:p.func,onSuccessCallback:p.func,autoChartAggregations:p.bool,onCSVDownloadStart:p.func,onCSVDownloadProgress:p.func,onCSVDownloadFinish:p.func}),yt(Ho,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,query:"",title:"",displayType:"table",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 Bo=l.forwardRef((function(e,t){var n=e.style,a=e.className;e.key;var r=St(e,Fo);return l.createElement("div",{style:ct({},n),className:a,ref:t},l.createElement(Ho,vt({},r,{ref:r.tileRef,className:"".concat(r.innerDivClass," ").concat(r.isEditing?"editing":""),"data-test":"react-autoql-dashboard-tile"})))})),zo=nt(tt),Uo=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},_o=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},jo=function(t){Ct(a,l.Component);var n=xt(a);function a(){var t;ft(this,a);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return yt(Tt(t=n.call.apply(n,[this].concat(o))),"tileRefs",{}),yt(Tt(t),"state",{isDragging:!1,previousTileState:t.props.tiles}),yt(Tt(t),"componentDidMount",(function(){t._isMounted=!0,t.props.executeOnMount&&t.executeDashboard(),t.setStyles(),window.addEventListener("resize",t.onWindowResize)})),yt(Tt(t),"componentDidUpdate",(function(n){ge(Ht(t.props.themeConfig),Ht(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"))!==1/0&&(t.props.isEditing&&n.tiles.length<t.props.tiles.length&&!t.state.justPerformedUndo&&t.scrollToNewTile(),t.setState({justPerformedUndo:!1}))})),yt(Tt(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)})),yt(Tt(t),"rebuildTooltips",(function(){clearTimeout(t.rebuildTooltipsTimer),t.rebuildTooltipsTimer=setTimeout((function(){fe.rebuild()}),500)})),yt(Tt(t),"setStyles",(function(){An(Ht(t.props.themeConfig))})),yt(Tt(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)))})),yt(Tt(t),"setPreviousTileState",(function(e){t.setState({previousTileState:e})})),yt(Tt(t),"executeDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].processTile()}catch(e){console.error(e)}})),yt(Tt(t),"unExecuteDashboard",(function(){try{for(var e in t.tileRefs)t.tileRefs[e]&&t.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),yt(Tt(t),"getChangeDetection",(function(e,n,a){return!ge(t.getChangeDetectionTileStructure(e,a),t.getChangeDetectionTileStructure(n,a))})),yt(Tt(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)}})),yt(Tt(t),"scrollToNewTile",(function(){t.scrollToNewTileTimeout=setTimeout((function(){t.ref&&t.ref.scrollIntoView(!1)}),200)})),yt(Tt(t),"onMoveStart",(function(){t.state.isDragging||t.setState({isDragging:!0})})),yt(Tt(t),"onMoveEnd",(function(e){try{t.getChangeDetection(t.props.tiles,e,!0)&&t.setPreviousTileState(t.props.tiles),t.stopDraggingTimeout=setTimeout((function(){t.setState({isDragging:!1})}),100)}catch(e){console.error(e)}})),yt(Tt(t),"updateTileLayout",(function(e){try{var n=t.props.tiles.map((function(t,n){return ct(ct({},t),e[n])}));t.props.onChange(n)}catch(e){console.error(e)}})),yt(Tt(t),"addTile",(function(){try{t.setPreviousTileState(t.props.tiles);var e=he(t.props.tiles),n=ve();e.push({key:n,i:n,w:6,h:5,x:6*Object.keys(e).length%12,y:1/0,query:"",title:""}),t.props.onChange(e)}catch(e){console.error(e)}})),yt(Tt(t),"undo",(function(){try{t.props.onChange(t.state.previousTileState),t.setState({previousTileState:t.props.tiles,justPerformedUndo:!0})}catch(e){console.error(e)}})),yt(Tt(t),"deleteTile",(function(e){try{t.setPreviousTileState(t.props.tiles);var n=he(t.props.tiles),a=n.map((function(e){return e.i})).indexOf(e);~a&&n.splice(a,1),t.props.onChange(n)}catch(e){console.error(e)}})),yt(Tt(t),"setParamsForTile",(function(e,n){try{t.setPreviousTileState(t.props.tiles);var a=he(t.props.tiles),r=a.map((function(e){return e.i})).indexOf(n);a[r]=ct(ct({},a[r]),e),Object.keys(e).includes("query")&&e.query!==t.props.tiles[r].query?(a[r].dataConfig=void 0,a[r].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==t.props.tiles[r].secondQuery&&(a[r].secondDataConfig=void 0,a[r].secondskipQueryValidation=!1),t.props.onChange(a)}catch(e){console.error(e)}})),yt(Tt(t),"runDrilldownFromAPI",(function(e,n){da(ct(ct({queryID:n,data:e},Ot(t.props.authentication)),Qt(t.props.autoQLConfig))).then((function(e){t._isMounted&&t.setState({activeDrilldownResponse:e,isDrilldownRunning:!1})})).catch((function(e){console.error(e),t._isMounted&&t.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0})}))})),yt(Tt(t),"onDrilldownStart",(function(e){var n=e.tileId,a=e.activeKey,r=e.isSecondHalf;Qt(t.props.autoQLConfig).enableDrilldowns&&(t.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:r,activeDrilldownTile:n||t.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:a,isAnimatingModal:!t.state.isDrilldownModalVisible}),t.animationTimeout=setTimeout((function(){t.setState({isAnimatingModal:!1})}),500))})),yt(Tt(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}))})),yt(Tt(t),"shouldShowOriginalQuery",(function(e){if(!e)return!1;var n=t.state.isDrilldownSecondHalf?e.secondDisplayType:e.displayType;return zt.includes(n)})),yt(Tt(t),"renderDrilldownTable",(function(){return l.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},t.state.isDrilldownRunning?l.createElement("div",{className:"dashboard-tile-loading-container"},l.createElement(Ea,null)):l.createElement(wr,{ref:function(e){return t.drilldownTableRef=e},displayType:"table",authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),dataFormatting:Ft(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}))})),yt(Tt(t),"renderChartCollapseBtn",(function(e){return l.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},l.createElement(er,{onClick:function(){t.setState({isDrilldownChartHidden:!t.state.isDrilldownChartHidden})},tooltip:t.state.isDrilldownChartHidden?"Show Chart":"Hide Chart"},l.createElement(ea,{type:"chart"}),l.createElement(ea,{type:t.state.isDrilldownChartHidden?"expand":"collapse"})))})),yt(Tt(t),"renderDrilldownModal",(function(){try{var e,n,a,r,o=t.props.tiles.find((function(e){return e.i===t.state.activeDrilldownTile}));return o&&t.state.isDrilldownSecondHalf?(e=o.secondQuery,n=o.secondQueryResponse||o.queryResponse,a=o.secondDisplayType,r=o.secondDataConfig):o&&!t.state.isDrilldownSecondHalf&&(e=o.title||o.query,n=o.queryResponse,a=o.displayType,r=o.dataConfig),l.createElement(Rr,{themeConfig:Ht(t.props.themeConfig),className:"dashboard-drilldown-modal",title:e,isVisible:t.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,onClose:function(){t.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})}},t.state.isDrilldownModalVisible&&l.createElement(c,null,o&&t.shouldShowOriginalQuery(o)&&!t.state.isDrilldownChartHidden&&l.createElement(at,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:t.state.isDrilldownChartHidden?0:35,onDragEnd:function(){t.setState({})}},l.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},!t.state.isDrilldownChartHidden&&l.createElement(wr,{authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),dataFormatting:Ft(t.props.dataFormatting),queryResponse:he(n),displayType:a,tableConfig:he(r),onUpdate:t.rebuildTooltips,isAnimatingContainer:t.state.isAnimatingModal,autoChartAggregations:t.props.autoChartAggregations,onDrilldownStart:function(e){return t.onDrilldownStart({tileId:o.i,activeKey:e})},onDrilldownEnd:t.onDrilldownEnd,activeChartElementKey:t.state.activeDrilldownChartElementKey,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-primary")}),t.renderChartCollapseBtn("bottom")),t.renderDrilldownTable()),t.shouldShowOriginalQuery(o)&&t.state.isDrilldownChartHidden&&t.renderChartCollapseBtn("top"),(!t.shouldShowOriginalQuery(o)||t.shouldShowOriginalQuery(o)&&t.state.isDrilldownChartHidden)&&t.renderDrilldownTable()))}catch(e){console.error(e),t.props.onErrorCallback(e)}})),yt(Tt(t),"renderEmptyDashboardMessage",(function(){return t.props.isEditable&&!t.props.isEditing?l.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",l.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.props.startEditingCallback()}},"New Dashboard")):t.props.isEditing?l.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",l.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){t.addTile()}},"New Tile")," ","to get started"):l.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),yt(Tt(t),"renderTiles",(function(){var e=t.props.tiles.map((function(e){return ct(ct({},e),{},{i:e.key,maxH:12,minH:2,minW:3})}));return l.createElement(zo,{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 l.createElement(Bo,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(n){return t.tileRefs[e.key]=n},key:e.key,authentication:Ot(t.props.authentication),autoQLConfig:Qt(t.props.autoQLConfig),themeConfig:Ht(t.props.themeConfig),tile:ct(ct({},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:Ft(t.props.dataFormatting),notExecutedText:t.props.notExecutedText,enableDynamicCharting:t.props.enableDynamicCharting,onErrorCallback:t.props.onErrorCallback,onSuccessCallback:t.props.onSuccessCallback,autoChartAggregations:t.props.autoChartAggregations,onQueryOutputUpdate:t.rebuildTooltips,onDrilldownStart:t.onDrilldownStart,onDrilldownEnd:t.onDrilldownEnd,onCSVDownloadStart:t.props.onCSVDownloadStart,onCSVDownloadProgress:t.props.onCSVDownloadProgress,onCSVDownloadFinish:t.props.onCSVDownloadFinish})})))})),yt(Tt(t),"render",(function(){return l.createElement(At,null,l.createElement(c,null,l.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"},t.props.tiles.length?t.renderTiles():t.renderEmptyDashboardMessage()),!t.state.isDragging&&t.renderDrilldownModal(),l.createElement(fe,{className:"react-autoql-dashboard-tooltip",id:"react-autoql-dashboard-toolbar-btn-tooltip",effect:"solid",delayShow:500,html:!0}),l.createElement(fe,{place:"left",className:"react-autoql-chart-tooltip",id:"dashboard-data-limit-warning-tooltip",effect:"solid",html:!0})))})),t}return ht(a)}();yt(jo,"propTypes",{authentication:Nt,autoQLConfig:Vt,dataFormatting:Rt,themeConfig:Mt,tiles:p.arrayOf(p.shape({})),executeOnMount:p.bool,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}),yt(jo,"defaultProps",{authentication:It,autoQLConfig:Lt,dataFormatting:qt,themeConfig:Pt,tiles:[],executeOnMount:!0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Ko=function(e){Ct(n,l.Component);var t=xt(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),o=0;o<a;o++)r[o]=arguments[o];return yt(Tt(e=t.call.apply(t,[this].concat(r))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),yt(Tt(e),"componentDidMount",(function(){An(Ht(e.props.themeConfig))})),yt(Tt(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)})),yt(Tt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=it(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:st,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),yt(Tt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),yt(Tt(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)}}))})),yt(Tt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),yt(Tt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),yt(Tt(e),"onMouseDown",(function(){fe.hide(),e.startRecording()})),yt(Tt(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 r={headers:{Authorization:"Bearer ".concat(e.props.authentication.token)},timeout:3e4};s.post(n,a,r).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})}))}))})),yt(Tt(e),"render",(function(){return l.createElement(At,null,l.createElement(Ee,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return l.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},l.createElement(ea,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},l.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},l.createElement(ea,{type:"microphone"}))),l.createElement(fe,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return ht(n)}();yt(Ko,"propTypes",{authentication:Nt,themeConfig:Mt,transcript:p.string,interimTranscript:p.string,finalTranscript:p.string,resetTranscript:p.func,onTranscriptChange:p.func,onFinalTranscript:p.func}),yt(Ko,"defaultProps",{authentication:It,themeConfig:Pt});export{jo as Dashboard,Bo as DashboardTile,ho as DataAlertModal,bo as DataAlerts,Oo as DataMessenger,xo as ExpressionBuilder,ro as ExpressionBuilderSimple,qo as FilterLockPopover,ea as Icon,Ea as LoadingDots,vo as NotificationFeed,$r as NotificationIcon,oo as NotificationItem,Ta as QueryInput,wr as QueryOutput,xr as ReverseTranslation,go as ScheduleBuilder,Ko as SpeechToTextButton,ba as SpeechToTextButtonBrowser,Uo as executeDashboard,ya as fetchQueryTips,Tn as getDefaultDisplayType,bn as getSupportedDisplayTypes,En as isDisplayTypeValid,_o as unExecuteDashboard};