@vizzly/dashboard 0.14.4-dev-d22768211be671a682866e999fa2312d5e7b3c29 → 0.14.4-dev-bda9b30d35806a81e2a92a4fdf7923c7412a4885

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.
package/dist/index.js CHANGED
@@ -1 +1,8 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),i=e(require("lodash/isEmpty")),r=require("lodash"),o=e(r),a=require("@vizzly/semantic-layer-public"),l=require("uuid"),s=e(require("@vizzly/joi")),u=e(require("moment-timezone")),d=require("@vizzly/sqlbuilder-public"),c=require("@emotion/react"),p=require("@emotion/react/jsx-runtime"),f=e(require("chroma-js")),m=require("@emotion/css"),h=e(require("@emotion/cache")),v=require("react-dom"),g=e(v),x=e(require("fuse.js")),b=require("@heroicons/react/solid"),y=require("@heroicons/react/outline"),w=e(require("moment")),C=require("react-popper");require("react-dates-17/initialize");var j=require("react-dates-17"),F=require("react-dnd"),S=require("@vizzly/dnd-backend"),k=require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge"),A=e(require("tiny-invariant")),T=require("@atlaskit/pragmatic-drag-and-drop/combine"),_=require("@atlaskit/pragmatic-drag-and-drop/element/adapter"),I=require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview"),D=require("@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source"),O=require("@atlaskit/pragmatic-drag-and-drop/external/adapter"),E=require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box"),L=require("@visx/responsive"),N=require("@visx/xychart"),M=require("@visx/gradient"),R=require("@visx/legend"),P=require("@visx/scale"),z=e(require("@visx/legend/lib/legends/Ordinal")),V=require("@visx/curve"),q=require("@visx/shape"),B=require("@visx/geo"),W=require("topojson-client"),H=e(require("@visx/responsive/lib/components/ParentSize")),Y=require("@visx/zoom"),G=e(require("cross-fetch")),U=require("@visx/tooltip"),K=require("@visx/group"),X=e(require("@visx/shape/lib/shapes/Pie")),Q=require("@react-spring/web"),Z=require("@react-hook/window-size"),J=e(require("copy-to-clipboard")),$=e(require("html2canvas")),ee=e(require("jspdf")),te=require("@visx/text"),ne=require("@visx/axis"),ie=require("@visx/grid"),re=require("@visx/clip-path"),oe=require("@visx/event"),ae=require("@visx/vendor/d3-array"),le=e(require("react-visibility-sensor")),se=e(require("exceljs")),ue=require("file-saver"),de=require("@vizzly/api-client"),ce=e(require("lodash/throttle"));function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function fe(e,t,n,i,r,o,a){try{var l=e[o](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,r)}function me(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function a(e){fe(o,i,r,a,l,"next",e)}function l(e){fe(o,i,r,a,l,"throw",e)}a(void 0)}))}}function he(e,t,n){if(ye())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var r=new(e.bind.apply(e,i));return n&&je(r,n.prototype),r}function ve(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return pe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ge(){return(ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(null,arguments)}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function be(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,je(e,t)}function ye(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ye=function(){return!!e})()}function we(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}function Ce(){Ce=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),a=new _(i||[]);return r(o,"_invoke",{value:S(e,n,a)}),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="executing",m="completed",h={};function v(){}function g(){}function x(){}var b={};u(b,a,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(I([])));w&&w!==n&&i.call(w,a)&&(b=w);var C=x.prototype=v.prototype=Object.create(b);function j(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function F(e,t){function n(r,o,a,l){var s=c(e[r],e,o);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==typeof d&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(s.arg)}var o;r(this,"_invoke",{value:function(e,i){function r(){return new t((function(t,r){n(e,i,t,r)}))}return o=o?o.then(r,r):r()}})}function S(t,n,i){var r=p;return function(o,a){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===o)throw a;return{value:e,done:!0}}for(i.method=o,i.arg=a;;){var l=i.delegate;if(l){var s=k(l,i);if(s){if(s===h)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===p)throw r=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=f;var u=c(t,n,i);if("normal"===u.type){if(r=i.done?m:"suspendedYield",u.arg===h)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(r=m,i.method="throw",i.arg=u.arg)}}}function k(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),h;var o=c(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,h):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function A(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 T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=x,r(C,"constructor",{value:x,configurable:!0}),r(x,"constructor",{value:g,configurable:!0}),g.displayName=u(x,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,u(e,s,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},j(F.prototype),u(F.prototype,l,(function(){return this})),t.AsyncIterator=F,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var a=new F(d(e,n,i,r),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},j(C),u(C,s,"Generator"),u(C,a,(function(){return this})),u(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=I,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(i,r){return l.type="throw",l.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.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 a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},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),h},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),T(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;T(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:I(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),h}},t}function je(e,t){return(je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Fe(e){var t="function"==typeof Map?new Map:void 0;return(Fe=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return he(e,arguments,xe(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),je(n,e)})(e)}var Se={FIRST_ROW:0,SECOND_ROW:1,THIRD_ROW:2,FOURTH_ROW:3,FIFTH_ROW:4,FIRST_CELL:0,SECOND_CELL:1,THIRD_CELL:2,FOURTH_CELL:3,FIFTH_CELL:4},ke=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={error:void 0,tryCount:0},n}be(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}};var n=t.prototype;return n.componentDidCatch=function(e,t){var n,i;console.log("Attempt "+this.state.tryCount,e,t),(null==(n=this.props)?void 0:n.onError)&&(null==(i=this.props)||i.onError(e,t)),this.setState({error:e,tryCount:this.state.tryCount+1})},n.render=function(){var e=this;return this.state.tryCount>1?this.props.renderOnError((function(){return e.setState({tryCount:0})}),this.state.error):this.props.children},t}(n.Component),Ae=a.QueryEngineConfig.Constants.supportedOperatorsConstants,Te=function(e,t){return[].concat(Object.keys(t.supportedOperators)).filter((function(t){return Ie[t].validDataTypes.includes(e.dataType)}))},_e=function(e,t){return"countDistinct"==e?t("count_distinct","Count distinct"):r.capitalize(e)},Ie=Ae,De=function(e){return e.map((function(e){return e.map((function(e){return"is_one_of"!=e.op&&"is_not_one_of"!=e.op||r.isArray(e.value)?e:ge({},e,{value:[e.value]})}))}))},Oe=function(e,t){return e.map((function(e){var n=ge({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete n.aggregate,t&&n.field==t.field&&"none"==n.function&&(n.function=t.truncate),n}))},Ee=function(e){return e.map((function(e){var t=ge({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t}))},Le=function(e){return"auto"===e||0===e||2===e?e:"auto"},Ne=function(e){if(!e)return{};var t={};return e.measure&&Object.entries(e.measure).forEach((function(e){t&&(t[e[0]]=Ee(e[1]))})),{measure:r.isEmpty(t)?void 0:t,group:e.group}},Me=a.QueryEngineConfig.Constants.supportedAggregatesConstants;function Re(e,t,n){if(void 0===t&&(t=!0),0==e.length)return"";if(1==e.length)return t?"'"+e[0]+"'":""+e[0];var i=[].concat(e),r=i.pop();return i.map((function(e){return t?"'"+e+"'":""+e})).join(", ")+" "+(n?n("list_of_values_and","and"):"and")+" "+(t?"'"+r+"'":""+r)}var Pe,ze,Ve,qe=function(e){for(var t=0,n=0;n<e.length;n++)t+=e.charCodeAt(n);return t},Be=function(e,t,n){var i=r.replace(e,t,n);return i.indexOf(t)>=0?Be(i,t,n):i},We=["debug","info","warning","error","properties"],He="error",Ye=function(e,t){return He=e,t&&t(He),{logDebug:Ke,logError:Je,logInfo:Xe,logWarning:Ze,logProperties:Qe,getCurrentLogLevel:function(){return He},updateLogLevel:function(e){We.includes(e)?He=e:Ze("Invalid log level: "+e)}}},Ge=function(e){return We.findIndex((function(e){return He==e}))<=We.findIndex((function(t){return e==t}))},Ue=function(e){return e instanceof Error?e:r.isObject(e)||r.isArray(e)?JSON.stringify(e):e},Ke=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];Ge("debug")&&(e=console).info.apply(e,["[VIZZLY DEBUG]"].concat(n.map(Ue)))},Xe=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];Ge("info")&&(e=console).info.apply(e,["[VIZZLY INFO]"].concat(n.map(Ue)))},Qe=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Ge("properties")&&console.info("[VIZZLY Dashboard Properties]",t)},Ze=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];Ge("warning")&&(e=console).warn.apply(e,["[VIZZLY WARNING]"].concat(n.map(Ue)))},Je=function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];Ge("error")&&(e=console).error.apply(e,["[VIZZLY ERROR]"].concat(n.map(Ue)))},$e=function(e){return(t=Be(e,"_"," ")).charAt(0).toUpperCase()+t.slice(1);var t},et=function(e,t,n){return void 0===n&&(n="No value"),null===e||"No value"===e||r.isNumber(e)&&isNaN(e)?n:e instanceof Date&&t?t(e):!0===e?"True":!1===e?"False":r.isNumber(e)&&e%1!=0?e.toFixed(2):Array.isArray(e)?e.join(", "):""+e},tt=function(e,t){return void 0===t&&(t="No value"),null===e?t:e instanceof Date?e.toISOString():e},nt=function(e,t){return it(e,t)[0]},it=function(e,t){var n,i=null!=(n=e.supportedAggregateOptions)?n:[],r=i.filter((function(n){return Object.keys(t).includes(n)&&t[n].validDataTypes.includes(e.dataType)}));return 0===r.length?r=Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)})):r.sort((function(e,t){return i.indexOf(e)-i.indexOf(t)})),r},rt=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},ot=function(e,t){var n=e.split("_"),i=n.pop();return[void 0].concat(Object.keys(t.supportedAggregates||{}),Object.keys(t.supportedTimeTruncFunctions||{}),Object.keys(t.supportedTransformationFunctions||{})).includes(i)?{field:n.join("_"),function:null!=i?i:""}:{field:e,function:"none"}},at=function(e,t){var n=ot(e,t);return{fieldId:n.field,function:n.function}},lt=function(e,t){var n=new Set(t.map((function(e){return e.field})));return e.filter((function(e){return!n.has(e.id)}))},st=function(e){return e.map((function(e){return"string"==typeof e?{field:e,function:"none"}:e}))},ut=function(e){return"string[]"==e.dataType},dt=function(e,t,n){var i=e.supportedAggregates,r=Object.keys(i).filter((function(e){return i[e].validDataTypes.includes(t)}));null==n||n.forEach((function(e){i.hasOwnProperty(e)||Ze("Unsupported aggregate option: "+e+" on "+t)}));var o=n&&n.length>0?n.filter((function(e){return r.includes(e)})):r;return n&&n.length>0&&0===o.length&&(o=r),o},ct=function(e,t,n,i,r,o){var a;if(n?a=n.field:t&&t.length>0&&t[0].field&&(a=t[0].field),i&&a){var l=i({dataSetId:e,fieldId:a});if(l)return l}return r?r(o||"no_value","No value"):void 0},pt=function(e){var t=e.nullValueAlias,n=e.textOverride,i=e.textOverrideKey;return t?t({dataSetId:e.dataSetId,fieldId:e.fieldId})||"No value":n?n(i||"no_value","No value"):void 0},ft=a.QueryEngineConfig.Constants.timeDimensionsConstants,mt=function(e){return null!=e&&e.truncate&&"none"!=(null==e?void 0:e.truncate)?e.field+"_"+e.truncate:null==e?void 0:e.field},ht=function(e,t){var n=e.split("_"),i=n.pop();return i&&!gt(t,i)?null:{field:n.join("_"),truncate:null!=i?i:""}},vt=ft,gt=function(e,t){return[].concat(Object.keys(e),["none"]).includes(t)},xt=function(e,t){var n=e.length>0&&e[0]?e:[[]],i=t.length>0&&t[0]?t:[[]];return n.length>1?n.map((function(e){return[].concat(i[0]||[],e||[])})):i.length>1?i.map((function(e){return[].concat(n[0]||[],e||[])})):[[].concat(n[0]||[],i[0]||[])]},bt=function(){return l.v4().replace(/-/g,"")},yt=function(e){return{minutes:{description:e?e("duration_option.minutes","Minutes"):"Minutes",formatter:function(e,t){e.setMinutes(e.getMinutes()+t)}},hours:{description:e?e("duration_option.minutes","Hours"):"Hours",formatter:function(e,t){e.setHours(e.getHours()+t)}},days:{description:e?e("duration_option.minutes","Days"):"Days",formatter:function(e,t){e.setDate(e.getDate()+t)}},weeks:{description:e?e("duration_option.minutes","Weeks"):"Weeks",formatter:function(e,t){e.setDate(e.getDate()+7*t)}},months:{description:e?e("duration_option.minutes","Months"):"Months",formatter:function(e,t){e.setMonth(e.getMonth()+t)}},years:{description:e?e("duration_option.minutes","Years"):"Years",formatter:function(e,t){e.setFullYear(e.getFullYear()+t)}}}},wt=function(e){return{future:{description:e?e("timeframe_option.minutes","Future"):"Future"},past:{description:e?e("timeframe_option.past","Past"):"Past"}}},Ct=s.object({unit:(Pe=s.string()).valid.apply(Pe,(Ve=yt(),Object.keys(Ve))).required(),value:s.number().integer().required(),timeFrame:(ze=s.string()).valid.apply(ze,function(){var e=wt();return Object.keys(e)}()).required()});function jt(e){return e&&"object"==typeof e&&"unit"in e&&"value"in e&&"timeFrame"in e}function Ft(e){return!Ct.validate(e).error}var St=function(e,t){var n=t?new Date(t):new Date;if(!e.value||null===e.unit)throw new Error("Unrecognized value: "+e.value);var i="future"===e.timeFrame?e.value:-e.value;return yt()[e.unit].formatter(n,i),n},kt=function(e){return null!==e?u(new Date(e)).tz(Intl.DateTimeFormat().resolvedOptions().timeZone)._d:e},At=function(e,t,n){return t.appliesToFields.flatMap((function(i){var r,o,a;if(i.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==Qo(e,i.fieldId).dataType&&"multiSelectFilter"!==t.type&&!kn(t.value))return[{field:i.fieldId,op:"array_contains",value:t.value}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"relativeRange"==(null==(r=t.value)?void 0:r.type))return[];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"fixedRange"==(null==(o=t.value)?void 0:o.type))return[{field:i.fieldId,op:qt(Vt.Greater,t),value:kt(t.value.after)},{field:i.fieldId,op:qt(Vt.Less,t),value:kt(t.value.before)}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"relative"==(null==(a=t.value)?void 0:a.type)){var l=n[t.value.value].range,s=l.before,u=l.after,d=[];return s&&(d=[].concat(d,[{field:i.fieldId,op:qt(Vt.Less,t),value:s}])),u&&(d=[].concat(d,[{field:i.fieldId,op:qt(Vt.Greater,t),value:u}])),d}if("singleSelectFilter"==t.type){var c=t.value;return t.value===_t&&(c=null),[{field:i.fieldId,op:"=",value:c}]}if(kn(t.value))return Ht(t.value,i,e.id);if("multiSelectFilter"==t.type&&t.value.length>0)return[{field:i.fieldId,op:"is_one_of",value:t.value}];if("dateFilter"==t.type&&!t.value||"dateAndTimeFilter"==t.type&&!t.value||"multiSelectFilter"==t.type&&0===t.value.length)return[];if("numericFilter"==t.type)return"op"in t.value&&"value"in t.value?[{field:i.fieldId,op:t.value.op,value:t.value.value}]:[];throw"Cannot convert filter type "+t.type+" to query attributes filter. "+JSON.stringify(t)}))},Tt=function(e,t){if("dateFilter"==e)return t("date_filter","Date filter");if("dateAndTimeFilter"==e)return t("date_time_filter","Date Time filter");if("singleSelectFilter"==e)return t("single_select_filter","Single select filter");if("multiSelectFilter"==e)return t("multi_select_filter","Multi select filter");if("advancedFilter"==e)return t("advanced_filter","Advanced filter");if("numericFilter"==e)return t("numeric_filter","Number comparison filter");throw"Unrecognised additional filter type "+e},_t="__vizzly_null_value_option";function It(e){return"dateAndTimeFilter"===e.type&&(e=ge({},e,{type:"dateFilter",allowTimeSelection:!0})),e}function Dt(e,t){return[].concat(e||[]).map((function(e){return 0===e.appliesToFields.length?null:Et(e,t)})).filter((function(e){return null!==e}))}var Ot=function(e){return ge({},e,{managedByConfiguration:!1})},Et=function(e){return"fields"in e?function(e){if("globalSelectFilter"==e.type)return{type:"singleSelectFilter",title:e.title,value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};if("globalDateTimeFilter"==e.type)return{type:"dateFilter",value:null,requiresValue:!1,managedByConfiguration:!1,title:e.title,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};throw"Unrecognised global filter. "+JSON.stringify(e)}(e):ge({},e=It(e),{type:Pt(e.type),value:zt(e.value,e.type,e.appliesToFields)})},Lt=function(e,t,n){var i;if("relativeRange"!==(null==(i=e.value)?void 0:i.type))return[];if(0===e.value.filters.length)return[];var r=[];return function(e,t,n){if(!n)throw new Error("appliesToFields is required");return e.map((function(e){var i=e.map((function(e){return{op:e.op,value:ge({},e.value)}})),r=[];return n.forEach((function(e){e.dataSetId==t.id&&i.forEach((function(t){r.push(ge({},t,{field:e.fieldId}))}))})),r}))}(e.value.filters,t,e.appliesToFields)[0].forEach((function(e){r.push({field:e.field,op:e.op,value:St(e.value,n)})})),r},Nt=function(e,t,n){if(e.title)return e.title;var i=n?n("untitled","Untitled"):"Untitled";return t.forEach((function(t){try{var n=e.appliesToFields[0],r=Qo(t,n.fieldId);t.id==n.dataSetId&&n.fieldId==r.id&&(i=r.publicName)}catch(e){}})),i},Mt=function(e){return r.isArray(e)?r.every(e,Mt):!e.requiresValue||!(!e.requiresValue||!e.value)},Rt=function(e,t){return[].concat(e).find((function(e){var n,i,o=e.type==t.type,a=(null==(n=e.appliesToFields)?void 0:n.length)==(null==(i=t.appliesToFields)?void 0:i.length),l=r.every(t.appliesToFields,(function(t){return r.some(e.appliesToFields,(function(e){return e.fieldId==t.fieldId&&e.dataSetId==t.dataSetId}))}));return o&&a&&l}))},Pt=function(e){return"dateTimeFilter"===e?"dateFilter":"numericFilter"===e||"multiSelectFilter"===e?"advancedFilter":e},zt=function(e,t,n){if(null==e)return null;if(kn(e))return e;if("numericFilter"===t){var i=e;return[n.map((function(e){return{field:e.fieldId,op:i.op,value:i.value}}))]}return"multiSelectFilter"===t?[n.map((function(t){return{field:t.fieldId,op:"is_one_of",value:e}}))]:e},Vt=function(e){return e[e.Greater=0]="Greater",e[e.Less=1]="Less",e}({});function qt(e,t){switch(e){case Vt.Greater:return t.inclusiveDate?">=":">";case Vt.Less:return t.inclusiveDate?"<=":"<";default:throw new Error("Unknown date operation")}}function Bt(e,t,n,i){if(i){var r=e.reduce((function(e,i){if(null!==i.value){if(Array.isArray(i.value)&&0===i.value.length)return e;i.appliesToFields.forEach((function(r){var o=r.dataSetId,a=Ko(t,o);e[o]||(e[o]=[]),null!==a&&(e[o]=[].concat(e[o],At(a,i,n)))}))}return e}),{});return 0===Object.keys(r).length?void 0:r}}var Wt=function(e){return"optionsPulledFrom"in e&&e.optionsPulledFrom&&0!==e.optionsPulledFrom.length?ge({},e,{appliesToFields:[].concat(e.optionsPulledFrom)}):e},Ht=function(e,t,n){if(!e)return[];if(Array.isArray(e)&&Array.isArray(e[0])){if(0===(e=e.filter((function(e){return!e.some((function(e){return Array.isArray(e.value)&&0===e.value.length||void 0===e.value}))}))).length)return[];if(t.dataSetId!==n)return[];var i=e[0].filter((function(e){return e.field===t.fieldId}));return i.length>0?i:[]}return[]},Yt=function(e,t,n){var i=[];return(e.globalFilters||[]).forEach((function(e){var r=[];"dateAndTimeFilter"!==e.type&&"dateFilter"!==e.type||(r=Lt(e,t)),i=[].concat(i,r,At(t,e,n))})),Object.values(e.localFilters||{}).flat().forEach((function(e){var r=[];"dateAndTimeFilter"!==e.type&&"dateFilter"!==e.type||(r=Lt(e,t)),i=[].concat(i,r,At(t,e,n))})),i},Gt=function(e,t){return t.length>0&&t[0].length>0?{type:"function",function:e.aggregate,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:t},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}:{type:"field",function:e.aggregate,value:e.fieldId}},Ut=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ValidationError",n}return be(t,e),t}(Fe(Error)),Kt=function(e){function t(t,n){var i;return(i=e.call(this,"\n An expected variable is missing from the defined Variables.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify(t)+"\n ")||this).missingVariableId=void 0,i.name="VariableNotFoundForVariables",i.missingVariableId=n,i}return be(t,e),t.prototype.getMissingFieldId=function(){return this.missingVariableId},t}(Ut),Xt=function(e){for(var t,n=/\{\{\s*([^\s{}][^{}]*?)\s*\}\}/g,i=[];null!==(t=n.exec(e));)i.push(t[1].trim());return i.length>0?i:void 0},Qt=function(e){if(e){var t=e();return Xe("Detected variables",t),t}return{}},Zt=function(e,t,n){if(n){var i=t(e);if(i&&0!==i.length){for(var r,o=[],a=ve(i);!(r=a()).done;){var l=r.value,s=n[l];if(s){if(void 0===s.value||""===s.value)throw new Error("Variable '"+l+"' is defined in the list but has no value.");o.push(l)}}if(0===o.length&&e)throw new Kt(n,e);return o.length>0?o:void 0}}},Jt=function(e,t){if("string"==typeof e){var n=Xt(e);if(n&&t)for(var i,r=ve(n);!(i=r()).done;){var o=i.value;if(o in t)return $t(t,o)}}return e};function $t(e,t){return e[t].value}var en=function(e,t,n){if(Zo(t,e))return{type:"field",value:e,function:"none"};var i=e;Xt(e)&&(i=Jt(e,n));var r=Number(i);if(isNaN(r)){var o="Invalid number for Maths field: "+e+".";Xt(e)&&(o="Invalid number for Maths field from variable: "+e+"."),Je(o)}return{type:"number",value:r}},tn=function(e,t,n,i){return e.map((function(e){return{returns:{type:"string",value:e.name},filter:Fn(e.rule,t,n,i)}}))},nn=function(e){return e.Operator="operator",e.IfLogic="ifLogic",e.NumberInput="number",e.Variable="variable",e.Field="field",e}({}),rn=function(e){return e.Divide="/",e.Multiply="*",e.Subtract="-",e.Add="+",e}({}),on=function(e,t,n,i){var r=e.values,o=r[0],a=r[1],l=r.slice(2),s=an(o,t,n),u=an(a,t,n);return l.length>0&&(u=l.reduce((function(i,r){return{type:"maths",op:e.op,left:i,right:an(r,t,n)}}),u)),i&&"none"!=i.function?{type:"function",function:i.function,value:{type:"maths",op:e.op,left:s,right:u}}:{type:"maths",op:e.op,left:s,right:u}},an=function(e,t,n){if(!e)throw new Error("Invalid metric: undefined metric received");switch(e.type){case nn.NumberInput:return sn(e);case nn.Variable:return ln(e,n.variables);case nn.Operator:return on(e,t,n);case nn.Field:return un(e);default:throw new Error("Unsupported metric type: "+e.type)}},ln=function(e,t){var n=$t(t,e.value),i=Number(n);if(isNaN(i)){var r="Invalid number for Maths field: "+e.value+".";Xt(e.value)&&(r="Invalid number for Maths field from variable: "+e.value+"."),Je(r)}return{type:"number",value:i}},sn=function(e){var t=Number(e.value);return isNaN(t)&&Je("Invalid number for Maths field: "+JSON.stringify(e)+"."),{type:"number",value:t}},un=function(e){return{type:"field",value:e.fieldId,function:"none"}},dn=function(e){return"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e},cn=function(e){return"roundToDecimalPlaces"in e},pn=function(e){return"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e},fn=function(e){return"denominatorFieldId"in e||"numeratorFieldId"in e},mn=function(e){return"rules"in e},hn=function(e){return"rule"in e},vn=function(e){return"metric"in e},gn=function(e){return"dateCalculationFunction"in e},xn=function(e){if(fn(e))return"percentage";if(dn(e))return"math";if(pn(e))return"math";if(mn(e))return"rules";if(cn(e))return"roundedNumber";if(gn(e))return"dateCalculation";if(hn(e))return"conditional";if(vn(e))return"calculatedField";throw"Unrecognised custom field type for custom field; "+JSON.stringify(e)},bn=function(e){return fn(e)||dn(e)||pn(e)||mn(e)||cn(e)||gn(e)||hn(e)||vn(e)},yn=function(e,t,n,i,r,o){if(fn(t))return function(e,t,n,i,r){var o,a,l,s,u,d,c=Yt(r.filterConfig,n,r.timeRangeOptions),p=function(e,t){var n=[],i=[];return t.numeratorFilter&&Sn(t.numeratorFilter)?t.numeratorFilter.forEach((function(t){n=[].concat(n,jn(null!=e?e:[],t))})):n=null!=e?e:[],t.denominatorFilter&&Sn(t.denominatorFilter)?t.denominatorFilter.forEach((function(t){i=[].concat(i,jn(null!=e?e:[],t))})):i=null!=e?e:[],{combinedNominatorFilters:n,combinedDenominatorFilters:i}}(jn(null!=(o=null==r||null==(a=r.filterConfig)?void 0:a.advancedFilter)?o:[],c),e),f=p.combinedNominatorFilters,m=p.combinedDenominatorFilters,h={fieldId:null!=(l=e.numeratorFieldId)?l:e.denominatorFieldId,aggregate:null!=(s=e.numeratorAggregate)?s:e.denominatorAggregate},v={fieldId:null!=(u=e.denominatorFieldId)?u:e.numeratorFieldId,aggregate:null!=(d=e.denominatorAggregate)?d:e.numeratorFieldId},g={type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Fn(m||[],t,n,r)}},x=Gt(v,Sn(e.denominatorFilter)?Fn(m,t,n,r):[]);return{type:"maths",left:Gt(h,Sn(e.numeratorFilter)?Fn(f,t,n,r):[]),op:"/",right:"withinGrouping"===e.denominatorScope?x:g}}(t,n,i,0,o);if(mn(t))return function(e,t,n,i,r){var o={type:"switchField",value:{cases:tn(t.rules,n,i,r)}};return"none"==e.function?o:{type:"function",function:e.function,value:o}}(e,t,n,i,o);if(pn(t))return function(e){var t=function(e,t,n){return n?{type:"maths",left:{type:"field",value:e,function:t},right:{type:"field",value:n.fieldId,function:n.function},op:n.operator}:{type:"field",value:e,function:t}};return{type:"maths",left:t(e.leftFieldId,e.leftFunction,e.leftNested),right:t(e.rightFieldId,e.rightFunction,e.rightNested),op:e.operator}}(t);if(dn(t))return function(e,t,n,i){return"none"!=e.function?{type:"function",function:e.function,value:{type:"maths",left:en(t.leftFieldId,n,i.variables),right:en(t.rightFieldId,n,i.variables),op:t.operator}}:{type:"maths",left:en(t.leftFieldId,n,i.variables),right:en(t.rightFieldId,n,i.variables),op:t.operator}}(e,t,i,o);if(cn(t))return function(e,t){var n={type:"field",function:"round_to_"+t.roundToDecimalPlaces+"_dp",value:t.fieldId};return"none"==e.function?n:{type:"function",function:e.function,value:n}}(e,t);if(hn(t))return function(e,t,n,i){return{type:"function",function:e.function,value:{type:"switchField",value:{cases:[{returns:{type:"field",function:"none",value:e.fieldId},filter:Fn(e.rule,t,n,i)},{returns:{type:"null"},filter:[[{value:1,op:"=",field:{type:"number",value:1}}]]}]}}}}(t,n,i,o);if(gn(t))return function(e,t){return"none"!=e.function?{type:"function",function:e.function,value:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}}}:{type:"date_maths",op:t.dateCalculationFunction,left:{type:"field",function:"none",value:t.leftFieldId},right:{type:"field",function:"none",value:t.rightFieldId}}}(e,t);if(vn(t))return function(e,t,n,i,r){return t.metric.type===nn.IfLogic?function(e,t,n,i,r,o){var a=[[{value:1,op:"=",field:{type:"number",value:1}}]],l=function(){var o=e.cases.map((function(e){var o,a,l=function(e,t){var n=[];return t&&Sn(t)?t.forEach((function(t){n=[].concat(n,jn(null!=e?e:[],t))})):n=null!=e?e:[],n}(jn(null!=(o=null==r||null==(a=r.filterConfig)?void 0:a.advancedFilter)?o:[],n),e.filter);return{returns:an(e.returns,t,r),filter:Fn(l,i,t,r)}}));if(!e.else)return[].concat(o,[{returns:{type:"null"},filter:a}]);var l={returns:an(e.else,t,r),filter:a};return[].concat(o,[l])}();if(null==o||!o.function||"none"===o.function)throw new Error("measure needs to be defined for if logic");return{type:"function",function:null==o?void 0:o.function,value:{type:"switchField",value:{cases:l}}}}(t.metric,n,Yt(r.filterConfig,n,r.timeRangeOptions),i,r,e):on(t.metric,n,r,e)}(e,t,i,n,o);throw"Unsupported custom field type; "+JSON.stringify(t)},wn=function(e){if("leftAggregate"in e||"rightAggregate"in e){var t=ge({},e,{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?ge({},e.leftNested,{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?ge({},e.rightNested,{aggregate:void 0,function:e.rightNested.function||e.rightNested.aggregate}):void 0});return delete t.leftAggregate,delete t.rightAggregate,t.rightNested&&delete t.rightNested.aggregate,t.leftNested&&delete t.leftNested.aggregate,t}if("numeratorFieldId"in e&&!("version"in e)){var n,i,r=[].concat((null==(n=e.numeratorFilter)?void 0:n[0])||[],(null==(i=e.denominatorFilter)?void 0:i[0])||[]);return ge({},e,{version:2,denominatorScope:e.denominatorScope||"all",denominatorFilter:(null==e?void 0:e.denominatorFilter)||[],numeratorFilter:r.length>0?[r]:[]})}return e},Cn=function(e){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e.value))return!1;var t=new Date(e.value);if(isNaN(t.getTime()))return!1;var n=e.value.split("T")[0].split("-").map(Number),i=n[0],r=n[1],o=n[2];return t.getUTCFullYear()===i&&t.getUTCMonth()+1===r&&t.getUTCDate()===o},jn=function(e,t){return e&&!r.isEmpty(e)||(e=[[]]),[].concat(e).map((function(e){return[].concat(e,t)}))},Fn=function(e,t,n,i){return e.map((function(e){return[].concat(e).flatMap((function(e){var r;if(e.function&&!gt(t.supportedTimeTruncFunctions,e.function))throw"Query engine does not support the query function "+e.function+".";var o,a=Qo(n,e.field),l={type:"field",value:e.field,function:null!=(r=e.function)?r:"none"};if(bn(a)&&(l=yn({field:a.id,function:null!=(o=e.function)?o:"none"},a,t,n,0,i)),("array_contains"==e.op||"array_does_not_contain"==e.op)&&Array.isArray(e.value))return[].concat(e.value).map((function(t){return{field:l,op:e.op,value:t}}));var s=Jt(e.value,i.variables);return Ft(e.value)&&(s=St(e.value)),Cn(e)&&(s=kt(e.value)),[{field:l,op:e.op,value:s}]}))}))},Sn=function(e){return e&&r.isArray(e)&&r.isArray(e[0])},kn=function(e){return e&&r.isArray(e)&&r.isArray(e[0])&&"field"in e[0][0]&&"op"in e[0][0]&&"value"in e[0][0]},An=function(){return s.array().items(s.object({key:s.string().required()})).min(0)},Tn=function(e,t){var n=function(e,t){return s.object({field:e.required(),function:t.required().description("Which if any, aggregate function should be applied to the field?")})};return null!=t&&t.restrictFields?s.alternatives.apply(s,t.restrictFields.filter((function(e){return e.canBeMeasure})).map((function(t){var i,r,o,a=(r=t,o=e,Object.keys(o).filter((function(e){return o[e].validDataTypes.includes(r.dataType)})));return n(s.string().valid(t.id).description(t.publicName+", "+(t.description||"")+"."),(i=s.string()).valid.apply(i,a.concat(["none"])))}))):n(s.string().description("The ID of the field from the data set to reference."),s.valid.apply(s,Object.keys(e).concat(["none"])))},_n=function(e){var t;return s.object({field:s.string().required().description("The ID of the field from the data set to reference."),direction:s.string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:(t=s.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which if any, function should be applied to the field?")})},In=function(e){return s.object({field:s.string().required().description("The ID of the field from the data set to reference."),truncate:s.valid.apply(s,Object.keys(e).concat(["none"])),bucketFill:s.boolean()})},Dn=function(e,t){var n=function(t,n){return s.object({field:t.required(),pivot:s.string().valid("x","y").optional(),function:n?s.valid.apply(s,Object.keys(e).concat(["none"])).required():s.valid("none").required()})};return null!=t&&t.restrictFields?s.array().items(s.alternatives.apply(s,t.restrictFields.filter((function(e){return e.canBeDimension})).map((function(e){return n(s.string().valid(e.id).description(e.publicName+", "+(e.description||"")+"."),"date_time"===e.dataType)})))).description("Fields to group the data by"):s.array().items(n(s.string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},On=function(e){var t,n;return s.object({field:s.string().required().description("The ID of the field from the data set to reference."),op:(t=s.string()).valid.apply(t,Object.keys(e.supportedOperators)).required(),value:s.alternatives().try(Zn,s.string().allow(null),s.number(),s.boolean(),s.array().items(s.string(),s.number(),s.allow(null)),Ct).required(),function:(n=s.string()).valid.apply(n,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])).description("Which function should be applied to the field?")})},En=function(e){return s.array().items(s.array().items(On(e)))},Ln=function(){return s.number().description("Limit the number of results returned after the query has been ran.")},Nn=function(e){var t,n=null!=e&&e.restrictDataSetIds?(t=s.string()).valid.apply(t,e.restrictDataSetIds):s.string();return{viewId:s.string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:s.string().allow("").description("A title that explains what is being displayed."),displaySubject:s.string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:n.description("The ID of the data set that is being used by the view."),protectedByOrganisation:s.boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},Mn=s.valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),Rn=function(e,t){return{measure:s.array().items(Tn(e.supportedAggregates,t)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:Dn(e.supportedTimeTruncFunctions,t).required(),order:s.array().items(_n(e)),limit:Ln(),offset:s.number().min(0).description("Paginate results by using this property with limit.")}},Pn=function(e,t){return ge({},Rn(e,t),{filter:s.array().items(s.array().items(On(e))),timeDimension:s.alternatives(In(e.supportedTimeTruncFunctions),s.valid(null)).required(),drilldown:s.alternatives(Dn(e.supportedTimeTruncFunctions,t).required(),s.string()),xAxisPrefix:s.string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:s.string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:s.string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:s.string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:s.alternatives(s.string(),s.valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:s.alternatives(s.string(),s.valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:Mn,approxXAxisLabelCount:Mn})},zn=s.string().valid("natural","straight","step","stepBefore","stepAfter","dotted"),Vn=function(e){var t;return s.array().items(s.object({function:(t=s.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),field:s.string().required().description("The ID of the field from the data set to reference.")}))},qn=function(e){var t;return s.array().items(s.object({function:(t=s.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"])),truncate:s.string(),field:s.string().required().description("The ID of the field from the data set to reference."),bucketFill:s.boolean().optional(),pivot:s.string().valid("x","y").optional()}))},Bn=function(e,t){return s.object().pattern(s.string(),s.alternatives().try(s.array().items(In(e.supportedTimeTruncFunctions)).min(1),Dn(e.supportedTimeTruncFunctions,t))).unknown(!0)},Wn=function(e,t){return s.object().pattern(s.string(),s.array().items(Tn(e.supportedAggregates,t)).min(1)).unknown(!0)},Hn=function(e,t){return s.object({measure:Wn(e,t),group:Bn(e,t)})},Yn=s.alternatives().try(s.number().required(),s.string().pattern(/^\{\{.*\}\}$/).required()),Gn=function(){return s.object({color:s.string().required(),value:Yn,strokeWidth:s.number().required(),strokeStyle:s.string().valid("dashed","solid").required(),label:s.boolean().optional()})},Un=function(){return s.array().items(Gn())},Kn=function(){return s.object({func:s.string().valid("mean","sum","current").allow(null).optional()})},Xn=function(){return s.object({x:s.string().allow(""),y:s.string().allow("")})},Qn=s.object().pattern(s.string(),s.object({width:s.number().min(0),height:s.number().min(0)})),Zn=s.custom((function(e,t){return"[object Date]"===Object.prototype.toString.call(e)?e:t.error("any.invalid")}),"Date object validation"),Jn=s.object({fieldId:s.string().required(),dataSetId:s.string().required()}),$n=function(e){return s.object().pattern(s.string(),s.array().items(On(e)).optional())},ei=function(e){return{title:s.string().allow(""),managedByConfiguration:s.boolean().optional(),requiresValue:s.boolean().optional(),optionsFilters:$n(e).optional(),appliesToFields:s.array().items(Jn).required(),optionsPulledFrom:s.array().items(Jn).optional(),hidden:s.boolean(),options:s.array().items(s.object({value:s.allow(s.number(),s.string()),label:s.string()})).optional()}},ti=function(e,t){return s.object(ge({},ei(e),{type:s.valid("singleSelectFilter").required(),value:s.alternatives(s.string(),s.number(),s.boolean(),s.valid.apply(s,t?[]:[null]))}))},ni=function(e,t){return s.object(ge({},ei(e),{type:s.valid("multiSelectFilter").required(),value:s.alternatives(s.array().items(s.string(),s.number()).single(),s.valid.apply(s,t?[]:[null]),s.array().items(s.array().items(On(e))))}))},ii=function(e,t){return s.object(ge({},ei(e),{type:s.valid("advancedFilter").required(),value:ri(e,t)}))},ri=function(e,t){return s.alternatives(s.valid.apply(s,t?[]:[null]),s.array().items(s.array().items(On(e))))},oi=function(e,t,n){return s.object(ge({},ei(e),{type:s.valid(n).required(),inclusiveDate:s.boolean().optional(),allowTimeSelection:s.boolean().optional(),value:s.alternatives(s.valid.apply(s,t?[]:[null]),s.object({type:s.valid("fixedRange"),before:s.alternatives(s.date()).required(),after:s.alternatives(s.date()).required()}),s.object({type:s.valid("relative"),value:s.string()}),s.object({type:s.valid("relativeRange"),filters:s.array()}))}))},ai=function(e,t){return s.object(ge({},ei(e),{type:s.valid("numericFilter").required(),value:s.alternatives(s.object({op:s.allow("=","<",">","<=",">="),value:s.number().allow(null,0)}),s.array().items(s.array().items(On(e))),s.valid.apply(s,t?[]:[null]))}))},li=function(e,t){return s.alternatives().conditional(".type",{is:"singleSelectFilter",then:ti(e,t)}).conditional(".type",{is:"dateFilter",then:oi(e,t,"dateFilter")}).conditional(".type",{is:"dateAndTimeFilter",then:oi(e,t,"dateAndTimeFilter")}).conditional(".type",{is:"multiSelectFilter",then:ni(e,t)}).conditional(".type",{is:"numericFilter",then:ai(e,t)}).conditional(".type",{is:"advancedFilter",then:ii(e,t)})};function si(e){return s.array().items(s.custom((function(t,n){if(!e)return n.error("any.invalid");var i=li(e,!!t.requiresValue).validate(t).error;return i?n.error("any.invalid",{message:i.message}):t}))).required()}var ui=function(e){return e.AND_WHERE="andWhere",e.OR_WHERE="orWhere",e.WHERE="where",e}({}),di=function(e,t,n){if(n){var i=n.filterConfig;if(n&&i&&(i.globalFilters&&0!==i.globalFilters.length||i.localFilters&&0!==i.localFilters.length||i.advancedFilter&&0!==i.advancedFilter.length&&!i.advancedFilter.every((function(e){return 0===e.length})))){var r=[ci(e,t,n,i.globalFilters),ci(e,t,n,i.localFilters),fi(e,t,n,i.advancedFilter)].filter(Boolean).filter((function(e){return e&&e.value.length>0}));if(0!==r.length)return{type:ui.AND_WHERE,value:r}}}},ci=function(e,t,n,i){if(i&&0!==i.length){var r=[];return i.forEach((function(i){"dateAndTimeFilter"!==i.type&&"dateFilter"!==i.type||Lt(i,e).forEach((function(i){r.push(pi(e,i,t,n))})),Array.isArray(i.value)&&i.value.length>1&&kn(i.value)?i.appliesToFields.flatMap((function(o){if(o.dataSetId!=e.id)return[];var a=fi(e,t,n,i.value);a&&r.push(a)})):At(e,i,n.timeRangeOptions).forEach((function(i){r.push(pi(e,i,t,n))}))})),{type:ui.AND_WHERE,value:r}}},pi=function(e,t,n,i){var r;if(t.function&&!gt(n.supportedTimeTruncFunctions,t.function))throw"Query engine does not support the query function "+t.function+".";var o=Qo(e,t.field);if(bn(o)){var a;r=yn({field:o.id,function:null!=(a=t.function)?a:"none"},o,n,e,0,i)}else{var l,s=ot(t.field,n);r={type:"field",value:s.field,function:null!=(l=s.function)?l:"none"}}if(("array_contains"==t.op||"array_does_not_contain"==t.op)&&Array.isArray(t.value))return hi(t,e,n,i);var u=Jt(t.value,i.variables);return Ft(t.value)&&(u=St(t.value)),Cn(t)&&(u=kt(t.value)),{type:ui.WHERE,value:{op:t.op,value:u,field:r}}},fi=function(e,t,n,i){if(i&&0!==i.length&&!i.every((function(e){return 0===e.length})))return 1===i.length?mi(i[0],e,t,n):{type:ui.OR_WHERE,value:i.map((function(i){return mi(i,e,t,n)}))}},mi=function(e,t,n,i){return{type:ui.AND_WHERE,value:e.map((function(e){return"array_contains"!=e.op&&"array_does_not_contain"!=e.op||!Array.isArray(e.value)?pi(t,e,n,i):hi(e,t,n,i)}))}},hi=function(e,t,n,i){return{type:ui.AND_WHERE,value:[].concat(e.value).map((function(r){return pi(t,ge({},e,{value:r}),n,i)}))}},vi=function(e,t){return[[].concat(e,[t]),e.length]},gi=function(e,t,n,i,r,o,a,l,s,u){var d=[],c=[],p=[],f=[],m=xi(e,l,s,u);if(r){var h;if(!gt(l.supportedTimeTruncFunctions,r.truncate))throw"Query engine does not support the time trunc function "+r.truncate+".";var v=vi(c,{type:"field",value:r.field,function:r.truncate});c=v[0],h=v[1],d=[].concat(d,[{functionId:r.truncate,field:Qo(e,r.field)}]),p=[].concat(p,[{index:h}])}return i.forEach((function(t){var n,i=vi(c,{type:"field",value:null==t?void 0:t.field,function:t.function});c=i[0],n=i[1],d=[].concat(d,[{functionId:t.function,field:Qo(e,t.field)}]),p=[].concat(p,[{index:n}])})),t.forEach((function(t){if(n=t.function,![].concat(Object.keys(l.supportedAggregates),["none"]).includes(n))throw"Query engine does not support the query function "+t.function+".";var n,i=vi(c,{type:"field",value:t.field,function:t.function});c=i[0],d=[].concat(d,[{functionId:t.function,field:Qo(e,t.field)}])})),n.forEach((function(e){var t=c.findIndex((function(t){return"field"==t.type&&t.value==e.field&&t.function==e.function}));t>=0&&(f=[].concat(f,[{index:t,direction:e.direction}]))})),c=c.map((function(t){if("field"==t.type&&"string"==typeof t.value){var n=Qo(e,t.value);if(bn(n))return yn({function:t.function,field:t.value},n,l,e,yi({group:p}),s)}return t})),{query:{type:"query",dataSetId:e.id,measure:c,group:p,filter:m,order:f,limit:o,offset:a},measureDescription:d}},xi=function(e,t,n,i){if(i&&i.length>0){var r=[];return i.forEach((function(i){var o=Fn([i],t,e,n);r=[].concat(r,[o[0]])})),r}return di(e,t,n)||[]},bi=gi,yi=function(e){return e.group.length>0},wi=function(e,t,n){return{query:{type:"preparedQuery",preparedQueryType:"uniqueArrayValues",dataSetId:e,fieldId:t.id,filter:n||[]},resultFields:[{id:t.id,publicName:t.publicName,dataType:t.dataType,fieldId:t.id,function:"none",outputDataType:"string"}]}},Ci=function(e,t,n,i){return{dataSetId:e.id,measure:[{field:t,function:"count"}],order:null!=i?i:[],filter:n?[n]:[],dimension:[{field:t,function:"none"}],timeDimension:null,limit:5e3,offset:0}},ji=function(e,t){return e.supportedFeatures.includes(t)},Fi=function(e,t,n){var i={};return e.forEach((function(e){var r=t.filter((function(t){return t.appliesToFields.find((function(t){return t.dataSetId===e.id}))})).map((function(t){return At(e,t,n)}));i[e.id]=r})),i};function Si(e,t){var n=e;return t&&n.map((function(e){var n=t[e.dataSetId].flat();0!==n.length&&e.filter.push(n)})),n}var ki=function(e){function t(t,n){var i;return(i=e.call(this,"\n An expected field is missing from a dataSet.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify(t)+"\n ")||this).missingFieldId=void 0,i.name="FieldNotFoundInDataSet",i.missingFieldId=n,i}return be(t,e),t.prototype.getMissingFieldId=function(){return this.missingFieldId},t}(Ut),Ai=function(e,t){return r.mergeWith({},e,t,(function(e,t){return r.isArray(t)?t:r.isObject(e)&&r.isObject(t)?Ai(e,t):t}))},Ti=rt,_i=ot,Ii=function(e){return"none"!=e.function};function Di(e,t){for(var n={},i=0,r=Object.entries(e);i<r.length;i++){var o=r[i];n[o[0]]=o[1].filter((function(e){return(null==e?void 0:e.field)!==t}))}return n}var Oi=function(e,t){return ge({},e,{order:r.remove(e.order,(function(e){return r.some(t,(function(t){return t.function==e.function&&t.field==e.field}))}))})},Ei=function(e,t,n){var i,o,a,l=ge({},e);if("measure"in l&&r.remove(l.measure,(function(e){return e.field==t})),"barMeasure"in l&&r.remove(l.barMeasure,(function(e){return e.field==t})),"lineMeasure"in l&&r.remove(l.lineMeasure,(function(e){return e.field==t})),"xMeasure"in l&&(null==(i=l.yMeasure)?void 0:i.field)==t&&(l.xMeasure=null),"yMeasure"in l&&(null==(o=l.yMeasure)?void 0:o.field)==t&&(l.yMeasure=null),"order"in l&&r.remove(l.order,(function(e){return e.field==t})),"dimension"in l&&r.remove(l.dimension,(function(e){return e.field==t})),"barDimension"in l&&r.remove(l.barDimension,(function(e){return e.field==t})),"lineDimension"in l&&r.remove(l.lineDimension,(function(e){return e.field==t})),"filter"in l&&l.filter.forEach((function(e){r.remove(e,(function(e){return e.field==t}))})),"parameters"in l&&l.parameters&&n){var s=function(e,t,n){if("measure"in e&&e.measure){var i=function(e,t){return Object.keys(e).map((function(e){var n=_i(e,t);return null!=n&&n.function?n:null})).find((function(e){return null!==e}))}(e.measure,n);if(null!=i&&i.function&&i.field===t){var r=Ti(i);delete e.measure[r]}e.measure=Di(e.measure,t)}if("group"in e&&e.group){var o=function(e,t){return Object.keys(e).map((function(e){var n=ht(e,t.supportedTimeTruncFunctions);return null!=n&&n.truncate?n:null})).find((function(e){return null!==e}))}(e.group,n);if(null!=o&&o.truncate&&o.field===t){var a=mt(o);delete e.group[a]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=Di(e.group,t)}return e}(l.parameters,t,n);l.parameters=s}return"timeDimension"in l&&(null==(a=l.timeDimension)?void 0:a.field)==t&&(l.timeDimension=null),l},Li=function(e){var t=[].concat(e.measure);return e.dimension.forEach((function(e){t.push({field:e.field,function:e.function})})),e.timeDimension&&t.push({field:e.timeDimension.field,function:e.timeDimension.truncate}),Oi(e,t)},Ni=function(e,t,n){var i=Ai(e,t),r=n.validate(i),o=r.error;if(o)throw o;return r.value},Mi=function(e){return s.object({filters:s.array().items(s.array().items(On(e)).required().max(1)).required().max(1),ruleValue:s.string().allow("").required(),ruleValueEnd:s.string().allow(""),ruleType:s.valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view.")},Ri=s.object({field:s.string().required().description("ID of the field in the data set to add a prefix too."),prefix:s.string().required().description("The prefix to be applied.")}),Pi=function(e){return s.array().items(Mi(e)).description("Apply formatting based on a set of defined rules.")};function zi(e){var t;return s.array().items(s.object({field:s.string().required(),function:(t=s.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"]))}))}var Vi=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),Pn(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:s.valid(!0,!1,"100%"),legend:s.valid(!0,!1),type:s.valid("barChart","horizontalBarChart","funnelChart").required(),conditionalFormattingRules:Pi(e.queryEngineConfig),protectedFields:s.object({dimension:qn(e.queryEngineConfig),measure:Vn(e.queryEngineConfig)}).unknown(!0),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:Un(),axisTitles:Xn(),headline:Kn(),tags:An(),drilldownOptions:zi(e.queryEngineConfig)}))},qi=function(e){return function(t,n){var i=Ni(t,n,Vi(e));return Li(i)}},Bi=function(e){function t(t){var n;return(n=e.call(this,"Corrupt view. "+t.message+".\n\n "+JSON.stringify(t)+"\n ")||this).name="CorruptedView",n}return be(t,e),t}(Ut),Wi=function(e){function t(t,n){var i;return(i=e.call(this,"\n An expected data set is missing from the dashboard.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify([].concat(t).map((function(e){return e.id})))+"\n ")||this).name="DataSetNotFound",i}return be(t,e),t}(Ut),Hi=function(e){var t=[];return"measure"in e&&e.measure&&(t=[].concat(t,[].concat(e.measure))),"xMeasure"in e&&e.xMeasure&&(t=[].concat(t,[e.xMeasure])),"yMeasure"in e&&e.yMeasure&&(t=[].concat(t,[e.yMeasure])),t},Yi=function(e){var t=[];return"dimension"in e&&e.dimension&&(t=[].concat(t,e.dimension)),"lineDimension"in e&&e.lineDimension&&(t=[].concat(t,e.lineDimension)),"barDimension"in e&&e.barDimension&&(t=[].concat(t,e.barDimension)),t},Gi=function(e){var t=[];return Hi(e).forEach((function(e){t=[].concat(t,[e.field])})),Yi(e).forEach((function(e){t=[].concat(t,[e.field])})),"order"in e&&e.order&&(t=[].concat(t,[].concat(e.order).map((function(e){return e.field})))),"timeDimension"in e&&e.timeDimension&&(t=[].concat(t,[e.timeDimension.field])),t},Ui={allowUnknown:!0,stripUnknown:!0},Ki=function(e,t,n){var i=Go(e.type,{queryEngineConfig:n}).schema.validate(e,Ui).error;if(i)return[new Bi(i)];var r=Ko(t,e.dataSetId);if(!r)return[new Wi(t,e.dataSetId)];var o=Gi(e);try{o.forEach((function(e){Qo(r,e)}))}catch(e){if(e instanceof ki)return[e];throw e}return[]},Xi=function(e){var t=function(e){return e+" need at least 1 grouping to display correctly."};return"barChart"===e.type?t("Column Charts"):"lineChart"===e.type?t("Line Charts"):"areaChart"===e.type?t("Area Charts"):"horizontalBarChart"===e.type?t("Horizontal Bar Charts"):"comboChart"===e.type?"Combo Charts needs at least 1 grouping (Bar and Line), or, have time set to display correctly.":"scatterChart"===e.type?t("Scatter Charts"):"pieChart"===e.type?t("Pie Charts"):"funnelChart"===e.type?t("Funnel Charts"):null},Qi=function(e){var t;return"comboChart"===e.type?!!e.timeDimension||!!(e.barDimension.length>0&&e.lineDimension.length>0):"barChart"!==e.type&&"lineChart"!==e.type&&"areaChart"!==e.type&&"horizontalBarChart"!==e.type&&"scatterChart"!==e.type&&"pieChart"!==e.type&&"funnelChart"!==e.type||!!e.timeDimension||null==e||!e.dimension||0!==(null==e||null==(t=e.dimension)?void 0:t.length)},Zi=function(e){return!!Qi(e)||Xi(e)},Ji=["parentDimension"],$i=function(e){return e||"view_"+l.v4()};function er(e){return we(e,Ji)}var tr=function(e,t,n){var i=r.cloneDeep(Uo(t.fields,{onlyFieldTypes:["boolean","string"]})),o=r.cloneDeep(Uo(t.fields,{onlyFieldTypes:["date_time"]})),a=r.cloneDeep(Uo(t.fields,{onlyFieldTypes:["number"]})),l=null;return o[0]&&(l={field:o[0].id,truncate:"none"}),n(e,{protectedByOrganisation:!0,dimension:i.map((function(e){return{field:e.id,function:"none"}})),measure:[].concat(a).map((function(e){return{function:"none",field:e.id}})),order:[],timeDimension:l})},nr=function(e,t){var n=null,i=r.cloneDeep(e);return i.forEach((function(e){var i=Qo(t,e.field);"date_time"==i.dataType&&(n={field:i.id,truncate:e.function})})),i=i.filter((function(e){return"date_time"!=Qo(t,e.field).dataType})),{timeDimension:n,dimension:i}},ir=function(e){var t=[].concat(e.dimension);return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate}].concat(t)),t},rr=function(e,t){var n=[];return r.isEmpty(t)||void 0===t?[]:(null==t||t.map((function(t){if(null!=t&&t.ruleType&&null!=t&&t.ruleValue){var i=[],r="field"in t&&"string"==typeof t.field&&"operator"in t&&"string"==typeof t.operator&&"value"in t;if(null!=t&&t.filters){var o=t.filters.map((function(t){return t.map((function(t){return or(t,e)}))}));i.push.apply(i,o)}else r&&i.push([or({field:t.field,op:t.operator,value:t.value},e)]);n.push({filters:i,ruleValueEnd:null==t?void 0:t.ruleValueEnd,ruleValue:t.ruleValue,ruleType:t.ruleType})}})),n)},or=function(e,t){var n,i=ot(e.field,t),r="none"!==i.function?i.function:null!=(n=e.function)?n:"none";return{field:i.field,op:e.op,value:e.value,function:r}},ar={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}};function lr(e,t){return function(t){return t in e.format_panel}(t)?ge({},e.format_panel[t],{namespace:t}):ge({},e.data_panel[t],{namespace:t})}function sr(e,t){var n;return null==(n=e.format_panel.axis_labels)?void 0:n.subSectionDefinition[t]}function ur(e){return ge({},lr(e,"heading"),{subSection:[e.format_panel.heading.subSectionDefinition.title,e.format_panel.heading.subSectionDefinition.subject]})}function dr(e){return ge({},lr(e,"axis_labels"),{y:ge({},sr(e,"y"),{prefix:sr(e,"y.prefix"),postfix:sr(e,"y.postfix"),format:sr(e,"y.format"),count:sr(e,"y.count"),axisTitle:sr(e,"y.axis_title")}),x:ge({},sr(e,"x"),{prefix:sr(e,"x.prefix"),postfix:sr(e,"x.postfix"),format:sr(e,"x.format"),count:sr(e,"x.count"),axisTitle:sr(e,"x.axis_title")})})}function cr(e,t,n){var i,r,o,a,l;return ge({},lr(e,"chart_styles"),t?{subSection:[null==(r=e.format_panel.chart_styles)?void 0:r.subSectionDefinition.curve,null==(o=e.format_panel.chart_styles)?void 0:o.subSectionDefinition.legend]}:n?{subSection:[null==(a=e.format_panel.chart_styles)?void 0:a.subSectionDefinition.stacked,null==(l=e.format_panel.chart_styles)?void 0:l.subSectionDefinition.legend]}:{subSection:[null==(i=e.format_panel.chart_styles)?void 0:i.subSectionDefinition.legend]})}function pr(e,t){var n;return ge({},null==(n=e.format_panel.stats_labels)?void 0:n.subSectionDefinition[t],{namespace:t})}var fr=function(e,t){if("current"===(null==e?void 0:e.func)&&t)return e},mr=function(e){return e.Maths="maths",e.IfStatement="ifStatement",e}({}),hr=function(e){return{title:ar.title,description:ar.description,servicesClass:"BarChart",namespace:ar.namespace,dump:function(e){return e},load:function(t){var n;return ge({},t,{measure:Ee(t.measure),order:Oe(t.order,t.timeDimension),filter:De(t.filter),viewId:$i(t.viewId),dimension:st(t.dimension),approxXAxisLabelCount:Le(t.approxXAxisLabelCount),approxYAxisLabelCount:Le(t.approxYAxisLabelCount),parameters:Ne(t.parameters),conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),headline:fr(t.headline,t.timeDimension),tags:null!=(n=t.tags)?n:[],drilldownOptions:t.drilldownOptions})},setAttributes:qi(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],drilldownOptions:void 0},t)},createFeedback:Zi,schema:Vi(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(ar,"data_set"),lr(ar,"views"),ge({},lr(ar,"field_y_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(ar,"field_x_axis"),{fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:2,testId:"add-dimension"}),lr(ar,"sort"),lr(ar,"filter"),ge({},lr(ar,"drilldown"),{options:{property:"drilldownOptions"}}),lr(ar,"custom_metrics"),lr(ar,"limit")]},formatPanelConfig:function(){return[ur(ar),cr(ar,!1,!0),dr(ar),ge({},lr(ar,"conditional_formatting"),{ruleType:"backgroundColor"}),lr(ar,"goal_line"),lr(ar,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return tr(e,t,this.setAttributes)}}},vr=function(e){return e.Forecast="Forecast",e.MovingAverage="Moving Average",e.Trend="Trend",e}({}),gr=s.object({type:s.string().valid(vr.Forecast),value:s.number()}),xr=s.object({type:s.string().valid(vr.Trend),value:s.number()}),br=s.object({value:s.number().required()}),yr=s.object({type:s.string().valid(vr.MovingAverage),averages:s.array().items(br).required()}),wr=function(){return s.array().items(s.alternatives(gr,xr,yr))},Cr=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),Pn(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:s.valid(!0,!1,"100%"),legend:s.valid(!0,!1),type:s.valid("lineChart").required(),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:zn,conditionalFormattingRules:Pi(e.queryEngineConfig),goalLines:Un(),axisTitles:Xn(),headline:Kn(),tags:An(),trends:wr()}))},jr=function(e){return function(t,n){var i=Ni(t,n,Cr(e));return Li(i)}},Fr={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Sr=function(e){return{title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:function(e){return e},load:function(t){var n,i;return{type:t.type,measure:Ee(t.measure),order:Oe(t.order,t.timeDimension),dimension:st(t.dimension),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:$i(t.viewId),filter:De(t.filter),dataSetId:t.dataSetId,limit:t.limit,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:fr(t.headline,t.timeDimension),parameters:Ne(t.parameters),approxXAxisLabelCount:Le(t.approxXAxisLabelCount),approxYAxisLabelCount:Le(t.approxYAxisLabelCount),axisTitles:t.axisTitles,tags:null!=(n=t.tags)?n:[],trends:null!=(i=t.trends)?i:[]}},setAttributes:jr(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[]},t)},createFeedback:Zi,schema:Cr(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(Fr,"data_set"),lr(Fr,"views"),ge({},lr(Fr,"field_y_axis"),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(Fr,"field_x_axis"),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:2,testId:"add-dimension"}),lr(Fr,"sort"),lr(Fr,"filter"),lr(Fr,"custom_metrics"),lr(Fr,"limit")]},formatPanelConfig:function(){return[ur(Fr),cr(Fr,!0,!1),dr(Fr),ge({},lr(Fr,"conditional_formatting"),{ruleType:"lineColor"}),lr(Fr,"goal_line"),lr(Fr,"trends"),lr(Fr,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return tr(e,t,this.setAttributes)}}},kr=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),Pn(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:s.valid(!0,!1,"100%"),legend:s.valid(!0,!1),type:s.valid("lineChartV2").required(),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),lineCurve:zn,conditionalFormattingRules:Pi(e.queryEngineConfig),goalLines:Un(),axisTitles:Xn(),headline:Kn(),tags:An(),trends:wr()}))},Ar=function(e){return function(t,n){var i=Ni(t,n,kr(e));return Li(i)}},Tr={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},_r=function(e){return{title:"Line chart V2",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:function(e){return e},load:function(t){var n,i;return{type:t.type,measure:Ee(t.measure),order:Oe(t.order,t.timeDimension),dimension:st(t.dimension),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,viewId:$i(t.viewId),filter:De(t.filter),dataSetId:t.dataSetId,limit:t.limit,timeDimension:null,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,lineCurve:t.lineCurve,conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),drilldown:t.drilldown,legend:t.legend,goalLines:t.goalLines,headline:fr(t.headline,t.timeDimension),parameters:Ne(t.parameters),approxXAxisLabelCount:Le(t.approxXAxisLabelCount),approxYAxisLabelCount:Le(t.approxYAxisLabelCount),axisTitles:t.axisTitles,tags:null!=(n=t.tags)?n:[],trends:null!=(i=t.trends)?i:[]}},setAttributes:Ar(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"lineChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[]},t)},createFeedback:Zi,schema:kr(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0&&e.dimension.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(Tr,"data_set"),lr(Tr,"views"),ge({},lr(Tr,"field_y_axis"),{fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(Tr,"field_x_axis"),{fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:function(e){return{dimension:[].concat(e)}},getValues:function(e){return[].concat(e.dimension)},maxAllowed:2,testId:"add-dimension"}),lr(Tr,"sort"),lr(Tr,"filter"),lr(Tr,"custom_metrics"),lr(Tr,"limit")]},formatPanelConfig:function(){return[ur(Tr),cr(Tr,!0,!1),dr(Tr),ge({},lr(Tr,"conditional_formatting"),{ruleType:"lineColor"}),lr(Tr,"goal_line")]},supportedCustomFields:{calculatedField:!1,percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return tr(e,t,this.setAttributes)}}},Ir=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{measure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),dimension:Dn(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),filter:En(e.queryEngineConfig),timeDimension:s.valid(null),order:s.array().items(_n(e.queryEngineConfig)),type:s.valid("pieChart").required(),legend:s.valid(!0,!1),labels:s.valid(!0,!1),limit:Ln(),labelsAsPercentage:s.boolean(),conditionalFormattingRules:Pi(e.queryEngineConfig),labelFormat:s.alternatives(s.string(),s.valid(null)),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),tags:An(),drilldownOptions:zi(e.queryEngineConfig)}))},Dr={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Or=function(e){return{title:Dr.title,description:Dr.description,servicesClass:"PieChart",namespace:Dr.namespace,dump:function(e){return e},load:function(t){var n;return{type:t.type,measure:Ee(t.measure),order:Oe(t.order,t.timeDimension),dimension:st(t.dimension),viewId:$i(t.viewId),timeDimension:t.timeDimension,displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,filter:De(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),labelsAsPercentage:t.labelsAsPercentage,legend:t.legend,labels:t.labels,labelFormat:t.labelFormat,parameters:Ne(t.parameters),tags:null!=(n=t.tags)?n:[],drilldownOptions:t.drilldownOptions}},setAttributes:function(t,n){return Ni(t,n,Ir(e))},validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[],drilldownOptions:void 0},t)},createFeedback:Zi,schema:Ir(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(Dr,"data_set"),lr(Dr,"views"),ge({},lr(Dr,"field_metrics"),{fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(Dr,"field_grouping"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),lr(Dr,"sort"),lr(Dr,"filter"),ge({},lr(Dr,"drilldown"),{options:{property:"drilldownOptions"}}),lr(Dr,"custom_metrics"),lr(Dr,"limit")]},formatPanelConfig:function(){var e,t,n;return[ur(Dr),ge({},lr(Dr,"conditional_formatting"),{ruleType:"backgroundColor"}),ge({},lr(Dr,"chart_styles"),{subSection:[null==(e=Dr.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend,null==(t=Dr.format_panel.chart_styles)?void 0:t.subSectionDefinition.labels,null==(n=Dr.format_panel.chart_styles)?void 0:n.subSectionDefinition.number_format]})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1}}},Er=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{xMeasure:Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),yMeasure:Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions).allow(null),dimension:Dn(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:s.array().items(_n(e.queryEngineConfig)),limit:Ln(),legend:s.valid(!0,!1),offset:s.number().min(0),filter:En(e.queryEngineConfig),type:s.valid("scatterChart").required(),timeDimension:s.valid(null),xAxisPrefix:s.string().allow(""),yAxisPrefix:s.string().allow(""),xAxisPostfix:s.string().allow(""),yAxisPostfix:s.string().allow(""),yAxisFormat:s.alternatives(s.string(),s.valid(null)),xAxisFormat:s.alternatives(s.string(),s.valid(null)),approxYAxisLabelCount:Mn,approxXAxisLabelCount:Mn,goalLines:Un(),axisTitles:Xn(),tags:An()}))},Lr=function(e){return function(t,n){var i=Ni(t,n,Er(e)),r=[];return i.xMeasure&&r.push(i.xMeasure),i.yMeasure&&r.push(i.yMeasure),i.dimension.forEach((function(e){r.push({field:e.field,function:e.function})})),Oi(i,r)}},Nr={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Mr=function(e){return{title:Nr.title,description:Nr.description,servicesClass:"ScatterChart",namespace:Nr.namespace,dump:function(e){return e},load:function(e){var t;return{type:e.type,xMeasure:Ee(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:Ee(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:st(e.dimension),viewId:$i(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:De(e.filter),order:Oe(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:Le(e.approxXAxisLabelCount),approxYAxisLabelCount:Le(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles,tags:null!=(t=e.tags)?t:[]}},setAttributes:Lr(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0,tags:[]},t)},createFeedback:Zi,schema:Er(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"scatterChart"),i=n.measure;return this.init(t.id,{xMeasure:i[0],yMeasure:i[1],dimension:n.dimension})},dataPanelConfig:function(){var e,t;return[lr(Nr,"data_set"),lr(Nr,"views"),ge({},lr(Nr,"labelled_metrics"),{subSection:[ge({},null==(e=Nr.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.xAxis,{propKey:"xMeasure",allowsMultiple:!1}),ge({},null==(t=Nr.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.yAxis,{propKey:"yMeasure",allowsMultiple:!1})]}),ge({},lr(Nr,"field_grouping"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),lr(Nr,"filter"),lr(Nr,"custom_metrics"),lr(Nr,"limit")]},formatPanelConfig:function(){var e;return[ur(Nr),ge({},lr(Nr,"chart_styles"),{subSection:[null==(e=Nr.format_panel.chart_styles)?void 0:e.subSectionDefinition.legend]}),dr(Nr),lr(Nr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!1}}},Rr=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{stacked:s.valid(!0,!1,"100%"),legend:s.valid(!0,!1),barMeasure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),lineMeasure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),barDimension:Dn(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),lineDimension:Dn(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions),order:s.array().items(_n(e.queryEngineConfig)),timeDimension:s.alternatives(In(e.queryEngineConfig.supportedTimeTruncFunctions),s.valid(null)),limit:Ln(),offset:s.number().min(0),filter:En(e.queryEngineConfig),type:s.valid("comboChart").required(),xAxisPrefix:s.string().allow(""),yAxisPrefix:s.string().allow(""),xAxisPostfix:s.string().allow(""),yAxisPostfix:s.string().allow(""),yAxisFormat:s.alternatives(s.string(),s.valid(null)),xAxisFormat:s.alternatives(s.string(),s.valid(null)),approxYAxisLabelCount:Mn,approxXAxisLabelCount:Mn,goalLines:Un(),conditionalFormattingRules:s.object({bar:s.array().items(Mi(e.queryEngineConfig)),line:s.array().items(Mi(e.queryEngineConfig))}),axisTitles:Xn(),tags:An()}))},Pr=function(e){return function(t,n){var i=Ni(t,n,Rr(e)),r=[].concat(i.lineMeasure,i.barMeasure);return[].concat(i.lineDimension,i.barDimension).forEach((function(e){r.push({field:e.field,function:e.function})})),i.timeDimension&&r.push({field:i.timeDimension.field,function:i.timeDimension.truncate}),Oi(i,r)}},zr={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Vr=function(e){return{title:zr.title,description:zr.description,servicesClass:"ComboChart",namespace:zr.namespace,dump:function(e){return e},load:function(t){return i=e.queryEngineConfig,ge({},n=t,{lineMeasure:Ee(n.lineMeasure),barMeasure:Ee(n.barMeasure),order:Oe(n.order,n.timeDimension||null),filter:De(n.filter),lineDimension:st(n.lineDimension||n.dimension||[]),barDimension:st(n.barDimension||n.dimension||[]),viewId:$i(n.viewId),approxXAxisLabelCount:Le(n.approxXAxisLabelCount),approxYAxisLabelCount:Le(n.approxYAxisLabelCount),conditionalFormattingRules:{bar:rr(i,null==(r=n.conditionalFormattingRules)?void 0:r.bar),line:rr(i,null==(o=n.conditionalFormattingRules)?void 0:o.line)},tags:null!=(a=n.tags)?a:[]});var n,i,r,o,a},setAttributes:Pr(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[]},t)},createFeedback:Zi,schema:Rr(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.lineMeasure.length>0||e.barMeasure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"comboChart"),i=n.measure,r=n.dimension;return this.init(t.id,{barMeasure:[i[0]],lineMeasure:[i[1]||i[0]],barDimension:r,lineDimension:r})},dataPanelConfig:function(){var e,t;return[lr(zr,"data_set"),lr(zr,"views"),ge({},lr(zr,"labelled_metrics"),{subSection:[ge({},null==(e=zr.data_panel.labelled_metrics)?void 0:e.subSectionDefinition.line,{propKey:"lineMeasure",allowsMultiple:!0}),ge({},null==(t=zr.data_panel.labelled_metrics)?void 0:t.subSectionDefinition.bar,{propKey:"barMeasure",allowsMultiple:!0})]}),lr(zr,"combo_chart_dimension"),lr(zr,"sort"),lr(zr,"filter"),lr(zr,"custom_metrics"),lr(zr,"limit")]},formatPanelConfig:function(){var e,t,n,i,r,o;return[ur(zr),cr(zr,!1,!0),dr(zr),ge({},lr(zr,"conditional_formatting"),{ruleType:"backgroundColor",subSection:[{title:null!=(e=null==(t=zr.format_panel.conditional_formatting)||null==(t=t.subSectionDefinition)?void 0:t.bar.title)?e:"",namespace:null==(n=zr.format_panel.conditional_formatting)||null==(n=n.subSectionDefinition)?void 0:n.bar.namespace,propKey:"bar"},{title:null!=(i=null==(r=zr.format_panel.conditional_formatting)||null==(r=r.subSectionDefinition)?void 0:r.line.title)?i:"",namespace:null==(o=zr.format_panel.conditional_formatting)||null==(o=o.subSectionDefinition)?void 0:o.line.namespace,propKey:"line"}]}),lr(zr,"goal_line")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!1}}},qr=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{type:s.valid("dataTable").required(),measure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)).required(),dimension:Dn(e.queryEngineConfig.supportedTimeTruncFunctions,e.attributesSchemaOptions).required(),order:s.array().items(_n(e.queryEngineConfig)),timeDimension:s.alternatives(In(e.queryEngineConfig.supportedTimeTruncFunctions),s.valid(null)),limit:Ln().required(),offset:s.number().min(0),filter:En(e.queryEngineConfig),prefixes:s.array().items(Ri),exportNames:s.object(),numberFormat:s.object(),conditionalFormattingRules:Pi(e.queryEngineConfig),dateTimeFormat:s.string(),protectedFields:s.object({dimension:qn(e.queryEngineConfig),measure:Vn(e.queryEngineConfig)}).unknown(!0),sizing:Qn,tags:An(),hiddenFields:s.array().items(s.string()),tableDrilldown:s.array().items(s.object({subsetDimension:s.string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table.")}))},Br=function(e){return function(t,n){var i=Ni(t,n,qr(e));return Li(i)}},Wr={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Hr=[3,5,10,20,50,100,200],Yr=function(e,t){return e.filter((function(e){return e.pivot==t}))},Gr=function(e){return{title:Wr.title,description:Wr.description,servicesClass:"PivotTable",namespace:Wr.namespace,dump:function(e){return e},load:function(t){var n,i,r,o;return{type:t.type,measure:Ee(t.measure),order:Oe(t.order,t.timeDimension||null),displayTitle:t.displayTitle,dimension:(o=ir({timeDimension:t.timeDimension,dimension:st(t.dimension)}),o.map((function(e){return ge({},e,{pivot:e.pivot?e.pivot:"x"})}))),displaySubject:t.displaySubject,protectedByOrganisation:t.protectedByOrganisation,protectedFields:t.protectedFields,viewId:$i(t.viewId),filter:De(t.filter),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),dateTimeFormat:t.dateTimeFormat,prefixes:t.prefixes,exportNames:t.exportNames,numberFormat:t.numberFormat,sizing:t.sizing,tableDrilldown:(r=t.tableDrilldown,r&&r.length>0?r.map(er):r||[]),tags:null!=(n=t.tags)?n:[],hiddenFields:null!=(i=t.hiddenFields)?i:[]}},setAttributes:Br(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[],hiddenFields:[]},t)},schema:qr(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"dataTable"),i=n.dimension;return this.init(t.id,{measure:n.measure.slice(0,5),dimension:i})},dataPanelConfig:function(){return[lr(Wr,"data_set"),lr(Wr,"views"),ge({},lr(Wr,"field_columns"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return ge({},e,{pivot:"y"})})),Yr(n.dimension,"x"))}},getValues:function(e){return Yr(e.dimension,"y")},testId:"add-pivot-dimension"}),ge({},lr(Wr,"field_rows"),{fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return ge({},e,{pivot:"x"})})),Yr(n.dimension,"y"))}},getValues:function(e){return Yr(e.dimension,"x")},testId:"add-dimension"}),ge({},lr(Wr,"drilldown"),{options:{maxOptions:1,property:"tableDrilldown"}}),ge({},lr(Wr,"field_metrics"),{fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),lr(Wr,"sort"),ge({},lr(Wr,"pagination"),{options:Hr}),lr(Wr,"filter"),lr(Wr,"custom_metrics")]},formatPanelConfig:function(){var e;return[ur(Wr),ge({},lr(Wr,"format"),{subSection:[null==(e=Wr.format_panel.format)?void 0:e.subSectionDefinition.time]}),lr(Wr,"prefixes"),ge({},lr(Wr,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!0}}},Ur=s.object({field:s.string().required(),function:s.valid("none").required()}),Kr=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{type:s.valid("basicTable").required(),measure:s.array().items(Ur).required(),dimension:s.array().max(0),order:s.array().items(_n(e.queryEngineConfig)),timeDimension:s.valid(null),limit:Ln().required(),offset:s.number().min(0),filter:En(e.queryEngineConfig),prefixes:s.array().items(Ri),exportNames:s.object(),numberFormat:s.object(),conditionalFormattingRules:Pi(e.queryEngineConfig),dateTimeFormat:s.string(),protectedFields:s.object({measure:Vn(e.queryEngineConfig)}).unknown(!0),sizing:Qn,tags:An(),hiddenFields:s.array().items(s.string())}))},Xr=function(e){return function(t,n){var i=Ni(t,n,Kr(e));return Oi(i,[].concat(i.measure))}},Qr={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Zr=function(e){return{title:Qr.title,description:Qr.description,servicesClass:"BasicTable",namespace:Qr.namespace,dump:function(e){return e},load:function(t){var n,i;return ge({},t,{measure:Ee(t.measure),order:Oe(t.order,t.timeDimension),filter:De(t.filter),dimension:st(t.dimension),viewId:$i(t.viewId),conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),tags:null!=(n=t.tags)?n:[],hiddenFields:null!=(i=t.hiddenFields)?i:[]})},setAttributes:Xr(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(t,n){var i={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],hiddenFields:[],dataSetId:t,viewId:$i(null==n?void 0:n.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return Xr(e)(i,n||{})},schema:Kr(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},setFields:function(t,n){var i=[].concat(n).map((function(e){return{field:e,function:"none"}}));return Xr(e)(t,{measure:i})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){var t=Uo(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!0}),n=[].concat(t).map((function(e){return{field:e.id,function:"none"}}));return this.init(e.id,{measure:n.slice(0,5)})},dataPanelConfig:function(){return[lr(Qr,"data_set"),lr(Qr,"views"),lr(Qr,"fields"),lr(Qr,"sort"),ge({},lr(Qr,"pagination"),{options:Hr}),lr(Qr,"filter"),lr(Qr,"custom_metrics")]},formatPanelConfig:function(){var e;return[ur(Qr),ge({},lr(Qr,"format"),{subSection:[null==(e=Qr.format_panel.format)?void 0:e.subSectionDefinition.time]}),lr(Qr,"prefixes"),ge({},lr(Qr,"conditional_formatting"),{ruleType:"backgroundColor"})]},supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!0,conditional:!0,calculatedField:[mr.Maths]},supportedFeatures:{parameters:!1,colorGradient:!0}}},Jr=function(e){return function(t,n){var i=Ni(t,n,Vi(e));return Li(i)}},$r={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},eo=function(e){return{title:$r.title,description:$r.description,servicesClass:"HorizontalBarChart",namespace:$r.namespace,dump:function(e){return e},load:function(e){var t;return ge({},e,{measure:Ee(e.measure),order:Oe(e.order,e.timeDimension),dimension:st(e.dimension),viewId:$i(e.viewId),filter:De(e.filter),approxXAxisLabelCount:Le(e.approxXAxisLabelCount),approxYAxisLabelCount:Le(e.approxYAxisLabelCount),tags:null!=(t=e.tags)?t:[],parameters:Ne(e.parameters)})},setAttributes:Jr(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,parameters:{},drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],drilldownOptions:void 0},t)},createFeedback:Zi,schema:Vi(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr($r,"data_set"),lr($r,"views"),ge({},lr($r,"field_y_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr($r,"field_x_axis"),{fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:2,testId:"add-dimension"}),lr($r,"sort"),lr($r,"filter"),ge({},lr($r,"drilldown"),{options:{property:"drilldownOptions"}}),lr($r,"custom_metrics"),lr($r,"limit")]},formatPanelConfig:function(){return[ur($r),cr($r,!1,!0),dr($r),ge({},lr($r,"conditional_formatting"),{ruleType:"backgroundColor"}),lr($r,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return tr(e,t,this.setAttributes)}}},to=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),Pn(e.queryEngineConfig,e.attributesSchemaOptions),{stacked:s.valid(!0,!1,"100%"),legend:s.valid(!0,!1),type:s.valid("areaChart").required(),lineCurve:zn,conditionalFormattingRules:Pi(e.queryEngineConfig),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),goalLines:Un(),axisTitles:Xn(),headline:Kn(),tags:An()}))},no=function(e){return function(t,n){var i=Ni(t,n,to(e));return Li(i)}},io={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format"},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},ro=function(e){return{title:io.title,description:io.description,servicesClass:"AreaChart",namespace:io.namespace,dump:function(e){return e},load:function(t){var n;return{type:t.type,measure:Ee(t.measure),displayTitle:t.displayTitle,dimension:st(t.dimension),timeDimension:t.timeDimension,displaySubject:t.displaySubject,viewId:$i(t.viewId),filter:De(t.filter),order:Oe(t.order,t.timeDimension),dataSetId:t.dataSetId,limit:t.limit,offset:t.offset,xAxisPostfix:t.xAxisPostfix,xAxisPrefix:t.xAxisPrefix,yAxisPostfix:t.yAxisPostfix,yAxisPrefix:t.yAxisPrefix,lineCurve:t.lineCurve,conditionalFormattingRules:rr(e.queryEngineConfig,t.conditionalFormattingRules),protectedByOrganisation:t.protectedByOrganisation,stacked:t.stacked,drilldown:t.drilldown,legend:t.legend,yAxisFormat:t.yAxisFormat,xAxisFormat:t.xAxisFormat,goalLines:t.goalLines,parameters:Ne(t.parameters),approxXAxisLabelCount:Le(t.approxXAxisLabelCount),approxYAxisLabelCount:Le(t.approxYAxisLabelCount),headline:fr(t.headline,t.timeDimension),tags:null!=(n=t.tags)?n:[]}},setAttributes:no(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[]},t)},createFeedback:Zi,schema:to(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(io,"data_set"),lr(io,"views"),ge({},lr(io,"field_y_axis"),{fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(io,"field_x_axis"),{fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:2,testId:"add-dimension"}),lr(io,"sort"),lr(io,"filter"),lr(io,"custom_metrics"),lr(io,"limit")]},formatPanelConfig:function(){var e,t,n;return[ur(io),ge({},lr(io,"chart_styles"),{subSection:[null==(e=io.format_panel.chart_styles)?void 0:e.subSectionDefinition.stacked,null==(t=io.format_panel.chart_styles)?void 0:t.subSectionDefinition.legend,null==(n=io.format_panel.chart_styles)?void 0:n.subSectionDefinition.curve]}),dr(io),ge({},lr(io,"conditional_formatting"),{ruleType:"areaColor"}),lr(io,"goal_line"),lr(io,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1}}},oo=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{fontSize:s.string().allow(""),formatter:s.object(),measure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:En(e.queryEngineConfig),prefixes:s.object(),postfixes:s.object(),type:s.valid("singleStat").required(),limit:Ln(),direction:s.string().valid("horizontal","vertical"),conditionalFormattingRules:Pi(e.queryEngineConfig),deltaTimeDimension:s.alternatives(In(e.queryEngineConfig.supportedTimeTruncFunctions),s.valid(null)),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),tags:An()}))},ao=function(e){if("singleMeasure"in e){var t={},n={},i=[],r={};return e.singleMeasure&&(i=[e.singleMeasure],t[Ti(e.singleMeasure)]=e.prefix,n[Ti(e.singleMeasure)]=e.postfix,r[Ti(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:n,measure:i,formatter:r,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,tags:e.tags,filter:De(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:Ne(e.parameters)}}return ge({},e,{filter:De(e.filter)})},lo={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"},direction:{title:"Direction",type:"direction",description:"",namespace:"direction"}}}}},so=function(e){return{title:lo.title,description:lo.description,servicesClass:"SingleStat",namespace:lo.namespace,dump:function(e){return e},load:function(e){var t,n,i=ao(e);return{type:"singleStat",prefixes:i.prefixes,postfixes:i.postfixes,formatter:i.formatter,fontSize:i.fontSize,measure:Ee(i.measure),displayTitle:i.displayTitle,displaySubject:i.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:$i(e.viewId),filter:i.filter,dataSetId:i.dataSetId,limit:i.limit,direction:null!=(t=i.direction)?t:"horizontal",conditionalFormattingRules:i.conditionalFormattingRules,deltaTimeDimension:i.deltaTimeDimension,parameters:Ne(i.parameters),tags:null!=(n=i.tags)?n:[]}},setAttributes:function(t,n){return Ni(t,n,oo(e))},validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,direction:"horizontal",conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[]},t)},schema:oo(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[n.measure[0]]})},dataPanelConfig:function(){return[lr(lo,"data_set"),lr(lo,"views"),ge({},lr(lo,"field_metrics"),{fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),lr(lo,"filter"),lr(lo,"custom_metrics"),lr(lo,"comparison")]},formatPanelConfig:function(){var e,t;return[ur(lo),ge({},lr(lo,"stats_labels"),{prefix:pr(lo,"prefix"),postfix:pr(lo,"postfix"),format:pr(lo,"format"),count:pr(lo,"count")}),ge({},lr(lo,"format"),{subSection:[null==(e=lo.format_panel.format)?void 0:e.subSectionDefinition.font_size,null==(t=lo.format_panel.format)?void 0:t.subSectionDefinition.direction]}),ge({},lr(lo,"conditional_formatting"),{ruleType:"fontColor"})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){var n=r.cloneDeep(Uo(t.fields,{onlyFieldTypes:["number"]}));return ge({},e,{type:"singleStat",protectedByOrganisation:!0,measure:[].concat(n).map((function(e){return{function:"none",field:e.id}}))})}}},uo=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{type:s.valid("custom").required(),customViewId:s.string().required(),tags:An()}))},co={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}}}},po=function(e){return{title:co.title,description:co.description,namespace:co.namespace,servicesClass:"Custom",dump:function(e){return e},load:function(e){var t;return{type:"custom",viewId:$i(e.viewId),customViewId:e.customViewId,displayTitle:e.displayTitle,displaySubject:e.displaySubject,dataSetId:e.dataSetId,tags:null!=(t=e.tags)?t:[],protectedByOrganisation:e.protectedByOrganisation}},setAttributes:function(t,n){return Ni(t,n,uo(e))},validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return{type:"custom",viewId:$i(null==t?void 0:t.viewId),customViewId:(null==t?void 0:t.customViewId)||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}},schema:uo(e),removeField:function(e,t){return e},isRunnable:function(){return!0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[lr(co,"data_set"),lr(co,"views")]},formatPanelConfig:function(){return[ur(co)]},supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{colorGradient:!1,parameters:!1}}},fo=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{type:s.valid("mercatorMap").required(),measure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:En(e.queryEngineConfig),limit:Ln(),dimension:Dn({},e.attributesSchemaOptions),labelFormat:s.alternatives(s.string(),s.valid(null)),noDataColor:s.string().required(),backgroundColor:s.string().required(),maxValueColor:s.string().required(),minValueColor:s.string().required(),position:s.object({scale:s.number(),centerX:s.number(),centerY:s.number()}),tags:An()}))},mo=function(e){return function(t,n){return Ni(t,n,fo(e))}},ho={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},vo=function(e){return{title:ho.title,description:ho.description,servicesClass:"MercatorMap",namespace:ho.namespace,dump:function(e){return e},load:function(e){var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:$i(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:Ee(e.measure),labelFormat:e.labelFormat,position:e.position,filter:De(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0",tags:null!=(t=e.tags)?t:[]}},setAttributes:mo(e),validate:function(){return[]},init:function(e,t){return ge({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:$i(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[]},t)},schema:fo(e),removeField:function(e,t){return e},isRunnable:function(e){return!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0])},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[lr(ho,"data_set"),lr(ho,"views"),ge({},lr(ho,"field_metrics"),{type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(ho,"field_country"),{fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"}),lr(ho,"filter"),lr(ho,"custom_metrics"),lr(ho,"limit")]},formatPanelConfig:function(){var e;return[ur(ho),ge({},lr(ho,"chart_styles"),{subSection:[null==(e=ho.format_panel.chart_styles)?void 0:e.subSectionDefinition.number_format]}),lr(ho,"map_colors")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!1}}},go=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),Pn(e.queryEngineConfig,e.attributesSchemaOptions),{type:s.valid("richText").required(),tags:An(),content:s.any()}))},xo=function(e){return function(t,n){return Ni(t,n,go(e))}},bo={title:"Rich text",description:"Add your data to a rich text component.",namespace:"rich_text",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this rich text view?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What metrics do you need to collect?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to group your results?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"How should the results be ordered?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this text view."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to use on this text view."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format",description:""}}},yo={type:"doc",content:[{type:"heading",attrs:{level:1},content:[{type:"text",text:"Rich text views"}]},{type:"paragraph",content:[{type:"text",text:"In this view, you can add any "},{type:"text",marks:[{type:"bold"}],text:"text based content"},{type:"text",text:" to your dashboard, and "},{type:"text",marks:[{type:"italic"}],text:"mix in your data with it!"}]},{type:"paragraph",content:[{type:"text",text:"Remember to use the "},{type:"text",marks:[{type:"bold"}],text:"format"},{type:"text",text:" "},{type:"text",marks:[{type:"bold"}],text:"tab"},{type:"text",text:" to "},{type:"text",marks:[{type:"underline"}],text:"style"},{type:"text",text:" your contents"}]},{type:"heading",attrs:{level:2},content:[{type:"text",text:"Adding data?"}]},{type:"paragraph",content:[{type:"text",text:"You can add data to your text content by using templating. For example, is how to take metrics "},{type:"text",marks:[{type:"code"}],text:'"Metric Name"'},{type:"text",text:" and "},{type:"text",marks:[{type:"code"}],text:'"A different metric name" '},{type:"text",text:"from the first row of the results, and show it on this view;"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:"{{ data.first.metric_name }}\n{{ data.first.a_different_metric_name }}\n"}]}]},wo=function(e){return{title:bo.title,description:bo.description,servicesClass:"RichText",namespace:bo.namespace,dump:function(e){return e},load:function(e){var t;return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:$i(e.viewId),type:"richText",dimension:e.dimension,limit:e.limit,measure:Ee(e.measure),filter:De(e.filter),tags:null!=(t=e.tags)?t:[],content:e.content||"",order:e.order||[],timeDimension:e.timeDimension||null}},setAttributes:xo(e),validate:function(){return[]},init:function(e,t){return ge({type:"richText",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:$i(null==t?void 0:t.viewId),tags:[],order:[],timeDimension:null,content:yo},t)},schema:go(e),removeField:function(e,t){return e},isRunnable:function(e){return!(!e.measure||!e.measure[0])},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[lr(bo,"data_set"),lr(bo,"views"),ge({},lr(bo,"field_metrics"),{fieldFilterOptions:{forComponent:"richText",onlyMeasures:!0},preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(bo,"field_grouping"),{fieldFilterOptions:{forComponent:"richText",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:2,testId:"add-dimension"}),lr(bo,"sort"),lr(bo,"filter"),lr(bo,"custom_metrics"),lr(bo,"limit")]},formatPanelConfig:function(){return[ur(bo),ge({},lr(bo,"rich_text"))]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!1}}},Co=["areaChart","barChart","basicTable","comboChart","custom","dataTable","funnelChart","horizontalBarChart","lineChart","lineChartV2","mercatorMap","pieChart","progress","richText","scatterChart","singleStat"],jo=function(e){return e.Linear="linear",e.Circular="circular",e}({}),Fo=function(e){return s.object(ge({},Nn(e.attributesSchemaOptions),{measure:s.array().items(Tn(e.queryEngineConfig.supportedAggregates,e.attributesSchemaOptions)),filter:En(e.queryEngineConfig),type:s.valid("progress").required(),limit:Ln(),conditionalFormattingRules:Pi(e.queryEngineConfig),parameters:Hn(e.queryEngineConfig,e.attributesSchemaOptions),goals:s.array().items(s.object({field:s.string().required().description("ID of the field in the data set to which the goal applies too"),value:s.number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:s.array().items(s.object({field:s.string().required().description("ID of the field to set the progress type of"),value:s.valid(jo.Linear,jo.Circular).required()})).description("Set the display type of the progress view"),formatter:s.object().pattern(s.string(),s.string()),prefixes:s.object().pattern(s.string(),s.string()),postfixes:s.object().pattern(s.string(),s.string()),tags:An()}))},So={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},ko=function(e){return{title:So.title,description:So.description,dump:function(e){return e},namespace:So.namespace,servicesClass:"Progress",load:function(e){var t,n=ao(e);return{type:"progress",measure:Ee(n.measure),displayTitle:n.displayTitle,displaySubject:n.displaySubject,protectedByOrganisation:n.protectedByOrganisation,viewId:$i(n.viewId),filter:n.filter,dataSetId:n.dataSetId,limit:n.limit,conditionalFormattingRules:n.conditionalFormattingRules,parameters:n.parameters,prefixes:n.prefixes,postfixes:n.postfixes,formatter:n.formatter,goals:n.goals,progressType:n.progressType,tags:null!=(t=n.tags)?t:[]}},setAttributes:function(t,n){return Ni(t,n,Fo(e))},validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[]},t)},schema:Fo(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[lr(So,"data_set"),lr(So,"views"),lr(So,"progress_goals"),lr(So,"filter"),lr(So,"custom_metrics")]},formatPanelConfig:function(){return[ur(So),lr(So,"progress_type"),ge({},lr(So,"stats_labels"),{prefix:pr(So,"prefix"),postfix:pr(So,"postfix"),format:pr(So,"format"),count:pr(So,"count")})]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!1}}},Ao=function(e){return function(t,n){var i=Ni(t,n,Vi(e));return Li(i)}},To={title:"Funnel chart",description:"Track conversion between stages of a process.",namespace:"funnel_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},_o=function(e){return{title:To.title,description:To.description,servicesClass:"FunnelChart",namespace:To.namespace,dump:function(e){return e},load:function(e){var t;return ge({},e,{measure:Ee(e.measure),order:Oe(e.order,e.timeDimension),dimension:st(e.dimension),viewId:$i(e.viewId),filter:De(e.filter),approxXAxisLabelCount:Le(e.approxXAxisLabelCount),approxYAxisLabelCount:Le(e.approxYAxisLabelCount),tags:null!=(t=e.tags)?t:[],parameters:Ne(e.parameters)})},setAttributes:Ao(e),validate:function(t,n){return Ki(t,n,e.queryEngineConfig)},init:function(e,t){return ge({type:"funnelChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:$i(null==t?void 0:t.viewId),filter:[],parameters:{},order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[]},t)},createFeedback:Zi,schema:Vi(e),removeField:function(t,n){return Ei(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=ra(t,e.queryEngineConfig,"funnelChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[lr(To,"data_set"),lr(To,"views"),ge({},lr(To,"field_y_axis"),{fieldFilterOptions:{forComponent:"funnelChart"},preSetPartialAttributes:function(e){return{measure:e}},allowsMultiple:!1,maxAllowed:1,getValues:function(e){return e.measure},testId:"metric-input"}),ge({},lr(To,"field_x_axis"),{fieldFilterOptions:{forComponent:"funnelChart",onlyDimensions:!0},allowsMultiple:!1,preventDuplicates:!0,preSetPartialAttributes:function(e,t){return nr(e,t)},getValues:function(e){return ir(e)},maxAllowed:1,testId:"add-dimension"}),lr(To,"sort"),lr(To,"filter"),lr(To,"custom_metrics"),lr(To,"limit")]},formatPanelConfig:function(){return[ur(To),cr(To,!1,!1),dr(To),ge({},lr(To,"conditional_formatting"),{ruleType:"backgroundColor"}),lr(To,"headline")]},supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,calculatedField:[mr.Maths,mr.IfStatement]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet:function(e,t){return tr(e,t,this.setAttributes)}}},Io=["title","description","data_panel","format_panel"],Do=["title","description","callToAction"],Oo=s.alternatives().try(s.string(),s.object({sentence:s.string().custom((function(e,t){for(var n,i=/\{\{(\w+)\}\}/g;null!==(n=i.exec(e));){var r=n[1];if(!t.state.ancestors[0][r+"_singular"]||!t.state.ancestors[0][r+"_plural"])return t.error("any.invalid",{message:'"textOverride": "'+r+'" found in sentence but corresponding "'+r+'_singular" and "'+r+'_plural" fields are missing'})}return e}))}).pattern(/.+_(singular|plural)$/,s.string())).messages({"any.custom":"{{#message}}"}),Eo=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Lo=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,No=/on[a-z]+\s*=\s*["'][^"']*["']/gi,Mo=/javascript:[^\s"']+/gi,Ro=new RegExp("^(?:"+/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/.source+"|"+/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/.source+"|[^*_<>])*$","m"),Po=function(e){if(Eo.test(e)||Lo.test(e)||No.test(e)||Mo.test(e))throw new Error("Invalid content: potentially malicious elements detected.");return Ro.test(e)},zo=function(e,t,n,i){return Vo(e,t,n,void 0,i)},Vo=function(e,t,n,i,r){if(r)return"[key: "+e+"]";var o,a=i?function(e,t){var n=e[t],i=Oo.validate(n);return i.error&&i.error.details.forEach((function(e){var t;Je(null==(t=e.context)?void 0:t.message)})),function(){if("string"==typeof n)return Po(n);if("object"==typeof n)return Po(n.sentence);if(void 0===n)return!0;throw new Error("Invalid translation type")}()?n:void 0}(i,e):void 0;return o=function(e,t){return t?e.replace(/\[\[([^\]]+)\]\]/g,(function(e,n){for(var i,r=ve(n.split("|"));!(i=r()).done;){var o=t[i.value];if("string"==typeof o&&""!==o)return o;if("number"==typeof o)return o.toString()}return""})):e}(o="object"==typeof a&&null!==a?a.sentence:"string"==typeof a?a:t,n),n&&(o=function(e,t,n){return Object.entries(t).forEach((function(t){var i=t[0],r=t[1];if(r&&"object"==typeof r&&"count"in r){var o=1===r.count?n&&n[i+"_singular"]||r.singular:n&&n[i+"_plural"]||r.plural;e=e.replace(new RegExp("{{"+i+"}}","g"),o)}})),e}(o,n,a)),function(e,t){if(!t)return e;for(var n=0,i=Object.entries(t);n<i.length;n++){var r=i[n],o=r[1];if("string"==typeof o||"number"==typeof o){var a=new RegExp("\\[\\["+r[0]+"\\]\\]","g");e=e.replace(a,String(o))}}return e}(o,n)},qo=function(e,t){var n=null!=t?t:Vo,i=e,r=e.namespace;return Io.forEach((function(t){if("title"===t||"description"===t){var o,a=n(r+"."+t,e[t]);i=ge({},i,((o={})[t]=a,o))}if("data_panel"===t){var l=r+"."+t,s=[];e.dataPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Wo(e,n,l)),Ho(e).forEach((function(t){var i=n(l+"."+t.key,t.defaultValue);e[t.property]=i})),s.push(e)})),i=ge({},i,{dataPanelConfig:function(){return s}})}if("format_panel"===t){var u=r+"."+t,d=[];e.formatPanelConfig().forEach((function(e){e.subSection&&(e.subSection=Wo(e,n,u)),function(e,t,n){function i(n,i){n&&Ho(n).forEach((function(r){var o=e(t+"."+i+"."+r.key,r.defaultValue);n[r.property]=o}))}function r(e,t,n){t.forEach((function(t){var r=e[t];r&&i(r,n)}))}n.x&&(r(n.x,Bo,"axis_labels"),i(n.x,"axis_labels")),n.y&&(r(n.y,Bo,"axis_labels"),i(n.y,"axis_labels")),function(e){return"prefix"in e}(n)&&r(n,Bo,"stats_labels")}(n,u,e),Ho(e).forEach((function(t){var i=n(u+"."+t.key,t.defaultValue);e[t.property]=i})),d.push(e)})),i=ge({},i,{formatPanelConfig:function(){return d}})}})),i},Bo=["count","axisTitle","format","postfix","prefix"];function Wo(e,t,n){var i;return null==(i=e.subSection)?void 0:i.map((function(i){return Ho(i).forEach((function(r){var o=t(n+"."+e.namespace+"."+r.key,r.defaultValue);i[r.property]=o})),i}))}function Ho(e){var t=e.namespace||e.type;if(!t)return[];var n=[];return Do.forEach((function(i){if(e[i]){var r=i;"callToAction"===i&&(r="call_to_action"),n.push({key:t+"."+r,defaultValue:e[i],property:i})}})),n}var Yo={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function Go(e,t){if("areaChart"==e)return qo(ro(t||Yo),null==t?void 0:t.textOverride);if("barChart"==e)return qo(hr(t||Yo),null==t?void 0:t.textOverride);if("basicTable"==e)return qo(Zr(t||Yo),null==t?void 0:t.textOverride);if("comboChart"==e)return qo(Vr(t||Yo),null==t?void 0:t.textOverride);if("custom"==e)return qo(po(t||Yo),null==t?void 0:t.textOverride);if("dataTable"==e)return qo(Gr(t||Yo),null==t?void 0:t.textOverride);if("funnelChart"==e)return qo(_o(t||Yo),null==t?void 0:t.textOverride);if("richText"==e)return qo(wo(t||Yo),null==t?void 0:t.textOverride);if("horizontalBarChart"==e)return qo(eo(t||Yo),null==t?void 0:t.textOverride);if("lineChart"==e)return qo(Sr(t||Yo),null==t?void 0:t.textOverride);if("lineChartV2"==e)return qo(_r(t||Yo),null==t?void 0:t.textOverride);if("mercatorMap"==e)return qo(vo(t||Yo),null==t?void 0:t.textOverride);if("pieChart"==e)return qo(Or(t||Yo),null==t?void 0:t.textOverride);if("progress"==e)return qo(ko(t||Yo),null==t?void 0:t.textOverride);if("scatterChart"==e)return qo(Mr(t||Yo),null==t?void 0:t.textOverride);if("singleStat"==e)return qo(so(t||Yo),null==t?void 0:t.textOverride);throw"Cannot get interface for "+e+". Please implement it."}function Uo(e,t){var n=[].concat(e);return null!=t&&t.onlyFieldTypes&&!r.isEmpty(t.onlyFieldTypes)&&(n=[].concat(n).filter((function(e){var n;return null==t||null==(n=t.onlyFieldTypes)?void 0:n.includes(e.dataType)}))),null!=t&&t.forComponent&&(n=function(e,t){var n=Go(t);return[].concat(e).filter((function(e){var t=!0;return fn(e)&&!n.supportedCustomFields.percentages&&(t=!1),dn(e)&&!n.supportedCustomFields.simpleMaths&&(t=!1),mn(e)&&!n.supportedCustomFields.rules&&(t=!1),cn(e)&&!n.supportedCustomFields.roundedNumbers&&(t=!1),hn(e)&&!n.supportedCustomFields.conditional&&(t=!1),gn(e)&&!n.supportedCustomFields.dateCalculations&&(t=!1),t}))}(n,t.forComponent)),null!=t&&t.removePercentage&&(n=n.filter((function(e){return!fn(e)}))),null!=t&&t.removeRuleGrouping&&(n=n.filter((function(e){return!mn(e)}))),null!=t&&t.removeSimpleMaths&&(n=n.filter((function(e){return!dn(e)}))),null!=t&&t.removeAggregateMaths&&(n=n.filter((function(e){return!pn(e)}))),null!=t&&t.removeDateCalculations&&(n=n.filter((function(e){return!gn(e)}))),null!=t&&t.removeConditional&&(n=n.filter((function(e){return!hn(e)}))),null!=t&&t.onlyDimensions&&(n=n.filter((function(e){return e.canBeDimension}))),null!=t&&t.onlyMeasures&&(n=n.filter((function(e){return e.canBeMeasure}))),n}var Ko=function(e,t){return e.find((function(e){return e.id==t}))||null},Xo=function(e,t){return e.find((function(e){return e.name==t}))||null},Qo=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n;throw new ki(e,t)},Zo=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n},Jo=function(e,t){var n=[].concat(e.fields).find((function(e){return e.publicName==t}));if(n)return n;throw"Failed to find field by name in data set. Looking for "+t},$o=function(e,t){var n=r.findIndex(e,(function(e){return e.id==t}));return[e[n]||null,n]},ea=function(e,t){return ge({},e,{fields:[].concat(e.fields).map((function(e){return function(e,t,n){var i=$e(e.id);return{id:e.id,dataType:e.dataType,publicName:e.publicName||i,dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],description:e.description||void 0,canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?Te(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities,supportedAggregateOptions:dt(t,e.dataType,e.supportedAggregateOptions)}}(e,t)}))})},ta=function(e,t){var n=[].concat(e.fields).filter(bn);return t&&(n=Uo(n,{forComponent:t})),n},na=function(e){return ge({},e,{fields:[].concat(e.fields).filter((function(e){return!bn(e)}))})},ia=function(e,t){return[].concat(e).map((function(e){return e.id==t.id?t:e}))},ra=function(e,t,n){var i="horizontalBarChart"===n?void 0:"x",r=function(e){return[].concat(Uo(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0}))}(e)[0],o=[].concat(function(e,t){return[].concat(Uo(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t}))}(e,n)).map((function(e){var n=nt(e,t.supportedAggregates);return{field:e.id,function:n}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:r?[{field:r.id,function:"none",pivot:i}]:[]}},oa=function(e,t,n){var i=Uo(e.fields,{removeAggregateMaths:!0,removePercentage:!0,removeConditional:!0}),r=[].concat(i).map((function(e){return{field:e.id,function:"none"}}));return{dataSetId:e.id,measure:r,timeDimension:null,order:[],filter:n,dimension:[],limit:t,offset:0}},aa=function(e){if(!e.preAggregated)throw"buildViewOnlyQuery function should only be used for single-view datasets";return{dataSetId:e.id,preparedQueryType:"preAggregated",type:"preparedQuery",filter:{}}},la=function(e,t){if(!t)return e;e=e.map(na);var n=[].concat(e).map((function(e){var n=(t[e.id]||[]).map(wn);return ge({},e,{fields:[].concat(e.fields,n)})}));return[].concat(n)},sa=function(e,t,n,i,r){var o,a,l;return void 0===r&&(r={}),{id:n,publicName:i,dataType:t,canBeDimension:null!=(o=r.canBeDimension)?o:"number"!=t,canBeMeasure:null==(a=r.canBeMeasure)||a,allowedOperators:null!=(l=r.allowedOperators)?l:Te({dataType:t},e)}},ua=function(e,t,n,i){return void 0===i&&(i={}),sa(e,"string",t,n,i)},da=function(e,t,n,i){return void 0===i&&(i={}),sa(e,"number",t,n,i)},ca=function(e,t,n,i){return void 0===i&&(i={}),sa(e,"boolean",t,n,i)},pa=function(e,t,n,i){var r,o,a,l;return{id:t,publicName:n,dataType:"date_time",allowedGranularities:null!=(r=i.allowedGranularities)?r:Object.keys(e.supportedTimeTruncFunctions),allowedOperators:null!=(o=i.allowedOperators)?o:Te({dataType:"date_time"},e),canBeDimension:null==(a=i.canBeDimension)||a,canBeMeasure:null!=(l=i.canBeMeasure)&&l}},fa={string:function(e,t,n){return void 0===n&&(n={}),ua(a.QueryEngineConfig.getQueryEngineConfig("js"),e,t,n)},number:function(e,t,n){return void 0===n&&(n={}),da(a.QueryEngineConfig.getQueryEngineConfig("js"),e,t,n)},boolean:function(e,t,n){return void 0===n&&(n={}),ca(a.QueryEngineConfig.getQueryEngineConfig("js"),e,t,n)},stringArray:function(e,t,n){return void 0===n&&(n={}),function(e,t,n,i){return void 0===i&&(i={}),sa(e,"string[]",t,n,i)}(a.QueryEngineConfig.getQueryEngineConfig("js"),e,t,n)},dateTime:function(e,t,n){return void 0===n&&(n={}),pa(a.QueryEngineConfig.getQueryEngineConfig("js"),e,t,n)}},ma={__proto__:null,number:da,string:ua,boolean:ca,dateTime:pa,InBrowser:fa},ha={name:"1cfxi1i",styles:".v_contentEnter{transition-property:all cubic-bezier(0, 0, 0.2, 1) 300ms;}.v_contentEnterFrom{opacity:0;transform:translateY(4px) scale(0.95);}.v_contentEnterTo{opacity:1;transform:translateY(0) scale(1);}.v_contentLeave{transition-property:all cubic-bezier(0.4, 0, 1, 1) 200ms;}.v_contentLeaveFrom{opacity:1;transform:translateY(0) scale(1);}.v_contentLeaveTo{transform:translateY(4px) scale(0.95);}.v_overlayEnter{transition-property:all cubic-bezier(0, 0, 0.2, 1) 300ms;}.v_overlayEnterFrom{opacity:0;}.v_overlayEnterTo{opacity:1;}.v_overlayLeave{transition-property:all cubic-bezier(0.4, 0, 1, 1) 300ms;}.v_overlayLeaveFrom{opacity:1;}.v_overlayLeaveTo{opacity:0;}.vizzly-studio hr{height:0;color:inherit;border-top-width:1px;}.vizzly-studio svg{display:block;vertical-align:middle;}.vizzly-toolbar hr{height:0;color:inherit;border-top-width:1px;}.vizzly-toolbar svg{display:block;vertical-align:middle;}.vizzly-modals hr{height:0;color:inherit;border-top-width:1px;}.vizzly-modals svg{display:block;vertical-align:middle;}.vizzly-popover hr{height:0;color:inherit;border-top-width:1px;}.vizzly-popover svg{display:block;vertical-align:middle;}*,::after,::before{box-sizing:border-box;}"},va=function(){return p.jsx(c.Global,{styles:ha})},ga=function(e){function t(){return e.apply(this,arguments)||this}return be(t,e),t}(Fe(Error)),xa=function(e){return e.InProgress="InProgress",e.Saved="Saved",e.Undefined="Undefined",e}({}),ba=function(){function e(){this.subscribers={}}var t=e.prototype;return t.get=function(e,t){var n=this;return this.subscribers[e]||(this.subscribers[e]=[]),this.subscribers[e].push(t),function(){n.subscribers[e]=n.subscribers[e].filter((function(e){return e!==t}))}},t.set=function(e,t){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e(t)}))},t.reload=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({reload:!0})}))},t.inBrowserRefetchData=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({reload:!0,clearInMemoryDb:!0})}))},t.save=function(e){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({save:!0})}))},t.resizing=function(e,t,n){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({resizing:n||t})}))},t.drilldown=function(e,t){this.subscribers[e]&&this.subscribers[e].forEach((function(e){return e({drilldown:t})}))},e}(),ya=new ba,wa=new ba,Ca=require("../package.json");if("undefined"!=typeof window&&"undefined"!=typeof localStorage){var ja=localStorage.getItem("__VIZZLY__LOG_LEVEL_STORED");ja&&Ye(ja),window.VizzlyDev={version:(null==Ca?void 0:Ca.version)||"dev",getServerLogLevel:function(){return localStorage.getItem("__VIZZLY__SERVER_LOG_LEVEL_STORED")},resetServerLogLevel:function(){localStorage.removeItem("__VIZZLY__SERVER_LOG_LEVEL_STORED")},setServerLogLevel:function(e){return We.includes(e)?(Ye(e,(function(e){localStorage.setItem("__VIZZLY__SERVER_LOG_LEVEL_STORED",e)})),window.location.reload(),"Log level set to "+e+"."):"Invalid log level. Please set one of "+We.join(", ")},setLogLevel:function(e){return We.includes(e)?(Ye(e,(function(e){localStorage.setItem("__VIZZLY__LOG_LEVEL_STORED",e)})),window.location.reload(),"Log level set to "+e+"."):(console.warn("Invalid log level. Please set one of",We),"Invalid log level. Please set one of "+We.join(", "))},clearRuntimeDeveloperTools:function(){localStorage.removeItem("__VIZZLY_RUNTIME_DEVELOPER_TOOLS"),window.location.reload()},clearStoredFilters:function(){localStorage.removeItem("dashboard_global_filters"),window.location.reload()},setRuntimeDeveloperTools:function(e){localStorage.setItem("__VIZZLY_RUNTIME_DEVELOPER_TOOLS",JSON.stringify(e)),window.location.reload()},dashboardSummary:function(){var e=document.querySelectorAll('[data-vizzly-summary="true"]'),t=[];return e.forEach((function(e){var n=e.getAttribute("data-vizzly-dashboard-id"),i=e.getAttribute("data-vizzly-user-reference"),r=e.getAttribute("data-vizzly-project-id"),o=e.getAttribute("data-vizzly-parent-dashboard-id");t.push({dashboardId:n,parentDashboardId:o,userReference:i,projectId:r})})),console.debug(JSON.stringify(t,null,2)),t},getRuntimeDeveloperTools:function(){return JSON.parse(localStorage.getItem("__VIZZLY_RUNTIME_DEVELOPER_TOOLS")||"{}")}}}var Fa=function(e,t){return e/t*100},Sa=function(e,t){return(Math.round(100*e)/100).toFixed(t)},ka=function(e,t){return new Intl.NumberFormat(void 0,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e)},Aa={year:"numeric",month:"short",day:"numeric"},Ta={year:"numeric",month:"short"},_a={weekday:"long",year:"numeric",month:"long",day:"numeric"},Ia=function(e,t,n){if(!e)return"";var i=e.toLocaleDateString("en-GB",n);return t&&t!=Intl.DateTimeFormat().resolvedOptions().timeZone?i+" ("+t+")":i},Da=function(e,t){var n={hour:"2-digit",minute:"2-digit"};return t&&(n.seconds="2-digit"),e.toLocaleTimeString("en-GB",n)},Oa=function(e,t){if("day_of_month"===t&&("number"==typeof e||"string"==typeof e))return""+e+function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}("string"==typeof e?parseInt(e):e);if("hour_of_day"===t&&("string"==typeof e||"number"==typeof e)){var n="number"==typeof e?e:parseInt(e),i=""+n;return n<10&&(i="0"+e),i+":00"}return"week_of_year"===t?"Week "+e:"month_of_year"!==t||"string"!=typeof e&&"number"!=typeof e?"day_of_week_iso"!==t||"string"!=typeof e&&"number"!=typeof e?Ea(new Date(e),t):{1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday",7:"Sunday"}[""+e]||null:{1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"}[""+e]||null},Ea=function(e,t){if(isNaN(e.getTime()))return"";var n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate();return r<10&&(r="0"+r),i<10&&(i="0"+i),"quarter"==t?"Q"+Na(e)+", "+e.getFullYear().toString():"week"==t?"Week "+Ma(e)+", "+e.getFullYear().toString():"DD-MM-YYYY"==t?r+"-"+i+"-"+n:"DD/MM/YYYY"==t?r+"/"+i+"/"+n:"MM-DD-YYYY"==t?i+"-"+r+"-"+n:"MM/DD/YYYY"==t?i+"/"+r+"/"+n:"DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=ge({},Aa,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"dddd DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=ge({},_a,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"hh:mm"==t?Da(e):"hh:mm:ss"==t?Da(e,!0):"DD MMMM YYYY"==t?function(e,t){return Ia(e,void 0,Aa)}(e):"MMMM YYYY"==t?Ia(e,null,Ta):"YYYY-MM-DD[T]HH:mm:ss"==t?e.getFullYear()+"-"+i+"-"+r+"T"+Da(e):"YYYY"==t?e.getFullYear().toString():null},La=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Na=function(e){return Math.floor((e.getMonth()+3)/3)},Ma=function(e){var t=new Date(e),n=new Date(e.getFullYear(),0,1),i=Math.floor((t.getTime()-n.getTime())/864e5);return Math.ceil(i/7)},Ra=function(e){return Array(e).fill(void 0)},Pa=function(e,t){var n=r.cloneDeep(e);return n.splice(t,1),n},za=function(e,t,n,i){return JSON.stringify({dimensionKeys:e,dimensionValues:t,fieldId:n,function:i})},Va=function(e){if(!e)return!1;try{return qa(e),!0}catch(e){return!1}},qa=function(e){var t=JSON.parse(e);return{dimensionKeys:t.dimensionKeys,dimensionValues:t.dimensionValues,fieldId:t.fieldId,function:t.function}},Ba=function(e){var t=qa(e);return rt({function:t.function,field:t.fieldId})},Wa=function(e){return[].concat(e.content).map((function(t){return r.reduce(t,(function(t,n,i){return t[e.fields[i].id]=n,t}),{})}))},Ha=function(e,t,n,i,o){if(void 0===i&&(i=!1),!e)return[];var a=Wa(e),l=[].concat(a).map((function(e){var i=[].concat(n.x).map((function(t){return tt(e[t],o)})),r={},a=[].concat(n.y).map((function(t){return e[t]}));t.forEach((function(t){var i=Ti(t),o=za(n.y,a,t.field,t.function);r[o]=e[i]}));var l={};return[].concat(n.x).forEach((function(t){l[t]=e[t]})),ge({},l,{x:i.join(", ")},r,{xValues:i})})),s=[],u={};l.forEach((function(e){var t=u[e.x];u[e.x]||s.push(e.x),u[e.x]=r.merge({},t,e)}));var d=s.map((function(e){return u[e]}));return i?Za(d):d},Ya=function(e,t,n){if(!n)return[];var i=Wa(n),r={};return i.forEach((function(n){var i=[].concat(e.y).map((function(e){return n[e]}));t.forEach((function(t){var n=za(e.y,i,t.field,t.function);r[n]=!0}))})),Object.keys(r)},Ga=function(e,t){return r.findIndex(e.fields,(function(e){return e.id==t}))},Ua=function(e,t){return e.fields[Ga(e,t)]},Ka=function(e){return void 0===e},Xa=function(e){return null===e},Qa=function(e){return!!Ka(e)||!!Xa(e)||r.isEmpty(e.content)},Za=function(e){var t=["x","xValues"];return e.map((function(e){var n=ge({},e),i=r.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:r.isNumber(n)?n:0}));return n=r.mapValues(n,(function(e,o){return t.includes(o)?e:r.isNumber(e)?Fa(n[o],i):e}))}))},Ja=function(e,t){return f.scale(e).colors(t)},$a=function(e,t){var n;return(null!=t?t:0)<=(null!=(n=null==e?void 0:e.length)?n:0)?e:nl(Ja(e,t))},el={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},tl=function(e){var t=1e4*Math.sin(e++);return t-Math.floor(t)},nl=function(e,t){void 0===t&&(t=5);for(var n,i,r=e.length;r;)i=Math.floor(tl(t)*r--),n=e[r],e[r]=e[i],e[i]=n,++t;return e},il=["contains_substring","does_not_contain_substring","ends_with","starts_with","<","<=",">",">="],rl=function(e,t){return function(e,t){if(null==t&&il.includes(e.op))return!1;switch(e.op){case"starts_with":return(""+t).startsWith(e.value);case"ends_with":return(""+t).endsWith(e.value);case"is_one_of":return e.value.includes(t);case"is_not_one_of":return!e.value.includes(t);case"contains_substring":return(""+t).includes(e.value);case"does_not_contain_substring":return!(""+t).includes(e.value);case"<":return t<e.value;case">":return t>e.value;case"=":return t==e.value;case"!=":return t!=e.value;case">=":return t>=e.value;case"<=":return t<=e.value;case"array_contains":return!!r.isArray(t)&&t.some((function(t){return e.value.includes(t)}));case"array_does_not_contain":return!!r.isArray(t)&&!t.some((function(t){return e.value.includes(t)}));case"array_contains_any_of":return!!r.isArray(t)&&t.some((function(t){return e.value.includes(t)}));case"array_contains_all_of":return!!r.isArray(t)&&t.every((function(t){return e.value.includes(t)}))}throw console.log("Unsupported comparison op.",e.op),"Unsupported comparison op."}(e,t)},ol=function(e){var t=e("number_format_option.noValueReplacement","No value"),n=e("number_format_option.formattingError","Formatting error");return{_vizzly_compact:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:Intl.NumberFormat(void 0,{notation:"compact"}).format(e)},description:e("number_format_option.compact","Compact")},_vizzly_to_2_dp:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:Sa(e,2)},description:e("number_format_option.to_2_dp","2 decimal places")},_vizzly_to_gbp:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:ka(e,"GBP")},description:e("number_format_option.currency_gbp","Currency £")},_vizzly_to_usd:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:ka(e,"USD")},description:e("number_format_option.currency_usd","Currency $")},_vizzly_to_eur:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:ka(e,"EUR")},description:e("number_format_option.currency_eur","Currency €")},_vizzly_to_percentage:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:function(e,t){var n=(100*e).toFixed(2);return n.endsWith(".00")?parseInt(n)+"%":n+"%"}(e)},description:e("number_format_option.percentage","Percentage")},_vizzly_separated:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:e.toLocaleString()},description:e("number_format_option.separated","Separated")},_vizzly_number:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:""+e},description:e("number_format_option.number","Number")},_vizzly_hours_and_minutes_from_minutes:{formatter:function(e,i){return void 0===i&&(i=t),null==e?i:Number.isNaN(e)?n:Math.floor(e/60)+" H : "+Sa(e%60,0)+" M"},description:e("number_format_option.minutes_to_hours_minutes","Minutes to hours & minutes")},hour_of_day:{description:"Hour of the day",formatter:function(e,n){return void 0===n&&(n=t),null==e?n:Oa(e,"hour_of_day")}},month_of_year:{description:"Month of the year",formatter:function(e,n){return void 0===n&&(n=t),null==e?n:Oa(e,"month_of_year")}},day_of_month:{description:"Day of month",formatter:function(e,n){return void 0===n&&(n=t),null==e?n:Oa(e,"day_of_month")}},day_of_week_iso:{description:"Day of week",formatter:function(e,n){return void 0===n&&(n=t),null==e?n:Oa(e,"day_of_week_iso")}},week_of_year:{description:"Week of year",formatter:function(e,n){return void 0===n&&(n=t),null==e?n:Oa(e,"week_of_year")}}}},al=function(e,t,n,i){var r;void 0===n&&(n=[]);var o=null!=(r=ll(i))?r:"NONE"===(null==t?void 0:t.toUpperCase())?null:t;return[].concat(n,[e,o]).filter((function(e){return null!=e})).join(" • ")},ll=function(e){return"Current"===e?"Current Trend":e||void 0},sl=function(e,t){return r.zipObject(null!=e?e:[],null!=t?t:[])},ul=function(e,t,n){if(!t)return e;if(r.isFunction(t)){if(null!=n&&n.filter)return t({value:e,filter:n.filter});if(null!=n&&n.fieldId)return t({value:e,fieldId:n.fieldId})}return t&&!r.isFunction(t)&&t[e]?t[e]:void 0};function dl(e,t,n,i,r){void 0===r&&(r=!0);for(var o=e.map((function(e){return Number(e[n])})),a=e.map((function(e){return new Date(e.x)})),l=o.length,s=a.map((function(e){return(e.getTime()-a[0].getTime())/864e5})),u=s.reduce((function(e,t){return e+t}),0)/l,d=o.reduce((function(e,t){return e+t}),0)/l,c=0,p=0,f=0;f<l;f++)c+=(s[f]-u)*(o[f]-d),p+=Math.pow(s[f]-u,2);for(var m=c/p,h=d-m*u,v=[],g=new Date(a[l-1]),x=0;x<l+(r?t:0);x++){var b,y=void 0;if(x<l)y=a[x];else{if(!r)continue;switch(i){case"week":g.setDate(g.getDate()+7);break;case"month":g.setMonth(g.getMonth()+1);break;case"quarter":g.setMonth(g.getMonth()+3);break;case"year":g.setFullYear(g.getFullYear()+1)}y=new Date(g)}var w=(y.getTime()-a[0].getTime())/864e5,C=m*w+h;v.push(((b={x:y})[n+"_current_linear_avg"]=x<l?parseFloat((m*w+h).toFixed(2)):void 0,b[n+"_forecast_linear_avg"]=x>=l-1?parseFloat(C.toFixed(2)):void 0,b))}return v}var cl=function(e){return!!e&&["week","month","quarter","year"].includes(e.truncate)},pl=function(e,t,n){var i=r.merge({},t,e);return r.merge({},n,i)},fl=function(e,t){return JSON.stringify(e)==JSON.stringify(t)},ml=function(e,t,n){var i=qa(n);return[].concat(t).flatMap((function(t){var n,o,a,l=rt({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(o=null==(a=t.filters)?void 0:a[0][0].function)?o:"none"}),s=function(e){var t=e.ruleFieldId,n=e.ruleFilters,i=e.dimensions,o=null==n?void 0:n[0][0];return(r.isArray(o.value)||!("string"!=typeof o.value&&"boolean"!=typeof o.value&&"number"!=typeof o.value))&&i.some((function(e){return e.field===t}))}({ruleFieldId:l,ruleFilters:t.filters,dimensions:e});return s||Ti({field:i.fieldId,function:i.function})==l?[{rule:t,isRuleOnDimension:s}]:[]}))},hl=function(e,t,n,i,r){return ml(e,t,n).map((function(e){var t,n,o,a,l,s,u,d=rt({field:null==(t=e.rule.filters)?void 0:t[0][0].field,function:null!=(n=null==(o=e.rule.filters)?void 0:o[0][0].function)?n:"none"}),c=at(d,{supportedAggregates:i,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),p=c.function,f=Qo(r,c.fieldId),m="When "+f.publicName+" "+(p&&"none"!=p?"("+p+")":"")+" "+(null==(a=e.rule.filters)?void 0:a[0][0].op)+" "+(null==(l=e.rule.filters)?void 0:l[0][0].value);return{isRuleOnDimension:e.isRuleOnDimension,color:e.rule.ruleValue,explanation:m,value:null==(s=e.rule.filters)?void 0:s[0][0].value,operator:null==(u=e.rule.filters)?void 0:u[0][0].op,conditionIsMet:function(t){var n,i;return rl({value:null==(n=e.rule.filters)?void 0:n[0][0].value,op:null==(i=e.rule.filters)?void 0:i[0][0].op},wl(f,t))}}}))},vl=function(e,t,n,i,o){if(n){var a=ml(e,t,i),l=qa(i),s=a.find((function(e){var t,a,s,u=e.rule,d=e.isRuleOnDimension;if(!r.isEmpty(u.filters)&&0!==u.filters.length){var c=rt({field:null==(t=u.filters)?void 0:t[0][0].field,function:null!=(a=null==(s=u.filters)?void 0:s[0][0].function)?a:"none"}),p=d?Qo(o,c):void 0,f=d?[].concat(l.dimensionValues,null!=n[c]?[n[c]]:[]):[n[i]];return r.some(f,(function(e){var t,n;return null==e?null:rl({op:null==(t=u.filters)?void 0:t[0][0].op,value:null==(n=u.filters)?void 0:n[0][0].value},p?wl(p,e):e)}))}}));if(s){var u=s.rule,d=u.ruleValue;return{value:d=function(e,t,n){if(e.boundaries&&2===e.boundaries.length&&e.ruleValueEnd){var i=e.boundaries[0],r="number"==typeof i?i:Number(i),o=e.boundaries[1],a="number"==typeof o?o:Number(o);t=f.scale([e.ruleValue,e.ruleValueEnd]).domain([r,a])(n).hex()}return t}(u,d,n[i]),type:s.rule.ruleType}}}},gl=function(e,t,n){return function(i,o){var a;if(i=null!=(a=ul(i,n,{fieldId:o}))?a:i,e){var l,s=t.defaultFormats()[null==e?void 0:e.truncate],u=t.dateTimeFormatOptions[s],d=t.dateTimeFormatOptions[(null==t?void 0:t.format)||""];return l=null!=d&&d.formatter?d.formatter(i):null!=u&&u.formatter?u.formatter(i):function(e){var t,n=new Date(e);if(!r.isDate(n)||isNaN(n.getTime()))return"string"==typeof e?e:"No value";try{if(!(t=Oa(n,"DD MMMM YYYY, hh:mm")||""))throw new Error("Invalid format")}catch(e){try{if(isNaN(n.getTime()))throw new Error("Invalid time value");t=n.toISOString()}catch(e){Je("Invalid time value",e),t="Invalid Date"}}return t}(i),""+(t.prefix||"")+l+(t.postfix||"")}return i=yl(i,t.numberFormatOptions,t.format),""+(t.prefix||"")+i+(t.postfix||"")}},xl=function(e,t){return function(n){var i;return"number"==typeof n?(n=yl(n,function(e,t){var n;return ge({},t,((n={}).default=function(e){return{description:"Default",formatter:ol(e)._vizzly_compact.formatter}}(e),n))}(e,null==t?void 0:t.numberFormatOptions),null!=(i=null==t?void 0:t.format)?i:"default"),""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")):""+((null==t?void 0:t.prefix)||"")+n+((null==t?void 0:t.postfix)||"")}},bl=function(e,t,n,i,r){return function(o){if(e){var a,l=(a=o).endsWith("_forecast_linear_avg")?{base:a.slice(0,-"_forecast_linear_avg".length),trend:"Forecast"}:a.endsWith("_current_linear_avg")?{base:a.slice(0,-"_current_linear_avg".length),trend:"Current"}:{base:a},s=l.trend,u=qa(l.base),d=Ti({function:u.function,field:u.fieldId}),c=Ua(e,d),p=_e(u.function,t);if(c){var f=al(null==c?void 0:c.publicName,p,u.dimensionValues,s),m=r({fieldId:u.fieldId,func:u.function,type:null!=n?n:"barChart",defaultLabel:f,viewId:null!=i?i:"",values:sl(u.dimensionKeys,u.dimensionValues)});return null!=m?m:f}}}},yl=function(e,t,n){var i,r=null==t||null==(i=t[null!=n?n:""])?void 0:i.formatter;return r?r(e):e};function wl(e,t){return"boolean"===e.dataType&&"string"==typeof t?(n=t,"boolean"===(i=e.dataType)&&("true"===n||"TRUE"===n||"True"===n)||("boolean"!==i||"false"!==n&&"FALSE"!==n&&"False"!==n)&&n):t;var n,i}var Cl={transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)"},jl=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},i=ge({},r.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var r=t?t[e]:null;r&&(i=ge({},i,n.variants&&n.variants[e]&&n.variants[e][r]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=ge({},e.css);r.every(Object.keys(r.omit(e,["css"])),(function(n){var i;return e[n]==(null==(i=t)?void 0:i[n])}))&&(i=ge({},i,n))})),i}},Fl=function(e){var t=function(t){var n=jl(e)(t);return m.css(n,"","")};return t.toString=t,t};function Sl(e){return function(e,t){for(var n=e.startsWith("#")?e.slice(1):e,i="",r=0;r<3;r++){var o=parseInt(n.substr(2*r,2),16);i+=("0"+Math.min(255,Math.floor(o+(255-o)*t/100)).toString(16)).slice(-2)}return"#"+i}("#374151",e)}function kl(e){for(var t,n={},i=ve(e);!(t=i()).done;){var r=t.value;n[r.toString()]=100-r}return n}var Al=kl([5,8,20,80,90]),Tl={base:Dl("55, 65, 81",0)};for(var _l in Al)Tl[_l]=Dl("55, 65, 81",Al[_l]);var Il={font:{header:16,standard:13,bold:400,sanSerif:"Inter, sans-serif",color:"rgb(55, 65, 81)"},size:{borderRadius:"0.5rem"},colors:{brand:Tl,blue:"rgb(48, 116, 217)",contrast:"rgb(249, 247, 250)",success:"#43BA73"}};function Dl(e,t){var n=e.match(/\d+/g).map(Number),i=n[0],r=n[1],o=n[2],a=t/100;return"rgb("+(i=Math.min(Math.round(i+(255-i)*a),255))+", "+(r=Math.min(Math.round(r+(255-r)*a),255))+", "+(o=Math.min(Math.round(o+(255-o)*a),255))+")"}var Ol={backgroundColor:"transparent",backgroundImage:"none",WebkitAppearance:"button",border:"none",cursor:"pointer",padding:0},El=Fl(Ol),Ll=Fl(ge({},Ol,{color:Sl(10),borderRadius:8,padding:4,"&:hover":{background:Sl(90),color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}})),Nl={margin:0},Ml={margin:0,textDecoration:"underline",color:"rgb(47, 129, 247)",cursor:"pointer"},Rl={listStyle:"none",padding:0,margin:0},Pl={padding:0,margin:0},zl=Fl(Nl),Vl='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',ql=Fl({fontFamily:Vl,fontSize:"1em"}),Bl=Fl(Ml),Wl=Fl(Rl),Hl=Fl(Pl),Yl=Fl({height:"100%"}),Gl=Fl({fontWeight:700}),Ul={xs:"0.75rem",sm:"0.8rem"},Kl=Fl({whiteSpace:"nowrap"}),Xl=Fl({position:"absolute",left:-9999,width:1,height:1,overflow:"hidden"}),Ql=Object.assign((function(){return null}),{iconButton:Ll,ml:function(e){return Fl({marginLeft:e})},bw:function(e){return Fl({borderWidth:e})},pt:function(e){return Fl({paddingTop:e})},pl:function(e){return Fl({paddingLeft:e})},pr:function(e){return Fl({paddingRight:e})},pb:function(e){return Fl({paddingBottom:e})},py:function(e){return Fl({paddingTop:e,paddingBottom:e})},p:function(e){return Fl({padding:e})},mt:function(e){return Fl({marginTop:e})},mb:function(e){return Fl({marginBottom:e})},mr:function(e){return Fl({marginRight:e})},m:function(e){return Fl({margin:e})},my:function(e){return Fl({marginTop:e,marginBottom:e})},codeText:ql,bold:Gl,button:El,text:zl,link:Bl,srOnly:Xl,liReset:Wl,ulReset:Hl,textSize:function(e){return Fl({fontSize:Ul[e]||"1rem"})},opacity:function(e){return Fl({opacity:e})},color:function(e){return Fl({color:e})},align:function(e){return Fl({textAlign:e})},height100:Yl,nowrap:Kl,position:function(e){return Fl({position:e})},cursor:function(e){return Fl({cursor:e})},coreButton:Ol}),Zl=Object.assign((function(){return null}),{button:Ol,text:Nl,link:Ml,codeFontFamily:Vl}),Jl=Fl({display:"block",verticalAlign:"middle"}),$l=Object.assign((function(){return null}),{selectedComponent:function(e){return Fl(ge({},Cl,Zl.button,{borderRadius:null==e?void 0:e.borderRadius,"&:hover":ge({},Cl,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),"&:focus":ge({},Cl,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),variants:{componentSelect:{true:ge({},Cl,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius,"&:focus-visible":{outline:0},"&:focus":{outline:0},"&:hover":ge({},Cl,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius})})}}}))},tableWrapper:Fl({display:"flex",height:268,width:"100%",flexDirection:"column",position:"relative"})}),es=function(e){var t=function(t){var n=jl(e)(t);return m.css(n,"","")};return t.toString=t,""+t},ts=function(e){return null!=e&&e.disabledFeatures?p.jsxs("div",{className:es({width:"100%",height:"100%",position:"relative",overflowX:"hidden",flexGrow:"1"}),"aria-disabled":!0,children:[null==e?void 0:e.children,p.jsx("div",{style:{position:"absolute",inset:0}})]}):p.jsx("div",{className:es({width:"100%",height:"100%",flexGrow:"1"}),children:null==e?void 0:e.children})},ns=function(e){return null!=e&&e.disabledFeatures?p.jsxs("div",{className:""+$l.tableWrapper,children:[null==e?void 0:e.children,p.jsx("div",{style:{position:"absolute",inset:0}})]}):p.jsx(t.Fragment,{children:null==e?void 0:e.children})},is=["fill","width","height"],rs=["fill","width","height"],os=["fill","gradient"],as=["fill","width","height"],ls=["fill","width","height"],ss=["fill"],us=["fill"],ds=["fill"],cs=["fill"],ps=["fill"],fs=function(e){var t;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:e.active?null!=(t=e.fill)?t:"black":"none",className:es({display:"inline-block",width:"lg"===e.size?"20px":"16px",height:"lg"===e.size?"20px":"16px"}),viewBox:"0 0 24 24",strokeWidth:2.5,stroke:"currentColor","data-component":"filter-icon",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})},ms=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=e.width,r=void 0===i?16:i,o=e.height,a=void 0===o?16:o,l=we(e,is);return p.jsx("svg",{onClick:l.onClick,xmlns:"http://www.w3.org/2000/svg",width:r,height:a,viewBox:"0 0 20 20",fill:n,children:p.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})},hs=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:es({width:"20px",height:"20px",opacity:.7}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})},vs=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px",margin:"4px auto auto auto"}),viewBox:"0 0 20 20",fill:"#88ecac",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})},gs=function(e){return p.jsxs(p.Fragment,{children:["removeFilter"==e.purpose&&p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px",margin:"4px auto auto auto"}),viewBox:"0 0 20 20",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd",fill:"currentColor"})}),"removeFilter"!=e.purpose&&p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px"}),viewBox:"0 0 20 20",fill:"currentColor",children:p.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 10 0-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})})]})},xs=function(e){var t;return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px",display:"inline"}),fill:null!=(t=null==e?void 0:e.fill)?t:"#88ecac",viewBox:"0 0 20 20",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z",clipRule:"evenodd"})})},bs=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px"}),viewBox:"0 0 20 20",fill:"currentColor",children:p.jsx("path",{d:"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"})})},ys=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:es({width:"20px",height:"20px"}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})})},ws=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px"}),viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V3a.75.75 0 0 1 .75-.75Zm-9 13.5a.75.75 0 0 1 .75.75v2.25a1.5 1.5 0 0 0 1.5 1.5h13.5a1.5 1.5 0 0 0 1.5-1.5V16.5a.75.75 0 0 1 1.5 0v2.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V16.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})})},Cs=function(e){return p.jsx("svg",{onClick:e.onClick,className:es({width:"16px",height:"16px"}),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})})},js=function(e){return p.jsxs("svg",{onClick:e.onClick,className:es({width:"16px",height:"16px"}),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6Z"})]})},Fs=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=e.width,r=e.height,o=we(e,rs);return p.jsx("svg",ge({fill:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",height:null!=r?r:20,width:null!=i?i:20},o,{children:p.jsx("path",{d:"M16.067 10.808a.624.624 0 0 1-.442 1.067.625.625 0 0 1-.442-.183l-4.558-4.558v10.991a.624.624 0 1 1-1.25 0V7.135l-4.558 4.557a.624.624 0 1 1-.884-.884l5.625-5.625a.625.625 0 0 1 .884 0l5.625 5.625ZM16.25 2.5H3.75a.625.625 0 1 0 0 1.25h12.5a.625.625 0 1 0 0-1.25Z"})}))},Ss=function(e){return p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"24px",height:"24px",display:"inline"}),viewBox:"0 0 20 20",fill:"currentColor",children:p.jsx("path",{d:"M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})})},ks=function(e){return p.jsxs(p.Fragment,{children:[e.isOpen&&p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"16px",height:"16px"}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),!e.isOpen&&p.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",className:es({width:"16px",height:"16px"}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})})]})},As=function(e){return p.jsx("svg",{onClick:e.onClick,className:es({width:"24px",height:"24px",display:"inline"}),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 01-2.25 2.25M16.5 7.5V18a2.25 2.25 0 002.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 002.25 2.25h13.5M6 7.5h3v3H6v-3z"})})},Ts=function(e){var t=e.fill,n=void 0===t?"rgb(55, 65, 81)":t,i=e.gradient,r=void 0!==i&&i,o=we(e,os);return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:r?"none":n,viewBox:"0 0 32 32",width:null!=o&&o.width?null==o?void 0:o.width:24,height:null!=o&&o.height?null==o?void 0:o.height:24,children:[p.jsx("path",{d:"M13.723 6.762 16.1 8.928l2.218-2.32a3.285 3.285 0 0 1 2.264-1.006c.862-.029 1.7.277 2.33.852l7.13 6.496c.63.574 1 1.37 1.03 2.21a3.13 3.13 0 0 1-.873 2.275l-6.654 6.96A3.286 3.286 0 0 1 21.28 25.4a3.297 3.297 0 0 1-2.33-.852l-2.376-2.165-2.218 2.32a3.286 3.286 0 0 1-2.265 1.006 3.297 3.297 0 0 1-2.33-.852l-7.128-6.496c-.63-.575-1.001-1.37-1.031-2.21a3.13 3.13 0 0 1 .873-2.275l6.654-6.96a3.286 3.286 0 0 1 2.265-1.006c.861-.028 1.7.278 2.33.852Zm7.92 15.9 6.655-6.96a.626.626 0 0 0-.031-.896l-7.13-6.497a.66.66 0 0 0-.918.031l-6.655 6.96a.626.626 0 0 0 .032.896l7.129 6.497a.66.66 0 0 0 .918-.031ZM4.377 15.608a.626.626 0 0 0 .031.897l7.129 6.496a.66.66 0 0 0 .919-.03l2.218-2.32-2.852-2.599a3.14 3.14 0 0 1-1.03-2.21 3.13 3.13 0 0 1 .872-2.275l2.662-2.784-2.376-2.165a.66.66 0 0 0-.919.03l-6.654 6.96Z",fill:r?"url(#a)":""}),r?p.jsxs("linearGradient",{id:"a",x1:"1.6",y1:"15.655",x2:"31.073",y2:"15.655",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:"#3683F5"}),p.jsx("stop",{offset:".5",stopColor:"#6764F8"}),p.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}):p.jsx("path",{d:"M72.7304 36.3655L84.8523 48.4873L96.9741 36.3655C100.189 33.1506 104.549 31.3444 109.096 31.3444C113.642 31.3444 118.003 33.1505 121.218 36.3655L157.583 72.731C160.798 75.9459 162.604 80.3062 162.604 84.8528C162.604 89.3994 160.798 93.7597 157.583 96.9746L121.218 133.34C118.003 136.555 113.642 138.361 109.096 138.361C104.549 138.361 100.189 136.555 96.9741 133.34L84.8523 121.218L72.7304 133.34C69.5155 136.555 65.1552 138.361 60.6086 138.361C56.062 138.361 51.7017 136.555 48.4868 133.34L12.1213 96.9746C8.90637 93.7597 7.10025 89.3994 7.10025 84.8528C7.10025 80.3062 8.90637 75.9459 12.1213 72.731L48.4868 36.3655C51.7017 33.1506 56.062 31.3444 60.6086 31.3444C65.1552 31.3444 69.5155 33.1506 72.7304 36.3655ZM111.52 123.643L147.886 87.2771C148.529 86.6342 148.89 85.7621 148.89 84.8528C148.89 83.9435 148.529 83.0714 147.886 82.4284L111.52 46.0629C110.877 45.4199 110.005 45.0587 109.096 45.0587C108.187 45.0587 107.315 45.4199 106.672 46.0629L70.3061 82.4284C69.6631 83.0714 69.3019 83.9435 69.3019 84.8528C69.3019 85.7621 69.6631 86.6342 70.3061 87.2771L106.672 123.643C107.315 124.286 108.187 124.647 109.096 124.647C110.005 124.647 110.877 124.286 111.52 123.643ZM21.8187 82.4284C21.1758 83.0714 20.8145 83.9435 20.8145 84.8528C20.8145 85.7621 21.1758 86.6342 21.8187 87.2771L58.1842 123.643C58.8272 124.286 59.6993 124.647 60.6086 124.647C61.5179 124.647 62.39 124.286 63.033 123.643L75.1548 111.521L60.6086 96.9746C57.3937 93.7597 55.5876 89.3994 55.5876 84.8528C55.5876 80.3062 57.3937 75.9459 60.6086 72.731L75.1548 58.1848L63.033 46.0629C62.39 45.4199 61.5179 45.0587 60.6086 45.0587C59.6993 45.0587 58.8272 45.4199 58.1842 46.0629L21.8187 82.4284Z"})]})},_s=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",className:es({width:"20px",height:"20px",display:"inline-block"}),viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"})})},Is=function(e){return p.jsx("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"16",height:null!=e&&e.height?""+(null==e?void 0:e.height):"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Sl(15),children:p.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z",clipRule:"evenodd"})})},Ds=function(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:p.jsx("path",{fillRule:"evenodd",d:"M7.28 7.72a.75.75 0 0 1 0 1.06l-2.47 2.47H21a.75.75 0 0 1 0 1.5H4.81l2.47 2.47a.75.75 0 1 1-1.06 1.06l-3.75-3.75a.75.75 0 0 1 0-1.06l3.75-3.75a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},Os=function(e){return p.jsxs("svg",{width:null!=e&&e.width?""+(null==e?void 0:e.width):"24",height:null!=e&&e.height?""+(null==e?void 0:e.height):"24",viewBox:"0 0 20 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M17.5007 4.66663C16.2923 4.66663 15.6173 5.86663 15.8923 6.75829L12.934 9.72496C12.684 9.64996 12.3173 9.64996 12.0673 9.72496L9.94232 7.59996C10.2257 6.70829 9.55065 5.49996 8.33398 5.49996C7.12565 5.49996 6.44232 6.69996 6.72565 7.59996L2.92565 11.3916C2.03398 11.1166 0.833984 11.7916 0.833984 13C0.833984 13.9166 1.58398 14.6666 2.50065 14.6666C3.70898 14.6666 4.38398 13.4666 4.10898 12.575L7.90065 8.77496C8.15065 8.84996 8.51732 8.84996 8.76732 8.77496L10.8923 10.9C10.609 11.7916 11.284 13 12.5007 13C13.709 13 14.3923 11.8 14.109 10.9L17.0757 7.94163C17.9673 8.21663 19.1673 7.54163 19.1673 6.33329C19.1673 5.41663 18.4173 4.66663 17.5007 4.66663Z",fill:"url(#paint0_linear_2169_391)"}),p.jsx("path",{d:"M12.5 5.5L13.2833 3.775L15 3L13.2833 2.225L12.5 0.5L11.7333 2.225L10 3L11.7333 3.775L12.5 5.5Z",fill:"url(#paint1_linear_2169_391)"}),p.jsx("path",{d:"M2.91732 7.16667L3.33398 5.5L5.00065 5.08333L3.33398 4.66667L2.91732 3L2.50065 4.66667L0.833984 5.08333L2.50065 5.5L2.91732 7.16667Z",fill:"url(#paint2_linear_2169_391)"}),p.jsxs("defs",{children:[p.jsxs("linearGradient",{id:"paint0_linear_2169_391",x1:"0.833984",y1:"4.66663",x2:"19.4886",y2:"5.49589",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:"#3074D9"}),p.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),p.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),p.jsxs("linearGradient",{id:"paint1_linear_2169_391",x1:"10",y1:"0.5",x2:"15.0947",y2:"0.623532",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:"#3074D9"}),p.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),p.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]}),p.jsxs("linearGradient",{id:"paint2_linear_2169_391",x1:"0.833984",y1:"3",x2:"5.07954",y2:"3.10294",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:"#3074D9"}),p.jsx("stop",{offset:"0.53125",stopColor:"#4542E1"}),p.jsx("stop",{offset:"1",stopColor:"#FF77B8"})]})]})]})},Es=function(e){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Sl(15),width:null!=e&&e.width?""+(null==e?void 0:e.width):"20",height:null!=e&&e.height?""+(null==e?void 0:e.height):"20",children:p.jsx("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})})},Ls=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Sl(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"})})},Ns=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"})})},Ms=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Sl(15),width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{d:"M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z"})})},Rs=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"})})},Ps=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})})},zs=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",children:p.jsx("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 0 1-1.313-1.313V9.564Z",clipRule:"evenodd"})})},Vs=function(e){var t,n;return p.jsx("svg",{fill:"currentColor",width:null!=(t=e.width)?t:"20",height:null!=(n=e.height)?n:"20",viewBox:"0 0 32 32",id:"icon",xmlns:"http://www.w3.org/2000/svg",stroke:"inherit",strokeWidth:"0.736",children:p.jsx("path",{d:"M18,28A12,12,0,1,0,6,16v6.2L2.4,18.6,1,20l6,6,6-6-1.4-1.4L8,22.2V16H8A10,10,0,1,1,18,26Z"})})},qs=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24",className:es({width:"20px",height:"20px"}),children:p.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"})})},Bs=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:es({width:"20px",height:"20px"}),children:p.jsx("path",{fillRule:"evenodd",d:"M12 5.25c1.213 0 2.415.046 3.605.135a3.256 3.256 0 0 1 3.01 3.01c.044.583.077 1.17.1 1.759L17.03 8.47a.75.75 0 1 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l3-3a.75.75 0 0 0-1.06-1.06l-1.752 1.751c-.023-.65-.06-1.296-.108-1.939a4.756 4.756 0 0 0-4.392-4.392 49.422 49.422 0 0 0-7.436 0A4.756 4.756 0 0 0 3.89 8.282c-.017.224-.033.447-.046.672a.75.75 0 1 0 1.497.092c.013-.217.028-.434.044-.651a3.256 3.256 0 0 1 3.01-3.01c1.19-.09 2.392-.135 3.605-.135Zm-6.97 6.22a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l1.752-1.751c.023.65.06 1.296.108 1.939a4.756 4.756 0 0 0 4.392 4.392 49.413 49.413 0 0 0 7.436 0 4.756 4.756 0 0 0 4.392-4.392c.017-.223.032-.447.046-.672a.75.75 0 0 0-1.497-.092c-.013.217-.028.434-.044.651a3.256 3.256 0 0 1-3.01 3.01 47.953 47.953 0 0 1-7.21 0 3.256 3.256 0 0 1-3.01-3.01 47.759 47.759 0 0 1-.1-1.759L6.97 15.53a.75.75 0 0 0 1.06-1.06l-3-3Z",clipRule:"evenodd"})})},Ws=function(e){var t,n,i;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:null!=(t=e.width)?t:"16",height:null!=(n=e.height)?n:"16",viewBox:"0 0 447.641 447.641",fill:null!=(i=null==e?void 0:e.fill)?i:Sl(15),children:p.jsx("path",{d:"M253.254,420.02L58.883,225.617h127.578c2.569-19.24,6.3-74.921-28.166-117.694 C127.838,70.109,75.132,50.942,1.666,50.942L0,33.547c1.252-0.228,31.214-5.926,72.962-5.926 c88.106,0,236.631,25.955,252.083,197.996h122.595L253.254,420.02z"})})},Hs=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=e.width,r=e.height,o=we(e,as);return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",width:null!=i?i:"20",height:null!=r?r:"20",fill:n},o,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 2H6.414l2.293 2.293a1 1 0 0 1-1.414 1.414L5 6.414V8a1 1 0 0 1-2 0V4Zm9 1a1 1 0 1 1 0-2h4a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V6.414l-2.293 2.293a1 1 0 1 1-1.414-1.414L13.586 5H12Zm-9 7a1 1 0 1 1 2 0v1.586l2.293-2.293a1 1 0 0 1 1.414 1.414L6.414 15H8a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1v-4Zm13-1a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 1 1 0-2h1.586l-2.293-2.293a1 1 0 0 1 1.414-1.414L15 13.586V12a1 1 0 0 1 1-1Z"})}))},Ys=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=e.width,r=e.height,o=we(e,ls);return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",width:null!=i?i:"20",height:null!=r?r:"20",fill:n,viewBox:"0 0 20 20"},o,{children:p.jsxs("g",{children:[p.jsx("path",{d:"M11 3a1 1 0 1 0 0 2h2.586l-6.293 6.293a1 1 0 1 0 1.414 1.414L15 6.414V9a1 1 0 1 0 2 0V4a1 1 0 0 0-1-1h-5Z"}),p.jsx("path",{d:"M5 5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3a1 1 0 1 0-2 0v3H5V7h3a1 1 0 0 0 0-2H5Z"})]})}))},Gs=function(e){var t=e.fill,n=void 0===t?"black":t,i=we(e,ss);return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},i,{children:p.jsx("path",{d:"M4 16v1a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-1m-4-8-4-4m0 0L8 8m4-4v12",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},Us=function(e){var t=e.fill,n=void 0===t?"black":t,i=we(e,us);return p.jsx("svg",ge({fill:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4a2 2 0 0 1 2-2h4.586A2 2 0 0 1 12 2.586L15.414 6A2 2 0 0 1 16 7.414V16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4Z"})}))},Ks=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=we(e,ds);return p.jsxs("svg",ge({fill:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i,{children:[p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.707 2.293a1 1 0 0 0-1.414 1.414l14 14a1 1 0 0 0 1.414-1.414l-1.473-1.473A10.014 10.014 0 0 0 19.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 0 0-4.512 1.074l-1.78-1.781Zm4.261 4.26 1.514 1.515a2.003 2.003 0 0 1 2.45 2.45l1.514 1.514a4 4 0 0 0-5.478-5.478Z"}),p.jsx("path",{d:"M12.454 16.697 9.75 13.992a4 4 0 0 1-3.742-3.741L2.335 6.578A9.98 9.98 0 0 0 .458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303Z"})]}))},Xs=function(e){var t=e.fill,n=void 0===t?"currentColor":t,i=we(e,cs);return p.jsxs("svg",ge({fill:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i,{children:[p.jsx("path",{d:"M10 12a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10ZM14 10a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"})]}))},Qs=function(e){var t;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:es({width:null!=(t=e.width)?t:16}),children:p.jsx("path",{fillRule:"evenodd",d:"M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"})})},Zs=function(e){var t;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:es({width:null!=(t=e.width)?t:16}),children:p.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 0 1 .75.75v16.19l6.22-6.22a.75.75 0 1 1 1.06 1.06l-7.5 7.5a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 1 1 1.06-1.06l6.22 6.22V3a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})})},Js=function(e){var t,n;return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:null!=(t=e.fill)?t:"#D93334",className:es({width:null!=(n=e.width)?n:20}),children:p.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})})},$s=function(e){var t,n,i=we(e,ps);return p.jsx("svg",ge({fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",width:null!=(t=i.width)?t:20,height:null!=(n=i.height)?n:20},i,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.316 3.051a1 1 0 0 1 .633 1.265l-4 12a1 1 0 1 1-1.898-.632l4-12a1 1 0 0 1 1.265-.633ZM5.707 6.293a1 1 0 0 1 0 1.414L3.414 10l2.293 2.293a1 1 0 1 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.414l3-3a1 1 0 0 1 1.414 0Zm8.586 0a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 1 1-1.414-1.414L16.586 10l-2.293-2.293a1 1 0 0 1 0-1.414Z"})}))},eu=function(e,t){return[].concat(e.supportedFeatures).includes(t)},tu={parameters:!0,disableAutoSave:!0,showGlobalFilters:!0,showResetButton:!1,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canAddTags:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowDateCalculationsCustomField:!0,allowCalculatedField:!1,allowConditionalCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0,canDownloadViewAsPNG:!0,forceMobile:!1,unloadOffScreenViews:!1,showSavingIndicator:!1,disablePersistingGlobalFiltersLocally:!1,simpleMultiSelectFilter:!1},nu={parameters:!0,disableAutoSave:!1,showGlobalFilters:!0,showResetButton:!0,canAddTags:!0,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowDateCalculationsCustomField:!0,allowConditionalCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowCalculatedField:!1,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1,canDownloadPDF:!0,canDownloadViewData:!0,canDownloadDataSet:!0,canDownloadViewAsPNG:!0,forceMobile:!1,unloadOffScreenViews:!1,showSavingIndicator:!0,disablePersistingGlobalFiltersLocally:!1,simpleMultiSelectFilter:!1},iu=[].concat(["barChart","horizontalBarChart","funnelChart","areaChart","lineChart","lineChartV2","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","progress","richText","custom"]).filter((function(e){return"custom"!=e})),ru=function(e){return{attributes:e,localFilters:[],results:[],colSpan:1,reports:[]}},ou=function(e){return{displayTitle:e,colSpan:12}},au=function(e){return"displayTitle"in e},lu=function(e,t,n,i){var r=function(e,t,n,i){var r=e[t];return"left"==i?[].concat(r.components).slice(0,n).reverse():[].concat(r.components).slice(n+1,r.components.length)}(e,t,n,i),o=r.length-1,a=r.findIndex((function(e){return e.colSpan>2}));return-1==a?-1:"left"==i?o-a:a+1+n},su=function(e){return{colSpan:e,isEmpty:!0}};function uu(e){return 1===e?12:e<5?12/e:2}var du=function(e,t,n,i){var r=[].concat(e),o=[].concat(r[n].components);return o[i]=ge({},t,{colSpan:o[i].colSpan}),r[n]={components:o,height:r[n].height},r},cu=function(e,t){return{components:e,height:null!=t?t:350}},pu=function(e){return"isEmpty"in e};function fu(e){for(var t,n=ve(e);!(t=n()).done;)for(var i,r=ve(t.value.components);!(i=r()).done;){var o=i.value;if(!("isEmpty"in o)||!0!==o.isEmpty)return!1}return!0}var mu=function(e,t,n){if(t===n||t<0||n<0||t>=e.length||n>=e.length)return[].concat(e);var i=[].concat(e),r=i.splice(t,1)[0];return i.splice(n,0,r),i},hu=function(e){var t=[].concat(e),n=r.sumBy(t,(function(e){return e.colSpan}));return 12==n||(t[t.length-1].colSpan+=12-n),t},vu=function(e){return!(e&&pu(e)&&e.colSpan<=0)},gu=function(e,t){return e.map((function(e){return function(e,t){var n=function(e){return"components"in e?e:{components:e,height:350}}(e),i=n.components.filter(vu).map((function(e){return e&&e.colSpan<=0?ge({},e,{colSpan:1}):e})),o=r.sumBy(i,(function(e){return null==e?1:0})),a=r.sumBy(i,(function(e){return null==e?0:e.colSpan})),l=Math.floor((12-a)/o),s=[].concat(i).map((function(e){return null===e?{isEmpty:!0,colSpan:l}:pu(e)||au(e)?e:xu(ge({},e,{colSpan:e.colSpan}),t)}));return{components:hu(s),height:n.height||350}}(e,t)}))},xu=function(e,t){if("isEmpty"in e||au(e))return e;var n=(0,Go(e.attributes.type,t).load)(e.attributes),i=[];return r.isArray(e.localFilters)&&(i=[].concat(e.localFilters?e.localFilters:[]).map((function(e){return Et(e)}))),"addOns"in e.attributes&&r.isEmpty(i)&&e.attributes.addOns.forEach((function(e){i=[].concat(i,[{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:n.dataSetId}]}])})),delete e.addOns,delete n.addOns,ge({},e,{localFilters:i,attributes:n,results:[]})},bu=function(e){if(pu(e)||au(e))return e;var t=[].concat(e.localFilters&&r.isArray(e.localFilters)?e.localFilters:[]).map(Ot);return ge({},e,{results:void 0,queries:void 0,attributes:ge({},e.attributes,{offset:void 0}),localFilters:t})},yu=function(e,t){var n;if(!e.attributes)throw new Error("Component attributes are required in saveable");return{attributes:ge({},e.attributes,{protectedByOrganisation:!!t||void 0}),localFilters:null!=(n=e.localFilters)?n:[],colSpan:1,results:[],reports:[]}},wu=function(e){return s.alternatives().conditional(".type",{is:"barChart",then:hr(e).schema}).conditional(".type",{is:"richText",then:wo(e).schema}).conditional(".type",{is:"mercatorMap",then:vo(e).schema}).conditional(".type",{is:"horizontalBarChart",then:eo(e).schema}).conditional(".type",{is:"lineChart",then:Sr(e).schema}).conditional(".type",{is:"lineChartV2",then:_r(e).schema}).conditional(".type",{is:"comboChart",then:Vr(e).schema}).conditional(".type",{is:"areaChart",then:ro(e).schema}).conditional(".type",{is:"pieChart",then:Or(e).schema}).conditional(".type",{is:"scatterChart",then:Mr(e).schema}).conditional(".type",{is:"singleStat",then:so(e).schema}).conditional(".type",{is:"dataTable",then:Gr(e).schema}).conditional(".type",{is:"basicTable",then:Zr(e).schema}).conditional(".type",{is:"progress",then:ko(e).schema}).conditional(".type",{is:"custom",then:po(e).schema}).conditional(".type",{is:"funnelChart",then:_o(e).schema})},Cu=a.QueryEngineConfig.getQueryEngineConfig("js"),ju={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},Fu=function(e,t){return{description:t,range:{before:La(e),after:La((n=e,i=new Date(n.getTime()-864e5),new Date(i.getFullYear(),i.getMonth(),i.getDate())))}};var n,i},Su=function(e,t,n){var i=new Date,r=new Date(i);return t>0&&r.setMonth(i.getMonth()-t),e>0&&(r=new Date(i.getTime()-24*e*60*60*1e3)),{description:n,range:{before:i,after:r}}},ku=function(e){return{today:(t=new Date,n=e("filter.today","Today"),i=La(t),r=new Date(i),r.setDate(r.getDate()+1),r.setMilliseconds(r.getMilliseconds()-1),{description:n,range:{before:r,after:i}}),past_1_day:Su(1,0,e("filter.past_1_day","Last 24 hours")),yesterday:Fu(new Date,e("filter.yesterday","Yesterday")),past_3_days:Su(3,0,e("filter.past_3_days","Last 3 days")),past_7_days:Su(7,0,e("filter.past_7_days","Last 7 days")),past_30_days:Su(30,0,e("filter.past_30_days","Last 30 days")),past_90_days:Su(90,0,e("filter.past_90_days","Last 90 days")),past_3_months:Su(0,3,e("filter.past_3_months","Last 3 months")),past_6_months:Su(0,6,e("filter.past_6_months","Last 6 months")),past_12_months:Su(0,12,e("filter.past_12_months","Last 12 months")),past_18_months:Su(0,18,e("filter.past_18_months","Last 18 months"))};var t,n,i,r},Au=function(){for(var e=ku(zo),t={},n=0,i=Object.entries(ju);n<i.length;n++){var r=i[n],o=r[0];r[1]&&o in e&&(t["_vizzly_"+o]=e[o])}return t},Tu=function(e,t){var n=ku(e),i=Object.keys(ju).map((function(e){return e in n?"_vizzly_"+e:e})),r=i.indexOf("_vizzly_today");r>-1&&(i.splice(r,1),i.unshift("_vizzly_today"));for(var o,a={},l={},s=ve(i);!(o=s()).done;){var u=o.value,d=u.replace("_vizzly_",""),c=n[d],p=null==t?void 0:t[d];"boolean"==typeof p?p&&(l[u]=c):null!=p?l[u]=p:!1!==ju[d]&&(l[u]=c)}if(t)for(var f=0,m=Object.entries(t);f<m.length;f++){var h=m[f],v=h[0],g=h[1];v in ju||(i.push(v),l[v]=g)}for(var x,b=ve(i);!(x=b()).done;){var y=x.value;y in l&&(a[y]=l[y])}return a},_u=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingDateTimeFormatOption",n}return be(t,e),t}(Fe(Error)),Iu=["week_of_year","hour_of_day","day_of_month","day_of_week_iso","month_of_year"],Du={hour_of_day:{description:"Hour of the day",formatter:function(e){return Oa(e,"hour_of_day")}},month_of_year:{description:"Month of the year",formatter:function(e){return Oa(e,"month_of_year")}},day_of_month:{description:"Day of month",formatter:function(e){return Oa(e,"day_of_month")}},day_of_week_iso:{description:"Day of week",formatter:function(e){return Oa(e,"day_of_week_iso")}},week_of_year:{description:"Week of year",formatter:function(e){return Oa(e,"week_of_year")}},"DD/MM/YYYY":{description:"DD/MM/YYYY",formatter:function(e){return Oa(e,"DD/MM/YYYY")}},"MM/DD/YYYY":{description:"MM/DD/YYYY",formatter:function(e){return Oa(e,"MM/DD/YYYY")}},"DD-MM-YYYY":{description:"DD-MM-YYYY",formatter:function(e){return Oa(e,"DD-MM-YYYY")}},"MM-DD-YYYY":{description:"MM-DD-YYYY",formatter:function(e){return Oa(e,"MM-DD-YYYY")}},"DD MMMM YYYY, hh:mm":{description:"DD MMMM YYYY, hh:mm",formatter:function(e){return Oa(e,"DD MMMM YYYY, hh:mm")}},"dddd DD MMMM YYYY, hh:mm":{description:"dddd DD MMMM YYYY, hh:mm",formatter:function(e){return Oa(e,"dddd DD MMMM YYYY, hh:mm")}},"hh:mm":{description:"hh:mm",formatter:function(e){return Oa(e,"hh:mm")}},"hh:mm:ss":{description:"hh:mm:ss",formatter:function(e){return Oa(e,"hh:mm:ss")}},"DD MMMM YYYY":{description:"DD MMMM YYYY",formatter:function(e){return Oa(e,"DD MMMM YYYY")}},"MMMM YYYY":{description:"MMMM YYYY",formatter:function(e){return Oa(e,"MMMM YYYY")}},YYYY:{description:"YYYY",formatter:function(e){return Oa(e,"YYYY")}},"YYYY-MM-DD[T]HH:mm:ss":{description:"YYYY-MM-DD[T]HH:mm:ss",formatter:function(e){return Oa(e,"YYYY-MM-DD[T]HH:mm:ss")}},quarter:{description:"Quarter",formatter:function(e){return Oa(e,"quarter")}},week:{description:"Week",formatter:function(e){return Oa(e,"week")}}},Ou=function(e,t){var n={};return Object.keys(e).forEach((function(t){e[t]&&(n[t]=e[t])})),Object.keys(t.supportedTimeTruncFunctions).forEach((function(e){var i=t.supportedTimeTruncFunctions[e].dateFormat;if(!n[i])throw new _u("Missing date format option '"+i+"'. Either bump the dashboard version to the latest, or add your own formatter with key '"+i+"' to dateTimeFormatOptions. Docs here; https://docs.vizzly.co/dashboard/properties/dateTimeFormatOptions")})),n},Eu={month:"MMMM YYYY",year:"YYYY",quarter:"quarter",week:"week",day:"DD-MM-YYYY",hourOfDayOnly:"hour_of_day",weekOfYearOnly:"week_of_year",dayOfWeekOnly:"day_of_week_iso",dayOfMonthOnly:"day_of_month",second:"hh:mm:ss",hour:"hh:mm",minute:"hh:mm",monthOfYearOnly:"month_of_year"},Lu={mode:"endUser",scope:"read_write",maxCSVDownloadLimit:1e4,featureToggles:ge({},nu),developerTools:!1,componentOverrides:{},customViews:[],reportScheduleOptions:[],overrideDeveloperInfo:null,datePickerFormat:"DD/MM/YYYY",disableToolbar:!1,onlyViewTypes:function(){return[]},dataPanel:function(e){return e},formatPanel:function(e){return e},isProgrammaticParent:!1,dashboardFilters:function(){return[]},onDashboardFilterChange:function(){},dateFilterOptions:Au(),dateTimeFormatOptions:Du,defaultFormats:function(){return Eu},numberFormatOptions:ol(zo),textOverrides:{},queryEngineConfig:Cu,organizationName:void 0,onEditorUpdate:function(e){return e},onSave:function(){return Ze("Save functionality not set.")},onScheduledReportChange:function(){var e=me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ze("Scheduled report change functionality not set.");case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),scheduledReports:[],onOpenConfigManagerUi:void 0,onReset:function(){throw new Error("onReset function not implemented.")},textOverride:function(e,t){return t},labelFormat:function(){}};function Nu(e,n){var i=Pu().id;t.useEffect((function(){var t,r=wa.get(null!=(t=null!=n?n:i)?t:"",(function(t){return e(t)}));return function(){return r()}}),[])}var Mu=n.createContext(ge({},Lu,{setOverrideDeveloperInfo:function(){throw"Not initiated."}})),Ru=function(e){var n,i,a,l,s,u,d=function(e,n,i,r,a){var l=Lu,s=function(e,t,n,i){var r,o={};return o=ge({},o,nu,e),"admin"==n&&(o=ge({},o,tu,function(e){var t,n,i;return{showDateAndTimeFilter:void 0===e.showDateAndTimeFilter||e.showDateAndTimeFilter,showDateFilter:void 0===e.showDateFilter||e.showDateFilter,canUseComponentLibrary:void 0===e.canUseComponentLibrary||e.canUseComponentLibrary,canSeeEmptyState:null!=(t=e.canSeeEmptyState)&&t,canDownloadViewData:void 0===e.canDownloadViewData||e.canDownloadViewData,canDownloadDataSet:void 0===e.canDownloadDataSet||e.canDownloadDataSet,canDownloadViewAsPNG:void 0===e.canDownloadViewAsPNG||e.canDownloadViewAsPNG,forceMobile:void 0!==e.forceMobile&&e.forceMobile,unloadOffScreenViews:void 0!==e.unloadOffScreenViews&&e.unloadOffScreenViews,allowCalculatedField:null!=(n=e.allowCalculatedField)&&n,simpleMultiSelectFilter:null!=(i=e.simpleMultiSelectFilter)&&i}}(e))),"read"==i&&"admin"!=n&&(o.disableAutoSave=!0,o.canEditComponentLibrary=!1,o.canEditComponentsOnDashboard=!1,o.canCreateStandaloneComponents=!1,o.parameters=!1,o.canAddTags=!1,o.canRemoveComponentsFromDashboard=!1,o.canConfigureLocalFilters=!1,o.canAddNewRows=!1,o.canAddNewCells=!1,o.canEditCustomMetrics=!1,o.canUseComponentLibrary=!1,o.canManageGlobalFilters=!1,o.showSavingIndicator=!1,o.disablePersistingGlobalFiltersLocally=null!=(r=o.disablePersistingGlobalFiltersLocally)&&r),eu(t,"simpleMaths")||(o.allowSimpleMathsCustomField=!1),eu(t,"aggregateMaths")||(o.allowAggregateMathsCustomField=!1),eu(t,"subquery")||(o.allowPercentagesCustomField=!1),eu(t,"switchField")||(o.allowRulesCustomField=!1),eu(t,"roundedNumbers")||(o.allowRoundedNumberCustomField=!1),eu(t,"dateMaths")||(o.allowDateCalculationsCustomField=!1),o.forceMobile&&(o.canUseComponentLibrary=!1,o.canAddNewRows=!1,o.canAddNewCells=!1,o.canAddTags=!1,o.canCreateStandaloneComponents=!1,o.canEditComponentsOnDashboard=!1,o.canRemoveComponentsFromDashboard=!1,o.canEditComponentLibrary=!1),o}(o.merge({},l.featureToggles,n),null!=i?i:l.queryEngineConfig,e||l.mode,r||l.scope),u=t.useState(s),d=u[0],c=u[1];return Nu((function(e){e.featureToggles&&c(ge({},d,e.featureToggles))}),a),{featureToggles:d}}(e.mode,null==(n=e.dashboardBehaviour)?void 0:n.featureToggles,null==(i=e.dashboardBehaviour)?void 0:i.queryEngineConfig,null==(a=e.dashboardBehaviour)?void 0:a.scope,e.id).featureToggles,c=e.textOverride||zo,f=t.useState(null),m=f[0],h=f[1],v=function(e,t,n,i,o){var a,l,s,u=e.mode||Lu.mode,d=e.scope||Lu.scope,c=e.isProgrammaticParent||Lu.isProgrammaticParent,p="admin"==u?{}:ge({},e.componentOverrides),f=e.queryEngineConfig?e.queryEngineConfig:Lu.queryEngineConfig;return ge({},Lu,{isProgrammaticParent:c,mode:u,scope:d,reportScheduleOptions:e.reportScheduleOptions||Lu.reportScheduleOptions,customViews:e.customViews||Lu.customViews,componentOverrides:p,onlyViewTypes:function(e){var i,o,a,l;return(i=iu,o=t,a=n&&(null==n?void 0:n.length)>0?[].concat(n,["richText"]):["richText"],l=[].concat(o||i),a&&(l=r.reject(l,(function(e){return a.includes(e)}))),l).filter((function(t){var n=!!Go(t).setDataAttributesFromPreAggregatedDataSet;return!(e.preAggregated&&!n)}))},developerTools:null!=(a=e.developerTools)&&a,featureToggles:o,textOverrides:e.textOverrides||Lu.textOverrides,maxCSVDownloadLimit:e.maxCSVDownloadLimit?e.maxCSVDownloadLimit:Lu.maxCSVDownloadLimit,queryEngineConfig:f,dataPanel:e.dataPanel?e.dataPanel:Lu.dataPanel,formatPanel:e.formatPanel?e.formatPanel:Lu.formatPanel,numberFormatOptions:ge({},ol(i),e.numberFormatOptions),defaultFormats:function(){return ge({},Eu,e.defaultFormats?e.defaultFormats():{})},onEditorUpdate:e.onEditorUpdate?e.onEditorUpdate:Lu.onEditorUpdate,dateFilterOptions:Tu(i,e.dateFilterOptions),onSave:e.onSave?e.onSave:Lu.onSave,onScheduledReportChange:e.onScheduledReportChange||Lu.onScheduledReportChange,dashboardFilters:e.dashboardFilters?e.dashboardFilters:Lu.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange?e.onDashboardFilterChange:Lu.onDashboardFilterChange,onOpenConfigManagerUi:e.onOpenConfigManagerUi,organizationName:e.organizationName,dateTimeFormatOptions:Ou(ge({},Lu.dateTimeFormatOptions,(l=e.dateTimeFormatOptions?e.dateTimeFormatOptions:{},s={},Object.keys(l).forEach((function(e){var t=l[e];t&&(s[e]=Iu.includes(e)?t:{description:t.description,formatter:function(e){return t.formatter(new Date(e))}})})),s)),f),datePickerFormat:e.datePickerFormat?e.datePickerFormat:Lu.datePickerFormat,disableToolbar:e.disableToolbar,scheduledReports:e.scheduledReports||Lu.scheduledReports})}(ge({},e.dashboardBehaviour||{},{mode:e.mode}),e.includeComponentTypes,e.excludeComponentTypes,c,d);return p.jsx(Mu.Provider,{value:ge({},v,{scheduledReports:v.scheduledReports||[],componentOverrides:null!=(l=null==e||null==(s=e.dashboardBehaviour)?void 0:s.componentOverrides)?l:{},developerTools:zu(v.developerTools),isProgrammaticParent:e.isProgrammaticParent,setOverrideDeveloperInfo:h,overrideDeveloperInfo:m,onError:e.onError,onReset:e.onReset,onViewClick:e.onViewClick,nullValueAlias:e.nullValueAlias,renderTableCell:e.renderTableCell,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:c,labelFormat:e.labelFormat?(u=e.labelFormat,function(e){if(u){var t,n=u(e);if("string"==typeof(t=n)||void 0===t)return n;console.error("labelFormat function returned an invalid type",e)}}):function(){},filterLibrary:e.filterLibrary||void 0,pdfSettings:e.pdfSettings,id:e.id,featureToggles:d,valueAlias:e.valueAlias,variables:e.variables}),children:e.children})},Pu=function(){return n.useContext(Mu)},zu=function(e){if("undefined"!=typeof window&&"VizzlyDev"in window){var t,n=(null==(t=window)||null==(t=t.VizzlyDev)?void 0:t.getRuntimeDeveloperTools())||{};if(Object.keys(n).length>0)return console.warn("\n------------------------------------------------\n------------------------------------------------\nUSING VIZZLY DEVELOPER TOOL OVERRIDES\n------------------------------------------------\nDisable by running the following in the browser console;\n\nVizzlyDev.clearRuntimeDeveloperTools()\n\n------------------------------------------------\n------------------------------------------------\n"),n}return e},Vu=function(e){var n=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"theme"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.theme),i=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"componentOverride"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.componentOverride),r=function(){setTimeout((function(){document.querySelectorAll("[data-themeapi]").forEach((function(e){!function(e){var t=e.getAttribute("data-themeapi"),n=e.getAttribute("data-chipposition"),i=null==n?void 0:n.split("."),r="0px",o="20px",a=void 0,l=void 0;null!=i&&i.length&&(i.includes("left")&&(a="0px",r=void 0),i.includes("center")&&(a="calc(50% - 35px)",r=void 0),i.includes("bottom")&&(l="8px",o=void 0),i.includes("above")&&(o="0")),e.style.setProperty("--theme-value","'"+t+"'"),e.style.setProperty("--chip-top-value",""+o),e.style.setProperty("--chip-right-value",""+r),e.style.setProperty("--chip-left-value",""+a),e.style.setProperty("--chip-bottom-value",""+l)}(e),e.classList.add("theme-box")}))}),300)},o=function(){setTimeout((function(){document.querySelectorAll("[data-componentoverride]").forEach((function(e){!function(e){var t=e.getAttribute("data-componentoverride");e.style.setProperty("--override-value","'"+t+"'")}(e),e.classList.add("override-box")}))}),300)};return t.useEffect((function(){n&&qu(),i&&Bu()}),[n]),t.useEffect((function(){return n&&(r(),document.addEventListener("click",r)),i&&(o(),document.addEventListener("click",o)),function(){document.removeEventListener("click",r),document.removeEventListener("click",o)}}),[]),p.jsx(t.Fragment,{children:null==e?void 0:e.children})},qu=function(){m.injectGlobal({name:"4a4ux5",styles:".vizzly-modals .theme-box:hover,.vizzly-studio .theme-box:hover{outline:2px solid #1db954;}.vizzly-modals .theme-box,.vizzly-studio .theme-box{outline:2px solid transparent;}.vizzly-modals .theme-box:hover::after,.vizzly-studio .theme-box:hover::after{opacity:1!important;z-index:999999999999;}.vizzly-modals .theme-box:after,.vizzly-studio .theme-box::after{opacity:0.4;content:var(--theme-value);position:absolute;background:#1db954;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:var(--chip-right-value);top:var(--chip-top-value);bottom:var(--chip-bottom-value);left:var(--chip-left-value);padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},Bu=function(){m.injectGlobal({name:"1jyh5on",styles:".vizzly-modals .override-box:hover,.vizzly-studio .override-box:hover{outline:2px solid #652C8F;}.vizzly-modals .override-box,.vizzly-studio .override-box{outline:2px solid transparent;}.vizzly-modals .override-box:hover::after,.vizzly-studio .override-box:hover::after{opacity:1!important;z-index:999999999999;}.vizzly-modals .override-box:after,.vizzly-studio .override-box::after{opacity:0.4;content:var(--override-value);position:absolute;background:#652C8F;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:0;top:20px;padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},Wu=function(e){var t=Pu(),n=t.componentOverrides,i=t.developerTools,r=t.setOverrideDeveloperInfo,o=null==n?void 0:n[e.renderOverrideKey];if(o){var a=ge({},e.componentProps,{testId:void 0,onClickWithDevToolCheck:void 0,activeDevToolHighlight:void 0});delete a.testId,delete a.onClickWithDevToolCheck,delete a.activeDevToolHighlight;var l=o(a);return"string"==typeof l?p.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):l}var s=!0===i||"object"==typeof i&&i.componentOverride;return p.jsx(e.Element,ge({},e.componentProps,{activeDevToolHighlight:s,onClickWithDevToolCheck:function(t){return function(n){if(!n.shiftKey||!s)return t&&t(n);r({overrideKey:e.renderOverrideKey,componentProps:e.componentProps}),n.stopPropagation()}}}))},Hu=function(e,t,n){return function(i){return p.jsx(Wu,{Element:e,renderOverrideKey:t,componentProps:n?n(i):i})}},Yu=function(e,t,n){return Hu((function(n){return p.jsx(Gu,{activeDevToolHighlight:n.activeDevToolHighlight,onClickWithDevToolCheck:n.onClickWithDevToolCheck,renderOverrideKey:t,children:p.jsx(e,ge({},n))})}),t,n)},Gu=function(e){var t;return p.jsx("div",ge({style:{display:"inherit",position:"relative"},onClick:e.onClickWithDevToolCheck()},((t={})["data-componentoverride"]=null==e?void 0:e.renderOverrideKey,t),{"data-testid":e.renderOverrideKey,children:e.children}))},Uu=Yu((function(e){return p.jsx(fs,{active:e.active})}),"renderFilterIcon"),Ku=Yu((function(){return p.jsx(As,{})}),"renderReportIcon"),Xu=Yu((function(){return p.jsx(_s,{active:!0})}),"renderParametersIcon"),Qu=Yu((function(){return p.jsx(ms,{})}),"renderCloseIcon"),Zu=Yu((function(){return p.jsx(hs,{})}),"renderUndoIcon"),Ju=Yu((function(){return p.jsx(vs,{})}),"renderCompletedIcon"),$u=Yu((function(e){return p.jsx(gs,{purpose:e.purpose})}),"renderDeleteIcon"),ed=Yu((function(e){return p.jsx(xs,ge({},e))}),"renderPlusIcon"),td=Yu((function(){return p.jsx(bs,{})}),"renderEditIcon"),nd=Yu((function(){return p.jsx(ys,{})}),"renderLockedIcon"),id=Yu((function(){return p.jsx(ws,{})}),"renderDownloadIcon"),rd=Yu((function(){return p.jsx(Cs,{})}),"renderComponentOptionsMenuIcon"),od=Yu((function(){return p.jsx(Ss,{})}),"renderLibraryIcon"),ad=Yu((function(e){return p.jsx(ks,{isOpen:e.isOpen})}),"renderAccordionIcon"),ld=Yu((function(){return p.jsx(Es,{})}),"renderSendIcon"),sd=Yu((function(){return p.jsx(zs,{})}),"renderStopIcon"),ud=Yu((function(){return p.jsx(Is,{})}),"renderUserIcon"),dd=Yu((function(){return p.jsx(Ts,{width:20,height:20})}),"renderAIChatIcon"),cd=Yu((function(){return p.jsx(Os,{width:20,height:20})}),"renderAIIcon"),pd=Yu((function(){return p.jsx(Ns,{width:20,height:20})}),"renderThumbsUpUnselectedIcon"),fd=Yu((function(){return p.jsx(Ls,{width:20,height:20})}),"renderThumbsUpSelectedIcon"),md=Yu((function(){return p.jsx(Rs,{width:20,height:20})}),"renderThumbsDownUnselectedIcon"),hd=Yu((function(){return p.jsx(Ms,{width:20,height:20})}),"renderThumbsDownSelectedIcon"),vd=Yu((function(){return p.jsx(Ps,{width:20,height:20})}),"renderSelectIcon"),gd=Yu((function(){return p.jsx(Ds,{})}),"renderBackButtonArrowIcon"),xd=Yu((function(){return p.jsx(js,{})}),"renderTagIcon"),bd=Yu((function(){return p.jsx(qs,{})}),"renderCheckIcon"),yd=Yu((function(){return p.jsx(Bs,{})}),"renderSwitchIcon"),wd=Yu((function(){return p.jsx(Vs,{})}),"renderResetIcon"),Cd=Yu((function(e){return p.jsx(Ws,ge({},e))}),"renderDrilldownIcon"),jd=Yu((function(){return p.jsx(Hs,{})}),"renderFullscreenIcon"),Fd=Yu((function(e){return p.jsx(Js,{fill:e.fill})}),"renderErrorIcon"),Sd=Yu((function(){return p.jsx($s,{})}),"renderCodeIcon");function kd(){for(var e=[],t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach((function(t){switch(typeof t){case"string":e.push(t);break;case"object":Object.keys(t).forEach((function(n){t[n]&&e.push(n)}))}})),e.length>0?e.join(" "):void 0}var Ad=function(e){var t,n,i,r,o,a;return Fl({width:"100%",display:"grid",gridTemplateColumns:null==e||null==(t=e.columns)?void 0:t.join(" "),gridTemplateRows:null==e||null==(n=e.rows)?void 0:n.join(" "),height:null==e?void 0:e.height,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,marginBottom:null==e?void 0:e.marginBottom,position:null==e?void 0:e.position,placeContent:null==e?void 0:e.placeContent,gridAutoFlow:null==e?void 0:e.flow,justifyContent:null==e?void 0:e.justifyContent,alignItems:null==e?void 0:e.alignItems,alignContent:null==e?void 0:e.alignContent,gridTemplateAreas:null==e?void 0:e.areas,minWidth:null==e?void 0:e.minWidth,justifyItems:null==e?void 0:e.justifyItems,flexGrow:null!=e&&e.grow?1:void 0,padding:null==e?void 0:e.padding,paddingTop:null!=(i=null==e?void 0:e.paddingTop)?i:null==e?void 0:e.paddingY,paddingLeft:null!=(r=null==e?void 0:e.paddingLeft)?r:null==e?void 0:e.paddingX,paddingRight:null!=(o=null==e?void 0:e.paddingRight)?o:null==e?void 0:e.paddingX,paddingBottom:null!=(a=null==e?void 0:e.paddingBottom)?a:null==e?void 0:e.paddingY,overflow:null==e?void 0:e.overflow})},Td=function(e){var t,n,i=null!=(t=null==e?void 0:e.as)?t:"div";return p.jsx(i,{className:kd(""+Ad(e),null==e?void 0:e.className),"data-component":null!=(n=null==e?void 0:e["data-component"])?n:"Grid",role:null==e?void 0:e.role,children:null==e?void 0:e.children})},_d=Object.assign((function(){return null}),{container:function(e){return Fl({position:"absolute",top:0,right:0,zIndex:2147483247,border:null==e?void 0:e.border,borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,boxShadow:null==e?void 0:e.boxShadow,fontSize:null==e?void 0:e.fontSize})},option:function(e){var t,n,i;return Fl(ge({display:"flex",width:"100%",alignItems:"center",justifyContent:"flex-start",padding:null==e?void 0:e.padding,borderBottom:null==e?void 0:e.separatorBorder,gap:"0.5rem",color:"inherit"},Cl,{variants:{clickable:(i={},i.true={cursor:"pointer","&:hover":ge({background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},Cl),"&:last-of-type":{borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius},"&:hover:last-of-type":{borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius},"&:first-of-type":{borderTopLeftRadius:null==e?void 0:e.borderRadius,borderTopRightRadius:null==e?void 0:e.borderRadius},"&:hover:first-of-type":{borderTopLeftRadius:null==e?void 0:e.borderRadius,borderTopRightRadius:null==e?void 0:e.borderRadius}},i)}}))},close:Fl({marginRight:"0.5rem",color:"inherit","&:hover":{opacity:.7}})});function Id(e,t){n.useEffect((function(){function n(n){e.current&&!e.current.contains(n.target)&&t()}return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}),[e,t])}var Dd=function(){return t.useContext(Od)},Od=t.createContext(void 0);function Ed(e,t){if(void 0!==e)try{return f(e).brighten(t).css()}catch(e){return void console.error("Invalid color provided:",e)}}var Ld=function(e){return 1===e?Nd:Rd},Nd={detail:"minimal",rowLimit:6,cellLimit:4,forms:{label:{fontSize:Il.font.standard,fontWeight:Il.font.bold,margin:"0 0 0.3rem 0"},input:{border:"2px "+Il.colors.brand[8]+" solid",background:"#fff",borderRadius:Il.size.borderRadius,padding:"0.35rem 0.5rem",fontSize:Il.font.standard,color:Il.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},active:{border:"2px rgb(224, 242, 255) solid","&:hover":{border:"2px rgb(224, 242, 255) solid"}}},select:{border:"2px "+Il.colors.brand[8]+" solid",background:"#fff",borderRadius:Il.size.borderRadius,padding:"0.35rem 0.5rem",color:Il.colors.brand.base,fontSize:Il.font.standard,fontWeight:"inherit",indicatorColor:Il.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},dateTime:{input:{border:"2px rgb(243, 244, 246) solid",background:"#fff",borderRadius:Il.size.borderRadius,padding:"0.26rem 0.5rem",fontSize:Il.font.standard,color:Il.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},active:{border:"2px rgb(239, 68, 68) solid","&:hover":{border:"2px rgb(239, 68, 68) solid"}}},date:{width:96},time:{width:40},indicatorColor:Il.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},unselected:{background:"transparent",color:"inherit",border:"1px solid #c9d1d9","&:hover":{background:"rgb(228, 231, 231)",color:"inherit",border:"1px solid rgb(228, 231, 231)"}},arrows:{background:"transparent",fill:"rgb(55, 65, 81)",border:"1px solid #e4e7e7",borderRadius:"8px","&:hover":{background:"rgb(233, 235, 240)",border:"1px solid #c4c4c4"}},title:{fontSize:Il.font.header,fontWeight:"bold",color:Il.font.color}}}},dropdowns:{fontSize:Il.font.standard,background:"rgb(255 255 255 / 1)",color:"inherit",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1)",borderRadius:Il.size.borderRadius,border:"0px solid transparent",separatorBorder:"1px solid "+Il.colors.brand[8],"&:hover":{background:Il.colors.brand[5]},padding:"0.5rem"},buttons:{primary:{borderRadius:Il.size.borderRadius,border:"1px solid rgb(48, 116, 217)",background:Il.colors.blue,padding:"0.30rem 0.75rem",boxShadow:"0 2px 0 rgb(0 0 0 / 5%)",color:"#fff",fontSize:Il.font.standard,"&:hover":{background:"#5795e6"}},secondary:{borderRadius:Il.size.borderRadius,border:"1px solid "+Il.colors.brand[20],background:"rgb(255, 255, 255)",padding:"0.30rem 0.75rem",color:Il.font.color,fontSize:Il.font.standard,"&:hover":{opacity:.7,background:"rgb(233, 235, 240)",border:"1px solid rgb(209, 209, 209, 0.8)",color:"rgb(27, 27, 29, 0.8)"},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}},add:{border:"2px dashed rgba(143, 143, 145, 0.2)",borderRadius:Il.size.borderRadius,color:"#8f8f91",background:"transparent","&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:"0.75rem"},medium:{fontSize:Il.font.standard},large:{fontSize:Il.font.standard}},grid:{selected:{borderRadius:Il.size.borderRadius,fontWeight:Il.font.bold,background:"rgb(243 244 246)",fontSize:Il.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}},unselected:{borderRadius:Il.size.borderRadius,fontWeight:Il.font.bold,background:"transparent",fontSize:Il.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}}}},panels:{padding:"0.75rem 1rem",borderRadius:Il.size.borderRadius,background:"#fff",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)"},modals:{base:{borderRadius:Il.size.borderRadius,border:"0px solid",background:"rgb(255, 255, 255)",boxShadow:"0 0 #0000,0 0 #0000,0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)",zIndex:2147483147},header:{padding:"0.75rem 0.75rem 0px"},content:{fontSize:Il.font.standard,padding:"0.75rem",alternativeBackground:"rgb(229 231 235 / 0.2)"},footer:{padding:"0.75rem"},overlay:{background:"#000",opacity:.3},options:{disableOutsideClick:!1,closeButton:"outside",showTitle:{editor:!1,library:!1}}},alerts:{padding:"8px 12px",borderRadius:Il.size.borderRadius,info:{background:"rgb(224, 242, 255)",border:"1px solid rgb(224, 242, 255)",iconColor:"#1677ff"},warning:{background:"rgb(255, 245, 234)",border:"1px solid #e1b878",iconColor:"#b98900"},critical:{background:"rgb(255, 85, 85)",border:"1px solid rgb(255, 85, 85)",color:"rgb(255, 255, 255)",iconColor:"#fff"},title:{fontWeight:Il.font.bold,fontSize:Il.font.standard},content:{fontSize:Il.font.standard}},tabs:{selected:{borderRadius:Il.size.borderRadius,padding:"0.5rem 0",fontSize:Il.font.standard,fontWeight:600,boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",background:"rgb(48 116 217)",color:"rgb(255 255 255)"},unselected:{borderRadius:Il.size.borderRadius,padding:"0.5rem 0",fontSize:Il.font.standard,fontWeight:600,color:"rgba(0, 0, 0, 0.4)"}},lists:{title:{fontSize:14,fontWeight:Il.font.bold},fontSize:Il.font.standard,border:"2px solid rgb(229 231 235 / 0.6)",borderRadius:Il.size.borderRadius,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"},select:{padding:"4px 0 4px 16px",fontSize:13,"&:hover":{background:Sl(97)}},row:{padding:"1px 1.5px 3.5px 8px"}},popoverMenu:{borderRadius:Il.size.borderRadius,fontSize:Il.font.standard,background:"rgb(249 247 250)",color:"inherit",boxShadow:"0 0 #0000,0 0 #0000,0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)","&:hover":{background:"rgb(255, 255, 255)"},padding:"0.35rem 0.75rem"},charts:{colors:["#feae4a","#5fbaff","#e15e9d"],title:{fontWeight:Il.font.bold,fontSize:Il.font.header,color:Il.colors.brand[90]},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Sl(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},line:{opacity:.1},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"},threshold:{stroke:"#F4F4F4"}},tables:{th:{background:Sl(95),borderTop:0,borderBottom:"3px solid "+Sl(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+Sl(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:Il.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Sl(70)},row:{borderBottom:"1px solid "+Sl(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}}},accordion:{iconColor:Il.colors.blue,button:{fontWeight:Il.font.bold,fontSize:Il.font.standard,color:Il.colors.blue}},dashboard:{borderColor:Sl(80),borderStyle:"solid",borderWidth:2,borderRadius:Il.size.borderRadius,icon:{color:Sl(5),background:"transparent","&:hover":{color:Ed(Sl(5),.95)}}},radioGroup:{description:{fontWeight:"inherit",color:Il.colors.brand[80],fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid rgb(243, 244, 246)",background:"#fff",borderRadius:"0.5rem",padding:"6px 10px 7px 16px",fontSize:16,fontWeight:500,height:36,"&:focus":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},"&:hover":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},icons:{color:"rgb(48, 116, 217)"}},library:{verified:{color:"rgba(22, 119, 255, 0.3)"}},header:{borderBottom:"2px solid "+Sl(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Ed("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Sl(15),background:"#fff"}},icons:{borderRadius:8,color:Sl(5),padding:4,"&:hover":{color:Ed(Sl(5),.95),background:Sl(95)}},chips:{background:"#E5E7EB",color:"#30363d",borderRadius:9999,fontSize:"0.75rem",fontWeight:400}},Md=Sl(82),Rd={detail:"minimal",rowLimit:6,cellLimit:4,version:2,forms:{label:{fontSize:14,color:Sl(0),fontWeight:500,margin:"0 0 0.3rem 0"},input:{fontSize:14,padding:"7.5px 1rem",color:Sl(0),fontWeight:400,border:"2px "+Md+" solid",background:"#fff",borderRadius:8,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},active:{border:"2px rgb(224, 242, 255) solid","&:hover":{border:"2px rgb(224, 242, 255) solid"}}},select:{border:"2px "+Md+" solid",background:"#fff",borderRadius:8,indicatorColor:Il.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},fontSize:14,padding:"8px 16px",color:Sl(0),fontWeight:400},dateTime:{input:{border:"2px "+Md+" solid",background:"#fff",borderRadius:8,padding:"0.26rem 0.5rem",fontSize:14,color:Sl(0),"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},active:{border:"2px rgb(224, 242, 255) solid","&:hover":{border:"2px rgb(224, 242, 255) solid"}}},date:{width:96},time:{width:48},indicatorColor:Il.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},unselected:{background:"transparent",color:"inherit",border:"1px solid #c9d1d9","&:hover":{background:"rgb(228, 231, 231)",color:"inherit",border:"1px solid rgb(228, 231, 231)"}},arrows:{background:"transparent",fill:"rgb(55, 65, 81)",border:"1px solid #e4e7e7",borderRadius:"8px","&:hover":{background:"rgb(233, 235, 240)",border:"1px solid #c4c4c4"}},title:{fontSize:Il.font.header,fontWeight:"bold",color:Il.font.color}}}},dropdowns:{fontSize:14,background:"rgb(255 255 255 / 1)",color:"inherit",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1)",borderRadius:8,border:"0px solid transparent",separatorBorder:"1px transparent solid","&:hover":{background:Sl(95)},padding:"0.5rem 1rem"},buttons:{primary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,fontWeight:500,background:Sl(0),color:"#fff",border:"0",boxShadow:"unset",narrowPadding:"0.46rem 1rem 0.5rem","&:hover":{background:Sl(10),border:0,boxShadow:"unset"},"&:disabled":{opacity:1,background:Sl(50),border:"0"},"&:hover:disabled":{opacity:1,background:Sl(50),border:"0"}},secondary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,background:"rgb(255, 255, 255)",fontWeight:500,color:Sl(0),border:"0",boxShadow:"unset","&:hover":{opacity:.7,background:"rgb(233, 235, 240)",border:0,boxShadow:"unset"},"&:disabled":{opacity:.7,background:"transparent",border:0},"&:hover:disabled":{opacity:.7,background:"transparent",border:0}},add:{border:"2px dashed "+Sl(70),color:Sl(15),background:"transparent",borderRadius:8,"&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:12,fontWeight:500},medium:{fontSize:12,fontWeight:500},large:{fontSize:14,fontWeight:500}}},panels:{padding:"0.75rem 1rem",borderRadius:8,background:"#fff",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)"},modals:{base:{borderRadius:8,border:"0px solid",background:"rgb(255, 255, 255)",boxShadow:"0 0 #0000,0 0 #0000,0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)",zIndex:2147483147},header:{background:"rgb(229 231 235 / 0.2)",padding:"1.5rem 2rem 0.5rem 2rem"},content:{fontSize:14,background:"rgb(229 231 235 / 0.2)",padding:"1rem 2rem",alternativeBackground:"rgb(229 231 235 / 0.2)"},footer:{padding:"0.5rem 2rem 0.5rem 2rem"},overlay:{background:"#000",opacity:.3},options:{disableOutsideClick:!1,closeButton:"outside",showTitle:{editor:!1,library:!1}}},alerts:{padding:"8px 12px",borderRadius:8,info:{background:"rgb(224, 242, 255)",border:"1px solid rgb(224, 242, 255)",iconColor:"#1677ff"},warning:{background:"rgb(255, 245, 234)",border:"1px solid #e1b878",iconColor:"#b98900"},critical:{background:"rgb(255, 85, 85)",border:"1px solid rgb(255, 85, 85)",color:"rgb(255, 255, 255)",iconColor:"#fff"},guidance:{background:"#EDF0F5",border:"none",color:"#374151",iconColor:"rgb(135, 141, 152)"},title:{fontWeight:Il.font.bold,fontSize:Il.font.standard,display:"block",width:"100%"},content:{fontSize:Il.font.standard,display:"block",width:"100%"}},tabs:{selected:{borderRadius:"0",padding:"11.5px 16px",fontSize:14,fontWeight:"initial",background:"transparent",color:"inherit",borderBottom:"3px solid #3683f5",boxShadow:"unset","&:disabled":{opacity:1,background:Sl(50),border:"0"},"&:hover:disabled":{opacity:1,background:Sl(50),border:"0"}},unselected:{borderRadius:"0",padding:"11.5px 16px 13.5px",fontSize:14,fontWeight:"initial",background:"transparent",color:"#6d7175",borderBottom:"1px solid "+Sl(90),"&:hover":{borderRadius:"6px 6px 0 0",color:"#202223"},"&:disabled":{opacity:1,background:Sl(90),border:"0"},"&:hover:disabled":{opacity:1,background:Sl(90),border:"0"}}},lists:{title:{fontSize:14,fontWeight:Il.font.bold},subTitle:{fontSize:14,fontWeight:Il.font.bold,color:Sl(20),margin:"0 0 0.5rem 0"},fontSize:Il.font.standard,borderRadius:8,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"},border:"2px solid "+Md,padding:"0.5rem",select:{padding:"4px 0 4px 16px",fontSize:13,"&:hover":{background:Sl(97)}},row:{padding:"2px 2px 2px 6px"}},popoverMenu:{borderRadius:8,fontSize:14,background:"rgb(249 247 250)",color:"inherit",boxShadow:"0 0 #0000,0 0 #0000,0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)","&:hover":{background:"rgb(255, 255, 255)"},padding:"0.35rem 0.75rem"},charts:{colors:["#feae4a","#5fbaff","#e15e9d"],title:{fontWeight:Il.font.bold,fontSize:Il.font.header,color:Sl(10)},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:Sl(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31",pie:{cornerRadius:5,gap:!0,hole:!0},line:{opacity:.1},barChart:{cornerRadius:3},singleStat:{delteStyle:"pill"},threshold:{stroke:"#F4F4F4"}},tables:{th:{background:"transparent",borderTop:0,borderBottom:"2px solid "+Sl(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid transparent",last:{borderRight:0},inner:{borderRight:!1},button:{color:"inherit",background:"transparent",padding:"8px",borderRadius:"8px","&:hover":{color:"inherit",background:Sl(90)}},sort:{color:"inherit",background:"transparent",padding:"8px",borderRadius:"8px","&:hover":{color:"inherit",background:Sl(90)}},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+Sl(70)},row:{borderBottom:"1px solid transparent",padding:"0.5rem",borderRight:"1px solid "+Sl(70),borderLeft:"1px solid "+Sl(70)},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}},body:{cells:{padding:"7.3px 8px",fontSize:13,borderBottom:"1px solid "+Il.colors.brand[8]},odd:{"&:hover":{background:Il.colors.brand[5]}},even:{"&:hover":{background:Il.colors.brand[5]}}}},accordion:{iconColor:Il.colors.blue,button:{fontWeight:Il.font.bold,fontSize:Il.font.standard,color:Il.colors.blue}},dashboard:{borderColor:Sl(80),borderStyle:"solid",borderWidth:2,borderRadius:"0.75rem",icon:{color:Sl(5),background:"transparent","&:hover":{color:Ed(Sl(5),.95)}}},radioGroup:{description:{fontWeight:"inherit",color:Sl(20),fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid "+Md,background:"#fff",borderRadius:"0.5rem",padding:"6px 10px 7px 16px",fontSize:16,fontWeight:500,height:36,"&:focus":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},"&:hover":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},icons:{color:"rgb(48, 116, 217)"}},library:{verified:{color:"rgba(22, 119, 255, 0.3)"}},filters:{filterBy:{padding:"0.45rem 1rem 0.46rem",lineHeight:"21px"}},header:{borderBottom:"2px solid "+Sl(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}},ai:{suggestions:{border:"1px solid transparent",background:"#D2D2FF",color:"#374151",borderRadius:8,padding:"8px 16px","&:hover":{background:Ed("#d2d2ff",.15),border:"1px solid #d2d2ff"}},avatar:{border:"none",color:Sl(15),background:"#fff"}},icons:{borderRadius:8,color:Sl(5),padding:4,"&:hover":{color:Ed(Sl(5),.95),background:Sl(95)}},chips:{background:"#E5E7EB",color:"#30363d",borderRadius:9999,fontSize:"0.75rem",fontWeight:400}},Pd=h({key:"css"}),zd=function(e){var t,n,i=null!=(t=null==(n=e.theme)?void 0:n.version)?t:2,o=r.defaultsDeep({},Vd(i,null==e?void 0:e.theme,null==e?void 0:e.storedTheme),Ld(i));return p.jsx(Od.Provider,{value:o,children:p.jsx(c.CacheProvider,{value:Pd,children:null==e?void 0:e.children})})},Vd=function(e,t,n){var i,o,a,l,s,u,d,c,p,f,m,h,v,g,x,b,y,w,C,j,F,S,k,A,T,_,I,D,O=null!=(i=null==t||null==(o=t.baseFont)?void 0:o.fontFamily)?i:null!=n&&n.fontFamily&&(null==n||null==(a=n.fontFamily)?void 0:a.length)>0?null==n?void 0:n.fontFamily:Il.font.sanSerif,E={baseFont:{fontSize:null!=(l=null!=(s=null==t||null==(u=t.baseFont)?void 0:u.fontSize)?s:null==n?void 0:n.fontSize)?l:Il.font.standard,fontFamily:O},titles:{fontFamily:null!=(d=null!=(c=null!=(p=null==t||null==(f=t.titles)?void 0:f.fontFamily)?p:null==t||null==(m=t.baseFont)?void 0:m.fontFamily)?c:null==n?void 0:n.fontFamily)?d:Il.font.sanSerif,fontSize:null!=(h=null==t||null==(v=t.titles)?void 0:v.fontSize)?h:null==t||null==(g=t.baseFont)?void 0:g.fontSize},colors:null!=(x=null!=(b=null!=(y=null==t||null==(w=t.charts)?void 0:w.colors)?y:null==t?void 0:t.colors)?b:null==n?void 0:n.colors)?x:null==(C=Ld(e).charts)?void 0:C.colors,rowLimit:null!=(j=null!=(F=null==t?void 0:t.rowLimit)?F:null==n?void 0:n.rowLimit)?j:Ld(e).rowLimit,detail:null!=(S=null!=(k=null==t?void 0:t.detail)?k:null==n?void 0:n.detail)?S:Ld(e).detail,fontFamily:O,fontSize:null!=(A=null!=(T=null==t?void 0:t.fontSize)?T:null==n?void 0:n.fontSize)?A:Il.font.sanSerif,dashboard:{icon:{color:null!=(_=null==t||null==(I=t.dashboard)||null==(I=I.icon)?void 0:I.color)?_:null==(D=Ld(e))||null==(D=D.dashboard)||null==(D=D.icon)?void 0:D.color}}};return r.merge({},t,E)},qd=t.createContext(!1);function Bd(e){return p.jsx(qd.Provider,{value:e.force,children:e.children})}function Wd(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];if(e in t){var o=t[e];return"function"==typeof o?o.apply(void 0,i):o}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,Wd),a}var Hd=["static"],Yd=["unmount"],Gd=["as","children","refName"],Ud=function(e){return e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e}({}),Kd=function(e){return e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e}({});function Xd(e){var t=e.slot,n=e.defaultTag,i=e.features,r=e.visible,o=void 0===r||r,a=e.name,l=Zd(e.theirProps,e.ourProps);if(o)return Qd(l,t,n,a);var s=null!=i?i:Ud.None;if(s&Ud.Static){var u=l.static,d=void 0!==u&&u,c=we(l,Hd);if(d)return Qd(c,t,n,a)}if(s&Ud.RenderStrategy){var p,f=l.unmount,m=void 0===f||f,h=we(l,Yd);return Wd(m?Kd.Unmount:Kd.Hidden,((p={})[Kd.Unmount]=function(){return null},p[Kd.Hidden]=function(){return Qd(ge({},h,{hidden:!0,style:{display:"none"}}),t,n,a)},p))}return Qd(l,t,n,a)}function Qd(e,n,i,r){var o;void 0===n&&(n={});var a=ec(e,["unmount","static"]),l=a.as,s=void 0===l?i:l,u=a.children,d=a.refName,c=void 0===d?"ref":d,p=we(a,Gd),f=void 0!==e.ref?((o={})[c]=e.ref,o):{},m="function"==typeof u?u(n):u;p.className&&"function"==typeof p.className&&(p.className=p.className(n));var h={};if(n){for(var v=!1,g=[],x=0,b=Object.entries(n);x<b.length;x++){var y=b[x],w=y[1];"boolean"==typeof w&&(v=!0),!0===w&&g.push(y[0])}v&&(h["data-headlessui-state"]=g.join(" "))}if(s===t.Fragment&&Object.keys($d(p)).length>0){if(!t.isValidElement(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+r+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(p).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return t.cloneElement(m,Object.assign({},Zd(m.props,$d(ec(p,["ref"]))),h,f,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return{ref:t.every((function(e){return null==e}))?void 0:function(e){for(var n,i=ve(t);!(n=i()).done;){var r=n.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}}}(m.ref,f.ref)))}return t.createElement(s,Object.assign({},ec(p,["ref"]),s!==t.Fragment&&f,s!==t.Fragment&&h),m)}function Zd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return{};if(1===t.length)return t[0];for(var i={},r={},o=0,a=t;o<a.length;o++){var l=a[o];for(var s in l)s.startsWith("on")&&"function"==typeof l[s]?(null!=r[s]||(r[s]=[]),r[s].push(l[s])):i[s]=l[s]}if(i.disabled||i["aria-disabled"])return Object.assign(i,Object.fromEntries(Object.keys(r).map((function(e){return[e,void 0]}))));var u=function(e){var t;Object.assign(i,((t={})[e]=function(t){for(var n=r[e],i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];for(var l,s=ve(n);!(l=s()).done;){var u=l.value;if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;u.apply(void 0,[t].concat(o))}},t))};for(var d in r)u(d);return i}function Jd(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function $d(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}function ec(e,t){void 0===t&&(t=[]);for(var n,i=Object.assign({},e),r=ve(t);!(n=r()).done;){var o=n.value;o in i&&delete i[o]}return i}var tc="undefined"==typeof window||"undefined"==typeof document,nc=tc?t.useEffect:t.useLayoutEffect;function ic(e){var n=t.useRef(e);return nc((function(){n.current=e}),[e]),n}var rc=function(e){var t=ic(e);return n.useCallback((function(){return t.current.apply(t,arguments)}),[t])},oc=Symbol();function ac(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=t.useRef(n);t.useEffect((function(){r.current=n}),[n]);var o=rc((function(e){for(var t,n=ve(r.current);!(t=n()).done;){var i=t.value;null!=i&&("function"==typeof i?i(e):i.current=e)}}));return n.every((function(e){return null==e||(null==e?void 0:e[oc])}))?void 0:o}var lc,sc=function(e){return e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e}({}),uc={serverHandoffComplete:!1};function dc(){var e=t.useState(uc.serverHandoffComplete),n=e[0],i=e[1];return t.useEffect((function(){!0!==n&&i(!0)}),[n]),t.useEffect((function(){!1===uc.serverHandoffComplete&&(uc.serverHandoffComplete=!0)}),[]),n}var cc=0;function pc(){return++cc}var fc=null!=(lc=n.useId)?lc:function(){var e=dc(),t=n.useState(e?pc:null),i=t[0],r=t[1];return nc((function(){null===i&&r(pc())}),[i]),null!=i?""+i:void 0},mc=["features"],hc=function(e){return e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e}({}),vc=Jd((function(e,t){var n=e.features,i=void 0===n?hc.None:n,r=we(e,mc);return Xd({ourProps:{ref:t,"aria-hidden":(i&hc.Focusable)===hc.Focusable||void 0,style:ge({position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},(i&hc.Hidden)===hc.Hidden&&!((i&hc.Focusable)===hc.Focusable)&&{display:"none"})},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})}));function gc(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}function xc(){var e=[],t=[],n={enqueue:function(e){t.push(e)},addEventListener:function(e,t,i,r){return e.addEventListener(t,i,r),n.add((function(){return e.removeEventListener(t,i,r)}))},requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);return n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n.requestAnimationFrame((function(){return n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);return n.add((function(){return clearTimeout(e)}))})),microTask:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var r={current:!0};return gc((function(){r.current&&t[0]()})),n.add((function(){r.current=!1}))},add:function(t){return e.push(t),function(){var n=e.indexOf(t);n>=0&&(0,e.splice(n,1)[0])()}},dispose:function(){for(var t,n=ve(e.splice(0));!(t=n()).done;)(0,t.value)()},workQueue:function(){return me(Ce().mark((function e(){var n,i,r;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=ve(t.splice(0));case 1:if((i=n()).done){e.next=7;break}return r=i.value,e.next=5,r();case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e)})))()}};return n}function bc(e){return tc?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}var yc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(","),wc=function(e){return e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e}({}),Cc=function(e){return e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e}({}),jc=function(e){return e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e}(jc||{}),Fc=function(e){return e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e}({});function Sc(e){null==e||e.focus({preventScroll:!0})}var kc=["textarea","input"].join(",");function Ac(e,t){return void 0===t&&(t=function(e){return e}),e.slice().sort((function(e,n){var i=t(e),r=t(n);if(null===i||null===r)return 0;var o=i.compareDocumentPosition(r);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function Tc(e,t,n,i){var r;void 0===n&&(n=!0),void 0===i&&(i=null);var o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?Ac(e):e:function(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(yc))}(e);i=null!=(r=i)?r:o.activeElement;var l,s,u=function(){if(t&(wc.First|wc.Next))return jc.Next;if(t&(wc.Previous|wc.Last))return jc.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),d=function(){if(t&wc.First)return 0;if(t&wc.Previous)return Math.max(0,a.indexOf(i))-1;if(t&wc.Next)return Math.max(0,a.indexOf(i))+1;if(t&wc.Last)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),c=t&wc.NoScroll?{preventScroll:!0}:{},p=0,f=a.length,m=void 0;do{var h;if(p>=f||p+f<=0)return Cc.Error;var v=d+p;if(t&wc.WrapAround)v=(v+f)%f;else{if(v<0)return Cc.Underflow;if(v>=f)return Cc.Overflow}null==(h=m=a[v])||h.focus(c),p+=u}while(m!==o.activeElement);return t&(wc.Next|wc.Previous)&&null!=(s=null==(l=m)||null==l.matches?void 0:l.matches(kc))&&s&&m.select(),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0"),Cc.Success}var _c=function(e){return e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e}({});function Ic(){var e=t.useRef(!1);return nc((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function Dc(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.useMemo((function(){return bc.apply(void 0,n)}),[].concat(n))}function Oc(e,n,i,r){var o=ic(i);t.useEffect((function(){var t;function i(e){o.current(e)}return(e=null!=(t=e)?t:window).addEventListener(n,i,r),function(){return e.removeEventListener(n,i,r)}}),[e,n,r])}function Ec(e,n){var i=t.useRef([]),r=rc(e);t.useEffect((function(){for(var e,t=[].concat(i.current),o=ve(n.entries());!(e=o()).done;){var a=e.value;if(i.current[a[0]]!==a[1]){var l=r(n,t);return i.current=n,l}}}),[r].concat(n))}var Lc=["initialFocus","containers","features"],Nc=function(e){return e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e}(Nc||{}),Mc=Object.assign(Jd((function(e,n){var i=t.useRef(null),r=ac(i,n),o=e.initialFocus,a=e.containers,l=e.features,s=void 0===l?Nc.All:l,u=we(e,Lc);dc()||(s=Nc.None);var d=Dc(i);!function(e,n){var i=e.ownerDocument,r=t.useRef(null);Oc(null==i?void 0:i.defaultView,"focusout",(function(e){n&&(r.current||(r.current=e.target))}),!0),Ec((function(){n||((null==i?void 0:i.activeElement)===(null==i?void 0:i.body)&&Sc(r.current),r.current=null)}),[n]);var o=t.useRef(!1);t.useEffect((function(){return o.current=!1,function(){o.current=!0,gc((function(){o.current&&(Sc(r.current),r.current=null)}))}}),[])}({ownerDocument:d},Boolean(s&Nc.RestoreFocus));var c=function(e,n){var i=e.ownerDocument,r=e.container,o=e.initialFocus,a=t.useRef(null),l=Ic();return Ec((function(){if(n){var e=r.current;e&&gc((function(){if(l.current){var t=null==i?void 0:i.activeElement;if(null!=o&&o.current){if((null==o?void 0:o.current)===t)return void(a.current=t)}else if(e.contains(t))return void(a.current=t);null!=o&&o.current?Sc(o.current):Tc(e,wc.First)===Cc.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),a.current=null==i?void 0:i.activeElement}}))}}),[n]),a}({ownerDocument:d,container:i,initialFocus:o},Boolean(s&Nc.InitialFocus));!function(e,t){var n=e.ownerDocument,i=e.container,r=e.containers,o=e.previousActiveElement,a=Ic();Oc(null==n?void 0:n.defaultView,"focus",(function(e){if(t&&a.current){var n=new Set(null==r?void 0:r.current);n.add(i);var l=o.current;if(l){var s=e.target;s&&s instanceof HTMLElement?function(e,t){for(var n,i=ve(e);!(n=i()).done;){var r;if(null!=(r=n.value.current)&&r.contains(t))return!0}return!1}(n,s)?(o.current=s,Sc(s)):(e.preventDefault(),e.stopPropagation(),Sc(l)):Sc(o.current)}}}),!0)}({ownerDocument:d,container:i,containers:a,previousActiveElement:c},Boolean(s&Nc.FocusLock));var f=function(){var e,n=t.useRef(_c.Forwards);return e=ic((function(e){"Tab"===e.key&&(n.current=e.shiftKey?_c.Backwards:_c.Forwards)})),t.useEffect((function(){function t(t){e.current(t)}return window.addEventListener("keydown",t,!0),function(){return window.removeEventListener("keydown",t,!0)}}),["keydown",!0]),n}(),m=rc((function(){var e,t=i.current;t&&Wd(f.current,((e={})[_c.Forwards]=function(){return Tc(t,wc.First)},e[_c.Backwards]=function(){return Tc(t,wc.Last)},e))})),h={ref:r};return p.jsxs(p.Fragment,{children:[Boolean(s&Nc.TabLock)&&p.jsx(vc,{as:"button",type:"button",onFocus:m,features:hc.Focusable}),Xd({ourProps:h,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(s&Nc.TabLock)&&p.jsx(vc,{as:"button",type:"button",onFocus:m,features:hc.Focusable})]})})),{features:Nc}),Rc=new Set,Pc=new Map;function zc(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Vc(e){var t=Pc.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var qc=["target"],Bc="headlessui-portal-root",Wc=t.Fragment,Hc=Jd((function(e,n){var i,r,o=e,a=t.useRef(null),l=ac((void 0===i&&(i=!0),Object.assign((function(e){a.current=e}),((r={})[oc]=i,r))),n),s=Dc(a),u=function(e){var n=t.useContext(qd),i=t.useContext(Gc),r=Dc(e),o=t.useState((function(){if(!n&&null!==i)return null;if(tc)return null;var e=null==r?void 0:r.getElementById(Bc);if(e)return e;if(null===r)return null;var t=r.createElement("div");return t.setAttribute("id",Bc),t.setAttribute("data-testid",Bc),r.body.appendChild(t)})),a=o[0],l=o[1];return t.useEffect((function(){null!==a&&(null!=r&&r.body.contains(a)||null==r||r.body.appendChild(a))}),[a,r]),t.useEffect((function(){n||null!==i&&l(i.current)}),[i,l,n]),a}(a),d=t.useState((function(){var e;return tc?null:null!=(e=null==s?void 0:s.createElement("div"))?e:null}))[0],c=dc(),p=t.useRef(!1);return nc((function(){if(p.current=!1,u&&d)return u.contains(d)||(d.setAttribute("data-headlessui-portal",""),u.appendChild(d)),function(){p.current=!0,gc((function(){var e;p.current&&u&&d&&(u.removeChild(d),u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u)))}))}}),[u,d]),c&&u&&d?v.createPortal(Xd({ourProps:{ref:l},theirProps:o,defaultTag:Wc,name:"Portal"}),d):null})),Yc=t.Fragment,Gc=t.createContext(null),Uc=Object.assign(Hc,{Group:Jd((function(e,t){var n=e.target,i=we(e,qc),r=ac(t);return p.jsx(Gc.Provider,{value:n,children:Xd({ourProps:{ref:r},theirProps:i,defaultTag:Yc,name:"Popover.Group"})})}))}),Kc=t.createContext(null);function Xc(){var e=t.useContext(Kc);if(null===e){var n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Xc),n}return e}var Qc=Jd((function(e,t){var n=Xc(),i="headlessui-description-"+fc(),r=ac(t);nc((function(){return n.register(i)}),[i,n.register]);var o=e;return Xd({ourProps:ge({ref:r},n.props,{id:i}),theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})})),Zc=t.createContext(null);Zc.displayName="OpenClosedContext";var Jc=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}({});function $c(){return t.useContext(Zc)}function ep(e){return p.jsx(Zc.Provider,{value:e.value,children:e.children})}var tp=t.createContext((function(){}));tp.displayName="StackContext";var np=function(e){return e[e.Add=0]="Add",e[e.Remove=1]="Remove",e}({});function ip(e){var n=e.children,i=e.onUpdate,r=e.type,o=e.element,a=e.enabled,l=t.useContext(tp),s=rc((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];null==i||i.apply(void 0,t),l.apply(void 0,t)}));return nc((function(){var e=void 0===a||!0===a;return e&&s(np.Add,r,o),function(){e&&s(np.Remove,r,o)}}),[s,r,o,a]),p.jsx(tp.Provider,{value:s,children:n})}function rp(e,n,i){var r=ic(n);t.useEffect((function(){function t(e){r.current(e)}return document.addEventListener(e,t,i),function(){return document.removeEventListener(e,t,i)}}),[e,i])}var op,ap=["open","onClose","initialFocus","__demoMode"],lp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(lp||{}),sp=function(e){return e[e.SetTitleId=0]="SetTitleId",e}(sp||{}),up=((op={})[sp.SetTitleId]=function(e,t){return e.titleId===t.id?e:ge({},e,{titleId:t.id})},op),dp=t.createContext(null);function cp(e){var n=t.useContext(dp);if(null===n){var i=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(i,cp),i}return n}function pp(e,t){return Wd(t.type,up,e,t)}dp.displayName="DialogContext";var fp,mp=Ud.RenderStrategy|Ud.Static,hp=Jd((function(e,n){var i,r=e.open,o=e.onClose,a=e.initialFocus,l=e.__demoMode,s=void 0!==l&&l,u=we(e,ap),d=t.useState(0),c=d[0],f=d[1],m=$c();void 0===r&&null!==m&&(r=Wd(m,((i={})[Jc.Open]=!0,i[Jc.Closed]=!1,i)));var h=t.useRef(new Set),v=t.useRef(null),g=ac(v,n),x=t.useRef(null),b=Dc(v),y=e.hasOwnProperty("open")||null!==m,w=e.hasOwnProperty("onClose");if(!y&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!y)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof r)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+r);if("function"!=typeof o)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+o);var C=r?lp.Open:lp.Closed,j=t.useReducer(pp,{titleId:null,descriptionId:null,panelRef:t.createRef()}),F=j[0],S=j[1],k=rc((function(){return o(!1)})),A=rc((function(e){return S({type:sp.SetTitleId,id:e})})),T=!!dc()&&!s&&C===lp.Open,_=c>1,I=null!==t.useContext(dp),D=_?"parent":"leaf";!function(e,t){void 0===t&&(t=!0),nc((function(){if(t&&e.current){var n=e.current,i=bc(n);if(i){Rc.add(n);for(var r,o=ve(Pc.keys());!(r=o()).done;){var a=r.value;a.contains(n)&&(Vc(a),Pc.delete(a))}return i.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=ve(Rc);!(t=n()).done;)if(e.contains(t.value))return;1===Rc.size&&(Pc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),zc(e))}})),function(){if(Rc.delete(n),Rc.size>0)i.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!Pc.has(e)){for(var t,n=ve(Rc);!(t=n()).done;)if(e.contains(t.value))return;Pc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),zc(e)}}));else for(var e,t=ve(Pc.keys());!(e=t()).done;){var r=e.value;Vc(r),Pc.delete(r)}}}}}),[t])}(v,!!_&&T),function(e,n,i){void 0===i&&(i=!0);var r=t.useRef(!1);function o(t,i){if(r.current&&!t.defaultPrevented){var o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=i(t);if(null!==a&&a.getRootNode().contains(a)){for(var l,s=ve(o);!(l=s()).done;){var u=l.value;if(null!==u){var d=u instanceof HTMLElement?u:u.current;if(null!=d&&d.contains(a))return}}var c,p,f,m;return void 0===(p=Fc.Loose)&&(p=Fc.Strict),(c=a)!==(null==(f=bc(c))?void 0:f.body)&&Wd(p,((m={})[Fc.Strict]=function(){return c.matches(yc)},m[Fc.Loose]=function(){for(var e=c;null!==e;){if(e.matches(yc))return!0;e=e.parentElement}return!1},m))||-1===a.tabIndex||t.preventDefault(),n(t,a)}}}t.useEffect((function(){requestAnimationFrame((function(){r.current=i}))}),[i]);var a=t.useRef(null);rp("mousedown",(function(e){var t;r.current&&(a.current=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target)}),!0),rp("click",(function(e){a.current&&(o(e,(function(){return a.current})),a.current=null)}),!0),rp("blur",(function(e){return o(e,(function(){return window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null}))}),!0)}((function(){var e,t,n=Array.from(null!=(e=null==b?void 0:b.querySelectorAll("body > *, [data-headlessui-portal]"))?e:[]).filter((function(e){return e instanceof HTMLElement&&!e.contains(x.current)&&(!F.panelRef.current||!e.contains(F.panelRef.current))}));return[].concat(n,[null!=(t=F.panelRef.current)?t:v.current])}),k,T&&!_),Oc(null==b?void 0:b.defaultView,"keydown",(function(e){e.defaultPrevented||e.key===sc.Escape&&C===lp.Open&&(_||(e.preventDefault(),e.stopPropagation(),k()))})),function(e,n){t.useEffect((function(){var t;if(n&&e){var i=xc(),r=e.documentElement,o=(null!=(t=e.defaultView)?t:window).innerWidth-r.clientWidth;if(l(r,"overflow","hidden"),o>0&&l(r,"paddingRight",o-(r.clientWidth-r.offsetWidth)+"px"),/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0){var a=window.pageYOffset;l(r,"position","fixed"),l(r,"marginTop","-"+a+"px"),l(r,"width","100%"),i.add((function(){return window.scrollTo(0,a)}))}return i.dispose}function l(e,t,n){var r,o=e.style.getPropertyValue(t);return Object.assign(e.style,((r={})[t]=n,r)),i.add((function(){var n;Object.assign(e.style,((n={})[t]=o,n))}))}}),[e,n])}(b,C===lp.Open&&!I),t.useEffect((function(){if(C===lp.Open&&v.current){var e=new IntersectionObserver((function(e){for(var t,n=ve(e);!(t=n()).done;){var i=t.value;0===i.boundingClientRect.x&&0===i.boundingClientRect.y&&0===i.boundingClientRect.width&&0===i.boundingClientRect.height&&k()}}));return e.observe(v.current),function(){return e.disconnect()}}}),[C,v,k]);var O=function(){var e=t.useState([]),n=e[0],i=e[1];return[n.length>0?n.join(" "):void 0,t.useMemo((function(){return function(e){var n=rc((function(e){return i((function(t){return[].concat(t,[e])})),function(){return i((function(t){var n=t.slice(),i=n.indexOf(e);return-1!==i&&n.splice(i,1),n}))}})),r=t.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return p.jsx(Kc.Provider,{value:r,children:e.children})}}),[i])]}(),E=O[0],L=O[1],N="headlessui-dialog-"+fc(),M=t.useMemo((function(){return[{dialogState:C,close:k,setTitleId:A},F]}),[C,F,k,A]),R=t.useMemo((function(){return{open:C===lp.Open}}),[C]),P={ref:g,id:N,role:"dialog","aria-modal":C===lp.Open||void 0,"aria-labelledby":F.titleId,"aria-describedby":E};return p.jsxs(ip,{type:"Dialog",enabled:C===lp.Open,element:v,onUpdate:rc((function(e,t,n){var i;"Dialog"===t&&Wd(e,((i={})[np.Add]=function(){h.current.add(n),f((function(e){return e+1}))},i[np.Remove]=function(){h.current.add(n),f((function(e){return e-1}))},i))})),children:[p.jsx(Bd,{force:!0,children:p.jsx(Uc,{children:p.jsx(dp.Provider,{value:M,children:p.jsx(Uc.Group,{target:v,children:p.jsx(Bd,{force:!1,children:p.jsx(L,{slot:R,name:"Dialog.Description",children:p.jsx(Mc,{initialFocus:a,containers:h,features:T?Wd(D,{parent:Mc.features.RestoreFocus,leaf:Mc.features.All&~Mc.features.FocusLock}):Mc.features.None,children:Xd({ourProps:P,theirProps:u,slot:R,defaultTag:"div",features:mp,visible:C===lp.Open,name:"Dialog"})})})})})})})}),p.jsx(vc,{features:hc.Hidden,ref:x})]})})),vp=Jd((function(e,n){var i=cp("Dialog.Overlay")[0],r=i.dialogState,o=i.close;return Xd({ourProps:{ref:ac(n),id:"headlessui-dialog-overlay-"+fc(),"aria-hidden":!0,onClick:rc((function(e){if(e.target===e.currentTarget){if(function(e){for(var t,n,i=e.parentElement,r=null;i&&!(i instanceof HTMLFieldSetElement);)i instanceof HTMLLegendElement&&(r=i),i=i.parentElement;var o=null!=(t=""===(null==(n=i)?void 0:n.getAttribute("disabled")))&&t;return(!o||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&o}(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),o()}}))},theirProps:e,slot:t.useMemo((function(){return{open:r===lp.Open}}),[r]),defaultTag:"div",name:"Dialog.Overlay"})})),gp=Object.assign(hp,{Backdrop:Jd((function(e,n){var i=cp("Dialog.Backdrop"),r=i[0].dialogState,o=i[1],a=ac(n),l="headlessui-dialog-backdrop-"+fc();t.useEffect((function(){if(null===o.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[o.panelRef]);var s=t.useMemo((function(){return{open:r===lp.Open}}),[r]);return p.jsx(Bd,{force:!0,children:p.jsx(Uc,{children:Xd({ourProps:{ref:a,id:l,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})})})})),Panel:Jd((function(e,n){var i=cp("Dialog.Panel"),r=i[0].dialogState,o=ac(n,i[1].panelRef),a="headlessui-dialog-panel-"+fc(),l=t.useMemo((function(){return{open:r===lp.Open}}),[r]);return Xd({ourProps:{ref:o,id:a,onClick:rc((function(e){e.stopPropagation()}))},theirProps:e,slot:l,defaultTag:"div",name:"Dialog.Panel"})})),Overlay:vp,Title:Jd((function(e,n){var i=cp("Dialog.Title")[0],r=i.dialogState,o=i.setTitleId,a="headlessui-dialog-title-"+fc(),l=ac(n);t.useEffect((function(){return o(a),function(){return o(null)}}),[a,o]);var s=t.useMemo((function(){return{open:r===lp.Open}}),[r]);return Xd({ourProps:{ref:l,id:a},theirProps:e,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),Description:Qc});function xp(e){var t;if(e.type)return e.type;var n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function bp(e,n){var i=t.useState((function(){return xp(e)})),r=i[0],o=i[1];return nc((function(){o(xp(e))}),[e.type,e.as]),nc((function(){r||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[r,n]),r}var yp,wp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(wp||{}),Cp=function(e){return e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e}(Cp||{});(fp={})[Cp.ToggleDisclosure]=function(e){var t;return ge({},e,{disclosureState:Wd(e.disclosureState,(t={},t[wp.Open]=wp.Closed,t[wp.Closed]=wp.Open,t))})},fp[Cp.CloseDisclosure]=function(e){return e.disclosureState===wp.Closed?e:ge({},e,{disclosureState:wp.Closed})},fp[Cp.LinkPanel]=function(e){return!0===e.linkedPanel?e:ge({},e,{linkedPanel:!0})},fp[Cp.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:ge({},e,{linkedPanel:!1})},fp[Cp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:ge({},e,{buttonId:t.buttonId})},fp[Cp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:ge({},e,{panelId:t.panelId})},t.createContext(null).displayName="DisclosureContext",t.createContext(null).displayName="DisclosureAPIContext",t.createContext(null).displayName="DisclosurePanelContext";var jp=function(e){return e[e.Open=0]="Open",e[e.Closed=1]="Closed",e}(jp||{}),Fp=function(e){return e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e}(Fp||{});function Sp(e){var n=e.onFocus,i=t.useState(!0),r=i[1];return i[0]?p.jsx(vc,{as:"button",type:"button",features:hc.Focusable,onFocus:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){var t;e.preventDefault();var i=50;t=requestAnimationFrame((function e(){if(!(i--<=0))return n()?(r(!1),void cancelAnimationFrame(t)):void(t=requestAnimationFrame(e));t&&cancelAnimationFrame(t)}))}))}):null}(yp={})[Fp.TogglePopover]=function(e){var t;return ge({},e,{popoverState:Wd(e.popoverState,(t={},t[jp.Open]=jp.Closed,t[jp.Closed]=jp.Open,t))})},yp[Fp.ClosePopover]=function(e){return e.popoverState===jp.Closed?e:ge({},e,{popoverState:jp.Closed})},yp[Fp.SetButton]=function(e,t){return e.button===t.button?e:ge({},e,{button:t.button})},yp[Fp.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:ge({},e,{buttonId:t.buttonId})},yp[Fp.SetPanel]=function(e,t){return e.panel===t.panel?e:ge({},e,{panel:t.panel})},yp[Fp.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:ge({},e,{panelId:t.panelId})},t.createContext(null).displayName="PopoverContext",t.createContext(null).displayName="PopoverAPIContext",t.createContext(null).displayName="PopoverGroupContext",t.createContext(null).displayName="PopoverPanelContext",t.createContext(null).displayName="GroupContext";var kp,Ap=["defaultIndex","vertical","manual","onChange","selectedIndex"],Tp=function(e){return e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e}(Tp||{}),_p=((kp={})[Tp.SetSelectedIndex]=function(e,t){var n=e.tabs.filter((function(e){var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}));if(t.index<0)return ge({},e,{selectedIndex:e.tabs.indexOf(n[0])});if(t.index>e.tabs.length)return ge({},e,{selectedIndex:e.tabs.indexOf(n[n.length-1])});var i=e.tabs.slice(0,t.index),r=e.tabs.slice(t.index),o=[].concat(r,i).find((function(e){return n.includes(e)}));return o?ge({},e,{selectedIndex:e.tabs.indexOf(o)}):e},kp[Tp.RegisterTab]=function(e,t){var n;if(e.tabs.includes(t.tab))return e;var i=e.tabs[e.selectedIndex],r=Ac([].concat(e.tabs,[t.tab]),(function(e){return e.current})),o=null!=(n=r.indexOf(i))?n:e.selectedIndex;return-1===o&&(o=e.selectedIndex),ge({},e,{tabs:r,selectedIndex:o})},kp[Tp.UnregisterTab]=function(e,t){return ge({},e,{tabs:e.tabs.filter((function(e){return e!==t.tab}))})},kp[Tp.RegisterPanel]=function(e,t){return e.panels.includes(t.panel)?e:ge({},e,{panels:Ac([].concat(e.panels,[t.panel]),(function(e){return e.current}))})},kp[Tp.UnregisterPanel]=function(e,t){return ge({},e,{panels:e.panels.filter((function(e){return e!==t.panel}))})},kp),Ip=t.createContext(null);function Dp(e){var n=t.useContext(Ip);if(null===n){var i=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(i,Dp),i}return n}Ip.displayName="TabsSSRContext";var Op=t.createContext(null);function Ep(e){var n=t.useContext(Op);if(null===n){var i=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(i,Ep),i}return n}Op.displayName="TabsDataContext";var Lp=t.createContext(null);function Np(e){var n=t.useContext(Lp);if(null===n){var i=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(i,Np),i}return n}function Mp(e,t){return Wd(t.type,_p,e,t)}Lp.displayName="TabsActionsContext";var Rp=t.Fragment,Pp=Jd((function(e,n){var i=e.defaultIndex,r=void 0===i?0:i,o=e.vertical,a=void 0!==o&&o,l=e.manual,s=void 0!==l&&l,u=e.onChange,d=e.selectedIndex,c=void 0===d?null:d,f=we(e,Ap),m=a?"vertical":"horizontal",h=s?"manual":"auto",v=null!==c,g=ac(n),x=t.useReducer(Mp,{selectedIndex:null!=c?c:r,tabs:[],panels:[]}),b=x[0],y=x[1],w=t.useMemo((function(){return{selectedIndex:b.selectedIndex}}),[b.selectedIndex]),C=ic(u||function(){}),j=ic(b.tabs),F=t.useMemo((function(){return ge({orientation:m,activation:h},b)}),[m,h,b]),S=ic(v?e.selectedIndex:b.selectedIndex),k=t.useMemo((function(){return{registerTab:function(e){return y({type:Tp.RegisterTab,tab:e}),function(){return y({type:Tp.UnregisterTab,tab:e})}},registerPanel:function(e){return y({type:Tp.RegisterPanel,panel:e}),function(){return y({type:Tp.UnregisterPanel,panel:e})}},change:function(e){S.current!==e&&C.current(e),v||y({type:Tp.SetSelectedIndex,index:e})}}}),[y,v]);nc((function(){y({type:Tp.SetSelectedIndex,index:null!=c?c:r})}),[c]);var A=t.useRef({tabs:[],panels:[]}),T={ref:g};return p.jsx(Ip.Provider,{value:A,children:p.jsx(Lp.Provider,{value:k,children:p.jsxs(Op.Provider,{value:F,children:[F.tabs.length<=0&&p.jsx(Sp,{onFocus:function(){for(var e,t=ve(j.current);!(e=t()).done;){var n,i,r=e.value;if(0===(null==(n=r.current)?void 0:n.tabIndex))return null==(i=r.current)||i.focus(),!0}return!1}}),Xd({ourProps:T,theirProps:f,slot:w,defaultTag:Rp,name:"Tabs"})]})})})})),zp=Jd((function(e,t){var n=Ep("Tab.List"),i=n.orientation,r=n.selectedIndex;return Xd({ourProps:{ref:ac(t),role:"tablist","aria-orientation":i},theirProps:e,slot:{selectedIndex:r},defaultTag:"div",name:"Tabs.List"})})),Vp=Ud.RenderStrategy|Ud.Static,qp=Object.assign(Jd((function(e,n){var i,r="headlessui-tabs-tab-"+fc(),o=Ep("Tab"),a=o.orientation,l=o.activation,s=o.selectedIndex,u=o.tabs,d=o.panels,c=Np("Tab"),p=Ep("Tab"),f=Dp("Tab"),m=t.useRef(null),h=ac(m,n);nc((function(){return c.registerTab(m)}),[c,m]);var v=f.current.tabs.indexOf(r);-1===v&&(v=f.current.tabs.push(r)-1);var g=u.indexOf(m);-1===g&&(g=v);var x=g===s,b=rc((function(e){var t=e();if(t===Cc.Success&&"auto"===l){var n,i=null==(n=bc(m))?void 0:n.activeElement,r=p.tabs.findIndex((function(e){return e.current===i}));-1!==r&&c.change(r)}return t})),y=rc((function(e){var t=u.map((function(e){return e.current})).filter(Boolean);if(e.key===sc.Space||e.key===sc.Enter)return e.preventDefault(),e.stopPropagation(),void c.change(g);switch(e.key){case sc.Home:case sc.PageUp:return e.preventDefault(),e.stopPropagation(),b((function(){return Tc(t,wc.First)}));case sc.End:case sc.PageDown:return e.preventDefault(),e.stopPropagation(),b((function(){return Tc(t,wc.Last)}))}return b((function(){return Wd(a,{vertical:function(){return e.key===sc.ArrowUp?Tc(t,wc.Previous|wc.WrapAround):e.key===sc.ArrowDown?Tc(t,wc.Next|wc.WrapAround):Cc.Error},horizontal:function(){return e.key===sc.ArrowLeft?Tc(t,wc.Previous|wc.WrapAround):e.key===sc.ArrowRight?Tc(t,wc.Next|wc.WrapAround):Cc.Error}})}))===Cc.Success?e.preventDefault():void 0})),w=t.useRef(!1),C=rc((function(){var e;w.current||(w.current=!0,null==(e=m.current)||e.focus(),c.change(g),gc((function(){w.current=!1})))})),j=rc((function(e){e.preventDefault()})),F=t.useMemo((function(){return{selected:x}}),[x]),S=e;return Xd({ourProps:{ref:h,onKeyDown:y,onMouseDown:j,onClick:C,id:r,role:"tab",type:bp(e,m),"aria-controls":null==(i=d[g])||null==(i=i.current)?void 0:i.id,"aria-selected":x,tabIndex:x?0:-1},theirProps:S,slot:F,defaultTag:"button",name:"Tabs.Tab"})})),{Group:Pp,List:zp,Panels:Jd((function(e,n){var i=Ep("Tab.Panels").selectedIndex;return Xd({ourProps:{ref:ac(n)},theirProps:e,slot:t.useMemo((function(){return{selectedIndex:i}}),[i]),defaultTag:"div",name:"Tabs.Panels"})})),Panel:Jd((function(e,n){var i,r,o,a=Ep("Tab.Panel"),l=a.selectedIndex,s=a.tabs,u=a.panels,d=Np("Tab.Panel"),c=Dp("Tab.Panel"),f="headlessui-tabs-panel-"+fc(),m=t.useRef(null),h=ac(m,n);nc((function(){return d.registerPanel(m)}),[d,m]);var v=c.current.panels.indexOf(f);-1===v&&(v=c.current.panels.push(f)-1);var g=u.indexOf(m);-1===g&&(g=v);var x=g===l,b=t.useMemo((function(){return{selected:x}}),[x]),y={ref:h,id:f,role:"tabpanel","aria-labelledby":null==(i=s[g])||null==(i=i.current)?void 0:i.id,tabIndex:x?0:-1};return x||null!=(r=e.unmount)&&!r||null!=(o=e.static)&&o?Xd({ourProps:y,theirProps:e,slot:b,defaultTag:"div",features:Vp,visible:x,name:"Tabs.Panel"}):p.jsx(vc,ge({as:"span"},y))}))});function Bp(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e&&i.length>0&&(t=e.classList).add.apply(t,i)}function Wp(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e&&i.length>0&&(t=e.classList).remove.apply(t,i)}var Hp=function(e){return e.Ended="ended",e.Cancelled="cancelled",e}({});function Yp(){var e=t.useState(xc)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}var Gp=["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"],Up=["show","appear","unmount"];function Kp(e){return void 0===e&&(e=""),e.split(" ").filter((function(e){return e.trim().length>1}))}var Xp=t.createContext(null);Xp.displayName="TransitionContext";var Qp=function(e){return e.Visible="visible",e.Hidden="hidden",e}(Qp||{}),Zp=t.createContext(null);function Jp(e){return"children"in e?Jp(e.children):e.current.filter((function(e){return null!==e.el.current})).filter((function(e){return e.state===Qp.Visible})).length>0}function $p(e,n){var i=ic(e),r=t.useRef([]),o=Ic(),a=Yp(),l=rc((function(e,t){var n;void 0===t&&(t=Kd.Hidden);var l=r.current.findIndex((function(t){return t.el===e}));-1!==l&&(Wd(t,((n={})[Kd.Unmount]=function(){r.current.splice(l,1)},n[Kd.Hidden]=function(){r.current[l].state=Qp.Hidden},n)),a.microTask((function(){!Jp(r)&&o.current&&(null==i.current||i.current())})))})),s=rc((function(e){var t=r.current.find((function(t){return t.el===e}));return t?t.state!==Qp.Visible&&(t.state=Qp.Visible):r.current.push({el:e,state:Qp.Visible}),function(){return l(e,Kd.Unmount)}})),u=t.useRef([]),d=t.useRef(Promise.resolve()),c=t.useRef({enter:[],leave:[],idle:[]}),p=rc((function(e,t,i){u.current.splice(0),n&&(n.chains.current[t]=n.chains.current[t].filter((function(t){return t[0]!==e}))),null==n||n.chains.current[t].push([e,new Promise((function(e){u.current.push(e)}))]),null==n||n.chains.current[t].push([e,new Promise((function(e){Promise.all(c.current[t].map((function(e){return e[1]}))).then((function(){return e()}))}))]),"enter"===t?d.current=d.current.then((function(){return null==n?void 0:n.wait.current})).then((function(){return i(t)})):i(t)})),f=rc((function(e,t,n){Promise.all(c.current[t].splice(0).map((function(e){return e[1]}))).then((function(){var e;null==(e=u.current.shift())||e()})).then((function(){return n(t)}))}));return t.useMemo((function(){return{children:r,register:s,unregister:l,onStart:p,onStop:f,wait:d,chains:c}}),[s,l,r,p,f,c,d])}function ef(){}Zp.displayName="NestingContext";var tf=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function nf(e){for(var t={},n=0,i=tf;n<i.length;n++){var r,o=i[n];t[o]=null!=(r=e[o])?r:ef}return t}var rf=Ud.RenderStrategy,of=Jd((function(e,n){var i,r=e.beforeEnter,o=e.afterEnter,a=e.beforeLeave,l=e.afterLeave,s=e.enter,u=e.enterFrom,d=e.enterTo,c=e.entered,f=e.leave,m=e.leaveFrom,h=e.leaveTo,v=we(e,Gp),g=t.useRef(null),x=ac(g,n),b=v.unmount?Kd.Unmount:Kd.Hidden,y=function(){var e=t.useContext(Xp);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),w=y.show,C=y.appear,j=y.initial,F=t.useState(w?Qp.Visible:Qp.Hidden),S=F[0],k=F[1],A=function(){var e=t.useContext(Zp);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),T=A.register,_=A.unregister,I=t.useRef(null);t.useEffect((function(){return T(g)}),[T,g]),t.useEffect((function(){var e;if(b===Kd.Hidden&&g.current){if(!w||S===Qp.Visible)return Wd(S,((e={})[Qp.Hidden]=function(){return _(g)},e[Qp.Visible]=function(){return T(g)},e));k(Qp.Visible)}}),[S,g,T,_,w,b]);var D=ic({enter:Kp(s),enterFrom:Kp(u),enterTo:Kp(d),entered:Kp(c),leave:Kp(f),leaveFrom:Kp(m),leaveTo:Kp(h)}),O=function(e){var n=t.useRef(nf(e));return t.useEffect((function(){n.current=nf(e)}),[e]),n}({beforeEnter:r,afterEnter:o,beforeLeave:a,afterLeave:l}),E=dc();t.useEffect((function(){if(E&&S===Qp.Visible&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,S,E]);var L=j&&!C,N=E?L||I.current===w?"idle":w?"enter":"leave":"idle",M=rc((function(e){return Wd(e,{enter:function(){return O.current.beforeEnter()},leave:function(){return O.current.beforeLeave()},idle:function(){}})})),R=rc((function(e){return Wd(e,{enter:function(){return O.current.afterEnter()},leave:function(){return O.current.afterLeave()},idle:function(){}})})),P=$p((function(){k(Qp.Hidden),_(g)}),A);!function(e){var t=e.container,n=e.direction,i=e.classes,r=e.onStart,o=e.onStop,a=Ic(),l=Yp(),s=ic(n);nc((function(){var e=xc();l.add(e.dispose);var n=t.current;if(n&&"idle"!==s.current&&a.current)return e.dispose(),r.current(s.current),e.add(function(e,t,n,i){var r=n?"enter":"leave",o=xc(),a=void 0!==i?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(i):function(){};"enter"===r&&(e.removeAttribute("hidden"),e.style.display="");var l=Wd(r,{enter:function(){return t.enter},leave:function(){return t.leave}}),s=Wd(r,{enter:function(){return t.enterTo},leave:function(){return t.leaveTo}}),u=Wd(r,{enter:function(){return t.enterFrom},leave:function(){return t.leaveFrom}});return Wp.apply(void 0,[e].concat(t.enter,t.enterTo,t.enterFrom,t.leave,t.leaveFrom,t.leaveTo,t.entered)),Bp.apply(void 0,[e].concat(l,u)),o.nextFrame((function(){Wp.apply(void 0,[e].concat(u)),Bp.apply(void 0,[e].concat(s)),function(e,t){var n=xc();if(!e)return n.dispose;var i=getComputedStyle(e),r=[i.transitionDuration,i.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t}));if(0!==r[0]+r[1]){var o=[];o.push(n.addEventListener(e,"transitionrun",(function(i){i.target===i.currentTarget&&(o.splice(0).forEach((function(e){return e()})),o.push(n.addEventListener(e,"transitionend",(function(e){e.target===e.currentTarget&&(t(Hp.Ended),o.splice(0).forEach((function(e){return e()})))})),n.addEventListener(e,"transitioncancel",(function(e){e.target===e.currentTarget&&(t(Hp.Cancelled),o.splice(0).forEach((function(e){return e()})))}))))})))}else t(Hp.Ended);n.add((function(){return t(Hp.Cancelled)}))}(e,(function(n){return n===Hp.Ended&&(Wp.apply(void 0,[e].concat(l)),Bp.apply(void 0,[e].concat(t.entered))),a(n)}))})),o.dispose}(n,i.current,"enter"===s.current,(function(t){var n;e.dispose(),Wd(t,((n={})[Hp.Ended]=function(){o.current(s.current)},n[Hp.Cancelled]=function(){},n))}))),e.dispose}),[n])}({container:g,classes:D,direction:N,onStart:ic((function(e){P.onStart(g,e,M)})),onStop:ic((function(e){P.onStop(g,e,R),"leave"!==e||Jp(P)||(k(Qp.Hidden),_(g))}))}),t.useEffect((function(){L&&(I.current=b===Kd.Hidden?null:w)}),[w,L,S]);var z=v,V={ref:x};return p.jsx(Zp.Provider,{value:P,children:p.jsx(ep,{value:Wd(S,(i={},i[Qp.Visible]=Jc.Open,i[Qp.Hidden]=Jc.Closed,i)),children:Xd({ourProps:V,theirProps:z,defaultTag:"div",features:rf,visible:S===Qp.Visible,name:"Transition.Child"})})})})),af=Jd((function(e,n){var i=e.show,r=e.appear,o=void 0!==r&&r,a=e.unmount,l=we(e,Up),s=t.useRef(null),u=ac(s,n);dc();var d,c=$c();if(void 0===i&&null!==c&&(i=Wd(c,((d={})[Jc.Open]=!0,d[Jc.Closed]=!1,d))),![!0,!1].includes(i))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var f=t.useState(i?Qp.Visible:Qp.Hidden),m=f[0],h=f[1],v=$p((function(){h(Qp.Hidden)})),g=t.useState(!0),x=g[0],b=g[1],y=t.useRef([i]);nc((function(){!1!==x&&y.current[y.current.length-1]!==i&&(y.current.push(i),b(!1))}),[y,i]);var w=t.useMemo((function(){return{show:i,appear:o,initial:x}}),[i,o,x]);t.useEffect((function(){if(i)h(Qp.Visible);else if(Jp(v)){var e=s.current;if(!e)return;var t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&h(Qp.Hidden)}else h(Qp.Hidden)}),[i,v]);var C={unmount:a};return p.jsx(Zp.Provider,{value:v,children:p.jsx(Xp.Provider,{value:w,children:Xd({ourProps:ge({},C,{as:t.Fragment,children:p.jsx(of,ge({ref:u},C,l))}),theirProps:{},defaultTag:t.Fragment,features:rf,visible:m===Qp.Visible,name:"Transition"})})})})),lf=Object.assign(af,{Child:Jd((function(e,n){var i=null!==t.useContext(Xp),r=null!==$c();return p.jsx(p.Fragment,{children:p.jsx(!i&&r?af:of,ge({ref:n},e))})})),Root:af}),sf=function(e){var t,n,i,r,o,a,l,s;return Fl(ge({padding:null==e?void 0:e.padding,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:null==e?void 0:e.paddingY,paddingLeft:null!=(n=null==e?void 0:e.paddingLeft)?n:null==e?void 0:e.paddingX,paddingRight:null!=(i=null==e?void 0:e.paddingRight)?i:null==e?void 0:e.paddingX,paddingBottom:null!=(r=null==e?void 0:e.paddingBottom)?r:null==e?void 0:e.paddingY,marginTop:null!=(o=null==e?void 0:e.marginTop)?o:null==e?void 0:e.marginY,marginBottom:null!=(a=null==e?void 0:e.marginBottom)?a:null==e?void 0:e.marginY,marginRight:null!=(l=null==e?void 0:e.marginRight)?l:null==e?void 0:e.marginX,marginLeft:null!=(s=null==e?void 0:e.marginLeft)?s:null==e?void 0:e.marginX,margin:null==e?void 0:e.margin,position:null==e?void 0:e.position,overflowX:null==e?void 0:e.overflowX,overflowY:null==e?void 0:e.overflowY,width:null==e?void 0:e.width,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,height:null==e?void 0:e.height,overflow:null==e?void 0:e.overflow,flex:null==e?void 0:e.flex,flexGrow:null==e?void 0:e.flexGrow,maxWidth:null==e?void 0:e.maxWidth,maxHeight:null==e?void 0:e.maxHeight,minHeight:null==e?void 0:e.minHeight,minWidth:null==e?void 0:e.minWidth,overflowWrap:null!=e&&e.textWrap?"break-word":void 0,wordWrap:null!=e&&e.textWrap?"break-word":void 0,wordBreak:null!=e&&e.textWrap?"break-word":void 0,hyphens:null!=e&&e.hyphens&&null!=e&&e.textWrap?"auto":void 0,alignSelf:null==e?void 0:e.alignSelf,border:null==e?void 0:e.border,textAlign:null==e?void 0:e.textAlign,display:null==e?void 0:e.display,listStyle:null==e?void 0:e.listStyle,right:null==e?void 0:e.right,top:null==e?void 0:e.top,left:null==e?void 0:e.left,gridArea:null==e?void 0:e.area,bottom:null==e?void 0:e.bottom,lineHeight:null==e?void 0:e.lineHeight,whiteSpace:null!=e&&e.nowrap?"nowrap":void 0,borderTop:null==e?void 0:e.borderTop},function(e){var t={};return null!=e&&e.mdWidth&&(t=ge({},t,{"@media (max-width: 1366px)":{width:null==e?void 0:e.mdWidth}})),null!=e&&e.smWidth&&(t=ge({},t,{"@media (max-width: 920px)":{width:null==e?void 0:e.smWidth}})),t}(e)))},uf=function(e){var t,n,i,r,o,a=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=ge({padding:0,border:0,marginY:0,marginX:0},e)),p.jsx(a,{className:kd(""+sf(e),null==(i=e)?void 0:i.className),"data-component":null!=(r=e["data-component"])?r:"View","data-themeapi":e["data-themeapi"],"data-testid":e["data-testid"],role:e.role,id:e.id,children:null==(o=e)?void 0:o.children})},df=function(e){var n=e.width,i=void 0===n?170:n,r=t.useRef(null);function o(){null==e||e.onClose()}Id(r,(function(){return null==e?void 0:e.onClose()})),t.useEffect((function(){return window.addEventListener("scroll",o),function(){return window.removeEventListener("scroll",o)}}),[]),t.useEffect((function(){return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}}),[]);var a=Dd();return null!=e&&e.position?p.jsx(Bd,{force:!0,children:p.jsx(Uc,{children:p.jsx("div",{style:pf(i,null==e?void 0:e.position,null==e?void 0:e.align),"data-component":"popover-menu-container",ref:r,className:_d.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})})}):p.jsx("div",{className:_d.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})},cf=Object.assign(df,{Options:function(e){return p.jsx(Td,{rows:["auto"],gap:"0.5rem",children:p.jsx(uf,{paddingY:null!=e&&e.padding?"0.5rem":void 0,children:null==e?void 0:e.children})})},Option:function(e){var t=Dd();return p.jsx("li",{className:""+_d.option(null==t?void 0:t.popoverMenu)({clickable:(null==e?void 0:e.onChange)&&"true"}),"data-testid":null==e?void 0:e.testId,onClick:function(){return(null==e?void 0:e.onChange)&&(null==e?void 0:e.onChange())},role:(null==e?void 0:e.onChange)&&"button",children:null==e?void 0:e.children})},Container:df,DisplayWrapper:function(e){var t=e.width,n=void 0===t?160:t,i=Dd();return p.jsx("div",{className:""+_d.container(null==i?void 0:i.popoverMenu),style:{width:n},children:null==e?void 0:e.children})}});function pf(e,t,n){var i,r,o=null!=(i=null==t?void 0:t.left)?i:0,a=t||{},l=a.left,s=void 0===l?0:l,u=a.top,d=a.width,c=void 0===d?0:d,p=a.height,f=(void 0===u?0:u)+(void 0===p?0:p)+window.pageYOffset;return{position:"absolute",left:"right"===n?o+e>window.innerWidth?s-c:s:s<e?s-c:s-e+c,top:null!=(r=null==t?void 0:t.topOverride)?r:f,width:e}}function ff(){var e=t.useState(!1),i=e[0],r=e[1],o=t.useState(void 0),a=o[0],l=o[1],s=n.useRef(null);return{ref:s,show:i,position:a,close:function(){return r(!1)},open:function(){r(!i),s.current&&l(s.current.getBoundingClientRect())}}}var mf={convert:!1,stripUnknown:!0},hf=function(e,n,i){var r=t.useState(""),o=r[0],a=r[1],l=e.map((function(e){if(i&&"object"==typeof e&&null!==e&&"value"in e&&"string"==typeof e.value){var t=i(e.value);return t?ge({},e,{alias:t}):e}return e}));return""===o?{values:e.map((function(e,t){return{item:e,refIndex:t}})),searchString:o,setSearch:a}:{values:new x(l,{keys:[].concat(n,["alias"]),useExtendedSearch:!0}).search(o).map((function(e){return{item:e.item,refIndex:e.refIndex}})),setSearch:a,searchString:o}},vf={"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4},"&::-webkit-scrollbar-corner":{backgroundColor:"transparent"}},gf=Fl({width:"100%"}),xf=Object.assign((function(){return null}),{dropdown:function(e,t){return Fl({marginTop:8,width:null!=e?e:void 0,minWidth:null!=t?t:void 0,position:"absolute",top:"100%",zIndex:40,left:0,variants:{fixedHeight:{on:{maxHeight:328},withAction:{maxHeight:288}}}})},optionWrappper:function(e,t){return Fl(ge({fontSize:null==e?void 0:e.fontSize,position:"relative",top:"100%",left:0,overflow:"overlay",borderRadius:t||null==e?void 0:e.borderRadius,borderTopLeftRadius:t?null==e?void 0:e.borderRadius:void 0,borderTopRightRadius:t?null==e?void 0:e.borderRadius:void 0,background:null==e?void 0:e.background,color:null==e?void 0:e.color,boxShadow:null==e?void 0:e.boxShadow,border:null==e?void 0:e.border,variants:{fixedHeight:{on:{maxHeight:328},withAction:{maxHeight:288}}}},vf))},option:function(e){return Fl({position:"relative",width:"100%",cursor:"pointer",borderBottom:null==e?void 0:e.separatorBorder,"&:hover":null==e?void 0:e["&:hover"]})},button:function(e){return Fl({position:"relative",width:"100%",borderLeftWidth:2,borderColor:"transparent",padding:null==e?void 0:e.padding,display:"grid",gap:8,textAlign:"left",boxSizing:"border-box",alignItems:"center",variants:{selected:{on:ge({fontWeight:500,gridTemplateColumns:"1fr 24px"},null==e?void 0:e.selected),off:{gridTemplateColumns:"1fr"}}}})},selectedIcon:Fl({height:"1.25rem",width:"1.25rem"}),layout:gf,subtext:Fl({color:"inherit",opacity:.6,fontWeight:400}),action:function(e){return Fl({fontSize:null==e?void 0:e.fontSize,color:Sl(15),position:"relative",bottom:0,width:"100%",textAlign:"left",background:Sl(90),padding:"0.65rem 0.5rem",borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius,boxShadow:null==e?void 0:e.boxShadow,border:null==e?void 0:e.border,"&:hover":{background:Sl(95)},marginBottom:"0.5rem"})}}),bf=function(e){var t,n,i,r,o;return Fl({width:null!=(t=null==e?void 0:e.width)?t:"100%",maxWidth:null==e?void 0:e.maxWidth,minWidth:null==e?void 0:e.minWidth,height:null==e?void 0:e.height,display:"flex",alignItems:null==e?void 0:e.alignItems,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,padding:null==e?void 0:e.padding,paddingTop:null!=(n=null==e?void 0:e.paddingTop)?n:null==e?void 0:e.paddingY,paddingLeft:null!=(i=null==e?void 0:e.paddingLeft)?i:null==e?void 0:e.paddingX,paddingRight:null!=(r=null==e?void 0:e.paddingRight)?r:null==e?void 0:e.paddingX,paddingBottom:null!=(o=null==e?void 0:e.paddingBottom)?o:null==e?void 0:e.paddingY,margin:null==e?void 0:e.margin,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,flexWrap:null!=e&&e.wrap?"wrap":void 0,flex:null==e?void 0:e.flex,flexDirection:null==e?void 0:e.direction,justifyContent:null==e?void 0:e.justifyContent,cursor:null==e?void 0:e.cursor,overflow:null==e?void 0:e.overflow,border:null==e?void 0:e.border,minHeight:null==e?void 0:e.minHeight,position:null==e?void 0:e.position,flexGrow:null==e?void 0:e.grow,maxHeight:null==e?void 0:e.maxHeight,alignContent:null==e?void 0:e.alignContent,placeContent:null==e?void 0:e.placeContent,placeItems:null==e?void 0:e.placeItems,justifyItems:null==e?void 0:e.justifyItems,alignSelf:null==e?void 0:e.alignSelf,gridArea:null==e?void 0:e.gridArea,lineHeight:null==e?void 0:e.lineHeight})},yf=function(e){var t,n,i,r,o,a,l,s,u=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=ge({padding:0,border:0,margin:0},e)),p.jsx(u,{className:kd(""+bf(e),null==(i=e)?void 0:i.className),"data-component":null!=(r=null==(o=e)?void 0:o["data-component"])?r:"Flex",role:null==(a=e)?void 0:a.role,"aria-labelledby":null==(l=e)?void 0:l["aria-labelledby"],children:null==(s=e)?void 0:s.children})},wf=Fl({position:"relative",display:"flex",flex:1,flexDirection:"row"}),Cf=Fl({width:16,zIndex:999,top:0,bottom:0,left:-3,position:"absolute",alignSelf:"flex-start",cursor:"pointer"}),jf=Object.assign((function(){return null}),{itemWrapper:wf,item:function(e){var t;return Fl({width:"100%",borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,boxShadow:null==e?void 0:e.boxShadow,color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,boxSizing:"border-box",variants:{highlight:{on:{border:null==e?void 0:e.border,borderColor:"#3074d9"},off:{border:null==e?void 0:e.border}},componentPadding:(t={},t.true={padding:"0.5rem"},t),clickable:{on:{cursor:"pointer"}}}})},label:function(e){var t;return Fl(ge({},Zl.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"20px",padding:"2px 0",letterSpacing:"-0.05em"}))},metadata:function(e){var t;return Fl(ge({},Zl.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em",color:"inherit",opacity:.6}))},right:Fl({display:"flex",alignItems:"center"}),edit:Fl({marginRight:"0.75rem",display:"grid",placeContent:"center",color:"inherit",opacity:.5}),deleteWrapper:function(e){var t,n;return Fl({position:"absolute",top:"-0.75rem",right:"-0.55rem",height:21.5,width:21.5,background:null==e||null==(t=e.icon)?void 0:t.background,border:null==e||null==(n=e.icon)?void 0:n.border,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"})},deleteButton:function(e){var t,n;return Fl(ge({},Zl.button,{height:16,color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":{color:Ed(null==e||null==(n=e.icon)?void 0:n.color,1.5)}}))},iconSize:Fl({height:"1rem",width:"1rem"}),addWrapper:Fl(ge({position:"relative",width:"100%"},Cl)),title:function(e){return Fl(ge({padding:0},Cl,e))},titleContainer:function(){return Fl({variants:{hasBorder:{true:{borderBottom:"2px solid #e5e7eb"}}}})},dragHandleContainer:Cf}),Ff=Object.assign((function(){return null}),{item:Fl({opacity:.5}),string:Fl({fontSize:"0.55rem",transform:"scaleX(1.2)",marginLeft:1}),bool:Fl({fontSize:"0.65rem",fontWeight:"bold"}),icon:function(e,t){if("stopColor"!==t)return Fl("stroke"===t?{"& > *":{stroke:null!=e?e:Sl(5)}}:{"& > *":{fill:null!=e?e:Sl(5)}})}}),Sf=function(e){return p.jsxs(t.Fragment,{children:["variable"===(null==e?void 0:e.icon)&&p.jsx(y.VariableIcon,{width:"75%","aria-label":"Variable"}),"number"===(null==e?void 0:e.icon)&&p.jsx(y.HashtagIcon,{width:"75%","aria-label":"Number"}),"date_time"===(null==e?void 0:e.icon)&&p.jsx(y.CalendarIcon,{width:"75%","aria-label":"Date"}),"string"===(null==e?void 0:e.icon)&&p.jsx(uf,{as:"div",className:""+Ql.codeText,"data-component":"DataTypeIcon-string",children:p.jsxs(Td,{columns:["1fr","1fr"],className:""+Ql.codeText,children:[p.jsx("span",{className:""+Ql.bold,"aria-label":"String",children:"A"}),p.jsx("span",{className:kd(""+Ff.string({}),""+Ql.bold),children:"A"})]})}),"string[]"===(null==e?void 0:e.icon)&&p.jsx(uf,{as:"div",className:""+Ql.codeText,"data-component":"DataTypeIcon-string[]",children:p.jsxs(Td,{columns:["1fr","1fr"],children:[p.jsx("span",{className:""+Ql.bold,"aria-label":"String",children:"A"}),p.jsx("span",{className:kd(""+Ff.string({}),""+Ql.bold),children:"[]"})]})}),"boolean"===(null==e?void 0:e.icon)&&p.jsx(uf,{as:"div",className:kd(""+Ff.bool({}),""+kf),"data-component":"DataTypeIcon-boolean",children:p.jsxs(Td,{columns:["1fr","1fr","1fr"],height:"20px",children:[p.jsx(uf,{alignSelf:"start",children:"T"}),p.jsx(uf,{alignSelf:"center",marginLeft:-.5,children:"/"}),p.jsx(uf,{alignSelf:"end",children:"F"})]})})]})},kf=Fl({fontSize:11,lineHeight:1.3,fontFamily:Zl.codeFontFamily}),Af=function(e){var t,i,r,o;return p.jsx(uf,{width:24,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:"0.2rem",alignSelf:null==e?void 0:e.alignSelf,"data-component":"item-icon",marginLeft:null!=(i=e.marginLeft)?i:-2,children:p.jsxs(yf,{justifyContent:"center",alignItems:"center",className:""+Ff.item,paddingTop:null!=(r=null==e?void 0:e.flexPaddingTop)?r:"0.10rem",children:[(o=null==e?void 0:e.icon,n.isValidElement(o)&&p.jsx(Tf,{icon:null==e?void 0:e.icon,width:null==e?void 0:e.iconWidth,iconColorMap:e.iconColorMap})),p.jsx(Sf,{icon:null==e?void 0:e.icon})]})})},Tf=function(e){var n,i,r,o=t.useRef(null),a=Dd();return t.useEffect((function(){if("stopColor"===e.iconColorMap&&o.current){var t=o.current.querySelector("svg");t&&t.querySelectorAll("stop").forEach((function(e){var t;e.setAttribute("stop-color",null==a||null==(t=a.charts)?void 0:t.iconColor)}))}}),[e.iconColorMap,null==a||null==(n=a.charts)?void 0:n.iconColor]),p.jsx("div",{ref:o,"data-themeapi":"charts.iconColor",className:kd(""+Ff.icon(null==a||null==(i=a.charts)?void 0:i.iconColor,e.iconColorMap),es({width:null!=(r=null==e?void 0:e.width)?r:"75%"})),children:null==e?void 0:e.icon})},_f=Object.assign((function(e){var n,i,r=Dd();return p.jsx(t.Fragment,{children:(null==e?void 0:e.open)&&p.jsx("div",{className:""+xf.dropdown(null==e?void 0:e.width,null==e?void 0:e.minWidth)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:p.jsxs(uf,{position:"relative",children:[p.jsx("div",{className:""+xf.optionWrappper(null==r?void 0:r.dropdowns,!!e.onFreeTextSelected)({fixedHeight:e.onFreeTextSelected?"withAction":(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:p.jsx(uf,{role:"list","data-component":"dropdown-options",maxHeight:e.onFreeTextSelected?360:400,children:null==e?void 0:e.children})}),e.onFreeTextSelected&&p.jsx("button",{onClick:function(){return e.onFreeTextSelected&&e.onFreeTextSelected()},className:Ql.button+" "+xf.action(null==r?void 0:r.dropdowns),children:e.textOverride?e.textOverride("dropdown.free_text","Enter Custom Value..."):null!=(n=null==(i=e.freeTextOptions)?void 0:i.label)?n:"Enter Custom Value..."})]})})})}),{Option:function(e){var n=e.label,i=Dd();return p.jsx("div",{className:""+xf.option(null==i?void 0:i.dropdowns),role:"listitem","aria-selected":null==e?void 0:e.selected,"data-themeapi":"dropdown",children:p.jsxs("div",{tabIndex:-1,onClick:function(t){return e.onChange(t)},onKeyUp:function(){return e.onChange()},role:"button",className:""+xf.button(null==i?void 0:i.dropdowns)({selected:null!=e&&e.selected?"on":"off"}),"data-testid":null==e?void 0:e.testId,children:[null!=e&&e.render?e.render(e):p.jsx(t.Fragment,{children:null!=e&&e.subtext||null!=e&&e.icon?p.jsxs(yf,{direction:"row",gap:"0.5rem",children:[(null==e?void 0:e.icon)&&p.jsx(Af,{icon:null==e?void 0:e.icon,paddingTop:"0"}),p.jsxs(uf,{flexGrow:1,paddingTop:"0.1rem",children:[p.jsx(uf,{children:r.isFunction(n)?n():n}),(null==e?void 0:e.subtext)&&p.jsx(uf,{className:""+xf.subtext,children:null==e?void 0:e.subtext})]})]}):p.jsx("span",{children:r.isFunction(n)?n():n})}),(null==e?void 0:e.selected)&&p.jsx(yf,{alignItems:"center",justifyContent:"center",alignSelf:"start",children:p.jsx("div",{className:""+xf.selectedIcon,children:p.jsx(b.CheckIcon,{className:es({width:"20px",height:"20px"}),"aria-hidden":"true"})})})]})})},Empty:function(e){var t=e.label;return p.jsx("div",{className:es({color:"#6b7280",cursor:"pointer",width:"full",borderColor:"#f3f4f6",borderBottom:"1px",textAlign:"center",position:"relative",padding:"8px 0"}),children:t})},Title:function(e){var t,n=e.label,i=Dd();return p.jsx("div",{className:""+(t=null==i?void 0:i.dropdowns,Fl({padding:null==t?void 0:t.padding,paddingTop:0,paddingBottom:0,fontSize:"0.75rem",variants:{index:{true:{borderTop:"1px solid #dbdcdf",marginTop:"0.25rem"}}}}))({index:0!==e.index}),role:"listitem","data-component":"dropdown-title",children:p.jsx("p",{className:""+Fl({marginBottom:0,fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.05em"}),children:r.isFunction(n)?n():n})})}}),If=function(){for(var e="",t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return"v"+e+" "+n.flatMap((function(t){return t?["vizzly"+e+"_"+t]:[]})).join(" ")},Df=function(e,t,n){var i=[].concat(n).flatMap((function(e){if(r.isFunction(e)){var n=e();if(n)return[If(n)]}return r.isString(e)&&t[e]?[If(e)]:[]})).join(" ");return If(e)+" "+i},Of=m.keyframes({name:"19mmmx",styles:"0%,15%{transform:translate(0, 0);}50%{transform:translate(0, -5px);opacity:0.7;}85%,100%{transform:translate(0, 0);}"}),Ef=function(e){return p.jsx("div",{"data-testid":"loading-component-ball",className:es({height:"7px",width:"7px",borderRadius:"50%",background:e.color?e.color:"white",float:"left",margin:"0 3px",animation:Of+" 2s infinite ease-in-out",MozAnimation:Of+" 2s infinite ease-in-out",WebkitAnimation:Of+" 2s infinite ease-in-out","&:nth-of-type(1)":{zIndex:1},"&:nth-of-type(2)":{animationDelay:"0.25s",WebkitAnimationDelay:"0.25s"},"&:nth-of-type(3)":{animationDelay:"0.5s",WebkitAnimationDelay:"0.5s"}})})},Lf=Yu((function(e){var t=e.color,n=e.mAuto;return p.jsxs("div",{className:[If("loading"),es(ge({marginTop:"-8px",marginBottom:"-8px"},n&&{margin:"auto"}))].join(" "),children:[p.jsx(Ef,{color:t}),p.jsx(Ef,{color:t}),p.jsx(Ef,{color:t})]})}),"renderLoadingComponent"),Nf=function(e){var t;return p.jsx("div",{className:es({display:"grid",alignContent:"center",textAlign:"center"}),style:{width:"100%",height:"100%",minHeight:null!=(t=null==e?void 0:e.minHeight)?t:"200px"},"data-testid":"loading-component",children:e.override?e.override({}):p.jsx(Lf,{mAuto:!0,color:"#e5e5e5"})})},Mf=function(e){return p.jsx("div",{className:es({display:"grid",alignContent:"center",textAlign:"center"}),style:{width:"100%",height:"100%"},children:p.jsx(Lf,{mAuto:!0,color:e.color})})},Rf=function(e){var t;return p.jsx("button",{"data-testid":null==e?void 0:e.testId,onClick:function(t){t.stopPropagation(),null==e||e.onClear()},onKeyUp:function(t){t.stopPropagation(),null==e||e.onClear()},className:kd(null==e?void 0:e.className,""+Ql.button),"aria-label":null!=(t=null==e?void 0:e["aria-label"])?t:null!=e&&e.textOverride?null==e?void 0:e.textOverride("clear","Clear"):"Clear",children:p.jsx("div",{children:p.jsx("svg",{fill:null==e?void 0:e.fill,height:8,width:10,stroke:null==e?void 0:e.stroke,focusable:"false",viewBox:"0 0 12 12",className:""+Jl,children:p.jsx("path",{fillRule:"evenodd",d:"M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z"})})})})},Pf={width:"1.5rem",cursor:"pointer",paddingTop:1,outline:"2px solid transparent",outlineOffset:2},zf=Object.assign((function(e){return Fl({width:"100%",minWidth:null!=e?e:void 0})}),{inputComponent:function(e,t){var n,i;return Fl(ge({display:"flex",outline:"2px solid transparent",outlineOffset:2,textAlign:"left",lineHeight:1.25,borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,fontWeight:null==e?void 0:e.fontWeight,fontSize:null==e?void 0:e.fontSize,boxShadow:null==e?void 0:e.boxShadow},t?ge({},null==e?void 0:e["&:focus"]):((n={})["&:hover"]=null==e?void 0:e["&:hover"],n),{variants:{highlighted:{on:{outline:"2px solid transparent",outlineOffset:2}},subtle:{off:{border:t?null==e||null==(i=e["&:focus"])?void 0:i.border:null==e?void 0:e.border},on:{border:null==e?void 0:e.border,borderColor:"transparent",background:"transparent"}}}}))},clickableArea:function(e){return Fl({width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==e?void 0:e.padding,paddingRight:0,gridArea:"1 / 1 / 2 / 3",variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},multiple:function(e,t){return Fl({display:"inline-grid",gridArea:"1 / 1 / 2 / 3",padding:null==e?void 0:e.padding,paddingLeft:0,paddingRight:0,width:null!=t?t:void 0,variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},input:Fl({height:"100%",width:"100%",appearance:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:"transparent",padding:"0 0.5rem",color:"inherit",outline:"2px solid transparent",border:0,"&:disabled":{border:"none"},variants:{rightAligned:{on:{textAlign:"right"},off:{}}}}),loading:Fl({paddingLeft:"0.25rem",paddingRight:0,width:100,alignSelf:"center"}),clearContainer:Fl({display:"flex",width:32,alignItems:"center",paddingLeft:"0.5rem",paddingRight:"0.25rem"}),clearButton:function(e){return Fl(ge({},Pf,{color:null==e?void 0:e.indicatorColor}))},controlGrid:Fl({}),arrowContainer:function(e,t){return Fl({display:"flex",width:null!=t?t:32,alignItems:"center",justifyContent:"center",padding:0,margin:0,color:"rgb(209 213 219)",variants:{subtle:{off:{borderLeft:null==e?void 0:e.border}}}})}}),Vf=Fl({variants:{open:{up:{},off:{transform:"rotate(180deg)"},side:{transform:"rotate(90deg)"}}}}),qf=function(e){var t,n;return p.jsx("button",{onClick:null!=e&&e.onClick?function(t){t.stopPropagation(),t.preventDefault(),(null==e?void 0:e.onClick)&&(null==e||e.onClick())}:void 0,"aria-label":e.label,className:""+(n=null==e?void 0:e.styled,Fl(ge({},Zl.button,{height:"1.5rem",cursor:"pointer",color:null==n?void 0:n.indicatorColor,outline:"2px solid transparent",outlineOffset:2,"&:disabled":{border:"none"}}))),children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:kd(""+Vf({open:null==e||!e.expanded||null!=e&&e.disabled?null==e?void 0:e.arrowStart:"off"}),es({stroke:null!=(t=null==e?void 0:e.strokeColor)?t:"currentColor"}),""+Jl),children:p.jsx("polyline",{points:"18 15 12 9 6 15"})})})},Bf=function(e){var n,i,o,a,l,s,u,d,c,f=e.disabled,m=e.placeholder,h=e.onClear,v=e.isLoading,g=t.useRef(null),x=function(){null==e||e.setOpen(!0),null!==g.current&&g.current.focus()},b=r.isString(null==e?void 0:e.selectedValue)?null==e?void 0:e.selectedValue:void 0;t.useEffect((function(){null!=e&&e.open&&null!==g.current&&!v&&g.current.focus()}),[null==e?void 0:e.open]);var y=Dd(),w=null!=e&&e.open?null!=e&&e.textOverride?null==e?void 0:e.textOverride("close","Close"):"Close":null!=e&&e.textOverride?null==e?void 0:e.textOverride("open","Open"):"Open";return p.jsx("div",{className:""+zf(e.fixedWidth),"data-component":"control","aria-labelledby":null!=e&&e.multiple?null==e?void 0:e.id:void 0,onClick:function(){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick())},children:p.jsxs("div",{className:kd(e.classNameInputComponent,""+zf.inputComponent(null==y||null==(n=y.forms)?void 0:n.select,null==e?void 0:e.open)({highlighted:null!=e&&e.highlighted?"on":"off",subtle:null!=e&&e.subtle?"on":"off"})),"data-themeapi":"forms.select",children:[p.jsxs(yf,{flex:"1 1 auto",wrap:!0,"data-component":"control-flex",alignItems:null!=e&&e.multiple?"flex-start":void 0,rowGap:null!=e&&e.multiple?"0.25rem":void 0,minHeight:null!=e&&e.multiple&&!e.isFilter?33:void 0,direction:null!=e&&e.multiple?"row":void 0,children:[(null==e?void 0:e.multiple)&&p.jsx(t.Fragment,{children:null==e?void 0:e.children}),!(null!=e&&e.multiple)&&p.jsx(uf,{flex:1,"data-component":"control-view",children:p.jsxs(Td,{"data-component":"control-grid",className:kd(""+zf.controlGrid),minWidth:e.fixedWidth,children:[p.jsx(t.Fragment,{children:null!=e&&e.open?p.jsx(t.Fragment,{children:0===e.value.length&&b&&p.jsx("div",{className:kd(zf.clickableArea(null==y||null==(o=y.forms)?void 0:o.select)({small:null!=e&&e.sm?"on":"off",rightAligned:null!=e&&e.rightAligned?"on":"off"}),e.classNameInputControlGrid,es({lineHeight:"16px"})),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:b})}):p.jsx("div",{onClick:function(){return x()},onKeyUp:function(){return x()},"data-testid":e.testId,className:kd(""+zf.clickableArea(null==y||null==(i=y.forms)?void 0:i.select),null==e?void 0:e.className,es({lineHeight:"16px"})),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:null==e?void 0:e.children})}),!(null!=e&&e.multiple)&&(null==e?void 0:e.open)&&p.jsx("div",{className:kd(zf.multiple(null==y||null==(a=y.forms)?void 0:a.select,e.fixedWidth)({small:null!=e&&e.sm?"on":"off"}),e.classNameInputControl),"data-component":"control-multiple",children:p.jsx("input",{style:{lineHeight:"16px",height:"16px",minWidth:m?9*(null==m?void 0:m.length)+"px":void 0},id:null==e?void 0:e.id,value:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t.target.value)},onClick:function(){return(null==e?void 0:e.multiple)&&(null==e?void 0:e.setOpen(!(null!=e&&e.open)))},"aria-labelledby":null==e?void 0:e["aria-labelledby"],placeholder:null==e?void 0:e.placeholder,disabled:f,ref:g,className:zf.input({rightAligned:null!=e&&e.rightAligned?"on":"off"}),autoComplete:"off"})})]})})]}),v&&p.jsx("div",{className:""+zf.loading,children:p.jsx(Mf,{color:"#3074d9"})}),h&&(null==e?void 0:e.clearable)&&p.jsx("div",{className:""+zf.clearContainer,children:p.jsx(Rf,{onClear:function(){return h&&h()},className:""+zf.clearButton(null==y||null==(l=y.forms)?void 0:l.select),fill:null==y||null==(s=y.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==y||null==(u=y.forms)||null==(u=u.select)?void 0:u.indicatorColor,testId:e.testId?e.testId+"-clear":void 0,textOverride:e.textOverride})}),p.jsx("div",{className:zf.arrowContainer(null==y||null==(d=y.forms)?void 0:d.select)({subtle:null!=e&&e.subtle?"on":"off"}),children:p.jsx(qf,{label:w,arrowStart:"up",disabled:f,onClick:function(){return null==e?void 0:e.setOpen(!(null!=e&&e.open))},styled:null==y||null==(c=y.forms)?void 0:c.select,expanded:null==e?void 0:e.open})})]})})},Wf=Object.assign(Fl({display:"flex",position:"relative",alignItems:"start",flexDirection:"column",variants:{dynamicWidth:{true:{width:"100%"}}}})),Hf=function(e){var n=t.useState(!1),i=n[0],r=n[1];return t.useEffect((function(){var t;return e?t=setTimeout((function(){return r(!0)}),500):r(!1),function(){t&&clearTimeout(t)}}),[e]),i},Yf=Hu((function(e){var i,o,a,l,s=e.selected,u=e.options,d=e.setSelectOptionsAreOpen,c=e.isLoading,f=e.selectOptionsAreOpen,m=e.onClickWithDevToolCheck,h=e.activeDevToolHighlight,v=e.textOverride,g=e.formatLabel,x=Pu().featureToggles,b=null===e.selected?null:u[e.selected],y="boolean"==typeof(null==b?void 0:b.label)?et(null==b?void 0:b.label,(function(){return""})):b?b.label:e.placeholder||(v?v("select_empty","Select..."):"Select..."),w=(l=r.isFunction(y)?y():y,g?g(l):l),C=n.useRef(null);Id(C,(function(){return d(!1)}));var j,F=Object.keys(u[0]||{}),S=hf(u,F,g),k=S.values,A=S.setSearch,T=S.searchString,_=function(t){t!=s&&e.onChange(null===t?null:t),d(!1)},I=Hf(e.isLoading),D=(j=null!=e&&e.selectOptionsAreOpen?T:r.isFunction(y)?y():y,g?g(j):j),O=function(e){var t=null==(e=k.find((function(e){return e.refIndex===s})))?void 0:e.item.label;return r.isString(t)&&g?g(t):t}();return p.jsxs("div",ge({className:""+Wf({dynamicWidth:null!=(i=null==e?void 0:e.dynamicWidth)?i:x.forceMobile}),ref:C,"data-component":null==e?void 0:e["data-component"]},((o={})["data-componentoverride"]="renderSelectComponent",o),{children:[p.jsx(Bf,{onClick:null==e?void 0:e.onClick,value:D,onChange:function(e){return A(e)},open:f,setOpen:m((function(){d(!f),A("")})),onClear:function(){b&&e.canBeCleared&&_(null),b&&e.canBeCleared&&A("")},clearable:!(!b||!e.canBeCleared),subtle:null==e?void 0:e.subtle,selectedValue:O,highlighted:h,rightAligned:null==e?void 0:e.rightAligned,testId:null==e?void 0:e.testId,classNameInputComponent:null==e?void 0:e.classNameInputComponent,classNameInputControl:e.classNameInputControl,classNameInputControlGrid:e.classNameInputControlGrid,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e["aria-labelledby"],className:null==e?void 0:e.controlClassName,textOverride:e.textOverride,fixedWidth:e.fixedWidth,nullValueAlias:e.nullValueAlias,children:null!=e&&e.renderSelected?null==e?void 0:e.renderSelected(b):p.jsxs(t.Fragment,{children:[b&&e.selectedLabelPrefix,w]})}),p.jsxs(_f,{open:f,fixedHeight:!0,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?158:void 0,onFreeTextSelected:e.onFreeTextSelected,textOverride:e.textOverride,children:[c&&p.jsx(uf,{height:80,children:I&&p.jsx(Mf,{color:"#3074d9"})}),!c&&k.map((function(t,n){var i,o=(i=r.isFunction(t.item.label)?t.item.label():t.item.label,g?g(i):t.item.label);return t.item.title?p.jsx(_f.Title,{label:t.item.label,index:n},"option_"+t.refIndex+"_"+t.item.label):p.jsx(_f.Option,ge({onChange:function(){return _(t.refIndex)},label:o,subtext:t.item.subText,selected:t.refIndex==s,testId:t.item.testId?""+t.item.testId:null!=e&&e.testId?(null==e?void 0:e.testId)+"-"+n:void 0,icon:t.item.icon},e.renderOption&&{render:function(){return e.renderOption&&e.renderOption(t.item)}}),"option_"+t.refIndex+"_"+t.item.label)})),!c&&!I&&0===k.length&&p.jsx(uf,{padding:8,width:200,children:null!=(a=e.noOptionsMessage)?a:e.textOverride?e.textOverride("no_options","No Options"):"No Options"})]})]}))}),"renderSelectComponent",(function(e){return ge({},e,{setSelectOptionsAreOpen:(t=e.setSelectOptionsAreOpen,n=[s.boolean()],function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return n.forEach((function(e,t){var n=e.validate(i[t],mf);if(n.error)throw n.error;i[t]=n.value})),t.apply(void 0,i)})});var t,n})),Gf=function(e,t,n,i){return Fl(ge({},e,{margin:null!=n?n:null==e?void 0:e.margin,fontWeight:null!=i?i:null==e?void 0:e.fontWeight,display:t?"none":"block",padding:0,position:"relative",width:"100%"}))},Uf=Fl({color:"#7D7D7E"}),Kf=function(e){var t,n,i=null!=(t=null==e?void 0:e.as)?t:"label",r=Dd(),o={className:""+(e.classNameOverride?e.classNameOverride:Gf(null==r||null==(n=r.forms)?void 0:n.label,null==e?void 0:e.labelHidden,null==e?void 0:e.margin,null==e?void 0:e.fontWeight)),"data-themeapi":"forms.label","data-chipposition":"above.right",htmlFor:null==e?void 0:e.htmlFor,id:null==e?void 0:e.id};return e.tooltip?p.jsxs(yf,{gap:"0.25rem",children:[p.jsx(i,ge({},o,{children:null==e?void 0:e.children})),p.jsx(uf,{width:18,children:(null==e?void 0:e.tooltip.href)&&p.jsxs("a",{href:null==e?void 0:e.tooltip.href,target:"_blank",rel:"noopener noreferrer",children:[p.jsx("span",{className:""+Ql.srOnly,children:null==e?void 0:e.tooltip.label}),p.jsx(b.QuestionMarkCircleIcon,{className:kd("help-icon",""+Uf)})]})})]}):p.jsx(i,ge({},o,{children:null==e?void 0:e.children}))},Xf=function(e,t,n){return Fl(ge({},e,{boxSizing:"border-box"},t?{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}:{outline:"2px solid transparent",outlineOffset:-2},n&&(null==e?void 0:e.active),{position:"relative"}))},Qf=["labelHidden","onClear","textOverride"],Zf=["labelHidden","onClear","textOverride","error"],Jf=["sm","error"],$f=n.forwardRef((function(e,n){var i,r,o,a,l,s,u,d=Dd();return we(e,Qf),p.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&p.jsx(Kf,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),!e.onClear&&p.jsx(em,ge({ref:n},e,{className:kd(""+Xf(null!=(i=null==e?void 0:e.inputTheme)?i:null==d||null==(r=d.forms)?void 0:r.input,null==e?void 0:e.error),e.className)})),e.onClear&&p.jsxs(yf,{alignItems:"center",position:"relative","data-component":"input",children:[p.jsx(em,ge({ref:n},e,{className:kd(""+Xf(null!=(o=null==e?void 0:e.inputTheme)?o:null==d||null==(a=d.forms)?void 0:a.input,null==e?void 0:e.error),e.className)})),p.jsx(Rf,{onClear:function(){return e.onClear&&e.onClear()},className:zf.clearButton(null==d||null==(l=d.forms)?void 0:l.select)+" "+tm,fill:null==d||null==(s=d.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==d||null==(u=d.forms)||null==(u=u.select)?void 0:u.indicatorColor})]})]})})),em=n.forwardRef((function(e,t){var n=we(e,Zf);return p.jsx("input",ge({id:null==e?void 0:e.id,ref:t},n,{className:kd(es({textAlign:"left",appearance:"none",width:"100%",lineHeight:"1.25",transition:"all cubic-bezier(0.4, 0, 0.2, 1) 150ms"}),Df("input",e,Jf),e.className),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled}))})),tm=Fl({position:"absolute",right:6,display:"flex",alignItems:"center",justifyCntent:"center"}),nm=function(e){var n,i=r.isFunction(e.options)&&e.selected?[{value:e.selected,label:e.selected===_t?e.noValueLabel:e.selected}]:[],o=t.useState(r.isArray(e.options)?{loading:!1,options:e.options}:{loading:!1,options:i}),a=o[0],l=o[1],s=a.options,u=t.useState(void 0!==e.defaultOpen&&e.defaultOpen),d=u[0],c=u[1];t.useEffect((function(){var t=new AbortController;d&&function(){var n=me(Ce().mark((function n(){var i;return Ce().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!r.isFunction(e.options)){n.next=6;break}return l({loading:!0,options:[]}),n.next=4,e.options(t.signal);case 4:(i=n.sent)?l({loading:!1,options:i}):Je("[Vizzly] Failed to fetch async options for select.");case 6:return n.abrupt("return",(function(){t.abort("Select unmounted")}));case 7:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}()()}),[d]);var f=t.useState(!1),m=f[0],h=f[1];t.useEffect((function(){if(!a.loading&&e.hasFreeText&&Array.isArray(s)&&e.selected){var t=s.some((function(t){return t.value===e.selected}));h(!t)}}),[a.loading,e.hasFreeText,s,e.selected]),t.useEffect((function(){r.isArray(e.options)&&l({loading:!1,options:e.options})}),[e.options]);var v=s.findIndex((function(t){return r.isArray(t.value)||r.isObject(t.value)?JSON.stringify(t.value)==JSON.stringify(e.selected):t.value===e.selected}));return p.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&p.jsx(Kf,{labelHidden:null==e?void 0:e.labelHidden,id:m||null==e?void 0:e.id,htmlFor:m?e.id:void 0,tooltip:null==e?void 0:e.tooltip,children:null==e?void 0:e.label}),!m&&p.jsx(Yf,{"data-component":null==e?void 0:e["data-component"],testId:e.testId,dynamicWidth:e.dynamicWidth,onChange:function(t){null===t?e.onChange(null,null):e.onChange(a.options[t].value,t)},onClick:e.onClick,classNameInputControl:e.classNameInputControl,classNameInputComponent:e.classNameInputComponent,classNameInputControlGrid:e.classNameInputControlGrid,controlClassName:null==e?void 0:e.controlClassName,setSelectOptionsAreOpen:c,options:a.options,isLoading:null!=(n=null==e?void 0:e.loading)?n:a.loading,subtle:e.subtle,selected:-1===v?null:v,selectOptionsAreOpen:d,anchorOptionsLeft:e.anchorLeft,error:e.error,canBeCleared:e.showClearBtn,selectedLabelPrefix:e.selectedPrefix,placeholder:e.placeholder,rightAligned:null==e?void 0:e.rightAligned,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e.id,renderSelected:null==e?void 0:e.renderSelected,renderOption:null==e?void 0:e.renderOption,noOptionsMessage:e.noOptionsMessage,textOverride:e.textOverride,fixedWidth:e.fixedWidth,dropdownForFilter:e.dropdownForFilter,onFreeTextSelected:e.hasFreeText?function(){h(!0),e.onChange("",null)}:void 0,formatLabel:e.formatLabel}),m&&p.jsx($f,{type:"string",onChange:function(t){e.onChange(t.target.value,null)},id:null==e?void 0:e.id,autoFocus:!0,onClear:function(){var t;h(!1),e.onChange(null==a||null==(t=a.options[0])?void 0:t.value,null)},value:e.selected,textOverride:e.textOverride})]})},im=function(e){return p.jsx("div",{"data-component":"select-input",children:null==e?void 0:e.children})},rm=function(e){var t=e.placeholder,n=e.showClearBtn;return p.jsx(nm,{showClearBtn:void 0===n||n,options:e.options,onChange:e.setSelected,selected:e.currentValue,anchorLeft:e.anchorLeft,placeholder:t,selectedPrefix:t+" · ",maintainOptionOrder:e.maintainOptionOrder,testId:"select",textOverride:e.textOverride,label:t,labelHidden:!0,id:e.id,dropdownForFilter:!0,fixedWidth:e.labelWidth,formatLabel:e.formatLabel,noValueLabel:e.noValueLabel})},om=s.object({displayTitle:s.string().min(1).required(),colSpan:s.number().valid(12).required()}),am=s.number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),lm=s.object({isEmpty:s.valid(!0).required(),colSpan:am}),sm=function(e){return s.object({attributes:wu({queryEngineConfig:e}),colSpan:am})},um=function(e){return s.object({id:s.string(),display:dm(e),componentLibrary:s.array().required().items(s.object({attributes:wu({queryEngineConfig:e})})),globalFilters:si(e),customFields:s.object().required()})};function dm(e){return s.array().required().items(s.object({height:s.number().required(),components:s.array().required().min(1).items(s.alternatives(lm,sm(e),om))}))}var cm=function(e,t){var n=t?{queryEngineConfig:t}:void 0;if("string"==typeof e.definition)throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:!1,permission:e.permission,globalFilters:Dt(e.definition.globalFilters,n),componentLibrary:[].concat(e.definition.componentLibrary||[]).map((function(e){return xu(ge({},e,{colSpan:(null==e?void 0:e.colSpan)||1}),n)})),theme:ge({},el,e.theme),display:gu(e.definition.display,n),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}}},pm=function(e,t){return e.dataSets.findIndex((function(e){return e.id==t}))},fm=function(e,t){return Ko(e.dataSets,t)},mm=function(e,t){return pm(e,t)>=0},hm=function(e){var t=ge({},e),n={};e.dataSets.forEach((function(e){n[e.id]=ta(e)}));var i,r=null===t.parentDashboardId?t.componentLibrary:Tm(t),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})).map(Ot);return{isPlayground:e.isPlayground,globalFilters:o,componentLibrary:[].concat(r).map(bu),display:(i=e.display,i.map((function(e){return{components:[].concat(e.components).map(bu),height:e.height}}))),customFields:n}},vm=function(e){var t=r.cloneDeep(e);return delete t.id,delete t.parentDashboardId,delete t.webhookId,delete t.createdAt,delete t.updatedAt,delete t.isProgrammatic,delete t.theme,delete t.data,delete t.permission,delete t.protectedByOrganisation,delete t.isPlayground,t},gm=function(e){return ge({},e.dashboardInState,vm(e.dashboardToImport))},xm=function(e,t,n){return ge({},e,{dataSets:la(t,n)})},bm=function(e){return ge({isPlayground:!1,display:[{components:[su(8),su(4)],height:350},{components:[su(4),su(4),su(4)],height:350}],componentLibrary:[],globalFilters:[],customFields:{}},e)},ym=function(e){var t=[];return e.display.forEach((function(e){e.components.forEach((function(e){pu(e)||au(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),r.uniq(t).flatMap((function(t){var n=Ko(e.dataSets,t);return n?[n]:[]}))},wm=function(e){var t=ym(e),n=function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),r.uniq(t).flatMap((function(t){var n=Ko(e.dataSets,t);return n?[n]:[]}))}(e);return r.uniqBy([].concat(n,t),(function(e){return e.id}))},Cm=function(e,t){return[].concat(t).filter((function(t){return t.parentDashboardId==e}))},jm=function(e){return[].concat(e).filter((function(e){return null==e.parentDashboardId}))},Fm=function(e){if(0==e.length)throw"Cannot get first created dashboard from empty list of dashboards.";return[].concat(e).sort((function(e,t){var n=new Date(e.createdAt),i=new Date(t.createdAt);return n.getTime()-i.getTime()}))[0]},Sm=function(e){return[].concat(e).sort((function(e,t){var n=new Date(e.updatedAt);return new Date(t.updatedAt).getTime()-n.getTime()}))},km=function(e){return Sm(e)[0]||null},Am=function(e,t){return e.find((function(e){return e.id==t}))||null},Tm=function(e){return e.componentLibrary.filter((function(e){return!e.attributes.protectedByOrganisation}))};function _m(e,t,n){var i=t.find((function(e){return e.id===n}));return void 0===i?e:ge({},i,{id:e.id,createdAt:e.createdAt,updatedAt:new Date})}var Im=function(e,t){var n=new Map;return e.forEach((function(e){var t=e.attributes.viewId;n.set(null!=t?t:"",e)})),t.forEach((function(e){var t=e.attributes.viewId;n.has(null!=t?t:"")||n.set(null!=t?t:"",e)})),Array.from(n.values())},Dm=function(e){var t=e.filter((function(e){return e.isProgrammatic}));if(0!==t.length){if(t.length>1)throw new Error("There should only be one programmatic dashboard");return t[0].id}},Om={__proto__:null,indexOfDataSet:pm,getDataSet:fm,hasDataSet:mm,getComponentsUsingDataSet:function(e,t){return r.flatMap([].concat(e.display),(function(e){return r.flatMap(e.components,(function(e){return pu(e)||au(e)?[]:(null==e?void 0:e.attributes.dataSetId)==t?[e]:[]}))}))},toSaveableDefinition:hm,prepareDashboardForImport:vm,mergeDashboardInStateAndDashboardToImport:gm,setDataSets:xm,newSaveable:bm,takePlaygroundDashboards:function(e){return r.filter([].concat(e),(function(e){return e.isPlayground}))},takeLiveDashboards:function(e){return r.filter([].concat(e),(function(e){return!e.isPlayground}))},getDataSetsUsedOnDisplay:ym,getDataSetsUsedOnDashboard:wm,getCopiesOfParentDashboard:Cm,getParentDashboards:jm,getFirstCreated:Fm,orderByLastUpdated:Sm,takeMostRecentlyUpdated:km,find:Am,updateLibraryWithProtectedComponents:function(e){var t=new Map(e.map((function(e){return[e.id,e]})));return e.map((function(e){var n;if(null===e.parentDashboardId)return e;var i=null==(n=t.get(e.parentDashboardId))?void 0:n.componentLibrary,r=null==i?void 0:i.filter((function(e){return e.attributes.protectedByOrganisation}));return r?ge({},e,{componentLibrary:[].concat(Tm(e),r)}):e}))},resetToParentDashboard:_m,buildProgrammaticDashboard:function(e,t){var n=[];return e.map((function(e){var i;if(void 0===e.id)throw new Error("Dashboard id is undefined");var r=xm(e,t,e.customFields||{});n.push({id:r.id,dataSets:r.dataSets,display:null!=(i=r.display)?i:[],globalFilters:[],componentLibrary:r.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})})),n},VIZZLY_EDITOR_ID:"vizzly_editor",updateWithProgrammaticDashboard:function(e,t){var n=function(e,t){if(t.length>0&&"vizzly_editor"===t[0].id)return[].concat(e,[ge({},t[0],{parentDashboardId:e[0].id,isProgrammatic:!0,permission:e[0].permission})])}(e,t);if(n)return n;var i=new Map(t.map((function(e){return[e.id,e]})));return e.map((function(e){var t=i.get(e.id);if(null!==e.parentDashboardId){var n=i.get(e.parentDashboardId);if((null==n?void 0:n.id)===e.parentDashboardId)return ge({},e,{componentLibrary:Im(null==n?void 0:n.componentLibrary,e.componentLibrary)})}return null!=t?t:e}))},addUniqueLibraryComponents:Im,checkAndReturnProgrammaticDashboardId:Dm,colSpanSchema:am,saveableDashboardDefinitionSchema:um,displaySchema:dm,fromRaw:cm,Dashboard:void 0},Em=function(e,t){return null===e?null:r.reduce(t,(function(e,t){return function(e,t){var n=r.cloneDeep(e);return n.attributes=Go(e.attributes.type).removeField(e.attributes,t),n}(e,t.id)}),e)},Lm=[];function Nm(e){for(var t,n=[],i=ve(e);!(t=i()).done;){var r=t.value;n.push("dateTimeFilter"===r.type?ge({},r,{type:"dateFilter"}):"dateAndTimeFilter"===r.type?It(r):r)}return n}var Mm=function(e,t,n,i){var r=[].concat(e.dashboard.componentLibrary);return r[n]=ge({},t,{attributes:ge({},t.attributes,{protectedByOrganisation:!!i||void 0})}),ge({},e,{componentEditor:null,dashboard:ge({},e.dashboard,{componentLibrary:r})})},Rm=function(e,t,n,i){var r=du(e.dashboard.display,t,n,i);return ge({},e,{dashboard:ge({},e.dashboard,{display:r})})},Pm=function(e,t){var n=t.rowIndex,i=r.cloneDeep(e.dashboard.display);return i.length>1?(i.splice(n,1),ge({},e,{dashboard:ge({},e.dashboard,{display:i})})):e},zm=n.createContext(null),Vm=function(e){var i,o,a=e.dashboard,l=e.children,s=e.trackEvent,u=function(e){var t,i,o,a=Pu(),l=a.dashboardFilters,s=a.onDashboardFilterChange,u=a.filterLibrary,d=e.dashboard,c=d.dataSets.map((function(e){return e.id})),p=(i=null==(t=d.componentLibrary)?void 0:t.filter((function(e){return c.includes(e.attributes.dataSetId)})),(o=function(e,t){if(e){var n=e(t.map((function(e){return ru(e.attributes)}))),i={};return n.forEach((function(e){var t,n;i[null!=(t=null==e||null==(n=e.attributes)?void 0:n.viewId)?t:""]=!0})),i}return null}(u,i))&&(i=i.filter((function(e){var t;return o&&o[null!=(t=e.attributes.viewId)?t:""]}))),i);d.componentLibrary=p;var f,m=ge({pickFromComponentLibrary:null,componentEditor:null,inPreviewMode:!1},e,{dashboard:d}),h=(f={dashboardFilters:l,onDashboardFilterChange:s},function(e,t){var n=t.type;return[function(e){return function(e,t){var n,i,o,a=t.dashboardFilters,l=[].concat(e.dashboard.globalFilters).filter((function(e){return!e.managedByConfiguration})),s=(i=e.dashboard.dataSets,o={},i.forEach((function(e){e&&e.fields?e.fields.forEach((function(t){(t.dashboardRequiredFilterGroups||[]).forEach((function(n){var i=n.publicName+" - "+t.dataType;o[i]=[].concat(o[i]||[],[{publicName:n.publicName,dataSetField:t,dataSetId:e.id}])}))})):Je("DataSet is undefined or does not have fields",e)})),Object.values(o)).map((function(e){return{type:"date_time"==e[0].dataSetField.dataType?"dateFilter":"singleSelectFilter",managedByConfiguration:!0,requiresValue:!0,title:e[0].publicName,appliesToFields:e.map((function(e){return{dataSetId:e.dataSetId,fieldId:e.dataSetField.id}})),value:null}})),u=a(wm(e.dashboard),Lm).map((function(e){return ge({},e,{managedByConfiguration:!0})})),d=function(e,t){var n=new Set(t.flatMap((function(e){return e.fields.map((function(e){return e.id}))})));return t.forEach((function(e){e.fields.forEach((function(e){n.add(e.id)}))})),e.map((function(e){var t=Object.assign({},e);return t.appliesToFields=e.appliesToFields.filter((function(e){return n.has(e.fieldId)})),t}))}([].concat(Nm(s),Nm(u),Nm(l)),e.dashboard.dataSets).map((function(t){var n=Rt(e.dashboard.globalFilters,t);return ge({},t,{value:n?n.value:t.value||null})}));return r.some(n=d,(function(e,t){var i=[].concat(n);return i.splice(t,1),!!Rt(i,e)}))&&Ze("Identical global dashboard filters found. This will cause strange behaviour. Please make sure the global filters all apply to a unique set of `appliesToFields` values."),ge({},e,{dashboard:ge({},e.dashboard,{globalFilters:d})})}(e,f)},function(e){return function(e,t,n){return"setGlobalFilters"!=t.type&&"init"!=t.type||n.onDashboardFilterChange(e.dashboard.globalFilters),e}(e,t,f)}].reduce((function(e,t){return t(e)}),function(){switch(n){case"insertRow":return function(e,t){var n=function(e,t,n){void 0===n&&(n=350);var i=[].concat(e);return i.splice(t,0,{components:[{isEmpty:!0,colSpan:12}],height:n}),i}(e.dashboard.display,t.rowIndex);return ge({},e,{dashboard:ge({},e.dashboard,{display:n})})}(e,t);case"appendCell":return function(e,t){var n=function(e,t){for(var n,i=r.cloneDeep(e),o=[].concat(i[t].components),a=su(uu(o.length+1)),l=(o=[].concat(o,[a])).length-1,s=0;s<((n=o.length)>2&&n<5?3:2);s++){var u=lu(i,t,l,"left");o.length<5?o[s].colSpan=uu(o.length):o[u].colSpan=o[u].colSpan-1,i[t]={components:[].concat(o),height:i[t].height}}return i}(e.dashboard.display,t.rowIndex);return ge({},e,{dashboard:ge({},e.dashboard,{display:n})})}(e,t);case"addHeaderRow":return function(e,t){var n,i,r,o,a,l=(n=t.rowIndex,i=t.initialTitle,r=[].concat(e.dashboard.display),o=ou(i),a=cu([o],52),r.splice(n,0,a),r);return ge({},e,{dashboard:ge({},e.dashboard,{display:l})})}(e,t);case"setHeaderComponent":return function(e,t){var n=t.component,i=t.rowIndex,o=t.cellIndex,a=r.cloneDeep(e);return a.dashboard.display[i].components[o]=n,a}(e,t);case"removeCell":return function(e,t){var n=t.rowIndex,i=t.cellIndex,o=r.cloneDeep(e.dashboard.display),a=o[n].components[i];return o[n].components.length>1?(o[n].components.splice(i,1),o[n].components[0].colSpan=o[n].components[0].colSpan+a.colSpan,ge({},e,{dashboard:ge({},e.dashboard,{display:o})})):Pm(e,ge({},t,{type:"removeRow"}))}(e,t);case"removeRow":return Pm(e,t);case"clearCell":return function(e,t){var n=t.rowIndex,i=t.cellIndex,o=r.cloneDeep(e.dashboard.display);return o[n].components[i]=su(o[n].components[i].colSpan),ge({},e,{dashboard:ge({},e.dashboard,{display:o})})}(e,t);case"addDataSet":return function(e,t){var n=t.dataSet,i=[].concat(e.dashboard.dataSets);return i.push(n),ge({},e,{dashboard:ge({},e.dashboard,{dataSets:i})})}(e,t);case"removeDataSet":return function(e,t){var n=t.dataSetId;if(!mm(e.dashboard,n))return e;var i=pm(e.dashboard,n),r=[].concat(e.dashboard.dataSets);return r.splice(i,1),ge({},e,{dashboard:ge({},e.dashboard,{dataSets:r})})}(e,t);case"setDataSets":return function(e,t){var n,i,o,a=t.dataSets,l=function(e,t){return[].concat(t).flatMap((function(t){var n,i,r,o=Ko(e,t.id);return null==o?[]:(n=o,i=[].concat(t.fields).map((function(e){return e.id})),r=[],[].concat(n.fields).forEach((function(e){i.includes(e.id)||(r=[].concat(r,[e]))})),r)}))}([].concat(e.dashboard.dataSets),a),s=r.reduce(l,(function(e,t){return function(e,t){var n=r.cloneDeep(e);return n.map((function(e){var n=e.components.map((function(e){return"isEmpty"in e||au(e)||(e.attributes=Go(e.attributes.type).removeField(e.attributes,t)),e}));return ge({},e,{components:n})})),n}(e,t.id)}),e.dashboard.display);return ge({},e,{componentEditor:(n=e.componentEditor,i=l,o=(null==n?void 0:n.component)||null,o=Em(o,i),n?ge({},n,{component:o}):null),dashboard:ge({},e.dashboard,{componentLibrary:[].concat(e.dashboard.componentLibrary).map((function(e){return Em(e,l)})),dataSets:[].concat(a),display:s})})}(e,t);case"startPickingComponentFromLibraryForDisplay":return function(e,t){return ge({},e,{pickFromComponentLibrary:{cellIndex:t.cellIndex,rowIndex:t.rowIndex}})}(e,t);case"startEditingComponent":return function(e,t){return ge({},e,{componentEditor:{target:{libraryIndex:t.libraryIndex,displayTarget:t.displayTarget},component:t.component||null}})}(e,t);case"saveComponent":return function(e,t){var n;if(!e.componentEditor)throw"Cannnot save a component when the editor is not active.";if(null==(n=e.componentEditor)||!n.component||!e.componentEditor.component.attributes)throw"Component must be set for it to be saved.";var i=ge({},e);return null!=e.componentEditor.target.libraryIndex&&(i=Mm(e,e.componentEditor.component,e.componentEditor.target.libraryIndex,t.protectedComponent)),e.componentEditor.target.displayTarget&&!e.componentEditor.target.libraryIndex&&(i=Rm(i,e.componentEditor.component,e.componentEditor.target.displayTarget.rowIndex,e.componentEditor.target.displayTarget.cellIndex)),ge({},i,{componentEditor:null,pickFromComponentLibrary:e.pickFromComponentLibrary})}(e,t);case"addCustomComponent":return function(e,t){var n=ge({},e);return null!=t.target.libraryIndex&&(n=Mm(e,t.component,t.target.libraryIndex)),t.target.displayTarget&&!t.target.libraryIndex&&(n=Rm(n,t.component,t.target.displayTarget.rowIndex,t.target.displayTarget.cellIndex)),ge({},n,{componentEditor:null})}(e,t);case"clearModal":return function(e,t){return ge({},e,{pickFromComponentLibrary:null,componentEditor:null})}(e);case"updateEditorComponent":return function(e,t){return e.componentEditor?ge({},e,{componentEditor:ge({},e.componentEditor,{component:t.component})}):ge({},e)}(e,t);case"setResultsForComponentInDisplay":return function(e,t){var n=t.rowIndex,i=t.cellIndex,r=e.dashboard.display[n].components[i];if(!r)throw"We can only set results on an existing component on the dashboard.";var o=ge({},r,{results:t.results});return ge({},Rm(e,o,n,i))}(e,t);case"setResultsForComponentInLibrary":return function(e,t){var n=t.libraryIndex,i=t.results,r=[].concat(e.dashboard.componentLibrary);return r[n]=ge({},r[n],{results:i}),ge({},e,{dashboard:ge({},e.dashboard,{componentLibrary:r})})}(e,t);case"setResultsForComponentInEditor":return function(e,t){if(!e.componentEditor)throw"Cannot set results for a closed editor.";if(!e.componentEditor.component)throw"Cannot set results for a non-existant component in editor.";return ge({},e,{componentEditor:ge({},e.componentEditor,{component:ge({},e.componentEditor.component,{results:t.results})})})}(e,t);case"pickComponentFromLibraryForDisplay":return function(e,t){var n=ge({},e.dashboard.componentLibrary[t.libraryIndex]);if(!n)throw"Cannot set a non-existant library component for display";if(!e.pickFromComponentLibrary)throw"Component library not open, so cannot set library component on display";var i=e.pickFromComponentLibrary;return ge({},Rm(e,n,i.rowIndex,i.cellIndex),{pickFromComponentLibrary:null})}(e,t);case"setDashboard":return function(e,t){return ge({},e,{dashboard:t.dashboard})}(e,t);case"importDashboard":return function(e,t){return ge({},e,{dashboard:gm({dashboardToImport:t.dashboardToImport,dashboardInState:e.dashboard})})}(e,t);case"setTheme":return function(e,t){return ge({},e,{dashboard:ge({},e.dashboard,{theme:t.theme})})}(e,t);case"setGlobalFilters":return function(e,t){return ge({},e,{dashboard:ge({},e.dashboard,{globalFilters:t.globalFilters})})}(e,t);case"setColSpans":return function(e,t){var n=r.cloneDeep(e.dashboard.display),i=r.cloneDeep(e.dashboard.display)[t.rowIndex];return i.components.map((function(e,n){e.colSpan=t.colSpans[n].colSpan})),n[t.rowIndex]=i,ge({},e,{dashboard:ge({},e.dashboard,{display:n})})}(e,t);case"setRowHeight":return function(e,t){var n=r.cloneDeep(e.dashboard.display),i=r.cloneDeep(e.dashboard.display)[t.rowIndex];return i.height=t.height,n[t.rowIndex]=i,ge({},e,{dashboard:ge({},e.dashboard,{display:n})})}(e,t);case"changePreviewMode":return function(e,t){return ge({},e,{inPreviewMode:t.inPreviewMode})}(e,t);case"updateDisplayComponentAttributes":return function(e,t){var n=t.rowIndex,i=t.cellIndex,r=ge({},e.dashboard.display[n].components[i],{attributes:ge({},t.attributes)});return Rm(e,r,n,i)}(e,t);case"updateComponentLibraryAttributes":return function(e,t){var n=t.libraryIndex,i=t.attributes,r=[].concat(e.dashboard.componentLibrary);return r[n]=ge({},r[n],{attributes:i}),ge({},e,{dashboard:ge({},e.dashboard,{componentLibrary:r})})}(e,t);case"removeComponentFromLibrary":return function(e,t){var n=t.libraryIndex,i=[].concat(e.dashboard.componentLibrary);return i.splice(n,1),ge({},e,{dashboard:ge({},e.dashboard,{componentLibrary:i})})}(e,t);case"setComponentReports":return function(e,t){var n=t.rowIndex,i=t.cellIndex,r=e.dashboard.display[n].components[i];if(!r)throw"We can only set local filters on an existing component on the dashboard.";var o=ge({},r,{reports:t.reports});return ge({},Rm(e,o,n,i))}(e,t);case"swapComponents":return function(e,t){Ke("swapComponents",t);var n,i,r,o,a,l=(r=t.positionB,o=ge({},(n=e.dashboard.display)[(i=t.positionA).rowIndex].components[i.cellIndex]),a=ge({},n[r.rowIndex].components[r.cellIndex]),n=du(n,o,r.rowIndex,r.cellIndex),n=du(n,a,i.rowIndex,i.cellIndex));return ge({},e,{dashboard:ge({},e.dashboard,{display:l})})}(e,t);case"setAttributes":return function(e,t){var n=t.rowIndex,i=t.cellIndex,r=e.dashboard.display[n].components[i];if(!r)throw"We can only set attributes on an existing component on the dashboard.";var o=ge({},r,{attributes:t.attributes});return ge({},Rm(e,o,n,i))}(e,t);case"addComponentToLibrary":return function(e,t){var n=[].concat(e.dashboard.componentLibrary),i=yu(t.component,t.protectedComponent);return n.push(i),ge({},e,{componentEditor:null,dashboard:ge({},e.dashboard,{componentLibrary:n})})}(e,t);case"setLocalFilters":return function(e,t){var n=t.localFilters,i=t.rowIndex,r=t.cellIndex,o=t.libraryIndex,a=ge({},e);if(void 0!==i&&void 0!==r){var l=e.dashboard.display[i].components[r];if(!l)throw"We can only set local filters on an existing component on the dashboard.";var s=ge({},l,{localFilters:n});a=Rm(e,s,i,r)}if(void 0!==o){var u=e.dashboard.componentLibrary[o];if(!u)throw"We can only set local filters on an existing component on the library.";var d=ge({},u,{localFilters:n});a=Mm(e,d,o)}return ge({},a)}(e,t);case"startEditor":return function(e,t){return ge({},e,{componentEditor:{target:{libraryIndex:t.libraryIndex,displayTarget:{rowIndex:0,cellIndex:0}},component:t.component||null}})}(e,t);case"moveRow":return function(e,t){var n=t.position;return ge({},e,{dashboard:ge({},e.dashboard,{display:mu(e.dashboard.display,n.movingIndex,n.destinationIndex)})})}(e,t);case"setActiveModal":return function(e,t){var n,i;return ge({},e,void 0===t.payload.attributes?{activeModal:ge({},e.activeModal,(i={},i[t.payload.modal]=void 0,i))}:{activeModal:ge({},e.activeModal,(n={},n[t.payload.modal]=t.payload,n))})}(e,t);case"setGeneratingPDF":return function(e,t){return ge({},e,{generatingPDF:t.payload})}(e,t);case"init":return e}}())});return n.useReducer(h,m,(function(e){return h(e,{type:"init"})}))}({componentEditor:e.componentEditor||null,dashboard:a?Bm(a,e.theme):a}),d=u[0],c=u[1];return t.useEffect((function(){(null==e?void 0:e.onDashboardUpdate)&&(null==e||e.onDashboardUpdate(d.dashboard))}),[JSON.stringify(d.dashboard)]),p.jsx(zm.Provider,{value:ge({},d,{dispatch:c,trackEvent:s||function(){},activeModal:d.activeModal,generatingPDF:d.generatingPDF,saving:e.saving,runQueriesCallback:(o=me(Ce().mark((function t(n,i,r){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!d.dashboard){t.next=2;break}return t.abrupt("return",e.runQueriesCallback(n,{abortSignal:i,dataSets:d.dashboard.dataSets,filterConfig:r}));case 2:return t.abrupt("return",null);case 3:case"end":return t.stop()}}),t)}))),function(e,t,n){return o.apply(this,arguments)})}),children:p.jsx(zd,{theme:null==e?void 0:e.theme,storedTheme:null==d||null==(i=d.dashboard)?void 0:i.theme,children:l})})},qm=function(){return n.useContext(zm)},Bm=function(e,t){var n,i,r,o,a,l,s,u,d,c,p,f;return ge({},e,{theme:{detail:null!=(n=null==t?void 0:t.detail)?n:null==e||null==(i=e.theme)?void 0:i.detail,rowLimit:null!=(r=null==t?void 0:t.rowLimit)?r:null==e||null==(o=e.theme)?void 0:o.rowLimit,fontFamily:null!=(a=null==t||null==(l=t.baseFont)?void 0:l.fontFamily)?a:null==e||null==(s=e.theme)?void 0:s.fontFamily,fontSize:null!=(u=null==t||null==(d=t.baseFont)?void 0:d.fontSize)?u:null==e||null==(c=e.theme)?void 0:c.fontSize,colors:null!=(p=null==t?void 0:t.colors)?p:null==e||null==(f=e.theme)?void 0:f.colors}})},Wm=function(){var e=me(Ce().mark((function e(t,n,i,r){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n(t,i,r);case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,n,i,r){return e.apply(this,arguments)}}(),Hm=function(e,t,n){return function(){var i=me(Ce().mark((function i(o){var a,l;return Ce().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,Wm(e,t,o);case 3:if(a=i.sent){i.next=6;break}throw new Error("Failed to fetch filter options.");case 6:return l=a.flatMap((function(e){return e?e.content.map((function(e){return e[0]})):[]})),i.abrupt("return",r.uniq(l).map((function(t){var i=et(t,(function(){throw"Async options should not be formatting a date time field."}));return i&&ul(i,n,{filter:e})&&(i=""+ul(i,n,{filter:e})),null===t&&(t=_t),{label:i,value:t}})));case 10:return i.prev=10,i.t0=i.catch(0),i.t0 instanceof Error?console.error(i.t0.message):console.error(i.t0),i.abrupt("return",[]);case 14:case"end":return i.stop()}}),i,null,[[0,10]])})));return function(e){return i.apply(this,arguments)}}()},Ym=function(e,t,n){var i=document.createElement("div"),r=document.createElement(t);r.textContent=e,null!=n&&n.fontSize&&(r.style.fontSize="number"==typeof n.fontSize?n.fontSize+"px":""+n.fontSize),null!=n&&n.fontWeight&&(r.style.fontWeight=""+n.fontWeight),i.appendChild(r),i.style.display="inline-block",i.style.visibility="hidden",document.body.appendChild(i);var o=r.offsetWidth;return document.body.removeChild(i),o};function Gm(e,t){var n=Ym(e,"span",{fontSize:null==t?void 0:t.fontSize,fontWeight:null==t?void 0:t.fontWeight});return(n>100?n:100)+24}var Um=function(e){var n,i,r,o,a=qm().runQueriesCallback,l=Pu(),s=l.cascadeFilterSelection,u=l.textOverride,d=l.valueAlias,c=l.nullValueAlias,f=e.filter,m=e.filterIndex,h=e.dataSets,v=e.onChange,g=t.useState(null),x=g[0],b=g[1],y=Dd(),w=t.useRef(void 0),C=function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.filter.options){t.next=2;break}return t.abrupt("return",e.filter.options);case 2:return t.next=4,Hm(Wt(f),a,d)(n);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=me(Ce().mark((function e(){var t,n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!f.requiresValue||null!==f.value){e.next=6;break}return t=new AbortController,e.next=4,C(t.signal);case 4:(n=e.sent)&&n[0]?(Ke("Filter forcing initial value to be set."),b(n),v(ge({},f,{value:n[0].value}))):Ze("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(f)]),t.useEffect((function(){s&&null!==w.current&&JSON.stringify(w.current)!==JSON.stringify(f.optionsFilters)&&b(null),w.current=f.optionsFilters}),[f.optionsFilters]);var j=Gm(Nt(f,h,u),null==y||null==(n=y.forms)?void 0:n.select);if(e.filter.hidden)return null;var F=function(){if(d){var e,t;if("string"==typeof f.value&&ul(f.value,d,{filter:f}))return null!=(e=ul(f.value,d,{filter:f}))?e:f.value;if("number"==typeof f.value&&ul(f.value.toString(),d,{filter:f}))return null!=(t=ul(f.value.toString(),d,{filter:f}))?t:f.value}return f.value}();return p.jsx(rm,{showClearBtn:e.showClearBtn,anchorLeft:!0,placeholder:Nt(f,h,u),options:x||C,currentValue:F,setSelected:function(t){e.onChange(ge({},f,{value:t}))},textOverride:u,id:qe(null!=(i=e.filter.title)?i:"")+"_"+e.filter.type,labelWidth:j,formatLabel:function(e){var t;return null!=(t=ul(e,d,{filter:f}))?t:e},noValueLabel:c?c({dataSetId:null==(r=f.appliesToFields)?void 0:r[0].dataSetId,fieldId:null==(o=f.appliesToFields)?void 0:o[0].fieldId})||void 0:"No value"},"filter-"+m)},Km=Object.assign((function(){return null}),{input:{border:"none",borderStyle:"none",borderWidth:"initial",borderColor:"initial",borderImage:"initial",backgroundColor:"transparent",boxShadow:"unset",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit",color:"inherit",padding:"0",margin:"0",boxSizing:"border-box",outline:"none",appearance:"none",textAlign:"left",backgroundImage:"none",backgroundPosition:"unset",backgroundRepeat:"no-repeat",backgroundSize:"auto"}}),Xm=Fl({position:"relative",display:"flex",height:"100%"}),Qm=Fl({display:"flex",width:"100%",height:"100%",alignItems:"center"}),Zm=Fl({width:18,display:"flex",verticalAlign:"middle",color:"rgb(72, 72, 72)",alignSelf:"center",justifyContent:"center"}),Jm=Object.assign((function(){return null}),{picker:Fl(ge({},Km.input,{appearance:"searchfield"})),prefixStyle:function(e){var t,n,i;return Fl({alignSelf:"center",paddingTop:0,paddingBottom:0,paddingRight:0,paddingLeft:"0.5rem",background:null==e||null==(t=e.input)?void 0:t.background,borderRadius:null==e||null==(n=e.input)?void 0:n.borderRadius,borderTopRightRadius:0,borderBottomRightRadius:0,color:null==e||null==(i=e.input)?void 0:i.color,whiteSpace:"nowrap",flex:1})},inputsWrapper:function(e,t){var n,i,r,o,a,l,s,u,d,c,p,f;return Fl(ge({position:"relative",border:null==e||null==(n=e.input)?void 0:n.border,boxShadow:null==e||null==(i=e.input)?void 0:i.boxShadow,borderRadius:null==e||null==(r=e.input)?void 0:r.borderRadius,fontSize:null==e||null==(o=e.input)?void 0:o.fontSize,background:null==e||null==(a=e.input)?void 0:a.background,padding:"0 0 1px 0",cursor:"default","&:hover":{border:null==e||null==(l=e.input)||null==(l=l["&:hover"])?void 0:l.border,background:null==e||null==(s=e.input)||null==(s=s["&:hover"])?void 0:s.background,boxShadow:null==e||null==(u=e.input)||null==(u=u["&:hover"])?void 0:u.boxShadow},"&:focus":{border:null==e||null==(d=e.input)||null==(d=d["&:focus"])?void 0:d.border,background:null==e||null==(c=e.input)||null==(c=c["&:focus"])?void 0:c.background,boxShadow:null==e||null==(p=e.input)||null==(p=p["&:focus"])?void 0:p.boxShadow}},t&&(null==e||null==(f=e.input)?void 0:f.active)))},inputs:Qm,separator:Zm,dateInput:function(e){var t,n,i,r,o,a;return Fl({width:null==e||null==(t=e.date)?void 0:t.width,background:null==e||null==(n=e.input)?void 0:n.background,padding:null==e||null==(i=e.input)?void 0:i.padding,cursor:"default",borderRadius:null==e||null==(r=e.input)?void 0:r.borderRadius,color:null==e||null==(o=e.input)?void 0:o.color,border:0,fontWeight:null==e||null==(a=e.input)?void 0:a.fontWeight,"&:focus":{outline:0}})},timeInput:function(e){var t;return Fl({width:null==e||null==(t=e.time)?void 0:t.width,paddingLeft:0,paddingRight:0})},clearContainer:function(){return Fl({width:18,alignSelf:"center"})},wrapper:Xm,separatorIcon:function(e){return Fl({verticalAlign:"middle",display:"block",fill:null==e?void 0:e.indicatorColor,height:18,width:18})},clearButton:function(e){return Fl(ge({},Pf,{fill:null==e?void 0:e.indicatorColor}))}}),$m=function(e){var t,n=Dd();return p.jsx("div",{style:{display:"inline-block"},children:p.jsx("input",{type:"text",name:null==e?void 0:e.name,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:""+Jm.dateInput(null==n||null==(t=n.forms)?void 0:t.dateTime),onChange:function(t){return null==e?void 0:e.onChange(t.currentTarget.value)}})})},eh=function(e){var n,i=t.useState(null==e||null==(n=e.value)?void 0:n.format(null==e?void 0:e.timeFormat)),r=i[0],o=i[1],a=t.useRef(null);t.useEffect((function(){e.shouldClear&&a.current&&(o(void 0),a.current.value="")}),[e.shouldClear]),t.useEffect((function(){var t;return o(null==e||null==(t=e.value)?void 0:t.format(null==e?void 0:e.timeFormat))}),[null==e?void 0:e.value]);var l=t.useState(!1),s=l[0],u=l[1],d=t.useRef(null),c=function(e){for(var t=[],n=0;n<1440;n+=15){var i=Math.floor(n/60),r=n%60,o=("0"+i).slice(-2)+":"+("0"+r).slice(-2),a=w().hour(i).minute(r).second(0);t.push({label:o,value:a})}return t}();return Id(d,(function(){u(!1)})),t.useEffect((function(){if(r){var t=th(r,null==e?void 0:e.timeFormat);t&&(null==e||e.onChange(t),u(!1))}}),[r]),p.jsxs("div",{ref:d,children:[p.jsx("div",{style:{position:"relative"},children:p.jsx("input",{ref:a,type:"text",name:null==e?void 0:e.name,value:r,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:null==e?void 0:e.className,onChange:function(e){o(e.currentTarget.value)},onClick:function(t){return function(t){u(!s),(null==e?void 0:e.onClick)&&(null==e||e.onClick(t))}(t)}})}),p.jsx("div",{style:{maxWidth:80},children:p.jsx(_f,{open:s,fixedHeight:!0,width:"calc(100% - 2px)",children:c.map((function(t,n){return p.jsx(_f.Option,{label:t.label,onChange:function(n){var i;null==n||n.stopPropagation(),o((i=t.value).format(null==e?void 0:e.timeFormat)),null==e||e.onChange(i),u(!1)}},n)}))})})]},null==e?void 0:e.name)},th=function(e,t){var n=w(e,"HH:mm:ss",!0),i=w(e,"HH:mm",!0),r=w(e,"hh:mm:ss A",!0);return i.isValid()||n.isValid()||r.isValid()?w(e,t):null},nh=function(e){return Fl(ge({maxHeight:"100%"},e,{variants:{hasFooter:{true:{},false:{borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius}},hasHeader:{true:{},false:{borderTopLeftRadius:null==e?void 0:e.borderRadius,borderTopRightRadius:null==e?void 0:e.borderRadius}}}}))},ih=Fl(ge({overflow:"overlay"},vf)),rh=function(e,t){return Fl(ge({fontWeight:null==e?void 0:e.fontWeight,fontSize:null==e?void 0:e.fontSize,padding:null==e?void 0:e.padding,background:null==e?void 0:e.background},t,{variants:{scrollable:{true:ge({background:null==e?void 0:e.alternativeBackground,paddingBottom:"0.75rem"},{"@media (max-height: 768px)":{height:420},"@media (min-height: 768px)":{height:600}})}}}))},oh=function(e){return Fl(ge({},e,{variants:{buttons:{end:{display:"grid",justifyContent:"end"}}}}))},ah=function(){var e,t=Dd();return p.jsx("div",{"aria-hidden":"true",role:"presentation",className:""+Jm.separator,children:p.jsx("svg",{focusable:"false",viewBox:"0 0 1000 1000",className:""+Jm.separatorIcon(null==t||null==(e=t.forms)?void 0:e.dateTime),"data-themeapi":"forms.dateTime.indicatorColor",children:p.jsx("path",{d:"M694 242l249 250c12 11 12 21 1 32L694 773c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210-210H68c-13 0-23-10-23-23s10-23 23-23h806L662 275c-21-22 11-54 32-33z"})})})},lh=Object.assign((function(){return null}),{popover:function(e){var t=e.minWidth,n=e.borderRadius,i=e.boxShadow,r=e.color,o=e.fontFamily,a=e.fontSize,l=e.fontWeight,s=e.letterSpacing,u=e.lineHeight,d=e.padding;return Fl(ge({zIndex:99999999999,background:e.background||Sl(0),borderRadius:n||4,color:r||"rgb(255, 255, 255)",fontSize:a||"0.75rem",fontWeight:l||500,letterSpacing:s||"0.1em",lineHeight:u||"1rem",padding:d||"6px 8px",boxShadow:i||"unset",fontFamily:o||"inherit"},{minWidth:t}))}}),sh=Object.assign((function(e){var n,i,r,o=Dd(),a=t.useState(null!=(n=null==e?void 0:e.showTooltip)&&n),l=a[0],s=a[1],u=t.useState(null),d=u[0],c=u[1],f=t.useState(null),m=f[1],h=C.usePopper(d,f[0],{placement:null!=(i=null==e?void 0:e.placement)?i:"bottom-start",modifiers:null!=(r=null==e?void 0:e.modifiers)?r:[]}),v=h.styles,g=h.attributes;return p.jsxs("div",{className:kd((null==e?void 0:e.className)&&""+(null==e?void 0:e.className)),children:[p.jsx("span",{ref:c,onMouseEnter:function(){return s(!0)},onMouseLeave:function(){return s(!1)},className:kd((null==e?void 0:e.classNameTrigger)&&""+(null==e?void 0:e.classNameTrigger)),children:e.children}),l&&p.jsx("div",ge({ref:m,"data-themeapi":"tooltips",className:""+lh.popover(ge({minWidth:null==e?void 0:e.tooltipMinWidth},null==o?void 0:o.tooltips)),style:ge({},v.popper,{visibility:l?"visible":"hidden"})},g.popper,{children:e.tooltipContent()}))]})}),{Content:function(e){var t;return p.jsx("div",{children:null!=(t=e.text)?t:null==e?void 0:e.children})}}),uh=function(e){var t,n,i,r,o,a=Dd(),l=e.textOverride,s=l?l("remove_pill","Remove [[label]]",{label:e.label}):"Remove "+(null==e?void 0:e.label);return p.jsxs("div",{className:es({background:null==a||null==(t=a.chips)?void 0:t.background,borderRadius:null==a||null==(n=a.chips)?void 0:n.borderRadius,color:null==a||null==(i=a.chips)?void 0:i.color,fontSize:null==a||null==(r=a.chips)?void 0:r.fontSize,fontWeight:null==a||null==(o=a.chips)?void 0:o.fontWeight,display:"flex",alignItems:"center",justifyContent:"center",padding:"0.125rem 0.5rem",height:"18px",minWidth:"max-content"}),children:[p.jsx("div",{className:es({maxWidth:"100%",flex:"0 1 auto",lineHeight:1}),children:e.label}),p.jsx("div",{className:es({display:"flex",flex:"1 1 auto",flexDirection:"row-reverse"}),children:p.jsxs("button",{onClick:function(t){t.preventDefault(),e.onRemove()},className:""+Ql.button,children:[p.jsx("span",{className:""+Ql.srOnly,children:s}),!(null!=e&&e.disableClear)&&p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:kd(""+Jl,es({cursor:"pointer",opacity:.7,width:"1rem",height:"1rem",marginLeft:"0.5rem",borderRadius:9999,"&:hover":{opacity:1}})),"aria-label":s,children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})})]})},dh=Object.assign((function(e){return p.jsx(yf,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,wrap:!0,minWidth:e.minWidth,padding:e.padding,"data-component":"selected-chips",children:e.children})}),{More:function(e){var n=e.pills,i=e.textOverride,r=e.numberOfPills;return p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:n.map((function(e,i){return 0===i?null:p.jsxs(t.Fragment,{children:[e,n.length!==i+1&&", "]},i)}))})},children:p.jsx(uh,{label:i?i("more_pill","[[numberOfPills]] more",{numberOfPills:null!=r?r:n.length-1}):(null!=r?r:n.length-1)+" more",disableClear:!0,onRemove:function(){},textOverride:i})})},Selected:uh}),ch=function(e){var n,i,r,o,a,l,s,u,d=Dd(),c=function(t){return null==t?void 0:t.format(e.timeFormat)},f=es({color:null==d||null==(n=d.forms)||null==(n=n.dateTime)||null==(n=n.input)?void 0:n.color,fontWeight:null==d||null==(i=d.forms)||null==(i=i.dateTime)||null==(i=i.input)?void 0:i.fontWeight,padding:null==d||null==(r=d.forms)||null==(r=r.dateTime)||null==(r=r.input)?void 0:r.padding,paddingLeft:0}),m=function(t){return t?t.format(e.dateFormat):void 0},h=e.pickerOpen||!e.datesDefined;return p.jsx(t.Fragment,{children:p.jsxs("div",{className:""+Jm.inputs,children:[e.prefix&&p.jsxs("div",{className:kd(""+Jm.prefixStyle(null==d||null==(o=d.forms)?void 0:o.dateTime),es({paddingRight:"0.5rem"})),children:[null!=(a=e.label)?a:"Custom"," ",!h&&"·"]}),!h&&p.jsxs(yf,{alignItems:"center",children:[e.state.fixed&&p.jsxs(t.Fragment,{children:[p.jsx("div",{className:f,children:m(e.startDate)}),"date_time"===e.type&&p.jsx("div",{"data-component":"time.start",className:f,children:c(e.time.start)}),p.jsx("div",{className:f,children:p.jsx(ah,{})}),p.jsx("div",{className:f,children:m(e.endDate)}),"date_time"===e.type&&p.jsx("div",{"data-component":"time.end",className:f,children:c(e.time.end)})]}),e.state.relative&&p.jsx(ph,{relative:e.state.relative,textOverride:e.textOverride}),p.jsx("div",{className:""+Jm.clearContainer(),children:p.jsx(Rf,{onClear:e.onClearAll,className:""+Jm.clearButton(null==d||null==(l=d.forms)?void 0:l.dateTime),"aria-label":e.textOverride?e.textOverride("clear_date","Clear Dates"):"Clear Dates",fill:null==d||null==(s=d.forms)||null==(s=s.select)?void 0:s.indicatorColor,stroke:null==d||null==(u=d.forms)||null==(u=u.select)?void 0:u.indicatorColor})})]})]})})},ph=function(e){var t,n,i=e.relative,r=e.textOverride,o=(n=[],null==i||null==(t=i[0])||t.forEach((function(e){var t=e.value;if(null!==t.unit&&null!==t.timeFrame){var i,o=yt(r)[t.unit].description,a=wt(r)[t.timeFrame].description,l=e.op+" "+(r&&r("date_picker.relative_date","[[value]] [[duration]] in [[timeframe]]",{value:null!=(i=t.value)?i:"",duration:o,timeframe:a}));n.push(l)}})),n);return p.jsxs(dh,{padding:"0 0.30rem 0 0",children:[o.map((function(e,t){return t>0?null:p.jsx(dh.Selected,{label:e,disableClear:!0,onRemove:function(){},textOverride:r},JSON.stringify(e))})),o.length>1&&p.jsx(dh.More,{pills:o,textOverride:r})]})},fh=function(e){var n,i,r,o,a,l,s,u,d,c,f,h,v,g,x,b,y,C,F,S,k,A,T,_,I,D,O,E,L,N,M,R,P,z,V,q,B,W,H,Y,G,U,K,X,Q,Z,J,$,ee=Dd(),te=t.useState("startDate"),ne=te[0],ie=te[1];return p.jsx("div",{className:kd(""+(o=null==ee||null==(n=ee.forms)?void 0:n.dateTime,m.css(".DateRangePickerInput{display:grid;background:",null==o||null==(a=o.input)?void 0:a.background,";border-radius:",null==o||null==(l=o.input)?void 0:l.borderRadius,"px;grid-template-columns:minmax(76px, auto) 18px minmax(76px, auto) 24px;}.DateInput:first-of-type{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;}.DateInput:first-of-type>input{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;padding-left:0.25rem;padding-right:0;}.DateInput_input{color:",null==o||null==(s=o.input)?void 0:s.color,";font-weight:",null==o||null==(u=o.input)?void 0:u.fontWeight,";background:",null==o||null==(d=o.input)?void 0:d.background,";outline:2px solid transparent;line-height:initial;&:hover:{border:",null==o||null==(c=o.input)||null==(c=c["&:hover"])?void 0:c.border,";background:",null==o||null==(f=o.input)||null==(f=f["&:hover"])?void 0:f.background,";}}.DateInput_input__focused input{border:",null==o||null==(h=o.input)||null==(h=h["&:focus"])?void 0:h.border,";background:",null==o||null==(v=o.input)||null==(v=v["&:focus"])?void 0:v.background,";}.DateInput:last-of-type>input{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;padding-left:0.25rem;padding-right:0;}.DateInput{margin:0;padding:0;background:",null==o||null==(g=o.input)?void 0:g.background,";position:relative;display:grid;min-width:76px;align-content:center;padding-bottom:1px;}.DateRangePickerInput_clearDates{border:0;color:inherit;font:inherit;line-height:normal;cursor:pointer;padding:5px;margin:2.5px;background-color:transparent;}.DateInput_input+.DateInput_input{margin-left:8px;}.DateInput_input__focused{outline-offset:0px;}.DateRangePickerInput__withBorder{border:none;border-bottom:2px solid black;border-radius:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__bottomRight::after{border-right-color:white;}.DayPickerKeyboardShortcuts_show__topRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__topRight::after{border-right-color:white;}.PresetDateRangePicker_panel{padding:0 22px 11px;}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;}.PresetDateRangePicker_button:active{outline:0;}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699;}.SingleDatePickerInput{display:inline-block;background-color:#fff;}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.SingleDatePickerInput__rtl{direction:rtl;}.SingleDatePickerInput__disabled{background-color:#f2f2f2;}.SingleDatePickerInput__block{display:block;}.SingleDatePickerInput__showClearDate{padding-right:30px;}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%;}.SingleDatePickerInput_clearDate__small{padding:6px;}.SingleDatePickerInput_clearDate__hide{visibility:hidden;}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle;}.SingleDatePickerInput_clearDate_svg__small{height:9px;}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.SingleDatePicker{position:relative;display:inline-block;}.SingleDatePicker__block{display:block;}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute;}.SingleDatePicker_picker__rtl{direction:rtl;}.SingleDatePicker_picker__directionLeft{left:0;}.SingleDatePicker_picker__directionRight{right:0;}.SingleDatePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff;}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px;}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0;}.DayPickerKeyboardShortcuts_show{width:33px;height:26px;position:absolute;z-index:2;}.DayPickerKeyboardShortcuts_show::before{content:'';display:block;position:absolute;}.DayPickerKeyboardShortcuts_show__bottomRight{bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topRight{top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight::before{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topLeft{top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft::before{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft:hover::before{border-left:33px solid #008489;}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute;}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:5px;}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px;text-align:left;}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0;}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px;}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2;}.DayPickerKeyboardShortcuts_close:active{outline:0;}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a;}.CalendarDay{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center;}.CalendarDay:active{outline:0;}.CalendarDay__defaultCursor{cursor:default;}.CalendarDay__default{background:",null==o||null==(x=o.calendar)||null==(x=x.unselected)?void 0:x.background,";border:",null==o||null==(b=o.calendar)||null==(b=b.unselected)?void 0:b.border,";color:",null==o||null==(y=o.calendar)||null==(y=y.unselected)?void 0:y.color,";}.CalendarDay__default:hover{background:",null==o||null==(C=o.calendar)||null==(C=C.unselected)||null==(C=C["&:hover"])?void 0:C.background,";border:",null==o||null==(F=o.calendar)||null==(F=F.unselected)?void 0:F.border,";color:",null==o||null==(S=o.calendar)||null==(S=S.unselected)||null==(S=S["&:hover"])?void 0:S.color,";}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit;}.CalendarDay__outside{border:0;background:#fff;color:#484848;}.CalendarDay__outside:hover{border:0;}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd;}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd;}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848;}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:",null==o||null==(k=o.calendar)||null==(k=k.selected)?void 0:k.background,";opacity:0.8;color:",null==o||null==(A=o.calendar)||null==(A=A.selected)?void 0:A.color,";}.CalendarDay__selected_span{background:",null==o||null==(T=o.calendar)||null==(T=T.selected)?void 0:T.background,";opacity:0.8;border:1px double ",null==o||null==(_=o.calendar)||null==(_=_.selected)?void 0:_.background,";color:",null==o||null==(I=o.calendar)||null==(I=I.selected)?void 0:I.color,";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:",null==o||null==(D=o.calendar)||null==(D=D.selected)?void 0:D.background,";opacity:0.7;border:1px double ",null==o||null==(O=o.calendar)||null==(O=O.selected)?void 0:O.background,";color:",null==o||null==(E=o.calendar)||null==(E=E.selected)?void 0:E.color,";border-radius:0;}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:",null==o||null==(L=o.calendar)||null==(L=L.selected)?void 0:L.background,";border:1px double ",null==o||null==(N=o.calendar)||null==(N=N.selected)?void 0:N.background,";color:",null==o||null==(M=o.calendar)||null==(M=M.selected)?void 0:M.color,";}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:",null==o||null==(R=o.calendar)||null==(R=R.selected)?void 0:R.background,";border:1px double ",null==o||null==(P=o.calendar)||null==(P=P.selected)?void 0:P.background,";opacity:0.8;color:",null==o||null==(z=o.calendar)||null==(z=z.selected)?void 0:z.color,";}.CalendarDay__hovered_span:active{background:",null==o||null==(V=o.calendar)||null==(V=V.selected)?void 0:V.background,";border:1px double ",null==o||null==(q=o.calendar)||null==(q=q.selected)?void 0:q.background,";color:",null==o||null==(B=o.calendar)||null==(B=B.selected)?void 0:B.color,";}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a;}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd;}.CalendarDay__hovered_start_first_possible_end{background:#eceeee;border:1px double #eceeee;}.CalendarDay__hovered_start_blocked_min_nights{background:#eceeee;border:1px double #e4e7e7;}.CalendarMonth{color:inherit;background:transparent;text-align:center;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.CalendarMonth_table{border-collapse:collapse;border-spacing:0;}.CalendarMonth_verticalSpacing{border-collapse:separate;}.CalendarMonth_caption{color:",null==o||null==(W=o.calendar)||null==(W=W.title)?void 0:W.color,";font-size:",($=null==o||null==(H=o.calendar)||null==(H=H.title)?void 0:H.fontSize)+("number"==typeof $?"px":""),";text-align:center;padding-top:22px;padding-bottom:48px;caption-side:initial;}.CalendarMonth_caption>strong{font-weight:",null==o||null==(Y=o.calendar)||null==(Y=Y.title)?void 0:Y.fontWeight,";}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px;}.CalendarMonthGrid{background:transparent;text-align:left;z-index:0;}.CalendarMonthGrid__animating{z-index:1;}.CalendarMonthGrid__horizontal{position:absolute;left:0;}.CalendarMonthGrid__vertical,.CalendarMonthGrid__vertical_scrollable{margin:0 auto;}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%;}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none;}.CalendarMonthGrid_month__hidden{visibility:hidden;}.DayPickerNavigation{position:relative;z-index:2;}.DayPickerNavigation__horizontal{height:0;}.DayPickerNavigation__verticalScrollable_prevNav{z-index:1;}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0;}.DayPickerNavigation__verticalScrollableDefault{position:relative;}.DayPickerNavigation__bottom{height:auto;}.DayPickerNavigation__bottomDefault{-webkit-box-pack:justify;-ms-flex-pack:justify;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;padding:0;margin:0;}.DayPickerNavigation_button__default{border:",null==o||null==(G=o.calendar)||null==(G=G.arrows)?void 0:G.border,";background-color:",null==o||null==(U=o.calendar)||null==(U=U.arrows)?void 0:U.background,";color:",null==o||null==(K=o.calendar)||null==(K=K.arrows)?void 0:K.border,";}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:",null==o||null==(X=o.calendar)||null==(X=X.arrows)||null==(X=X["&:hover"])?void 0:X.border,";background-color:",null==o||null==(Q=o.calendar)||null==(Q=Q.arrows)||null==(Q=Q["&:hover"])?void 0:Q.background,";}.DayPickerNavigation_button__default:active{background:#f2f2f2;}.DayPickerNavigation_button__disabled{cursor:default;border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:focus,.DayPickerNavigation_button__disabled:hover{border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:active{background:0 0;}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:0.78;border-radius:",null==o||null==(Z=o.calendar)||null==(Z=Z.arrows)?void 0:Z.borderRadius,";padding:6px 9px;}.DayPickerNavigation_bottomButton__horizontalDefault{position:static;margin:-10px 22px 30px;}.DayPickerNavigation_leftButton__horizontalDefault{left:13px;}.DayPickerNavigation_rightButton__horizontalDefault{right:31px;}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0, 0, 0, 0.1);position:relative;display:inline-block;text-align:center;height:100%;width:50%;}.DayPickerNavigation_nextButton__verticalDefault{border-left:0;}.DayPickerNavigation_nextButton__verticalScrollableDefault,.DayPickerNavigation_prevButton__verticalScrollableDefault{width:100%;}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:",null==o||null==(J=o.calendar)||null==(J=J.arrows)?void 0:J.fill,";display:block;}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;}.DayPickerNavigation_svg__disabled{fill:#f2f2f2;}.DayPicker{position:relative;text-align:left;}.DayPicker__verticalScrollable{height:100%;}.DayPicker__hidden{visibility:hidden;}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0, 0, 0, 0.05),0 0 0 1px rgba(0, 0, 0, 0.07);border-radius:3px;}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%;}.DayPicker_portal__vertical{position:initial;}.DayPicker_focusRegion{outline:0;}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top;}.DayPicker_weekHeaders{position:relative;}.DayPicker_weekHeaders__horizontal{margin-left:9px;}.DayPicker_weekHeader{color:inherit;position:absolute;top:62px;z-index:2;text-align:left;}.DayPicker_weekHeader__vertical{left:50%;}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center;}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px;}.DayPicker_weekHeader_li{display:inline-block;text-align:center;}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px;}.DayPicker_transitionContainer__horizontal{-webkit-transition:height 0.2s ease-in-out;-moz-transition:height 0.2s ease-in-out;transition:height 0.2s ease-in-out;}.DayPicker_transitionContainer__vertical{width:100%;}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll;}.DateInput__block{width:100%;}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb;}.DateInput_input{width:100%;}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:0.2px;padding:7px 7px 5px;}.DateInput_input__regular{font-weight:auto;}.DateInput_input__readOnly{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.DateInput_input__disabled{background:#f2f2f2;font-style:italic;}.DateInput_screenReaderMessage{border:0;clip:rect(0, 0, 0, 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2;}.DateInput_fangShape{fill:#fff;}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent;}.DateRangePickerInput__disabled{background:#f2f2f2;}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.DateRangePickerInput__rtl{direction:rtl;}.DateRangePickerInput__block{display:block;}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848;align-self:center;}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:18px;width:18px;}.DateRangePickerInput_clearDates__small{padding:6px;}.DateRangePickerInput_clearDates__hide{cursor:inherit;&:hover{background:unset;}}.DateRangePickerInput_clearDates_svg{fill:rgb(75 85 99);stroke:rgb(75 85 99);height:8px;width:8px;vertical-align:middle;}.DateRangePickerInput_clearDates_svg__small{height:9px;}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.DateRangePicker{position:relative;display:grid;align-content:center;}.DateRangePicker__block{display:block;}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute;}.DateRangePicker_picker__rtl{direction:rtl;}.DateRangePicker_picker__directionLeft{left:0;}.DateRangePicker_picker__directionRight{right:0;}.DateRangePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.DateRangePicker_picker__fullScreenPortal{background-color:#fff;}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}","")),es({height:"100%",position:"relative"})),"data-themeapi":"forms.dateTime.calendar","data-chipposition":"above.right",children:p.jsx(j.DayPickerRangeController,{initialVisibleMonth:function(){return w()},startDate:null==(i=e.dates)?void 0:i.start,endDate:null==(r=e.dates)?void 0:r.end,onDatesChange:e.onDatesChange,focusedInput:ne,onFocusChange:function(e){ie(e||"startDate")},numberOfMonths:2,displayFormat:"YYYY/MM/DD",hideKeyboardShortcutsPanel:!0,minimumNights:0,noBorder:!0,isOutsideRange:function(){return!1},renderMonthElement:function(e){var t,n,i,r,o=e.month,a=e.onYearSelect;return p.jsxs("span",{children:[p.jsx("span",{"data-themeapi":"forms.dateTime.calendar.title","data-chipposition":"above.right",className:es({position:"relative",color:(null==ee||null==(t=ee.forms)||null==(t=t.dateTime)||null==(t=t.calendar)||null==(t=t.title)?void 0:t.color)||Sl(10),fontFamily:(null==ee||null==(n=ee.forms)||null==(n=n.dateTime)||null==(n=n.calendar)||null==(n=n.title)?void 0:n.fontFamily)||"inherit",fontWeight:(null==ee||null==(i=ee.forms)||null==(i=i.dateTime)||null==(i=i.calendar)||null==(i=i.title)?void 0:i.fontWeight)||"bold",lineHeight:(null==ee||null==(r=ee.forms)||null==(r=r.dateTime)||null==(r=r.calendar)||null==(r=r.title)?void 0:r.lineHeight)||"1.15"}),children:o.format("MMMM")}),p.jsx("select",{value:o.year(),onChange:function(e){return a(o,e.target.value)},className:""+Jm.picker,"data-testid":"year-select",children:Array.from({length:25},(function(e,t){return w().year()-t})).map((function(e){return p.jsx("option",{value:e,children:e},"year-"+e)}))})]})}})})},mh=function(e,t){if(!t)throw new Error("time is null or undefined");var n=w(e),i=w(t);return(n=n.hour(i.hour()).minute(i.minute()).second(i.second())).toDate()},hh=function(e){var t;return p.jsx(yf,{className:kd(Df("button-group",e,[])),gap:e.gap||"0.75rem",justifyContent:null!=(t=null==e?void 0:e.buttons)?t:"start","data-component":e["data-component"],children:e.children})},vh=["sm","primary","secondary","disabled","loading","suppressed"],gh=Hu((function(e){var n,i,r,o,a,l,s=Dd(),u=null!=e&&e.primary?"primary":null!=e&&e.secondary?"secondary":e.suppressed?"suppressed":"secondary";return p.jsx("button",ge({},((n={})["data-componentoverride"]="renderButtonComponent",n),{"data-component":null==e?void 0:e["data-component"],"data-testid":e.testId,onClick:e.onClickWithDevToolCheck&&e.onClickWithDevToolCheck(e.onClick),disabled:e.disabled,className:kd(Df("button",e,vh),null==e?void 0:e.className,""+(i=null==s?void 0:s.buttons,r=e.themeOverride,Fl(ge({},Zl.button,{transitionDuration:"150ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",cursor:"pointer",letterSpacing:"normal",whiteSpace:"nowrap",transform:"translateY(0) scale(1)",lineHeight:"inherit","&:disabled":{opacity:.7,cursor:"inherit"},"&:disabled:hover":{opacity:.95,cursor:"inherit"},variants:{type:{primary:{},secondary:{},suppressed:{}},highlight:{false:{outline:"2px solid transparent",outlineOffset:-2},true:{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}},block:{true:{display:"block",width:"100%"}}},compoundVariants:[{type:"primary",css:ge({},null==i?void 0:i.primary,r)},{type:"secondary",css:ge({},null==i?void 0:i.secondary,{"&:hover":ge({},null==i||null==(o=i.secondary)?void 0:o["&:hover"]),"&:disabled":ge({},null==i||null==(a=i.secondary)?void 0:a["&:disabled"]),"&:hover:disabled":ge({},null==i||null==(l=i.secondary)?void 0:l["&:hover:disabled"])},r)},{type:"suppressed",css:ge({},null==i?void 0:i.secondary,r,{background:"transparent",paddingLeft:4,paddingRight:4,"&:disabled":{background:"transparent"}})}]})))({type:u,highlight:!(null==e||!e.highlight),block:null==e?void 0:e.block})),onMouseEnter:e.onMouseEnter,"data-themeapi":e.internal?void 0:"buttons."+u,"aria-readonly":e.readonly,children:e.icon?p.jsxs(yf,{gap:"0.25rem",alignItems:"center",children:[p.jsx(uf,{width:20,children:e.icon.Icon()}),p.jsx("span",{children:e.children})]}):p.jsx(t.Fragment,{children:e.children})}))}),"renderButtonComponent"),xh=function(e){var t,n,i,r=Dd();return p.jsx(uf,{className:""+Xf(null==r||null==(t=r.forms)?void 0:t.input,void 0,e.active),paddingTop:null!=(n=e.paddingTop)?n:4,paddingBottom:null!=(i=null==e?void 0:e.paddingBottom)?i:4.5,paddingX:"0!important",position:"relative",width:"100%","data-component":"input-container",children:e.children})};function bh(e,n,i,r){t.useEffect((function(){var t=function(){if(e&&n.current){var t=n.current.getBoundingClientRect(),o=t.top+i+2,a=window.innerWidth;if(t.left+648>a&&t.left<648)return void r({left:"50%",transform:"translateX(-50%)",right:"unset",top:o});if(t.left+648>a)return void r({left:t.right-648,top:o,right:"unset"});r({left:t.left,top:o,right:"unset"})}};return window.addEventListener("resize",t),t(),function(){return window.removeEventListener("resize",t)}}),[e])}var yh=function(e){return p.jsx("h3",ge({},e,{children:e.children}))},wh=function(e){return p.jsx("p",ge({},e,{children:e.children}))},Ch=function(e){return p.jsx("p",ge({},e,{className:es({textTransform:"capitalize",fontSize:"12px",lineHeight:"16px",fontWeight:"500",marginBottom:2===(null==e?void 0:e.marginBottom)?"8px":"0"}),children:e.children}))},jh=function(e){var t=e.children,n=e.id;return p.jsx("div",{id:n,children:p.jsx(F.DndProvider,{backend:function(e,t,i){return kh({manager:e,context:t,options:i,id:n})},options:{rootElement:document.getElementById(n)},children:t})})},Fh=function(e){var n=e.children,i=e.disable,r=t.useContext(F.DndContext);return p.jsx(uf,i?{paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:n}:{id:"vizzly-component-dnd-wrapper",paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:p.jsx(F.DndProvider,{context:r,backend:function(e,t,n){return kh({manager:e,context:t,options:n,id:"vizzly-component-dnd-wrapper"})},options:{rootElement:document.getElementById("vizzly-component-dnd-wrapper")},children:n})})},Sh=function(e){var n=e.children,i=t.useContext(F.DndContext);return p.jsx(F.DndProvider,{context:i,backend:function(e,t,n){return kh({manager:e,context:t,options:n,id:Bc})},options:{rootElement:document.getElementById(Bc)},children:n})},kh=function(e){var t=e.id,n=function(e,t,n){return new S.HTML5BackendImpl(e,t,n)}(e.manager,e.context,e.options);return n.setup=function(){var e=document.getElementById(t);e?e instanceof HTMLElement?n.addEventListeners(e):Je("DndProvider: Node with id "+t+" is not an HTMLElement."):Je("DndProvider: Node with id "+t+" not found.")},n.teardown=function(){var e=document.getElementById(t);e?e instanceof HTMLElement?e&&e instanceof HTMLElement&&n.removeEventListeners(e):Je("DndProvider: Node with id "+t+" is not an HTMLElement."):Je("DndProvider: Node with id "+t+" not found.")},n},Ah=function(e){var t,n,i,r,o,a,l,s,u,d=e.title,c=e.hiddenUnlessEnabledInCss,f=e.className,m=e.show,h=e.hide,v=Dd();return p.jsxs("div",{className:kd(If("modal-header"),""+(u=null==v||null==(t=v.modals)?void 0:t.header,Fl(ge({width:"100%",lineHeight:"1.5rem"},u,{"& h3":Zl.text,variants:{hidden:{true:{position:"absolute",left:-1e4,top:"auto",width:1,height:1,overflow:"hidden"}}}})))({hidden:null!=(n=null!=(i=null==v||null==(r=v.modals)?void 0:r.header)?i:c)&&n})),"data-themeapi":"modals.header",style:h?{display:"none"}:m||null!=v&&null!=(o=v.modals)&&o.header?{display:"block"}:{display:"none"},"data-component":null!=(a=null==e?void 0:e["data-component"])?a:"modal-header",children:[p.jsx(yf,{className:kd(null!=f?f:void 0),alignItems:"center",gap:"0.25rem",children:e.children||p.jsxs(p.Fragment,{children:[p.jsx(yh,{className:es({fontSize:null==v||null==(l=v.modals)||null==(l=l.header)?void 0:l.fontSize,fontWeight:null==v||null==(s=v.modals)||null==(s=s.header)?void 0:s.fontWeight}),children:d}),(null==e?void 0:e.tooltip)&&p.jsx(uf,{width:18,children:p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:e.tooltip})},children:p.jsx(b.QuestionMarkCircleIcon,{"aria-label":"Help",color:Sl(30)})})})]})}),null==e.titleExtra?void 0:e.titleExtra()]})},Th=function(e){var t,n,i,r,o,a=null!=(t=null==e?void 0:e.buttons)?t:"end",l=Dd();return p.jsx("div","space-between"===(null==e?void 0:e.buttons)?{className:kd(If("modal-footer"),""+oh(null==l||null==(r=l.modals)?void 0:r.footer)({buttons:a}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(o=null==e?void 0:e["data-component"])?o:"modal-footer","data-chipposition":"bottom.center",children:p.jsx(yf,{gap:"0.75rem",justifyContent:"space-between",children:null==e?void 0:e.children})}:{className:kd(If("modal-footer"),""+oh(null==l||null==(n=l.modals)?void 0:n.footer)({buttons:null==e?void 0:e.buttons}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(i=null==e?void 0:e["data-component"])?i:"modal-footer","data-chipposition":"bottom.center",children:null==e?void 0:e.children})},_h=function(e){var t,n,i=e.children,r=e.className,o=Dd();return p.jsx("div",{className:kd(null!=e&&e.scrollable?""+ih:void 0,If("modal-content"),""+rh(null==o||null==(t=o.modals)?void 0:t.content)({scrollable:null!=e&&e.scrollable?"true":"false"}),r),"data-themeapi":"modals.content","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"modal-content",children:i})},Ih=function(e){var n,i,r,o,a,l,s,u,d,c=t.useRef();e.width&&(c.current=e.width);var f,m=null==(n=Dd())?void 0:n.modals;return p.jsx("div",{style:{display:"inherit",zIndex:null!=(i=null==m||null==(r=m.base)?void 0:r.zIndex)?i:2147483147},children:p.jsx(lf,{appear:!0,show:e.isOpen,children:p.jsxs(gp,{style:{zIndex:null!=(o=null==m||null==(a=m.base)?void 0:a.zIndex)?o:2147483147},"data-themeapi":"modals.base",className:kd("vizzly-modals",es({position:"fixed",top:0,left:0,right:0,bottom:0,overflowY:null!=(l=e.options)&&l.disableModalScrolling?void 0:"auto",overflowX:null!=(s=e.options)&&s.disableModalScrolling?void 0:"hidden"})),onClose:function(){var t;return!(null!=m&&null!=(t=m.options)&&t.disableOutsideClick)&&e.onClose()},"data-testid":"modal",static:!(null!=m&&null!=(u=m.options)&&u.disableOutsideClick),children:[p.jsx(gp.Overlay,{className:kd(If("modal-overlay"),""+(f=null==m?void 0:m.overlay,Fl(ge({position:"fixed",top:0,right:0,bottom:0,left:0},f,{variants:{dark:{true:{opacity:.7},false:{opacity:null==f?void 0:f.opacity}}}})))({dark:null!=(d=null==e?void 0:e.dark)&&d})),"data-themeapi":"modals.overlay"}),p.jsxs("div",{"data-testid":e["data-testid"],className:es({minHeight:"100vh",padding:"0 16px",textAlign:"center"}),children:[p.jsx("span",{className:es({display:"inline-block",height:"100vh",verticalAlign:"middle"}),"aria-hidden":"true",children:"​"}),p.jsxs(lf.Child,{enter:"v_contentEnter",enterFrom:"v_contentEnterFrom",enterTo:"v_contentEnterTo",leave:"v_contentLeave",leaveFrom:"v_contentLeaveFrom",leaveTo:"v_contentLeaveTo",className:es({position:"relative",display:"inline-block",verticalAlign:"middle",textAlign:"left",width:"100%",transition:"all 150ms cubic-bezier(0.4, 0, 0.2, 1)",margin:"32px 0",maxWidth:"sm"==c.current?"384px":"xl"==c.current?"576px":"2xl"==c.current?"672px":"4xl"==c.current?"896px":"7xl"==c.current?"1280px":"576px"}),children:[!e.hideCloseIcon&&p.jsx(Nh,{onClick:e.onClose}),p.jsx(Oh,{vizzlyPrefix:If("modal-wrapper",e.namespace),disableDnD:e.disableDnD,children:e.children})]})]})]})})})},Dh=t.createContext({isUsed:!1,setIsUsed:function(){}}),Oh=function(e){return p.jsx(e.disableDnD?Eh:Lh,ge({},e,{children:null==e?void 0:e.children}))},Eh=function(e){var t,n,i=Dd();return p.jsx("div",{className:kd(null==e?void 0:e.vizzlyPrefix,""+nh(null==i||null==(t=i.modals)?void 0:t.base),If("modal-body")),"data-themeapi":"modals.base","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"vizzly-modal-body","data-chipposition":"above.center","data-dndenabled":e.disableDnD?"false":"true",children:null==e?void 0:e.children})},Lh=function(e){var n=t.useContext(Dh),i=n.isUsed,r=n.setIsUsed;return i||r(!0),p.jsxs(Dh.Provider,{value:{isUsed:!0,setIsUsed:r},children:[!i&&p.jsx(Sh,{children:p.jsx(Eh,ge({},e,{children:null==e?void 0:e.children}))}),i&&p.jsx(Eh,ge({},e,{children:null==e?void 0:e.children}))]})},Nh=function(e){var t,n,i,r,o=null==(t=Dd())?void 0:t.modals;return"none"===(null==o||null==(n=o.options)?void 0:n.closeButton)?null:p.jsx("button",{type:"button","data-testid":"close-modal",onClick:function(){return e.onClick()},className:kd(If("modal-close"),""+Ql.button,"inside"===(null==o||null==(i=o.options)?void 0:i.closeButton)?es({position:"absolute",top:"8px",right:"8px"}):es({position:"absolute",top:"-24px",right:"-24px"})),"data-themeapi":"modals.options.closeButton","data-component":"modal-close-button","aria-label":"Close modal button",children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"inside"===(null==o||null==(r=o.options)?void 0:r.closeButton)?Sl(5):"#FFF",className:es({width:"24px",height:"24px"}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})},Mh=Object.assign(Ih,{Header:Ah,Footer:Th,Content:_h}),Rh=function(e){var n,i,r=Dd(),o=Pu().featureToggles,a=Gm(e.label,null==r||null==(n=r.forms)?void 0:n.select),l=t.useRef(null),s=t.useState({}),u=s[0],d=s[1],c=t.useRef(null),f=t.useState(0),m=f[0],h=f[1];t.useEffect((function(){l.current&&h(l.current.getBoundingClientRect().height)}),[l.current]),bh(e.open,l,m,d);var v=function(){e.onCancel()};return Id(c,(function(){v()})),e.hidden?null:p.jsx(uf,{minWidth:a+36,"data-component":e.id,width:o.forceMobile?"100%":void 0,"data-testid":"filter_"+e.filterIndex+"_type_number",children:p.jsxs("div",{className:es({position:"relative",height:"100%",display:"flex",width:"100%"}),id:e.id,children:[p.jsx("div",{ref:l,className:es({display:"flex",height:"100%",width:"100%"}),children:p.jsx(xh,{paddingTop:"0!important",paddingBottom:"0!important",active:e.open,children:e.display})}),e.open&&p.jsx(gp,{open:e.open,onClose:v,className:kd("vizzly_picker",es(ge({position:"fixed",top:m+2,zIndex:21474831470,overflowY:void 0,overflowX:void 0},u))),children:p.jsxs(gp.Panel,{className:"relative z-10",style:{width:648},children:[p.jsx("h1",{className:""+Xl,children:"Advanced Filter"}),p.jsx("div",{"data-themeapi":"modals.content",ref:c,className:kd(""+nh(null==r||null==(i=r.modals)?void 0:i.base)),children:e.children})]})})]})})},Ph=function(e){var t=e.textOverride;return p.jsxs(Mh.Footer,{buttons:"space-between",children:[e.showClearBtn&&p.jsx(hh,{children:p.jsx(gh,{onClick:e.onClearAll,disabled:e.clearDisabled,children:t?t("date_picker.button_clear","Clear"):"Clear"})}),p.jsxs(hh,{buttons:"end",children:[p.jsx(gh,{onClick:e.onCancel,children:t?t("date_picker.button_close","Close"):"Close"}),p.jsx(gh,{onClick:function(){return e.onApply()},primary:!0,disabled:e.applyDisabled,children:t?t("date_picker.button_apply","Apply"):"Apply"})]})]})},zh=function(e){var t,n=Dd();return p.jsx("div",{className:kd(If("modal-content"),If("picker-content"),""+rh(null==n||null==(t=n.modals)?void 0:t.content,{paddingBottom:e.paddingBottom,paddingTop:e.paddingTop})({scrollable:"false"})),"data-themeapi":"modals.content",children:e.children})},Vh=function(e){var n,i,r,o,a,l,s,u,d,c,f=e.dateFormat,m=e.textOverride,h=e.fixed,v=e.setState,g=e.setTime,x=e.timeFormat,b=e.time,y=Dd(),w=function(e){return e?e.format(f):void 0},C=t.useState(!1),j=C[0],F=C[1];t.useEffect((function(){j&&F(!1)}),[j]);var S=t.useCallback((function(e){var t=e.startDate,n=e.endDate;g({start:t?th("00:00",x):null,end:n?th("23:59",x):null}),t&&n&&t.isAfter(n)?v({fixed:{start:n,end:t},relative:void 0,type:Kv.Fixed}):v({fixed:{start:t,end:n},relative:void 0,type:Kv.Fixed})}),[]),k=t.useCallback((function(e){g({start:e.start,end:e.end})}),[]),A=t.useCallback((function(){v({fixed:{end:null,start:null},relative:void 0,type:Kv.Fixed}),g({start:null,end:null}),F(!0)}),[e.onClear]);return p.jsxs(t.Fragment,{children:[p.jsxs(zh,{paddingTop:0,children:[p.jsx("div",{className:es({width:"date_time"!==e.type?"50%":"66%"}),children:p.jsx("div",{className:""+Jm.inputsWrapper(null==y||null==(n=y.forms)?void 0:n.dateTime),"data-themeapi":"forms.dateTime.input",children:p.jsxs("div",{className:kd(""+Jm.inputs,es({minHeight:32})),children:[p.jsxs(yf,{gap:0,alignItems:"center",children:[p.jsx($m,{name:"start_date",value:w(null!=(i=null==h?void 0:h.start)?i:null),label:m?m("start_date","Start Date"):"Start Date",onChange:function(e){var t;v({fixed:{start:qh(e,f),end:null!=(t=null==h?void 0:h.end)?t:null},type:Kv.Fixed})},dateFormat:f}),"date_time"===e.type&&p.jsx(t.Fragment,{children:p.jsx(eh,{label:m?m("time","Time"):"Time",name:"start_time",onChange:function(e){k({start:e,end:b.end})},className:Jm.dateInput(null==y||null==(r=y.forms)?void 0:r.dateTime)+" "+Jm.timeInput(null==y||null==(o=y.forms)?void 0:o.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:x,value:b.start,shouldClear:j})})]}),p.jsx(ah,{}),p.jsxs(yf,{gap:0,children:[p.jsx($m,{name:"end_date",value:w(null!=(a=null==h?void 0:h.end)?a:null),label:m?m("end_date","End Date"):"End Date",onChange:function(e){var t;v({fixed:{end:qh(e,f),start:null!=(t=null==h?void 0:h.start)?t:null},type:Kv.Fixed})},dateFormat:f}),"date_time"===e.type&&p.jsx(eh,{label:m?m("time","Time"):"Time",name:"end_time",onChange:function(e){k({start:b.start,end:e})},className:Jm.dateInput(null==y||null==(l=y.forms)?void 0:l.dateTime)+" "+Jm.timeInput(null==y||null==(s=y.forms)?void 0:s.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:x,value:b.end,shouldClear:j})]}),p.jsx("div",{className:""+Jm.clearContainer(),children:p.jsx(Rf,{onClear:A,className:""+Jm.clearButton(null==y||null==(u=y.forms)?void 0:u.dateTime),"aria-label":m?m("clear_date","Clear Dates"):"Clear Dates",fill:null==y||null==(d=y.forms)||null==(d=d.select)?void 0:d.indicatorColor,stroke:null==y||null==(c=y.forms)||null==(c=c.select)?void 0:c.indicatorColor})})]})})}),p.jsx(fh,{dates:h,onDatesChange:S,textOverride:m})]}),p.jsx(Ph,{onClearAll:e.onClearAll,textOverride:e.textOverride,onCancel:e.onCancel,onApply:e.onApply,applyDisabled:!(null!=h&&h.start&&null!=h&&h.end),showClearBtn:!0})]})},qh=function(e,t){return w(e,t,!0).isValid()?w(e,t):null},Bh=Object.assign((function(){return null}),{list:function(e){var t;return Fl({position:"relative",width:"100%",display:"grid",gridTemplateColumns:null==e?void 0:e.columns,padding:null!=(t=null==e?void 0:e.padding)?t:"0 0.5rem",margin:"0 0 1.5rem 0",borderBottom:null!=e&&e.theme&&null!=e&&e.theme.borderBottom?null==e?void 0:e.theme.borderBottom:"0px solid transparent"})},button:function(e){var t,n,i,r,o,a,l,s,u,d,c,p,f,m,h,v,g,x,b,y,w,C,j,F,S,k,A;return Fl({lineHeight:"1rem",letterSpacing:"0.1em",whiteSpace:"nowrap",position:"relative",variants:{state:{unselected:{borderRadius:null==e||null==(t=e.unselected)?void 0:t.borderRadius,padding:null==e||null==(n=e.unselected)?void 0:n.padding,fontSize:null==e||null==(i=e.unselected)?void 0:i.fontSize,fontWeight:null==e||null==(r=e.unselected)?void 0:r.fontWeight,color:null==e||null==(o=e.unselected)?void 0:o.color,boxShadow:null==e||null==(a=e.unselected)?void 0:a.boxShadow,background:null!=(l=null==e||null==(s=e.unselected)?void 0:s.background)?l:"inherit",border:null==e||null==(u=e.unselected)?void 0:u.border,borderRight:null==e||null==(d=e.unselected)?void 0:d.borderRight,borderLeft:null==e||null==(c=e.unselected)?void 0:c.borderLeft,borderTop:null==e||null==(p=e.unselected)?void 0:p.borderTop,borderBottom:null==e||null==(f=e.unselected)?void 0:f.borderBottom,"&:hover":ge({},Cl,null==e||null==(m=e.unselected)?void 0:m["&:hover"])},selected:{borderRadius:null==e||null==(h=e.selected)?void 0:h.borderRadius,padding:null==e||null==(v=e.selected)?void 0:v.padding,fontSize:null==e||null==(g=e.selected)?void 0:g.fontSize,fontWeight:null==e||null==(x=e.selected)?void 0:x.fontWeight,color:null==e||null==(b=e.selected)?void 0:b.color,boxShadow:null==e||null==(y=e.selected)?void 0:y.boxShadow,background:null==e||null==(w=e.selected)?void 0:w.background,border:null==e||null==(C=e.selected)?void 0:C.border,borderRight:null==e||null==(j=e.selected)?void 0:j.borderRight,borderLeft:null==e||null==(F=e.selected)?void 0:F.borderLeft,borderTop:null==e||null==(S=e.selected)?void 0:S.borderTop,borderBottom:null==e||null==(k=e.selected)?void 0:k.borderBottom,"&:hover":ge({},null==e||null==(A=e.selected)?void 0:A["&:hover"])}},button:{true:{cursor:"pointer",padding:"0.5rem",border:0,whiteSpace:"nowrap"}}}})},panel:function(e,t){return Fl({paddingLeft:null!=e?e:"0.5rem",paddingRight:null!=t?t:"0.5rem"})},hasChanges:Fl({fontSize:8})}),Wh=["children","paddingLeft","paddingRight","className"],Hh=Object.assign((function(){return null}),{Group:function(e){return p.jsx(qp.Group,ge({},e,{children:p.jsx("div",{className:If("tab-group"),children:e.children})}))},Button:function(e){var t=Dd();return p.jsx(qp,ge({},e,{className:""+Ql.button,children:function(n){var i,r=n.selected;return p.jsx("div",{className:kd(Df("tab-button",{selected:r},["selected"]),""+Bh.button(null!=(i=e.tabsStyleOverride)?i:null==t?void 0:t.tabs)({state:r?"selected":"unselected"})),"data-themeapi":"tabs-"+(r?"selected":"unselected"),children:e.children})}}))},Panel:function(e){var t=e.children,n=e.paddingLeft,i=e.paddingRight,r=e.className,o=we(e,Wh);return p.jsx(qp.Panel,ge({className:kd(If("tab-panel"),""+Bh.panel(n,i),r)},o,{children:t}))},Panels:function(e){return p.jsx(qp.Panels,ge({},e,{children:e.children}))},List:function(e){var t,n=Dd();return p.jsx(qp.List,ge({className:kd(If("tab-button-list"),""+Bh.list({columns:null==e?void 0:e.columns,theme:null!=(t=null==e?void 0:e.tabsStyleOverride)?t:null==n?void 0:n.tabs,padding:null==e?void 0:e.padding}))},e,{"data-themeapi":"tabs","data-chipposition":"above.left",children:e.children}))}}),Yh=function(e,t){var n=e.value;return!!e.field&&!!e.op&&(jt(n)?Ft(n):!(Array.isArray(n)&&0===n.length||!t&&[void 0,NaN,""].includes(n)))},Gh=function(e){var t;if(!e.field)return null;var n=Pu().textOverride,i=function(e,t,n){var i={};return[].concat(e.allowedOperators).forEach((function(r){var o=t[r];o.validDataTypes.includes(e.dataType)&&(i[r]=ge({},o,{publicName:n?n("config.supported_operator."+r,o.publicName):o.publicName}))})),i}(e.field,e.queryEngineConfig.supportedOperators,n),r=[].concat(Object.keys(i)).flatMap((function(t,n){return null!=e&&e.isAList||!["is_one_of","is_not_one_of"].includes(t)?[{label:i[t].publicName,value:t,testId:e.testId+"-pick-op-"+n}]:[]}));"allowedOperators"in e.field&&e.field.allowedOperators.includes("=")&&r.push({label:n("math_op_is_null","Is null"),value:"is_null",testId:"is-null"}),"allowedOperators"in e.field&&e.field.allowedOperators.includes("!=")&&r.push({label:n("math_op_is_not_null","Is not null"),value:"is_not_null",testId:"is-not-null"});var o=e.selected;return"!="==e.selected&&null===e.value?o="is_not_null":"="==e.selected&&null===e.value&&(o="is_null"),p.jsx(nm,{label:n("operator","Operator"),labelHidden:!0,id:null==e?void 0:e.id,testId:e.testId+"-pick-op",onChange:function(t){e.onChange("is_not_null"==t?{op:"!=",value:null}:"is_null"==t?{op:"=",value:null}:"is_not_null"!=t&&"is_null"!=t&&null===e.value?{op:t,value:void 0}:{op:t})},options:null!=(t=e.supportedQueryOperators)?t:r,selected:o,textOverride:n})},Uh=n.forwardRef((function(e,t){return p.jsxs(p.Fragment,{children:[(null==e?void 0:e.label)&&p.jsx(Kf,{htmlFor:null==e?void 0:e.id,children:null==e?void 0:e.label}),p.jsx("input",ge({"data-testid":"checkbox",className:""+Kh(),type:"checkbox",ref:t},e,{checked:e.checked}))]})})),Kh=function(){return Fl({marginRight:"8px",height:"16px",width:"16px",cursor:"pointer",appearance:"none",borderRadius:"2px",borderWidth:2,borderStyle:"solid",backgroundSize:"contain",backgroundPosition:"center",backgroundRepeat:"no-repeat",verticalAlign:"top",transitionProperty:"all",borderColor:Sl(50),backgroundColor:"rgb(255, 255, 255)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"200ms","&:checked":{borderColor:"rgb(48, 116, 217)",backgroundColor:"rgb(48, 116, 217)"},"&:hover":{borderColor:"rgb(48, 116, 217)"},"&:focus":{outline:"2px solid transparent",outlineOffset:2}})},Xh=Object.assign((function(){return null}),{remove:function(e){return Fl(ge({"& svg":ge({},Cl,{fill:"#e5e7eb"})},e?{}:{"&:hover svg":ge({},Cl,{fill:"#de0938",cursor:"pointer"})}))},complete:function(e){return Fl(ge({},e?{}:{"& svg":ge({},Cl,{fill:"rgb(229, 231, 235)"})}))}});function Qh(e,t){return[].concat(t(null==e?void 0:e.denominatorFilter),t(null==e?void 0:e.numeratorFilter))}function Zh(e,t){return e.rules.flatMap((function(e){return t(e.rule)}))}function Jh(e,t){var n=function(e){return function(e,n){var i=[];return null==e||e.forEach((function(e){e.forEach((function(e){var n=function(e){var n;return null!=(n=t(e.value))?n:[]}(e);n.length>0&&i.push.apply(i,n)}))})),i}(e)};return mn(e)?Zh(e,n):fn(e)?Qh(e,n):hn(e)?n(e.rule):[]}var $h=function(e,n,i,r,o,a,l){var s=t.useState(!1),u=s[0],d=s[1],c=function(e,n,i){var r=t.useState(0),o=r[0],a=r[1];return t.useEffect((function(){if("dataSetId"in n){var t=Gi(n);i&&i.changes&&Object.keys(i.changes).forEach((function(n){var i=function(e,t,n,i,r){return e.flatMap((function(e){var r=i(t,e),o=function(e){return function(e,t){var i=[];return null==e||e.forEach((function(e){e.forEach((function(e){var t=function(e){var t=Xt(e.value);return null==t?void 0:t.find((function(e){return e===n}))}(e);void 0!==t&&i.push(t)}))})),i}(e)};return mn(r)?Zh(r,o):fn(r)?Qh(r,o):hn(r)?o(r.rule):[]}))}(t,e,n,Qo);Ke("Custom fields that have changed when Variables have changed",i),i.length>0&&a((function(e){return e+1}))}))}}),[JSON.stringify(i)]),t.useEffect((function(){if("dataSetId"in n){var t=Gi(n);i&&i.variables&&t.forEach((function(t){var n=Qo(e,t);try{Jh(n,(function(e){return Zt(e,Xt,i.variables)}))}catch(e){Je(e)}}))}}),[e,n,i]),{noOfVariableChanges:o}}(o,e,l).noOfVariableChanges;try{var p=function(e,t){if("dataSetId"in t){var n=Gi(t).flatMap((function(t){var n=Qo(e,t);return bn(n)?[n]:[]}));return JSON.stringify(n)}return""}(o,e);return t.useEffect((function(){var t=new AbortController;return function(){var o=me(Ce().mark((function o(){var a;return Ce().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return d(!0),o.next=3,Wm(e,n,t.signal,r);case 3:(a=o.sent)?(d(!1),t.signal.aborted||i(a)):Array.isArray(e)?i(e.map((function(e){return null}))):i([null]);case 5:case"end":return o.stop()}}),o)})));return function(){return o.apply(this,arguments)}}()(),function(){t.abort("useQueryEffect unmounted")}}),[JSON.stringify({componentType:a,dataSetId:o.id,queries:e,filterConfig:r,watchCustomFieldChangesKey:p,noOfVariableChanges:c})]),{queriesAreChanging:u}}catch(e){if(d(!1),e instanceof ki)return{queriesAreChanging:!1};throw e}},ev=function(e){var i,o,a,l,s=null!=(i=null==e?void 0:e.showableChips)?i:2,u=e.selected,d=e.textOverride,c=t.useState([]),f=c[0],m=c[1];t.useEffect((function(){r.isArray(e.options)&&m(e.options)}),[e.options]);var h=t.useState(null!=(o=null==e?void 0:e.isLoading)&&o),v=h[0],g=h[1],x=t.useState(r.isFunction(e.options)?"unloaded":void 0),b=x[0],y=x[1],w=n.useState(!1),C=w[0],j=w[1];t.useEffect((function(){var t=function(){var t=me(Ce().mark((function t(){var n;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(g(!0),n=new AbortController,y("loading"),!r.isFunction(e.options)){t.next=9;break}return e.options(n.signal).then((function(e){y("loaded"),e&&(m(e),g(!1))})),t.abrupt("return",(function(){n.abort("Multi-select unmounted"),y("failed")}));case 9:g(!1),m(e.options);case 11:return t.abrupt("return",(function(){}));case 12:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();C&&r.isFunction(e.options)&&t()}),[C]);var F=hf(f,["label","value"]),S=F.values,k=F.searchString,A=F.setSearch,T=t.useRef(null);Id(T,(function(){j(!1),E(s)}));var _=function(t){A("");var n=[].concat(u);n=u.includes(t)?r.filter([].concat(u),(function(e){return e!=t})):[].concat(u,[t]),e.setSelected(n)},I=r.sumBy(f,(function(e){return e.hide?0:1})),D=t.useState(s),O=D[0],E=D[1];t.useEffect((function(){E(C?u.length:s)}),[u.length,f.length]);var L=Dd(),N=Hf(e.isLoading);return p.jsxs("div",{className:es({width:"100%"}),"data-fetchstatus":null!=b?b:void 0,children:[(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&p.jsx(Kf,{labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,children:null==e?void 0:e.label}),p.jsxs("div",{className:es({width:"100%",display:"flex",flexDirection:"column",alignItems:"center",position:"relative"}),ref:T,children:[p.jsxs(Bf,{value:k,onChange:function(e){return A(e)},open:C,setOpen:function(e){j(e),E(e?u.length:s)},multiple:!0,id:null==e?void 0:e.id,"aria-labelledby":(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&(null==e?void 0:e.id),onClick:function(){return!C&&0===u.length&&j(!0)},testId:"multi-select",textOverride:d,fixedWidth:null==e?void 0:e.labelWidth,isFilter:e.isFilter,children:[(null==e?void 0:e.selectedPrefix)&&p.jsx(uf,{"data-component":"selected-prefix",padding:null!=(a=null==L||null==(l=L.forms)||null==(l=l.select)?void 0:l.padding)?a:"0.30rem 0.5rem",paddingRight:0,lineHeight:"16px",children:null==e?void 0:e.selectedPrefix}),(null==e?void 0:e.placeholder)&&0===u.length&&p.jsx(uf,{padding:"0.35rem 0.5rem",as:"span",children:p.jsx("span",{style:{color:"#A1A8B3"},children:null==e?void 0:e.placeholder})}),p.jsx(yf,{flex:1,minWidth:C?0===u.length?void 0:190:void 0,alignItems:"stretch",height:"100%",children:p.jsxs(yf,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,wrap:!0,padding:"4px 8px","data-component":"selected-chips",alignItems:"center",children:[u.length<=O&&u.map((function(t,n){var i=f[t];return i?p.jsx(dh.Selected,{onRemove:function(){return _(t)},label:i.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:d},n):null})),O<=s&&u.length>s&&p.jsxs(t.Fragment,{children:[u.map((function(t,n){var i=f[t];return n>s-1?null:i?p.jsx(dh.Selected,{onRemove:function(){return _(t)},label:i.label,disableClear:null==e?void 0:e.disableClearAll,textOverride:d},n):null})),p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:u.map((function(e,n){var i;return n<=s-1?null:p.jsxs(t.Fragment,{children:[null==(i=f[e])?void 0:i.label,u.length!==n+1&&", "]},n)}))})},children:p.jsx(dh.Selected,{onRemove:function(){},label:u.length-s+" more",disableClear:!0,textOverride:d})})]})]})})]}),p.jsxs(_f,{open:C,width:e.dropdownForFilter?void 0:"calc(100% - 2px)",minWidth:e.dropdownForFilter?192:void 0,onFreeTextSelected:e.onFreeTextSelected,freeTextOptions:e.freeTextOptions,children:[v&&p.jsx(uf,{height:80,children:N&&p.jsx(Mf,{color:"#3074d9"})}),u.length!==I&&p.jsxs(t.Fragment,{children:[p.jsx(uf,{padding:8,children:p.jsx($f,{id:(null==e?void 0:e.id)+"-add-item",label:"Add "+e.placeholder,labelHidden:!0,autoFocus:!0,defaultValue:k,onChange:function(e){return A(e.target.value)}})}),S.map((function(e,n){return p.jsx(t.Fragment,{children:!e.item.hide&&!u.includes(e.refIndex)&&p.jsx(_f.Option,{onChange:function(){return _(e.refIndex)},label:e.item.label})},n)}))]}),!v&&u.length===I&&p.jsx(uf,{padding:8,children:d?d("no_options","No Options"):"No Options"})]})]})]})},tv=function(e,t,n,i,r,o){var a=Go(t,{queryEngineConfig:i}),l=n.preAggregated&&a.setDataAttributesFromPreAggregatedDataSet?a.setDataAttributesFromPreAggregatedDataSet(a.init(n.id),n):a.autoGenerate(n);if(o)try{var s=function(e,t,n,i){var r={},o=nv.includes("measure")?"measure":null;return nv.forEach((function(a){if(a in e&&a in t){var l=e[a];if(a!==o||!Array.isArray(l))return void(r[a]=l);r[o]=l.map((function(e){if(Ii(e))return e;var t=Qo(n,e.field);return ge({},e,{function:dt(i,t.dataType)[0]})}))}})),r}(o.attributes,l,n,i);Xe("Swapping component type");var u=a.setAttributes(l,ge({type:t},s));return r(u,n,"initial"),ru(u)}catch(e){Xe("Component properties are not compatible with new type",e)}var d=r(l,n,"initial");return ru(a.setAttributes(l,d))},nv=["measure","order","timeDimension","dimension","filter","displayTitle","displaySubject","limit"],iv=function(){var e,n,i=Pu(),r=i.onlyViewTypes,o=i.queryEngineConfig,a=i.textOverride;t.useState(null);var l=qm(),s=l.dashboard,u=l.componentEditor,d=l.runQueriesCallback,c=l.dispatch,p=l.trackEvent,f=Pu(),m=f.featureToggles,h=f.numberFormatOptions,v=f.mode,g=f.dataPanel,x=f.formatPanel,b=f.onEditorUpdate,y=(null==u?void 0:u.component)||null;if(t.useEffect((function(){var e=function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tv(0,r(s.dataSets[0])[0],s.dataSets[0],o,b);case 2:t=e.sent,u&&c(ge({type:"startEditingComponent",component:t},u.target));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();y||e()}),[]),!y)return null;var w=Go(y.attributes.type,{queryEngineConfig:o}),C=Ko(s.dataSets,y.attributes.dataSetId);if(!C)return null;var j=null!=u&&null!=(e=u.target)&&e.libraryIndex||0===(null==u||null==(n=u.target)?void 0:n.libraryIndex)?"library":"dashboard",F=function(e){if(y&&w){var t,n=b(e,C,"edit");e.type!==y.attributes.type&&(w=Go(e.type,{queryEngineConfig:o}));try{t=w.setAttributes(e,n)}catch(n){console.warn("[VIZZLY] Not applying changes from `onEditorUpdate` because of a validation error.",n),t=e}var i=ge({},y,{attributes:t});c({type:"updateEditorComponent",component:i})}};return{setLocalFilters:function(e){c({type:"updateEditorComponent",component:ge({},y,{localFilters:e})})},queryEngineConfig:o,selectedComponent:y.attributes.type,onSelectViewType:function(e,t){var n;n=null!=t&&t.customView?function(e,t,n,i){var r=Go("custom",{queryEngineConfig:e}),o=r.setAttributes(r.init(t.id,{customViewId:n.id}),{type:"custom"});return i(o,t,"initial"),ru(o)}(o,C,t.customView,b):tv(0,e,C,o,b,y),c({type:"updateEditorComponent",component:n})},dataPanel:g,formatPanel:x,setDataSet:function(){var e=me(Ce().mark((function e(t){var n,i,a,l;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u&&u.component&&t)){e.next=10;break}if(n=$o(s.dataSets,t),!(i=n[0])){e.next=10;break}return(a=r(i)).includes(l=u.component.attributes.type)||(l=a[0]),e.next=8,tv(0,l,i,o,b);case 8:c({type:"updateEditorComponent",component:e.sent});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),featureToggles:m,dashboard:s,setDataSets:function(e){c({type:"setDataSets",dataSets:e})},dataSet:C,viewOptions:r,numberFormatOptions:h,setAttributes:F,setPartialAttributes:function(e){w&&F(w.setAttributes(y.attributes,e))},setResults:function(e){c({type:"setResultsForComponentInEditor",results:e})},mode:v,origin:j,componentEditor:u,component:y,trackEvent:p,runQueriesCallback:d,dispatch:c,textOverride:a}},rv=Sl(85),ov=function(e){return p.jsx("div",{"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:p.jsxs(yf,{direction:"column",gap:"0.25rem",children:[p.jsxs(yf,{justifyContent:"space-between",alignItems:"end",children:[p.jsx("span",{className:es({fontSize:"0.8rem",textAlign:"left"}),children:e.showTitle?e.title:""}),e.showValue&&p.jsx(uf,{as:"p",margin:0,children:null==e?void 0:e.displayValueNow})]}),p.jsx("div",{className:av,"data-percentage":e.percentage,children:p.jsx("div",{className:lv(e.color,e.percentage)})})]})})},av=es({height:10,backgroundColor:rv,borderRadius:"9999px",position:"relative",overflow:"hidden",width:"100%"}),lv=function(e,t){var n=Math.max(0,Math.min(100,t));return es({height:"100%",width:n+"%",backgroundColor:"string"==typeof e?e:null==e?void 0:e[0],borderRadius:"inherit",transition:"width 0.3s ease"})},sv=function(e){var t,n,i,r,o=null!=(t=e.radius)?t:120,a=null!=(n=e.stroke)?n:15,l=o-2*a,s=2*l*Math.PI,u=s-e.percentage/100*s,d="gradient-"+Math.random().toString(36).substr(2,9);return p.jsxs(yf,{direction:"column",alignItems:"center",children:[p.jsxs("div",{style:{position:"relative"},"aria-valuenow":e.valueNow,"aria-valuemin":e.valueMin,"aria-valuemax":e.valueMax,"aria-label":e.title,children:[p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:1.25*o,height:1.25*o,viewBox:"0 0 "+2*o+" "+2*o,children:[p.jsx("defs",{children:p.jsx("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:(r=e.color,Array.isArray(r)?r.map((function(e,t,n){return p.jsx("stop",{offset:t/(n.length-1)*100+"%",stopColor:e},t)})):[p.jsx("stop",{offset:"0%",stopColor:r},"0"),p.jsx("stop",{offset:"100%",stopColor:r},"1")])})}),p.jsx("circle",{stroke:rv,fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,r:l,cx:o,cy:o}),p.jsx("circle",{stroke:"url(#"+d+")",fill:"transparent",strokeWidth:a,strokeDasharray:s+" "+s,style:{strokeDashoffset:u},r:l,cx:o,cy:o,transform:"rotate(-90 "+o+" "+o+")",strokeLinecap:"round"})]}),e.showValue&&p.jsx("p",{className:""+uv,children:null!=(i=null==e?void 0:e.displayValueNow)?i:e.percentage+"%"})]}),e.showTitle&&p.jsx("div",{className:Ql.textSize("sm")+" "+dv,children:e.title})]})},uv=Fl({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",margin:0}),dv=Fl({textAlign:"center",height:20}),cv=function(e){var t=Number(Fa(e.valueNow,e.valueMax).toFixed(2));return p.jsx(e.type===jo.Circular?sv:ov,ge({},e,{percentage:t}))},pv=Object.assign(cv,{View:cv,Circular:sv,Linear:ov}),fv=function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{children:p.jsx("path",{d:"M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM152 96H64V160H152V96zM208 160H296V96H208V160zM448 96H360V160H448V96zM64 288H152V224H64V288zM296 224H208V288H296V224zM360 288H448V224H360V288zM152 352H64V416H152V352zM208 416H296V352H208V416zM448 352H360V416H448V352z"})}))},mv=function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{children:p.jsx("path",{d:"M64 400C64 408.8 71.16 416 80 416H480C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H80C35.82 480 0 444.2 0 400V64C0 46.33 14.33 32 32 32C49.67 32 64 46.33 64 64V400zM342.6 278.6C330.1 291.1 309.9 291.1 297.4 278.6L240 221.3L150.6 310.6C138.1 323.1 117.9 323.1 105.4 310.6C92.88 298.1 92.88 277.9 105.4 265.4L217.4 153.4C229.9 140.9 250.1 140.9 262.6 153.4L320 210.7L425.4 105.4C437.9 92.88 458.1 92.88 470.6 105.4C483.1 117.9 483.1 138.1 470.6 150.6L342.6 278.6z"})}))},hv={areaChart:function(e){return function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},e,{children:p.jsx("path",{d:"M500 384c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12V76c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v308h436zM372.7 159.5L288 216l-85.3-113.7c-5.1-6.8-15.5-6.3-19.9 1L96 248v104h384l-89.9-187.8c-3.2-6.5-11.4-8.7-17.4-4.7z"})}))}(e)},barChart:function(e){return function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{children:p.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))}(e)},horizontalBarChart:function(e){return function(e){return p.jsx("svg",ge({className:es({transform:"rotate(90deg)"}),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e,{children:p.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))}(e)},lineChart:function(e){return mv(e)},lineChartV2:function(e){return mv(e)},pieChart:function(e){return function(e){return p.jsxs("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},e,{children:[p.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),p.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]}))}(e)},scatterChart:function(e){return function(e){return p.jsxs("svg",ge({viewBox:"0 0 2134 2134",xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1.5}},e,{children:[p.jsx("path",{d:"M208.333 208.334v1716.66M214.91 1926.73h1716.66",style:{strokeWidth:"166.67px"}}),p.jsx("circle",{cx:987.916,cy:920.416,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),p.jsx("circle",{cx:708.749,cy:1516.25,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),p.jsx("circle",{cx:1633.75,cy:907.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),p.jsx("circle",{cx:1775.42,cy:307.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}})]}))}(e)},singleStat:function(e){return function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor"},e,{children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5l-3.9 19.5m-2.1-19.5l-3.9 19.5"})}))}(e)},dataTable:function(e){return fv(e)},basicTable:function(e){return fv(e)},comboChart:function(e){return function(e){return p.jsx("svg",ge({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512.000000 512.000000",children:p.jsxs("g",{transform:"translate(0.000000,512.000000) scale(0.100000,-0.100000)",stroke:"currentColor",children:[p.jsx("path",{d:"M4840 4671 c-138 -42 -207 -183 -151 -306 l18 -40 -337 -483 -337 -483 -74 -2 c-51 -2 -84 -8 -106 -21 l-31 -19 -169 121 c-92 66 -220 158 -283 204 l-115 84 -2 48 c-3 69 -20 113 -60 157 -71 79 -205 93 -296 30 -62 -42 -100 -120 -95 -191 l3 -51 -308 -240 -308 -240 -50 9 c-118 22 -231 -44 -259 -150 -7 -24 -15 -49 -19 -57 -6 -12 -204 -122 -474 -263 l-78 -41 -42 24 c-62 34 -157 33 -219 -4 -26 -15 -56 -39 -68 -54 l-21 -27 -255 39 -255 39 -15 35 c-39 93 -112 141 -211 141 -134 -1 -223 -91 -223 -227 1 -131 92 -223 222 -223 65 0 123 26 170 74 l35 36 224 -35 c123 -19 238 -37 256 -40 24 -4 33 -12 38 -34 8 -39 60 -98 105 -121 58 -30 110 -34 174 -16 94 28 156 107 160 205 l1 37 268 143 c245 131 270 142 285 128 30 -28 106 -57 147 -57 70 0 117 19 166 69 62 61 86 153 60 223 -8 21 14 40 291 256 l300 233 39 -15 c54 -22 136 -20 181 2 l36 19 288 -208 288 -208 3 -51 c3 -62 30 -117 77 -157 46 -42 95 -56 172 -51 81 5 137 42 177 118 30 59 34 104 13 173 l-14 47 342 490 c341 489 341 490 372 484 76 -14 176 39 218 115 32 59 36 152 9 208 -45 96 -167 153 -263 124z"}),p.jsx("path",{d:"M4765 3605 l-25 -24 0 -1544 c0 -1506 0 -1545 19 -1568 18 -23 25 -24 135 -24 107 0 117 2 138 23 l23 23 3 1522 c2 1028 0 1534 -7 1558 -15 49 -43 59 -162 59 -93 0 -102 -2 -124 -25z"}),p.jsx("path",{d:"M2914 3246 c-17 -7 -34 -21 -38 -31 -3 -9 -6 -626 -6 -1370 0 -1317 1 -1353 19 -1376 18 -22 28 -24 129 -27 104 -4 110 -3 138 21 l29 25 0 1361 0 1360 -22 23 c-20 20 -35 23 -120 25 -69 2 -107 -1 -129 -11z"}),p.jsx("path",{d:"M1962 2580 c-12 -11 -24 -31 -27 -43 -3 -12 -4 -478 -3 -1035 l3 -1014 29 -25 c28 -24 34 -25 138 -21 101 3 111 5 129 27 18 23 19 54 19 1055 l0 1033 -23 21 c-21 20 -34 22 -133 22 -97 0 -113 -2 -132 -20z"}),p.jsx("path",{d:"M3842 2593 c-7 -3 -19 -18 -27 -33 -13 -25 -15 -167 -15 -1039 0 -719 3 -1017 11 -1034 17 -37 50 -47 150 -47 94 0 141 14 153 45 3 9 6 478 6 1041 l0 1025 -25 24 c-23 24 -30 25 -132 24 -59 0 -114 -3 -121 -6z"}),p.jsx("path",{d:"M102 1748 c-12 -6 -27 -27 -33 -47 -6 -24 -9 -235 -7 -623 l3 -587 23 -23 c21 -21 31 -23 138 -23 110 0 117 1 135 24 18 22 19 48 19 636 l0 614 -26 20 c-23 18 -40 21 -128 20 -55 0 -111 -5 -124 -11z"}),p.jsx("path",{d:"M1025 1735 l-25 -24 0 -605 c0 -332 3 -612 6 -621 12 -31 59 -45 153 -45 100 0 133 10 150 47 16 34 16 1192 0 1226 -17 37 -50 47 -160 47 -93 0 -102 -2 -124 -25z"})]})}))}(e)},mercatorMap:function(e){return function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{fill:"none"},className:"w-5 h-5"},e,{children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12.75 3.03v.568c0 .334.148.65.405.864l1.068.89c.442.369.535 1.01.216 1.49l-.51.766a2.25 2.25 0 01-1.161.886l-.143.048a1.107 1.107 0 00-.57 1.664c.369.555.169 1.307-.427 1.605L9 13.125l.423 1.059a.956.956 0 01-1.652.928l-.679-.906a1.125 1.125 0 00-1.906.172L4.5 15.75l-.612.153M12.75 3.031a9 9 0 00-8.862 12.872M12.75 3.031a9 9 0 016.69 14.036m0 0l-.177-.529A2.25 2.25 0 0017.128 15H16.5l-.324-.324a1.453 1.453 0 00-2.328.377l-.036.073a1.586 1.586 0 01-.982.816l-.99.282c-.55.157-.894.702-.8 1.267l.073.438c.08.474.49.821.97.821.846 0 1.598.542 1.865 1.345l.215.643m5.276-3.67a9.012 9.012 0 01-5.276 3.67m0 0a9 9 0 01-10.275-4.835M15.75 9c0 .896-.393 1.7-1.016 2.25"})}))}(e)},richText:function(e){return function(e){return p.jsx("svg",ge({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6"},e,{children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"})}))}(e)},progress:function(e){return p.jsx(pv,{valueMax:100,valueNow:64,type:jo.Circular,title:"Progress type",color:(null==(t=e)?void 0:t.color)||"#2d2f31",radius:19,stroke:5});var t},funnelChart:function(e){return p.jsx("svg",ge({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},e,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 2.125C2 1.504 2.504 1 3.125 1h13.5c.621 0 1.125.504 1.125 1.125V5.5c0 .298-.119.585-.33.795l-5.295 5.296v4.034c0 .298-.118.584-.33.796l-2.25 2.25a1.125 1.125 0 0 1-1.92-.796v-6.284L2.329 6.295A1.125 1.125 0 0 1 2 5.5V2.125Z"})}))},custom:function(e){return p.jsx(p.Fragment,{})}},vv=function(e){if(e in gv)return gv[e]},gv={areaChart:"fill",barChart:"fill",horizontalBarChart:"fill",lineChart:"fill",pieChart:"fill",scatterChart:"fill",singleStat:"stroke",dataTable:"fill",basicTable:"fill",comboChart:"fill",mercatorMap:"stroke",funnelChart:"fill",progress:"stopColor"},xv=function(e){return"rowIndex"in e},bv=function(e){return"title"in e},yv=function(e,t){return e.find((function(e){return bv(e)&&e.id===t}))},wv=function(){var e=Pu(),t=e.textOverride,n=e.queryEngineConfig,i=e.customViews,r=iv();if(!r)return null;var o=r.viewOptions(r.dataSet),a=i.filter(bv);if(a&&a.length>0){var l=a.map((function(e){return e.id}));o=[].concat(o,l)}var s=[].concat(o).flatMap((function(e){var i=Co.includes(e)?e:"custom",o=Go(i,{textOverride:t,queryEngineConfig:n});if(!o.setDataAttributesFromPreAggregatedDataSet&&r.dataSet.preAggregated)return[];if("custom"===i){var l=a.find((function(t){return t.id===e}));return l?[{value:"custom",label:l.title,icon:l.Icon(),customViewId:l.id}]:[]}return[{value:e,label:o.title,icon:hv[i]()}]})),u=function(){if("custom"!==r.component.attributes.type)return r.component.attributes.type}();return p.jsx(im,{children:p.jsx(nm,{label:t("view","View"),labelHidden:!0,id:"select-view",testId:"select-view",dynamicWidth:!0,anchorLeft:!0,onChange:function(e,t){var n=s[t];"custom"===n.value&&"customViewId"in n&&n.customViewId?r.onSelectViewType(e,{customView:yv(i,n.customViewId)}):r.onSelectViewType(e)},selected:u,renderOption:function(e){return p.jsx(Cv,ge({},e,{option:"option",iconColorMap:vv(null==e?void 0:e.value)}))},renderSelected:function(e){var t=e;return"custom"===r.component.attributes.type&&(t=s.find((function(e){return"customViewId"in r.component.attributes&&"customViewId"in e&&e.customViewId===r.component.attributes.customViewId}))),p.jsx(Cv,ge({},t,{option:"view",iconColorMap:vv(null==e?void 0:e.value)}))},options:s})})},Cv=function(e){return p.jsxs(yf,{direction:"row",gap:"0.5rem",alignItems:"center",height:"view"===e.option?16:"inline"===e.option?18:20,children:[(null==e?void 0:e.icon)&&p.jsx(Af,{flexPaddingTop:"0",paddingTop:"0",icon:null==e?void 0:e.icon,iconWidth:"horizontalBarChart"===e.value[0]||"barChart"===e.value[0]?"66%":void 0,alignSelf:"center",iconColorMap:e.iconColorMap}),p.jsx(uf,{as:"span",marginY:"0.15rem",children:null==e?void 0:e.label})]})},jv=Yu((function(e){return p.jsx("input",{defaultValue:e.value,"data-testid":e.testId,className:es({backgroundColor:"white",borderRadius:"6px",appearance:"none",borderWidth:"2px",borderStyle:"solid",borderColor:e.error?"#ef4444":"#dbdcdf",textAlign:"left",color:Sl(0),outline:"none",padding:"4px 8px",width:"100%",transitionProperty:"all",lineHeight:"1.25","&:focus":{borderColor:"rgb(224, 242, 255)"}}),type:"datetime-local",onChange:function(t){var n=t.target.value?new Date(t.target.value):null;e.onChange(n)}})}),"renderDateTimeInput"),Fv=function(e){var n=t.useState(!1),i=n[0],r=n[1],o=t.useRef(null),a=Pu().textOverride;Id(o,(function(){r(!1)}));var l=function(){if(e.value&&e.value.unit&&e.value.timeFrame){var t,n=yt(a)[e.value.unit].description,i=wt(a)[e.value.timeFrame].description;return a("date_picker.relative_date","[[value]] [[duration]] in [[timeframe]]",{value:null!=(t=e.value.value)?t:"",duration:n,timeframe:i})}}();return p.jsxs(uf,{position:"relative",flexGrow:1,children:[p.jsx($f,{onClick:function(){return r(!i)},onChange:function(){},label:"Value",labelHidden:!0,readOnly:!0,id:e.id+"_relative_picker_input",value:l,className:es({textTransform:e.value?"lowercase":void 0}),placeholder:"Relative date"}),i&&p.jsx(Sv,{onApply:function(t){r(!1),e.onChange(t)},ref:o,align:"right",initialValue:e.value,id:e.id+"_relative_picker"})]})},Sv=t.forwardRef((function(e,n){var i,r,o,a=e.id,l=t.useState(null!=(i=e.initialValue)?i:{value:null,unit:null,timeFrame:"future"}),s=l[0],u=l[1],d=t.useState(!1),c=d[0],f=d[1];t.useEffect((function(){f(Ft(s))}),[s]);var m=Pu().textOverride,h=Dd(),v=Object.entries(yt(m)).map((function(e){return{label:e[1].description,value:e[0]}})),g=Object.entries(wt(m)).map((function(e){return{label:e[1].description,value:e[0]}}));return p.jsx("div",{ref:n,className:es({position:"absolute",right:"right"===e.align?0:void 0,left:"left"===e.align?0:void 0,zIndex:4294966294}),children:p.jsx("div",{className:kd(""+nh(null==h||null==(r=h.modals)?void 0:r.base),es({padding:"1rem"})),children:p.jsxs(yf,{width:340,direction:"column",gap:"1rem",children:[p.jsx(uf,{children:p.jsxs(yf,{gap:"0.5rem",children:[p.jsx(uf,{width:96,children:p.jsx($f,{onChange:function(e){u(ge({},s,{value:parseFloat(e.target.value)}))},type:"number",label:m("date_picker.value","Relative Value"),labelHidden:!0,value:null!=(o=s.value)?o:void 0,autoFocus:!0,id:a+"_relative_value"})}),p.jsx(uf,{flex:1,children:p.jsx(nm,{label:m("date_picker.unit","Unit"),labelHidden:!0,selected:s.unit,onChange:function(e){u(ge({},s,{unit:e}))},options:v,id:a+"_relative_unit"})}),p.jsx(uf,{flex:1,children:p.jsx(nm,{label:m("date_picker.time_frame","Timeframe"),labelHidden:!0,selected:s.timeFrame,onChange:function(e){u(ge({},s,{timeFrame:e}))},options:g,id:a+"_relative_timeframe"})})]})}),p.jsx(uf,{alignSelf:"right",children:p.jsx(hh,{buttons:"end",children:p.jsx(gh,{onClick:function(){c&&e.onApply(s)},primary:!0,disabled:!c,children:m("date_picker.button","Apply")})})})]})})})})),kv=function(e){return e[e.Relative=0]="Relative",e[e.Fixed=1]="Fixed",e}({});function Av(e){var n,i,r=e.value,o=e.setFilter,a=t.useState(null!=(n=e.options)&&n.disableRelativeDates?kv.Fixed:null!=(i=e.options)&&i.disableFixedDates?kv.Relative:"string"==typeof r||void 0===r?kv.Fixed:kv.Relative),l=a[0],s=a[1];return p.jsxs(yf,{height:"100%",gap:"0.25rem",children:[p.jsxs(yf,{children:[l===kv.Fixed&&p.jsx(jv,{value:r?Oa(new Date(r),"YYYY-MM-DD[T]HH:mm:ss"):void 0,onChange:function(e){var t=e?e.toISOString():null;o({value:t})},testId:""+e.testId}),l===kv.Relative&&p.jsx(Fv,{onChange:function(e){return o({value:e})},value:r,id:e.id})]}),void 0===e.options&&p.jsx(yf,{width:40,children:p.jsx("button",{onClick:function(){s(l===kv.Fixed?kv.Relative:kv.Fixed)},className:es(ge({},Ql.coreButton,{color:"initial",padding:"0.4rem",borderRadius:8},Cl,{"&:hover":ge({},Cl,{opacity:.7,backgroundColor:Sl(90),borderRadius:8,padding:"0.4rem"})})),"aria-label":"Switch to "+(l===kv.Fixed?"relative":"fixed")+" date",children:p.jsx(yd,{})})})]})}function Tv(e){var t=3;return null!=e&&e.hideField&&(t-=1),t}var _v={name:"iykytu",styles:">div{display:none;}&:hover{>div{display:block;}}"},Iv=function(e){var t=Dd();return p.jsxs("button",{css:e.tooltip?_v:"",onClick:e.onChange,disabled:null==e?void 0:e.disabled,className:kd(""+Dv(null==t?void 0:t.icons,e.ignoreThemeSizeOverrides),e.className),"aria-label":e.ariaLabel,children:[!e.ariaLabel&&p.jsx("span",{className:""+Xl,children:e.label}),e.children,e.tooltip&&p.jsx("div",{style:{position:"absolute",top:"calc(100% + 2px)",left:"0",pointerEvents:"none",width:"max-content"},className:""+lh.popover(ge({},null==t?void 0:t.tooltips)),children:e.tooltip})]})},Dv=function(e,t){var n,i;return Fl(ge({},Zl.button,{color:null==e?void 0:e.color,position:"relative",borderRadius:t?8:null==e?void 0:e.borderRadius,padding:t?4:null==e?void 0:e.padding,width:t?"auto":null==e?void 0:e.width,height:t?"auto":null==e?void 0:e.height,"&:hover":{background:null==e||null==(n=e["&:hover"])?void 0:n.background,color:null==e||null==(i=e["&:hover"])?void 0:i.color},"&:disabled":{opacity:.7,background:"transparent"},"&:hover:disabled":{opacity:.7,background:"transparent"}}))},Ov=Object.assign((function(e){return p.jsxs("div",{children:[p.jsxs("div",{children:[p.jsx(Kf,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),e.secondaryAction&&p.jsx("span",{className:es({marginLeft:"12px",opacity:"0.4","&:hover":{opacity:"0.8"}}),children:p.jsx("button",{onClick:function(){var t;return null==(t=e.secondaryAction)?void 0:t.onClick()},children:e.secondaryAction.label})})]}),p.jsx($f,{id:null==e?void 0:e.id,type:"number",min:e.min,max:e.max,onChange:function(t){e.setNumber(parseFloat(t.target.value))},defaultValue:e.currentValue||void 0,"data-testid":e.testId})]})}),{HandleBarSupport:function(e){var n=t.useState(!1),i=n[1];return p.jsx($f,{id:e.testId+"-value-"+e.id,label:e.label,labelHidden:e.labelHidden,"data-testid":e.testId+"-value",type:"text",onChange:function(t){var n=t.target.value,r=function(e){if(""===e)return{isValid:!1,parsedValue:void 0};if(/(\{\{\{|\}\}\})/.test(e))return{isValid:!1,parsedValue:void 0};if(/^\{\{[^}]*$/.test(e)||"{"===e)return{isValid:!1,parsedValue:void 0};if(/^\{\{.+\}\}$/.test(e))return{isValid:!0,parsedValue:e};if(/^-?\d*(\.\d+)?$/.test(e)){var t=parseFloat(e);return{isValid:!isNaN(t),parsedValue:t}}return{isValid:!1,parsedValue:void 0}}(n),o=r.isValid,a=r.parsedValue;(function(e){return!/^\{\{[^}]*$/.test(e)&&"{"!==e&&!/^\{\{.*[^}]\}$/.test(e)})(n)&&i(!o),e.onChange(a)},onBlur:function(){var t,n,r=!(""!==(n="number"==typeof(t=String(e.value))?t.toString():t)&&("string"!=typeof n||!/(\{\{\{|\}\}\})/.test(n))&&!(void 0===n||"{"===n||"string"==typeof n&&/^\{\{[^}]*$/.test(n))&&("string"==typeof n&&/^\{\{.+\}\}$/.test(n)||/^-?\d*(\.\d+)?$/.test(n)));i(r)},defaultValue:e.value,error:n[0]})}}),Ev=function(e,t){return("!="==e||"="==e)&&null===t},Lv=function(e){var n,i,r,o,a,l,s=Dd(),u=Tv(e.options),d=e.textOverride,c=e.id,f=e.filter,m=f.field,h=f.op,v=f.value,g=Yh(e.filter),x=function(t){e.onChange(ge({},e.filter,t))},b=(l=[],Uo(e.dataSet.fields,{removeAggregateMaths:!0,removePercentage:!0}).forEach((function(t,n){l.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n,icon:p.jsx(Af,{icon:t.dataType,paddingTop:0})})})),l);return p.jsxs("div",{className:es(ge({display:"flex"},g&&{borderColor:"#4ade80"})),children:[p.jsxs(Td,{grow:!0,gap:"0.5rem",columns:["repeat("+u+", minmax(0, 1fr))"],children:[!(null!=(n=e.options)&&n.hideField)&&p.jsx("div",{children:p.jsx(nm,{label:d("field","Field"),id:e.testId+"-pick-field-"+c,labelHidden:!0,testId:e.testId+"-pick-field",onChange:function(t,n){var i=void 0;"number"==typeof n&&null!=e&&e.overrideFieldOptions&&(i=null==e?void 0:e.overrideFieldOptions[n].function),x({value:void 0,op:void 0,field:t,function:i})},options:null!=(i=null==e?void 0:e.overrideFieldOptions)?i:b,selected:m,renderSelected:m?function(e){return p.jsx(Cv,ge({},e,{option:"inline"}))}:void 0,controlClassName:""+Ql.pl("0.5rem"),textOverride:d})}),p.jsx("div",{className:es({transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"150ms",opacity:m?"1":"0"}),children:p.jsx(Gh,{queryEngineConfig:e.queryEngineConfig,onChange:function(e){return x(ge({},e))},field:m,testId:e.testId,selected:h,value:v,id:"percentage-operator-"+(null==e?void 0:e.rowIndex)+"-"+c,isAList:m&&"string"==m.dataType,supportedQueryOperators:e.supportedQueryOperators})}),p.jsx("div",{className:es({transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"150ms",opacity:h?"1":"0"}),children:!Ev(h,v)&&p.jsxs(p.Fragment,{children:[m&&"number"==m.dataType&&p.jsx(Ov.HandleBarSupport,{id:c,testId:null!=(r=e.testId)?r:"",onChange:function(e){return x({value:e})},value:v,label:d("value","Value"),labelHidden:!0}),m&&("string"==m.dataType||"string[]"==m.dataType)&&p.jsx(t.Fragment,{children:h&&h in Rv?p.jsx(Nv,{onChange:function(e){return x({value:e})},testId:e.testId+"-value-"+c,value:v,dataSet:e.dataSet,field:m,id:c,multiple:h in Mv,filter:e.filter,options:null==(o=e.options)?void 0:o.selectValueOptions}):p.jsx($f,{label:d("value","Value"),labelHidden:!0,id:e.testId+"-value-"+c,"data-testid":e.testId+"-value",type:"text",onChange:function(e){x({value:e.target.value})},defaultValue:v})}),m&&"boolean"==m.dataType&&p.jsx(nm,{label:d("value","Value"),labelHidden:!0,id:e.testId+"-value-"+c,selected:v,onChange:function(e){return x({value:e})},options:[{label:"True",value:!0},{label:"False",value:!1}],textOverride:d}),m&&"date_time"==m.dataType&&p.jsx(Av,{value:v,setFilter:x,testId:e.testId,id:e.id,options:e.options})]})||p.jsx("p",{})})]}),p.jsx("div",{className:kd(""+Xh.complete(g),es({flex:"none",width:"1.75rem",textAlign:"right",marginLeft:"0.5rem",marginRight:e.hideRemove?"0":"0.5rem"})),children:p.jsx("div",{className:es({padding:4}),children:p.jsx(sh,{tooltipContent:function(){return g?d("filters.filter_is_successfully_defined","Filter is successfully defined"):d("filters.filter_is_not_defined","Filter is not defined")},children:p.jsx(Ju,{})})})}),!e.hideRemove&&p.jsxs(t.Fragment,{children:[p.jsx("div",{className:es({flex:"none",width:2,borderLeft:null==s||null==(a=s.forms)||null==(a=a.input)?void 0:a.border,marginTop:4,marginBottom:4})}),p.jsx("div",{className:es({flex:"none",width:"1.75rem",textAlign:"right",marginLeft:"0.5rem"}),children:p.jsx(sh,{tooltipContent:function(){return null!=e&&e.removeDisabled?d("filters.no_filter_to_remove","No filter to remove"):d("filters.click_to_remove_filter","Click to Remove filter")},children:p.jsx(Iv,{label:d("remove_filter","Remove filter: [[filterNumber]]",{filterNumber:e.rowIndex+1}),onChange:function(){return e.onDelete()},className:"vizzly_reset-button",disabled:null==e?void 0:e.removeDisabled,children:p.jsx($u,{purpose:"removeFilter"})})})})]})]})},Nv=function(e){var n,i=e.value,r=function(e,n){var i,r=qm().runQueriesCallback,o=Pu().variables,a=t.useState(void 0),l=a[0],s=a[1],u=Qo(e,n);return i="string[]"==u.dataType?[wi(e.id,u).query]:[Ci(e,n)],$h(i,r,(function(e){null===e&&s(null),e&&s(e[0])}),{},e,void 0,o),{result:null!=l?l:null,loading:void 0===l,error:null===l}}(null==e?void 0:e.dataSet,e.field.id).result,o=Pu(),a=o.textOverride,l=o.valueAlias,s=o.nullValueAlias,u=null!=e&&e.options?e.options:(null==r?void 0:r.content.map((function(t,n){var i,r,o,a=t[0],l=a;return null===a&&(s&&(i=null!=(r=s({dataSetId:null==e||null==(o=e.dataSet)?void 0:o.id,fieldId:e.field.id}))?r:void 0),l=et(a,void 0,i)),{value:a,label:l,testId:e.testId+"-pick-field-"+n}})))||[];return null!=e&&e.multiple?p.jsx(ev,{label:a("values","Values"),id:"select-multiple-value-"+e.id,labelHidden:!0,setSelected:function(t){return null==e?void 0:e.onChange(t.map((function(e){return u[e].value})))},selected:(n=[],null==u||u.forEach((function(e,t){i&&i.includes(e.value)&&n.push(t)})),n),options:u,textOverride:a}):p.jsx(nm,{testId:null==e?void 0:e.testId,label:a("value","Value"),labelHidden:!0,id:"select-single-value-"+e.id,selected:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t)},options:u,textOverride:a,hasFreeText:!0,formatLabel:function(t){var n,i;return null!=(n=ul(t,l,{fieldId:null==(i=e.field)?void 0:i.id}))?n:t}})},Mv={array_contains:"array_contains",array_does_not_contain:"array_does_not_contain",is_one_of:"is_one_of",is_not_one_of:"is_not_one_of",array_contains_any_of:"array_contains_any_of",array_contains_all_of:"array_contains_all_of"},Rv=ge({"=":"=","!=":"!="},Mv),Pv=function(e){var n=t.useState("initial"),i=n[0],r=n[1],o=e.autoFeedback?me(Ce().mark((function t(){var n;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=!1,!e.onClick){t.next=7;break}return r("loading"),t.next=5,e.onClick();case 5:r((n=!!t.sent)?"success":"error");case 7:return t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)}))):e.onClick,a=(e.error||"error"==i?"error":(e.isLoading||"loading"==i)&&"loading")||(e.success||"success"==i)&&"success"||i;return p.jsxs(gh,{testId:e.testId,error:"error"==a,isLoading:"loading"==a,primary:!e.secondary,secondary:e.secondary,onClick:o,type:e.type,disabled:e.disabled,"data-component":null==e?void 0:e["data-component"],block:null==e?void 0:e.block,internal:null==e?void 0:e.internal,className:null==e?void 0:e.className,themeOverride:null==e?void 0:e.themeOverride,icon:e.icon,onMouseEnter:e.onMouseEnter,children:[p.jsx("div",{className:es(ge({},"loading"==a&&{visibility:"hidden"})),children:e.children}),"loading"==a&&p.jsx("div",{className:es({display:"grid",placeContent:"center"}),children:p.jsx(Lf,{color:"white"})})]})},zv=function(e){var t=e.textOverride,n=Tv(e.options),i=1===e.maxOrFilters;return p.jsxs(p.Fragment,{children:[e.wipFilters.map((function(r,o){var a,l=null!=e&&e.maxOrFilters?Math.min(null==e?void 0:e.maxOrFilters,r.length):r.length;return p.jsxs("div",{children:[0!=o&&p.jsx(Vv,{marginBottom:16,children:p.jsx("span",{className:es({padding:".6rem 1rem",fontSize:14,letterSpacing:"normal",transform:"translateY(0) scale(1)"}),children:p.jsx("strong",{children:t("filters.or","OR")})})}),p.jsxs("div",{children:[!e.removeHeadings&&p.jsxs("div",{className:es({display:"flex"}),children:[p.jsxs(Td,{grow:!0,gap:"0.5rem",columns:["repeat("+n+", minmax(0, 1fr))"],children:[!(null!=(a=e.options)&&a.hideField)&&p.jsx("div",{children:p.jsx(Kf,{as:"span",children:e.fieldHeadingOverride||t("field","Field")})}),p.jsx("div",{children:p.jsx(Kf,{as:"span",children:t("operator","Operator")})}),p.jsx("div",{children:p.jsx(Kf,{as:"span",children:t("value","Value")})})]}),p.jsx("div",{className:es({flex:"none",width:i?"1.75rem":"3.5rem"})})]}),r.slice(0,l).map((function(n,a){return p.jsx("div",{className:es({marginBottom:"8px"}),children:p.jsx(Lv,{id:"filter-"+o+"-"+a,queryEngineConfig:e.queryEngineConfig,testId:"filter-"+o+"-"+a,filter:n,dataSet:e.dataSet,onChange:function(t){e.updateWipFilter(t,o,a)},onDelete:function(){e.deleteWipFilter(o,a)},rowIndex:a,removeDisabled:void 0!==e.removeLastEnabled?!e.removeLastEnabled:r.length<=1||r.length===a+1,overrideFieldOptions:null==e?void 0:e.overrideFieldOptions,hideRemove:i,textOverride:t,supportedQueryOperators:e.supportedQueryOperators,options:e.options})},"filter_"+o+"_"+a)}))]})]},"filter_"+o)})),e.onAddOrFilter&&p.jsx(Vv,{children:p.jsx(sh,{tooltipContent:function(){return"Add OR filter"},children:p.jsx(Pv,{secondary:!0,onClick:function(){return e.onAddOrFilter&&e.onAddOrFilter()},testId:"add-rule-btn",className:es({background:"transparent"}),children:t("filters.plus_or_filter","+ OR Filter")})})}),e.actionsRight&&p.jsx(uf,{children:p.jsxs(yf,{justifyContent:"space-between",children:[p.jsx("div",{}),p.jsx("div",{children:e.actionsRight})]})})]})},Vv=function(e){var t;return p.jsx("div",{className:es({display:"inline-flex",width:"100%",alignItems:"center",justifyContent:"center",marginTop:16,marginBottom:null!=(t=null==e?void 0:e.marginBottom)?t:8,height:15}),children:e.children})};function qv(e,t,n,i){return ge({},e,i&&!!(r=n[t])&&r.validDataTypes.includes(e.dataType)&&function(e,t){return"string"==typeof e&&t.hasOwnProperty(e)}(t,n)&&{dataType:"number",allowedOperators:[">","<","=","!=",">=","<=","is_one_of","is_not_one_of"]});var r}function Bv(e,t,n,i){return[].concat(e).map((function(e){return[].concat(e).map((function(e){var r;return ge({},e,{field:qv(Qo(t,e.field),null!=(r=e.function)?r:"none",n,i)})}))}))}function Wv(e,t){return[].concat(e).map((function(e){return[].concat(e).flatMap((function(e){var n;return Yh(e,1===t.maxFilters)?[{op:e.op,value:e.value,field:null==(n=e.field)?void 0:n.id,function:e.function}]:[]}))})).filter((function(e){return!r.isEmpty(e)}))}var Hv=function(e,i,o,a){var l;void 0===a&&(a={startWithEmptyField:!1,maxFilters:void 0,enableChangeToNumber:!1});var s=Bv(e,i,o,a.enableChangeToNumber),u=n.useState(s),d=u[0],c=u[1];t.useEffect((function(){c(Bv(e,i,o,a.enableChangeToNumber))}),[JSON.stringify(e)]);var p={field:null!=(l=a)&&l.startWithEmptyField?void 0:i.fields[0],op:void 0,value:void 0};r.isEmpty(d)&&(d=[[p]]);var f=[].concat(d).map((function(e){var t=e[e.length-1];return t&&Yh(t)?[].concat(e,[p]):[].concat(e)}));return{addOrFilter:function(){var e=[].concat(d);e.push([p]),c(e)},deleteWipFilter:function(e,t){var n=d;return n[e].splice(t,1),r.isEmpty(n[e])&&n.splice(e,1),c([].concat(n)),Wv(d,a)},updateWipFilter:function(e,t,n){var i=d;i[t][n]=e,c([].concat(i))},completedFilters:Wv(d,a),wipFilters:f}},Yv=function(e,t){var n=t.map((function(e){return e.dataSetId}));return e.filter((function(e){return n.includes(e.id)})).map((function(e){return ge({},e,{fields:e.fields.filter((function(n){return t.some((function(t){return t.fieldId===n.id&&t.dataSetId===e.id}))}))})}))};function Gv(e,t){return[].concat(Object.keys(e.supportedOperators)).flatMap((function(n,i){return t.includes(n)?{label:e.supportedOperators[n].publicName,value:n,testId:"pick-op-"+i}:[]}))}var Uv=function(e){var n,i,r=((i=e.data).forEach((function(e){})),{id:"aggregated-dataset",name:"Aggregated Dataset",fields:[i[0].fields[0]]}),a=e.textOverride,l=Hv(null!=(n=e.relative)?n:[],r,e.queryEngineConfig.supportedAggregates),s=l.completedFilters,u=l.wipFilters,d=l.deleteWipFilter,c=l.updateWipFilter;return t.useEffect((function(){o.isEqual(e.relative,s)||e.setState({type:Kv.Relative,fixed:void 0,relative:s})}),[s]),p.jsxs(t.Fragment,{children:[p.jsx(zh,{paddingTop:0,children:p.jsx(yf,{direction:"column",gap:"0.5rem",children:p.jsx(uf,{children:p.jsx(zv,{wipFilters:u,completedFilters:s,dataSet:r,updateWipFilter:c,queryEngineConfig:e.queryEngineConfig,deleteWipFilter:d,textOverride:null!=a?a:zo,options:{disableFixedDates:!0,hideField:!0},supportedQueryOperators:Gv(e.queryEngineConfig,["<","<=",">",">="])})})})}),p.jsx(Ph,{onClearAll:e.onClearAll,textOverride:e.textOverride,onCancel:e.onCancel,onApply:e.onApply,applyDisabled:0===s.length,showClearBtn:!0})]})},Kv=function(e){return e[e.Fixed=0]="Fixed",e[e.Relative=1]="Relative",e}({}),Xv=Hu((function(e){var n,i,r,o,a,l,s,u=e.startDate,d=e.endDate,c=e.datePickerFormat,f=e.onChange,m=e.id,h=e.prefix,v=e.onClear,g=e.label,x=e.type,b=e.textOverride,y="MM/DD/YYYY"===c?"MM/DD/YYYY":"YYYY/MM/DD"===c?"YYYY/MM/DD":"DD/MM/YYYY",C=null!=(n=e.timeFormat)?n:"HH:mm",j=t.useState(function(e,t,n){return{start:e?th(e,t):null,end:n?th(n,t):null}}(e.startTime,C,e.endTime)),F=j[0],S=j[1],k=t.useState({}),A=k[0],T=k[1],_=t.useState(e.relative?{relative:e.relative,type:Kv.Relative}:{fixed:{start:u?w(u):null,end:d?w(d):null},type:Kv.Fixed}),I=_[0],D=_[1],O=Dd(),E=t.useState(!1),L=E[0],N=E[1],M=function(){N(!1),e.onOpenChange&&e.onOpenChange(!1)},R=function(){N(!0),e.onOpenChange&&e.onOpenChange(!0)};t.useEffect((function(){var t,n;!e.showCustom||null!=(t=I.fixed)&&t.end||null!=(n=I.fixed)&&n.start||I.relative||R()}),[e.showCustom]);var P=t.useRef(null),z=t.useState(0),V=z[0],q=z[1];t.useEffect((function(){P.current&&q(P.current.getBoundingClientRect().height)}),[P.current]);var B=function(){var e,t,n,i,r,o,a,l,s,u;null!=(e=I.fixed)&&e.start&&null!=(t=I.fixed)&&t.end&&f((a="date_time"===x?w(null!=(n=null==F?void 0:F.start)?n:"00:00","HH:mm"):null,l=null==(i=I.fixed)?void 0:i.start.toDate(),s="date_time"===x?w(null!=(r=null==F?void 0:F.end)?r:"00:00","HH:mm"):null,u=null==(o=I.fixed)?void 0:o.end.toDate(),{start:mh(l,a||w("00:00","HH:mm")),end:mh(u,s||w("23:59","HH:mm"))})),I.relative&&f(I.relative),M()},W=t.useRef(null),H=function(){e.startDate||e.endDate||e.relative?(e.startDate&&e.endDate&&D({fixed:{end:w(e.endDate),start:w(e.startDate)},relative:void 0,type:Kv.Fixed}),e.relative&&D({relative:e.relative,type:Kv.Relative}),S({start:e.startTime?th(e.startTime,C):null,end:e.endTime?th(e.endTime,C):null}),M()):e.setShowCustom&&e.setShowCustom(!1)};Id(W,(function(){H()}));var Y=function(){D({fixed:{end:null,start:null},relative:void 0,type:Kv.Fixed}),S({start:null,end:null}),f(null),M(),e.setShowCustom&&e.setShowCustom(!1)};return bh(L,P,V,T),p.jsxs("div",{className:kd(""+Jm.wrapper,es({minWidth:null!=e&&e.fixedWidth?(null==e?void 0:e.fixedWidth)+34:"100%"})),id:""+(null!=m?m:"date-picker"),"data-component":"date-picker",children:[p.jsx("div",{className:kd(""+Jm.inputsWrapper(null==O||null==(i=O.forms)?void 0:i.dateTime,L),es({width:"100%"})),"data-themeapi":"forms.dateTime.input",onClick:function(){return R()},ref:P,children:p.jsx(ch,{prefix:h,label:g,timeFormat:C,dateFormat:y,pickerOpen:L,datesDefined:!(!u||!d)||!!e.relative,type:x,onClearAll:Y,textOverride:b,startDate:null!=(r=null==(o=I.fixed)?void 0:o.start)?r:null,time:F,endDate:null!=(a=null==(l=I.fixed)?void 0:l.end)?a:null,state:I})}),L&&p.jsx(gp,{open:L,onClose:H,className:kd("vizzly_picker",es(ge({position:"fixed",top:V+2,overflowY:void 0,overflowX:void 0,zIndex:21474831470},A))),children:p.jsxs(gp.Panel,{className:"relative z-10",style:{width:648},children:[p.jsx("h1",{className:""+Xl,children:"Date Picker"}),p.jsx("div",{className:kd(""+nh(null==O||null==(s=O.modals)?void 0:s.base)),children:p.jsxs(Hh.Group,{defaultIndex:I.type,onChange:function(e){D(ge({},I,{type:e}))},className:es({flexGrow:1,display:"flex",flexDirection:"column"}),children:[p.jsx(zh,{paddingBottom:0,children:p.jsxs(Hh.List,{columns:"1fr 1fr",padding:0,children:[p.jsx(Hh.Button,{"data-component":"tab-fixed",children:b?b("date_picker.fixed","Fixed"):"Fixed"}),p.jsx(Hh.Button,{"data-component":"tab-relative",children:b?b("date_picker.relative","Relative"):"Relative"})]})}),p.jsxs(Hh.Panels,{className:es({height:"100%",flexGrow:1}),children:[p.jsx(Hh.Panel,{className:es({flexGrow:1,display:"flex",flexDirection:"column"}),paddingLeft:0,paddingRight:0,children:p.jsx(Vh,{dateFormat:y,textOverride:b,fixed:I.fixed,onApply:B,setState:D,type:x,onCancel:H,onClearAll:Y,setTime:S,timeFormat:C,time:F,onClear:v})}),e.queryEngineConfig&&e.data?p.jsx(Hh.Panel,{className:es({flexGrow:1,display:"flex",flexDirection:"column"}),paddingLeft:0,paddingRight:0,children:p.jsx(Uv,{textOverride:b,onClearAll:Y,onCancel:H,onApply:B,queryEngineConfig:e.queryEngineConfig,data:e.data,relative:I.relative,setState:D})}):p.jsx("div",{children:"appliesToFields, queryEngineConfig and data are undefined"})]})]})})]})})]})}),"renderDateTimeRangeInput",(function(e){return ge({},e)})),Qv=function(e){var n=e.placeholder,i=e.dateFilterOptions,r=e.onChangeToTimeRange,o=e.showClearBtn,a=e.textOverride,l=t.useState(e.currentValue),s=l[0],u=l[1],d=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return r&&(d=[].concat(d,[{label:a?a("custom_range","Custom range"):"Custom range",value:"__vizzly_custom"}])),p.jsx(nm,{showClearBtn:void 0===o||o,options:d,onChange:function(t){"__vizzly_custom"===t?(u(t),e.onChangeToTimeRange&&e.onChangeToTimeRange()):(u(t),e.onChange&&e.onChange(t))},selected:s,anchorLeft:!0,placeholder:n,selectedPrefix:null!=e&&e.hasSelectedPrefix?n+" · ":void 0,maintainOptionOrder:!0,textOverride:a,fixedWidth:null==e?void 0:e.fixedWidth,label:n,labelHidden:!0,id:null==e?void 0:e.id,dropdownForFilter:e.dropdownForFilter})},Zv=function(e){var n,i,o,a,l,s=e.hasCustomPicker,u=e.allowTimeSelection,d=function(){if("value"in e.currentValue){var t,n,i;if("fixedRange"===(null==(t=e.currentValue.value)?void 0:t.type))return{fixedRange:e.currentValue.value};if("relativeRange"===(null==(n=e.currentValue.value)?void 0:n.type))return{relativeRange:e.currentValue.value};if("relative"===(null==(i=e.currentValue.value)?void 0:i.type))return{relative:e.currentValue.value}}}(),c=(null==d||null==(n=d.fixedRange)?void 0:n.after)||void 0,f=(null==d||null==(i=d.fixedRange)?void 0:i.before)||void 0,m=function(e){return e instanceof Date?e:"string"==typeof e?new Date(e):void 0},h=function(e){if(u&&e instanceof Date)return null==e?void 0:e.toLocaleTimeString()},v=t.useState(!!(null!=d&&d.relativeRange||null!=d&&d.fixedRange)),g=v[0],x=v[1];return p.jsxs(t.Fragment,{children:[!g&&p.jsx(Qv,{showClearBtn:e.showClearBtn,dateFilterOptions:e.dateFilterOptions,placeholder:null==e?void 0:e.placeholder,fixedWidth:null==e?void 0:e.fixedWidth,dropdownForFilter:!0,onChangeToTimeRange:function(){x(!0)},onChange:function(t){s&&x(!1),e.onChange&&e.onChange(t)},currentValue:null!=(o=null==d||null==(a=d.relative)?void 0:a.value)?o:null,hasSelectedPrefix:!0,custom:s,textOverride:e.textOverride,id:null==e?void 0:e.id}),s&&g&&p.jsx(Xv,{fixedWidth:e.fixedWidth,label:null==e?void 0:e.placeholder,id:null==e?void 0:e.id,startDate:c,endDate:f,startTime:h(m(c)),endTime:h(m(f)),relative:null==d||null==(l=d.relativeRange)?void 0:l.filters,datePickerFormat:e.datePickerFormat,queryEngineConfig:e.queryEngineConfig,onOpenChange:e.onOpenChange,data:e.data,onChange:function(t){return null===t?e.onChange(null):function(e){return r.isArray(e)}(t)?e.onChange(t):e.onChange(t&&"start"in t&&"end"in t&&null!==t.start&&null!==t.end?{startDate:t.start,endDate:t.end}:null)},prefix:!0,onClear:function(){null==e||e.onChange(null),x(!1)},setShowCustom:x,showCustom:g,type:u?"date_time":"date",textOverride:e.textOverride})]})},Jv=function(e){var t,n,i=Dd(),o=Pu(),a=o.textOverride,l=o.featureToggles,s=o.queryEngineConfig,u=o.datePickerFormat,d=e.onChange,c=e.filter,f=e.dataSets,m=e.showClearBtn,h=e.type,v=Nt(c,f,a),g=Gm(v,null==i||null==(t=i.forms)?void 0:t.select),x=!("dateFilter"!==h||!("allowTimeSelection"in c)||!c.allowTimeSelection);return e.filter.hidden?null:p.jsx(uf,{minWidth:g,width:l.forceMobile?"100%":void 0,children:p.jsx(Zv,{hasCustomPicker:!0,showClearBtn:m,fixedWidth:g,dateFilterOptions:null==e?void 0:e.dateFilterOptions,datePickerFormat:u,queryEngineConfig:s,data:Yv(f,c.appliesToFields),allowTimeSelection:x,onChange:function(e){return d(function(e,t,n){var i=ge({type:e,appliesToFields:t.appliesToFields,title:t.title,managedByConfiguration:t.managedByConfiguration,requiresValue:t.requiresValue,inclusiveDate:t.inclusiveDate},"dateFilter"===t.type&&{allowTimeSelection:t.allowTimeSelection},{value:null});return"string"==typeof n?i=ge({},i,{value:{type:"relative",value:n}}):n&&"endDate"in n&&n.endDate&&n.startDate?i=ge({},i,{value:{type:"fixedRange",before:n.endDate,after:n.startDate}}):r.isArray(n)?i=ge({},i,{value:{type:"relativeRange",filters:n}}):null===n&&(i=ge({},i,{value:null})),i}(h,c,e))},currentValue:c,placeholder:v,textOverride:a,id:qe(null!=(n=e.filter.title)?n:"")+"_"+e.filter.type,onOpenChange:e.onOpenChange})})},$v=function(e,t,n){if(e.length>0){var i=null==t?void 0:t.filter((function(t){return e.find((function(e){return e===t.value}))})).map((function(e){return e.label})).join(", ");return[{full:i?[i]:e,op:null!=n?n:"is_one_of"}]}},eg=function(e,t,n){var i;return null!=(i=n[e])&&i.publicName?"is_one_of"===e||"is_not_one_of"===e||"number"==typeof t?n[e].publicName+" "+(null!=t?t:"Unknown"):"does_not_contain_substring"===e?'Does not contain "'+t+'"':"contains_substring"===e?'Contains "'+t+'"':n[e].publicName+' "'+t+'"':""+t},tg=function(e){var n=e.chips,i=Pu(),o=i.textOverride,a=i.queryEngineConfig;return p.jsx(dh,{padding:"0 0.30rem 0 0",children:n.map((function(e){return void 0===e?null:r.isArray(e)&&e.length>0?p.jsx(dh.Selected,{label:e.map((function(e){return eg(e.op,e.full,a.supportedOperators)})).join(" AND "),disableClear:!0,onRemove:function(){},textOverride:o},JSON.stringify(e)):r.isArray(e.full)&&e.full.length>1?p.jsx(sh,{tooltipContent:function(){return p.jsxs(sh.Content,{children:[a.supportedOperators[e.op].publicName," ",r.isArray(e.full)&&e.full.map((function(n,i){return p.jsxs(t.Fragment,{children:[n,e.full.length!==i+1&&", "]},i)}))]})},children:p.jsx(dh.Selected,{label:eg(e.op,e.full[0],a.supportedOperators)+(e.full.length>1?", "+(e.full.length-1)+" more":""),disableClear:!0,onRemove:function(){},textOverride:o})},JSON.stringify(e)):p.jsx(dh.Selected,{label:r.isArray(e.full)?eg(e.op,e.full[0],a.supportedOperators):eg(e.op,e.full,a.supportedOperators),disableClear:!0,onRemove:function(){},textOverride:o},JSON.stringify(e))}))})},ng=function(e){var n,i,r,o,a,l,s=Dd(),u=e.pickerOpen||!e.defined,d=Ym(null!=(n=null==e?void 0:e.label)?n:"","label",{fontSize:null==s||null==(i=s.forms)||null==(i=i.input)?void 0:i.fontSize,fontWeight:null==s||null==(r=s.forms)||null==(r=r.input)?void 0:r.fontWeight}),c=function(e,t,n){return kn(e.value)?(i=e.value,r=n,o=[],Array.isArray(i)&&Array.isArray(i[0])&&(o=i.map((function(e){if(Array.isArray(e)&&e.length>0&&void 0!==e[0].value){if(e.length>1){var t=e[0].field,n=e.filter((function(e){return e.field===t})),i=[];return n.forEach((function(e){var t=null==r?void 0:r.filter((function(t){return e.value.find((function(e){return e===t.value}))})).map((function(e){return e.label})).join(", ");i.push({full:t?[t]:e.value,op:e.op})})),i}var o=null==r?void 0:r.filter((function(t){return e[0].value.find((function(e){return e===t.value}))})).map((function(e){return e.label})).join(", ");return{full:o?[o]:e[0].value,op:e[0].op}}return null})).filter((function(e){return null!==e}))),o):"boolean"===t?"boolean"==typeof e.value?e.value:void 0:"number"===t?"number"==typeof e.value?e.value:void 0:null!==e.value&&"object"==typeof e.value&&"op"in e.value&&"value"in e.value?$v([e.value.value.toString()],n,e.value.op):null!==e.value&&Array.isArray(e.value)&&e.value.length>0?$v(e.value,n,"is_one_of"):void 0;var i,r,o}(e.filter,e.type,e.filter.options);return p.jsx("div",{onClick:function(){return e.onClick(!u)},className:es({position:"relative",height:"100%"}),"data-component":"advanced-display-values",children:p.jsxs(yf,{alignItems:"center",width:"100%",height:"100%",as:"fieldset",position:"relative","data-component":"advanced-display-values",gap:"0.5rem",paddingTop:5,paddingBottom:6,children:[e.prefix&&p.jsxs("label",{className:kd(""+Jm.prefixStyle(),es({maxWidth:d+20,paddingLeft:"1rem"})),children:[null!=(o=e.label)?o:"Custom"," ",c&&c.length>0&&"·"]}),!u&&p.jsx(t.Fragment,{children:c&&c.length>0&&p.jsx(tg,{chips:c})}),p.jsx("div",{className:es({width:26.5})}),p.jsx("div",{className:kd(zf.arrowContainer(null==s||null==(a=s.forms)?void 0:a.select,26.5)({subtle:"off"}),es({position:"absolute",top:0,bottom:0,right:0})),children:p.jsx(qf,{label:"open",arrowStart:"up",styled:null==s||null==(l=s.forms)?void 0:l.select,expanded:u})})]})})},ig=Hu((function(e){var n=t.useState(!1),i=n[0],o=n[1],a=t.useState([]),l=a[0],s=a[1],u=t.useState(!1),d=u[0],c=u[1],f=e.filter,m=e.dataSets,h=e.filter.requiresValue,v=Pu(),g=v.textOverride,x=v.valueAlias,b=qm().runQueriesCallback,y=Nt(f,m,g),w=function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.filter.options){t.next=2;break}return t.abrupt("return",e.filter.options);case 2:return t.next=4,Hm(Wt(f),b,x)(n);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),C=function(){o(!1),e.onOpenChange&&e.onOpenChange(!1)};t.useEffect((function(){!function(){var t=me(Ce().mark((function t(){var n,i,o,a;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!f.requiresValue||!(null===f.value||r.isArray(f.value)&&0===(null==(n=f.value)?void 0:n.length))){t.next=11;break}if(o=new AbortController,null==(i=e.filter)||!i.options){t.next=6;break}t.t0=e.filter.options,t.next=9;break;case 6:return t.next=8,w(o.signal);case 8:t.t0=t.sent;case 9:(a=t.t0)&&a[0]?(Ke("Filter forcing initial value to be set."),e.onChange(ge({},f,{value:[a[0].value]}))):Ze("Ran select filter options to force a value, but no results were returned.");case 11:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify(f)]);var j=function(){e.onChange(f),C()},F=function(){var t=ge({},f,{value:null});e.onChange(t),C()},S=0===function(){var e=f.appliesToFields[0].dataSetId,t=Ko(m,e);if(!t)throw"Failed to find data set "+e;return ge({},t,{fields:[Qo(t,f.appliesToFields[0].fieldId)]})}().fields[0].allowedOperators.length,k=h&&d,A=e.filter.type+"-filter";return p.jsxs(Rh,{label:y,onCancel:function(){return j()},hidden:e.filter.hidden,id:A,open:i,filterIndex:e.filterIndex,display:p.jsx(ng,{onClick:function(t){t&&(o(!0),e.onOpenChange&&e.onOpenChange(!0)),t||j()},pickerOpen:i,defined:!0,onClearAll:F,label:y,prefix:!0,filter:f,type:e.type,clearDisabled:k,id:A+"-"+e.filterIndex}),children:[p.jsx(zh,{children:p.jsx(Td,{gap:"1rem",children:p.jsx(rg,{filter:f,dataSets:m,type:e.type,setCompletedFilters:s,setDoNotAllowClear:c})})}),p.jsx(Ph,{onCancel:function(){return j()},onClearAll:F,onApply:function(){var t;(null==l||null==(t=l[0])?void 0:t.length)>0?(e.onChange(ge({},f,{value:l})),C()):F()},textOverride:g,applyDisabled:k||S,clearDisabled:k,showClearBtn:e.showClearBtn})]})}),"renderAdvancedFilter"),rg=function(e){var n=e.filter,i=e.dataSets,o=Pu(),a=o.textOverride,l=o.queryEngineConfig,s=function(){var e=n.appliesToFields[0].dataSetId,t=Ko(i,e);if(!t)throw"Failed to find data set "+e;return ge({},t,{fields:[Qo(t,n.appliesToFields[0].fieldId)]})},u=Hv(function(e,t){if(null===e.value||r.isArray(e.value)&&0===e.value.length)return[];if(kn(e.value)&&r.isArray(e.value)&&r.isArray(e.value[0]))return e.value;if("string"===t)return[[{field:e.appliesToFields[0].fieldId,op:"is_one_of",value:e.value}]];if("number"===t){var n,i=e.value;return[[{field:e.appliesToFields[0].fieldId,op:null!=(n=null==i?void 0:i.op)?n:"=",value:null==i?void 0:i.value}]]}return[]}(n,e.type),s(),l.supportedAggregates),d=u.completedFilters,c=u.addOrFilter,f=u.wipFilters,m=u.deleteWipFilter,h=u.updateWipFilter;return t.useEffect((function(){e.setCompletedFilters(d)}),[JSON.stringify(d)]),t.useEffect((function(){var t;0===(null==f||null==(t=f[0])||null==(t=t[0].value)?void 0:t.length)&&e.setDoNotAllowClear(!0)}),[JSON.stringify(f)]),p.jsx(yf,{direction:"column",gap:"0.5rem",children:p.jsx(uf,{children:p.jsx(zv,{wipFilters:f,completedFilters:d,dataSet:s(),updateWipFilter:function(e,t,n){return h(function(e,t,n,i){var r,o,a=null==(r=t[n])?void 0:r[i],l=e;return"number"!==(null==(o=l.field)?void 0:o.dataType)&&(null==a?void 0:a.op)!==l.op&&void 0!==(null==a?void 0:a.value)&&(l.value=void 0),l}(e,d,t,n),t,n)},queryEngineConfig:l,deleteWipFilter:m,textOverride:null!=a?a:zo,options:{hideField:!0,selectValueOptions:e.filter.options},onAddOrFilter:function(){return c()}})})})},og=function(e){var n,i,r,o,a=Dd(),l=t.useRef(void 0),s=Pu(),u=s.cascadeFilterSelection,d=s.textOverride,c=s.featureToggles,f=s.valueAlias,m=qm().runQueriesCallback,h=e.filter,v=e.filterIndex,g=e.dataSets,x=e.onChange,b=t.useState(null),y=b[0],w=b[1],C=t.useState(!1),j=C[0],F=C[1],S=function(){var t=me(Ce().mark((function t(n){var i;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.filter.options){t.next=3;break}return w(e.filter.options),t.abrupt("return",e.filter.options);case 3:return t.next=5,Hm(Wt(h),m,f)(n);case 5:return w(i=t.sent),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var e=me(Ce().mark((function e(){var t,n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(y){e.next=7;break}return F(!0),t=new AbortController,e.next=5,S(t.signal);case 5:(n=e.sent)&&n[0]?(Ke("Filter forcing initial value to be set."),F(!1),w(n)):Ze("Ran select filter options to force a value, but no results were returned.");case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=me(Ce().mark((function e(){var t,n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!h.requiresValue||null!==h.value&&0!==h.value.length){e.next=6;break}return t=new AbortController,e.next=4,S(t.signal);case 4:(n=e.sent)&&n[0]?(Ke("Filter forcing initial value to be set."),w(n),x(ge({},h,{value:[n[0].value]}))):Ze("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(h)]);var A=Nt(h,g,d),T=t.useState([]),_=T[0],I=T[1];t.useEffect((function(){null!=h&&h.value&&!kn(h.value)?y&&(null==y?void 0:y.length)>0?I(function(e,t){return t.reduce((function(t,n,i){return e&&e.includes(n.value)&&t.push(i),t}),[])}(null==h?void 0:h.value,y)):k():I([])}),[h,y]),t.useEffect((function(){u&&null!==l.current&&JSON.stringify(l.current)!==JSON.stringify(h.optionsFilters)&&w(null),l.current=h.optionsFilters}),[h.optionsFilters]);var D=Gm(A,null==a||null==(n=a.forms)?void 0:n.select);return e.filter.hidden?null:p.jsx(uf,{minWidth:D+36,"data-component":"multi-select-filter",width:c.forceMobile?"100%":void 0,children:p.jsx(ev,{options:y||S,setSelected:function(t){y&&e.onChange(ge({},h,{value:t.map((function(e){var t;return null==(t=y[e])?void 0:t.value})).filter((function(e){return void 0!==e}))}))},selected:_,isLoading:j,id:"filter-"+v,disableClearAll:!(null!=e&&e.showClearBtn)&&1===(null==(i=h.value)?void 0:i.length),selectedPrefix:A+(null!=(r=h.value)&&r.length&&(null==(o=h.value)?void 0:o.length)>0?" · ":""),showableChips:1,textOverride:d,labelWidth:D,label:A,labelHidden:!0,dropdownForFilter:!0,isFilter:!0},"filter-"+v)})},ag=function(e){var t=e.filter,n=e.filterIndex,i=e.onChange,r=e.shouldAlwaysHaveValue,o=Pu(),a=o.queryEngineConfig,l=o.featureToggles,s=function(e){var t=li(a,e.requiresValue).validate(e).error;t?Je("Invalid additional filter. Therefore ignoring the change",t,e):i(e)},u=function(n){r&&null==n.value?"dateAndTimeFilter"!==t.type&&"dateFilter"!==t.type||s(ge({type:t.type,appliesToFields:t.appliesToFields,title:t.title,value:{type:"relative",value:Object.keys(null==e?void 0:e.dateFilterOptions)[0]},requiresValue:t.requiresValue,managedByConfiguration:t.managedByConfiguration,inclusiveDate:t.inclusiveDate},"dateFilter"===t.type&&{allowTimeSelection:t.allowTimeSelection})):s(n)},d=function(e,t){var n;if("singleSelectFilter"!=e.type&&"dateFilter"!=e.type&&"dateAndTimeFilter"!=e.type){var i=null==(n=e.appliesToFields)||null==(n=n[0])?void 0:n.dataSetId;if(i){var r=Ko(t,i);if(r)return Qo(r,e.appliesToFields[0].fieldId).dataType;Je("Failed to find data set to get filter type")}else Je("Failed to find data set id to get filter type")}}(t,e.dataSets);return t.appliesToFields.length>0?"singleSelectFilter"==t.type?p.jsx(Um,{showClearBtn:!r,filter:t,filterIndex:n,onChange:u,dataSets:e.dataSets},"boolean"==typeof e.filter.value?void 0:JSON.stringify(e.filter.value)):"multiSelectFilter"==t.type&&l.simpleMultiSelectFilter?p.jsx(og,{showClearBtn:!r,filter:t,filterIndex:n,onChange:u,dataSets:e.dataSets}):d?p.jsx(ig,{showClearBtn:!r,filter:t,filterIndex:n,onChange:u,dataSets:e.dataSets,type:d,onOpenChange:e.onOpenChange},JSON.stringify(e.filter.value)):"dateFilter"==t.type?p.jsx(Jv,{showClearBtn:!r,dateFilterOptions:null==e?void 0:e.dateFilterOptions,filter:t,onChange:u,dataSets:e.dataSets,type:t.type,onOpenChange:e.onOpenChange},JSON.stringify(e.filter.value)):null:null},lg=function(e){var n,i=ff(),o=i.ref,a=i.show,l=i.position,s=i.close,u=i.open,d=Pu().dateFilterOptions,c=t.useState(!1),f=c[0],m=c[1];return p.jsxs(t.Fragment,{children:[(e.localFilters.length>0||e.zoomControl)&&p.jsxs("div",{ref:o,children:[e.zoomControl&&e.zoomControl.show&&p.jsx("button",{className:es({marginRight:"12px"}),onClick:e.zoomControl.onReset,children:p.jsx(Zu,{})}),e.localFilters.length>0&&p.jsx("button",{onClick:function(){return u()},"aria-label":"Show Local Filter",className:""+Ql.button,children:p.jsx(Uu,{active:(n=e.localFilters,r.some(n,(function(e){var t=e.value;return!(r.isArray(t)&&0===t.length||!t)})))})})]}),a&&p.jsx(cf,{onClose:function(){f||s()},width:420,position:l,children:p.jsx(cf.Options,{padding:!0,children:p.jsx(uf,{padding:"0.5rem",children:p.jsx(yf,{direction:"column",gap:"0.5rem","data-component":"filters",children:[].concat(e.localFilters).map((function(t,n){return p.jsx(uf,{children:p.jsx(ag,{dataSets:[e.dataSet],filterIndex:n,filter:t,onChange:function(t){var i=[].concat(e.localFilters);i[n]=t,e.setLocalFilters(i)},dateFilterOptions:d,onOpenChange:function(e){return m(e)}})},"local_filter_"+n)}))})})})})]})},sg=Object.assign((function(){return null}),{title:function(e){var t,n,i,r,o,a,l,s,u;return Fl({padding:0,fontSize:null==e||null==(t=e.title)?void 0:t.fontSize,color:null==e||null==(n=e.title)?void 0:n.color,fontWeight:null==e||null==(i=e.title)?void 0:i.fontWeight,fontFamily:null==e||null==(r=e.title)?void 0:r.fontFamily,margin:null!=(o=null==e||null==(a=e.title)?void 0:a.margin)?o:0,textAlign:null!=(l=null==e||null==(s=e.title)?void 0:s.textAlign)?l:"left",lineHeight:null==e||null==(u=e.title)?void 0:u.lineHeight,maxWidth:"calc(100% - 22px)",variants:{canFlex:{true:{flex:1},false:{flex:"none"}}}})},subject:function(e){var t,n,i,r,o,a,l,s,u;return Fl({position:"relative",fontSize:null==e||null==(t=e.subject)?void 0:t.fontSize,color:null==e||null==(n=e.subject)?void 0:n.color,fontWeight:null==e||null==(i=e.subject)?void 0:i.fontWeight,fontFamily:null==e||null==(r=e.subject)?void 0:r.fontFamily,margin:null!=(o=null==e||null==(a=e.subject)?void 0:a.margin)?o:0,marginBottom:"0.3rem",textAlign:null!=(l=null==e||null==(s=e.subject)?void 0:s.textAlign)?l:"left",lineHeight:null==e||null==(u=e.subject)?void 0:u.lineHeight,padding:0,flex:1})},verified:function(e){var t;return Fl({height:18,color:null==e||null==(t=e.verified)?void 0:t.color})}}),ug=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span";return p.jsx(n,{className:""+Ql.srOnly,htmlFor:null==e?void 0:e.htmlFor,children:null==e?void 0:e.children})},dg=function(e){var n=e.measures,i=Pu();return p.jsx(t.Fragment,{children:n&&(null==e?void 0:e.activeMeasures)&&p.jsx(yf,{direction:"column",gap:"1rem",children:Object.keys(n).map((function(t,r){var a=function(e,t,n,i,r,o,a){try{var l,s,u=_i(e,{supportedAggregates:t,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),d=Qo(n,u.field),c=null!=(l=al(d.publicName,null==(s=t[u.function])?void 0:s.publicName))?l:"",p=r({fieldId:u.field,func:u.function,type:o,defaultLabel:c,viewId:a}),f=[{label:null!=p?p:c,value:u}];return i[e].map((function(e){var i,l=al(Qo(n,e.field).publicName,null==(i=t[e.function])?void 0:i.publicName),s=r({fieldId:e.field,func:e.function,type:o,defaultLabel:l,viewId:a});f.push({label:null!=s?s:l,value:e})})),f}catch(e){if(e instanceof ki)return[];throw e}}(t,i.queryEngineConfig.supportedAggregates,e.dataSet,n,i.labelFormat,e.componentType,e.viewId),l=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return o.isEqual(e.value,t)}))}));return n.length>0?n[0].value:null}(a,e.activeMeasures);return p.jsx(nm,{label:"Replace Parameter "+(r+1),labelHidden:!0,id:"replace-parameter-"+r,selected:l,onChange:function(t){return e.setMeasure(t,l)},options:a},t)}))})})},cg=function(e,t){return"custom"!=e&&!!Go(e).supportedFeatures.parameters&&!(r.isEmpty(t)||!fg(t)&&!pg(t))},pg=function(e){return!r.isEmpty(null==e?void 0:e.group)},fg=function(e){return!r.isEmpty(null==e?void 0:e.measure)},mg=function(e){var n=e.activeDimensions,i=e.group,r=e.dataSet,o=Pu().queryEngineConfig;return p.jsx(t.Fragment,{children:i&&n&&p.jsx(yf,{direction:"column",gap:"1rem",children:Object.keys(i).map((function(t,n){var a=ht(t,o.supportedTimeTruncFunctions),l=a?function(e,t,n,i){if(!t||!n[i])return[];var r=Qo(e,t.field);if(!r)return[];var o=[{label:r.publicName+" ("+t.truncate+")",value:t}];return n[i].forEach((function(t){if(t&&"truncate"in t){var n=Qo(e,t.field);n&&o.push({label:n.publicName+" ("+t.truncate+")",value:t})}})),o}(r,a,i,t):function(e,t,n){var i;if(!t||null==e||!e.fields||!n[t])return[];var r=Qo(e,t);if(!r)return[];var o=[{label:null!=(i=r.publicName)?i:"",value:{field:t,function:"none"}}];return n[t].forEach((function(t){if(t&&"function"in t){var n,i=Qo(e,t.field);i&&o.push({label:i.publicName,value:{field:t.field,function:null!=(n=t.function)?n:"none"}})}})),o}(r,t,i),s=a?hg(l,null==e?void 0:e.activeTimeDimension):vg(l,null==e?void 0:e.activeDimensions);return p.jsx(nm,{labelHidden:!0,label:"Replace Parameter "+(n+1),id:"replace-parameter-"+n,selected:s,onChange:function(t){return null==e?void 0:e.setDimension(t,s)},options:l},t)}))})})},hg=function(e,t){var n;return null==(n=e.find((function(e){return o.isEqual(e.value,t)})))?void 0:n.value},vg=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return e.value.field===t.field&&e.value.function===t.function}))}));return n.length>0?n[0].value:null},gg=function(e,t,n){return null==n?n:null==n?void 0:n.map((function(n){return n.field===e.field&&n.function===e.function?ge({},t):n}))},xg=function(e){return function(t,n){var i=r.cloneDeep(e.activeOrder);e.activeOrder&&n&&t&&(i=[].concat(e.activeOrder).map((function(e){return"truncate"in n&&"truncate"in t&&n.truncate===e.function&&n.field===e.field?{direction:e.direction,field:t.field,function:t.truncate}:e}))),"truncate"in t||!n||"truncate"in n||null==e||e.setPartialAttributes({dimension:gg(n,t,null==e?void 0:e.activeDimension),order:i}),"truncate"in t&&(null==e||e.setPartialAttributes({timeDimension:t,order:i}))}},bg=function(e,t,n){return null==n?void 0:n.map((function(n){return o.isEqual(n,e)?t:n}))},yg=function(e){var n,i=ff(),o=i.ref,a=i.show,l=i.position,s=i.close,u=i.open,d=e.parameters;return cg(null==e?void 0:e.componentType,d)?p.jsxs(t.Fragment,{children:[p.jsx("div",{ref:o,children:p.jsxs("button",{onClick:function(){return u()},className:""+Ql.button,children:[p.jsx("span",{className:""+Xl,children:"Change Parameters"}),p.jsx(sh,{tooltipContent:function(){return"Change Parameters"},children:p.jsx(Xu,{})})]})}),a&&p.jsx(cf,{onClose:function(){return s()},width:320,position:l,children:p.jsx(cf.Options,{padding:!0,children:p.jsx(uf,{padding:"0.5rem",children:p.jsxs(yf,{direction:"column",gap:"0.5rem","data-component":"parameters",children:[pg(d)&&fg(d)&&p.jsx(Ch,{marginBottom:0,children:"Measures"}),p.jsx(dg,{measures:null==d?void 0:d.measure,dataSet:null==e?void 0:e.dataSet,activeMeasures:null==e?void 0:e.activeMeasures,setMeasure:(n=e,function(e,t){var i=r.cloneDeep(n.activeOrder);n.activeOrder&&t&&e&&(i=[].concat(n.activeOrder).map((function(n){return"function"in t&&"function"in e&&t.function===n.function&&t.field===n.field?{direction:n.direction,field:e.field,function:e.function}:n}))),null==n||n.setPartialAttributes({measure:bg(t,e,n.activeMeasures),order:i})}),componentType:null==e?void 0:e.componentType,viewId:null==e?void 0:e.viewId}),pg(d)&&fg(d)&&p.jsx(Ch,{marginBottom:0,children:"Groups"}),p.jsx(mg,{group:null==d?void 0:d.group,dataSet:null==e?void 0:e.dataSet,activeDimensions:null==e?void 0:e.activeDimension,activeTimeDimension:null==e?void 0:e.activeTimeDimension,setDimension:xg(e)})]})})})})]}):null},wg=function(e){var n,i,o,a,l,s,u=Dd(),d=Pu(),c=d.organizationName,f=d.textOverride;if(!e.displayTitle&&!e.displaySubject&&r.isEmpty(e.localFilters)&&"custom"!==e.componentType&&!cg(null==e?void 0:e.componentType,e.parameters)&&(null==e||!e.verified))return p.jsx(uf,{paddingBottom:null!=(s=e.paddingBottom)?s:"12px","data-component":"empty-titles"});var m,h=(m=0,r.isEmpty(e.localFilters)||(m+=1.25),cg(null==e?void 0:e.componentType,e.parameters)&&(m+=1.25),cg(null==e?void 0:e.componentType,e.parameters)&&!r.isEmpty(e.localFilters)&&(m+=.5),m+"rem"),v=c?f("verified_by_with_organization","Verified by [[organizationName]]",{organizationName:c}):f("verified","Verified");return p.jsxs(p.Fragment,{children:[p.jsxs(yf,{direction:"column",gap:"0.25rem",paddingBottom:null!=(n=e.paddingBottom)?n:"12px","data-component":"titles",children:[p.jsxs(yf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(i=u.charts)||null==(i=i.title)?void 0:i.textAlign)?h:void 0,children:[e.displayTitle&&p.jsx(yh,{style:{fontFamily:null==u||null==(o=u.titles)?void 0:o.fontFamily},className:""+sg.title(null==u?void 0:u.charts)({canFlex:null!=e&&e.library?"false":"true"}),"data-themeapi":"charts.title",children:e.displayTitle}),(null==e?void 0:e.verified)&&(null==e?void 0:e.library)&&p.jsxs(sh,{tooltipContent:function(){return p.jsx(t.Fragment,{children:v})},children:[p.jsx(b.BadgeCheckIcon,{className:""+sg.verified(null==u?void 0:u.library),"data-testid":"badge","data-themeapi":"library.verified.icon"}),p.jsx(ug,{children:v})]})]}),e.displaySubject&&p.jsx(yf,{alignItems:"center",gap:"0.25rem",paddingRight:h,paddingLeft:"center"===(null==u||null==(a=u.charts)||null==(a=a.subject)?void 0:a.textAlign)?h:void 0,children:p.jsx(wh,{style:{fontFamily:null==u||null==(l=u.baseFont)?void 0:l.fontFamily},className:""+sg.subject(null==u?void 0:u.charts),"data-themeapi":"charts.subject",children:e.displaySubject})})]}),e.dataSet&&!(null!=e&&e.library)&&"custom"!==e.componentType&&p.jsx("div",{className:es({position:"absolute",top:"0",right:"0",zIndex:"2"}),children:p.jsxs("div",{className:es({position:"absolute",top:"12px",right:"12px",gap:"10px",display:"flex",flexDirection:"row"}),children:[p.jsx(yg,{activeDimension:null==e?void 0:e.dimension,activeTimeDimension:e.timeDimension,activeMeasures:null==e?void 0:e.measure,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.componentType,dataSet:e.dataSet,setPartialAttributes:e.setPartialAttributes,viewId:e.viewId,activeOrder:e.order}),p.jsx(lg,{setLocalFilters:e.setLocalFilters,localFilters:e.localFilters,zoomControl:e.zoomControl,dataSet:e.dataSet})]})})]})},Cg=function(e){var t=e.children;return p.jsx("div",{id:e.id,className:""+jg({queriesAreChanging:e.queriesAreChanging,overflowScroll:e.overflowScroll,justifyCenter:e.justifyCenter}),"data-component":"view-wrapper","data-idfordownload":"true",children:t})},jg=Fl({display:"flex",width:"100%",height:"100%",flexDirection:"column",variants:{queriesAreChanging:{false:{},true:{filter:"blur(1px)"}},overflowScroll:{false:{},true:ge({overflow:"auto"},vf)},justifyCenter:{false:{},true:{justifyContent:"center"}}}}),Fg=t.createContext({addToast:function(){throw"not implemented."}}),Sg=function(e){return p.jsxs("div",{className:es({display:"flex"}),children:[p.jsx("span",{children:e.renderIcon()}),p.jsx("span",{className:es({marginLeft:"12px"}),children:e.message})]})},kg=function(e){return p.jsx(Sg,{message:e.message,renderIcon:function(){return p.jsx("svg",{className:es({width:"20px",height:"20px"}),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})})}})},Ag=function(e){return p.jsx(Sg,{message:e.message,renderIcon:function(){return p.jsx("svg",{className:es({width:"20px",height:"20px"}),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"#e86f7f",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}})},Tg=function(e){return p.jsx(Sg,{message:e.message,renderIcon:function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:es({width:"20px",height:"20px"}),viewBox:"0 0 20 20",fill:"#6fe8ba",children:p.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}})};function _g(e){var n=e.children,i=t.useState([]),o=i[0],a=i[1],l=t.useRef([]),s=t.useCallback((function(e,t){if(t){if(l.current.includes(t))return;l.current=[].concat(l.current,[t])}a((function(t){return[e].concat(t)})),setTimeout((function(){t&&r.remove(l.current),a((function(e){return e.slice(void 0,-1)}))}),7500)}),[a]);return p.jsxs(Fg.Provider,{value:{addToast:s},children:[p.jsx("div",{className:es({position:"fixed",left:"20px",bottom:"20px"}),style:{zIndex:2147483647},children:o.map((function(e,t){return p.jsx("div",{className:es({boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",borderRadius:"8px",padding:"12px 24px",backgroundColor:"rgba(0, 0, 0, 0.9)",color:"white",marginTop:"12px",letterSpacing:"0.025em"}),children:e()},"toast_"+t)}))}),n]})}function Ig(){return t.useContext(Fg)}var Dg,Og=function(e){var t=Pu(),n=t.textOverrides,i=t.developerTools,r=Ig().addToast,o=("string"==typeof e.override?[e.override]:e.override).find((function(e){return!!n[e]})),a=p.jsx(p.Fragment,{children:o?n[o]:e.children});return!0===i||"object"==typeof i&&i.translationKeys?p.jsx("span",{onMouseEnter:function(){r((function(){return p.jsx(kg,{message:"Change the text with 'textOverride' property '"+e.override+"'"})}),"unique-text-override-"+e.override)},children:a}):p.jsx(p.Fragment,{children:a})},Eg=Fl({display:"grid",height:"100%",width:"100%",alignContent:"center"}),Lg=Fl({margin:"auto",textAlign:"center"}),Ng=Fl(ge({},Zl.text,{fontSize:"1.5rem",lineHeight:"2rem",color:"inherit",variants:{textOpacity:(Dg={},Dg[60]={opacity:60},Dg[40]={opacity:40},Dg)}})),Mg=Fl({marginTop:"0.75rem",fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1rem",opacity:.8}),Rg=Object.assign((function(e){var t,n;return p.jsx("div",{className:""+Eg,children:p.jsxs("div",{className:Lg+" "+(null!=(t=e.contentClassName)?t:""),children:[p.jsx("h1",{className:""+Ng({opacity:e.opacity}),children:e.title}),null!=(n=null==e?void 0:e.children)?n:e.renderExtra&&e.renderExtra()]})})}),{Extra:function(e){return p.jsx("div",{className:""+Mg,children:null==e?void 0:e.children})}}),Pg=es({fontSize:"12px",lineHeight:"16px",fontWeight:"500",letterSpacing:"0.1em",opacity:"0.5",marginTop:"12px",maxWidth:"576px"}),zg=function(e){return p.jsx(Rg,{opacity:40,title:null==e?void 0:e.title,contentClassName:e.emptyClassName,children:e.renderExtra&&e.renderExtra()})},Vg=function(){return p.jsx(Rg,{title:"We have failed to load your dashboard",renderExtra:function(){return p.jsxs(p.Fragment,{children:[p.jsx("p",{className:[""+Ql.text,Pg].join(" "),children:"An internal error occurred, please try again soon."}),p.jsx("div",{className:es({marginTop:"16px"}),children:p.jsx(Pv,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},qg=function(){return p.jsx(Rg,{title:"There is an issue with your configuration settings.",renderExtra:function(){return p.jsx("p",{className:""+Ql.text,children:"See logs for more details."})}})},Bg=function(){return p.jsx(Rg,{title:"We have failed to load your dashboard",renderExtra:function(){return p.jsxs(p.Fragment,{children:[p.jsx("p",{className:[""+Ql.text,Pg].join(" "),children:"We were unable to verify your identity"}),p.jsx("div",{className:es({marginTop:"16px"}),children:p.jsx(Pv,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},Wg=function(e){return p.jsx(Rg,{title:"This view has changed",renderExtra:function(){return p.jsx(Rg.Extra,{children:p.jsxs(Og,{override:"view.data-set-changed",children:["A field this view was using has been removed.",p.jsx("div",{className:es({marginTop:"16px",width:"100%"}),children:p.jsx(Pv,{"data-component":"remove-missing-field",onClick:function(){return e.removeMissingField()},children:"Auto fix"})})]})})}})},Hg=function(e){var t;return p.jsx(Rg,{title:null!=(t=null==e?void 0:e.title)?t:"Query under construction 🏗",renderExtra:function(){var t;return p.jsx(Rg.Extra,{children:null!=(t=null==e?void 0:e.children)?t:"Not all required properties have been set to render this component"})}})},Yg=function(){return p.jsx(Rg,{title:p.jsx(Og,{override:"view.failed-to-fetch-results",children:"Failed to fetch the data 🤔"})})},Gg=function(){var e=Pu();return p.jsx(Rg,{title:(0,e.textOverride)("results-too-large","There is too much data for this view.")})},Ug=function(){return p.jsx(Rg,{title:"This view is not available"})},Kg=function(e){return p.jsxs(Cg,{queriesAreChanging:!1,children:[p.jsx(wg,ge({},e)),p.jsx(Rg,{title:p.jsx(Og,{override:"view.empty-results",children:"No data to show"})}),e.children]})},Xg=function(e){return p.jsx(Rg,{title:"Something went wrong 😞",renderExtra:function(){return p.jsx(Pv,{onClick:e.onManualRetry,className:es({marginTop:"12px"}),children:"retry"})}})},Qg=function(e){return p.jsx(Rg,{title:"Something went wrong 😞",renderExtra:function(){return p.jsx(Pv,{onClick:e.onManualRetry,className:es({marginTop:"12px"}),children:"retry"})}})},Zg=Object.assign((function(){return null}),{button:function(e){return Fl(ge({},Zl.button,{color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight}))},icon:function(e){return Fl({"& > *":{fill:null==e?void 0:e.iconColor}})}}),Jg=["sm"],$g=function(e){var n,i=t.useState(e.defaultOpen||!1),r=i[0],o=i[1],a=Dd();return p.jsxs("div",{className:kd(Df("accordion",e,Jg),es({marginBottom:"12px"})),children:[p.jsxs("button",{"data-testid":e.testId,type:"button",onClick:function(){if(e.showAccordionIcon){var t=!r;o(t),t&&e.onOpened&&e.onOpened()}},className:kd(""+Zg.button(null==a||null==(n=a.accordion)?void 0:n.button),es({position:"relative",cursor:"pointer",width:"100%",textAlign:"left",marginBottom:"0",borderRadius:"8px"})),"data-themeapi":"accordion.button","data-chipposition":"top.left",children:[p.jsx(yf,{gap:"0.25rem",alignItems:"center",children:null==e?void 0:e.title}),e.renderAction&&p.jsx("div",{className:es({position:"absolute",top:"0",right:"32px"}),children:e.renderAction(r)}),e.showAccordionIcon&&p.jsx("span",{className:kd(""+Zg.icon(null==a?void 0:a.accordion),es({position:"absolute",top:"4px",right:"0"})),"data-themeapi":"accordion.iconColor",children:p.jsx(ad,{isOpen:r})})]}),r&&p.jsx("div",{className:kd(If("accordion-content"),es({marginTop:"8px"})),children:e.children})]})},ex=function(e){return p.jsx($g,ge({},e))},tx=function(e){return p.jsx(uf,{paddingRight:null==e?void 0:e.paddingRight,as:null==e?void 0:e.as,children:p.jsx(Td,{gap:"0.5rem",children:null==e?void 0:e.children})})},nx=function(e){var t,n,i,r,o,a,l,s,u,d,c,p,f,m,h,v,g,x,b;return Fl({height:null!=(t=null==e?void 0:e.height)?t:"100%",width:"100%",transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",WebkitFontSmoothing:"antialiased",justifyContent:null!=(n=null==e?void 0:e.align)?n:"center",alignItems:"center",display:"flex",cursor:"pointer",padding:"0 12px 1px 12px",background:null==(i=e.theme)?void 0:i.background,border:null==(r=e.theme)?void 0:r.border,boxShadow:null==(o=e.theme)?void 0:o.boxShadow,borderRadius:null==(a=e.theme)?void 0:a.borderRadius,color:null==(l=e.theme)?void 0:l.color,position:"relative","&:hover":ix(e.theme),variants:{size:{small:{fontSize:null==(s=e.theme)||null==(s=s.small)?void 0:s.fontSize,fontWeight:null==(u=e.theme)||null==(u=u.small)?void 0:u.fontWeight,padding:null!=(d=null==(c=e.theme)||null==(c=c.small)?void 0:c.padding)?d:"2px 8px 3px",height:"auto",width:"auto"},medium:{fontSize:null==(p=e.theme)||null==(p=p.medium)?void 0:p.fontSize,fontWeight:null==(f=e.theme)||null==(f=f.medium)?void 0:f.fontWeight,padding:null!=(m=null==(h=e.theme)||null==(h=h.medium)?void 0:h.padding)?m:"0 12px"},large:{fontSize:null==(v=e.theme)||null==(v=v.large)?void 0:v.fontSize,fontWeight:null==(g=e.theme)||null==(g=g.large)?void 0:g.fontWeight,padding:null!=(x=null==(b=e.theme)||null==(b=b.large)?void 0:b.padding)?x:"0 12px"}},isHovering:{true:ix(e.theme)}}})};function ix(e){var t,n,i,r;if(e)return{transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",background:null==(t=e["&:hover"])?void 0:t.background,border:null==(n=e["&:hover"])?void 0:n.border,boxShadow:null==(i=e["&:hover"])?void 0:i.boxShadow,color:null==(r=e["&:hover"])?void 0:r.color}}var rx=function(e){var t,n,i,r=Dd();return p.jsx("button",{onClick:function(t){e.disabled||(t.preventDefault(),(null==e?void 0:e.onChange)&&(null==e||e.onChange()))},"data-component":null==e?void 0:e["data-component"],"data-testid":null==e?void 0:e.testId,className:kd(nx({height:null==e?void 0:e.height,align:null==e?void 0:e.align,theme:null!=(t=null==e?void 0:e.addTheme)?t:null==r||null==(n=r.buttons)?void 0:n.add})({size:null!=(i=null==e?void 0:e.size)?i:"medium"}),e.className),"data-themeapi":"buttons.add",disabled:e.disabled,children:p.jsx("span",{children:null==e?void 0:e.children})})},ox=function(e){return p.jsx(uf,{children:p.jsx(rx,{testId:e.testId,onChange:function(){return null==e?void 0:e.onChange()},height:36,align:"left",disabled:e.disabled,className:If("add-list-item"),children:p.jsxs(yf,{children:["+ ",e.label]})})})},ax=function(e){return void 0===(null==e?void 0:e.children)?null:p.jsx(Td,{gap:e.hasDeleteIcon?"0.9rem":"0.5rem",className:If("listview"),columns:["repeat(1,minmax(0,1fr))"],"data-component":"list-view",role:"list",children:null==e?void 0:e.children})},lx=t.forwardRef((function(e,t){var n=Dd();return p.jsx("div",{className:kd(If("listview-item"),""+jf.item(null==n?void 0:n.lists)({highlight:e.highlight?"on":"off",clickable:e.onClick&&"on",componentPadding:null!=e&&e.padding?"true":"false"})),ref:t,"data-themeapi":"lists",children:null==e?void 0:e.children})})),sx=Fl(ge({},Cl,{opacity:0,cursor:"pointer",variants:{active:{true:ge({},Cl,{opacity:1})}}})),ux=Fl({width:"100%",display:"flex",cursor:"pointer",height:16}),dx=Fl(ge({},Cl,{width:12,color:"#1f293799",variants:{active:{true:ge({},Cl,{color:"rgba(93,103,119,0.6)"})}}})),cx=Fl({position:"absolute",top:0,left:0,right:0,background:"transparent",variants:{active:{true:{"&:hover":{background:"rgb(229 231 235 / 0.2)",boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",borderTopRightRadius:Il.size.borderRadius,borderTopLeftRadius:Il.size.borderRadius}}}}}),px=function(e){var t,n,i,r,o,a;return Fl(ge({},Cl,{cursor:"pointer",color:null==e||null==(t=e.icon)?void 0:t.color,background:null==e||null==(n=e.icon)?void 0:n.background,borderRadius:null==e||null==(i=e.icon)?void 0:i.borderRadius,padding:null==e||null==(r=e.icon)?void 0:r.padding,"&:hover":ge({},null==e||null==(o=e.icon)?void 0:o["&:hover"]),"&:disabled":ge({},null==e||null==(a=e.icon)?void 0:a["&:disabled"])}))},fx=function(e){return p.jsx("div",{ref:e.dragSource,className:""+cx({active:null!=e&&e.enabled?"true":"false"}),style:null!=e&&e.height?{height:null==e?void 0:e.height}:{},children:(null==e?void 0:e.enabled)&&p.jsx(mx,{active:null==e?void 0:e.active,top:null==e?void 0:e.top})})},mx=function(e){var n,i,r=Pu().textOverride,o=t.useState(!1),a=o[0],l=o[1],s=Dd();return p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:r("drag_to_move","Drag to move")})},className:""+(n=null==e?void 0:e.top,i=e.left,Fl(ge({},Cl,{position:"absolute",left:null!=i?i:1,top:n})))({active:null!=e&&e.active?"true":"false"}),tooltipMinWidth:110,children:p.jsx("div",{className:""+sx({active:null!=e&&e.active?"true":"false"}),children:p.jsxs("div",{className:""+ux,onMouseOver:function(){return l(!0)},onMouseLeave:function(){return l(!1)},"data-themeapi":"dashboard.icon",children:[p.jsx(b.DotsVerticalIcon,{className:dx({active:a?"true":"false"})+" "+px(null==s?void 0:s.dashboard)}),p.jsx(b.DotsVerticalIcon,{className:dx({active:a?"true":"false"})+" "+px(null==s?void 0:s.dashboard),style:{marginLeft:-8}})]})})})};function hx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var vx=t.forwardRef((function(e,n){var i,r,o,a,l,s,u,d,c,f,m,h,v,g,x,b,y=e.item,w=e.index,C=e.onDeleteItem,j=e.onToggleHidden,F=e.showHiddenToggle,S=e.onOrderChange&&e.totalItemsCount>1,k=Pu().textOverride,A=Dd(),T=t.useState(!1),_=T[0],I=T[1],D=!!e.isHidden&&e.isHidden({itemIndex:w});return p.jsxs(t.Fragment,{children:[p.jsx("div",{ref:n,className:hx("listview-item",es({display:"flex"}),"dragging"===(null==e||null==(i=e.state)?void 0:i.type)&&es({opacity:.4})),onMouseEnter:function(){return I(!0)},onMouseLeave:function(){return I(!1)},"data-component":"listview-item",role:"listitem",children:p.jsxs("div",{style:{cursor:y.onClick?"pointer":void 0},onClick:function(){return y.onClick?y.onClick(w):void 0},onKeyDown:function(e){!y.onClick||"Enter"!==e.key&&" "!==e.key||y.onClick(w)},tabIndex:y.onClick?0:void 0,className:""+jf.itemWrapper,"data-themeapi":"lists",role:y.onClick?"button":void 0,"aria-labelledby":"list-item-title-"+w,children:[p.jsx(lx,{clickable:!!y.onClick,highlight:y.highlight,children:p.jsxs(yf,{direction:"row","data-component":"list-cell-row",gap:"0.5rem",padding:null==A||null==(r=A.lists)||null==(r=r.row)?void 0:r.padding,alignItems:"top",position:"relative",children:[p.jsx("div",{className:""+jf.dragHandleContainer,children:!!S&&p.jsx(mx,{active:_,top:9})}),p.jsx(uf,{flex:1,paddingLeft:0,children:p.jsxs(yf,{gap:"0.25rem",children:[(null==y?void 0:y.icon)&&p.jsx("div",{className:es({display:"flex",alignItems:"center"}),children:p.jsx(Af,{flexPaddingTop:0,paddingTop:0,marginLeft:0,icon:null==y?void 0:y.icon})}),p.jsxs(uf,{flexGrow:1,paddingY:"4px","data-component":"list-title-subtext",children:["string"==typeof y.title?p.jsxs("span",{className:es({display:"flex",alignItems:"center"}),children:[p.jsx("p",{className:[""+jf.label(null==A?void 0:A.lists),es(ge({},D&&{textDecoration:"line-through"}))].join(" "),id:"list-item-title-"+w,children:y.title}),_&&j&&F&&p.jsx(Iv,{label:D?"Show in view":"Hide from view",ariaLabel:D?"Show in view":"Hide from view",onChange:function(){return j({itemIndex:w})},tooltip:D?"Show in view":"Hide from view",children:p.jsx(D?Xs:Ks,{className:es({width:"16px",height:"16px"})})})]}):p.jsx(t.Fragment,{children:y.title}),y.subtext&&p.jsx("p",{className:""+jf.metadata(null==A?void 0:A.lists),children:y.subtext})]})]})}),y.select&&p.jsx("div",{className:""+jf.right,children:p.jsx(nm,{labelHidden:!0,label:k("function","Function"),subtle:!0,showClearBtn:y.select.showClearBtn,onChange:function(e){var t;return null==(t=y.select)?void 0:t.onChange(e,w)},options:y.select.options,selected:y.select.selected,rightAligned:!0,id:"function_"+w,controlClassName:es({padding:null==A||null==(o=A.lists)||null==(o=o.select)?void 0:o.padding,fontSize:null==A||null==(a=A.lists)||null==(a=a.select)?void 0:a.fontSize,color:null==A||null==(l=A.lists)||null==(l=l.select)?void 0:l.color,fontWeight:null==A||null==(s=A.lists)||null==(s=s.select)?void 0:s.fontWeight,border:"0!important","&:hover":{padding:null==A||null==(u=A.lists)||null==(u=u.select)?void 0:u.padding,border:"0!important"}}),classNameInputComponent:es({border:"0!important",fontSize:null==A||null==(d=A.lists)||null==(d=d.select)?void 0:d.fontSize,color:null==A||null==(c=A.lists)||null==(c=c.select)?void 0:c.color,fontWeight:null==A||null==(f=A.lists)||null==(f=f.select)?void 0:f.fontWeight,textAlign:"right","&:hover":{border:"0!important",background:null==A||null==(m=A.lists)||null==(m=m.select)||null==(m=m["&:hover"])?void 0:m.background}}),classNameInputControl:es({padding:null==A||null==(h=A.lists)||null==(h=h.select)?void 0:h.padding}),classNameInputControlGrid:es({padding:null==A||null==(v=A.lists)||null==(v=v.select)?void 0:v.padding,fontSize:null==A||null==(g=A.lists)||null==(g=g.select)?void 0:g.fontSize,color:null==A||null==(x=A.lists)||null==(x=x.select)?void 0:x.color,fontWeight:null==A||null==(b=A.lists)||null==(b=b.select)?void 0:b.fontWeight})})}),y.renderRight&&p.jsx("div",{className:""+jf.right,children:y.renderRight()}),y.editIcon&&p.jsx("div",{className:""+jf.edit,children:p.jsx(td,{})}),y.preventDelete&&p.jsx("div",{className:""+jf.edit,children:p.jsx(nd,{})})]})}),C&&!y.preventDelete&&p.jsx("div",{className:""+jf.deleteWrapper(null==A?void 0:A.lists),children:p.jsxs("button",{type:"button",className:""+jf.deleteButton(null==A?void 0:A.lists),"data-testid":e.testId&&e.testId+"-"+w+"-remove",onClick:function(e){e.stopPropagation(),C&&C(w,y.context)},"aria-label":k("remove","Remove"),"data-themeapi":"lists.icon",children:[p.jsxs("span",{className:""+Xl,children:[k("remove","Remove")," ",y.title]}),p.jsx(Qu,{})]})})]})}),e.closestEdge&&p.jsx(E.DropIndicator,{edge:e.closestEdge,gap:"8px"})]})})),gx={type:"idle"},xx={type:"dragging"},bx=t.memo((function(e){var n=t.useRef(null),i=t.useState(gx),r=i[0],o=i[1],a=t.useState(null),l=a[0],s=a[1];return t.useEffect((function(){var t=n.current;return t||A(!1),T.combine(_.draggable({element:t,getInitialData:function(){return{type:e.purpose,itemId:e.item.id,rowId:e.index}},onGenerateDragPreview:function(e){var n=e.location,i=e.nativeSetDragImage,r=e.source.element.getBoundingClientRect();I.setCustomNativeDragPreview({nativeSetDragImage:i,getOffset:D.preserveOffsetOnSource({element:t,input:n.current.input}),render:function(e){return o({type:"preview",container:e.container,rect:r}),function(){return o(xx)}}})},onDragStart:function(){o(xx)},onDrop:function(){return o(gx)}}),O.dropTargetForExternal({element:t}),_.dropTargetForElements({element:t,canDrop:function(t){var n=t.source;return n.data.rowId!==e.index&&n.data.type===e.purpose},getIsSticky:function(){return!0},getData:function(t){return k.attachClosestEdge({type:e.purpose,itemId:e.item.id},{input:t.input,element:t.element,allowedEdges:["top","bottom"]})},onDragEnter:function(t){t.source.data.itemId!==e.item.id&&t.self.data.type===t.source.data.type&&s(k.extractClosestEdge(t.self.data))},onDrag:function(t){t.source.data.itemId!==e.item.id&&t.self.data.type===t.source.data.type&&s(k.extractClosestEdge(t.self.data))},onDragLeave:function(){s(null)},onDrop:function(t){var n=t.source;t.self.data.type===n.data.type&&e.onOrderChange&&e.onOrderChange(e.index,n.data.rowId),s(null)}}))}),[e.index,e.item,e.purpose]),p.jsxs(t.Fragment,{children:[p.jsx(vx,ge({},e,{ref:n,state:r,closestEdge:l})),"preview"===r.type&&g.createPortal(p.jsx("div",{style:{boxSizing:"border-box",width:r.rect.width,height:r.rect.height},children:p.jsx(yx,{})}),r.container)]})})),yx=function(){return p.jsx("div",{className:es({position:"fixed",pointerEvents:"none",left:0,top:0,background:Il.colors.blue,opacity:.5,height:40,width:360,borderRadius:8,zIndex:10})})},wx=function(e){return null!=e&&e.onOrderChange?p.jsx("div",{className:es({position:"relative"}),children:p.jsx(bx,ge({},e))}):p.jsx(vx,ge({},e))};function Cx(e){var t,i=r.orderBy(e.initValues,(function(e){return e.title})),o=n.useState(null!=(t=null==e?void 0:e.isOpen)&&t),a=o[0],l=o[1],s=hf(i,["title","subtext"]),u=s.setSearch,d=s.values,c=s.searchString,f=n.useRef(null);return Id(f,(function(){return l(!1)})),e.hide?null:p.jsxs("div",{className:""+jf.addWrapper,ref:f,children:[p.jsx(uf,{marginTop:e.marginTop,"data-component":"new-item",children:p.jsx(ox,{testId:e.testId,onChange:function(){var t=!a;t&&e.onOpenDropdown&&e.onOpenDropdown(),l(t)},label:e.callToAction})}),p.jsxs(_f,{open:a,fixedHeight:!0,width:"calc(100% - 2px)",children:[p.jsx(uf,{padding:8,children:p.jsx($f,{id:(null==e?void 0:e.id)+"-add-item",label:"Add Item",labelHidden:!0,autoFocus:!0,defaultValue:c,onChange:function(e){return u(e.target.value)}})}),d.map((function(t){return p.jsx(_f.Option,{testId:e.testId+"-option-"+t.refIndex,onChange:function(){return(n=i[t.refIndex]).onSelected&&n.onSelected(n.value),e.onNew&&e.onNew(n.value),void l(!1);var n},label:t.item.title,subtext:t.item.subtext,icon:t.item.icon},"list_view_"+t.refIndex+"_option")}))]})]})}function jx(e){var n,i;return p.jsxs(tx,{paddingRight:null!=(n=null==e?void 0:e.paddingRight)?n:"0.25rem",children:[e.items.length>0&&p.jsx(ax,{children:[].concat(e.items).map((function(t,n){return p.jsx(wx,{mode:null==e?void 0:e.mode,testId:e.testId,onDeleteItem:e.onDeleteItem,onOrderChange:e.onOrderChange,onToggleHidden:e.onToggleHidden,isHidden:e.isHidden,showHiddenToggle:e.showHiddenToggle,item:t,index:n,totalItemsCount:e.items.length,purpose:e.purpose},"list_view_item_"+n)}))}),p.jsxs(t.Fragment,{children:[e.newItem&&p.jsx(Cx,ge({},e.newItem,{testId:e.testId,id:null==e?void 0:e.id,marginTop:e.items.length>0?"0.125rem":void 0})),e.newItemBtn&&p.jsx(ox,{testId:e.testId,onChange:null==(i=e.newItemBtn)?void 0:i.onClick,label:e.newItemBtn.callToAction,disabled:null==e?void 0:e.newItemBtn.disabled})]})]})}function Fx(e){var n=t.useState(!1),i=n[0],r=n[1];return t.useEffect((function(){return r(!1)}),[i]),t.useImperativeHandle(e,(function(){return{resetSize:function(){r(!0)}}})),i}var Sx=t.memo((function(e){return p.jsx(p.Fragment,{children:e.annotations.map((function(t){return p.jsxs(N.Annotation,{dataKey:e.dataKey,datum:t.datum,dx:t.xOffset,dy:t.yOffset,children:[p.jsx(N.AnnotationConnector,{stroke:"#dedede"}),p.jsx(N.AnnotationLabel,{backgroundPadding:5,title:t.title,showAnchorLine:!1,titleFontSize:"10px",backgroundProps:{opacity:1}})]})}))})}),(function(e,t){return JSON.stringify(e)==JSON.stringify(t)})),kx=function(e){var t=e.dataKey,n=e.data;if(!e.show||r.isEmpty(e.generateAnnotations))return null;var i=function(e,t,n){var i=r.minBy(n,(function(e){return e[t]})),o=r.maxBy(n,(function(e){return e[t]})),a=[];return i&&a.push({title:"Low of "+i[t],datum:i,yOffset:15,xOffset:10}),o&&a.push({title:"High of "+o[t],datum:o,yOffset:-15,xOffset:10}),a}(0,t,n||[]);return p.jsx(Sx,{dataKey:t,annotations:i})},Ax=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},i=ge({},r.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var r=t?t[e]:null;r&&(i=ge({},i,n.variants&&n.variants[e][r]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=ge({},e.css);r.every(Object.keys(r.omit(e,["css"])),(function(n){var i;return e[n]==(null==(i=t)?void 0:i[n])}))&&(i=ge({},i,n))})),i}}(e)(t);return m.css(n,"","")};return t.toString=t,t},Tx="\n.visx-tooltip {\n z-index: 14294967294; /* or whatever height is appropriate */\n}",_x=function(e,t){return t?e-40:e},Ix=m.css({display:"inline-flex",position:"relative",flexDirection:"row",gap:24,padding:0,height:40},"",""),Dx=m.css({name:"um88o8",styles:"color:inherit;margin:0 0 0 4px;flex:1;display:flex;justify-content:left;font-family:inherit;font-size:0.75rem;opacity:1;font-weight:400"}),Ox=Object.assign((function(){return null}),{icon:function(e,t){return Ax({marginLeft:"2px",variants:{type:{lines:{width:8,paddingTop:3,maxHeight:1,backgroundColor:e},bar:{height:8,width:8,backgroundColor:e,borderRadius:2},area:{height:0,width:0,borderBottom:"8px solid "+e,borderLeft:"8px solid transparent"},scatter:{height:8,borderRadius:"50%",width:8,backgroundColor:e},pie:{height:8,borderRadius:"50%",width:8,backgroundColor:e},trend:ge({width:8,paddingTop:3,maxHeight:1},t)}}})},container:Ix,label:Dx,scrollbar:m.css({name:"1azakc",styles:"text-align:center"}),reason:function(e){return m.css(Dx,{zIndex:999,pointerEvents:"none",overflow:"hidden",position:"absolute",marginLeft:"20px",marginTop:"-5px",padding:"3px 5px",boxShadow:"0 1px 3px 0 rgba(0,0,0,0.1),0 1px 2px 0 rgba(0,0,0,0.06)",borderRadius:"5px",paddingLeft:"12px",paddingRight:"8px",background:"linear-gradient(90deg, "+e+" 5px, rgba(255,255,255,1) 5px)"},"","")},wrapper:Ax({textAlign:"left"})}),Ex=function(e){var n,i,r=t.useState(!1),o=r[1];return p.jsx("div",{className:(i=r[0],m.css(ge({overflowX:i?"auto":"hidden",whiteSpace:"nowrap"},i?{"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4}}:{}),"","")+" "+(null!=(n=null==e?void 0:e.className)?n:"")),onMouseEnter:function(){return o(!0)},onMouseLeave:function(){return o(!1)},children:null==e?void 0:e.children})},Lx=function(e){var n,i,r=t.useState(!1),o=r[0],a=r[1];return p.jsx(p.Fragment,{children:p.jsx("span",{onMouseLeave:function(){return a(!1)},onMouseEnter:function(){return a(!0)},className:Ox.icon(null!=(n=e.color)?n:"#5d4e8c",e.additionalStyles)({type:null==e?void 0:e.type}),children:o&&e.reason&&p.jsx("div",{className:Ox.reason(null!=(i=e.color)?i:"#5d4e8c"),children:e.reason})})})},Nx={natural:V.curveNatural,monotoneX:V.curveMonotoneX,monotoneY:V.curveMonotoneY,straight:V.curveLinear,step:V.curveStep,stepBefore:V.curveStepBefore,stepAfter:V.curveStepAfter},Mx="-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif";function Rx(e,t){var n,i;return[].concat(null!=e&&e.areas?null==e?void 0:e.areas[t]:[],null!=e&&e.bars?null==e?void 0:e.bars[t]:[],null!=e&&e.lines?null==e?void 0:e.lines[t]:[],null!=(n=null==(i=e.trends)?void 0:i[t])?n:[])}function Px(e,t,n,i,r,o){var a={type:"linear",nice:!0},l={paddingOuter:.05,paddingInner:.3,type:n?"time":"band"};return"y"===e&&o&&(a=ge({},a,{domain:o})),"x"===e?(r&&(l=ge({},l,{type:"band"})),i&&(l=ge({},l,{type:"pow"})),t?a:l):t?l:a}function zx(e,t,n,i){return function(r){var o;return null!=(o=t(r,e))?o:n[i]}}function Vx(e,t,n){return function(i){var r;return null!=(r=e(i))?r:t[n]}}var qx=function(e,t,n){return function(i){if(e){var r=(o=null==n?void 0:n.find((function(e){return e.x==i})))?Object.keys(o)[0]:null;return e(i,r)}var o;return t?Hx(i):i}},Bx=function(e){return function(t){return null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(t):t}},Wx=function(e,t,n,i){return null==n?"No value":qx(e,t,i)(n)},Hx=function(e){return e?new Date(e).toLocaleDateString():""},Yx=t.forwardRef((function(e,t){if(Fx(t))return null;var n,i,r=(i={},{data:(n=e.data).map((function(e,t){var r=n[t-1],o=ge({},e);return Object.keys(o).forEach((function(e){var a=r?r[e]:null,l=a?Math.max(a-n[t][e],0):0;if("{"===e[0]){var s=JSON.parse(e);s.modifier=Gx;var u=JSON.stringify(s);i[u]=!0,o[u]=l}})),o})),keys:Object.keys(i)}),o=r.data,a=[].concat(e.keys,r.keys);return p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,sparkline:e.sparkline,x:e.x,formatSeriesName:e.formatSeriesName,bars:{funnelChart:!0,annotate:[],stacked:!1,colors:e.colors,data:o,keys:a,formatter:e.formatter,styles:{cornerRadius:0}},legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,forceXAxisAsTime:null==e?void 0:e.forceXAxisAsTime,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,showTotalOnTooltip:e.showTotalOnTooltip,theme:null==e?void 0:e.theme,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities,onClick:function(t,n,i){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t,n,i))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,enableHover:e.enableHover,popOverMenuStyles:e.popOverMenuStyles})}})})),Gx="positiveDiffWithPreviousValueInSeries",Ux=function(e){return e.includes(Gx)},Kx=function(e){return Math.round(e.test/e.original*100)},Xx=function(e){return Math.round(100*(Number(e)+Number.EPSILON))/100},Qx=function(e){var t,n,i=Object.keys(e).find((function(e){return e.includes(Gx)})),r=i?Zx({positiveDiffDatumKey:i}):null,o=null,a=null;return r&&i&&(null!=(t=e[r])&&t.datum&&null!=(n=e[i])&&n.datum?(o=e[r].datum[r],a=e[i].datum[i]):(o=e[r],a=e[i])),{standardDatumValue:o,positiveDiffValue:a}},Zx=function(e){var t=e.positiveDiffDatumKey,n=null==t?void 0:t.split(',"modifier":"'+Gx+'"}')[0];return n!==t?n+"}":null},Jx=function(e){var t,n,i,r,o,a,l=[],s=0;return null!=e&&e.bars&&(null==e||e.bars.keys.forEach((function(){l.push({type:"bar",index:s}),s+=1}))),null!=e&&e.areas&&(null==e||null==(i=e.areas)||i.keys.forEach((function(){l.push({type:"area",index:s}),s+=1}))),null==e||!e.lines||null!=e&&null!=(t=e.lines)&&t.scatter||null==e||null==(r=e.lines)||r.keys.forEach((function(){l.push({type:"lines",index:s}),s+=1})),null!=e&&e.lines&&null!=e&&null!=(n=e.lines)&&n.scatter&&(null==e||null==(o=e.lines)||o.keys.forEach((function(){l.push({type:"scatter",index:s}),s+=1}))),null!=e&&e.trends&&(null==e||null==(a=e.trends)||a.keys.forEach((function(){l.push({type:"trend",index:s}),s+=1}))),l},$x=function(e,t){var n=-Infinity;if(t&&e)for(var i,r=ve(t);!(i=r()).done;)for(var o=i.value,a=0;a<e.length;a++)e[a][o]>n&&(n=e[a][o]);return n},eb=function(e,t){var n=Infinity;if(t&&e)for(var i,r=ve(t);!(i=r()).done;)for(var o=i.value,a=0;a<e.length;a++)e[a][o]<n&&(n=e[a][o]);return Infinity===n?0:n};function tb(e,t,n,i,r){var o=e?Math.max.apply(Math,e.map((function(e){return e.value}))):void 0,a=e?Math.min.apply(Math,e.map((function(e){return e.value}))):void 0;return o&&a&&o>t&&a<n?Px("y",i,r,void 0,void 0,[1.0005*a,1.0005*o]):o&&o>t?Px("y",i,r,void 0,void 0,[n,1.0005*o]):a&&a<n?Px("y",i,r,void 0,void 0,[1.0005*a,t]):Px("y",i,r)}var nb,ib=function(e){if(void 0===e||0===e)return"dotted";"number"==typeof e&&(e=e.toString());var t=e.split(" ").map(Number);if(1===t.length){if(1===t[0])return"solid";if(t[0]>=2)return"dotted"}else{if(t.every((function(e){return e>=2})))return"dotted";if(t[0]<2)return 1===t[0]?"solid":"dotted"}return"solid"},rb=Ax({margin:0,color:"inherit",fontFamily:"inherit",letterSpacing:"inherit",fontSize:"0.9rem",fontWeight:700,padding:0}),ob=Ax({borderBottom:"1px dotted rgba(0,0,0,0.025)"}),ab=Ax({alignItems:"center",display:"flex",fontFamily:"inherit",letterSpacing:"inherit",gap:6}),lb=Ax({display:"block",fontFamily:"inherit",letterSpacing:"inherit",margin:0,padding:0,textAlign:"right"}),sb=Ax({display:"grid",gridTemplateRows:"auto 1fr",gridRowGap:12,variants:{displayGrid:(nb={},nb.true={gridTemplateColumns:"1fr 1fr",gridColumnGap:48},nb.false={gridTemplateColumns:"1fr"},nb)}}),ub=Ax({borderTop:"1px solid rgba(200, 200, 200, 0.4)"}),db=Ax({display:"grid",gridTemplateColumns:"auto 1fr",gap:12,fontWeight:500,color:"inherit",alignItems:"center"}),cb=Ax({display:"block",padding:0,margin:0}),pb=Object.assign((function(){return null}),{wrapper:function(e,t,n){var i=Array(n||1).fill("auto").join(" ");return t&&(i="20px "+i),e&&(i+=" 40px"),Ax({display:"grid",gridTemplateRows:i,gap:12,padding:6})},heading:rb,total:ub,highlighted:Ax({wordBreak:"break-all"}),row:ob,rowLabel:ab,resultGrid:sb,rowValue:lb,tooltipRowContainer:db,totalLabel:cb,sectionTitle:Ax({color:"#7d838d",fontFamily:"inherit",fontSize:12,fontWeight:700,marginBottom:0,marginTop:"0.25rem"})}),fb=Fl({fontSize:12}),mb=Fl({color:Sl(35)}),hb=Fl({variants:{1:{true:{fontSize:22.652}},2:{true:{fontSize:19.416}},3:{true:{fontSize:18}},4:{true:{fontSize:16}}}}),vb=function(e){var t,n,i,o=e.chartProps,a=e.datumKey,l=e.tooltipNearestDatum.key,s=[].concat((i=r.sumBy([(n=o).bars,n.areas,n.lines,n.trends],(function(e){return e?1:0}))>=1,n.sharedTooltip||i?Object.keys(null!=(t=null==e?void 0:e.datumKey)?t:{}):[l]));s.sort((function(t,n){var i=e.formatSeriesName(t),r=e.formatSeriesName(n);return i?r?i<r?-1:1:-1:1}));var u=[].concat(s).filter((function(e){return e&&void 0!==a[e].datum[e]})),d=e.formatValue?e.formatValue(a[l].datum[l]):a[l].datum[l];return p.jsxs(gb,{total:o.showTotalOnTooltip,title:!0,sections:void 0!==d&&u.length>1?2:1,children:[p.jsx("p",{className:""+pb.heading,children:null==e?void 0:e.heading}),void 0!==d&&p.jsxs("div",{className:""+pb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[u.length>1&&p.jsx("p",{className:pb.sectionTitle+" "+mb,children:"Active"}),p.jsx(bb,{datumKey:a,keyString:l,chartProps:o,chartTooltipProps:e,allDatumKeysOnVerticalAxis:e.allDatumKeysOnVerticalAxis})]}),u.length>1&&p.jsxs("div",{className:""+pb.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[p.jsx("p",{className:pb.sectionTitle+" "+mb,children:"All"}),u.map((function(t){var n;return null!=o&&null!=(n=o.lines)&&n.scatter&&void 0===a[t].datum[t]?null:p.jsx(bb,{datumKey:a,keyString:t,chartProps:o,chartTooltipProps:e,allDatumKeysOnVerticalAxis:e.allDatumKeysOnVerticalAxis},"chart_"+t)}))]}),o.showTotalOnTooltip&&p.jsxs("div",{className:pb.total+" "+pb.tooltipRowContainer,children:[p.jsx("p",{className:""+pb.totalLabel,children:"Rounded total: "}),p.jsx("p",{className:pb.row+" "+pb.rowValue,children:e.formatValue?e.formatValue(null==e?void 0:e.total):e.total})]})]})},gb=function(e){return p.jsx("div",{"data-themeapi":"charts.popoverMenus","data-chipposition":"below.right",className:""+pb.wrapper(e.total,null==e?void 0:e.title,null==e?void 0:e.sections),"data-sections":null==e?void 0:e.sections,children:null==e?void 0:e.children})},xb=function(e){var t,n,i;return p.jsxs("div",{style:{fontWeight:e.bold?700:500},className:""+pb.tooltipRowContainer,children:[p.jsxs("span",{className:pb.row+" "+pb.rowLabel,children:[(null==e?void 0:e.icon)&&p.jsx(Lx,{type:null==e||null==(t=e.icon)?void 0:t.type,color:null==e||null==(n=e.icon)?void 0:n.color,additionalStyles:null==e||null==(i=e.icon)?void 0:i.additionalStyles}),p.jsx("span",{className:""+pb.highlighted,children:null==e?void 0:e.label})]}),p.jsx("p",{className:pb.row+" "+pb.rowValue,children:null==e?void 0:e.value})]})},bb=function(e){var t,n=e.datumKey,i=e.keyString,r=e.chartProps,o=e.chartTooltipProps,a=function(e,t){var n,i,r,o,a;return null!=t&&t.bars&&null!=t&&null!=(n=t.bars.keys)&&n.find((function(t){return t===e}))?"bar":null==t||!t.lines||null!=t&&t.lines.scatter||null==t||null==(i=t.lines)||null==(i=i.keys)||!i.find((function(t){return t===e}))?null!=t&&t.areas&&null!=t&&null!=(r=t.areas)&&null!=(r=r.keys)&&r.find((function(t){return t===e}))?"area":null!=t&&t.lines&&null!=t&&t.lines.scatter&&null!=t&&null!=(o=t.lines)&&null!=(o=o.keys)&&o.find((function(t){return t===e}))?"scatter":null!=t&&t.trends&&null!=t&&null!=(a=t.trends)&&null!=(a=a.keys)&&a.find((function(t){return t===e}))?"trend":null:"lines"}(n[i].key,r);if(!a)return null;var l,s=null!=(t=function(e,t,n,i){var r,o,a,l,s;return"area"==t&&null!=e&&null!=(r=e.areas)&&r.formatter?e.areas.formatter(n):"bar"==t&&null!=e&&null!=(o=e.bars)&&o.formatter?null==e||null==(a=e.bars)?void 0:a.formatter(i,n):"lines"==t&&null!=e&&null!=(l=e.lines)&&l.formatter?e.lines.formatter(n):"scatter"==t&&null!=e&&null!=(s=e.lines)&&s.formatter?e.lines.formatter(i,n):void 0}(r,a,i,n[i].datum))?t:o.getColor(i),u=o.formatSeriesName(i),d="undefined"===(l=o.formatValue?o.formatValue(n[i].datum[i]):n[i].datum[i])?"-":l;return p.jsx("div",{style:{width:380},children:p.jsx(xb,{icon:{type:a,color:s,additionalStyles:o.additionalStyles?o.additionalStyles(i):void 0},label:u,value:d})})},yb=function(e){var t,i,r,o,a,l,s,u=Qx(e.datum),d=u.positiveDiffValue,c=u.standardDatumValue,f=(t=e.chartData[0],(r=(i=Object.keys(t).find((function(e){return e.includes(Gx)})))?Zx({positiveDiffDatumKey:i}):null)?t[r]:null),m=(s=-1!==(l=(a=(o={nearestDatum:e.tooltipNearestDatum.datum,chartData:e.chartData}).chartData).indexOf(o.nearestDatum))?a[l-1]:null)?Qx(s):null;return p.jsxs(gb,{title:!0,sections:1,children:[p.jsx("p",{className:""+pb.heading,children:e.heading}),p.jsx("div",{children:d>0&&c&&f&&m&&m.standardDatumValue?p.jsx(wb,{positiveDiffValue:d,standardDatumValue:c,previousDatumValue:m.standardDatumValue,firstStepDatumValue:f,formatValue:e.formatValue}):0===d&&c&&f?p.jsx(xb,{label:p.jsx(jb,{style:{width:20,height:20,display:"block"},fill:"#12B76A"}),value:p.jsxs(n.Fragment,{children:[p.jsx("span",{style:{fontWeight:"bold"},children:e.formatValue?e.formatValue(c):c})," ",p.jsxs("span",{style:{opacity:.7},children:["(",Kx({original:f,test:c}),"%)"]})]})}):"Sorry, we couldn't access data to show change values"})]})},wb=function(e){var t=e.standardDatumValue,i=e.positiveDiffValue,r=e.firstStepDatumValue,o=e.previousDatumValue;return p.jsxs("div",{children:[p.jsx(xb,{label:p.jsx(jb,{style:{width:20,height:20,display:"block"},fill:"#12B76A"}),value:p.jsxs(n.Fragment,{children:[p.jsx("span",{style:{fontWeight:"bold"},children:e.formatValue?e.formatValue(t):t})," ",p.jsxs("span",{style:{opacity:.7},children:["(",Kx({original:r,test:t}),"%)"]})]})}),p.jsx(xb,{label:p.jsx(Sb,{style:{width:20,height:20,display:"block"},fill:"#F04438"}),value:p.jsxs(n.Fragment,{children:[p.jsxs("span",{style:{fontWeight:"bold"},children:["-",e.formatValue?e.formatValue(Xx(i)):Xx(i)]})," ",p.jsxs("span",{style:{opacity:.7},children:["(-",Kx({original:o,test:i}),"%)"]})]})})]})},Cb=["fill"],jb=function(e){var t=e.fill,n=void 0===t?"#213165":t,i=we(e,Cb);return p.jsx("svg",ge({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.293 5.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L14.586 11H3a1 1 0 1 1 0-2h11.586l-2.293-2.293a1 1 0 0 1 0-1.414Z",fill:n})}))},Fb=["fill"],Sb=function(e){var t=e.fill,n=void 0===t?"#213165":t,i=we(e,Fb);return p.jsx("svg",ge({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i,{children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 13a1 1 0 1 0 0 2h5a1 1 0 0 0 1-1V9a1 1 0 1 0-2 0v2.586l-4.293-4.293a1 1 0 0 0-1.414 0L8 9.586 3.707 5.293a1 1 0 0 0-1.414 1.414l5 5a1 1 0 0 0 1.414 0L11 9.414 14.586 13H12Z",fill:n})}))},kb=function(e){return p.jsx(Ex,{className:null!=e&&e.alignCenter?""+Ox.scrollbar:""+Ox.wrapper,x:!0,children:p.jsx(z,{scale:P.scaleOrdinal({domain:null==e?void 0:e.keys,range:null==e?void 0:e.colors}),children:function(t){return p.jsx("div",{className:Ox.container,children:t.map((function(t,n){var i,r,o,a=null==e||null==(i=e.typeIndex)?void 0:i.find((function(e){return e.index===t.index})),l=Ux(t.datum),s=e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(t.text):[],u=e.replaceDimensionColorsIfPossible?s.filter((function(e){return!e.isRuleOnDimension})):s;return p.jsxs(R.LegendItem,{margin:"0",children:[e.funnelChart?0===n&&u.map((function(e,t){return p.jsx(Lx,{type:null==a?void 0:a.type,color:e.color,reason:e.explanation},t)})):u.map((function(e,t){return p.jsx(Lx,{type:null==a?void 0:a.type,color:e.color,reason:e.explanation},t)})),p.jsx(Lx,{type:null==a?void 0:a.type,color:l?"#9AA4B250":(r=null!=e&&e.formatter&&null!=e&&e.colors&&e.data?zx(t.datum,null==e?void 0:e.formatter,null==e?void 0:e.colors,n)(e.data):t.value,o=s.filter((function(e){var n=e.conditionIsMet(t.datum);return e.isRuleOnDimension&&n})),e.replaceDimensionColorsIfPossible&&o[0]&&o[0].conditionIsMet(t.datum)?o[0].color:r),additionalStyles:function(){if("trend"===(null==a?void 0:a.type)&&e.getIndicatorStyles)return e.getIndicatorStyles(t.datum)}(),reason:u.length>0?"Original color":void 0}),p.jsx(R.LegendLabel,{className:Ox.label,style:{},children:l?"Previous Step":null!=e&&e.formatSeriesName?null==e?void 0:e.formatSeriesName(null==t?void 0:t.text):t.text})]},"legend-quantile-"+n)}))})}})})},Ab=function(e){return{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textShadow:"rgba(0, 0, 0, 0.01) 0 0 1px",position:"absolute",lineHeight:"16px",fontSize:12,pointerEvents:"none",background:e.background||"white",border:e.border||"none",borderRadius:e.borderRadius||"4px",boxShadow:e.boxShadow||"0 1px 2px rgba(33,33,33,0.2)",color:e.color||"#212529",fontFamily:e.fontFamily||"Inter, sans-serif",letterSpacing:e.letterSpacing||"0.02em",padding:e.padding||(e.old?10:16)}};function Tb(e,t,n,i,r,o){void 0===o&&(o=0);var a=document.createElement("canvas").getContext("2d");if(!a)return e;a.font=r+" "+i+" "+n;var l=t-o;if(a.measureText(e).width+.4*((null==e?void 0:e.length)-1)>l){for(var s=l-a.measureText("...").width,u="",d=0;d<e.length;d++){var c=e[d],p=a.measureText(c).width;if(!(s>=p))break;u+=c,s-=p+.4}return u+"..."}return e}function _b(e,t,n){if(1===e.length)return null==t?void 0:t.from.x;var i=e[n+1],r=e[n-1];return i&&r||i?i.from.x-t.from.x:r?t.from.x-r.from.x:0}var Ib=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new Error("Invalid font size type")},Db=function(e){if(void 0!==e){if("number"==typeof e)return e;switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 900;case"lighter":return 100;default:var t=parseInt(e,10);if(isNaN(t))throw new Error("Invalid font weight type");return t}}};function Ob(e,t,n){var i=(t-n)/3;return i*e+(n-9*i)}function Eb(e,t,n,i){var r=0,o=function(e,t){var n,i;return{fontFamily:null!=(n=null!=(i=null==e?void 0:e.fontFamily)?i:t)?n:Mx,fontWeight:null!=e&&e.fontWeight?Db(e.fontWeight):"700",fontSize:null!=e&&e.fontSize?Ib(e.fontSize):9,letterSpacing:"normal"}}(n,null==i?void 0:i.fontFamily),a=o.fontFamily,l=o.fontWeight,s=o.fontSize,u=o.letterSpacing;return e.forEach((function(e){var n=function(e,t,n,i,r){var o=document.createElementNS("http://www.w3.org/2000/svg","svg"),a=document.createElementNS("http://www.w3.org/2000/svg","text");a.textContent=e,a.setAttribute("font-family",t),a.setAttribute("font-weight",n),a.setAttribute("font-size",i),a.setAttribute("letter-spacing",r),o.appendChild(a),document.body.appendChild(o);var l=a.getBBox().width;return document.body.removeChild(o),l}(t(e),a,""+l,""+s,u);r=Math.max(r,n)})),r}var Lb=function(e){var t,n,i,r,o,a,l={fontFamily:null!=(t=null==e||null==(n=e.theme)?void 0:n.fontFamily)?t:Mx,fontWeight:null==e||null==(i=e.theme)?void 0:i.fontWeight,fontSize:null==e||null==(r=e.theme)?void 0:r.fontSize,style:{fill:null!=(o=null==(a=e.theme)?void 0:a.color)?o:Sl(10)}};if("y"===(null==e?void 0:e.axis)){var s,u,d=-((null==e?void 0:e.axisFromPoint.y)+e.axisToPoint.y)/2;return p.jsx("svg",{x:"-1.25em",y:"0",fontSize:null==e||null==(s=e.theme)?void 0:s.fontSize,style:{overflow:"visible"},className:"vizzly-axis-title vizzly-axis-title-y",children:p.jsx("text",ge({transform:"rotate(-90)",x:d,y:"-"+(e.horizontal?null!=(u=e.leftPanelWidth)?u:82:38)},l,{textAnchor:"middle",children:p.jsx("tspan",{x:d,dy:"0em",children:null==e?void 0:e.label})}))})}return p.jsx("g",{className:"vizzly-axis-title vizzly-axis-title-x",transform:"translate(0, 0)",children:p.jsx("text",ge({x:((null==e?void 0:e.axisFromPoint.x)+e.axisToPoint.x)/2,y:"34",textAnchor:"middle",dominantBaseline:"middle"},l,{children:null==e?void 0:e.label}))})},Nb=function(e){var n,i,r,o,a,l,s,u=e.ticks,d=e.xAxisIsTime,f=function(e,n,i,r,o,a,l,s){void 0===s&&(s=!1);var u=t.useState([]),d=u[0],c=u[1];return t.useEffect((function(){if(e&&n.length&&i){var t=function(e,t,n){return Eb(e,(function(e){return e.formattedValue}),t,n)}(n,l,a),u=n.find((function(e){return e.from.x+t/8>=r+t/2})),d=o-r-1.2*t;if(!(d<0)){for(var p=Math.floor((d-40)/(t+(s&&t>54?60:30))),f=Math.max(1,Math.floor(n.length/(p+1))),m=[u],h=(null==u?void 0:u.index)+f;h<n.length;h+=f)m.push(n[h]);c(m)}}}),[e,n,i,a,l]),i?d:n}(e.chartWidth,u,d,e.axisFromPoint.x,e.axisToPoint.x,null==e?void 0:e.labelProps,null==e||null==(n=e.theme)?void 0:n.labels,d&&u.length>10);return"none"===e.type?null:e.horizontal?p.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(i=e.ticks)?void 0:i.map((function(t,n,i){var r;return function(t){return 0===t||t===(null==e?void 0:e.ticks.length)-1}(n)?c.createElement(Mb,ge({},t,{width:_b(i,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(r=e.theme)?void 0:r.labels,type:null==e?void 0:e.type})):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==f?void 0:f.map((function(t,n,i){var r;return c.createElement(Mb,ge({},t,{width:_b(i,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:(null==t?void 0:t.index)+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(r=e.theme)?void 0:r.labels,type:null==e?void 0:e.type,xAxisIsTime:null==e?void 0:e.xAxisIsTime}))}))),!(null!=e&&e.hideAxisLine)&&p.jsx("line",{className:"visx-line",x1:e.axisFromPoint.x,y1:e.axisFromPoint.y,x2:e.axisToPoint.x,y2:e.axisToPoint.y,fill:"transparent",shapeRendering:"crispEdges",stroke:null==e?void 0:e.tickStroke,strokeWidth:null==e?void 0:e.strokeWidth,strokeLinecap:"square"}),(null==e?void 0:e.label)&&p.jsx(Lb,ge({},e,{theme:null==e||null==(r=e.theme)?void 0:r.axisTitles,axis:"x",horizontal:null!=(o=null==e?void 0:e.axisHorizontal)&&o,leftPanelWidth:e.leftPanelWidth}))]}):p.jsxs(t.Fragment,{children:[null==e||null==(a=e.ticks)?void 0:a.map((function(t,n){var i;return p.jsx("g",{className:"visx-group visx-axis-tick vizzly-axis-h",transform:"translate(0, 0)",children:p.jsx(Mb,ge({},t,{width:82,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type,xAxisIsTime:null==e?void 0:e.xAxisIsTime}))},t.index+"-"+(null==e?void 0:e.uniqueId))})),(null==e?void 0:e.label)&&p.jsx(Lb,ge({},e,{theme:null==e||null==(l=e.theme)?void 0:l.axisTitles,axis:"y",horizontal:null!=(s=e.axisHorizontal)&&s}))]})},Mb=function(e){var n,i,r,o,a,l,s,u,d,c,f,m=e.type,h=null!=(n=e.theme)&&n.fontSize?Ib(null==(i=e.theme)?void 0:i.fontSize):9,v=null!=(r=e.theme)&&r.fontWeight?""+Db(null==(o=e.theme)?void 0:o.fontWeight):"700",g=null!=(a=null==(l=e.theme)?void 0:l.fontFamily)?a:Mx,x=e.width/6,b=Tb(e.formattedValue,e.horizontal&&e.last?e.width-Ob(h,40,5):e.width-Ob(h,4,0),g,""+h,v,x),y="end2end"===m?e.last?e.right:null==e?void 0:e.left:e.horizontal?null!=e&&e.last?(null==e||null==(s=e.from)?void 0:s.x)-5:null==e||null==(u=e.from)?void 0:u.x:-5,w=null==e||null==(d=e.from)?void 0:d.y;return p.jsxs(t.Fragment,{children:[!e.horizontal&&p.jsx("line",{className:"visx-line",x1:"0",y1:w,x2:"0",y2:w,fill:"transparent",shapeRendering:"crispEdges",stroke:"#eaeaea",strokeWidth:"1",strokeLinecap:"square"}),p.jsx("g",{x:"-0.25em",y:"0.25em",children:p.jsx("text",{transform:"",x:y,y:e.horizontal?"16":w,fontFamily:g,fontWeight:v,fontSize:""+h,letterSpacing:.4,stroke:"none",textAnchor:"end2end"===m?e.last?"end":"start":e.horizontal?"middle":"end",style:{fill:null!=(c=null==(f=e.theme)?void 0:f.color)?c:"rgba(0, 0, 0, 0.6)"},"data-horizontal":e.horizontal?"true":"false","data-axisistime":e.xAxisIsTime?"true":"false","data-type":"type-"+m,children:p.jsx("tspan",{x:y,dy:e.horizontal?0:2,children:"end2end"===m||e.xAxisIsTime?e.formattedValue:b})})})]})},Rb=function(e){var n,i,r;return"none"===e.type?null:p.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(n=e.ticks)?void 0:n.map((function(n,i,r){var o,a;return 0===i?p.jsxs(t.Fragment,{children:[p.jsx(Pb,ge({},n,{width:null!=e&&e.horizontal?_b(r,n,i):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:!1,top:null==e?void 0:e.axisToPoint.y,horizontal:e.horizontal,theme:null==e||null==(o=e.theme)?void 0:o.labels,type:null==e?void 0:e.type})),p.jsx(Pb,ge({},n,{width:null!=e&&e.horizontal?_b(r,n,i):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,top:null==e?void 0:e.axisToPoint.y,last:!0,horizontal:e.horizontal,theme:null==e||null==(a=e.theme)?void 0:a.labels,type:null==e?void 0:e.type,maxValueOfYAxis:null==e?void 0:e.maxValueOfYAxis}))]},n.index+"-"+(null==e?void 0:e.uniqueId)):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==e||null==(i=e.ticks)?void 0:i.map((function(t,n,i){var r;return c.createElement(Pb,ge({},t,{width:null!=e&&e.horizontal?_b(i,t,n):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,top:null==e?void 0:e.axisToPoint.y,right:null==e?void 0:e.axisToPoint.x,last:!1,key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(r=e.theme)?void 0:r.labels,type:null==e?void 0:e.type}))}))),(null==e?void 0:e.label)&&p.jsx(Lb,ge({},e,{theme:null==e||null==(r=e.theme)?void 0:r.axisTitles,axis:null!=e&&e.horizontal?"x":"y",horizontal:null==e?void 0:e.horizontal}))]})},Pb=function(e){var t,n,i,r,o,a,l,s,u,d=null!=(t=e.theme)&&t.fontSize?Ib(null==(n=e.theme)?void 0:n.fontSize):"9",c=null!=(i=e.theme)&&i.fontWeight?""+Db(null==(r=e.theme)?void 0:r.fontWeight):"700",f=null!=(o=null==(a=e.theme)?void 0:a.fontFamily)?o:Mx,m=Tb(null!=(l=null==e?void 0:e.maxValueOfYAxis)?l:e.formattedValue,e.width,f,""+d,c,5),h=e.horizontal?e.last?e.right:e.from.x:e.to.x;return p.jsx("g",{x:"-0.25em",y:"0.25em",children:p.jsx("text",{transform:"matrix(1, 0, 0, 1, 0, 0)",x:h,y:e.horizontal?"16":null!=e&&e.last?e.top:e.from.y,fontFamily:f,fontWeight:c,fontSize:d,letterSpacing:.4,stroke:"none",textAnchor:e.horizontal&&"end2end"===e.type?e.last?"end":"start":"middle",style:{fill:null!=(s=null==(u=e.theme)?void 0:u.color)?s:"rgba(0, 0, 0, 0.6)"},children:p.jsx("tspan",{x:h,dy:e.horizontal?0:2,children:m})})})},zb=t.memo((function(e){var n=null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(e.value):e.value,i=e.goalLine,r=e.axisProps,o=e.toX,a=t.useState(0),l=a[0],s=a[1],u=t.useRef(null);t.useEffect((function(){if(u.current){var e=u.current.getBBox();s(e.width+16)}}),[n]);var d=t.useMemo((function(){return function(e,t){for(var n,i,r,o=0,a=ve(e);!(r=a()).done;){var l=r.value;if(l.value<=t.value&&(n=l),l.value>=t.value){i=l;break}}return n&&i&&(o=n.value===i.value?n.from.y:n.from.y+(i.from.y-n.from.y)/(i.value-n.value)*(t.value-n.value)),Math.round(o)}(r.ticks,i)}),[r.ticks,i]);return p.jsxs("g",{children:[p.jsx(q.Line,{from:{x:0,y:d},to:{x:o,y:d},stroke:i.color,strokeDasharray:"dashed"==i.strokeStyle?"5,5":void 0,strokeWidth:2,strokeLinecap:"round",shapeRendering:"smooth"}),p.jsxs("g",{transform:"translate("+(o-l-8- -(null==e?void 0:e.marginRight))+","+(d+8)+")",children:[p.jsx("path",{d:"M 0,0\n l -8,-8 \n l 8,-8 \n h "+l+" \n a 3,3 0 0 1 3,3 \n v 10 \n a 3,3 0 0 1 -3,3 \n h "+-l+" z",fill:i.color}),p.jsx("text",{ref:u,x:l/2,y:-1,dy:-4,textAnchor:"middle",fontFamily:Mx,fontSize:9,fill:Vb(i.color,["#fff",Sl(0)]),children:n})]})]})})),Vb=function(e,t){return r.maxBy(t,(function(t){return f.contrast(t,e)}))||e},qb=function(e,t,n,i){return(n+"_"+t+"_"+i+"_"+btoa(e.key+"_"+e.value+"_"+e.direction)).replace(/=/g,"")};function Bb(e,t){return null==t?void 0:t.filter((function(t){return t.key===e}))}function Wb(e,t,n){return qb(e,t,">="===e.direction?"above":"below",n)}var Hb=function(e){var n=t.useContext(N.DataContext)||{},i=n.yScale,r=n.width;if(!i||!r)return null;var o=e.height-e.margin.top;return p.jsxs(t.Fragment,{children:[p.jsx("g",{transform:"translate(50, 0)",children:e.threshold.map((function(t,n){var o,a,l=i(t.value);return p.jsx("g",{children:p.jsx("line",{x1:0,y1:l,x2:r-e.margin.right-e.margin.left,y2:l,stroke:null!=(o=null==(a=e.theme)?void 0:a.stroke)?o:"#F4F4F4",strokeWidth:"1",fill:"transparent","data-themeapi":"charts.threshold.stroke"})},"threshold-"+n)}))}),p.jsx("defs",{children:e.threshold.map((function(n,r){var a=i(n.value);return p.jsxs(t.Fragment,{children:[p.jsx("clipPath",{id:qb(n,e.idPrefix,"above",e.uniqueId),children:p.jsx("rect",{x:"0",y:"0",width:"100%",height:a})}),p.jsx("clipPath",{id:qb(n,e.idPrefix,"intermediate",e.uniqueId),children:p.jsx("rect",{x:"0",y:a,width:"100%",height:0})}),p.jsx("clipPath",{id:qb(n,e.idPrefix,"below",e.uniqueId),children:p.jsx("rect",{x:"0",y:a,width:"100%",height:o-a})})]},"threshold-"+r)}))})]})},Yb=function(e,t){var n=e||"natural";return"natural"===n&&(n=t?"monotoneY":"monotoneX"),n};function Gb(e,t){try{var n=(i=e,getComputedStyle(document.documentElement).getPropertyValue(i).trim());return n?f(n).brighten(t).hex():void 0!==e?f(e).brighten(t).css():void 0}catch(e){return void console.error("Error in lightenColor:",e)}var i}var Ub=function(e,t,n,i){return{xAccessor:function(r){return r?i?r[n]:e?new Date(r[t]):r[t]:void 0},yAccessor:function(r){return r?i?e?new Date(r[t]):r[t]:r[n]:void 0}}},Kb=function(e){var n,i,o,a,l,s,u,d,f,m,h,v,g,x,b,y,w,C,j,F,S,k,A,T,_,I,D,O,E,L,R,P,z,V,q,B,W=_x(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),H=e.approxYAxisLabelCount,Y=void 0===H?"auto":H,G=e.approxXAxisLabelCount,U=void 0===G?"auto":G,K=e.removeStroke,X=void 0!==K&&K,Q=e.horizontal,Z=void 0!==Q&&Q,J=e.theme,$=e.x,ee=(V=e.x,q=e.bars,e.forceXAxisAsTime&&!q||r.isDate(null==(B=Rx({bars:q,lines:e.lines,areas:e.areas},"data")[0])?void 0:B[V])),te=Nx[Yb(e.lineCurve,Z)],ne=function(e,t){var n,i,r,o;return{fill:null!=(n=null==t?void 0:t.color)?n:"rgba(0, 0, 0, 0.6)",fontSize:null!=(i=null==t?void 0:t.fontSize)?i:9,fontWeight:null!=(r=null==t?void 0:t.fontWeight)?r:700,fontFamily:null!=(o=null==t?void 0:t.fontFamily)?o:Mx,textAnchor:e?"end":"middle",scaleToFit:"shrink-only"}},ie=function(e,n){var i=t.useRef(null),o=t.useState(0),a=o[0],l=o[1];t.useEffect((function(){var e=r.throttle((function(){l(i.current?i.current.clientWidth:0)}),100);return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}));var s=Math.min(a<1e3?parseInt((""+a)[0]):12,12);return"auto"!=e?[i,e]:[i,s*(n?4:1)]}(U,!(null!=e&&e.horizontal)&&(null==e?void 0:e.forceXAxisAsTime)),re=ie[0],oe=ie[1],ae=t.useState(void 0),le=ae[0],se=ae[1],ue=t.useState(void 0),de=ue[0],ce=ue[1],pe=Rx(e,"colors"),fe=N.buildChartTheme(ge({},N.lightTheme,{colors:pe,tickLength:0,gridColor:"",gridColorDark:""})),me=Rx(e,"data"),he=null!=(i=null==J||null==(o=J.axis)?void 0:o.stroke)?i:"#eaeaea",ve=function(e,t){var n=0===e?"none":2===e?"end2end":"auto";return{xAxisType:n,xAxisAttributes:"end2end"===n?{left:0}:null,yAxisType:0===t?"none":2===t?"end2end":"auto"}}(U,Y),xe=ve.xAxisType,be=ve.xAxisAttributes,ye=ve.yAxisType,we=null!=(a=null!=(l=null==e||null==(s=e.lines)?void 0:s.data.length)?l:null==e||null==(u=e.areas)||null==(u=u.data)?void 0:u.length)?a:null==(d=e.bars)?void 0:d.data.length,Ce=function(e){var n,i,r,o,a,l;return t.useMemo((function(){for(var t=-Infinity,n=Infinity,i=0,r=["bars","lines","areas"];i<r.length;i++){var o,a,l=r[i],s=null==(o=e[l])?void 0:o.data,u=null==(a=e[l])?void 0:a.keys,d=$x(s,u),c=eb(s,u);d>t&&(t=d),c<n&&(n=c)}return{maxValue:t,minValue:n}}),[null==(n=e.bars)?void 0:n.data,null==(i=e.bars)?void 0:i.keys,null==(r=e.lines)?void 0:r.data,null==(o=e.lines)?void 0:o.keys,null==(a=e.areas)?void 0:a.data,null==(l=e.areas)?void 0:l.keys])}(e),je=Ce.maxValue,Fe=Ce.minValue,Se=null!=(f=null==(m=e.lines)?void 0:m.threshold)?f:null==(h=e.areas)?void 0:h.threshold,ke=function(e,t,n,i,r,o){if(e&&t)return Eb(r,(function(e){return n.formatXAxisLabel?n.formatXAxisLabel(e[o]):String(e[o])}),null==i?void 0:i.labels,void 0)}(Z,null!=(v=e.forceXAxisAsTime)&&v,e,J,Rx(e,"data"),e.x),Ae=e.sparkline?{top:2,bottom:2,left:"right"!==e.yAxisOrientation?50:0,right:0}:function(e,t,n,i,r){var o=Boolean(null==i?void 0:i.x),a=Boolean(null==i?void 0:i.y);return{top:8,bottom:o?40:25,left:e?("none"!==n?r?r+10:82:25)+(a?24:0):t?50+(a?24:0):25,right:25}}(Z,"right"!==e.yAxisOrientation,xe,null==e?void 0:e.axisTitles,ke),Te=Ab(ge({},e.popOverMenuStyles,{old:!0})),_e=function(t){if(e.trends){var n,i,r,o,a,l,s,u,d,c,p,f=null==(n=e.trends)?void 0:n.keys.indexOf(t),m=e.trends;return{borderStyle:null!=(i=ib(null==(r=m.strokeDasharray)?void 0:r[f]))?i:"dotted",borderWidth:0,marginTop:null!=(o=null==(a=m.strokeWidth)?void 0:a[f])?o:2,borderTopWidth:null!=(l=null==(s=m.strokeWidth)?void 0:s[f])?l:2,borderColor:null!=(u=null==(d=m.colors)?void 0:d[f])?u:"#1E1D2D",opacity:null!=(c=null==(p=m.opacity)?void 0:p[f])?c:1}}};return p.jsxs("div",{ref:re,style:{position:"relative",height:W},className:"vizzly-xy-chart"+(null!=e&&null!=(g=e.bars)&&g.funnelChart?" vizzly-xy-chart-funnel":""),"data-testid":"vizzly-"+(null==e?void 0:e.uniqueId)+"-chart",children:[p.jsxs(N.XYChart,{theme:fe,margin:Ae,height:W,xScale:Px("x",Z,ee,null==e||null==(x=e.lines)?void 0:x.scatter,!(null==e||!e.lines)||!(null==e||!e.areas)),yScale:tb(null==e?void 0:e.goalLine,je,Fe,Z,ee),horizontal:Z,onPointerUp:function(t){return null==e?void 0:e.onClick(le,de,t)},children:[p.jsx(N.Grid,{columns:Z,rows:!Z,stroke:"black",strokeDasharray:"0.5 5",strokeWidth:X?0:2,lineStyle:{strokeLinecap:"round",stroke:null!=(b=null==J||null==(y=J.grid)?void 0:y.stroke)?b:"rgba(200, 200, 200, 0.2)"}}),!(null!=e&&e.sparkline)&&p.jsxs(p.Fragment,{children:["none"!==xe&&p.jsx(N.Axis,ge({},be,{tickLabelProps:function(){var e=ge({},ne(Z,null==J?void 0:J.labels));return Z||(e.y=15),e},numTicks:"end2end"===xe?we:oe,strokeWidth:X?0:1,tickStroke:"#eaeaea",stroke:Z?"transparent":he,orientation:Z?"left":"bottom",tickFormat:qx(e.formatXAxisLabel,e.forceXAxisAsTime||ee,me),label:Z?null==e||null==(w=e.axisTitles)?void 0:w.y:null==e||null==(C=e.axisTitles)?void 0:C.x,children:function(t){return p.jsx(Nb,ge({},t,{theme:J,type:xe,uniqueId:null==e?void 0:e.uniqueId,chartWidth:null==e?void 0:e.width,xAxisIsTime:!!e.forceXAxisAsTime,leftPanelWidth:ke,axisHorizontal:null==e?void 0:e.horizontal}))}})),p.jsx(N.Axis,{labelOffset:50,tickLabelProps:function(){var t=ge({},ne(Z,null==J?void 0:J.labels));return Z||"right"===e.yAxisOrientation||(t.width=50,t.textAnchor="middle"),t},hideAxisLine:!0,numTicks:"auto"===Y?5:Y,strokeWidth:X?0:1,hideTicks:!0,tickLength:e.horizontal||"right"===e.yAxisOrientation?10:25,stroke:he,orientation:Z?"bottom":e.yAxisOrientation||"left",tickFormat:Bx(e),label:Z?null==e||null==(j=e.axisTitles)?void 0:j.x:null==e||null==(F=e.axisTitles)?void 0:F.y,children:function(t){return p.jsx(Rb,ge({},t,{theme:J,type:ye,horizontal:Z,maxValueOfYAxis:null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(je):je,uniqueId:null==e?void 0:e.uniqueId}))}})]}),Se&&Se.length>0&&p.jsx(Hb,{threshold:Se,height:W,margin:Ae,idPrefix:e.idPrefix,theme:null==J?void 0:J.threshold,uniqueId:e.uniqueId}),p.jsx("style",{children:"\n .visx-bar-stack .visx-bar {\n stroke: #fff;\n stroke-width: 2px;\n }\n .vizzly-xy-chart-funnel .visx-bar-stack .visx-bar {\n stroke-width: 0;\n }\n .visx-tooltip-glyph svg {\n max-width: 10px\n height: 10px;\n }\n "+Tx+"\n "}),(null==e?void 0:e.areas)&&p.jsx(p.Fragment,{children:[].concat(e.areas.keys).map((function(n,i){var r,o,a,l,s,u=(null==(r=e.areas)?void 0:r.formatter)&&(null==(o=e.areas)?void 0:o.formatter(n))||(null==(a=e.areas)?void 0:a.colors[i]);return p.jsxs(t.Fragment,{children:[p.jsx(M.LinearGradient,{id:"g"+e.uniqueId+i,from:u,to:u,fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+i),null==(l=Bb(n,null==(s=e.areas)?void 0:s.threshold))?void 0:l.map((function(t,n){return p.jsx(M.LinearGradient,{id:"g"+e.uniqueId+i+"_"+n,from:t.color,to:t.color,clipPath:"url(#"+Wb(t,e.idPrefix,e.uniqueId)+")",fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+i+"_"+n)}))]})}))}),(null==e?void 0:e.areas)&&!(null!=e&&null!=(S=e.areas)&&S.stacked)&&[].concat(e.areas.keys).map((function(n,i){var r,o,a,l=ge({curve:te,dataKey:n,data:null==(r=e.areas)?void 0:r.data},Ub(ee,$,n,Z),{renderLine:!1});return p.jsxs(t.Fragment,{children:[c.createElement(N.AreaSeries,ge({},l,{key:"grouped_area_"+e.uniqueId+"_"+i,fill:"url(#g"+e.uniqueId+i+")"})),null==(o=Bb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return p.jsx(N.AreaSeries,ge({},l,{clipPath:"url(#"+Wb(t,e.idPrefix,e.uniqueId)+")",fill:"url(#g"+e.uniqueId+i+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+i+"_threshold_"+n)}))]})})),(null==e?void 0:e.areas)&&e.areas.stacked&&p.jsx(N.AreaStack,{curve:te,renderLine:!0,children:[].concat(e.areas.keys).map((function(n,i){var r,o,a,l=ge({dataKey:n,data:null==(r=e.areas)?void 0:r.data},Ub(ee,$,n,Z));return p.jsxs(t.Fragment,{children:[p.jsx(N.AreaSeries,ge({fill:"url(#g"+e.uniqueId+i+")",lineProps:{strokeWidth:4,strokeLinecap:"round"}},l),"areas_stacked_"+e.uniqueId+"_"+i),null==(o=Bb(n,null==(a=e.areas)?void 0:a.threshold))?void 0:o.map((function(t,n){return p.jsx(N.AreaSeries,ge({},l,{clipPath:"url(#"+Wb(t,e.idPrefix,e.uniqueId)+")",fill:"url(#g"+e.uniqueId+i+"_"+n+")"}),"grouped_area_"+e.uniqueId+"_"+i+"_threshold_"+n)}))]})}))}),(null==e?void 0:e.bars)&&!e.bars.stacked&&!(null!=e&&null!=(k=e.bars)&&k.funnelChart)&&p.jsxs(t.Fragment,{children:[e.enableHover&&p.jsx("style",{children:"\n /* We need to find a more accurate way to target the rect element. */\n .vizzly-xy-chart > div > svg > rect {\n cursor: pointer;\n }"}),p.jsx(N.BarGroup,{children:e.bars.keys.map((function(t,n){var i,r,o;return p.jsx(N.BarSeries,ge({radiusAll:!0,radius:null!=(i=null==(r=e.bars)||null==(r=r.styles)?void 0:r.cornerRadius)?i:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Ub(ee,$,t,Z),{colorAccessor:function(i){var r,o,a,l,s=null!=(r=null==e||null==(o=e.bars)||null==o.formatter?void 0:o.formatter(i,t))?r:pe[n],u=function(e){return Object.values(e)[0]};return e.enableHover&&u(null!=(a=null==le?void 0:le.datum)?a:{})===u(i)&&(s=null!=(l=Gb(s,.8))?l:s),s}}),"grouped_bar_"+e.uniqueId+"_"+n)}))})]}),(null==e?void 0:e.bars)&&!e.bars.stacked&&(null==e||null==(A=e.bars)?void 0:A.funnelChart)&&p.jsxs(t.Fragment,{children:[e.enableHover&&p.jsx("style",{children:"\n /* We need to find a more accurate way to target the rect element. */\n .vizzly-xy-chart > div > svg > rect {\n cursor: pointer;\n }"}),p.jsx(N.BarStack,{children:e.bars.keys.map((function(t,n){var i,r,o;return p.jsx(N.BarSeries,ge({radiusAll:!0,radius:null!=(i=null==(r=e.bars)||null==(r=r.styles)?void 0:r.cornerRadius)?i:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data},Ub(ee,$,t,Z),{colorAccessor:function(i){var r,o,a=null!=(r=null==e||null==(o=e.bars)||null==o.formatter?void 0:o.formatter(i,t))?r:pe[n];return Ux(t)?"#9AA4B250":a}}),"bar_with_previous_"+e.uniqueId+"_"+n)}))})]}),(null==e?void 0:e.bars)&&e.bars.stacked&&p.jsxs(t.Fragment,{children:[e.enableHover&&p.jsx("style",{children:"\n /* We need to find a more accurate way to target the rect element. */\n .vizzly-xy-chart > div > svg > rect {\n cursor: pointer;\n }"}),p.jsx(N.BarStack,{offset:"100%"==e.bars.stacked?"expand":"none",children:e.bars.keys.map((function(t,n){var i,r,o;return p.jsx(N.BarSeries,ge({radiusAll:!0,radius:null!=(i=null==(r=e.bars)||null==(r=r.styles)?void 0:r.cornerRadius)?i:3,dataKey:t,data:null==(o=e.bars)?void 0:o.data,"data-testid":"stacked_bar_"+e.uniqueId+"_"+n},Ub(ee,$,t,Z),{colorAccessor:function(i){var r,o,a,l,s=null!=(r=null==e||null==(o=e.bars)||null==o.formatter?void 0:o.formatter(i,t))?r:pe[n],u=function(e){return Object.values(e)[0]};return e.enableHover&&u(null!=(a=null==le?void 0:le.datum)?a:{})===u(i)&&(s=null!=(l=Gb(s,.8))?l:s),s}}),"stacked_bar_"+e.uniqueId+"_"+n)}))})]}),"dotted"===(null==(T=e.lines)?void 0:T.style)&&e.lines&&e.lines.keys.map((function(t,n){var i;return p.jsx(N.GlyphSeries,ge({dataKey:t,data:null==(i=e.lines)?void 0:i.data},Ub(ee,$,t,Z),{colorAccessor:function(i){var r,o;return null!=(r=null==e||null==(o=e.lines)||null==o.datumFormatter?void 0:o.datumFormatter(i,t))?r:pe[n]}}),"line_dots_chart_"+e.uniqueId+"_"+n)})),(null==e?void 0:e.lines)&&!(null!=e&&null!=(_=e.lines)&&_.scatter)&&e.lines.keys.map((function(n,i){var r,o,a,l,s,u,d=ge({strokeWidth:3,curve:te,dataKey:n,data:null==(r=e.lines)?void 0:r.data},Ub(ee,$,n,Z));return p.jsxs(t.Fragment,{children:[p.jsx(N.LineSeries,ge({},d,{colorAccessor:(null==e||null==(o=e.lines)?void 0:o.formatter)&&Vx(null==e?void 0:e.lines.formatter,pe,i),strokeOpacity:"dotted"===(null==(a=e.lines)?void 0:a.style)?null==(l=e.theme)||null==(l=l.line)?void 0:l.opacity:1})),null==(s=Bb(n,null==(u=e.lines)?void 0:u.threshold))?void 0:s.map((function(t,n){var r,o;return c.createElement(N.LineSeries,ge({},d,{key:"line_on_line_chart_"+e.uniqueId+"_"+i+"_threshold_"+n,clipPath:"url(#"+Wb(t,e.idPrefix,e.uniqueId)+")",stroke:t.color,strokeOpacity:"dotted"===(null==(r=e.lines)?void 0:r.style)?null==(o=e.theme)||null==(o=o.line)?void 0:o.opacity:1}))}))]},"line_on_line_chart_"+e.uniqueId+"_"+i)})),null==e||null==(I=e.trends)||null==(I=I.keys)?void 0:I.map((function(t,n){var i,r,o,a,l,s,u;return p.jsx(N.LineSeries,ge({strokeWidth:null!=(i=null==e||null==(r=e.trends)||null==(r=r.strokeWidth)?void 0:r[n])?i:2,strokeDasharray:null!=(o=null==e||null==(a=e.trends)||null==(a=a.strokeDasharray)?void 0:a[n])?o:5,strokeOpacity:null!=(l=null==e||null==(s=e.trends)||null==(s=s.opacity)?void 0:s[n])?l:1,curve:te,dataKey:t,colorAccessor:function(){var t;return null==e||null==(t=e.trends)||null==(t=t.colors)?void 0:t[n]},data:null==e||null==(u=e.trends)?void 0:u.data},Ub(ee,$,t,Z)),"trends_line_on_line_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(D=e.lines)?void 0:D.scatter)&&e.lines.keys.map((function(t,n){var i;return p.jsx(N.GlyphSeries,ge({dataKey:t,data:null==(i=e.lines)?void 0:i.data},Ub(ee,$,t,Z),{colorAccessor:function(i){var r;if(null!=e&&null!=(r=e.lines)&&r.formatter)return zx(t,null==e?void 0:e.lines.formatter,pe,n)(i)}}),"scatter_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(O=e.lines)?void 0:O.scatter)&&e.lines.keys.map((function(t,n){var i,r;return p.jsx(N.GlyphSeries,ge({dataKey:t,data:null==(i=e.lines)?void 0:i.data},Ub(ee,$,t,Z),{colorAccessor:(null==e||null==(r=e.lines)?void 0:r.formatter)&&zx(t,null==e?void 0:e.lines.formatter,pe,n)}),"scatter_chart_"+e.uniqueId+"_"+n)})),["areas","lines"].map((function(n,i){var r=e;return p.jsx(t.Fragment,{children:r[n]&&[].concat(r[n].keys).map((function(t,o){var a,l;return p.jsx(kx,{show:(null==le?void 0:le.key)==t,generateAnnotations:null==(a=r[n])?void 0:a.annotate,dataKey:t,data:null==(l=r[n])?void 0:l.data},"area_lines_"+e.uniqueId+"_"+i+"_"+o)}))},"area_lines_"+e.uniqueId+"_"+i)})),null!=e&&null!=(E=e.bars)&&E.funnelChart?p.jsx(N.Tooltip,{showVerticalCrosshair:!0,showSeriesGlyphs:!0,style:Te,renderTooltip:function(n){var i=n.tooltipData,o=n.colorScale,a=null==i?void 0:i.datumByKey;t.useEffect((function(){return s()})),ce(a);var l=null==i?void 0:i.nearestDatum,s=r.debounce((function(){var e,t=(null==l||null==(e=l.key)?void 0:e.key)!=(null==le?void 0:le.key);le&&!t||se(null==i?void 0:i.nearestDatum)}));if(!i||!o)return null;var u=Wx(e.formatXAxisLabel,ee,null==l?void 0:l.datum[$],me);return p.jsx(yb,{heading:u,datum:a,chartData:me,tooltipNearestDatum:l,formatValue:Bx(e)})}}):p.jsx(N.Tooltip,{showVerticalCrosshair:!0,style:Te,showSeriesGlyphs:null==e.bars,renderTooltip:function(n){var i=n.tooltipData,o=n.colorScale,a=null==i?void 0:i.datumByKey,l=Object.keys(null==i?void 0:i.datumByKey),s=r.debounce((function(){var e,t=(null==u||null==(e=u.key)?void 0:e.key)!=(null==le?void 0:le.key);le&&!t||se(null==i?void 0:i.nearestDatum)}));t.useEffect((function(){return s()})),ce(a);var u=null==i?void 0:i.nearestDatum;if(!i||!o)return null;var d=Object.values(null!=a?a:{}),c=Math.round(r.sumBy(d,(function(e){return Number(e.datum[e.key]||0)}))),f=Wx(e.formatXAxisLabel,ee,null==u?void 0:u.datum[$],me);return p.jsx(vb,{heading:f,total:c,chartProps:e,datumKey:a,tooltipNearestDatum:u,typeIndex:Jx(e),getColor:function(e){return null==o?void 0:o(e)},formatSeriesName:e.formatSeriesName,formatValue:Bx(e),additionalStyles:_e,allDatumKeysOnVerticalAxis:l})}}),e.goalLine&&(null==(L=e.goalLine)?void 0:L.length)>0&&!Z&&p.jsx(N.Axis,{orientation:"left",children:function(t){var n;return null==(n=e.goalLine)?void 0:n.map((function(n,i){var r;return p.jsx(zb,{axisProps:t,goalLine:n,value:n.value,toX:(null!=(r=null==e?void 0:e.width)?r:0)-Ae.left-Ae.right,marginRight:Ae.right,maxValueOfYAxis:je,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel},(null==e?void 0:e.uniqueId)+"-"+i)}))}})]}),(null==e?void 0:e.legend)&&p.jsx(kb,{funnelChart:null==e||null==(R=e.bars)?void 0:R.funnelChart,keys:Rx(e,"keys"),colors:pe,typeIndex:Jx(e),formatSeriesName:null==e?void 0:e.formatSeriesName,formatter:null==e||null==(P=e.bars)?void 0:P.formatter,data:null==(z=e.bars)?void 0:z.data,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities,getIndicatorStyles:_e})]})},Xb=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,sparkline:e.sparkline,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,lineCurve:e.lineCurve,showTotalOnTooltip:e.showTotalOnTooltip,forceXAxisAsTime:e.forceXAxisAsTime,areas:{colors:e.colors,annotate:e.annotate||[],stacked:e.stacked||!1,data:e.data,keys:e.keys,formatter:e.formatter,threshold:e.threshold},x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles,idPrefix:null==e?void 0:e.idPrefix,popOverMenuStyles:e.popOverMenuStyles})}})})),Qb=function(e){var t=[];return"dimension"in e&&(t=[].concat(t,e.dimension||[])),"lineDimension"in e&&(t=[].concat(t,e.lineDimension||[])),"barDimension"in e&&(t=[].concat(t,e.barDimension||[])),{x:(t=(t=[].concat(e.timeDimension?[{field:e.timeDimension.field,function:e.timeDimension.truncate,pivot:"x"}]:[],t)).map((function(e,t){return 0==t?(e.pivot="x",e):(e.pivot="y",e)}))).filter((function(e){return"x"==e.pivot})).map((function(e){return rt(e)})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return rt(e)})),detailed:{x:t.filter((function(e){return"x"==e.pivot})).map((function(e){return{field:e.field,function:e.function}})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return{field:e.field,function:e.function}}))}}};function Zb(e){var n=e.title,i=e.subject,r=e.headline,o=t.useRef(null),a=t.useState(n),l=a[0],s=a[1],u=t.useState(null==r?void 0:r.func),d=u[0],c=u[1],p=t.useState(i),f=p[0],m=p[1];return t.useEffect((function(){var e;0===l.length&&n.length>=1&&o.current&&o.current.resetSize(),0===f.length&&i.length>=1&&o.current&&o.current.resetSize(),0===(null==d?void 0:d.length)&&null!=r&&r.func&&(null==r||null==(e=r.func)?void 0:e.length)>=1&&o.current&&o.current.resetSize(),s(n),m(i),c(null==r?void 0:r.func)}),[n,i,r]),o}var Jb=function(e,t){return!(!1!==e&&void 0!==e||!t)||!0===e};function $b(e){if(0===(null==e?void 0:e.measure.length))return"The Data settings are missing a Metric. Select from the list of Metrics to display the Chart."}function ey(e){if(e.xMeasure&&e.yMeasure||e.dimension.length>0)return"The Data settings are missing a parameter. Select from the list of parameters to display the Chart."}var ty=Fl({padding:"2px 6px",borderRadius:6,variants:{positive:{yes:{color:"rgb(4, 120, 87)",background:"#D1FAE5"},no:{color:"rgb(190, 18, 60)",background:"#FFE4E6"}}}}),ny=Fl({fontSize:"12px",display:"flex",alignItems:"center",rowGap:"0.5rem",position:"relative",cursor:"pointer"}),iy=Object.assign((function(){return null}),{deltaPill:ty,deltaText:Fl({padding:0,borderRadius:6,variants:{positive:{yes:{color:"rgb(23, 171, 92)",background:"transparent"},no:{color:"rgb(190, 18, 60)",background:"transparent"}}}}),arrow:Fl({height:"1rem",width:"1rem",variants:{percentageIncrease:{yes:{transform:"rotate(315deg)"},no:{transform:"rotate(45deg)"}},delteStyle:{pill:{},text:{position:"absolute",right:"-1rem"}}}}),delta:ny});function ry(e,t){var n;return null==e||null==(n=e.content)||null==(n=n[e.content.length-1])?void 0:n[t]}function oy(e,t,n,i,r,o){var a=e[Ti(i)]||"_vizzly_to_2_dp",l=t[Ti(i)]||"",s=n[Ti(i)]||"";return{formattedValue:o[a].formatter(r),prefix:l,postfix:s}}var ay=function(e,t,n){var i="";return t&&(i=""+t),i=""+i+e,n&&(i=""+i+n),i},ly=function(e){var n=Pu(),i=n.textOverride,r=oy(e.formatter,e.prefixes,e.postfixes,e.measure,e.value,n.numberFormatOptions),o=r.formattedValue,a=r.prefix,l=r.postfix;return o===i("single_stat.no_value","No value")?p.jsx(t.Fragment,{children:o}):p.jsx(t.Fragment,{children:ay(o,a,l)})},sy=function(e){var n,i,r,o=Pu().textOverride,a=Dd(),l=t.useState(!0),s=l[0],u=l[1],d="supporting"===e.viewFor||"text"===(null==a||null==(r=a.charts)||null==(r=r.singleStat)?void 0:r.delteStyle)?"text":"pill",c=e.result;if(!c||0===c.content.length||1===c.content.length)return null;var f,m,h,v=c.content[c.content.length-2][e.index],g=ry(c,e.index),x=(f=v,0!==(m=g)?0!==f?(m-f)/f*100:100*m:100*-f),b=(h={positive:x>=0?"yes":"no"},"text"===d?iy.deltaText(h):iy.deltaPill(h)),y=-1*(v-g);return p.jsxs(t.Fragment,{children:[p.jsx(uf,{as:"hr",margin:0,border:0,borderTop:"1px solid "+Sl(85)}),p.jsxs(Td,{gap:"0.15rem",children:["standalone"===e.viewFor&&p.jsxs(uf,{as:"p",className:kd(""+Ql.textSize("xs"),Ql.opacity(.7)+" "+Ql.align("left")),margin:0,children:[o("single_stat.current","Current")," ",null==e||null==(n=e.deltaTimeDimension)?void 0:n.truncate]}),p.jsxs(yf,{gap:"0.5rem",alignItems:"end",children:["standalone"===e.viewFor&&p.jsx(uf,{as:"p",margin:0,nowrap:!0,children:p.jsx(ly,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:g,measure:null==e?void 0:e.measure})}),p.jsx(yf,{alignSelf:"supporting"===e.viewFor?"flex-end":"text"===(null==a||null==(i=a.charts)||null==(i=i.singleStat)?void 0:i.delteStyle)?"center":"flex-end",gap:"0.5rem",children:p.jsx(sh,{tooltipContent:function(){var t;return p.jsxs(sh.Content,{children:[o("single_stat.previous","Previous")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate,":"," ",p.jsx(ly,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:v,measure:null==e?void 0:e.measure})]})},children:p.jsxs("button",{onClick:function(){return u(!s)},className:kd(b,""+Ql.bw(0),""+iy.delta),"aria-label":s?o("single_stat.show_as_value","Show as value"):o("single_stat.show_as_percentage","Show as percentage"),children:[s?Sa(x,2)+"%":p.jsx(ly,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:y,measure:null==e?void 0:e.measure}),p.jsx("svg",{className:""+iy.arrow({percentageIncrease:x>=0?"yes":"no",delteStyle:d}),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75"})})]})})})]})]})]})},uy=function(e){var n=t.useRef(null),i=t.useState(0),r=i[0],o=i[1];return t.useEffect((function(){var e,t,i=function(){n.current&&o(n.current.offsetWidth)},r=(e=i,function(){clearTimeout(t),t=setTimeout((function(){e()}),50)});requestAnimationFrame((function(){return i()}));var a=new ResizeObserver(r);return n.current&&a.observe(n.current),window.addEventListener("resize",r),function(){window.removeEventListener("resize",r),a&&a.disconnect()}}),[e]),[n,r]},dy=function(e){var t=Pu().textOverride,n=null==e?void 0:e.results.some((function(e){return Array.isArray(null==e?void 0:e.content)&&(null==e?void 0:e.content)&&e.content.length>1}));return null!==e.deltaTimeDimension&&!1===n?p.jsx("p",{className:kd(""+Ql.textSize("xs"),""+Ql.opacity(.5)),children:t("single_stat.no_data_for_delta_description","No data available for [[deltaTimeDimension]] comparison",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})}):null===(null==e?void 0:e.deltaTimeDimension)||!1===n?null:p.jsx(uf,{margin:0,className:kd(""+Ql.textSize("xs"),""+Ql.opacity(.5)),textAlign:"left",children:t("single_stat.delta_description","Comparing [[deltaTimeDimension]] over [[deltaTimeDimension]]",{deltaTimeDimension:null==e?void 0:e.deltaTimeDimension.truncate})})},cy={standalone:{smallFonts:"sm",direction:"column",gap:"1rem",statGap:80},supporting:{smallFonts:"xs",direction:"row",gap:"0.25rem",statGap:40}},py=function(e){var n,i,o,a=Pu(),l=a.textOverride,s=a.labelFormat,u=e.results[0],d=e.results[1],c=t.useState(null),f=c[0],m=c[1];if(t.useEffect((function(){if(u&&e.measure){var t=Ga(u,Ti(e.measure));-1!==t&&m(t)}}),[u,e.measure]),null===f)return null;var h=e.displayCurrent?ry(d,f):null==u||null==(n=u.content)||null==(n=n[0])?void 0:n[f],v=function(e,t){var n={};return t.forEach((function(t){var i,r;if("fontColor"==t.ruleType&&rl({op:null==(i=t.filters)?void 0:i[0][0].op,value:null==(r=t.filters)?void 0:r[0][0].value},e))return n.color=t.ruleValue})),n}(h,r.filter(e.conditionalFormattingRules,(function(t){var n,i,r;return rt({field:null==(n=t.filters)?void 0:n[0][0].field,function:null!=(i=null==(r=t.filters)?void 0:r[0][0].function)?i:"none"})==Ti(e.measure)}))),g=al(null==u||null==(i=u.fields[f])?void 0:i.publicName,null==(o=e.supportedAggregates[e.measure.function])?void 0:o.publicName),x=s({fieldId:e.measure.field,func:e.measure.function,type:"singleStat",defaultLabel:g,viewId:e.viewId});return p.jsxs("div",{children:[p.jsx("div",{className:""+Ql.align("left"),children:(e.showAggregateText||"supporting"===e.viewFor)&&p.jsx("span",{className:Ql.textSize(cy[e.viewFor].smallFonts)+" "+Ql.nowrap,children:null!=x?x:g})}),p.jsxs(yf,{gap:"0.35rem",direction:cy[e.viewFor].direction,children:[p.jsx(uf,{children:e.displayCurrent&&"supporting"===e.viewFor?p.jsx(sh,{tooltipContent:function(){var t;return p.jsxs(sh.Content,{children:[l("single_stat.current","Current")," ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate]})},children:p.jsx("p",{style:ge({},v,{fontSize:e.fontSize}),className:Ql.text+" "+es({display:"flex",fontSize:"48px",fontWeight:"600",lineHeight:"1",letterSpacing:"0.025em",textAlign:"left",position:"relative",paddingTop:"4px",whiteSpace:"nowrap"}),children:p.jsx(ly,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:h,measure:null==e?void 0:e.measure})})}):p.jsx("p",{style:ge({},v,{fontSize:e.fontSize}),className:Ql.text+" "+Ql.align("left")+" "+es({display:"flex",fontSize:"48px",fontWeight:"600",lineHeight:"1",letterSpacing:"0.1em",textAlign:"left",position:"relative",paddingTop:"4px"}),children:p.jsx(ly,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure,value:h})})}),p.jsx(sy,{index:f,result:d,deltaTimeDimension:null==e?void 0:e.deltaTimeDimension,formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure,viewFor:e.viewFor})]})]})},fy={type:"singleStat",prefixes:{},postfixes:{},fontSize:"30px",measure:[],displayTitle:"",displaySubject:"",formatter:{},filter:[],limit:500,conditionalFormattingRules:[],deltaTimeDimension:null,tags:[]},my=function(e){var n,i,r,o,a,l,s,u,d,c,f,m,h,v,g={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:e.setPartialAttributes,dataSet:e.dataSet,componentType:null==(i=e)?void 0:i.type,parameters:null==(r=e)?void 0:r.parameters,measure:null==(o=e)?void 0:o.measure,viewId:null!=(a=null==(l=e)?void 0:l.viewId)?a:""},x=uy(e.queriesAreChanging),b=x[0],y=x[1],w=uy(e.queriesAreChanging),C=w[0],j=w[1];if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters",children:$b({measure:e.measure,order:[],dimension:[]})});var F=void 0!==e.results?e.results[0]:void 0;if(Ka(F))return p.jsx(Nf,{});if(Xa(F))return p.jsx(Yg,{});if(Qa(F))return p.jsx(Kg,ge({},g));var S=(e=pl(e,{},fy)).measure.length,k=cy[e.viewFor].statGap,A=e.leftAlign?"flex-start":(S-1)*k+j*S<y-32?"center":void 0;return p.jsxs(Cg,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,id:e.id,children:[!e.hideHeader&&p.jsx(wg,ge({},g,{paddingBottom:0})),S>1?p.jsxs(t.Fragment,{children:[p.jsx("div",{className:es({width:"vertical"===e.direction?"min-content":"100%",height:"100%",margin:"vertical"===e.direction?"auto":void 0}),ref:b,children:p.jsx(yf,{direction:e.direction&&"vertical"===e.direction?"column":"row",height:"100%",gap:e.direction&&"vertical"===e.direction?32:k,"data-component":"stat-container",alignItems:"center",justifyContent:e.direction&&"vertical"===e.direction?"center":A,children:[].concat(e.measure).map((function(t,n){var i,r;return p.jsx("div",{ref:C,className:es({width:"vertical"===e.direction?"100%":void 0}),children:p.jsx(py,{index:n,showAggregateText:S>1,supportedAggregates:e.supportedAggregates,measure:t,prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(i=e)?void 0:i.deltaTimeDimension,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(r=e.viewId)?r:""})},n)}))})}),(null==(s=e)?void 0:s.deltaTimeDimension)&&p.jsx(uf,{marginTop:cy[e.viewFor].gap,children:p.jsx(dy,{deltaTimeDimension:null==(u=e)?void 0:u.deltaTimeDimension,results:null==(d=e)?void 0:d.results})})]}):p.jsxs(Td,{placeContent:e.leftAlign?"left":"center","data-component":"stat-container",height:"100%",children:[p.jsx(py,{index:1,showAggregateText:S>1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(c=e)?void 0:c.deltaTimeDimension,viewFor:e.viewFor,displayCurrent:e.displayCurrent,viewId:null!=(f=e.viewId)?f:""},1),(null==(m=e)?void 0:m.deltaTimeDimension)&&p.jsx(uf,{marginTop:cy[e.viewFor].gap,children:p.jsx(dy,{deltaTimeDimension:null==(h=e)?void 0:h.deltaTimeDimension,results:null==(v=e)?void 0:v.results})})]})]})};function hy(e,t){return e.reduce((function(e,n){return t&&"string"==typeof t&&(e[rt(n)]=t),e}),{})}function vy(e,t){return(null===t||"object"!=typeof t||0!==Object.keys(t).length)&&e.length>0&&"asc"===e[0].direction&&!!t}function gy(e,t,n){return!(null==t||!t.func)&&vy(e,n)}my.defaultProps=fy;var xy=function(e){var n,i,r,o,a=Pu().queryEngineConfig,l=t.useState([]),s=l[0],u=l[1],d=0!==Object.keys(e.component.attributes.timeDimension||{}).length&&"current"===(null==(n=e.component.attributes.headline)?void 0:n.func),c=d&&e.component.attributes.timeDimension?ge({},e.component.attributes.timeDimension,{bucketFill:!1}):null,f=function(e,t,n,i){return e.map((function(e){var r;return ge({},e,{function:(null==(r=it(Qo(n,e.field),t))?void 0:r.includes(i))?i:e.function})}))}(e.component.attributes.measure,a.supportedAggregates,e.dataSet,null==(i=e.component.attributes.headline)?void 0:i.func),m=so({queryEngineConfig:a}).init(e.dataSet.id,{prefixes:hy(f,e.component.attributes.yAxisPrefix),postfixes:hy(f,e.component.attributes.yAxisPostfix),formatter:hy(f,e.component.attributes.yAxisFormat),fontSize:"1.1rem",viewId:e.component.attributes.viewId+"-stats",deltaTimeDimension:c,measure:f,filter:e.component.attributes.filter}),h=$h(m,e.runQueriesCallback,u,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables);return p.jsx(uf,{minHeight:d?80:56,children:p.jsx(my,ge({},m,{id:null!=(r=m.viewId)?r:"",dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:function(){},setPartialAttributes:function(t){return e.setPartialAttributes(t)},results:s,queriesAreChanging:h.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(o=e.dashboardBehaviour)||null==(o=o.queryEngineConfig)?void 0:o.supportedTransformationFunctions,library:null==e?void 0:e.library,leftAlign:!0,viewFor:"supporting",displayCurrent:d,hideHeader:!0,defaultFormats:e.dashboardBehaviour.defaultFormats}))})},by=function(e){var t=[];return e?(e.forEach((function(e){var n;t.push({key:za([],[],e.filters[0][0].field,null!=(n=e.filters[0][0].function)?n:"none"),value:e.filters[0][0].value,direction:e.filters[0][0].op,color:e.ruleValue})})),t):t},yy=function(e,t){if(t&&0!==t.length)return null==t?void 0:t.map((function(t){try{var n=t.value;return"string"==typeof t.value&&(Zt(t.value,Xt,null==e?void 0:e.variables),n=Jt(t.value,null==e?void 0:e.variables)),r.isNumber(n)?{value:n,strokeStyle:t.strokeStyle,strokeWidth:t.strokeWidth,color:t.color,label:t.label}:(Je("Goal line won’t be displayed as value is not a number.",n),null)}catch(e){return Je(e),null}})).filter((function(e){return null!==e}))},wy=function(e){var n,i,r,o,a,l=Zb({title:null==e?void 0:e.displayTitle,subject:null==e?void 0:e.displaySubject,headline:null==e?void 0:e.headline}),s=Pu(),u=s.textOverride,d=s.labelFormat,c=s.valueAlias,f=s.nullValueAlias,m=s.variables,h=Dd(),v={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setPartialAttributes:e.setPartialAttributes,viewId:null!=(i=null==e?void 0:e.viewId)?i:"",order:e.order};if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},v));var g=Qb(e),x=Ya(g,e.measure,e.result),b=Ha(e.result,e.measure,g,"100%"==e.stacked,ct(e.dataSetId,e.dimension,e.timeDimension,f,u)),y=gy(e.order,e.headline,e.timeDimension);return p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},v,{paddingBottom:y?"0.5rem":void 0})),y&&p.jsx(xy,ge({},e.propsForHeadline)),p.jsx(ts,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:p.jsx(Xb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:l,uniqueId:e.id,x:"x",keys:x,colors:$a(null==h?void 0:h.colors,x.length),data:b,legend:Jb(null==e?void 0:e.legend,"verbose"===(null==h?void 0:h.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,showTotalOnTooltip:!!e.stacked,stacked:!!e.stacked,formatXAxisLabel:gl(e.timeDimension,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats},c),formatYAxisLabel:xl(u,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),annotate:"verbose"==(null==h?void 0:h.detail)?["high_and_low"]:[],lineCurve:"dotted"===e.lineCurve?"natural":e.lineCurve,theme:null==h?void 0:h.charts,formatSeriesName:bl(e.result,u,e.type,null!=(o=e.viewId)?o:"",d),formatter:function(t){var n=vl(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},onPointerUp:null==e?void 0:e.onPointerUp,sparkline:e.sm,goalLine:yy(m,e.goalLines),axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,threshold:by(e.conditionalFormattingRules),popOverMenuStyles:null==h||null==(a=h.charts)?void 0:a.popoverMenus})})]})})};wy.defaultProps={type:"areaChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,tags:[],xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,headline:{}};var Cy=t.memo(wy,fl),jy=function(){return null},Fy=function(e){var t;return(null==e||null==(t=e.component)||null==(t=t.attributes)||null==(t=t.drilldown)?void 0:t.length)>0},Sy=function(e){var n,i=t.useState(null),r=i[0],o=i[1],a=e.component,l=a.results,s=a.attributes,u=a.localFilters,d=$h(s,e.runQueriesCallback,e.setResults,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables).queriesAreChanging;return Go(e.component.attributes.type,{queryEngineConfig:e.dashboardBehaviour.queryEngineConfig}),p.jsxs(t.Fragment,{children:[p.jsx(Cy,ge({id:e.id},s,{dataSet:e.dataSet,localFilters:u,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:l&&l[0],queriesAreChanging:d,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,onPointerUp:function(t){return Fy(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix,defaultFormats:e.dashboardBehaviour.defaultFormats})),r&&p.jsx(jy,{onDrilldown:r,onClose:function(){return o(null)},inputProps:e})]})},ky=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,sparkline:e.sparkline,x:e.x,formatSeriesName:e.formatSeriesName,bars:{annotate:[],stacked:"stacked"===(null==e?void 0:e.type),colors:e.colors,data:e.data,keys:e.keys,formatter:e.formatter,styles:e.styles},legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,forceXAxisAsTime:null==e?void 0:e.forceXAxisAsTime,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,showTotalOnTooltip:e.showTotalOnTooltip,theme:null==e?void 0:e.theme,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities,onClick:function(t,n,i){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t,n,i))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,enableHover:e.enableHover,popOverMenuStyles:e.popOverMenuStyles})}})}));function Ay(e,t,n){var i=Ty(e,t);return null!=n&&n.grouping?_y(i,null==n?void 0:n.grouping):i}var Ty=function(e,t){return e.map((function(e){return e.field in t?{fieldId:e.field,function:e.function,aggregate:e.function,value:t[e.field]}:{fieldId:e.field,function:e.function,aggregate:e.function}}))},_y=function(e,t){return t.forEach((function(t){var n=e.findIndex((function(e){return e.fieldId===t.fieldId}));n>-1?e[n]=ge({},e[n],t):e.push(t)})),e},Iy=function(e,t){return"function"in t&&"date_time"==Qo(e,t.field).dataType?{field:t.field,truncate:t.function}:null},Dy=function(e,t,n,i){var r=[].concat(i);if(t){var o=r.filter((function(e){return e.field!==t.field}));return"date_time"!==Qo(e,n.field).dataType&&o.unshift({field:n.field,function:"none"}),o}return[]},Oy=function(e,t,n,i,r){var o=[].concat(null!=e?e:[]);if(0===o.length&&o.push([]),n)if(i){var a,l={field:null!=(a=n.field)?a:"",op:">=",value:n.value},s=function(){if(n){var e,i=function(){var e=t.findIndex((function(e){return e[0]===(null==n?void 0:n.value)}));if(e>=0)for(var i=t[e],r=e+1;r<t.length;r++)if(t[r][0]!==i[0])return t[r][0]}();if(i)return{field:null!=(e=n.field)?e:"",op:"<",value:i}}}();o=o.map(s?function(e){return[l,s].concat(e)}:function(e){return[l].concat(e)})}else if(r&&r.length>0){var u,d={field:null!=(u=n.field)?u:"",op:"=",value:n.value};o=o.map((function(e){return[d].concat(e)}))}return o},Ey=function(e){return 1===e.length},Ly=function(e,t,n,i){var r=[].concat(e);return n&&(r=r.filter((function(e){return e.field!==n.field}))),"date_time"===Qo(t,i.field).dataType&&"function"in i&&(r=r.filter((function(e){return e.field!==i.field}))).unshift({field:i.field,direction:"asc",function:i.function}),r};function Ny(e,t){var n=null==Object?void 0:Object.entries(null==e?void 0:e.datum)[0],i=ot(n[0],t);return{field:i.field,value:n[1],function:i.function}}function My(e,t,n,i,r){var o=[];if(i){var a=e({field:i.field,function:i.truncate});o=[{field:i.field,function:i.truncate,value:null==r?void 0:r.datum[null!=a?a:""]}]}if(n&&n.length>0&&r){var l,s;null!=r&&r.datum[null!=(l=n[0].field)?l:""]&&o.push({field:n[0].field,function:n[0].function,value:null==r?void 0:r.datum[null!=(s=n[0].field)?s:""]});var u=t(r.key);u&&(null==u?void 0:u.dimensionKeys.length)>0&&n.some((function(e){return e.field===u.dimensionKeys[0]}))&&o.push({field:u.dimensionKeys[0],function:"none",value:u.dimensionValues[0]})}return o}function Ry(e,t,n,i,r){var o,a,l=null!=(o=e.filter)?o:[];t.filter&&t.filter.length>0&&(l=i([].concat(null!=(a=t.filter)?a:[]),l));var s=[];return n.length>0&&(n.forEach((function(t){var n,i=null;(null==e||null==(n=e.timeDimension)?void 0:n.field)===t.field&&(i=e.timeDimension);var o=e.dimension.filter((function(e){return e.field===t.field})),a=r(t,i,o);a&&a.length>0&&a.forEach((function(e){e.length>0&&s.push.apply(s,e)}))})),s.length>0&&(l=i([[].concat(s)],l))),l}function Py(e,t,n,i,r){if(!Array.isArray(e)||!Array.isArray(n))throw new Error("Invalid input: fields and row must be arrays");return e.map((function(e,o){var a,l;if(Va(e.datumKey))return(l={})[e.datumKey]=null==(a=n[o])?void 0:a.value,l;var s={};if("string"==typeof e.id){var u,d,c=e.id;r&&null!=i&&i.some((function(e){return e.id===r.subsetDimension}))&&(c=r.subsetDimension);var p=ot(c,t);(d={})[JSON.stringify(p)]=null==(u=n[o])?void 0:u.value,s=d}return s})).filter((function(e){return Object.keys(e).length>0}))}var zy=function(e){var t;return!(!e||void 0===e||!(e.measure&&(null==(t=e.measure)?void 0:t.length)>0||null!=e&&e.dimension&&(null==e?void 0:e.dimension.length)>0))};function Vy(e,t,n,i,r,o,a,l){var s,u,d,c=(null==(s=e.fields[n])?void 0:s.id)||"",p=at(c,{supportedAggregates:l,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),f=p.fieldId,m=p.function,h=function(e,t){var n={};return e.forEach((function(e,i){n[e.id]=t[i]})),n}(e.fields,(null==(u=e.content)?void 0:u[t])||[]);if("dataTable"===i){var v,g={fieldId:f,function:m,value:r,aggregate:m};d={grouping:Ay(o,h,a),value:null!=(v=null==a?void 0:a.value)?v:g}}else d={fieldId:c,value:r,function:"none",aggregate:"none"};return{activeFieldsWithValues:h,cell:d}}var qy=function(e){return Fl({padding:null==e?void 0:e.padding,display:"flex",alignItems:"center",borderRadius:null==e?void 0:e.borderRadius,gap:8,height:"fit-content",variants:{alertType:{warning:null==e?void 0:e.warning,info:null==e?void 0:e.info,critical:null==e?void 0:e.critical,guidance:null==e?void 0:e.guidance}}})},By=Fl({display:"block",alignSelf:"flex-start"}),Wy=Object.assign(qy,{svg:function(e){var t,n,i,r;return Fl({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==e||null==(t=e.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==e||null==(n=e.info)?void 0:n.iconColor},critical:{fill:null==e||null==(i=e.critical)?void 0:i.iconColor},guidance:{fill:null==e||null==(r=e.guidance)?void 0:r.iconColor}}}})},icon:Fl({display:"block",height:"16px",width:"16px",margin:"2px 0"}),content:function(e){var t,n,i,r;return Fl({display:null==e||null==(t=e.title)?void 0:t.display,width:null==e||null==(n=e.title)?void 0:n.width,fontSize:null==e||null==(i=e.content)?void 0:i.fontSize,fontWeight:null==e||null==(r=e.content)?void 0:r.fontWeight})},title:function(e){var t,n,i,r;return Fl({fontWeight:null==e||null==(t=e.title)?void 0:t.fontWeight,display:null==e||null==(n=e.title)?void 0:n.display,whiteSpace:"wrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:null==e||null==(i=e.title)?void 0:i.fontSize,WebkitFontSmoothing:"antialiased",width:null==e||null==(r=e.title)?void 0:r.width})},iconWrapper:By}),Hy=function(e){var n,i,r=Dd();return p.jsxs("div",{role:"alert",className:kd(Wy(null==r?void 0:r.alerts)({alertType:null!=(n=null==e?void 0:e.type)?n:"info"}),null==e?void 0:e.className),"data-themeapi":"alerts",children:[p.jsxs("span",{className:""+Wy.iconWrapper,children:[void 0!==(null==e?void 0:e.icon)&&p.jsx(t.Fragment,{children:null==e?void 0:e.icon}),void 0===(null==e?void 0:e.icon)&&p.jsx("span",{className:""+Wy.icon,children:p.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+Wy.svg(null==r?void 0:r.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:p.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+Wy.svg(null==r?void 0:r.alerts)({alertType:null!=(i=null==e?void 0:e.type)?i:"info"}),children:p.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})})]}),p.jsxs("div",{className:es({display:"flex",flexDirection:"row",gap:2,flexWrap:"wrap"}),children:[(null==e?void 0:e.title)&&p.jsx("div",{className:""+Wy.title(null==r?void 0:r.alerts),children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&p.jsx("div",{className:""+Wy.content(null==r?void 0:r.alerts),children:null==e?void 0:e.children})]})]})},Yy=Object.assign((function(){return null}),{container:Fl({position:"relative"}),overlay:Fl({position:"absolute",inset:0,zIndex:2}),content:Fl({opacity:.5})}),Gy=function(e){return null!=e&&e.enabled?p.jsxs("div",{className:""+Yy.container,"aria-disabled":"true",children:[p.jsx("div",{className:""+Yy.overlay,children:(null==e?void 0:e.message)&&p.jsx(yf,{justifyContent:"center",alignItems:"center",height:"100%",className:""+Yy.overlay,children:p.jsx(uf,{marginX:"3.5rem",children:p.jsx("div",{style:{textAlign:"center"},children:null==e?void 0:e.message})})})}),p.jsx("div",{className:""+Yy.content,children:null==e?void 0:e.children})]}):p.jsx(t.Fragment,{children:null==e?void 0:e.children})},Uy=function(e){return e.positioning&&!1!==Xy(e.options)?p.jsx(Ky,ge({},e,{positioning:e.positioning})):null},Ky=function(e){var n=e.positioning,i=e.onClose,r=Pu().queryEngineConfig,o=t.useRef(null);Id(o,(function(){null!=n&&n.x&&null!=n&&n.y&&i(void 0)}));var a=function(){var t=[];return e.options&&e.options.forEach((function(n,i){var o=Qo(e.dataSet,n.field);"date_time"===o.dataType?o.allowedGranularities.forEach((function(e){t.push({testId:n.field+"-option-"+i+"-"+e,value:{field:n.field,function:e},label:o.publicName+" ("+r.supportedTimeTruncFunctions[e].publicName+")",icon:o.dataType})})):t.push({testId:n.field+"-option-"+i,value:n,label:o.publicName,icon:o.dataType})})),t}(),l=hf(a,["label"]),s=l.setSearch,u=l.values,d=l.searchString;return p.jsx(t.Fragment,{children:n.x&&n.y&&p.jsx(Bd,{force:!0,children:p.jsx(Uc,{children:p.jsx("div",{style:ge({},pf(300,{left:n.x,top:n.y,width:300,height:200,topOverride:window.scrollY+n.y},"right"),{zIndex:4294966294}),ref:o,children:p.jsxs(_f,{open:!0,fixedHeight:!0,width:"calc(100% - 2px)",children:[p.jsxs(yf,{className:""+hb({4:!0}),padding:"12px 8px 4px",alignItems:"center",gap:"0.5rem",position:"relative",width:e.width,children:[p.jsx(Cd,{width:16,height:16}),p.jsx(uf,{children:"Drilldown"}),e.disabled&&p.jsx(uf,{position:"absolute",right:8,width:18,children:p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:"Metrics can't be selected in Editor"})},children:p.jsx(b.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon"})})})]}),e.required&&p.jsx(uf,{padding:8,children:p.jsx(Hy,{title:"Sort is required when a Grouping is a Date",className:es({textWrap:"wrap"})})}),!e.required&&p.jsxs(t.Fragment,{children:[p.jsx(uf,{padding:8,children:p.jsx($f,{id:"dropdown-input",label:"Search for a field",placeholder:"Search for a field",labelHidden:!0,autoFocus:!0,defaultValue:d,onChange:function(e){return s(e.target.value)}})}),p.jsx(Gy,{enabled:e.disabled,children:u.map((function(e){return p.jsx(_f.Option,{testId:"option-"+e.refIndex,onChange:function(){i(u[e.refIndex].item.value)},label:e.item.label,icon:e.item.icon},"list_view_"+e.refIndex+"_option")}))})]})]})})})})})},Xy=function(e){return void 0!==e&&e&&(null==e?void 0:e.length)>0},Qy=function(e){var n,i,r,o,a=Dd();return e.drilldownSelections&&0!==(null==(n=e.drilldownSelections)?void 0:n.length)?p.jsxs(yf,{justifyContent:"flex-end",gap:"0.5rem",margin:"0 0 0.5rem 0",className:kd(""+fb,es({color:null!=(i=null==a||null==(r=a.charts)||null==(r=r.subject)?void 0:r.color)?i:Sl(15)})),"data-component":"drilldown-breadcrumb",children:[p.jsx(uf,{height:"0.5rem",children:p.jsx(sh,{tooltipContent:function(){return"Reset drilldown"},children:p.jsx("button",{onClick:function(){return e.onReset()},className:""+Ql.button,"aria-label":"Reset drilldown",children:p.jsx(Cd,{})})})}),null==(o=e.drilldownSelections)?void 0:o.map((function(n,i){return p.jsxs("div",{className:es({textAlign:"right"}),"data-component":"drilldown-breadcrumb",children:[n.existingField&&p.jsx(Zy,{field:n.existingField,dataSet:e.dataSet}),p.jsx(t.Fragment,{children:"  >  "}),p.jsx(Jy,{option:n.newField,dataSet:e.dataSet})]},i)}))]}):null},Zy=function(e){var n,i=e.field,r=e.dataSet,o=Pu(),a=o.queryEngineConfig,l=o.dateTimeFormatOptions,s=o.numberFormatOptions,u=Qo(r,i.field),d="date_time"==u.dataType&&"function"in i?l[null==(n=a.supportedTimeTruncFunctions)||null==(n=n[i.function])?void 0:n.dateFormat].formatter(new Date(i.value)):yl(i.value,s,u.dataType);return p.jsxs(t.Fragment,{children:[u.publicName," = '",d,"'"]})},Jy=function(e){var n=e.option,i=Qo(e.dataSet,n.field),r=Pu();return p.jsxs(t.Fragment,{children:[i.publicName,"function"in n&&"date_time"==i.dataType?" ("+r.queryEngineConfig.supportedTimeTruncFunctions[n.function].publicName+")":""]})};function $y(e){var n=e.developerTools,i=e.viewId,r=e.onClickSettingsChange;t.useEffect((function(){"object"==typeof n&&n.viewClickSettingsInput&&n.viewClickSettingsInput.viewId===i&&r&&r({clickedValue:n.viewClickSettingsInput.clickedValue,nearestDatum:n.viewClickSettingsInput.nearestDatum,pieClickedValue:n.viewClickSettingsInput.pieClickedValue,pieEvent:n.viewClickSettingsInput.pieEvent})}),["object"==typeof n&&n.viewClickSettingsInput])}var ew={type:"barChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",tags:[],yAxisFormat:null,xAxisFormat:null,legend:!1,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",drilldownOptions:void 0},tw=function(e){var n,i,r,o,a,l,s,u,d,c,f,m,h,v,g,x,b,y,w,C=e.displayTitle,j=e.displaySubject,F=Pu(),S=F.textOverride,k=F.labelFormat,A=F.valueAlias,T=F.nullValueAlias,_=F.queryEngineConfig,I=F.variables,D=F.developerTools,O=Zb({title:C,subject:j,headline:e.headline}),E=Dd(),L={displayTitle:C,displaySubject:j,localFilters:(e=pl(e,{},ew)).localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:e.setPartialAttributes,library:null!=(n=null==(i=e)?void 0:i.library)&&n,verified:null==(r=e)?void 0:r.protectedByOrganisation,dataSet:e.dataSet,parameters:null==(o=e)?void 0:o.parameters,componentType:null==(a=e)?void 0:a.type,measure:null==(l=e)?void 0:l.measure,dimension:null==(s=e)?void 0:s.dimension,timeDimension:e.timeDimension,viewId:null!=(u=null==(d=e)?void 0:d.viewId)?u:"",order:e.order},N=Go(e.type),M=t.useState(),R=M[0],P=M[1],z=function(t,n,i){Ke("nearestDatum",n),Ke("clickedValue",t),function(e,t,n,i){var r,o,a=n.onViewClick;(function(e){return(null==e?void 0:e.distance)<3})(e)&&a({viewId:null!=(r=null==n?void 0:n.viewId)?r:"",type:null!=(o=null==n?void 0:n.type)?o:"barChart",clicked:{grouping:function(){var i,r=[],o=Object.keys(null!=t?t:{}).map((function(e){return qa(e)}));if(null!=n&&n.dimension&&(null==n||null==(i=n.dimension)?void 0:i.length)>0)if(o.length>1)o.map((function(e){var t,n;r.push({fieldId:null!=(t=""+e.dimensionKeys[0])?t:"",function:e.function,aggregate:e.function,value:null!=(n=""+e.dimensionValues[0])?n:""})}));else{var a,l=null!=(a=null==n?void 0:n.dimension[0].field)?a:"";r.push({fieldId:l,function:null==n?void 0:n.dimension[0].function,aggregate:null==n?void 0:n.dimension[0].function,value:null==e?void 0:e.datum[l]})}if(n&&"timeDimension"in n&&null!==(null==n?void 0:n.timeDimension)){var s,u,d,c,p=null!=(s=null==(u=n.timeDimension)?void 0:u.field)?s:"";r.push({fieldId:p,function:null==(d=n.timeDimension)?void 0:d.truncate,aggregate:null==(c=n.timeDimension)?void 0:c.truncate,value:null==e?void 0:e.datum[p]})}return r}(),value:{fieldId:null!=n&&n.measure?null==n?void 0:n.measure[0].field:"",function:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",aggregate:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",value:null==e?void 0:e.datum[null==e?void 0:e.key]}},dataSet:{id:n.dataSet.id,name:n.dataSet.name,description:n.dataSet.description,fields:n.dataSet.fields}},function(){var t=me(Ce().mark((function t(r){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r&&null!=n&&n.dimension&&i)){t.next=4;break}return t.next=3,i(r,My(rt,qa,n.dimension,n.timeDimension,e));case 3:return t.abrupt("return",t.sent);case 4:return t.abrupt("return",Promise.resolve(null));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}(t,n,{dimension:e.dimension,measure:e.measure,timeDimension:e.timeDimension,onViewClick:e.onViewClick,type:"barChart",viewId:e.id,dataSet:e.dataSet},e.runViewClickQuery),!1===Xy(e.drilldownOptions)||Ey(e.drilldownSelections)?P(void 0):t&&null!=i&&i.event&&"clientY"in(null==i?void 0:i.event.nativeEvent)&&P({x:null==i?void 0:i.event.nativeEvent.clientX,y:null==i?void 0:i.event.nativeEvent.clientY,field:Ny(t,_)})};if($y({developerTools:D,viewId:e.id,onClickSettingsChange:function(e){return z(e.clickedValue,e.nearestDatum)}}),!N.isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},L));var V=Qb(e),q=Ya(V,e.measure,e.result),B=Ha(e.result,e.measure,V,"100%"==e.stacked,ct(e.dataSetId,e.dimension,e.timeDimension,T,S)),W=gy(e.order,e.headline,e.timeDimension);return p.jsxs(t.Suspense,{fallback:p.jsx(Nf,{}),children:[p.jsx(Uy,{positioning:R,onClose:function(t){P(void 0),t&&e.onDrilldownChange({newField:t,existingField:null==R?void 0:R.field})},options:e.drilldownOptions,dataSet:null==(c=e)?void 0:c.dataSet,required:!(!e.timeDimension||0!==e.order.length),disabled:e.editor}),p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},L,{paddingBottom:W?"0.5rem":void 0})),W&&p.jsx(xy,ge({},e.propsForHeadline)),p.jsx(Qy,{onReset:function(){return e.onResetDrilldown()},drilldownSelections:e.drilldownSelections,dataSet:e.dataSet}),p.jsx(ts,{disabledFeatures:null!=(f=null==(m=e)?void 0:m.library)&&f,children:p.jsx(ky,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:O,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:xl(S,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(h=e)?void 0:h.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),formatXAxisLabel:gl(e.timeDimension,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(v=e)?void 0:v.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats},A),formatter:function(t,n){var i,r=vl(e.dimension,e.conditionalFormattingRules,t,n,null==(i=e)?void 0:i.dataSet);if(r)return r.value},styles:null==E||null==(g=E.charts)?void 0:g.barChart,keys:q,colors:$a(null==E?void 0:E.colors,q.length),data:B,legend:Jb(null==(x=e)?void 0:x.legend,"verbose"===(null==E?void 0:E.detail)),horizontal:"horizontalBarChart"==e.type,removeStroke:!1,type:e.stacked?"stacked":"grouped",showTotalOnTooltip:!!e.stacked,forceXAxisAsTime:!!e.timeDimension,theme:null==E?void 0:E.charts,axisTitles:null==(b=e)?void 0:b.axisTitles,formatSeriesName:bl(e.result,S,e.type,null!=(y=e.viewId)?y:"",k),conditionalFormattingPossibilities:function(t){return hl(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},onClick:z,goalLine:yy(I,e.goalLines),idPrefix:e.idPrefix,enableHover:Xy(e.drilldownOptions)&&!Ey(e.drilldownSelections),popOverMenuStyles:null==E||null==(w=E.charts)?void 0:w.popoverMenus})})]})]})};tw.defaultProps=ew;var nw=t.memo(tw,fl),iw=function(e,n,i,r,o,a,l,s){var u=e;return n.preAggregated&&(u=[aa(n)]),function(e,n,i,r){t.useEffect((function(){var t=Go(n.type,{queryEngineConfig:i});if(e.preAggregated&&t.setDataAttributesFromPreAggregatedDataSet){var o=t.setDataAttributesFromPreAggregatedDataSet(n,e);r(o)}}),[JSON.stringify({dataSet:e,type:n.type})])}(n,e,i,o),{queriesAreChanging:$h(u,a,l,r,n,e.type,s).queriesAreChanging}};function rw(e,n,i,r){var o=t.useState(null),a=o[0],l=o[1],s=t.useState([]),u=s[0],d=s[1];t.useEffect((function(){var t;a&&null!=(t=e[0])&&t.content&&(c(a),l(null))}),[a,e]);var c=function(t){var o,a,l=t.existingField,s=t.newField;Xe("Drilldown - existingField",l),Xe("Drilldown - newField",s);var u=ge({},n,{filter:Oy(n.filter,null!=(o=null==(a=e[0])?void 0:a.content)?o:[],l,n.timeDimension,n.dimension),dimension:Dy(r,l,s,n.dimension),timeDimension:Iy(r,s),order:Ly(n.order,r,l,s)});i(u),d((function(e){return[].concat(e,[{newField:s,existingField:l}])}))};return Nu((function(e){e.drilldown&&function(e,t){if(!t.existingField)throw new Error("[[VIZZLY ERROR]]: `existingField` is undefined when validating the drilldown");if(!t.newField)throw new Error("[[VIZZLY ERROR]]: `newField` is undefined when validating the drilldown");var n=t.newField.field;if(t.existingField){var i=e.fields.some((function(e){var n;return e.id===(null==(n=t.existingField)?void 0:n.field)})),r=e.fields.some((function(e){return e.id===n}));if(i&&r)return!0}throw new Error("[[VIZZLY ERROR]]: When validating the drilldown, properties passed in do not match those of your data set")}(r,e.drilldown)&&!Ey(u)&&e.drilldown.viewId===n.viewId&&l(e.drilldown)})),{onDrilldownChange:c,setDrilldownSelections:d,drilldownSelections:u}}var ow=function(e){var n,i=e.component,r=i.localFilters,o=i.results,a=t.useState(e.component.attributes),l=a[0],s=a[1];t.useEffect((function(){m||(s(e.component.attributes),c([]))}),[JSON.stringify(e.component.attributes)]);var u=rw(o,l,(function(e){return s(e)}),e.dataSet),d=u.onDrilldownChange,c=u.setDrilldownSelections,f=u.drilldownSelections,m=iw(f.length>0?l:e.component.attributes,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:r,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults,e.dashboardBehaviour.variables).queriesAreChanging,h=function(){var t=me(Ce().mark((function t(n,i){var a,l,s,u;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Ke("ViewClick - queries",n),Ke("ViewClick - existingField",i),a=Ry(e.component.attributes,n,i,xt,(function(e,t,n){var i,r;return Oy([],null!=(i=null==(r=o[0])?void 0:r.content)?i:[],e,t,n)})),Ke("ViewClick - applied filters",a),l=Zr({queryEngineConfig:e.dashboardBehaviour.queryEngineConfig}).init(e.dataSet.id,ge({viewId:e.component.attributes.viewId+"-stats",measure:[],dimension:[]},n,{filter:a})),s=new AbortController,t.prev=6,t.next=9,e.runQueriesCallback(l,s.signal,{localFilters:r,globalFilters:e.globalFilters});case 9:return Ke("ViewClick - results",u=t.sent),t.abrupt("return",{results:u});case 14:t.prev=14,t.t0=t.catch(6),Je("ViewClick - error",t.t0);case 17:case"end":return t.stop()}}),t,null,[[6,14]])})));return function(e,n){return t.apply(this,arguments)}}();return Go(e.component.attributes.type,{queryEngineConfig:e.dashboardBehaviour.queryEngineConfig}),p.jsx(nw,ge({id:e.id},l,{sm:e.sm,dataSet:e.dataSet,localFilters:e.component.localFilters,parameters:null==e?void 0:e.component.attributes.parameters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:o&&o[0],queriesAreChanging:m,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onViewClick:function(t,n){return(null==e?void 0:e.onViewClick)&&(null==e?void 0:e.onViewClick(t,n))},goalLines:e.component.attributes.goalLines,axisTitles:null==e?void 0:e.component.attributes.axisTitles,propsForHeadline:e,idPrefix:e.idPrefix,onDrilldownChange:d,drilldownSelections:f,onResetDrilldown:function(){s(e.component.attributes),c([])},editor:null==e?void 0:e.editor,defaultFormats:e.dashboardBehaviour.defaultFormats,runViewClickQuery:h}))},aw=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,lineCurve:e.lineCurve,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,formatter:e.formatter,threshold:e.threshold,style:e.lineStyle,datumFormatter:e.datumFormatter},trends:null!=e&&e.trends?{data:e.trends.data,keys:e.trends.keys,colors:e.trends.colors,opacity:e.trends.opacity,strokeWidth:e.trends.strokeWidth,strokeDasharray:e.trends.strokeDasharray}:void 0,popOverMenuStyles:e.popOverMenuStyles,x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles,idPrefix:null==e?void 0:e.idPrefix})}})})),lw=function(e){var n,i,r,o,a,l=Pu(),s=l.textOverride,u=l.labelFormat,d=l.valueAlias,c=l.nullValueAlias,f=l.variables,m=e.displayTitle,h=e.displaySubject,v=Zb({title:m,subject:h,headline:null==e?void 0:e.headline}),g={displayTitle:m,displaySubject:h,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setPartialAttributes:e.setPartialAttributes,viewId:null!=(i=null==e?void 0:e.viewId)?i:"",order:e.order},x=Dd();if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},g));var b=Qb(e),y=Ya(b,e.measure,e.result),w=Ha(e.result,e.measure,b,"100%"==e.stacked,ct(e.dataSetId,e.dimension,e.timeDimension,c,s)),C=gy(e.order,e.headline,e.timeDimension);return p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},g,{paddingBottom:C?"0.5rem":void 0})),C&&p.jsx(xy,ge({},e.propsForHeadline)),p.jsx(ts,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:p.jsx(aw,{ref:v,uniqueId:e.id,x:"x",approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,formatYAxisLabel:xl(s,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),formatXAxisLabel:gl(e.timeDimension,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats},d),keys:y,colors:$a(null==x?void 0:x.colors,y.length),data:w,sparkline:e.sm,legend:Jb(null==e?void 0:e.legend,"verbose"===(null==x?void 0:x.detail)),horizontal:!1,annotate:"verbose"==(null==x?void 0:x.detail)?["high_and_low"]:[],forceXAxisAsTime:!!e.timeDimension,lineCurve:"dotted"===e.lineCurve?"natural":e.lineCurve,theme:null==x?void 0:x.charts,formatSeriesName:bl(e.result,s,e.type,null!=(o=e.viewId)?o:"",u),formatter:function(t){var n=vl(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.value},datumFormatter:function(t,n){var i=vl(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(i)return i.value},trends:function(){if(e.order.length>0&&e.trends&&e.trends.length>0&&cl(e.timeDimension))return function(e){var t,n=e.measures,i=e.resultSet,r=e.trends,o=e.timeDimension,a=za(e.pivotConfig.y,[],n[0].field,n[0].function),l=null==o?void 0:o.truncate,s=Math.max(2,Math.min(20,Math.round(i.length/3)));return i.length>0&&r&&r.length>0&&r[0].type===vr.Forecast&&l?{data:dl(i,null!=(t=r[0].value)?t:s,a,l,!0),keys:[a+"_current_linear_avg",a+"_forecast_linear_avg"],colors:["#1E1D2D","#1E1D2D"],opacity:[.4,.4],strokeWidth:[1,1],strokeDasharray:[0,5]}:i.length>0&&r&&r.length>0&&r[0].type===vr.Trend&&l?{data:dl(i,s,a,l,!1),keys:[a+"_current_linear_avg"],colors:["#1E1D2D"],opacity:[.4],strokeWidth:[1],strokeDasharray:[5]}:void 0}({pivotConfig:b,measures:e.measure,resultSet:w,trends:e.trends,timeDimension:e.timeDimension})}(),onPointerUp:null==e?void 0:e.onPointerUp,goalLine:yy(f,e.goalLines),axisTitles:null==e?void 0:e.axisTitles,threshold:by(e.conditionalFormattingRules),idPrefix:e.idPrefix,popOverMenuStyles:null==x||null==(a=x.charts)?void 0:a.popoverMenus,lineStyle:"dotted"===e.lineCurve?"dotted":void 0})})]})})};lw.defaultProps={type:"lineChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,headline:void 0,tags:[]};var sw=t.memo(lw,fl),uw=function(e){var n,i=t.useState(null),r=i[0],o=i[1],a=e.component,l=a.results,s=a.attributes,u=iw(s,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults,e.dashboardBehaviour.variables);return p.jsxs(t.Fragment,{children:[p.jsx(sw,ge({id:e.id},s,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:l&&l[0],queriesAreChanging:u.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,onPointerUp:function(t){return Fy(e)&&o(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,propsForHeadline:e,idPrefix:e.idPrefix,defaultFormats:e.dashboardBehaviour.defaultFormats})),r&&p.jsx(jy,{onDrilldown:r,onClose:function(){return o(null)},inputProps:e})]})},dw=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,scatter:!0},x:e.x,sharedTooltip:!0,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles,idPrefix:null==e?void 0:e.idPrefix,popOverMenuStyles:e.popOverMenuStyles})}})})),cw={type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,filter:[],limit:500,legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",tags:[]},pw=function(e){var n,i,r,o,a,l,s,u,d,c,f,m,h=e.displayTitle,v=e.displaySubject,g=Pu(),x=g.textOverride,b=g.labelFormat,y=g.variables,w=Zb({title:h,subject:v}),C={displayTitle:h,displaySubject:v,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==(i=e)?void 0:i.type,viewId:null!=(r=null==(o=e)?void 0:o.viewId)?r:"",order:e.order,setPartialAttributes:e.setPartialAttributes},j=Dd();if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters",children:ey(e)});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},C));var F=(e=pl(e,{},cw)).result&&e.xMeasure?function(e,t,n){var i={};return Wa(n).forEach((function(n){var r=[].concat(e).map((function(e){return n[e.field]})),o=[].concat(e).map((function(e){return e.field})),a=za(o,r,t.field,t.function);i[a]=!0})),Object.keys(i)}(e.dimension,e.xMeasure,e.result):[];if(!e.xMeasure||!e.yMeasure)return null;var S=[];e.xMeasure&&S.push(e.xMeasure),e.yMeasure&&S.push(e.yMeasure);var k=Qb(e),A=e.result?Ha(e.result,S,k):[],T=za([],[],e.xMeasure.field,e.xMeasure.function);return A.map((function(t){var n=[].concat(e.dimension.map((function(e){return t[e.field]}))),i=e.yMeasure,r=e.xMeasure;if(!i)return!1;if(!r)return!1;var o=za([],[],i.field,i.function),a=za(e.dimension.map((function(e){return e.field})),n,r.field,r.function);return t[a]=t[o],t})),p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},C)),p.jsx(ts,{disabledFeatures:null!=(a=null==(l=e)?void 0:l.library)&&a,children:p.jsx(dw,{ref:w,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,x:T,keys:F,colors:$a(null==j?void 0:j.colors,F.length),data:A,legend:Jb(null==(s=e)?void 0:s.legend,"verbose"===(null==j?void 0:j.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!1,sparkline:!1,formatYAxisLabel:xl(x,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(u=e)?void 0:u.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),formatXAxisLabel:gl(null,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(d=e)?void 0:d.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),theme:null==j?void 0:j.charts,formatSeriesName:bl(e.result,x,e.type,null!=(c=e.viewId)?c:"",b),goalLine:yy(y,e.goalLines),axisTitles:null==(f=e)?void 0:f.axisTitles,idPrefix:e.idPrefix,popOverMenuStyles:null==j||null==(m=j.charts)?void 0:m.popoverMenus})})]})})};pw.defaultProps=cw;var fw=t.memo(pw,fl),mw=function(e){var t,n=e.component,i=n.results,r=n.attributes,o=n.localFilters,a=$h(r,e.runQueriesCallback,e.setResults,{localFilters:o,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables);return p.jsx(fw,ge({id:e.id},r,{dataSet:e.dataSet,localFilters:o,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:i&&i[0],queriesAreChanging:a.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,sm:e.sm,library:null==e?void 0:e.library,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,idPrefix:e.idPrefix,defaultFormats:e.dashboardBehaviour.defaultFormats}))},hw=function(e){return[].concat(e.content).map((function(t){return r.reduce(t,(function(t,n,i){return t[e.fields[i].id]=n,t}),{})}))},vw=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){var n,i;return p.jsx(Kb,ge({},e,{height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(i=null==e?void 0:e.width)?i:null==t?void 0:t.width,popOverMenuStyles:e.popOverMenuStyles}))}})})),gw={worldCountries:{id:"worldCountries",fetchTopoJSON:function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("https://static.app.vizzly.co/topojson/world-countries.json",{mode:"cors"});case 2:if(!(t=e.sent).ok){e.next=8;break}return e.next=6,t.json();case 6:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),geographicAreaId:function(e){return"id"in e&&"string"==typeof e.id?e.id:""},geographicAreaPublicName:function(e){return r.get(e,"properties.name","Name not found.")},allGeographicAreas:function(e){var t,n=this,i=(null==e||null==(t=e.objects)||null==(t=t.countries1)?void 0:t.geometries)||[];return r.reduce(i,(function(e,t){return e[n.geographicAreaId(t)]={publicName:n.geographicAreaPublicName(t)},e}),{})},resolveUserDataToVizzlyAreaCode:function(e){var t={};return Object.keys(e).forEach((function(n){var i,r=(i={Afghanistan:"AFG",Angola:"AGO",Albania:"ALB","United Arab Emirates":"ARE",Argentina:"ARG",Armenia:"ARM",Antarctica:"ATA","French Southern and Antarctic Lands":"ATF",Australia:"AUS",Austria:"AUT",Azerbaijan:"AZE",Burundi:"BDI",Belgium:"BEL",Benin:"BEN","Burkina Faso":"BFA",Bangladesh:"BGD",Bulgaria:"BGR","The Bahamas":"BHS","Bosnia and Herzegovina":"BIH",Belarus:"BLR",Belize:"BLZ",Bermuda:"BMU",Bolivia:"BOL",Brazil:"BRA",Brunei:"BRN",Bhutan:"BTN",Botswana:"BWA","Central African Republic":"CAF",Canada:"CAN",Switzerland:"CHE",Chile:"CHL",China:"CHN","Ivory Coast":"CIV",Cameroon:"CMR","Democratic Republic of the Congo":"COD","Republic of the Congo":"COG",Colombia:"COL","Costa Rica":"CRI",Kosovo:"CS-KM",Cuba:"CUB",Cyprus:"CYP","Czech Republic":"CZE",Germany:"DEU",Djibouti:"DJI",Denmark:"DNK","Dominican Republic":"DOM",Algeria:"DZA",Ecuador:"ECU",Egypt:"EGY",Eritrea:"ERI","Western Sahara":"ESH",Spain:"ESP",Estonia:"EST",Ethiopia:"ETH",Finland:"FIN",Fiji:"FJI","Falkland Islands":"FLK",France:"FRA",Gabon:"GAB","United Kingdom":"GBR",Georgia:"GEO",Ghana:"GHA",Guinea:"GIN",Gambia:"GMB","Guinea Bissau":"GNB","Equatorial Guinea":"GNQ",Greece:"GRC",Greenland:"GRL",Guatemala:"GTM","French Guiana":"GUF",Guyana:"GUY",Honduras:"HND",Croatia:"HRV",Haiti:"HTI",Hungary:"HUN",Indonesia:"IDN",India:"IND",Ireland:"IRL",Iran:"IRN",Iraq:"IRQ",Iceland:"ISL",Israel:"ISR",Italy:"ITA",Jamaica:"JAM",Jordan:"JOR",Japan:"JPN",Kazakhstan:"KAZ",Kenya:"KEN",Kyrgyzstan:"KGZ",Cambodia:"KHM","South Korea":"KOR",Kuwait:"KWT",Laos:"LAO",Lebanon:"LBN",Liberia:"LBR",Libya:"LBY","Sri Lanka":"LKA",Lesotho:"LSO",Lithuania:"LTU",Luxembourg:"LUX",Latvia:"LVA",Morocco:"MAR",Moldova:"MDA",Madagascar:"MDG",Mexico:"MEX",Macedonia:"MKD",Mali:"MLI",Malta:"MLT",Myanmar:"MMR",Montenegro:"MNE",Mongolia:"MNG",Mozambique:"MOZ",Mauritania:"MRT",Malawi:"MWI",Malaysia:"MYS",Namibia:"NAM","New Caledonia":"NCL",Niger:"NER",Nigeria:"NGA",Nicaragua:"NIC",Netherlands:"NLD",Norway:"NOR",Nepal:"NPL","New Zealand":"NZL",Oman:"OMN",Pakistan:"PAK",Panama:"PAN",Peru:"PER",Philippines:"PHL","Papua New Guinea":"PNG",Poland:"POL","Puerto Rico":"PRI","North Korea":"PRK",Portugal:"PRT",Paraguay:"PRY","West Bank":"PSE",Qatar:"QAT",Romania:"ROU",Russia:"RUS",Rwanda:"RWA","Saudi Arabia":"SAU",Sudan:"SDN",Senegal:"SEN","Solomon Islands":"SLB","Sierra Leone":"SLE","El Salvador":"SLV",Somalia:"SOM","Republic of Serbia":"SRB","South Sudan":"SSD",Suriname:"SUR",Slovakia:"SVK",Slovenia:"SVN",Sweden:"SWE",Swaziland:"SWZ",Syria:"SYR",Chad:"TCD",Togo:"TGO",Thailand:"THA",Tajikistan:"TJK",Turkmenistan:"TKM","East Timor":"TLS","Trinidad and Tobago":"TTO",Tunisia:"TUN",Turkey:"TUR",Taiwan:"TWN","United Republic of Tanzania":"TZA",Uganda:"UGA",Ukraine:"UKR",Uruguay:"URY","United States of America":"USA",Uzbekistan:"UZB",Venezuela:"VEN",Vietnam:"VNM",Vanuatu:"VUT",Yemen:"YEM","South Africa":"ZAF",Zambia:"ZMB",Zimbabwe:"ZWE"},Object.values(i).forEach((function(e){i[e]=e})),i)[n]||n;t[r]=e[n]})),t}}},xw=function(e){var n,i,o=e.width,a=e.height,l=e.data,s=e.background,u=e.colorRange,d=e.gridColor,c=e.missingDataColor,f=e.formatValue,m=e.onPositionChange,h=e.position||{centerX:o/2,centerY:a/2,scale:o/630*100},v=h.centerX,g=h.centerY,x=h.scale,b=function(e){var n=t.useState(null),i=n[0],r=n[1],o=gw[e];return t.useEffect((function(){!function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.fetchTopoJSON();case 2:(t=e.sent)&&r(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[e]),{topologyJSON:i,topology:o}}(e.topology),y=b.topology,w=b.topologyJSON,C=function(e,t){var n=U.useTooltip({tooltipOpen:!1,tooltipLeft:e/2,tooltipTop:t,tooltipData:void 0}),i=n.showTooltip,r=n.hideTooltip,o=n.tooltipOpen,a=n.tooltipData,l=n.tooltipLeft,s=void 0===l?0:l,u=n.tooltipTop,d=void 0===u?0:u,c=U.useTooltipInPortal({scroll:!0,detectBounds:!0});return{showTooltip:i,hideTooltip:r,tooltipOpen:o,tooltipData:a,tooltipLeft:s,tooltipTop:d,containerRef:c.containerRef,containerBounds:c.containerBounds,TooltipInPortal:c.TooltipInPortal}}(o,a),j=C.showTooltip,F=C.containerRef,S=C.tooltipData,k=C.containerBounds,A=C.tooltipOpen,T=C.TooltipInPortal,_=C.tooltipTop,I=C.tooltipLeft,D=C.hideTooltip;if(!w)return null;var O=y.resolveUserDataToVizzlyAreaCode(l),E=W.feature(w,w.objects.countries1),L=Object.values(l),N=P.scaleQuantize({domain:[null!=(n=r.min(L))?n:0,null!=(i=r.max(L))?i:1],range:u});return o<10?null:p.jsxs("div",{ref:F,children:[p.jsx("style",{children:""+Tx}),p.jsx(Y.Zoom,{width:o,height:a,initialTransformMatrix:{scaleX:x,scaleY:x,translateX:v,translateY:g,skewX:0,skewY:0},children:function(e){return p.jsxs("div",{onMouseLeave:function(){m&&m({scale:e.transformMatrix.scaleX,centerX:e.transformMatrix.translateX,centerY:e.transformMatrix.translateY})},children:[p.jsxs("svg",{"data-component":"mercator-map",width:o,height:a,onDoubleClick:function(){e.scale({scaleX:1.3,scaleY:1.3})},onTouchStart:e.dragStart,onMouseDown:e.dragStart,onTouchMove:e.dragMove,onTouchEnd:e.dragEnd,onMouseMove:e.dragMove,onMouseUp:e.dragEnd,onMouseLeave:function(){D(),e.isDragging&&e.dragEnd()},children:[p.jsx("rect",{x:0,y:0,width:o,height:a,fill:s,rx:14}),p.jsx(B.Mercator,{data:E.features,scale:e.transformMatrix.scaleX,translate:[e.transformMatrix.translateX,e.transformMatrix.translateY],children:function(e){return p.jsxs("g",{children:[p.jsx(B.Graticule,{graticule:function(t){return e.path(t)||""},stroke:null!=d?d:"none"}),e.features.map((function(e,t){var n,i=e.feature;return p.jsx("path",{"data-testid":"map-feature-"+i.id,d:e.path||"",fill:(n=y.geographicAreaId(i),O[n]?N(O[n]):c),stroke:s,strokeWidth:.5,onMouseEnter:function(e){i.id!=(null==S?void 0:S.areaId)&&j({tooltipLeft:e.clientX-k.left,tooltipTop:e.clientY-k.top,tooltipData:{areaId:i.id,publicName:y.geographicAreaPublicName(i),value:O[i.id]}})}},"map-feature-"+t)}))]})}}),A&&p.jsx(T,{top:_,left:I,children:p.jsx(gb,{sections:1,children:p.jsx(xb,{label:null==S?void 0:S.publicName,value:null!=S&&S.value?""+f(S.value):"No data"})})},Math.random())]}),p.jsxs("div",{style:{position:"absolute",bottom:20,right:30,display:"flex",flexDirection:"column"},children:[p.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",marginBottom:5,border:0},onClick:function(){e.scale({scaleX:1.4,scaleY:1.4})},"aria-label":"zoom in",children:"+"}),p.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",border:0},onClick:function(){return e.scale({scaleX:.8,scaleY:.8})},"aria-label":"zoom out",children:"-"})]})]})}})]})},bw=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(H,{children:function(t){return p.jsx(xw,ge({},e,{width:t.width,height:t.height}))}})})),yw=function(e){var t=e.endAngle;return{startAngle:t>Math.PI?2*Math.PI:0,endAngle:t>Math.PI?2*Math.PI:0,opacity:0}},ww=function(e){return{startAngle:e.startAngle,endAngle:e.endAngle,opacity:1}};function Cw(e){var t=e.animate,n=e.path,i=e.getColor,r=e.onClickDatum,o=e.onMouseOver,a=e.onMouseOut,l=e.showLabel,s=e.valueKey,u=e.formatValue,d=e.onAnimation;return Q.useTransition(e.arcs,{from:t?yw:ww,enter:ww,update:ww,leave:t?yw:ww,keys:e.getKey,onRest:function(){d&&d(!1)},onStart:function(){d&&d(!0)}})((function(e,t,d){var c=d.key,f=n.centroid(t),m=f[0],h=f[1],v=t.endAngle-t.startAngle>=.1,g=JSON.parse(c);return p.jsxs("g",{children:[p.jsx(Q.animated.path,{d:Q.interpolate([e.startAngle,e.endAngle],(function(e,i){return n(ge({},t,{startAngle:e,endAngle:i}))})),fill:i(t),onClick:function(e){return r(g,t.index,e)},onTouchStart:function(){return r(g)},onMouseOver:function(){return o({arc:t,coords:{x:m,y:h}})},onMouseOut:function(){return a()}}),l&&v&&p.jsx(Q.animated.g,{style:{opacity:e.opacity},children:p.jsx("text",{fill:"white",x:m,y:h,dy:".33em",fontSize:9,textAnchor:"middle",pointerEvents:"none",children:u(g[s])})})]},c)}))}var jw=t.forwardRef((function(e,t){return Fx(t)?null:p.jsx(L.ParentSize,{children:function(t){return p.jsx(Fw,ge({width:null==t?void 0:t.width,height:null==t?void 0:t.height},e))}})})),Fw=function(e){var n,i,r,o,a,s=e.width,u=e.labelKey,d=e.valueKey,c=e.formatValue,f=e.formatLabel,m=_x(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),h=t.useState(!1),v=h[0],g=h[1],x=U.useTooltip({tooltipOpen:!1,tooltipLeft:s/2,tooltipTop:m,tooltipData:"Move me with your mouse or finger"}),b=x.showTooltip,y=x.hideTooltip,w=x.tooltipOpen,C=x.tooltipData,j=x.tooltipLeft,F=void 0===j?0:j,S=x.tooltipTop,k=void 0===S?0:S,A=U.useTooltipInPortal({scroll:!0,detectBounds:!0}),T=A.containerRef,_=A.TooltipInPortal,I=Sw(null==e?void 0:e.data,u,f),D=P.scaleOrdinal({domain:I,range:null==e?void 0:e.colors}),O=s-25-25,E=m-8-25,L=Math.min(O,E)/2,N=E/2,M=O/2,R=m/5.5,z=t.useCallback((function(e){var t,n,i=(null==e||null==(t=e.coords)?void 0:t.x)+s/2,r=(null==e||null==(n=e.coords)?void 0:n.y)+m/2;b({tooltipLeft:i,tooltipTop:r,tooltipData:JSON.stringify(e.arc.data)})}),[b,m,s]);if(s<10)return null;var V=function(){if(C){var e=JSON.parse(C);return{label:f?f(e[u]):e[u],value:c(e[d])}}return{label:"",value:""}};return p.jsxs("div",{ref:T,style:{position:"relative",height:m,width:s},children:[p.jsx("style",{children:""+Tx}),p.jsx("svg",{width:s,height:m,children:p.jsxs(K.Group,{top:N+8,left:M+25,children:[p.jsx(X,{data:null==e?void 0:e.data,pieValue:function(e){return e[d]},outerRadius:L,innerRadius:null!=(i=e.styles)&&i.hole?L-R:void 0,cornerRadius:null!=(r=null==(o=e.styles)?void 0:o.cornerRadius)?r:5,padAngle:null!=(a=e.styles)&&a.gap?.005:void 0,pieSort:null,pieSortValues:null,children:function(t){return p.jsx(Cw,ge({},t,{animate:!0,getKey:function(e){return JSON.stringify(e.data)},onClickDatum:function(t,n,i){(null==e?void 0:e.onClick)&&(null==e||e.onClick({datum:t,index:n,key:d},i))},getColor:function(t){return e.formatColor&&e.formatColor(t.data,d)||D(t.data[u])},onMouseOver:z,onMouseOut:function(){return y()},showLabel:null==e?void 0:e.showLabel,valueKey:d,formatValue:function(e){return c(e)},onAnimation:function(e){return g(e)}}))}}),w&&p.jsx(_,{style:Ab(ge({},e.popOverMenuStyles,{old:!0})),top:k,left:F,children:p.jsx(gb,{sections:1,children:p.jsx(xb,{label:V().label,value:V().value.toString()})})},l.v4())]})}),!v&&(null==e?void 0:e.legend)&&p.jsx(kb,{colors:null==e?void 0:e.colors,keys:I,typeIndex:kw(null==e?void 0:e.data),alignCenter:!0,replaceDimensionColorsIfPossible:!0,conditionalFormattingPossibilities:function(t){return e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(d):[]}})]})},Sw=function(e,t,n){return e.map((function(e){return n?n(e[t]):e[t]}))},kw=function(e){return e.map((function(e,t){return{index:t,type:"pie"}}))},Aw=t.createContext({editor:null}),Tw=function(){return t.useContext(Aw),null},_w=function(e){var n,i,o,a,l,s,u,d,c=e.displayTitle,f=e.displaySubject,m=t.useState(),h=m[0],v=m[1],g=Pu(),x=g.textOverride,b=g.nullValueAlias,y=g.onViewClick,w=g.queryEngineConfig,C=g.developerTools,j=Dd(),F=Zb({title:c,subject:f}),S={displayTitle:c,displaySubject:f,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:e.setPartialAttributes,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,viewId:null!=(i=null==e?void 0:e.viewId)?i:"",order:e.order},k={dataSetId:e.dataSetId,measure:e.measure,dimension:e.dimension,timeDimension:null,order:e.order,filter:e.filter},A=e.measure.length>0&&e.dimension.length>0,T=function(t,n){var i;v({x:n.clientX,y:n.clientY}),function(e,t,n,i,r,o,a){if(e){var l=qa(t.key);e({viewId:null!=i?i:"",dataSet:{id:n.id,name:n.name,fields:n.fields,description:n.description},clicked:{value:{fieldId:l.fieldId,function:l.function,aggregate:"none",value:t.datum[t.key]}},type:"pieChart"},function(){var e=me(Ce().mark((function e(n){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!a){e.next=4;break}return e.next=3,a(n,My(rt,qa,r,o,t));case 3:return e.abrupt("return",e.sent);case 4:return e.abrupt("return",Promise.resolve(null));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}(y,t,e.dataSet,null!=(i=e.viewId)?i:"",e.dimension,e.timeDimension,e.runViewClickQuery),!1===Xy(e.drilldownOptions)||Ey(e.drilldownSelections)?v(void 0):t&&v({x:n.clientX,y:n.clientY,field:Ny(t,w)})};if($y({developerTools:C,viewId:null!=(o=e.viewId)?o:"",onClickSettingsChange:function(e){return e.pieClickedValue&&e.pieEvent&&T(e.pieClickedValue,e.pieEvent)}}),Ka(e.result))return p.jsx(Nf,{});if(!A)return p.jsx(Hg,{title:"Missing parameters",children:$b(k)});if(e.result&&(null==(a=e.result)?void 0:a.content.length)>1e3)return Xe("Results for this query has "+(null==(d=e.result)?void 0:d.content.length)+" entries, this is too large to render a Pie Chart"),p.jsx(Gg,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},S));var _=Qb({dimension:e.dimension}),I=function(e,t,n,i,o){void 0===i&&(i=!1);var a=hw(e),l=[].concat(a).map((function(e){var i=function(e,t){var n=r.reject([].concat(e.x),(function(e){var n;return e==(null==(n=t.timeDimension)?void 0:n.field)}));return t.timeDimension?[t.timeDimension.field]:n}(t,n),a=i.map((function(t){return tt(e[t],o)})),l={},s=t.y.includes("measures")?[].concat(t.y).slice(0,t.y.length-1):[].concat(t.y),u=[].concat(s).map((function(t){return e[t]}));n.measure.forEach((function(t){var n=Ti(t),i=za(s,u,t.field,t.function);l[i]=e[n]}));var d={};return i.forEach((function(t){d[t]=e[t]})),ge({},d,{x:a.join(", ")},l,{xValues:a})})),s=[],u={};l.forEach((function(e){var t=u[e.x];u[e.x]||s.push(e.x),u[e.x]=r.merge({},t,e)}));var d=s.map((function(e){return u[e]}));return i?function(e){var t=["x","xValues"];return e.map((function(e){var n=ge({},e),i=r.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:r.isNumber(n)?n:0}));return n=r.mapValues(n,(function(e,o){return t.includes(o)?e:r.isNumber(e)?Fa(n[o],i):e}))}))}(d):d}(e.result,_,k,!1,ct(e.dataSetId,e.dimension,e.timeDimension,b,x)),D=function(e,t,n){var i=hw(t),r={};return i.forEach((function(t){var i=[].concat(n.y).map((function(e){return t[e]}));e.measure.forEach((function(e){var t=Ti(e),o=za(n.y,i,e.field,e.function);r[o]={key:o,yValues:[].concat(i,[t]),name:[].concat(i,[t]).join(", ")}}))})),Object.values(r)}(k,e.result,_).map((function(t){return{data:I.map((function(n){var i;return(i={})[e.dimension[0].field]=r.isArray(n[e.dimension[0].field])?n[e.dimension[0].field]:n.x,i[t.key]=Number(n[t.key]),i})),valueKey:t.key,labelKey:e.dimension[0].field}}));return p.jsxs(t.Suspense,{fallback:p.jsx(Nf,{}),children:[p.jsx(Uy,{positioning:h,onClose:function(t){t&&e.onDrilldownChange({newField:t,existingField:null==h?void 0:h.field}),v(void 0)},options:e.drilldownOptions,dataSet:null==e?void 0:e.dataSet,disabled:e.editor}),p.jsxs(Cg,{queriesAreChanging:e.queriesAreChanging,id:e.id,children:[p.jsx(wg,ge({},S)),p.jsx(Qy,{onReset:function(){return e.onResetDrilldown()},drilldownSelections:e.drilldownSelections,dataSet:e.dataSet}),p.jsx(ts,{disabledFeatures:null!=(l=null==e?void 0:e.library)&&l,children:p.jsx(jw,{ref:F,data:D[0].data,labelKey:D[0].labelKey,valueKey:D[0].valueKey,colors:$a(null==j?void 0:j.colors,I.length),styles:null==j||null==(s=j.charts)?void 0:s.pie,onClick:T,popOverMenuStyles:null==j||null==(u=j.charts)?void 0:u.popoverMenus,conditionalFormattingPossibilities:function(t){return hl(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},formatColor:function(t,n){var i=vl(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(i)return i.value},showLabel:"verbose"===(null==j?void 0:j.detail)&&!1!==(null==e?void 0:e.labels)||(null==e?void 0:e.labels),legend:Jb(null==e?void 0:e.legend,"verbose"===(null==j?void 0:j.detail)),formatValue:function(t){return yl(Sa(t,2),null==e?void 0:e.numberFormatOptions,null==e?void 0:e.labelFormat)}})})]})]})};_w.defaultProps={type:"pieChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!1,labelFormat:null,tags:[],drilldownOptions:void 0};var Iw=t.memo(_w,fl),Dw=function(e){var n,i=e.component,r=i.results,o=i.localFilters,a=t.useState(e.component.attributes),l=a[0],s=a[1];t.useEffect((function(){m||(s(e.component.attributes),c([]))}),[JSON.stringify(e.component.attributes)]);var u=rw(r,l,(function(e){return s(e)}),e.dataSet),d=u.onDrilldownChange,c=u.setDrilldownSelections,f=u.drilldownSelections,m=$h(l,e.runQueriesCallback,e.setResults,{localFilters:o,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables).queriesAreChanging,h=function(){var t=me(Ce().mark((function t(n,i){var a,l,s,u;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Ke("ViewClick - queries",n),Ke("ViewClick - existingField",i),a=Ry(e.component.attributes,n,i,xt,(function(e,t,n){var i,o;return Oy([],null!=(i=null==(o=r[0])?void 0:o.content)?i:[],e,t,n)})),Ke("ViewClick - applied filters",a),l=Zr({queryEngineConfig:e.dashboardBehaviour.queryEngineConfig}).init(e.dataSet.id,ge({viewId:e.component.attributes.viewId+"-stats",measure:[],dimension:[]},n,{filter:a})),s=new AbortController,t.prev=6,t.next=9,e.runQueriesCallback(l,s.signal,{localFilters:o,globalFilters:e.globalFilters});case 9:return Ke("ViewClick - results",u=t.sent),t.abrupt("return",{results:u});case 14:t.prev=14,t.t0=t.catch(6),Je("ViewClick - error",t.t0);case 17:case"end":return t.stop()}}),t,null,[[6,14]])})));return function(e,n){return t.apply(this,arguments)}}();return p.jsx(Iw,ge({id:e.id},l,{dataSet:e.dataSet,localFilters:e.component.localFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},setLocalFilters:e.setLocalFilters,result:r&&r[0],queriesAreChanging:m,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,onDrilldownChange:d,drilldownSelections:f,onResetDrilldown:function(){s(e.component.attributes),c([])},editor:null==e?void 0:e.editor,defaultFormats:e.dashboardBehaviour.defaultFormats,runViewClickQuery:h}))},Ow=Fl({borderWidth:0,padding:0,marginLeft:0,marginRight:0}),Ew=function(e){var t,n;return p.jsx(uf,{className:kd(If("panel-property"),""+Ow),marginBottom:null!=(t=e.marginBottom)?t:"0.75rem",as:null!=(n=null==e?void 0:e.as)?n:"div",children:e.children})},Lw=function(e,t,n){return[].concat(t).flatMap((function(t,i){var r=!n.includes(i);return[].concat(function(e){return[].concat(e.fields).filter((function(e){return!bn(e)}))}(t)).filter((function(t){var n;return("dateFilter"==(n=e)||"dateAndTimeFilter"==n||"dateTimeFilter"==n?["date_time"]:"numericFilter"===n?["number"]:["number","string","boolean","string[]"]).includes(t.dataType)})).map((function(e){return{label:t.name+" · "+e.publicName,value:{dataSetId:t.id,field:e},hide:r}}))}))},Nw=function(e,t){switch(t.type){case"setSelectedFields":return function(e,t){return ge({},e,{selectedFieldIndexes:t.selectedFieldIndexes})}(e,t);case"setSelectedDataSets":return function(e,t){var n=t.selectedDataSetIndexes,i=e.dataSets,o=e.selectedFieldIndexes,a=Lw(e.type,i,e.selectedDataSetIndexes);return o=r.remove(o,(function(e){var t=$o(i,a[e].value.dataSetId);return n.includes(t[1])})),ge({},e,{selectedDataSetIndexes:n,selectedFieldIndexes:o})}(e,t);case"setTitle":return function(e,t){return ge({},e,{title:t.title})}(e,t);case"setType":return function(e,t){return ge({},e,{selectedFieldIndexes:[],type:t.filterType})}(e,t);case"setAdvancedOptions":return function(e,t){return t.options.inclusiveDate&&"dateFilter"!==e.type&&"dateAndTimeFilter"!==e.type?e:ge({},e,{options:t.options})}(e,t);default:return ge({},e)}},Mw=function(e,t){var n=e[null==t?void 0:t[0]];return n?e.map((function(e){return(null==e?void 0:e.value.field.dataType)!==(null==n?void 0:n.value.field.dataType)?ge({},e,{hide:!0}):e})):e},Rw=function(e){return p.jsxs(yf,{alignItems:"center",children:[p.jsx(Uh,{onChange:function(t){e.onChange(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),p.jsx(Kf,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},Pw={type:"singleSelectFilter",appliesToFields:[],title:"",value:null,requiresValue:!1,managedByConfiguration:!1},zw=function(e){var i,o=function(e,i){var o,a,l=i.filter((function(e){return!e.hide})),s=r.uniq([].concat(e.appliesToFields).map((function(e){return l.findIndex((function(t){return t.id==e.dataSetId}))}))),u=[].concat(e.appliesToFields).flatMap((function(t){var n=Lw(e.type,l,s).findIndex((function(e){return e.value.dataSetId==t.dataSetId&&t.fieldId==e.value.field.id}));return-1==n?[]:[n]})),d=function(){if("dateFilter"===e.type)return{inclusiveDate:e.inclusiveDate,allowTimeSelection:e.allowTimeSelection}}(),c=n.useReducer(Nw,{title:e.title,type:e.type,selectedDataSetIndexes:s,dataSets:l,selectedFieldIndexes:u,options:d}),p=c[0],f=c[1];!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(p);var m,h,v=[].concat(l).map((function(e){return{label:e.name,value:e.id}})),g=Lw(p.type,l,p.selectedDataSetIndexes),x=[].concat(p.selectedFieldIndexes).map((function(e){var t=g[e].value;return{dataSetId:t.dataSetId,fieldId:t.field.id}})),b={type:p.type,appliesToFields:x,title:p.title,value:null,managedByConfiguration:!1,requiresValue:!1};return null!=(o=p.options)&&o.inclusiveDate&&"dateFilter"===p.type&&(b=ge({},b,{inclusiveDate:null==(m=p.options)?void 0:m.inclusiveDate})),null!=(a=p.options)&&a.allowTimeSelection&&"dateFilter"===p.type&&(b=ge({},b,{allowTimeSelection:null==(h=p.options)?void 0:h.allowTimeSelection})),t.useEffect((function(){1===v.length&&f({type:"setSelectedDataSets",selectedDataSetIndexes:[0]})}),[]),{selectedFieldIndexes:p.selectedFieldIndexes,selectedDataSetIndexes:p.selectedDataSetIndexes,dataSetOptions:v,fieldOptions:"advancedFilter"===p.type?Mw(g,p.selectedFieldIndexes):g,dispatch:f,globalFilter:b}}(e.current||Pw,e.dataSets),a=o.fieldOptions,l=o.dataSetOptions,s=o.globalFilter,u=o.dispatch,d=o.selectedDataSetIndexes,c=o.selectedFieldIndexes,f=Pu(),m=f.featureToggles,h=f.textOverride,v=function(e){u({type:"setAdvancedOptions",options:e})};return p.jsxs(p.Fragment,{children:[p.jsx(Mh.Header,{title:h("new_filter","New filter"),show:!0}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{label:h("title","Title"),id:"title",placeholder:h("title","Title"),value:s.title,onChange:function(e){u({type:"setTitle",title:e.target.value})}})}),l.length>1&&p.jsx(Ew,{children:p.jsx(ev,{id:"data-set",label:h("data_sets","Data sets"),placeholder:h("data_sets_placeholder","Which data sets will this filter impact?"),options:l,selected:d,setSelected:function(e){u({type:"setSelectedDataSets",selectedDataSetIndexes:e})},textOverride:h})}),p.jsx(Ew,{children:p.jsx(nm,{id:"filter-type",label:h("filter_type","Filter type"),anchorLeft:!0,selected:s.type,onChange:function(e){u({type:"setType",filterType:e})},options:(i=[{label:h("single_select","Single select"),value:"singleSelectFilter",subText:h("single_select_filter_description","Choose a single option from the list to filter. ")}],m.simpleMultiSelectFilter&&i.push({label:h("multi_select","Multi select"),value:"multiSelectFilter",subText:h("multi_select_description","Allow multiple selections.")}),i.push({label:h("advanced_filter","Advanced filter"),value:"advancedFilter",subText:h("advanced_filter_description","Create complex filters using comparison operators.")}),m.showDateFilter&&i.push({label:h("date_picker","Date picker"),value:"dateFilter",subText:h("date_picker_description","Select a specific date or date range, with an optional time, to filter the data.")}),i),textOverride:h})}),p.jsx(Ew,{children:p.jsx(ev,{label:h("fields","Fields"),id:"data-set-fields",placeholder:h("fields_placeholder","Which fields will this filter impact?"),options:a,selected:c,setSelected:function(e){u({type:"setSelectedFields",selectedFieldIndexes:e})},textOverride:h})}),"dateFilter"===s.type&&p.jsx(Ew,{children:p.jsx(ex,{testId:"percentage-advanced-options",showAccordionIcon:!0,title:h("advanced_options","Advanced Options"),defaultOpen:s.allowTimeSelection||s.inclusiveDate,children:p.jsxs(Ew,{as:"fieldset",children:[p.jsx(uf,{marginY:5,children:p.jsx(Rw,{id:"inclusive-of-current-date",label:h("filter.include_time_range","Include time range"),onChange:function(e){return v({inclusiveDate:e})},currentValue:s.inclusiveDate})}),p.jsx(uf,{marginY:5,children:p.jsx(Rw,{id:"allow-time-selection",label:h("filter.allow_time_selection","Allow time selection"),onChange:function(e){return v({allowTimeSelection:e})},currentValue:s.allowTimeSelection})})]})})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:function(){return e.onCancel()},children:h("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){e.setFilter(s)},children:h("confirm","Confirm")})]})})]})},Vw=Object.assign((function(){}),{svg:function(e){var t,n,i;return Fl({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==e||null==(t=e.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==e||null==(n=e.info)?void 0:n.iconColor,transform:"rotate(180deg)"},critical:{fill:null==e||null==(i=e.critical)?void 0:i.iconColor}}}})},icon:Fl({paddingTop:0,display:"block",height:"1rem",width:"1rem"})}),qw=function(e){var t,n=Dd();return p.jsxs("div",{className:kd(""+Vw.icon,null==e?void 0:e.className),role:"alert",children:[p.jsx("span",{className:""+Xl,children:null==e?void 0:e.title}),p.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+Vw.svg(null==n?void 0:n.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:p.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+Vw.svg(null==n?void 0:n.alerts)({alertType:null!=(t=null==e?void 0:e.type)?t:"info"}),children:p.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})]})},Bw=function(e){var i=e.filters,r=e.show,o=e.onClose,a=e.source,l=e.onDeleteItem,s=e.onUpdate,u=e.dataSets.filter((function(e){return!e.preAggregated})),d=t.useState([])[1];t.useEffect((function(){Xe("Filters",i)}),[i]);var c=Pu(),f=c.textOverride,m=c.mode,h=n.useState(null),v=h[0],g=h[1],x=Array.isArray(i)?[].concat(i).map((function(e,t){var n={},i=e.hidden;0!==e.appliesToFields.length||i||(n={renderRight:function(){return p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added.")})},children:p.jsx(qw,{title:f("warning_no_field_on_this_filter","There are no fields on this Filter. It should be deleted or a field added."),type:"warning",className:""+Hw})})}});var r=i?"This filter is hidden.":f("additional_filters.filter_type_subtext","[[filterType]] for [[numberOfFields]] {{field}} [[listOfFields]]",{field:{count:e.appliesToFields.length,singular:"field",plural:"fields"},listOfFields:Re([].concat(e.appliesToFields).map((function(e){var t=Ko(u,e.dataSetId);return t?Qo(t,e.fieldId).publicName:""})),!0,f),numberOfFields:e.appliesToFields.length,filterType:Tt(e.type,f)});return ge({isHiddenFilter:i,preventDelete:e.managedByConfiguration,title:Nt(e,u,f),subtext:r},n,{editIcon:!e.managedByConfiguration,onClick:e.managedByConfiguration?function(){}:function(){return g({draftFilter:e,filterIndex:t})},id:"filter_"+t})})).filter((function(e){return!e.isHiddenFilter})):[];return p.jsxs(p.Fragment,{children:[p.jsxs(Mh,{width:"xl","data-testid":"manage-filters-modal",isOpen:r,onClose:function(){return o()},children:[p.jsx(Mh.Header,{title:""+("global"===a?f("dashboard_filters","Dashboard filters"):f("add_local_filters","Add Local filters")),show:!0}),p.jsx(Mh.Content,{children:p.jsx(jx,{mode:m,onDeleteItem:l,newItemBtn:{callToAction:"global"===a?f("new_dashboard_filter","New dashboard filter"):f("new_local_filter","New local filter"),onClick:function(){g({filterIndex:void 0,draftFilter:Pw}),d(i)}},items:x})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsx(Pv,{onClick:function(){return o()},secondary:!0,children:f("close","Close")})})]}),p.jsx(Mh,{width:"xl","data-testid":"edit-filter",isOpen:null!=v,onClose:function(){},hideCloseIcon:!0,children:p.jsx(zw,{onCancel:function(){return g(null)},current:(null==v?void 0:v.draftFilter)||null,setFilter:function(e){d(i),s({filter:e,index:null==v?void 0:v.filterIndex}),g(null)},dataSets:u})})]})};function Ww(e,t){var n=t.filter,i=t.index,r=[].concat(e);return void 0===i?r=[].concat(r,[n]):i>=0&&i<r.length&&(r[i]=n),r}var Hw=Fl({paddingTop:0}),Yw=function(){var e=qm(),t=e.dashboard,i=e.dispatch,r=e.trackEvent,o=n.useState(!1),a=o[0],l=o[1];if(!t)return null;var s=function(e){i({type:"setGlobalFilters",globalFilters:e})};return p.jsxs(p.Fragment,{children:[p.jsx(Gw,{onChange:function(){r("manageGlobalFilters.open"),l(!0)},disabled:fu(t.display)}),p.jsx(Bw,{dataSets:t.dataSets,filters:t.globalFilters,show:a,onUpdate:function(e){var n=Ww(t.globalFilters,e);s(n)},source:"global",onDeleteItem:function(e){var n=[].concat(t.globalFilters);n.splice(e,1),s(n)},onClose:function(){r("manageGlobalFilters.close"),l(!1)}})]})},Gw=function(e){var t,n=Dd(),i=Pu().textOverride;return p.jsx("div",{className:""+Uw,"data-themeapi":"filters.filterBy",children:p.jsx(Pv,{testId:"manage-global-filters-open",onClick:null==e?void 0:e.onChange,disabled:null==e?void 0:e.disabled,className:kd("filter-by-button"),themeOverride:null==n||null==(t=n.filters)?void 0:t.filterBy,secondary:!0,children:p.jsxs(yf,{as:"span",justifyContent:"center",alignItems:"center",gap:"0.25rem",children:[p.jsx("span",{className:"filter-by-button-icon",children:p.jsx(fs,{active:!1})}),p.jsx("span",{className:"filter-by-button-text",children:i("dashboard-filters.call-to-action","Add filter")})]})})})},Uw=Fl({minWidth:"100px",position:"relative"}),Kw=Yu((function(e){var n=qm().dashboard,i=Pu(),r=i.dateFilterOptions,o=i.featureToggles,a=i.cascadeFilterSelection;return p.jsxs(yf,{gap:"0.5rem","data-component":"filters",className:""+Zw(i.scope),wrap:!0,children:[e.globalFilters.length>0&&p.jsx(t.Fragment,{children:[].concat(e.globalFilters).map((function(t,i){return p.jsx(ag,{shouldAlwaysHaveValue:t.requiresValue,dataSets:n.dataSets,dateFilterOptions:r,filter:ge({},t,{optionsFilters:Bt(null==e?void 0:e.globalFilters,n.dataSets,r,a)}),filterIndex:i,onChange:function(t){var n=[].concat(e.globalFilters);n[i]=t,e.setGlobalFilters(n)}},i)}))}),o.canManageGlobalFilters&&p.jsx(Yw,{})]})}),"renderGlobalFiltersViewComponent"),Xw=function(e){var t=Pu();return p.jsx("div",{className:""+Qw(t.scope),"data-component":"global-filters",children:p.jsx(Kw,ge({},e))})},Qw=function(e){return Fl("read"===e?{"@media (min-width: 768px)":{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"},"@media (max-width: 767px)":{display:"block"}}:{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"})},Zw=function(e){return Fl("read"===e?{"@media (min-width: 768px)":{flexDirection:"row"},"@media (max-width: 767px)":{flexDirection:"column"}}:{flexDirection:"row"})},Jw=s.object({dataSetId:s.string().required(),fieldId:s.string().required()}),$w=s.array().items(Jw).required();function eC(e,t,n,i){var r=e.properties.appliesToFields,o=$w.validate(r).error;if(o&&Je("Validation error for appliesToFields: "+o.message+" ",r),t.forEach((function(i,o){tC(i.appliesToFields,r)&&(n=!0,t[o]=ge({},i,e.properties))})),!n)throw Je("No matching filters found for the provided appliesToFields when running updateFilter.",i.updateFilter),new Error("No matching filters found for the provided appliesToFields.");return n}function tC(e,t){return e.length===t.length&&e.every((function(e){return t.some((function(t){return t.dataSetId===e.dataSetId&&t.fieldId===e.fieldId}))}))}var nC=function(e){function t(t,n){var i;return(i=e.call(this,"'Issue with Vizzly State "+n+": '"+t+"'")||this).name="StateValidation",i}return be(t,e),t}(Ut),iC=function(e,t){var n=[];return e.forEach((function(e){var i=li(t,!!e.requiresValue).validate(e),r=i.error,o=i.value;if(r)throw Je("Invalid global filter configuration: "+r.message),r;n.push(o)})),n},rC=function(){var e=qm(),n=e.dashboard,i=e.dispatch,r=n.globalFilters,o=Pu(),a=o.featureToggles,l=o.queryEngineConfig,s=o.scope,u=function(e,n){var i=t.useState(void 0),r=i[0],o=i[1];return{get:function(){try{var t=window.localStorage.getItem(e);return t?JSON.parse(t):void 0}catch(e){return void console.error(e)}},set:function(t){try{var n=t instanceof Function?t(r):t;o(n),window.localStorage.setItem(e,JSON.stringify(n))}catch(e){console.error(e)}},storedValue:r}}("dashboard_global_filters_"+n.id),d=a.showGlobalFilters;Nu((function(e){var t=function(e,t){var n;if(t.addFilter){var i,r,o=$w.validate(t.addFilter.properties.appliesToFields).error;if(o)throw Je("Validation error for appliesToFields: "+o.message,null==(i=t.addFilter)||null==(i=i.properties)?void 0:i.appliesToFields),new Error("Validation error for appliesToFields");if(e.some((function(e){var n,i;return tC(e.appliesToFields,null!=(n=null==(i=t.addFilter)||null==(i=i.properties)?void 0:i.appliesToFields)?n:[])})))throw Je("Filter with matching appliesToFields already exists",t.addFilter),new Error("Filter with matching appliesToFields already exists.");e.push(null==(r=t.addFilter)?void 0:r.properties)}if(t.updateFilter&&eC(t.updateFilter,e,!1,t),t.updateFilters)return null==t||null==(n=t.updateFilters)||n.forEach((function(n){eC(n,e,!1,t)})),e;if(t.removeFilter){var a=$w.validate(t.removeFilter).error;if(a)throw Je("Validation error for appliesToFields: "+a.message+" ",t.removeFilter),new Error("No matching filters found for the provided appliesToFields.");e=e.filter((function(e){return!(t.removeFilter&&tC(e.appliesToFields,t.removeFilter))}))}return Ke("Updated global filters",e,t),e}(r,e);try{var n=iC(t,l);i({type:"setGlobalFilters",globalFilters:n})}catch(e){throw new nC(e,"globalFilters")}}));var c=function(e){return u.set(function(e){var t=e.map((function(e){return{value:e.value,appliesToFields:e.appliesToFields}}));return JSON.stringify(t)}(e))},f="read"===s&&!a.disablePersistingGlobalFiltersLocally;return t.useEffect((function(){if(f){var e=u.get();if(e)try{var t=function(e,t,n,i,r,o){var a=JSON.parse(e);return{validFilters:n(t.map((function(e){var t=a.find((function(t){var n=t.appliesToFields,o=function(e){var t=$w.validate(e).error;return null==t?void 0:t.message}(n);return o&&r("Validation error for appliesToFields: "+o+" ",n),i(e.appliesToFields,n)}));return t?ge({},e,t):e})))}}(e,r,(function(e){return iC(e,l)}),tC,Je).validFilters;if(JSON.stringify(t)===JSON.stringify(r))return void Xe("No global filters have changed, not updating local storage");i({type:"setGlobalFilters",globalFilters:t})}catch(e){throw new nC(e,"globalFilters")}else Xe("No global filters found in local storage, setting from dashboard"),c(r)}}),[s,a.disablePersistingGlobalFiltersLocally]),d?p.jsx(Xw,{globalFilters:r,setGlobalFilters:function(e){Ke("Setting global filters",e),i({type:"setGlobalFilters",globalFilters:e}),f&&(Xe("Saving global filters to local storage"),c(e))},setupAsyncOptionLoader:function(){return me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Not implemented.";case 1:case"end":return e.stop()}}),e)})))}}):null},oC=Object.assign((function(e){var n=e.content,i=e.textOverride,r=e.children,o=t.useState(!1),a=o[0],l=o[1],s=Ig().addToast;return p.jsxs(yf,{gap:"0.5rem",children:[p.jsx(uf,{textWrap:!0,flex:1,hyphens:"none",children:p.jsx("span",{style:{userSelect:"none"},children:r||n})}),p.jsx(oC.Button,{onClick:function(e){e.preventDefault(),e.stopPropagation(),"string"==typeof n&&(J(n),l(!0),s((function(){return p.jsx(Tg,{message:"Copied to clipboard"})})),setTimeout((function(){return l(!1)}),2e3))},copied:a,textOverride:i})]})}),{Button:function(e){return p.jsxs("button",{onClick:function(t){return null==e?void 0:e.onClick(t)},"aria-label":e.textOverride?e.textOverride("copy_content","Copy content"):"Copy content",className:""+Ql.button,children:[!(null!=e&&e.copied)&&p.jsx("svg",{height:22,width:22,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),(null==e?void 0:e.copied)&&p.jsx("svg",{height:22,width:22,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75"})})]})}}),aC=function(e){return p.jsxs("pre",{className:es({backgroundColor:"rgba(0, 0, 0, 0.9)",borderRadius:"8px",color:"white",padding:"12px",marginBottom:"12px",userSelect:"none",fontSize:e.sm?"12px":"14px",position:"relative",lineHeight:e.sm?"16px":"20px"}),children:[p.jsx(lC,{content:e.content,copyContent:e.copyContent}),e.children||e.content]})},lC=function(e){var n=Ig().addToast,i=t.useState(!1),r=i[0],o=i[1];return p.jsx(oC.Button,{onClick:me(Ce().mark((function t(){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.copyContent){t.next=6;break}return t.next=3,e.copyContent();case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=e.content;case 7:J(t.t0),n((function(){return p.jsx(Tg,{message:"Copied to clipboard"})})),o(!0),setTimeout((function(){return o(!1)}),2e3);case 12:case"end":return t.stop()}}),t)}))),iconStyles:{position:"absolute",top:"0.75rem",right:"1.25rem"},copied:r})},sC=function(){var e,t=Pu(),n=t.overrideDeveloperInfo,i=t.setOverrideDeveloperInfo;return p.jsx(Mh,{width:"xl",isOpen:!!n,onClose:function(){return i(null)},children:p.jsxs("div",{onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[p.jsx(Mh.Header,{title:"Replace component"}),p.jsxs(Mh.Content,{children:[p.jsx("div",{className:es({marginTop:"8px"}),children:p.jsx(aC,{content:"<Vizzly.Dashboard\n// Rest of dashboard props...\n"+(null==n?void 0:n.overrideKey)+"={CustomComponent}\n/>"})}),p.jsxs("p",{children:["Adding the `",null==n?void 0:n.overrideKey,"` React prop of the Vizzly.Dashboard component, will allow you to render your own component."]}),!r.isEmpty(null==n?void 0:n.componentProps)&&p.jsx("div",{className:es({marginTop:"8px",padding:"4px 12px",borderRadius:"6px",backgroundColor:"#f3f5f9"}),children:p.jsx($g,{showAccordionIcon:!0,title:"View props",children:p.jsx(aC,{content:(e=null==n?void 0:n.componentProps,JSON.stringify(e,(function(e,t){if("testId"!=e)return"children"==e?" [ React.JSX ] ":r.isFunction(t)?" [ function ] ":t}),2))})})})]})]})})},uC=Object.assign((function(){return null}),{tooltip:Fl({height:"100%",width:"100%",justifyContent:"center",alignItems:"center",display:"flex"})}),dC=function(e){return null!=e&&e.narrow?p.jsx(sh,{placement:"right-start",tooltipContent:function(){return p.jsx(sh.Content,{children:null==e?void 0:e.tooltipLabel})},className:""+uC.tooltip,classNameTrigger:""+uC.tooltip,children:p.jsx(cC,ge({},e))}):p.jsx(cC,ge({},e))},cC=function(e){var t;return p.jsxs(rx,{onChange:null==e?void 0:e.onChange,size:"large","data-compenent":null!=(t=null==e?void 0:e["data-component"])?t:"add-cell-button",className:e.className,children:["+ ",p.jsx("span",{style:null!=e&&e.narrow?{display:"none"}:{},children:null==e?void 0:e.label})]})},pC=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadQueryEngineConfig",n}return be(t,e),t}(Fe(Error)),fC=function(e){function t(t){var n;return(n=e.call(this,"The queryEngineEndpoint value '"+t+"' is not valid.")||this).invalidEndpoint=void 0,n.name="InvalidQueryEngineEndpoint",n.invalidEndpoint=t,n}return be(t,e),t}(Fe(Error)),mC=function(e){function t(){var t;return(t=e.call(this,"The queryEngineEndpoint value is not of the correct type. It must be a string or a function.")||this).name="InvalidQueryEngineEndpointType",t}return be(t,e),t}(Fe(Error)),hC=function(e){return e.startsWith("/")?hC(e.slice(1)):e.endsWith("/")?hC(e.slice(0,-1)):e},vC=function(e,t){var n=hC(e),i=hC(t),r=function(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}(e)?"":"/";return""==n&&""==i?"/":""==i?""+r+n:""!=n&&""!=i?""+r+n+"/"+i:""+r+i},gC=function(e){return function(){var t=me(Ce().mark((function t(n,i,r){var o,a,l,s;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},i&&(o.auth="Bearer "+i),a="",r&&(a="filter="+r.join(",")),t.next=6,e({path:"/api/v2/auth/project/"+n+"/access_token?"+a,method:"get",headers:o});case 6:if(s=(l=t.sent).body,200!=l.status){t.next=11;break}return t.abrupt("return",s.token.token);case 11:return t.abrupt("return",void 0);case 12:case"end":return t.stop()}}),t)})));return function(e,n,i){return t.apply(this,arguments)}}()},xC=function(){var e=me(Ce().mark((function e(t,n){var i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.dashboardAccessToken){e.next=3;break}return Ke("Using dashboard access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.dashboardAccessToken});case 3:if(!t.projectAccessToken){e.next=6;break}return Ke("Using project access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.projectAccessToken});case 6:if(!t.apiKey){e.next=11;break}return Ke("Using API Key for auth header"),e.abrupt("return",{auth:"Api-Key "+t.apiKey});case 11:if(!n.preFetchProjectAccessTokens||!t.useCookieAuth&&!t.appSessionAuthToken){e.next=24;break}return Ke("Fetching project access token from the Vizzly API",n.preFetchProjectAccessTokens.projectId,"Filtering by",n.preFetchProjectAccessTokens.resourceFilters),e.next=15,gC(bC(t))(n.preFetchProjectAccessTokens.projectId,t.appSessionAuthToken,n.preFetchProjectAccessTokens.resourceFilters);case 15:if(!(i=e.sent)){e.next=21;break}return Ke("Project access token received."),e.abrupt("return",{auth:"Bearer "+i});case 21:Ke("Failed to receive project access token.");case 22:e.next=25;break;case 24:Ke("Not pre-fetching project access token.");case 25:return e.abrupt("return",{});case 26:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),bC=function(e){return function(){var t=me(Ce().mark((function t(n){var i,r,o,a,l,s;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,xC(e,n);case 3:return i=t.sent,r=n.headers||{},o=vC(e.host,n.path),t.next=8,G(o,{method:n.method,headers:ge({"Content-Type":"application/json",Accept:"application/json"},i,r),redirect:"follow",referrerPolicy:"no-referrer",body:n.body?JSON.stringify(n.body):null,signal:n.abortSignal,mode:n.mode||void 0});case 8:return a=t.sent,t.next=11,a.json();case 11:return l=t.sent,Ke("HTTP Client Response",{host:e.host,path:n.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),t.abrupt("return",{body:l,status:a.status,headers:a.headers});case 16:if(t.prev=16,t.t0=t.catch(0),null==(s=n.abortSignal)||!s.aborted){t.next=21;break}return console.log("Aborted a request."),t.abrupt("return",{status:500,body:{reason:"Aborted"},headers:null});case 21:throw t.t0;case 22:case"end":return t.stop()}}),t,null,[[0,16]])})));return function(e){return t.apply(this,arguments)}}()},yC=function(e){return"string"==typeof e?{}:e.customHeaders?e.customHeaders():{}},wC=function(){var e,t;if("undefined"==typeof window)return{};var n=null!=(e=window)&&null!=(e=e.VizzlyDev)&&e.getServerLogLevel?null==(t=window)||null==(t=t.VizzlyDev)?void 0:t.getServerLogLevel():void 0;return n?{"vizzly-log-level":n}:{}},CC=function(e){return function(){var t=me(Ce().mark((function t(n){var i,r;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={host:kC(e)},r=ge({},n,{headers:ge({},n.headers,yC(e),wC())}),t.abrupt("return",bC(i)(r));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},jC=function(){var e=me(Ce().mark((function e(t){var n,i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=CC(t),e.next=3,n({method:"post",mode:"cors",path:"/api/v1/support",body:{frontendFeatures:["formatter:monthOfYearOnly"]}});case 3:if(200!=(i=e.sent).status){e.next=6;break}return e.abrupt("return","supportedFeatures"in(r=i.body)?r:ge({},r,{supportedFeatures:["subquery"]}));case 6:return e.abrupt("return",null);case 7:case"end":return e.stop()}var r}),e)})));return function(t){return e.apply(this,arguments)}}(),FC=function(e){var t="string"==typeof e?e:e.endpoint;return!!t.startsWith("http://")||!!t.startsWith("https://")||!!t.startsWith("/")},SC=function(){var e=me(Ce().mark((function e(t,n){var i,r;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"in-browser"!==t){e.next=5;break}return e.abrupt("return",Cu);case 5:if("function"!=typeof t){e.next=14;break}return e.next=8,t();case 8:if(i=e.sent){e.next=11;break}throw new pC("Failed to load query engine config.");case 11:return e.abrupt("return",ge({},i));case 14:if(!n){e.next=20;break}if(FC(t)){e.next=17;break}throw new fC(t);case 17:return e.abrupt("return",Cu);case 20:if(!("string"==typeof t||"object"==typeof t&&"endpoint"in t)){e.next=31;break}if(FC(t)){e.next=23;break}throw new fC(t);case 23:return e.next=25,jC(t);case 25:if(r=e.sent){e.next=28;break}throw new pC("Failed to load query engine config.");case 28:return e.abrupt("return",r);case 31:throw new mC;case 32:e.next=42;break;case 34:if(e.prev=34,e.t0=e.catch(0),Je(e.t0),!(e.t0 instanceof fC)){e.next=39;break}throw e.t0;case 39:if(!(e.t0 instanceof mC)){e.next=41;break}throw e.t0;case 41:throw new pC("Failed to load query engine config.");case 42:case"end":return e.stop()}}),e,null,[[0,34]])})));return function(t,n){return e.apply(this,arguments)}}(),kC=function(e){return"string"==typeof e?e:e.endpoint},AC=function(e){return p.jsx(Ew,{children:p.jsx("div",{className:""+TC,children:p.jsx($f,{label:e.label,id:null==e?void 0:e.id,style:{padding:0,flexGrow:1,marginBottom:0},type:"color",onChange:function(t){e.setColor(t.target.value)},value:e.currentValue||void 0})})})},TC=Fl({width:"100%",flexDirection:"column",flexGrow:1,height:"100%",display:"flex"}),_C=Object.assign((function(){return null}),{wrapper:Fl({position:"relative","&:hover .help-icon":{opacity:1}}),fadeIn:function(e){return Fl(ge({opacity:0,maxWidth:18,color:e},Cl))}}),IC=function(e){return p.jsxs(yf,{alignItems:"top"===(null==e?void 0:e.checkboxPosition)?"flex-start":"center",children:[p.jsx(Uh,{onChange:function(t){e.setChecked(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id,checked:!!e.currentValue}),p.jsxs(Kf,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",classNameOverride:e.classNameLabel,children:[e.tooltip&&p.jsxs(yf,{className:""+_C.wrapper,alignItems:"center",gap:"0.25rem",children:[p.jsx("span",{children:e.label}),p.jsx(uf,{width:"18px",as:"span",children:p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:null==e?void 0:e.tooltip})},children:p.jsx(b.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+_C.fadeIn(Sl(15))+" "+Ql.cursor("pointer"),onClick:e.tooltipOnClick})})})]}),!e.tooltip&&e.label]})]})},DC=function(e){return p.jsx("div",{children:p.jsx($f,{id:null==e?void 0:e.id,label:null==e?void 0:e.label,maxLength:e.maxLength,onChange:function(t){e.setText(t.target.value)},defaultValue:e.currentValue||void 0})})},OC=function(e){var t=Pu();return p.jsx(im,{children:p.jsx(nm,{labelHidden:null==e?void 0:e.labelHidden,label:e.label,id:null==e?void 0:e.id,onChange:e.onSelect,options:e.options,selected:e.currentValue,dynamicWidth:!0,textOverride:t.textOverride})})},EC=["uploadButtonTitle","allowMultipleFiles"],LC={fileList:null,value:""},NC=function(e){var n=e.uploadButtonTitle,i=void 0===n?"Upload file":n,r=e.allowMultipleFiles,o=void 0!==r&&r,a=we(e,EC),l=t.useRef(null),s=a.files&&Array.from(a.files);return p.jsxs("div",{children:[a.label&&p.jsx("label",{className:""+MC,htmlFor:"file",children:a.label}),p.jsx("input",{hidden:!0,name:"file",type:"file",className:es({display:"hidden",width:0,height:0}),ref:l,accept:a.accept,tabIndex:-1,multiple:o,onChange:function(e){return a.onChange(e)},value:a.value}),p.jsxs("button",{type:"button",className:""+RC,onClick:function(){var e;return null==l||null==(e=l.current)?void 0:e.click()},children:[p.jsx("span",{className:""+PC,children:p.jsx(Gs,{width:24,height:24,fill:"#3074D9"})}),p.jsx("span",{className:""+zC,children:i}),a.uploadButtonDescription&&p.jsx("span",{className:""+VC,children:a.uploadButtonDescription})]}),s&&s.length>0&&p.jsx("div",{className:""+qC,children:s.map((function(e){return p.jsxs("div",{className:""+BC,children:[p.jsx(Us,{style:{pointerEvents:"none"},width:20,height:20,fill:Sl(60)}),p.jsx("span",{className:""+WC,children:e.name}),p.jsxs("button",{type:"button",className:""+HC,onClick:function(){return function(e){if(o){if(a.files){var t=Array.from(a.files).filter((function(t){return t!==e}));a.setFiles((function(e){return ge({},e,{fileList:t})}))}}else a.setFiles(LC)}(e)},"aria-label":"remove",children:[p.jsx("span",{className:""+Xl,children:"Remove"}),p.jsx(ms,{width:16,height:16,fill:Sl(20)})]})]},e.name)}))})]})},MC=Fl({color:Sl(0),fontSize:"0.875rem",display:"block",lineHeight:"1.25rem",fontWeight:"600",marginBottom:"0.75rem"}),RC=Fl({border:"2px dashed "+Sl(70),borderRadius:"0.75rem",padding:"1.5rem 2rem",background:"transparent",width:"100%",cursor:"pointer",display:"flex",justifyContent:"center",flexWrap:"wrap","&:hover":{background:Sl(88)}}),PC=Fl({background:"#E0F2FF",padding:"0.5rem",borderRadius:"50%",display:"block",width:"2.5rem",height:"2.5rem",pointerEvents:"none"}),zC=Fl({display:"block",fontWeight:600,fontSize:"0.875rem",lineHeight:"1.25rem",color:Sl(0),pointerEvents:"none",textAlign:"center",width:"100%",marginTop:"0.5rem"}),VC=Fl({display:"block",color:Sl(10),fontSize:"0.75rem",lineHeight:"1rem",marginTop:"0.25rem",pointerEvents:"none"}),qC=Fl({marginTop:"1.5rem",display:"grid",gridTemplateColumns:"1fr",gap:"0.5rem"}),BC=Fl({width:"100%",background:"white",border:"2px solid "+Sl(80),borderRadius:"0.5rem",position:"relative",padding:"0.5rem",display:"grid",gridTemplateColumns:"1.25rem 1fr",gap:"0.375rem"}),WC=Fl({width:"100%",fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:500,wordBreak:"break-all"}),HC=Fl({borderRadius:"50%",padding:"0.25rem",position:"absolute",right:"-0.75rem",top:"-0.75rem",border:"none",background:"white",cursor:"pointer","&:hover":{background:Sl(88)},"&:focus":{background:Sl(88)}}),YC=function(e){var n,i,r=t.useState(!1),o=r[0],a=r[1],l=t.useState(null),s=l[0],u=l[1],d=t.useState(!1),c=d[0],f=d[1],m=t.useState(null),h=m[0],v=m[1],g=t.useState(!1),x=g[0],b=g[1],y=t.useState({fileList:null,value:""}),w=y[0],C=y[1],j=t.useState(null),F=j[0],S=j[1],k=qm(),A=k.dashboard,T=k.dispatch,_=Pu().queryEngineConfig,I=null===A.parentDashboardId?'"'+(A.metadata._vizzly_parent_dashboard_name||"Unnamed")+'" parent dashboard':"",D=function(e){var t=new FileReader;return new Promise((function(n,i){t.onerror=function(){t.abort(),i(new DOMException("Problem parsing file."))},t.onload=function(){n(t.result)},t.readAsText(e)}))},O=function(){var e=me(Ce().mark((function e(t){var n,i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t.target.files){e.next=14;break}if(n=t.target.files[0],h&&v(null),"application/json"===n.type){e.next=6;break}throw new Error("Please upload a valid JSON file");case 6:return C({fileList:t.target.files,value:t.target.value}),e.next=9,D(n);case 9:i=JSON.parse(e.sent),S(i),e.next=16;break;case 14:console.log("No files selected"),C(LC);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),v(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(t){return e.apply(this,arguments)}}(),E=function(){u(null),a(!1)},L=function(){v(null),f(!1)};return p.jsxs(uf,{paddingTop:"0.50rem","data-component":null==e?void 0:e["data-component"],paddingBottom:"1rem",className:"vizzly-toolbar",children:[p.jsxs("div",{className:es({background:"#1E1D2D",color:"white",padding:"0.5rem 0.5rem 0.5rem 1rem",borderRadius:"1rem",display:"flex",justifyContent:"space-between",fontFamily:"Inter, sans-serif",flexWrap:"wrap","@media (min-width: 480px)":{flexWrap:"nowrap"}}),children:[p.jsxs("div",{className:es({display:"flex",justifyContent:"start",gap:"0.75rem",alignItems:"center",width:"100%",MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",textShadow:"rgba(0, 0, 0, 0.01) 0 0 1px","@media (min-width: 480px)":{width:"41.5rem"}}),children:[p.jsx("span",{className:""+Ql.srOnly,children:"Vizzly"}),p.jsx("a",{href:e.logo.href,className:es({display:"block"}),target:null!=(n=null==e||null==(i=e.logo)?void 0:i.target)?n:void 0,children:p.jsx(Ts,{width:32,height:32,gradient:!0})}),(null==e?void 0:e.logo.text)&&p.jsx(uf,{as:"span",paddingTop:2,children:e.logo.text}),p.jsx("span",{className:es({fontSize:"1rem",fontWeight:"500",lineHeight:"1.5rem",color:"white",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"none","@media (min-width: 800px)":{display:"block"}}),children:"Vizzly Admin Toolbar"}),I&&p.jsx("span",{className:es({fontSize:"0.75rem",fontWeight:"400",lineHeight:"1.5rem",color:"#E9EBF0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"none","@media (min-width: 800px)":{display:"block"}}),children:I}),p.jsx("div",{className:es({height:"1.5rem",width:"1px",backgroundColor:"#414A59",margin:"0 0.75rem",display:"none","@media (min-width: 800px)":{display:"block"}})}),p.jsx("button",{type:"button",className:es({fontFamily:"Inter, sans-serif",background:"transparent",color:"white",fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:"500",border:"0",textDecoration:"none","&:hover":{textDecoration:"underline"},cursor:"pointer",padding:"0"}),onClick:function(){return f(!0)},children:"Import"}),p.jsx("button",{type:"button",className:es({fontFamily:"Inter, sans-serif",background:"transparent",color:"white",fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:"500",border:"0",textDecoration:"none","&:hover":{textDecoration:"underline"},cursor:"pointer",padding:"0"}),onClick:function(){return a(!0)},children:"Export"})]}),null==e?void 0:e.children]}),p.jsxs(Mh,{width:"sm",isOpen:c,onClose:function(){return L()},children:[p.jsx(Mh.Header,{title:"Import dashboard"}),p.jsxs(Mh.Content,{children:[p.jsx("p",{className:es({margin:"0 0 1.5rem 0",display:"block"}),children:"Import a dashboard export file from another Vizzly project or environment."}),p.jsxs("div",{className:es({margin:"0 0 1.5rem 0"}),children:[p.jsx(NC,{label:"Your dashboard export",onChange:function(e){return O(e)},setFiles:C,setError:v,files:null==w?void 0:w.fileList,value:null==w?void 0:w.value,accept:"application/json",uploadButtonDescription:"Accepts: JSON"}),h&&p.jsx("div",{className:es({margin:"1.5rem 0 0 0"}),children:p.jsx(Hy,{type:"warning",title:h})})]}),p.jsx("div",{className:es({margin:"0 0 1rem 0"}),children:p.jsx(IC,{setChecked:b,currentValue:x,label:"I understand that importing a new dashboard will completely replace all existing dashboard charts, filters, and the component library."})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:function(){return L()},children:"Cancel"}),p.jsx(Pv,{disabled:!x,testId:"import-dashboard",onClick:function(){return function(){try{if(null===w.fileList||0===w.fileList.length||null===F)throw new Error("Please upload a dashboard export file.");T({type:"importDashboard",dashboardToImport:F}),f(!1)}catch(e){v(e.message)}}()},children:"Import dashboard"})]})})]}),p.jsxs(Mh,{width:"sm",isOpen:o,onClose:function(){return E()},children:[p.jsx(Mh.Header,{title:"Export dashboard"}),p.jsxs(Mh.Content,{children:[p.jsx("p",{className:es({margin:"0 0 1.5rem 0",display:"block"}),children:"Use this dashboard configuration in another Vizzly project or environment."}),p.jsxs("a",{className:es({margin:"0 0 1rem 0",textDecoration:"none",display:"flex",color:"#374151"}),href:"https://docs.vizzly.co/managing-environments",target:"_blank",children:[p.jsx(Ys,{fill:"#5F6773"}),p.jsx("span",{className:es({display:"block",fontWeight:"600",padding:"0 0 0 0.25rem"}),children:"What's included in dashboard exports"})]}),s&&p.jsx(Hy,{type:"critical",title:s})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:function(){return E()},children:"Cancel"}),p.jsx(Pv,{testId:"export-dashboard",onClick:function(){!function(){try{if(!A)throw new Error("No dashboard found");if(!_)throw new Error("No query engine config found");var e=function(e){var t=e.data,n=e.fileName;try{if("object"!=typeof t||null==t)throw new Error("Data must be an object");var i=JSON.stringify(t,null,2),r=new Blob([i],{type:"application/json"}),o=URL.createObjectURL(r),a=document.createElement("a");return a.href=o,a.download=n+".json",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o),"Success"}catch(e){return console.error(e),"Sorry, the data supplied to downloadToJSON was not a valid object"}}({data:vm(A),fileName:""+A.id});if("Success"!==e)throw new Error(e);a(!1)}catch(e){u(e.message)}}()},icon:{Icon:function(){return p.jsx(id,{})}},children:"Export dashboard"})]})})]})]})},GC=function(e){return JSON.stringify({display:e.display,componentLibrary:e.componentLibrary,globalFilters:e.globalFilters,customFields:e.customFields})},UC=function(e){var n=qm().dashboard,i=t.useState(!1),r=i[0],o=i[1],a=Pu(),l=a.featureToggles,s=a.scope,u=a.mode,d=a.onSave,c=a.queryEngineConfig,f=a.onOpenConfigManagerUi,m=a.disableToolbar,h=hm(n),v=eu(c,"configManagerUi")&&f;t.useEffect((function(){var e=new AbortController;return function(){var t=me(Ce().mark((function t(){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:l.disableAutoSave||"endUser"!=u?Ke("Auto-save is disabled, so the dashboard will not be saved."):g(e.signal);case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()(),function(){return e.abort("Save unmounted")}}),[h&&JSON.stringify({changes:GC(h)})]);var g=function(e){"read_write"==s&&d(n,e)};if(Nu((function(e){e.save&&(Ke("Received from VizzlyState, `save()`"),g())})),m)return null;var x=function(){o(!1)};return p.jsxs(p.Fragment,{children:[("admin"==u||v)&&p.jsx(YC,{"data-component":"admin-tools",logo:{href:"https://docs.vizzly.co/",target:"_blank"},children:p.jsx(yf,{justifyContent:"end",alignItems:"center",children:p.jsx("div",{className:es({display:"flex",justifyContent:"justify-start",alignItems:"center",width:"100%",marginTop:"0.5rem","@media (min-width: 480px)":{width:"auto",marginTop:"0",justifyContent:"justify-end"}}),children:p.jsxs("div",{className:es({display:"flex",gap:"0.5rem"}),children:["admin"==u&&p.jsx("div",{className:es({display:"flex",gap:"1rem",alignItems:"center"}),children:p.jsx(Pv,{secondary:!0,testId:"save-dashboard",onClick:function(){o(!0)},themeOverride:{fontFamily:"Inter, sans-serif"},internal:!0,disabled:e.isProgrammaticParent,children:"Save"})}),v&&p.jsx(Pv,{testId:"manage-data-sets",onClick:function(){f()},themeOverride:{fontFamily:"Inter, sans-serif"},internal:!0,children:"Open Query Engine"})]})})})}),p.jsxs(Mh,{width:"sm",isOpen:r,onClose:function(){return x()},children:[p.jsx(Mh.Header,{title:"Save"}),p.jsx(Mh.Content,{children:p.jsx("p",{className:es({margin:"0 0 0.5rem 0"}),children:"Saving will update the default dashboard all new users see and update the verified chart library for new and existing users."})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:function(){return x()},children:"Cancel"}),p.jsx(Pv,{testId:"confirm-save",onClick:function(){g(),x()},children:"Save"})]})})]})]})},KC=function(e,t){setTimeout((function(){try{var n=t?document.getElementById(t):window;n&&n.scrollBy&&n.scrollBy({top:"bottom"===e?99999999:e,behavior:"smooth"})}catch(e){Ke("Failed to auto-scroll.")}}),50)},XC=function(e){var n=qm(),i=n.dashboard,o=n.dispatch,a=Pu().dashboardFilters,l=t.useState(0===i.globalFilters.length),s=l[0],u=l[1];return t.useEffect((function(){var e=function(e,t){var n,i=t(e.dataSets,[]).map((function(e){return ge({},e,{managedByConfiguration:!0})})),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})),a=t(e.dataSets,o),l=(n=i,[].concat(a).filter((function(e){return!Rt(n,e)})));return e.globalFilters.length==l.length?r.cloneDeep(l):(Ze("dashboardFilters function did not return the same number of user-added dashboard filters, so changes made to user-added dashboard filters will be ignored."),r.cloneDeep(e.globalFilters))}(i,a);o({type:"setGlobalFilters",globalFilters:e}),u(!0)}),[]),s?p.jsx(p.Fragment,{children:e.children}):null},QC=function(e){var n=qm().dispatch,i=Pu(),r=i.onReset,o=i.textOverride,a=t.useState(!1),l=a[0],s=a[1],u=function(){var t=me(Ce().mark((function t(){var i;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(!0),t.next=3,r();case 3:(i=t.sent)&&n({type:"setDashboard",dashboard:i}),s(!1),null==e||e.onClose();case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=t.useState(!1),c=d[0],f=d[1];return t.useEffect((function(){e.show||(f(!1),s(!1))}),[e.show]),p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:o("confirm_reset","Confirm Reset"),show:!0}),p.jsx(Mh.Content,{children:p.jsx(IC,{label:o("delete_all_dashboard_content","Any change you have made will be lost and the default dashboard will be restored."),setChecked:function(e){return f(e)},currentValue:c,id:"reset-dashboard",checkboxPosition:"top"})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},disabled:l,children:o("cancel","Cancel")}),p.jsx(gh,{onClick:function(){c&&u()},disabled:!c||l,primary:!0,children:o("reset_dashboard","Reset Dashboard")})]})})]})},ZC=function(e){var t=Pu(),n=t.textOverride;return!1===t.featureToggles.showResetButton?null:p.jsx(sh,{tooltipContent:function(){return n("reset_dashboard_to_default","Reset dashboard to default")},children:p.jsx(Iv,{label:n("reset","Reset"),onChange:e.onChange,className:"vizzly_reset-button",disabled:null==e?void 0:e.disabled,children:p.jsx(wd,{})})})},JC=function(e){return p.jsx("div",{className:Ql.height100+" "+$C,"data-component":"cell-contents","data-vizzlycomponentloaded":e.showComponent?"true":"false",children:e.children})},$C="vizzly-component",ej=function(){return Array.from(document.querySelectorAll('[class*="'+$C+'"]')).map((function(e){return{element:e,isLoaded:"true"===e.getAttribute("data-vizzlycomponentloaded")}}))},tj=function(){var e=me(Ce().mark((function e(t){var n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===t&&(t=500),n=function(){return ej().every((function(e){return e.isLoaded}))};case 2:if(n()){e.next=7;break}return e.next=5,new Promise((function(e){return setTimeout(e,t)}));case 5:e.next=2;break;case 7:return e.abrupt("return",ej());case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),nj=Object.assign((function(){return null}),{label:function(e){return Fl({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,margin:0,padding:0})},description:function(e){return Fl({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight})},input:Fl({margin:0,padding:0,alignSelf:"flex-start",marginTop:2}),fieldset:function(e){return void 0===e&&(e=!1),Fl({border:"none",margin:0,padding:0,width:"auto",opacity:e?.6:1,cursor:e?"not-allowed":"pointer"})}});function ij(e){var t=e.options,n=e.name,i=e.onChange,r=e.selected,o=e.label,a=e.labelHidden,l=e.locked,s=e.direction,u=e.maxWidth;return p.jsxs("fieldset",{className:""+nj.fieldset(l),children:[!a&&p.jsx(Kf,{as:"legend",children:o}),p.jsx(yf,{direction:s||"column",gap:"0.5rem","data-component":"radio-group",maxWidth:u||"100%",children:t.map((function(e,t){return p.jsx(rj,{option:e,name:n,onChange:function(e){return i&&!l&&i(e.target.value)},selected:r},t)}))})]})}function rj(e){return e.option.children?p.jsxs(n.Fragment,{children:[p.jsx(oj,ge({},e,{type:"radio"})),e.selected===e.option.value&&p.jsx("div",{className:es({padding:"4px 0 8px 20px"}),children:e.option.children})]}):p.jsx(oj,ge({},e,{type:"radio"}))}function oj(e){var t,n,i=e.name,r=e.option,o=e.selected,a=e.onChange,l=e.type,s=Dd();return p.jsxs(yf,{as:"label",gap:"0.5rem",alignItems:"self-start","data-component":"input",cursor:"inherit",className:""+lj,children:[p.jsx("input",{type:l,name:i,value:r.value,checked:JSON.stringify(o)===JSON.stringify(r.value),onChange:a,className:kd("checkbox"===l?Kh()+" "+aj:""+nj.input)}),p.jsxs(yf,{direction:"column","data-component":"label",children:[p.jsx("p",{className:""+nj.label(null==s||null==(t=s.radioGroup)?void 0:t.label),"data-themeapi":"radioGroup.label",children:r.label}),(null==r?void 0:r.description)&&p.jsx("span",{className:""+nj.description(null==s||null==(n=s.radioGroup)?void 0:n.description),children:null==r?void 0:r.description})]})]})}var aj=Fl({marginRight:0,marginTop:1}),lj=Fl({userSelect:"none"}),sj=function(e){return e[e.LOW=1]="LOW",e[e.NORMAL=2]="NORMAL",e[e.MEDIUM=3]="MEDIUM",e[e.HIGH=7]="HIGH",e[e.EXTREME=12]="EXTREME",e}({}),uj=function(e){return e[e.NONE=0]="NONE",e[e.SMALL=5]="SMALL",e[e.MEDIUM=10]="MEDIUM",e[e.LARGE=25]="LARGE",e}({}),dj={orientation:"portrait",format:"A4",margin:uj.NONE},cj=function(e){var n=t.useState(!1),i=n[0],r=n[1],o=Pu().textOverride,a=t.useState(dj),l=a[0],s=a[1];return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:o("download_dashboard_to_pdf","Download dashboard to PDF"),show:!0}),p.jsxs(Mh.Content,{children:[p.jsx("p",{className:es({margin:"0 0 24px 0"}),children:o("pdf_download.description","Download the dashboard you see in this view.")}),p.jsx(ij,{options:[{label:o("pdf_download.page.orientation.portrait","Portrait"),value:"portrait"},{label:o("pdf_download.page.orientation.landscape","Landscape"),value:"landscape"}],name:"page-orientation",label:o("pdf_download.page.orientation","Orientation"),selected:l.orientation,labelHidden:!0,onChange:function(e){return s(ge({},l,{orientation:e}))}})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:o("cancel","Cancel")}),p.jsx(Pv,{primary:!0,onClick:function(){r(!0),tj().then((function(){r(!1),null==e||e.onClose(l)}))},disabled:i,children:o("download","Download")})]})})]})},pj=function(e){var n=Pu().textOverride;return p.jsxs(t.Fragment,{children:[e.showLabel&&p.jsx(Pv,{secondary:!0,onClick:e.onChange,disabled:e.disabled,children:p.jsxs(yf,{gap:"0.25rem",children:[p.jsx(id,{})," ",n("download_dashboard_to_pdf.button","Download to PDF")]})}),!e.showLabel&&p.jsx(sh,{tooltipContent:function(){return n("download_dashboard_to_pdf","Download dashboard to PDF")},children:p.jsx(Iv,{onChange:e.onChange,disabled:e.disabled,label:n("download_dashboard_to_pdf.button","Download to PDF"),className:""+Ql.pt(6),children:p.jsx(id,{})})})]})},fj=3.77952755906,mj={method:"save",resolution:sj.MEDIUM,page:{margin:uj.NONE,format:"A4",orientation:"portrait"},canvas:{mimeType:"image/jpeg",qualityRatio:1,useCORS:!0,logging:!1},overrides:{}},hj=function(){function e(e,t){var n,i,r,o,a;this.pdf=void 0,this.canvas=void 0,this.options=void 0,this.canvas=e,this.options=t,this.pdf=new ee(ge({format:null!=(n=null==(i=this.options)||null==(i=i.page)?void 0:i.format)?n:mj.page.format,orientation:null!=(r=null==(o=this.options)||null==(o=o.page)?void 0:o.orientation)?r:mj.page.orientation},null==(a=this.options.overrides)?void 0:a.pdf,{unit:"mm"}))}var t=e.prototype;return t.getMarginTopMM=function(){var e,t,n,i,r,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:mj.page.margin:null!=(i=null==(r=this.options)||null==(r=r.page)?void 0:r.margin)?i:mj.page.margin;return Number(o)},t.getMarginLeftMM=function(){var e,t,n,i,r,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:mj.page.margin:null!=(i=null==(r=this.options)||null==(r=r.page)?void 0:r.margin)?i:mj.page.margin;return Number(o)},t.getMarginRightMM=function(){var e,t,n,i,r,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:mj.page.margin:null!=(i=null==(r=this.options)||null==(r=r.page)?void 0:r.margin)?i:mj.page.margin;return Number(o)},t.getMarginBottomMM=function(){var e,t,n,i,r,o="object"==typeof(null==(e=this.options)||null==(e=e.page)?void 0:e.margin)?null!=(t=null==(n=this.options)||null==(n=n.page)?void 0:n.margin.top)?t:mj.page.margin:null!=(i=null==(r=this.options)||null==(r=r.page)?void 0:r.margin)?i:mj.page.margin;return Number(o)},t.getMarginTop=function(){return this.getMarginTopMM()*fj},t.getMarginBottom=function(){return this.getMarginBottomMM()*fj},t.getMarginLeft=function(){return this.getMarginLeftMM()*fj},t.getMarginRight=function(){return this.getMarginRightMM()*fj},t.getScale=function(){var e;return null!=(e=this.options.resolution)?e:mj.resolution},t.getPageHeight=function(){return this.getPageHeightMM()*fj},t.getPageHeightMM=function(){return this.pdf.internal.pageSize.height},t.getPageWidthMM=function(){return this.pdf.internal.pageSize.width},t.getPageWidth=function(){return this.getPageWidthMM()*fj},t.getOriginalCanvasWidth=function(){return this.canvas.width/this.getScale()},t.getOriginalCanvasHeight=function(){return this.canvas.height/this.getScale()},t.getCanvasPageAvailableHeight=function(){return this.getPageAvailableHeight()*this.getScale()*this.getHorizontalFitFactor()},t.getPageAvailableWidth=function(){return this.getPageWidth()-(this.getMarginLeft()+this.getMarginRight())},t.getPageAvailableHeight=function(){return this.getPageHeight()-(this.getMarginTop()+this.getMarginBottom())},t.getPageAvailableWidthMM=function(){return this.getPageAvailableWidth()/fj},t.getPageAvailableHeightMM=function(){return this.getPageAvailableHeight()/fj},t.getNumberPages=function(){return Math.ceil(this.canvas.height/this.getCanvasPageAvailableHeight())},t.getHorizontalFitFactor=function(){return this.getPageAvailableWidth()<this.getOriginalCanvasWidth()?this.getOriginalCanvasWidth()/this.getPageAvailableWidth():1},t.getCanvasOffsetY=function(e){return this.getCanvasPageAvailableHeight()*(e-1)},t.getCanvasHeightLeft=function(e){return this.canvas.height-this.getCanvasOffsetY(e)},t.getCanvasPageHeight=function(e){if(this.canvas.height<this.getCanvasPageAvailableHeight())return this.canvas.height;var t=this.getCanvasHeightLeft(e);return t<this.getCanvasPageAvailableHeight()?t:this.getCanvasPageAvailableHeight()},t.getCanvasPageWidth=function(){return this.canvas.width},t.createCanvasPage=function(e){var t=this.getCanvasPageWidth(),n=this.getCanvasPageHeight(e),i=document.createElement("canvas");i.setAttribute("width",String(t)),i.setAttribute("height",String(n));var r=i.getContext("2d");return r&&r.drawImage(this.canvas,0,this.getCanvasOffsetY(e),this.canvas.width,n,0,0,this.canvas.width,n),i},t.convert=function(){for(var e=1,t=this.getNumberPages();e<=t;){var n,i,r,o,a,l,s,u;e>1&&this.pdf.addPage(null!=(a=null==(l=this.options)||null==(l=l.page)?void 0:l.format)?a:mj.page.format,null!=(s=null==(u=this.options)||null==(u=u.page)?void 0:u.orientation)?s:mj.page.orientation);var d=this.createCanvasPage(e),c=d.toDataURL(null!=(n=null==(i=this.options.canvas)?void 0:i.mimeType)?n:mj.canvas.mimeType,null!=(r=null==(o=this.options.canvas)?void 0:o.qualityRatio)?r:mj.canvas.qualityRatio);this.pdf.setPage(e),this.pdf.addImage({imageData:c,width:d.width/(this.getScale()*fj*this.getHorizontalFitFactor()),height:d.height/(this.getScale()*fj*this.getHorizontalFitFactor()),x:this.getMarginLeftMM(),y:this.getMarginTopMM()}),e+=1}return this.pdf},e}(),vj=function(e){return e?ge({},mj,e,{canvas:ge({},mj.canvas,e.canvas),page:ge({},mj.page,e.page)}):mj},gj=function(e){return e()},xj=function(){var e=me(Ce().mark((function e(t,n){var i,r,o,a,l,s,u,d,c,p,f;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=vj(n),o=gj(t)){e.next=4;break}throw new Error("Target element not found");case 4:return a=ge({useCORS:r.canvas.useCORS,logging:r.canvas.logging,scale:r.resolution},r.overrides.canvas),e.next=7,$(o,a);case 7:if(l=e.sent,null==n||!n.header){e.next=15;break}if(!(u=gj(null==n?void 0:n.header))){e.next=15;break}return e.next=13,$(u,a);case 13:s=bj(s,e.sent,l);case 15:d=new hj(null!=(i=s)?i:l,r),c=d.convert(),e.t0=r.method,e.next="build"===e.t0?20:"open"===e.t0?21:23;break;case 20:return e.abrupt("return",c);case 21:return window.open(c.output("bloburl"),"_blank"),e.abrupt("return",c);case 23:return f=null!=(p=r.filename)?p:(new Date).getTime()+".pdf",e.next=26,c.save(f,{returnPromise:!0});case 26:return e.abrupt("return",c);case 27:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function bj(e,t,n){e=document.createElement("canvas");var i=(t?t.height:0)+n.height,r=Math.max(t?t.width:0,n.width);e.width=r,e.height=i;var o=e.getContext("2d");return o&&(o.clearRect(0,0,r,i),t&&o.drawImage(t,0,0),o.drawImage(n,0,t?t.height:0)),e}var yj=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,wj=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,Cj=/on[a-z]+\s*=\s*["'][^"']*["']/gi,jj=/javascript:[^\s"']+/gi;function Fj(e){return me(Ce().mark((function t(){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,xj((function(){return document.getElementById("vizzly_dashboard_content")}),{method:"save",filename:"dashboard.pdf",page:null==e?void 0:e.page,header:function(){return document.getElementById("vizzly_dashboard_header")}});case 2:case"end":return t.stop()}}),t)})))}var Sj=function(e){var n,i=e.pdfSettings,r=null==(n=document.getElementById("vizzly_dashboard_content"))?void 0:n.offsetWidth;if(t.useEffect((function(){var e=document.createElement("style");return e.innerHTML="img { display: inline-flex; }",document.head.appendChild(e),function(){document.head.removeChild(e)}}),[]),null!=i&&i.header&&function(e){return function(e){return yj.test(e)||wj.test(e)||Cj.test(e)||jj.test(e)}(e)}(null==i?void 0:i.header))throw new Error("Invalid content: potentially malicious elements detected.");return null!=i&&i.header?p.jsx("div",{dangerouslySetInnerHTML:{__html:(null==i?void 0:i.header)||""},id:"vizzly_dashboard_header",style:{position:"absolute",left:-9999,width:r}}):null},kj=function(e){return JSON.stringify(e)},Aj=Hu((function(e){var t=e.saving;return t&&t!==xa.Undefined?p.jsx(yf,{paddingTop:4,children:p.jsx(Tj,{text:t===xa.InProgress?"Saving...":"Saved",standard:!0,children:p.jsx(b.CloudIcon,{width:16,fill:Sl(15)})})}):p.jsx("div",{})}),"renderSavingComponent",(function(e){return ge({},e)})),Tj=function(e){return p.jsxs(yf,{direction:"row",gap:"0.25rem",alignItems:"center",justifyContent:"end",children:[p.jsx(t.Fragment,{children:e.children}),p.jsx("span",{className:es({fontSize:14,color:Sl(15)}),children:null==e?void 0:e.text})]})},_j=function(e){return{renderCloseIcon:e.renderCloseIcon||null,renderDeleteIcon:e.renderDeleteIcon||null,renderFilterIcon:e.renderFilterIcon||null,renderParametersIcon:e.renderParametersIcon||null,renderLoadingComponent:e.renderLoadingComponent||null,renderDownloadIcon:e.renderDownloadIcon||null,renderEditIcon:e.renderEditIcon||null,renderComponentOptionsMenuIcon:e.renderComponentOptionsMenuIcon||null,renderLockedIcon:e.renderLockedIcon||null,renderLibraryIcon:e.renderLibraryIcon||null,renderAccordionIcon:e.renderAccordionIcon||null,renderButtonComponent:e.renderButtonComponent||null,renderAdvancedFilter:e.renderAdvancedFilter||null,renderSelectComponent:e.renderSelectComponent||null,renderDateTimeRangeInput:e.renderDateTimeRangeInput||null,renderDateTimeInput:e.renderDateTimeInput||null,renderReportIcon:e.renderReportIcon||null,renderSendIcon:e.renderSendIcon||null,renderUserIcon:e.renderUserIcon||null,renderAIChatIcon:e.renderAIChatIcon||null,renderAIIcon:e.renderAIIcon||null,renderThumbsUpUnselectedIcon:e.renderThumbsUpUnselectedIcon||null,renderThumbsUpSelectedIcon:e.renderThumbsUpSelectedIcon||null,renderThumbsDownUnselectedIcon:e.renderThumbsDownUnselectedIcon||null,renderThumbsDownSelectedIcon:e.renderThumbsDownSelectedIcon||null,renderSelectIcon:e.renderSelectIcon||null,renderBackButtonArrowIcon:e.renderBackButtonArrowIcon||null,renderStopIcon:e.renderStopIcon||null,renderTagIcon:e.renderTagIcon||null,renderSwitchIcon:e.renderSwitchIcon||null,renderCheckIcon:e.renderCheckIcon||null,renderResetIcon:e.renderResetIcon||null,renderSavingComponent:e.renderSavingComponent||null,renderDrilldownIcon:e.renderDrilldownIcon||null,renderPresentIcon:e.renderPresentIcon||null,renderFullscreenIcon:e.renderFullscreenIcon||null,renderArrowDownIcon:e.renderArrowDownIcon||null,renderCodeIcon:e.renderCodeIcon||null,renderCogIcon:e.renderCogIcon||null,renderArrowUpIcon:e.renderArrowUpIcon||null,renderErrorIcon:e.renderErrorIcon||null}},Ij=function(e){var t=e.component.attributes,n=Pu(),i=n.customViews,r=n.dateFilterOptions,o=qm().dashboard,a=null;try{a=function(e,t){var n=e.find((function(e){return e.id==t}));if(!n)throw"Failed to find custom component.";return n}(i,t.customViewId)}catch(e){return p.jsx(Ug,{})}return p.jsxs(Cg,{id:t.viewId,queriesAreChanging:!1,children:[p.jsx(wg,{displaySubject:t.displaySubject,displayTitle:t.displayTitle,viewId:t.viewId,componentType:"custom",localFilters:[],library:!1,setLocalFilters:function(){},setPartialAttributes:function(){}}),function(){if(!a)return null;var e=a.Component({attributes:t,dashboardFilters:Fi(o.dataSets,o.globalFilters,r)});return p.jsx("div","string"==typeof e?{dangerouslySetInnerHTML:{__html:e},className:Dj,"data-customviewid":t.customViewId}:{className:Dj,"data-customviewid":t.customViewId,children:e})}()]})},Dj=kd(If("custom-view"),es({position:"relative",height:"100%",overflow:"hidden"})),Oj=function(e){var t=e.defaultColor,n=e.value,i=e.yKey,r=e.conditionalFormattingRules;if(0===r.length||null===n)return t;var o=t,a=r.filter((function(e){return e.yKey===i}));return 0===a.length?t:(a.forEach((function(e){("<="===e.operator&&n<=e.value||">="===e.operator&&n>=e.value)&&(o=e.color)})),o)},Ej=function(e){var t=e.data,n=e.margin,i=e.xScaleKey,r=e.xScaleDataType,o=e.xScale,a="desc"===e.xOrdering,l=oe.localPoint(e.event)||{x:0,y:0};if(l){var s=null;if("date_time"===r&&"invert"in o){var u=o.invert(l.x-n.left),d=ae.bisector((function(e,t){return a?t-new Date(e[i].value):new Date(e[i].value)-t})).left(t,u),c=0===d?t[0]:t[d-1],p=c[i].value?new Date(c[i].value):null,f=t[d],m=f&&f[i].value?new Date(f[i].value):null;s=c,f&&m&&p&&(s=a?u.valueOf()-p.valueOf()<m.valueOf()-u.valueOf()?f:c:u.valueOf()-p.valueOf()>m.valueOf()-u.valueOf()?f:c)}else if("number"===r&&"invert"in o){var h,v=o.invert(l.x-n.left),g=ae.bisector((function(e,t){return a?t-Number(e[i].value):Number(e[i].value)-t})).left(t,v),x=0===g?t[0]:t[g-1],b=x[i].value?Number(x[i].value):null,y=t[g],w=y&&null!=(h=y[i])&&h.value?Number(y[i].value):null;s=x,y&&w&&b&&(s=Math.abs(v-b)>Math.abs(w-v)?y:x)}else if("string"===r&&"step"in o){var C=o.step(),j=l.x-n.left,F=Math.floor(j/C),S=t[F],k=t[F+1];s=S,k&&(s=Math.abs(j-C*F)>Math.abs(C*(F+1)-j)?k:S)}return{tooltipLeft:l.x,tooltipTop:l.y,tooltipData:s}}},Lj=function(e){var t=e.color,n=e.style;return p.jsx("svg",{width:10,height:10,style:{display:"block"},children:"line"===n.type?p.jsx("line",null!==n.strokeDasharray?{x1:"0",y1:"5",x2:"10",y2:"5",stroke:t,strokeWidth:n.strokeWidth,strokeDasharray:2}:{x1:"0",y1:"5",x2:"10",y2:"5",stroke:t,strokeWidth:n.strokeWidth}):p.jsx("rect",{fill:t,width:10,height:10,rx:"2"})})},Nj=function(e){var t=e.keys,n=e.legendItems,i=e.showRoundedTotal,r=e.tooltipData,o=e.visibleYKeys,a=e.xKey,l=e.yKeys,s=e.conditionalFormattingRules;return p.jsx(U.TooltipWithBounds,{left:e.tooltipLeft,top:e.tooltipTop,style:e.theme,children:p.jsxs("div",{style:{wordBreak:"break-all"},children:[p.jsx("div",{style:{fontFamily:"inherit",lineHeight:"inherit",letterSpacing:"inherit",fontWeight:"bold",fontSize:"15px",width:"100%"},children:r[a].formattedValue?r[a].formattedValue:r[a].value}),p.jsx("table",{cellPadding:0,cellSpacing:0,style:{margin:"0",borderSpacing:"0",borderCollapse:"inherit",border:"none"},children:p.jsxs("tbody",{children:[n.map((function(e,n){return r[e.yKey]&&null!==r[e.yKey].value?o.includes(e.yKey)&&p.jsxs("tr",{children:[p.jsx("td",{style:{verticalAlign:"middle",padding:0===n?"12px 8px 0 0":"8px 8px 0 0",width:"auto"},children:p.jsx(Lj,{color:Oj({defaultColor:e.color,value:r[e.yKey].value,yKey:e.yKey,conditionalFormattingRules:s}),style:e.style,yKey:e.yKey})}),p.jsx("td",{style:{padding:"8px 0 0 0"},children:t[e.yKey].keyFormatted}),p.jsx("td",{style:{fontWeight:"bold",padding:"8px 0 0 16px"},children:r[e.yKey].formattedValue?r[e.yKey].formattedValue:r[e.yKey].value})]},e.yKey):null})),i&&p.jsxs("tr",{children:[p.jsx("td",{colSpan:2,style:{padding:"12px 0 0 0"},children:"Rounded Total"}),p.jsx("td",{style:{fontWeight:"bold",padding:"12px 0 0 16px"},children:l.reduce((function(e,t){return e+Math.round(r[t].value)}),0)})]})]})})]})},Math.random())},Mj=function(e){var n=e.yKey,i=e.yKeyFormatted,r=e.color,o=e.style,a=e.onClick,l=e.visible,s=e.conditionalFormattingRules,u=t.useMemo((function(){return s.filter((function(e){return e.yKey===n}))}),[s]);return p.jsxs("button",{type:"button",style:{all:"unset",display:"flex",flexWrap:"nowrap",alignItems:"center",outline:"revert",gap:"4px",padding:"4px",cursor:"pointer",marginRight:"10px"},onClick:a,children:[p.jsxs("span",{style:{height:10,display:"flex"},children:[p.jsx(Lj,{color:r,style:o,yKey:n}),u.length>0&&u.map((function(e){return p.jsx(Lj,{color:e.color,style:o,yKey:n})}))]}),p.jsx("span",{style:{fontSize:"12px",lineHeight:"16px",display:"block",textDecoration:l?"none":"line-through",textWrap:"nowrap"},children:i||n})]},"legend-"+n)},Rj=function(e){var t=e.keys,n=e.visibleYKeys,i=e.legendItems,r=e.setVisibleYKeys,o=e.conditionalFormattingRules,a=e.marginLeft;return p.jsx("div",{style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",height:"40px",overflowX:"auto",alignItems:"center",marginLeft:a?a+"px":void 0},children:i.map((function(e){return t[e.yKey]&&c.createElement(Mj,ge({},e,{key:"legend-"+e.yKey,yKeyFormatted:t[e.yKey].keyFormatted,onClick:function(){return r((function(t){var n;return 0===(n=t.length===i.length?[e.yKey]:t.includes(e.yKey)?t.filter((function(t){return t!==e.yKey})):[].concat(t,[e.yKey])).length?i.map((function(e){return e.yKey})):n}))},visible:n.includes(e.yKey),conditionalFormattingRules:o}))}))})},Pj=function(e){var n=e.goalLine,i=e.innerWidth,r=e.y,o=e.margin,a=t.useRef(null),l=t.useState(0),s=l[0],u=l[1];return t.useEffect((function(){if(a.current){var e=a.current.getBBox();u(e.width+16)}}),[n.formattedValue]),p.jsxs("g",{style:{position:"relative"},children:[p.jsx(q.Line,{from:{x:o.left,y:o.top+r},to:{x:o.left+i,y:o.top+r},stroke:n.color,strokeDasharray:"dashed"==n.strokeStyle?2.5*n.strokeWidth+","+2.5*n.strokeWidth:void 0,strokeWidth:n.strokeWidth,strokeLinecap:"round",shapeRendering:"smooth"}),p.jsxs("g",{transform:"translate("+(o.left+i-s)+","+(r+o.top+8)+")",children:[p.jsx("path",{d:"M 0,0\n l -8,-8 \n l 8,-8 \n h "+s+" \n a 3,3 0 0 1 3,3 \n v 10 \n a 3,3 0 0 1 -3,3 \n h "+-s+" z",fill:n.color}),p.jsx("text",{ref:a,x:s/2,y:-1,dy:-4,textAnchor:"middle",fontFamily:"Arial, sans-serif",fontSize:9,fill:"#fff",children:n.formattedValue})]})]})};function zj(e,t){return void 0===t&&(t=8.8),e.length*t}var Vj=["formattedValue"],qj=["formattedValue"],Bj={opacity:"0.75",fontWeight:"bold"},Wj=function(e){var i,o,a=e.chart,l=e.options,s=e.theme,u=e.width,d=e.height,c=U.useTooltip(),f=c.tooltipOpen,m=c.tooltipLeft,h=void 0===m?0:m,v=c.tooltipTop,g=void 0===v?0:v,x=c.tooltipData,b=c.hideTooltip,y=c.showTooltip,w=function(e,t){var n=r.max(e.y.ticks.map((function(e){return 8.8*(e.formattedValue||"").length}))),i=e.y.title?40:0,o=e.x.title?40:0,a=t&&e.y.ticks.length>0?r.max([n,40]):40;return{top:15,right:40,bottom:30+o,left:a+i,bottomTitleOffset:20,leftTitleOffset:a}}(a,l.axis.showYAxisLabels),C=t.useState(a.lines.map((function(e){return e.yKey}))),j=C[0],F=C[1];t.useEffect((function(){return F(a.lines.map((function(e){return e.yKey}))),function(){F([])}}),[a.lines]);var S=u-w.left-w.right,k=d-w.top-w.bottom-(l.showLegend?40:0),A=a.x.key,T=a.x.scale.key,_=a.x.scale.dataType,I=Nx[Yb("dotted"===l.lineCurve?"natural":l.lineCurve,!1)],D=t.useMemo((function(){return function(e){var t,n,i,r,o,a,l,s,u,d,c,p,f,m,h,v,g,x,b,y,w,C,j,F,S,k,A;return{axis:{stroke:null!=(t=null==e||null==(n=e.axis)?void 0:n.stroke)?t:"rgba(0, 0, 0, 0.1)"},grid:{stroke:null!=(i=null==e||null==(r=e.grid)?void 0:r.stroke)?i:"rgba(200, 200, 200, 0.2)"},labels:{pointerEvents:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textShadow:"rgba(0, 0, 0, 0.01) 0 0 1px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fill:null!=(o=null==e||null==(a=e.labels)?void 0:a.color)?o:"rgba(0, 0, 0, 0.6)",fontSize:null!=(l=null==e||null==(s=e.labels)?void 0:s.fontSize)?l:9,fontWeight:null!=(u=null==e||null==(d=e.labels)?void 0:d.fontWeight)?u:700,fontFamily:null!=(c=null==e||null==(p=e.labels)?void 0:p.fontFamily)?c:Mx},popoverMenus:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textShadow:"rgba(0, 0, 0, 0.01) 0 0 1px",position:"absolute",lineHeight:"1.25",fontSize:12,pointerEvents:"none",background:null!=(f=null==e||null==(m=e.popoverMenus)?void 0:m.background)?f:"white",border:null!=e&&null!=(h=e.popoverMenus)&&h.border?e.popoverMenus.border:"none",borderRadius:null!=(v=null==e||null==(g=e.popoverMenus)?void 0:g.borderRadius)?v:"4px",boxShadow:null!=(x=null==e||null==(b=e.popoverMenus)?void 0:b.boxShadow)?x:"0 1px 2px rgba(33,33,33,0.2)",color:null!=(y=null==e||null==(w=e.popoverMenus)?void 0:w.color)?y:"#212529",fontFamily:null!=(C=null==e||null==(j=e.popoverMenus)?void 0:j.fontFamily)?C:"Inter, sans-serif",letterSpacing:null!=(F=null==e||null==(S=e.popoverMenus)?void 0:S.letterSpacing)?F:"0.02em",padding:null!=(k=null==e||null==(A=e.popoverMenus)?void 0:A.padding)?k:16}}}(s)}),[s]),O=t.useMemo((function(){return"string"===_?P.scalePoint({range:[0,S],domain:T?[].concat(a.data.map((function(e){return e[T]&&null!==e[T].value?String(e[T].value):""}))):[]}):"date_time"===_?P.scaleTime({range:[0,S],domain:"asc"===a.x.scale.ordering?[a.x.scale.min,a.x.scale.max]:[a.x.scale.max,a.x.scale.min]}):"number"===_?P.scaleLinear({range:[0,S],domain:"asc"===a.x.scale.ordering?[a.x.scale.min,a.x.scale.max]:[a.x.scale.max,a.x.scale.min],nice:!0}):null}),[S,a.x,a.data]),E=t.useMemo((function(){return P.scaleLinear({range:[k,0],domain:"asc"===a.y.scale.ordering?[a.y.scale.min,a.y.scale.max]:[a.y.scale.max,a.y.scale.min],nice:!0})}),[k,a.y]),L=t.useMemo((function(){return T&&_?function(e){var t=e.xScaleKey,n=e.xScaleDataType,i=e.yKeys;return t?e.data.map((function(e){var r={};return e[t]?r[t]="date_time"===n?null!==e[t].value?new Date(e[t].value):null:e[t].value:console.log({record:e,xScaleKey:t}),i.forEach((function(t){e[t]&&(r[t]=null!==e[t].value?Number(e[t].value):null)})),r})):[]}({data:a.data,xScaleKey:T,xScaleDataType:_,yKeys:a.y.keys}):[]}),[a.data,T,_,a.y.keys]),N=t.useMemo((function(){return a.goalLines.map((function(e){return p.jsx(Pj,{innerWidth:S,y:E(e.value),goalLine:e,margin:{top:w.top,left:w.left,right:w.right,bottom:w.bottom}},e.value)}))}),[a.goalLines,w,S,E]),M=t.useCallback((function(e){if(A&&T&&null!==O){var t=Ej({data:a.data,event:e,margin:w,xScaleKey:T,xScaleDataType:_,xOrdering:a.x.scale.ordering,xScale:O});y({tooltipLeft:null==t?void 0:t.tooltipLeft,tooltipTop:null==t?void 0:t.tooltipTop,tooltipData:null==t?void 0:t.tooltipData})}}),[y,O,w,A,T,_,a.x.scale.ordering,a.data]),R=t.useCallback((function(){b()}),[b]);if(0===u||0===d||null===O)return p.jsx(n.Fragment,{});var z=a.y.ticks.map((function(e){return Number(e.value)}));return p.jsxs(n.Fragment,{children:[p.jsxs("svg",{width:u,height:d-(l.showLegend?40:0),onMouseMove:M,onMouseLeave:R,style:{display:"block"},children:[p.jsxs(K.Group,{left:w.left,top:w.top,children:[p.jsx(ie.GridRows,{tickValues:z.length>0?z:void 0,scale:E,width:S,height:k,pointerEvents:"none",strokeDasharray:"0.5 5",strokeWidth:l.removeStroke?0:2,lineStyle:{strokeLinecap:"round",stroke:D.grid.stroke}}),l.axis.showXAxisLabels&&p.jsx(ne.AxisBottom,{label:a.x.title||void 0,labelProps:{style:Bj},labelOffset:w.bottomTitleOffset,hideTicks:!0,top:k,scale:O,tickFormat:function(e){var t=null;return(t="date_time"===_&&e instanceof Date?a.x.ticks.find((function(t){return t.scaleValue&&new Date(t.scaleValue).valueOf()===e.valueOf()}))||null:a.x.ticks.find((function(t){return t.scaleValue===e}))||null)?t.formattedValue?t.formattedValue:t.value.toString():""},tickValues:a.x.ticks.length>0?a.x.ticks.map((function(e){return null!==e.scaleValue?e.scaleValue:0})):void 0,tickComponent:function(e){var t=e.formattedValue,n=we(e,Vj);return p.jsx(te.Text,ge({style:D.labels},n,{children:t}))},stroke:D.axis.stroke,strokeWidth:l.removeStroke?0:1}),l.axis.showYAxisLabels&&p.jsx(ne.AxisLeft,{labelOffset:w.leftTitleOffset,label:a.y.title||void 0,labelProps:{style:Bj},hideTicks:!0,left:0,top:0,scale:E,tickFormat:function(e){var t=a.y.ticks.filter((function(t){return t.value===e}))[0];return t?t.formattedValue?t.formattedValue:t.value.toString():""},tickValues:z,tickComponent:function(e){var t=e.formattedValue,n=we(e,qj);return p.jsx(te.Text,ge({width:10,style:D.labels},n,{children:t}))},stroke:null!=(i=null==s||null==(o=s.axis)?void 0:o.stroke)?i:"transparent"}),p.jsxs(K.Group,{children:[a.y.keys.map((function(e){var t;return p.jsx(q.LinePath,{visibility:j.includes(e)?"visible":"hidden",data:L,x:function(e){var t,n=e[T],i="date_time"===_?new Date(n):"number"===_?Number(n):String(n);return null!=(t=O(i))?t:0},y:function(t){return E(t[e])},stroke:a.lines.filter((function(t){return t.yKey===e}))[0].color,strokeWidth:a.lines.filter((function(t){return t.yKey===e}))[0].style.strokeWidth,strokeLinecap:"round",strokeDasharray:null!=(t=a.lines.filter((function(t){return t.yKey===e}))[0].style.strokeDasharray)?t:void 0,shapeRendering:"smooth",defined:function(t){return null!==t[e]},curve:I},e)})),a.conditionalFormattingRules.map((function(e){var t;if("<="!==e.operator&&">="!==e.operator)return null;var n=e.yKey,i="clip-path-"+n+"-"+e.value+"-"+e.color+"-"+Math.random(),r=function(e){var t=e.conditionalFormattingRule,n=e.chart;try{var i=n.yScale;if("<="===t.operator){var r=Math.sign(n.height-i(t.value))?n.height-i(t.value):0,o=Math.sign(n.width)?n.width:0;return{x:0,y:i(t.value),width:o,height:r}}if(">="===t.operator)return{x:0,y:0,width:Math.sign(n.width)?n.width:0,height:i(t.value)};throw new Error("Operator "+t.operator+" is not supported for conditional formatting (yet)")}catch(e){return console.log(e),console.error(e),{x:0,y:0,width:0,height:0}}}({conditionalFormattingRule:e,chart:{width:S,height:k,yScale:E}});return p.jsxs(K.Group,{children:[p.jsx(q.LinePath,{clipPath:"url(#"+i+")",visibility:j.includes(n)?"visible":"hidden",data:L,x:function(e){var t,n=e[T],i="date_time"===_?new Date(n):"number"===_?Number(n):String(n);return null!=(t=O(i))?t:0},y:function(e){return E(e[n])},stroke:e.color,strokeWidth:a.lines.filter((function(e){return e.yKey===n}))[0].style.strokeWidth,strokeLinecap:"round",strokeDasharray:null!=(t=a.lines.filter((function(e){return e.yKey===n}))[0].style.strokeDasharray)?t:void 0,shapeRendering:"smooth",defined:function(e){return null!==e[n]},curve:I},n),p.jsx(re.RectClipPath,{id:i,x:r.x,y:r.y,width:r.width,height:r.height})]},i)}))]})]}),x&&p.jsxs("g",{children:[p.jsx(q.Line,{from:{x:h,y:w.top},to:{x:h,y:k+w.top},stroke:"#aaa",strokeWidth:2,pointerEvents:"none",opacity:.8}),a.y.keys.map((function(e){if(!T||!x[e]||null===x[e].value)return null;if(x[T]&&x[T].value&&_&&j.includes(e)){var t=x[T].value,n="date_time"===_?new Date(t):"number"===_?Number(t):String(t);return p.jsx("circle",{cx:O(n)+w.left,cy:E(null!==x[e].value?x[e].value:0)+w.top,r:4,fill:Oj({defaultColor:a.lines.filter((function(t){return t.yKey===e}))[0].color,yKey:e,value:x[e].value,conditionalFormattingRules:a.conditionalFormattingRules}),strokeWidth:2,stroke:"#fff",pointerEvents:"none"},e)}return null}))]}),N]}),l.showLegend&&p.jsx(Rj,{legendItems:a.lines,visibleYKeys:j,setVisibleYKeys:F,keys:a.keys,conditionalFormattingRules:a.conditionalFormattingRules,marginLeft:w.left-w.leftTitleOffset}),f&&x&&A&&p.jsx(Nj,{tooltipData:x,tooltipLeft:h,tooltipTop:g,xKey:A,keys:a.keys,visibleYKeys:j,yKeys:a.y.keys,legendItems:a.lines,showRoundedTotal:l.showRoundedTotal,conditionalFormattingRules:a.conditionalFormattingRules,theme:D.popoverMenus})]})},Hj=function(e){return 0===e?0:e+.03*e},Yj=function(e){var t=e.data,n=e.keys,i=e.dataType,r=e.goalLines;if(0===n.length)return{max:null,min:null};if("date_time"===i){var o=[].concat(t.flatMap((function(e){return n.map((function(t){return e[t]?new Date(e[t].value).valueOf():0}))})));return{max:Hj(Math.max.apply(Math,o)),min:Hj(Math.min.apply(Math,o))}}if("number"===i){var a=[].concat(t.flatMap((function(e){return n.map((function(t){return e[t]?e[t].value:0}))})),r?r.map((function(e){return e.value})):[]);return{max:Hj(Math.max.apply(Math,a)),min:Hj(Math.min.apply(Math,a))}}return{max:null,min:null}},Gj=function(e){var n,i,o,a,l=Pu(),s=l.textOverride,u=l.valueAlias,d=l.nullValueAlias,c=l.labelFormat,f=l.queryEngineConfig,m={displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,verified:e.attributes.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,parameters:null==e?void 0:e.attributes.parameters,componentType:null==e?void 0:e.attributes.type,measure:null==e?void 0:e.attributes.measure,dimension:null==e?void 0:e.attributes.dimension,timeDimension:e.attributes.timeDimension,setPartialAttributes:e.setPartialAttributes,viewId:null!=(i=null==e?void 0:e.attributes.viewId)?i:"",order:e.attributes.order},h=gy(e.attributes.order,e.attributes.headline,null),v=Dd(),g=Go(e.attributes.type),x=Qb(e.attributes),b=null;return Ka(e.result)||Xa(e.result)||Qa(e.result)||!g.isRunnable(e.attributes)||(b=function(e){var t,n,i,o,a=e.axisTitles,l=e.colors,s=e.conditionalFormattingAttributes,u=e.dateTimeFormatOptions,d=e.defaultFormats,c=e.goalLineAttributes,p=e.nullValue,f=e.numberFormatOptions,m=e.order,h=e.pivotConfig,v=e.result,g=e.trendsAndForecasts,x=e.xAxisFormat,b=e.xAxisPostfix,y=e.xAxisPrefix,w=e.yAxisFormat,C=e.yAxisPostfix,j=e.yAxisPrefix,F=e.approxYAxisLabelCount,S=e.seriesLabelFormatter,k=e.valueAlias,A={},T={},_={},I={};v.fields.forEach((function(e){h.x.includes(e.id)?(T[e.id]=b,A[e.id]=y,x&&"number"===e.outputDataType&&f[x]&&(I[e.id]=x)):h.y.includes(e.id)||(T[e.id]=C,A[e.id]=j,w=w||"_vizzly_compact",e.dataType&&f[w]&&(I[e.id]=w)),_[e.id]=p}));var D=function(e,t){var n=[],i=function(e,n){var i,r,o=null==e,a=t.valueAlias?t.valueAlias({fieldId:n.fieldId,function:n.function,value:e}):void 0,l=Ti({field:n.fieldId,function:n.function});if(o)i=a||""+(null!=(r=t.nullValue[l])?r:"No value");else if("number"===n.outputDataType){var s,u=t.activeNumberFormats[l]||t.defaultFormats()[n.function],d=null==(s=t.numberFormatOptions[u])?void 0:s.formatter;i=a||(d?d(e,""+t.nullValue):""+e)}else if("date_time"===n.outputDataType){var c,p=t.activeDateTimeFormats[l]||t.defaultFormats()[n.function],f=null==(c=t.dateTimeFormatOptions[p])?void 0:c.formatter;i=a||(f?f(new Date(e)):""+e)}else i="boolean"===n.outputDataType?a||(!0===e?"true":"false"):"string[]"===n.outputDataType?a||Re(e,!1):e;return o||(i=""+(t.prefixes[l]||"")+(i||"")+(t.postfixes[l]||"")),{formattedValue:i,value:e}};return{content:e.content.map((function(t){var o={},a=t.map((function(t,n){var a=e.fields[n];return o[a.id]=i(t,a),r.cloneDeep(o[a.id])}));return n.push(o),a})),contentMapped:n,fields:e.fields,formatterFunc:i}}(v,{defaultFormats:d,dateTimeFormatOptions:u,numberFormatOptions:f,valueAlias:function(e){if("function"==typeof k)return String(k({fieldId:rt({field:e.fieldId,function:e.function}),value:e.value}))},nullValue:_,prefixes:A,postfixes:T,activeNumberFormats:I,activeDateTimeFormats:{}}),O=null!=(t=h.x[0])?t:null,E=v.fields.find((function(e){return e.id===O})),L=m.length>0?m[0].function:void 0,N=function(e){return E?D.formatterFunc(e,{fieldId:E.fieldId,function:E.function,outputDataType:E.outputDataType}).formattedValue:""},M=function(e){var t=D.fields.find((function(e){return![].concat(h.x,h.y).includes(e.id)}));return t?D.formatterFunc(e,{fieldId:t.fieldId,function:t.function,outputDataType:t.outputDataType}).formattedValue:""},R=(null==E?void 0:E.outputDataType)||"string",P=function(e,t,n){var i={},o=e.fields.filter((function(e){var n=!t.x.includes(e.id),i=!t.y.includes(e.id);return n&&i})),a=e.fields.filter((function(e){return t.x.includes(e.id)})),l=e.fields.filter((function(e){return t.y.includes(e.id)})),s={},u=[],d={};e.contentMapped.forEach((function(e){a.forEach((function(t){var r,a=t.id+":"+e[t.id].value;u.push(a);var c=l.map((function(t){return t.id+":"+e[t.id].value})).join("_");s[a]=ge({},s[a]||{},((r={})[t.id]=e[t.id],r)),o.forEach((function(t){var r,o=l.length>0?[c,t.id].join("_"):t.id;d[o]=!0,i[o]={key:o,dataType:t.dataType,outputDataType:t.outputDataType,keyFormatted:n({yResultField:t,yPivotFields:l,row:e})},s[a]=ge({},s[a]||{},((r={})[o]=e[t.id],r))}))}))}));var c=r.uniq(u).map((function(e){return s[e]}));return{xKeys:a.map((function(e){return e.id})),yKeys:Object.keys(d),keys:i,seriesData:c}}(D,h,S),z=P.keys,V=P.yKeys,q=P.seriesData,B=null!=(n=P.xKeys[0])?n:null,W=(function(e){var t,n=e.chartData,i=e.formattingFunctionX,o=e.formattingFunctionY,a=e.keys,l=e.nullValue,s=e.orderFunction,u=e.trendsAndForecasts,d=e.xAxisPostfix,c=e.xAxisPrefix,p=e.xKey,f=e.yAxisPostfix,m=e.yAxisPrefix,h=e.yKeys;if(!u||0===u.length||"date_time"!==e.xScaleDataType)return{chartData:n};if(!s||!["week","month","quarter","year"].includes(s))return{chartData:n};var v="Forecast"===u[0].type,g="Forecast"===u[0].type&&null!=(t=u[0].value)?t:0,x=h[0],b=r.cloneDeep(a),y=function(e){for(var t=e.data,n=e.forecastUnits,i=e.xKey,r=e.yKey,o=e.timeUnit,a=e.includeForecast,l=r+"_forecast",s=r+"_trend",u=[],d=[],c=t.map((function(e){return Number(e[r].value)})),p=t.map((function(e){return new Date(e[i].value)})),f=c.length,m=p.map((function(e){return(e.getTime()-p[0].getTime())/864e5})),h=m.reduce((function(e,t){return e+t}),0)/f,v=c.reduce((function(e,t){return e+t}),0)/f,g=0,x=0,b=0;b<f;b++)g+=(m[b]-h)*(c[b]-v),x+=Math.pow(m[b]-h,2);for(var y=g/x,w=v-y*h,C=new Date(p[f-1]),j=0;j<f+(a?n:0);j++){var F=void 0;if(j<f)F=p[j];else{if(!a)continue;switch(o){case"week":C.setDate(C.getDate()+7);break;case"month":C.setMonth(C.getMonth()+1);break;case"quarter":C.setMonth(C.getMonth()+3);break;case"year":C.setFullYear(C.getFullYear()+1)}F=new Date(C)}var S=(F.getTime()-p[0].getTime())/864e5,k=y*S+w,A=y*S+w;j>=f-1?(j===f-1&&u.push({date:F.toISOString(),value:parseFloat(A.toFixed(2))}),a&&d.push({date:F.toISOString(),value:parseFloat(k.toFixed(2))})):u.push({date:F.toISOString(),value:parseFloat(A.toFixed(2))})}return{trendData:u,trendKey:s,forecastData:d,forecastKey:l}}({data:n,forecastUnits:g,xKey:p,yKey:x,timeUnit:s,includeForecast:v}),w=y.trendData,C=y.trendKey,j=y.forecastData,F=y.forecastKey,S=n.map((function(e){var t=e[p].value,n=w.find((function(e){return e.date===t}));if(n){var i,r,a={value:n.value,formattedValue:""+m+o(n.value,l)+f};return ge({},e,v&&j.length>0?((i={})[C]=a,i[F]={value:null,formattedValue:null},i):((r={})[C]=a,r))}return null}));if(v&&j.length>0)for(var k=function(){var e,t=j[A],n=((e={})[p]={value:t.date,formattedValue:""+c+i(t.date,l)+d},e[C]={value:null,formattedValue:null},e[F]={value:t.value,formattedValue:""+m+o(t.value,l)+f},e);h.forEach((function(e){n[e]={value:null,formattedValue:null}})),S.push(n)},A=0;A<g;A++)k();[].concat(h,v&&j.length>0?[C,F]:[C]),b[C]={key:C,keyFormatted:b[x].keyFormatted+" • Trend",dataType:"number"},v&&j.length>0&&(b[F]={key:F,keyFormatted:b[x].keyFormatted+" • Forecast",dataType:"number"})}({chartData:q,formattingFunctionX:N,formattingFunctionY:M,keys:z,nullValue:p,trendsAndForecasts:g,xAxisPostfix:b,xKey:B,yKeys:V,xAxisPrefix:y,xScaleDataType:R,yAxisPostfix:C,yAxisPrefix:j,orderFunction:L}),function(e){var t=e.goalLineAttributes,n=e.formattingFunctionY;return null==t?void 0:t.map((function(e){return{value:Number(e.value),formattedValue:""+n(Number(e.value)),color:e.color,strokeWidth:e.strokeWidth,strokeStyle:e.strokeStyle}}))}({goalLineAttributes:c,formattingFunctionY:M})),H=function(e){var t,n=e.data,i=e.xKey,r=e.yKeys,o=e.nullValue,a=e.tickCountYAxis,l=e.formattingFunctionX,s=e.formattingFunctionY,u=e.goalLines,d=[],c=[],p={dataType:e.xScaleDataType,key:i,ordering:(null==(t=e.order[0])?void 0:t.direction)||null},f=Yj({data:n,keys:null===p.key?[]:[p.key],dataType:p.dataType});i&&(d=n.map((function(e){var t,n,r,a=null!=(t=e[i])&&t.value?e[i].value:null,s=l(a,o),u=null!==p.key&&null!=(n=e[p.key])&&n.value?null==(r=e[p.key])?void 0:r.value:"";return{value:null!==a?a:"",formattedValue:null!==s?""+s:null,scaleValue:"date_time"===p.dataType?new Date(u):"string"===p.dataType?String(u):"number"===p.dataType?Number(u):u}})));for(var m,h,v,g=Yj({data:n,keys:r,dataType:"number",goalLines:u}),x=g.max||0,b=Math.min(g.min||0,0),y=(m=(x-b)/(a-1),h=Math.floor(Math.log10(m)),((v=m/Math.pow(10,h))<=1.5?1:v<=3?2:v<=7?5:10)*Math.pow(10,h)),w=0;w<a;w++){var C=y*w,j=s(C,o);c.push({value:C,formattedValue:j,scaleValue:C})}return{x:{ticks:d,scale:{dataType:p.dataType,max:f.max,min:f.min,key:p.key,ordering:p.ordering}},y:{ticks:c,scale:{dataType:"number",key:null,ordering:"asc",max:x,min:b}}}}({data:q,xKey:B,xScaleDataType:R,yKeys:V,tickCountYAxis:F,formattingFunctionX:N,formattingFunctionY:M,nullValue:p,order:m,goalLines:W}),Y=function(e){var t=e.yKeys,n=$a(e.colors,t.length);return t.map((function(e,t){return{yKey:e,color:n[t],style:{strokeWidth:3,strokeDasharray:null,type:"line"}}}))}({colors:null!=l?l:["#feae4a","#5fbaff","#e15e9d"],yKeys:V}),G=function(e){var t=[];return e.conditionalFormattingAttributes.forEach((function(e){var n=e.filters[0][0];t.push({operator:n.op,value:n.value,color:e.ruleValue,yKey:n.function?n.field+"_"+n.function:n.field})})),t}({conditionalFormattingAttributes:s}),U={keys:z,x:{ticks:H.x.ticks,scale:{dataType:H.x.scale.dataType,key:H.x.scale.key,ordering:H.x.scale.ordering,min:H.x.scale.min,max:H.x.scale.max},key:B,postfix:b,prefix:y,title:null!=(i=null==a?void 0:a.x)?i:null},y:{ticks:H.y.ticks,scale:{dataType:H.y.scale.dataType,key:H.y.scale.key,ordering:H.y.scale.ordering,min:H.y.scale.min,max:H.y.scale.max},keys:V,postfix:C,prefix:j,title:null!=(o=null==a?void 0:a.y)?o:null},data:q,lines:Y,conditionalFormattingRules:G,goalLines:W};return console.log("line chart v2",{chart:U}),U}({axisTitles:e.attributes.axisTitles,xAxisPostfix:e.attributes.xAxisPostfix,xAxisPrefix:e.attributes.xAxisPrefix,yAxisPostfix:e.attributes.yAxisPostfix,yAxisPrefix:e.attributes.yAxisPrefix,yAxisFormat:e.attributes.yAxisFormat,xAxisFormat:e.attributes.xAxisFormat,approxYAxisLabelCount:"auto"===e.attributes.approxYAxisLabelCount?10:e.attributes.approxYAxisLabelCount,colors:null==v||null==(o=v.charts)?void 0:o.colors,valueAlias:u,nullValue:ct(e.attributes.dataSetId,e.attributes.dimension,e.attributes.timeDimension,d,s),result:e.result,pivotConfig:x,order:e.attributes.order,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,goalLineAttributes:null!=(a=e.attributes.goalLines)?a:[],conditionalFormattingAttributes:e.attributes.conditionalFormattingRules,trendsAndForecasts:e.attributes.trends,defaultFormats:e.defaultFormats,seriesLabelFormatter:function(t){var n,i,r,o=t.yResultField,a=t.yPivotFields,l=t.row,s=(null==(n=f.supportedAggregates[o.function])?void 0:n.publicName)||(null==(i=f.supportedTimeTruncFunctions[o.function])?void 0:i.publicName)||(null==(r=f.supportedTransformationFunctions[o.function])?void 0:r.publicName),u="none"===o.function?"":" • "+s,d=a.map((function(e){return l[e.id].formattedValue})).join(" • ")+(0===a.length?"":" • ")+o.publicName+u;return c&&c({viewId:e.attributes.viewId,fieldId:o.fieldId,func:o.function,type:"lineChartV2",defaultLabel:d})||d}})),g.isRunnable(e.attributes)?Ka(e.result)?p.jsx(Nf,{}):Xa(e.result)?p.jsx(Yg,{}):Qa(e.result)?p.jsx(Kg,ge({},m)):p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},m,{paddingBottom:h?"0.5rem":void 0})),h&&p.jsx(xy,ge({},e.propsForHeadline)),p.jsx("div",{className:es({flex:"1",position:"relative"}),"aria-disabled":e.library,children:b&&p.jsx(L.ParentSize,{style:{position:"absolute",width:"100%",height:"100%",overflowX:"hidden"},children:function(t){return p.jsx(Wj,{width:t.width,height:t.height,chart:(n=b,i=t.width,o=function(e,t,n){void 0===n&&(n=8.8);for(var i,r,o=[],a=0,l=ve(e);!(i=l()).done;){var s=i.value,u=zj((null==s?void 0:s.formattedValue)||"",n);if(!(a+u<=(r=t,r-.3*r)))break;o.push(s),a+=u+n}return o.length}((n=r.cloneDeep(n)).x.ticks||[],i,8.8),n.x.ticks=function(e,t){if(t>=e.length)return e;for(var n=[],i=(e.length-1)/(t-1),r=0;r<t;r++){var o=Math.round(r*i);n.push(e[o])}return n}(n.x.ticks,o),n),options:{lineCurve:e.attributes.lineCurve,removeStroke:!1,showRoundedTotal:!1,showLegend:e.attributes.legend,axis:{showXAxisLabels:0!==e.attributes.approxXAxisLabelCount,showYAxisLabels:0!==e.attributes.approxYAxisLabelCount}},theme:null==v?void 0:v.charts});var n,i,o}})})]})}):p.jsx(Hg,{title:"Missing parameters"})},Uj=function(e){var t=e.component,n=t.results,i=t.attributes,r=e.dashboardBehaviour,o=iw(i,e.dataSet,r.queryEngineConfig,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults,r.variables);return p.jsx(Gj,{id:e.id,attributes:i,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:n&&n[0],queriesAreChanging:o.queriesAreChanging,numberFormatOptions:r.numberFormatOptions,dateTimeFormatOptions:r.dateTimeFormatOptions,defaultFormats:r.defaultFormats,propsForHeadline:e,idPrefix:e.idPrefix,library:null==e?void 0:e.library})},Kj=t.memo((function(e){var n,i,r,o,a,l,s,u=Pu(),d=u.textOverride,c=u.labelFormat,m=u.valueAlias,h=u.nullValueAlias,v=u.variables,g=e.displayTitle,x=e.displaySubject,b=Zb({title:g,subject:x}),y=Dd(),w={displayTitle:g,displaySubject:x,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,dataSet:e.dataSet,componentType:null==e?void 0:e.type,viewId:null!=(i=e.viewId)?i:"",order:e.order,setPartialAttributes:e.setPartialAttributes};if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(e.lineResult)||Ka(e.barResult))return p.jsx(Nf,{});if(Xa(e.lineResult)&&Xa(e.barResult))return p.jsx(Yg,{});var C,j,F=Qb({dimension:e.barDimension,timeDimension:e.timeDimension}),S=e.barResult?Ya(F,e.barMeasure,e.barResult):[],k=e.barResult?Ha(e.barResult,e.barMeasure,F,"100%"==e.stacked,ct(e.dataSetId,e.barDimension,e.timeDimension,h,d)):[],A=Qb({dimension:e.lineDimension,timeDimension:e.timeDimension}),T=e.lineResult?Ya(A,e.lineMeasure,e.lineResult):[],_=e.lineResult?Ha(e.lineResult,e.lineMeasure,A,"100%"==e.stacked,ct(e.dataSetId,e.lineDimension,e.timeDimension,h,d)):[];return p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},w)),p.jsx(ts,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:p.jsx(vw,{ref:b,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:null!=(o=e.viewId)?o:e.id,formatYAxisLabel:xl(d,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),formatXAxisLabel:gl(e.timeDimension,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats},m),forceXAxisAsTime:!!e.timeDimension,legend:Jb(null==e?void 0:e.legend,"verbose"===(null==y?void 0:y.detail)),x:"x",bars:{colors:$a(null==y?void 0:y.colors,S.length),data:k,annotate:[],stacked:!!e.stacked,keys:S,styles:null==y||null==(a=y.charts)?void 0:a.barChart,formatter:function(t,n){if(e.conditionalFormattingRules&&e.conditionalFormattingRules.bar){var i=vl(e.barDimension,e.conditionalFormattingRules.bar,t,n,null==e?void 0:e.dataSet);return i?i.value:void 0}}},lines:{colors:(C=$a(null==y?void 0:y.colors,T.length),void 0===j&&(j=1),[].concat(C).map((function(e){return function(e,t,n){return f(e).darken(t).hex()}(e,j)}))),data:_,annotate:[],keys:T,threshold:by(null==(l=e.conditionalFormattingRules)?void 0:l.line)},removeStroke:!1,theme:null==y?void 0:y.charts,formatSeriesName:function(t){var n,i,r=e.barResult&&bl(e.barResult,d,e.type,null!=(n=e.viewId)?n:"",c)(t),o=e.lineResult&&bl(e.lineResult,d,e.type,null!=(i=e.viewId)?i:"",c)(t);return r||o||""},sparkline:e.sm,onClick:function(){},goalLine:yy(v,e.goalLines),axisTitles:null==e?void 0:e.axisTitles,idPrefix:e.idPrefix,popOverMenuStyles:null==y||null==(s=y.charts)?void 0:s.popoverMenus})})]})})}),fl),Xj=function(e){var t=e.component,n=t.results,i=t.attributes,r=t.localFilters,o=qm().dashboard,a=$h(i,e.runQueriesCallback,e.setResults,{localFilters:r,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables);return p.jsx(Kj,ge({id:e.id},i,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,lineResult:n&&n[0],barResult:n&&n[1],queriesAreChanging:a.queriesAreChanging,setPartialAttributes:function(t){return e.setPartialAttributes(t)},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,dashboard:o,sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,goalLines:null==e?void 0:e.component.attributes.goalLines,idPrefix:e.idPrefix,defaultFormats:e.dashboardBehaviour.defaultFormats}))},Qj=function(e){var n,i=e.result,r=e.minValueColor,o=e.maxValueColor,a=e.noDataColor,l={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=null==e?void 0:e.library)&&n,verified:null==e?void 0:e.protectedByOrganisation,dataSet:e.dataSet,componentType:null==e?void 0:e.type,viewId:e.id,setPartialAttributes:e.setPartialAttributes},s=Zb({title:e.displayTitle,subject:e.displaySubject});if(!Go("mercatorMap").isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(i))return p.jsx(Nf,{});if(Xa(i))return p.jsx(Yg,{});var u={};if(i){var d=e.dimension[0].field,c=e.measure[0],f=i.fields.findIndex((function(e){return e.id==d})),m=i.fields.findIndex((function(e){return e.id==Ti(c)}));i.content.forEach((function(e){u[e[f]]=e[m]}))}var h=Ja([r,o],((null==i?void 0:i.content.length)||100)/4);return p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},l)),p.jsx(bw,{ref:s,formatValue:function(t){return yl(Sa(t,2),e.numberFormatOptions,e.labelFormat)},topology:"worldCountries",data:u,background:e.backgroundColor,colorRange:h,missingDataColor:a,position:e.position,onPositionChange:e.onPositionChange})]})})},Zj=function(e){var t=e.component,n=t.results,i=t.attributes,r=$h(i,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables);return p.jsx(Qj,ge({},i,{id:e.id,result:n&&n[0],queriesAreChanging:r.queriesAreChanging,dataSet:e.dataSet,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTransformationFunctions,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(){},onPositionChange:e.onPositionChange,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,defaultFormats:e.dashboardBehaviour.defaultFormats}))},Jj={type:"funnelChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",tags:[],yAxisFormat:null,xAxisFormat:null,legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto"},$j=function(e){var n,i,r,o,a,l,s,u,d,c,f,m,h,v,g,x,b,y,w=e.displayTitle,C=e.displaySubject,j=Pu(),F=j.textOverride,S=j.labelFormat,k=j.valueAlias,A=j.nullValueAlias,T=j.variables,_=Zb({title:w,subject:C,headline:e.headline}),I=Dd(),D={displayTitle:w,displaySubject:C,localFilters:(e=pl(e,{},Jj)).localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:e.setPartialAttributes,library:null!=(n=null==(i=e)?void 0:i.library)&&n,verified:null==(r=e)?void 0:r.protectedByOrganisation,dataSet:e.dataSet,parameters:null==(o=e)?void 0:o.parameters,componentType:null==(a=e)?void 0:a.type,measure:null==(l=e)?void 0:l.measure,dimension:null==(s=e)?void 0:s.dimension,timeDimension:e.timeDimension,viewId:null!=(u=null==(d=e)?void 0:d.viewId)?u:"",order:e.order};if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters"});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});if(Qa(e.result))return p.jsx(Kg,ge({},D));var O=Qb(e),E=Ya(O,e.measure,e.result),L=Ha(e.result,e.measure,O,!1,ct(e.dataSetId,e.dimension,e.timeDimension,A,F)),N=gy(e.order,e.headline,e.timeDimension);return p.jsx(t.Suspense,{fallback:p.jsx(Nf,{}),children:p.jsxs(Cg,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[p.jsx(wg,ge({},D,{paddingBottom:N?"0.5rem":void 0})),N&&p.jsx(xy,ge({},e.propsForHeadline)),p.jsx(ts,{disabledFeatures:null!=(c=null==(f=e)?void 0:f.library)&&c,children:p.jsx(Yx,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:_,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:xl(F,{prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(m=e)?void 0:m.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats}),formatXAxisLabel:gl(e.timeDimension,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(h=e)?void 0:h.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats},k),formatter:function(t,n){var i,r=vl(e.dimension,e.conditionalFormattingRules,t,n,null==(i=e)?void 0:i.dataSet);if(r)return r.value},styles:null==I||null==(v=I.charts)?void 0:v.barChart,keys:E,colors:$a(null==I?void 0:I.colors,E.length),data:L,legend:Jb(null==(g=e)?void 0:g.legend,"verbose"===(null==I?void 0:I.detail)),removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,theme:null==I?void 0:I.charts,axisTitles:null==(x=e)?void 0:x.axisTitles,formatSeriesName:bl(e.result,F,e.type,null!=(b=e.viewId)?b:"",S),conditionalFormattingPossibilities:function(t){return hl(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},goalLine:yy(T,e.goalLines),idPrefix:e.idPrefix,popOverMenuStyles:null==I||null==(y=I.charts)?void 0:y.popoverMenus})})]})})};$j.defaultProps=Jj;var eF=t.memo($j,fl),tF=function(e){var n,i=t.useState(e.component.attributes),r=i[0],o=i[1],a=e.component,l=a.results,s=iw(r,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:a.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults).queriesAreChanging;return t.useEffect((function(){s||o(e.component.attributes)}),[JSON.stringify(e.component.attributes)]),p.jsx(t.Fragment,{children:p.jsx(eF,ge({id:e.id},r,{sm:e.sm,dataSet:e.dataSet,localFilters:e.component.localFilters,parameters:null==e?void 0:e.component.attributes.parameters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:l&&l[0],queriesAreChanging:s,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(n=n.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onViewClick:function(t){return(null==e?void 0:e.onViewClick)&&(null==e?void 0:e.onViewClick(t))},goalLines:e.component.attributes.goalLines,axisTitles:null==e?void 0:e.component.attributes.axisTitles,propsForHeadline:e,idPrefix:e.idPrefix,defaultFormats:e.dashboardBehaviour.defaultFormats,type:"funnelChart"}))})},nF=function(e){return p.jsx("p",{children:"Coming soon"})},iF=function(e){var t,n=e.component,i=n.results,r=n.attributes,o=iw(r,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults,e.dashboardBehaviour.variables);return p.jsx(my,ge({},r,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},results:i,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,viewFor:"standalone",defaultFormats:e.dashboardBehaviour.defaultFormats,direction:e.component.attributes.direction}))},rF={type:"dataTable",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:10,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[]};function oF(e){return e>0}function aF(e){return e.total>=e.limit}function lF(e,t){return(e||0)+(t||rF.limit)}function sF(e,t){if(void 0!==e||void 0!==t)return(e||0)-(t||rF.limit)}var uF=Fl(ge({minWidth:"100%",overflow:"overlay"},vf)),dF=Object.assign((function(){return null}),{table:Fl({textIndent:"0",borderColor:"inherit",borderCollapse:"collapse",tableLayout:"fixed"}),wrapper:uF,th:function(e){var t,n,i,r,o,a,l,s;return Fl({padding:0,display:"table-cell",position:"relative",fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,background:null==e?void 0:e.background,color:null==e?void 0:e.color,whiteSpace:"nowrap",textAlign:"left",borderTop:null==e?void 0:e.borderTop,borderRight:null==e?void 0:e.borderRight,borderBottom:null==e?void 0:e.borderBottom,variants:{lastGroupColumn:{true:{borderRight:null!=(t=null==e||null==(n=e.row)?void 0:n.borderRight)?t:null==e?void 0:e.borderRight}},firstGroupColumn:{true:{borderLeft:null==e||null==(i=e.row)?void 0:i.borderLeft}},first:{true:{borderLeft:null==e||null==(r=e.first)?void 0:r.borderLeft}},last:{true:{borderRight:null==e||null==(o=e.last)?void 0:o.borderRight}},rowScope:{true:{background:null==e||null==(a=e.column)?void 0:a.background}},hover:{true:{"&:hover":{color:null==e||null==(l=e["&:hover"])?void 0:l.color,background:null==e||null==(s=e["&:hover"])?void 0:s.background}}}}})},td:function(e){var t,n,i,r,o,a,l;return Fl({verticalAlign:"top",overflow:"hidden",position:"relative",whiteSpace:"nowrap",borderLeft:null==e||null==(t=e.body)||null==(t=t.cells)?void 0:t.borderLeft,borderRight:null==e||null==(n=e.body)||null==(n=n.cells)?void 0:n.borderRight,borderBottom:null==e||null==(i=e.body)||null==(i=i.cells)?void 0:i.borderBottom,fontSize:null==e||null==(r=e.body)||null==(r=r.cells)?void 0:r.fontSize,padding:null==e||null==(o=e.body)||null==(o=o.cells)?void 0:o.padding,variants:{first:{true:{borderLeft:null==e||null==(a=e.body)?void 0:a.borderLeft}},last:{true:{borderRight:null==e||null==(l=e.body)?void 0:l.borderRight}},align:{alignLeft:{textAlign:"left"},alignRight:{textAlign:"right"}}}})},tr:function(e){var t,n,i,r,o,a,l,s;return Fl({position:"relative",cursor:"default",variants:{even:{true:{background:null==e||null==(t=e.body)||null==(t=t.even)?void 0:t.background,color:null==e||null==(n=e.body)||null==(n=n.even)?void 0:n.color,"&:hover":{background:null==e||null==(i=e.body)||null==(i=i.even)||null==(i=i["&:hover"])?void 0:i.background,color:null==e||null==(r=e.body)||null==(r=r.even)||null==(r=r["&:hover"])?void 0:r.color}}},odd:{true:{background:null==e||null==(o=e.body)||null==(o=o.odd)?void 0:o.background,color:null==e||null==(a=e.body)||null==(a=a.odd)?void 0:a.color,"&:hover":{background:null==e||null==(l=e.body)||null==(l=l.odd)||null==(l=l["&:hover"])?void 0:l.background,color:null==e||null==(s=e.body)||null==(s=s.odd)||null==(s=s["&:hover"])?void 0:s.color}}}}})},showMoreButton:function(e){var t;return Fl(ge({color:null==e||null==(t=e.odd)?void 0:t.color,background:"transparent",padding:"0 4px 0 4px",minWidth:20,fontSize:"100%",border:0,fontWeight:300,alignSelf:"flex-end",position:"absolute",right:0,top:"40%",marginBottom:1},Cl,{"&:hover":ge({},Cl,{opacity:.5}),"> svg":{marginTop:-2},"> span":{height:10,lineHeight:"1px",display:"block"}}))},tdContentWrapper:function(e){return Fl({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip","> span":{fontSize:null!=e?e:"inherit"}})},thInner:function(e,t){var n,i;return Fl({position:"relative",textOverflow:"ellipsis",whiteSpace:t?"normal":"nowrap",padding:null==e||null==(n=e.inner)?void 0:n.padding,borderBottomWidth:null==e||null==(i=e.inner)?void 0:i.borderBottomWidth})},thLabel:function(e){return Fl({textTransform:null==e?void 0:e.textTransform})},thButton:function(e){var t,n,i=e.theme;return Fl({width:"calc(100% - 32px)",textTransform:"inherit",fontWeight:"inherit",lineHeight:"16px",textAlign:"left",WebkitLineClamp:1,color:null!=i&&i.color?i.color:"inherit",background:null!=i&&i.background?i.background:"transparent",padding:null!=i&&i.padding?i.padding:"8px",borderRadius:null!=i&&i.borderRadius?i.borderRadius:"8px","&:hover":{color:null!=i&&null!=(t=i["&:hover"])&&t.color?i["&:hover"].color:"inherit",background:null!=i&&null!=(n=i["&:hover"])&&n.background?i["&:hover"].background:Sl(90)}})},thSortButton:function(e){var t,n,i=e.theme;return Fl({width:"32px",height:"32px",textTransform:"inherit",fontWeight:"inherit",color:null!=i&&i.color?i.color:"inherit",background:null!=i&&i.background?i.background:"transparent",padding:null!=i&&i.padding?i.padding:"8px",borderRadius:null!=i&&i.borderRadius?i.borderRadius:"8px","&:hover":{color:null!=i&&null!=(t=i["&:hover"])&&t.color?i["&:hover"].color:"inherit",background:null!=i&&null!=(n=i["&:hover"])&&n.background?i["&:hover"].background:Sl(90)}})},thGroupRow:function(e){var t,n,i,r,o,a,l,s,u,d,c,p,f,m;return Fl(ge({display:"table-cell",position:"relative",fontWeight:null==e||null==(t=e.th)||null==(t=t.group)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.th)||null==(n=n.group)?void 0:n.fontSize,background:null==e||null==(i=e.th)||null==(i=i.column)?void 0:i.background,textTransform:null==e||null==(r=e.th)||null==(r=r.group)?void 0:r.textTransform,color:null==e||null==(o=e.th)||null==(o=o.column)?void 0:o.color,whiteSpace:"nowrap",textAlign:"left",borderRight:null==e||null==(a=e.th)||null==(a=a.column)?void 0:a.borderRight,borderLeft:null==e||null==(l=e.th)||null==(l=l.column)?void 0:l.borderLeft,borderBottom:null==e||null==(s=e.body)||null==(s=s.cells)?void 0:s.borderBottom,padding:null==e||null==(u=e.th)||null==(u=u.column)?void 0:u.padding},Cl,{variants:{first:{true:{borderLeft:null==e||null==(d=e.body)?void 0:d.borderLeft}},last:{true:{borderRight:null==e||null==(c=e.body)?void 0:c.borderRight}},deadSpace:{true:{borderBottom:null==e||null==(p=e.th)||null==(p=p.row)?void 0:p.borderBottom,borderRight:0,borderLeft:null==e||null==(f=e.th)||null==(f=f.column)?void 0:f.borderLeft}},level:{2:{background:null==e||null==(m=e.th)||null==(m=m.level)?void 0:m[2].background}}}}))},thGroupColumn:function(e,t){var n,i,r,o,a,l,s,u,d,c,p;return Fl(ge({display:"table-cell",position:"relative",fontWeight:null==e||null==(n=e.group)?void 0:n.fontWeight,fontSize:null==e||null==(i=e.group)?void 0:i.fontSize,textTransform:null==e||null==(r=e.group)?void 0:r.textTransform,background:null==e?void 0:e.background,color:null==e?void 0:e.color,whiteSpace:"nowrap",textAlign:"left",borderTop:null==e?void 0:e.borderTop,borderRight:t?null==e?void 0:e.borderRight:null!=(o=null==e||null==(a=e.row)?void 0:a.borderRight)?o:null==e?void 0:e.borderRight,borderLeft:null==e?void 0:e.borderRight,borderBottom:null==e||null==(l=e.row)?void 0:l.borderBottom,padding:null==e||null==(s=e.row)?void 0:s.padding},Cl,{variants:{first:{true:{borderLeft:null==e||null==(u=e.first)?void 0:u.borderLeft}},last:{true:{borderRight:null==e||null==(d=e.last)?void 0:d.borderRight}},hover:{true:{"&:hover":ge({},Cl,{color:null==e||null==(c=e["&:hover"])?void 0:c.color,background:null==e||null==(p=e["&:hover"])?void 0:p.background})}}}}))}}),cF=Fl({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),pF=function(e){var n=e.columnIndex,i=e.type,r=e.fieldKey,o=e.onResized,a=e.width,l=t.useState(!1),s=l[0],u=l[1],d=F.useDrag({type:i,item:{columnIndex:n,fieldKey:r,width:a},collect:function(e){return{isDragging:e.isDragging()}},end:function(e,t){var n=t.getDifferenceFromInitialOffset();n&&o({columnIndex:e.columnIndex,fieldKey:r,width:e.width+n.x})}}),c=d[0],f=d[1],m=d[2];return t.useEffect((function(){if(m){var e=new Image;e.src=function(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=1;var r=i.getContext("2d");return r&&(r.fillStyle="transparent",r.fillRect(0,0,1,1)),i.toDataURL()}(),e.onload=function(){return m(e)}}}),[m]),p.jsx("div",{className:""+fF,ref:f,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)},children:p.jsx("span",{className:""+mF({onHover:c.isDragging||s?"true":"false"})})})},fF=Fl({position:"absolute",right:-8,top:0,bottom:0,width:16,zIndex:1,cursor:"ew-resize"}),mF=Fl({position:"absolute",top:4,bottom:4,right:6,transitionDuration:"100ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",borderRightWidth:3,borderRightStyle:"solid",variants:{onHover:{true:{borderRightColor:Il.colors.blue},false:{borderRightColor:"transparent"}}}}),hF=t.forwardRef((function(e,t){return p.jsx("div",{ref:t,className:"vizzly-data-table "+dF.wrapper,children:p.jsx("table",{className:""+dF.table,children:e.children})})})),vF=t.forwardRef((function(e,n){var i,r,o,a,l=e.clickEnabled,s=Dd(),u={first:e.first&&"true",last:e.last&&"true",hover:e.hover&&"true",level:null==e?void 0:e.level},d=t.useMemo((function(){return null!=e&&e.deadSpace||"row"===(null==e?void 0:e.scope)?"tables.th.column":null!=e&&e.group?"tables.th.row":e.level?"tables.th.level."+e.level:"tables.th"}),[null==e?void 0:e.deadSpace,null==e?void 0:e.scope,null==e?void 0:e.group]),c=t.useMemo((function(){var t,n;return e.group?"row"===e.scope?dF.thGroupRow(null==s?void 0:s.tables)(ge({},u,{deadSpace:null!=e&&e.deadSpace?"true":void 0})):dF.thGroupColumn(null==s||null==(t=s.tables)?void 0:t.th,!(null!=e&&e.lastGroupColumn)&&(null==e?void 0:e.deadSpace))(u):dF.th(null==s||null==(n=s.tables)?void 0:n.th)(ge({},u,{rowScope:"row"===(null==e?void 0:e.scope)?"true":void 0,lastGroupColumn:null!=e&&e.lastGroupColumn&&!e.last?"true":void 0,firstGroupColumn:null==e||!e.firstGroupColumn||e.last||e.first?void 0:"true"}))}),[e.group,e.scope,null==e?void 0:e.deadSpace,null==e?void 0:e.level]);return p.jsxs("th",{scope:null!=(i=null==e?void 0:e.scope)?i:"column",className:c,style:e.cellStyles,"data-themeapi":d,"data-chipposition":"top.left","data-group":e.group?"true":"false","data-first":e.first?"true":"false","data-last":e.last?"true":"false","data-hover":e.hover?"true":"false","data-deadspace":e.deadSpace?"true":"false","data-lastgroupcolumn":e.lastGroupColumn?"true":"false","data-firstgroupcolumn":e.firstGroupColumn?"true":"false",colSpan:e.colSpan,role:l?"button":void 0,tabIndex:l?0:void 0,"data-clickenabled":l?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},children:[(null==e?void 0:e.dragSettings)&&p.jsx(pF,ge({},null==e?void 0:e.dragSettings)),p.jsx("div",{style:e.columnStyles,className:es({display:"relative",boxSizing:"border-box"}),children:p.jsx("div",{className:""+dF.thInner(null==s||null==(r=s.tables)?void 0:r.th,e.simple),ref:n,"data-themeapi":"tables.th.inner",children:p.jsxs(yf,{as:"div",overflow:e.simple?void 0:"hidden",alignItems:"center","data-component":"th-inner",paddingLeft:null!=e&&e.level&&1!==(null==e?void 0:e.level)?20*(null==e?void 0:e.level):void 0,children:[(null==e?void 0:e.expand)&&p.jsx(qf,ge({},e.expand,{label:null!=e&&e.expand.expanded?"Collapse "+(null==e?void 0:e.expand.label):"Expand "+e.expand.label,arrowStart:"side",strokeColor:null==s||null==(o=s.tables)||null==(o=o.body)||null==(o=o.drilldown)||null==(o=o.arrow)?void 0:o.stroke,styled:null==s||null==(a=s.forms)?void 0:a.select})),e.children]})})})]})})),gF=t.forwardRef((function(e,n){var i,r,o,a,l,s=Dd();return p.jsxs(t.Fragment,e.simple?{children:[p.jsx("div",{className:kd(void 0,""+Ql.button,""+dF.thButton({theme:null==s||null==(o=s.tables)||null==(o=o.th)?void 0:o.button}),es({color:"inherit",textAlign:"left",whiteSpace:"normal"}),If("table-th-button")),"data-testid":e.testIdPrefix+"-title",children:e.label}),e.onSort&&p.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:kd(""+Ql.button,""+dF.thSortButton({theme:null==s||null==(a=s.tables)||null==(a=a.th)?void 0:a.sort})),"aria-label":null!=(l=e.sortLabel)?l:"Sort","data-testid":e.testIdPrefix+"-sort","data-themeapi":"tables.th.sort","data-chipposition":"above.right",children:[!e.direction&&p.jsx(b.SelectorIcon,{}),"asc"===e.direction&&p.jsx(b.ChevronUpIcon,{}),"desc"===e.direction&&p.jsx(b.ChevronDownIcon,{})]})]}:{children:[p.jsx(xF,ge({},e,{ref:n})),e.onSort&&p.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:kd(""+Ql.button,""+dF.thSortButton({theme:null==s||null==(i=s.tables)||null==(i=i.th)?void 0:i.sort})),"aria-label":null!=(r=e.sortLabel)?r:"Sort","data-testid":e.testIdPrefix+"-sort","data-themeapi":"tables.th.sort","data-chipposition":"above.right",children:[!e.direction&&p.jsx(b.SelectorIcon,{}),"asc"===e.direction&&p.jsx(b.ChevronUpIcon,{}),"desc"===e.direction&&p.jsx(b.ChevronDownIcon,{})]})]})})),xF=t.forwardRef((function(e,n){var i,r=Dd(),o=t.useRef(null),a=e.label,l=function(e,n){var i=t.useState(!1),r=i[0],o=i[1];return t.useEffect((function(){var t,i=e.current;n&&i&&((i.offsetHeight<i.scrollHeight||i.offsetWidth<i.scrollWidth)&&o(!0),e.current&&(t=e.current).offsetWidth<t.scrollWidth&&o(!0))}),[e.current]),r}(o,a),s=t.useCallback((function(e){"function"==typeof n?n(e):null!=n&&(n.current=e),o.current=e}),[n,o]);return p.jsx("button",{onClick:function(){return e.onChange&&e.onChange()},ref:s,className:kd(l?""+cF:void 0,""+Ql.button,""+dF.thButton({theme:null==r||null==(i=r.tables)||null==(i=i.th)?void 0:i.button}),If("table-th-button")),"data-testid":e.testIdPrefix+"-title","data-themeapi":"tables.th.button","data-chipposition":"above.left",children:l?p.jsx(sh,{placement:"bottom-start",tooltipContent:function(){return p.jsx(sh.Content,{children:a})},className:""+cF,modifiers:[{name:"offset",options:{offset:[-50,10]}}],showTooltip:e.showTooltip,children:p.jsx(bF,{children:a})}):p.jsx(bF,{children:a})})})),bF=function(e){var t,n=Dd();return p.jsx("span",{className:""+dF.thLabel(null==n||null==(t=n.tables)?void 0:t.th),children:e.children})},yF=Object.assign((function(){return null}),{Wrapper:hF,Head:function(e){return p.jsx("thead",{className:es({position:"relative",zIndex:1}),children:e.children})},Body:function(e){return p.jsx("tbody",{className:es({overflow:"scroll",minWidth:"100%",borderBottom:"1px"}),children:e.children})},TR:function(e){var t,n=Dd();return p.jsx("tr",{"data-themeapi":e.odd?"tables.body.odd":"tables.body.even",className:""+dF.tr(null==n?void 0:n.tables)({odd:e.odd&&"true",even:e.even&&"true"}),"data-chipposition":"top.left","aria-expanded":!0===e.expanded?"true":!1===(null==e?void 0:e.expanded)?"false":void 0,"aria-level":null!=(t=e.level)?t:void 0,children:e.children})},TD:function(e){var i,r,o,a,l,s=Dd(),u=n.useState(!1),d=u[0],c=u[1],f=e.clickEnabled,m=e.first,h=t.useRef(null),v=null!=(i=e.showMoreLabel)?i:"Show more";return t.useEffect((function(){var t,n,i=h.current;"number"==typeof(null==(t=e.style)?void 0:t.width)&&i&&c((null==(n=e.style)?void 0:n.width)<i.offsetWidth+16)}),[h.current,null==(r=e.style)?void 0:r.width]),p.jsx("td",{style:ge({},e.style),className:""+dF.td(null==s?void 0:s.tables)({first:e.first&&"true",last:e.last&&"true",align:null!=(o=e.align)?o:"alignRight"}),role:f?"button":void 0,tabIndex:f?0:void 0,"data-clickenabled":f?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},"data-themeapi":"tables.body.cells","data-first":m?"true":"false","data-last":e.last?"true":"false",children:e.customRender?p.jsx(t.Fragment,{children:e.children}):p.jsxs(t.Fragment,{children:[p.jsx("div",{className:e.simple?void 0:""+dF.tdContentWrapper(null==s||null==(a=s.tables)||null==(a=a.body)||null==(a=a.cells)?void 0:a.fontSize),style:function(t){var n,i,r,o="number"==typeof(null==(n=e.style)?void 0:n.width)?(null==(i=e.style)?void 0:i.width)-(t?36:16):null==(r=e.style)?void 0:r.width;return{width:o,minWidth:o}}(d),children:p.jsx("span",{ref:h,children:e.children})}),d&&p.jsx("button",{"aria-label":"string"==typeof e.children?v+": "+e.children:v,onClick:function(){return e.onShowMore&&e.onShowMore()},className:""+dF.showMoreButton(null==s||null==(l=s.tables)?void 0:l.body),children:p.jsx(b.DotsHorizontalIcon,{})})]})})},TH:vF,THButton:gF,THLabel:bF,HeadTR:function(e){return p.jsx("tr",{children:e.children})}}),wF=Object.assign(yF.Wrapper,{Wrapper:yF.Wrapper,Head:yF.Head,Body:yF.Body,TR:yF.TR,TD:yF.TD,TH:yF.TH,THLabel:yF.THLabel,THButton:yF.THButton,HeadTR:yF.HeadTR}),CF=function(e){return p.jsx(yf,{direction:"column",children:null==e?void 0:e.children})};function jF(e){return null===e?"asc":"asc"===e?"desc":null}var FF=function(e){var n=r.debounce(e.onSetExportName),i=Pu().textOverride,o=Object.entries(e.numberFormatOptions).map((function(e){return{label:e[1].description,value:e[0]}}));return p.jsx(t.Fragment,{children:e.open&&p.jsx(cf,{onClose:function(){return null==e?void 0:e.close()},width:220,position:null==e?void 0:e.triggerPosition,align:"right",children:p.jsxs(cf.Options,{padding:!0,children:[p.jsx(cf.Option,{children:p.jsx(CF,{children:p.jsx($f,{label:i("table_settings.title","Title"),id:"table-header-title","data-testid":"table-header-title",defaultValue:e.exportName,placeholder:e.originalPublicName,onChange:function(t){n(e.fieldId,t.target.value?t.target.value:void 0)}})})}),"number"==e.dataType&&p.jsx(cf.Option,{children:p.jsx(CF,{children:p.jsx(nm,{label:i("table_settings.format","Format"),id:"table-header-format",testId:"table-header-format",showClearBtn:!0,selected:e.currentNumberFormat,options:o,onChange:function(t){e.onSetNumberFormat(t)},textOverride:i})})})]})})})},SF=function(e){var t=Pu().textOverride,n=qm().generatingPDF,i=e.fieldIndex,r=e.currentOrder,o=e.exportName,a=e.currentNumberFormat,l=e.fields[i],s={width:e.width,maxWidth:e.width,minWidth:e.width},u=ff(),d=u.ref,c=u.show,f=u.position,m=u.close,h=u.open,v={fontFamily:s.fontFamily,translate:e.columnOffset+"px"};return e.isImpactedColumn&&(v.opacity=.1),p.jsxs(wF.TH,{cellStyles:s,columnStyles:v,first:0===i,last:null==e?void 0:e.last,hover:!0,group:!1,dragSettings:{columnIndex:i,type:e.id,fieldKey:l.datumKey,onResized:null==e?void 0:e.onResizedColumn,width:e.width},lastGroupColumn:e.isLastGroupColumn,firstGroupColumn:e.isFirstGroupColumn,simple:n,children:[p.jsx(wF.THButton,{onChange:function(){return h()},direction:r?null==r?void 0:r.direction:void 0,label:o||l.publicName,onSort:ut(l)?void 0:function(){var t,n=ot(l.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});null==e.onOrderChange||e.onOrderChange({fieldId:n.field,function:n.function,direction:jF(null!=(t=null==r?void 0:r.direction)?t:null)})},ref:d,testIdPrefix:"column-"+(null==l?void 0:l.id),sortLabel:t("table_settings.sort","Sort"),simple:n}),p.jsx(FF,{open:c,triggerPosition:f,close:m,exportName:e.exportName||l.publicName,fieldId:l.datumKey,originalPublicName:l.publicName,onSetExportName:e.onSetExportName,onSetNumberFormat:function(t){return e.onSetNumberFormat(l.datumKey,t)},currentNumberFormat:a,numberFormatOptions:e.numberFormatOptions,dataType:l.dataType})]})},kF=function(e){var t,n,i,r=null!=(t=null==e?void 0:e.as)?t:"span",o=Dd();return p.jsx(r,{className:kd(""+jf.title(null!=(n=e.themeClassName)?n:null==o||null==(i=o.lists)?void 0:i.title),e.className),"data-themeapi":"list.title",id:e.id,children:null==e?void 0:e.children})},AF=function(e){var t,n,i=Dd();return p.jsx("span",{children:p.jsx(kF,{as:"legend",themeClassName:null==i||null==(t=i.section)?void 0:t.title,children:p.jsxs(yf,{gap:"0.25rem",alignItems:"center",as:"span",children:[null==e?void 0:e.title,(null==e?void 0:e.tooltip)&&p.jsx(uf,{width:"18px",children:p.jsx(sh,{tooltipContent:function(){return p.jsx(sh.Content,{children:null==e?void 0:e.tooltip})},children:p.jsx(b.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+_C.fadeIn(null==i||null==(n=i.dashboard)||null==(n=n.icon)?void 0:n.color)})})})]})})})},TF=Object.assign((function(e){var t,n=Dd();return p.jsxs("fieldset",{className:kd(""+_C.wrapper,""+Ql.bw(0),""+Ql.m(0),""+Ql.p(0),null!=n&&null!=(t=n.section)&&t.panel?es(n.section.panel):void 0),children:[(null==e?void 0:e.title)&&p.jsx(AF,ge({},e)),p.jsx(uf,{marginTop:"0.25rem",children:e.children})]})}),{Grid:function(e,t){var n=e.gap;return p.jsx(Td,{gap:void 0===n?"0.75rem":n,columns:2===e.columns?["repeat(2, minmax(0px, 1fr))"]:void 0,"data-component":null==t?void 0:t["data-component"],children:e.children})},Panel:function(e){var t,n,i=Dd();return p.jsx(uf,{as:null!=(t=null==e?void 0:e.as)?t:"fieldset","data-component":"list-panel",children:p.jsxs(lx,{padding:!0,children:[(null==e?void 0:e.title)&&p.jsx(uf,{"data-component":"section-panel",children:p.jsx(Kf,{as:"legend",classNameOverride:""+Gf(null==i||null==(n=i.lists)?void 0:n.subTitle),children:null==e?void 0:e.title})}),p.jsx(Td,{gap:"0.5rem",children:null==e?void 0:e.children})]})})},Container:function(e){return p.jsx(yf,{direction:"column",gap:"0.75rem","data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Title:AF}),_F=function(e){return p.jsxs(Mh,{onClose:function(){return null==e?void 0:e.onCloseModal()},isOpen:null==e?void 0:e.open,width:"sm",children:[p.jsx(Mh.Content,{children:p.jsx(TF.Container,{children:p.jsx(TF.Panel,{as:"div",children:p.jsx(oC,{content:null==e?void 0:e.content})})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsx(gh,{secondary:!0,onClick:function(){return null==e?void 0:e.onCloseModal()},children:"Close"})})]})},IF=Fl({height:"1.25rem",width:"1.25rem","&:disabled":{opacity:.4}}),DF=Fl({fontSize:13,fontWeight:"normal"}),OF=function(e){var t,n,i=e.textOverride;return p.jsxs(yf,{justifyContent:"flex-end",alignItems:"center",margin:"0.5rem 0 0 0",children:[p.jsxs("span",{className:""+DF,children:[i?i("pagination.page","Page"):"Page"," ",(null!=(t=e.offset)?t:0)/(null!=(n=e.limit)?n:1)+1]}),e.onPrevious&&p.jsx("button",{disabled:null==e?void 0:e.previousDisabled,onClick:e.onPrevious,"aria-label":"Previous",className:Ql.button+" "+IF,children:p.jsx(b.ChevronLeftIcon,{})}),e.onNext&&p.jsx("button",{"aria-label":"Next",disabled:null==e?void 0:e.nextDisabled,className:Ql.button+" "+IF,onClick:e.onNext,children:p.jsx(b.ChevronRightIcon,{})})]})},EF=function(e,t){return t[e]?t[e]:Va(e)?t[Ba(e)]:void 0},LF=function(e){var t=e.fieldId,n=e.hiddenFields;if(!n||0===n.length)return!1;var i=!1;return n.forEach((function(e){t.includes(e+"_")&&(i=!0)})),i},NF=function(e){for(var t,n=[],i=function(){var e=t.value,i=n.find((function(t){return t.content===e.formatted}));i?i.colSpan+=1:n.push({content:e.formatted,colSpan:1,unformatted:e.unformatted})},r=ve(e);!(t=r()).done;)i();return n};function MF(e,t){return e.dimensionValues.map((function(n,i){return t(n,e.dimensionKeys[i])})).join(", ")}var RF=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},PF=function(e,t,n){var i=ot(t,n);return e.filter((function(e){return e.field===(null==i?void 0:i.field)&&e.function===i.function}))[0]},zF=function(e,t){if((null==t?void 0:t.length)>0&&Va(e.datumKey)){var n=(qa(e.datumKey).dimensionValues||[]).join(", ");return t.some((function(e){return e.unformatted===n}))}return!1},VF=function(e){var t=e.type,n=e.result,i=e.exportNames,o=e.prefixes,a=e.dateTimeFormat,l=e.dateTimeFormatOptions,s=e.numberFormat,u=e.numberFormatOptions,d=e.supportedAggregates,c=e.supportedTimeTruncFunctions,p=e.labelFormat,f=e.nullReplacement,m=e.measure,h=e.xMeasure,v=e.yMeasure,g=e.dimension,x=e.viewId,b=e.dataSetId,y=e.nullValueAlias,w=e.textOverride,C=e.hiddenFields;if(!n)return null;C&&(n=function(e){var t=e.hiddenFields,n=r.cloneDeep(e.result);return n.fields=n.fields.map((function(e){return t.some((function(t){return e.id.includes(t)}))&&(e.hidden=!0),e})),n}({result:n,hiddenFields:C}));var j=[],F=[],S=void 0,k=function(e,n,i,r,o){var a=e;n&&"none"!=n&&(a=al(e,d[n].publicName));var l=p({fieldId:i,func:n,type:t,defaultLabel:a,viewId:null!=x?x:"",values:sl(r,o)});return null!=l?l:a};if(n&&"dataTable"==t){var A=Hi({measure:m,xMeasure:h,yMeasure:v}),T=Yi({dimension:g}),_=function(e,t,n,i,o,a,l){var s=r.groupBy(t,(function(e){return e.pivot||"x"})),u={x:(s.x||[]).map((function(e){return Ti(e)})),y:(s.y||[]).map((function(e){return Ti(e)})),detailed:{x:(s.x||[]).map((function(e){return{field:e.field,function:e.function}})),y:(s.y||[]).map((function(e){return{field:e.field,function:e.function}}))}},d=Ha(e,n,u,void 0,ct(i,t,null,o,a)),c=[].concat(u.x).map((function(t){return ge({},Ua(e,t),{hidden:LF({fieldId:t,hiddenFields:l}),datumKey:t})})),p=[],f=Ya(u,n,e);return d.forEach((function(e){p.push([].concat(e.xValues,r.cloneDeep(f).map((function(t){return void 0===e[t]?null:e[t]}))))})),f.forEach((function(t){var n=qa(t),i=Ti({field:n.fieldId,function:n.function}),r=Ua(e,i),o=za(n.dimensionKeys,n.dimensionValues,n.fieldId,n.function);c.push({id:i,datumKey:o,publicName:null==r?void 0:r.publicName,dataType:"number",hidden:LF({fieldId:i,hiddenFields:l}),fieldId:n.fieldId,function:n.function,outputDataType:"number"})})),{fields:c,content:p}}(n,T,A,b,y,w,C);S=function(e,t,n,i,o){if(!r.some(t,(function(e){return"y"==e.pivot}))||!e)return!1;var a=n.flatMap((function(t){if(Va(t.datumKey)){var n=qa(t.datumKey);return[{formatted:MF(n,(function(t,n){return function(e,t,n,i,r){var o=ht(t,r);if(e&&o){var a=Ua(e,t),l=r[o.truncate].dateFormat,s="date_time"==(null==a?void 0:a.dataType)?new Date(n):n;return et(s,i[l].formatter)||""+n}return""+n}(e,n,t,i,o)})),unformatted:MF(n,(function(e){return e}))}]}return[]})),l=r.cloneDeep(t).flatMap((function(e){return"y"==e.pivot?[]:[{colSpan:1,content:"",rowGroup:!0,unformatted:""}]}));return{consolidated:[].concat(l,NF(a)),unconsolidated:[].concat(l,a.map((function(e){return{colSpan:1,content:e.formatted,unformatted:e.unformatted}})))}}(n,T,_.fields,l,c),F=_.content,j=_.fields}else n&&n.fields.forEach((function(e){j.push(ge({},e,{datumKey:za([],[],e.id,"none")}))}));return j=j.map((function(e){var t=e.publicName,n=e.id,r="none",o=void 0,a=void 0,l=function(e,t){return t[e]?t[e]:Va(e)?t[Ba(e)]:void 0}(e.datumKey,i||{});if(Va(e.datumKey)){var s=qa(e.datumKey);n=s.fieldId,o=s.dimensionKeys,a=s.dimensionValues}return l?t=l:Va(e.datumKey)&&(r=qa(e.datumKey).function),ge({},e,{publicName:l||k(t,r,n,o,a)})})),F=qF(j,"dataTable"==t?F:n.content,o,a,l,s,u,f),{groupTitles:S,fields:j,content:F}},qF=function(e,t,n,i,r,o,a,l){return t.map((function(t){return t.map((function(t,s){var u,d=e[s],c=n?function(e,t){var n;return null==(n=e.find((function(e){var n=t.id;return Va(n)?Ba(n)==e.field:n==e.field})))?void 0:n.prefix}(n,e[s]):"",p=i?r[i].formatter:function(e){return e.toISOString()},f=o?EF(null!=(u=d.datumKey)?u:"",o):"",m=a[f||""];return{value:t,displayValue:""+(null!=c?c:"")+(m&&"number"==d.dataType?m.formatter(t,l(d.id)):et(function(e,t){if(null===e)return null;switch(t){case"boolean":return!!e;case"date_time":return new Date(e);case"number":return Number(e);case"string[]":return""+(Array.isArray(e)?Re(e,!1):""+e);case"string":return""+e}}(t,d.dataType),p,l(d.id)))}}))}))};function BF(e,t,n,i){var r,o;return i&&i.hasOwnProperty(e)?i[e]:null!=(r=null==(o=t[e])?void 0:o.width)?r:n}var WF=function(e){var n=e.row,i=e.rowIndex,o=e.tableRepresentation,a=e.dimension,l=e.conditionalFormattingRules,s=e.dataSet,u=e.protectedFields,d=e.drilldownAction,c=Pu(),m=c.queryEngineConfig,h=c.textOverride,v=qm().generatingPDF;return p.jsx(t.Fragment,{children:n.map((function(t,c){if(null!=o&&o.fields[c].hidden)return null;if(null==o)return null;var g,x=o.fields[c],b=e.drilldown.length>0&&0===c,y=BF(x.datumKey,null==e?void 0:e.sizing,null==e?void 0:e.defaultColumnWidth,null==e?void 0:e.alternativeColumnSizing);if(Va(x.datumKey)){var w=qa(x.datumKey),C={};null==o||o.fields.forEach((function(e,t){var i,r;C[w.fieldId]=null==(i=n[t])?void 0:i.value,C[e.datumKey]=null==(r=n[t])?void 0:r.value})),w.dimensionKeys.forEach((function(e,t){C[e]=w.dimensionValues[t]}));var j=vl(a,l,C,x.datumKey,s);j&&(g=function(e){var t,n=e.type,i=e.value,o=(t=null!=i?i:"",r.maxBy(["white","black"],(function(e){return f.contrast(e,t)}))||t);switch(n){case"fontColor":return{color:i};case"backgroundColor":return{backgroundColor:i,color:o}}return{}}(j))}var F,S=e.renderTableCell(i,c,t.value,x.datumKey);return PF(a,x.id,{supportedAggregates:m.supportedAggregates,supportedTimeTruncFunctions:m.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0})?p.jsx(wF.TH,{first:0===c,last:c+1===n.length,group:!0,scope:"row",onClick:function(){return e.onViewClick(i,c,t.value,x.datumKey)},clickEnabled:zy(u),expand:d&&b?{expanded:null==d?void 0:d.expanded,onClick:function(){return null==d?void 0:d.onExpanded(null!=d&&d.expanded?void 0:i)},label:""+t.displayValue}:void 0,level:null!=(F=null==e?void 0:e.level)?F:void 0,children:S?p.jsx(HF,{component:S}):"undefined"!==t.displayValue?t.displayValue:""},"table_row_"+i+"_cell_"+c):p.jsx(wF.TD,{first:0===c,last:c+1===n.length,onClick:function(){return e.onViewClick(i,c,t.value,x.datumKey)},align:"number"==x.dataType?"alignRight":"alignLeft",clickEnabled:zy(u),simple:v,style:ge({},null==e?void 0:e.cellStyles,g||{},{width:y,maxWidth:y,minWidth:y}),onShowMore:function(){return null==e?void 0:e.setShowMore(t.displayValue)},showMoreLabel:h("table_settings.show_more","Show more"),customRender:!!S,children:S?p.jsx(HF,{component:S}):void 0!==t.displayValue?t.displayValue:""},"table_row_"+i+"_cell_"+c+"_"+JSON.stringify(t.displayValue)+"}")}))})},HF=function(e){var n=e.component;return"string"==typeof n?p.jsx("div",{dangerouslySetInnerHTML:{__html:n}}):p.jsx(t.Fragment,{children:n})},YF=function(e){var i=n.useState(void 0),r=i[0],o=i[1],a=e.rowIndex,l=e.dataSet,s=e.drilldown;t.useEffect((function(){return o(void 0)}),[e.queriesAreChanging]);var u=t.useState(),d=u[0],c=u[1],f=void 0!==r,m=s&&(null==s?void 0:s.length)>0,h=Pu().queryEngineConfig;return p.jsxs(t.Fragment,{children:[p.jsx(wF.TR,{odd:a%2!=0,even:a%2==0,level:s?1:void 0,expanded:s?f:void 0,children:p.jsx(WF,ge({},e,{drilldownAction:m?{onExpanded:function(t){if(void 0!==t){var n=function(e,t,n){return UF(t).map((function(t){var i,r,o,a=(o=RF(t),e.fields.findIndex((function(e){return e.id===o})));return(r={})[t.field]=null==(i=e.content[n][a])?void 0:i.value,r}))}(e.tableRepresentation,e.dimension,t);null!==n&&o(n)}else o(void 0)},expanded:f}:void 0,onViewClick:function(t,n,i){e.handleOnChange(t,n,i,Py(null==e?void 0:e.tableRepresentation.fields,h,e.row))},renderTableCell:function(t,n,i){return e.handleTableCellRender(t,n,i,Py(null==e?void 0:e.tableRepresentation.fields,h,e.row))}}))}),(null==e?void 0:e.drilldownInputProps)&&f&&m&&p.jsx(GF,{setResults:function(e){return c({results:e})},dataSet:l,result:null==d?void 0:d.results[0],drilldownInputProps:null==e?void 0:e.drilldownInputProps,drilldown:s,selectedRow:r,tableRowProps:e,parentFields:e.tableRepresentation.fields,handleOnChange:e.handleOnChange,dimension:e.dimension,handleTableCellRender:e.handleTableCellRender})]})},GF=function(e){var n,i,r=t.useState(0),o=r[0],a=r[1],l=e.drilldownInputProps,s=l.component,u=l.runQueriesCallback,d=s.attributes.limit,c=Pu(),f=c.queryEngineConfig,m=c.numberFormatOptions,h=c.dateTimeFormatOptions,v=c.labelFormat,g=c.textOverride,x=c.nullValueAlias,b=c.variables,y=function(e,t,n,i,r){var o,a,l,s,u=(o=i.map((function(e){return Object.keys(e)})).flat(),e.filter.filter((function(e){return e.every((function(e){return!o.includes(e.field)}))}))),d=function(e,t,n){var i=[].concat(e).map((function(e){var n,i=Object.keys(e)[0];return{field:i,op:"=",value:e[i],function:(null==(n=t.find((function(e){return e.field===i})))?void 0:n.function)||"none"}}));return jn(n,i)}(i,n,[].concat(u));return ge({},e,{dimension:(a=e.dimension,l=t,s=a.filter((function(e){return"x"!==e.pivot})),[].concat(s,[ge({},l)])),order:[{field:t.field,direction:"asc",function:t.function||"none"}],filter:d,offset:r})}(s.attributes,ot(e.drilldown[0].subsetDimension,f),e.dimension,e.selectedRow,o);$h(y,u,null==e?void 0:e.setResults,{localFilters:s.localFilters,globalFilters:e.drilldownInputProps.globalFilters},e.dataSet,void 0,b);var w=function(t){return pt({dataSetId:e.dataSet.id,fieldId:t,nullValueAlias:x,textOverride:g,textOverrideKey:"table_cell.no_value_replacement"})},C=t.useMemo((function(){return VF({type:y.type,result:e.result,exportNames:y.exportNames,prefixes:y.prefixes,dateTimeFormat:y.dateTimeFormat,dateTimeFormatOptions:h,numberFormat:y.numberFormat,numberFormatOptions:m,supportedAggregates:f.supportedAggregates,supportedTimeTruncFunctions:f.supportedTimeTruncFunctions,labelFormat:v,nullReplacement:w,measure:y.measure,xMeasure:y.xMeasure,yMeasure:y.yMeasure,dimension:y.dimension,dataSetId:e.dataSet.id,nullValueAlias:x,textOverride:g,hiddenFields:y.hiddenFields})}),[y.type,e.result,y.exportNames,y.prefixes,y.dateTimeFormat,h,y.numberFormat,m,f.supportedAggregates,f.supportedTimeTruncFunctions,void 0,y.measure,y.xMeasure,y.yMeasure,y.dimension]),j=t.useMemo((function(){return p.jsx(p.Fragment,{children:e.result&&p.jsx(OF,{offset:o,limit:d,onNext:function(){var e;return a(null!=(e=lF(o,d))?e:0)},onPrevious:function(){var e;return a(null!=(e=sF(o,d))?e:0)},previousDisabled:!oF(null!=o?o:0),nextDisabled:!aF({offset:null!=o?o:0,limit:null!=d?d:0,total:C?C.content.length:0}),textOverride:g})})}),[o,d,null==(n=e.result)?void 0:n.content.length,a,null==C?void 0:C.content.length]),F=0===o&&(null!=(i=null==C?void 0:C.content.length)?i:0)<(null!=d?d:0),S=null==e?void 0:e.tableRowProps.row.length;return Ka(e.result)?p.jsx(wF.TR,{level:2,children:p.jsx(wF.TH,{colSpan:S,children:p.jsx(Nf,{minHeight:30})})}):Xa(e.result)?p.jsx(Yg,{}):p.jsxs(t.Fragment,{children:[(null==C?void 0:C.content)&&p.jsx(t.Fragment,{children:(null==C?void 0:C.content.length)>0?p.jsx(t.Fragment,{children:null==C?void 0:C.content.map((function(t,n){var i=function(e,t,n,i,r,o){return 0===e.length?[{value:i[0].value,displayValue:i[0].displayValue}]:e.map((function(e,a){if(0===a)return i[0];var l=t.fields.findIndex((function(t){return t.datumKey===e.datumKey})),s=r.find((function(t){return t.field===e.id}));return-1!==l?t.content[n][l]:s?{value:null,displayValue:""}:{value:null,displayValue:o("table_parent.no_value_replacement","No value")}}))}(e.parentFields,C,n,t,UF(e.dimension),g);return p.jsx(wF.TR,{level:2,odd:n%2!=0,even:n%2==0,children:p.jsx(WF,ge({},null==e?void 0:e.tableRowProps,{row:i,rowIndex:n,drilldownAction:void 0,level:2,subsetTableRepresentation:C,onViewClick:function(t,n,r,o){e.handleOnChange(t,n,r,Py(e.parentFields,f,i,C.fields,e.drilldown[0]),KF(null==e?void 0:e.drilldown[0],f,e.selectedRow,C.content[t][0].value,i[n].value,o,e.dimension))},renderTableCell:function(t,n,r,o){e.handleTableCellRender(t,n,r,Py(e.parentFields,f,i,C.fields,e.drilldown[0]),KF(null==e?void 0:e.drilldown[0],f,e.selectedRow,C.content[t][0].value,i[n].value,o,e.dimension))}}))},"table_row_level_2_"+n)}))}):p.jsx(wF.TR,{level:2,children:p.jsx(wF.TH,{colSpan:S,children:"No Results"})})}),!F&&p.jsx(wF.TR,{level:2,children:p.jsx(wF.TH,{colSpan:S,children:j})})]})};function UF(e){return e.filter((function(e){return"x"===e.pivot}))}function KF(e,t,n,i,r,o,a){var l=ot(e.subsetDimension,t),s=function(){var e=[{fieldId:l.field,function:l.function,aggregate:l.function,value:i}];return a.forEach((function(t){var i;"x"===t.pivot&&e.push({fieldId:t.field,function:t.function,aggregate:t.function,value:(null==n||null==(i=n.find((function(e){return Object.keys(e)[0]===t.field})))?void 0:i[t.field])||""})})),e}();return{value:function(){if(Va(o)){var n=qa(o);return{fieldId:n.fieldId,value:r,function:n.function,aggregate:n.function,datum:o}}var i=ot(e.subsetDimension,t);return{fieldId:i.field,value:r,function:i.function,aggregate:i.function,datum:o}}(),grouping:s}}var XF=function(e,t,n){if(!n)return[];var i=[],r=new Map;return n.fields.forEach((function(e,t){r.set(e.id,t)})),e.forEach((function(e){var o,a,l,s,u=Yi(t),d=rt({field:null==(o=e.filters)?void 0:o[0][0].field,function:null!=(a=null==(l=e.filters)?void 0:l[0][0].function)?a:"none"}),c=r.get(d);if(void 0!==c)if(u.some((function(t){var n;return t.field===(null==(n=e.filters)?void 0:n[0][0].field)}))||"number"!=typeof(null==(s=e.filters)?void 0:s[0][0].value))i.push(ge({},e,{boundaries:void 0}));else{var p=Infinity,f=-Infinity;n.content.forEach((function(t){var n,i,r=Number(t[c]);isNaN(r)||rl({op:null==(n=e.filters)?void 0:n[0][0].op,value:null==(i=e.filters)?void 0:i[0][0].value},r)&&(p=Math.min(p,r),f=Math.max(f,r))})),Infinity!==p&&-Infinity!==f&&i.push(ge({},e,{boundaries:[p,f]}))}})),i},QF=function(e){var n,i,o,a,l,s,u,d={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==e?void 0:e.type,viewId:null!=(i=null==e?void 0:e.viewId)?i:"",order:e.order,setPartialAttributes:e.setPartialAttributes},c=e.sizing,f=Pu(),m=f.labelFormat,h=f.textOverride,v=f.nullValueAlias,g=qm().generatingPDF,x=function(e){var n=t.useRef(null),i=t.useState(0),o=i[0],a=i[1];return t.useEffect((function(){var e=r.throttle((function(){a(n.current?n.current.offsetWidth:0)}),100);return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),e.cancel()}}),[e]),[n,o]}(JSON.stringify(e)),b=x[0],y=function(e,t){var n=e/t;return n<200&&(n=200),n>300&&(n=300),n}(x[1],((null==(o=e.result)?void 0:o.fields)||[]).length),w=F.useDragLayer((function(e){if(e.isDragging()){var t,n=e.getItem(),i=e.getDifferenceFromInitialOffset();if(null!==i&&n)return(t={})[null==n?void 0:n.fieldKey]=(null==n?void 0:n.width)+(null==i?void 0:i.x),t}})),C=function(t){var n;return null==e?void 0:e.onSizingUpdate(ge({},c,((n={})[t.fieldKey]={width:t.width},n)))},j=t.useState(null),S=j[0],k=j[1],A=function(t){return pt({dataSetId:e.dataSetId,fieldId:t,nullValueAlias:v,textOverride:h,textOverrideKey:"table.no_value_replacement"})},T=t.useMemo((function(){return VF({type:e.type,result:e.result,exportNames:e.exportNames,prefixes:e.prefixes,dateTimeFormat:e.dateTimeFormat,dateTimeFormatOptions:e.dateTimeFormatOptions,numberFormat:e.numberFormat,numberFormatOptions:e.numberFormatOptions,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,labelFormat:m,nullReplacement:A,measure:e.measure,xMeasure:e.xMeasure,yMeasure:e.yMeasure,dimension:null==e?void 0:e.dimension,viewId:e.viewId,dataSetId:e.dataSetId,nullValueAlias:v,hiddenFields:null==e?void 0:e.hiddenFields})}),[e.measure,e.xMeasure,e.yMeasure,e.result,e.dateTimeFormat,e.numberFormat,e.prefixes,e.dateTimeFormatOptions,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions,null==e?void 0:e.dimension]),_=(null!=(a=e.result)&&a.content?null==(l=e.result)?void 0:l.content.length:0)>(T?T.content.length:0),I=t.useMemo((function(){var t,n,i;return p.jsx(p.Fragment,{children:e.result&&!_&&p.jsx(OF,{offset:null==e?void 0:e.offset,limit:null==e?void 0:e.limit,onNext:null==e?void 0:e.onNext,onPrevious:null==e?void 0:e.onPrevious,previousDisabled:!oF(null!=(t=e.offset)?t:0),nextDisabled:!aF({offset:null!=(n=e.offset)?n:0,limit:null!=(i=e.limit)?i:0,total:T?T.content.length:0}),textOverride:h})})}),[e.offset,e.limit,e.onPrevious,e.onNext,null==(s=e.result)?void 0:s.content.length,_]),D=t.useMemo((function(){return T?function(e,t,n,i){var r=function(e,t,n,i){return e.fields.filter((function(e){return!!PF(t,e.id,{supportedAggregates:n,supportedTimeTruncFunctions:i,supportedTransformationFunctions:void 0})}))}(e,t,n,i);return r.length>0?r[r.length-1].id:null}(T,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions):null}),[T,e.dimension,e.supportedAggregates,e.supportedTimeTruncFunctions]),O=t.useMemo((function(){return T?function(e){var t=-1;return e.groupTitles&&e.groupTitles.consolidated.forEach((function(e,n){""===e.content&&!0===e.rowGroup&&(t=n)})),t}(T):null}),[T]),E=Dd();if(null===T)return null;if(Qa(e.result))return p.jsx(Kg,ge({},d,{children:I}));if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters",children:$b(e)});if(Ka(e.result))return p.jsx(Nf,{});if(Xa(e.result))return p.jsx(Yg,{});var L={fontFamily:null==E?void 0:E.fontFamily},N=function(t,n,i,r,o){return function(e,t,n,i,r,o){var a=e.result,l=e.onViewClick,s=e.type;if(null!=a&&a.fields&&l){var u,d=Vy(a,n,t,s,i,e.dimension,o,e.supportedAggregates);l({viewId:null!=(u=null==e?void 0:e.viewId)?u:"",type:s,fields:d.activeFieldsWithValues,clicked:d.cell,fieldsV2:r,dataSet:{id:e.dataSet.id,name:e.dataSet.name,fields:e.dataSet.fields,description:e.dataSet.description}})}}(e,n,t,i,r,o)},M=function(t,n,i,r,o){return function(e,t,n,i,r,o){var a=e.result,l=e.renderTableCell,s=e.type;if(null!=a&&a.fields&&l){var u,d=Vy(a,n,t,s,i,e.dimension,o,e.supportedAggregates);return l({viewId:null!=(u=null==e?void 0:e.viewId)?u:"",type:s,cell:d.cell,fields:r})}}(e,n,t,i,r,o)};return p.jsxs(Cg,{queriesAreChanging:e.queriesAreChanging,id:e.id,children:[p.jsx(uf,{marginBottom:null!=e&&e.displayTitle&&(null==e?void 0:e.displayTitle.length)>0?"0.4rem":void 0,children:p.jsx(wg,ge({},d,{paddingBottom:0}))}),p.jsxs(ns,{disabledFeatures:null!=(u=null==e?void 0:e.library)&&u,children:[p.jsxs(wF.Wrapper,{ref:b,children:[p.jsxs(wF.Head,{children:[T.groupTitles&&p.jsx(wF.HeadTR,{children:T.groupTitles.consolidated.map((function(e,t){var n;return p.jsx(wF.TH,{colSpan:e.colSpan,group:!0,last:t+1===((null==T?void 0:T.groupTitles)&&(null==T||null==(n=T.groupTitles)||null==(n=n.consolidated)?void 0:n.length)),simple:null!=g&&g,deadSpace:e.rowGroup,lastGroupColumn:t===O,children:e.content},e+"_"+t)}))}),p.jsx(wF.HeadTR,{children:T.fields.map((function(t,n){if(t.hidden)return null;var i=e.order.find((function(n){var i=ot(t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});return n.field===i.field&&i.function==n.function})),r=function(e,t){var n,i,r=(n=e.groupTitles?e.groupTitles.consolidated:[],(i=e.fields.filter((function(e){return zF(e,n)}))).length>0?i[i.length-1]:void 0),o=function(e,t){var n=e.filter((function(e){return zF(e,t)}));return n.length>0?n[0]:void 0}(e.fields,e.groupTitles?e.groupTitles.consolidated:[]);return{isLastGroupColumn:t.id===(null==r?void 0:r.id),isFirstGroupColumn:t.id===(null==o?void 0:o.id)}}(T,t),o=r.isLastGroupColumn,a=r.isFirstGroupColumn,l=PF(null==e?void 0:e.dimension,t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0}),s=BF(t.datumKey,c,y,w),u=!(!T.groupTitles||t.id!==D);return p.jsx(SF,{exportName:t.publicName,onSetExportName:e.onSetExportName,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,id:e.id,isImpactedColumn:!1,width:s,columnOffset:0,currentOrder:i,onOrderChange:e.onOrderChange,fieldIndex:n,numberFormatOptions:e.numberFormatOptions,currentNumberFormat:EF(t.datumKey,e.numberFormat),onSetNumberFormat:e.onSetNumberFormat,fields:null==T?void 0:T.fields,last:n+1===(null==T?void 0:T.fields.length),scope:l?"row":void 0,onResizedColumn:C,isLastGroupColumn:o||u,isFirstGroupColumn:a},"table_column_"+n)}))})]}),p.jsx(wF.Body,{children:T.content.map((function(t,n){return p.jsx(YF,{protectedFields:null==e?void 0:e.protectedFields,dataSet:null==e?void 0:e.dataSet,conditionalFormattingRules:XF(null==e?void 0:e.conditionalFormattingRules,e,e.result),dimension:null==e?void 0:e.dimension,rowIndex:n,row:t,tableRepresentation:T,sizing:c,defaultColumnWidth:y,alternativeColumnSizing:w,handleOnChange:N,handleTableCellRender:M,cellStyles:L,setShowMore:k,drilldown:e.tableDrilldown,drilldownInputProps:null==e?void 0:e.drilldownInputProps,queriesAreChanging:e.queriesAreChanging},n)}))})]}),I]}),p.jsx(_F,{open:!!S,onCloseModal:function(){return k(null)},content:S})]})};QF.defaultProps=rF;var ZF=function(e){return p.jsx(QF,ge({},e))},JF=function(e){var t=e.component,n=t.results,i=t.attributes,o=$h(i,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables).queriesAreChanging,a=n[0];if(a&&a.fields.length!=i.dimension.length+i.measure.length)return null;var l=i.measure.map((function(e){return Ti(e)})),s=i.dimension.map((function(e){return Ti({function:e.function,field:e.field})}));return r.every(null==a?void 0:a.fields,(function(e){return s.includes(e.id)||l.includes(e.id)}))?p.jsx(ZF,ge({},i,{dataSet:e.dataSet,onSetExportName:function(t,n){var r;e.updateComponentAttributes(ge({},i,{exportNames:ge({},i.exportNames,(r={},r[t]=n,r))}))},id:e.id,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},result:a,onNext:function(){var t,r,o,a;aF({limit:null!=(t=i.limit)?t:0,offset:null!=(r=i.offset)?r:0,total:null!=(o=null==(a=n[0])?void 0:a.content.length)?o:0})&&e.updateComponentAttributes(ge({},i,{offset:lF(i.offset,i.limit)}))},onPrevious:function(){var t;oF(null!=(t=i.offset)?t:0)&&e.updateComponentAttributes(ge({},i,{offset:sF(i.offset,i.limit)}))},queriesAreChanging:o,onOrderChange:function(t){var n=t.fieldId,o=t.function,a=t.direction,l=r.cloneDeep(i.order),s=l.findIndex((function(e){return e.field===n&&e.function==o}));null===a?l.splice(s,1):s>-1?l[s].direction=a:l.push({field:n,direction:a,function:o}),e.updateComponentAttributes(ge({},i,{order:l}))},numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onSetNumberFormat:function(t,n){var r=ge({},i.numberFormat);n?r[t]=n:delete r[t],e.updateComponentAttributes(ge({},i,{numberFormat:r}))},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,library:null==e?void 0:e.library,onViewClick:null==e?void 0:e.onViewClick,renderTableCell:e.renderTableCell,onSizingUpdate:function(t){e.updateComponentAttributes(ge({},i,{sizing:t}))},drilldownInputProps:{component:e.component,runQueriesCallback:e.runQueriesCallback,globalFilters:e.globalFilters},defaultFormats:e.dashboardBehaviour.defaultFormats})):null},$F=function(e,t,n){try{if(!Ko(t,e.attributes.dataSetId))throw new Wi(t,e.attributes.dataSetId);var i=Go(e.attributes.type,{queryEngineConfig:n.queryEngineConfig}).validate(e.attributes,t);return i.length>0&&Ze(i),i[0]}catch(e){if(e instanceof ki)return e;if(e instanceof Wi)return e;if(e instanceof Bi)return e;throw e}},eS=function(e){var t;return e&&0!==e.length?null==(t=e[0])?void 0:t.value:jo.Linear},tS=Object.assign((function(e){var n=e.children,i=e.view,r=e.onWidthChange,o=t.useRef(null),a=t.useState(0),l=a[0],s=a[1];return t.useEffect((function(){var e=new ResizeObserver((function(e){for(var t,n=ve(e);!(t=n()).done;){var i=t.value.contentRect.width;s(i),r(i)}}));return o.current&&e.observe(o.current),function(){e.disconnect()}}),[]),p.jsx("div",{className:""+nS({fullHeight:i===jo.Linear?"true":"false"}),ref:o,children:p.jsx("div",{children:p.jsxs(yf,{direction:i!==jo.Linear?"row":"column",height:"100%",gap:i!==jo.Linear?l/16.8:"1.5rem","data-component":"stat-container",alignItems:i!==jo.Linear?"center":"normal",justifyContent:i!==jo.Linear?"flex-start":"normal",children:[i===jo.Circular&&p.jsx(yf,{justifyContent:"center",alignItems:"center",width:"fit-content",grow:1,gap:l/17,children:n}),i===jo.Linear&&n]})})})}),{Individual:t.forwardRef((function(e,t){return p.jsx("div",{ref:t,children:e.children})})),Single:function(e){return p.jsx(Td,{placeContent:"center","data-component":"stat-single-container",height:"100%",justifyContent:"normal",children:e.children})}}),nS=Fl({width:"100%",variants:{fullHeight:{true:{height:"100%"}}}}),iS=function(e){var n,i=Pu(),r=i.numberFormatOptions,o=i.labelFormat,a=e.results[0],l=t.useState(null),s=l[0],u=l[1];if(t.useEffect((function(){if(a&&e.measure){var t=Ga(a,Ti(e.measure));-1!==t&&u(t)}}),[a,e.measure]),null===s)return null;var d=null==a?void 0:a.content[0][s],c=function(e,t,n,i){var r,o;return al(null==e||null==(r=e.fields[t])?void 0:r.publicName,null==(o=i[n.function])?void 0:o.publicName)}(a,s,e.measure,e.supportedAggregates),f=oy(e.formatter,e.prefixes,e.postfixes,e.measure,d,r),m=f.formattedValue,h=f.prefix,v=f.postfix,g=o({fieldId:e.measure.field,func:e.measure.function,type:"progress",defaultLabel:c,viewId:e.viewId});return p.jsx(pv,{valueNow:d,title:null!=g?g:c,displayValueNow:ay(m,h,v),type:e.progressType,color:["#7F7FD5","#86A8E7"],valueMax:null!=(n=e.valueMax)?n:2*d,showValue:!0,showTitle:e.showTitle,radius:e.progressType===jo.Linear?void 0:e.radius})},rS={type:"progress",measure:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],parameters:{},formatter:{},goals:[],progressType:[],postfixes:{},prefixes:{},tags:[]},oS=function(e){var n,i,r,o,a,l,s,u,d,c={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:e.setPartialAttributes,dataSet:e.dataSet,componentType:null==(i=e)?void 0:i.type,measure:null==(r=e)?void 0:r.measure,viewId:null!=(o=null==(a=e)?void 0:a.viewId)?o:""};if(!Go(e.type).isRunnable(e))return p.jsx(Hg,{title:"Missing parameters",children:$b({measure:e.measure,order:[],dimension:[]})});var f=void 0!==e.results?e.results[0]:void 0;if(Ka(f))return p.jsx(Nf,{});if(Xa(f))return p.jsx(Yg,{});if(Qa(f))return p.jsx(Kg,ge({},c));var m=(e=pl(e,{},rS)).measure.length,h=eS(e.progressType),v=t.useState(0),g=v[0],x=v[1],b=(null!=(l=e.height)?l:350)/2.1;return p.jsxs(Cg,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,id:e.id,children:[p.jsx(wg,ge({},c,{paddingBottom:0})),m>1?p.jsx(uf,{marginY:"0.5rem",children:p.jsx(tS,{noOfValues:m,view:h,onWidthChange:function(e){return x(e)},children:[].concat(e.measure).map((function(t,n){var i,r,o,a,l=e.goals?null==(i=e.goals.filter((function(e){return e.field===Ti(t)}))[0])?void 0:i.value:null;return p.jsx(tS.Individual,{children:p.jsx(iS,{index:n,supportedAggregates:e.supportedAggregates,measure:t,results:e.results,valueMax:l,showTitle:!0,progressType:h,formatter:null==(r=e)?void 0:r.formatter,postfixes:null==(o=e)?void 0:o.postfixes,prefixes:e.prefixes,radius:h===jo.Linear?void 0:b<g?b:g,viewId:null!=(a=e.viewId)?a:""})},n)}))})}):p.jsx(tS.Single,{children:p.jsx(iS,{index:1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],results:e.results,valueMax:e.goals&&e.goals.length>0?e.goals[0].value:null,showTitle:!1,progressType:h,formatter:null==(s=e)?void 0:s.formatter,postfixes:null==(u=e)?void 0:u.postfixes,prefixes:e.prefixes,radius:b+20,viewId:null!=(d=e.viewId)?d:""},1)})]})};oS.defaultProps=rS;var aS=function(e){var t,n=e.component,i=n.results,r=n.attributes,o=$h(r,e.runQueriesCallback,e.setResults,{localFilters:n.localFilters,globalFilters:e.globalFilters},e.dataSet,void 0,e.dashboardBehaviour.variables);return p.jsx(oS,ge({},r,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setPartialAttributes:function(t){return e.setPartialAttributes(t)},results:i,queriesAreChanging:o.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(t=t.queryEngineConfig)?void 0:t.supportedTransformationFunctions,library:null==e?void 0:e.library,height:null==e?void 0:e.height,defaultFormats:e.dashboardBehaviour.defaultFormats}))},lS=function(e){var t=qm().dashboard,n=Pu();if(!e.component.attributes)return null;var i=Go(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig}),r=function(t){return e.updateComponentAttributes(i.setAttributes(e.component.attributes,t))},o=$F(e.component,t.dataSets,n);if(o){if(o instanceof Wi)return p.jsx(zg,{title:"Data set not available."});if(o instanceof Bi)return p.jsx(zg,{title:"This view is no-longer supported."});if(o instanceof ki)return p.jsx(Wg,{removeMissingField:function(){var t=Go(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig});if(o instanceof ki){var i=t.removeField(e.component.attributes,o.getMissingFieldId());e.updateComponentAttributes(i)}}})}var a=fm(t,e.component.attributes.dataSetId);if(e.isBeingSizeAdjusted)return p.jsx(zg,{title:p.jsx(Lf,{color:"#e5e5e5"})});var l=null!=e&&e.editor||null!=e&&e.library?void 0:e.component.colSpan<=2,s=function(i){(0,Go(i.type,n).validate)(i,t.dataSets),e.updateComponentAttributes(i)},u=e.editor?"editor":e.library?"library":"dashboard";if("scatterChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(mw,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,idPrefix:u,setPartialAttributes:r})});if(["horizontalBarChart","barChart"].includes(e.component.attributes.type))return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(ow,{id:e.id,dataSet:a,setLocalFilters:e.setLocalFilters,runQueriesCallback:e.runQueriesCallback,updateComponentAttributes:function(e){return s(e)},component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,onViewClick:n.onViewClick,idPrefix:u,editor:null==e?void 0:e.editor,setPartialAttributes:r})});if("areaChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Sy,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,idPrefix:u,updateComponentAttributes:function(e){return s(e)},setPartialAttributes:r})});if("lineChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(uw,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,updateComponentAttributes:function(e){return s(e)},runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,idPrefix:u,setPartialAttributes:r})});if("lineChartV2"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Uj,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,updateComponentAttributes:function(e){return s(e)},runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library,idPrefix:u,setPartialAttributes:r})});if("pieChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Dw,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library,editor:null==e?void 0:e.editor,setPartialAttributes:r,idPrefix:u})});if("singleStat"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(iF,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library,updateComponentAttributes:function(e){return s(e)},setPartialAttributes:r,idPrefix:u})});if("progress"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(aS,{id:e.id,idPrefix:u,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library,height:e.height,setPartialAttributes:r})});if("dataTable"==e.component.attributes.type||"basicTable"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(JF,{id:e.id,idPrefix:u,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,updateComponentAttributes:function(e){return s(e)},dashboardBehaviour:n,library:null==e?void 0:e.library,onViewClick:n.onViewClick,renderTableCell:n.renderTableCell,setPartialAttributes:r})});if("comboChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Xj,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,idPrefix:u,setPartialAttributes:r})});if("custom"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Ij,{component:e.component})});if("mercatorMap"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(Zj,{id:e.id,idPrefix:u,setLocalFilters:e.setLocalFilters,onPositionChange:function(t){if(!e.library){var i=(0,Go("mercatorMap",n).setAttributes)(e.component.attributes,{position:t});e.updateComponentAttributes(i)}},dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n})});if("funnelChart"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(tF,{id:e.id,dataSet:a,setLocalFilters:e.setLocalFilters,runQueriesCallback:e.runQueriesCallback,updateComponentAttributes:function(e){return s(e)},component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:l,library:null==e?void 0:e.library,onViewClick:n.onViewClick,idPrefix:u,setPartialAttributes:r})});if("richText"==e.component.attributes.type)return p.jsx(ke,{renderOnError:function(e){return p.jsx(Xg,{onManualRetry:e})},onError:n.onError,children:p.jsx(nF,{id:e.id,idPrefix:u,editor:e.editor,setLocalFilters:e.setLocalFilters,dataSet:a,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library,updateComponentAttributes:function(e){return s(e)},setPartialAttributes:r})});throw"Unsupported component in generic component wrapper. "+e.component.attributes.type},sS=function(e){var n=Pu(),i=n.maxCSVDownloadLimit,r=n.textOverride,o=n.featureToggles,a=t.useState(function(e){return e.canDownloadDataSet&&e.canDownloadViewData?"data-set-download-type":e.canDownloadViewData&&!e.canDownloadDataSet?"view-download-type":e.canDownloadDataSet&&!e.canDownloadViewData?"data-set-download-type":e.canDownloadDataSet||e.canDownloadViewData||!e.canDownloadViewAsPNG?void 0:"view-as-png"}(o)),l=a[0],s=a[1],u=t.useState("csv"),d=u[0],c=u[1],f=[],m=p.jsx(ij,{options:[{label:r("csv","CSV (.csv)"),value:"csv"},{label:r("xlsx","Excel (.xlsx)"),value:"xlsx"}],name:"file-format",label:r("select_file_format","Select File Format"),selected:d,labelHidden:!0,onChange:function(e){return c(e)}});if(o.canDownloadViewAsPNG&&f.push({label:r("view_as_png","Image"),value:"view-as-png",description:r("view_as_png_description","Download this view as an image (PNG).")}),o.canDownloadViewData&&f.push({label:r("view_data_set","Visible data set"),value:"view-download-type",description:r("view_data_set_description","Download the data shown in this view."),children:m}),o.canDownloadDataSet){var h=i&&"number"==typeof i?r("full_data_set_desription","Download all available data (up to [[maxCSVDownloadLimit]] rows).",{maxCSVDownloadLimit:i.toLocaleString()}):"";f.push({label:r("full_data_set","Full data set"),value:"data-set-download-type",description:h,children:m})}return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[p.jsx(Mh.Header,{title:r("data_download","Download"),show:!0}),p.jsxs(Mh.Content,{children:[f.length>1?p.jsx(ij,{options:f,name:"download-type",label:r("select_download_type","Select Download Type"),selected:l,labelHidden:!0,onChange:function(e){return s(e)}}):1===f.length&&p.jsx("p",{className:""+Ql.my(0),children:f[0].description}),0===f.length&&p.jsx(Hy,{children:r("data_download.not_enabled","Downloads for this view have not been made available")})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:r("cancel","Cancel")}),p.jsx(gh,{primary:!0,onClick:function(){l&&e.onDownload({downloadType:l,fileFormat:d,overrideId:null==e?void 0:e.overrideId}),null==e||e.onClose(!0)},disabled:0===f.length,testId:"download-button",children:r("download","Download")})]})})]})};function uS(e){return{purpose:"addRowAbove",renderIcon:function(){return p.jsx(Fs,{})},onClick:function(){e&&e()},testId:"add-row-above"}}function dS(e,t){return(null==e?void 0:e.rowLimit)&&t.length<(null==e?void 0:e.rowLimit)}var cS=Yu((function(e){var t=Pu().textOverride,n=e.onClose,i={editComponentsOnDashboard:t("edit_components_on_dashboard","Edit"),editComponentsOnLibrary:t("edit_components_on_library","Edit"),downloadComponentData:t("download","Download"),increaseColSpan:t("merge","Merge"),decreaseColSpan:t("unmerge","Unmerge"),removeComponentFromLibrary:t("remove_component_from_library","Remove"),removeComponentFromGlobalLibrary:t("remove_component_from_global_library","Delete"),removeComponentFromDashboard:t("remove_component_from_dashboard","Remove"),removeCellFromDashboard:t("remove_cell_from_dashboard","Remove"),parameters:t("add_parameters","Add Parameters"),localFilter:t("add_local_filters","Add Local Filters"),addComponentToLibrary:t("add_to_library","Add to Library"),clickSettings:t("click_settings","Click Settings"),viewRawResults:t("view_raw_results","JSON Results"),viewRawAttributes:t("view_view_attributes","JSON Attributes"),addTags:t("view_add_tags","Add Tags"),presentView:t("view_fullscreen","View Fullscreen"),addRowAbove:t("add_row_above","Insert Row Above")};return p.jsx(cf.Options,{children:p.jsx("div",{children:e.cellOptions.map((function(e,t){return p.jsxs(cf.Option,{"data-testid":e.testId,onChange:function(){e.onClick(),n()},children:[e.renderIcon&&e.renderIcon(),p.jsx("span",{children:i[e.purpose]||""})]},"option_"+t+"_"+e.purpose+e.testId)}))})})}),"renderComponentOptions"),pS=function(e){var t=Pu().textOverride,n=ff(),i=n.ref,r=n.open,o=n.position,a=n.show,l=n.close,s=Dd();return p.jsxs("div",{className:es({position:"absolute",right:"-20px",top:"0"}),ref:i,children:[p.jsx("button",{"data-testid":"open-component-options","aria-label":null!=e&&e.chartLabel?t("cell_options","Options")+": "+(null==e?void 0:e.chartLabel):t("cell_options","Options"),onClick:function(){r()},className:px(null==s?void 0:s.dashboard)+" "+Ql.button,"data-themeapi":"dashboard.icon",children:p.jsx(rd,{})}),a&&p.jsx(cf,{onClose:function(){return l()},position:o,children:p.jsx(cS,{onClose:function(){return r()},cellOptions:e.cellOptions})})]})},fS=function(e){var n,i=t.useState(!1),o=i[0],a=i[1],l=qm().dashboard,s=Dd(),u=Pu(),d=Go(e.component.attributes.type),c=$F(e.component,l.dataSets,u),f=Ko(l.dataSets,e.component.attributes.dataSetId),m=[],h="custom"===e.component.attributes.type;return!e.canEditComponentsOnDashboard||c instanceof ki||m.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return p.jsx(vS,{})},onClick:function(){return e.onEdit()},testId:"edit"}),e.canDownloadComponentData&&!h&&m.push({purpose:"downloadComponentData",renderIcon:function(){return p.jsx(id,{})},onClick:function(){return a(!0)},testId:"download"}),e.canShowFullscreen&&!h&&m.push({purpose:"presentView",renderIcon:function(){return p.jsx(jd,{})},onClick:function(){return e.onShowFullscreen()},testId:"view_fullscreen"}),u.featureToggles.canConfigureLocalFilters&&!h&&m.push({purpose:"localFilter",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(Uu,{active:!1})})},onClick:function(){return e.onAddFilter()},testId:"filterBy"}),!u.featureToggles.parameters||null==(n=d.supportedFeatures)||!n.parameters||"read_write"!==u.scope||null!=f&&f.preAggregated||h||m.push({purpose:"parameters",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(Xu,{})})},onClick:function(){return e.onSetParameters()},testId:"parameters"}),e.canViewRawJSONResults&&!h&&m.push({purpose:"viewRawResults",renderIcon:function(){return p.jsx(Sd,{})},onClick:function(){return e.onViewRawJSONResults()},testId:"view-raw-results"}),e.canViewRawViewAttributes&&!h&&m.push({purpose:"viewRawAttributes",renderIcon:function(){return p.jsx(Sd,{})},onClick:function(){return e.onViewRawAttributes()},testId:"view-view-attributes"}),"read_write"===u.scope&&u.featureToggles.canEditComponentLibrary&&!h&&m.push({purpose:"addComponentToLibrary",renderIcon:function(){return p.jsx(gS,{})},onClick:function(){return e.onAddToLibrary()},testId:"add-to-library"}),"read_write"===u.scope&&dS(s,l.display)&&m.push(uS((function(){return e.onInsertRowAbove()}))),e.canRemoveComponentsFromDashboard&&m.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return p.jsx(hS,{})},onClick:function(){return e.onRemove()},testId:"remove"}),r.isEmpty(m)?null:p.jsxs(p.Fragment,{children:[p.jsx(pS,{cellOptions:m,chartLabel:null==e?void 0:e.chartLabel}),p.jsx(sS,{onDownload:e.onDownload,show:o,onClose:function(){return a(!1)}})]})},mS=function(e){var t=Pu(),n=t.featureToggles,i=t.scope,o=Dd(),a=[];return"read_write"===i&&e.display&&dS(o,e.display)&&a.push(uS((function(){return e.onInsertRowAbove()}))),n.canRemoveComponentsFromDashboard&&(a=[].concat(a,[{purpose:"removeCellFromDashboard",renderIcon:function(){return p.jsx($u,{purpose:"removeCellFromDashboard"})},onClick:function(){return e.onRemoveCell()},testId:"deleteCell"}])),r.isEmpty(a)?null:p.jsx(pS,{chartLabel:e.chartLabel,cellOptions:a})},hS=function(){return p.jsx($u,{purpose:"removeComponentFromDashboard"})},vS=function(){return p.jsx(td,{})},gS=function(){return p.jsx(ed,{fill:"currentColor"})},xS=function(e,t,n){return Fl(ge({transform:t?"translate3d(0, 0, 0)":void 0,position:"relative",height:"100%",width:null!=n?n:"100%"},e))},bS=n.forwardRef((function(e,t){var n,i,r=e.transform,o=void 0===r||r,a=Dd();return p.jsx("div",{role:null==e?void 0:e.role,"data-testid":null==e?void 0:e.testId,className:kd(null==e?void 0:e.vizzlyPrefix,""+xS(ge({},null==a?void 0:a.panels,{padding:null!=(n=null==e?void 0:e.padding)?n:null==a||null==(i=a.panels)?void 0:i.padding}),o,null==e?void 0:e.width)),ref:t,"data-themeapi":"panels","data-chipposition":"top.left",onMouseOver:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!0))},onMouseLeave:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!1))},"data-component":e["data-component"],children:null==e?void 0:e.children})})),yS=function(e){var t,n=Pu().textOverride;return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[p.jsx(Mh.Header,{title:n("are_you_sure","Are you sure?"),show:!0}),p.jsx(Mh.Content,{children:p.jsx(uf,{paddingY:8,children:e.message})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{testId:"modal-cancel-delete-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:n("cancel","Cancel")}),p.jsx(gh,{testId:"modal-confirm-delete-btn",primary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},disabled:null==e?void 0:e.disabledDelete,children:null!=(t=e.deleteButtonLabel)?t:n("delete","Delete")})]})})]})},wS=Object.assign((function(){return null}),{emptyCell:function(e){return Fl({position:"relative",height:"100%",borderRadius:null==e?void 0:e.borderRadius,borderColor:null==e?void 0:e.borderColor,borderWidth:null==e?void 0:e.borderWidth,borderStyle:null==e?void 0:e.borderStyle})}}),CS=function(e){var t=e.component.localFilters||[],n=qm().dashboard,i=fm(n,e.component.attributes.dataSetId);return i?(i.preAggregated&&(i=fm(n,i.preAggregated[0])),p.jsx(Bw,{dataSets:[i],filters:t,show:null==e?void 0:e.show,onUpdate:function(n){var i=Ww(t,n);null==e||e.setLocalFilters(i)},source:"local",onDeleteItem:function(n){var i=[].concat(t);i.splice(n,1),null==e||e.setLocalFilters(i)},onClose:function(){return null==e?void 0:e.onClose()}})):null},jS=function(e){var t;return p.jsxs("svg",{height:null!=(t=null==e?void 0:e.height)?t:"535",viewBox:"0 0 1541 535",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("rect",{x:"1068",y:"287",width:"11",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),p.jsx("rect",{x:"1152",y:"259",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),p.jsx("rect",{x:"1232",y:"95",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),p.jsx("rect",{x:"1348",y:"256",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),p.jsx("rect",{x:"532",y:"312",width:"16",height:"15",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"4"}),p.jsx("rect",{x:"326",y:"197",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),p.jsx("rect",{x:"508.5",y:"56.5",width:"11",height:"3",rx:"1.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"3"}),p.jsx("rect",{x:"242",y:"236",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),p.jsx("rect",{x:"249",y:"302",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),p.jsx("rect",{x:"203.25",y:"139.25",width:"2.5",height:"10.5",rx:"1.25",stroke:null==e?void 0:e.color,strokeOpacity:"0.22",strokeWidth:"2.5"}),p.jsx("rect",{x:"160",y:"88",width:"16",height:"14",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.3",strokeWidth:"4"}),p.jsx("rect",{x:"1203",y:"266",width:"120",height:"117",rx:"16",fill:"url(#paint0_linear_7_421)",fillOpacity:"0.2"}),p.jsx("rect",{x:"1205.5",y:"268.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("path",{d:"M1205 299H1321",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("rect",{x:"377",y:"177",width:"120",height:"117",rx:"16",fill:"url(#paint1_linear_7_421)"}),p.jsx("rect",{x:"379.5",y:"179.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("path",{d:"M379 210H495",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsxs("g",{clipPath:"url(#clip0_7_421)",children:[p.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"#E7EAF1"}),p.jsx("rect",{x:"730",y:"116",width:"337.5",height:"239.708",rx:"8",fill:"#F3F5F9"}),p.jsx("g",{filter:"url(#filter0_d_7_421)",children:p.jsx("rect",{x:"741.926",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"})}),p.jsxs("g",{filter:"url(#filter1_d_7_421)",children:[p.jsx("rect",{x:"828.984",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"}),p.jsx("rect",{x:"829.484",y:"128.426",width:"77.7103",height:"65.7845",rx:"5.4629",stroke:null==e?void 0:e.color})]}),p.jsx("path",{d:"M888.611 160.721C888.611 172.247 879.267 181.591 867.741 181.591C856.214 181.591 846.871 172.247 846.871 160.721C846.871 149.195 856.214 139.851 867.741 139.851C879.267 139.851 888.611 149.195 888.611 160.721ZM855.661 160.721C855.661 167.393 861.069 172.801 867.741 172.801C874.412 172.801 879.821 167.393 879.821 160.721C879.821 154.049 874.412 148.641 867.741 148.641C861.069 148.641 855.661 154.049 855.661 160.721Z",fill:null==e?void 0:e.color}),p.jsx("path",{d:"M867.741 139.851C862.912 139.851 858.233 141.525 854.501 144.588C850.768 147.651 848.214 151.914 847.272 156.65C846.33 161.385 847.059 166.301 849.335 170.559C851.611 174.817 855.293 178.155 859.754 180.003C864.215 181.85 869.179 182.094 873.799 180.693C878.42 179.291 882.411 176.331 885.094 172.316C887.776 168.301 888.984 163.481 888.51 158.675C888.037 153.87 885.912 149.378 882.498 145.964L876.283 152.179C878.259 154.155 879.489 156.756 879.763 159.537C880.037 162.318 879.338 165.109 877.785 167.432C876.232 169.756 873.922 171.47 871.247 172.281C868.573 173.092 865.7 172.951 863.118 171.882C860.536 170.812 858.405 168.88 857.087 166.416C855.77 163.951 855.348 161.105 855.893 158.364C856.438 155.623 857.917 153.156 860.077 151.383C862.238 149.61 864.946 148.641 867.741 148.641L867.741 139.851Z",fill:null==e?void 0:e.color}),p.jsx("path",{d:"M867.741 139.851C864.309 139.851 860.929 140.697 857.903 142.315C854.876 143.933 852.295 146.273 850.388 149.126C848.481 151.98 847.308 155.26 846.971 158.675C846.635 162.091 847.146 165.537 848.459 168.708C849.773 171.879 851.848 174.677 854.501 176.854C857.154 179.031 860.303 180.521 863.669 181.19C867.035 181.86 870.515 181.689 873.799 180.693C877.083 179.696 880.071 177.905 882.498 175.479L876.283 169.263C874.878 170.668 873.148 171.704 871.247 172.281C869.346 172.858 867.332 172.957 865.384 172.569C863.436 172.181 861.613 171.319 860.077 170.059C858.542 168.799 857.34 167.179 856.58 165.344C855.82 163.509 855.524 161.514 855.719 159.537C855.914 157.56 856.593 155.662 857.697 154.01C858.8 152.358 860.294 151.004 862.046 150.067C863.798 149.131 865.754 148.641 867.741 148.641L867.741 139.851Z",fill:"#D9FFE8"}),p.jsx("g",{filter:"url(#filter2_d_7_421)",children:p.jsx("path",{d:"M916.042 133.889C916.042 130.595 918.712 127.926 922.005 127.926H1048.42C1051.71 127.926 1054.38 130.595 1054.38 133.889V262.687C1054.38 265.98 1051.71 268.65 1048.42 268.65H922.005C918.712 268.65 916.042 265.98 916.042 262.687V133.889Z",fill:"white"})}),p.jsx("path",{d:"M945.857 189.636C946.367 187.861 951.979 177.805 956.061 184.312C960.142 190.819 965.244 198.509 968.816 192.593C972.387 186.678 975.958 169.523 980.55 173.664C985.142 177.805 989.223 172.481 992.795 164.791C996.366 157.101 1000.45 158.284 1004.02 167.157C1007.59 176.03 1009.12 181.946 1015.24 181.946C1021.37 181.946 1023.92 189.044 1028.51 186.678C1032.18 184.785 1038.54 162.622 1041.26 151.777",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),p.jsx("path",{d:"M956.061 184.312C951.979 177.805 946.367 187.861 945.857 189.636V240.028H1041.26V151.777C1038.54 162.622 1032.18 184.785 1028.51 186.678C1023.92 189.044 1021.37 181.946 1015.24 181.946C1009.12 181.946 1007.59 176.03 1004.02 167.157C1000.45 158.284 996.366 157.101 992.795 164.791C989.223 172.481 985.142 177.805 980.55 173.664C975.958 169.523 972.387 186.678 968.816 192.593C965.244 198.509 960.142 190.819 956.061 184.312Z",fill:"url(#paint2_linear_7_421)"}),p.jsx("g",{filter:"url(#filter3_d_7_421)",children:p.jsx("rect",{x:"741.926",y:"203.058",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),p.jsx("g",{filter:"url(#filter4_d_7_421)",children:p.jsx("rect",{x:"741.926",y:"278.191",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),p.jsx("path",{d:"M749.081 337.82C775.101 330.469 781.606 307.366 802.422 306.316C823.238 305.266 832.345 323.118 840.151 319.967C847.957 316.817 862.268 279.012 892.191 300.015",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),p.jsx("path",{d:"M750.274 337.82C755.048 335.681 765.637 329.264 769.804 320.709C775.012 310.014 784.126 300.389 795.844 314.292C807.561 328.195 817.977 339.959 829.695 312.153C841.413 284.347 851.829 292.903 860.943 305.736C870.057 318.57 877.869 338.889 892.191 318.57",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),p.jsx("g",{filter:"url(#filter5_d_7_421)",children:p.jsx("rect",{x:"916.042",y:"278.191",width:"138.339",height:"66.7845",rx:"5.9629",fill:"white"})}),p.jsx("path",{d:"M764.015 167.45C763.28 167.45 762.601 167.361 761.978 167.183C761.354 167.005 760.798 166.76 760.308 166.448C759.83 166.136 759.429 165.775 759.106 165.363L760.375 163.86C760.62 164.239 760.937 164.567 761.327 164.845C761.716 165.112 762.156 165.324 762.646 165.48C763.135 165.624 763.636 165.697 764.148 165.697C764.827 165.697 765.362 165.585 765.751 165.363C766.141 165.14 766.335 164.812 766.335 164.378C766.335 164.099 766.224 163.86 766.002 163.66C765.79 163.459 765.417 163.298 764.883 163.176L762.545 162.641C761.922 162.497 761.388 162.296 760.943 162.04C760.497 161.784 760.158 161.473 759.924 161.105C759.702 160.727 759.59 160.293 759.59 159.803C759.59 159.157 759.763 158.584 760.108 158.083C760.464 157.582 760.965 157.182 761.61 156.881C762.267 156.581 763.057 156.43 763.981 156.43C764.95 156.43 765.801 156.597 766.536 156.931C767.27 157.265 767.894 157.76 768.406 158.417L767.204 159.803C766.758 159.235 766.263 158.823 765.718 158.567C765.183 158.3 764.555 158.167 763.831 158.167C763.341 158.167 762.941 158.228 762.629 158.35C762.317 158.462 762.084 158.617 761.928 158.818C761.783 159.018 761.711 159.246 761.711 159.502C761.711 159.703 761.755 159.886 761.844 160.053C761.933 160.209 762.1 160.348 762.345 160.471C762.601 160.593 762.963 160.71 763.43 160.821L765.434 161.272C766.48 161.506 767.232 161.851 767.688 162.307C768.155 162.753 768.389 163.348 768.389 164.094C768.389 164.806 768.205 165.413 767.838 165.914C767.471 166.415 766.953 166.799 766.285 167.066C765.629 167.322 764.872 167.45 764.015 167.45ZM763.23 169.002V154.911H764.783V169.002H763.23ZM771.992 167.466V160.487C771.992 160.231 771.992 159.97 771.992 159.703C772.003 159.424 772.014 159.141 772.025 158.851C771.647 159.196 771.224 159.497 770.756 159.753C770.289 160.009 769.81 160.187 769.321 160.287L769.02 158.35C769.276 158.328 769.56 158.256 769.872 158.133C770.194 158 770.517 157.844 770.84 157.666C771.174 157.477 771.474 157.282 771.742 157.081C772.02 156.87 772.231 156.658 772.376 156.447H774.246V167.466H771.992ZM777.502 164.912C777.947 164.912 778.298 165.034 778.554 165.279C778.821 165.524 778.954 165.852 778.954 166.264C778.954 166.687 778.821 167.021 778.554 167.266C778.298 167.5 777.947 167.617 777.502 167.617C777.057 167.617 776.701 167.5 776.433 167.266C776.177 167.021 776.049 166.687 776.049 166.264C776.049 165.852 776.177 165.524 776.433 165.279C776.701 165.034 777.057 164.912 777.502 164.912ZM778.199 156.447H786.931V158.2C786.007 159.124 785.272 160.076 784.727 161.055C784.182 162.035 783.786 163.053 783.541 164.111C783.308 165.168 783.191 166.287 783.191 167.466H780.904C780.904 166.242 781.054 165.068 781.354 163.944C781.666 162.808 782.139 161.729 782.773 160.705C783.419 159.669 784.237 158.679 785.228 157.733L785.695 158.334H778.199V156.447ZM800.402 156.447V167.466H798.315V161.723L798.431 158.501H798.398L795.343 167.466H793.456L790.417 158.501H790.384L790.501 161.723V167.466H788.414V156.447H791.753L793.74 162.458L794.441 164.945H794.474L795.192 162.474L797.163 156.447H800.402Z",fill:"#374151"}),p.jsx("rect",{x:"749.081",y:"210.214",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"749.081",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"150.585",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"168.474",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"186.362",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"204.251",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"222.14",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"923.198",y:"240.028",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"941.087",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"964.938",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),p.jsx("rect",{x:"769.355",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"769.355",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"943.472",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"943.472",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"970.901",y:"285.346",width:"8.34806",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"797.977",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),p.jsx("rect",{x:"752.659",y:"234.065",width:"5.9629",height:"27.4293",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"763.392",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"774.125",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"784.859",y:"235.258",width:"5.9629",height:"26.2367",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"795.592",y:"247.184",width:"5.9629",height:"14.311",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"806.325",y:"241.221",width:"5.9629",height:"20.2739",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"817.058",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"827.792",y:"244.799",width:"5.9629",height:"16.6961",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"838.525",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"849.258",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"859.991",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"870.724",y:"231.68",width:"5.9629",height:"29.8145",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"881.458",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"892.191",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"923.198",y:"298.465",width:"82.288",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),p.jsx("rect",{x:"923.198",y:"313.968",width:"26.2367",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),p.jsx("rect",{x:"923.198",y:"329.472",width:"52.4735",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),p.jsx("rect",{x:"923.198",y:"304.427",width:"118.065",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"923.198",y:"319.931",width:"85.8657",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),p.jsx("rect",{x:"923.198",y:"335.435",width:"70.3622",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),p.jsxs("g",{filter:"url(#filter6_d_7_421)",children:[p.jsx("rect",{x:"594",y:"81",width:"155",height:"172",rx:"8",fill:"white"}),p.jsx("rect",{x:"594.5",y:"81.5",width:"154",height:"171",rx:"7.5",stroke:null==e?void 0:e.color})]}),p.jsx("rect",{x:"614",y:"223",width:"116",height:"17",rx:"3",fill:"#F3F5F9"}),p.jsx("rect",{x:"614",y:"103",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),p.jsx("rect",{x:"614",y:"209",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),p.jsx("rect",{x:"614",y:"122",width:"115",height:"3",rx:"1.5",fill:"#D9FFE8"}),p.jsx("rect",{x:"614",y:"122",width:"58",height:"3",rx:"1.5",fill:"#151515"}),p.jsx("circle",{cx:"673",cy:"123",r:"6",fill:"#151515"}),p.jsx("rect",{x:"614",y:"153",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),p.jsx("rect",{x:"614",y:"167",width:"16",height:"16",fill:"#151515"}),p.jsx("rect",{x:"714",y:"167",width:"16",height:"16",fill:"#F3F5F9"}),p.jsx("rect",{x:"639",y:"167",width:"16",height:"16",fill:"#374151"}),p.jsx("rect",{x:"661.5",y:"164.5",width:"21",height:"21",fill:null==e?void 0:e.color,stroke:"#151515"}),p.jsx("rect",{x:"689",y:"167",width:"16",height:"16",fill:"#D9FFE8"}),p.jsx("path",{d:"M674.157 178.471L674.157 178.471L674.159 178.477L689.023 218.322L689.024 218.322C689.212 218.826 689.552 219.258 689.997 219.558C690.443 219.859 690.971 220.013 691.508 219.999C692.045 219.985 692.564 219.803 692.993 219.479C693.422 219.155 693.738 218.706 693.9 218.193L693.902 218.186L697.67 205.899L710.895 218.839C710.896 218.84 710.898 218.841 710.899 218.842C711.381 219.322 712.034 219.591 712.715 219.591C713.397 219.591 714.051 219.32 714.534 218.839L714.537 218.837L718.249 215.115L718.251 215.113C718.731 214.629 719 213.974 719 213.293C719 212.611 718.731 211.956 718.251 211.472L718.245 211.466L718.24 211.461L705.081 198.603L717.11 194.872L717.126 194.867L717.142 194.861C717.649 194.685 718.089 194.355 718.399 193.918C718.71 193.48 718.877 192.957 718.877 192.42C718.877 191.884 718.71 191.36 718.399 190.922C718.091 190.488 717.656 190.16 717.154 189.983L677.486 175.165C677.485 175.164 677.485 175.164 677.485 175.164C677.022 174.991 676.52 174.954 676.038 175.058C675.555 175.162 675.112 175.402 674.762 175.751C674.412 176.099 674.169 176.54 674.062 177.022C673.955 177.504 673.988 178.007 674.157 178.471Z",fill:"black",stroke:"#E7EAF1",strokeWidth:"2"})]}),p.jsx("rect",{x:"217",y:"77",width:"96",height:"99",rx:"16",fill:"url(#paint3_linear_7_421)",fillOpacity:"0.2"}),p.jsx("rect",{x:"219.5",y:"79.5",width:"91",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("path",{d:"M218.5 104.5H311",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("rect",{x:"1064",y:"69",width:"105",height:"99",rx:"16",fill:"url(#paint4_linear_7_421)",fillOpacity:"0.2"}),p.jsx("rect",{x:"1066.5",y:"71.5",width:"100",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("rect",{x:"1011",y:"218",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),p.jsx("rect",{x:"1442",y:"227",width:"19",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),p.jsx("rect",{x:"1269",y:"130",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),p.jsx("rect",{x:"420",y:"111",width:"18",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.28",strokeWidth:"4"}),p.jsx("path",{d:"M1066 97H1167",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("rect",{x:"69",y:"193",width:"73",height:"72",rx:"16",fill:"url(#paint5_linear_7_421)",fillOpacity:"0.2"}),p.jsx("rect",{x:"71.5",y:"195.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("path",{d:"M70 213H141",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("rect",{x:"1399",y:"116",width:"73",height:"72",rx:"16",fill:"url(#paint6_linear_7_421)"}),p.jsx("rect",{x:"1401.5",y:"118.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsx("path",{d:"M1400 136H1471",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),p.jsxs("defs",{children:[p.jsxs("filter",{id:"filter0_d_7_421",x:"737.155",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter1_d_7_421",x:"824.214",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter2_d_7_421",x:"911.272",y:"123.155",width:"147.88",height:"150.265",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter3_d_7_421",x:"737.155",y:"198.288",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter4_d_7_421",x:"737.155",y:"273.42",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter5_d_7_421",x:"911.272",y:"273.42",width:"147.88",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("filter",{id:"filter6_d_7_421",x:"580",y:"67",width:"183",height:"200",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"7"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),p.jsxs("linearGradient",{id:"paint0_linear_7_421",x1:"1206.5",y1:"324",x2:"1319.5",y2:"324",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint1_linear_7_421",x1:"492",y1:"231.5",x2:"380.5",y2:"230.5",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.2"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint2_linear_7_421",x1:"993.56",y1:"151.777",x2:"993.56",y2:"240.028",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.72"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint3_linear_7_421",x1:"310.5",y1:"126",x2:"219.5",y2:"126",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint4_linear_7_421",x1:"1066.5",y1:"117",x2:"1164",y2:"118",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),p.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint5_linear_7_421",x1:"138",y1:"229",x2:"74",y2:"229",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsxs("linearGradient",{id:"paint6_linear_7_421",x1:"1404",y1:"152",x2:"1467.5",y2:"152",gradientUnits:"userSpaceOnUse",children:[p.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.19"}),p.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),p.jsx("clipPath",{id:"clip0_7_421",children:p.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"white"})})]})]})},FS=function(e){var t;return p.jsxs(yf,{justifyContent:"center",direction:"column",alignItems:"center",height:"100%","data-component":"empty-state",children:[p.jsx(jS,{height:null!=(t=e.height)?t:160,color:null==e?void 0:e.illustrationColor}),p.jsxs(yf,{direction:"column",gap:"1rem",alignItems:"center",children:[p.jsx(uf,{className:""+SS,children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&p.jsx(uf,{children:null==e?void 0:e.children})]})]})},SS=Fl({fontSize:16,fontWeight:500}),kS={group:void 0,measure:void 0},AS=function(e,t){if(!e.group&&!e.measure&&!t)return!0},TS=function(e,t,n){var i,r=null==(i=n[e])?void 0:i[0];if(!r)return t;var o=t.findIndex((function(e){return e.field===r.field}));return-1!==o&&(t[o]={field:e,function:"none"}),t};function _S(e,t){var n=[],i=[],r=!1,o=!1;return e.forEach((function(e){var t={value:e.id,label:e.name,subText:e.description};e.preAggregated?(r=!0,i.push(t)):(o=!0,n.push(t))})),r&&o?(n.unshift({label:t("dataSets.data","Data"),title:!0,value:""}),i.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""})):r&&i.unshift({label:t("dataSets.defined_views","Defined views"),title:!0,value:""}),[].concat(n,i)}var IS=function(e){var t=e.dataSets,n=e.setDataSet,i=Pu().textOverride;return p.jsxs(p.Fragment,{children:[t.length>1&&p.jsx(im,{children:p.jsx(nm,{label:i("dataset","Dataset"),labelHidden:!0,id:"select-data-set",testId:"select-data-set",anchorLeft:!0,placeholder:i("dataset","Dataset"),onChange:n,selected:e.dataSet.id,options:_S(t,i),dynamicWidth:!0})}),e.dataSet.preAggregated&&p.jsx(uf,{paddingX:0,paddingTop:16,children:p.jsx(Hy,{icon:p.jsx(p.Fragment,{}),type:"info",children:i("pre-aggregated_data_set_description","Please note; this data set is pre-aggregated, therefore customization options on the data panel are limited.")})})]})},DS=function(e,t,n,i){var r,o=[].concat(n);return o.splice(i,1),(r={})[e]=t(o),r},OS=function(e,t,n){var i=[].concat(e),r=e[t];return i[t]=e[n],i[n]=r,i},ES=function(e){var t=Pu(),n=t.textOverride,i=t.organizationName;return p.jsxs(Mh,{width:"sm","data-testid":"cannot-delete-modal",isOpen:!0,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:n("field_protected","Field Protected"),show:!0}),p.jsx(Mh.Content,{children:p.jsx("p",{children:i?n("cannot_delete_modal_content_with_org_name","This field has been protected by [[organizationName]] and cannot be removed.",{organizationName:i}):n("cannot_delete_modal_content_without_org_name","This field has been protected by the administrator and cannot be removed.")})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsx(hh,{children:p.jsx(gh,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:n("close","Close")})})})]})},LS=function(e){var n,i,o,a=t.useState(!1),l=a[0],s=a[1],u=e.propKey||"dimension",d=e.dataSet,c=e.attributes[u]||[],f=[].concat(c).map((function(e,t){var n=Qo(d,e.field);return{title:n.publicName,icon:n.dataType,id:"dimension_"+t}})),m=[].concat(Uo(d.fields,null!=(n=e.filterFieldOptions)?n:{onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})),h=lt(m,[].concat(c)),v=[].concat(h).map((function(e){return{title:e.publicName,icon:e.dataType,value:e.id}})),g=Pu();return p.jsxs(t.Fragment,{children:[p.jsx(jx,{mode:g.mode,testId:null!=(i=null==e?void 0:e.testId)?i:"add-dimension",onDeleteItem:e.dataSet.preAggregated?void 0:function(t){var n,i=[].concat(c);i.splice(t,1),e.setPartialAttributes(((n={})[u]=i,n))},onOrderChange:e.allowsMultiple?function(t,n){var i=OS([].concat(c),t,n);e.setPartialAttributes({dimension:i})}:void 0,newItem:{callToAction:null!=(o=null==e?void 0:e.label)?o:(0,g.textOverride)("add_comparison","Add comparison"),onNew:function(t){var n,i=[].concat(c,[{field:t,function:"none"}]);e.setPartialAttributes(((n={})[u]=i,n))},initValues:v,hide:!!e.dataSet.preAggregated||r.isEmpty(h)||!e.allowsMultiple&&!r.isEmpty(e.attributes[u])},items:e.filterOptions?e.filterOptions(f):f,purpose:"dimension"}),l&&p.jsx(ES,{onClose:function(){return s(!1)}})]})},NS=function(e){var t,n,i,o=e.dataSet,a=e.setPartialAttributes,l=e.allow,s=r.isArray(n=(null==e?void 0:e.attributes).timeDimensions)?n:n?[n]:[],u=(i=[],[].concat(s).map((function(t,n){var r,l,u,d=Qo(o,t.field),c=null!=e&&e.onNewMeasureFilterTruncFunctions?e.onNewMeasureFilterTruncFunctions(d):e.supportedTimeDimensions,p="date_time"==d.dataType?(r=d.allowedGranularities,l=e.supportedTimeDimensions,u=Object.keys(l),[].concat(u).flatMap((function(e){return r.includes(e)?[{value:e,label:l[e].publicName}]:[]}))):void 0,f=p?{onChange:function(e,t){!function(e,t){var n=[].concat(s);n[t]=ge({},n[t],{truncate:e}),a({timeDimensions:n})}(e,t)},options:MS(p,c),selected:t.truncate}:void 0;i.push({title:Qo(o,t.field).publicName,icon:"date_time",value:t.field,select:f,id:"time_dimension_"+n})})),i),d=Uo(o.fields,{onlyFieldTypes:["date_time"]}).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),c=!!l&&s.length===l,f=Pu();return p.jsx(jx,{mode:f.mode,testId:"time-dimension",onOrderChange:l?void 0:function(e,t){var n=OS([].concat(s),e,t);a({timeDimensions:n})},onDeleteItem:function(e){var t=[].concat(s);t.splice(e,1),a({timeDimensions:t})},newItem:{callToAction:null!=(t=null==e?void 0:e.label)?t:(0,f.textOverride)("add_time_dimension","Add time dimension"),onNew:function(e){var t=[].concat(s,[{field:e.id,truncate:Object.keys(vt)[0]}]);a({timeDimensions:t})},initValues:d,hide:c},items:e.filterOptions?e.filterOptions(u):u,purpose:"time-dimension"})};function MS(e,t){return e.filter((function(e){return t.hasOwnProperty(e.value)}))}var RS=function(e){var n,i,o,a,l=t.useState(!1),s=l[0],u=l[1],d=e.propKey||"measure",c=(o=!!e.allowsMultiple,function(e){var t;return o?e:null!=(t=e[0])?t:null}),f=e.setPartialAttributes,m=e.dataSet,h=e.supportedAggregates,v=e.attributes,g=r.isArray(a=v[d])?a:a?[a]:[],x=function(e,t,n,i){return[].concat(e).map((function(e,i){var r=Qo(t,e.field),o={onChange:function(e,t){!function(e,t){!function(e,t,n){var i,r,o=[].concat(g);o[n]=ge({},o[n],((i={}).function=t,i)),f(((r={})[d]=c(o),r))}(0,e,t)}(e,t)},options:function(e,t){var n=it(e,t);return[].concat(n).map((function(e){return{value:e,label:t[e].publicName}}))}(r,n),selected:e.function};return{title:r.publicName,icon:r.dataType,value:e.field,select:fn(r)||"none"===e.function?void 0:o,id:"field_"+i}}))}(g,m,h),b=[].concat(Uo(m.fields,e.fieldFilterOptions)).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}})),y=Pu(),w=y.mode,C=y.textOverride,j=!1;return e.allowsMultiple||(j=!e.allowsMultiple&&!!v[d]),r.isArray(v[d])&&e.maxAllowed&&e.maxAllowed<=v[d].length&&(j=!0),e.dataSet.preAggregated&&(j=!0),p.jsxs(t.Fragment,{children:[p.jsx(jx,{mode:w,onOrderChange:e.allowsMultiple?function(e,t){var n,i=OS([].concat(g),e,t);f(((n={})[d]=c(i),n))}:void 0,onDeleteItem:e.disableRemove||e.dataSet.preAggregated?void 0:function(e){f(DS(d,c,g,e))},items:e.filterOptions?e.filterOptions(x):x,newItem:{callToAction:null!=(n=null==e?void 0:e.label)?n:C("add_metric","Add metric"),onNew:function(t){var n,i=null!=e&&e.onNewMeasureFilterAggregate?e.onNewMeasureFilterAggregate(t):e.supportedAggregates,r=nt(t,i),o=[].concat(g,[{field:t.id,function:fn(t)?t.denominatorAggregate:r}]);f(((n={})[d]=c(o),n))},initValues:b,hide:j},id:null==e?void 0:e.id,testId:null!=(i=null==e?void 0:e.testId)?i:"metric-input",purpose:"measure"}),s&&p.jsx(ES,{onClose:function(){return u(!1)}})]})},PS=function(e){var t=e.values[e.itemIndex].field,n=r.cloneDeep(e.attributes);return"dataTable"!==n.type&&"basicTable"!==n.type||(void 0===n.hiddenFields?n.hiddenFields=[t]:n.hiddenFields.includes(t)?n.hiddenFields=n.hiddenFields.filter((function(e){return e!==t})):n.hiddenFields.push(t)),n},zS=function(e){var t=e.attributes,n=e.isMeasure,i=void 0===n||n;return!("dataTable"!==t.type&&"basicTable"!==t.type||!t.hiddenFields||0===t.hiddenFields.length||!t.hiddenFields.includes(e.values[e.itemIndex].field)||!i)},VS=function(e){var n=e.attributes,i=e.setPartialAttributes,r=e.dataSet,o=t.useState(!1),a=o[0],l=o[1],s=Pu(),u=n.measure,d=[].concat(u).map((function(e,t){var n=Qo(r,e.field);return{title:n.publicName,icon:n.dataType,id:"field_"+t}})),c=[].concat(Uo(r.fields,{removeAggregateMaths:!0,removePercentage:!0})).map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}));return p.jsxs(t.Fragment,{children:[p.jsx(jx,{mode:s.mode,onOrderChange:function(e,t){var n=OS([].concat(u),e,t);i({measure:n})},onDeleteItem:function(e){var t=DS("measure",(function(e){return e}),u,e);if(("dataTable"===n.type||"basicTable"===n.type)&&void 0!==n.hiddenFields&&n.hiddenFields.length>0){var r=[].concat(n.hiddenFields);t.hiddenFields=r.filter((function(e){if(t.measure)return!!t.measure.some((function(t){return t.field===e}))}))}i(t)},onToggleHidden:function(e){return i(PS({itemIndex:e.itemIndex,values:u,attributes:n}))},items:d,newItem:{callToAction:s.textOverride("add_field","Add field"),onNew:function(e){var t=[].concat(u,[{field:e.id,function:"none"}]);i({measure:t})},initValues:c},isHidden:function(e){return zS({itemIndex:e.itemIndex,attributes:n,values:u})},showHiddenToggle:"dataTable"===n.type||"basicTable"===n.type,purpose:"fields"}),a&&p.jsx(ES,{onClose:function(){return l(!1)}})]})},qS=function(e,t){return t&&"string"==typeof t?e+" ("+t+")":e},BS=function(e){var t=e.attributes,n=e.setPartialAttributes,i=e.dataSet,r=Pu().textOverride,o=[].concat(t.order).map((function(t,n){var o,l,s,u={onChange:function(e,t){a(e,t)},options:[{label:r("asc","Asc"),value:"asc"},{label:r("desc","Desc"),value:"desc"}],selected:t.direction},d=Qo(i,t.field),c=(null==(o=e.queryEngineConfig)||null==(o=o.supportedAggregates)||null==(o=o[t.function])?void 0:o.publicName)||(null==(l=e.queryEngineConfig)||null==(l=l.supportedTimeTruncFunctions)||null==(l=l[t.function])?void 0:l.publicName)||(null==(s=e.queryEngineConfig)||null==(s=s.supportedTransformationFunctions)||null==(s=s[t.function])?void 0:s.publicName)||t.function;return{title:qS(d.publicName,t.function&&"none"!=t.function&&_e(c,r)),icon:d.dataType,select:u,id:"sort_"+n}})),a=function(e,i){var r=[].concat(t.order);r[i].direction=e,n({order:r})},l=Pu().mode,s=function(e,t,n,i,r,o){var a=[];if(a=a.concat([].concat(i||[]).flatMap((function(t){var n=Qo(e,t.field);return ut(n)?[]:[{title:n.publicName,icon:n.dataType,value:n,onSelected:function(e){r(e.id,t.function)}}]}))),t){var l=Qo(e,t.field);a.push({title:l.publicName,icon:l.dataType,value:l,onSelected:function(e){r(e.id,t.truncate)}})}return a.concat([].concat(n||[]).flatMap((function(t){var n=Qo(e,t.field);return ut(n)?[]:[{title:qS(n.publicName,Ii(t)&&_e(t.function,o)),icon:n.dataType,value:t,onSelected:function(e){return r(e.field,e.function)}}]})))}(e.dataSet,e.timeDimension||null,e.measure,e.dimension,(function(e,i){var r=[].concat(t.order,[{field:e,direction:"asc",function:i}]);n({order:r})}),r);return p.jsx(jx,{mode:l,onOrderChange:function(e,i){var r=OS([].concat(t.order),e,i);n({order:r})},onDeleteItem:function(e){var i=[].concat(t.order);i.splice(e,1),n({order:i})},items:o,newItem:{callToAction:r("add_sort","Add sort"),initValues:s},testId:"sort-input",purpose:"sort"})};function WS(e,t){return{math:{title:t("custom_metric_title.math","Math"),subtext:t("custom_metric_description.math","Calculate from multiple values")},dateCalculation:{title:t("custom_metric_title.date_difference","Date Difference"),subtext:t("custom_metric_description.date_difference","Find the difference between dates")},rules:{title:t("custom_metric_title.rules_based_groups","Rules-based Groups"),subtext:t("custom_metric_description.rules_based_group","Create groups based on conditions")},percentage:{title:t("custom_metric_title.percentage","Percentage"),subtext:t("custom_metric_description.percentage","Calculate a percentage in a field")},roundedNumber:{title:t("custom_metric_title.number_formatting","Rounded Number"),subtext:t("custom_metric_description.number_formatting","Round a number field")},conditional:{title:t("custom_metric_title.conditional","Conditional"),subtext:t("custom_metric_description.conditional","Create a conditional field")},calculatedField:{title:t("custom_metric_title.caclulated_field","Calculated Field"),subtext:t("custom_metric_description.caclulated_field","Create a calculated field")}}[e]}function HS(e,t){return t("custom_metric_modal_title","[[custom_metric_title]] Custom Metric",{custom_metric_title:WS(e,t).title})}var YS=function(e,t,n,i){var r=[],o=Go(t);return e.allowSimpleMathsCustomField&&o.supportedCustomFields.simpleMaths||e.allowAggregateMathsCustomField&&o.supportedCustomFields.aggregateMaths?r.push(ge({},WS("math",i),{value:"math"})):(e.allowSimpleMathsCustomField||e.allowAggregateMathsCustomField||Ke("Simple math custom field not made available, because of a feature toggle."),o.supportedCustomFields.simpleMaths&&!o.supportedCustomFields.aggregateMaths||Ke("Simple math custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRoundedNumberCustomField&&o.supportedCustomFields.roundedNumbers?r.push(ge({},WS("roundedNumber",i),{value:"roundedNumber"})):(e.allowRoundedNumberCustomField||Ke("Rounded number custom field not made available, because of a feature toggle."),o.supportedCustomFields.roundedNumbers||Ke("Rounded number custom field not made available, because it is not supported for the view "+o.title+".")),e.allowPercentagesCustomField&&o.supportedCustomFields.percentages?r.push(ge({},WS("percentage",i),{value:"percentage"})):(e.allowPercentagesCustomField||Ke("Percentage custom field not made available, because of a feature toggle."),o.supportedCustomFields.percentages||Ke("Percentage custom field not made available, because it is not supported for the view "+o.title+".")),e.allowRulesCustomField&&o.supportedCustomFields.rules&&ji(n,"switchField")?r.push(ge({},WS("rules",i),{value:"rules"})):(e.allowRulesCustomField||Ke("Custom rules field not made available, because of a feature toggle."),o.supportedCustomFields.rules||Ke("Custom rules field not made available, because it is not supported for the view "+o.title+"."),ji(n,"switchField")||Ke("Custom rules field not made available, because it is not supported by the current query engine.")),e.allowDateCalculationsCustomField&&o.supportedCustomFields.dateCalculations?r.push(ge({},WS("dateCalculation",i),{value:"dateCalculation"})):(e.allowDateCalculationsCustomField||Ke("Date maths custom field not made available, because of a feature toggle."),o.supportedCustomFields.dateCalculations||Ke("Date maths custom field not made available, because it is not supported for the view "+o.title+".")),e.allowConditionalCustomField&&o.supportedCustomFields.conditional?r.push(ge({},WS("conditional",i),{value:"conditional"})):(e.allowConditionalCustomField||Ke("Conditional custom field not made available, because of a feature toggle."),o.supportedCustomFields.conditional||Ke("Conditional custom field not made available, because it is not supported for the view "+o.title+".")),e.allowCalculatedField&&o.supportedCustomFields.calculatedField?r.push(ge({},WS("calculatedField",i),{value:"calculatedField"})):(e.allowCalculatedField||Ke("Calculated custom field not made available, because of a feature toggle."),o.supportedCustomFields.calculatedField||Ke("Calculated custom field not made available, because it is not supported for the view "+o.title+".")),r},GS=function(e){return e.Drilldown="drilldown",e.AdvancedFilter="advancedFilter",e.Prefix="prefix",e.ConditionalCustomMetric="conditionalCustomMetric",e.PercentageCustomMetric="percentageCustomMetric",e.MathCustomMetric="mathCustomMetric",e.RulesCustomMetric="rulesCustomMetric",e.RoundedNumberCustomMetric="roundedNumberCustomMetric",e.DateCalculationCustomMetric="dateCalculationCustomMetric",e.DeleteCustomMetric="deleteCustomMetric",e.TableDrilldown="tableDrilldown",e.Progress="progress",e.ConditionalFormatting="conditionalFormatting",e.TrendLines="trendLines",e.GoalLines="goalLines",e.CalculatedField="calculatedField",e.ItemPicker="itemPicker",e}({}),US=function(e){var n=Pu(),i=n.mode,r=n.featureToggles,o=n.textOverride,a=n.variables,l=qm().dispatch,s=Ko(e.dataSets,e.dataSetId);if(!s)return console.warn("Data set must be found for custom field input to render."),null;var u=YS(r,e.componentType,null==e?void 0:e.queryEngineConfig,o),d=ta(s,e.componentType),c=function(t,n,i){var r=XS(t);r&&l({type:"setActiveModal",payload:{modal:r,attributes:i?void 0:{show:!0,onClose:function(){return h(t)},onNewCustomField:m,queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,dataSet:s,initialValue:null!=n?n:void 0}}})},f=[].concat(d).map((function(e,n){var i=!1;try{Jh(e,(function(e){return Zt(e,Xt,null==a?void 0:a.variables)}))}catch(e){i=!0}return{title:e.publicName,id:"custom-metric-"+n,subtext:KS(e,o),onClick:function(){var t=xn(e);c(t,e)},renderRight:i?function(){return p.jsx("div",{className:es({display:"flex",alignItems:"center",paddingRight:8}),children:p.jsx("div",{"aria-label":o("custom_metric.variable_not_available","A variable is not available."),children:p.jsx(sh,{tooltipContent:function(){return p.jsx(t.Fragment,{children:o("custom_metric.variable_not_available","A variable is not available.")})},children:p.jsx(Fd,{})})})})}:void 0}})),m=function(t){var n=Ko(e.dataSets,e.dataSetId);if(!n)throw o("cannot_find_data_set","Cannot find data set.");var i=function(e,t){var n=!1,i=[].concat(e.fields).map((function(e){return e.id==t.id?(n=!0,t):e}));return ge({},e,{fields:n?i:[].concat(i,[t])})}(n,t),r=ia(e.dataSets,i);e.setDataSets(r),h(xn(t))},h=function(e){c(e,void 0,!0)};return p.jsx(jx,{mode:i,newItem:{callToAction:o("add_custom_metric","Add custom metric"),onNew:function(e){return c(e,void 0)},initValues:u,onOpenDropdown:function(){KC("bottom","editor-panel")}},items:f,onDeleteItem:function(t){l({type:"setActiveModal",payload:{modal:GS.DeleteCustomMetric,attributes:{message:o("delete_custom_metric","This will permanently remove the custom field '[[nameOfCustomMetric]]' from all views on the dashboard, not just this view. Are you sure you want to continue?",{nameOfCustomMetric:d[t].publicName}),onClose:function(n){return function(t,n){if(t&&n){var i=ia(e.dataSets,function(e,t){var n=e.fields.findIndex((function(e){return e.id==t})),i=[].concat(e.fields);return n>=0?(i.splice(n,1),ge({},e,{fields:i})):ge({},e,{fields:i})}(s,n.id));e.setDataSets(i)}l({type:"setActiveModal",payload:{modal:GS.DeleteCustomMetric,attributes:void 0}})}(n,d[t])},show:!0}}})},testId:"custom-metric-input"})};function KS(e,t){return dn(e)||pn(e)?WS("math",t).title:fn(e)?WS("percentage",t).title:mn(e)?WS("rules",t).title:hn(e)?WS("conditional",t).title:gn(e)?WS("dateCalculation",t).title:cn(e)?WS("roundedNumber",t).title:vn(e)?WS("calculatedField",t).title:""}var XS=function(e){switch(e){case"percentage":return GS.PercentageCustomMetric;case"conditional":return GS.ConditionalCustomMetric;case"math":return GS.MathCustomMetric;case"rules":return GS.RulesCustomMetric;case"roundedNumber":return GS.RoundedNumberCustomMetric;case"dateCalculation":return GS.DateCalculationCustomMetric;case"calculatedField":return GS.CalculatedField;default:return}},QS=function(e){var n,i=e.dataSet,o=e.queryEngineConfig,a=e.fieldFilterOptions,l=e.attributes,s=e.preSetPartialAttributes,u=e.setPartialAttributes,d=e.callToAction,c=e.maxAllowed,f=e.preventDuplicates,m=null!=a&&a.onlyDimensions?"grouping":"metric",h=(0,e.getValues)(l),v=function(e){var t=s(e,i,l);"order"in l&&e.forEach((function(e){"date_time"==Qo(i,e.field).dataType&&"grouping"==m&&(t.order=[{function:e.function,field:e.field,direction:"asc"}])})),("dataTable"===l.type||"basicTable"===l.type)&&void 0!==l.hiddenFields&&l.hiddenFields.length>0&&(t.hiddenFields=function(e){var t=e.attributes;if(("dataTable"===t.type||"basicTable"===t.type)&&void 0!==t.hiddenFields&&t.hiddenFields.length>0){var n=[].concat(t.hiddenFields),i=r.cloneDeep(t.dimension),o=r.cloneDeep(t.measure);return n.filter((function(e){return!(!i.some((function(t){return t.field===e}))&&!o.some((function(t){return t.field===e})))}))}return[]}({attributes:l})),u(t)},g=t.useState(!1),x=g[0],b=g[1],y=Pu(),w=ZS(h,m,o,v),C=ek(h,i,m,o,v),j=$S(i,a,f,h);return p.jsxs(t.Fragment,{children:[p.jsx(jx,{testId:null!=(n=null==e?void 0:e.testId)?n:"field-collector-input",mode:y.mode,items:C,newItem:{callToAction:d||y.textOverride("add_field","Add field"),onNew:w,initValues:j,hide:!!e.dataSet.preAggregated||!!c&&h.length>=c},onOrderChange:function(e,t){var n=OS([].concat(h),e,t);v(n)},onToggleHidden:function(e){return u(PS({itemIndex:e.itemIndex,values:h,attributes:l}))},onDeleteItem:i.preAggregated?void 0:function(e){v(Pa(h,e))},isHidden:function(e){return zS({itemIndex:e.itemIndex,attributes:l,values:h,isMeasure:"metric"===m})},showHiddenToggle:"metric"===m&&("dataTable"===l.type||"basicTable"===l.type),purpose:m}),x&&p.jsx(ES,{onClose:function(){return b(!1)}})]})};function ZS(e,t,n,i){return function(r){var o=[].concat(e),a=JS(t,r,n);i([].concat(o,[a]))}}function JS(e,t,n){return"grouping"==e&&"date_time"==t.dataType?{field:t.id,function:t.allowedGranularities[0]}:"grouping"==e||fn(t)||pn(t)?{field:t.id,function:"none"}:{field:t.id,function:it(t,n.supportedAggregates)[0]}}function $S(e,t,n,i){var r=Uo(e.fields,t);return n&&(r=lt(r,[].concat(i))),r.map((function(e){return{title:e.publicName,icon:e.dataType,subtext:e.description,value:e}}))}function ek(e,t,n,i,o){return[].concat(e).map((function(a,l){var s,u=Qo(t,a.field),d=[];"metric"==n?d=it(u,i.supportedAggregates).map((function(e){return{label:i.supportedAggregates[e].publicName,value:e}})):"grouping"===n&&"date_time"===u.dataType&&(s=i.supportedTimeTruncFunctions,d=u.allowedGranularities.filter((function(e){return void 0!==s[e]})).map((function(e){return{label:s[e].publicName,value:e}})));var c=!fn(u),p=!pn(u);return{title:u.publicName,icon:u.dataType,id:"metric_"+l,select:!t.preAggregated&&"none"!=a.function&&c&&p?{options:d,selected:a.function,onChange:function(t){var n=r.cloneDeep(e);"function"in a&&(n[l]={field:a.field,function:t}),o(n)}}:void 0}}))}var tk=function(e){var t=Pu().mode,n=qm().dispatch,i=e.textOverride,o=e.dataSet,a=function(e,t){var n=e.flatMap((function(e){return e.map((function(e){return Qo(t,e.field).publicName}))}));return r.uniq(n)}(e.attributes.filter,o),l=function(t){t&&e.setPartialAttributes({filter:t}),n({type:"setActiveModal",payload:{modal:GS.AdvancedFilter,attributes:void 0}})},s=r.isEmpty(e.attributes.filter)?[]:[{title:i("filter_list_title","[[filterCount]] {{condition}}",{condition:{plural:"conditions",singular:"condition",count:e.attributes.filter.length},filterCount:e.attributes.filter.length}),subtext:i("filter_list_subtext","{{acrossFields}} [[fields]].",{acrossFields:{count:a.length,singular:"On the field",plural:"Across fields"},fields:Re(a)}),onClick:function(){return u()},id:"filter-list"}],u=function(){n({type:"setActiveModal",payload:{modal:GS.AdvancedFilter,attributes:{show:!0,onClose:l,filter:e.attributes.filter,dataSet:o}}})},d={callToAction:i("add_filter","Add filter"),onClick:function(){return u()}};return p.jsx(jx,{mode:t,newItemBtn:r.isEmpty(s)?d:void 0,onDeleteItem:function(){e.setPartialAttributes({filter:[]})},items:s})},nk=function(e){var t,n=Pu(),i=n.mode,r=n.textOverride,o=qm().dispatch,a=[{title:r("trend-lines.trens.title","Trend"),subtext:r("trend-lines.trend.subtext","Analyzes trends within the given date range."),value:vr.Trend},{title:r("trend-lines.forecast.title","Forecast"),subtext:r("trend-lines.forecast.subtext","Forecast uses historical data to predict future trends."),value:vr.Forecast}],l=[].concat(e.trends||[]).map((function(e,t){return{title:e.type,id:"trends-input-item-"+t,index:t}})),s=function(t){if(t){var n=e.trends||[];n.push(t),e.onSetTrends(n)}o({type:"setActiveModal",payload:{modal:GS.TrendLines,attributes:void 0}})};return p.jsx(jx,{mode:i,newItem:{callToAction:r("add_trend","Add trend line"),onNew:function(t){return function(t){var n=e.trends||[];t!==vr.MovingAverage&&(t===vr.Trend&&n.push({type:t,value:void 0}),t===vr.Forecast&&o({type:"setActiveModal",payload:{modal:GS.TrendLines,attributes:{trend:{type:vr.Forecast,value:void 0},show:!0,onClose:s,dataSet:e.dataSet,componentAttributes:e.componentAttributes}}}),e.onSetTrends(n))}(t)},initValues:a,onOpenDropdown:function(){KC("bottom","editor-panel")},hide:e.trends&&(null==(t=e.trends)?void 0:t.length)>0},items:l,onDeleteItem:function(t){var n=e.trends||[];n.splice(t,1),e.onSetTrends(n)},testId:"trends-input"})},ik=function(e){var t,n,i=e.component,r=e.definedMetric,o=e.measure,a=Ti(r),l=Qo(null==e?void 0:e.dataSet,r.field),s=Pu(),u=s.queryEngineConfig,d=s.textOverride,c=s.labelFormat,f=al(l.publicName,null==(t=u.supportedAggregates[r.function])?void 0:t.publicName),m=c({fieldId:r.field,func:r.function,type:i.attributes.type,defaultLabel:f,viewId:null!=(n=i.attributes.viewId)?n:""});return p.jsxs(yf,{direction:"column",gap:"0.5rem",children:[p.jsx(Kf,{as:"p",margin:0,children:p.jsxs(yf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[p.jsx(Af,{icon:l.dataType})," ",p.jsx("span",{children:null!=m?m:f})]})}),p.jsx(RS,ge({},e,{attributes:{measure:o?o[a]:[]},dataSet:null==e?void 0:e.dataSet,componentType:i.attributes.type,allowsMultiple:!0,onNewMeasureFilterAggregate:ok(e.definedMetrics,u),setPartialAttributes:function(t){var n;e.setAttributes(((n={})[a]=t.measure,n))},supportedAggregates:u.supportedAggregates,id:"metric-input",propKey:"measure",filterOptions:function(t){return rk(t,null==e?void 0:e.definedMetrics)},label:d("add_alternative_metric","Add alternative metric")}))]})},rk=function(e,t){return e.map((function(e){var n=t.filter((function(t){return t.field===e.value})),i=e.select.options.filter((function(e){return!n.map((function(e){return e.function})).includes(e.value)})),r=e.select.selected;return i.some((function(e){return e.value===r}))||(r=i.length>0?i[0].value:null),ge({},e,{select:ge({},e.select,{options:i,selected:r})})}))};function ok(e,t){return function(n){var i=e.filter((function(e){return e.field===n.id})),r=ge({},t.supportedAggregates);return i.forEach((function(e){delete r[e.function]})),r}}var ak=function(e){var t=e.group,n=e.definedDimension,i=RF(n),r=Qo(null==e?void 0:e.dataSet,n.field),o=t?t[i]:null,a=Pu(),l=a.queryEngineConfig,s=a.textOverride;return p.jsxs(yf,{direction:"column",gap:"0.5rem",children:[p.jsx(Kf,{as:"p",margin:0,children:p.jsxs(yf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[p.jsx(Af,{icon:r.dataType})," ",p.jsx("span",{children:r.publicName})]})}),p.jsx(LS,ge({},e,{allowsMultiple:!0,attributes:{dimension:o||void 0},setPartialAttributes:function(t){var n,r;e.setAttributes(((r={})[i]=null!=(n=t.dimension)?n:[],r))},supportedTransformationFunctions:l.supportedTransformationFunctions,filterOptions:function(e){return e},label:s("add_alternative_group","Add alternative group")}))]})},lk=function(e){var t=e.group,n=e.definedDimension,i=mt(n),r=Qo(null==e?void 0:e.dataSet,null==e?void 0:e.definedDimension.field),o=Pu(),a=o.queryEngineConfig,l=o.textOverride,s=t?t[i]:null;return p.jsxs(yf,{direction:"column",gap:"0.5rem",children:[p.jsx(Kf,{as:"p",margin:0,children:p.jsxs(yf,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[p.jsx(Af,{icon:r.dataType})," ",p.jsxs("span",{children:[r.publicName," (",n.truncate,")"]})]})}),p.jsx(NS,ge({},e,{attributes:{timeDimensions:s||null},supportedTimeDimensions:a.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&e.setAttributes(((n={})[i]=t.timeDimensions,n))},onNewMeasureFilterTruncFunctions:function(t){var i=ge({},a.supportedTimeTruncFunctions);return t.id===(null==e?void 0:e.definedDimension.field)&&delete i[n.truncate],i},label:l("add_alternative_time_group","Add alternative time group")}))]})},sk=function(e){var t=(null==e?void 0:e.component).attributes,n=Pu().featureToggles,i=qm().dispatch;return null!=e&&e.show?0==function(e,t){var n=[],i=Go(t);return e.parameters&&i.supportedFeatures.parameters?n.push({title:"Parameter",subtext:"Set customisable Parameters on Views"}):(e.parameters||Ke("Parameters not made available, because of a feature toggle."),i.supportedFeatures.parameters||Ke("Parameters not made available, because it is not supported for the view "+i.title+".")),n}(n,t.type).length?null:p.jsx(uk,ge({},e,{onAddingParameters:function(n){var r=ge({},t,{parameters:n});"parameters"in t&&void 0!==e.cellIndex&&void 0!==e.rowIndex&&i({type:"setAttributes",attributes:r,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),"parameters"in t&&void 0!==e.libraryIndex&&i({type:"updateComponentLibraryAttributes",attributes:r,libraryIndex:null==e?void 0:e.libraryIndex}),null==e||e.onClose()}})):null},uk=function(e){var n=(null==e?void 0:e.component).attributes,i=Pu().textOverride,r=qm(),a=fm(r.dashboard,e.component.attributes.dataSetId),l=function(e,n,i){var r=Pu().queryEngineConfig,a=t.useState(kS),l=a[0],s=a[1],u=function(){s(kS)},d="parameters"in e?e.parameters:void 0;t.useEffect((function(){d?s(d):u()}),[JSON.stringify(d)]);var c,p,f,m,h,v,g,x,b,y,w,C="measure"in e&&"parameters"in e&&o.isEmpty(null==(c=e.parameters)?void 0:c.measure)?e.measure:"parameters"in e&&!o.isEmpty(null==(p=e.parameters)?void 0:p.measure)&&null!=(f=e.parameters)&&f.measure?(m=r.supportedAggregates,h=e.parameters,e.measure.map((function(e){var t,n=Object.keys(null!=(t=null==h?void 0:h.measure)?t:{}).find((function(t){var n,i;return(null!=(n=null==h||null==(i=h.measure)?void 0:i[t])?n:[]).some((function(t){return t.field===e.field&&t.function===e.function}))}));return n?_i(n,{supportedAggregates:m,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}):e}))):[],j="dimension"in e&&"parameters"in e&&o.isEmpty(null==(v=e.parameters)?void 0:v.group)?e.dimension:"dimension"in e&&"parameters"in e&&!o.isEmpty(null==(g=e.parameters)?void 0:g.group)&&null!=(x=e.parameters)&&x.group?function(e,t){return e?null==e?void 0:e.map((function(e){var n,i=Object.keys(null!=(n=null==t?void 0:t.group)?n:{}).find((function(n){var i,r;return(null!=(i=null==t||null==(r=t.group)?void 0:r[n])?i:[]).some((function(t){return(null==t?void 0:t.field)===e.field&&"function"in t&&t.function===("function"in e&&e.function)}))}));return i?{field:i,function:"none"}:e})):[]}(e.dimension,e.parameters):[],F="timeDimension"in e&&e.timeDimension&&"parameters"in e&&o.isEmpty(null==(b=e.parameters)?void 0:b.group)?e.timeDimension:"timeDimension"in e&&"parameters"in e&&!o.isEmpty(null==(y=e.parameters)?void 0:y.group)&&null!=(w=e.parameters)&&w.group?function(e,t,n){var i,r=Object.keys(null!=(i=null==n?void 0:n.group)?i:{}).find((function(e){var i,r;return(null!=(i=null==n||null==(r=n.group)?void 0:r[e])?i:[]).some((function(e){if(e)return e.field===(null==t?void 0:t.field)&&("truncate"in e&&e.truncate)===t.truncate}))}));if(r){var o=ht(r,e);return null!=o?o:t}return t}(r.supportedTimeTruncFunctions,e.timeDimension,e.parameters):void 0;return ge({},l,{definedMetrics:C,definedDimensions:j,definedTimeDimension:F,onChange:function(t){if("measure"in t&&t.measure){var n=function(e,t){var n=Object.keys(t)[0];e.measure||(e.measure={});var i=ge({},e.measure),r=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete i[n],r=n):i[n]=t[n],{updatedMetrics:ge({},e,{measure:i}),metricKeyToDelete:r}}(ge({},l),t.measure),o=n.updatedMetrics,a=n.metricKeyToDelete;a&&function(t){if("measure"in e&&t&&l.measure){var n=_i(t,r),o=function(e,t,n,i){var r,o=null==(r=i[e])?void 0:r[0];if(!o)return t;var a=t.findIndex((function(e){return e.field===o.field&&e.function===o.function}));return-1!==a&&n&&(t[a]=n),t}(t,e.measure,n,l.measure);i({measure:o})}}(a),s(o)}if("group"in t&&t.group){var u=function(e,t){var n=Object.keys(t)[0];e.group||(e.group={});var i=ge({},e.group),r=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete i[n],r=n):i[n]=t[n],{updatedMetrics:ge({},e,{group:i}),metricKeyToDelete:r}}(ge({},l),t.group),d=u.updatedMetrics,c=u.metricKeyToDelete;c&&function(t){if("parameters"in e&&t&&l.group){var n=ht(t,r.supportedTimeTruncFunctions);n&&i({timeDimension:n}),"dimension"in e&&!n&&i({dimension:TS(t,e.dimension,l.group)})}}(c),s(d)}},handleUpsert:function(){n(l)},reset:u,disabled:AS(l,d)})}(n,null==e?void 0:e.onAddingParameters,e.setPartialAttributes),s=l.definedMetrics,u=l.onChange,d=l.measure,c=l.handleUpsert,f=l.definedDimensions,m=l.definedTimeDimension,h=l.group;return a?p.jsxs(Mh,{width:"xl","data-testid":"parameters-modal",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:i("add_parameters","Add Parameters"),show:!0,tooltip:i("add_parameters_tooltip","Set alternate metrics and groups for the view.")}),p.jsx(Mh.Content,{children:p.jsx(yf,{width:"100%",children:p.jsx(uf,{flex:1,children:p.jsxs(Hh.Group,{defaultIndex:0,children:[(m||0!==f.length)&&p.jsxs(Hh.List,{columns:"1fr 1fr",padding:0,children:[p.jsx(Hh.Button,{children:i("add_parameter_metrics","Metrics")}),p.jsx(Hh.Button,{children:i("add_parameter_groups","Groups")})]}),p.jsxs(Hh.Panels,{children:[p.jsxs(Hh.Panel,{paddingLeft:0,paddingRight:0,children:[p.jsx(Ch,{marginBottom:2,children:i("current_active_metrics","Current active metrics")}),p.jsx(yf,{direction:"column",gap:"1.5rem",children:null==s?void 0:s.map((function(t){return p.jsx(ik,{component:null==e?void 0:e.component,definedMetric:t,definedMetrics:s,dataSet:a,setAttributes:function(e){return u({measure:e})},measure:d},t.field+"-"+t.function)}))})]}),p.jsxs(Hh.Panel,{paddingLeft:0,paddingRight:0,children:[p.jsx(Ch,{marginBottom:2,children:i("current_active_groups","Current active groups")}),p.jsxs(yf,{direction:"column",gap:"1.5rem",children:[f.map((function(t){return p.jsx(ak,{setAttributes:function(e){return u({group:e})},component:null==e?void 0:e.component,definedDimension:t,dataSet:a,group:h},""+t.field)})),m&&p.jsx(lk,{definedDimension:m,setAttributes:function(e){return u({group:e})},dataSet:a,group:h})]})]})]})]})})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:i("close","Close")}),p.jsx(gh,{onClick:function(){return c()},primary:!0,children:i("update","Update")})]})})]}):null},dk=function(e){var t=Pu().textOverride,n=Ig().addToast;return p.jsxs(Mh,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[p.jsx(Mh.Header,{title:t("json_results","Data in raw JSON format"),show:!0}),p.jsx(Mh.Content,{children:p.jsx(uf,{maxHeight:"400px",overflowY:"scroll",children:p.jsx("pre",{"data-testid":"raw-results-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.results,null,2)})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("close","Close")}),p.jsx(gh,{primary:!0,testId:"modal-copy-json-results-btn",onClick:function(){var t=J(JSON.stringify(e.results));n(t?function(){return p.jsx(Tg,{message:"Copied results"})}:function(){return p.jsx(Ag,{message:"Failed to copy results"})})},children:t("copy","Copy")})]})})]})},ck=function(e){var n=Pu().textOverride,i=Ig().addToast,r=t.useState(!1),o=r[0],a=r[1],l=t.useState(JSON.stringify(e.attributes,null,2)),s=l[0],u=l[1];return p.jsxs(Mh,{width:"4xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:n("json_attributes","Attributes in raw JSON format"),show:!0}),p.jsx(uf,{position:"absolute",top:20,right:20,children:p.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/services/views/"+e.attributes.type,children:p.jsx(b.QuestionMarkCircleIcon,{color:"#000",width:20,height:20})})}),p.jsx(Mh.Content,{children:p.jsxs(uf,{maxHeight:"400px",overflowY:"scroll",children:[!o&&p.jsx("pre",{"data-testid":"raw-attributes-"+e.rowIndex+"-"+e.cellIndex,children:JSON.stringify(e.attributes,null,2)}),o&&p.jsx("textarea",{onChange:function(e){return u(e.target.value)},style:{width:"100%",maxWidth:"100%",minHeight:"400px"},children:JSON.stringify(e.attributes,null,2)})]})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{secondary:!0,testId:"modal-close-btn",onClick:function(){return null==e?void 0:e.onClose()},children:n("close","Close")}),p.jsx(gh,{secondary:!0,testId:"modal-edit-attributes-btn",onClick:function(){return a(!o)},children:o?"View original":"Edit"}),!o&&p.jsx(gh,{primary:!0,testId:"modal-copy-json-attributes-btn",onClick:function(){var t=J(JSON.stringify(e.attributes));i(t?function(){return p.jsx(Tg,{message:"Copied attributes"})}:function(){return p.jsx(Ag,{message:"Failed to copy attributes"})})},children:n("copy","Copy")}),o&&p.jsx(gh,{primary:!0,testId:"modal-update-attributes-btn",onClick:function(){try{e.updateComponentAttributes(JSON.parse(s)),i((function(){return p.jsx(Tg,{message:"Updated attributes"})})),e.onClose()}catch(e){Je(e),i((function(){return p.jsx(Ag,{message:"Failed to update attributes"})}))}},children:"Update"})]})})]})},pk=function(){var e=me(Ce().mark((function e(t,n){var i,r,o,a,l,s,u,d,c;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d=t()){e.next=3;break}throw new Error("Target element not found");case 3:return c=ge({useCORS:null==(i=null==n||null==(r=n.canvas)?void 0:r.useCORS)||i,logging:null!=(o=null==n||null==(a=n.canvas)?void 0:a.logging)&&o,scale:null!=(l=null==n?void 0:n.resolution)?l:window.devicePixelRatio||1},null==n||null==(s=n.overrides)?void 0:s.canvas),e.next=6,$(d,c);case 6:p=null!=(u=null==n?void 0:n.filename)?u:"download.png",m=void 0,f=e.sent.toDataURL("image/png").replace("image/png","image/octet-stream"),(m=document.createElement("a")).href=f,m.download=p,document.body.appendChild(m),m.click(),document.body.removeChild(m);case 8:case"end":return e.stop()}var p,f,m}),e)})));return function(t,n){return e.apply(this,arguments)}}(),fk=function(e){var t=Pu().textOverride;return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[p.jsx(Mh.Header,{title:t("are_you_sure","Are you sure?"),show:!0}),p.jsx(Mh.Content,{children:p.jsx(uf,{paddingY:8,children:t("add_view_to_the_library","You are adding a View to the Template Library.")})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{testId:"modal-cancel-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:t("cancel","Cancel")}),p.jsx(gh,{testId:"modal-confirm-btn",primary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},children:t("confirm","Confirm")})]})})]})},mk=function(e){var n=t.useState(!1),i=n[0],r=n[1],o=Pu().textOverride;return p.jsxs(t.Fragment,{children:[p.jsxs(Mh,{width:"7xl",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[p.jsx(Mh.Content,{children:p.jsx("div",{style:{height:550},id:"view_fullscreen",children:e.view})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{testId:"modal-cancel-delete-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:o("cancel","Cancel")}),p.jsx(gh,{testId:"modal-confirm-delete-btn",primary:!0,onClick:function(){return r(!0)},children:o("download","Download")})]})})]}),p.jsx(sS,{overrideId:"view_fullscreen",onDownload:e.onDownload,show:i,onClose:function(){return r(!1)}})]})},hk=function(e){var n=Dd(),i=Pu(),r=i.featureToggles,o=i.textOverride,a=r.canUseComponentLibrary,l=r.canCreateStandaloneComponents;return 0===(null==e?void 0:e.rowIndex)&&0===(null==e?void 0:e.cellIndex)&&r.canSeeEmptyState?p.jsx(bS,{vizzlyPrefix:If("populated-cell"),"data-component":"empty-cell",children:p.jsxs("div",{className:es({display:"grid",width:"100%",height:"100%",placeContent:"center"}),children:[!e.generatingPDF&&p.jsx(mS,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell,onInsertRowAbove:function(){return e.onInsertRowAbove()},display:e.display}),p.jsx(FS,{title:p.jsx(t.Fragment,{children:o("empty_state_call_to_action","Build a dashboard with your data and delight your customer.")}),illustrationColor:"#43BA73",children:l&&p.jsx(rx,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:o("add_view_call_to_action","+ Add View")})})]})}):p.jsx("div",{className:kd(If("empty-cell"),""+wS.emptyCell(null==n?void 0:n.dashboard)),"data-themeapi":"dashboard","data-chipposition":"top.left",children:p.jsxs("div",{className:es({display:"grid",width:"100%",height:"100%",placeContent:"center"}),children:[!e.generatingPDF&&p.jsx(mS,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell,onInsertRowAbove:function(){return e.onInsertRowAbove()},display:e.display}),p.jsxs(yf,{gap:"0.5rem",wrap:!0,justifyContent:"center",children:[a&&p.jsx(rx,{onChange:e.onPickFromLibrary,size:"small","data-component":"select-template",testId:"add-view-from-library",className:If("select-template-button"),children:p.jsxs(yf,{alignItems:"center",as:"span",children:[p.jsx(od,{}),p.jsx("span",{className:es({display:"inline-block",marginLeft:"4px"}),children:o("select_template","Select Template")})]})}),l&&p.jsx(rx,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",className:If("add-view-button"),children:o("add_view_call_to_action","+ Add View")})]})]})})},vk=function(e){var i,r,o=t.useState(!1),a=o[0],l=o[1],s=t.useState(!1),u=s[0],d=s[1],c=t.useState(!1),f=c[0],m=c[1],h=t.useState(!1),v=h[0],g=h[1],x=t.useState(!1),b=x[0],y=x[1],w=t.useState(!1),C=w[0],j=w[1],S=t.useState(!1),k=S[0],A=S[1],T=qm().dispatch,_=Pu(),I=_.featureToggles,D=_.developerTools,O=_.scope,E=_.textOverride,L=_.mode,N=_.queryEngineConfig,M=I.canDownloadComponentData,R=I.canEditComponentsOnDashboard,P=I.canRemoveComponentsFromDashboard,z=!0===D||"object"==typeof D&&D.viewRawResults,V=!0===D||"object"==typeof D&&D.viewRawAttributes,q=n.useState(!1),B=q[0],W=q[1],H=e.generatingPDF||window.disableViewCheck||B,Y=(i=e.rowIndex,r=e.cellIndex,F.useDrag((function(){return{type:"vizzlyMoveComponentPositionDragHandle",item:{rowIndex:i,cellIndex:r},collect:function(e){var t=e.isDragging();return{adjust:e.getDifferenceFromInitialOffset(),isDragging:t}}}}))),G=Y[1],U=Y[2],K=function(t){T({type:"setLocalFilters",localFilters:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},X=t.useState(!1),Q=X[0],Z=X[1],J=function(){var t=me(Ce().mark((function t(n){var i,r,o;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.overrideId,o=n.fileFormat,"view-as-png"!==(i=n.downloadType)){t.next=6;break}return t.next=4,pk((function(){return document.getElementById(r||e.id)}),{method:"save",filename:"dashboard-"+e.id+".png",page:{}});case 4:t.next=7;break;case 6:e.onDownload({downloadType:i,fileFormat:o});case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),$=!B||I.unloadOffScreenViews,ee=Go(e.component.attributes.type,{queryEngineConfig:N});return p.jsxs(p.Fragment,{children:[p.jsx(le,{active:$,partialVisibility:!0,onChange:W,children:p.jsxs(bS,{vizzlyPrefix:If("populated-cell"),"data-testid":e.testId,ref:U,onHover:Z,"data-component":"populated-cell",children:[p.jsx(fx,{dragSource:G,active:"read_write"===O&&Q,enabled:"read_write"===O,top:gk(e.component.attributes).top,height:gk(e.component.attributes).height}),!e.generatingPDF&&p.jsx(fS,{canDownloadComponentData:M&&e.componentValidWithDataSet,canEditComponentsOnDashboard:R&&e.componentValidWithDataSet,canRemoveComponentsFromDashboard:P,canShowFullscreen:!0,onEdit:e.onEdit,onRemove:function(){return l(!0)},onDownload:J,onAddToLibrary:function(){return y(!0)},chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),component:e.component,onAddFilter:function(){return d(!0)},onSetParameters:function(){return A(!0)},onViewRawJSONResults:function(){return m(!0)},onViewRawAttributes:function(){return g(!0)},onShowFullscreen:function(){return j(!0)},canViewRawJSONResults:z,canViewRawViewAttributes:V,onInsertRowAbove:function(){T({type:"insertRow",rowIndex:e.rowIndex})}}),p.jsxs(JC,{showComponent:H,children:[H&&p.jsx(lS,{id:e.id,setLocalFilters:K,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes,height:e.height}),!H&&p.jsx(Nf,{})]})]})}),p.jsx(yS,{message:E("delete_view_from_dashboard_message","This view will be deleted from your dashboard."),onClose:function(t){t&&(null==e||e.onRemove()),l(!1)},show:a}),p.jsx(CS,{component:e.component,onClose:function(){return d(!1)},show:u,setLocalFilters:K}),p.jsx(sk,{cellIndex:e.cellIndex,setPartialAttributes:function(t){return e.updateComponentAttributes(ee.setAttributes(e.component.attributes,t))},rowIndex:e.rowIndex,show:k,component:e.component,onClose:function(){return A(!1)}}),p.jsx(dk,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:f,results:e.component.results,onClose:function(){return m(!1)}}),p.jsx(ck,{cellIndex:e.cellIndex,rowIndex:e.rowIndex,show:v,attributes:e.component.attributes,onClose:function(){return g(!1)},updateComponentAttributes:function(t){return e.updateComponentAttributes(t)}}),p.jsx(fk,{show:b,onClose:function(t){t&&T({type:"addComponentToLibrary",component:e.component,protectedComponent:"admin"===L}),y(!1)}}),p.jsx(mk,{show:C,onClose:function(){return j(!1)},onDownload:J,view:p.jsx(lS,{id:e.id,setLocalFilters:K,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes,height:e.height})})]})},gk=function(e){var t=e.displayTitle,n=e.displaySubject,i=t?15:8,r=28;return t&&(r+=13),n&&(r+=13),n&&t&&(r+=4),n&&!t&&(i=14),{top:i,height:r}},xk=function(e){e=function(e){var t=r.cloneDeep(e),n=[];return t.fields.forEach((function(e,t){e.hidden&&n.push(t)})),t.content=t.content.map((function(e){return n.forEach((function(t){e.splice(t,1)})),e})),t.fields=t.fields.filter((function(e){return!e.hidden})),t}(e);var t=[].concat(e.fields).map((function(t,n){var i;if(!e.groupTitles)return t.publicName;var r=null==(i=e.groupTitles.unconsolidated)||null==(i=i[n])?void 0:i.content;return(r?"["+r+"] ":"")+t.publicName}));return[t=t.filter((function(e){return null!==e}))].concat(e.content)},bk=function(){var e=me(Ce().mark((function e(t,n,i){var r,o,a,l,s,u;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r="",t){e.next=6;break}n({fileContents:r="Download failed",fileType:"text/csv;charset=utf-8",fileName:"download.csv"}),e.next=21;break;case 6:if(o=new se.Workbook,a=o.addWorksheet("Sheet 1"),l=xk(t),s=l.map((function(e){return e.map((function(e){var t;return"object"==typeof e?null!=(t=e.displayValue)?t:e.value:e}))})),a.addRows(s),!i){e.next=16;break}r=JSON.stringify(o.model),n({fileContents:r,fileType:"text/csv;charset=utf-8",fileName:"download.csv"}),e.next=21;break;case 16:return e.next=18,o.csv.writeBuffer();case 18:u=new Blob([e.sent],{type:"text/csv;charset=utf-8"}),n({fileContents:u,fileType:"text/csv;charset=utf-8",fileName:"download.csv"});case 21:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),yk=function(){var e=me(Ce().mark((function e(t,n,i){var r,o,a,l,s,u;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r="",t){e.next=6;break}n({fileContents:r="Download failed",fileType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName:"download.xlsx"}),e.next=22;break;case 6:if(o=new se.Workbook,a=o.addWorksheet("Sheet 1"),l=xk(t),s=l.map((function(e){return e.map((function(e){var t;return"object"==typeof e?null!=(t=e.displayValue)?t:e.value:e}))})),a.addRows(s),a.columns.forEach((function(e){if(e.values){var t=e.values.map((function(e){return"string"==typeof e&&e.toString().length})),n=Math.max.apply(Math,t.filter((function(e){return"number"==typeof e})));e.width=n}})),!i){e.next=17;break}r=JSON.stringify(o.model),n({fileContents:r,fileType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName:"download.xlsx"}),e.next=22;break;case 17:return e.next=19,o.xlsx.writeBuffer();case 19:u=new Blob([e.sent],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),n({fileContents:u,fileType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName:"download.xlsx"});case 22:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),wk=function(e){var t=e.fileContents,n=e.fileType,i=e.fileName;if(t instanceof Blob)ue.saveAs(t,i);else{var r=new Blob([t],{type:n});ue.saveAs(r,i)}},Ck=function(){var e=me(Ce().mark((function e(t,n,i,o,a,l,s,u,d,c,p,f,m){var h,v,g,x,b,y,w;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===c&&(c=wk),h=r.cloneDeep(a),e.prev=2,"limit"in h&&(h.limit=o),v=new AbortController,g="view-download-type"==t?h:[oa(n,o,"filter"in h?h.filter:[])],e.next=8,Wm(g,i,v.signal,d);case 8:if(Xa(b=null==(x=e.sent)?void 0:x[0])||Qa(b)||Ka(b)){e.next=22;break}if(y=r.isArray(g)?g[0]:g,w=VF({type:y.type,result:b,exportNames:"exportNames"in h?h.exportNames:void 0,prefixes:"prefixes"in h&&Array.isArray(h.prefixes)?h.prefixes:void 0,dateTimeFormat:"dateTimeFormat"in h?h.dateTimeFormat:void 0,dateTimeFormatOptions:l,numberFormat:"numberFormat"in h?h.numberFormat:void 0,numberFormatOptions:s,supportedAggregates:u.supportedAggregates,supportedTimeTruncFunctions:u.supportedTimeTruncFunctions,labelFormat:p,nullReplacement:function(){return""},measure:y.measure,xMeasure:y.xMeasure,yMeasure:y.yMeasure,dimension:null==y?void 0:y.dimension,dataSetId:n.id,hiddenFields:y.hiddenFields}),"csv"!==f){e.next=17;break}bk(w,c,null!=m&&m),e.next=22;break;case 17:if("xlsx"!==f){e.next=21;break}yk(w,c,null!=m&&m),e.next=22;break;case 21:throw new Error("Unsupported file format received by download(). Receiving: "+f);case 22:e.next=27;break;case 24:e.prev=24,e.t0=e.catch(2),Je(e.t0);case 27:case"end":return e.stop()}}),e,null,[[2,24]])})));return function(t,n,i,r,o,a,l,s,u,d,c,p,f){return e.apply(this,arguments)}}(),jk=function(e){if(!e.show)return null;var t=e.onClose,i=e.component,r=n.useState(i.displayTitle),o=r[0],a=r[1],l=qm().dispatch,s=Pu().textOverride;return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return t()},children:[p.jsx(Mh.Header,{title:s("update_header","Update Header"),show:!0}),p.jsx(Mh.Content,{children:p.jsx(Ew,{children:p.jsx($f,{id:"header-title",label:s("header_title","Title"),labelHidden:!0,value:o,onChange:function(e){return a(e.target.value)}})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return t()},secondary:!0,children:s("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return n=ge({},i,{displayTitle:o}),l({type:"setHeaderComponent",component:n,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),void t();var n},children:s("update","Update")})]})})]})},Fk=function(e){var t,n,i,r=Dd();return p.jsxs(yf,{justifyContent:"space-between",alignItems:"center",margin:null!=(t=null==e?void 0:e.margin)?t:"0 0 1rem","data-component":"action-section",className:""+Sk(null==r?void 0:r.header),"data-themeapi":"header",children:[p.jsx(uf,{children:(null==e?void 0:e.title)&&p.jsxs(yf,{direction:"column",gap:"0.5rem",children:[p.jsx(uf,{as:null!=(n=e.titleLevel)?n:null==r||null==(i=r.header)||null==(i=i.title)?void 0:i.htmlElement,className:""+kk(null==r?void 0:r.header),"data-themeapi":"header.title",children:null==e?void 0:e.title}),(null==e?void 0:e.subTitle)&&p.jsx("p",{className:""+Ak,children:null==e?void 0:e.subTitle})]})}),(null==e?void 0:e.extra)&&p.jsx(uf,{children:null==e?void 0:e.extra})]})},Sk=function(e){var t;return Fl({borderBottom:null==e?void 0:e.borderBottom,borderTop:null==e?void 0:e.borderTop,background:null==e?void 0:e.background,padding:null!=(t=null==e?void 0:e.padding)?t:"0.5rem 0",textAlign:null==e?void 0:e.textAlign})},kk=function(e){var t,n,i,r,o,a;return Fl({lineHeight:null==e||null==(t=e.title)?void 0:t.lineHeight,color:null==e||null==(n=e.title)?void 0:n.color,fontFamily:null==e||null==(i=e.title)?void 0:i.fontFamily,fontSize:null==e||null==(r=e.title)?void 0:r.fontSize,fontWeight:null==e||null==(o=e.title)?void 0:o.fontWeight,margin:null==e||null==(a=e.title)?void 0:a.margin})},Ak=Fl({margin:0,fontSize:14}),Tk=function(e){var t=[],i=n.useState(!1),r=i[0],o=i[1],a=Dd(),l=Pu(),s=l.featureToggles,u=l.scope,d=qm(),c=d.dispatch,f=d.dashboard;return t.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return p.jsx(vS,{})},onClick:function(){return o(!0)},testId:"edit"}),dS(a,f.display)&&t.push(uS((function(){c({type:"insertRow",rowIndex:e.rowIndex})}))),s.canRemoveComponentsFromDashboard&&t.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return p.jsx(hS,{})},onClick:function(){return e.onRemove()},testId:"remove"}),p.jsxs(uf,{position:"relative",height:"100%",margin:"0 0.1rem 0.5rem 0.1rem",children:[p.jsx(Fk,{title:e.component.displayTitle,margin:0}),!e.generatingPDF&&"read_write"===u&&p.jsx(pS,{cellOptions:t,chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1)}),p.jsx(jk,{show:r,component:e.component,onClose:function(){return o(!1)},rowIndex:e.rowIndex,cellIndex:e.cellIndex})]})};function _k(e,t){return!(t<=0||t>=e.length)&&e[t-1].components.some((function(e){return au(e)}))}var Ik,Dk,Ok=function(e){var t,n,i,r,o,a=e.customView,l=e.component,s=qm().dashboard,u=Pu().dateFilterOptions,d=function(){var e=a.Component({attributes:l.attributes,dashboardFilters:Fi(s.dataSets,s.globalFilters,u)});return"string"==typeof e?p.jsx("div",{dangerouslySetInnerHTML:{__html:e},className:Dj}):e};if(null!=(t=a.options)&&t.raw)return d();var c=null!=(n=null==(i=a.attributes)?void 0:i.displayTitle)?n:"";return p.jsx(bS,{vizzlyPrefix:If("populated-cell"),children:p.jsxs(Cg,{queriesAreChanging:!1,children:[p.jsx(uf,{marginBottom:c&&c.length>0?"0.4rem":void 0,children:p.jsx(wg,{displayTitle:c,paddingBottom:0,displaySubject:null!=(r=null==(o=a.attributes)?void 0:o.displaySubject)?r:"",localFilters:[],viewId:a.id,setLocalFilters:function(){},componentType:"custom",library:!1,setPartialAttributes:function(){}})}),d()]})})},Ek=function(e,t,n){return e.slice(-15)+"_"+t+"_"+n},Lk=function(e){var t=e.onCreateNew,n=e.onPickFromLibrary,i=e.onRemoveCell,r=e.rowIndex,o=e.cellIndex,a=e.trackEvent,l=Pu(),s=l.queryEngineConfig,u=l.dateTimeFormatOptions,d=l.numberFormatOptions,c=l.labelFormat,f=l.customViews,m=qm(),h=m.dispatch,v=m.dashboard,g=m.runQueriesCallback,x=v.display[r].components[o],b=pu(x)?"empty":au(x)?"header":"populated",y=F.useDrop((function(){return{accept:au(x)?"_no_junk_please_":"vizzlyMoveComponentPositionDragHandle",drop:function(t,n){Ke("dropCell",t),h({type:"swapComponents",positionA:{rowIndex:t.rowIndex,cellIndex:t.cellIndex},positionB:{rowIndex:e.rowIndex,cellIndex:e.cellIndex}})},collect:function(e){return{isOver:e.isOver()}}}})),w=y[0],C=y[1],j=f.find((function(t){return xv(t)&&t.rowIndex===e.rowIndex&&t.cellIndex===e.cellIndex}));return p.jsxs("div",{ref:C,className:es({padding:"8px",height:"100%",opacity:w.isOver?"0.2":"1"}),children:["populated"==b&&!pu(x)&&!au(x)&&!j&&p.jsx(vk,{rowIndex:r,cellIndex:o,id:Ek(v.id,r,o),componentValidWithDataSet:!0,generatingPDF:e.generatingPDF,setComponentReports:function(e){h({type:"setComponentReports",rowIndex:r,cellIndex:o,reports:e})},testId:"populated_cell_"+r+"_cell_"+o,isBeingSizeAdjusted:e.isBeingSizeAdjusted,component:x,runQueriesCallback:g,updateComponentAttributes:function(e){h({type:"updateDisplayComponentAttributes",rowIndex:r,cellIndex:o,attributes:e})},height:e.height,setResults:function(e){h({type:"setResultsForComponentInDisplay",rowIndex:r,cellIndex:o,results:e})},onEdit:function(){a("component.startEditing"),h({type:"startEditingComponent",displayTarget:{rowIndex:r,cellIndex:o},libraryIndex:null,component:x})},onRemove:function(){a("component.removeFromDisplay"),h({type:"clearCell",rowIndex:r,cellIndex:o})},onDownload:function(){var t=me(Ce().mark((function t(n){var i,r;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=Ko(v.dataSets,x.attributes.dataSetId),r={globalFilters:v.globalFilters,localFilters:x.localFilters},i&&Ck(n.downloadType,i,g,e.maxCSVDownloadLimit,x.attributes,u,d,s,r,void 0,c,n.fileFormat);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),j&&xv(j)&&p.jsx(Ok,{customView:j,component:x}),!j&&"empty"==b&&p.jsx(hk,{onCreateNew:function(){return t(r,o)},onPickFromLibrary:function(){return n(r,o)},onRemoveCell:function(){return i(r,o)},cellIndex:o,rowIndex:r,generatingPDF:e.generatingPDF,onInsertRowAbove:function(){h({type:"insertRow",rowIndex:e.rowIndex})},display:v.display}),"header"==b&&au(x)&&p.jsx(Tk,{component:x,onRemove:function(){return i(r,o)},rowIndex:r,cellIndex:o,generatingPDF:e.generatingPDF})]},"row_"+r+"_cell_"+o)},Nk=Fl(ge({width:"100%",cursor:"ns-resize",opacity:0,paddingTop:"0.75rem",paddingBottom:"0.75rem"},Cl,{"&:hover":ge({},Cl,{opacity:100})})),Mk=Fl({position:"relative",height:"0.25rem",marginLeft:"40%",width:"20%"}),Rk=Fl(ge({cursor:"ew-resize",position:"absolute",right:"-0.75rem",height:"25%",width:"0.25rem",top:"40%"},Cl,{"&:hover":ge({},Cl,{opacity:80}),variants:{highlighted:(Ik={},Ik.true={opacity:100},Ik.false={opacity:0},Ik)}})),Pk=Object.assign((function(){return null}),{dragHandle:function(e){return Fl({borderRadius:"0.75rem",background:null==e?void 0:e.borderColor})},cellDragHandle:Rk,rowDragHandle:Mk,rowDragHandleContainer:Nk}),zk=function(e){var t=F.useDrop((function(){return{accept:"componentWidthDragHandle",drop:function(t,n){var i=n.getDifferenceFromInitialOffset();i&&e.onDrop(t.cellIndex,i.x,t.displayRow)},collect:function(e){return{isOver:e.isOver()}}}})),n=t[0],i=t[1],r=e.dropIndex*e.colWidth+e.colWidth/2+32+"px",o=[0,10,11,12].includes(e.dropIndex);return p.jsx("div",{ref:i,className:es({position:"absolute",height:"100%",width:e.colWidth?e.colWidth+"px":"100%",top:"-4px",left:r,display:"flex",transition:"all cubic-bezier(0.4, 0, 0.2, 1) 150ms"}),children:n.isOver?p.jsx("div",{className:es({position:"absolute",top:"0",display:o?"none":"block",left:"calc(50% - 10px)",height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"rgba(0,0,0,0.8)"})}):p.jsx(p.Fragment,{children:e.active&&p.jsx("div",{className:es({position:"absolute",top:"0",display:o?"none":"block",left:"calc(50% - 10px)",height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"rgba(0,0,0,0.1)"})})})})},Vk=function(e){return e.Up="Up",e.Down="Down",e}({}),qk=function(e){var t=e.direction,n=Pu().textOverride,i=qm().dispatch,r=n("cell_options","Move Row")+" "+(null==e?void 0:e.direction);return p.jsx(sh,{placement:"right-start",tooltipContent:function(){return p.jsx(sh.Content,{children:r})},className:es({display:"flex",justifyContent:"center",alignItems:"center"}),children:p.jsxs(Iv,{onChange:function(){return t===Vk.Up&&i({type:"moveRow",position:{movingIndex:e.rowIndex,destinationIndex:e.rowIndex-1}}),void(t===Vk.Down&&i({type:"moveRow",position:{movingIndex:e.rowIndex,destinationIndex:e.rowIndex+1}}))},label:r,className:es(t===Vk.Down&&e.headerRow?{marginTop:-4}:{}),ignoreThemeSizeOverrides:!0,children:[t===Vk.Up&&p.jsx(Qs,{}),t===Vk.Down&&p.jsx(Zs,{})]})})},Bk=function(e){var n=Dd(),i=F.useDrag((function(){return{type:"rowHeightDragHandle",item:{rowIndex:e.rowIndex,displayRow:e.displayRow},collect:function(e){return{isDragging:e.isDragging()}},end:function(t,n){var i=n.getDifferenceFromInitialOffset();i&&e.onNewHeight(t.rowIndex,t.displayRow.height+i.y)}}}),[e.displayRow,e.rowIndex]),r=i[0],o=i[1],a=i[2];return t.useEffect((function(){a((Dk||((Dk=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Dk),{captureDraggingState:!1})}),[]),r.isDragging?null:p.jsx("div",{ref:o,className:""+Pk.rowDragHandleContainer,children:p.jsx("div",{className:" "+Pk.dragHandle(null==n?void 0:n.dashboard)+" "+Pk.rowDragHandle,"data-themeapi":"dashboard"})})},Wk=function(e){var t=Dd(),n=F.useDrag((function(){return{type:"componentWidthDragHandle",item:{displayRow:e.displayRow,cellIndex:e.cellIndex,rowIndex:e.rowIndex},collect:function(e){return{isDragging:e.isDragging()}}}}),[JSON.stringify(e.displayRow),JSON.stringify(e.rowIndex)]);return n[0].isDragging?null:p.jsx("div",{ref:n[1],className:Pk.dragHandle(null==t?void 0:t.dashboard)+" "+Pk.cellDragHandle({highlighted:null!=e&&e.rowHighlighted?"true":"false"})})},Hk=t.forwardRef((function(e,n){var i=e.generatingPDF,o=t.useState(!1),a=o[0],l=o[1],s=Uk(),u=s[0],d=s[1],c=Pu(),f=c.scope,m=c.textOverride,h=c.featureToggles,v=c.customViews,g=qm().dispatch,x=Dd(),b=function(e){return parseFloat(((e-1)/12).toFixed(2))}(d),y=F.useDragLayer((function(t){var n=t.getItem(),i=t.getItemType(),o=t.getDifferenceFromInitialOffset(),a=[].concat(Ra(12)).map((function(){return 0})),l=0;if(null!=o)if("rowHeightDragHandle"==i&&e.rowIndex==n.rowIndex)l=o.y;else if("componentWidthDragHandle"==i&&n&&e.rowIndex==n.rowIndex){var s=(n.displayRow.components[n.cellIndex+1].colSpan-2)*b,u=r.max([-(n.displayRow.components[n.cellIndex].colSpan-2)*b,o.x]);u=r.min([s,u]),a[n.cellIndex]=u,a[n.cellIndex+1]=-u}return{rowHeightAdjustment:l,moveType:i,adjustRowIndex:e.rowIndex,widthAdjustments:a,activeCell:n?n.cellIndex:null,activeRow:n?n.rowIndex:null,isDraggingComponentWidth:"componentWidthDragHandle"==i}})),w=y.rowHeightAdjustment,C=y.widthAdjustments,j=y.activeCell,S=y.activeRow,k=y.moveType,A=y.isDraggingComponentWidth,T=t.useRef(null),_=t.useState(),I=_[0],D=_[1];t.useEffect((function(){T.current&&D(T.current.offsetWidth)}),[]);var O,E=e.displayRow.components.some((function(e){return au(e)})),L=w+(E?52:e.displayRow.height),N=v.find((function(e){var t;return xv(e)&&(null==(t=e.options)?void 0:t.disableAddCell)}));return p.jsx("div",{ref:T,onMouseOver:function(){return l(!0)},onMouseLeave:function(){return l(!1)},onFocus:function(){return l(!0)},onBlur:function(){return l(!1)},className:es({position:"relative"}),"data-component":"resizable-row",children:p.jsxs(Td,{columns:e.columns,"data-component":"panel-row",marginBottom:E?void 0:26,children:[!e.hideAddCellColumn&&p.jsx("div",{className:(O="space-between",e.canAddNewCells&&(O="center"),0!==e.rowIndex||e.canAddNewCells||(O="flex-end"),es({display:"flex",alignItems:"stretch",paddingBottom:E?0:10,paddingTop:E?0:8,dataComponent:"add-cell",flexDirection:"column",gap:E?"0":"0.5rem",justifyContent:O})),"data-component":"add-cell","data-testid":"add-cell-max-reached","data-totalcells":!e.canAddNewCells&&(null==x?void 0:x.cellLimit),children:p.jsx(t.Fragment,{children:a&&"read_write"===f&&p.jsxs(t.Fragment,{children:[0!==e.rowIndex&&p.jsx(uf,{minHeight:E?0:26,width:32,children:p.jsx(qk,{rowIndex:e.rowIndex,headerRow:E,direction:Vk.Up})}),!e.hideAddNewHeaderRow&&!E&&e.canAddNewCells&&!N&&p.jsx(uf,{minHeight:32,width:32,children:p.jsx(dC,{onChange:e.onAddHeaderRow,narrow:!0,tooltipLabel:m("add_header_tooltip","Add Header Row"),label:m("add_header","Add Header"),"data-component":"add-header-row",className:If("add-header-row")})}),!E&&e.canAddNewCells&&!N&&p.jsx(dC,{onChange:e.onAppendCell,narrow:!0,tooltipLabel:m("add_cell_tooltip","Add Cell to Row"),label:m("add_cell","Add Cell"),"data-component":"add-cell-button",className:If("add-cell-button")}),e.rowIndex!==e.totalRows-1&&"read_write"===f&&p.jsx(uf,{minHeight:E?0:26,width:32,children:p.jsx(qk,{rowIndex:e.rowIndex,headerRow:E,direction:Vk.Down})})]})})}),p.jsxs("div",{className:""+Gk(L,f,e.displayRow.components.length,h.forceMobile),"data-component":"rowContainer",children:[A&&!E&&p.jsx(p.Fragment,{children:Ra(12).map((function(t,n){return p.jsx(zk,{onDrop:function(t,i,o){var a=r.cloneDeep(o),l=r.sumBy([].concat(a.components).splice(0,t),(function(e){return e.colSpan})),s=n+1-l,u=s-[].concat(a.components)[t].colSpan,d=[].concat(a.components).map((function(e){return e.colSpan}));d[t]=s,d[t+1]=d[t+1]-u,e.onColSpanChange(d.map((function(e){return{colSpan:e}})))},dropIndex:n,colWidth:b,active:null!=j},n)}))}),p.jsx("div",{className:es({width:"100%",height:"100%"}),ref:u,children:[].concat(e.displayRow.components).map((function(t,n){var r=n==e.displayRow.components.length-1,o="componentWidthDragHandle"==k&&null!=j&&e.rowIndex==S&&(j==n||j+1==n),l="rowHeightDragHandle"==k&&e.rowIndex==S;return p.jsx("div",{className:[""+Yk(L,b*t.colSpan+(C[n]||0),f,I,h.forceMobile),es({display:"inline-block",overflowY:"hidden"})].join(" "),"data-component":"cell-container",children:p.jsxs("div",{className:es({position:"relative",height:"100%"}),style:h.forceMobile&&!h.canRemoveComponentsFromDashboard?{width:"100%"}:{width:"calc(100% - 20px)"},children:[p.jsx(Lk,{generatingPDF:i,maxCSVDownloadLimit:e.maxCSVDownloadLimit,isBeingSizeAdjusted:o||l,onCreateNew:e.onCreateNew,onPickFromLibrary:e.onPickFromLibrary,onRemoveCell:e.onRemoveCell,rowIndex:e.rowIndex,cellIndex:n,trackEvent:e.trackEvent,height:L}),!r&&"read_write"===f&&!h.forceMobile&&!E&&p.jsx(Wk,{displayRow:e.displayRow,rowIndex:e.rowIndex,cellIndex:n,rowHighlighted:a})]})},"row_"+e.rowIndex+"_cell_"+n)}))}),"read_write"===f&&!h.forceMobile&&p.jsx(Bk,{onNewHeight:function(e,t){g({type:"setRowHeight",rowIndex:e,height:t})},displayRow:e.displayRow,rowIndex:e.rowIndex})]},"actual_resizable_row_"+e.rowIndex)]})})})),Yk=function(e,t,n,i,r){var o,a={width:null!=i?i:"100%",height:e};return Fl(r?a:"read"===n?((o={})["@media (min-width: 768px)"]={width:t,height:"100%"},o["@media (max-width: 767px)"]=a,o):{width:t,height:"100%"})},Gk=function(e,t,n,i){var r,o={height:e*n};return Fl(i?o:"read"===t?((r={})["@media (min-width: 768px)"]={height:e},r["@media (max-width: 767px)"]=o,r):{height:e})},Uk=function(){var e=t.useRef(null),n=t.useState(0),i=n[0],r=n[1];return t.useEffect((function(){r(e.current?e.current.clientWidth:0);var t=function(){r(e.current?e.current.offsetWidth:0)};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}})),[e,i]},Kk=function(e){return p.jsx("div",{style:e.dashboardGridSettings,"data-component":"studio-views",id:"vizzly_dashboard_content",children:e.display.map((function(t,n){return c.createElement(Xk,ge({},e,{key:e.id+"_"+n,displayRow:t,rowIndex:n,lastRow:n===e.display.length-1,fieldLength:e.display.length}))}))})},Xk=function(e){var t,n,i,r=Pu(),o=r.maxCSVDownloadLimit,a=r.pdfSettings,l=r.textOverride,s=r.featureToggles,u=qm(),d=u.dispatch,c=u.trackEvent,f=Dd(),m=e.rowIndex;return p.jsx(Hk,{maxCSVDownloadLimit:o,onCreateNew:function(e,t){d({type:"startEditingComponent",displayTarget:{rowIndex:e,cellIndex:t},libraryIndex:null,component:null})},onPickFromLibrary:function(e,t){c("library.open"),d({type:"startPickingComponentFromLibraryForDisplay",rowIndex:e,cellIndex:t})},onRemoveCell:function(e,t){c("manageDisplay.removeCell"),d({type:"removeCell",rowIndex:e,cellIndex:t})},rowIndex:m,trackEvent:c,displayRow:e.display[m],generatingPDF:null!=(t=null==a?void 0:a.generatingPDF)?t:!0===e.generatingPDF,onColSpanChange:function(e){d({type:"setColSpans",colSpans:e,rowIndex:m})},canAddNewCells:(n=e.displayRow,s.canAddNewCells&&n.components.length<(null!=(i=null==f?void 0:f.cellLimit)?i:4)),hideAddCellColumn:e.hideAddCellColumn,columns:e.gridColumns,onAppendCell:function(){return function(e){c("manageDisplay.appendCell"),d({type:"appendCell",rowIndex:e})}(m)},onAddHeaderRow:function(){return function(e){d({type:"addHeaderRow",rowIndex:e,initialTitle:l("header.new_header","New Header")})}(m)},totalRows:e.display.length,hideAddNewHeaderRow:_k(e.display,m),marginBottom:e.pdfPageBreaks?e.pdfPageBreaks[m]:void 0},"dashboard_"+e.id+"_row_"+m)},Qk=Object.assign((function(){}),{wrapper:function(e){return Fl({position:"relative",border:null==e?void 0:e.border,background:null==e?void 0:e.background,borderRadius:null==e?void 0:e.borderRadius})},input:function(e){var t,n,i;return Fl(ge({color:"inherit",width:"100%",border:0,height:null==e?void 0:e.height,background:"transparent",padding:null==e?void 0:e.padding,fontSize:null==e?void 0:e.fontSize,borderRadius:null==e?void 0:e.borderRadius,fontWeight:null==e?void 0:e.fontWeight,boxSizing:"border-box"},Cl,{"&:hover":ge({},Cl,{outline:0,boxShadow:e?null==(t=e["&:hover"])?void 0:t.boxShadow:void 0,background:e?null==(n=e["&:hover"])?void 0:n.background:void 0}),"&:focus":ge({},Cl,{outline:0,boxShadow:e?null==(i=e["&:focus"])?void 0:i.boxShadow:void 0})}))},icon:function(e){var t,n;return Fl({color:null==e||null==(t=e.icons)?void 0:t.color,height:18,width:18,"> * svg":{fill:null==e||null==(n=e.icons)?void 0:n.color}})},iconWrapper:Fl({top:8,right:12,position:"absolute",display:"flex",gap:"0.5rem"})}),Zk=t.forwardRef((function(e,n){var i=e.placeholder,r=e.onChange,o=e.initialValue,a=e.inputRef,l=t.useState(null!=o?o:""),s=l[0],u=l[1],d=function(e,n){var i=t.useState(e),r=i[0],o=i[1];return t.useEffect((function(){var t=setTimeout((function(){o(e)}),500);return function(){return clearTimeout(t)}}),[e,500]),r}(s);t.useEffect((function(){r(d)}),[r,d]);var c=function(){return u("")},f=Dd();return p.jsx("form",{autoComplete:"off",children:p.jsxs("div",{role:"search",className:""+Qk.wrapper(null==f?void 0:f.search),"data-themeapi":"search","data-chipposition":"top.left",children:[p.jsx(ug,{as:"label",htmlFor:"fuzzy-search-input",children:"Search"}),p.jsx("input",{value:s,onChange:function(e){return u(e.target.value)},id:"fuzzy-search-input",name:"fuzzy-search-input",className:""+Qk.input(null==f?void 0:f.search),placeholder:i,ref:a,"data-testid":"fuzzy-search-input"}),p.jsxs("span",{className:""+Qk.iconWrapper,children:[s&&p.jsx(Rf,{onClear:function(){return c&&c()},className:""+Qk.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"}),p.jsx(y.SearchIcon,{className:""+Qk.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"})]})]})})})),Jk=function(e){var t,n=null!=(t=null==e?void 0:e.percentage)?t:50;return p.jsx("div",{style:{height:e.height*(n/100)+"px"},children:p.jsx("div",{style:{width:e.width+"px",height:e.height+"px"},className:es(ge({},50===n&&{transform:"scale(0.5) translate(-25%,-25%)"})),children:e.children})})},$k=function(e){var t=Pu();return p.jsxs(Mh,{width:"xl","data-testid":"add-tags-modal",isOpen:e.show,onClose:function(){return e.onClose()},hideCloseIcon:!0,children:[p.jsx(Mh.Header,{title:(0,t.textOverride)("tags.modal_title","Add Tags"),show:!0}),e.show&&p.jsx(eA,ge({},e))]})},eA=function(e){var n,i,r=(n=qm().dashboard,i=new Set,n.componentLibrary.forEach((function(e){var t;[].concat(null!=(t=e.attributes.tags)?t:[]).forEach((function(e){i.add(e)}))})),Array.from(i)),o=function(){return function(e){var t=new Set,n=[];return e.forEach((function(e){t.has(e.key)||(t.add(e.key),n.push({value:e.key,label:e.key}))})),n}(r)},a=t.useState(function(){var t=o(),n=[];return t.map((function(t,i){e.component.attributes.tags.map((function(e){t.value===e.key&&n.push(i)}))})),n}()),l=a[0],s=a[1],u=t.useState(!1),d=u[0],c=u[1],f=t.useState(""),m=f[0],h=f[1],v=Pu().textOverride,g=t.useState(o()),x=g[0],b=g[1];return p.jsxs(t.Fragment,{children:[p.jsx(Mh.Content,{children:p.jsxs(yf,{width:"100%",children:[!d&&p.jsx(uf,{flex:1,children:p.jsx(ev,{label:v("tags.select_label","Tags"),setSelected:function(e){s(e)},id:"multi-tenancy-filter-guard",options:x,selected:l,onFreeTextSelected:function(){return c(!0)},freeTextOptions:{label:v("tags.select_add_new_tag","Add New Tag")}})}),d&&p.jsxs(yf,{flex:1,gap:"0.5rem",children:[p.jsx(uf,{flex:1,width:"100%",children:p.jsx($f,{type:"string",onChange:function(e){h(e.target.value)},id:"free-text-tag",autoFocus:!0,value:m,label:v("tags.select_new_tag","New Tag")})}),p.jsx(uf,{paddingTop:24,children:p.jsxs(hh,{children:[p.jsx(sh,{tooltipContent:function(){return m.trim()?v("tags.model_add","Add Tag"):v("tags.invalid","Enter value to add")},children:p.jsxs(gh,{onClick:function(){""!==m.trim()&&(x.find((function(e){return e.value===m}))||(b((function(e){return[].concat(e,[{value:m,label:m}])})),s((function(e){return[].concat(e,[x.length])}))),h(""),c(!1))},disabled:!m.trim(),className:es({lineHeight:"1.4rem",paddingBottom:0,paddingLeft:"0.75rem",paddingRight:"0.75rem"}),children:[p.jsx("span",{className:""+Xl,children:v("tags.model_add","Add Tag")}),p.jsx(bd,{})]})}),p.jsx(sh,{tooltipContent:function(){return v("tags.model_add","Cancel")},children:p.jsxs(gh,{className:es({lineHeight:"1.4rem",paddingBottom:"0.25rem",paddingLeft:"0.75rem",paddingRight:"0.75rem"}),onClick:function(){h(""),c(!1)},children:[p.jsx("span",{className:""+Xl,children:v("tags.model_cancel","Cancel")}),p.jsx(Qu,{})]})})]})})]})]})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:v("close","Close")}),p.jsx(gh,{onClick:function(){return t=l.map((function(e){return{key:x[e].value}})),e.setTags(t),void e.onClose();var t},primary:!0,disabled:d,children:v("update","Update")})]})})]})},tA=function(e){var i=t.useState(!1),r=i[0],o=i[1],a=t.useState(!1),l=a[0],s=a[1],u=t.useState(!1),d=u[0],c=u[1],f=qm().dispatch,m=e.component,h=e.libraryIndex,v=n.useState(!1),g=v[0],x=v[1],b=Pu(),y=b.mode,w=b.queryEngineConfig,C=window.disableViewCheck||g,j=Dd(),F="admin"===y||!m.attributes.protectedByOrganisation&&"endUser"===y,S=Go(e.component.attributes.type,{queryEngineConfig:w});return p.jsx(t.Fragment,{children:p.jsx(le,{active:!g,partialVisibility:!0,onChange:x,children:p.jsxs("button",{onClick:function(){return e.onSelectComponent(h)},className:""+$l.selectedComponent(null==j?void 0:j.panels)({componentSelect:h===(null==e?void 0:e.selectedIndex)&&"true"}),"aria-selected":h===(null==e?void 0:e.selectedIndex),children:[p.jsxs(ug,{children:["View ",h+1,m.attributes.displayTitle?": "+m.attributes.displayTitle:""]}),!C&&p.jsx("div",{style:{height:"170px"},children:p.jsx(Nf,{})}),C&&p.jsx(bS,{children:p.jsxs(Jk,{width:340,height:306,percentage:100,children:[F&&p.jsx(nA,{label:"View "+(h+1)+" Options",onEdit:function(){return null==e?void 0:e.onEdit(h)},onDelete:function(){return null==e?void 0:e.onDelete(h)},onSetParameters:function(){return o(!0)},onAddFilter:function(){return s(!0)},onAddTags:function(){return c(!0)},attributes:m.attributes}),p.jsx(lS,{isBeingSizeAdjusted:!1,id:"library_"+h+"_"+Math.floor(1e11*Math.random()),setLocalFilters:function(){},runQueriesCallback:e.runQueriesCallback,component:m,setResults:function(t){return e.setResults(t,h)},updateComponentAttributes:e.updateComponentAttributes,library:!0})]})},"select_component_preview_"+h),p.jsx(sk,{setPartialAttributes:function(t){return e.updateComponentAttributes(S.setAttributes(e.component.attributes,t))},libraryIndex:e.libraryIndex,show:r,component:e.component,onClose:function(){return o(!1)}}),p.jsx(CS,{component:e.component,onClose:function(){return s(!1)},show:l,setLocalFilters:function(e){f({type:"setLocalFilters",localFilters:e,libraryIndex:h})}}),p.jsx($k,{component:e.component,onClose:function(){return c(!1)},show:d,setTags:function(e){f({type:"updateComponentLibraryAttributes",attributes:ge({},m.attributes,{tags:e}),libraryIndex:h})}})]})})})},nA=function(e){var i,r=n.useRef(null),o=Pu(),a=Go(null==e?void 0:e.attributes.type),l=t.useState(!1),s=l[0],u=l[1],d=t.useState(void 0),c=d[0],f=d[1],m=[{purpose:"editComponentsOnLibrary",renderIcon:function(){return p.jsx(td,{})},onClick:function(){return e.onEdit()}},{purpose:"removeComponentFromLibrary",renderIcon:function(){return p.jsx($u,{purpose:"removeComponentFromDashboard"})},onClick:function(){return e.onDelete()}}];o.featureToggles.parameters&&null!=(i=a.supportedFeatures)&&i.parameters&&"read_write"===o.scope&&m.push({purpose:"parameters",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(Xu,{})})},onClick:function(){return e.onSetParameters()}}),"read_write"===o.scope&&o.featureToggles.canAddTags&&m.push({purpose:"addTags",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(xd,{})})},onClick:function(){return e.onAddTags()}}),o.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(Uu,{active:!1})})},onClick:function(){return e.onAddFilter()}});var h=Dd();return p.jsxs("div",{className:es({position:"absolute",right:"-20px",top:"0"}),ref:r,children:[p.jsxs("button",{"data-testid":"open-component-options",onClick:function(e){e.stopPropagation(),u(!s),r.current&&f(r.current.getBoundingClientRect())},"data-themeapi":"dashboard.icon",className:px(null==h?void 0:h.dashboard)+" "+Ql.button+" open-component-options",children:[p.jsx(ug,{children:null==e?void 0:e.label}),p.jsx(rd,{})]}),s&&p.jsx(cf,{onClose:function(){return u(!1)},position:c,children:p.jsx(cS,{onClose:function(){return u(!1)},cellOptions:m})})]})},iA=function(){},rA=Object.assign(tx,{Cell:lx,Add:ox,Container:ax,Item:Object.assign((function(e){var n,i,r,o,a,l,s,u,d,c=e.index,f=e.onOrderChange,m=f&&e.totalItemsCount>1,h=f?(i={id:"re-order-drag-"+e.index,index:e.index,type:"list-view-drag"},r=e.onOrderChange||iA,o=t.useRef(null),a=F.useDrop({accept:i.type,collect:function(e){return{handlerId:e.getHandlerId()}},hover:function(e,t){var n;if(o.current){var a=e.index,l=i.index;if(a!==l){var s=null==(n=o.current)?void 0:n.getBoundingClientRect(),u=(s.bottom-s.top)/2,d=t.getClientOffset().y-s.top;a<l&&d<u||a>l&&d>u||(r(a,l),e.index=l)}}}})[1],s=(l=F.useDrag({type:i.type,item:function(){return{id:i.id,index:i.index}},collect:function(e){return{isDragging:e.isDragging()}}}))[0].isDragging,d=l[2],(u=l[1])(a(o)),[o,d,s,u]):[null,null];return p.jsx(yf,{cursor:m?"ns-resize":void 0,"data-component":"listview-item",role:"listitem",as:null!=(n=e.as)?n:"fieldset",children:p.jsx("div",{onClick:function(){return e.onChange?e.onChange(c):void 0},className:""+jf.itemWrapper,children:p.jsxs(lx,{clickable:!!e.onChange,highlight:e.highlight,ref:h[0],children:[(null==e?void 0:e.title)&&p.jsx(yf,{"data-component":"list-cell-row-title",paddingY:"0.5rem",paddingRight:"0.5rem",paddingLeft:"0.5rem",className:""+jf.titleContainer()({hasBorder:null!=e&&e.children?"true":"false"}),children:p.jsx(TF.Title,{title:null==e?void 0:e.title})}),(null==e?void 0:e.children)&&p.jsx(yf,{direction:"row","data-component":"list-cell-row",gap:"0.5rem",paddingY:"0.1rem",paddingRight:"0.5rem",paddingLeft:"0.5rem",alignItems:"center",children:null==e?void 0:e.children})]})})})})),Heading:kF}),oA=function(e){var t=Pu().textOverride;return p.jsxs(Td,{gap:"0.5rem",children:[p.jsx(rA.Heading,{id:"filter-list",className:es({padding:"0.5rem",margin:0,borderBottom:"2px solid #ccc"}),children:t("library.filter","Filters")}),p.jsx(yf,{direction:"column",as:"ul",className:""+Ql.ulReset,"aria-labelledby":"filter-list",children:e.tags.map((function(t){var n=function(){if(e.selected.length>0&&e.selected.map((function(e){return e.key})).includes(t.key))return t.key}();return p.jsx(uf,{paddingY:"0.25rem",flex:1,as:"li",className:""+Ql.liReset,children:p.jsx(oj,{type:"checkbox",name:t.key,selected:n,onChange:function(){return function(t){[].concat(e.selected).includes(t)?e.onTagSelected([].concat(e.selected).filter((function(e){return e!==t}))):e.onTagSelected([].concat(e.selected,[t]))}(t)},option:{value:t.key,label:t.key}})},t.key)}))})]})},aA=function(e){var n=t.useState({tags:[]}),i=n[0],o=n[1],a=Pu().textOverride;if(r.isEmpty(e.components))return p.jsx(zg,{title:a("library.no_results","Your library is empty")});var l=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&e.current.focus()}),[]),e}(),s=[].concat(e.components).map((function(e){return{displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,component:e}})),u=hf(s,["displayTitle","displaySubject"]),d=u.values,c=u.setSearch;t.useEffect((function(){var t;null==e||e.onSelectComponent(null==(t=d[0])?void 0:t.refIndex)}),[u.searchString]);var f=function(e){var t=new Set,n=new Set;return e.forEach((function(e){var i;[].concat(null!=(i=e.attributes.tags)?i:[]).forEach((function(e){t.has(e.key)||(t.add(e.key),n.add(e))}))})),Array.from(n)}(e.components),m=[].concat(d).filter(function(e){return function(t){return 0===e.tags.length||e.tags.every((function(e){return t.item.component.attributes.tags.some((function(t){return t.key===e.key}))}))}}(i));return p.jsxs(yf,{children:[p.jsx(uf,{padding:"1.5rem",flex:4,paddingLeft:f.length>0?0:void 0,children:p.jsxs(Td,{gap:"1.5rem",rows:["48px","1fr"],children:[p.jsx(uf,{children:p.jsx(Zk,{placeholder:a("library.search_library","Search Library"),onChange:c,inputRef:l})}),p.jsx(uf,{children:p.jsxs(Td,{columns:f.length>0?["repeat(2, 1fr)"]:["repeat(3, 1fr)"],gap:"1.5rem",children:[0===m.length&&p.jsx(zg,{title:a("library.search_returned_no_results","Your search returned no results")}),[].concat(m).map((function(t){var n=t.refIndex;return p.jsx(tA,{updateComponentAttributes:e.updateComponentAttributes,setResults:e.setResults,component:t.item.component,libraryIndex:n,onSelectComponent:null==e?void 0:e.onSelectComponent,runQueriesCallback:e.runQueriesCallback,selectedIndex:null==e?void 0:e.selectedIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit},n)}))]})})]})}),f.length>0&&p.jsx(uf,{flex:1,minWidth:304,paddingRight:0,padding:"1.5rem",children:p.jsx(oA,{onTagSelected:function(e){o({tags:e})},tags:f,selected:i.tags})})]})},lA=function(){var e=qm(),n=e.dispatch,i=e.dashboard,o=e.trackEvent,a=e.runQueriesCallback,l=t.useState(0),s=l[0],u=l[1],d=t.useState(null),c=d[0],f=d[1],m=Pu(),h=m.featureToggles,v=m.textOverride,g=h.canEditComponentLibrary,x=function(){var e=i.componentLibrary.length;o("library.startCreatingNew"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:null})};return r.isEmpty(i.componentLibrary)?p.jsx("div",{className:[If("modal-empty-library"),es({margin:"0 auto",height:"384px"})].join(" "),children:p.jsx(zg,{title:v("library.no_view_in_library","There are no Views in your template library"),renderExtra:function(){return h.canEditComponentLibrary&&p.jsx("div",{className:es({marginTop:"12px"}),children:p.jsx(Pv,{onClick:x,children:v("library.create_new","Create New")})})}})}):p.jsxs(p.Fragment,{children:[p.jsx(sA,{runQueriesCallback:a,onClose:function(){o("library.close"),n({type:"clearModal"})},onSelect:function(){n({type:"pickComponentFromLibraryForDisplay",libraryIndex:s})},updateComponentAttributes:function(e){n({type:"updateComponentLibraryAttributes",attributes:e,libraryIndex:s})},setFocussedComponentResults:function(e){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:s})},dashboard:i,selectedLibraryIndex:s,setResults:function(e,t){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:t})},canEditComponentLibrary:g,onEdit:function(e){var t=ge({},i.componentLibrary[e]);o("library.startEditing"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:t})},onDelete:f,onCreate:x,onSelectComponent:function(e){o("library.switchSelectedComponent"),u(e)}}),p.jsx(uA,{open:null!==c,onClose:function(){return f(null)},onDelete:function(){null!==c&&n({type:"removeComponentFromLibrary",libraryIndex:c}),f(null),u(0)}})]})},sA=function(e){var n,i,r=Dd(),o=Pu().textOverride,a="boolean"==typeof(null==r||null==(n=r.modals)||null==(n=n.options)||null==(n=n.showTitle)?void 0:n.library)&&!(null!=r&&null!=(i=r.modals)&&null!=(i=i.options)&&null!=(i=i.showTitle)&&i.library);return p.jsxs(t.Fragment,{children:[p.jsx(Mh.Header,{title:o("library.select_template","Select Template"),"data-component":"library-header",hide:a}),p.jsx(Mh.Content,{scrollable:!0,"data-component":"library-content",children:p.jsx(aA,{runQueriesCallback:null==e?void 0:e.runQueriesCallback,setResults:null==e?void 0:e.setResults,components:e.dashboard.componentLibrary,onSelectComponent:function(t){return null==e?void 0:e.onSelectComponent(t)},updateComponentAttributes:null==e?void 0:e.updateComponentAttributes,selectedIndex:null==e?void 0:e.selectedLibraryIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit})}),p.jsxs(Mh.Footer,{buttons:"space-between","data-component":"library-footer",children:[p.jsx(hh,{"data-component":"library-footer-left",children:(null==e?void 0:e.canEditComponentLibrary)&&p.jsx(Pv,{testId:"library-create-new",onClick:function(){return null==e?void 0:e.onCreate()},secondary:!0,children:o("library.create_new","Create New")})}),p.jsxs(hh,{buttons:"end","data-component":"library-footer-right",children:[p.jsx(Pv,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:o("close","Close")}),p.jsx(Pv,{testId:"add-view-from-library-to-dashboard",onClick:function(){return null==e?void 0:e.onSelect()},children:o("library.add_to_dashboard","Add to Dashboard")})]})]})]})},uA=function(e){return p.jsxs(Mh,{width:"sm",isOpen:null==e?void 0:e.open,onClose:function(){return null==e?void 0:e.onClose()},children:[p.jsx(Mh.Header,{title:"Are you sure?"}),p.jsx(Mh.Content,{children:p.jsx("p",{className:""+Ql.text,children:"Are you sure you want to delete this component from your library?"})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Cancel"}),p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onDelete()},children:"Delete"})]})})]})},dA=t.createContext(void 0),cA=function(){return t.useContext(dA)},pA=["How could I improve this visualisation?","Show me a line chart."],fA=t.createContext({}),mA=function(e){var n=t.useState(void 0),i=n[0],r=n[1],o=t.useState(!1),a=o[0],l=o[1],s=function(){var t=me(Ce().mark((function t(){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l(!0),a||i){t.next=15;break}return t.prev=2,t.next=5,e.fetchSuggestions();case 5:r(t.sent),l(!1),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),Je(t.t0),r(pA),l(!1);case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(){return t.apply(this,arguments)}}();return p.jsx(fA.Provider,{value:{onAsk:e.onAsk,onAction:e.onAction,suggestions:i,fetchSuggestions:s},children:e.children})},hA=function(){return t.useContext(fA)},vA=function(e){return p.jsx("div",{className:es({gridColumn:"span 2 / span 2"}),children:e.children})},gA=function(e){return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(yf,{gap:"0.75rem",direction:"column",children:e.section.subSection.map((function(t,n){return p.jsxs(vA,{children:[p.jsx(Ch,{children:t.title}),p.jsx(RS,ge({componentType:e.attributes.type},e,{allowsMultiple:t.allowsMultiple,propKey:t.propKey,setPartialAttributes:e.setAttributes,supportedAggregates:e.queryEngineConfig.supportedAggregates}))]},n)}))})})},xA=function(e){var t=e.dataSets.filter((function(e){return!e.hide}));return t.length<2&&!e.dataSet.preAggregated?null:p.jsx(TF,{title:e.section.title,tooltip:e.section.description,"data-component":"dataset-section",children:p.jsx(IS,ge({},e,{dataSets:t,setPartialAttributes:e.setAttributes}))})},bA=function(e){var t=Pu();return 0==YS(t.featureToggles,e.attributes.type,null==e?void 0:e.queryEngineConfig,t.textOverride).length||e.dataSet.preAggregated?null:p.jsx(p.Fragment,{children:e.featureToggles.canEditCustomMetrics&&p.jsx(TF,{title:e.section.title,tooltip:e.section.description,"data-component":"custom-metric-section",children:p.jsx(US,{queryEngineConfig:e.queryEngineConfig,setDataSets:e.setDataSets,dataSetId:e.attributes.dataSetId,dataSets:e.dataSets,componentType:e.attributes.type})})})},yA=function(e){if(e.dataSet.preAggregated)return null;if(!("order"in e.attributes))return null;var t=e.attributes,n=[],i=[];if("comboChart"===t.type){if(!("barDimension"in t&&"lineDimension"in t&&"barMeasure"in t&&"lineMeasure"in t))return null;var r=function(e){var t=[].concat(e.barDimension,e.lineDimension),n=[].concat(e.barMeasure,e.lineMeasure);return{dimension:t.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t})),measure:n.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t}))}}(t);n=r.dimension,i=r.measure}else{if(!("dimension"in t))return null;if(!("measure"in t))return null;n=t.dimension,i=t.measure}return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,"data-component":"sort-section",children:p.jsx(BS,ge({},e,{attributes:t,timeDimension:"timeDimension"in t&&t.timeDimension||null,dimension:n,measure:i,setPartialAttributes:e.setAttributes,queryEngineConfig:e.queryEngineConfig}))})},wA=function(e){var t,n=Pu(),i=n.mode,r=n.textOverride,o=qm().dispatch,a=void 0===e.drilldownOptions||0===e.drilldownOptions.length,l=function(t){Xe("handleOnClose of Drilldown modal."),t&&e.onSetDrilldown(t),o({type:"setActiveModal",payload:{modal:GS.Drilldown,attributes:void 0}})},s=function(){o({type:"setActiveModal",payload:{modal:GS.Drilldown,attributes:{show:!0,onClose:l,drilldownOptions:e.drilldownOptions,dataSet:e.dataSet,dimension:e.dimensions,component:e.component}}})};return p.jsx(p.Fragment,{children:p.jsx(jx,{mode:i,onDeleteItem:function(){return e.onSetDrilldown([])},newItemBtn:a?{callToAction:r("add_drilldown","Add drilldown"),onClick:function(){return s()}}:void 0,items:a?[]:[{id:"drilldown-options",title:"Fields selected: "+(null==(t=e.drilldownOptions)?void 0:t.length),onClick:function(){return s()}}]})})},CA=function(e){var n=Pu(),i=n.mode,o=n.queryEngineConfig,a=n.textOverride,l=qm().dispatch;t.useEffect((function(){null!=e&&e.drilldown&&(null==e?void 0:e.drilldown.length)>0&&(0!==e.dimensions.length||r.isEmpty(e.drilldown)||e.onSetDrilldown([]))}),[e.dimensions]);var s=function(t){if(!(null==e||null==(t=e.drilldown)?void 0:t[0]))return[];var n=ot(null==e?void 0:e.drilldown[0].subsetDimension,o),i=Qo(e.dataSet,n.field);return[{title:qS(i.publicName,n.function&&"none"!=n.function&&_e(n.function,a)),id:"drilldown-subset-field"}]}();return p.jsx(jx,{mode:i,newItemBtn:r.isEmpty(null==e?void 0:e.drilldown)?{callToAction:a("add_drilldown","Add drilldown"),onClick:function(){l({type:"setActiveModal",payload:{modal:GS.TableDrilldown,attributes:{show:!0,onClose:function(t){return function(t){t&&e.onSetDrilldown([t]),l({type:"setActiveModal",payload:{modal:GS.TableDrilldown,attributes:void 0}})}(t)},dimension:e.dimensions,dataSet:e.dataSet}}})}}:void 0,onDeleteItem:function(){return e.onSetDrilldown([])},items:s})},jA=function(e){return"drilldownOptions"in e.attributes?p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(wA,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldownOptions:null==e?void 0:e.attributes.drilldownOptions,onSetDrilldown:function(t){return e.setAttributes({drilldownOptions:t})},component:e.attributes.type})}):"tableDrilldown"in e.attributes?p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(CA,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldown:null==e?void 0:e.attributes.tableDrilldown,onSetDrilldown:function(t){return e.setAttributes({tableDrilldown:t})}})}):null},FA=function(e){var t=Pu();return"filter"in e.attributes?e.dataSet.preAggregated?null:p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(tk,ge({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,textOverride:t.textOverride}))}):null},SA=function(e){var t=Pu();return"limit"in e.attributes?e.dataSet.preAggregated?null:p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(Ov,{label:(0,t.textOverride)("limit","Limit"),labelHidden:!0,id:"limit",currentValue:e.attributes.limit,setNumber:function(t){return e.setAttributes({limit:t||0})}})}):null},kA=function(e){var t=Pu().textOverride;if(!("limit"in e.attributes))return null;var n=e.section.options.map((function(e){return{value:e,label:e}}));return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(im,{children:p.jsx(nm,{label:t("rows_per_page","Rows per page"),id:"pagination-limit-input",testId:"pagination-limit-input",onChange:function(t){e.setAttributes({limit:t||0,offset:0})},options:n,selected:e.attributes.limit,textOverride:t,onClick:function(){return KC("bottom","editor-panel")}})})})},AA=function(e){var t=Pu().textOverride;return"comboChart"!=e.attributes.type?null:p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsxs(yf,{gap:"0.75rem",direction:"column","data-component":"combo-chart-compare",children:[p.jsxs(uf,{children:[p.jsx(Ch,{children:t("combo_chart.data_panel.dimension.line","Line")}),p.jsx(LS,ge({propKey:"lineDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),p.jsxs(uf,{children:[p.jsx(Ch,{children:t("combo_chart.data_panel.dimension.bar","Bar")}),p.jsx(LS,ge({propKey:"barDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),p.jsxs(uf,{children:[p.jsx(Ch,{children:t("combo_chart.data_panel.dimension.time","Time")}),p.jsx(NS,ge({},e,{attributes:{timeDimensions:e.attributes.timeDimension?[e.attributes.timeDimension]:[]},allow:1,supportedTimeDimensions:e.queryEngineConfig.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&(null==e||e.setAttributes({timeDimension:null!=(n=t.timeDimensions[0])?n:null}))}}))]})]})})},TA=function(e){return"measure"in e.attributes?p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(VS,ge({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},_A=function(e){return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,"data-component":"views-section",children:p.jsx(wv,ge({},e,{setPartialAttributes:e.setAttributes}))})},IA=function(e){return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(QS,ge({},e,e.section,{setPartialAttributes:e.setAttributes}))})},DA=function(e){return e.dataSet.preAggregated||"lineChartV2"!==e.attributes.type&&"lineChart"!==e.attributes.type||!OA(e.attributes)?null:p.jsx(TF,{title:e.section.title,tooltip:e.section.description,"data-component":"trends-section",children:p.jsx(nk,{trends:null==e?void 0:e.attributes.trends,onSetTrends:function(t){return e.setAttributes({trends:t})},dataSet:e.dataSet,componentAttributes:e.attributes})})},OA=function(e){return!("lineChartV2"!==e.type&&"lineChart"!==e.type||!("lineChart"===e.type&&"trends"in e&&"timeDimension"in e&&e.timeDimension&&cl(e.timeDimension))&&("lineChartV2"!==e.type||!("trends"in e)||!e.dimension.some((function(e){return["week","month","quarter","year"].includes(e.function)}))))},EA=function(e){return p.jsx(Td,{gap:"1.5rem",children:null==e?void 0:e.children})},LA=function(e){var t=Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),n=Uo(e.dataSet.fields,{onlyFieldTypes:["date_time"]}),i=Pu(),r=i.mode,o=i.textOverride;if(0===n.length)return null;var a,l=[];e.deltaTimeDimension&&l.push({title:Qo(e.dataSet,e.deltaTimeDimension.field).publicName,subtext:e.queryEngineConfig.supportedTimeTruncFunctions[null==(a=e.deltaTimeDimension)?void 0:a.truncate].publicName+" window",id:"delta-time-trunc",select:{onChange:function(t){e.deltaTimeDimension&&e.setDeltaTimeDimension(ge({},e.deltaTimeDimension,{truncate:t}))},selected:e.deltaTimeDimension?e.deltaTimeDimension.truncate:t[0],options:[].concat(t).map((function(t){return{label:e.queryEngineConfig.supportedTimeTruncFunctions[t].publicName,value:t}}))}});var s=[].concat(n).map((function(e,t){return{title:""+e.publicName,subtext:"",value:e.id,id:"delta-time-trunc-field-"+t}}));return p.jsx(jx,{mode:r,onDeleteItem:function(){e.setDeltaTimeDimension(null)},items:l,newItem:{callToAction:o("add_percentage_and_absolute_change","Add percentage and absolute change"),hide:null!=e.deltaTimeDimension,initValues:s,onNew:function(n){e.setDeltaTimeDimension({truncate:t[0],field:n,bucketFill:!1})}}})},NA=function(e){var t,n=Pu().queryEngineConfig,r=null==e?void 0:e.attributes;return t=Uo((null==e?void 0:e.dataSet).fields,{onlyFieldTypes:["date_time"]}),i(t)?null:p.jsx(TF,{title:"Comparison",children:p.jsx(LA,{dataSet:null==e?void 0:e.dataSet,deltaTimeDimension:r.deltaTimeDimension,setDeltaTimeDimension:function(t){e.setAttributes({deltaTimeDimension:t})},queryEngineConfig:n})})},MA=function(e){var t=e.attributes,n=e.dataSet,i=e.setAttributes,r=qm().dispatch,o=t.measure,a=Pu(),l=a.mode,s=a.queryEngineConfig,u=a.textOverride,d=function(e){if(e){var n=Ti(e.measure);i({measure:zA(o,n,e),goals:PA(t.goals,n,e),progressType:RA(t.progressType,n)})}r({type:"setActiveModal",payload:{modal:GS.Progress,attributes:void 0}})},c=[].concat(o).map((function(e,i){var o,a,l,c=Qo(n,e.field),f=null!=(o=null==(a=t.goals.find((function(t){return t.field===Ti(e)})))?void 0:a.value)?o:"-";return{title:p.jsxs(yf,{gap:"0.25rem",direction:"column",children:[p.jsx("div",{children:al(c.publicName,null==(l=s.supportedAggregates[e.function])?void 0:l.publicName)}),p.jsxs("div",{children:[u("goal_set_to","Goal set to"),": ",p.jsx("span",{className:""+Ql.bold,children:f})]})]}),icon:c.dataType,id:"progress-metric-"+i,onClick:function(){r({type:"setActiveModal",payload:{modal:GS.Progress,attributes:{show:!0,onClose:d,dataSet:n,progressMetric:{measure:e,goal:f}}}})}}}));return p.jsx(TF,{title:e.section.title,tooltip:e.section.description,children:p.jsx(TF.Container,{"data-component":"progress-input",children:p.jsx(jx,{mode:l,onOrderChange:function(e,t){var n=OS([].concat(o),e,t);i({measure:n})},purpose:"progress",newItemBtn:{callToAction:u("add_metric","Add metric"),onClick:function(){r({type:"setActiveModal",payload:{modal:GS.Progress,attributes:{show:!0,onClose:d,dataSet:n,progressMetric:void 0}}})}},onDeleteItem:function(e){var n=Ti(o[e]);i({measure:Pa(o,e),goals:t.goals.filter((function(e){return e.field!==n})),progressType:t.progressType.filter((function(e){return e.field!==n}))})},items:c})})})};function RA(e,t){var n=e.findIndex((function(e){return e.field===t})),i=[].concat(e);return-1!==n?i[n]={field:t,value:eS(e)}:i.push({field:t,value:eS(e)}),i}function PA(e,t,n){var i=e.findIndex((function(e){return e.field===t})),r=[].concat(e);return-1!==i?r[i]={field:t,value:n.goal}:r.push({field:t,value:n.goal}),r}function zA(e,t,n){var i=[].concat(e),r=i.findIndex((function(e){return Ti(e)===t}));return-1!==r?i[r]=n.measure:i.push(n.measure),i}var VA=function(e){var i=Pu().textOverride,r=e.dataPanelConfig.some((function(e){return"function"!=typeof e&&("filter"===e.type||"customMetrics"==e.type||"limit"==e.type)}))&&!e.dataSet.preAggregated;return p.jsxs(EA,{children:[e.dataPanelConfig.map((function(t,i){return"function"==typeof t?p.jsx(n.Fragment,{children:t({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+i):p.jsxs(n.Fragment,{children:["fieldCollector"==t.type&&p.jsx(IA,ge({},e,{section:t})),"drilldown"==t.type&&p.jsx(jA,ge({},e,{section:t})),"labelledMetrics"==t.type&&p.jsx(gA,ge({},e,{section:t})),"fields"==t.type&&p.jsx(TA,ge({},e,{section:t})),"progressGoals"===t.type&&p.jsx(MA,ge({},e,{section:t})),"dataSet"==t.type&&p.jsx(xA,ge({},e,{section:t})),"views"==t.type&&p.jsx(_A,ge({},e,{section:t})),"sort"==t.type&&p.jsx(yA,ge({},e,{section:t})),"pagination"==t.type&&p.jsx(kA,ge({},e,{section:t})),"comboChartDimension"==t.type&&p.jsx(AA,ge({},e,{section:t})),"comparison"==t.type&&p.jsx(NA,ge({},e,{section:t}))]},t.type+"_"+i)})),r&&p.jsx(ex,{title:i("advanced_options","Advanced Options"),defaultOpen:!1,showAccordionIcon:!0,onOpened:function(){KC("bottom","editor-panel")},children:p.jsx(EA,{children:e.dataPanelConfig.map((function(n,i){return"function"!=typeof n?p.jsxs(t.Fragment,{children:["filter"==n.type&&p.jsx(FA,ge({},e,{section:n})),"customMetrics"==n.type&&p.jsx(bA,ge({},e,{section:n})),"limit"==n.type&&p.jsx(SA,ge({},e,{section:n}))]},i):null}))})})]})},qA=function(){var e=iv(),t=Pu();if(!e)return p.jsx(Nf,{});var n=e.dataSet,i=e.queryEngineConfig,r=e.dataPanel,o=e.dashboard,a=e.setPartialAttributes,l=e.component.attributes;if(!n)throw"Data set required to show data props editor.";var s=Go(l.type,{queryEngineConfig:i,textOverride:e.textOverride});return p.jsx(ke,{renderOnError:function(e){return p.jsx(Qg,{onManualRetry:e})},onError:t.onError,children:p.jsx(VA,{setDataSets:e.setDataSets,setAttributes:a,setDataSet:e.setDataSet,dataSets:o.dataSets,dataSet:n,featureToggles:e.featureToggles,attributes:l,queryEngineConfig:i,dataPanelConfig:r(s.dataPanelConfig(),{type:l.type})})})},BA=function(e){var n,i=e.section,o=e.attributes,a=function(e){return t.useMemo((function(){return r.debounce((function(t){e(t)}),50)}),[e])}(e.setAttributes);return p.jsx(TF,{title:i.title,tooltip:null==i?void 0:i.description,children:p.jsx(TF.Grid,{children:null==i||null==(n=i.subSection)?void 0:n.map((function(e,n){return p.jsxs(t.Fragment,{children:["title"===e.type&&p.jsx("div",{children:p.jsx($f,{label:null==e?void 0:e.title,"data-testid":"display-title-input",id:"display-title-input",type:"text",onChange:function(e){return a({displayTitle:e.target.value})},defaultValue:o.displayTitle})}),"subject"===e.type&&p.jsx("div",{children:p.jsx($f,{label:null==e?void 0:e.title,"data-testid":"display-subject-input",id:"display-subject-input",type:"text",onChange:function(e){return a({displaySubject:e.target.value})},defaultValue:o.displaySubject})})]},n)}))})})},WA=function(e){var t,n=Pu(),i=n.numberFormatOptions,r=n.textOverride,o=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return p.jsx(im,{children:p.jsx(nm,{id:null==e?void 0:e.id,showClearBtn:!0,selected:null==e?void 0:e.currentValue,label:null!=(t=null==e?void 0:e.label)?t:r("format","Format"),onChange:function(t){return null==e?void 0:e.onChange(t)},options:o,textOverride:r})})},HA=function(e){var n=e.section,i=e.attributes,r=e.setAttributes,o=Pu().textOverride,a=n.subSection.some((function(e){return"legend"===e.type||"numberFormat"===e.type||"labels"===e.type})),l=n.subSection.some((function(e){return"stacked"===e.type||"curve"===e.type})),s=function(){var e=[{value:"natural",label:o("natural","Natural")},{value:"straight",label:o("straight","Straight")},{value:"step",label:o("step","Step")}];return"lineChart"===i.type&&e.push({value:"dotted",label:o("dotted","Dotted")}),e}();return p.jsx(TF,{title:n.title,tooltip:null==n?void 0:n.description,children:p.jsxs(Td,{gap:"1rem",children:[l&&p.jsx(TF.Grid,{columns:2,"data-component":"layout",children:null==n?void 0:n.subSection.map((function(e,n){return p.jsxs(t.Fragment,{children:["stacked"===e.type&&p.jsx(OC,{id:"format-layout-stacked",label:e.title,currentValue:void 0!==i.stacked&&i.stacked,onSelect:function(e){return r({stacked:e})},options:[{label:o("grouped","Grouped"),value:!1},{label:o("stacked","Stacked"),value:!0},{label:o("stacked_100prc","Stacked (100%)"),value:"100%"}]}),"curve"===e.type&&p.jsx(OC,{label:e.title,id:"format-layout-curve",currentValue:i.lineCurve,onSelect:function(e){return r({lineCurve:e})},options:s})]},n)}))}),a&&p.jsx(TF.Grid,{"data-component":"settings",children:null==n?void 0:n.subSection.map((function(e,n){return p.jsxs(t.Fragment,{children:["legend"===e.type&&p.jsx(IC,{label:e.title,setChecked:function(e){return r({legend:e})},currentValue:i.legend,id:"show-legend-input"}),"labels"===e.type&&p.jsx(IC,{label:e.title,setChecked:function(e){return r({labels:e})},currentValue:i.labels,id:"show-labels-input"}),"numberFormat"===e.type&&p.jsx(WA,{label:e.title,onChange:function(e){return r({labelFormat:e})},id:"format-number",currentValue:i.labelFormat,testId:"format-number"})]},n)}))})]})})},YA=function(e){var t,n,i,r,o,a,l,s,u,d,c,f,m,h,v,g,x=Pu(),b=x.textOverride,y=x.dateTimeFormatOptions,w=[{label:b("auto","Auto"),value:"auto"},{label:b("minimal","Minimal"),value:2},{label:b("None","None"),value:0}],C=Object.keys(y).map((function(e){return{label:y[e].description,value:e}})),j="horizontalBarChart"==e.attributes.type,F=(null==(t=e.attributes)||null==(t=t.dimension)?void 0:t.length)>0&&"number"===Qo(e.dataSet,null==(n=e.attributes)||null==(n=n.dimension[0])?void 0:n.field).dataType&&!(null!=(i=e.attributes)&&i.timeDimension),S=!(null==(r=e.attributes)||!r.timeDimension),k=j?{x:"y",y:"x"}:{x:"x",y:"y"},A=k.x,T=k.y;return p.jsx(TF,{title:null==(o=e.section)?void 0:o.title,tooltip:null==(a=e.section)?void 0:a.description,"data-component":"axis-preference-section",children:p.jsxs(TF.Container,{"data-component":"single-stats-labels",children:[p.jsxs(TF.Panel,{title:null==(l=e.section[T])?void 0:l.title,children:[p.jsxs(TF.Grid,{columns:2,children:[p.jsx(DC,{label:e.section[T].prefix.title,setText:function(t){return e.setAttributes({yAxisPrefix:t})},currentValue:e.attributes.yAxisPrefix,maxLength:4,id:"axis-"+T+"-prefix"}),p.jsx(DC,{label:e.section[T].postfix.title,setText:function(t){return e.setAttributes({yAxisPostfix:t})},currentValue:e.attributes.yAxisPostfix,maxLength:4,id:"axis-"+T+"-postfix"})]}),p.jsxs(TF.Grid,{columns:2,children:[p.jsx(WA,{label:null==(s=e.section[T].format)?void 0:s.title,id:"axis-"+T+"-format",onChange:function(t){return e.setAttributes({yAxisFormat:t})},currentValue:e.attributes.yAxisFormat,testId:"axis-"+T+"-format"}),p.jsx(OC,{id:"axis-"+T+"-label-count",label:e.section.y.count.title,currentValue:e.attributes.approxYAxisLabelCount,onSelect:function(t){return e.setAttributes({approxYAxisLabelCount:t})},options:w})]}),p.jsx(TF.Grid,{children:p.jsx(DC,{label:null!=(u=null==(d=e.section[T].axisTitle)?void 0:d.title)?u:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[T]=t,n)})},currentValue:null==(c=e.attributes.axisTitles)?void 0:c[T],id:"axis-"+[T]+"-axisTitle"})})]}),p.jsxs(TF.Panel,{title:e.section[A].title,children:[p.jsxs(TF.Grid,{columns:2,children:[p.jsx(DC,{label:e.section[A].prefix.title,setText:function(t){return e.setAttributes({xAxisPrefix:t})},currentValue:e.attributes.xAxisPrefix,maxLength:4,id:"axis-"+A+"-prefix"}),p.jsx(DC,{label:e.section[A].postfix.title,setText:function(t){return e.setAttributes({xAxisPostfix:t})},currentValue:e.attributes.xAxisPostfix,maxLength:4,id:"axis-"+A+"-postfix"})]}),p.jsx(TF.Grid,{columns:F||S?2:1,children:p.jsxs(p.Fragment,{children:[F&&p.jsx(WA,{label:null==(f=e.section[A].format)?void 0:f.title,id:"axis-"+A+"-format",onChange:function(t){e.setAttributes({xAxisFormat:t})},currentValue:e.attributes.xAxisFormat,testId:"axis-"+T+"-format"}),S?p.jsxs(p.Fragment,{children:[p.jsx(OC,{id:"axis-"+A+"-label-date-format",label:(null==(m=e.section.x)||null==(m=m.format)?void 0:m.title)||"Format",currentValue:e.attributes.xAxisFormat,onSelect:function(t){return e.setAttributes({xAxisFormat:t})},options:C}),p.jsx(OC,{id:"axis-"+A+"-label-count",label:e.section.x.count.title,currentValue:e.attributes.approxXAxisLabelCount,onSelect:function(t){return e.setAttributes({approxXAxisLabelCount:t})},options:w})]}):p.jsx(Rw,{label:b("hide_labels","Hide Labels"),onChange:function(t){return e.setAttributes({approxXAxisLabelCount:t?0:"auto"})},id:"hide-labels",currentValue:0===e.attributes.approxXAxisLabelCount})]})}),p.jsx(TF.Grid,{children:p.jsx(DC,{label:null!=(h=null==(v=e.section[A].axisTitle)?void 0:v.title)?h:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[A]=t,n)})},currentValue:null==(g=e.attributes.axisTitles)?void 0:g[A],id:"axis-"+[A]+"-axisTitle"})})]})]})})};function GA(e,t,n){var i;if("object"==typeof e&&null!==e){var r=o.findIndex(t,(function(t){return o.isEqual(t,e)}));-1!==r?(i=[].concat(t))[r]=n:i=[].concat(null!=t?t:[],[n])}else i=[].concat(null!=t?t:[],[n]);return i}var UA=Object.assign((function(){}),{Swatch:function(e){return p.jsx("span",{className:""+KA(e.color)})}}),KA=function(e){return Fl({backgroundColor:e,width:"1rem",height:"1rem",borderRadius:"0.125rem",display:"inline-block"})},XA=function(e){var t,n,i=Pu(),r=i.textOverride,o=i.valueAlias,a=null==(t=e.rule.filters)?void 0:t[0][0],l=a.field,s=a.function,u=a.value,d=a.op,c=Qo(e.dataSet,l),f=null!=(n=ul(u,o,{fieldId:l}))?n:u;return p.jsxs(yf,{alignItems:"center",as:"span",direction:"row",children:[p.jsx("span",{className:""+Ql.text,dangerouslySetInnerHTML:{__html:r("display_conditional_format_configuration","If <strong>[[fieldName]] [[fieldFunction]]</strong> is <strong>[[operator]]</strong> <strong>[[value]]</strong> then color is",{fieldName:c.publicName,fieldFunction:s&&"none"!=s?"("+s+")":"",operator:d,value:f})}}),p.jsxs(uf,{as:"span",marginLeft:"0.5rem",height:"1rem",children:[p.jsx(UA.Swatch,{color:e.rule.ruleValue}),e.rule.ruleValueEnd&&p.jsx(UA.Swatch,{color:e.rule.ruleValueEnd})]})]})},QA=function(e){var t=Pu(),n=t.mode,i=t.textOverride,r=qm().dispatch,o=function(t){r({type:"setActiveModal",payload:{modal:GS.ConditionalFormatting,attributes:{ruleType:e.ruleType,dataSet:e.dataSet,measures:e.measure,dimension:e.dimension||[],show:!0,onClose:function(){return a()},onSave:function(n){var i=GA(null!=t&&t,e.conditionalFormattingRules,n);e.onSetConditionalFormattingRules(i),a()},componentType:e.componentType,numberConditionalFormattingOnly:e.numberConditionalFormattingOnly,conditionalFormatting:null!=t?t:void 0}}})},a=function(){r({type:"setActiveModal",payload:{modal:GS.ConditionalFormatting,attributes:void 0}})};return p.jsx(jx,{mode:n,onOrderChange:function(t,n){var i=OS([].concat(e.conditionalFormattingRules),t,n);e.onSetConditionalFormattingRules(i)},items:ZA(e.queryEngineConfig,e.conditionalFormattingRules,e.dataSet,i,(function(e){return o(e)})),purpose:"conditional-formatting",newItemBtn:{callToAction:i("add_condition","Add Condition"),onClick:o},onDeleteItem:function(t){var n,i=[].concat(null!=(n=e.conditionalFormattingRules)?n:[]);i.splice(t,1),e.onSetConditionalFormattingRules(i)}})};function ZA(e,t,n,i,o){return(null!=t?t:[]).map((function(t,a){var l;if(!r.isArray(t.filters)||r.isArray(t.filters),0===t.filters[0].length)return{title:i("error","Error"),subtext:i("invalid_rule","Invalid or broken rule"),id:"conditional-formatting-rule-"+a};var s=ot(null==(l=t.filters)?void 0:l[0][0].field,e);try{return{title:Qo(n,s.field).publicName,subtext:p.jsx(XA,{dataSet:n,rule:t,queryEngineConfig:e}),onClick:function(){return o(t)},id:"conditional-formatting-rule-"+a}}catch(e){return{title:i("error","Error"),subtext:i("invalid_rule","Invalid or broken rule"),id:"conditional-formatting-rule-"+a}}}))}var JA=function(e){var t,n=e.section,i=e.attributes;return p.jsx(TF,{title:n.title,tooltip:null==n?void 0:n.description,children:p.jsx(yf,{gap:"0.75rem",direction:"column",children:n.subSection?null==(t=n.subSection)?void 0:t.map((function(t,r){var o,a,l="bar"===t.propKey?i.barMeasure:"line"===t.propKey?i.lineMeasure:[];return p.jsxs("div",{children:[p.jsx(Ch,{children:t.title}),p.jsx(QA,{dimension:"bar"===t.propKey?i.barDimension:[],ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(n){var i;return e.setAttributes({conditionalFormattingRules:(i={},i[t.propKey]=n,i)})},measure:l,dataSet:e.dataSet,conditionalFormattingRules:null!=(o=null==i||null==(a=i.conditionalFormattingRules)?void 0:a[t.propKey])?o:void 0,queryEngineConfig:e.queryEngineConfig,componentType:e.attributes.type,numberConditionalFormattingOnly:"line"===t.propKey})]},r)})):p.jsx(QA,{dimension:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)?[]:i.dimension,ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(t){return e.setAttributes({conditionalFormattingRules:t})},measure:i.measure,dataSet:e.dataSet,conditionalFormattingRules:i.conditionalFormattingRules,queryEngineConfig:e.queryEngineConfig,componentType:e.attributes.type,numberConditionalFormattingOnly:"lineColor"===(null==n?void 0:n.ruleType)||"areaColor"===(null==n?void 0:n.ruleType)})})})},$A=function(e){var n,i,r=Pu(),o=r.dateTimeFormatOptions,a=r.textOverride;return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:p.jsx(TF.Grid,{gap:"1.5rem",children:null==e||null==(i=e.section)||null==(i=i.subSection)?void 0:i.map((function(n,i){return p.jsxs(t.Fragment,{children:["time"===n.type&&p.jsx("div",{children:p.jsx(nm,{label:n.title,onChange:function(t){e.setAttributes({dateTimeFormat:t})},options:Object.keys(o).map((function(e){return{label:o[e].description,value:e}})),selected:e.attributes.dateTimeFormat,textOverride:a})}),"fontSize"===n.type&&p.jsx(DC,{label:null==n?void 0:n.title,currentValue:e.attributes.fontSize,setText:function(t){return e.setAttributes({fontSize:t})}}),"direction"===n.type&&p.jsx(ij,{options:[{label:"Horizontal",value:"horizontal"},{label:"Vertical",value:"vertical"}],name:"direction",label:"Layout Direction (Multiple stats only)",selected:e.attributes.direction,onChange:function(t){e.setAttributes({direction:t})}})]},i)}))})})},eT=function(e){var t,n,i=qm().dispatch,r=Pu(),o=r.textOverride,a=function(t){var n;t&&e.setAttributes({prefixes:[].concat(null!=(n=e.attributes.prefixes)?n:[],[t])}),i({type:"setActiveModal",payload:{modal:GS.Prefix,attributes:void 0}})};return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:p.jsx(jx,{mode:r.mode,items:(null!=(n=e.attributes.prefixes)?n:[]).map((function(t,n){var i=at(t.field,e.queryEngineConfig),r=i.function;return{title:Qo(e.dataSet,i.fieldId).publicName+("none"!=r?" ("+e.queryEngineConfig.supportedAggregates[r].publicName+")":""),subtext:t.prefix,id:"prefix-"+n}})),newItemBtn:{callToAction:o("add_prefix","Add Prefix"),onClick:function(){i({type:"setActiveModal",payload:{modal:GS.Prefix,attributes:{show:!0,onClose:a,measures:e.attributes.measure,dataSet:e.dataSet}}})}},onDeleteItem:function(t){var n,i=[].concat(null!=(n=e.attributes.prefixes)?n:[]);i.splice(t,1),e.setAttributes({prefixes:i})}})})},tT=function(e){var t,n=Pu().textOverride;if("mercatorMap"!=e.attributes.type)return null;var i=e.attributes,o=i.backgroundColor,a=i.noDataColor,l=i.maxValueColor,s=i.minValueColor,u=r.debounce(e.setAttributes,200);return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:p.jsxs(TF.Grid,{columns:2,children:[p.jsx("div",{children:p.jsx(AC,{id:"map-background-color",label:n("background","Background"),currentValue:o,setColor:function(e){return u({backgroundColor:e})}})}),p.jsx("div",{children:p.jsx(AC,{id:"map-no-data-color",label:n("no_data","No data"),currentValue:a,setColor:function(e){return u({noDataColor:e})}})}),p.jsx("div",{children:p.jsx(AC,{id:"map-min-value-color",label:n("min_value","Min value"),currentValue:s,setColor:function(e){return u({minValueColor:e})}})}),p.jsx("div",{children:p.jsx(AC,{id:"map-max-value-color",label:n("max_value","Max value"),currentValue:l,setColor:function(e){return u({maxValueColor:e})}})})]})})},nT=function(e){var t,n,i=Pu(),r=i.numberFormatOptions,o=i.textOverride,a=i.labelFormat,l=Object.keys(r).map((function(e){return{value:e,label:r[e].description}}));return p.jsxs(TF,{title:null==e||null==(t=e.section)?void 0:t.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[0==e.attributes.measure.length&&p.jsx("p",{className:es({fontSize:"12px",lineHeight:"16px",opacity:"0.8"}),children:o("stats_label_warning","Please select a metric on the data panel.")}),p.jsx(TF.Container,{"data-component":"single-stats-labels",children:[].concat(e.attributes.measure).map((function(t,n){var i,r,o,s,u,d=al(Qo(e.dataSet,t.field).publicName,null==(i=e.queryEngineConfig.supportedAggregates[t.function])?void 0:i.publicName),c=a({fieldId:t.field,func:t.function,type:e.attributes.type,defaultLabel:d,viewId:e.attributes.viewId});return p.jsxs(TF.Panel,{title:null!=c?c:d,children:[p.jsxs(TF.Grid,{columns:2,children:[p.jsx(DC,{id:"prefix_"+n,label:null==e||null==(r=e.section)?void 0:r.prefix.title,currentValue:e.attributes.prefixes?e.attributes.prefixes[Ti(t)]:void 0,setText:function(n){var i,r=ge({},e.attributes.prefixes,((i={})[Ti(t)]=n,i));e.setAttributes({prefixes:r})}}),p.jsx(DC,{id:"postfix_"+n,label:null==e||null==(o=e.section)?void 0:o.postfix.title,currentValue:e.attributes.postfixes?e.attributes.postfixes[Ti(t)]:void 0,setText:function(n){var i,r=ge({},e.attributes.postfixes,((i={})[Ti(t)]=n,i));e.setAttributes({postfixes:r})}})]}),p.jsx(TF.Grid,{children:p.jsx(OC,{id:"format_"+n,options:l,currentValue:e.attributes.formatter&&e.attributes.formatter[Ti(t)]||"_vizzly_number",onSelect:function(n){var i,r=ge({},e.attributes.formatter,((i={})[Ti(t)]=n,i));e.setAttributes({formatter:r})},label:null!=(s=null==e||null==(u=e.section)||null==(u=u.format)?void 0:u.title)?s:"Format"})})]},n)}))})]})},iT=function(e){var n,i=Pu(),r=i.mode,o=i.textOverride,a=i.variables,l=qm().dispatch,s=function(){l({type:"setActiveModal",payload:{modal:GS.GoalLines,attributes:void 0}})},u=function(t){l({type:"setActiveModal",payload:{modal:GS.GoalLines,attributes:{show:!0,onClose:function(){return s()},onSave:function(n){var i=GA(null==t||t,e.goalLines,n);e.onSetGoalLineRules(i),s()},goalLine:null!=t?t:void 0}}})};return p.jsx(p.Fragment,{children:p.jsx(jx,{mode:r,onOrderChange:function(t,n){var i=OS([].concat(e.goalLines),t,n);e.onSetGoalLineRules(i)},purpose:"goal-lines",items:(null!=(n=e.goalLines)?n:[]).map((function(e,n){var i=function(e,t){try{return Zt(e,Xt,t),!0}catch(e){return!1}}(e.value,null==a?void 0:a.variables);return{title:p.jsxs(yf,{alignItems:"center",gap:"0.25rem",children:[p.jsx(UA.Swatch,{color:e.color}),p.jsx("span",{dangerouslySetInnerHTML:{__html:o("goal_line_configuration","Set to <strong>[[ruleValue]]</strong>",{ruleValue:e.value})}}),!i&&p.jsx("div",{"aria-label":o("goal_line.variable_not_available","This variable is not available."),children:p.jsx(sh,{tooltipContent:function(){return p.jsx(t.Fragment,{children:o("goal_line.variable_not_available","This variable is not available.")})},children:p.jsx(Fd,{})})})]}),onClick:function(){return u(e)},id:"goal-line-"+n}})),newItemBtn:{callToAction:o("add_goal_line","Add Goal Line"),onClick:function(){return u()}},onDeleteItem:function(t){var n,i=[].concat(null!=(n=e.goalLines)?n:[]);i.splice(t,1),e.onSetGoalLineRules(i)}})})},rT=function(e){var t;return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:p.jsx(iT,{onSetGoalLineRules:function(t){return e.setAttributes({goalLines:t})},goalLines:e.attributes.goalLines})})},oT=function(e){var t=Pu().textOverride;return p.jsx(TF,{title:t("type","Type"),children:p.jsxs(TF.Grid,{children:[0===e.attributes.goals.length&&p.jsx(Hy,{type:"info",title:t("progress.goals_need to be set","Goals need to be set")}),p.jsx(Gy,{enabled:0===e.attributes.goals.length,children:p.jsx(OC,{options:[{value:jo.Linear,label:t("linear","Linear")},{value:jo.Circular,label:t("circular","Circular")}],currentValue:eS(e.attributes.progressType),onSelect:function(t){var n=e.attributes.progressType.map((function(e){return ge({},e,{value:t})}));e.setAttributes({progressType:n})},label:t("type","Type"),labelHidden:!0})})]})})},aT=function(e){var t,n,i,r=Pu().textOverride;if(e.dataSet.preAggregated)return null;if(!vy(e.attributes.order,e.attributes.timeDimension))return null;var o=[{label:r("none","None"),value:null},{label:r("current","Current"),value:"current"}];return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:p.jsx(nm,{id:"headline-options",label:r("options","Options"),labelHidden:!0,onChange:function(t){e.setAttributes({headline:{func:t}})},options:o,selected:null!=(n=null==(i=e.attributes.headline)?void 0:i.func)?n:null,textOverride:r,onClick:function(){KC("bottom","editor-panel")}})})},lT=function(e){var t;return p.jsx(TF,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:p.jsx(Tw,{})})},sT=function(e){return p.jsx(EA,{children:null==e?void 0:e.formatPanelConfig.map((function(i,r){return"function"==typeof i?p.jsx(n.Fragment,{children:i({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+r):p.jsxs(t.Fragment,{children:["heading"===i.type&&p.jsx(BA,ge({},e,{section:i})),"progressType"===i.type&&p.jsx(oT,ge({},e,{section:i})),"format"===i.type&&p.jsx($A,ge({},e,{section:i})),"prefixes"===i.type&&p.jsx(eT,ge({},e,{section:i})),"axisLabels"===i.type&&p.jsx(YA,ge({},e,{section:i})),"mapColors"===i.type&&p.jsx(tT,ge({},e,{section:i})),"conditionalFormatting"===i.type&&p.jsx(JA,ge({},e,{section:i})),"goalLine"===i.type&&p.jsx(rT,ge({},e,{section:i})),"chartStyles"===i.type&&p.jsx(HA,ge({},e,{section:i})),"headline"===i.type&&p.jsx(aT,ge({},e,{section:i})),"statsLabels"===i.type&&p.jsx(nT,ge({},e,{section:i})),"richText"===i.type&&p.jsx(lT,ge({},e,{section:i})),"trends"==i.type&&p.jsx(DA,ge({},e,{section:i}))]},r)}))})},uT=function(){var e=iv(),t=Pu();if(!e)return p.jsx(Nf,{});var n=Go(e.component.attributes.type,{queryEngineConfig:e.queryEngineConfig,textOverride:e.textOverride});return p.jsx(ke,{renderOnError:function(e){return p.jsx(Qg,{onManualRetry:e})},onError:t.onError,children:p.jsx(sT,{setDataSets:e.setDataSets,setAttributes:e.setPartialAttributes,setDataSet:e.setDataSet,dataSets:e.dashboard.dataSets,dataSet:null==e?void 0:e.dataSet,featureToggles:e.featureToggles,attributes:e.component.attributes,queryEngineConfig:e.queryEngineConfig,formatPanelConfig:e.formatPanel(n.formatPanelConfig(),{type:e.component.attributes.type})})})};function dT(e){var t=Pu().textOverride;return p.jsxs(Hh.Group,{defaultIndex:e.defaultTabOpen||0,children:[p.jsxs(Hh.List,{columns:"1fr 1fr",children:[p.jsx(Hh.Button,{"data-component":"tab-data",children:t("editor.tab.heading.data","Data")}),p.jsx(Hh.Button,{"data-component":"tab-format",children:t("editor.tab.heading.format","Format")})]}),p.jsxs(Hh.Panels,{children:[p.jsx(Hh.Panel,{children:p.jsx(qA,{})}),p.jsx(Hh.Panel,{children:p.jsx(uT,{})})]})]})}var cT=t.createContext(void 0),pT=function(){var e=t.useContext(cT);if(!e)throw new Error("useEditorFeedback must be used within an EditorFeedbackProvider");return e},fT=function(e){var n=e.children,i=t.useState([]),r=i[1];return p.jsx(cT.Provider,{value:{feedbackMessages:i[0],addFeedbackMessage:function(e){r((function(t){return[].concat(t,[e])}))},removeFeedbackMessage:function(e){r((function(t){return t.filter((function(t){return t.id!==e}))}))},clearAllFeedbackMessages:function(){r([])},setFeedbackMessages:r},children:n})},mT=function(){var e=pT();return p.jsx("div",{"data-component":"editor-modal-feedback",className:es({padding:"16px 24px 0",display:"grid",gridTemplateColumns:"1fr",gap:"8px",overflowY:"auto"}),children:e.feedbackMessages.map((function(e){return p.jsx(Hy,ge({},e),e.id)}))})},hT=Object.assign((function(){return null}),{panel:function(e,t){return Fl(ge({height:"100%",overflow:"overlay",padding:2===e?0:"0 8px",marginLeft:2===e?"-0.5rem":void 0},vf,t))},view:function(e){return Fl(ge({height:"100%",overflow:"overlay"},vf,e))}}),vT=t.forwardRef((function(e,n){var i,r,o,a=Dd(),l=t.useRef(null),s=function(){var e=l.current;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")};t.useImperativeHandle(n,(function(){return{focus:function(){var e;null==(e=l.current)||e.focus()}}})),t.useEffect((function(){l.current&&e.enableFocus&&l.current.focus()}),[]),t.useEffect((function(){s()}),[e.value]);var u=!e.submitDisabled&&"\n"!==e.value&&"\n\n"!==e.value;return p.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&p.jsx(Kf,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),p.jsxs(yf,{className:""+Xf(null!=(i=null==e?void 0:e.inputTheme)?i:null==a||null==(r=a.forms)?void 0:r.input,null==e?void 0:e.error),alignItems:"flex-start",maxHeight:200,children:[p.jsx("textarea",{id:null==e?void 0:e.id,ref:l,className:""+gT({isDisabled:null!=e&&e.disabled?"true":"false"}),"data-themeapi":"forms.input","data-chipposition":"above.right",onKeyDown:function(t){"Enter"===t.key&&!t.shiftKey&&u&&(t.preventDefault(),e.handleSubmit())},disabled:null==e?void 0:e.disabled,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.placeholder,onChange:null==e?void 0:e.onChange,rows:1,onInput:s,onFocus:null==e?void 0:e.onFocus,onBlur:null==e?void 0:e.onBlur}),p.jsx("button",{"aria-label":null==e?void 0:e.submit.label,onClick:null==e?void 0:e.handleSubmit,className:""+xT(null==a?void 0:a.icons),children:p.jsx("span",{children:null!=(o=e.submit.icon)?o:null==e?void 0:e.submit.label})})]})]})})),gT=Fl(ge({flex:1,border:"none",background:"transparent",marginRight:6,resize:"none",lineHeight:"1.5",maxHeight:180,"&:focus":{outline:"none"},fontStyle:"inherit",fontSize:"inherit",fontFamily:"inherit"},vf,{variants:{isDisabled:{true:{opacity:.5}}}})),xT=function(e){var t;return Fl({border:"none",background:"transparent",cursor:"pointer",padding:0,paddingBottom:2,alignSelf:"flex-end","&:focus":{outline:"none"},"&[disabled]":{cursor:"initial"},"& svg":{fill:null==e?void 0:e.color,"&:hover":{fill:null==e||null==(t=e["&:hover"])?void 0:t.color}}})},bT=function(e){var t=Pu().textOverride;return p.jsxs(yf,{children:[e.onReload&&p.jsx(yT,{label:t("refetch_response","Refetch response"),icon:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"18",height:"18",children:p.jsx("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",clipRule:"evenodd"})}),onChange:e.onReload,"data-id":e["data-id"]+"-reload"}),e.onThumbsUp&&p.jsx(yT,{label:t("ai.good_response","Good response"),icon:p.jsx(e.thumbsUp?fd:pd,{}),onChange:e.onThumbsUp,"data-id":e["data-id"]+"-thumbs-up","data-selected":e.thumbsUp?"true":"false"}),e.onThumbsDown&&p.jsx(yT,{label:t("ai.bad_response","Bad response"),icon:p.jsx(e.thumbsDown?hd:md,{}),onChange:e.onThumbsDown,"data-id":e["data-id"]+"-thumbs-down","data-selected":e.thumbsUp?"true":"false"}),e.onSelect&&p.jsx(yT,{label:t("show_this_change","Show this change"),onChange:e.onSelect,icon:p.jsx(vd,{}),"data-id":e["data-id"]+"-select"})]})},yT=function(e){var t=Dd();return p.jsx(uf,{children:p.jsx(sh,{tooltipContent:function(){return e.label},children:p.jsx("button",{onClick:function(){return e.onChange()},"aria-label":e.label,className:""+wT(null==t?void 0:t.icons),"data-testid":e["data-id"],"data-select":e["data-selected"],children:e.icon})})})},wT=function(e){var t;return Fl(ge({border:"none",background:"transparent",cursor:"pointer",padding:0,width:30,height:30,borderRadius:"50%",stroke:null==e?void 0:e.color},Cl,{"&:hover":ge({},Cl,{stroke:null==e||null==(t=e["&:hover"])?void 0:t.color})}))},CT=function(e){return e.User="user",e.AI="ai",e}({}),jT=function(e){return e.WaitingForMessage="waitingForMessage",e.Thinking="thinking",e}({}),FT=function(e){return e.ThumbsUp="thumbs_up",e.ThumbsDown="thumbs_down",e}({}),ST=function(e){return e.Warning="warning",e.Critical="critical",e.Info="info",e}({}),kT=function(e){var t=Pu();return p.jsx(AT,ge({},e,{label:(0,t.textOverride)("ai.you","You"),icon:p.jsx(ud,{width:16,height:16})}))},AT=function(e){var t=Dd();return p.jsxs(Td,{columnGap:"0.5rem",as:"li",areas:'"icon title"\n "empty content"',columns:["max-content","1fr"],children:[p.jsx(uf,{width:30,area:"icon",children:p.jsx("div",{className:""+TT(null==t?void 0:t.ai),"data-conversationid":e.id,children:e.icon})}),p.jsx(uf,{area:"title",alignSelf:"end",children:p.jsx(Kf,{as:"p",children:e.label})}),p.jsxs(uf,{area:"content",children:[e.loading&&p.jsx(uf,{width:40,paddingY:8,children:p.jsx(Mf,{color:"#3074d9"})}),!e.loading&&e.message&&p.jsxs(yf,{gap:"0.5rem",direction:"column",children:[p.jsx(uf,{children:e.message}),e.options&&p.jsx(bT,ge({},e.options))]})]})]})},TT=function(e){var t,n,i;return Fl({border:null==e||null==(t=e.avatar)?void 0:t.border,width:30,height:30,borderRadius:"50%",backgroundColor:null==e||null==(n=e.avatar)?void 0:n.background,display:"flex",alignItems:"center",justifyContent:"center","& svg":{fill:null==e||null==(i=e.avatar)?void 0:i.color}})},_T=Object.assign({},{Replies:function(e){return e.sender_type===CT.AI?p.jsx(AT,{message:e.content,label:"Vizzly AI",icon:p.jsx(dd,{}),onTypingEnd:e.onTypingEnd,options:e.options,id:e.id}):p.jsx(kT,{message:e.content,id:e.id})},Loading:function(){return p.jsx(AT,{label:"Vizzly AI",icon:p.jsx(Ts,{width:20,height:20}),loading:!0,id:"loading"})},Reply:AT,You:kT}),IT=function(e){function t(n){var i;return void 0===n&&(n="AI usage limit reached"),(i=e.call(this,n)||this).name="AIUsageLimitReached",Object.setPrototypeOf(i,t.prototype),i}return be(t,e),t}(Fe(Error)),DT=function(e){function t(){var n;return(n=e.call(this,"Something went wrong while fetching data from the AI.")||this).name="AIFailedToFetch",Object.setPrototypeOf(n,t.prototype),n}return be(t,e),t}(Fe(Error)),OT=function(e){function t(){var n;return(n=e.call(this,"There has been an error with the AI. Please try again.")||this).name="AIContainsErrors",Object.setPrototypeOf(n,t.prototype),n}return be(t,e),t}(Fe(Error)),ET=function(e){function t(){var n;return(n=e.call(this,"User aborted AI request.")||this).name="AIAborted",Object.setPrototypeOf(n,t.prototype),n}return be(t,e),t}(Fe(Error)),LT=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="LoadingAborted",n}return be(t,e),t}(Fe(Error)),NT={conversationId:void 0,message:"",messageState:jT.WaitingForMessage,messageHistory:[]},MT=function(e){var t=hA().suggestions,n=Pu().textOverride,i=Dd();return p.jsxs(uf,{as:"li",children:[p.jsx(uf,{as:"p",paddingBottom:"0.25rem",children:n("ai.ask_a_question_or_pick_a_suggestion","Ask a question or pick a suggestion:")}),p.jsxs(yf,{as:"ul",padding:0,margin:0,gap:"0.75rem",direction:"column",children:[!t&&p.jsx(uf,{as:"li",width:40,paddingY:8,children:p.jsx(Mf,{color:"#3074d9"})}),null==t?void 0:t.map((function(t,n){return p.jsx(uf,{as:"li",listStyle:"none",children:p.jsx("button",{className:""+RT(null==i?void 0:i.ai),onClick:function(){return e.onChange(t)},children:t})},n)}))]})]})},RT=function(e){var t,n,i,r,o,a,l,s;return Fl({border:null==e||null==(t=e.suggestions)?void 0:t.border,background:null==e||null==(n=e.suggestions)?void 0:n.background,color:null==e||null==(i=e.suggestions)?void 0:i.color,padding:null==e||null==(r=e.suggestions)?void 0:r.padding,borderRadius:null==e||null==(o=e.suggestions)?void 0:o.borderRadius,cursor:"pointer",minHeight:40,textAlign:"left",width:"100%","&:focus":{outline:"none"},"&:hover":{background:null==e||null==(a=e.suggestions)||null==(a=a["&:hover"])?void 0:a.background,color:null==e||null==(l=e.suggestions)||null==(l=l["&:hover"])?void 0:l.color,border:null==e||null==(s=e.suggestions)||null==(s=s["&:hover"])?void 0:s.border}})},PT=function(e){var i,r,o,a,l,s,u,d=Pu().textOverride,c=n.useState(!1),f=c[0],m=c[1],h=t.useRef(null),v=(r=t.useRef(i=e.attributes),t.useEffect((function(){r.current=i}),[]),r.current),g=hA(),x=g.onAction,b=function(e,n,i,r){var o=t.useRef(null),a=t.useState(NT),l=a[0],s=a[1],u=t.useState(void 0),d=u[0],c=u[1],p=t.useCallback((function(e){s((function(t){return ge({},t,{message:e})})),c(void 0)}),[]),f=t.useCallback(function(){var t=me(Ce().mark((function t(a){var u,d,p,f,m,h,v,g;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c(void 0),o.current&&o.current.abort(),o.current=new AbortController,void 0!==a&&void 0!==a.message&&(u=a.message,s((function(e){return ge({},e,{message:u})}))),t.prev=4,!n||l.messageState===jT.Thinking){t.next=16;break}return s((function(e){return ge({},e,{messageState:jT.Thinking})})),t.next=9,n(null!=(d=null==a?void 0:a.message)?d:l.message,l.conversationId,e,o.current.signal);case 9:return m=(p=t.sent).conversationId,h=p.messageHistory,v=Go((f=p.attributes).type,{queryEngineConfig:i}),g=v.init(f.dataSetId,f),s(ge({},l,{conversationId:m,messageHistory:h,message:""})),r(g),t.abrupt("return",{status:"success"});case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),t.t0 instanceof ET?c({error:ST.Info,message:"We stopped your question from being sent."}):t.t0 instanceof IT?c({error:ST.Warning,message:t.t0.message}):t.t0 instanceof DT||t.t0 instanceof OT?c({error:ST.Critical,message:t.t0.message}):Je(t.t0),s((function(e){return ge({},e,{messageState:jT.WaitingForMessage})}));case 22:return t.abrupt("return",{status:"failed"});case 23:case"end":return t.stop()}}),t,null,[[4,18]])})));return function(e){return t.apply(this,arguments)}}(),[n,l.message,l.messageState,e]);return ge({send:f,setMessage:p},l,{feedback:d,reset:function(){s(NT),c(void 0)}})}(e.attributes,g.onAsk,e.queryEngineConfig,e.setAttributes),y=function(e,n){var i=t.useState({reactions:[]}),r=i[0],o=i[1],a=t.useCallback(function(){var t=me(Ce().mark((function t(i,r){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e||!n){t.next=6;break}return t.next=4,e(n,i,{reaction:r});case 4:t.sent.success&&o((function(e){return ge({},e,{reactions:[].concat(e.reactions||[],[{messageId:i,reaction:r}])})}));case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error sending AI reaction",t.t0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,n){return t.apply(this,arguments)}}(),[e,n,r]);return ge({sendReaction:a},r)}(x,b.conversationId),w=b.messageState,C=b.messageHistory,j=b.message,F=b.feedback,S=(o=j,a=t.useRef(null),s=(l=t.useState(0))[0],u=l[1],t.useEffect((function(){var e=function(){u(a.current?a.current.clientHeight:0)};return e(),window.addEventListener("resize",(function(){return e})),function(){window.removeEventListener("resize",e)}}),[o]),[a,s]),k=S[0],A=S[1],T=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&(e.current.scrollTop=e.current.scrollHeight)})),e}();return t.useEffect((function(){var e;w!==jT.Thinking&&(null==(e=h.current)||e.focus())}),[w]),e.closed?null:p.jsxs(yf,{direction:"column",height:"100%",gap:"1.5rem",children:[e.closeAI&&p.jsxs(hh,{buttons:"space-between",children:[p.jsx(gh,{onClick:function(){return e.closeAI&&e.closeAI()},suppressed:!0,icon:{Icon:function(){return p.jsx(gd,{})}},children:d("back_to_editor","Back to Editor")}),p.jsx(gh,{onClick:function(){return m(!0)},children:d("new_chat","New Chat")})]}),p.jsxs(uf,{position:"relative",height:"100%",children:[p.jsx(uf,{height:0,children:p.jsx(yS,{onClose:function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n&&(b.reset(),e.setAttributes(v)),m(!1),t.abrupt("return",!0);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),message:d("ai.new_chat_modal_message","Are you sure you want to start a new chat? This will delete all your current changes."),show:f,deleteButtonLabel:d("ai.new_chat_modal_cta","Start new chat")})}),p.jsx("div",{className:""+VT(A),ref:T,children:p.jsx(yf,{gap:"2rem",direction:"column",overflow:"overlay",children:p.jsxs(yf,{gap:"1.25rem",direction:"column",as:"ul",padding:0,margin:0,children:[w!==jT.Thinking&&(!C||0===(null==C?void 0:C.length))&&p.jsx(MT,{onChange:function(e){return b.send({message:e})}}),w===jT.Thinking&&(!C||0===(null==C?void 0:C.length))&&p.jsxs(t.Fragment,{children:[p.jsx(_T.You,{message:j,id:"thinking"}),void 0===F&&p.jsx(_T.Loading,{})]}),C.length>0&&p.jsxs(t.Fragment,{children:[null==C?void 0:C.map((function(e,n){var i,r=null==(i=y.reactions)?void 0:i.filter((function(t){return t.messageId===e.id})),o=void 0;return console.log("ai",b),e.sender_type===CT.AI&&void 0===F&&(o={onThumbsUp:b.conversationId?function(){return y.sendReaction(e.id,FT.ThumbsUp)}:void 0,onThumbsDown:b.conversationId?function(){return y.sendReaction(e.id,FT.ThumbsDown)}:void 0,thumbsUp:null==r?void 0:r.some((function(e){return e.reaction===FT.ThumbsUp})),thumbsDown:null==r?void 0:r.some((function(e){return e.reaction===FT.ThumbsDown})),"data-id":e.id}),p.jsx(t.Fragment,{children:p.jsx(_T.Replies,ge({},e,{content:e.content,options:o}))},n+"_"+e.id)})),w===jT.Thinking&&p.jsxs(t.Fragment,{children:[p.jsx(_T.You,{message:j,id:"thinking"}),void 0===F&&p.jsx(_T.Loading,{})]})]})]})})}),p.jsx("div",{className:""+zT,ref:k,children:p.jsxs(yf,{gap:"1rem",direction:"column",children:[F&&p.jsx(Hy,{title:F.message,type:F.error}),p.jsxs(yf,{gap:"0.5rem",direction:"column",children:[p.jsx(vT,{ref:h,id:"input",label:"Message Vizzly",placeholder:d("ai.ask_me_a_question","Ask me a question..."),value:j,onChange:function(e){return b.setMessage(e.currentTarget.value)},labelHidden:!0,handleSubmit:me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b.send();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),submitDisabled:!j||w===jT.Thinking,enableFocus:!0,disabled:w===jT.Thinking,submit:w===jT.Thinking?{label:d("stop_question","Stop Question"),icon:p.jsx(sd,{})}:{label:d("submit_question","Submit Question"),icon:p.jsx(ld,{})}}),p.jsx(uf,{as:"p",className:Ql.textSize("xs")+" "+Ql.color(Sl(50)),margin:0,padding:0,paddingLeft:"0.5rem",children:d("ai.ai_may_hallucinate","Responses may be inaccurate; verify details in the Editor.")})]})]})})]})]})},zT=Fl({position:"absolute",left:0,right:0,bottom:0}),VT=function(e){return Fl(ge({position:"absolute",left:0,top:0,right:0,overflowY:"scroll",bottom:e,paddingBottom:"1.5rem"},vf))},qT=function(e){return p.jsx(PT,ge({},e))},BT=function(e){return p.jsx(p.Fragment,{children:e.children})},WT=function(e){var t=e.message,n=e.hideCondition,i=e.removeFeedbackMessage;e.showCondition?(0,e.addFeedbackMessage)(t):n&&i(t.id)},HT=function(e){var n,i,r,o,a,l=Dd(),s=pT(),u=e.editor,d=u.setAttributes,c=u.setResults,f=u.runQueriesCallback,m=u.component,h=u.dataSet,v=u.queryEngineConfig;return t.useEffect((function(){return WT({message:{id:"grouping",type:"info",children:Xi(m.attributes)},showCondition:!Qi(m.attributes),hideCondition:Qi(m.attributes),addFeedbackMessage:s.addFeedbackMessage,removeFeedbackMessage:s.removeFeedbackMessage}),function(){s.removeFeedbackMessage("grouping")}}),[m.attributes]),t.useEffect((function(){return WT({message:{id:"limit",type:"info",children:"More data is available for this view. Increase 'Limit' (Advanced Options) to show all data."},showCondition:m.results.some((function(e){return null==e?void 0:e.hasMoreResults})),hideCondition:!m.results.some((function(e){return null==e?void 0:e.hasMoreResults})),addFeedbackMessage:s.addFeedbackMessage,removeFeedbackMessage:s.removeFeedbackMessage}),function(){s.removeFeedbackMessage("limit")}}),[m.results]),p.jsx(BT,{setContent:function(e){d(ge({},m.attributes,{content:e}))},content:"richText"===m.attributes.type?m.attributes.content:null,children:p.jsx(uf,{height:"40rem",width:"100%",children:p.jsxs(Td,{columns:["24rem","1fr"],height:"100%",gap:e.standalone?null!=(n=null==l||null==(i=l.editor)?void 0:i.gap)?n:"1.5rem":void 0,children:[!e.ai&&p.jsx("div",{id:"editor-panel",className:""+hT.panel(null==l?void 0:l.version,null==l||null==(r=l.editor)?void 0:r.settings),children:p.jsx(dT,{})}),(null==(o=e.usingBeta)?void 0:o.active)&&p.jsx(qT,{closeAI:function(){return e.openAI(!1)},dataSet:h,attributes:m.attributes,setAttributes:d,queryEngineConfig:v,closed:!e.ai}),p.jsxs(Td,{rows:["1fr","100px"],className:""+hT.view(null==l||null==(a=l.editor)?void 0:a.component),children:[p.jsx(Fh,{disable:!("basicTable"==m.attributes.type||"dataTable"==m.attributes.type),children:p.jsx(lS,{id:"editor_"+Math.floor(1e11*Math.random()),isBeingSizeAdjusted:!1,setLocalFilters:e.editor.setLocalFilters,runQueriesCallback:f,setResults:c,component:m,updateComponentAttributes:d,editor:!0})}),p.jsx(mT,{})]})]})})})},YT=function(e){var t,i,o=iv(),a=n.useState(!1),l=a[0],s=a[1],u=cA(),d=hA().fetchSuggestions,c=Pu().textOverride,f=Dd();if(!o)return p.jsx(Nf,{});var m=o.dashboard,h=o.mode,v=o.origin,g=o.componentEditor,x=o.dispatch,b=o.trackEvent,y=null==u?void 0:u.active,w="boolean"==typeof(null==f||null==(t=f.modals)||null==(t=t.options)||null==(t=t.showTitle)?void 0:t.editor)&&!(null!=f&&null!=(i=f.modals)&&null!=(i=i.options)&&null!=(i=i.showTitle)&&i.editor),C=(null==g?void 0:g.target.displayTarget)||r.isNumber(null==g?void 0:g.target.libraryIndex);return p.jsxs("div",{"data-testid":"editor",children:[p.jsx(Ah,{title:c("editor","Editor"),"data-component":"editor-header",hide:w}),p.jsx(_h,{"data-component":"editor-content",children:p.jsx(fT,{children:p.jsx(HT,{editor:o,openAI:s,ai:l,usingBeta:u})})}),p.jsxs(Th,{buttons:y?"space-between":"end","data-component":"editor-footer",children:[y&&p.jsx(hh,{children:p.jsx(Gy,{enabled:l,children:p.jsx(Pv,{secondary:!0,onClick:function(){return s(!0)},icon:{Icon:function(){return p.jsx(cd,{})}},onMouseEnter:function(){d&&d()},children:c("ask_ai","Ask AI")})})}),p.jsxs(hh,{buttons:"end",children:[p.jsx(Pv,{secondary:!0,onClick:function(){b("editor.changesCancelled"),Xe("doClose of Editor modal."),e.onClose?e.onClose():x({type:"clearModal"}),s(!1)},children:C?c("editor_modal.cancel","Cancel"):c("editor_modal.close","Close")}),C&&p.jsx(Pv,{onClick:function(){b("editor.changesConfirmed"),x({type:"saveComponent",protectedComponent:"library"===v&&"admin"===h}),s(!1)},children:GT(h,c,v,(null==g?void 0:g.target.libraryIndex)!==m.componentLibrary.length)})]})]})]})};function GT(e,t,n,i){return"library"===n&&i?t("editor_modal.save","Save"):"library"===n?t("editor_modal.add_to_library","Add to Library"):"endUser"===e?t("editor_modal.save","Save"):t("editor_modal.confirm","Confirm")}var UT=function(e){var n,i=Pu(),r=i.textOverride,o=i.queryEngineConfig,a=$S(e.dataSet,ge({},{onlyDimensions:!0,forComponent:n=e.component},"pieChart"===n?{onlyFieldTypes:["number","boolean","string"]}:{onlyFieldTypes:["number","boolean","string","date_time"]}),!0,e.dimension),l=function(){var t=[];return a.length>0&&(t=null==a?void 0:a.map((function(t){return{value:t.value,label:e.dataSet.name+" · "+t.title,icon:t.icon}}))),t}(),s=t.useState(function(e,t){var n=[],i=new Set(null==t?void 0:t.map((function(e){return e.field})));return e.forEach((function(e,t){i.has(e.value.id)&&n.push(t)})),n}(l,e.drilldownOptions)),u=s[0],d=s[1];return p.jsxs(Mh,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},disableDnD:!0,children:[p.jsx(Mh.Header,{title:r("drilldown_fields","Drilldown Fields")}),p.jsx(Mh.Content,{children:p.jsx(Td,{columns:["1fr"],gap:"1rem",children:p.jsx(Ew,{children:p.jsx(ev,{label:r("fields","Fields"),options:l,selected:u,setSelected:d,textOverride:r,id:"drilldown-fields",placeholder:"Drilldown field"})})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:r("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){e.onClose(function(e,t,n){var i=[];return e.length>0&&function(e,t){return t.map((function(t){return e[t].value}))}(t,e).forEach((function(e){i.push(JS("grouping",e,n))})),i}(u,l,o))},primary:!0,children:r("save","Save")})]})})]})},KT=function(e){var t=Pu(),n=t.textOverride,i=t.queryEngineConfig,r=Hv(e.filter,e.dataSet,i.supportedAggregates),o=r.completedFilters,a=r.addOrFilter,l=r.wipFilters,s=r.updateWipFilter,u=r.deleteWipFilter;return p.jsxs(Mh,{width:"4xl",isOpen:e.show,disableDnD:!0,onClose:e.onClose,children:[p.jsx(Mh.Header,{title:n("advanced_filters","Advanced Filters")}),p.jsx(Mh.Content,{children:p.jsx(zv,{queryEngineConfig:i,updateWipFilter:s,deleteWipFilter:u,wipFilters:l,completedFilters:o,dataSet:e.dataSet,textOverride:n,onAddOrFilter:function(){return a()}})}),p.jsx(Mh.Footer,{children:p.jsxs("div",{className:es({width:"100%",display:"grid",gridTemplateColumns:"1fr 1fr"}),children:[p.jsx("div",{}),p.jsx("div",{children:p.jsxs("div",{className:es({width:"100%",textAlign:"right"}),children:[p.jsx("span",{className:es({marginRight:"12px"}),children:p.jsx(gh,{secondary:!0,onClick:function(){return e.onClose()},children:n("advanced_filters.cancel","Cancel")})}),p.jsx(gh,{testId:"save-filter-btn",onClick:function(){return e.onClose(o)},primary:!0,children:n("advanced_filters.save","Save")})]})})]})})]})},XT=function(e,t){return t.map((function(t){return{label:Qo(e,t.field).publicName,value:Ti(t)}}))},QT=function(e){var n=e.dataSet,i=e.show,r=e.onClose,o=e.measures,a=t.useState(void 0),l=a[0],s=a[1],u=t.useState(void 0),d=u[0],c=u[1],f=Pu().textOverride;return p.jsxs(Mh,{isOpen:i,onClose:r,width:"sm",disableDnD:!0,children:[p.jsx(Mh.Header,{title:f("choose_a_prefix","Choose a prefix")}),p.jsxs(Mh.Content,{children:[p.jsxs(Ew,{children:[p.jsx(Ch,{children:f("field","Field")}),p.jsx(nm,{options:XT(n,o),selected:l,onChange:function(e){return s(e)},textOverride:f})]}),p.jsx(DC,{label:f("prefix","Prefix"),currentValue:d,setText:c})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:function(){return r()},children:f("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){l&&d&&r({field:l,prefix:d})},children:f("save","Save")})]})})]})},ZT={publicName:"",measure:null},JT=function(e,t){return!(e.measure&&e.publicName&&t[0]&&t[0].length>0)},$T=function(e){var n=e.dataSet,i=Pu().textOverride,r=function(e,n,i,r){var o=!!n,a=t.useState(ZT),l=a[0],s=a[1],u=Hv(null!=n&&n.rule?n.rule:[],i,e.supportedAggregates),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter,m=u.addOrFilter;return t.useEffect((function(){s(n?{publicName:n.publicName,measure:{field:n.fieldId,function:n.function}}:ZT)}),[JSON.stringify(n)]),{onChange:function(e){s(ge({},l,e))},fieldPublicName:l.publicName,measure:l.measure,completedFilters:d,wipFilters:c,deleteWipFilter:p,updateWipFilter:f,addOrFilter:m,isEditing:o,handleUpsertConditionalField:function(){if(l.measure&&l.publicName){var t,i=function(e,t,n,i,r){return{id:bt(),publicName:e,fieldId:t,function:n,rule:i,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},r)}}(l.publicName,l.measure.field,l.measure.function,d,e);r(ge({},i,{id:null!=(t=null==n?void 0:n.id)?t:i.id}))}},saveDisabled:JT(l,d)}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),o={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removePercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0,removeDateCalculations:!0,removeConditional:!0};return p.jsxs(Mh,{width:"4xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:HS("conditional",i)}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{id:"conditional-name",placeholder:i("metric_name","Metric name"),label:i("metric_name","Metric name"),value:r.fieldPublicName,onChange:function(e){return r.onChange({publicName:e.target.value})}})}),p.jsxs(TF.Panel,{children:[p.jsxs(Ew,{as:"fieldset",children:[p.jsx(Kf,{as:"legend",children:i("base_metric","Base Metric")}),p.jsx(RS,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){r.onChange({measure:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:r.measure?[r.measure]:[]},dataSet:e.dataSet,fieldFilterOptions:o})]}),p.jsxs(Ew,{as:"fieldset",marginBottom:0,children:[p.jsx(Kf,{as:"legend",children:i("Filters","Filters")}),p.jsx(zv,{fieldHeadingOverride:i("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:r.completedFilters,wipFilters:r.wipFilters,updateWipFilter:function(e,t,n){r.updateWipFilter(e,t,n)},deleteWipFilter:function(e,t){r.deleteWipFilter(e,t)},removeLastEnabled:!0,removeHeadings:!0,textOverride:i,onAddOrFilter:function(){return r.addOrFilter()}})]})]})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return e.onClose()},secondary:!0,children:i("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return r.handleUpsertConditionalField()},disabled:r.saveDisabled,children:r.isEditing?i("update","Update"):i("create","Create")})]})})]})},e_={publicName:"",numerator:null,numeratorFilter:!1,denominatorFilter:!1,denominator:null,denominatorScope:"all"},t_=function(e,t){return!(e.denominator&&e.publicName&&(t[0]&&t[0].length>0||e.numerator))},n_={publicName:"",mathType:"simple",left:void 0,right:void 0,rightFieldId:void 0,leftFieldId:void 0,operator:void 0},i_=function(e){switch(e.mathType){case"simple":return void 0===e.publicName||void 0===e.operator||void 0===e.leftFieldId||void 0===e.rightFieldId;case"aggregate":return void 0===e.left||void 0===e.right||void 0===e.operator;default:return!0}},r_=function(e){var t,n,i,r,o=void 0,a=void 0,l=void 0;return e&&(a_(e)&&e.operator&&e.right&&(o=null==(t=e.left)?void 0:t.field,a=null==(n=e.left)?void 0:n.function,l={operator:e.operator,fieldId:null==(i=e.right)?void 0:i.field,function:null==(r=e.right)?void 0:r.function}),l_(e)&&(o=e.field,a=e.function)),{fieldId:o,function:a,nested:l}};function o_(e){return{field:e.fieldId,function:e.function}}var a_=function(e){return"left"in e||"operator"in e||"right"in e},l_=function(e){return"field"in e&&"function"in e};function s_(e,t){var n={};return n[t]=e&&a_(e)?e.left:{operator:"+",left:null!=e?e:void 0},n}var u_=function(e){var t=e.state,n=e.onClick,i=Pu().textOverride,r=i("agg_maths_add_remove_button","[[add|remove]] nested calculation",{add:"add"===t?i("add","Add"):"",remove:"remove"===t?i("remove","Remove"):""});return p.jsx(sh,{tooltipContent:function(){return r},classNameTrigger:""+f_,children:p.jsxs(Pv,{secondary:!0,onClick:n,children:[p.jsx("span",{className:""+Xl,children:r}),p.jsx("remove"===t?b.MinusSmIcon:b.PlusSmIcon,{width:16})]})})},d_=function(e){var n=e.left,i=e.right,r=e.operator,o=e.dataSet,a=Pu().textOverride,l=i_({mathType:"aggregate",left:n,right:i,operator:r,publicName:""});return p.jsx("code",{className:""+m_,children:l?p.jsx(t.Fragment,{children:a("metrics_operators_need_defined","Metrics and operator need to be defined")}):p.jsxs(t.Fragment,{children:[n&&p.jsx(uf,{flex:1,as:"span","data-component":"calculation-left",textAlign:"right",children:p.jsx(p_,{side:n,dataSet:o})}),p.jsx(uf,{as:"strong",width:8,"data-component":"calculation-operator",className:""+Ql.bold,children:r}),i&&p.jsx(uf,{flex:1,as:"span","data-component":"calculation-right",children:p.jsx(p_,{side:i,dataSet:o})})]})})},c_=function(e){return p.jsx("code",{className:""+m_,children:e.children})},p_=function(e){var n,i,r,o,a,l,s=e.side,u=e.dataSet;return p.jsx(t.Fragment,{children:s&&a_(s)?p.jsxs("span",{children:[p.jsx("span",{className:""+Ql.bold,children:"("}),(null==(n=s.left)?void 0:n.field)&&Qo(u,null==(i=s.left)?void 0:i.field).publicName," (",null==s||null==(r=s.left)?void 0:r.function,")"," ",s.operator," ",(null==(o=s.right)?void 0:o.field)&&Qo(u,null==(a=s.right)?void 0:a.field).publicName," (",null==(l=s.right)?void 0:l.function,")",p.jsx("span",{className:""+Ql.bold,children:")"})]}):p.jsxs("span",{children:[s&&Qo(u,s.field).publicName," ",(null==s?void 0:s.function)&&p.jsxs(t.Fragment,{children:["(",null==s?void 0:s.function,")"]})]})})},f_=Fl({display:"block"}),m_=Fl({backgroundColor:Sl(80),color:Sl(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11});function h_(e,t,n){var i=t.map((function(t){return t.map((function(t){var i=Qo(e,t.field),r=t.value;return r=ul(r,n,{fieldId:t.field}),i.publicName+" "+t.op+" “"+r+"“"})).join(", ")})),r=t.length>1,o=i.join(" | ");return r?"("+o+")":o}var v_=function(e){var n=e.dataSet,i=Pu(),r=i.textOverride,o=i.queryEngineConfig,a=function(e,n,i,r){var o=!!n,a=t.useState(e_),l=a[0],s=a[1],u=Hv(n&&"numeratorFilter"in n&&n.numeratorFilter?n.numeratorFilter:[],i,e.supportedAggregates),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter,m=u.addOrFilter,h=Hv(n&&"denominatorFilter"in n&&n.denominatorFilter?n.denominatorFilter:[],i,e.supportedAggregates),v=h.completedFilters,g=h.wipFilters,x=h.deleteWipFilter,b=h.updateWipFilter,y=h.addOrFilter;return t.useEffect((function(){s(n?{publicName:n.publicName,numeratorFilter:!(!n||!("numeratorFilter"in n)),denominatorFilter:!(!n||!("denominatorFilter"in n)),numerator:n.numeratorFieldId&&n.numeratorAggregate?{function:n.numeratorAggregate,field:n.numeratorFieldId}:null,denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId},denominatorScope:n.denominatorScope}:e_)}),[JSON.stringify(n)]),{onChange:function(e){s(ge({},l,e))},denominatorScope:l.denominatorScope,fieldPublicName:l.publicName,denominatorMeasure:l.denominator,numeratorMeasure:l.numerator,completedNumeratorFilter:d,wipNumeratorFilters:c,deleteWipNumeratorFilter:p,updateWipNumeratorFilter:f,addOrNumeratorFilter:m,completedDenominatorFilter:v,wipDenominatorFilters:g,deleteWipDenominatorFilter:x,updateWipDenominatorFilter:b,addOrDenominatorFilter:y,isEditing:o,handleUpsertPercentageField:function(){if(l.denominator&&l.publicName){var t=function(e,t,n,i,r,o,a,l,s){return{version:2,id:bt(),publicName:e,numeratorFilter:null!=o?o:[],denominatorFieldId:t,numeratorFieldId:null!=i?i:null,numeratorAggregate:null!=r?r:null,denominatorAggregate:n,denominatorFilter:null!=a?a:[],canBeDimension:!1,canBeMeasure:!0,dataType:"number",denominatorScope:s||"all",allowedOperators:Te({dataType:"number"},l)}}(l.publicName,l.denominator.field,l.denominator.function,l.numerator?l.numerator.field:null,l.numerator?l.numerator.function:null,d,v,e,l.denominatorScope);r(ge({},t,{id:o?n.id:t.id}))}},numeratorFilter:l.numeratorFilter,denominatorFilter:l.denominatorFilter,saveDisabled:t_(l,d)}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),l=a.onChange,s=a.numeratorFilter,u=a.denominatorFilter,d=a.denominatorScope,c={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removePercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0,removeDateCalculations:!0,removeConditional:!0};return p.jsxs(Mh,{width:"4xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:HS("percentage",r)}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{id:"percentage-name",placeholder:r("metric_name","Metric name"),label:r("metric_name","Metric name"),value:a.fieldPublicName,onChange:function(e){return l({publicName:e.target.value})}})}),p.jsxs(Td,{gap:"1rem",children:[p.jsxs(TF.Panel,{children:[p.jsxs(Ew,{as:"fieldset",marginBottom:s?void 0:0,children:[p.jsx(Kf,{as:"legend",children:r("numerator","Numerator")}),p.jsx(RS,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({numerator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.numeratorMeasure?[a.numeratorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:c})]}),s&&p.jsxs(Ew,{as:"fieldset",marginBottom:0,children:[p.jsx(Kf,{as:"legend",children:r("Filters","Filters")}),p.jsx(zv,{fieldHeadingOverride:r("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedNumeratorFilter,wipFilters:a.wipNumeratorFilters,updateWipFilter:function(e,t,n){a.updateWipNumeratorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipNumeratorFilter(e,t).length&&l({numeratorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:r,onAddOrFilter:function(){return a.addOrNumeratorFilter()}})]}),!1===s&&p.jsx(x_,{onChange:function(){l({numeratorFilter:!0})}})]}),p.jsxs(TF.Panel,{children:[p.jsxs(Ew,{as:"fieldset",marginBottom:u?void 0:0,children:[p.jsx(Kf,{as:"legend",children:r("denominator","Denominator")}),p.jsx(RS,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){l({denominator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:a.denominatorMeasure?[a.denominatorMeasure]:[]},dataSet:e.dataSet,fieldFilterOptions:c})]}),u&&p.jsxs(Ew,{as:"fieldset",marginBottom:0,children:[p.jsx(Kf,{as:"legend",children:r("Filters","Filters")}),p.jsx(zv,{fieldHeadingOverride:r("metric","Metric"),queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:a.completedDenominatorFilter,wipFilters:a.wipDenominatorFilters,updateWipFilter:function(e,t,n){a.updateWipDenominatorFilter(e,t,n)},deleteWipFilter:function(e,t){0===a.deleteWipDenominatorFilter(e,t).length&&l({denominatorFilter:!1})},removeLastEnabled:!0,removeHeadings:!0,textOverride:r,onAddOrFilter:function(){return a.addOrDenominatorFilter()}})]}),!1===u&&p.jsx(x_,{onChange:function(){l({denominatorFilter:!0})}}),p.jsx(ex,{testId:"percentage-advanced-options",showAccordionIcon:!0,title:r("advanced_options","Advanced Options"),children:p.jsx(Ew,{as:"fieldset",children:p.jsx(uf,{marginY:5,children:p.jsx(ij,{options:[{value:"all",label:r("denominator_scope_all_title","Across all groups"),description:r("denominator_scope_all_description","Denominator is calculated using all your data")},{value:"withinGrouping",label:r("denominator_scope_all_title","Within each group"),description:r("denominator_scope_within_group_description","Denominator is calculated using the data within each grouping")}],name:"start-check",label:r("denominator_scope_title","Scope"),selected:d||"all",direction:"row",onChange:function(e){return l({denominatorScope:e})}})})})})]})]}),p.jsx(uf,{marginTop:20,children:p.jsx(c_,{children:p.jsxs(Td,{justifyContent:"center",children:[p.jsx(g_,ge({},a,{position:"numerator",dataSet:n,supportedAggregates:o.supportedAggregates})),p.jsx(uf,{children:p.jsx(uf,{as:"hr",border:"1px solid "+Sl(15),height:1})}),p.jsx(g_,ge({},a,{position:"denominator",dataSet:n,supportedAggregates:o.supportedAggregates}))]})})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return e.onClose()},secondary:!0,children:r("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return a.handleUpsertPercentageField()},disabled:a.saveDisabled,children:a.isEditing?r("update","Update"):r("create","Create")})]})})]})},g_=function(e){var t,n,i,r=e.numeratorMeasure,o=e.denominatorMeasure,a=e.position,l=e.dataSet,s=e.supportedAggregates,u=e.completedDenominatorFilter,d=e.completedNumeratorFilter,c=Pu(),f=c.textOverride,m=c.valueAlias,h="",v="",g="",x="numerator"===a&&Sn(d)&&d[0].length>0;return o||"denominator"!==a?"numerator"!==a||x||r?("numerator"===a&&!r&&o&&(h=null==(t=s[o.function])?void 0:t.publicName,v=Qo(l,o.field).publicName),"numerator"===a&&r&&(h=null==(n=s[r.function])?void 0:n.publicName,v=Qo(l,r.field).publicName),"denominator"===a&&o&&(h=null==(i=s[o.function])?void 0:i.publicName,v=Qo(l,o.field).publicName),x?g=h_(l,d,m):"denominator"===a&&Sn(u)&&u.length>0&&(g=h_(l,u,m)),p.jsxs(uf,{textAlign:"center",children:[h,"(",v,g.length?" | "+g:"",")"]})):p.jsx(uf,{textAlign:"center",children:f("percentage_modal.numerator_required","Numerator required")}):p.jsx(uf,{textAlign:"center",children:f("percentage_modal.denominator_required","Denominator required")})},x_=function(e){var t=Pu();return p.jsx(yf,{justifyContent:"space-between",children:p.jsx(Pv,{secondary:!0,onClick:function(){return e.onChange()},children:(0,t.textOverride)("add_filter_by","+ Filter by")})})},b_=function(e){var n=e.label,i=void 0===n?"Metric":n,r=t.useState(e.value),o=r[0],a=r[1],l=[];return[].concat(e.dataSetFields).forEach((function(t,n){l.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n})})),p.jsx(nm,{label:i,labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,testId:e?e.testId+"-pick-field":void 0,onChange:function(t){a(t),null==e||e.onChange(t)},options:l,selected:o,hasFreeText:!0})},y_=function(e){if("string"==typeof e){if(Xt(e))return e;var t=Number(e);if(isNaN(t)||0===e.length)return;return e}if("object"==typeof e&&null!==e)return e.id},w_=function(e){var t,n=Pu().textOverride,i=[{label:n("add","Add"),value:"+",testId:"simple-math-operator-add"},{label:n("subtract","Subtract"),value:"-"},{label:n("multiply","Multiply"),value:"*"},{label:n("divide","Divide"),value:"/"}];return p.jsx(nm,{placeholder:n("select_operator","Operator..."),id:null!=(t=null==e?void 0:e.id)?t:"simple-math-operator",label:n("operator","Operator"),labelHidden:!0,onChange:function(t){null==e||e.onChange(t)},options:i,selected:e.mathOperator})},C_=function(e){var n,i,r=Pu(),o=r.textOverride,a=r.featureToggles,l=function(e,n,i){var r=!!n,o=t.useState(n_),a=o[0],l=o[1],s=function(){l(n_)};return t.useEffect((function(){if(n)if(pn(n)){var e=(i=(t=n).rightFieldId,r=t.rightFunction,o=t.leftNested,a=t.rightNested,u=o_({fieldId:t.leftFieldId,function:t.leftFunction}),d=o_({fieldId:i,function:r}),o&&(u={left:u,operator:o.operator,right:o_({fieldId:o.fieldId,function:o.function})}),a&&(d={left:d,operator:a.operator,right:o_({fieldId:a.fieldId,function:a.function})}),{left:u,right:d});l({publicName:n.publicName,left:e.left,right:e.right,leftFieldId:void 0,rightFieldId:void 0,operator:n.operator,mathType:"aggregate"})}else dn(n)&&l({publicName:n.publicName,rightFieldId:n.rightFieldId,leftFieldId:n.leftFieldId,operator:n.operator,right:void 0,left:void 0,mathType:"simple"});else s();var t,i,r,o,a,u,d}),[JSON.stringify(n)]),ge({reset:s},a,{handleUpsertMathField:function(){if("simple"===a.mathType&&null!=a&&a.leftFieldId&&null!=a&&a.operator&&null!=a&&a.rightFieldId){var t=function(e,t,n,i,r){return{id:bt(),publicName:e,rightFieldId:i,operator:n,leftFieldId:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},r)}}(a.publicName,null==a?void 0:a.leftFieldId,null==a?void 0:a.operator,null==a?void 0:a.rightFieldId,e);i(ge({},t,{id:r?n.id:t.id}))}if("aggregate"===a.mathType&&a.left&&a.right&&a.operator){var o=function(e){var t=e.right,n=r_(e.left),i=n.fieldId,r=n.function,o=n.nested,a=r_(t);return{nestedLeft:o,nestedRight:a.nested,leftField:i,rightField:a.fieldId,leftFunction:r,rightFunction:a.function}}(a),l=function(e,t,n,i,r,o,a,l,s){return{id:bt(),publicName:e,rightFieldId:r,rightFunction:o,operator:i,leftFieldId:t,leftFunction:n,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},a),leftNested:l,rightNested:s}}(a.publicName,o.leftField,o.leftFunction,a.operator,o.rightField,o.rightFunction,e,o.nestedLeft,o.nestedRight);i(ge({},l,{id:r?n.id:l.id}))}},onChange:function(e){l(void 0!==e.mathType&&e.mathType!==a.mathType?ge({},a,e,{left:void 0,leftFieldId:void 0,right:void 0,rightFieldId:void 0}):ge({},a,e))},isEditing:!!n,disabled:i_(a)})}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),s=l.leftFieldId,u=l.operator,d=l.publicName,c=l.handleUpsertMathField,f=l.onChange,m=l.isEditing,h=l.mathType,v=l.right,g=l.left,x=l.disabled,b=l.reset,y={onlyFieldTypes:["number"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0,removeDateCalculations:!0,removeConditional:!0},w=Uo(e.dataSet.fields,y),C=function(e){var t=[],n=Go(e);return n.supportedCustomFields.simpleMaths&&(t=[].concat(t,[{value:"simple",label:"Simple",description:"Math calculation with simple metrics"}])),n.supportedCustomFields.aggregateMaths&&(t=[].concat(t,[{value:"aggregate",label:"Aggregate",description:"Math calculation with a aggregate metric"}])),t}(e.componentType),j=function(t){if(t)return Zo(e.dataSet,t)?t?Qo(e.dataSet,t):void 0:t};return t.useEffect((function(){null!=e&&e.show&&!e.initialValue&&b()}),[null==e?void 0:e.show]),p.jsxs(Mh,{width:"4xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:HS("math",o)}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{label:o("metric_name","Metric name"),id:"metric-name",placeholder:o("metric_name","Metric name"),value:d,onChange:function(e){return f({publicName:e.target.value})}})}),p.jsxs(Ew,{as:"fieldset",children:[p.jsx(Kf,{as:"legend",children:"Calculation"}),a.allowAggregateMathsCustomField&&p.jsx(uf,{marginBottom:"1rem",children:p.jsx(ij,{options:C,name:"math-check",label:o("select_math_type","Select Math Type"),selected:h,locked:m,labelHidden:!0,onChange:function(e){return f({mathType:e})}})}),"simple"===h&&p.jsx(TF.Panel,{children:p.jsxs(yf,{direction:"row",gap:"0.5rem",children:[p.jsx(uf,{flex:1,children:p.jsx(b_,{id:"metric-1",testId:"metric-1",label:o("metric_number","Metric [[metricNumber]]",{metricNumber:"1"}),onChange:function(e){return f({leftFieldId:y_(e)})},dataSetFields:w,value:j(null==(n=e.initialValue)?void 0:n.leftFieldId),labelHidden:!0})}),p.jsx(uf,{width:170,children:p.jsx(w_,{mathOperator:u,onChange:function(e){return f({operator:e})}})}),p.jsx(uf,{flex:1,children:p.jsx(b_,{id:"metric-2",testId:"metric-2",label:o("metric_number","Metric [[metricNumber]]",{metricNumber:"2"}),onChange:function(e){return f({rightFieldId:y_(e)})},dataSetFields:w.filter((function(e){return e.id!==s})),value:j(null==(i=e.initialValue)?void 0:i.rightFieldId),labelHidden:!0})})]})}),"aggregate"===h&&p.jsxs(t.Fragment,{children:[p.jsx(TF.Panel,{children:p.jsxs(yf,{direction:"column",gap:"1rem",paddingY:"0.5rem",children:[p.jsxs(yf,{direction:"row",gap:"0.5rem",children:[p.jsx(uf,{flex:1,children:p.jsx(RS,{id:"left-1",testId:"left-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return f(g&&a_(g)?{left:ge({},g,{left:t[0]})}:{left:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:g&&l_(g)?[g]:null!=g&&g.left?[null==g?void 0:g.left]:[]},dataSet:e.dataSet,fieldFilterOptions:y},""+g)}),g&&!!a_(g)&&p.jsxs(t.Fragment,{children:[p.jsx(uf,{width:120,children:p.jsx(w_,{mathOperator:g.operator,onChange:function(e){return f({left:ge({},g,{operator:e})})}})}),p.jsx(uf,{flex:1,children:p.jsx(RS,{id:"right-1",testId:"right-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return f({left:ge({},g,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:null!=g&&g.right?[null==g?void 0:g.right]:[]},dataSet:e.dataSet,fieldFilterOptions:y})})]}),p.jsx(uf,{children:p.jsx(u_,{onClick:function(){return f(s_(g,"left"))},state:g&&a_(g)?"remove":"add"})})]}),p.jsx(yf,{justifyContent:"center",children:p.jsx(uf,{flex:1,marginRight:60,children:p.jsx(w_,{mathOperator:u,onChange:function(e){return f({operator:e})},id:"operator-2"})})}),p.jsxs(yf,{direction:"row",gap:"0.5rem",children:[p.jsx(uf,{flex:1,children:p.jsx(RS,{id:"left-2",testId:"left-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return f(v&&a_(v)?{right:ge({},v,{left:t[0]})}:{right:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:v&&l_(v)?[v]:null!=v&&v.left?[null==v?void 0:v.left]:[]},dataSet:e.dataSet,fieldFilterOptions:y},""+v)}),v&&a_(v)&&p.jsxs(t.Fragment,{children:[p.jsx(uf,{width:120,children:p.jsx(w_,{mathOperator:v.operator,onChange:function(e){return f({right:ge({},v,{operator:e})})},id:"operator-2"})}),p.jsx(uf,{flex:1,children:p.jsx(RS,{id:"right-2",testId:"right-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return f({right:ge({},v,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:v.right?[v.right]:[]},dataSet:e.dataSet,fieldFilterOptions:y})})]}),p.jsx(uf,{children:p.jsx(u_,{onClick:function(){f(s_(v,"right"))},state:v&&a_(v)?"remove":"add"})})]})]})}),p.jsx(uf,{marginTop:20,children:p.jsx(d_,{left:g,right:v,operator:u,dataSet:null==e?void 0:e.dataSet})})]})]})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return e.onClose()},secondary:!0,children:o("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return c()},disabled:x,children:m?o("update","Update"):o("create","Create")})]})})]})},j_=function(e){var n=e.index,i=e.rules,a=e.data,l=e.queryEngineConfig,s=e.updateDraft,u=e.removeDraft,d=Pu().textOverride,c=Hv(i.rule,a,l.supportedAggregates),f=c.completedFilters,m=c.wipFilters,h=c.addOrFilter,v=c.deleteWipFilter,g=c.updateWipFilter,x=t.useMemo((function(){return r.debounce((function(e){o.isEqual(i.rule,e)||s(ge({},i,{rule:e}))}),1)}),[i,s]);t.useEffect((function(){return x(f),function(){x.cancel()}}),[f,x]);var b=d("rule_title","Rule [[ruleNumber]]",{ruleNumber:n+1})+(i.name?": "+i.name:"");return p.jsx(uf,{as:"fieldset",children:p.jsxs(yf,{gap:"0.5rem",paddingBottom:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.1rem",direction:"column",children:[p.jsx(TF.Title,{title:b}),p.jsx(uf,{children:p.jsx($f,{id:"rules-name-"+n,label:d("field_value","Field Value"),value:i.name,onChange:function(e){return s(ge({},i,{name:e.target.value}))}})}),p.jsx(uf,{children:p.jsx(yf,{direction:"column",gap:"0.5rem",children:p.jsx(uf,{children:p.jsx(zv,{wipFilters:m,completedFilters:f,dataSet:a,updateWipFilter:g,queryEngineConfig:l,deleteWipFilter:v,textOverride:d,onAddOrFilter:function(){return h()},actionsRight:p.jsx(t.Fragment,{children:0!==n&&p.jsx(Pv,{secondary:!0,onClick:function(){return u()},children:d("delete_rule","Delete Rule")})})})})})})]})})},F_=function(e){var t,n=A_(e.initialValue),i=n.draft,r=n.updateDraftTitle,o=n.addNewRule,a=n.updateDraftRules,l=n.removeDraftRule,s=Pu().textOverride;return p.jsxs(Mh,{width:"4xl",isOpen:e.show,onClose:e.onClose,children:[p.jsx(Mh.Header,{title:HS("rules",s)}),p.jsxs(Mh.Content,{scrollable:!0,children:[p.jsx(Ew,{children:p.jsx($f,{id:"rules-name",label:s("metric_name","Metric name"),value:null==i?void 0:i.publicName,onChange:function(e){return r(e.target.value)}})}),p.jsx(Ew,{children:p.jsx(Td,{gap:"0.75rem",role:"list",children:null==i||null==(t=i.rules)?void 0:t.map((function(t,n){return p.jsx(TF.Panel,{children:p.jsx(j_,{rules:t,index:n,data:null==e?void 0:e.dataSet,queryEngineConfig:e.queryEngineConfig,updateDraft:function(e){return a(e,n)},removeDraft:function(){return l(n)}})},"rules_modal_key_"+n)}))})})]}),p.jsxs(Mh.Footer,{buttons:"space-between",children:[p.jsx(hh,{children:p.jsx(Pv,{onClick:function(){return o()},secondary:!0,children:s("add_rule","Add Rule")})}),p.jsxs(hh,{buttons:"end",children:[p.jsx(Pv,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:s("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return function(){if(i.publicName&&i.rules){var t=(n=i.publicName,r=i.rules,o=e.queryEngineConfig,{id:bt(),publicName:n,rules:r,dataType:"string",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Te({dataType:"string"},o)});e.onNewCustomField(e.initialValue?ge({},t,{id:e.initialValue.id}):t)}var n,r,o}()},children:e.initialValue?s("update","Update"):s("create","Create")})]})]})]})},S_={name:"",rule:[]},k_={publicName:"",rules:[S_]},A_=function(e){var n=t.useState(k_),i=n[0],r=n[1];return t.useEffect((function(){r(e||k_)}),[JSON.stringify(e)]),{draft:i,updateDraftTitle:function(e){r(ge({},i,{publicName:e}))},addNewRule:function(){var e,t=[].concat(null!=(e=null==i?void 0:i.rules)?e:[]);t.push(S_),r(ge({},i,{rules:t}))},updateDraftRules:function(e,t){var n,o=[].concat(null!=(n=null==i?void 0:i.rules)?n:[]);t>=0&&t<o.length&&(o[t]=e),r(ge({},i,{rules:o}))},removeDraftRule:function(e){var t,n=[].concat(null!=(t=null==i?void 0:i.rules)?t:[]);e>=0&&e<n.length+1&&n.splice(e,1),r(ge({},i,{rules:n}))}}},T_=["round_to_0_dp","round_to_2_dp"],__=function(e){var n=Pu(),i=n.mode,o=n.textOverride,a=function(e,n,i,o){var a=!!e,l=r.intersection(T_,Object.keys(n.supportedTransformationFunctions)),s=t.useState(""),u=s[0],d=s[1],c=t.useState({dataSetField:void 0,transformationFunctionKey:void 0}),p=c[0],f=c[1],m=Uo(i.fields,{onlyFieldTypes:["number"],removeDateCalculations:!0}).map((function(e){return{title:e.publicName,value:e}})),h=p.dataSetField?[{title:p.dataSetField.publicName,id:"rounded-number-field-"+p.dataSetField.id,select:{selected:p.transformationFunctionKey,onChange:function(e){f(ge({},p,{transformationFunctionKey:e}))},options:[].concat(l).map((function(e){return{label:n.supportedTransformationFunctions[e].publicName,value:e}}))}}]:[];return t.useEffect((function(){if(e&&cn(e)){d(e.publicName);var t=Qo(i,e.fieldId);f({dataSetField:t,transformationFunctionKey:2==e.roundToDecimalPlaces?"round_to_2_dp":"round_to_0_dp"})}else d(""),f({dataSetField:void 0,transformationFunctionKey:void 0})}),[JSON.stringify(e)]),{onCreateNewRoundedNumber:function(){if(p&&p.dataSetField){var t,i=function(e,t,n,i){return{id:bt(),publicName:e,fieldId:t,roundToDecimalPlaces:n,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},i)}}(u,null==(t=p.dataSetField)?void 0:t.id,"round_to_0_dp"==p.transformationFunctionKey?0:2,n);o(ge({},i,{id:a?e.id:i.id}))}},isEditing:a,metricName:u,setMetricName:d,items:h,initValues:m,selected:p,setSelected:f,transformationFunctions:l}}(e.initialValue,e.queryEngineConfig,e.dataSet,e.onNewCustomField),l=a.isEditing,s=a.metricName,u=a.setMetricName,d=a.items,c=a.initValues,f=a.selected,m=a.setSelected,h=a.transformationFunctions,v=a.onCreateNewRoundedNumber;return p.jsxs(Mh,{width:"xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:HS("roundedNumber",o)}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{id:"rounded-number-name",placeholder:o("metric_name","Metric name"),label:o("metric_name","Metric name"),value:s,onChange:function(e){return u(e.target.value)}})}),p.jsx(Ew,{children:p.jsx(jx,{testId:"select-rounded-number-field",mode:i,items:d,onDeleteItem:function(){return m({dataSetField:void 0,transformationFunctionKey:h[0]})},newItem:{callToAction:o("select_field_to_transform","Select field to transform"),onNew:function(e){return m({dataSetField:e,transformationFunctionKey:h[0]})},initValues:c,hide:!!f.dataSetField}})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return e.onClose()},secondary:!0,children:o("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){f.dataSetField&&v()},children:l?o("update","Update"):o("create","Create")})]})})]})},I_={publicName:""},D_=function(e){var n=Pu().textOverride,i=function(e,n){var i=!!e,r=t.useState(I_),o=r[0],a=r[1];t.useEffect((function(){a(e||I_)}),[JSON.stringify(e)]);var l=Uo(n.fields,{onlyFieldTypes:["date_time"]}),s=l.map((function(e){return{label:e.publicName,value:e.id}}));return{isEditing:i,dateTimeFields:l,dateFieldOptions:s,dateCalculationFunctions:d.DATE_MATHS_OPERATORS.map((function(e){return{label:$e(e),value:e}})),wipDateCalculationField:o,updateWipDateCalculation:function(e){a(ge({},o,e))}}}(e.initialValue,e.dataSet),r=i.dateCalculationFunctions,o=i.isEditing,a=i.dateFieldOptions,l=i.wipDateCalculationField,s=i.updateWipDateCalculation;return p.jsxs(Mh,{width:"2xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:HS("dateCalculation",n)}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{id:"date-calculation-name",placeholder:n("metric_name","Metric name"),label:n("metric_name","Metric name"),value:l.publicName,onChange:function(e){return s({publicName:e.target.value})}})}),p.jsx(TF.Panel,{children:p.jsx(Ew,{as:"fieldset",children:p.jsxs(yf,{direction:"row",gap:"0.5rem",children:[p.jsx(uf,{width:170,children:p.jsx(nm,{testId:"date-calc-calculation",label:"Calculation",onChange:function(e){s({dateCalculationFunction:e})},options:r,selected:l.dateCalculationFunction})}),p.jsx(uf,{flex:1,children:p.jsx(nm,{testId:"date-calc-date-one",label:"Date one",onChange:function(e){s({leftFieldId:e})},options:a,selected:l.leftFieldId})}),p.jsx(uf,{flex:1,children:p.jsx(nm,{testId:"date-calc-date-two",label:"Date two",onChange:function(e){s({rightFieldId:e})},options:a,selected:l.rightFieldId})})]})})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return e.onClose()},secondary:!0,children:n("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){if(l.leftFieldId&&l.rightFieldId&&l.publicName&&l.dateCalculationFunction){var t=(n=l.publicName,i=l.leftFieldId,r=l.dateCalculationFunction,a=l.rightFieldId,s=e.queryEngineConfig,{id:bt(),publicName:n,leftFieldId:i,rightFieldId:a,dateCalculationFunction:r,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},s)});e.onNewCustomField(ge({},t,{id:o&&e.initialValue?e.initialValue.id:t.id}))}var n,i,r,a,s},children:o?n("update","Update"):n("create","Create")})]})})]})},O_=function(e){var n=t.useState([]),i=n[0],r=n[1],o=Pu(),a=o.mode,l=o.queryEngineConfig,s=o.textOverride,u=ek(i,null==e?void 0:e.dataSet,"grouping",l,r),d=$S(null==e?void 0:e.dataSet,{onlyDimensions:!0},!0,[].concat(i,null==e?void 0:e.dimension)),c=ZS(i,"grouping",l,r);return p.jsxs(Mh,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},disableDnD:!0,children:[p.jsx(Mh.Header,{title:s("add_drilldown","Add Drilldown")}),p.jsx(Mh.Content,{children:p.jsx(Td,{columns:["1fr"],gap:"1rem",children:p.jsxs(Ew,{children:[p.jsx(Kf,{as:"p",children:s("drilldown_field","Drilldown field")}),p.jsx(jx,{mode:a,onDeleteItem:function(){return r([])},items:u,newItem:{callToAction:s("add_drilldown_field","Add drilldown field"),onNew:c,initValues:d,hide:i.length>0}})]})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:s("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){var t;0===i.length||e.onClose({subsetDimension:rt({field:i[0].field,function:null==(t=i[0])?void 0:t.function})})},primary:!0,disabled:0===i.length,children:s("update","Update")})]})})]})},E_=function(e){var n,i,r=t.useState((null==(n=e.progressMetric)?void 0:n.measure)||null),o=r[0],a=r[1],l=t.useState((null==(i=e.progressMetric)?void 0:i.goal)||null),s=l[0],u=l[1],d=Pu(),c=d.queryEngineConfig,f=d.textOverride;return p.jsxs(Mh,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},disableDnD:!0,children:[p.jsx(Mh.Header,{title:f("add_progress_metric","Add Progress Metric")}),p.jsxs(Mh.Content,{children:[p.jsxs(Ew,{children:[p.jsx(Kf,{children:f("metric","Metric")}),p.jsx(RS,{componentType:"progress",maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){a(e.measure[0])},supportedAggregates:c.supportedAggregates,attributes:{measure:o?[o]:[]},dataSet:e.dataSet,fieldFilterOptions:{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:"progress",removePercentage:!1,removeSimpleMaths:!1,removeRuleGrouping:!1,removeAggregateMaths:!1},disableRemove:!0})]}),p.jsx(Ew,{children:p.jsx(Ov,{label:f("goal","Goal"),currentValue:s,setNumber:function(e){return u(e)},id:"progress-goal"})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:f("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){o&&s&&e.onClose({measure:o,goal:s})},primary:!0,disabled:null===s||null===o,children:e.progressMetric?f("update","Update"):f("add","Add")})]})})]})},L_={filters:[[]],ruleValue:"#1FF985",ruleValueEnd:void 0,ruleType:"backgroundColor"},N_=function(e,t){return!!Mi(t).validate(e).error},M_=function(e){return null!=e&&e.show?p.jsx(R_,ge({},e)):null},R_=function(e){var n,i=t.useState(!1),o=i[0],a=i[1],l=t.useState(null!=(n=e.conditionalFormatting)&&n.ruleValueEnd?"gradient":"single"),s=l[0],u=l[1],d=Pu(),c=d.queryEngineConfig,f=d.textOverride,m="basicTable"!=e.componentType,h=function(e,t,n,i,r,o){return[].concat(function(e,t){return[].concat(t).flatMap((function(t){var n=Qo(e,t.field);return"date_time"==n.dataType?[]:[{label:n.publicName,value:n,icon:p.jsx(Af,{icon:n.dataType,paddingTop:0}),function:t.function}]}))}(e,t),function(e,t,n,i,r){return t.map((function(t){var o=Qo(e,t.field);return{label:o.publicName+(Ii(t)?" ("+_e(t.function,i)+")":""),value:qv(o,t.function,r,n),icon:p.jsx(Af,{icon:n?"number":o.dataType,paddingTop:0}),function:t.function}}))}(e,n,i,r,o))}(e.dataSet,e.dimension,e.measures,m,f,c.supportedAggregates),v=function(e,n,i,r,o){void 0===o&&(o=!1);var a=Pu().queryEngineConfig,l=t.useState(null!=e?e:ge({},L_,{ruleType:i})),s=l[0],u=l[1],d=Hv(s.filters,r,a.supportedAggregates,{startWithEmptyField:!0,maxFilters:1,enableChangeToNumber:o}),c=d.completedFilters,p=d.wipFilters,f=d.deleteWipFilter,m=d.updateWipFilter;t.useEffect((function(){u(e||L_)}),[JSON.stringify(e)]);var h=function(e){u(ge({},s,e))};return t.useEffect((function(){return h({filters:c})}),[JSON.stringify(c)]),ge({},s,{completedFilters:c,wipFilters:p,handleUpsert:function(){n(ge({},s,{ruleType:i}))},deleteWipFilter:f,updateWipFilter:m,onChange:h,disabled:N_(ge({},s,{ruleType:i}),a)})}(null==e?void 0:e.conditionalFormatting,e.onSave,e.ruleType,e.dataSet,m),g=v.onChange,x=v.ruleValue,b=v.ruleValueEnd,y=v.disabled,w=v.handleUpsert,C=v.completedFilters,j=v.wipFilters,F=v.deleteWipFilter,S=v.updateWipFilter,k=Go(e.componentType);t.useEffect((function(){var e,t,n,i;void 0===(null==(e=j[0][0])?void 0:e.field)&&(a(!1),u("single")),"none"!==(null==(t=j[0][0])?void 0:t.function)&&void 0!==(null==(n=j[0][0])?void 0:n.function)||"number"===(null==(i=j[0][0])||null==(i=i.field)?void 0:i.dataType)?a(!0):(a(!1),u("single"))}),[j]);var A=r.throttle((function(e){g(e)}),300);return p.jsxs(Mh,{isOpen:!0,onClose:e.onClose,width:"4xl",disableDnD:!0,children:[p.jsx(Mh.Header,{title:f("add_conditional_formatting","Add Conditional Formatting"),hiddenUnlessEnabledInCss:!1}),p.jsx(Mh.Content,{children:p.jsxs(Td,{gap:"1rem",children:[p.jsx(TF.Panel,{children:p.jsx(zv,{fieldHeadingOverride:f("field","Field"),queryEngineConfig:c,dataSet:e.dataSet,completedFilters:C,wipFilters:j,updateWipFilter:S,deleteWipFilter:F,overrideFieldOptions:h,maxOrFilters:1,textOverride:f,supportedQueryOperators:e.numberConditionalFormattingOnly?Gv(c,["<=",">="]):void 0})}),p.jsx(TF.Panel,{children:p.jsxs(yf,{gap:"1rem",direction:"column",children:[o&&k.supportedFeatures.colorGradient&&p.jsx(ij,{options:[{label:f("color_format.single","Single"),value:"single"},{label:f("color_format.gradient","Gradient"),value:"gradient"}],name:"gradient-check",label:f("select_percentage_type","Select Percentage Type"),selected:s,labelHidden:!0,onChange:function(e){u(e),g({ruleValueEnd:"gradient"===e?"#16A257":void 0})}}),p.jsxs(yf,{gap:"0.5rem",children:[p.jsx(uf,{flex:1,children:p.jsx(AC,{id:"color-formatting",label:"gradient"===s?f("start_color","Start Color"):f("color","Color"),currentValue:x,setColor:function(e){return A({ruleValue:e})}})}),p.jsx(uf,{flex:1,children:"gradient"===s&&o&&k.supportedFeatures.colorGradient&&p.jsx(AC,{id:"color-formatting-end",label:f("end_color","End Color"),currentValue:null!=b?b:"#16A257",setColor:function(e){return A({ruleValueEnd:e})}})})]})]})})]})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:e.onClose,children:f("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return w()},disabled:y,children:f("save","Save")})]})})]})},P_={month:{publicName:"Monthly",dateFormat:"MMMM YYYY",dataTypeOutput:"date_time"},year:{publicName:"Yearly",dateFormat:"YYYY",dataTypeOutput:"date_time"},quarter:{publicName:"Per quarter",dateFormat:"quarter",dataTypeOutput:"date_time"},week:{publicName:"Weekly",dateFormat:"week",dataTypeOutput:"date_time"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY",dataTypeOutput:"date_time"},hour:{publicName:"Hourly",dateFormat:"hh:mm",dataTypeOutput:"date_time"},minute:{publicName:"Per minute",dateFormat:"hh:mm",dataTypeOutput:"date_time"},second:{publicName:"Per second",dateFormat:"hh:mm:ss",dataTypeOutput:"date_time"}},z_=function(e){var n,i,r,o,a=e.trend,l=t.useState(a&&a.type===vr.Forecast?null!=(o=a.value)?o:10:null),s=l[0],u=l[1],d=Pu().textOverride,c=!(!a||a.type!==vr.Forecast||null===a.value),f=null===s||isNaN(s)||s>600;return p.jsxs(Mh,{width:"xl",isOpen:e.show,onClose:function(){return e.onClose()},disableDnD:!0,children:[p.jsx(Mh.Header,{title:d("add_trend_lines","Add Trend Lines")}),p.jsx(Mh.Content,{children:p.jsx(Ew,{children:p.jsx(Ov,{label:d("forecast_limit","[[timeDimension]] Forecast Limit",{timeDimension:(null==P_||null==(n=P_[null!=(i=null==(r=e.componentAttributes)||null==(r=r.timeDimension)?void 0:r.truncate)?i:""])?void 0:n.publicName)||""}),currentValue:s,setNumber:function(e){return u(e)},id:"forecast-input",max:600})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:d("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){null===s||f||e.onClose({type:vr.Forecast,value:s})},primary:!0,disabled:f,children:c?d("update","Update"):d("add","Add")})]})})]})},V_={value:void 0,strokeStyle:"dashed",strokeWidth:2,color:Sl(0),label:void 0},q_=function(e){return!!Gn().validate(e).error},B_=function(e){return null!=e&&e.show?p.jsx(W_,ge({},e)):null},W_=function(e){var n=Pu().textOverride,i=function(e,n){var i=t.useState(null!=e?e:V_),r=i[0],o=i[1];return t.useEffect((function(){o(e||V_)}),[JSON.stringify(e)]),ge({},r,{handleUpsert:function(){n(r)},onChange:function(e){o(ge({},r,e))},disabled:q_(r)})}(null==e?void 0:e.goalLine,null==e?void 0:e.onSave),r=i.value,o=i.onChange,a=i.color,l=i.disabled,s=i.handleUpsert;return p.jsxs(Mh,{isOpen:!0,onClose:null==e?void 0:e.onClose,width:"xl",disableDnD:!0,children:[p.jsx(Mh.Header,{title:n("add_goal_line","Add Goal Line")}),p.jsx(Mh.Content,{children:p.jsxs(Td,{columns:["1fr","1fr"],gap:"1rem",children:[p.jsx(Ew,{children:p.jsx(Ov.HandleBarSupport,{id:"goal-line-value",label:n("value","Value"),value:r,onChange:function(e){return o({value:e})}})}),p.jsx(AC,{id:"color-formatting",label:n("color","Color"),currentValue:a,setColor:function(e){return o({color:e})}})]})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(Pv,{secondary:!0,onClick:null==e?void 0:e.onClose,children:n("cancel","Cancel")}),p.jsx(Pv,{onClick:function(){return s()},disabled:l,children:n("save","Save")})]})})]})},H_={publicName:"",metric:void 0},Y_=function(e){return!(0===(t=e).publicName.length||void 0===t.publicName||void 0===t.metric||void 0===t.metric.type||t.metric.type===nn.Operator&&"values"in t.metric&&0===t.metric.values.length||t.metric.type===nn.IfLogic&&"cases"in t.metric&&0===t.metric.cases.length);var t},G_=function(e){var t=e.op;return t===rn.Divide?p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:Sl(50),className:es({width:16,height:16}),children:p.jsx("path",{fillRule:"evenodd",d:"M15.256 3.042a.75.75 0 0 1 .449.962l-6 16.5a.75.75 0 1 1-1.41-.513l6-16.5a.75.75 0 0 1 .961-.449Z",clipRule:"evenodd"})}):t===rn.Multiply?p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:"1.5",stroke:Sl(50),className:es({width:16,height:16}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})}):t===rn.Add?p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:"1.5",stroke:Sl(50),className:es({width:16,height:16}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}):t===rn.Subtract?p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:"1.5",stroke:Sl(50),className:es({width:16,height:16}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14"})}):null},U_=function(e){var t,n=e.field,i=e.dataSet,r=e.onDeleteItem,o=e.id,a=Pu(),l={id:(t=Qo(i,n.fieldId)).id,title:t.publicName,subtext:t.description,editIcon:!1,icon:t.dataType};return p.jsx(vx,{index:0,item:l,totalItemsCount:1,purpose:"custom-metric-builder-field",mode:a.mode,onDeleteItem:function(){return r()},testId:o})},K_=function(e){var t,n,i=e.variable,r=e.onDeleteItem,o=e.id,a=Pu(),l=(n=null==a||null==(t=a.variables)?void 0:t.variables[i.value],{title:i.value,subtext:null==n?void 0:n.description,editIcon:!1,icon:"variable",id:i.value});return p.jsx(vx,{index:0,item:l,totalItemsCount:1,purpose:"custom-metric-builder-variable",mode:a.mode,onDeleteItem:r,testId:o})},X_=function(){return{type:nn.IfLogic,cases:[{filter:[],returns:void 0}],else:void 0}},Q_=function(e){return{type:nn.Operator,op:e,values:[]}};function Z_(e){return J_(e)}function J_(e){if(e&&"type"in e)switch(e.type){case nn.NumberInput:return{type:nn.NumberInput,value:void 0};case nn.Variable:return{type:nn.Variable,value:e.title};case nn.Field:return{type:nn.Field,fieldId:e.id,function:"none"};case nn.Operator:return Q_(e.id);case nn.IfLogic:return X_();default:return}}var $_=function(e){Pu();var t=Dd();return p.jsx("div",{className:""+jf.deleteWrapper(null==t?void 0:t.lists),children:p.jsxs("button",{type:"button",className:""+jf.deleteButton(null==t?void 0:t.lists),"data-testid":"remove-"+e.id,onClick:function(t){t.stopPropagation(),e.onDeleteItem()},"aria-label":e.label,"data-themeapi":"lists.icon",children:[p.jsx("span",{className:""+Xl,children:e.label}),p.jsx(Qu,{})]})})},eI=function(e){var t=Pu().textOverride;return p.jsxs("div",{className:es({position:"relative"}),children:[p.jsx($f,{label:"Value",value:e.value,id:e.id,onChange:e.onChange,labelHidden:!0,type:"number"}),p.jsx($_,{id:e.id,onDeleteItem:e.onDeleteItem,label:t("remove","Remove")+" Value"})]})},tI=function(e,t,n){if(void 0===t&&(t=!1),!e)return"";switch(e.type){case nn.NumberInput:return void 0!==e.value?e.value.toString():"Still to be defined";case nn.Variable:return"{{ "+e.value+" }}";case nn.Field:return e.fieldId;case nn.Operator:var i=e.op,r=e.values;if(0===r.length)return"Still to be defined";if(i===rn.Divide&&r.length>2){var o=r.reduce((function(e,t,i){return 0===i?tI(t,!0,n):"("+e+" / "+tI(t,!0,n)+")"}),"");return t?"("+o+")":o}var a=r.map((function(e){return tI(e,!0,n)})).join(" "+i+" ");return t?"("+a+")":a;case nn.IfLogic:return e.cases.map((function(e){var t=e.returns?"then "+tI(e.returns,!0,n):"";return 0===e.filter.length?"Still to be defined":"if ("+e.filter.map((function(t){return nI(t,e.filter.length>1,n)})).join(" || ")+") "+t})).join(" else ")+(e.else?" else "+tI(e.else,!0,n):"");default:return""}},nI=function(e,t,n){var i=e.map((function(e){var t=e.op,i=e.value,r=e.field;if(jt(i)){var o=i;if(null!==o.unit&&null!==o.timeFrame){var a,l=yt(n)[o.unit].description.toLowerCase(),s=wt(n)[o.timeFrame].description.toLowerCase();return n("metric_overview.relative_date","[[field]] [[op]] [[value]] [[duration]] in [[timeframe]]",{field:r,op:t,value:null!=(a=i.value)?a:"",duration:l,timeframe:s})}}return r+" "+t+" “"+i+"“"})).join(", ");return t?"("+i+")":i},iI=function(e){var t=e.metric,n=Pu().textOverride;return p.jsx("code",t?{className:""+rI,"data-testid":"metric-overview",children:tI(t,!1,n)}:{className:""+rI,"data-testid":"metric-overview",children:n("metrics_operators_need_defined","Metrics and operator need to be defined")})},rI=es({backgroundColor:Sl(80),color:Sl(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11}),oI=function(e){return aI().map((function(t){return ge({},t,{things:t.things.filter((function(n){var i,r;return null!=(i=null==(r=e[t.id])?void 0:r.includes(n.id))&&i}))})})).filter((function(e){return e.things.length>0}))},aI=function(){return[{title:"Operators",id:"operator",things:[{id:rn.Add,type:nn.Operator,title:"Add",icon:p.jsx(G_,{op:rn.Add}),subtext:"Returns the sum of two or more numbers."},{id:rn.Subtract,type:nn.Operator,title:"Subtract",icon:p.jsx(G_,{op:rn.Subtract}),subtext:"Returns the difference of two or more numbers."},{id:rn.Divide,type:nn.Operator,title:"Divide",icon:p.jsx(G_,{op:rn.Divide}),subtext:"Returns the quotient of two or more numbers."},{id:rn.Multiply,type:nn.Operator,title:"Multiply",icon:p.jsx(G_,{op:rn.Multiply}),subtext:"Returns the product of two or more numbers."}]},{title:"Logic",id:"logic",things:[{id:nn.IfLogic,type:nn.IfLogic,title:"If Statement",icon:p.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 121.83 122.88",children:p.jsx("g",{children:p.jsx("path",{d:"M27.61,34.37l-4.07,4.6l0.4,1.74h10.48c-2.14,12.38-3.74,23.54-6.81,40.74c-3.67,21.94-5.78,27.33-7.03,29.3 c-1.1,1.95-2.68,2.96-4.82,2.96c-2.35,0-6.6-1.86-8.88-3.97c-0.82-0.56-1.79-0.42-2.82,0.26C2,111.74,0,114.42,0,116.82 c-0.12,3.24,4.21,6.06,8.34,6.06c3.64,0,9-2.28,14.64-7.64c7.71-7.31,13.48-17.34,18.3-39.02c3.1-13.84,4.56-22.84,6.74-35.5 l13.02-1.18l2.82-5.17H49.2C52.99,10.53,55.95,7,59.59,7c2.42,0,5.24,1.86,8.48,5.52c0.96,1.32,2.4,1.18,3.5,0.28 c1.85-1.1,4.13-3.92,4.28-6.48C75.96,3.5,72.6,0,66.82,0C61.58,0,53.55,3.5,46.8,10.38c-5.92,6.27-9.02,14.1-11.16,23.99H27.61 L27.61,34.37z M69.27,50.33c4.04-5.38,6.46-7.17,7.71-7.17c1.29,0,2.32,1.27,4.53,8.41l3.78,12.19 c-7.31,11.18-12.66,17.41-15.91,17.41c-1.08,0-2.17-0.34-2.94-1.1c-0.76-0.76-1.6-1.39-2.42-1.39c-2.68,0-6,3.25-6.06,7.28 c-0.06,4.11,2.82,7.05,6.6,7.05c6.49,0,11.98-6.37,22.58-23.26l3.1,10.45c2.66,8.98,5.78,12.81,9.68,12.81 c4.82,0,11.3-4.11,18.37-15.22l-2.96-3.38c-4.25,5.12-7.07,7.52-8.74,7.52c-1.86,0-3.49-2.84-5.64-9.82l-4.53-14.73 c2.68-3.95,5.32-7.27,7.64-9.92c2.76-3.15,4.89-4.49,6.34-4.49c1.22,0,2.28,0.52,2.94,1.25c0.87,0.96,1.39,1.41,2.42,1.41 c2.33,0,5.93-2.96,6.06-6.88c0.12-3.64-2.14-6.74-6.06-6.74c-5.92,0-11.14,5.1-21.19,20.04l-2.07-6.41 c-2.9-9-4.82-13.63-8.86-13.63c-4.7,0-11.16,5.78-17.48,14.94L69.27,50.33L69.27,50.33z"})})}),subtext:"Returns the first value if the condition is true; otherwise, returns the second value."},{id:nn.NumberInput,type:nn.NumberInput,title:"Number",icon:p.jsx("svg",{version:"1.1",id:"Layer_1",viewBox:"0 0 122.88 102.06",children:p.jsx("g",{children:p.jsx("path",{d:"M8.18,23.12h67.09v5.39H8.18c-0.77,0-1.47,0.31-1.98,0.82c-0.5,0.51-0.82,1.21-0.82,1.98v39.46c0,0.77,0.31,1.47,0.82,1.98 c0.51,0.5,1.21,0.82,1.98,0.82h67.09v5.39H8.18c-2.24,0-4.29-0.92-5.77-2.4L2.4,76.53C0.92,75.05,0,73.01,0,70.76V31.3 c0-2.24,0.92-4.29,2.4-5.77l0.01-0.01C3.89,24.04,5.94,23.12,8.18,23.12L8.18,23.12z M71.77,53.85c-1.52,0-2.75-1.23-2.75-2.75 c0-1.52,1.23-2.75,2.75-2.75h12.78V18.04c-0.39-3.8-1.56-6.62-3.34-8.6c-1.93-2.16-4.67-3.43-7.99-3.98 c-1.49-0.24-2.51-1.65-2.26-3.15c0.24-1.49,1.65-2.51,3.15-2.26c4.54,0.75,8.37,2.57,11.19,5.74c0.72,0.8,1.37,1.69,1.94,2.66 c0.72-1.25,1.58-2.35,2.56-3.32c2.94-2.92,6.88-4.51,11.59-5.1c1.51-0.18,2.88,0.89,3.06,2.4c0.18,1.51-0.89,2.88-2.4,3.06 c-3.52,0.44-6.38,1.54-8.39,3.53c-1.99,1.97-3.25,4.91-3.61,9.04v5.07h24.65c2.24,0,4.29,0.92,5.77,2.4l0.01,0.01 c1.48,1.48,2.4,3.53,2.4,5.77v39.46c0,2.24-0.92,4.29-2.4,5.77l-0.01,0.01c-1.48,1.48-3.53,2.4-5.77,2.4H90.05v5.07 c0.36,4.13,1.62,7.08,3.61,9.04c2,1.98,4.86,3.09,8.39,3.53c1.51,0.18,2.58,1.56,2.4,3.06c-0.18,1.51-1.55,2.58-3.06,2.4 c-4.7-0.59-8.65-2.18-11.59-5.1c-0.98-0.97-1.84-2.07-2.56-3.32c-0.57,0.97-1.22,1.85-1.94,2.66c-2.83,3.16-6.66,4.99-11.19,5.74 c-1.49,0.24-2.9-0.77-3.15-2.26c-0.24-1.49,0.77-2.9,2.26-3.15c3.32-0.55,6.06-1.81,7.99-3.98c1.78-1.99,2.94-4.81,3.34-8.6 l0-30.17H71.77L71.77,53.85L71.77,53.85z M90.05,28.5v19.84h12.98c1.52,0,2.75,1.23,2.75,2.75c0,1.52-1.23,2.75-2.75,2.75H90.05 v19.71h24.65c0.77,0,1.47-0.31,1.98-0.82c0.5-0.51,0.82-1.21,0.82-1.98V31.3c0-0.77-0.31-1.47-0.82-1.98 c-0.51-0.5-1.21-0.82-1.98-0.82H90.05L90.05,28.5z"})})}),subtext:"Assign a static number"}]}]},lI=function(e){switch(e){case rn.Divide:return"Divide";case rn.Multiply:return"Multiply";case rn.Subtract:return"Subtract";case rn.Add:return"Add";default:return e}},sI=function(e){var t;return p.jsxs("div",{className:es({display:"grid",gap:8}),"data-component":"custom-metric-row",children:[e.title&&p.jsx("div",{className:es({fontSize:14,fontWeight:500,color:"inherit"}),children:e.title}),p.jsx("div",{className:es({marginLeft:null!=(t=e.marginLeft)?t:20,display:"grid",gap:8}),"data-component":"custom-metric-row-children",children:e.children})]})},uI=function(e){var n=e.filter,i=Pu(),o=i.queryEngineConfig,a=i.textOverride,l=Hv(e.filter,e.dataSet,o.supportedAggregates),s=l.completedFilters,u=l.wipFilters,d=l.addOrFilter,c=l.deleteWipFilter,f=l.updateWipFilter,m=t.useMemo((function(){return r.debounce((function(t){r.isEqual(n,t)||e.updateFilter(t)}),1)}),[n,e.updateFilter]);return t.useEffect((function(){return m(s),function(){m.cancel()}}),[s,m]),p.jsx(TF.Panel,{children:p.jsx(zv,{wipFilters:u,completedFilters:s,dataSet:e.dataSet,updateWipFilter:f,queryEngineConfig:o,deleteWipFilter:c,textOverride:a,onAddOrFilter:function(){return d()}})})},dI=function(e){var n=e.value,i=e.level,r=e.dataSet,o=e.updateValue,a=e.index,l=e.onDeleteItem,s=e.parentIsIfLogic,u=e.isEditing,d=Pu(),c=d.variables,f=d.textOverride;if(n.type===nn.NumberInput)return p.jsx(eI,{value:n.value,id:i+"-input-"+a,onChange:function(e){var t=ge({},n);t.value=Number(e.target.value),o(t)},onDeleteItem:l});if(n.type===nn.Variable)return p.jsx(K_,{variable:n,onDeleteItem:l,id:i+"-"+a+"-variable"});if(n.type===nn.Field)return p.jsx(U_,{field:n,dataSet:r,onDeleteItem:l,id:i+"-"+a+"-field"});var m=[].concat(oI({operator:[rn.Add,rn.Divide,rn.Subtract,rn.Multiply],logic:[nn.NumberInput]}));if(n.type===nn.IfLogic||s||m.push(function(e){var t=Uo(e.fields,{onlyFieldTypes:["number"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0,removeDateCalculations:!0,removeConditional:!0}).map((function(e){return{type:nn.Field,id:e.id,title:e.publicName,subtext:e.description,editIcon:!1,icon:p.jsx(Sf,{icon:"number"})}}));return{id:nn.Field,title:"Fields",things:t}}(r)),null!=c&&c.variables){var h=function(e,t){var n=[];if(Object.entries(e).forEach((function(e){var t=e[0],i=e[1];"number"==typeof i.value&&n.push({id:t,type:nn.Variable,title:t,icon:p.jsx(Sf,{icon:"variable"}),subtext:i.description})})),0!==n.length)return{id:"variables",title:"Variables",things:n}}(c.variables);h&&m.push(h)}n.type===nn.IfLogic&&(s=!0);var v=!u;return p.jsxs("div",{className:es({position:"relative"}),children:[v&&p.jsx($_,{id:i+"-block-"+a,onDeleteItem:l,label:f("remove","Remove")+" level "+(i+1)+" "+n.type}),p.jsxs("div",{className:es({background:Sl(90+4*i),borderRadius:8,padding:"16px 20px 20px"}),"data-level":i,"data-type":n.type,children:[n.type===nn.IfLogic&&p.jsxs("div",{className:es({display:"grid",gap:8}),children:[n.cases.map((function(e,l){return p.jsxs(t.Fragment,{children:[p.jsx(sI,{title:0!==l?"Else If":"If",children:p.jsx(uI,{filter:e.filter,dataSet:r,updateFilter:function(t){e.filter=t,o(ge({},n))}})}),p.jsxs(sI,{title:"Then",children:[e.returns&&p.jsx(dI,{value:e.returns,level:i+1,dataSet:r,updateValue:function(t){e.returns=t,o(ge({},n))},index:a,onDeleteItem:function(){e.returns=void 0,o(ge({},n))},parentIsIfLogic:s}),!e.returns&&p.jsx(pI,{items:m,onSelect:function(t){if(t){var i=Z_(t);i&&(e.returns=i)}o(ge({},n))},disabled:0===e.filter.length})]})]},l)})),p.jsxs(sI,{title:"Else",children:[n.else&&p.jsx(dI,{value:n.else,level:i+1,dataSet:r,updateValue:function(e){n.else=e,o(ge({},n))},index:a,onDeleteItem:function(){n.else=void 0,o(ge({},n))},parentIsIfLogic:s}),!n.else&&p.jsx(pI,{items:m,onSelect:function(e){var t=Z_(e);t&&(n.else=t),o(ge({},n))},disabled:0===n.cases[0].filter.length})]})]}),n.type===nn.Operator&&p.jsxs("div",{children:[p.jsx("div",{className:es({fontSize:14,fontWeight:500,color:"inherit",marginBottom:8}),"data-type":"title",children:lI(n.op)}),n.values.map((function(e,a){return p.jsxs(t.Fragment,{children:[p.jsx("div",{className:es({marginLeft:20}),"data-type":e.type,children:p.jsx(dI,{value:e,level:i+1,dataSet:r,updateValue:function(e){var t=function(e,t,n){var i=ge({},e),r=i.values.map((function(e,i){return i===t?n:e}));return i.values=r,i}(n,a,e);o(t)},index:a,onDeleteItem:function(){var e=function(e,t){var n=ge({},e),i=n.values.filter((function(e,n){return n!==t}));return n.values=i,n}(n,a);o(e)},parentIsIfLogic:s})}),n.values.length-1!==a&&p.jsx("div",{className:es({height:0===i?20:8,position:"relative"}),"data-type":lI(n.op),children:p.jsx("div",{className:es({position:"absolute",top:0===i?0:-6,bottom:0,left:-3}),children:p.jsx(G_,{op:n.op})})})]},a)})),p.jsx("div",{className:es({marginLeft:20,marginTop:0===i&&0!==n.values.length?20:8}),"data-type":"Add property",children:p.jsx(pI,{items:m,onSelect:function(e){o(function(e,t){var n=ge({},e);if(t&&"values"in n){var i=J_(t);i&&n.values.push(i)}return n}(n,e))}})})]})]})]})},cI=function(e){var n,i,r=t.useState({wipCustomMetric:e.metric}),o=r[0],a=r[1],l=function(t){a({wipCustomMetric:t}),e.onChange&&e.onChange(t)};return t.useEffect((function(){e.metric&&e.isEditing&&a({wipCustomMetric:e.metric})}),[JSON.stringify(e.metric)]),p.jsx(t.Fragment,{children:p.jsxs("div",{children:[o.wipCustomMetric&&p.jsx(dI,{value:o.wipCustomMetric,level:0,dataSet:e.dataSet,updateValue:function(e){return function(e){l(e)}(e)},index:0,onDeleteItem:function(){l(void 0)},isEditing:e.isEditing}),!o.wipCustomMetric&&p.jsx(pI,{items:(n=e.supportedTypes,i={},n.includes(mr.Maths)&&(i=ge({},i,{operator:[rn.Add,rn.Divide,rn.Subtract,rn.Multiply]})),n.includes(mr.IfStatement)&&(i=ge({},i,{logic:[nn.IfLogic]})),oI(i)),onSelect:function(e){var t=function(e){return(null==e?void 0:e.id)===rn.Add||(null==e?void 0:e.id)===rn.Divide||(null==e?void 0:e.id)===rn.Subtract||(null==e?void 0:e.id)===rn.Multiply?Q_(e.id):(null==e?void 0:e.id)===nn.IfLogic?X_():void 0}(e);t&&l(t)}}),p.jsx(uf,{marginTop:20,children:p.jsx(iI,{metric:o.wipCustomMetric})})]})})},pI=function(e){var t=qm().dispatch,n=function(){t({type:"setActiveModal",payload:{modal:GS.ItemPicker,attributes:void 0}})};return p.jsx(Gy,{enabled:e.disabled,children:p.jsx(ox,{testId:"add-property",onChange:function(){t({type:"setActiveModal",payload:{modal:GS.ItemPicker,attributes:{title:"Add Property",show:!0,onClose:function(){return n()},onSave:function(t){e.onSelect(t),n()},items:e.items}}})},label:"Add property",disabled:e.disabled})})},fI=function(e){var n=Pu().textOverride,i=Go(e.componentType),r=function(e,n,i){var r=!!n,o=t.useState(H_),a=o[0],l=o[1];return t.useEffect((function(){n&&l({publicName:n.publicName,metric:n.metric})}),[JSON.stringify(n)]),{publicName:a.publicName,onChange:function(e){l(ge({},a,e))},resetState:function(){l(H_)},metric:a.metric,isEditing:r,disabled:!Y_(a),handleUpsert:function(){if(Y_(a)&&a.metric){var t=function(e,t,n){return{id:bt(),publicName:e,metric:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Te({dataType:"number"},n)}}(a.publicName,a.metric,e);i(ge({},t,{id:r?n.id:t.id}))}}}}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),o=r.onChange;return!1===i.supportedCustomFields.calculatedField?null:p.jsxs(Mh,{width:"4xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:"Calculated Field"}),p.jsxs(Mh.Content,{children:[p.jsx(Ew,{children:p.jsx($f,{label:n("metric_name","Metric name"),id:"metric-name",placeholder:n("metric_name","Metric name"),value:r.publicName,onChange:function(e){return o({publicName:e.target.value})}})}),p.jsx(Ew,{children:p.jsx(cI,{dataSet:e.dataSet,metric:r.metric,onChange:function(e){return o({metric:e})},isEditing:r.isEditing,supportedTypes:i.supportedCustomFields.calculatedField})})]}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{onClick:function(){return e.onClose()},secondary:!0,children:n("cancel","Cancel")}),p.jsx(gh,{onClick:function(){return r.handleUpsert()},disabled:r.disabled,primary:!0,children:r.isEditing?n("update","Update"):n("create","Create")})]})})]})},mI=function(e){var n=t.useState(void 0),i=n[0],r=n[1],o=t.useState(e.items[0]),a=o[0],l=o[1],s=function(t){t?e.onSave(t):e.onClose(),r(void 0),l(e.items[0])},u=Pu(),d=u.textOverride,c=u.mode;return p.jsxs(Mh,{width:"xl",isOpen:e.show,onClose:e.onClose,disableDnD:!0,children:[p.jsx(Mh.Header,{title:e.title}),p.jsx(Mh.Content,{children:p.jsx(bS,{padding:0,children:p.jsxs(yf,{children:[p.jsx("div",{className:es(ge({minWidth:192,flex:1,position:"relative",borderRight:"1px solid "+Sl(90),maxHeight:320,minHeight:320,overflowY:"auto"},vf)),children:p.jsx("div",{className:es({paddingBottom:4,paddingTop:4,height:"100%"}),children:e.items.map((function(e,t){return p.jsx("div",{className:es({padding:12,borderTop:0!==t?"1px solid "+Sl(90):void 0,borderRight:a.id===e.id?"2px solid #3074D9":void 0,backgroundColor:a.id===e.id?Sl(97):"transparent",cursor:"pointer","&:hover":{backgroundColor:Sl(97)}}),onClick:function(){return function(e){r(void 0),l(e)}(e)},onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l(e))},tabIndex:0,role:"button",children:p.jsx("span",{className:es({fontSize:14,fontWeight:500}),children:e.title})},t)}))})}),p.jsx("div",{className:es(ge({flex:2,maxHeight:320,minHeight:320,overflowY:"auto"},vf)),children:p.jsx("div",{className:es({padding:12,display:"grid",gap:8}),children:a.things.map((function(e,t){return p.jsx("div",{"data-selectedthing":(null==i?void 0:i.id)===e.id,children:p.jsx(vx,{index:t,item:ge({},e,{onClick:function(){return r(e)},highlight:(null==i?void 0:i.id)===e.id}),totalItemsCount:1,purpose:"custom-metric-builder-field",mode:c})},t)}))})})]})})}),p.jsx(Mh.Footer,{buttons:"end",children:p.jsxs(hh,{children:[p.jsx(gh,{onClick:function(){return s()},secondary:!0,children:d("cancel","Cancel")}),p.jsx(gh,{onClick:function(){return s(i)},disabled:void 0===i,primary:!0,children:"Add"})]})})]})},hI=function(e){return e[e.Neither=0]="Neither",e[e.Library=1]="Library",e[e.Editor=2]="Editor",e}({}),vI=function(e){var n=e.modalToShow,i=e.modalIsOpen,r=e.modalNamespace,o=qm(),a=o.dispatch,l=o.trackEvent;return p.jsxs(t.Fragment,{children:[p.jsxs(Mh,{width:"7xl",isOpen:i,onClose:function(){Xe("onClose of "+r+" modal."),l("library.close"),a({type:"clearModal"})},transparentBackground:"modal-library"==r,namespace:r,options:{disableModalScrolling:n==hI.Library},disableDnD:!0,children:[n==hI.Library&&p.jsx(lA,{}),n==hI.Editor&&p.jsx(YT,{})]}),p.jsx(gI,{})]})},gI=function(){var e=qm().activeModal;return t.useEffect((function(){var t=e&&Object.entries(e).filter((function(e){return void 0!==e[1]})).map((function(e){return e[0]}));t&&(null==t?void 0:t.length)>0&&Xe("Active modals: ",t)}),[e]),e?p.jsx(p.Fragment,{children:Object.entries(e).filter((function(e){return void 0!==e[1]})).map((function(e){var t=e[0],n=e[1],i=null==n?void 0:n.attributes;switch(t){case GS.Drilldown:return p.jsx(UT,ge({},i,{show:!0}),t);case GS.AdvancedFilter:return p.jsx(KT,ge({},i,{show:!0}),t);case GS.Prefix:return p.jsx(QT,ge({},i,{show:!0}),t);case GS.ConditionalCustomMetric:return p.jsx($T,ge({},i),t);case GS.PercentageCustomMetric:return p.jsx(v_,ge({},i),t);case GS.MathCustomMetric:return p.jsx(C_,ge({},i),t);case GS.CalculatedField:return p.jsx(fI,ge({},i),t);case GS.RulesCustomMetric:return p.jsx(F_,ge({},i),t);case GS.RoundedNumberCustomMetric:return p.jsx(__,ge({},i),t);case GS.DateCalculationCustomMetric:return p.jsx(D_,ge({},i),t);case GS.DeleteCustomMetric:return p.jsx(yS,ge({},i),t);case GS.TableDrilldown:return p.jsx(O_,ge({},i),t);case GS.Progress:return p.jsx(E_,ge({},i),t);case GS.ConditionalFormatting:return p.jsx(M_,ge({},i),t);case GS.TrendLines:return p.jsx(z_,ge({},i),t);case GS.GoalLines:return p.jsx(B_,ge({},i),t);case GS.ItemPicker:return p.jsx(mI,ge({},i),t);default:return null}}))}):null},xI=function(e){var t=Pu(),n=t.reportScheduleOptions,i=t.onScheduledReportChange,r=t.textOverride,o=(t.scheduledReports||[])[0],a=o?o.id:l.v4(),s=[].concat(n).map((function(e){return{label:e.description,value:e.cron}})),u=function(){var e=me(Ce().mark((function e(t){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i(a,t);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return p.jsxs(Mh,{width:"xl",onClose:e.onClose,isOpen:e.isOpen,children:[p.jsx(Mh.Header,{title:r("set_report_schedule","Set report schedule")}),p.jsx(Mh.Content,{children:p.jsx(nm,{placeholder:r("select_schedule","Select schedule"),selected:o?o.schedule:null,showClearBtn:!0,onChange:u,options:s})}),p.jsx(Mh.Footer,{children:p.jsx(Pv,{onClick:e.onClose,secondary:!0,children:r("close","Close")})})]})},bI=function(){var e=Pu(),n=e.textOverride,i=e.reportScheduleOptions,o=qm().dashboard.webhookId,a=!r.isEmpty(i)&&o,l=t.useState(!1),s=l[0],u=l[1];return a?p.jsxs(p.Fragment,{children:[p.jsx(sh,{tooltipContent:function(){return n("scheduled_reports","Setup scheduled reports")},children:p.jsx(Iv,{label:n("scheduled_reports","Scheduled reports"),onChange:function(){return u(!0)},className:"vizzly_scheduled_reports-button",children:p.jsx(Ku,{})})}),p.jsx(xI,{isOpen:s,onClose:function(){return u(!1)}})]}):null},yI=function(){var e,n=Z.useWindowWidth(),i=t.useRef(0),r=t.useState(!1),o=r[0],a=r[1],l=qm(),s=l.dashboard,u=l.dispatch,d=l.componentEditor,c=l.pickFromComponentLibrary,f=l.trackEvent,m=l.saving,h=l.generatingPDF,v=Pu(),g=v.featureToggles,x=v.scope,b=v.isProgrammaticParent,y=v.textOverride,w=v.pdfSettings,C=v.componentOverrides,j=v.developerTools,F=t.useState(!1),S=F[0],k=F[1];!function(e){var n=Pu().mode,i=t.useState(!1),r=i[0],o=i[1],a=t.useState(null),l=a[0],s=a[1];t.useEffect((function(){if(e.dashboard){var t=ge({},n=e.dashboard,{display:n.display.map((function(e){return ge({},e,{components:e.components.map((function(e){return"results"in e?ge({},e,{results:[]}):e}))})}))});null!==l&&kj(t)!==kj(l)&&o(!0)}var n}),[e]),t.useEffect((function(){s(e.dashboard)}),[]),t.useEffect((function(){var e=function(e){"admin"===n&&r&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}),[r,n]),t.useEffect((function(){var e=function(){var e=me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"admin"===n&&r&&navigator.sendBeacon("/log","Tab closed");case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return window.addEventListener("unload",e),function(){return window.removeEventListener("unload",e)}}),[])}({dashboard:s});var A=function(e){i.current!==n&&(i.current=n,k(!0),setTimeout((function(){return k(!1)}),null!=e?e:100))};Nu((function(e){var t,n;e.resizing&&(Ke("Received from vizzlyState, `resizing()`"),"object"==typeof e.resizing&&(t=null!=(n=e.resizing.timeout)?n:100),A(t))}));var T=document.cookie.includes("disableViewCheck=true");t.useEffect((function(){var e=function(){return A()};return T||window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}));var _=null!=d||null!=c,I=hI.Neither,D=void 0;null!=d?(I=hI.Editor,D="modal-editor"):null!=c&&(I=hI.Library,D="modal-library");var O=g.showGlobalFilters,E=Mt(s.globalFilters);E||Ke("Required dashboard filters do not have values, so the display of the dashboard will not render.",s.globalFilters);var L,N,M,R=g.canDownloadPDF,P="read"===x||g.forceMobile,z=function(e,t,n,i){return{hideAddCellColumn:!1===e.canAddNewCells||!!t,hideActionBar:!(null==n||!n.generatingPDF)||!(!t||e.showResetButton)||!(e.showGlobalFilters||i||e.showResetButton),hideAddRow:!1===e.canAddNewRows||!!t}}(g,P,w,R),V=z.hideAddCellColumn,q=z.hideActionBar,B=z.hideAddRow,W=P&&!R,H=V?["auto"]:["32px","auto"],Y=V?{gridColumn:"span 1/span 2",gridRow:2}:{gridColumn:"span 2/span 2",gridRow:2},G=null!=w&&w.generatingPDF?function(e,t){var n=0,i=1390-t,r={},o=!0;if(e.forEach((function(e,t){var a=e.height;(n+=a)>i&&(r[t-1]=i-(n-a),n=a,o&&(o=!1,i=1390))})),n<=i){var a=e.length-1;r[a]&&delete r[a]}return r}(s.display,(N=0,(M=document.querySelector(".dashboard-pdf-generator-header"))&&(N=(L=M)?L.offsetHeight:0),N)):void 0;return p.jsxs(Vu,{developerTools:j,children:[p.jsxs(jh,{id:"vizzly_dashboard_provider",children:[p.jsx(vI,{modalToShow:I,modalIsOpen:_,modalNamespace:D}),p.jsx(cj,{show:!0===h,onClose:function(){var e=me(Ce().mark((function e(t){var n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Fj({page:t}),!t){e.next=4;break}return e.next=4,n();case 4:u({type:"setGeneratingPDF",payload:!1});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),p.jsx(sC,{}),p.jsx(QC,{show:o,onClose:function(){return a(!1)}}),!(null!=w&&w.generatingPDF)&&p.jsx(UC,{isProgrammaticParent:b}),p.jsx(uf,{padding:"0.25rem","data-component":"dashboard",overflow:"hidden",className:"vizzly-studio",children:p.jsx(XC,{children:p.jsxs(uf,{position:"relative",children:[S&&p.jsx(Nf,{override:C.renderLoadingComponent}),!S&&p.jsxs(Td,{rows:q?["auto"]:wI(!B,!q),columns:H,gap:8,className:If("dashboard"),"data-component":"dashboard-grid",children:[!q&&p.jsxs(yf,{gridRow:1,gap:"16px","data-component":"action-bar",className:""+CI(x),justifyContent:"space-between",gridArea:!0===V?"1 / 1 / 2 / 2":void 0,direction:g.forceMobile?"column":"row",children:[p.jsx(uf,{flexGrow:1,paddingLeft:!0===V?"0.5rem":void 0,"data-component":"action-bar-filters",children:O&&p.jsx(rC,{})}),!W&&p.jsxs(yf,{gap:"0.25rem",width:g.forceMobile?"100%":140,paddingTop:4,"data-component":"action-bar-tools",alignItems:"flex-start",justifyContent:g.forceMobile?"flex-start":"flex-end",children:[g.showSavingIndicator&&p.jsx(Aj,{saving:m}),R&&p.jsx(pj,{onChange:function(){return u({type:"setGeneratingPDF",payload:!0})},disabled:!0===h,showLabel:"read"===x&&(!1===O||0===s.globalFilters.length)}),p.jsx(bI,{}),"read_write"===x&&p.jsx(ZC,{onChange:function(){return a(!0)}})]})]}),E&&p.jsxs(p.Fragment,{children:[p.jsx(Kk,{display:s.display,id:s.id,dashboardGridSettings:Y,generatingPDF:null!=(e=null==w?void 0:w.generatingPDF)?e:!0===h,hideAddCellColumn:V,gridColumns:H,pdfPageBreaks:G}),s.display.length<s.theme.rowLimit&&!B&&p.jsx(yf,{alignItems:"stretch",gridRow:3,gridColumn:V?1:2,paddingRight:28,paddingLeft:V?"0.5rem":void 0,"data-component":"add-row",height:72,children:p.jsx(dC,{label:y("add_row","Add Row"),onChange:function(){var e;e=s.display.length,f("manageDisplay.newRow"),u({type:"insertRow",rowIndex:e}),KC(350)},className:If("add-row")})})]})]})]})})})]}),h&&p.jsx(Sj,{pdfSettings:w})]},JSON.stringify(j))},wI=function(e,t){var n=[];return t&&n.push("minmax(28px, 1fr)"),n.push("auto"),e&&n.push("72px"),n},CI=function(e){return Fl("read"===e?{"@media (min-width: 767px)":{paddingRight:24,gridColumn:1},"@media (max-width: 768px)":{paddingRight:28,gridColumn:"span 2/span 2"}}:{paddingRight:29,gridColumn:2})},jI=n.createContext(null),FI=function(e){return p.jsx(jI.Provider,{value:{globalLibraries:e.globalLibraries},children:e.children})},SI=function(e){var i,r,o=n.useState(0),a=o[0],l=o[1],s=function(){var t=me(Ce().mark((function t(){var n;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.onReset();case 2:if(!(n=t.sent)){t.next=6;break}return l(a+1),t.abrupt("return",n);case 6:return t.abrupt("return",null);case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return p.jsx(Ru,{isProgrammaticParent:e.dashboardBehaviour.isProgrammaticParent,mode:e.dashboardBehaviour.mode,scheduledReports:e.dashboardBehaviour.scheduledReports,onScheduledReportChange:e.dashboardBehaviour.onScheduledReportChange,includeComponentTypes:e.includeComponents,excludeComponentTypes:e.excludeComponents,dashboardBehaviour:e.dashboardBehaviour,onError:e.onError,onViewClick:e.onViewClick,renderTableCell:e.renderTableCell,onReset:s,disableToolbar:e.dashboardBehaviour.disableToolbar,cascadeFilterSelection:e.dashboardBehaviour.cascadeFilterSelection,textOverride:e.dashboardBehaviour.textOverride,labelFormat:null!=(i=e.dashboardBehaviour.labelFormat)?i:function(){},filterLibrary:null==e?void 0:e.dashboardBehaviour.filterLibrary,pdfSettings:e.dashboardBehaviour.pdfSettings,id:e.dashboardBehaviour.id,valueAlias:e.dashboardBehaviour.valueAlias,nullValueAlias:e.dashboardBehaviour.nullValueAlias,componentOverrides:null!=(r=e.dashboardBehaviour.componentOverrides)?r:{},variables:e.dashboardBehaviour.variables,children:p.jsx(Vm,{theme:e.theme,trackEvent:e.trackEvent,dashboard:e.dashboard,componentEditor:e.componentEditor,onDashboardUpdate:e.onDashboardUpdate,saving:e.saving,runQueriesCallback:function(t,n){var i;return e.runQueriesCallback(t,ge({},n,{dataAccessToken:null==(i=e.identityConfig.dataAccess)?void 0:i.signature}))},children:p.jsx(mA,ge({},e.ai,{children:p.jsx("div",{"data-vizzly-summary":!0,"data-vizzly-dashboard-id":e.dashboard.id,"data-vizzly-user-reference":e.identityConfig.dashboardAccess.userReference,"data-vizzly-project-id":e.identityConfig.dashboardAccess.projectId,"data-vizzly-parent-dashboard-id":e.dashboard.parentDashboardId,className:"vizzly_dashboard_provider",children:p.jsxs(_g,{children:[e.editor&&p.jsx(FI,ge({},e.editor,{children:e.children})),!e.editor&&p.jsx(t.Fragment,{children:e.children})]})},"_vizzly_dashboard_"+e.dashboard.id+"_"+a)}))})})};function kI(e,t){var n;return(null==(n=e.find((function(e){return"read_write"===e.scope&&t[0].id===e.globalLibraryId})))?void 0:n.token)||""}function AI(e,t,n){var i=_I(e);if(!i)throw new Error("No matching library found.");return i.library.views&&i.library.customFields||II(i),function(e,t){if(!e)throw new Error("View array needs initialised");var n=e.findIndex((function(e){return e.attributes.viewId===(null==t?void 0:t.attributes.viewId)}));-1!==n?e[n]=t:e.push(t)}(i.library.views,t),function(e,t){if(!e)throw new Error("View object needs initialised");for(var n in e){var i;e.hasOwnProperty(n)&&null!=(i=t.library.customFields)&&i.hasOwnProperty(n)&&(t.library.customFields[n]=e[n])}}(n,i),i}var TI=function(e,t){var n=_I(e);if(!n)throw new Error("No matching library found.");return n.library.views=n.library.views?n.library.views.filter((function(e){return e.attributes.viewId!==t.attributes.viewId})):[],n};function _I(e){var t=e.find((function(t){return e.some((function(e){return e.id===t.parentGlobalLibraryId}))}))||e.find((function(e){return null===e.parentGlobalLibraryId}));if(!t)throw new Error("No matching library found.");return t}var II=function(e){e.library.views=[],e.library.customFields={}},DI=function(e){return[].concat(e).filter((function(e){return null!==e.parentGlobalLibraryId}))};function OI(e){return EI.apply(this,arguments)}function EI(){return(EI=me(Ce().mark((function e(t){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===t||"function"==typeof t){e.next=2;break}throw new Error("The view prop must be a function returning a Promise<Component | null>.");case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var LI=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadIdentity",n}return be(t,e),t}(Fe(Error)),NI=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="InvalidIdentityReturn",n}return be(t,e),t}(Fe(Error)),MI=function(e){return ge({},(i=null==(t=e.split("."))?void 0:t[1],JSON.parse((n=i,"object"==typeof window&&window&&window.atob?window.atob(n):Buffer.from(n,"base64").toString()).toString())),{signature:e});var t,n,i},RI=function(e,t,n,i){var r=MI(e);"scope"in r||(r.scope="read_write");var o={dashboardAccess:r,dataAccess:t?MI(t):void 0,queryEngineAccessConfig:n?MI(n):void 0,dashboardAdminOverride:i?MI(i):void 0};return PI(o),o},PI=function(e){var t=new Date,n=new Date(e.dashboardAccess.expires),i=!!e.dataAccess&&new Date(e.dataAccess.expires);!1!==i&&i<t&&console.warn("Vizzly data access token expired at;",i),n<t&&console.warn("Vizzly dashboard access token expired at;",n)},zI=function(e){if(!e)throw new NI("Failed to load identity.");var t=s.object({dashboardAccessToken:s.string().required(),dataAccessToken:s.string(),queryEngineAccessToken:s.string(),projectAccessToken:s.string().optional()}).validate(e).error;if(t)throw new NI(t.message);return e},VI=function(){var e=me(Ce().mark((function e(t){var n,i,r;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:if(n=zI(n=e.sent)){e.next=6;break}throw new LI("Failed to fetch identity config.");case 6:return i=qI()&&((o=window.location.href).split("#vizzly_")[1]||new URLSearchParams(new URL(o).search).get("_vizzlyDashboardAdmin"))||null,r=RI(n.dashboardAccessToken,n.dataAccessToken,n.queryEngineAccessToken,i),e.abrupt("return",{identityConfig:r,tokens:n});case 9:case"end":return e.stop()}var o}),e)})));return function(t){return e.apply(this,arguments)}}(),qI=function(){return"undefined"!=typeof window},BI=[{namespace:"config.supported_operator",constants:Ae},{namespace:"config.supported_aggregate",constants:Me},{namespace:"config.supported_time",constants:ft}],WI=function(e,t,n){var i={};return Object.entries(e).forEach((function(e){var r=e[0],o=e[1];i[r]=ge({},o,{publicName:t(n+"."+r,o.publicName)})})),i},HI=function(e){function t(){var t;return(t=e.call(this,"Identity prop type is invalid.")||this).name="InvalidIdentityPropType",t}return be(t,e),t}(Fe(Error)),YI=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToResolveDataSets",n}return be(t,e),t}(Fe(Error)),GI=function(e){function t(){var t;return(t=e.call(this,"dataSets property is not valid")||this).name="InvalidDataSetsPropType",t}return be(t,e),t}(Fe(Error)),UI=function(){var e=me(Ce().mark((function e(t,n,i){var r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=CC(t),e.next=3,r({method:"post",body:{dynamicConfig:"object"==typeof t?t.dynamicConfig:void 0,integritySignature:n},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:i});case 3:if(200!=(o=e.sent).status){e.next=6;break}return e.abrupt("return",o.body.dataSets);case 6:throw new YI("Failed to resolve data sets from "+JSON.stringify(t)+". Received status "+o.status);case 7:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),KI=function(e,t){if(e)return e;if("function"==typeof t){if(!e)throw"dataSets function is required when loading a custom query engine config.";return e}if(t)return n=t,function(){var e=me(Ce().mark((function e(t){var i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,UI(n,null==(i=t.dataAccess)?void 0:i.signature);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var n;throw new GI},XI=function(e,t){return function(){var n=me(Ce().mark((function n(i,r){var o,a;return Ce().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,"function"==typeof(o=KI(e,t))){n.next=4;break}throw new GI;case 4:return n.next=6,o(i,r);case 6:if(a=n.sent){n.next=9;break}throw new YI("Failed to fetch data sets from the query engine endpoint");case 9:return n.abrupt("return",a.map((function(e){return ea(e,r)})));case 12:if(n.prev=12,n.t0=n.catch(0),Je(n.t0),!(n.t0 instanceof GI)){n.next=17;break}throw n.t0;case 17:if(!(n.t0 instanceof de.Errors.FailedToResolveDataSets)){n.next=19;break}throw new YI(n.t0.message);case 19:throw new YI("Failed to fetch data sets.");case 20:case"end":return n.stop()}}),n,null,[[0,12]])})));return function(e,t){return n.apply(this,arguments)}}()},QI={apiHost:"https://api.vizzly.co"},ZI=function(){function e(e,t,n,i){void 0===i&&(i=QI),this.queryEngineConfig=void 0,this.dataSets=void 0,this.queryEngine=void 0,this.loadAccessTokens=void 0,this.loadDataSetsCallback=void 0,this.options=void 0,this.queryEngine=e||"in-browser",this.loadAccessTokens=t,this.loadDataSetsCallback=n,this.options=ge({},QI,i)}var t=e.prototype;return t.getQueryEngineConfig=function(){var e=me(Ce().mark((function e(){var t=this;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.queryEngineConfig){e.next=2;break}return e.abrupt("return",this.queryEngineConfig);case 2:return e.next=4,SC(this.queryEngine,this.loadDataSetsCallback);case 4:return this.queryEngineConfig=e.sent,this.queryEngineConfig=(n=function(e,n,i){return Vo(e,n,i,t.options.textOverrides,t.options.developerMode)},i=void 0,(i=ge({},this.queryEngineConfig)).supportedAggregates&&(i.supportedAggregates=WI(i.supportedAggregates,n,BI[1].namespace)),i.supportedTimeTruncFunctions&&(i.supportedTimeTruncFunctions=WI(i.supportedTimeTruncFunctions,n,BI[2].namespace)),i.supportedOperators&&(i.supportedOperators=WI(i.supportedOperators,n,BI[0].namespace)),i),e.abrupt("return",this.queryEngineConfig);case 8:case"end":return e.stop()}var n,i}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.getIdentity=function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"==typeof this.loadAccessTokens){e.next=2;break}throw new HI;case 2:return e.next=4,VI(this.loadAccessTokens);case 4:return e.abrupt("return",{accessTokens:(t=e.sent).tokens,identityConfig:t.identityConfig});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.getDataSets=function(){var e=me(Ce().mark((function e(){var t,n,i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getIdentity();case 2:return t=e.sent.identityConfig,e.next=6,this.getQueryEngineConfig();case 6:return n=e.sent,i=XI(this.loadDataSetsCallback,this.queryEngine),e.next=10,i(t,n);case 10:return this.dataSets=e.sent,e.abrupt("return",this.dataSets);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.load=function(){var e=me(Ce().mark((function e(){var t,n,i,r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getIdentity(),this.getQueryEngineConfig(),this.getDataSets()]);case 2:return n=(t=e.sent)[0].identityConfig,r=t[2],o=this.getDashboardStorageStrategy(i=t[1]),e.abrupt("return",{queryEngineConfig:i,dataSets:r,identityConfig:n,dashboardStorageStrategy:o});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.getDashboardStorageStrategy=function(e){return"function"==typeof this.queryEngine?{strategy:"vizzlyApi"}:e.supportedFeatures.includes("encryptedDashboards")&&"in-browser"!==this.queryEngine?{strategy:"queryEngine",endpoint:this.queryEngine}:{strategy:"vizzlyApi"}},e}();function JI(e,t){if(!t)throw new Error("Query engine config is required to validate filters");return iC(e,t)}var $I=function(e){function t(){return e.apply(this,arguments)||this}return be(t,e),t}(Fe(Error)),eD=function(e){function t(t,n){var i;return(i=e.call(this,"'Issue with Services in "+n+": '"+t+"'")||this).name="ServicesValidation",i}return be(t,e),t}(Ut),tD=function(){function e(e){if(this.component=void 0,this.colSpan=void 0,this.localFilters=void 0,this.isEmpty=void 0,null!=e&&e.component){var t;this.component=null==e?void 0:e.component,this.colSpan=null!=(t=null==e?void 0:e.colSpan)?t:12}else{var n,i=su(null!=(n=null==e?void 0:e.colSpan)?n:12);this.colSpan=i.colSpan,this.isEmpty=i.isEmpty}null!=e&&e.localFilters&&(this.localFilters=JI(e.localFilters,jO.use().getViewConfiguration().queryEngineConfig))}var t=e.prototype;return t.set=function(e){var t;this.component=e.component,this.colSpan=null!=(t=e.colSpan)?t:12,this.isEmpty=!e.component||void 0,null!=e&&e.localFilters&&(this.localFilters=JI(e.localFilters,jO.use().getViewConfiguration().queryEngineConfig))},t.setColSpan=function(e){try{!function(e){var t=am.validate(e).error;if(t)throw new $I(t.message)}(e),this.colSpan=e}catch(e){throw new eD(e,"Cell.setColSpan")}},t.setComponent=function(e){this.component=e,this.isEmpty=void 0},t.emptyCell=function(e){var t=su(null!=e?e:12);this.colSpan=t.colSpan,this.isEmpty=t.isEmpty,this.component=void 0},e}(),nD=function(){function e(e,t){this.components=[],this.height=350,this.components=null!=e?e:[],this.height=null!=t?t:350,this.validateTotalColSpan()}var t=e.prototype;return t.addCell=function(e,t){void 0===t?this.components.push(e):this.components.splice(t,0,e),this.validateTotalColSpan()},t.setHeight=function(e){this.height=e},t.setRow=function(e){this.components=e,this.validateTotalColSpan()},t.set=function(e,t){this.components=e,this.height=null!=t?t:350,this.validateTotalColSpan()},t.validateTotalColSpan=function(){if(this.components.reduce((function(e,t){return e+t.colSpan}),0)>12)throw new Error("Total column span of cells exceeds the allowed limit of 12.")},e}(),iD=function(){function e(e){this.component=void 0;var t=ou("New Header");e&&(t=ge({},t,{displayTitle:e}));var n=cu([t],52);this.component=[n]}return e.prototype.setTitle=function(e){if(!this.component)throw new Error("Header is undefined");au(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)},e}(),rD=function(){function e(e,t){this.dashboard=void 0;var n={id:e};null!=t&&t.display&&(n=ge({},n,{display:oD(null==t?void 0:t.display)})),null!=t&&t.customFields&&(n=ge({},n,{customFields:t.customFields})),null!=t&&t.library&&(n=ge({},n,{componentLibrary:aD(null==t?void 0:t.library)})),this.dashboard=bm(n)}var t=e.prototype;return t.setDisplay=function(e){var t=oD(e);if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.display=t},t.setCustomFields=function(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.customFields=e},t.setLibrary=function(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.componentLibrary=aD(e)},t.build=function(){var e,t;if(!this.dashboard)throw new Error("Dashboard is undefined");return ge({},this.dashboard,{display:null==(e=this.dashboard)?void 0:e.display,componentLibrary:null==(t=this.dashboard)?void 0:t.componentLibrary})},e}();function oD(e){var t=[];return e.forEach((function(e){if(e instanceof nD){var n,i=null==e?void 0:e.components.map((function(e){var t;return e.component&&!e.isEmpty?{attributes:e.component.attributes,localFilters:null!=(t=e.localFilters)?t:[],results:[],colSpan:e.colSpan,reports:[]}:{colSpan:e.colSpan,isEmpty:!0}}));t.push({height:null!=(n=e.height)?n:350,components:i})}var r;e instanceof iD&&(null==(r=e.component)||r.forEach((function(e){t.push({height:e.height,components:e.components})})))})),t}var aD=function(e){var t,n=[],i=new Set;return null==e||null==(t=e.library)||t.forEach((function(e){if(e.component&&e.component.attributes){var t,r=e.component.attributes.viewId;if(i.has(null!=r?r:""))throw new Error("Duplicate viewId found: "+r);i.add(null!=r?r:""),n.push({attributes:e.component.attributes,localFilters:null!=(t=e.localFilters)?t:[],results:[],colSpan:1,reports:[]})}})),n};function lD(e){var t=s.object({component:s.object().required(),uniqueViewId:s.string().min(1).required().messages({"string.base":"\"uniqueViewId\" should be a type of 'text'","string.empty":'"uniqueViewId" cannot be an empty field',"string.min":'"uniqueViewId" should have a minimum length of {#limit}',"any.required":'"uniqueViewId" maybe undefined or null'})}).validate(e).error;if(t)throw new $I(t.message)}var sD=function(){function e(e){this.library=void 0,this.library=[],null!=e&&e.components&&this.addComponents(null==e?void 0:e.components)}var t=e.prototype;return t.addComponent=function(e,t,n){try{lD({component:e,uniqueViewId:t});var i,r,o=new tD({component:uD(e,t),colSpan:1,localFilters:null==n?void 0:n.localFilters});void 0===(null==n?void 0:n.position)?null==(i=this.library)||i.push(o):null==(r=this.library)||r.splice(n.position,0,o)}catch(e){throw new eD(e,"Library.addComponent")}},t.addComponents=function(e){var t=this;try{if(void 0===e)throw new eD("Components are undefined","Library.addComponents");e.forEach((function(e){var n;lD(e);var i=new tD({component:uD(e.component,e.uniqueViewId),colSpan:1});null==(n=t.library)||n.push(i)}))}catch(e){throw new eD(e,"Library.addComponents")}},e}(),uD=function(e,t){return ge({},e,{attributes:ge({},e.attributes,{viewId:t})})},dD=function(){function e(e){this.editor=void 0,null!=e&&e.component&&(this.editor=e.component)}var t=e.prototype;return t.setComponent=function(e){if(!this.editor)throw new Error("Editor is undefined");this.editor=e},t.build=function(){if(!this.editor)throw new Error("Editor is undefined");return yu({attributes:this.editor.attributes})},e}(),cD=function(){function e(e){this.attributes=void 0,this.vizzly=void 0,this.vizzly=jO.use();var t=Go(e.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig});this.attributes=(0,t.init)(null==e?void 0:e.dataSetId,e)}return e.prototype.updateAttributes=function(e){var t=Go(this.attributes.type,{queryEngineConfig:this.vizzly.getViewConfiguration().queryEngineConfig}).setAttributes;if(!this.attributes)throw new Error("Attributes have not been initialized yet");this.attributes=t(this.attributes,e)},e}(),pD=function(e){function t(t){return e.call(this,ge({},t,{type:"areaChart"}))||this}return be(t,e),t.type=function(){return"areaChart"},t}(cD),fD=function(e){function t(t){return e.call(this,ge({},t,{type:"lineChart"}))||this}return be(t,e),t.type=function(){return"lineChart"},t}(cD),mD=function(e){function t(t){return e.call(this,ge({},t,{type:"barChart"}))||this}return be(t,e),t.type=function(){return"barChart"},t}(cD),hD=function(e){function t(t){return e.call(this,ge({},t,{type:"pieChart"}))||this}return be(t,e),t.type=function(){return"pieChart"},t}(cD),vD=function(e){function t(t){return e.call(this,ge({},t,{type:"scatterChart"}))||this}return be(t,e),t.type=function(){return"scatterChart"},t}(cD),gD=function(e){function t(t){return e.call(this,ge({},t,{type:"comboChart"}))||this}return be(t,e),t.type=function(){return"comboChart"},t}(cD),xD=function(e){function t(t){return e.call(this,ge({},t,{type:"dataTable"}))||this}return be(t,e),t.type=function(){return"dataTable"},t}(cD),bD=function(e){function t(t){return e.call(this,ge({},t,{type:"basicTable"}))||this}return be(t,e),t.type=function(){return"basicTable"},t}(cD),yD=function(e){function t(t){return e.call(this,ge({},t,{type:"horizontalBarChart"}))||this}return be(t,e),t.type=function(){return"horizontalBarChart"},t}(cD),wD=function(e){function t(t){return e.call(this,ge({},t,{type:"mercatorMap"}))||this}return be(t,e),t.type=function(){return"mercatorMap"},t}(cD),CD=function(e){function t(t){return e.call(this,ge({},t,{type:"singleStat"}))||this}return be(t,e),t.type=function(){return"singleStat"},t}(cD),jD=function(e){function t(t){return e.call(this,ge({},t,{type:"progress"}))||this}return be(t,e),t.type=function(){return"progress"},t}(cD),FD=function(e){function t(t){var n;return(n=e.call(this,"Vizzly has not yet been loaded. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto handle this error and retry once Vizzly has finished loading.\n\nInstance Id; "+t)||this).name="VizzlyInstanceNotLoaded",n}return be(t,e),t}(Fe(Error)),SD=function(e){function t(t,n){var i;return(i=e.call(this,"Timeout waiting for Vizzly to load. Please see the instantiation docs;\nhttps://docs.vizzly.co/services/initializing\n\nThis might be expected behavior if you have set it up correctly. If so, you will need\nto bump the timeout which was set to "+n+"ms.\n\nInstance Id; "+t)||this).name="TimeoutWaitingForVizzlyInstance",i}return be(t,e),t}(Fe(Error)),kD={convert:!1,stripUnknown:!1,allowUnknown:!0},AD=function(e,t){var n=s.array().items(_D(t)).validate(e,kD);if(n.error)throw new $I(n.error.message)},TD=function(e){var t;return s.array().items(s.alternatives().try(s.object({field:s.string().required().description("The ID of the field from the data set to reference."),op:(t=s.string()).valid.apply(t,Object.keys(e.supportedOperators)).required(),value:s.any().required()}).description("A filter object to apply to the data set."),s.array()))},_D=function(e){return s.object(ge({},Rn(e,{}),{filter:TD(e),timeDimension:s.alternatives(In(e.supportedTimeTruncFunctions),s.valid(null))}))},ID={convert:!1,stripUnknown:!1,allowUnknown:!0},DD=function(e,t){var n=s.object({definition:t?um(t):s.object().required(),parentDashboardId:s.string().required(),metadata:s.object()}).validate(e,ID);if(n.error)throw new $I(n.error.message)},OD=function(e,t){var n=s.object({dashboardId:s.string().required(),definition:t?um(t):s.object().required(),metadata:s.object().optional(),deleted:s.boolean().optional()}).validate(e,ID);if(n.error)throw new $I(n.error.message)},ED=function(e){return e.SAVING="saving",e.SAVED="saved",e.DELETED="deleted",e}({}),LD=function(e,t,n){var i,r;return t&&"none"!==t?e.supportedAggregates[t]?"number":null!=(i=e.supportedTimeTruncFunctions[t])&&i.dataTypeOutput?null==(r=e.supportedTimeTruncFunctions[t])?void 0:r.dataTypeOutput:n.dataType:n.dataType},ND=function(e,t){return e.map((function(e){return e.map((function(e){var n=e.field,i=e.functionId;return{id:Ti({field:n.id,function:i}),fieldId:n.id,function:i,publicName:n.publicName,dataType:n.dataType,outputDataType:LD(t,i,n)}}))}))},MD=function(e,t,n,i){var r=t.map((function(t){var r=Ko(e,t.dataSetId);if(!r)throw"Data set not found for query attributes query";return gi(r,t.measure,t.order,t.dimension,t.timeDimension,t.limit,t.offset,n,i,t.filter)}));return{queries:r.map((function(e){return e.query})),resultFields:ND([].concat(r).map((function(e){return e.measureDescription})),n)}};function RD(e,t){var n=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==n?void 0:n.filter((function(e){return e.field!==t.fieldId}))}var PD=function(e,t,n,i){var r=bi(t,e.measure,e.order,e.dimension,e.timeDimension||null,e.limit,e.offset,n,i);return{queries:[r.query],resultFields:ND([r.measureDescription],n)}},zD=PD,VD=PD,qD=PD,BD=PD,WD=PD,HD=PD,YD=PD,GD=PD,UD=PD,KD=PD,XD=function(e,t,n){var i=[],r=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"preAggregated"==e[0].preparedQueryType){var o,a=Ko(n.dataSets,e[0].dataSetId);if(!a)throw"Data set not found for pre aggregated query";var l=a.preAggregated[0],s=function(e,t){return{query:e,resultFields:t.fields.map((function(e){return{id:e.id,publicName:e.publicName,dataType:e.dataType,fieldId:e.id,function:"none",outputDataType:e.dataType}}))}}(e[0],a),u=s.query,d=s.resultFields,c=Ko(n.dataSets,l),p=Yt(n.filterConfig,c,n.timeRangeOptions),f=Fn([p],t,c,n);i=[ge({},u,{filter:(o={},o[c.id]=f,o)})],r=[d]}else if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type&&"uniqueArrayValues"==e[0].preparedQueryType){i=[e[0]];var m=Ko(n.dataSets,e[0].dataSetId);if(!m)throw"Data set not found for view attributes query";var h=Qo(m,e[0].fieldId),v=wi(e[0].dataSetId,h);i=[v.query],r=[v.resultFields]}else if(Array.isArray(e)){var g=[].concat(e).map((function(e){var i=Ko(n.dataSets,e.dataSetId);if(!i)throw"Data set not found for query-attributes query";return ge({},e,{filter:[],whereClause:di(i,t,ge({},n,{filterConfig:ge({},n.filterConfig,{advancedFilter:e.filter})}))})})),x=MD(n.dataSets,g,t,n);i=x.queries,r=x.resultFields}else if("type"in e&&("order"in e||"measure"in e)){var b=Ko(n.dataSets,e.dataSetId);if(!b)throw"Data set not found for view attributes query";var y=function(e,t,n,i){switch(e.type){case"areaChart":return zD(e,t,n,i);case"barChart":return VD(e,t,n,i);case"horizontalBarChart":return qD(e,t,n,i);case"lineChart":return BD(e,t,n,i);case"lineChartV2":return WD(e,t,n,i);case"pieChart":return HD(e,t,n,i);case"dataTable":return YD(e,t,n,i);case"basicTable":return GD(e,t,n,i);case"comboChart":return function(e,t,n,i){var r=function(e,t,n,i){var r=bi(t,e.lineMeasure,e.order,e.lineDimension,e.timeDimension,e.limit,e.offset,n,i);return{bar:bi(t,e.barMeasure,e.order,e.barDimension,e.timeDimension,e.limit,e.offset,n,i),line:r}}(e,t,n,i),o=r.line,a=r.bar;return{queries:[o.query,a.query],resultFields:ND([o.measureDescription,a.measureDescription],n)}}(e,t,n,i);case"singleStat":case"progress":return function(e,t,n,i){var r=function(e,t,n,i){var r=function(e,t,n,i){var r=bi(t,e.measure,[],[],null,1,e.offset,n,i),o=r.query,a=r.measureDescription;return o.measure=[{type:"number",value:0}].concat(o.measure),{query:o,measureDescription:a=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"}].concat(a)}}(e,t,n,i),o=null;return"deltaTimeDimension"in e&&(o=function(e,t,n,i){return t.deltaTimeDimension?bi(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],[],t.deltaTimeDimension,t.limit,t.offset,n,i):null}(t,e,n,i)),{queries:o?[r.query,o.query]:[r.query],measureDescription:o?[r.measureDescription,o.measureDescription]:[r.measureDescription]}}(e,t,n,i);return{queries:r.queries,resultFields:ND(r.measureDescription,n)}}(e,t,n,i);case"scatterChart":return function(e,t,n,i){var r=[];e.xMeasure&&r.push(e.xMeasure),e.yMeasure&&r.push(e.yMeasure);var o=bi(t,r,e.order,e.dimension,e.timeDimension,e.limit,e.offset,n,i);return{queries:[o.query],resultFields:ND([o.measureDescription],n)}}(e,t,n,i);case"mercatorMap":return function(e,t,n,i){return MD([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:[],order:[],timeDimension:null}],n,i)}(e,t,n,i);case"funnelChart":return UD(e,t,n,i);case"richText":return KD(e,t,n,i);default:throw"Unsupported."}}(e,b,t,ge({},n,{filterConfig:ge({},n.filterConfig,{advancedFilter:e.filter})}));i=y.queries,r=y.resultFields}else if("custom"!=e.type){var w=function(e,t,n,i){var r=[].concat(e.appliesToFields).map((function(r){var o=Ko(t,r.dataSetId);if(!o)throw"Data set not found for additional filter query";var a=Qo(o,r.fieldId);if("string[]"==a.dataType){var l=Fn([RD(e,r)],n,o,i),s=wi(r.dataSetId,a,l);return{queries:[s.query],resultFields:[s.resultFields]}}var u=Ci(o,r.fieldId,RD(e,r),function(e){return"string"===(null==e?void 0:e.dataType)||"number"===(null==e?void 0:e.dataType)?[{field:e.id,direction:"asc",function:"none"}]:[]}(a));return MD(t,[u],n,i)}));return{queries:r.flatMap((function(e){return e.queries})),resultFields:r.flatMap((function(e){return e.resultFields}))}}(e,n.dataSets,t,n);i=w.queries,r=w.resultFields}return n.timeZone&&(i=i.map((function(e){return ge({},e,{timeZone:n.timeZone})}))),{queries:i,resultFields:r}},QD={},ZD=function(e,t,n){var i=JSON.stringify(e),r=new Date;r.setSeconds(r.getSeconds()+n),Ke("Browser cache new object set.",i),QD[i]={item:t,expires:r}},JD=function(e){var t=JSON.stringify(e),n=QD[t];if(!n)return Ke("Browser cache miss.",e),null;Ke("Browser cache hit.",e);var i=n.item,r=n.expires;return new Date<r?i:(delete QD[t],null)},$D=function(e){return Array.isArray(e)?0==e.length:"object"==typeof e&&$D(Object.keys(e))},eO=function(){var e=me(Ce().mark((function e(t,n,i,r){var o,a,l,s,u;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},t.forEach((function(e,t){var n=JD(r(e));n&&(Ke("Query result received from the cache."),o[t]=n)})),t.forEach((function(e,t){n(e)||(Ke("Query is not runnable."),o[t]=null)})),a=t.filter((function(e,t){return n(e)&&void 0===o[t]})),l=[],$D(a)){e.next=10;break}return e.next=8,i(a);case 8:l=null===(s=e.sent)?null:s.results?s.results:s;case 10:if(null!==l){e.next=12;break}return e.abrupt("return",null);case 12:if(!$D(l)||!$D(o)){e.next=14;break}return e.abrupt("return",null);case 14:return u=[].concat(t).map((function(e,t){var i,a=o[t];if(n(e)&&null==a&&(a=(null==(i=l)?void 0:i.shift())||null,ZD(r(e),a,20)),void 0===a)throw"A result went missing...";return a})),e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t,n,i,r){return e.apply(this,arguments)}}(),tO=function(){var e=me(Ce().mark((function e(t,n,i,r){var o,a,l;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=CC(n),e.next=3,o({path:"/api/v2/create-results",method:"post",mode:"cors",body:{queries:t,virtualFields:{},dynamicConfig:"object"==typeof n?n.dynamicConfig:void 0,identityConfigIntegritySignature:i},abortSignal:r});case 3:return l=(a=e.sent).body,e.abrupt("return",200==a.status?l:null);case 8:case"end":return e.stop()}}),e)})));return function(t,n,i,r){return e.apply(this,arguments)}}(),nO=function(){var e=me(Ce().mark((function e(t,n,i){var r,o,a,l,s;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=XD(n,t.queryEngineConfig,i),o=r.queries,a=r.resultFields,e.next=3,eO(o,(function(e){return!0}),function(){var e=me(Ce().mark((function e(n){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tO(n,t.queryEngineEndpoint,t.dataAccessToken,i.abortSignal);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return l=e.sent,s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return null==n?null:{content:n.content,fields:a[t],hasMoreResults:n.hasMoreResults}})),e.abrupt("return",s);case 6:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),iO={},rO=[],oO={},aO=function(){var e=me(Ce().mark((function e(t,n,i){var r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(oO[t.id]||(oO[t.id]=ce(n,5e3,{leading:!0})),r=oO[t.id],Ke("Fetching data for in-browser query engine. DataSet;",t.id,"CacheKey;",i),!iO[i]){e.next=8;break}return Ke("Returning data for in-browser query engine from the cache."),e.abrupt("return",iO[i]);case 8:return e.next=10,r(t);case 10:return(o=e.sent)||rO.includes(t.id)||(rO.push(t.id),console.error("Failed to download data for data set "+t.id)),o&&r.cancel(),Ke("Fetching data from cacheKey: "+i),iO[i]=o,e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),lO=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingVizzlyInMemoryDb",n}return be(t,e),t}(Fe(Error)),sO=function(){var e=window.VizzlyInMemoryDb;if(!e)throw new lO("VizzlyInMemoryDb missing! This means that 'window.VizzlyInMemoryDb' was not set. This is required for the in-browser vizzly setup.\n\nPlease ensure you have added the script tag to load the in-browser query engine.\n\nFor example, this should be added within the <head> tag;\n<script src=\"https://static.app.vizzly.co/query-engine/0.8.29/vizzly-in-memory-db.umd.js\"><\/script>\n\nNote, you can change the version of the in-memory database by changing '0.8.3' to the version you require.\n");return e},uO=function(){var e=me(Ce().mark((function e(t,n){var i,r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("measure"in t)||0!==t.measure.length){e.next=2;break}return e.abrupt("return",[[]]);case 2:return r={id:n.id,fields:n.fields.map((function(e){return{id:e.id,address:["_",n.id,e.id],dataType:e.dataType}})),joins:[]},e.next=5,sO().queryV2(t,r);case 5:return e.abrupt("return",(null==(o=e.sent)||null==(i=o[0])?void 0:i.values)||[]);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),dO=function(e,t){return e+"::"+t},cO=function(){var e=me(Ce().mark((function e(t,n,i){var r;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[].concat(t).map(function(){var e=me(Ce().mark((function e(t){var r,o,a;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=$o(n,t.dataSetId),o=r[0],a=dO(i,t.dataSetId),!iO[a]||!o){e.next=10;break}return e.next=6,uO(t,o);case 6:return e.abrupt("return",{content:e.sent,hasMoreResults:!1});case 10:return console.warn("Returning an empty result."),e.abrupt("return",{content:[],hasMoreResults:null});case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=3,Promise.all(r);case 3:return e.abrupt("return",{results:e.sent});case 5:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),pO=function(){var e=me(Ce().mark((function e(t,n,i,r){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sO().init(n.map((function(e){return{id:null==e?void 0:e.id,fields:null==e?void 0:e.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))}})));case 2:return e.next=4,Promise.all([].concat(t).flatMap(function(){var e=me(Ce().mark((function e(t){var o,a,l,s;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=$o(n,t.dataSetId),!(a=o[0])){e.next=8;break}return e.next=4,aO(a,i,dO(r,t.dataSetId));case 4:return l=e.sent,s={id:null==a?void 0:a.id,fields:null==a?void 0:a.fields.map((function(e){return{id:e.id,dataType:e.dataType}}))},e.next=8,sO().ingest(s,l||[]);case 8:return e.abrupt("return",[]);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:return e.next=6,cO(t,n,r);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t,n,i,r){return e.apply(this,arguments)}}(),fO=function(){var e=me(Ce().mark((function e(t,n,i){var r,o,a,l,s;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=XD(n,Cu,i),o=r.queries,a=r.resultFields,e.next=3,eO(o,(function(e){return!0}),function(){var e=me(Ce().mark((function e(n){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pO(n,i.dataSets,t.loadData,t.cacheKeyNamespace);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return null===(l=e.sent)&&(l=o.map((function(){return null}))),s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return null==n?null:{content:n.content,fields:a[t],hasMoreResults:n.hasMoreResults}})),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),mO=function(){var e=me(Ce().mark((function e(t,n,i){var r,o,a,l;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=XD(n,t.queryEngineConfig,i),o=r.queries,a=r.resultFields,e.next=3,eO(o,(function(e){return"preparedQuery"==e.type&&Ze("Custom query engine does not support prepared queries."),"query"==e.type}),function(){var e=me(Ce().mark((function e(n){var r;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.runQueries(n,ge({},i,{dataAccessToken:t.dataAccessToken}));case 2:if(null!=(r=e.sent)){e.next=5;break}return e.abrupt("return",{results:n.map((function(){return null}))});case 5:return e.abrupt("return",{results:r.map((function(e,t){return Array.isArray(e)?{fields:a[t],content:e,hasMoreResults:null}:e}))});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:if(null!==(l=e.sent)){e.next=6;break}return e.abrupt("return",o.map((function(){return null})));case 6:return e.abrupt("return",l);case 7:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}();function hO(e,t,n){return vO.apply(this,arguments)}function vO(){return(vO=me(Ce().mark((function e(t,n,i){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyQueryEngine"!=t.type){e.next=4;break}return e.next=3,nO(t,n,i);case 3:return e.abrupt("return",e.sent);case 4:if("vizzlyJsQueryEngine"!=t.type){e.next=8;break}return e.next=7,fO(t,n,i);case 7:return e.abrupt("return",e.sent);case 8:if("custom"!=t.type){e.next=12;break}return e.next=11,mO(t,n,i);case 11:return e.abrupt("return",e.sent);case 12:return e.abrupt("return",[]);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var gO=function(e,t,n,i,r,o,a,l){var s,u,d=(u=e.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((function(e){return e+":"+u[e]})).join(":::"));if(r)return function(){var o=me(Ce().mark((function o(a,s){var u;return Ce().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,hO({type:"custom",queryEngineConfig:t,runQueries:r,dataAccessToken:null==(u=e.dataAccess)?void 0:u.signature,cacheKeyNamespace:d},a,{abortSignal:s.abortSignal,dataSets:s.dataSets,filterConfig:s.filterConfig||{},timeRangeOptions:n,timeZone:l,variables:i});case 2:return o.abrupt("return",o.sent);case 3:case"end":return o.stop()}}),o)})));return function(e,t){return o.apply(this,arguments)}}();if(o)return function(){var e=me(Ce().mark((function e(t,r){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,hO({type:"vizzlyJsQueryEngine",loadData:o,cacheKeyNamespace:d},t,{abortSignal:r.abortSignal,dataSets:r.dataSets,filterConfig:r.filterConfig||{},timeRangeOptions:n,timeZone:l,variables:i});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();if(a&&null!=(s=e.dataAccess)&&s.signature)return function(){var r=me(Ce().mark((function r(o,s){var u;return Ce().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,hO({type:"vizzlyQueryEngine",queryEngineConfig:t,dataAccessToken:null==(u=e.dataAccess)?void 0:u.signature,queryEngineEndpoint:a,cacheKeyNamespace:d},o,{abortSignal:s.abortSignal,dataSets:s.dataSets,filterConfig:s.filterConfig||{},timeRangeOptions:n,timeZone:l,variables:i});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();throw"Missing required props."},xO=function(e,t){var n=function(e){return[].concat(e).find((function(e){return null===e.parentGlobalLibraryId}))}(e);if(n&&"read"===t.dashboardAccess.scope)return{type:"exact",globalLibrary:n};if(n&&"read_write"===t.dashboardAccess.scope&&"admin"!==t.dashboardAccess.accessType)return{type:"exact",globalLibrary:DI(e)[0]};if(n&&"admin"===t.dashboardAccess.accessType)return{type:"exact",globalLibrary:n};throw"No strategy found."};de.VizzlyApiClientLogger.UserAgentProduct="Services";var bO=ge({},{apiHost:"https://api.vizzly.co"}),yO=function(){function e(e,t,n,i,r,o){this.queryEngineConfig=void 0,this.dataSets=void 0,this.identityConfig=void 0,this.vizzlyAPIClient=void 0,this.programmaticDashboard=void 0,this.globalLibraryPermissions=void 0,this.programmaticDashboard=r,this.dataSets=n,this.queryEngineConfig=t,this.identityConfig=e,this.vizzlyAPIClient=function(e,t,n){var i,r,o,a=new de.Authentication({dashboardAccessToken:null==e?void 0:e.dashboardAccess.signature,dataAccessToken:null==e||null==(i=e.dataAccess)?void 0:i.signature,projectAdminOverrideToken:null==e||null==(r=e.dashboardAdminOverride)?void 0:r.signature,queryEngineAccessToken:null==e||null==(o=e.queryEngineAccessConfig)?void 0:o.signature}),l=function(){return{}};"queryEngine"===t.strategy&&"string"!=typeof t.endpoint&&(l=t.endpoint.customHeaders||l);var s="queryEngine"===t.strategy?new de.VizzlyQueryEngineApi(a,"string"==typeof t.endpoint?t.endpoint:t.endpoint.endpoint,l):void 0,u=new de.VizzlyApi(a,n.host),d=new de.VizzlyAppApi(a,"https://app.vizzly.co");return new de.Vizzly({vizzlyApi:u,vizzlyAppApi:d,vizzlyQueryEngineApi:s},"queryEngine"===t.strategy?new de.PersistViaQueryEngine:new de.PersistDirectToVizzlyApi)}(e,i,o)}e.load=function(){var e=me(Ce().mark((function e(t,n){var i,r,o,a,l;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n=bO),Ke("Starting load process for the services package."),r=t.programmaticDashboard,o=new ZI(i=t.queryEngine,t.identity,t.dataSets,n),e.next=6,o.load();case 6:return l=new jO((a=e.sent).identityConfig,a.queryEngineConfig,a.dataSets,a.dashboardStorageStrategy,r,{host:n.apiHost}),jO._instanceStore.default=l,jO.queryEngine=i,Ke("Loaded services package and added it to the instance store."),e.abrupt("return",l);case 16:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),e.use=function(e){void 0===e&&(e="default");var t=jO._instanceStore[e];if(!t)throw new FD(e);return t},e.waitToUse=function(){var t=me(Ce().mark((function t(n,i){var r,o;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===n&&(n="default"),void 0===i&&(i=1e4),r=e._instanceStore,o=n,t.abrupt("return",new Promise((function(e,t){if(r.hasOwnProperty(o))e(r[o]);else var a=setTimeout((function(){clearTimeout(a),t(new SD(n,i))}),i),l=setInterval((function(){r.hasOwnProperty(o)&&(clearTimeout(a),clearInterval(l),e(r[o]))}),10)})));case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.clearInstances=function(){jO._instanceStore={}};var t=e.prototype;return t.createDashboard=function(){var e=me(Ce().mark((function e(t){var n,i,r,o,a;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DD(t,this.queryEngineConfig),i=this.vizzlyAPIClient.getDashboardManager(),e.next=5,i.create({metadata:t.metadata||t.meta,definition:t.definition,parentDashboardId:t.parentDashboardId,permissions:[{scope:"read_write"}]});case 5:return o=cm(r=e.sent.dashboard,this.queryEngineConfig),a=xm(o,this.dataSets,(null==(n=r.definition)?void 0:n.customFields)||{}),e.abrupt("return",a);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.updateDashboard=function(){var e=me(Ce().mark((function e(t){var n,i,r,o,a;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return OD(t,this.queryEngineConfig),i=this.vizzlyAPIClient.getDashboardManager(),e.next=5,i.update({dashboardId:t.dashboardId,metadata:t.metadata||t.meta,definition:t.definition,deleted:t.deleted,abortSignal:t.abortSignal});case 5:return o=cm(r=e.sent,this.queryEngineConfig),a=xm(o,this.dataSets,(null==(n=r.definition)?void 0:n.customFields)||{}),e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.updateScheduledReport=function(){var e=me(Ce().mark((function e(t,n,i){var r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.vizzlyAPIClient.getAPIs().vizzlyApi,e.next=3,r.saveScheduledReport({scheduledReportId:n,cronSchedule:i,dashboardAccessToken:t});case 3:if(200!==(o=e.sent).status){e.next=10;break}if(null!==i){e.next=9;break}return e.abrupt("return",!0);case 9:return e.abrupt("return",o.body);case 10:case"end":return e.stop()}}),e,this)})));return function(t,n,i){return e.apply(this,arguments)}}(),t.getScheduledReports=function(){var e=me(Ce().mark((function e(t){var n,i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.vizzlyAPIClient){e.next=7;break}return n=this.vizzlyAPIClient.getAPIs().vizzlyApi,e.next=4,n.getScheduledReports({dashboardAccessToken:t});case 4:if(200!==(i=e.sent).status){e.next=7;break}return e.abrupt("return",i.body);case 7:return e.abrupt("return",{reports:[]});case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getDashboards=function(){var t=me(Ce().mark((function t(n){var i,r,o=this;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this.vizzlyAPIClient.getDashboardManager(),t.next=4,i.getDashboards(null!=n&&n.abortController?{abortSignal:null==n?void 0:n.abortController.signal}:{});case 4:if(r=t.sent.flatMap((function(t){return e.upcastDashboard(t,o.dataSets,o.queryEngineConfig)})),!this.programmaticDashboard){t.next=18;break}return t.t0=Om,t.t1=r,t.t2=Om,t.next=12,this.programmaticDashboard(this.dataSets);case 12:return t.t3=t.sent,t.t4=this.dataSets,t.t5=t.t2.buildProgrammaticDashboard.call(t.t2,t.t3,t.t4),t.abrupt("return",t.t0.updateWithProgrammaticDashboard.call(t.t0,t.t1,t.t5));case 18:return t.abrupt("return",r);case 19:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t.createGlobalLibrary=function(){var e=me(Ce().mark((function e(t){var n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.vizzlyAPIClient.getGlobalLibraryManager(),e.next=4,n.create(t);case 4:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getGlobalLibraries=function(){var e=me(Ce().mark((function e(t){var n,i,r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.vizzlyAPIClient.getGlobalLibraryManager(),e.next=4,n.getGlobalLibraries(null!=t&&t.abortController?{abortSignal:null==t?void 0:t.abortController.signal}:{});case 4:return this.globalLibraryPermissions=(i=e.sent).permissions,r=i.global_libraries.map((function(e){return{id:(t=e).id,name:t.name,library:t.library,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),parentGlobalLibraryId:t.parent_global_library_id};var t})),o=xO(r,this.getIdentityConfig()),e.abrupt("return",[o.globalLibrary]);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getViewConfiguration=function(){return{queryEngineConfig:this.queryEngineConfig}},t.getIdentityConfig=function(){return this.identityConfig},t.query=function(){var t=me(Ce().mark((function t(n,i){var r,o,a,l,s,u,d=this;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Ke("[Services] Querying data with queries:",n),r="default",null!=i&&i.instanceId&&(r=i.instanceId),o=e._instanceStore[r],a=Si(n,null==i?void 0:i.dashboardFilters),AD(a,o.queryEngineConfig),l=function(){if(null!=i&&i.queryEngineEndpoint)return i.queryEngineEndpoint;if(jO.queryEngine){if("string"==typeof jO.queryEngine)return jO.queryEngine;if("string"!=typeof jO.queryEngine&&"endpoint"in jO.queryEngine)return jO.queryEngine.endpoint}}(),s=gO(o.identityConfig,o.queryEngineConfig,Tu(zo,null==i?void 0:i.dateFilterOptions),(null==i?void 0:i.variables)||{},null==i?void 0:i.runQueries,null==i?void 0:i.data,l),u=function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s(a,{abortSignal:null==i||null==(t=i.abortController)?void 0:t.signal,dataSets:d.dataSets});case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),Je("[Services] Error fetching data on query:",e.t0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}(),t.next=11,u();case 11:return t.t0=t.sent,t.abrupt("return",{results:t.t0});case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),e.upcastDashboard=function(e,t,n){try{var i,r=cm(e,n);return[xm(r,t,(null==(i=e.definition)?void 0:i.customFields)||{})]}catch(t){return Je("Failed to upcast dashboard "+e.id+". This dashboard will not be available for use.",t),[]}},e.filterDashboards=function(e,t){var n=r.cloneDeep(e);return t.onlyParentDashboards&&(n=n.filter((function(e){return null===e.parentDashboardId}))),t.onlyChildDashboards&&(n=n.filter((function(e){return null!==e.parentDashboardId}))),t.onlyChildDashboardsForParent&&(n=n.filter((function(e){return e.parentDashboardId===t.onlyChildDashboardsForParent}))),t.onlyAllowScope&&(n=n.filter((function(e){var n;return(null==(n=e.permission)?void 0:n.scope)===t.onlyAllowScope}))),t.onlyDashboardsIncludingMetadata&&(n=n.filter((function(e){var n=Object.keys(t.onlyDashboardsIncludingMetadata||{});return r.every(n,(function(n){var i;return e.metadata[n]===(null==t||null==(i=t.onlyDashboardsIncludingMetadata)?void 0:i[n])}))}))),n},t.updateGlobalLibrary=function(){var e=me(Ce().mark((function e(t){var n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=this.vizzlyAPIClient.getGlobalLibraryManager(),e.next=5,n.update(t);case 5:return e.abrupt("return",e.sent);case 9:e.prev=9,e.t0=e.catch(0),Je("Error updating global library:",e.t0);case 12:case"end":return e.stop()}}),e,this,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),e.eventBusController=function(){var t=me(Ce().mark((function t(n,i){var r,o,a,l,s,u,d;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,r=e.use(),"addComponentToLibrary"!==n.action&&"deleteComponentFromLibrary"!==n.action||!r.globalLibraryPermissions){t.next=23;break}return jO.publish({data:{action:"updateToGlobalLibraryStatus",state:ED.SAVING}}),t.t0=Promise,t.next=7,r.getGlobalLibraries({abortController:null==i?void 0:i.abortController});case 7:return t.t1=t.sent,t.t2=[t.t1],t.next=11,t.t0.all.call(t.t0,t.t2);case 11:return l=_I(a=t.sent[0]),"addComponentToLibrary"===n.action&&(l=AI(a,n.component,n.customFields)),"deleteComponentFromLibrary"===n.action&&(l=TI(a,n.component)),s=kI(r.globalLibraryPermissions,[l]),Xe("library and tokens for update",{libraryForUpdate:l,tokenForLibrary:s}),u={globalLibraryId:l.id,library:l.library,abortSignal:null==i||null==(o=i.abortController)?void 0:o.signal,globalLibrarySessionToken:s},t.next=21,r.updateGlobalLibrary(u);case 21:t.sent&&(d=ED.SAVED,"deleteComponentFromLibrary"===n.action&&(d=ED.DELETED),jO.publish({data:{action:"newViewsInGlobalLibrary"}}),jO.publish({data:{action:"updateToGlobalLibraryStatus",state:d}}));case 23:t.next=28;break;case 25:t.prev=25,t.t3=t.catch(0),Je("Error handling event:",t.t3);case 28:case"end":return t.stop()}}),t,null,[[0,25]])})));return function(e,n){return t.apply(this,arguments)}}(),e.publish=function(e){jO.eventBus.map((function(t){t(e)})),jO.eventBusController(e.data).catch((function(e){Je("Failed to handle event:",e)}))},e.subscription=function(e){return jO.eventBus.push(e),function(){jO.eventBus=jO.eventBus.filter((function(t){return t!==e}))}},e}();yO.queryEngine=void 0,yO._instanceStore={},yO.DEFAULT_INSTANCE_ID="default",yO.eventBus=[],yO.Row=nD,yO.Cell=tD,yO.Dashboard=rD,yO.Editor=dD,yO.Header=iD,yO.Library=sD,yO.AreaChart=pD,yO.LineChart=fD,yO.BarChart=mD,yO.PieChart=hD,yO.ScatterChart=vD,yO.ComboChart=gD,yO.PivotTable=xD,yO.BasicTable=bD,yO.HorizontalBarChart=yD,yO.MercatorMap=wD,yO.SingleStat=CD,yO.Progress=jD,"undefined"==typeof window||window.Vizzly||(window.Vizzly=yO);var wO,CO,jO="undefined"!=typeof window&&window.Vizzly||yO,FO=function(e){var n,i,r=e.deleteProps,o=e.view,a=e.addTagsProps,l=ff(),s=l.ref,u=l.open,d=l.position,c=l.show,f=l.close,m=Pu(),h=m.textOverride,v=t.useState(!1),g=v[0],x=v[1],b=t.useState(!1),y=b[0],w=b[1],C={delete:i="read_write"===m.scope,addTags:n=m.featureToggles.canAddTags,more:i&&n},j=function(){var e=[];return C.delete&&e.push({purpose:"removeComponentFromGlobalLibrary",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx($u,{purpose:"removeComponentFromLibrary"})})},onClick:function(){return x(!0)},testId:"delete-view"}),C.addTags&&e.push({purpose:"addTags",renderIcon:function(){return p.jsx(yf,{width:20,justifyContent:"center",as:"span",children:p.jsx(xd,{})})},onClick:function(){return w(!0)},testId:"add-tag"}),e}();return p.jsxs(t.Fragment,{children:[p.jsx(yS,{show:g,onClose:function(e){r.onDelete(e)&&x(!1)},message:h("editor.delete_modal","You are deleting [[title]] from the Global Library",{title:o.attributes.displayTitle||0!==o.attributes.displayTitle.length?o.attributes.displayTitle:"Untitled View"})}),p.jsx($k,{component:o,onClose:function(){return w(!1)},show:y,setTags:a.onChange}),C.delete&&!C.more&&p.jsx(Pv,{secondary:!0,onClick:function(){return x(!0)},disabled:r.disabled,children:h("editor.delete","Delete")}),C.more&&p.jsxs("div",{className:es({position:"relative"}),ref:s,children:[p.jsx(Pv,{secondary:!0,onClick:function(){u()},children:h("editor.more","More")}),c&&p.jsx(cf,{onClose:function(){return f()},position:d,children:p.jsx(cS,{onClose:function(){return u()},cellOptions:j})})]}),C.addTags&&!C.more&&p.jsx(Pv,{secondary:!0,onClick:function(){return w(!0)},children:h("editor.add_tags","Add Tags")})]})},SO=function(e){var n=qm(),i=n.dashboard,r=n.dispatch,o=n.componentEditor,a=Pu(),l=a.onlyViewTypes,s=a.queryEngineConfig,u=a.onEditorUpdate,d=t.useState(null),c=d[0],f=d[1],m=t.useState(!0),h=m[0],v=m[1],g=function(){var e=me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",tv(0,l(null==i?void 0:i.dataSets[0])[0],null==i?void 0:i.dataSets[0],s,u));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return t.useEffect((function(){var t=!0;return function(){var n=me(Ce().mark((function n(){var r,o;return Ce().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=null,o=!1,n.prev=2,n.next=5,OI(e.view);case 5:n.next=11;break;case 7:return n.prev=7,n.t0=n.catch(2),Je(n.t0),n.abrupt("return");case 11:if(!e.view){n.next=16;break}return n.next=14,e.view(null==i?void 0:i.dataSets);case 14:o=null!==(r=n.sent);case 16:if(r){n.next=20;break}return n.next=19,g();case 19:r=n.sent;case 20:t&&(f(r),v(!o));case 21:case"end":return n.stop()}}),n,null,[[2,7]])})));return function(){return n.apply(this,arguments)}}()(),function(){t=!1}}),[e.view]),t.useEffect((function(){c&&r({type:"startEditor",libraryIndex:null,component:c})}),[JSON.stringify(c)]),null===o&&null===c?p.jsx(Nf,{}):p.jsx(t.Fragment,{children:null!=o&&null!==c&&p.jsx(kO,ge({},e,{getInitialComponent:g,currentView:c,initialComponentUndefined:h}))},JSON.stringify(c))},kO=function(e){var t=iv();return t?p.jsx("div",{"data-testid":"editor-app",children:p.jsxs(jh,{id:"vizzly_editor-app_provider",children:[p.jsx(AO,ge({},e,{editor:t})),p.jsx(gI,{})]})}):p.jsx(Nf,{})},AO=function(e){var i=e.editor,r=e.currentView,o=t.useState(!1),a=o[0],l=o[1],s=n.useContext(jI),u=qm(),d=u.dashboard,c=u.dispatch,f=Pu().mode,m=t.useState(!1),h=m[0],v=m[1],g=cA();return t.useEffect((function(){if(r&&null!=s&&s.globalLibraries){var e,t=null==(e=function(e,t){if(!e)throw new Error("No global libraries found.");return e.find((function(e){return e.library.views?e.library.views.find((function(e){return e.attributes.viewId===t})):null}))}(null==s?void 0:s.globalLibraries,r.attributes.viewId))?void 0:e.library.customFields,n=d.dataSets.map(na);t&&(function(e,t){[].concat(e).forEach((function(e){t[e.id]&&t[e.id].forEach((function(t){e.fields=[].concat(e.fields,[t])}))}))}(n,t),i.setDataSets(n))}}),[JSON.stringify(r),JSON.stringify(null==s?void 0:s.globalLibraries)]),t.useEffect((function(){var t=jO.subscription(function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("updateToGlobalLibraryStatus"===n.data.action&&n.data.state===ED.SAVING&&l(!0),"updateToGlobalLibraryStatus"===n.data.action&&n.data.state===ED.SAVED&&l(!1),"updateToGlobalLibraryStatus"!==n.data.action||n.data.state!==ED.DELETED){t.next=10;break}return t.t0=c,t.next=6,e.getInitialComponent();case 6:t.t1=t.sent,t.t2={type:"startEditor",libraryIndex:null,component:t.t1},(0,t.t0)(t.t2),l(!1);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());return function(){return t()}}),[]),p.jsx(t.Fragment,{children:p.jsxs(Td,{gap:"1rem",children:[p.jsx(yf,{justifyContent:"flex-end",children:p.jsx("div",{children:p.jsxs(hh,{children:[p.jsx(FO,{deleteProps:{disabled:e.initialComponentUndefined||a,onDelete:function(e){return e&&r&&jO.publish({data:{action:"deleteComponentFromLibrary",component:r}}),!0}},addTagsProps:{onChange:function(e){i.component.attributes.tags=e}},view:r}),p.jsx(Pv,{primary:!0,onClick:function(){var t,n=i.dataSet.fields.filter(bn),r=yu(i.component,"admin"===f);e.onSave&&e.onSave(r),jO.publish({data:{action:"addComponentToLibrary",component:r,customFields:(t={},t[r.attributes.dataSetId]=n,t)}})},disabled:null===i.component||a,children:"Save to Library"})]})})}),p.jsx(uf,{children:p.jsx(fT,{children:p.jsx(HT,{editor:i,ai:h,openAI:v,usingBeta:g,standalone:!0})})})]})})},TO=t.createContext(void 0);!function(e){e.Admin="admin",e.EndUser="endUser"}(wO||(wO={})),function(e){e.Read="read",e.ReadWrite="read_write"}(CO||(CO={}));var _O=function(){var e=me(Ce().mark((function e(t,n){var i,r,o,a,l,s,u;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("exact"!=t.type){e.next=9;break}if((i=n.dashboards.find((function(e){return e.id===t.dashboardId}))).permission){e.next=4;break}throw"";case 4:return Ke("A specific dashboard has been requested. This will be rendered with",r=i.permission.scope,"scope.",t.dashboardId),e.abrupt("return",{dashboardId:t.dashboardId,mode:"read_write"===r&&null===i.parentDashboardId?wO.Admin:wO.EndUser,scope:r});case 9:if("instantCopyOf"!=t.type){e.next=29;break}if(a=n.dashboards.find((function(e){return e.id===t.parentDashboardId})),"read_write"!==(null==(o=a.permission)?void 0:o.scope)){e.next=15;break}return Ke("Write access to the parent dashboard has been found, so this dashboard will be shown with admin access.",t.parentDashboardId),e.abrupt("return",{dashboardId:t.parentDashboardId,mode:wO.Admin,scope:CO.ReadWrite});case 15:if(l=Cm(t.parentDashboardId,n.dashboards),!(s=km(l))){e.next=20;break}return Ke("An existing child dashboard exists of the parent dashboard. As no specific dashboardId was provided, we will render the most recently updated child dashboard",s.id),e.abrupt("return",{dashboardId:s.id,mode:wO.EndUser,scope:s.permission.scope});case 20:return Ke("No previous child dashboard has been created on behalf of the current user for the parent dashboard",a.id,". Creating a child copy of the parent."),e.next=23,n.createDashboard({parentDashboardId:a.id,definition:hm(a),metadata:{}});case 23:if(u=e.sent){e.next=26;break}throw"Failed to create first child dashboard for the user.";case 26:return e.abrupt("return",{dashboardId:u.id,scope:CO.ReadWrite,mode:wO.EndUser});case 29:throw"Unsupported strategy";case 30:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),IO=function(e){function t(){var t;return(t=e.call(this,"At least one data set must be built for the Vizzly dashboard to render.")||this).name="NoDataSetResolved",t}return be(t,e),t}(Fe(Error)),DO=function(e,n){var i=t.useState({loading:!0,error:void 0,dashboards:[],globalLibraries:[]}),r=i[0],o=i[1],a=t.useRef(),l=a.current;t.useEffect((function(){var t=new AbortController;return function(){var i=me(Ce().mark((function i(){var l;return Ce().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,jO.load(e,{apiHost:(null==n?void 0:n.apiHost)||"https://api.vizzly.co"});case 3:return a.current=i.sent,i.next=6,Promise.all([a.current.getGlobalLibraries({abortController:t}),a.current.getDashboards({abortController:t})]);case 6:o({loading:!1,error:void 0,dashboards:(l=i.sent)[1],globalLibraries:l[0]}),i.next=16;break;case 12:i.prev=12,i.t0=i.catch(0),Je("Error loading Vizzly",i.t0),o({loading:!1,error:i.t0,dashboards:[].concat(r.dashboards),globalLibraries:[].concat(r.globalLibraries)});case 16:case"end":return i.stop()}}),i,null,[[0,12]])})));return function(){return i.apply(this,arguments)}}()(),function(){return t.abort(new LT("We stopped loading Vizzly because of an abort signal triggered by an unmount"))}}),[]);var s=function(){var t=me(Ce().mark((function t(){var i;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=new AbortController,function(){var t=me(Ce().mark((function t(){var l;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,jO.load(e,{apiHost:(null==n?void 0:n.apiHost)||"https://api.vizzly.co"});case 3:return a.current=t.sent,t.next=6,Promise.all([a.current.getGlobalLibraries({abortController:i}),a.current.getDashboards({abortController:i})]);case 6:o({loading:!1,error:void 0,dashboards:(l=t.sent)[1],globalLibraries:l[0]}),t.next=16;break;case 12:t.prev=12,t.t0=t.catch(0),Je("Error loading Vizzly",t.t0),o({loading:!1,error:t.t0,dashboards:[].concat(r.dashboards),globalLibraries:[].concat(r.globalLibraries)});case 16:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(){return t.apply(this,arguments)}}()(),t.abrupt("return",(function(){return i.abort(new LT("We stopped loading Vizzly because of an abort signal triggered by an unmount"))}));case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),u=function(){var e=me(Ce().mark((function e(t){var n;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l){e.next=15;break}return e.prev=1,e.next=4,l.createDashboard({definition:t.definition,parentDashboardId:t.parentDashboardId,metadata:t.metadata||t.meta,abortSignal:t.abortSignal});case 4:return o(ge({},r,{dashboards:[].concat(r.dashboards,[n=e.sent])})),e.abrupt("return",n);case 9:return e.prev=9,e.t0=e.catch(1),Je(e.t0),e.abrupt("return",null);case 13:e.next=16;break;case 15:throw"Unable to create a dashboard when vizzly has not been loaded.";case 16:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}();t.useEffect((function(){var t=new AbortController,i=function(){var i=me(Ce().mark((function i(){return Ce().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,jO.load(e,{apiHost:(null==n?void 0:n.apiHost)||"https://api.vizzly.co"});case 3:return a.current=i.sent,i.next=6,Promise.all([a.current.getGlobalLibraries({abortController:t})]);case 6:o(ge({},r,{globalLibraries:i.sent[0]})),i.next=15;break;case 11:i.prev=11,i.t0=i.catch(0),Je("Error loading Vizzly",i.t0),o({loading:!1,error:i.t0,dashboards:[].concat(r.dashboards),globalLibraries:[].concat(r.globalLibraries)});case 15:case"end":return i.stop()}}),i,null,[[0,11]])})));return function(){return i.apply(this,arguments)}}();if(l){var s=jO.subscription((function(e){"newViewsInGlobalLibrary"===e.data.action&&i()}));return function(){return s()}}return function(){return t.abort(new LT("We stopped loading Vizzly because of an abort signal triggered by an unmount"))}}),[l]);var d=function(){var e=me(Ce().mark((function e(t){var n,i;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l){e.next=20;break}return o(ge({},r,{saving:xa.InProgress})),e.prev=2,e.next=5,l.updateDashboard({dashboardId:t.dashboardId,definition:t.definition,deleted:t.deleted,metadata:t.metadata||t.meta,abortSignal:t.abortSignal});case 5:return n=e.sent,e.next=8,l.getDashboards();case 8:return i=e.sent,o((function(e){return ge({},e,{dashboards:i,saving:xa.Saved})})),setTimeout((function(){o(ge({},r,{saving:xa.Undefined}))}),500),e.abrupt("return",n);case 14:return e.prev=14,e.t0=e.catch(2),Je("Error updating dashboard",e.t0),e.abrupt("return",null);case 18:e.next=21;break;case 20:throw"Unable to update a dashboard when vizzly has not been loaded.";case 21:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}();if(Ke("useVizzly state.",r),!l||r.error||r.loading)return ge({},r,{loading:!0,createDashboard:null,identityConfig:null,updateDashboard:null,queryEngineConfig:null,accessType:null,refetch:null,getScheduledReports:null,updateScheduledReport:null});var c=l.getIdentityConfig();return ge({},r,{loading:!1,identityConfig:c,createDashboard:u,updateDashboard:d,queryEngineConfig:l.getViewConfiguration().queryEngineConfig,accessType:c.dashboardAdminOverride?"admin":c.dashboardAccess.accessType,filterDashboards:jO.filterDashboards,refetch:s,updateScheduledReport:function(e,t,n){if(l)return l.updateScheduledReport(e,t,n);throw"vizzly not set"},getScheduledReports:function(e){if(l)return l.getScheduledReports(e);throw"vizzly not set"}})},OO=function(e){return me(Ce().mark((function t(){var n,i;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/parent-dashboards",method:"get"});case 2:if(i=(n=t.sent).body,200!=n.status){t.next=7;break}return t.abrupt("return",i.dashboards.map((function(e){return{id:e.id,created_at:e.created_at,updated_at:e.updated_at,webhook_id:e.webhook_id}})));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})))},EO=function(e){return function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/scheduled-report",method:"post",body:{cronSchedule:n.cronSchedule,dashboardAccessToken:n.dashboardAccessToken,scheduledReportId:n.scheduledReportId}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},LO=function(e){return e.map((function(e){return{name:e.name,description:e.description||"",fields:e.fields.map((function(e){var t=[],n=["none"];return"date_time"==e.dataType?n=[].concat(n,e.allowedGranularities||[]):t=[].concat(t,e.supportedAggregateOptions||[]),{name:e.publicName,description:e.description||"",canBeDimension:e.canBeDimension,canBeMeasure:e.canBeMeasure,availableFunctionsInSelect:t,availableFunctionsInGrouping:n}}))}}))},NO=function(e,t){var n=r.cloneDeep(t);if("custom"===n.type)throw"Custom views are not supported by Vizzly AI.";if("funnelChart"===n.type)throw"Funnel chart views are not supported by Vizzly AI.";if("richText"===n.type)throw"Rich text views are not supported by Vizzly AI.";if("lineChartV2"===n.type)throw"Line Chart V2 views are not supported by Vizzly AI.";var i,o,a,l=[],s=[],u=[],d={orWhereClauses:[]},c=[],p=[],f=n.displayTitle,m=n.displaySubject,h=n.limit;return"goalLines"in n&&(c=null==(i=n.goalLines)?void 0:i.map((function(e){return{value:e.value,color:e.color,strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth}}))),"conditionalFormattingRules"in n&&Array.isArray(n.conditionalFormattingRules)&&(p=null==(o=n.conditionalFormattingRules)?void 0:o.map((function(e){return{color:e.ruleValue,field:e.filters[0][0].field,function:e.filters[0][0].function,op:e.filters[0][0].op,value:e.filters[0][0].value}}))),"measure"in n&&(l=n.measure.map((function(t){return{field:Qo(e,t.field).publicName,function:t.function}}))),"dimension"in n&&(s=n.dimension.map((function(t){return{field:Qo(e,t.field).publicName,function:t.function}}))),"order"in n&&(u=n.order.map((function(t){return{field:Qo(e,t.field).publicName,function:t.function,direction:t.direction}}))),"filter"in n&&(d={orWhereClauses:null==(a=n.filter||[])?void 0:a.map((function(t){return{andWhereClauses:t.map((function(t){return{field:Qo(e,t.field).publicName,function:t.function,op:t.op,value:t.value}}))}}))}),{title:f,subtitle:m,type:n.type,dataSetName:e.name,select:l,group:s,order:u,goalLines:c,conditionalFormatting:p,filter:d,limit:h}},MO=function(e,t,n,i){var o,a,l,s,u=r.cloneDeep(t),d=Xo(e,n.dataSetName);if(!d)throw"Failed to find data set by name";return"title"in n&&(u.displayTitle=n.title||u.displayTitle),"limit"in u&&"limit"in n&&(u.limit=n.limit),"filter"in u&&"filter"in n&&(u.filter=null==(o=(null==(a=n.filter)?void 0:a.orWhereClauses)||[])?void 0:o.map((function(e){return e.andWhereClauses.map((function(e){return{field:Jo(d,e.field).id,function:e.function,op:e.op,value:e.value}}))}))),"subtitle"in n&&(u.displaySubject=n.subtitle||u.displaySubject),"measure"in u&&"select"in n&&(u.measure=(n.select||[]).map((function(e){return{field:Jo(d,e.field).id,function:e.function}}))),"dimension"in u&&"group"in n&&(u.dimension=(n.group||[]).map((function(e){return{field:Jo(d,e.field).id,function:e.function}}))),"goalLines"in u&&"goalLines"in n&&(u.goalLines=null==(l=n.goalLines)?void 0:l.map((function(e){return{strokeStyle:e.strokeStyle,strokeWidth:e.strokeWidth,color:e.color,value:e.value}}))),"order"in u&&"order"in n&&(u.order=(n.order||[]).map((function(e){return{field:Jo(d,e.field).id,function:e.function,direction:e.direction}}))),"conditionalFormattingRules"in u&&"conditionalFormatting"in n&&(u.conditionalFormattingRules=null==(s=n.conditionalFormatting)?void 0:s.map((function(e){var t=Jo(d,e.field);return{ruleType:"backgroundColor",ruleValue:e.color,filters:[[{field:t.id,function:e.function,op:e.op,value:e.value}]]}}))),n.type&&t.type!=n.type&&(u=Go(n.type,{queryEngineConfig:i}).init(d.id,ge({},u,{type:n.type}))),function(e,t){var n=Go(e.type,{queryEngineConfig:t}).schema.validate(e,{stripUnknown:{arrays:!0,objects:!0},allowUnknown:!1,abortEarly:!1}),i=n.error,r=n.value;return i&&Ze("AI attribute errors",i),r}(u,i)},RO=function(e,t,n,i){if(!Xo(i,e.ai_view.dataSetName))throw Ze("The AI returned an invalid data set ID. This is likely due to a bug in the AI. Please contact support."),new OT;return{conversationId:e.conversation_id,attributes:MO(i,t,e.ai_view,n),messageHistory:e.conversation_content.messages.map((function(e){return{id:e.id,content:e.content,reaction:e.reaction,sender_type:e.sender_type,sent_at:new Date(e.sent_at),status:e.status}}))}};function PO(e,t){if(200!=e){if(422==e||429==e)throw Ke("askAi","AI usage limit reached",t),new IT(t.quota+" queries per hour allowed.");if(500===e&&t&&"reason"in t&&"Aborted"===t.reason)throw new ET;throw new DT}}var zO=function(e){return function(){var t=me(Ce().mark((function t(n,i,r,o,a,l,s){var u,d,c,p;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=NO(Ko(a,i.dataSetId),i),t.next=3,e({path:"/api/ai",method:"post",body:{question:r,conversationId:n,currentAttributes:u,dataSets:LO(a),dashboardAccessToken:o},abortSignal:s});case 3:return PO((d=t.sent).status,c=d.body),p=RO(c,i,l,a),t.abrupt("return",p);case 9:case"end":return t.stop()}}),t)})));return function(e,n,i,r,o,a,l){return t.apply(this,arguments)}}()},VO=function(e){function t(t){var n;return(n=e.call(this,"Failed to save Vizzly config. Received status code "+t+".")||this).name="FailedToSaveVizzlyConfigVersion",n}return be(t,e),t}(Fe(Error)),qO=function(e){return e.ConfigStore="cnf_",e.Project="prj_",e.KeyPair="kyp_",e.Dashboard="dsh_",e.ProjectApiKey="vizzly_project_api_key_",e}({}),BO=function(e){return function(){var t=me(Ce().mark((function t(n,i){var r;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/config",method:"post",body:{projectId:n,encryptedConfig:i},preFetchProjectAccessTokens:n?{projectId:n,resourceFilters:[qO.Project,qO.ConfigStore]}:void 0});case 2:if(200==(r=t.sent.status)){t.next=6;break}throw new VO(r);case 6:return t.abrupt("return",200==r);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},WO=function(e){return function(){var t=me(Ce().mark((function t(n){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key",method:"post",body:{},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[qO.Project]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},HO=function(e){return function(){var t=me(Ce().mark((function t(n,i,r){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key/"+i,method:"put",body:ge({},r),preFetchProjectAccessTokens:{projectId:n,resourceFilters:[qO.Project,qO.ProjectApiKey]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e,n,i){return t.apply(this,arguments)}}()},YO=function(e){return function(){var t=me(Ce().mark((function t(n,i){var r,o,a;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/question-suggestions",method:"post",body:{dataSets:LO(i),dashboardAccessToken:n}});case 2:if(PO(a=(r=t.sent).status,o=r.body),200!=a){t.next=8;break}return t.abrupt("return",{suggestions:o.suggestions});case 8:throw"Failed to fetch question suggestions from AI.";case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},GO=function(e){return function(){var t=me(Ce().mark((function t(n){var i,r,o;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={},n&&(i={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},headers:i});case 4:return o=(r=t.sent).body,t.abrupt("return",200==r.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},UO=function(e){return function(){var t=me(Ce().mark((function t(n){var i,r,o;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={},n&&(i={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},headers:i});case 4:return o=(r=t.sent).body,t.abrupt("return",200==r.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},KO=function(e){return function(){var t=me(Ce().mark((function t(n){var i,r,o;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={},n&&(i={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},headers:i});case 4:return o=(r=t.sent).body,t.abrupt("return",200==r.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},XO=function(e){return function(){var t=me(Ce().mark((function t(n,i,r){var o,a,l;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},r&&(o={auth:"Bearer "+r}),t.next=4,e({path:"/api/v2/project/managed-query-engine/"+n+"/key-pairs/"+i,method:"get",headers:o});case 4:if(l=(a=t.sent).body,200!=a.status){t.next=9;break}return t.abrupt("return",{privateKey:l.keys.private_key,publicKey:l.keys.public_key});case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t)})));return function(e,n,i){return t.apply(this,arguments)}}()},QO=function(e){return function(){var t=me(Ce().mark((function t(n,i,r,o){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai/conversation/"+n+"/message/"+i,method:"post",body:{reaction:o.reaction,dashboardAccessToken:r}});case 2:return t.abrupt("return",ZO(t.sent));case 4:case"end":return t.stop()}}),t)})));return function(e,n,i,r){return t.apply(this,arguments)}}()},ZO=function(e){if(200===e.status)return{success:!0};throw new Error("AI Action failed")},JO=function(e){return p.jsx("div",{children:p.jsxs("span",{children:[p.jsxs("span",{className:es({marginRight:"12px"}),children:[!0===e.status&&p.jsx(eE,{}),!1===e.status&&p.jsx(tE,{}),null===e.status&&p.jsx(nE,{})]}),!0===e.status&&e.successMessage,!1===e.status&&e.errorMessage,null===e.status&&e.unknownMessage]})})},$O=function(e){var t=e.statusReport.configs.flatMap((function(e){return e.connections}));return p.jsxs("div",{className:es({display:"grid",gridTemplateColumns:"1fr",gap:"16px",marginTop:"16px"}),children:[p.jsx(JO,{status:r.every(e.statusReport.configs,(function(e){return null===e.validationErrorDetails})),successMessage:"All configs are valid",errorMessage:"Not all configs are valid",unknownMessage:"We did not run any config validation checks"}),p.jsx(JO,{status:t.length>0?r.every(t,(function(e){return!!e.pingResult})):null,successMessage:"All connection checks passed",errorMessage:"Not all connection checks passed",unknownMessage:"We did not run a connection check"}),p.jsx(JO,{status:!!e.statusReport.projectId||null,successMessage:"Valid project ID",errorMessage:"Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set",unknownMessage:"Failed to find your project ID. Please ensure the VIZZLY_PROJECT_ID environment variable has been set"}),p.jsx(JO,{status:!0,successMessage:"Using configs from "+Re(e.statusReport.configs.flatMap((function(e){return 0===e.connections.length&&0===e.dataSets.length&&0===e.publicKeys.length&&0===e.sqlViews.length?[]:[e.source.name]})))+".",errorMessage:"Failed to load configs",unknownMessage:"Failed to load configs"})]})},eE=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:es({width:"24px",height:"24px",display:"inline-block"}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},tE=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:es({width:"24px",height:"24px",display:"inline-block"}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})},nE=function(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:es({width:"24px",height:"24px",display:"inline-block"}),children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},iE=function(){var e=me(Ce().mark((function e(t,n){var i,r,o;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=CC(t),e.next=3,i({path:"/api/v2/status",method:"post",mode:"cors",abortSignal:n,body:{}});case 3:return o=(r=e.sent).body,e.abrupt("return",200==r.status?o:null);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),rE=function(e){var t=p.jsx("code",{style:{background:"rgba(0, 0, 0, 0.05)",borderRadius:"5px",padding:"2px 5px"},children:e.children});return e.href?p.jsx("a",{target:"_blank",href:e.href,children:t}):t},oE=function(e){var n=t.useState(void 0),i=n[0],r=n[1];return t.useEffect((function(){var t=new AbortController;return"query-engine"==e.implementationMeta.type&&e.implementationMeta.queryEngineEndpoint&&function(){var e=me(Ce().mark((function e(n){var o,a;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=setTimeout((function(){t.signal.aborted||void 0!==i||(t.abort(),r(null))}),2e3),e.prev=1,e.next=4,iE(n,t.signal);case 4:a=e.sent,clearTimeout(o),r(a||null),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),r(null);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()(e.implementationMeta.queryEngineEndpoint),function(){t.abort("Setup notice unmounted")}}),[]),p.jsx(Rg,{title:"Vizzly set up",renderExtra:function(){return p.jsxs("div",{style:{width:"650px"},children:[e.helpSections.map((function(e,t){return p.jsxs("div",{className:es({margin:"24px 0",borderRadius:"8px",padding:"12px",backgroundColor:"#f3f5f9"}),children:[p.jsxs("div",{className:es({textAlign:"left"}),children:[p.jsx("h2",{className:[""+Ql.text,es({fontWeight:"bold",marginBottom:"12px"})].join(" "),children:e.title}),e.text.map((function(e,t){return p.jsx("p",{className:[""+Ql.text,es({marginBottom:"8px"})].join(" "),children:e},t)}))]}),e.callToAction&&p.jsx("div",{className:es({textAlign:"right",marginTop:"24px"}),children:p.jsx("a",{target:"_blank",href:e.callToAction.link,children:p.jsx(Pv,{children:e.callToAction.text})})})]},t)})),void 0!==i&&p.jsxs("div",{className:es({textAlign:"left",borderRadius:"8px",marginTop:"12px",padding:"12px",width:"100%",backgroundColor:"#f3f5f9"}),children:[null===i&&p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:[""+Ql.text,es({fontWeight:"bold",marginBottom:"12px"})].join(" "),children:"Vizzly Query Engine not found"}),p.jsxs("p",{className:""+Ql.text,children:["If you have deployed the Vizzly Query Engine, then please set the ",p.jsx(rE,{children:"queryEngineEndpoint"})," ","property to the URL where it is deployed too."]}),p.jsx("div",{className:es({textAlign:"right",marginTop:"8px"}),children:p.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/query-engines/self-hosted-query-engine",children:p.jsx(Pv,{children:"Deploy the Query Engine"})})})]}),i&&p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:[""+Ql.text,es({fontWeight:"bold",margin:"12px 0 "})].join(" "),children:"Query engine status"}),p.jsx($O,{statusReport:i})]})]})]})}})},aE=function(e){return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"Set up identity"},text:[p.jsxs(p.Fragment,{children:["We need to replace the current placeholder ",p.jsx(rE,{children:"identity"})," function with your own identity logic."]}),"Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens."]}]})},lE=function(e){return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:["The async identity function must return the Vizzly access tokens in the correct format."]}]})},sE=function(e){var t=[];switch(e.implementationMeta.type){case"custom":case"in-browser":t=[p.jsxs(p.Fragment,{children:["The ",p.jsx(rE,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"}),"function must provide at least one data set"]})];break;case"query-engine":t=[p.jsx(p.Fragment,{children:"To start using the Vizzly dashboard, you must add a data set to the Vizzly Query Engine."}),p.jsx(p.Fragment,{children:"If you have already done this, check the `dataSets` value in your identity token to make sure it allows at least one data set to be returned."})]}return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"At least one data set must be provided",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:t}]})},uE=function(e){return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"We did not fetch your data sets.",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:[p.jsxs(p.Fragment,{children:["If you are using the Vizzly Query Engine, then you will need to set the"," ",p.jsx(rE,{href:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",children:"queryEngineEndpoint"})," ","property on the dashboard."]}),p.jsxs(p.Fragment,{children:["Alternatively, if you are not using the Vizzly Query Engine, then the"," ",p.jsx(rE,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"})," property is required, and it must be an async function."]})]}]})},dE=function(e){return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"Query Engine Endpoint",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",text:"See the docs"},text:[p.jsxs(p.Fragment,{children:["Incorrect ",p.jsx(rE,{children:"queryEngineEndpoint"})," value",e.invalidEndpoint?" ("+JSON.stringify(e.invalidEndpoint)+")":"",". Please deploy the"," ",p.jsx("a",{className:es({textDecoration:"underline"}),href:"https://docs.vizzly.co/query-engines/self-hosted",children:"Vizzly Query Engine"}),", and then provide the URL to it as a string, or as an object with a string host value."]})]}]})},cE=function(e){return p.jsx(oE,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:[p.jsxs(p.Fragment,{children:[p.jsx(rE,{children:"identity"})," must be an async function that returns your Vizzly identity tokens."]})]}]})},pE=function(e){Je(e.error);var t=p.jsx("p",{children:"Unknown error"});return e.error instanceof IO&&(t=p.jsx(sE,{implementationMeta:e.implementationMeta})),e.error instanceof GI&&(t=p.jsx(uE,{implementationMeta:e.implementationMeta})),e.error instanceof mC&&(t=p.jsx(dE,{implementationMeta:e.implementationMeta,invalidType:!0})),e.error instanceof fC&&(t=p.jsx(dE,{implementationMeta:e.implementationMeta,invalidEndpoint:e.error.invalidEndpoint})),e.error instanceof HI&&(t=p.jsx(cE,{implementationMeta:e.implementationMeta})),e.error instanceof LI&&(t=p.jsx(Bg,{})),e.error instanceof NI&&(t=p.jsx(lE,{implementationMeta:e.implementationMeta})),e.error instanceof pC&&(t=p.jsx(Vg,{})),e.error instanceof YI&&(t=p.jsx(qg,{})),e.error instanceof ga&&(t=p.jsx(aE,{implementationMeta:e.implementationMeta})),e.error instanceof LT&&(t=p.jsx(Nf,{override:e.renderLoadingComponent})),p.jsxs(zd,{children:[p.jsx(va,{}),t]})},fE=function(e){var n=t.useState(0),i=n[0],r=n[1];return Nu((function(e){e.clearInMemoryDb&&(Ke("Received from vizzlyState, `clearInMemoryDb()`"),sO().clear(),oO={},iO={},Ke("Browser cache cleared."),QD={}),e.reload&&(Ke("Received from vizzlyState, `reload()`"),r((function(e){return e+1})))}),e.id),c.createElement(mE,ge({},e,{key:e.parentDashboardId+"_"+e.dashboardId+"_"+i}))},mE=function(e){var n,i,o,a,l,s,u=function(e){return"runQueries"in e?{type:"custom",queryEngineEndpoint:e.queryEngineEndpoint}:"data"in e?{type:"in-browser",queryEngineEndpoint:e.queryEngineEndpoint}:{type:"query-engine",queryEngineEndpoint:e.queryEngineEndpoint}}(e),d=e.vizzlyApiHost?{host:e.vizzlyApiHost}:{host:"https://api.vizzly.co"},c=(s=bC(l=d),{config:l,getParentDashboards:OO(s),saveScheduledReport:EO(s),askAi:zO(s),aiActions:QO(s),askAiForQuestionSuggestions:YO(s),createVizzlyConfigVersion:BO(s),createProjectApiKey:WO(s),updateProjectApiKey:HO(s),getProjectAccessToken:gC(s),createSelfHostedQueryEngineProject:GO(s),createSelfHostedDynamicQueryEngineProject:UO(s),createSelfHostedInBrowserQueryEngineProject:KO(s),getManagedQueryEngineKeyPair:XO(s)}),f=function(t,n,i){var r;return Vo(t,n,i,e.textOverrides,"object"==typeof e.developerTools&&!0===(null==(r=e.developerTools)?void 0:r.translationKeys))},m=function(e){var n,i,o=DO({queryEngine:e.queryEngine,identity:e.identityCallback,dataSets:e.loadDataSetsCallback,programmaticDashboard:e.programmaticDashboard},{apiHost:e.apiConfig.host}),a=function(e,n,i){var r=t.useState(),o=r[0],a=r[1];if(t.useEffect((function(){!function(){var t=me(Ce().mark((function t(){var i,r,l,s;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("dashboards"in n){t.next=2;break}return t.abrupt("return");case 2:if(e){t.next=4;break}return t.abrupt("return");case 4:if(!n.loading){t.next=6;break}return t.abrupt("return");case 6:return t.next=8,_O(e,n);case 8:r=(i=t.sent).mode,s=i.scope,(l=i.dashboardId)!=(null==o?void 0:o.dashboardId)&&a({mode:r,dashboardId:l,scope:s});case 13:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify({strategy:e,loading:n.loading})]),!("dashboards"in n))return null;if(!o)return null;if(n.loading)return null;var l=n.dashboards.find((function(e){return e.id==o.dashboardId}))||null;return{mode:o.mode,dashboard:l,scope:o.scope,isProgrammaticParent:!!i}}(function(e,t,n,i){if("dashboards"in e&&!(e.loading||e.error||(Ke("Loading dashboard strategy, with props;",{dashboardId:n,parentDashboardId:t}),i&&0===e.dashboards.length))){var r,o,a=function(e,t,n){if(e){var i=Am(n,e);if(null!=i&&i.parentDashboardId)throw"[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.";return e}var r=jm(n);return Dm(r)||t||Fm(r).id}(t,e.identityConfig.dashboardAccess.dashboardId,e.dashboards);if("admin"==e.accessType){Ke("Admin access found, so we will show the parent dashboard.",a);var l=a;if(n){var s=e.dashboards.find((function(e){return e.id==n}));null!=s&&s.parentDashboardId&&(Ke("A child dashboard was provided whilst in admin mode. Therefore the parent of the given child will be shown to administer.",s.parentDashboardId),l=s.parentDashboardId)}return Ke("Admin access found, so we will show the parent dashboard.",l),{type:"exact",dashboardId:l}}return n?(Ke("Strategy will be to show dashboard",n),{type:"exact",dashboardId:n}):1===e.dashboards.filter((function(e){return null!=e.parentDashboardId&&(void 0===t||e.parentDashboardId===t)})).length&&"read"==e.identityConfig.dashboardAccess.scope?(Ke("Strategy will be to show read-only view of the only child dashboard. If you wish to render a read-only view of the parent dashboard, please make sure the `dashboardId` property matches the `parentDashboardId` property.",a),{type:"exact",dashboardId:e.dashboards.find((function(e){return null!=e.parentDashboardId})).id}):"read"==e.identityConfig.dashboardAccess.scope&&a?(Ke("Strategy will be to return read-only view of the parent dashboard.",a),{type:"exact",dashboardId:a}):e.identityConfig.dashboardAccess.dashboardId?(Ke("Strategy will be to show a child of the parent dashboard determined by the identity config",null==(r=e.identityConfig.dashboardAccess)?void 0:r.dashboardId),{type:"instantCopyOf",parentDashboardId:null==(o=e.identityConfig.dashboardAccess)?void 0:o.dashboardId}):(Ke("Strategy will be to show a child of the parent dashboard",a),{type:"instantCopyOf",parentDashboardId:a})}}(o,e.parentDashboardId,e.dashboardId,e.isEditor),o,e.programmaticDashboard),l=function(e,n){var i=t.useState([]),o=i[0],a=i[1];t.useEffect((function(){!function(){var t=me(Ce().mark((function t(){return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.getScheduledReports||!n){t.next=6;break}return t.next=3,e.getScheduledReports(n);case 3:a(t.sent.reports);case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify({dashboardAccessToken:n,loadingVizzly:e})]);var l=function(){var t=me(Ce().mark((function t(i,l){var s,u,d;return Ce().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.updateScheduledReport||!n){t.next=7;break}return t.next=3,e.updateScheduledReport(n,i,l);case 3:!0===(s=t.sent)?a([].concat(o).filter((function(e){return e.id!=i}))):s&&(u=[].concat(o,[s.report]).map((function(e){return e.id==i?s.report:e})),d=r.uniqBy(u,(function(e){return e.id})),a(d)),t.next=8;break;case 7:console.warn("Function to update scheduled report not loaded.");case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}();return{reports:o,getScheduledReports:e.getScheduledReports,updateScheduledReport:l}}(o,null==a||null==(n=a.dashboard)||null==(n=n.permission)?void 0:n.token),s=l.reports,u=l.updateScheduledReport;if(!o)return null;if("error"in o&&o.error)return{error:o.error};if("loading"in o&&o.loading)return null;if(!("dashboards"in o))return null;var d=o.identityConfig,c=o.queryEngineConfig;return a?0===((null==a||null==(i=a.dashboard)?void 0:i.dataSets)||[]).length?{error:new IO}:{vizzly:o,scope:a.scope,queryEngineConfig:c,dashboard:a.dashboard,identityConfig:d,mode:a.mode,vizzlyApiConfig:e.apiConfig,isProgrammaticParent:a.isProgrammaticParent,globalLibraries:o.globalLibraries,reports:s,updateScheduledReport:u}:null}({dashboardId:e.dashboardId,parentDashboardId:e.parentDashboardId,queryEngine:e.queryEngineConfig||e.queryEngineEndpoint,identityCallback:e.identity,loadDataSetsCallback:e.dataSets,apiConfig:d,implementationMeta:u,programmaticDashboard:e.parentDashboard,textOverride:f,isEditor:e.isEditor});!function(e,n){var i;t.useEffect((function(){var t;e&&"dashboard"in e&&null!=e&&null!=(t=e.dashboard)&&t.id&&(null==n||n({id:e.dashboard.id,metadata:e.dashboard.metadata,scope:e.scope,dataSets:e.dashboard.dataSets}))}),[JSON.stringify({loaded:!!e,dashboardId:e&&"dashboard"in e&&(null==e||null==(i=e.dashboard)?void 0:i.id)})])}(m,e.onDashboardLoad);var h=function(e,n){var i=t.useState({}),r=i[0],o=i[1],a=t.useState(),l=a[0],s=a[1];return t.useEffect((function(){var t=Qt(e);o(t)}),[JSON.stringify(e)]),Nu((function(t){if(t.variables){var n=ge({},Qt(e),t.variables);Ke("Updated variables",n),s(t.variables),o(n)}}),n),{variables:r,changes:l}}(e.variables,null!=(n=e.id)?n:"");if(null===m)return p.jsx(Nf,{override:e.renderLoadingComponent});if("error"in m)return p.jsx(pE,{renderLoadingComponent:e.renderLoadingComponent,implementationMeta:u,error:m.error});if(!m.dashboard)return p.jsx(Nf,{override:e.renderLoadingComponent});var v=function(){var e=me(Ce().mark((function e(t,n){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"read_write"==m.scope&&m.vizzly.updateDashboard({dashboardId:t.id,definition:hm(t),abortSignal:n});case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),g=function(){var e=me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===m||!("dashboard"in m)||null===m.dashboard){e.next=4;break}return t=_m(m.dashboard,m.vizzly.dashboards,m.dashboard.parentDashboardId),v(t),e.abrupt("return",t);case 4:return e.abrupt("return",null);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=(null==(i=m.identityConfig)||null==(i=i.queryEngineAccessConfig)?void 0:i.allowDatabaseSchemaAccess)&&"query-engine"==u.type,b=null!=(o=e.dateFilterOptions)?o:e.dateTimeFilterOptions,y=gO(m.identityConfig,m.queryEngineConfig,Tu(f,b),h.variables,e.runQueries,e.data,e.queryEngineEndpoint,e.timeZone),w=function(){var e=me(Ce().mark((function e(t,n,i){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.dashboard||!m.dashboard.permission){e.next=4;break}return e.next=3,c.aiActions(t,n,m.dashboard.permission.token,i);case 3:return e.abrupt("return",e.sent);case 4:throw"Dashboard has not yet been loaded.";case 5:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),C=function(){var e=me(Ce().mark((function e(t,n,i,r){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.dashboard||!m.dashboard.permission){e.next=4;break}return e.next=3,c.askAi(n,i,t,m.dashboard.permission.token,m.dashboard.dataSets,m.queryEngineConfig,r);case 3:return e.abrupt("return",e.sent);case 4:throw"Dashboard has not yet been loaded.";case 5:case"end":return e.stop()}}),e)})));return function(t,n,i,r){return e.apply(this,arguments)}}(),j=function(){var e=me(Ce().mark((function e(){return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.dashboard||!m.dashboard.permission){e.next=6;break}return e.next=3,c.askAiForQuestionSuggestions(m.dashboard.permission.token,m.dashboard.dataSets);case 3:return e.abrupt("return",e.sent.suggestions);case 6:throw"Dashboard has not yet been loaded.";case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return p.jsx(TO.Provider,{value:ge({},e,{onSave:v}),children:p.jsx(SI,{trackEvent:e.trackEvent,dashboardBehaviour:{id:e.id,isProgrammaticParent:m.isProgrammaticParent,mode:m.mode,scope:m.scope,dateFilterOptions:b,numberFormatOptions:null==e?void 0:e.numberFormatOptions,dateTimeFormatOptions:null==e?void 0:e.dateTimeFormatOptions,defaultFormats:e.defaultFormats,datePickerFormat:null==e?void 0:e.datePickerFormat,onEditorUpdate:null==e?void 0:e.onEditorUpdate,scheduledReports:m.reports,onScheduledReportChange:m.updateScheduledReport,reportScheduleOptions:e.reportScheduleOptions,dataPanel:e.dataPanel,formatPanel:e.formatPanel,maxCSVDownloadLimit:e.maxCSVDownloadLimit,textOverrides:e.textOverrides,developerTools:e.developerTools,dashboardFilters:e.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange,onSave:v,onOpenConfigManagerUi:x?function(){var e,t,n,i,r;x&&"query-engine"===u.type&&u.queryEngineEndpoint&&(window.location.href=(t=u.queryEngineEndpoint,(n=null==(e=m.identityConfig.queryEngineAccessConfig)?void 0:e.signature)?(i=JSON.stringify({queryEngineAccessToken:n,projectAccessToken:void 0}),r="object"==typeof window&&window&&window.btoa?window.btoa(i):Buffer.from(i).toString("base64"),vC(kC(t),"/sign-in#"+r)):""))}:void 0,organizationName:e.organizationName,featureToggles:e.featureToggles,customViews:e.customViews,componentOverrides:_j(e),queryEngineConfig:m.queryEngineConfig,disableToolbar:null==e?void 0:e.disableToolbar,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection,textOverride:f,pdfSettings:null==e?void 0:e.pdfSettings,labelFormat:null==e?void 0:e.labelFormat,filterLibrary:null==e?void 0:e.filterLibrary,nullValueAlias:null==e?void 0:e.nullValueAlias,valueAlias:null==e?void 0:e.valueAlias,variables:h},ai:{onAction:w,onAsk:C,fetchSuggestions:j},onDashboardUpdate:null==e?void 0:e.onDashboardUpdate,dashboard:m.dashboard,runQueriesCallback:y,implementationMeta:u,identityConfig:m.identityConfig,includeComponents:null==e?void 0:e.includeComponents,excludeComponents:null==e?void 0:e.excludeComponents,onReset:g,onError:null==e?void 0:e.onError,theme:e.theme,vizzlyApiConfig:d,onViewClick:null==e?void 0:e.onViewClick,renderTableCell:null==e?void 0:e.renderTableCell,editor:e.isEditor?{globalLibraries:m.globalLibraries}:void 0,saving:null!=(a=m.vizzly.saving)?a:xa.Undefined,children:null==e?void 0:e.children})})},hE=["view"],vE=function(e){return p.jsxs(ke,{renderOnError:function(){return p.jsx("p",{children:"Unexpected error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[p.jsx(va,{}),p.jsx(fE,ge({},e,{children:p.jsx(yI,{})}))]})},gE=function(e){var t=we(e,hE);return p.jsxs(ke,{renderOnError:function(){return p.jsx("p",{children:"Unexpected error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[p.jsx(va,{}),p.jsx(fE,ge({},t,{featureToggles:ge({},t.featureToggles,{disableAutoSave:!0}),parentDashboard:me(Ce().mark((function e(){var t;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new jO.Dashboard("vizzly_editor",{display:[new jO.Header("Editor")],customFields:{}}),e.abrupt("return",[t.build()]);case 2:case"end":return e.stop()}}),e)}))),isEditor:!0,children:p.jsx(SO,ge({},e))}))]})},xE={Dashboard:vE,Editor:gE,NewVizzlyImplementation:ga,displayPositions:Se,DataSetField:ma};exports.Dashboard=vE,exports.DataSetField=ma,exports.Editor=gE,exports.NewVizzlyImplementation=ga,exports.VizzlyState=wa,exports.VizzlyTheming=void 0,exports.default=xE,exports.displayPositions=Se,exports.useVizzly=DO,exports.vizzlyState=ya;
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./dashboard.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./dashboard.cjs.development.js')
8
+ }