@sisense/sdk-ui 1.34.0 → 1.35.0

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.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";var rf=Object.defineProperty,of=Object.defineProperties;var af=Object.getOwnPropertyDescriptors;var Nr=Object.getOwnPropertySymbols;var zi=Object.prototype.hasOwnProperty,qi=Object.prototype.propertyIsEnumerable;var ma=(e,r,t)=>r in e?rf(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,C=(e,r)=>{for(var t in r||(r={}))zi.call(r,t)&&ma(e,t,r[t]);if(Nr)for(var t of Nr(r))qi.call(r,t)&&ma(e,t,r[t]);return e},k=(e,r)=>of(e,af(r));var le=(e,r)=>{var t={};for(var n in e)zi.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Nr)for(var n of Nr(e))r.indexOf(n)<0&&qi.call(e,n)&&(t[n]=e[n]);return t};var V=(e,r,t)=>(ma(e,typeof r!="symbol"?r+"":r,t),t);var Te=(e,r,t)=>new Promise((n,o)=>{var a=u=>{try{l(t.next(u))}catch(c){o(c)}},i=u=>{try{l(t.throw(u))}catch(c){o(c)}},l=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,i);l((t=t.apply(e,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./use-common-filters-CqGo6jp3.cjs"),s=require("./derive-chart-family-C3FH49ux.cjs"),g=require("react"),se=require("react/jsx-runtime"),gs=require("react-dom");function Rc(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const Y=Rc(g),sf=Rc(gs);function Hn(e){return e.endsWith("/")?e:`${e}/`}const lf={errorPrefix:"[request-error]",errors:{networkError:"Network error. Check browser console for further details.",authFailed:"Failed to authenticate.",ssoNotEnabled:"SSO is not enabled on target instance, please choose another authentication method.",ssoNoLoginUrl:"Can not fetch login URL on target instance. Check SSO settings.",passwordAuthFailed:"$t(errorPrefix) Username and password authentication was not successful. Check credentials.",tokenAuthFailed:"$t(errorPrefix) Token authentication was not successful. Check credentials.",responseError_onlyStatus:"$t(errorPrefix) Status: {{status}}",responseError_withStatusText:"$t(errorPrefix) Status: {{status}} - {{statusText}}"}},cf={errorPrefix:"[request-error]",errors:{networkError:"Помилка мережі. Можливо ви забули додати свій домен до «CORS Allowed Origins» в панелі адміністратора Sisense -> Security Settings.",authFailed:"Автентифікація не вдалася.",ssoNotEnabled:"SSO не ввімкнено на цьому сервері, будь ласка, виберіть інший метод аутентифікації",ssoNoLoginUrl:"Неможливо отримати loginUrl з сервера. Перевірте налаштування SSO.",passwordAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою імені користувача та пароля. Перевірте дані для входу.",tokenAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою токена. Перевірте дані для входу.",responseError_onlyStatus:"$t(errorPrefix) Статус: {{status}}",responseError_withStatusText:"$t(errorPrefix) Статус: {{status}} - {{statusText}}"}},Lc="sdkRestClient",uf={en:lf,uk:cf};function df(){return s.initI18next({resource:uf,language:"en",namespace:Lc})}const{i18nextInstance:pf}=df();class vr{constructor(r){this._valid=!0,this._authenticating=!1,this._tried=!1,this._result=new Promise(t=>{this._resolve=t}),this.type=r}isValid(){return this._valid}invalidate(){this._valid=!1}authenticate(){return this._result}isAuthenticating(){return this._authenticating}authenticated(){return this._result}applyHeader(r){}}const Ao=(e,r)=>{for(const[t,n]of Object.entries(r))Array.isArray(e)?e.push([t,n]):typeof e.set=="function"?e.set(t,n):e[t]=n},Nc=(e,r)=>{if(!e||typeof e!="string")return e;const t=new URL(e);for(const[n,o]of Object.entries(r))t.searchParams.append(n,o);return t.toString().replace(/\/([?&])/,"$1")},ff=(e,r)=>e===null||r===null;class hf extends vr{constructor(r,t){super("bearer"),this.bearer=t,this._resolve(!0)}applyHeader(r){const t="Bearer "+this.bearer;Ao(r,{Authorization:t})}authenticate(){return this._result}authenticated(){return this._result}}function mf(e){return e.type==="bearer"}class gf extends vr{constructor(){super("fusion")}authenticate(){var r,t,n,o,a;const i=!!(!((t=(r=window.prism)===null||r===void 0?void 0:r.user)===null||t===void 0)&&t._id);this._resolve(i);const l=(a=(o=(n=window.document)===null||n===void 0?void 0:n.cookie)===null||o===void 0?void 0:o.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/))===null||a===void 0?void 0:a[1];return l&&(this.antiCsrfToken=l),this._result}applyHeader(r){this.antiCsrfToken&&Ao(r,{"X-Xsrf-Token":this.antiCsrfToken})}}let Wt=class extends s.AbstractTranslatableError{constructor(r,t){super(Lc,{key:r,interpolationOptions:t},pf.t)}get status(){return this.interpolationOptions.status}};var ga=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class yf extends vr{constructor(r,t=!1){super("sso"),this.url=Hn(r),this._enableSilentPreAuth=t}authenticate(r=!0){var t;return ga(this,void 0,void 0,function*(){try{this._authenticating=!0;const{isAuthenticated:n,loginUrl:o}=yield this.checkAuthentication();if(n)return this._resolve(!0),yield this._result;const a=Nc(o,{return_to:window.location.href});if(this._enableSilentPreAuth&&r){yield this.authenticateSilent(a);const{isAuthenticated:i}=yield this.checkAuthentication();if(i)return this._resolve(!0),yield this._result}(t=window==null?void 0:window.location)===null||t===void 0||t.replace(a)}finally{this._resolve(!1),this._authenticating=!1}return this._result})}authenticateSilent(r){return ga(this,void 0,void 0,function*(){const t=document.createElement("iframe");t.style.display="none",document.body.appendChild(t),t.src=r,yield new Promise(n=>{t.onload=()=>{n(!0)}}),document.body.removeChild(t)})}checkAuthentication(){var r,t;return ga(this,void 0,void 0,function*(){const n=`${this.url}api/auth/isauth`,o=yield fetch(n,{headers:{Internal:"true"},credentials:"include"}).catch(Fo);if(o.status===200&&!(!((t=(r=o.headers)===null||r===void 0?void 0:r.get("Content-Type"))===null||t===void 0)&&t.includes("application/json")))throw new Wt("errors.authFailed");const a=yield o.json();if(!a.isAuthenticated){if(!a.ssoEnabled)throw new Wt("errors.ssoNotEnabled");if(!a.loginUrl)throw new Wt("errors.ssoNoLoginUrl")}return{isAuthenticated:a.isAuthenticated,loginUrl:a.loginUrl||""}})}}function Ic(e){return e.type==="sso"}var bf=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class vf extends vr{constructor(r,t){super("wat"),this.url=`${Hn(r)}api/v1/wat/sessionToken`,this.body=`{"webAccessToken": "${t}"}`}authenticate(){return bf(this,void 0,void 0,function*(){if(this._tried)return this._result;this._tried=!0;try{this._authenticating=!0;const r=yield fetch(this.url,{method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:this.body}).catch(Fo);if(r.ok){const t=yield r.json();this._initialiser=t.initialiser,this._webSessionToken=t.webSessionToken,this._resolve(!0)}}catch(r){throw new Wt("errors.tokenAuthFailed")}finally{this._resolve(!1),this._authenticating=!1}return this._result})}applyHeader(r){if(this._webSessionToken&&this._initialiser){const t=this._webSessionToken,n=this._initialiser;Ao(r,{Authorization:t,Initialiser:n})}}}function jc(e){return e.type==="wat"}var Wc=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};function xf(e){var r,t,n;return Wc(this,void 0,void 0,function*(){if(!e.ok){const o=(r=e.headers)===null||r===void 0?void 0:r.get("Content-Type"),a=o&&o.includes("application/json")?yield e.json().catch(()=>({})):{};throw new Wt("errors.responseError",{status:e.status.toString(),statusText:e.statusText,errorCode:(t=a.error)===null||t===void 0?void 0:t.code,errorMessage:(n=a.error)===null||n===void 0?void 0:n.message,context:e.statusText?"withStatusText":"onlyStatus"})}return e})}function wf(e,r){if(r.invalidate(),_f(r))throw new Wt("errors.passwordAuthFailed");if(mf(r)||jc(r))throw new Wt("errors.tokenAuthFailed");return Ic(r)&&!r.isAuthenticating()&&r.authenticate(),e}function Cf(e){return e.message==="Failed to fetch"&&e.name==="TypeError"}function Tf(){return console.warn("Network error. Verify server is accessible and your domain is added to 'CORS Allowed Origins' in Sisense Admin Panel -> Security Settings."),Promise.reject(new Wt("errors.networkError"))}const Sf=e=>r=>Wc(void 0,void 0,void 0,function*(){return r.status===401?wf(r,e):r.ok?r:xf(r)}),Fo=e=>Cf(e)?Tf():Promise.reject(e);var Df=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class kf extends vr{constructor(r,t,n){super("password"),this._authheader="",this.url=`${Hn(r)}api/v1/authentication/login`;const o=encodeURIComponent(t),a=encodeURIComponent(n);this.body=`username=${o}&password=${a}`}authenticate(){return Df(this,void 0,void 0,function*(){if(this._tried)return this._result;this._tried=!0;try{this._authenticating=!0;const r=yield fetch(this.url,{method:"POST",headers:{accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:this.body}).catch(Fo);if(r.ok){const t=yield r.json();this._authheader=t.access_token}}finally{this._resolve(!!this._authheader),this._authenticating=!1}return this._result})}applyHeader(r){const t="Bearer "+this._authheader;Ao(r,{Authorization:t})}}function _f(e){return e.type==="password"}function Ef({url:e,username:r,password:t,token:n,wat:o,ssoEnabled:a=!1,enableSilentPreAuth:i=!1,useFusionAuth:l=!1}){const u=Hn(e);return a?new yf(u,i):r&&t?new kf(u,r,t):n?new hf(u,n):o?new vf(u,o):l?new gf:null}var Mf=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class Pf{constructor(r,t,n){this.url=Hn(r),this.auth=t,this.env=n}login(){return this.auth.authenticate()}call(r,t,n){return Mf(this,void 0,void 0,function*(){this.auth.isAuthenticating()&&(yield this.auth.authenticated()),t.headers=t.headers||{},Ic(this.auth)&&(t.credentials="include"),this.auth.applyHeader(t.headers);const o=n!=null&&n.skipTrackingParam?r:Nc(r,{trc:this.env}),a=yield fetch(o,t).then(Sf(this.auth)).catch(Fo);if(!(a.status===204||a.status===304))return n!=null&&n.returnBlob?a.blob():a.json().catch(i=>{var l,u;if(!(!((u=(l=i==null?void 0:i.message)===null||l===void 0?void 0:l.includes)===null||u===void 0)&&u.call(l,"Unexpected end of JSON input")))throw i})})}post(r,t,n={},o,a){const i=Object.assign({method:"POST",body:a!=null&&a.nonJSONBody?t:JSON.stringify(t),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:o},n);return this.call(this.url+r,i,a)}patch(r,t,n={},o,a){const i=Object.assign({method:"PATCH",body:a!=null&&a.nonJSONBody?t:JSON.stringify(t),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:o},n);return this.call(this.url+r,i,a)}get(r,t={},n){return this.call(this.url+r,Object.assign(Object.assign({},t),{method:"GET"}),n)}delete(r,t={},n){return this.call(this.url+r,Object.assign(Object.assign({},t),{method:"DELETE"}),n)}}const Of={errors:{invalidAttribute:"Invalid attribute {{attributeName}}. Hint: attributes for query should be extracted from the data model generated by the CLI tool.",noDimensionsOrMeasures:"Neither dimensions nor measures found. Query should have at least one dimension or measure.",invalidMeasure:'Invalid measure "{{measureName}}". Hint: measures for the query can be constructed using the "measureFactory" functions.',invalidFilter:'Invalid filter "{{filterName}}". Hint: filters for the query can be constructed using the "filterFactory" functions.',invalidHighlight:'Invalid highlight "{{highlightName}}". Hint: highlights for the query can be constructed using the "filterFactory" functions.',invalidCountNegative:'Invalid count "{{count}}". Count should be non-negative.',invalidOffset:'Invalid offset "{{offset}}". Offset should be non-negative.',missingHttpClient:"Query requires httpClient to work properly.",missingPostMethod:'httpClient must provide "post" method.',noJaqlResponse:"No jaql response received from the server",dataSourceNotFound:'Failed to get fields for data source "{{dataSource}}". Please make sure the data source exists and is accessible.'}},Af={errors:{invalidAttribute:"Недійсний атрибут {{attributeName}}. Підказка: атрибути для запиту повинні бути витягнуті з моделі даних, створеної за допомогою CLI-інструменту.",noDimensionsOrMeasures:"Не знайдено ні вимірів, ні показників. Запит повинен мати щонайменше один вимір або показник.",invalidMeasure:'Недійсний показник "{{measureName}}". Підказка: показники для запиту можна створити за допомогою функцій "measureFactory".',invalidFilter:'Недійсний фільтр "{{filterName}}". Підказка: фільтри для запиту можна створити за допомогою функцій "filterFactory".',invalidHighlight:'Недійсне виділення "{{highlightName}}". Підказка: виділення для запиту можна створити за допомогою функцій "filterFactory".',invalidCountNegative:`Недійсний count "{{count}}". Count повинен бути не від'ємним.`,invalidOffset:`Недійсний offset "{{offset}}". Offset повинен бути не від'ємним.`,missingHttpClient:"Для запиту потрібен httpClient, щоб працювати належним чином.",missingPostMethod:'httpClient повинен мати метод "post".',noJaqlResponse:"Відповіді, що містить jaql, від сервера не отримано",dataSourceNotFound:'Не вдалося отримати поля для джерела даних "{{dataSource}}". Переконайтесь що джерело існує і доступне.'}},Bc="sdkQueryClient",Ff={en:Of,uk:Af};function Rf(){return s.initI18next({resource:Ff,language:"en",namespace:Bc})}const{i18nextInstance:Lf}=Rf();class lr extends s.DimensionalElement{constructor(r,t,n,o,a,i,l,u){super(r,a||s.MetadataTypes.Dimension,i,u),this._dimensions=[],this._attributes=[],this._sort=s.Sort.None,this._sort=l||s.Sort.None,this._expression=t,this.setDimensions(o||[]),this.setAttributes(n)}static parseType(r){switch(r){case"datetime":case s.MetadataTypes.DateDimension:return s.MetadataTypes.DateDimension;case"text":case s.MetadataTypes.TextDimension:return s.MetadataTypes.TextDimension;case"numeric":case s.MetadataTypes.NumericDimension:return s.MetadataTypes.NumericDimension}return s.MetadataTypes.TextDimension}getAttachedName(r,t){let n=r;const o=s.normalizeName(r);return(o==="id"||o==="name"||Object.getOwnPropertyDescriptor(this,o)!==void 0||this[o]!==void 0)&&(n=t),n}setDimensions(r){this._dimensions=r;for(let t=0;t<r.length;t++){const n=this.getAttachedName(r[t].name,r[t].attributes[0].expression);this[s.normalizeName(n)]=r[t],n!=r[t].name&&(r[t].name=n)}}setAttributes(r){this._attributes=r||[];for(let t=0;t<r.length;t++){const n=this.getAttachedName(r[t].name,r[t].expression);this[s.normalizeName(n)]=r[t],r[t].name!=n&&(r[t].name=n)}}get id(){return this._expression}get attributes(){return this._attributes}get dimensions(){return this._dimensions}get expression(){return this._expression}getSort(){return this._sort}sort(r){return new lr(this.name,this.expression,this.attributes,this.dimensions,this.type,this.description,r,this.dataSource)}serializable(){const r=super.serializable();return r.expression=this.expression,this.getSort()!==void 0&&(r.sort=this.getSort()),r.attributes=this._attributes.map(t=>t.serializable()),r.diemsnions=this._dimensions.map(t=>t.serializable()),this.defaultAttribute&&(r.defaultAttribute=this.defaultAttribute.serializable()),r}jaql(r){if(this.defaultAttribute)return this.defaultAttribute.jaql(r);if(this.dimensions.length>0)return this.dimensions[0].jaql(r);const t={jaql:{title:this.name,dim:this.expression,datatype:s.jaqlSimpleColumnType(this.type)}};return this._sort!=s.Sort.None&&(t.jaql.sort=this._sort==s.Sort.Ascending?"asc":"desc"),r===!0?t.jaql:t}}class Ro extends lr{constructor(r,t,n,o,a){super(r,t,[],[],s.MetadataTypes.DateDimension,n,o,a),this.defaultLevel=s.DateLevels.Years,this.Years=new s.DimensionalLevelAttribute(s.DateLevels.Years,t,s.DateLevels.Years,"yyyy",n,o,a),this.Quarters=new s.DimensionalLevelAttribute(s.DateLevels.Quarters,t,s.DateLevels.Quarters,"Q yyyy",n,o,a),this.Months=new s.DimensionalLevelAttribute(s.DateLevels.Months,t,s.DateLevels.Months,"yyyy-MM",n,o,a),this.Weeks=new s.DimensionalLevelAttribute(s.DateLevels.Weeks,t,s.DateLevels.Weeks,"ww yyyy",n,o,a),this.Days=new s.DimensionalLevelAttribute(s.DateLevels.Days,t,s.DateLevels.Days,"yyyy-MM-dd",n,o,a),this.Hours=new s.DimensionalLevelAttribute(s.DateLevels.Hours,t,s.DateLevels.Hours,"yyyy-MM-dd HH:mm",n,o,a),this.MinutesRoundTo30=new s.DimensionalLevelAttribute(s.DateLevels.MinutesRoundTo30,t,s.DateLevels.MinutesRoundTo30,"yyyy-MM-dd HH:mm",n,o,a),this.MinutesRoundTo15=new s.DimensionalLevelAttribute(s.DateLevels.MinutesRoundTo15,t,s.DateLevels.MinutesRoundTo15,"yyyy-MM-dd HH:mm",n,o,a),this.Minutes=new s.DimensionalLevelAttribute(s.DateLevels.Minutes,t,s.DateLevels.Minutes,"yyyy-MM-dd HH:mm",n,o,a),this.Seconds=new s.DimensionalLevelAttribute(s.DateLevels.Seconds,t,s.DateLevels.Seconds,"yyyy-MM-dd HH:mm:ss",n,o,a),this.AggHours=new s.DimensionalLevelAttribute(s.DateLevels.AggHours,t,s.DateLevels.AggHours,"HH:mm",n,o,a),this.AggMinutesRoundTo30=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo30,t,s.DateLevels.AggMinutesRoundTo30,"HH:mm",n,o,a),this.AggMinutesRoundTo15=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo15,t,s.DateLevels.AggMinutesRoundTo15,"HH:mm",n,o,a),this.AggMinutesRoundTo1=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo1,t,s.DateLevels.AggMinutesRoundTo1,"HH:mm",n,o,a),this.setAttributes([this.Years,this.Quarters,this.Months,this.Weeks,this.Days,this.Hours,this.MinutesRoundTo30,this.MinutesRoundTo15,this.Minutes,this.Seconds,this.AggHours,this.AggMinutesRoundTo30,this.AggMinutesRoundTo15,this.AggMinutesRoundTo1])}get id(){return this.expression}setDimensions(){}setAttributes(r){this._attributes=r}getSort(){return this._sort}sort(r){return new Ro(this.name,this.expression,this.description,r,this.dataSource)}serializable(){const r=super.serializable();return this.defaultLevel&&(r.defaultLevel=this.defaultLevel),r}jaql(r){const t=this[this.defaultLevel].jaql();return t.jaql.title=this.name,r?t.jaql:t}}function Hc(e){const r=e.name||e.title,t=e.desc||e.description,n=e.expression||e.dim,o=lr.parseType(e.dimtype||e.type),a=e.sort,i=e.dataSource;if(o==s.MetadataTypes.DateDimension)return new Ro(r,n,t,a,i);const l=Object.getOwnPropertyNames(e).map(d=>e[d]).filter(d=>s.MetadataTypes.isAttribute(d.type));if(l.length==0)if(e.attributes){let d;for(let f=0;f<e.attributes.length;f++)d=e.attributes[f],l.push(new s.DimensionalAttribute(d.name,d.expression,d.type,d.description,d.sort,d.dataSource))}else n&&l.push(new s.DimensionalAttribute(r,n,o,t,a,i));const u=Object.getOwnPropertyNames(e).map(d=>e[d]).filter(d=>s.MetadataTypes.isDimension(d.type));if(u.length==0&&e.dimensions)for(let d=0;d<e.dimensions.length;d++)u.push(Hc(e.dimensions[d]));const c=new lr(r,n,l,u,o,t,a,i);return e.defaultAttribute&&(c.defaultAttribute=l.find(d=>d.name===e.defaultAttribute)),c}function Nf(e){const r=e.name||e.title,t=e.expression||e.dim,n=e.desc||e.description,o=e.sort,a=e.dataSource;return new Ro(r,t,n,o,a)}function If(e,r){const t=e.map(o=>jf(o,r)),n=Wf(t);return Object.values(n).map(o=>Hc(o))}const jf=(e,r)=>{const t=e.table,n=e.tableTitle||t,o=e.id,a=e.title||o,i=s.isDataSourceInfo(r)?r:{title:r,live:!1},l=e.dimtype==="datetime"?Nf({name:a,expression:o,dataSource:i}):s.createAttribute({name:a,type:e.dimtype==="text"?"text-attribute":"numeric-attribute",expression:o,dataSource:i});return{dimension:{id:t,name:n},attribute:l}},Wf=e=>e.reduce((r,{dimension:t,attribute:n})=>{const o=r[t.name]||{name:t.name,expression:t.id};return Object.assign(Object.assign({},r),{[t.name]:Object.assign(Object.assign({},o),{[n.name]:n})})},{}),Yc=e=>{if(e!==void 0)return`${e}`},$c=e=>{if(e!==void 0)return new Date(e).toISOString()},ys=()=>!1;function Qi(e,r){const t=r.filter;return"or"in t?n=>t.or.map(o=>e(Object.assign(Object.assign({},r),{filter:o}))).reduce((o,a)=>o||a(n),!1):"and"in t?n=>t.and.map(o=>e(Object.assign(Object.assign({},r),{filter:o}))).reduce((o,a)=>o&&a(n),!0):e(r)}function Bf(e){const{datatype:r}=e,t=e.filter,n=r==="datetime"?$c:Yc;return o=>{const a=t.members.map(n),i=n(o);return a.includes(i)}}function Hf(e){const{datatype:r}=e,t=e.filter,n=r==="datetime"?$c:Yc;return o=>{var a,i;const l=((i=(a=t.exclude)===null||a===void 0?void 0:a.members)===null||i===void 0?void 0:i.map(n))||[],u=n(o);return!l.includes(u)}}function Yf(e){const r=e.filter,t=s.getSelectedConditionOption(r);return t===s.ConditionFilterType.STARTS_WITH?n=>new RegExp(`^${r.startsWith}`,"i").test(n):t===s.ConditionFilterType.ENDS_WITH?n=>new RegExp(`${r.endsWith}$`,"i").test(n):t===s.ConditionFilterType.CONTAINS?n=>new RegExp(r.contains,"i").test(n):t===s.ConditionFilterType.EQUALS?n=>n.localeCompare(r.equals,void 0,{sensitivity:"base"})===0:t===s.ConditionFilterType.DOESNT_START_WITH?n=>!new RegExp(`^${r.doesntStartWith}`,"i").test(n):t===s.ConditionFilterType.DOESNT_END_WITH?n=>!new RegExp(`${r.doesntEndWith}$`,"i").test(n):t===s.ConditionFilterType.DOESNT_CONTAIN?n=>!new RegExp(r.doesntContain,"i").test(n):t===s.ConditionFilterType.DOESNT_EQUAL?n=>n.localeCompare(r.doesntEqual,void 0,{sensitivity:"base"})!==0:ys}function $f(e){const r=e.filter,t=s.getSelectedConditionOption(r);return t===s.ConditionFilterType.EQUALS?n=>Number(r.equals)===Number(n):t===s.ConditionFilterType.DOESNT_EQUAL?n=>Number(r.doesntEqual)!==Number(n):t===s.ConditionFilterType.LESS_THAN?n=>Number(n)<Number(r.toNotEqual):t===s.ConditionFilterType.GREATER_THAN?n=>Number(n)>Number(r.fromNotEqual):t===s.ConditionFilterType.BETWEEN?n=>Number(r.to)>=Number(n)&&Number(n)>=Number(r.from):t===s.ConditionFilterType.GREATER_THAN_OR_EQUAL?n=>Number(n)>=Number(r.from):t===s.ConditionFilterType.LESS_THAN_OR_EQUAL?n=>Number(r.to)>=Number(n):ys}function Uf(e){const r=e,{datatype:t}=r,n=r.filter;return s.isSpecificItemsFilter(n)?Bf(r):s.isConditionFilter(n)&&s.getSelectedConditionOption(n)===s.ConditionFilterType.IS_NOT?Hf(r):t==="text"?Qi(Yf,r):t==="numeric"?Qi($f,r):ys}function Vf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=[...t,e],a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return[...r||[],e]}}function zf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=[...t,...e],a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return[...r||[],...e]}}function qf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=t.filter(i=>i.config.guid!==e.config.guid),a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return(r||[]).filter(t=>t.config.guid!==e.config.guid)}}function Qf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=t.filter(i=>!e.some(l=>i.config.guid===l.config.guid)),a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return(r||[]).filter(t=>!e.some(n=>t.config.guid===n.config.guid))}}function Gf(e,r){return t=>{if(p.isFilterRelations(t)){const{filters:n,relations:o}=p.splitFiltersAndRelations(t),a=n.map(l=>l.config.guid===e.config.guid?r:l),i=p.getRelationsWithReplacedFilter(o,e,r);return p.combineFiltersAndRelations(a,i)}return(t||[]).map(n=>n.config.guid===e.config.guid?r:n)}}var Ge={},Uc={},Lo={},bs={};(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(o,a,i,l){function u(c){return c instanceof i?c:new i(function(d){d(c)})}return new(i||(i=Promise))(function(c,d){function f(y){try{m(l.next(y))}catch(b){d(b)}}function h(y){try{m(l.throw(y))}catch(b){d(b)}}function m(y){y.done?c(y.value):u(y.value).then(f,h)}m((l=l.apply(o,a||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Task=e.ExecutionResultStatus=void 0;var t;(function(o){o.SUCCESS="SUCCESS",o.ERROR="ERROR"})(t=e.ExecutionResultStatus||(e.ExecutionResultStatus={}));class n{constructor(a,i,l){this.steps=a,this.passport=i,this.addons=l,this.statistics={startTime:new Date,steps:[],runtimeInfo:{}},this.currentStep=void 0}run(a){return r(this,void 0,void 0,function*(){let i=a,l;for(let c=0;c<this.steps.length;c+=1){this.currentStep=this.steps[c];const{resultValue:d,info:f}=yield this.currentStep.run(this,i);if(this.statistics.steps.push(f),f.success)i=d;else{l=f.error;break}}const u=this.statistics.steps.length===this.steps.length&&this.statistics.steps.every(c=>c.success);return this.statistics.endTime=new Date,{status:u?t.SUCCESS:t.ERROR,error:l,result:u?i:void 0,statistics:this.statistics}})}cancel(a){var i;return r(this,void 0,void 0,function*(){yield(i=this.currentStep)===null||i===void 0?void 0:i.cancel(this,a)})}addRuntimeInfo(a,i){this.statistics.runtimeInfo[a]=i}emitAddonEvent(a,...i){var l;const u=a.split("."),c=u[0],d=u[1],f=(l=this.addons)===null||l===void 0?void 0:l.find(m=>m.addonName===c),h=(f==null?void 0:f.events)[d];h(...i)}}e.Task=n})(bs);var ya=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.AbstractTaskManager=void 0;const Kf=bs;class Xf{constructor(r){this.runningTasks=new Map,this.addons=r||[]}runTask(r){return ya(this,void 0,void 0,function*(){const{taskId:t}=r.passport;this.runningTasks.set(t,r);const n=yield r.run();return this.runningTasks.delete(t),n})}createFlow(r){return t=>ya(this,void 0,void 0,function*(){const n=new Kf.Task(r,t,this.addons);return this.runTask(n)})}cancel(r,t){return ya(this,void 0,void 0,function*(){const n=this.runningTasks.get(r);n&&(yield n.cancel(t))})}}Lo.AbstractTaskManager=Xf;var No={},xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.TaskCanceledError=void 0;class Zf extends Error{constructor(r){const t=`Task was canceled due to: "${r}"`;super(t)}}xr.TaskCanceledError=Zf;var Gi=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};Object.defineProperty(No,"__esModule",{value:!0});No.Step=void 0;const Jf=xr;class eh{constructor(r,t,n){this.taskSelfResolvers=new Map,this.taskStepInfos=new Map,this.name=r,this.runLogic=t,this.cancelLogic=n}run(r,t){return Gi(this,void 0,void 0,function*(){return this.addStepInfo(r,{name:this.name}),new Promise(n=>{const o=new Date,a=(i,l)=>{const u=new Date,c=u.getTime()-o.getTime();this.addStepInfo(r,{startTime:o,endTime:u,duration:c}),this.addStepInfo(r,l?{success:!1,error:l}:{success:!0}),n({resultValue:i,info:this.getStepInfo(r)})};this.taskSelfResolvers.set(r,a),this.runLogic(r,t).then(i=>a(i)).finally(()=>{this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r)}).catch(i=>a(void 0,i))})})}cancel(r,t){return Gi(this,void 0,void 0,function*(){this.addStepInfo(r,{wasCanceled:!0,cancelingReason:t});const n=this.taskSelfResolvers.get(r);n==null||n(void 0,new Jf.TaskCanceledError(t)),this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r),yield this.cancelLogic(r,t)})}addStepInfo(r,t){const n=this.taskStepInfos.get(r)||{},o=Object.assign(Object.assign({},n),t);this.taskStepInfos.set(r,o)}getStepInfo(r){return this.taskStepInfos.get(r)}}No.Step=eh;var Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.Addon=void 0;class th{constructor(){this.events={}}}Io.Addon=th;var jo={},Ir,nh=new Uint8Array(16);function Vc(){if(!Ir&&(Ir=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ir))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ir(nh)}const rh=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Wo(e){return typeof e=="string"&&rh.test(e)}var Ae=[];for(var ba=0;ba<256;++ba)Ae.push((ba+256).toString(16).substr(1));function Bo(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(Ae[e[r+0]]+Ae[e[r+1]]+Ae[e[r+2]]+Ae[e[r+3]]+"-"+Ae[e[r+4]]+Ae[e[r+5]]+"-"+Ae[e[r+6]]+Ae[e[r+7]]+"-"+Ae[e[r+8]]+Ae[e[r+9]]+"-"+Ae[e[r+10]]+Ae[e[r+11]]+Ae[e[r+12]]+Ae[e[r+13]]+Ae[e[r+14]]+Ae[e[r+15]]).toLowerCase();if(!Wo(t))throw TypeError("Stringified UUID is invalid");return t}var Ki,va,xa=0,wa=0;function oh(e,r,t){var n=r&&t||0,o=r||new Array(16);e=e||{};var a=e.node||Ki,i=e.clockseq!==void 0?e.clockseq:va;if(a==null||i==null){var l=e.random||(e.rng||Vc)();a==null&&(a=Ki=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),i==null&&(i=va=(l[6]<<8|l[7])&16383)}var u=e.msecs!==void 0?e.msecs:Date.now(),c=e.nsecs!==void 0?e.nsecs:wa+1,d=u-xa+(c-wa)/1e4;if(d<0&&e.clockseq===void 0&&(i=i+1&16383),(d<0||u>xa)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");xa=u,wa=c,va=i,u+=122192928e5;var f=((u&268435455)*1e4+c)%4294967296;o[n++]=f>>>24&255,o[n++]=f>>>16&255,o[n++]=f>>>8&255,o[n++]=f&255;var h=u/4294967296*1e4&268435455;o[n++]=h>>>8&255,o[n++]=h&255,o[n++]=h>>>24&15|16,o[n++]=h>>>16&255,o[n++]=i>>>8|128,o[n++]=i&255;for(var m=0;m<6;++m)o[n+m]=a[m];return r||Bo(o)}function zc(e){if(!Wo(e))throw TypeError("Invalid UUID");var r,t=new Uint8Array(16);return t[0]=(r=parseInt(e.slice(0,8),16))>>>24,t[1]=r>>>16&255,t[2]=r>>>8&255,t[3]=r&255,t[4]=(r=parseInt(e.slice(9,13),16))>>>8,t[5]=r&255,t[6]=(r=parseInt(e.slice(14,18),16))>>>8,t[7]=r&255,t[8]=(r=parseInt(e.slice(19,23),16))>>>8,t[9]=r&255,t[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=r/4294967296&255,t[12]=r>>>24&255,t[13]=r>>>16&255,t[14]=r>>>8&255,t[15]=r&255,t}function ah(e){e=unescape(encodeURIComponent(e));for(var r=[],t=0;t<e.length;++t)r.push(e.charCodeAt(t));return r}var sh="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ih="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function qc(e,r,t){function n(o,a,i,l){if(typeof o=="string"&&(o=ah(o)),typeof a=="string"&&(a=zc(a)),a.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+o.length);if(u.set(a),u.set(o,a.length),u=t(u),u[6]=u[6]&15|r,u[8]=u[8]&63|128,i){l=l||0;for(var c=0;c<16;++c)i[l+c]=u[c];return i}return Bo(u)}try{n.name=e}catch(o){}return n.DNS=sh,n.URL=ih,n}function lh(e){if(typeof e=="string"){var r=unescape(encodeURIComponent(e));e=new Uint8Array(r.length);for(var t=0;t<r.length;++t)e[t]=r.charCodeAt(t)}return ch(uh(dh(e),e.length*8))}function ch(e){for(var r=[],t=e.length*32,n="0123456789abcdef",o=0;o<t;o+=8){var a=e[o>>5]>>>o%32&255,i=parseInt(n.charAt(a>>>4&15)+n.charAt(a&15),16);r.push(i)}return r}function Qc(e){return(e+64>>>9<<4)+14+1}function uh(e,r){e[r>>5]|=128<<r%32,e[Qc(r)-1]=r;for(var t=1732584193,n=-271733879,o=-1732584194,a=271733878,i=0;i<e.length;i+=16){var l=t,u=n,c=o,d=a;t=Le(t,n,o,a,e[i],7,-680876936),a=Le(a,t,n,o,e[i+1],12,-389564586),o=Le(o,a,t,n,e[i+2],17,606105819),n=Le(n,o,a,t,e[i+3],22,-1044525330),t=Le(t,n,o,a,e[i+4],7,-176418897),a=Le(a,t,n,o,e[i+5],12,1200080426),o=Le(o,a,t,n,e[i+6],17,-1473231341),n=Le(n,o,a,t,e[i+7],22,-45705983),t=Le(t,n,o,a,e[i+8],7,1770035416),a=Le(a,t,n,o,e[i+9],12,-1958414417),o=Le(o,a,t,n,e[i+10],17,-42063),n=Le(n,o,a,t,e[i+11],22,-1990404162),t=Le(t,n,o,a,e[i+12],7,1804603682),a=Le(a,t,n,o,e[i+13],12,-40341101),o=Le(o,a,t,n,e[i+14],17,-1502002290),n=Le(n,o,a,t,e[i+15],22,1236535329),t=Ne(t,n,o,a,e[i+1],5,-165796510),a=Ne(a,t,n,o,e[i+6],9,-1069501632),o=Ne(o,a,t,n,e[i+11],14,643717713),n=Ne(n,o,a,t,e[i],20,-373897302),t=Ne(t,n,o,a,e[i+5],5,-701558691),a=Ne(a,t,n,o,e[i+10],9,38016083),o=Ne(o,a,t,n,e[i+15],14,-660478335),n=Ne(n,o,a,t,e[i+4],20,-405537848),t=Ne(t,n,o,a,e[i+9],5,568446438),a=Ne(a,t,n,o,e[i+14],9,-1019803690),o=Ne(o,a,t,n,e[i+3],14,-187363961),n=Ne(n,o,a,t,e[i+8],20,1163531501),t=Ne(t,n,o,a,e[i+13],5,-1444681467),a=Ne(a,t,n,o,e[i+2],9,-51403784),o=Ne(o,a,t,n,e[i+7],14,1735328473),n=Ne(n,o,a,t,e[i+12],20,-1926607734),t=Ie(t,n,o,a,e[i+5],4,-378558),a=Ie(a,t,n,o,e[i+8],11,-2022574463),o=Ie(o,a,t,n,e[i+11],16,1839030562),n=Ie(n,o,a,t,e[i+14],23,-35309556),t=Ie(t,n,o,a,e[i+1],4,-1530992060),a=Ie(a,t,n,o,e[i+4],11,1272893353),o=Ie(o,a,t,n,e[i+7],16,-155497632),n=Ie(n,o,a,t,e[i+10],23,-1094730640),t=Ie(t,n,o,a,e[i+13],4,681279174),a=Ie(a,t,n,o,e[i],11,-358537222),o=Ie(o,a,t,n,e[i+3],16,-722521979),n=Ie(n,o,a,t,e[i+6],23,76029189),t=Ie(t,n,o,a,e[i+9],4,-640364487),a=Ie(a,t,n,o,e[i+12],11,-421815835),o=Ie(o,a,t,n,e[i+15],16,530742520),n=Ie(n,o,a,t,e[i+2],23,-995338651),t=je(t,n,o,a,e[i],6,-198630844),a=je(a,t,n,o,e[i+7],10,1126891415),o=je(o,a,t,n,e[i+14],15,-1416354905),n=je(n,o,a,t,e[i+5],21,-57434055),t=je(t,n,o,a,e[i+12],6,1700485571),a=je(a,t,n,o,e[i+3],10,-1894986606),o=je(o,a,t,n,e[i+10],15,-1051523),n=je(n,o,a,t,e[i+1],21,-2054922799),t=je(t,n,o,a,e[i+8],6,1873313359),a=je(a,t,n,o,e[i+15],10,-30611744),o=je(o,a,t,n,e[i+6],15,-1560198380),n=je(n,o,a,t,e[i+13],21,1309151649),t=je(t,n,o,a,e[i+4],6,-145523070),a=je(a,t,n,o,e[i+11],10,-1120210379),o=je(o,a,t,n,e[i+2],15,718787259),n=je(n,o,a,t,e[i+9],21,-343485551),t=Nt(t,l),n=Nt(n,u),o=Nt(o,c),a=Nt(a,d)}return[t,n,o,a]}function dh(e){if(e.length===0)return[];for(var r=e.length*8,t=new Uint32Array(Qc(r)),n=0;n<r;n+=8)t[n>>5]|=(e[n/8]&255)<<n%32;return t}function Nt(e,r){var t=(e&65535)+(r&65535),n=(e>>16)+(r>>16)+(t>>16);return n<<16|t&65535}function ph(e,r){return e<<r|e>>>32-r}function Ho(e,r,t,n,o,a){return Nt(ph(Nt(Nt(r,e),Nt(n,a)),o),t)}function Le(e,r,t,n,o,a,i){return Ho(r&t|~r&n,e,r,o,a,i)}function Ne(e,r,t,n,o,a,i){return Ho(r&n|t&~n,e,r,o,a,i)}function Ie(e,r,t,n,o,a,i){return Ho(r^t^n,e,r,o,a,i)}function je(e,r,t,n,o,a,i){return Ho(t^(r|~n),e,r,o,a,i)}var fh=qc("v3",48,lh);const hh=fh;function mh(e,r,t){e=e||{};var n=e.random||(e.rng||Vc)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){t=t||0;for(var o=0;o<16;++o)r[t+o]=n[o];return r}return Bo(n)}function gh(e,r,t,n){switch(e){case 0:return r&t^~r&n;case 1:return r^t^n;case 2:return r&t^r&n^t&n;case 3:return r^t^n}}function Ca(e,r){return e<<r|e>>>32-r}function yh(e){var r=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var o=0;o<n.length;++o)e.push(n.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,i=Math.ceil(a/16),l=new Array(i),u=0;u<i;++u){for(var c=new Uint32Array(16),d=0;d<16;++d)c[d]=e[u*64+d*4]<<24|e[u*64+d*4+1]<<16|e[u*64+d*4+2]<<8|e[u*64+d*4+3];l[u]=c}l[i-1][14]=(e.length-1)*8/Math.pow(2,32),l[i-1][14]=Math.floor(l[i-1][14]),l[i-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<i;++f){for(var h=new Uint32Array(80),m=0;m<16;++m)h[m]=l[f][m];for(var y=16;y<80;++y)h[y]=Ca(h[y-3]^h[y-8]^h[y-14]^h[y-16],1);for(var b=t[0],v=t[1],x=t[2],w=t[3],T=t[4],S=0;S<80;++S){var D=Math.floor(S/20),_=Ca(b,5)+gh(D,v,x,w)+T+r[D]+h[S]>>>0;T=w,w=x,x=Ca(v,30)>>>0,v=b,b=_}t[0]=t[0]+b>>>0,t[1]=t[1]+v>>>0,t[2]=t[2]+x>>>0,t[3]=t[3]+w>>>0,t[4]=t[4]+T>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var bh=qc("v5",80,yh);const vh=bh,xh="00000000-0000-0000-0000-000000000000";function wh(e){if(!Wo(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}const Ch=Object.freeze(Object.defineProperty({__proto__:null,NIL:xh,parse:zc,stringify:Bo,v1:oh,v3:hh,v4:mh,v5:vh,validate:Wo,version:wh},Symbol.toStringTag,{value:"Module"})),Th=s.getAugmentedNamespace(Ch);Object.defineProperty(jo,"__esModule",{value:!0});jo.TaskPassport=void 0;const Sh=Th;class Dh{constructor(){this.taskId=(0,Sh.v4)()}}jo.TaskPassport=Dh;(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__createBinding||(Object.create?function(n,o,a,i){i===void 0&&(i=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(n,i,l)}:function(n,o,a,i){i===void 0&&(i=a),n[i]=o[a]}),t=s.commonjsGlobal&&s.commonjsGlobal.__exportStar||function(n,o){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&r(o,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),t(Lo,e),t(No,e),t(bs,e),t(Io,e),t(jo,e),t(xr,e)})(Uc);(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__createBinding||(Object.create?function(n,o,a,i){i===void 0&&(i=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(n,i,l)}:function(n,o,a,i){i===void 0&&(i=a),n[i]=o[a]}),t=s.commonjsGlobal&&s.commonjsGlobal.__exportStar||function(n,o){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&r(o,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),t(Uc,e)})(Ge);class We extends s.AbstractTranslatableError{constructor(r,t){super(Bc,{key:r,interpolationOptions:t},Lf.t)}get status(){return this.interpolationOptions.status}}var kh=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};const cr="api/datasources",_h="api/v2/datamodels";class Eh{constructor(r){this.httpClient=r}getDataSourceFields(r,t=9999,n=0){const o=s.getDataSourceName(r),a=`${cr}/${encodeURI(o)}/fields/search`;return this.httpClient.post(a,{offset:n,count:t}).catch(()=>{throw new We("errors.dataSourceNotFound",{dataSource:typeof r=="string"?r:r.title})})}getDataSourceList(){const r=`${cr}/?sharedWith=r,w`;return this.httpClient.get(r)}getDataSourceSchema(r){const t=`${_h}/schema?title=${encodeURIComponent(r)}`;return this.httpClient.get(t)}sendJaqlRequest(r,t){const n=Gc(r),o=new AbortController;return{responsePromise:this.httpClient.post(n,t,void 0,o.signal).then(a=>Array.isArray(a)?{values:[],metadata:[]}:a),abortHttpRequest:a=>o.abort(a)}}sendDownloadCsvRequest(r,t){const n=Oh(r),o=new AbortController,a=new URLSearchParams;return a.append("data",encodeURIComponent(JSON.stringify(t))),{responsePromise:this.httpClient.post(n,a,{headers:{"Content-Type":"application/x-www-form-urlencoded"}},o.signal,{nonJSONBody:!0,returnBlob:!0}),abortHttpRequest:i=>o.abort(i)}}sendCancelJaqlQueryRequest(r,t){return this.sendCancelMultipleJaqlQueriesRequest([r],t)}sendCancelMultipleJaqlQueriesRequest(r,t){return kh(this,void 0,void 0,function*(){const n={queries:r.join(";")},o=Mh(t);try{yield this.httpClient.post(o,n)}catch(a){if(a.status==="404"){const i=Ph(t);yield this.httpClient.post(i,n)}else throw a}})}}function Mh(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/localhost/${r}/cancel_queries`}function Ph(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/live/${r}/cancel_queries`}function Gc(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/${r}/jaql`}function Oh(e){return`${Gc(e)}/csv`}var Kc={exports:{}};/*! @preserve
1
+ "use strict";var rf=Object.defineProperty,of=Object.defineProperties;var af=Object.getOwnPropertyDescriptors;var Nr=Object.getOwnPropertySymbols;var zi=Object.prototype.hasOwnProperty,qi=Object.prototype.propertyIsEnumerable;var ma=(e,r,t)=>r in e?rf(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,C=(e,r)=>{for(var t in r||(r={}))zi.call(r,t)&&ma(e,t,r[t]);if(Nr)for(var t of Nr(r))qi.call(r,t)&&ma(e,t,r[t]);return e},k=(e,r)=>of(e,af(r));var le=(e,r)=>{var t={};for(var n in e)zi.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Nr)for(var n of Nr(e))r.indexOf(n)<0&&qi.call(e,n)&&(t[n]=e[n]);return t};var V=(e,r,t)=>(ma(e,typeof r!="symbol"?r+"":r,t),t);var Te=(e,r,t)=>new Promise((n,o)=>{var a=u=>{try{l(t.next(u))}catch(c){o(c)}},i=u=>{try{l(t.throw(u))}catch(c){o(c)}},l=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,i);l((t=t.apply(e,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./use-common-filters-Dx4AeUoy.cjs"),s=require("./derive-chart-family-C3FH49ux.cjs"),g=require("react"),se=require("react/jsx-runtime"),gs=require("react-dom");function Rc(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const Y=Rc(g),sf=Rc(gs);function Hn(e){return e.endsWith("/")?e:`${e}/`}const lf={errorPrefix:"[request-error]",errors:{networkError:"Network error. Check browser console for further details.",authFailed:"Failed to authenticate.",ssoNotEnabled:"SSO is not enabled on target instance, please choose another authentication method.",ssoNoLoginUrl:"Can not fetch login URL on target instance. Check SSO settings.",passwordAuthFailed:"$t(errorPrefix) Username and password authentication was not successful. Check credentials.",tokenAuthFailed:"$t(errorPrefix) Token authentication was not successful. Check credentials.",responseError_onlyStatus:"$t(errorPrefix) Status: {{status}}",responseError_withStatusText:"$t(errorPrefix) Status: {{status}} - {{statusText}}"}},cf={errorPrefix:"[request-error]",errors:{networkError:"Помилка мережі. Можливо ви забули додати свій домен до «CORS Allowed Origins» в панелі адміністратора Sisense -> Security Settings.",authFailed:"Автентифікація не вдалася.",ssoNotEnabled:"SSO не ввімкнено на цьому сервері, будь ласка, виберіть інший метод аутентифікації",ssoNoLoginUrl:"Неможливо отримати loginUrl з сервера. Перевірте налаштування SSO.",passwordAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою імені користувача та пароля. Перевірте дані для входу.",tokenAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою токена. Перевірте дані для входу.",responseError_onlyStatus:"$t(errorPrefix) Статус: {{status}}",responseError_withStatusText:"$t(errorPrefix) Статус: {{status}} - {{statusText}}"}},Lc="sdkRestClient",uf={en:lf,uk:cf};function df(){return s.initI18next({resource:uf,language:"en",namespace:Lc})}const{i18nextInstance:pf}=df();class vr{constructor(r){this._valid=!0,this._authenticating=!1,this._tried=!1,this._result=new Promise(t=>{this._resolve=t}),this.type=r}isValid(){return this._valid}invalidate(){this._valid=!1}authenticate(){return this._result}isAuthenticating(){return this._authenticating}authenticated(){return this._result}applyHeader(r){}}const Ao=(e,r)=>{for(const[t,n]of Object.entries(r))Array.isArray(e)?e.push([t,n]):typeof e.set=="function"?e.set(t,n):e[t]=n},Nc=(e,r)=>{if(!e||typeof e!="string")return e;const t=new URL(e);for(const[n,o]of Object.entries(r))t.searchParams.append(n,o);return t.toString().replace(/\/([?&])/,"$1")},ff=(e,r)=>e===null||r===null;class hf extends vr{constructor(r,t){super("bearer"),this.bearer=t,this._resolve(!0)}applyHeader(r){const t="Bearer "+this.bearer;Ao(r,{Authorization:t})}authenticate(){return this._result}authenticated(){return this._result}}function mf(e){return e.type==="bearer"}class gf extends vr{constructor(){super("fusion")}authenticate(){var r,t,n,o,a;const i=!!(!((t=(r=window.prism)===null||r===void 0?void 0:r.user)===null||t===void 0)&&t._id);this._resolve(i);const l=(a=(o=(n=window.document)===null||n===void 0?void 0:n.cookie)===null||o===void 0?void 0:o.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/))===null||a===void 0?void 0:a[1];return l&&(this.antiCsrfToken=l),this._result}applyHeader(r){this.antiCsrfToken&&Ao(r,{"X-Xsrf-Token":this.antiCsrfToken})}}let Wt=class extends s.AbstractTranslatableError{constructor(r,t){super(Lc,{key:r,interpolationOptions:t},pf.t)}get status(){return this.interpolationOptions.status}};var ga=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class yf extends vr{constructor(r,t=!1){super("sso"),this.url=Hn(r),this._enableSilentPreAuth=t}authenticate(r=!0){var t;return ga(this,void 0,void 0,function*(){try{this._authenticating=!0;const{isAuthenticated:n,loginUrl:o}=yield this.checkAuthentication();if(n)return this._resolve(!0),yield this._result;const a=Nc(o,{return_to:window.location.href});if(this._enableSilentPreAuth&&r){yield this.authenticateSilent(a);const{isAuthenticated:i}=yield this.checkAuthentication();if(i)return this._resolve(!0),yield this._result}(t=window==null?void 0:window.location)===null||t===void 0||t.replace(a)}finally{this._resolve(!1),this._authenticating=!1}return this._result})}authenticateSilent(r){return ga(this,void 0,void 0,function*(){const t=document.createElement("iframe");t.style.display="none",document.body.appendChild(t),t.src=r,yield new Promise(n=>{t.onload=()=>{n(!0)}}),document.body.removeChild(t)})}checkAuthentication(){var r,t;return ga(this,void 0,void 0,function*(){const n=`${this.url}api/auth/isauth`,o=yield fetch(n,{headers:{Internal:"true"},credentials:"include"}).catch(Fo);if(o.status===200&&!(!((t=(r=o.headers)===null||r===void 0?void 0:r.get("Content-Type"))===null||t===void 0)&&t.includes("application/json")))throw new Wt("errors.authFailed");const a=yield o.json();if(!a.isAuthenticated){if(!a.ssoEnabled)throw new Wt("errors.ssoNotEnabled");if(!a.loginUrl)throw new Wt("errors.ssoNoLoginUrl")}return{isAuthenticated:a.isAuthenticated,loginUrl:a.loginUrl||""}})}}function Ic(e){return e.type==="sso"}var bf=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class vf extends vr{constructor(r,t){super("wat"),this.url=`${Hn(r)}api/v1/wat/sessionToken`,this.body=`{"webAccessToken": "${t}"}`}authenticate(){return bf(this,void 0,void 0,function*(){if(this._tried)return this._result;this._tried=!0;try{this._authenticating=!0;const r=yield fetch(this.url,{method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:this.body}).catch(Fo);if(r.ok){const t=yield r.json();this._initialiser=t.initialiser,this._webSessionToken=t.webSessionToken,this._resolve(!0)}}catch(r){throw new Wt("errors.tokenAuthFailed")}finally{this._resolve(!1),this._authenticating=!1}return this._result})}applyHeader(r){if(this._webSessionToken&&this._initialiser){const t=this._webSessionToken,n=this._initialiser;Ao(r,{Authorization:t,Initialiser:n})}}}function jc(e){return e.type==="wat"}var Wc=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};function xf(e){var r,t,n;return Wc(this,void 0,void 0,function*(){if(!e.ok){const o=(r=e.headers)===null||r===void 0?void 0:r.get("Content-Type"),a=o&&o.includes("application/json")?yield e.json().catch(()=>({})):{};throw new Wt("errors.responseError",{status:e.status.toString(),statusText:e.statusText,errorCode:(t=a.error)===null||t===void 0?void 0:t.code,errorMessage:(n=a.error)===null||n===void 0?void 0:n.message,context:e.statusText?"withStatusText":"onlyStatus"})}return e})}function wf(e,r){if(r.invalidate(),_f(r))throw new Wt("errors.passwordAuthFailed");if(mf(r)||jc(r))throw new Wt("errors.tokenAuthFailed");return Ic(r)&&!r.isAuthenticating()&&r.authenticate(),e}function Cf(e){return e.message==="Failed to fetch"&&e.name==="TypeError"}function Tf(){return console.warn("Network error. Verify server is accessible and your domain is added to 'CORS Allowed Origins' in Sisense Admin Panel -> Security Settings."),Promise.reject(new Wt("errors.networkError"))}const Sf=e=>r=>Wc(void 0,void 0,void 0,function*(){return r.status===401?wf(r,e):r.ok?r:xf(r)}),Fo=e=>Cf(e)?Tf():Promise.reject(e);var Df=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class kf extends vr{constructor(r,t,n){super("password"),this._authheader="",this.url=`${Hn(r)}api/v1/authentication/login`;const o=encodeURIComponent(t),a=encodeURIComponent(n);this.body=`username=${o}&password=${a}`}authenticate(){return Df(this,void 0,void 0,function*(){if(this._tried)return this._result;this._tried=!0;try{this._authenticating=!0;const r=yield fetch(this.url,{method:"POST",headers:{accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:this.body}).catch(Fo);if(r.ok){const t=yield r.json();this._authheader=t.access_token}}finally{this._resolve(!!this._authheader),this._authenticating=!1}return this._result})}applyHeader(r){const t="Bearer "+this._authheader;Ao(r,{Authorization:t})}}function _f(e){return e.type==="password"}function Ef({url:e,username:r,password:t,token:n,wat:o,ssoEnabled:a=!1,enableSilentPreAuth:i=!1,useFusionAuth:l=!1}){const u=Hn(e);return a?new yf(u,i):r&&t?new kf(u,r,t):n?new hf(u,n):o?new vf(u,o):l?new gf:null}var Mf=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class Pf{constructor(r,t,n){this.url=Hn(r),this.auth=t,this.env=n}login(){return this.auth.authenticate()}call(r,t,n){return Mf(this,void 0,void 0,function*(){this.auth.isAuthenticating()&&(yield this.auth.authenticated()),t.headers=t.headers||{},Ic(this.auth)&&(t.credentials="include"),this.auth.applyHeader(t.headers);const o=n!=null&&n.skipTrackingParam?r:Nc(r,{trc:this.env}),a=yield fetch(o,t).then(Sf(this.auth)).catch(Fo);if(!(a.status===204||a.status===304))return n!=null&&n.returnBlob?a.blob():a.json().catch(i=>{var l,u;if(!(!((u=(l=i==null?void 0:i.message)===null||l===void 0?void 0:l.includes)===null||u===void 0)&&u.call(l,"Unexpected end of JSON input")))throw i})})}post(r,t,n={},o,a){const i=Object.assign({method:"POST",body:a!=null&&a.nonJSONBody?t:JSON.stringify(t),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:o},n);return this.call(this.url+r,i,a)}patch(r,t,n={},o,a){const i=Object.assign({method:"PATCH",body:a!=null&&a.nonJSONBody?t:JSON.stringify(t),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:o},n);return this.call(this.url+r,i,a)}get(r,t={},n){return this.call(this.url+r,Object.assign(Object.assign({},t),{method:"GET"}),n)}delete(r,t={},n){return this.call(this.url+r,Object.assign(Object.assign({},t),{method:"DELETE"}),n)}}const Of={errors:{invalidAttribute:"Invalid attribute {{attributeName}}. Hint: attributes for query should be extracted from the data model generated by the CLI tool.",noDimensionsOrMeasures:"Neither dimensions nor measures found. Query should have at least one dimension or measure.",invalidMeasure:'Invalid measure "{{measureName}}". Hint: measures for the query can be constructed using the "measureFactory" functions.',invalidFilter:'Invalid filter "{{filterName}}". Hint: filters for the query can be constructed using the "filterFactory" functions.',invalidHighlight:'Invalid highlight "{{highlightName}}". Hint: highlights for the query can be constructed using the "filterFactory" functions.',invalidCountNegative:'Invalid count "{{count}}". Count should be non-negative.',invalidOffset:'Invalid offset "{{offset}}". Offset should be non-negative.',missingHttpClient:"Query requires httpClient to work properly.",missingPostMethod:'httpClient must provide "post" method.',noJaqlResponse:"No jaql response received from the server",dataSourceNotFound:'Failed to get fields for data source "{{dataSource}}". Please make sure the data source exists and is accessible.'}},Af={errors:{invalidAttribute:"Недійсний атрибут {{attributeName}}. Підказка: атрибути для запиту повинні бути витягнуті з моделі даних, створеної за допомогою CLI-інструменту.",noDimensionsOrMeasures:"Не знайдено ні вимірів, ні показників. Запит повинен мати щонайменше один вимір або показник.",invalidMeasure:'Недійсний показник "{{measureName}}". Підказка: показники для запиту можна створити за допомогою функцій "measureFactory".',invalidFilter:'Недійсний фільтр "{{filterName}}". Підказка: фільтри для запиту можна створити за допомогою функцій "filterFactory".',invalidHighlight:'Недійсне виділення "{{highlightName}}". Підказка: виділення для запиту можна створити за допомогою функцій "filterFactory".',invalidCountNegative:`Недійсний count "{{count}}". Count повинен бути не від'ємним.`,invalidOffset:`Недійсний offset "{{offset}}". Offset повинен бути не від'ємним.`,missingHttpClient:"Для запиту потрібен httpClient, щоб працювати належним чином.",missingPostMethod:'httpClient повинен мати метод "post".',noJaqlResponse:"Відповіді, що містить jaql, від сервера не отримано",dataSourceNotFound:'Не вдалося отримати поля для джерела даних "{{dataSource}}". Переконайтесь що джерело існує і доступне.'}},Bc="sdkQueryClient",Ff={en:Of,uk:Af};function Rf(){return s.initI18next({resource:Ff,language:"en",namespace:Bc})}const{i18nextInstance:Lf}=Rf();class lr extends s.DimensionalElement{constructor(r,t,n,o,a,i,l,u){super(r,a||s.MetadataTypes.Dimension,i,u),this._dimensions=[],this._attributes=[],this._sort=s.Sort.None,this._sort=l||s.Sort.None,this._expression=t,this.setDimensions(o||[]),this.setAttributes(n)}static parseType(r){switch(r){case"datetime":case s.MetadataTypes.DateDimension:return s.MetadataTypes.DateDimension;case"text":case s.MetadataTypes.TextDimension:return s.MetadataTypes.TextDimension;case"numeric":case s.MetadataTypes.NumericDimension:return s.MetadataTypes.NumericDimension}return s.MetadataTypes.TextDimension}getAttachedName(r,t){let n=r;const o=s.normalizeName(r);return(o==="id"||o==="name"||Object.getOwnPropertyDescriptor(this,o)!==void 0||this[o]!==void 0)&&(n=t),n}setDimensions(r){this._dimensions=r;for(let t=0;t<r.length;t++){const n=this.getAttachedName(r[t].name,r[t].attributes[0].expression);this[s.normalizeName(n)]=r[t],n!=r[t].name&&(r[t].name=n)}}setAttributes(r){this._attributes=r||[];for(let t=0;t<r.length;t++){const n=this.getAttachedName(r[t].name,r[t].expression);this[s.normalizeName(n)]=r[t],r[t].name!=n&&(r[t].name=n)}}get id(){return this._expression}get attributes(){return this._attributes}get dimensions(){return this._dimensions}get expression(){return this._expression}getSort(){return this._sort}sort(r){return new lr(this.name,this.expression,this.attributes,this.dimensions,this.type,this.description,r,this.dataSource)}serializable(){const r=super.serializable();return r.expression=this.expression,this.getSort()!==void 0&&(r.sort=this.getSort()),r.attributes=this._attributes.map(t=>t.serializable()),r.diemsnions=this._dimensions.map(t=>t.serializable()),this.defaultAttribute&&(r.defaultAttribute=this.defaultAttribute.serializable()),r}jaql(r){if(this.defaultAttribute)return this.defaultAttribute.jaql(r);if(this.dimensions.length>0)return this.dimensions[0].jaql(r);const t={jaql:{title:this.name,dim:this.expression,datatype:s.jaqlSimpleColumnType(this.type)}};return this._sort!=s.Sort.None&&(t.jaql.sort=this._sort==s.Sort.Ascending?"asc":"desc"),r===!0?t.jaql:t}}class Ro extends lr{constructor(r,t,n,o,a){super(r,t,[],[],s.MetadataTypes.DateDimension,n,o,a),this.defaultLevel=s.DateLevels.Years,this.Years=new s.DimensionalLevelAttribute(s.DateLevels.Years,t,s.DateLevels.Years,"yyyy",n,o,a),this.Quarters=new s.DimensionalLevelAttribute(s.DateLevels.Quarters,t,s.DateLevels.Quarters,"Q yyyy",n,o,a),this.Months=new s.DimensionalLevelAttribute(s.DateLevels.Months,t,s.DateLevels.Months,"yyyy-MM",n,o,a),this.Weeks=new s.DimensionalLevelAttribute(s.DateLevels.Weeks,t,s.DateLevels.Weeks,"ww yyyy",n,o,a),this.Days=new s.DimensionalLevelAttribute(s.DateLevels.Days,t,s.DateLevels.Days,"yyyy-MM-dd",n,o,a),this.Hours=new s.DimensionalLevelAttribute(s.DateLevels.Hours,t,s.DateLevels.Hours,"yyyy-MM-dd HH:mm",n,o,a),this.MinutesRoundTo30=new s.DimensionalLevelAttribute(s.DateLevels.MinutesRoundTo30,t,s.DateLevels.MinutesRoundTo30,"yyyy-MM-dd HH:mm",n,o,a),this.MinutesRoundTo15=new s.DimensionalLevelAttribute(s.DateLevels.MinutesRoundTo15,t,s.DateLevels.MinutesRoundTo15,"yyyy-MM-dd HH:mm",n,o,a),this.Minutes=new s.DimensionalLevelAttribute(s.DateLevels.Minutes,t,s.DateLevels.Minutes,"yyyy-MM-dd HH:mm",n,o,a),this.Seconds=new s.DimensionalLevelAttribute(s.DateLevels.Seconds,t,s.DateLevels.Seconds,"yyyy-MM-dd HH:mm:ss",n,o,a),this.AggHours=new s.DimensionalLevelAttribute(s.DateLevels.AggHours,t,s.DateLevels.AggHours,"HH:mm",n,o,a),this.AggMinutesRoundTo30=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo30,t,s.DateLevels.AggMinutesRoundTo30,"HH:mm",n,o,a),this.AggMinutesRoundTo15=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo15,t,s.DateLevels.AggMinutesRoundTo15,"HH:mm",n,o,a),this.AggMinutesRoundTo1=new s.DimensionalLevelAttribute(s.DateLevels.AggMinutesRoundTo1,t,s.DateLevels.AggMinutesRoundTo1,"HH:mm",n,o,a),this.setAttributes([this.Years,this.Quarters,this.Months,this.Weeks,this.Days,this.Hours,this.MinutesRoundTo30,this.MinutesRoundTo15,this.Minutes,this.Seconds,this.AggHours,this.AggMinutesRoundTo30,this.AggMinutesRoundTo15,this.AggMinutesRoundTo1])}get id(){return this.expression}setDimensions(){}setAttributes(r){this._attributes=r}getSort(){return this._sort}sort(r){return new Ro(this.name,this.expression,this.description,r,this.dataSource)}serializable(){const r=super.serializable();return this.defaultLevel&&(r.defaultLevel=this.defaultLevel),r}jaql(r){const t=this[this.defaultLevel].jaql();return t.jaql.title=this.name,r?t.jaql:t}}function Hc(e){const r=e.name||e.title,t=e.desc||e.description,n=e.expression||e.dim,o=lr.parseType(e.dimtype||e.type),a=e.sort,i=e.dataSource;if(o==s.MetadataTypes.DateDimension)return new Ro(r,n,t,a,i);const l=Object.getOwnPropertyNames(e).map(d=>e[d]).filter(d=>s.MetadataTypes.isAttribute(d.type));if(l.length==0)if(e.attributes){let d;for(let f=0;f<e.attributes.length;f++)d=e.attributes[f],l.push(new s.DimensionalAttribute(d.name,d.expression,d.type,d.description,d.sort,d.dataSource))}else n&&l.push(new s.DimensionalAttribute(r,n,o,t,a,i));const u=Object.getOwnPropertyNames(e).map(d=>e[d]).filter(d=>s.MetadataTypes.isDimension(d.type));if(u.length==0&&e.dimensions)for(let d=0;d<e.dimensions.length;d++)u.push(Hc(e.dimensions[d]));const c=new lr(r,n,l,u,o,t,a,i);return e.defaultAttribute&&(c.defaultAttribute=l.find(d=>d.name===e.defaultAttribute)),c}function Nf(e){const r=e.name||e.title,t=e.expression||e.dim,n=e.desc||e.description,o=e.sort,a=e.dataSource;return new Ro(r,t,n,o,a)}function If(e,r){const t=e.map(o=>jf(o,r)),n=Wf(t);return Object.values(n).map(o=>Hc(o))}const jf=(e,r)=>{const t=e.table,n=e.tableTitle||t,o=e.id,a=e.title||o,i=s.isDataSourceInfo(r)?r:{title:r,live:!1},l=e.dimtype==="datetime"?Nf({name:a,expression:o,dataSource:i}):s.createAttribute({name:a,type:e.dimtype==="text"?"text-attribute":"numeric-attribute",expression:o,dataSource:i});return{dimension:{id:t,name:n},attribute:l}},Wf=e=>e.reduce((r,{dimension:t,attribute:n})=>{const o=r[t.name]||{name:t.name,expression:t.id};return Object.assign(Object.assign({},r),{[t.name]:Object.assign(Object.assign({},o),{[n.name]:n})})},{}),Yc=e=>{if(e!==void 0)return`${e}`},$c=e=>{if(e!==void 0)return new Date(e).toISOString()},ys=()=>!1;function Qi(e,r){const t=r.filter;return"or"in t?n=>t.or.map(o=>e(Object.assign(Object.assign({},r),{filter:o}))).reduce((o,a)=>o||a(n),!1):"and"in t?n=>t.and.map(o=>e(Object.assign(Object.assign({},r),{filter:o}))).reduce((o,a)=>o&&a(n),!0):e(r)}function Bf(e){const{datatype:r}=e,t=e.filter,n=r==="datetime"?$c:Yc;return o=>{const a=t.members.map(n),i=n(o);return a.includes(i)}}function Hf(e){const{datatype:r}=e,t=e.filter,n=r==="datetime"?$c:Yc;return o=>{var a,i;const l=((i=(a=t.exclude)===null||a===void 0?void 0:a.members)===null||i===void 0?void 0:i.map(n))||[],u=n(o);return!l.includes(u)}}function Yf(e){const r=e.filter,t=s.getSelectedConditionOption(r);return t===s.ConditionFilterType.STARTS_WITH?n=>new RegExp(`^${r.startsWith}`,"i").test(n):t===s.ConditionFilterType.ENDS_WITH?n=>new RegExp(`${r.endsWith}$`,"i").test(n):t===s.ConditionFilterType.CONTAINS?n=>new RegExp(r.contains,"i").test(n):t===s.ConditionFilterType.EQUALS?n=>n.localeCompare(r.equals,void 0,{sensitivity:"base"})===0:t===s.ConditionFilterType.DOESNT_START_WITH?n=>!new RegExp(`^${r.doesntStartWith}`,"i").test(n):t===s.ConditionFilterType.DOESNT_END_WITH?n=>!new RegExp(`${r.doesntEndWith}$`,"i").test(n):t===s.ConditionFilterType.DOESNT_CONTAIN?n=>!new RegExp(r.doesntContain,"i").test(n):t===s.ConditionFilterType.DOESNT_EQUAL?n=>n.localeCompare(r.doesntEqual,void 0,{sensitivity:"base"})!==0:ys}function $f(e){const r=e.filter,t=s.getSelectedConditionOption(r);return t===s.ConditionFilterType.EQUALS?n=>Number(r.equals)===Number(n):t===s.ConditionFilterType.DOESNT_EQUAL?n=>Number(r.doesntEqual)!==Number(n):t===s.ConditionFilterType.LESS_THAN?n=>Number(n)<Number(r.toNotEqual):t===s.ConditionFilterType.GREATER_THAN?n=>Number(n)>Number(r.fromNotEqual):t===s.ConditionFilterType.BETWEEN?n=>Number(r.to)>=Number(n)&&Number(n)>=Number(r.from):t===s.ConditionFilterType.GREATER_THAN_OR_EQUAL?n=>Number(n)>=Number(r.from):t===s.ConditionFilterType.LESS_THAN_OR_EQUAL?n=>Number(r.to)>=Number(n):ys}function Uf(e){const r=e,{datatype:t}=r,n=r.filter;return s.isSpecificItemsFilter(n)?Bf(r):s.isConditionFilter(n)&&s.getSelectedConditionOption(n)===s.ConditionFilterType.IS_NOT?Hf(r):t==="text"?Qi(Yf,r):t==="numeric"?Qi($f,r):ys}function Vf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=[...t,e],a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return[...r||[],e]}}function zf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=[...t,...e],a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return[...r||[],...e]}}function qf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=t.filter(i=>i.config.guid!==e.config.guid),a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return(r||[]).filter(t=>t.config.guid!==e.config.guid)}}function Qf(e){return r=>{if(p.isFilterRelations(r)){const{filters:t,relations:n}=p.splitFiltersAndRelations(r),o=t.filter(i=>!e.some(l=>i.config.guid===l.config.guid)),a=p.calculateNewRelations(t,n,o);return p.combineFiltersAndRelations(o,a)}return(r||[]).filter(t=>!e.some(n=>t.config.guid===n.config.guid))}}function Gf(e,r){return t=>{if(p.isFilterRelations(t)){const{filters:n,relations:o}=p.splitFiltersAndRelations(t),a=n.map(l=>l.config.guid===e.config.guid?r:l),i=p.getRelationsWithReplacedFilter(o,e,r);return p.combineFiltersAndRelations(a,i)}return(t||[]).map(n=>n.config.guid===e.config.guid?r:n)}}var Ge={},Uc={},Lo={},bs={};(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(o,a,i,l){function u(c){return c instanceof i?c:new i(function(d){d(c)})}return new(i||(i=Promise))(function(c,d){function f(y){try{m(l.next(y))}catch(b){d(b)}}function h(y){try{m(l.throw(y))}catch(b){d(b)}}function m(y){y.done?c(y.value):u(y.value).then(f,h)}m((l=l.apply(o,a||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Task=e.ExecutionResultStatus=void 0;var t;(function(o){o.SUCCESS="SUCCESS",o.ERROR="ERROR"})(t=e.ExecutionResultStatus||(e.ExecutionResultStatus={}));class n{constructor(a,i,l){this.steps=a,this.passport=i,this.addons=l,this.statistics={startTime:new Date,steps:[],runtimeInfo:{}},this.currentStep=void 0}run(a){return r(this,void 0,void 0,function*(){let i=a,l;for(let c=0;c<this.steps.length;c+=1){this.currentStep=this.steps[c];const{resultValue:d,info:f}=yield this.currentStep.run(this,i);if(this.statistics.steps.push(f),f.success)i=d;else{l=f.error;break}}const u=this.statistics.steps.length===this.steps.length&&this.statistics.steps.every(c=>c.success);return this.statistics.endTime=new Date,{status:u?t.SUCCESS:t.ERROR,error:l,result:u?i:void 0,statistics:this.statistics}})}cancel(a){var i;return r(this,void 0,void 0,function*(){yield(i=this.currentStep)===null||i===void 0?void 0:i.cancel(this,a)})}addRuntimeInfo(a,i){this.statistics.runtimeInfo[a]=i}emitAddonEvent(a,...i){var l;const u=a.split("."),c=u[0],d=u[1],f=(l=this.addons)===null||l===void 0?void 0:l.find(m=>m.addonName===c),h=(f==null?void 0:f.events)[d];h(...i)}}e.Task=n})(bs);var ya=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.AbstractTaskManager=void 0;const Kf=bs;class Xf{constructor(r){this.runningTasks=new Map,this.addons=r||[]}runTask(r){return ya(this,void 0,void 0,function*(){const{taskId:t}=r.passport;this.runningTasks.set(t,r);const n=yield r.run();return this.runningTasks.delete(t),n})}createFlow(r){return t=>ya(this,void 0,void 0,function*(){const n=new Kf.Task(r,t,this.addons);return this.runTask(n)})}cancel(r,t){return ya(this,void 0,void 0,function*(){const n=this.runningTasks.get(r);n&&(yield n.cancel(t))})}}Lo.AbstractTaskManager=Xf;var No={},xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.TaskCanceledError=void 0;class Zf extends Error{constructor(r){const t=`Task was canceled due to: "${r}"`;super(t)}}xr.TaskCanceledError=Zf;var Gi=s.commonjsGlobal&&s.commonjsGlobal.__awaiter||function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};Object.defineProperty(No,"__esModule",{value:!0});No.Step=void 0;const Jf=xr;class eh{constructor(r,t,n){this.taskSelfResolvers=new Map,this.taskStepInfos=new Map,this.name=r,this.runLogic=t,this.cancelLogic=n}run(r,t){return Gi(this,void 0,void 0,function*(){return this.addStepInfo(r,{name:this.name}),new Promise(n=>{const o=new Date,a=(i,l)=>{const u=new Date,c=u.getTime()-o.getTime();this.addStepInfo(r,{startTime:o,endTime:u,duration:c}),this.addStepInfo(r,l?{success:!1,error:l}:{success:!0}),n({resultValue:i,info:this.getStepInfo(r)})};this.taskSelfResolvers.set(r,a),this.runLogic(r,t).then(i=>a(i)).finally(()=>{this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r)}).catch(i=>a(void 0,i))})})}cancel(r,t){return Gi(this,void 0,void 0,function*(){this.addStepInfo(r,{wasCanceled:!0,cancelingReason:t});const n=this.taskSelfResolvers.get(r);n==null||n(void 0,new Jf.TaskCanceledError(t)),this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r),yield this.cancelLogic(r,t)})}addStepInfo(r,t){const n=this.taskStepInfos.get(r)||{},o=Object.assign(Object.assign({},n),t);this.taskStepInfos.set(r,o)}getStepInfo(r){return this.taskStepInfos.get(r)}}No.Step=eh;var Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.Addon=void 0;class th{constructor(){this.events={}}}Io.Addon=th;var jo={},Ir,nh=new Uint8Array(16);function Vc(){if(!Ir&&(Ir=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ir))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ir(nh)}const rh=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Wo(e){return typeof e=="string"&&rh.test(e)}var Ae=[];for(var ba=0;ba<256;++ba)Ae.push((ba+256).toString(16).substr(1));function Bo(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(Ae[e[r+0]]+Ae[e[r+1]]+Ae[e[r+2]]+Ae[e[r+3]]+"-"+Ae[e[r+4]]+Ae[e[r+5]]+"-"+Ae[e[r+6]]+Ae[e[r+7]]+"-"+Ae[e[r+8]]+Ae[e[r+9]]+"-"+Ae[e[r+10]]+Ae[e[r+11]]+Ae[e[r+12]]+Ae[e[r+13]]+Ae[e[r+14]]+Ae[e[r+15]]).toLowerCase();if(!Wo(t))throw TypeError("Stringified UUID is invalid");return t}var Ki,va,xa=0,wa=0;function oh(e,r,t){var n=r&&t||0,o=r||new Array(16);e=e||{};var a=e.node||Ki,i=e.clockseq!==void 0?e.clockseq:va;if(a==null||i==null){var l=e.random||(e.rng||Vc)();a==null&&(a=Ki=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),i==null&&(i=va=(l[6]<<8|l[7])&16383)}var u=e.msecs!==void 0?e.msecs:Date.now(),c=e.nsecs!==void 0?e.nsecs:wa+1,d=u-xa+(c-wa)/1e4;if(d<0&&e.clockseq===void 0&&(i=i+1&16383),(d<0||u>xa)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");xa=u,wa=c,va=i,u+=122192928e5;var f=((u&268435455)*1e4+c)%4294967296;o[n++]=f>>>24&255,o[n++]=f>>>16&255,o[n++]=f>>>8&255,o[n++]=f&255;var h=u/4294967296*1e4&268435455;o[n++]=h>>>8&255,o[n++]=h&255,o[n++]=h>>>24&15|16,o[n++]=h>>>16&255,o[n++]=i>>>8|128,o[n++]=i&255;for(var m=0;m<6;++m)o[n+m]=a[m];return r||Bo(o)}function zc(e){if(!Wo(e))throw TypeError("Invalid UUID");var r,t=new Uint8Array(16);return t[0]=(r=parseInt(e.slice(0,8),16))>>>24,t[1]=r>>>16&255,t[2]=r>>>8&255,t[3]=r&255,t[4]=(r=parseInt(e.slice(9,13),16))>>>8,t[5]=r&255,t[6]=(r=parseInt(e.slice(14,18),16))>>>8,t[7]=r&255,t[8]=(r=parseInt(e.slice(19,23),16))>>>8,t[9]=r&255,t[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=r/4294967296&255,t[12]=r>>>24&255,t[13]=r>>>16&255,t[14]=r>>>8&255,t[15]=r&255,t}function ah(e){e=unescape(encodeURIComponent(e));for(var r=[],t=0;t<e.length;++t)r.push(e.charCodeAt(t));return r}var sh="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ih="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function qc(e,r,t){function n(o,a,i,l){if(typeof o=="string"&&(o=ah(o)),typeof a=="string"&&(a=zc(a)),a.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+o.length);if(u.set(a),u.set(o,a.length),u=t(u),u[6]=u[6]&15|r,u[8]=u[8]&63|128,i){l=l||0;for(var c=0;c<16;++c)i[l+c]=u[c];return i}return Bo(u)}try{n.name=e}catch(o){}return n.DNS=sh,n.URL=ih,n}function lh(e){if(typeof e=="string"){var r=unescape(encodeURIComponent(e));e=new Uint8Array(r.length);for(var t=0;t<r.length;++t)e[t]=r.charCodeAt(t)}return ch(uh(dh(e),e.length*8))}function ch(e){for(var r=[],t=e.length*32,n="0123456789abcdef",o=0;o<t;o+=8){var a=e[o>>5]>>>o%32&255,i=parseInt(n.charAt(a>>>4&15)+n.charAt(a&15),16);r.push(i)}return r}function Qc(e){return(e+64>>>9<<4)+14+1}function uh(e,r){e[r>>5]|=128<<r%32,e[Qc(r)-1]=r;for(var t=1732584193,n=-271733879,o=-1732584194,a=271733878,i=0;i<e.length;i+=16){var l=t,u=n,c=o,d=a;t=Le(t,n,o,a,e[i],7,-680876936),a=Le(a,t,n,o,e[i+1],12,-389564586),o=Le(o,a,t,n,e[i+2],17,606105819),n=Le(n,o,a,t,e[i+3],22,-1044525330),t=Le(t,n,o,a,e[i+4],7,-176418897),a=Le(a,t,n,o,e[i+5],12,1200080426),o=Le(o,a,t,n,e[i+6],17,-1473231341),n=Le(n,o,a,t,e[i+7],22,-45705983),t=Le(t,n,o,a,e[i+8],7,1770035416),a=Le(a,t,n,o,e[i+9],12,-1958414417),o=Le(o,a,t,n,e[i+10],17,-42063),n=Le(n,o,a,t,e[i+11],22,-1990404162),t=Le(t,n,o,a,e[i+12],7,1804603682),a=Le(a,t,n,o,e[i+13],12,-40341101),o=Le(o,a,t,n,e[i+14],17,-1502002290),n=Le(n,o,a,t,e[i+15],22,1236535329),t=Ne(t,n,o,a,e[i+1],5,-165796510),a=Ne(a,t,n,o,e[i+6],9,-1069501632),o=Ne(o,a,t,n,e[i+11],14,643717713),n=Ne(n,o,a,t,e[i],20,-373897302),t=Ne(t,n,o,a,e[i+5],5,-701558691),a=Ne(a,t,n,o,e[i+10],9,38016083),o=Ne(o,a,t,n,e[i+15],14,-660478335),n=Ne(n,o,a,t,e[i+4],20,-405537848),t=Ne(t,n,o,a,e[i+9],5,568446438),a=Ne(a,t,n,o,e[i+14],9,-1019803690),o=Ne(o,a,t,n,e[i+3],14,-187363961),n=Ne(n,o,a,t,e[i+8],20,1163531501),t=Ne(t,n,o,a,e[i+13],5,-1444681467),a=Ne(a,t,n,o,e[i+2],9,-51403784),o=Ne(o,a,t,n,e[i+7],14,1735328473),n=Ne(n,o,a,t,e[i+12],20,-1926607734),t=Ie(t,n,o,a,e[i+5],4,-378558),a=Ie(a,t,n,o,e[i+8],11,-2022574463),o=Ie(o,a,t,n,e[i+11],16,1839030562),n=Ie(n,o,a,t,e[i+14],23,-35309556),t=Ie(t,n,o,a,e[i+1],4,-1530992060),a=Ie(a,t,n,o,e[i+4],11,1272893353),o=Ie(o,a,t,n,e[i+7],16,-155497632),n=Ie(n,o,a,t,e[i+10],23,-1094730640),t=Ie(t,n,o,a,e[i+13],4,681279174),a=Ie(a,t,n,o,e[i],11,-358537222),o=Ie(o,a,t,n,e[i+3],16,-722521979),n=Ie(n,o,a,t,e[i+6],23,76029189),t=Ie(t,n,o,a,e[i+9],4,-640364487),a=Ie(a,t,n,o,e[i+12],11,-421815835),o=Ie(o,a,t,n,e[i+15],16,530742520),n=Ie(n,o,a,t,e[i+2],23,-995338651),t=je(t,n,o,a,e[i],6,-198630844),a=je(a,t,n,o,e[i+7],10,1126891415),o=je(o,a,t,n,e[i+14],15,-1416354905),n=je(n,o,a,t,e[i+5],21,-57434055),t=je(t,n,o,a,e[i+12],6,1700485571),a=je(a,t,n,o,e[i+3],10,-1894986606),o=je(o,a,t,n,e[i+10],15,-1051523),n=je(n,o,a,t,e[i+1],21,-2054922799),t=je(t,n,o,a,e[i+8],6,1873313359),a=je(a,t,n,o,e[i+15],10,-30611744),o=je(o,a,t,n,e[i+6],15,-1560198380),n=je(n,o,a,t,e[i+13],21,1309151649),t=je(t,n,o,a,e[i+4],6,-145523070),a=je(a,t,n,o,e[i+11],10,-1120210379),o=je(o,a,t,n,e[i+2],15,718787259),n=je(n,o,a,t,e[i+9],21,-343485551),t=Nt(t,l),n=Nt(n,u),o=Nt(o,c),a=Nt(a,d)}return[t,n,o,a]}function dh(e){if(e.length===0)return[];for(var r=e.length*8,t=new Uint32Array(Qc(r)),n=0;n<r;n+=8)t[n>>5]|=(e[n/8]&255)<<n%32;return t}function Nt(e,r){var t=(e&65535)+(r&65535),n=(e>>16)+(r>>16)+(t>>16);return n<<16|t&65535}function ph(e,r){return e<<r|e>>>32-r}function Ho(e,r,t,n,o,a){return Nt(ph(Nt(Nt(r,e),Nt(n,a)),o),t)}function Le(e,r,t,n,o,a,i){return Ho(r&t|~r&n,e,r,o,a,i)}function Ne(e,r,t,n,o,a,i){return Ho(r&n|t&~n,e,r,o,a,i)}function Ie(e,r,t,n,o,a,i){return Ho(r^t^n,e,r,o,a,i)}function je(e,r,t,n,o,a,i){return Ho(t^(r|~n),e,r,o,a,i)}var fh=qc("v3",48,lh);const hh=fh;function mh(e,r,t){e=e||{};var n=e.random||(e.rng||Vc)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){t=t||0;for(var o=0;o<16;++o)r[t+o]=n[o];return r}return Bo(n)}function gh(e,r,t,n){switch(e){case 0:return r&t^~r&n;case 1:return r^t^n;case 2:return r&t^r&n^t&n;case 3:return r^t^n}}function Ca(e,r){return e<<r|e>>>32-r}function yh(e){var r=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var o=0;o<n.length;++o)e.push(n.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,i=Math.ceil(a/16),l=new Array(i),u=0;u<i;++u){for(var c=new Uint32Array(16),d=0;d<16;++d)c[d]=e[u*64+d*4]<<24|e[u*64+d*4+1]<<16|e[u*64+d*4+2]<<8|e[u*64+d*4+3];l[u]=c}l[i-1][14]=(e.length-1)*8/Math.pow(2,32),l[i-1][14]=Math.floor(l[i-1][14]),l[i-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<i;++f){for(var h=new Uint32Array(80),m=0;m<16;++m)h[m]=l[f][m];for(var y=16;y<80;++y)h[y]=Ca(h[y-3]^h[y-8]^h[y-14]^h[y-16],1);for(var b=t[0],v=t[1],x=t[2],w=t[3],T=t[4],S=0;S<80;++S){var D=Math.floor(S/20),_=Ca(b,5)+gh(D,v,x,w)+T+r[D]+h[S]>>>0;T=w,w=x,x=Ca(v,30)>>>0,v=b,b=_}t[0]=t[0]+b>>>0,t[1]=t[1]+v>>>0,t[2]=t[2]+x>>>0,t[3]=t[3]+w>>>0,t[4]=t[4]+T>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var bh=qc("v5",80,yh);const vh=bh,xh="00000000-0000-0000-0000-000000000000";function wh(e){if(!Wo(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}const Ch=Object.freeze(Object.defineProperty({__proto__:null,NIL:xh,parse:zc,stringify:Bo,v1:oh,v3:hh,v4:mh,v5:vh,validate:Wo,version:wh},Symbol.toStringTag,{value:"Module"})),Th=s.getAugmentedNamespace(Ch);Object.defineProperty(jo,"__esModule",{value:!0});jo.TaskPassport=void 0;const Sh=Th;class Dh{constructor(){this.taskId=(0,Sh.v4)()}}jo.TaskPassport=Dh;(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__createBinding||(Object.create?function(n,o,a,i){i===void 0&&(i=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(n,i,l)}:function(n,o,a,i){i===void 0&&(i=a),n[i]=o[a]}),t=s.commonjsGlobal&&s.commonjsGlobal.__exportStar||function(n,o){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&r(o,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),t(Lo,e),t(No,e),t(bs,e),t(Io,e),t(jo,e),t(xr,e)})(Uc);(function(e){var r=s.commonjsGlobal&&s.commonjsGlobal.__createBinding||(Object.create?function(n,o,a,i){i===void 0&&(i=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(n,i,l)}:function(n,o,a,i){i===void 0&&(i=a),n[i]=o[a]}),t=s.commonjsGlobal&&s.commonjsGlobal.__exportStar||function(n,o){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&r(o,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),t(Uc,e)})(Ge);class We extends s.AbstractTranslatableError{constructor(r,t){super(Bc,{key:r,interpolationOptions:t},Lf.t)}get status(){return this.interpolationOptions.status}}var kh=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};const cr="api/datasources",_h="api/v2/datamodels";class Eh{constructor(r){this.httpClient=r}getDataSourceFields(r,t=9999,n=0){const o=s.getDataSourceName(r),a=`${cr}/${encodeURI(o)}/fields/search`;return this.httpClient.post(a,{offset:n,count:t}).catch(()=>{throw new We("errors.dataSourceNotFound",{dataSource:typeof r=="string"?r:r.title})})}getDataSourceList(){const r=`${cr}/?sharedWith=r,w`;return this.httpClient.get(r)}getDataSourceSchema(r){const t=`${_h}/schema?title=${encodeURIComponent(r)}`;return this.httpClient.get(t)}sendJaqlRequest(r,t){const n=Gc(r),o=new AbortController;return{responsePromise:this.httpClient.post(n,t,void 0,o.signal).then(a=>Array.isArray(a)?{values:[],metadata:[]}:a),abortHttpRequest:a=>o.abort(a)}}sendDownloadCsvRequest(r,t){const n=Oh(r),o=new AbortController,a=new URLSearchParams;return a.append("data",encodeURIComponent(JSON.stringify(t))),{responsePromise:this.httpClient.post(n,a,{headers:{"Content-Type":"application/x-www-form-urlencoded"}},o.signal,{nonJSONBody:!0,returnBlob:!0}),abortHttpRequest:i=>o.abort(i)}}sendCancelJaqlQueryRequest(r,t){return this.sendCancelMultipleJaqlQueriesRequest([r],t)}sendCancelMultipleJaqlQueriesRequest(r,t){return kh(this,void 0,void 0,function*(){const n={queries:r.join(";")},o=Mh(t);try{yield this.httpClient.post(o,n)}catch(a){if(a.status==="404"){const i=Ph(t);yield this.httpClient.post(i,n)}else throw a}})}}function Mh(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/localhost/${r}/cancel_queries`}function Ph(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/live/${r}/cancel_queries`}function Gc(e){const r=encodeURIComponent(s.getDataSourceName(e));return`${cr}/${r}/jaql`}function Oh(e){return`${Gc(e)}/csv`}var Kc={exports:{}};/*! @preserve
2
2
  * numeral.js
3
3
  * version : 2.0.6
4
4
  * author : Adam Draper
5
5
  * license : MIT
6
6
  * http://adamwdraper.github.com/Numeral-js/
7
- */(function(e){(function(r,t){e.exports?e.exports=t():r.numeral=t()})(s.commonjsGlobal,function(){var r,t,n="2.0.6",o={},a={},i={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},l={currentLocale:i.currentLocale,zeroFormat:i.zeroFormat,nullFormat:i.nullFormat,defaultFormat:i.defaultFormat,scalePercentBy100:i.scalePercentBy100};function u(c,d){this._input=c,this._value=d}return r=function(c){var d,f,h,m;if(r.isNumeral(c))d=c.value();else if(c===0||typeof c=="undefined")d=0;else if(c===null||t.isNaN(c))d=null;else if(typeof c=="string")if(l.zeroFormat&&c===l.zeroFormat)d=0;else if(l.nullFormat&&c===l.nullFormat||!c.replace(/[^0-9]+/g,"").length)d=null;else{for(f in o)if(m=typeof o[f].regexps.unformat=="function"?o[f].regexps.unformat():o[f].regexps.unformat,m&&c.match(m)){h=o[f].unformat;break}h=h||r._.stringToNumber,d=h(c)}else d=Number(c)||null;return new u(c,d)},r.version=n,r.isNumeral=function(c){return c instanceof u},r._=t={numberToFormat:function(c,d,f){var h=a[r.options.currentLocale],m=!1,y=!1,b=0,v="",x=1e12,w=1e9,T=1e6,S=1e3,D="",_=!1,E,F,N,j,I,H,B;if(c=c||0,F=Math.abs(c),r._.includes(d,"(")?(m=!0,d=d.replace(/[\(|\)]/g,"")):(r._.includes(d,"+")||r._.includes(d,"-"))&&(I=r._.includes(d,"+")?d.indexOf("+"):c<0?d.indexOf("-"):-1,d=d.replace(/[\+|\-]/g,"")),r._.includes(d,"a")&&(E=d.match(/a(k|m|b|t)?/),E=E?E[1]:!1,r._.includes(d," a")&&(v=" "),d=d.replace(new RegExp(v+"a[kmbt]?"),""),F>=x&&!E||E==="t"?(v+=h.abbreviations.trillion,c=c/x):F<x&&F>=w&&!E||E==="b"?(v+=h.abbreviations.billion,c=c/w):F<w&&F>=T&&!E||E==="m"?(v+=h.abbreviations.million,c=c/T):(F<T&&F>=S&&!E||E==="k")&&(v+=h.abbreviations.thousand,c=c/S)),r._.includes(d,"[.]")&&(y=!0,d=d.replace("[.]",".")),N=c.toString().split(".")[0],j=d.split(".")[1],H=d.indexOf(","),b=(d.split(".")[0].split(",")[0].match(/0/g)||[]).length,j?(r._.includes(j,"[")?(j=j.replace("]",""),j=j.split("["),D=r._.toFixed(c,j[0].length+j[1].length,f,j[1].length)):D=r._.toFixed(c,j.length,f),N=D.split(".")[0],r._.includes(D,".")?D=h.delimiters.decimal+D.split(".")[1]:D="",y&&Number(D.slice(1))===0&&(D="")):N=r._.toFixed(c,0,f),v&&!E&&Number(N)>=1e3&&v!==h.abbreviations.trillion)switch(N=String(Number(N)/1e3),v){case h.abbreviations.thousand:v=h.abbreviations.million;break;case h.abbreviations.million:v=h.abbreviations.billion;break;case h.abbreviations.billion:v=h.abbreviations.trillion;break}if(r._.includes(N,"-")&&(N=N.slice(1),_=!0),N.length<b)for(var R=b-N.length;R>0;R--)N="0"+N;return H>-1&&(N=N.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+h.delimiters.thousands)),d.indexOf(".")===0&&(N=""),B=N+D+(v||""),m?B=(m&&_?"(":"")+B+(m&&_?")":""):I>=0?B=I===0?(_?"-":"+")+B:B+(_?"-":"+"):_&&(B="-"+B),B},stringToNumber:function(c){var d=a[l.currentLocale],f=c,h={thousand:3,million:6,billion:9,trillion:12},m,y,b;if(l.zeroFormat&&c===l.zeroFormat)y=0;else if(l.nullFormat&&c===l.nullFormat||!c.replace(/[^0-9]+/g,"").length)y=null;else{y=1,d.delimiters.decimal!=="."&&(c=c.replace(/\./g,"").replace(d.delimiters.decimal,"."));for(m in h)if(b=new RegExp("[^a-zA-Z]"+d.abbreviations[m]+"(?:\\)|(\\"+d.currency.symbol+")?(?:\\))?)?$"),f.match(b)){y*=Math.pow(10,h[m]);break}y*=(c.split("-").length+Math.min(c.split("(").length-1,c.split(")").length-1))%2?1:-1,c=c.replace(/[^0-9\.]+/g,""),y*=Number(c)}return y},isNaN:function(c){return typeof c=="number"&&isNaN(c)},includes:function(c,d){return c.indexOf(d)!==-1},insert:function(c,d,f){return c.slice(0,f)+d+c.slice(f)},reduce:function(c,d){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof d!="function")throw new TypeError(d+" is not a function");var f=Object(c),h=f.length>>>0,m=0,y;if(arguments.length===3)y=arguments[2];else{for(;m<h&&!(m in f);)m++;if(m>=h)throw new TypeError("Reduce of empty array with no initial value");y=f[m++]}for(;m<h;m++)m in f&&(y=d(y,f[m],m,f));return y},multiplier:function(c){var d=c.toString().split(".");return d.length<2?1:Math.pow(10,d[1].length)},correctionFactor:function(){var c=Array.prototype.slice.call(arguments);return c.reduce(function(d,f){var h=t.multiplier(f);return d>h?d:h},1)},toFixed:function(c,d,f,h){var m=c.toString().split("."),y=d-(h||0),b,v,x,w;return m.length===2?b=Math.min(Math.max(m[1].length,y),d):b=y,x=Math.pow(10,b),w=(f(c+"e+"+b)/x).toFixed(b),h>d-b&&(v=new RegExp("\\.?0{1,"+(h-(d-b))+"}$"),w=w.replace(v,"")),w}},r.options=l,r.formats=o,r.locales=a,r.locale=function(c){return c&&(l.currentLocale=c.toLowerCase()),l.currentLocale},r.localeData=function(c){if(!c)return a[l.currentLocale];if(c=c.toLowerCase(),!a[c])throw new Error("Unknown locale : "+c);return a[c]},r.reset=function(){for(var c in i)l[c]=i[c]},r.zeroFormat=function(c){l.zeroFormat=typeof c=="string"?c:null},r.nullFormat=function(c){l.nullFormat=typeof c=="string"?c:null},r.defaultFormat=function(c){l.defaultFormat=typeof c=="string"?c:"0.0"},r.register=function(c,d,f){if(d=d.toLowerCase(),this[c+"s"][d])throw new TypeError(d+" "+c+" already registered.");return this[c+"s"][d]=f,f},r.validate=function(c,d){var f,h,m,y,b,v,x,w;if(typeof c!="string"&&(c+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",c)),c=c.trim(),c.match(/^\d+$/))return!0;if(c==="")return!1;try{x=r.localeData(d)}catch(T){x=r.localeData(r.locale())}return m=x.currency.symbol,b=x.abbreviations,f=x.delimiters.decimal,x.delimiters.thousands==="."?h="\\.":h=x.delimiters.thousands,w=c.match(/^[^\d]+/),w!==null&&(c=c.substr(1),w[0]!==m)||(w=c.match(/[^\d]+$/),w!==null&&(c=c.slice(0,-1),w[0]!==b.thousand&&w[0]!==b.million&&w[0]!==b.billion&&w[0]!==b.trillion))?!1:(v=new RegExp(h+"{2}"),c.match(/[^\d.,]/g)?!1:(y=c.split(f),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(v):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(v)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(v)&&!!y[1].match(/^\d+$/)))},r.fn=u.prototype={clone:function(){return r(this)},format:function(c,d){var f=this._value,h=c||l.defaultFormat,m,y,b;if(d=d||Math.round,f===0&&l.zeroFormat!==null)y=l.zeroFormat;else if(f===null&&l.nullFormat!==null)y=l.nullFormat;else{for(m in o)if(h.match(o[m].regexps.format)){b=o[m].format;break}b=b||r._.numberToFormat,y=b(f,h,d)}return y},value:function(){return this._value},input:function(){return this._input},set:function(c){return this._value=Number(c),this},add:function(c){var d=t.correctionFactor.call(null,this._value,c);function f(h,m,y,b){return h+Math.round(d*m)}return this._value=t.reduce([this._value,c],f,0)/d,this},subtract:function(c){var d=t.correctionFactor.call(null,this._value,c);function f(h,m,y,b){return h-Math.round(d*m)}return this._value=t.reduce([c],f,Math.round(this._value*d))/d,this},multiply:function(c){function d(f,h,m,y){var b=t.correctionFactor(f,h);return Math.round(f*b)*Math.round(h*b)/Math.round(b*b)}return this._value=t.reduce([this._value,c],d,1),this},divide:function(c){function d(f,h,m,y){var b=t.correctionFactor(f,h);return Math.round(f*b)/Math.round(h*b)}return this._value=t.reduce([this._value,c],d),this},difference:function(c){return Math.abs(r(this._value).subtract(c).value())}},r.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(c){var d=c%10;return~~(c%100/10)===1?"th":d===1?"st":d===2?"nd":d===3?"rd":"th"},currency:{symbol:"$"}}),function(){r.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(c,d,f){var h=r._.includes(d," BPS")?" ":"",m;return c=c*1e4,d=d.replace(/\s?BPS/,""),m=r._.numberToFormat(c,d,f),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,h+"BPS"),m=m.join("")):m=m+h+"BPS",m},unformat:function(c){return+(r._.stringToNumber(c)*1e-4).toFixed(15)}})}(),function(){var c={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},d={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},f=c.suffixes.concat(d.suffixes.filter(function(m){return c.suffixes.indexOf(m)<0})),h=f.join("|");h="("+h.replace("B","B(?!PS)")+")",r.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(h)},format:function(m,y,b){var v,x=r._.includes(y,"ib")?d:c,w=r._.includes(y," b")||r._.includes(y," ib")?" ":"",T,S,D;for(y=y.replace(/\s?i?b/,""),T=0;T<=x.suffixes.length;T++)if(S=Math.pow(x.base,T),D=Math.pow(x.base,T+1),m===null||m===0||m>=S&&m<D){w+=x.suffixes[T],S>0&&(m=m/S);break}return v=r._.numberToFormat(m,y,b),v+w},unformat:function(m){var y=r._.stringToNumber(m),b,v;if(y){for(b=c.suffixes.length-1;b>=0;b--){if(r._.includes(m,c.suffixes[b])){v=Math.pow(c.base,b);break}if(r._.includes(m,d.suffixes[b])){v=Math.pow(d.base,b);break}}y*=v||1}return y}})}(),function(){r.register("format","currency",{regexps:{format:/(\$)/},format:function(c,d,f){var h=r.locales[r.options.currentLocale],m={before:d.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:d.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,v;for(d=d.replace(/\s?\$\s?/,""),y=r._.numberToFormat(c,d,f),c>=0?(m.before=m.before.replace(/[\-\(]/,""),m.after=m.after.replace(/[\-\)]/,"")):c<0&&!r._.includes(m.before,"-")&&!r._.includes(m.before,"(")&&(m.before="-"+m.before),v=0;v<m.before.length;v++)switch(b=m.before[v],b){case"$":y=r._.insert(y,h.currency.symbol,v);break;case" ":y=r._.insert(y," ",v+h.currency.symbol.length-1);break}for(v=m.after.length-1;v>=0;v--)switch(b=m.after[v],b){case"$":y=v===m.after.length-1?y+h.currency.symbol:r._.insert(y,h.currency.symbol,-(m.after.length-(1+v)));break;case" ":y=v===m.after.length-1?y+" ":r._.insert(y," ",-(m.after.length-(1+v)+h.currency.symbol.length-1));break}return y}})}(),function(){r.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(c,d,f){var h,m=typeof c=="number"&&!r._.isNaN(c)?c.toExponential():"0e+0",y=m.split("e");return d=d.replace(/e[\+|\-]{1}0/,""),h=r._.numberToFormat(Number(y[0]),d,f),h+"e"+y[1]},unformat:function(c){var d=r._.includes(c,"e+")?c.split("e+"):c.split("e-"),f=Number(d[0]),h=Number(d[1]);h=r._.includes(c,"e-")?h*=-1:h;function m(y,b,v,x){var w=r._.correctionFactor(y,b),T=y*w*(b*w)/(w*w);return T}return r._.reduce([f,Math.pow(10,h)],m,1)}})}(),function(){r.register("format","ordinal",{regexps:{format:/(o)/},format:function(c,d,f){var h=r.locales[r.options.currentLocale],m,y=r._.includes(d," o")?" ":"";return d=d.replace(/\s?o/,""),y+=h.ordinal(c),m=r._.numberToFormat(c,d,f),m+y}})}(),function(){r.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(c,d,f){var h=r._.includes(d," %")?" ":"",m;return r.options.scalePercentBy100&&(c=c*100),d=d.replace(/\s?\%/,""),m=r._.numberToFormat(c,d,f),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,h+"%"),m=m.join("")):m=m+h+"%",m},unformat:function(c){var d=r._.stringToNumber(c);return r.options.scalePercentBy100?d*.01:d}})}(),function(){r.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(c,d,f){var h=Math.floor(c/60/60),m=Math.floor((c-h*60*60)/60),y=Math.round(c-h*60*60-m*60);return h+":"+(m<10?"0"+m:m)+":"+(y<10?"0"+y:y)},unformat:function(c){var d=c.split(":"),f=0;return d.length===3?(f=f+Number(d[0])*60*60,f=f+Number(d[1])*60,f=f+Number(d[2])):d.length===2&&(f=f+Number(d[0])*60,f=f+Number(d[1])),Number(f)}})}(),r})})(Kc);var Ah=Kc.exports;const Fh=s.getDefaultExportFromCjs(Ah),Rh=(e,r)=>{const t=Ih(e);return Lh(t,r)};function Lh(e,r){return{columns:r==null?void 0:r.map(t=>({name:t.name,type:s.simpleColumnType(t.type)})),rows:Nh(e)}}function Nh(e){var r;let t=!1;const n=(r=e[0])===null||r===void 0?void 0:r.map((o,a)=>{const i=e.some(l=>"selected"in l[a]);return i&&(t=!0),i});return e.map(o=>{const a=t?n.some((i,l)=>i&&!o[l].selected):void 0;return o.map(i=>a!==void 0?{data:i.data,text:i.text,blur:a}:{data:i.data,text:i.text})})}function Ih({values:e=[],metadata:r=[]}){var t,n,o,a;e[0]&&!Array.isArray(e[0])&&(e=[e]);for(let i=0;i<e.length;i++){const l=e[i];for(let u=0;u<l.length;u++)r[u].format&&(!((n=(t=r[u])===null||t===void 0?void 0:t.format)===null||n===void 0)&&n.number)&&(l[u].text=Fh(l[u].data).format((a=(o=r[u])===null||o===void 0?void 0:o.format)===null||a===void 0?void 0:a.number))}return e}var Zt=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class jh extends Ge.AbstractTaskManager{constructor(r,t){super(),this.sentRequestsAbortersMap=new Map,this.executeQuerySending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_JAQL_QUERY",this.sendJaqlQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executeDownloadCsvSending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_DOWNLOAD_CSV_QUERY",this.sendCsvQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executePivotQuerySending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.preparePivotJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_JAQL_QUERY",this.sendPivotJaqlQuery.bind(this),this.cancelPivotJaqlQuery.bind(this))]),this.queryApi=r,this.pivotClient=t}prepareJaqlPayload(r){return Zt(this,void 0,void 0,function*(){const{queryDescription:t,executionConfig:n}=r.passport,o=s.getJaqlQueryPayload(t,n.shouldSkipHighlightsWithoutAttributes),a=r.passport.executionConfig.onBeforeQuery;return a?a(o):o})}sendJaqlQuery(r,t){return Zt(this,void 0,void 0,function*(){const{queryDescription:n,taskId:o}=r.passport,{responsePromise:a,abortHttpRequest:i}=this.queryApi.sendJaqlRequest(r.passport.queryDescription.dataSource,t);this.sentRequestsAbortersMap.set(o,i);const l=yield a.finally(()=>{this.sentRequestsAbortersMap.delete(o)});Wh(l);const u=[...n.attributes,...n.measures],c=(l.headers||[]).slice(u.length).map(d=>({name:d,type:"number"}));return Rh(l,[...u,...c])})}sendCsvQuery(r,t){return Zt(this,void 0,void 0,function*(){const{taskId:n}=r.passport,{responsePromise:o,abortHttpRequest:a}=this.queryApi.sendDownloadCsvRequest(r.passport.queryDescription.dataSource,t);return this.sentRequestsAbortersMap.set(n,a),o.finally(()=>{this.sentRequestsAbortersMap.delete(n)})})}cancelDataRetrievalQuery(r){const t=r.passport.taskId,n=this.sentRequestsAbortersMap.get(t);return n&&(n(),this.sentRequestsAbortersMap.delete(t)),this.queryApi.sendCancelJaqlQueryRequest(t,r.passport.queryDescription.dataSource)}preparePivotJaqlPayload(r){return Zt(this,void 0,void 0,function*(){const{pivotQueryDescription:t,executionConfig:n}=r.passport,o=s.getPivotJaqlQueryPayload(t,n.shouldSkipHighlightsWithoutAttributes),a=r.passport.executionConfig.onBeforeQuery;return a?a(o):o})}sendPivotJaqlQuery(r,t){var n;const{pivotQueryDescription:o}=r.passport;return this.pivotClient.queryData(t,!0,(n=o.count)!==null&&n!==void 0?n:Hh,!1)}cancelPivotJaqlQuery(r){const t=r.passport.taskId,n=this.sentRequestsAbortersMap.get(t);return n&&(n(),this.sentRequestsAbortersMap.delete(t)),this.queryApi.sendCancelJaqlQueryRequest(t,r.passport.pivotQueryDescription.dataSource)}}function Wh(e){var r;if(!e)throw new We("errors.noJaqlResponse");if(e.error)throw new Error(`${e.details} ${(r=e.database)!==null&&r!==void 0?r:""} ${e.extraDetails?JSON.stringify(e.extraDetails):""}`)}class Xi extends Ge.TaskPassport{constructor(r,t,n){super(),this.queryDescription=t,this.type=r,this.executionConfig=n}}class Bh extends Ge.TaskPassport{constructor(r,t,n){super(),this.pivotQueryDescription=t,this.type=r,this.executionConfig=n}}var Zi=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};const Hh=2e4,Ta="Unspecified reason";class Yh{constructor(r,t=new s.UB(r.url,r.auth),n){Uh(r),this.queryApi=new Eh(r),this.taskManager=new jh(this.queryApi,t),this.shouldSkipHighlightsWithoutAttributes=n!=null?n:!1}executeQuery(r,t){const n=new Xi("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{Ji(r),this.taskManager.executeQuerySending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}executeCsvQuery(r,t){const n=new Xi("SEND_DOWNLOAD_CSV_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{Ji(r),this.taskManager.executeDownloadCsvSending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}executePivotQuery(r,t){const n=new Bh("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{$h(r),this.taskManager.executePivotQuerySending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}getDataSourceFields(r,t=9999,n=0){return Zi(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceFields(r,t,n))||[]})}getDataSourceSchema(r){return this.queryApi.getDataSourceSchema(r)}getDataSourceList(){return Zi(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceList())||[]})}}function Ji(e){const{attributes:r,measures:t,filters:n,highlights:o,count:a,offset:i}=e;if(a&&a<0)throw new We("errors.invalidCountNegative",{count:a.toString()});if(i&&i<0)throw new We("errors.invalidOffset",{offset:i.toString()});if(r.length+t.length===0)throw new We("errors.noDimensionsOrMeasures");r.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isAttribute(l)){const{name:u}=l;throw new We("errors.invalidAttribute",{attributeName:u})}}),t.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isMeasure(l))throw new We("errors.invalidMeasure",{measureName:l.name})}),n.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isFilter(l))throw new We("errors.invalidFilter",{filterName:l.name})}),o.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isFilter(l))throw new We("errors.invalidHighlight",{highlightName:l.name})})}function $h(e){const{rowsAttributes:r,columnsAttributes:t,measures:n,filters:o,highlights:a,count:i,offset:l}=e;if(i&&i<0)throw new We("errors.invalidCountNegative",{count:i.toString()});if(l&&l<0)throw new We("errors.invalidOffset",{offset:l.toString()});if(r.length+t.length+n.length===0)throw new We("errors.noDimensionsOrMeasures");o.forEach(u=>{if(!u.skipValidation&&!s.MetadataTypes.isFilter(u))throw new We("errors.invalidFilter",{filterName:u.name})}),a.forEach(u=>{if(!u.skipValidation&&!s.MetadataTypes.isFilter(u))throw new We("errors.invalidHighlight",{highlightName:u.name})})}function Uh(e){if(!e)throw new We("errors.missingHttpClient");if(!e.post)throw new We("errors.missingPostMethod")}const Vh={enabled:!0,delay:500},zh={locale:s.getBaseDateFnsLocale(),dateConfig:s.defaultDateConfig,loadingIndicatorConfig:Vh,translationConfig:{language:"en",customTranslations:[]},language:"en",queryCacheConfig:{enabled:!1},queryLimit:s.QUERY_DEFAULT_LIMIT,tabberConfig:{enabled:!1},accessibilityConfig:{enabled:!1},errorBoundaryConfig:{alwaysShowErrorText:!1},trackingConfig:{enabled:!0}};function qh(e,r,t){return Te(this,null,function*(){var o;const n=yield Gh(r,t);return s.merge.withOptions({mergeArrays:!1},zh,{locale:s.getBaseDateFnsLocale((o=e==null?void 0:e.translationConfig)==null?void 0:o.language)},n,e)})}function Qh(e){const r={};return e.forEach(t=>{r[t.key]=t}),r}function Gh(e,r=!1){return Te(this,null,function*(){var a,i;const t=yield e.get("api/globals");if(!t)throw new s.TranslatableError("errors.serverSettingsNotLoaded");const n=r?{colors:s.getDefaultThemeSettings().palette.variantColors}:yield p.getLegacyPalette(p.getPaletteName(t.designSettings),e);return{serverThemeSettings:p.convertToThemeSettings(t.designSettings,n,e.url),serverLanguage:t.language,serverVersion:t.version,serverFeatures:Qh(t.features),user:{tenant:{name:((i=(a=t.user)==null?void 0:a.tenant)==null?void 0:i.name)||s.SYSTEM_TENANT_NAME}}}})}function Kh(e,r){return r===s.SYSTEM_TENANT_NAME?e:e.replace(`/${r}`,"")}function Xh(){window.addEventListener("unhandledrejection",e=>{e.reason instanceof Error?console.error(e.reason.message):console.error(e.reason)})}const Xc=u=>Te(exports,[u],function*({defaultDataSource:e,url:r,token:t,wat:n,ssoEnabled:o,appConfig:a,enableSilentPreAuth:i,useFusionAuth:l}){if(r===void 0)throw new s.TranslatableError("errors.sisenseContextNoAuthentication");const c=Hn(r),d=Ef({url:c,token:t,wat:n,ssoEnabled:o,enableSilentPreAuth:i,useFusionAuth:l});if(!d)throw new s.TranslatableError("errors.sisenseContextNoAuthentication");Xh();const f=new Pf(c,d,"sdk-ui-1.34.0"),h=yield f.login(),m=jc(d)||!h,y=yield qh(a||{},f,m),b=new s.UB(Kh(c,y.user.tenant.name),d),v=new Yh(f,b),x={clear:s.clearExecuteQueryCache};return{httpClient:f,pivotClient:b,queryClient:v,settings:y,defaultDataSource:e,queryCache:x}}),el=e=>e,Zh=()=>{let e=el;return{configure(r){e=r},generate(r){return e(r)},reset(){e=el}}},Jh=Zh(),em={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function tm(e,r,t="Mui"){const n=em[r];return n?`${t}-${n}`:`${Jh.generate(e)}-${r}`}const nm=["ownerState"],rm=["variants"],om=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function am(e){return Object.keys(e).length===0}function sm(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Sa(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const im=p.createTheme(),tl=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function jr({defaultTheme:e,theme:r,themeId:t}){return am(r)?e:r[t]||r}function lm(e){return e?(r,t)=>t[e]:null}function Gr(e,r){let{ownerState:t}=r,n=p._objectWithoutPropertiesLoose(r,nm);const o=typeof e=="function"?e(s._extends({ownerState:t},n)):e;if(Array.isArray(o))return o.flatMap(a=>Gr(a,s._extends({ownerState:t},n)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:a=[]}=o;let l=p._objectWithoutPropertiesLoose(o,rm);return a.forEach(u=>{let c=!0;typeof u.props=="function"?c=u.props(s._extends({ownerState:t},n,t)):Object.keys(u.props).forEach(d=>{(t==null?void 0:t[d])!==u.props[d]&&n[d]!==u.props[d]&&(c=!1)}),c&&(Array.isArray(l)||(l=[l]),l.push(typeof u.style=="function"?u.style(s._extends({ownerState:t},n,t)):u.style))}),l}return o}function cm(e={}){const{themeId:r,defaultTheme:t=im,rootShouldForwardProp:n=Sa,slotShouldForwardProp:o=Sa}=e,a=i=>p.styleFunctionSx(s._extends({},i,{theme:jr(s._extends({},i,{defaultTheme:t,themeId:r}))}));return a.__mui_systemSx=!0,(i,l={})=>{p.internal_processStyles(i,D=>D.filter(_=>!(_!=null&&_.__mui_systemSx)));const{name:u,slot:c,skipVariantsResolver:d,skipSx:f,overridesResolver:h=lm(tl(c))}=l,m=p._objectWithoutPropertiesLoose(l,om),y=d!==void 0?d:c&&c!=="Root"&&c!=="root"||!1,b=f||!1;let v;process.env.NODE_ENV!=="production"&&u&&(v=`${u}-${tl(c||"Root")}`);let x=Sa;c==="Root"||c==="root"?x=n:c?x=o:sm(i)&&(x=void 0);const w=p.styled(i,s._extends({shouldForwardProp:x,label:v},m)),T=D=>typeof D=="function"&&D.__emotion_real!==D||p.isPlainObject(D)?_=>Gr(D,s._extends({},_,{theme:jr({theme:_.theme,defaultTheme:t,themeId:r})})):D,S=(D,..._)=>{let E=T(D);const F=_?_.map(T):[];u&&h&&F.push(I=>{const H=jr(s._extends({},I,{defaultTheme:t,themeId:r}));if(!H.components||!H.components[u]||!H.components[u].styleOverrides)return null;const B=H.components[u].styleOverrides,R={};return Object.entries(B).forEach(([O,A])=>{R[O]=Gr(A,s._extends({},I,{theme:H}))}),h(I,R)}),u&&!y&&F.push(I=>{var H;const B=jr(s._extends({},I,{defaultTheme:t,themeId:r})),R=B==null||(H=B.components)==null||(H=H[u])==null?void 0:H.variants;return Gr({variants:R},s._extends({},I,{theme:B}))}),b||F.push(a);const N=F.length-_.length;if(Array.isArray(D)&&N>0){const I=new Array(N).fill("");E=[...D,...I],E.raw=[...D.raw,...I]}const j=w(E,...F);if(process.env.NODE_ENV!=="production"){let I;u&&(I=`${u}${p.capitalize(c||"")}`),I===void 0&&(I=`Styled(${p.getDisplayName(i)})`),j.displayName=I}return i.muiName&&(j.muiName=i.muiName),j};return w.withConfig&&(S.withConfig=w.withConfig),S}}const um=cm();function dm(e){const{theme:r,name:t,props:n}=e;return!r||!r.components||!r.components[t]||!r.components[t].defaultProps?n:p.resolveProps(r.components[t].defaultProps,n)}function pm({props:e,name:r,defaultTheme:t,themeId:n}){let o=p.useTheme(t);return n&&(o=o[n]||o),dm({theme:o,name:r,props:e})}function fm(e,r,t=void 0){const n={};return Object.keys(e).forEach(o=>{n[o]=e[o].reduce((a,i)=>{if(i){const l=r(i);l!==""&&a.push(l),t&&t[i]&&a.push(t[i])}return a},[]).join(" ")}),n}const hm=["component","direction","spacing","divider","children","className","useFlexGap"],mm=p.createTheme(),gm=um("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,r)=>r.root});function ym(e){return pm({props:e,name:"MuiStack",defaultTheme:mm})}function bm(e,r){const t=Y.Children.toArray(e).filter(Boolean);return t.reduce((n,o,a)=>(n.push(o),a<t.length-1&&n.push(Y.cloneElement(r,{key:`separator-${a}`})),n),[])}const vm=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],xm=({ownerState:e,theme:r})=>{let t=s._extends({display:"flex",flexDirection:"column"},p.handleBreakpoints({theme:r},p.resolveBreakpointValues({values:e.direction,breakpoints:r.breakpoints.values}),n=>({flexDirection:n})));if(e.spacing){const n=p.createUnarySpacing(r),o=Object.keys(r.breakpoints.values).reduce((u,c)=>((typeof e.spacing=="object"&&e.spacing[c]!=null||typeof e.direction=="object"&&e.direction[c]!=null)&&(u[c]=!0),u),{}),a=p.resolveBreakpointValues({values:e.direction,base:o}),i=p.resolveBreakpointValues({values:e.spacing,base:o});typeof a=="object"&&Object.keys(a).forEach((u,c,d)=>{if(!a[u]){const h=c>0?a[d[c-1]]:"column";a[u]=h}});const l=(u,c)=>e.useFlexGap?{gap:p.getValue(n,u)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${vm(c?a[c]:e.direction)}`]:p.getValue(n,u)}};t=p.deepmerge(t,p.handleBreakpoints({theme:r},i,l))}return t=p.mergeBreakpointsInOrder(r.breakpoints,t),t};function wm(e={}){const{createStyledComponent:r=gm,useThemeProps:t=ym,componentName:n="MuiStack"}=e,o=()=>fm({root:["root"]},u=>tm(n,u),{}),a=r(xm),i=Y.forwardRef(function(u,c){const d=t(u),f=p.extendSxProp(d),{component:h="div",direction:m="column",spacing:y=0,divider:b,children:v,className:x,useFlexGap:w=!1}=f,T=p._objectWithoutPropertiesLoose(f,hm),S={direction:m,spacing:y,useFlexGap:w},D=o();return se.jsx(a,s._extends({as:h,ownerState:S,ref:c,className:p.clsx(D.root,x)},T,{children:b?bm(v,b):v}))});return process.env.NODE_ENV!=="production"&&(i.propTypes={children:p.PropTypes.node,direction:p.PropTypes.oneOfType([p.PropTypes.oneOf(["column-reverse","column","row-reverse","row"]),p.PropTypes.arrayOf(p.PropTypes.oneOf(["column-reverse","column","row-reverse","row"])),p.PropTypes.object]),divider:p.PropTypes.node,spacing:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string])),p.PropTypes.number,p.PropTypes.object,p.PropTypes.string]),sx:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object,p.PropTypes.bool])),p.PropTypes.func,p.PropTypes.object])}),i}function Zc(e,r){var t,n;return Y.isValidElement(e)&&r.indexOf((t=e.type.muiName)!=null?t:(n=e.type)==null||(n=n._payload)==null||(n=n.value)==null?void 0:n.muiName)!==-1}const Cm=["children","className","disableTypography","inset","primary","primaryTypographyProps","secondary","secondaryTypographyProps"],Tm=e=>{const{classes:r,inset:t,primary:n,secondary:o,dense:a}=e,i={root:["root",t&&"inset",a&&"dense",n&&o&&"multiline"],primary:["primary"],secondary:["secondary"]};return p.composeClasses(i,p.getListItemTextUtilityClass,r)},Sm=p.styled$1("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[{[`& .${p.listItemTextClasses.primary}`]:r.primary},{[`& .${p.listItemTextClasses.secondary}`]:r.secondary},r.root,t.inset&&r.inset,t.primary&&t.secondary&&r.multiline,t.dense&&r.dense]}})(({ownerState:e})=>s._extends({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4},e.primary&&e.secondary&&{marginTop:6,marginBottom:6},e.inset&&{paddingLeft:56})),Jc=Y.forwardRef(function(r,t){const n=p.useDefaultProps({props:r,name:"MuiListItemText"}),{children:o,className:a,disableTypography:i=!1,inset:l=!1,primary:u,primaryTypographyProps:c,secondary:d,secondaryTypographyProps:f}=n,h=p._objectWithoutPropertiesLoose(n,Cm),{dense:m}=Y.useContext(p.ListContext);let y=u!=null?u:o,b=d;const v=s._extends({},n,{disableTypography:i,inset:l,primary:!!y,secondary:!!b,dense:m}),x=Tm(v);return y!=null&&y.type!==p.Typography&&!i&&(y=se.jsx(p.Typography,s._extends({variant:m?"body2":"body1",className:x.primary,component:c!=null&&c.variant?void 0:"span",display:"block"},c,{children:y}))),b!=null&&b.type!==p.Typography&&!i&&(b=se.jsx(p.Typography,s._extends({variant:"body2",className:x.secondary,color:"text.secondary",display:"block"},f,{children:b}))),se.jsxs(Sm,s._extends({className:p.clsx(x.root,a),ownerState:v,ref:t},h,{children:[y,b]}))});process.env.NODE_ENV!=="production"&&(Jc.propTypes={children:p.PropTypes.node,classes:p.PropTypes.object,className:p.PropTypes.string,disableTypography:p.PropTypes.bool,inset:p.PropTypes.bool,primary:p.PropTypes.node,primaryTypographyProps:p.PropTypes.object,secondary:p.PropTypes.node,secondaryTypographyProps:p.PropTypes.object,sx:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object,p.PropTypes.bool])),p.PropTypes.func,p.PropTypes.object])});const rn=(e,r)=>`${r}px solid ${e}`,eu=e=>({columns:[{widthPercentage:100,rows:e.map(r=>({cells:[{widthPercentage:100,widgetId:r.id}]}))}]});function tu(e){return p.isString(e)?{direction:e}:e}function nl(e,r){return{valuesIndex:e.field-(r.rows||[]).length-(r.columns||[]).length,columnsMembersPath:Object.values(e.measurePath||{})}}function Dm({type:e,settings:r,sortDetails:t},n){return e==="simple"?t.field>=(n.rows||[]).length?[{rowIndex:0,sort:{direction:s.getSortType(r[0].direction),by:nl(t,n)}}]:[{rowIndex:t.field,sort:{direction:s.getSortType(r[0].direction)}}]:r.reduce((o,a,i)=>{var f;const l=(f=n.rows)==null?void 0:f[i],u=(l==null?void 0:l.sortType)&&tu(l==null?void 0:l.sortType),c={direction:s.getSortType(a.direction),by:nl(t,n)};return!a.selected&&s.isEqual(u==null?void 0:u.by,c.by)&&o.push({rowIndex:i,sort:null}),a.selected&&o.push({rowIndex:i,sort:c}),o},[])}function km(e){const{jaql:r,pivotBuilder:t,isForceReload:n}=e,[o,a]=g.useState({isLoading:!1,isNoResults:!1}),i=p.useHasChanged(r);g.useEffect(()=>{r&&(i||n)&&t.updateJaql(r)},[n,i,r,t]);const l=g.useCallback(()=>{a({isLoading:!0,isNoResults:!1})},[]),u=g.useCallback(c=>{a({isLoading:!1,isNoResults:!c.cellsMetadata})},[]);return g.useEffect(()=>{const c=[{event:s.lv,handler:l},{event:s.cv,handler:u}];return c.forEach(({event:d,handler:f})=>{t.on(d,f)}),()=>{c.forEach(({event:d,handler:f})=>{t.off(d,f)})}},[t,l,u]),o}function _m(e){const{pivotClient:r,pivotBuilder:t,shouldBeRecreated:n}=e,[o,a]=g.useState(()=>r.prepareDataService());return g.useEffect(()=>{if(n){const i=r.prepareDataService();a(i),t.updateDataService(i)}},[r,t,n]),g.useEffect(()=>()=>{o.destroy()},[o]),o}const Em=({dataOptions:e})=>{const[r,t]=g.useState(p.translatePivotTableDataOptions(e));return{dataOptionsInternal:r,updateSort(n){var o;t(k(C({},r),{rows:(o=r.rows)==null?void 0:o.map((a,i)=>{const l=n.rows.find(({rowIndex:u})=>u===i);return l?l.sort===null?s.safeCombine(a,{sortType:void 0}):s.safeCombine(a,{sortType:l.sort}):a})}))}}},Mm=e=>(r,t,n,o)=>{var u;const a=s.getPivotDataOptionByJaqlIndex(e,(u=o==null?void 0:o.field)==null?void 0:u.index),i=s.getNumberFormatConfig(a),l=r.value===null||typeof r.value=="undefined";r.content=l?"":s.applyFormatPlainText(i,r.value)},Pm=()=>(e,r,t)=>{var c,d;const n=e.userType===s.nt.CORNER,o=e.userType===s.nt.SUB_TOTAL;if(!r||n||o)return;const a=t.metadata.find(({panel:f,jaql:h})=>{var x;const m=["rows","columns"].includes(f),y=h.dim===r.jaql.dim,b=r.jaql.datatype===h.datatype&&r.jaql.level===h.level,v=(x=h.in)==null?void 0:x.selected;return m&&y&&b&&v}),i=(d=(c=a==null?void 0:a.jaql)==null?void 0:c.in)==null?void 0:d.selected;if(!i)return;Uf(i.jaql)(e.value)&&(e.state={isSelected:!0})};function Om(e,r){return t=>{var n,o,a,i;if(t.userType===s.nt.SUB_TOTAL&&(t.content=r("pivotTable.subTotal",{value:(n=t.content)!=null?n:""})),t.userType===s.nt.GRAND_TOTAL){if(t.metadataType===s.xe.ROWS&&(t.content=r("pivotTable.grandTotal"),((o=e.values)==null?void 0:o.length)===1&&!((a=e.columns)!=null&&a.length))){const[l]=e.values,u="column"in l?l.column:l;t.content=(i=u.name)!=null?i:t.content}t.metadataType===s.xe.COLUMNS&&t.parent&&(t.content=r("pivotTable.grandTotal"))}}}const Am="#000000",Fm="#ffffff";function Rm(e,r){return(t,n,o,a)=>{var d;const i={};if(n.userType===s.nt.SUB_TOTAL||n.userType===s.nt.GRAND_TOTAL||o.userType===s.nt.SUB_TOTAL||o.userType===s.nt.GRAND_TOTAL||o.parent&&o.parent.userType===s.nt.SUB_TOTAL||o.parent&&o.parent.userType===s.nt.GRAND_TOTAL)return;const l=s.getPivotDataOptionByJaqlIndex(e,(d=a==null?void 0:a.field)==null?void 0:d.index),u=l==null?void 0:l.color,c=l==null?void 0:l.dataBarsColor;if(u){const f=s.getColoringServiceByColorOptions(u);if(f.type==="Static"||f.type==="Absolute"){const h=f.getColor(t.value);h&&(i.backgroundColor=h)}else if(f.type==="Relative"){const h=u,[m]=r.palette.variantColors,y=m?s.scaleBrightness(m,.2):Am,b=m?s.scaleBrightness(m,-.2):Fm,v={steps:h.steps,min:h.minColor,max:h.maxColor,minDef:y,maxDef:b,minGray:s.toGray(y),maxGray:s.toGray(b)};t.store=t.store||{},t.store.compileRange=({min:x,max:w,minvalue:T,midvalue:S,maxvalue:D})=>s.getInterpolatorFn(x!=null?x:"#000000",w!=null?w:"#ffffff",T!=null?T:0,S!=null?S:0,D!=null?D:0),t.store.compileRangeContext={},t.store.compileRangeArgs=v}}if(c){const f=s.getColoringServiceByColorOptions(c);if(f.type==="Static"||f.type==="Absolute"){const h=f.getColor(t.value);h&&(i.databarColor=h)}}Object.keys(i).length>0&&(t.style=t.style||{},Object.assign(t.style,i))}}const Lm=({dataService:e,dataOptions:r})=>{const{app:t}=s.useSisenseContext(),{t:n}=s.useTranslation(),{themeSettings:o}=s.useThemeContext(),a=g.useCallback(s.over([Mm(r),Rm(r,o)]),[r]),i=g.useCallback((u,c)=>s.applyDateFormat(u,c,t==null?void 0:t.settings.locale,t==null?void 0:t.settings.dateConfig),[t]),l=g.useCallback(s.over([s.createHeaderCellValueFormatter(r,i),Om(r,n),Pm()]),[r,n]);g.useEffect(()=>(e.on(s.rE,a),e.on(s.am,l),()=>{e.off(s.rE,a),e.off(s.am,l)}),[e,a])};function rl(e,r){return p.dataLoadStateReducer(e,r)}const Nm=p.withTracking("useExecutePivotQuery")(nu);function nu(e){const r=jm(e),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(rl,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext();return g.useEffect(()=>{if(a||o({type:"error",error:new s.TranslatableError("errors.executeQueryNoSisenseContext")}),t(i)){o({type:"loading"});const{dataSource:l,rows:u,columns:c,values:d,grandTotals:f,filters:h,highlights:m,count:y,offset:b,onBeforeQuery:v}=e,{filters:x,relations:w}=s.getFilterListAndRelationsJaql(h);s.executePivotQuery({dataSource:l,rows:u,columns:c,values:d,grandTotals:f,filters:x,filterRelations:w,highlights:m,count:y,offset:b},i,{onBeforeQuery:v}).then(T=>{o({type:"success",data:T})}).catch(T=>{o({type:"error",error:T})})}},[i,a,e,t]),n.data&&r?rl(n,{type:"loading"}):n}const Im=["dataSource","rows","columns","values","grandTotals","count","offset","onBeforeQuery"];function jm(e){return p.useHasChanged(e,Im,(r,t)=>{const{filters:n}=s.getFilterListAndRelationsJaql(t.filters),{filters:o}=s.getFilterListAndRelationsJaql(r.filters);return p.isFiltersChanged(n,o)||p.isFiltersChanged(t.highlights,r.highlights)})}function ru(e,r){const[t,n]=g.useState(e),o=g.useMemo(()=>p.debounce(a=>{n(a)},r),[r]);return g.useEffect(()=>{o(e)},[e,o]),t}const Wm=200,ol=e=>C({attribute:s.translateColumnToAttribute(e),includeSubTotals:e.includeSubTotals||!1},e.sortType&&{sort:tu(e.sortType)}),Bm=e=>{var r;return{measure:s.translateColumnToMeasure(e),totalsCalculation:e.totalsCalculation,dataBars:e.dataBars||!1,shouldRequestMinMax:((r=e.color)==null?void 0:r.type)==="range"}},ou=e=>{const{rows:r=[],columns:t=[],values:n=[],grandTotals:o}=e,a=r.flatMap(ol),i=t.flatMap(ol),l=n.flatMap(Bm);return{rows:a,columns:i,values:l,grandTotals:o}},Hm=({dataSet:e,dataOptionsInternal:r,filters:t,highlights:n})=>{const[o,a]=g.useState(),{rows:i,columns:l,values:u,grandTotals:c}=ou(r),d=g.useCallback(m=>{a(y=>s.isEqual(y,m)?y:m)},[a]),f=ru({dataSource:e,rows:i,columns:l,values:u,grandTotals:c,filters:t,highlights:n,onBeforeQuery:d},Wm),{error:h}=nu(f);return{jaql:o,error:h}},Ym="#cbced7",$m="#ffff9c";function Um(e,r){var o,a,i,l,u,c,d,f,h,m,y;let t,n;if((o=r==null?void 0:r.chart)!=null&&o.backgroundColor){const b=s.getDarkFactor(s.toColor((a=r==null?void 0:r.chart)==null?void 0:a.backgroundColor))<.5?.07:-.07;t=s.getSlightlyDifferentColor((i=r==null?void 0:r.chart)==null?void 0:i.backgroundColor,b),n=s.getSlightlyDifferentColor((l=r==null?void 0:r.chart)==null?void 0:l.backgroundColor,b*1.5)}return{fontFamily:(u=r==null?void 0:r.typography)==null?void 0:u.fontFamily,textColor:(c=r==null?void 0:r.chart)==null?void 0:c.textColor,backgroundColor:(d=r==null?void 0:r.chart)==null?void 0:d.backgroundColor,borderColor:Ym,fillColor:t,additionalFillColor:n,fillOptions:{alternatingRows:e==null?void 0:e.alternatingRowsColor,alternatingColumns:e==null?void 0:e.alternatingColumnsColor,columnsHeaders:e==null?void 0:e.headersColor,rowMembers:e==null?void 0:e.membersColor,totals:e==null?void 0:e.totalsColor},rowHeight:e==null?void 0:e.rowHeight,isAutoHeight:(f=e==null?void 0:e.isAutoHeight)!=null?f:!1,navigationPrimaryColor:(h=r==null?void 0:r.typography)==null?void 0:h.primaryTextColor,navigationSecondaryColor:(m=r==null?void 0:r.typography)==null?void 0:m.secondaryTextColor,selectionColor:(y=e==null?void 0:e.highlightColor)!=null?y:$m}}const Vm=25;function zm({nodeRef:e,pivotBuilder:r,dataOptions:t,styleOptions:n,themeSettings:o,size:a,onTotalHeightChange:i}){const[l,u]=p.useSyncedState((n==null?void 0:n.rowsPerPage)||Vm),c=g.useCallback((m,y)=>{const v=[...t.rows?t.rows:[],...t.columns?t.columns:[],...t.values?t.values:[]].map(w=>w==null?void 0:w.width);if(y){const[w,T]=y,S=m[w];S&&typeof S.jaqlIndex!="undefined"&&(v[S.jaqlIndex]=T)}const x=[];return m.forEach((w,T)=>{typeof w.jaqlIndex!="undefined"&&typeof v[w.jaqlIndex]!="undefined"&&x.push([T,v[w.jaqlIndex]])}),x},[t]),d=g.useCallback(m=>{u(m)},[u]),f=g.useMemo(()=>Um(n,o),[n,o]),h=g.useMemo(()=>a?C({width:a.width,height:a.height,isPaginated:!0,itemsPerPage:l,isSelectedMode:!0,onUpdatePredefinedColumnWidth:c,onItemsPerPageChange:d,onTotalHeightChange:i},f):null,[a,l,c,f,i,d]);g.useEffect(()=>{e.current&&h&&(!!e.current.children.length?r.updateProps(h):r.render(e.current,h))},[e,r,h])}function qm(e){const{pivotClient:r}=e,t=g.useMemo(()=>r.preparePivotBuilder(),[r]);return g.useEffect(()=>()=>{t.destroy()},[t]),t}const au=p.asSisenseComponent({componentName:"PivotTable"})(e=>{const{dataSet:r,dataOptions:t,filters:n,highlights:o,refreshCounter:a=0}=e,i=g.useMemo(()=>{var I;return(I=e.styleOptions)!=null?I:{}},[e.styleOptions]),l=g.useRef(null),[u,c]=g.useState(null),[d,f]=g.useState(null),{app:h}=s.useSisenseContext(),{themeSettings:m}=s.useThemeContext(),y=h==null?void 0:h.pivotClient;if(!y)throw new s.TranslatableError("errors.noPivotClient");const{dataOptionsInternal:b,updateSort:v}=Em({dataOptions:t}),{error:x,jaql:w}=Hm({dataSet:r,dataOptionsInternal:b,filters:n,highlights:o});if(x)throw x;const T=qm({pivotClient:y}),S=p.useHasChanged(w),D=a>0&&p.useHasChanged(a),_=_m({pivotClient:y,pivotBuilder:T,shouldBeRecreated:S||D});Lm({dataService:_,dataOptions:t}),zm({nodeRef:l,pivotBuilder:T,dataOptions:t,styleOptions:i,themeSettings:m,size:u,onTotalHeightChange:f});const{isLoading:E,isNoResults:F}=km({jaql:w,pivotBuilder:T,isForceReload:D}),N=g.useCallback(I=>{const H=Dm(I,b);v({rows:H})},[b,v]);g.useEffect(()=>(T.on(s.uv,N),()=>{T.off(s.uv,N)}),[T,N]);const j=g.useCallback(I=>{(I.width!==(u==null?void 0:u.width)||I.height!==(u==null?void 0:u.height))&&c(I)},[u,c]);return s.jsx(p.DynamicSizeContainer,{defaultSize:p.DEFAULT_PIVOT_TABLE_SIZE,size:{width:i==null?void 0:i.width,height:i!=null&&i.isAutoHeight&&!F&&d!=null?d:i==null?void 0:i.height},onSizeChange:j,children:s.jsx(p.LoadingOverlay,{themeSettings:m,isVisible:E,children:s.jsxs(s.Fragment,{children:[F&&s.jsx(p.NoResultsOverlay,{iconType:"table"}),s.jsx("div",{ref:l,"aria-label":"pivot-table-root"})]})})})}),vs=p.asSisenseComponent({componentName:"PivotTableWidget"})(e=>{var f;const[r,t]=g.useState(0),{app:n}=s.useSisenseContext(),{styleOptions:o,dataSource:a=n==null?void 0:n.defaultDataSource,dataOptions:i}=e,l=p.getWidgetDefaultSize("pivot",{hasHeader:!((f=o==null?void 0:o.header)!=null&&f.hidden)}),h=e.styleOptions||{},{width:u,height:c}=h,d=le(h,["width","height"]);return i?s.jsx(p.DynamicSizeContainer,{defaultSize:l,size:{width:u,height:o!=null&&o.isAutoHeight?void 0:c},children:s.jsx(p.WidgetContainer,k(C({},e),{dataSetName:a&&s.getDataSourceName(a),onRefresh:()=>t(r+1),children:s.jsx(au,{dataSet:e.dataSource,dataOptions:e.dataOptions,styleOptions:d,filters:e.filters,highlights:e.highlights,refreshCounter:r})}))}):null}),Qm=e=>{const r=[],t=n=>{Array.isArray(n)?n.forEach(t):typeof n=="object"&&n!==null&&(n.widgetid&&r.push(n.widgetid),Object.values(n).forEach(t))};return t(e.layout),r},Gm=e=>"levels"in e&&e.isCascading===!0;function Km(e,r){if(!e)return[];return t(e);function t(n){var o,a;if(p.isRelationsRuleIdNode(n))return[{nodeType:"attribute",attribute:((a=(o=p.findFilterByGuid(r,n.instanceid))==null?void 0:o.attribute)==null?void 0:a.name)||n.instanceid}];if(p.isRelationsRule(n))return[{nodeType:"openBracket"},...t(n.left),{nodeType:"operator",operator:n.operator},...t(n.right),{nodeType:"closeBracket"}];throw new p.UnknownRelationsNodeError}}function lo(e=[],r=[],t){switch(t){case"widgetFirst":return p.mergeFiltersOrFilterRelations(r,e);case"codeFirst":return p.mergeFiltersOrFilterRelations(e,r);case"codeOnly":return r;default:return p.mergeFiltersOrFilterRelations(e,r)}}var Xm=function(e){return e.FILTER="filter",e.SELECT="select",e}({});function al(e){return!!e&&e.min!==null&&e.max!==null}var Zm=function(e){return e.PRE="pre",e.POST="post",e}({});function su(e){return"formula"in e}function iu(e){return"formulaRef"in e}const Jm=e=>({columns:(e.columns||[]).map(r=>({widthPercentage:r.width,rows:(r.cells||[]).map(t=>{const n=t.subcells.reduce((o,a)=>o+a.width,0);return{cells:t.subcells.map(o=>({widthPercentage:n<100?o.width/(n/100):o.width,height:o.elements[0].height,widgetId:o.elements[0].widgetid}))}})}))}),eg=e=>s.createFilterFromJaql(e.jaql,e.instanceid,e.disabled,e.locked),tg=e=>{const{levels:r,instanceid:t,disabled:n,locked:o}=e,a=r.map(i=>s.createFilterFromJaql(i,i.instanceid));return new s.CascadingFilter(a,{guid:t,disabled:n,locked:o})};function ng(e,r){const t=e.map(o=>Gm(o)?tg(o):eg(o));if(!r)return t;const n=p.convertFilterRelationsModelToRelationRules(r,t);return!n||p.isTrivialSingleNodeRelations(n)?t:p.combineFiltersAndRelations(t,n)}const rg=e=>e.subtype==="WidgetsTabber";function og(e=[]){const r={};return e.forEach(t=>{var n,o,a,i;r[t.oid]={filtersOptions:{applyMode:((n=t.options)==null?void 0:n.dashboardFiltersMode)==="filter"?p.CommonFiltersApplyMode.FILTER:p.CommonFiltersApplyMode.HIGHLIGHT,shouldAffectFilters:(o=t.options)==null?void 0:o.selector,ignoreFilters:{all:(a=t.metadata.ignore)==null?void 0:a.all,ids:(i=t.metadata.ignore)==null?void 0:i.ids},forceApplyBackgroundFilters:!0}}}),r}function ag(e=[]){const r={};return e.forEach(t=>{rg(t)&&(r[t.oid]={tabs:t.style.tabs,activeTab:parseInt(t.style.activeTab||"1",10)})}),r}function sg(e,r){return Te(this,null,function*(){var o;const t=ig(e.widgets||[]);if(t.length===0)return e;const n=yield r.getSharedFormulas(t);return k(C({},e),{widgets:(o=e.widgets)==null?void 0:o.map(a=>lg(a,n))})})}function ig(e){const r=e.flatMap(t=>t.metadata.panels.flatMap(n=>n.items.flatMap(o=>!su(o.jaql)||!o.jaql.context?[]:Object.values(o.jaql.context).filter(iu).map(i=>i.formulaRef))));return Array.from(new Set(r))}function lg(e,r){const t=e.metadata.panels.map(n=>{const o=n.items.map(a=>{const{jaql:i}=a;if(!su(i)||!i.context)return a;const l=Object.fromEntries(Object.entries(i.context).map(([u,c])=>iu(c)?[u,r[c.formulaRef]]:[u,c]));return k(C({},a),{jaql:k(C({},i),{context:l})})});return k(C({},n),{items:o})});return k(C({},e),{metadata:k(C({},e.metadata),{panels:t})})}function lu(a,i){return Te(this,arguments,function*(e,r,t={},n,o){var y,b;const{includeWidgets:l,includeFilters:u}=t,c=new s.RestApi(e),d=["oid","title","datasource","style"],f=((y=e.auth)==null?void 0:y.type)==="wat";l&&d.push("layout"),u&&(d.push("filters"),d.push("filterRelations"));const h=yield c.getDashboard(r,{fields:d});if(!h)throw new s.TranslatableError("errors.dashboardWithOidNotFound",{dashboardOid:r});if(l){let v;if(f){const x=Qm(h);v=(yield Promise.all(x.map(T=>c.getWidget(T,h.oid)))).filter(T=>T!==void 0)}else v=(yield c.getDashboardWidgets(r))||[];h.widgets=v}if((b=h.style)!=null&&b.paletteId&&!h.style.palette){const v=yield c.getPalettes(),x=v==null?void 0:v.find(({_id:w})=>{var T;return w===((T=h.style)==null?void 0:T.paletteId)});x&&(h.style.palette={name:x.name,colors:x.colors})}const m=yield sg(h,c);return Ps(m,n,o)})}const cu=(e,r)=>{const t={};for(const n of e){const o=r(n);o in t||(t[o]=n)}return Object.values(t)};function uu(t){return Te(this,arguments,function*(e,r={}){const{includeWidgets:n,searchByTitle:o}=r,a=new s.RestApi(e),i=[];let l=["oid","title","datasource"];n&&(l=[],i.push("widgets"));const u=yield a.getDashboards({fields:l,expand:i,searchByTitle:o});if(!u)return[];const c=cu(u,d=>d.oid);return c.length!==u.length&&console.warn("Removing detected duplicate dashboard(s)"),c.map(d=>Ps(d))})}const du=p.withTracking("useGetDashboardModel")(pu);function pu(e){const r=p.useHasChanged(e,["dashboardOid"]),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext(),{themeSettings:l}=s.useThemeContext();return g.useEffect(()=>{if(a||o({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(i)){o({type:"loading"});const{dashboardOid:u,includeWidgets:c,includeFilters:d}=e;lu(i.httpClient,u,{includeWidgets:c,includeFilters:d},l,i.settings).then(f=>{o({type:"success",data:f})}).catch(f=>{o({type:"error",error:f})})}},[i,a,e,t,l]),n.data&&r?Ya(p.dataLoadStateReducer(n,{type:"loading"})):Ya(n)}function Ya(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{dashboard:r})}const cg=p.withTracking("useGetDashboardModels")(ug);function ug(e={}){const r=p.useHasChanged(e,["includeWidgets"]),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext();return g.useEffect(()=>{a||o({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(i)&&(o({type:"loading"}),uu(i.httpClient,e).then(l=>{o({type:"success",data:l})}).catch(l=>{o({type:"error",error:l})}))},[i,a,e,t]),n.data&&r?$a(p.dataLoadStateReducer(n,{type:"loading"})):$a(n)}function $a(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{dashboards:r})}const fu=o=>Te(exports,[o],function*({widgetOid:e,dashboardOid:r,includeDashboard:t,api:n}){const[a,i]=yield Promise.all([n.getWidget(e,r),t?n.getDashboard(r):void 0]);return{widget:a,dashboard:i}});function hu(e,r,t,n,o){return Te(this,null,function*(){const a=new s.RestApi(e),{widget:i}=yield fu({widgetOid:t,dashboardOid:r,api:a});if(!i)throw new s.TranslatableError("errors.widgetWithOidNotFound",{widgetOid:t});return wr(i,n,o)})}const dg=p.withTracking("useGetWidgetModel")(mu);function mu(e){const r=p.useHasChanged(e,["dashboardOid","widgetOid"]),t=p.useShouldLoad(e,r),{themeSettings:n}=s.useThemeContext(),[o,a]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:i,app:l}=s.useSisenseContext();return g.useEffect(()=>{if(i||a({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(l)){a({type:"loading"});const{dashboardOid:u,widgetOid:c}=e;hu(l.httpClient,u,c,n,l.settings).then(d=>{a({type:"success",data:d})}).catch(d=>{a({type:"error",error:d})})}},[l,i,e,t,n]),o.data&&r?sl(p.dataLoadStateReducer(o,{type:"loading"})):sl(o)}function sl(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{widget:r})}function pg(e,r,t){var n;return t(e,function(o,a,i){if(r(o,a,i))return n=a,!1}),n}function fg(e,r){return pg(e,s.baseIteratee(r),s.baseForOwn)}function hg(e){return e.percent||e.type==="percent"?"Percent":e.currency?"Currency":"Numbers"}function mg(e){return e.decimals!==void 0&&e.decimals!=="auto"?typeof e.decimals=="string"?Number.parseFloat(e.decimals):e.decimals:"auto"}function gg(e){var n,o,a,i,l,u,c,d,f;const r=e.jaql.datatype==="numeric"||e.jaql.agg==="count"||"context"in e.jaql,t=(n=e.format)==null?void 0:n.mask;return r&&t?{decimalScale:mg(t),kilo:(o=t.abbreviations)==null?void 0:o.k,million:(a=t.abbreviations)==null?void 0:a.m,billion:(i=t.abbreviations)==null?void 0:i.b,trillion:(l=t.abbreviations)==null?void 0:l.t,thousandSeparator:(c=(u=t.number)==null?void 0:u.separated)!=null?c:t.separated,prefix:((d=t.currency)==null?void 0:d.position)===Zm.PRE,symbol:(f=t.currency)==null?void 0:f.symbol,name:hg(t)}:null}const yg=!0;function bg(e,r){if(!r||!yg)return e;const{forecast:t,trend:n}=r;let o=C({},e);return t&&!t.isViewerDisabled&&t.isEnabled&&(o=k(C({},o),{forecast:{confidenceInterval:t.confidence/100,forecastHorizon:t.forecastPeriod,modelType:"auto"}})),n&&!n.isViewerDisabled&&n.isEnabled&&(o=k(C({},o),{trend:{modelType:n.trendType}})),o}const vg=e=>{var r,t,n,o,a,i,l;return e.jaql&&"level"in e.jaql?(a=(t=(r=e.format)==null?void 0:r.mask)==null?void 0:t[e.jaql.level])!=null?a:(o=(n=e.format)==null?void 0:n.mask)==null?void 0:o.dateAndTime:(l=(i=e.format)==null?void 0:i.mask)==null?void 0:l.dateAndTime};function ln(e,r){var d,f,h,m,y,b,v,x;const t=s.createDimensionalElementFromJaql(e.jaql,vg(e),e.panel),n=s.getSortType((d=e.jaql.sort)!=null?d:e.categoriesSorting),o=gg(e),a=(f=e.format)==null?void 0:f.subtotal,i=(h=e.format)==null?void 0:h.width;let l=s.createValueColorOptions((m=e.format)==null?void 0:m.color,r);const u=s.createValueColorOptions((y=e.format)==null?void 0:y.colorSecond,r),c=e.panel==="columns"&&e.panel;if(!l&&!((b=e.format)!=null&&b.color)&&e.format&&"colorIndex"in e.format&&(l=s.createValueColorOptions({type:"color",colorIndex:e.format.colorIndex},r)),s.MetadataTypes.isMeasure(t)){const w=e.y2,T=e.singleSeriesType,S="subtotalAgg"in e.jaql&&e.jaql.subtotalAgg,D=(v=e.format)==null?void 0:v.databars,_=C(C(C(C(C(C(C(C(C(C({column:t},l&&{color:l}),u&&{dataBarsColor:u}),w&&{showOnRightAxis:w}),n&&{sortType:n}),T&&{chartType:T}),o&&{numberFormatConfig:o}),S&&{totalsCalculation:S}),D&&{dataBars:D}),i&&{width:i}),c&&{panel:c});return bg(_,e.statisticalModels)}return C(C(C(C(C(C({column:t,isColored:(x=e.isColored)!=null?x:!1},n&&{sortType:n}),o&&{numberFormatConfig:o}),a&&{includeSubTotals:a}),i&&{width:i}),l&&{color:l}),c&&{panel:c})}function Ct(e){const r=e.column;let t;if(s.MetadataTypes.isAttribute(r))t=r.jaql(!0);else if(s.MetadataTypes.isMeasure(r))t=r.jaql(!0);else throw new s.TranslatableError("errors.unsupportedDimensionalElement");return t.jaql?t:{jaql:t}}const gu=(e,r)=>{const t={};return e.forEach(n=>{n.name!=="filters"&&(t[p.camelCase(n.name)]=be(e,n.name,r))}),t};function Ua(e,r,t){return s.getEnabledPanelItems(e,r).map(s.getRootPanelItem).map(t)}function be(e,r,t){return Ua(e,r,n=>ln(n,t))}function xg(e,r,t){var d,f;const o=["chart/line","chart/area"].includes(r)?"x-axis":"categories",a=be(e,o,t),i=be(e,"values",t),l=be(e,"break by",t),u=(f=(d=s.getEnabledPanelItems(e,"break by")[0])==null?void 0:d.format)==null?void 0:f.members,c=u&&s.createValueToColorMap(u);return C({category:a,value:i,breakBy:l},c&&{seriesToColorMap:c})}function wg(e,r,t){var u,c,d,f;const n=be(r,"categories",t),o=be(r,"values",t),a=be(r,"size",t);let i,l;return e==="sunburst"?l=s.createValueToColorMultiColumnsMap(s.getEnabledPanelItems(r,"categories")):(i=(c=(u=s.getEnabledPanelItems(r,"categories")[0])==null?void 0:u.format)==null?void 0:c.members,s.getEnabledPanelItems(r,"color").length&&(i=(f=(d=s.getEnabledPanelItems(r,"color")[0])==null?void 0:d.format)==null?void 0:f.members),l=i&&s.createValueToColorMap(i)),C({category:n,value:[...o,...a]},l&&{seriesToColorMap:l})}function Cg(e,r){var c,d;const[t]=be(e,"x-axis",r),[n]=be(e,"y-axis",r),[o]=be(e,"point",r),[a]=be(e,"Break By / Color",r),[i]=be(e,"size",r),l=(d=(c=s.getEnabledPanelItems(e,"Break By / Color")[0])==null?void 0:c.format)==null?void 0:d.members,u=l&&s.createValueToColorMap(l);return C({x:t,y:n,breakByPoint:o,breakByColor:a,size:i},u&&{seriesToColorMap:u})}function Tg(e,r){const t=be(e,"value",r),n=be(e,"secondary",r),o=be(e,"min",r),a=be(e,"max",r);return{value:t,secondary:n,min:o,max:a}}function Sg(e,r){return{columns:be(e,"columns",r)}}function Dg(e,r,t){let n;const o={},a=be(e,"columns",t),i=Ua(e,"values",(u,c)=>{var y,b,v,x,w;const{field:d,jaql:f}=u,{sortDetails:h}=f;h&&(n=h),d&&(o[d.index]=c),((b=(y=u.format)==null?void 0:y.color)==null?void 0:b.type)==="color"&&!((x=(v=u.format)==null?void 0:v.color)!=null&&x.color)&&delete u.format.color;const m=ln(u,t);return typeof m.color!="string"&&((w=m.color)==null?void 0:w.type)==="conditional"&&delete m.color.defaultColor,m});return{rows:Ua(e,"rows",(u,c,d)=>{var b;const f=c===d.length-1;let{sortDetails:h}=u==null?void 0:u.jaql;const m=ln(u,t);m.column&&s.MetadataTypes.isAttribute(m.column)&&(m.column=m.column.sort(s.Sort.None)),f&&n&&(h=n);const y=(h==null?void 0:h.field)!==((b=u.field)==null?void 0:b.index);return h&&(m.sortType=C({direction:s.getSortType(h.dir)},y&&{by:{valuesIndex:o[h.field],columnsMembersPath:Object.values(h.measurePath||{})}})),m}),columns:a,values:i,grandTotals:{rows:r.rowsGrandTotal,columns:r.columnsGrandTotal}}}function kg(e){const r={"whisker/iqr":"iqr","whisker/extremums":"extremums","whisker/deviation":"standardDeviation"},t=fg(e.whisker,n=>n);return r[t]}function _g(e,r,t){const n=be(e,"category",t),o=be(e,"value",t),a=kg(r),i=r.outliers.enabled;return{category:n,value:o,boxType:a,outliersEnabled:i}}function Eg(e,r){return s.getEnabledPanelItems(e,"geo").map(s.getRootPanelItem).map(t=>{const n=ln(t,r);return"geoLevel"in t?k(C({},n),{level:t.geoLevel}):n})}function Mg(e,r){const t=Eg(e,r),n=be(e,"size",r)[0],o=be(e,"color",r)[0],a=be(e,"details",r)[0];return{geo:t,size:n,colorBy:o,details:a}}function Pg(e,r){const t=[be(e,"geo",r)[0]],n=be(e,"color",r)[0];return C({geo:t},n&&{color:[n]})}function Va(e,r){const t="dim"in e.jaql?k(C({},e),{jaql:k(C({},e.jaql),{datasource:r})}):e,n=e.parent?Va(e.parent,r):void 0,o=e.through?Va(e.through,r):void 0;return k(C({},t),{parent:n,through:o})}function Og(e,r){return e.map(t=>k(C({},t),{items:t.items.map(n=>Va(n,r))}))}function Ag(e,r,t,n){if(Fg(e))return xg(r,e,n);if(Rg(e))return wg(e,r,n);if(e==="chart/scatter")return Cg(r,n);if(e==="indicator")return Tg(r,n);if(s.isTableWidget(e))return Sg(r,n);if(s.isPivotTableWidget(e))return Dg(r,t,n);if(e==="chart/boxplot")return _g(r,t,n);if(e==="map/scatter")return Mg(r,n);if(e==="map/area")return Pg(r,n);if(e==="richtexteditor")return{};throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetType:e})}function Fg(e){return["chart/line","chart/area","chart/bar","chart/column","chart/polar"].includes(e)}function Rg(e){return["chart/pie","chart/funnel","treemap","sunburst"].includes(e)}function gn(e,r){const t=s.getChartSubtype(e);return C(C({},r),t&&{subtype:t})}function Dt(e){const{min:r,max:t}=e||{};return k(C({},e),{min:typeof r=="number"?r:null,max:typeof t=="number"?t:null})}function Lg(e,r,t){var x,w,T,S,D,_,E,F,N,j;const n={xAxis:Dt(r.xAxis),yAxis:Dt(r.yAxis),y2Axis:Dt(r.y2Axis)},a=["chart/line","chart/area"].includes(e)?"x-axis":"categories",i=s.getEnabledPanelItems(t,a),l=s.getEnabledPanelItems(t,"values"),u=i.length===2;u&&(n.xAxis=k(C({},n.xAxis),{title:(x=n.xAxis)==null?void 0:x.x2Title,x2Title:(w=n.xAxis)==null?void 0:w.title}));const c=!!((T=n.xAxis)!=null&&T.title&&"text"in n.xAxis.title),d=i[i.length-1];!c&&d&&(n.xAxis=k(C({},n.xAxis),{title:k(C({},(S=n.xAxis)==null?void 0:S.title),{text:d.jaql.title})}));const f=!!((D=n.xAxis)!=null&&D.x2Title&&"text"in n.xAxis.x2Title),h=i[0];!f&&u&&(n.xAxis=k(C({},n.xAxis),{x2Title:k(C({},(_=n.xAxis)==null?void 0:_.x2Title),{text:h.jaql.title})}));const m=!!((E=n.yAxis)!=null&&E.title&&"text"in n.yAxis.title),y=l.filter(I=>!I.y2);!m&&y.length===1&&(n.yAxis=k(C({},n.yAxis),{title:k(C({},(F=n.yAxis)==null?void 0:F.title),{text:y[0].jaql.title})}));const b=!!((N=n.y2Axis)!=null&&N.title&&"text"in n.y2Axis.title),v=l.filter(I=>I.y2);return!b&&v.length===1&&(n.y2Axis=k(C({},n.y2Axis),{title:k(C({},(j=n.y2Axis)==null?void 0:j.title),{text:v[0].jaql.title})})),n}function Ng(e,r){var a,i;const t={xAxis:Dt(e.categories),yAxis:Dt(e.axis)},n=s.getEnabledPanelItems(r,"categories")[0];return!!!((a=t.xAxis)!=null&&a.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(i=t.xAxis)==null?void 0:i.title),{text:n.jaql.title})})),t.yAxis=k(C({},t.yAxis),{title:{enabled:!1}}),t}function Ig(e,r){var l,u,c,d;const t={xAxis:Dt(e.xAxis),yAxis:Dt(e.yAxis)},n=s.getEnabledPanelItems(r,"x-axis")[0],o=s.getEnabledPanelItems(r,"y-axis")[0];return!!!((l=t.xAxis)!=null&&l.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(u=t.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((c=t.yAxis)!=null&&c.title&&"text"in t.yAxis.title)&&o&&(t.yAxis=k(C({},t.yAxis),{title:k(C({},(d=t.yAxis)==null?void 0:d.title),{text:o.jaql.title})})),t}function jg(e,r){var l,u,c,d;const t={xAxis:Dt(e.xAxis),yAxis:Dt(e.yAxis)},n=s.getEnabledPanelItems(r,"category")[0],o=s.getEnabledPanelItems(r,"value")[0];return!!!((l=t.xAxis)!=null&&l.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(u=t.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((c=t.yAxis)!=null&&c.title&&"text"in t.yAxis.title)&&o&&(t.yAxis=k(C({},t.yAxis),{title:k(C({},(d=t.yAxis)==null?void 0:d.title),{text:o.jaql.title})})),t}function Wg(e,r){var i,l,u,c,d,f,h,m,y,b,v,x,w,T,S,D,_,E,F,N,j;const t=((i=r.seriesLabels)==null?void 0:i.enabled)&&((c=(u=(l=r.seriesLabels)==null?void 0:l.labels)==null?void 0:u.types)==null?void 0:c.totals),n=e==="area/stacked"||e==="area/stackedspline"||e==="column/stackedcolumn"||e==="bar/stacked",o=e==="area/stacked100"||e==="area/stackedspline100"||e==="column/stackedcolumn100"||e==="bar/stacked100";let a=(f=(d=r.seriesLabels)==null?void 0:d.enabled)!=null?f:!1;return(n||o)&&(a=!!(n&&((y=(m=(h=r.seriesLabels)==null?void 0:h.labels)==null?void 0:m.types)!=null&&y.relative)||o&&((x=(v=(b=r.seriesLabels)==null?void 0:b.labels)==null?void 0:v.types)!=null&&x.count))),k(C({},t&&{totalLabels:{enabled:t,rotation:(T=(w=r.seriesLabels)==null?void 0:w.rotation)!=null?T:0}}),{seriesLabels:{enabled:(D=(S=r.seriesLabels)==null?void 0:S.enabled)!=null?D:!1,rotation:(E=(_=r.seriesLabels)==null?void 0:_.rotation)!=null?E:0,showValue:a,showPercentage:!!(o&&((j=(N=(F=r.seriesLabels)==null?void 0:F.labels)==null?void 0:N.types)!=null&&j.percentage))}})}function Bg(e,r,t,n){return k(C(C(C({},gn(r,t)),Lg(e,t,n)),Wg(r,t)),{lineWidth:t.lineWidth,markers:t.markers})}function Hg(e,r,t){return C(C({},gn(e,r)),Ng(r,t))}function Yg(e,r,t){var n,o,a;return k(C(C({},gn(e,r)),Ig(r,t)),{markerSize:{scatterDefaultSize:(n=r.markerSize)==null?void 0:n.defaultSize,scatterBubbleMinSize:(o=r.markerSize)==null?void 0:o.min,scatterBubbleMaxSize:(a=r.markerSize)==null?void 0:a.max}})}function $g(e){return{header:{color:{enabled:e["colors/headers"]}},rows:{alternatingColor:{enabled:e["colors/rows"]}},columns:{alternatingColor:{enabled:e["colors/columns"]}}}}function Ug(e,r){return k(C({},gn(e,r)),{funnelSize:r.size,funnelType:r.type,funnelDirection:r.direction,labels:r.labels,legend:r.legend})}const Vg=(e,r)=>{const t=s.getChartSubtype(e);return t==="indicator/gauge"?{subtype:t,skin:+r.skin}:r.subtype==="bar"?{subtype:t,numericSubtype:"numericBar"}:{subtype:t,numericSubtype:"numericSimple",skin:r.skin}};function zg(e,r,t){var i,l,u,c,d,f,h,m;const n=Vg(e,r),o=(i=s.getEnabledPanelItems(t,"value")[0])==null?void 0:i.jaql.title,a=(l=s.getEnabledPanelItems(t,"secondary")[0])==null?void 0:l.jaql.title;return k(C({},n),{indicatorComponents:{title:{shouldBeShown:((c=(u=r.components)==null?void 0:u.title)==null?void 0:c.enabled)||!1,text:o},secondaryTitle:{text:a||""},ticks:{shouldBeShown:((f=(d=r.components)==null?void 0:d.ticks)==null?void 0:f.enabled)||!1},labels:{shouldBeShown:((m=(h=r.components)==null?void 0:h.labels)==null?void 0:m.enabled)||!1}}})}function qg(e){var r,t,n,o;return{labels:{category:[{enabled:(r=e["title/1"])!=null?r:!0},{enabled:(t=e["title/2"])!=null?t:!0},{enabled:(n=e["title/3"])!=null?n:!0}]},tooltip:{mode:(o=e["tooltip/value"])==null||o?"value":"contribution"}}}function Qg(e){var r;return{legend:{enabled:e["legend/enabled"],position:e["legend/position"]},tooltip:{mode:(r=e["tooltip/value"])==null||r?"value":"contribution"}}}function Gg(e,r,t){return C(C({},gn(e,r)),jg(r,t))}function Kg(e,r){return k(C({},gn(e,r)),{markers:{fill:r.markers.fill,size:{defaultSize:r.markers.size.defaultSize,minSize:r.markers.size.min,maxSize:r.markers.size.max}}})}function Xg(e){let r;switch(e){case"areamap/world":r="world";break;case"areamap/usa":r="usa";break;default:throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetSubtype:e})}return{mapType:r}}function Zg(e){var r,t,n,o,a;return{rowsPerPage:parseInt(`${e.pageSize}`),isAutoHeight:e.automaticHeight,rowHeight:e.rowHeight,alternatingRowsColor:(r=e.colors)==null?void 0:r.rows,alternatingColumnsColor:(t=e.colors)==null?void 0:t.columns,headersColor:(n=e.colors)==null?void 0:n.headers,membersColor:(o=e.colors)==null?void 0:o.members,totalsColor:(a=e.colors)==null?void 0:a.totals}}function Jg(e,r){var a,i,l;const{subtype:t,style:n,metadata:{panels:o}}=r;switch(e){case"chart/line":case"chart/area":case"chart/bar":case"chart/column":{const u=Bg(e,t,n,o);if(u.navigator){const c=(a=r.options)==null?void 0:a.previousScrollerLocation;u.navigator.scrollerLocation=al(c)?c:void 0}return u}case"chart/polar":return Hg(t,n,o);case"chart/scatter":return Yg(t,n,o);case"chart/funnel":return Ug(t,n);case"treemap":return qg(n);case"sunburst":return Qg(n);case"chart/pie":return gn(t,n);case"tablewidget":case"tablewidgetagg":return $g(n);case"pivot":case"pivot2":return Zg(n);case"indicator":return zg(t,n,o);case"chart/boxplot":{const u=Gg(t,n,o);return u.navigator&&(u.navigator.scrollerLocation=al((i=r.options)==null?void 0:i.previousScrollerLocation)?(l=r.options)==null?void 0:l.previousScrollerLocation:void 0),u}case"map/scatter":return Kg(t,n);case"map/area":return Xg(t);case"richtexteditor":return n.content;default:throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetType:e})}}const yu=e=>({backgroundColor:e.widgetBackgroundColor,spaceAround:p.LEGACY_DESIGN_TYPES[e.widgetSpacing],cornerRadius:p.LEGACY_DESIGN_TYPES[e.widgetCornerRadius],shadow:p.LEGACY_DESIGN_TYPES[e.widgetShadow],border:e.widgetBorderEnabled,borderColor:e.widgetBorderColor,header:{titleTextColor:e.widgetTitleColor,titleAlignment:p.LEGACY_DESIGN_TYPES[e.widgetTitleAlignment],dividerLine:e.widgetTitleDividerEnabled,dividerLineColor:e.widgetTitleDividerColor,backgroundColor:e.widgetTitleBackgroundColor}});function ey(e,r,t){if(!r||!t)return e;const n=yu(r);return C(C({},e),n)}function ty(e,r){return e&&e.length?p.baseUniq(e,s.baseIteratee(r)):[]}function ny(e,r){var n;const t=(n=e==null?void 0:e.findIndex(o=>o===r))!=null?n:-1;return t===-1?[]:e.slice(t)}const bu=e=>e!=null&&e.parent?[...bu(e.parent),ln(e).column]:[],vu=e=>{var r,t,n;if(e!=null&&e.parent&&e.through&&"filter"in e.through.jaql){const o=ln(e).column,{jaql:a,format:{mask:i}={}}=e.parent,l="level"in a&&a.level&&i&&i[a.level],u=(n=(t=(r=e.through.jaql.filter)==null?void 0:r.members)==null?void 0:t.map(l?c=>({categoryValue:c,categoryDisplayValue:s.applyDateFormat(s.parseISO(c),l)}):c=>({categoryValue:c})))!=null?n:[];return[...vu(e.parent),{nextDimension:o,points:u}]}return[]};function ry(e){switch(e){case"chart/line":case"chart/area":return["x-axis"];case"chart/boxplot":return["category"];case"chart/scatter":return["x-axis","y-axis","point","Break By / Color"];default:return["categories"]}}const oy=(e,r)=>{const t=ry(e).map(o=>s.getEnabledPanelItems(r,o)).flat().filter(o=>{const a="agg"in o.jaql&&o.jaql.agg,i="formula"in o.jaql&&o.jaql.formula;return!a&&!i});return t.length===1?t[0]:void 0},xu="calendar",wu="calendar - weeks",ay=[s.DateLevels.Years,s.DateLevels.Quarters,s.DateLevels.Months,s.DateLevels.Days],sy=[s.DateLevels.Years,s.DateLevels.Weeks,s.DateLevels.Days],iy=[s.DateLevels.Years,s.DateLevels.Quarters,s.DateLevels.Months,s.DateLevels.Weeks,s.DateLevels.Days],ly=e=>e.length===2?iy:e[0]===xu?ay:e[0]===wu?sy:[],cy=(e,r)=>{const[t=[],n]=p.partition(e,a=>[xu,wu].includes(a)),o=ny(ly(t),r.granularity);return o.length?[{title:"Calendar Hierarchy",levels:o.map(l=>new s.DimensionalLevelAttribute(`${l} in ${r.name}`,r.expression,l,s.DimensionalLevelAttribute.getDefaultFormatForGranularity(l)))},...n]:n},uy=e=>{const r=e&&ln(e),t=(e==null?void 0:e.hierarchies)||[];return r&&s.isDatetime(r.column.type)?(r.column.name=(e==null?void 0:e.jaql).column,cy(t,r.column)):t},dy=(e,r,t=[],n)=>{const o=oy(e,r),a=o&&s.getRootPanelItem(o),i=vu(o),l=uy(a);return{drilldownPaths:[...ty([...o?bu(o):[]],({expression:c})=>c),...l],drilldownSelections:i}};function xs(e){const i=e.filter,{filter:r}=i,t=le(i,["filter"]),n=r&&"turnedOff"in r&&r.turnedOff;let o,a;return n?a=r:o=r,t.members&&t.members.length===0&&(t.all=!0),{filter:t,backgroundFilter:o,turnOffMembersFilter:a}}function py(e){const{filter:r,backgroundFilter:t,turnOffMembersFilter:n}=xs(e.jaql),o=[k(C({},e),{jaql:k(C({},e.jaql),{filter:C(C({},r),n&&{filter:n})})})];return t&&o.push(k(C({},e),{jaql:k(C({},e.jaql),{filter:t}),disabled:!1})),o}function fy(e){const r=e.find(n=>n.name==="filters"),t=[];return r==null||r.items.forEach(n=>{t.push(...py(n).filter(({disabled:o})=>!o))}),t}function Cu(e){return fy(e).map(r=>s.createFilterFromJaql(r.jaql,r.instanceid))}function ws(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toExecuteQueryParams");let r,t,n,o;if(s.isTableWidget(e.widgetType)){const{attributes:a,measures:i}=p.getTableAttributesAndMeasures(p.translateTableDataOptions(e.dataOptions));r=a,t=i,n=p.DEFAULT_TABLE_ROWS_PER_PAGE*p.PAGES_BATCH_SIZE+1,o=!0}else{const{attributes:a,measures:i}=p.getTranslatedDataOptions(e.dataOptions,e.chartType);r=a,t=i}return{dataSource:e.dataSource,dimensions:r,measures:t,filters:e.filters,highlights:e.highlights,count:n,ungroup:o}}function Cs(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toExecutePivotQueryParams"});const{rows:r,columns:t,values:n,grandTotals:o}=ou(p.translatePivotTableDataOptions(e.dataOptions));return{dataSource:e.dataSource,rows:r,columns:t,values:n,grandTotals:o,filters:e.filters,highlights:e.highlights}}function Tu(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toChartProps");if(s.isTextWidget(e.widgetType))throw new Au("toChartProps");return s.isTableWidget(e.widgetType)?C({chartType:e.chartType},Ts(e)):{chartType:e.chartType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters,highlights:e.highlights}}function Ts(e){if(!s.isTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters}}function Su(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters,highlights:e.highlights}}function Ss(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toChartWidgetProps");if(s.isTextWidget(e.widgetType))throw new Au("toChartWidgetProps");return{chartType:e.chartType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||"",drilldownOptions:e.drilldownOptions}}function Du(e){if(!s.isTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableWidgetProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,title:e.title,description:e.description||""}}function Ds(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableWidgetProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||""}}function ks(e){if(!s.isTextWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTextWidgetSupported",{methodName:"toTextWidgetProps"});return{styleOptions:e.styleOptions}}function ku(e){if(!s.isPluginWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPluginWidgetSupported",{methodName:"toPluginWidgetProps"});return{pluginType:e.pluginType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||""}}function _u(e){const{widgetType:r}=e;return s.isPivotTableWidget(r)?C({widgetType:"pivot"},Ds(e)):s.isTextWidget(r)?C({widgetType:"text"},ks(e)):s.isPluginWidget(r)?C({widgetType:"plugin"},ku(e)):C({widgetType:"chart"},Ss(e))}function _s(e){const{oid:r}=e;return k(C({},_u(e)),{id:r})}const Tt=()=>{throw new s.TranslatableError("errors.methodNotImplemented")},Eu={oid:"",title:"",dataSource:"",description:"",widgetType:"plugin",pluginType:"",dataOptions:{},styleOptions:{},drilldownOptions:{},filters:[],highlights:[],chartType:void 0,getExecuteQueryParams:Tt,getExecutePivotQueryParams:Tt,getChartProps:Tt,getTableProps:Tt,getPivotTableProps:Tt,getPivotTableWidgetProps:Tt,getChartWidgetProps:Tt,getTableWidgetProps:Tt,getTextWidgetProps:Tt};function Mu(e){return k(C({},e),{getExecuteQueryParams:()=>ws(e),getExecutePivotQueryParams:()=>Cs(e),getChartProps:()=>Tu(e),getTableProps:()=>Ts(e),getPivotTableProps:()=>Su(e),getChartWidgetProps:()=>Ss(e),getTableWidgetProps:()=>Du(e),getPivotTableWidgetProps:()=>Ds(e),getTextWidgetProps:()=>ks(e)})}function wr(e,r,t){var h,y,b,v;let n,o,a,i;const l=Og(e.metadata.panels,e.datasource);if(n=e.type,s.isSupportedWidgetType(n)){a=Ag(n,l,e.style,r==null?void 0:r.palette.variantColors),i=Jg(n,e);const x=(v=(b=(y=t==null?void 0:t.serverFeatures)==null?void 0:y.widgetDesignStyle)==null?void 0:b.active)!=null?v:!0;i=ey(i,e.style.widgetDesign,x)}else{o=n,n="plugin",a=gu(l,(h=r==null?void 0:r.palette.variantColors)!=null?h:[]);const m=e.style,{widgetDesign:x}=m,w=le(m,["widgetDesign"]);i=C(C({},w),x?yu(x):{})}const u=dy(n,l),c=Cu(l),d=s.isChartWidget(n)?s.getChartType(n):void 0,f=k(C({},Eu),{oid:e.oid,title:e.title,dataSource:s.convertDataSource(e.datasource),description:e.desc||"",widgetType:n,chartType:d,pluginType:o||"",dataOptions:a||{},styleOptions:i||{},drilldownOptions:u,filters:c});return Mu(f)}function Pu(e){const r=s.getWidgetTypeFromChartType(e.chartType),t=k(C(C({},Eu),e),{filters:e.filters||[],widgetType:r});return Mu(t)}function hy(e){if(s.isChartWidgetProps(e))return Pu(e);throw new s.TranslatableError("errors.otherWidgetTypesNotSupported")}function Ou(e,r){const t=r||e.dataSource;if(typeof t=="string")throw new il("dataSource");if(!t.id||!t.live&&!t.address)throw new il("dataSource");const n=e.chartType;let o=e.widgetType,a={},i=e.styleOptions.subtype||"";if(!n)throw new Error("Chart type is required");const l=[];if(s.isCartesian(n)){const d=["chart/line","chart/area"].includes(e.widgetType)?"x-axis":"categories",f=e.dataOptions.category.map(b=>Ct(s.normalizeColumn(b))),h={name:d,items:f};l.push(h);const m=e.dataOptions.value.map(b=>Ct(s.normalizeMeasureColumn(b)));l.push({name:"values",items:m});const y=e.dataOptions.breakBy.map(b=>Ct(s.normalizeColumn(b)));l.push({name:"break by",items:y}),n==="polar"?i="column/polar":n==="bar"?i=i||"bar/classic":n==="column"?i=i||"column/classic":n==="area"?i=i||"area/basic":n==="line"&&(i=i||"line/basic")}else if(s.isTable(n)){const{attributes:d,measures:f}=p.getTableAttributesAndMeasures(e.dataOptions),h=[...d.map(m=>Ct(s.normalizeColumn(m))),...f.map(m=>Ct(s.normalizeMeasureColumn(m)))];l.push({name:"columns",items:h}),o="tablewidget"}else if(s.isIndicator(n))["value","min","max","secondary"].forEach(d=>{const f=(e.dataOptions[d]||[]).map(h=>Ct(s.normalizeMeasureColumn(h)));l.push({name:d,items:f})}),i=i||"indicator/numeric",a=k(C({},i==="indicator/gauge"?{subtype:"round",skin:"1"}:{subtype:"simple",skin:"vertical"}),{components:{ticks:{inactive:!1,enabled:!0},labels:{inactive:!1,enabled:!0},title:{inactive:!1,enabled:!0},secondaryTitle:{inactive:!0,enabled:!0}}});else if(s.isCategorical(n)){const d=e.dataOptions.category.map(m=>Ct(s.normalizeAnyColumn(m)));l.push({name:"categories",items:d});const f=e.dataOptions.value.map(m=>Ct(s.normalizeAnyColumn(m))),h=n==="treemap";l.push({name:h?"size":"values",items:f}),h&&["color","values"].forEach(y=>{l.push({name:y,items:[]})}),n==="pie"?(i=i||"pie/basic",a={convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",minimalIndependentSlicePercentage:3,independentSlicesCount:7}}):n==="treemap"||n==="sunburst"?i=i||n:n==="funnel"&&(i=i||"chart/funnel")}else if(s.isScatter(n))["x","y","size","breakByColor","breakByPoint"].forEach(d=>{if(e.dataOptions[d]){const f={breakByColor:"Break By / Color",breakByPoint:"point",x:"x-axis",y:"y-axis"},h=[Ct(s.normalizeAnyColumn(e.dataOptions[d]))];l.push({name:f[d]||d,items:h})}}),i=i||"bubble/scatter";else throw new my(n);const u=(e.filters||[]).map(d=>d.jaql());return l.push({name:"filters",items:u}),{oid:e.oid||"",title:e.title,desc:e.description,datasource:t,type:o,metadata:{panels:l},style:a,subtype:i}}class il extends s.TranslatableError{constructor(r){super("errors.widgetModel.incomleteWidget",{prop:r})}}class my extends s.TranslatableError{constructor(r){super("errors.widgetModel.unsupportedWidgetTypeDto",{chartType:r})}}class Es extends s.TranslatableError{constructor(r){super("errors.widgetModel.pivotWidgetNotSupported",{methodName:r})}}class Au extends s.TranslatableError{constructor(r){super("errors.widgetModel.textWidgetNotSupported",{methodName:r})}}const gy=Object.freeze(Object.defineProperty({__proto__:null,fromChartWidgetProps:Pu,fromWidgetDto:wr,fromWidgetProps:hy,toChartProps:Tu,toChartWidgetProps:Ss,toCommonWidgetProps:_u,toExecutePivotQueryParams:Cs,toExecuteQueryParams:ws,toPivotTableProps:Su,toPivotTableWidgetProps:Ds,toPluginWidgetProps:ku,toTableProps:Ts,toTableWidgetProps:Du,toTextWidgetProps:ks,toWidgetDto:Ou,toWidgetProps:_s},Symbol.toStringTag,{value:"Module"}));function Ms(e){const{title:r,dataSource:t,widgets:n,layoutOptions:o,filters:a,widgetsOptions:i,tabbersOptions:l,styleOptions:u}=e;return{title:r,defaultDataSource:t,widgets:n.map(_s),layoutOptions:o,config:{},filters:a,widgetsOptions:i,styleOptions:u,tabbersOptions:l}}function Ps(e,r,t){var D;const{oid:n,title:o,datasource:a,widgets:i,layout:l,filters:u,filterRelations:c,style:d}=e,f={title:a.title,type:a.live?"live":"elasticube"},h=C({},d!=null&&d.palette?{palette:{variantColors:d==null?void 0:d.palette.colors}}:null),m=r&&C(C({},r),h.palette?{palette:h.palette}:null),y=(i==null?void 0:i.map(_=>wr(_,m,t)))||[],b=l?Jm(l):{columns:[]},v=(D=c==null?void 0:c[0])==null?void 0:D.filterRelations,x=ng(u||[],v),w=og(i),T=ag(i);return{oid:n,title:o,dataSource:f,styleOptions:h,widgets:y,layoutOptions:{widgetsPanel:b},filters:x,widgetsOptions:w,tabbersOptions:T}}const yy=Object.freeze(Object.defineProperty({__proto__:null,fromDashboardDto:Ps,toDashboardProps:Ms},Symbol.toStringTag,{value:"Module"}));function by(e){return s.isCascadingFilter(e)?vy(e):Os(e)}function Os(e){return s.isMembersFilter(e)?xy(e):s.isRankingFilter(e)?wy(e):As(e)}function vy(e){return{isCascading:!0,instanceid:e.config.guid,disabled:e.config.disabled,levels:e.filters.map(r=>{const t=Os(r);return k(C({},t.jaql),{instanceid:t.instanceid})})}}function As(e){const{config:{disabled:r}}=e,t=Object.assign(Object.create(e),{config:k(C({},e.config),{disabled:!1})}).jaql(!0);return{jaql:k(C({},t),{table:s.getTableNameFromAttribute(e.attribute),column:s.getColumnNameFromAttribute(e.attribute)}),disabled:r,instanceid:e.config.guid,isCascading:!1}}function xy(e){const r=As(e);return r.jaql.filter.multiSelection=e.config.enableMultiSelection,e.config.deactivatedMembers.length>0&&(e.config.excludeMembers?r.jaql.filter.exclude.members=[...e.members,...e.config.deactivatedMembers]:r.jaql.filter.members=[...e.members,...e.config.deactivatedMembers]),e.config.backgroundFilter&&za(r.jaql,Os(e.config.backgroundFilter).jaql.filter),e.config.deactivatedMembers.length>0&&za(r.jaql,{exclude:{members:e.config.deactivatedMembers},turnedOff:!0}),r}function wy(e){const r=As(e);if(e.measure instanceof s.DimensionalBaseMeasure){const t=r.jaql.filter;t.by.table=s.getTableNameFromAttribute(e.measure.attribute),t.by.column=s.getColumnNameFromAttribute(e.measure.attribute),t.rankingMessage=e.measure.name}return r}function za(e,r){if(e.filter)return za(e.filter,r);e.filter=r}var Cy=function(e){return e.DASHBOARD_INIT="DASHBOARD.INIT",e.DASHBOARD_UPDATE_LAYOUT="DASHBOARD.UPDATE_LAYOUT",e}({}),Fu=function(e){return e.FILTERS_UPDATE="FILTERS.UPDATE",e.ADD_WIDGET="WIDGETS.ADD",e}({});function Ty(e,r){var t,n;switch(r.type){case"DASHBOARD.INIT":return C(C({},e),r.payload);case"FILTERS.UPDATE":return k(C({},e),{filters:r.payload});case"WIDGETS.ADD":{const o=[...e.widgets,r.payload],a=[...((n=(t=e==null?void 0:e.layoutOptions)==null?void 0:t.widgetsPanel)==null?void 0:n.columns)||[]];return a[0]&&(a[0].rows.length||a[0].rows.push({cells:[]}),a[0].rows[0].cells.push({widgetId:r.payload.oid,widthPercentage:100})),k(C(C({},e),e!=null&&e.layoutOptions.widgetsPanel?{layoutOptions:k(C({},e==null?void 0:e.layoutOptions),{widgetsPanel:k(C({},e==null?void 0:e.layoutOptions.widgetsPanel),{columns:a})})}:null),{widgets:o})}default:return e}}function Sy(e,r,t){return Te(this,null,function*(){if(!e)throw new Error("Dashboard model is not initialized");if(r.type==="FILTERS.UPDATE"){const{filters:n,relations:o}=p.splitFiltersAndRelations(r.payload),a=n.map(by),i=p.filterRelationRulesToFilterRelationsModel(o,n),l=Dy(n);yield t.patchDashboard(e,{filters:a,filterRelations:i?[{datasource:l,filterRelations:i}]:void 0})}else if(r.type==="WIDGETS.ADD"){const n=yield t.addWidgetToDashboard(e,Ou(r.payload));if(!n)throw new Error("Failed to add widget to dashboard");return{type:"WIDGETS.ADD",payload:wr(n)}}return r})}function Dy(e){const r=new Set(e.map(t=>{var n;return(n=t.dataSource)==null?void 0:n.title}));if(r.size>1)throw new Error("Persisting filters from multiple datasources is not supported now");return r.values().next().value}function ky(e){return e.type===Rp.FILTERS_UPDATE?{type:Fu.FILTERS_UPDATE,payload:e.payload}:null}function _y(e,r){return e==="wat"?(r&&console.warn('WAT authentication does not support persistence. The changes will not be saved. Set "persist" flag to false to avoid this warning.'),!1):!0}const Ru=p.withTracking("useDashboardModel")(Ey);function Ey({dashboardOid:e,includeWidgets:r,includeFilters:t,persist:n=!0}){const{restApi:o,isReady:a}=s.useRestApi(),{app:i}=s.useSisenseContext(),l=g.useMemo(()=>!!(i!=null&&i.httpClient.auth)&&_y(i.httpClient.auth.type,n),[i==null?void 0:i.httpClient.auth,n]),u=n&&l,[c,d]=g.useReducer(Ty,null),f=g.useCallback(v=>Te(this,null,function*(){if(!a||!o)throw new s.RestApiNotReadyError;return u&&(v=yield Sy(c==null?void 0:c.oid,v,o)),d(v)}),[u,c==null?void 0:c.oid,o,a,d]),{dashboard:h,isLoading:m,isError:y,error:b}=du({dashboardOid:e,includeWidgets:r,includeFilters:t});return g.useEffect(()=>{h&&d({type:Cy.DASHBOARD_INIT,payload:h})},[h,d]),{dashboard:c,isLoading:m,isError:y,error:b,dispatchChanges:f}}/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */const{entries:Lu,setPrototypeOf:ll,isFrozen:My,getPrototypeOf:Py,getOwnPropertyDescriptor:Oy}=Object;let{freeze:Ve,seal:rt,create:Nu}=Object,{apply:qa,construct:Qa}=typeof Reflect!="undefined"&&Reflect;Ve||(Ve=function(r){return r});rt||(rt=function(r){return r});qa||(qa=function(r,t,n){return r.apply(t,n)});Qa||(Qa=function(r,t){return new r(...t)});const Wr=Ze(Array.prototype.forEach),cl=Ze(Array.prototype.pop),Qn=Ze(Array.prototype.push),Kr=Ze(String.prototype.toLowerCase),Da=Ze(String.prototype.toString),ul=Ze(String.prototype.match),Gn=Ze(String.prototype.replace),Ay=Ze(String.prototype.indexOf),Fy=Ze(String.prototype.trim),ot=Ze(Object.prototype.hasOwnProperty),He=Ze(RegExp.prototype.test),Kn=Ry(TypeError);function Ze(e){return function(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return qa(e,r,n)}}function Ry(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return Qa(e,t)}}function te(e,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Kr;ll&&ll(e,null);let n=r.length;for(;n--;){let o=r[n];if(typeof o=="string"){const a=t(o);a!==o&&(My(r)||(r[n]=a),o=a)}e[o]=!0}return e}function Ly(e){for(let r=0;r<e.length;r++)ot(e,r)||(e[r]=null);return e}function Jt(e){const r=Nu(null);for(const[t,n]of Lu(e))ot(e,t)&&(Array.isArray(n)?r[t]=Ly(n):n&&typeof n=="object"&&n.constructor===Object?r[t]=Jt(n):r[t]=n);return r}function Xn(e,r){for(;e!==null;){const n=Oy(e,r);if(n){if(n.get)return Ze(n.get);if(typeof n.value=="function")return Ze(n.value)}e=Py(e)}function t(){return null}return t}const dl=Ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ka=Ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_a=Ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ny=Ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ea=Ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Iy=Ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pl=Ve(["#text"]),fl=Ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ma=Ve(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hl=Ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Br=Ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jy=rt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Wy=rt(/<%[\w\W]*|[\w\W]*%>/gm),By=rt(/\${[\w\W]*}/gm),Hy=rt(/^data-[\-\w.\u00B7-\uFFFF]/),Yy=rt(/^aria-[\-\w]+$/),Iu=rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$y=rt(/^(?:\w+script|data):/i),Uy=rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ju=rt(/^html$/i),Vy=rt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ml=Object.freeze({__proto__:null,MUSTACHE_EXPR:jy,ERB_EXPR:Wy,TMPLIT_EXPR:By,DATA_ATTR:Hy,ARIA_ATTR:Yy,IS_ALLOWED_URI:Iu,IS_SCRIPT_OR_DATA:$y,ATTR_WHITESPACE:Uy,DOCTYPE_NAME:ju,CUSTOM_ELEMENT:Vy});const Zn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},zy=function(){return typeof window=="undefined"?null:window},qy=function(r,t){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const a="dompurify"+(n?"#"+n:"");try{return r.createPolicy(a,{createHTML(i){return i},createScriptURL(i){return i}})}catch(i){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function Wu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zy();const r=K=>Wu(K);if(r.version="3.1.6",r.removed=[],!e||!e.document||e.document.nodeType!==Zn.document)return r.isSupported=!1,r;let{document:t}=e;const n=t,o=n.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:m}=e,y=u.prototype,b=Xn(y,"cloneNode"),v=Xn(y,"remove"),x=Xn(y,"nextSibling"),w=Xn(y,"childNodes"),T=Xn(y,"parentNode");if(typeof i=="function"){const K=t.createElement("template");K.content&&K.content.ownerDocument&&(t=K.content.ownerDocument)}let S,D="";const{implementation:_,createNodeIterator:E,createDocumentFragment:F,getElementsByTagName:N}=t,{importNode:j}=n;let I={};r.isSupported=typeof Lu=="function"&&typeof T=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:B,TMPLIT_EXPR:R,DATA_ATTR:O,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:W}=ml;let{IS_ALLOWED_URI:z}=ml,Q=null;const ie=te({},[...dl,...ka,..._a,...Ea,...pl]);let Z=null;const xe=te({},[...fl,...Ma,...hl,...Br]);let J=Object.seal(Nu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,fe=null,he=!0,Pe=!0,Ce=!1,ze=!0,tt=!1,Rt=!0,Xt=!1,la=!1,ca=!1,xn=!1,Or=!1,Ar=!1,Di=!0,ki=!1;const Gp="user-content-";let ua=!0,Vn=!1,wn={},Cn=null;const _i=te({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ei=null;const Mi=te({},["audio","video","img","source","image","track"]);let da=null;const Pi=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fr="http://www.w3.org/1998/Math/MathML",Rr="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let Tn=xt,pa=!1,fa=null;const Kp=te({},[Fr,Rr,xt],Da);let zn=null;const Xp=["application/xhtml+xml","text/html"],Zp="text/html";let Ee=null,Sn=null;const Jp=t.createElement("form"),Oi=function(M){return M instanceof RegExp||M instanceof Function},ha=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sn&&Sn===M)){if((!M||typeof M!="object")&&(M={}),M=Jt(M),zn=Xp.indexOf(M.PARSER_MEDIA_TYPE)===-1?Zp:M.PARSER_MEDIA_TYPE,Ee=zn==="application/xhtml+xml"?Da:Kr,Q=ot(M,"ALLOWED_TAGS")?te({},M.ALLOWED_TAGS,Ee):ie,Z=ot(M,"ALLOWED_ATTR")?te({},M.ALLOWED_ATTR,Ee):xe,fa=ot(M,"ALLOWED_NAMESPACES")?te({},M.ALLOWED_NAMESPACES,Da):Kp,da=ot(M,"ADD_URI_SAFE_ATTR")?te(Jt(Pi),M.ADD_URI_SAFE_ATTR,Ee):Pi,Ei=ot(M,"ADD_DATA_URI_TAGS")?te(Jt(Mi),M.ADD_DATA_URI_TAGS,Ee):Mi,Cn=ot(M,"FORBID_CONTENTS")?te({},M.FORBID_CONTENTS,Ee):_i,X=ot(M,"FORBID_TAGS")?te({},M.FORBID_TAGS,Ee):{},fe=ot(M,"FORBID_ATTR")?te({},M.FORBID_ATTR,Ee):{},wn=ot(M,"USE_PROFILES")?M.USE_PROFILES:!1,he=M.ALLOW_ARIA_ATTR!==!1,Pe=M.ALLOW_DATA_ATTR!==!1,Ce=M.ALLOW_UNKNOWN_PROTOCOLS||!1,ze=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,tt=M.SAFE_FOR_TEMPLATES||!1,Rt=M.SAFE_FOR_XML!==!1,Xt=M.WHOLE_DOCUMENT||!1,xn=M.RETURN_DOM||!1,Or=M.RETURN_DOM_FRAGMENT||!1,Ar=M.RETURN_TRUSTED_TYPE||!1,ca=M.FORCE_BODY||!1,Di=M.SANITIZE_DOM!==!1,ki=M.SANITIZE_NAMED_PROPS||!1,ua=M.KEEP_CONTENT!==!1,Vn=M.IN_PLACE||!1,z=M.ALLOWED_URI_REGEXP||Iu,Tn=M.NAMESPACE||xt,J=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&Oi(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&Oi(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),tt&&(Pe=!1),Or&&(xn=!0),wn&&(Q=te({},pl),Z=[],wn.html===!0&&(te(Q,dl),te(Z,fl)),wn.svg===!0&&(te(Q,ka),te(Z,Ma),te(Z,Br)),wn.svgFilters===!0&&(te(Q,_a),te(Z,Ma),te(Z,Br)),wn.mathMl===!0&&(te(Q,Ea),te(Z,hl),te(Z,Br))),M.ADD_TAGS&&(Q===ie&&(Q=Jt(Q)),te(Q,M.ADD_TAGS,Ee)),M.ADD_ATTR&&(Z===xe&&(Z=Jt(Z)),te(Z,M.ADD_ATTR,Ee)),M.ADD_URI_SAFE_ATTR&&te(da,M.ADD_URI_SAFE_ATTR,Ee),M.FORBID_CONTENTS&&(Cn===_i&&(Cn=Jt(Cn)),te(Cn,M.FORBID_CONTENTS,Ee)),ua&&(Q["#text"]=!0),Xt&&te(Q,["html","head","body"]),Q.table&&(te(Q,["tbody"]),delete X.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=M.TRUSTED_TYPES_POLICY,D=S.createHTML("")}else S===void 0&&(S=qy(m,o)),S!==null&&typeof D=="string"&&(D=S.createHTML(""));Ve&&Ve(M),Sn=M}},Ai=te({},["mi","mo","mn","ms","mtext"]),Fi=te({},["foreignobject","annotation-xml"]),ef=te({},["title","style","font","a","script"]),Ri=te({},[...ka,..._a,...Ny]),Li=te({},[...Ea,...Iy]),tf=function(M){let $=T(M);(!$||!$.tagName)&&($={namespaceURI:Tn,tagName:"template"});const G=Kr(M.tagName),me=Kr($.tagName);return fa[M.namespaceURI]?M.namespaceURI===Rr?$.namespaceURI===xt?G==="svg":$.namespaceURI===Fr?G==="svg"&&(me==="annotation-xml"||Ai[me]):!!Ri[G]:M.namespaceURI===Fr?$.namespaceURI===xt?G==="math":$.namespaceURI===Rr?G==="math"&&Fi[me]:!!Li[G]:M.namespaceURI===xt?$.namespaceURI===Rr&&!Fi[me]||$.namespaceURI===Fr&&!Ai[me]?!1:!Li[G]&&(ef[G]||!Ri[G]):!!(zn==="application/xhtml+xml"&&fa[M.namespaceURI]):!1},it=function(M){Qn(r.removed,{element:M});try{T(M).removeChild(M)}catch($){v(M)}},Lr=function(M,$){try{Qn(r.removed,{attribute:$.getAttributeNode(M),from:$})}catch(G){Qn(r.removed,{attribute:null,from:$})}if($.removeAttribute(M),M==="is"&&!Z[M])if(xn||Or)try{it($)}catch(G){}else try{$.setAttribute(M,"")}catch(G){}},Ni=function(M){let $=null,G=null;if(ca)M="<remove></remove>"+M;else{const Oe=ul(M,/^[\r\n\t ]+/);G=Oe&&Oe[0]}zn==="application/xhtml+xml"&&Tn===xt&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const me=S?S.createHTML(M):M;if(Tn===xt)try{$=new h().parseFromString(me,zn)}catch(Oe){}if(!$||!$.documentElement){$=_.createDocument(Tn,"template",null);try{$.documentElement.innerHTML=pa?D:me}catch(Oe){}}const Re=$.body||$.documentElement;return M&&G&&Re.insertBefore(t.createTextNode(G),Re.childNodes[0]||null),Tn===xt?N.call($,Xt?"html":"body")[0]:Xt?$.documentElement:Re},Ii=function(M){return E.call(M.ownerDocument||M,M,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ji=function(M){return M instanceof f&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof d)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Wi=function(M){return typeof l=="function"&&M instanceof l},wt=function(M,$,G){I[M]&&Wr(I[M],me=>{me.call(r,$,G,Sn)})},Bi=function(M){let $=null;if(wt("beforeSanitizeElements",M,null),ji(M))return it(M),!0;const G=Ee(M.nodeName);if(wt("uponSanitizeElement",M,{tagName:G,allowedTags:Q}),M.hasChildNodes()&&!Wi(M.firstElementChild)&&He(/<[/\w]/g,M.innerHTML)&&He(/<[/\w]/g,M.textContent)||M.nodeType===Zn.progressingInstruction||Rt&&M.nodeType===Zn.comment&&He(/<[/\w]/g,M.data))return it(M),!0;if(!Q[G]||X[G]){if(!X[G]&&Yi(G)&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,G)||J.tagNameCheck instanceof Function&&J.tagNameCheck(G)))return!1;if(ua&&!Cn[G]){const me=T(M)||M.parentNode,Re=w(M)||M.childNodes;if(Re&&me){const Oe=Re.length;for(let qe=Oe-1;qe>=0;--qe){const lt=b(Re[qe],!0);lt.__removalCount=(M.__removalCount||0)+1,me.insertBefore(lt,x(M))}}}return it(M),!0}return M instanceof u&&!tf(M)||(G==="noscript"||G==="noembed"||G==="noframes")&&He(/<\/no(script|embed|frames)/i,M.innerHTML)?(it(M),!0):(tt&&M.nodeType===Zn.text&&($=M.textContent,Wr([H,B,R],me=>{$=Gn($,me," ")}),M.textContent!==$&&(Qn(r.removed,{element:M.cloneNode()}),M.textContent=$)),wt("afterSanitizeElements",M,null),!1)},Hi=function(M,$,G){if(Di&&($==="id"||$==="name")&&(G in t||G in Jp))return!1;if(!(Pe&&!fe[$]&&He(O,$))){if(!(he&&He(A,$))){if(!Z[$]||fe[$]){if(!(Yi(M)&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,M)||J.tagNameCheck instanceof Function&&J.tagNameCheck(M))&&(J.attributeNameCheck instanceof RegExp&&He(J.attributeNameCheck,$)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck($))||$==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,G)||J.tagNameCheck instanceof Function&&J.tagNameCheck(G))))return!1}else if(!da[$]){if(!He(z,Gn(G,L,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&M!=="script"&&Ay(G,"data:")===0&&Ei[M])){if(!(Ce&&!He(P,Gn(G,L,"")))){if(G)return!1}}}}}}return!0},Yi=function(M){return M!=="annotation-xml"&&ul(M,W)},$i=function(M){wt("beforeSanitizeAttributes",M,null);const{attributes:$}=M;if(!$)return;const G={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z};let me=$.length;for(;me--;){const Re=$[me],{name:Oe,namespaceURI:qe,value:lt}=Re,qn=Ee(Oe);let Be=Oe==="value"?lt:Fy(lt);if(G.attrName=qn,G.attrValue=Be,G.keepAttr=!0,G.forceKeepAttr=void 0,wt("uponSanitizeAttribute",M,G),Be=G.attrValue,Rt&&He(/((--!?|])>)|<\/(style|title)/i,Be)){Lr(Oe,M);continue}if(G.forceKeepAttr||(Lr(Oe,M),!G.keepAttr))continue;if(!ze&&He(/\/>/i,Be)){Lr(Oe,M);continue}tt&&Wr([H,B,R],Vi=>{Be=Gn(Be,Vi," ")});const Ui=Ee(M.nodeName);if(Hi(Ui,qn,Be)){if(ki&&(qn==="id"||qn==="name")&&(Lr(Oe,M),Be=Gp+Be),S&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!qe)switch(m.getAttributeType(Ui,qn)){case"TrustedHTML":{Be=S.createHTML(Be);break}case"TrustedScriptURL":{Be=S.createScriptURL(Be);break}}try{qe?M.setAttributeNS(qe,Oe,Be):M.setAttribute(Oe,Be),ji(M)?it(M):cl(r.removed)}catch(Vi){}}}wt("afterSanitizeAttributes",M,null)},nf=function K(M){let $=null;const G=Ii(M);for(wt("beforeSanitizeShadowDOM",M,null);$=G.nextNode();)wt("uponSanitizeShadowNode",$,null),!Bi($)&&($.content instanceof a&&K($.content),$i($));wt("afterSanitizeShadowDOM",M,null)};return r.sanitize=function(K){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,G=null,me=null,Re=null;if(pa=!K,pa&&(K="<!-->"),typeof K!="string"&&!Wi(K))if(typeof K.toString=="function"){if(K=K.toString(),typeof K!="string")throw Kn("dirty is not a string, aborting")}else throw Kn("toString is not a function");if(!r.isSupported)return K;if(la||ha(M),r.removed=[],typeof K=="string"&&(Vn=!1),Vn){if(K.nodeName){const lt=Ee(K.nodeName);if(!Q[lt]||X[lt])throw Kn("root node is forbidden and cannot be sanitized in-place")}}else if(K instanceof l)$=Ni("<!---->"),G=$.ownerDocument.importNode(K,!0),G.nodeType===Zn.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?$=G:$.appendChild(G);else{if(!xn&&!tt&&!Xt&&K.indexOf("<")===-1)return S&&Ar?S.createHTML(K):K;if($=Ni(K),!$)return xn?null:Ar?D:""}$&&ca&&it($.firstChild);const Oe=Ii(Vn?K:$);for(;me=Oe.nextNode();)Bi(me)||(me.content instanceof a&&nf(me.content),$i(me));if(Vn)return K;if(xn){if(Or)for(Re=F.call($.ownerDocument);$.firstChild;)Re.appendChild($.firstChild);else Re=$;return(Z.shadowroot||Z.shadowrootmode)&&(Re=j.call(n,Re,!0)),Re}let qe=Xt?$.outerHTML:$.innerHTML;return Xt&&Q["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&He(ju,$.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
7
+ */(function(e){(function(r,t){e.exports?e.exports=t():r.numeral=t()})(s.commonjsGlobal,function(){var r,t,n="2.0.6",o={},a={},i={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},l={currentLocale:i.currentLocale,zeroFormat:i.zeroFormat,nullFormat:i.nullFormat,defaultFormat:i.defaultFormat,scalePercentBy100:i.scalePercentBy100};function u(c,d){this._input=c,this._value=d}return r=function(c){var d,f,h,m;if(r.isNumeral(c))d=c.value();else if(c===0||typeof c=="undefined")d=0;else if(c===null||t.isNaN(c))d=null;else if(typeof c=="string")if(l.zeroFormat&&c===l.zeroFormat)d=0;else if(l.nullFormat&&c===l.nullFormat||!c.replace(/[^0-9]+/g,"").length)d=null;else{for(f in o)if(m=typeof o[f].regexps.unformat=="function"?o[f].regexps.unformat():o[f].regexps.unformat,m&&c.match(m)){h=o[f].unformat;break}h=h||r._.stringToNumber,d=h(c)}else d=Number(c)||null;return new u(c,d)},r.version=n,r.isNumeral=function(c){return c instanceof u},r._=t={numberToFormat:function(c,d,f){var h=a[r.options.currentLocale],m=!1,y=!1,b=0,v="",x=1e12,w=1e9,T=1e6,S=1e3,D="",_=!1,E,F,N,j,I,H,B;if(c=c||0,F=Math.abs(c),r._.includes(d,"(")?(m=!0,d=d.replace(/[\(|\)]/g,"")):(r._.includes(d,"+")||r._.includes(d,"-"))&&(I=r._.includes(d,"+")?d.indexOf("+"):c<0?d.indexOf("-"):-1,d=d.replace(/[\+|\-]/g,"")),r._.includes(d,"a")&&(E=d.match(/a(k|m|b|t)?/),E=E?E[1]:!1,r._.includes(d," a")&&(v=" "),d=d.replace(new RegExp(v+"a[kmbt]?"),""),F>=x&&!E||E==="t"?(v+=h.abbreviations.trillion,c=c/x):F<x&&F>=w&&!E||E==="b"?(v+=h.abbreviations.billion,c=c/w):F<w&&F>=T&&!E||E==="m"?(v+=h.abbreviations.million,c=c/T):(F<T&&F>=S&&!E||E==="k")&&(v+=h.abbreviations.thousand,c=c/S)),r._.includes(d,"[.]")&&(y=!0,d=d.replace("[.]",".")),N=c.toString().split(".")[0],j=d.split(".")[1],H=d.indexOf(","),b=(d.split(".")[0].split(",")[0].match(/0/g)||[]).length,j?(r._.includes(j,"[")?(j=j.replace("]",""),j=j.split("["),D=r._.toFixed(c,j[0].length+j[1].length,f,j[1].length)):D=r._.toFixed(c,j.length,f),N=D.split(".")[0],r._.includes(D,".")?D=h.delimiters.decimal+D.split(".")[1]:D="",y&&Number(D.slice(1))===0&&(D="")):N=r._.toFixed(c,0,f),v&&!E&&Number(N)>=1e3&&v!==h.abbreviations.trillion)switch(N=String(Number(N)/1e3),v){case h.abbreviations.thousand:v=h.abbreviations.million;break;case h.abbreviations.million:v=h.abbreviations.billion;break;case h.abbreviations.billion:v=h.abbreviations.trillion;break}if(r._.includes(N,"-")&&(N=N.slice(1),_=!0),N.length<b)for(var R=b-N.length;R>0;R--)N="0"+N;return H>-1&&(N=N.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+h.delimiters.thousands)),d.indexOf(".")===0&&(N=""),B=N+D+(v||""),m?B=(m&&_?"(":"")+B+(m&&_?")":""):I>=0?B=I===0?(_?"-":"+")+B:B+(_?"-":"+"):_&&(B="-"+B),B},stringToNumber:function(c){var d=a[l.currentLocale],f=c,h={thousand:3,million:6,billion:9,trillion:12},m,y,b;if(l.zeroFormat&&c===l.zeroFormat)y=0;else if(l.nullFormat&&c===l.nullFormat||!c.replace(/[^0-9]+/g,"").length)y=null;else{y=1,d.delimiters.decimal!=="."&&(c=c.replace(/\./g,"").replace(d.delimiters.decimal,"."));for(m in h)if(b=new RegExp("[^a-zA-Z]"+d.abbreviations[m]+"(?:\\)|(\\"+d.currency.symbol+")?(?:\\))?)?$"),f.match(b)){y*=Math.pow(10,h[m]);break}y*=(c.split("-").length+Math.min(c.split("(").length-1,c.split(")").length-1))%2?1:-1,c=c.replace(/[^0-9\.]+/g,""),y*=Number(c)}return y},isNaN:function(c){return typeof c=="number"&&isNaN(c)},includes:function(c,d){return c.indexOf(d)!==-1},insert:function(c,d,f){return c.slice(0,f)+d+c.slice(f)},reduce:function(c,d){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof d!="function")throw new TypeError(d+" is not a function");var f=Object(c),h=f.length>>>0,m=0,y;if(arguments.length===3)y=arguments[2];else{for(;m<h&&!(m in f);)m++;if(m>=h)throw new TypeError("Reduce of empty array with no initial value");y=f[m++]}for(;m<h;m++)m in f&&(y=d(y,f[m],m,f));return y},multiplier:function(c){var d=c.toString().split(".");return d.length<2?1:Math.pow(10,d[1].length)},correctionFactor:function(){var c=Array.prototype.slice.call(arguments);return c.reduce(function(d,f){var h=t.multiplier(f);return d>h?d:h},1)},toFixed:function(c,d,f,h){var m=c.toString().split("."),y=d-(h||0),b,v,x,w;return m.length===2?b=Math.min(Math.max(m[1].length,y),d):b=y,x=Math.pow(10,b),w=(f(c+"e+"+b)/x).toFixed(b),h>d-b&&(v=new RegExp("\\.?0{1,"+(h-(d-b))+"}$"),w=w.replace(v,"")),w}},r.options=l,r.formats=o,r.locales=a,r.locale=function(c){return c&&(l.currentLocale=c.toLowerCase()),l.currentLocale},r.localeData=function(c){if(!c)return a[l.currentLocale];if(c=c.toLowerCase(),!a[c])throw new Error("Unknown locale : "+c);return a[c]},r.reset=function(){for(var c in i)l[c]=i[c]},r.zeroFormat=function(c){l.zeroFormat=typeof c=="string"?c:null},r.nullFormat=function(c){l.nullFormat=typeof c=="string"?c:null},r.defaultFormat=function(c){l.defaultFormat=typeof c=="string"?c:"0.0"},r.register=function(c,d,f){if(d=d.toLowerCase(),this[c+"s"][d])throw new TypeError(d+" "+c+" already registered.");return this[c+"s"][d]=f,f},r.validate=function(c,d){var f,h,m,y,b,v,x,w;if(typeof c!="string"&&(c+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",c)),c=c.trim(),c.match(/^\d+$/))return!0;if(c==="")return!1;try{x=r.localeData(d)}catch(T){x=r.localeData(r.locale())}return m=x.currency.symbol,b=x.abbreviations,f=x.delimiters.decimal,x.delimiters.thousands==="."?h="\\.":h=x.delimiters.thousands,w=c.match(/^[^\d]+/),w!==null&&(c=c.substr(1),w[0]!==m)||(w=c.match(/[^\d]+$/),w!==null&&(c=c.slice(0,-1),w[0]!==b.thousand&&w[0]!==b.million&&w[0]!==b.billion&&w[0]!==b.trillion))?!1:(v=new RegExp(h+"{2}"),c.match(/[^\d.,]/g)?!1:(y=c.split(f),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(v):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(v)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(v)&&!!y[1].match(/^\d+$/)))},r.fn=u.prototype={clone:function(){return r(this)},format:function(c,d){var f=this._value,h=c||l.defaultFormat,m,y,b;if(d=d||Math.round,f===0&&l.zeroFormat!==null)y=l.zeroFormat;else if(f===null&&l.nullFormat!==null)y=l.nullFormat;else{for(m in o)if(h.match(o[m].regexps.format)){b=o[m].format;break}b=b||r._.numberToFormat,y=b(f,h,d)}return y},value:function(){return this._value},input:function(){return this._input},set:function(c){return this._value=Number(c),this},add:function(c){var d=t.correctionFactor.call(null,this._value,c);function f(h,m,y,b){return h+Math.round(d*m)}return this._value=t.reduce([this._value,c],f,0)/d,this},subtract:function(c){var d=t.correctionFactor.call(null,this._value,c);function f(h,m,y,b){return h-Math.round(d*m)}return this._value=t.reduce([c],f,Math.round(this._value*d))/d,this},multiply:function(c){function d(f,h,m,y){var b=t.correctionFactor(f,h);return Math.round(f*b)*Math.round(h*b)/Math.round(b*b)}return this._value=t.reduce([this._value,c],d,1),this},divide:function(c){function d(f,h,m,y){var b=t.correctionFactor(f,h);return Math.round(f*b)/Math.round(h*b)}return this._value=t.reduce([this._value,c],d),this},difference:function(c){return Math.abs(r(this._value).subtract(c).value())}},r.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(c){var d=c%10;return~~(c%100/10)===1?"th":d===1?"st":d===2?"nd":d===3?"rd":"th"},currency:{symbol:"$"}}),function(){r.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(c,d,f){var h=r._.includes(d," BPS")?" ":"",m;return c=c*1e4,d=d.replace(/\s?BPS/,""),m=r._.numberToFormat(c,d,f),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,h+"BPS"),m=m.join("")):m=m+h+"BPS",m},unformat:function(c){return+(r._.stringToNumber(c)*1e-4).toFixed(15)}})}(),function(){var c={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},d={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},f=c.suffixes.concat(d.suffixes.filter(function(m){return c.suffixes.indexOf(m)<0})),h=f.join("|");h="("+h.replace("B","B(?!PS)")+")",r.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(h)},format:function(m,y,b){var v,x=r._.includes(y,"ib")?d:c,w=r._.includes(y," b")||r._.includes(y," ib")?" ":"",T,S,D;for(y=y.replace(/\s?i?b/,""),T=0;T<=x.suffixes.length;T++)if(S=Math.pow(x.base,T),D=Math.pow(x.base,T+1),m===null||m===0||m>=S&&m<D){w+=x.suffixes[T],S>0&&(m=m/S);break}return v=r._.numberToFormat(m,y,b),v+w},unformat:function(m){var y=r._.stringToNumber(m),b,v;if(y){for(b=c.suffixes.length-1;b>=0;b--){if(r._.includes(m,c.suffixes[b])){v=Math.pow(c.base,b);break}if(r._.includes(m,d.suffixes[b])){v=Math.pow(d.base,b);break}}y*=v||1}return y}})}(),function(){r.register("format","currency",{regexps:{format:/(\$)/},format:function(c,d,f){var h=r.locales[r.options.currentLocale],m={before:d.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:d.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,v;for(d=d.replace(/\s?\$\s?/,""),y=r._.numberToFormat(c,d,f),c>=0?(m.before=m.before.replace(/[\-\(]/,""),m.after=m.after.replace(/[\-\)]/,"")):c<0&&!r._.includes(m.before,"-")&&!r._.includes(m.before,"(")&&(m.before="-"+m.before),v=0;v<m.before.length;v++)switch(b=m.before[v],b){case"$":y=r._.insert(y,h.currency.symbol,v);break;case" ":y=r._.insert(y," ",v+h.currency.symbol.length-1);break}for(v=m.after.length-1;v>=0;v--)switch(b=m.after[v],b){case"$":y=v===m.after.length-1?y+h.currency.symbol:r._.insert(y,h.currency.symbol,-(m.after.length-(1+v)));break;case" ":y=v===m.after.length-1?y+" ":r._.insert(y," ",-(m.after.length-(1+v)+h.currency.symbol.length-1));break}return y}})}(),function(){r.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(c,d,f){var h,m=typeof c=="number"&&!r._.isNaN(c)?c.toExponential():"0e+0",y=m.split("e");return d=d.replace(/e[\+|\-]{1}0/,""),h=r._.numberToFormat(Number(y[0]),d,f),h+"e"+y[1]},unformat:function(c){var d=r._.includes(c,"e+")?c.split("e+"):c.split("e-"),f=Number(d[0]),h=Number(d[1]);h=r._.includes(c,"e-")?h*=-1:h;function m(y,b,v,x){var w=r._.correctionFactor(y,b),T=y*w*(b*w)/(w*w);return T}return r._.reduce([f,Math.pow(10,h)],m,1)}})}(),function(){r.register("format","ordinal",{regexps:{format:/(o)/},format:function(c,d,f){var h=r.locales[r.options.currentLocale],m,y=r._.includes(d," o")?" ":"";return d=d.replace(/\s?o/,""),y+=h.ordinal(c),m=r._.numberToFormat(c,d,f),m+y}})}(),function(){r.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(c,d,f){var h=r._.includes(d," %")?" ":"",m;return r.options.scalePercentBy100&&(c=c*100),d=d.replace(/\s?\%/,""),m=r._.numberToFormat(c,d,f),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,h+"%"),m=m.join("")):m=m+h+"%",m},unformat:function(c){var d=r._.stringToNumber(c);return r.options.scalePercentBy100?d*.01:d}})}(),function(){r.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(c,d,f){var h=Math.floor(c/60/60),m=Math.floor((c-h*60*60)/60),y=Math.round(c-h*60*60-m*60);return h+":"+(m<10?"0"+m:m)+":"+(y<10?"0"+y:y)},unformat:function(c){var d=c.split(":"),f=0;return d.length===3?(f=f+Number(d[0])*60*60,f=f+Number(d[1])*60,f=f+Number(d[2])):d.length===2&&(f=f+Number(d[0])*60,f=f+Number(d[1])),Number(f)}})}(),r})})(Kc);var Ah=Kc.exports;const Fh=s.getDefaultExportFromCjs(Ah),Rh=(e,r)=>{const t=Ih(e);return Lh(t,r)};function Lh(e,r){return{columns:r==null?void 0:r.map(t=>({name:t.name,type:s.simpleColumnType(t.type)})),rows:Nh(e)}}function Nh(e){var r;let t=!1;const n=(r=e[0])===null||r===void 0?void 0:r.map((o,a)=>{const i=e.some(l=>"selected"in l[a]);return i&&(t=!0),i});return e.map(o=>{const a=t?n.some((i,l)=>i&&!o[l].selected):void 0;return o.map(i=>a!==void 0?{data:i.data,text:i.text,blur:a}:{data:i.data,text:i.text})})}function Ih({values:e=[],metadata:r=[]}){var t,n,o,a;e[0]&&!Array.isArray(e[0])&&(e=[e]);for(let i=0;i<e.length;i++){const l=e[i];for(let u=0;u<l.length;u++)r[u].format&&(!((n=(t=r[u])===null||t===void 0?void 0:t.format)===null||n===void 0)&&n.number)&&(l[u].text=Fh(l[u].data).format((a=(o=r[u])===null||o===void 0?void 0:o.format)===null||a===void 0?void 0:a.number))}return e}var Zt=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};class jh extends Ge.AbstractTaskManager{constructor(r,t){super(),this.sentRequestsAbortersMap=new Map,this.executeQuerySending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_JAQL_QUERY",this.sendJaqlQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executeDownloadCsvSending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_DOWNLOAD_CSV_QUERY",this.sendCsvQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executePivotQuerySending=super.createFlow([new Ge.Step("PREPARE_JAQL_PAYLOAD",this.preparePivotJaqlPayload.bind(this),()=>Zt(this,void 0,void 0,function*(){})),new Ge.Step("SEND_JAQL_QUERY",this.sendPivotJaqlQuery.bind(this),this.cancelPivotJaqlQuery.bind(this))]),this.queryApi=r,this.pivotClient=t}prepareJaqlPayload(r){return Zt(this,void 0,void 0,function*(){const{queryDescription:t,executionConfig:n}=r.passport,o=s.getJaqlQueryPayload(t,n.shouldSkipHighlightsWithoutAttributes),a=r.passport.executionConfig.onBeforeQuery;return a?a(o):o})}sendJaqlQuery(r,t){return Zt(this,void 0,void 0,function*(){const{queryDescription:n,taskId:o}=r.passport,{responsePromise:a,abortHttpRequest:i}=this.queryApi.sendJaqlRequest(r.passport.queryDescription.dataSource,t);this.sentRequestsAbortersMap.set(o,i);const l=yield a.finally(()=>{this.sentRequestsAbortersMap.delete(o)});Wh(l);const u=[...n.attributes,...n.measures],c=(l.headers||[]).slice(u.length).map(d=>({name:d,type:"number"}));return Rh(l,[...u,...c])})}sendCsvQuery(r,t){return Zt(this,void 0,void 0,function*(){const{taskId:n}=r.passport,{responsePromise:o,abortHttpRequest:a}=this.queryApi.sendDownloadCsvRequest(r.passport.queryDescription.dataSource,t);return this.sentRequestsAbortersMap.set(n,a),o.finally(()=>{this.sentRequestsAbortersMap.delete(n)})})}cancelDataRetrievalQuery(r){const t=r.passport.taskId,n=this.sentRequestsAbortersMap.get(t);return n&&(n(),this.sentRequestsAbortersMap.delete(t)),this.queryApi.sendCancelJaqlQueryRequest(t,r.passport.queryDescription.dataSource)}preparePivotJaqlPayload(r){return Zt(this,void 0,void 0,function*(){const{pivotQueryDescription:t,executionConfig:n}=r.passport,o=s.getPivotJaqlQueryPayload(t,n.shouldSkipHighlightsWithoutAttributes),a=r.passport.executionConfig.onBeforeQuery;return a?a(o):o})}sendPivotJaqlQuery(r,t){var n;const{pivotQueryDescription:o}=r.passport;return this.pivotClient.queryData(t,!0,(n=o.count)!==null&&n!==void 0?n:Hh,!1)}cancelPivotJaqlQuery(r){const t=r.passport.taskId,n=this.sentRequestsAbortersMap.get(t);return n&&(n(),this.sentRequestsAbortersMap.delete(t)),this.queryApi.sendCancelJaqlQueryRequest(t,r.passport.pivotQueryDescription.dataSource)}}function Wh(e){var r;if(!e)throw new We("errors.noJaqlResponse");if(e.error)throw new Error(`${e.details} ${(r=e.database)!==null&&r!==void 0?r:""} ${e.extraDetails?JSON.stringify(e.extraDetails):""}`)}class Xi extends Ge.TaskPassport{constructor(r,t,n){super(),this.queryDescription=t,this.type=r,this.executionConfig=n}}class Bh extends Ge.TaskPassport{constructor(r,t,n){super(),this.pivotQueryDescription=t,this.type=r,this.executionConfig=n}}var Zi=function(e,r,t,n){function o(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function l(d){try{c(n.next(d))}catch(f){i(f)}}function u(d){try{c(n.throw(d))}catch(f){i(f)}}function c(d){d.done?a(d.value):o(d.value).then(l,u)}c((n=n.apply(e,r||[])).next())})};const Hh=2e4,Ta="Unspecified reason";class Yh{constructor(r,t=new s.UB(r.url,r.auth),n){Uh(r),this.queryApi=new Eh(r),this.taskManager=new jh(this.queryApi,t),this.shouldSkipHighlightsWithoutAttributes=n!=null?n:!1}executeQuery(r,t){const n=new Xi("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{Ji(r),this.taskManager.executeQuerySending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}executeCsvQuery(r,t){const n=new Xi("SEND_DOWNLOAD_CSV_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{Ji(r),this.taskManager.executeDownloadCsvSending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}executePivotQuery(r,t){const n=new Bh("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},t||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((o,a)=>{$h(r),this.taskManager.executePivotQuerySending(n).then(i=>{i.status===Ge.ExecutionResultStatus.SUCCESS?o(i.result):a(i.error)})}),cancel:o=>this.taskManager.cancel(n.taskId,o||Ta)}}getDataSourceFields(r,t=9999,n=0){return Zi(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceFields(r,t,n))||[]})}getDataSourceSchema(r){return this.queryApi.getDataSourceSchema(r)}getDataSourceList(){return Zi(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceList())||[]})}}function Ji(e){const{attributes:r,measures:t,filters:n,highlights:o,count:a,offset:i}=e;if(a&&a<0)throw new We("errors.invalidCountNegative",{count:a.toString()});if(i&&i<0)throw new We("errors.invalidOffset",{offset:i.toString()});if(r.length+t.length===0)throw new We("errors.noDimensionsOrMeasures");r.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isAttribute(l)){const{name:u}=l;throw new We("errors.invalidAttribute",{attributeName:u})}}),t.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isMeasure(l))throw new We("errors.invalidMeasure",{measureName:l.name})}),n.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isFilter(l))throw new We("errors.invalidFilter",{filterName:l.name})}),o.forEach(l=>{if(!l.skipValidation&&!s.MetadataTypes.isFilter(l))throw new We("errors.invalidHighlight",{highlightName:l.name})})}function $h(e){const{rowsAttributes:r,columnsAttributes:t,measures:n,filters:o,highlights:a,count:i,offset:l}=e;if(i&&i<0)throw new We("errors.invalidCountNegative",{count:i.toString()});if(l&&l<0)throw new We("errors.invalidOffset",{offset:l.toString()});if(r.length+t.length+n.length===0)throw new We("errors.noDimensionsOrMeasures");o.forEach(u=>{if(!u.skipValidation&&!s.MetadataTypes.isFilter(u))throw new We("errors.invalidFilter",{filterName:u.name})}),a.forEach(u=>{if(!u.skipValidation&&!s.MetadataTypes.isFilter(u))throw new We("errors.invalidHighlight",{highlightName:u.name})})}function Uh(e){if(!e)throw new We("errors.missingHttpClient");if(!e.post)throw new We("errors.missingPostMethod")}const Vh={enabled:!0,delay:500},zh={locale:s.getBaseDateFnsLocale(),dateConfig:s.defaultDateConfig,loadingIndicatorConfig:Vh,translationConfig:{language:"en",customTranslations:[]},language:"en",queryCacheConfig:{enabled:!1},queryLimit:s.QUERY_DEFAULT_LIMIT,tabberConfig:{enabled:!1},accessibilityConfig:{enabled:!1},errorBoundaryConfig:{alwaysShowErrorText:!1},trackingConfig:{enabled:!0}};function qh(e,r,t){return Te(this,null,function*(){var o;const n=yield Gh(r,t);return s.merge.withOptions({mergeArrays:!1},zh,{locale:s.getBaseDateFnsLocale((o=e==null?void 0:e.translationConfig)==null?void 0:o.language)},n,e)})}function Qh(e){const r={};return e.forEach(t=>{r[t.key]=t}),r}function Gh(e,r=!1){return Te(this,null,function*(){var a,i;const t=yield e.get("api/globals");if(!t)throw new s.TranslatableError("errors.serverSettingsNotLoaded");const n=r?{colors:s.getDefaultThemeSettings().palette.variantColors}:yield p.getLegacyPalette(p.getPaletteName(t.designSettings),e);return{serverThemeSettings:p.convertToThemeSettings(t.designSettings,n,e.url),serverLanguage:t.language,serverVersion:t.version,serverFeatures:Qh(t.features),user:{tenant:{name:((i=(a=t.user)==null?void 0:a.tenant)==null?void 0:i.name)||s.SYSTEM_TENANT_NAME}}}})}function Kh(e,r){return r===s.SYSTEM_TENANT_NAME?e:e.replace(`/${r}`,"")}function Xh(){window.addEventListener("unhandledrejection",e=>{e.reason instanceof Error?console.error(e.reason.message):console.error(e.reason)})}const Xc=u=>Te(exports,[u],function*({defaultDataSource:e,url:r,token:t,wat:n,ssoEnabled:o,appConfig:a,enableSilentPreAuth:i,useFusionAuth:l}){if(r===void 0)throw new s.TranslatableError("errors.sisenseContextNoAuthentication");const c=Hn(r),d=Ef({url:c,token:t,wat:n,ssoEnabled:o,enableSilentPreAuth:i,useFusionAuth:l});if(!d)throw new s.TranslatableError("errors.sisenseContextNoAuthentication");Xh();const f=new Pf(c,d,"sdk-ui-1.35.0"),h=yield f.login(),m=jc(d)||!h,y=yield qh(a||{},f,m),b=new s.UB(Kh(c,y.user.tenant.name),d),v=new Yh(f,b),x={clear:s.clearExecuteQueryCache};return{httpClient:f,pivotClient:b,queryClient:v,settings:y,defaultDataSource:e,queryCache:x}}),el=e=>e,Zh=()=>{let e=el;return{configure(r){e=r},generate(r){return e(r)},reset(){e=el}}},Jh=Zh(),em={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function tm(e,r,t="Mui"){const n=em[r];return n?`${t}-${n}`:`${Jh.generate(e)}-${r}`}const nm=["ownerState"],rm=["variants"],om=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function am(e){return Object.keys(e).length===0}function sm(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Sa(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const im=p.createTheme(),tl=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function jr({defaultTheme:e,theme:r,themeId:t}){return am(r)?e:r[t]||r}function lm(e){return e?(r,t)=>t[e]:null}function Gr(e,r){let{ownerState:t}=r,n=p._objectWithoutPropertiesLoose(r,nm);const o=typeof e=="function"?e(s._extends({ownerState:t},n)):e;if(Array.isArray(o))return o.flatMap(a=>Gr(a,s._extends({ownerState:t},n)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:a=[]}=o;let l=p._objectWithoutPropertiesLoose(o,rm);return a.forEach(u=>{let c=!0;typeof u.props=="function"?c=u.props(s._extends({ownerState:t},n,t)):Object.keys(u.props).forEach(d=>{(t==null?void 0:t[d])!==u.props[d]&&n[d]!==u.props[d]&&(c=!1)}),c&&(Array.isArray(l)||(l=[l]),l.push(typeof u.style=="function"?u.style(s._extends({ownerState:t},n,t)):u.style))}),l}return o}function cm(e={}){const{themeId:r,defaultTheme:t=im,rootShouldForwardProp:n=Sa,slotShouldForwardProp:o=Sa}=e,a=i=>p.styleFunctionSx(s._extends({},i,{theme:jr(s._extends({},i,{defaultTheme:t,themeId:r}))}));return a.__mui_systemSx=!0,(i,l={})=>{p.internal_processStyles(i,D=>D.filter(_=>!(_!=null&&_.__mui_systemSx)));const{name:u,slot:c,skipVariantsResolver:d,skipSx:f,overridesResolver:h=lm(tl(c))}=l,m=p._objectWithoutPropertiesLoose(l,om),y=d!==void 0?d:c&&c!=="Root"&&c!=="root"||!1,b=f||!1;let v;process.env.NODE_ENV!=="production"&&u&&(v=`${u}-${tl(c||"Root")}`);let x=Sa;c==="Root"||c==="root"?x=n:c?x=o:sm(i)&&(x=void 0);const w=p.styled(i,s._extends({shouldForwardProp:x,label:v},m)),T=D=>typeof D=="function"&&D.__emotion_real!==D||p.isPlainObject(D)?_=>Gr(D,s._extends({},_,{theme:jr({theme:_.theme,defaultTheme:t,themeId:r})})):D,S=(D,..._)=>{let E=T(D);const F=_?_.map(T):[];u&&h&&F.push(I=>{const H=jr(s._extends({},I,{defaultTheme:t,themeId:r}));if(!H.components||!H.components[u]||!H.components[u].styleOverrides)return null;const B=H.components[u].styleOverrides,R={};return Object.entries(B).forEach(([O,A])=>{R[O]=Gr(A,s._extends({},I,{theme:H}))}),h(I,R)}),u&&!y&&F.push(I=>{var H;const B=jr(s._extends({},I,{defaultTheme:t,themeId:r})),R=B==null||(H=B.components)==null||(H=H[u])==null?void 0:H.variants;return Gr({variants:R},s._extends({},I,{theme:B}))}),b||F.push(a);const N=F.length-_.length;if(Array.isArray(D)&&N>0){const I=new Array(N).fill("");E=[...D,...I],E.raw=[...D.raw,...I]}const j=w(E,...F);if(process.env.NODE_ENV!=="production"){let I;u&&(I=`${u}${p.capitalize(c||"")}`),I===void 0&&(I=`Styled(${p.getDisplayName(i)})`),j.displayName=I}return i.muiName&&(j.muiName=i.muiName),j};return w.withConfig&&(S.withConfig=w.withConfig),S}}const um=cm();function dm(e){const{theme:r,name:t,props:n}=e;return!r||!r.components||!r.components[t]||!r.components[t].defaultProps?n:p.resolveProps(r.components[t].defaultProps,n)}function pm({props:e,name:r,defaultTheme:t,themeId:n}){let o=p.useTheme(t);return n&&(o=o[n]||o),dm({theme:o,name:r,props:e})}function fm(e,r,t=void 0){const n={};return Object.keys(e).forEach(o=>{n[o]=e[o].reduce((a,i)=>{if(i){const l=r(i);l!==""&&a.push(l),t&&t[i]&&a.push(t[i])}return a},[]).join(" ")}),n}const hm=["component","direction","spacing","divider","children","className","useFlexGap"],mm=p.createTheme(),gm=um("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,r)=>r.root});function ym(e){return pm({props:e,name:"MuiStack",defaultTheme:mm})}function bm(e,r){const t=Y.Children.toArray(e).filter(Boolean);return t.reduce((n,o,a)=>(n.push(o),a<t.length-1&&n.push(Y.cloneElement(r,{key:`separator-${a}`})),n),[])}const vm=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],xm=({ownerState:e,theme:r})=>{let t=s._extends({display:"flex",flexDirection:"column"},p.handleBreakpoints({theme:r},p.resolveBreakpointValues({values:e.direction,breakpoints:r.breakpoints.values}),n=>({flexDirection:n})));if(e.spacing){const n=p.createUnarySpacing(r),o=Object.keys(r.breakpoints.values).reduce((u,c)=>((typeof e.spacing=="object"&&e.spacing[c]!=null||typeof e.direction=="object"&&e.direction[c]!=null)&&(u[c]=!0),u),{}),a=p.resolveBreakpointValues({values:e.direction,base:o}),i=p.resolveBreakpointValues({values:e.spacing,base:o});typeof a=="object"&&Object.keys(a).forEach((u,c,d)=>{if(!a[u]){const h=c>0?a[d[c-1]]:"column";a[u]=h}});const l=(u,c)=>e.useFlexGap?{gap:p.getValue(n,u)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${vm(c?a[c]:e.direction)}`]:p.getValue(n,u)}};t=p.deepmerge(t,p.handleBreakpoints({theme:r},i,l))}return t=p.mergeBreakpointsInOrder(r.breakpoints,t),t};function wm(e={}){const{createStyledComponent:r=gm,useThemeProps:t=ym,componentName:n="MuiStack"}=e,o=()=>fm({root:["root"]},u=>tm(n,u),{}),a=r(xm),i=Y.forwardRef(function(u,c){const d=t(u),f=p.extendSxProp(d),{component:h="div",direction:m="column",spacing:y=0,divider:b,children:v,className:x,useFlexGap:w=!1}=f,T=p._objectWithoutPropertiesLoose(f,hm),S={direction:m,spacing:y,useFlexGap:w},D=o();return se.jsx(a,s._extends({as:h,ownerState:S,ref:c,className:p.clsx(D.root,x)},T,{children:b?bm(v,b):v}))});return process.env.NODE_ENV!=="production"&&(i.propTypes={children:p.PropTypes.node,direction:p.PropTypes.oneOfType([p.PropTypes.oneOf(["column-reverse","column","row-reverse","row"]),p.PropTypes.arrayOf(p.PropTypes.oneOf(["column-reverse","column","row-reverse","row"])),p.PropTypes.object]),divider:p.PropTypes.node,spacing:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string])),p.PropTypes.number,p.PropTypes.object,p.PropTypes.string]),sx:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object,p.PropTypes.bool])),p.PropTypes.func,p.PropTypes.object])}),i}function Zc(e,r){var t,n;return Y.isValidElement(e)&&r.indexOf((t=e.type.muiName)!=null?t:(n=e.type)==null||(n=n._payload)==null||(n=n.value)==null?void 0:n.muiName)!==-1}const Cm=["children","className","disableTypography","inset","primary","primaryTypographyProps","secondary","secondaryTypographyProps"],Tm=e=>{const{classes:r,inset:t,primary:n,secondary:o,dense:a}=e,i={root:["root",t&&"inset",a&&"dense",n&&o&&"multiline"],primary:["primary"],secondary:["secondary"]};return p.composeClasses(i,p.getListItemTextUtilityClass,r)},Sm=p.styled$1("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[{[`& .${p.listItemTextClasses.primary}`]:r.primary},{[`& .${p.listItemTextClasses.secondary}`]:r.secondary},r.root,t.inset&&r.inset,t.primary&&t.secondary&&r.multiline,t.dense&&r.dense]}})(({ownerState:e})=>s._extends({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4},e.primary&&e.secondary&&{marginTop:6,marginBottom:6},e.inset&&{paddingLeft:56})),Jc=Y.forwardRef(function(r,t){const n=p.useDefaultProps({props:r,name:"MuiListItemText"}),{children:o,className:a,disableTypography:i=!1,inset:l=!1,primary:u,primaryTypographyProps:c,secondary:d,secondaryTypographyProps:f}=n,h=p._objectWithoutPropertiesLoose(n,Cm),{dense:m}=Y.useContext(p.ListContext);let y=u!=null?u:o,b=d;const v=s._extends({},n,{disableTypography:i,inset:l,primary:!!y,secondary:!!b,dense:m}),x=Tm(v);return y!=null&&y.type!==p.Typography&&!i&&(y=se.jsx(p.Typography,s._extends({variant:m?"body2":"body1",className:x.primary,component:c!=null&&c.variant?void 0:"span",display:"block"},c,{children:y}))),b!=null&&b.type!==p.Typography&&!i&&(b=se.jsx(p.Typography,s._extends({variant:"body2",className:x.secondary,color:"text.secondary",display:"block"},f,{children:b}))),se.jsxs(Sm,s._extends({className:p.clsx(x.root,a),ownerState:v,ref:t},h,{children:[y,b]}))});process.env.NODE_ENV!=="production"&&(Jc.propTypes={children:p.PropTypes.node,classes:p.PropTypes.object,className:p.PropTypes.string,disableTypography:p.PropTypes.bool,inset:p.PropTypes.bool,primary:p.PropTypes.node,primaryTypographyProps:p.PropTypes.object,secondary:p.PropTypes.node,secondaryTypographyProps:p.PropTypes.object,sx:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object,p.PropTypes.bool])),p.PropTypes.func,p.PropTypes.object])});const rn=(e,r)=>`${r}px solid ${e}`,eu=e=>({columns:[{widthPercentage:100,rows:e.map(r=>({cells:[{widthPercentage:100,widgetId:r.id}]}))}]});function tu(e){return p.isString(e)?{direction:e}:e}function nl(e,r){return{valuesIndex:e.field-(r.rows||[]).length-(r.columns||[]).length,columnsMembersPath:Object.values(e.measurePath||{})}}function Dm({type:e,settings:r,sortDetails:t},n){return e==="simple"?t.field>=(n.rows||[]).length?[{rowIndex:0,sort:{direction:s.getSortType(r[0].direction),by:nl(t,n)}}]:[{rowIndex:t.field,sort:{direction:s.getSortType(r[0].direction)}}]:r.reduce((o,a,i)=>{var f;const l=(f=n.rows)==null?void 0:f[i],u=(l==null?void 0:l.sortType)&&tu(l==null?void 0:l.sortType),c={direction:s.getSortType(a.direction),by:nl(t,n)};return!a.selected&&s.isEqual(u==null?void 0:u.by,c.by)&&o.push({rowIndex:i,sort:null}),a.selected&&o.push({rowIndex:i,sort:c}),o},[])}function km(e){const{jaql:r,pivotBuilder:t,isForceReload:n}=e,[o,a]=g.useState({isLoading:!1,isNoResults:!1}),i=p.useHasChanged(r);g.useEffect(()=>{r&&(i||n)&&t.updateJaql(r)},[n,i,r,t]);const l=g.useCallback(()=>{a({isLoading:!0,isNoResults:!1})},[]),u=g.useCallback(c=>{a({isLoading:!1,isNoResults:!c.cellsMetadata})},[]);return g.useEffect(()=>{const c=[{event:s.lv,handler:l},{event:s.cv,handler:u}];return c.forEach(({event:d,handler:f})=>{t.on(d,f)}),()=>{c.forEach(({event:d,handler:f})=>{t.off(d,f)})}},[t,l,u]),o}function _m(e){const{pivotClient:r,pivotBuilder:t,shouldBeRecreated:n}=e,[o,a]=g.useState(()=>r.prepareDataService());return g.useEffect(()=>{if(n){const i=r.prepareDataService();a(i),t.updateDataService(i)}},[r,t,n]),g.useEffect(()=>()=>{o.destroy()},[o]),o}const Em=({dataOptions:e})=>{const[r,t]=g.useState(p.translatePivotTableDataOptions(e));return{dataOptionsInternal:r,updateSort(n){var o;t(k(C({},r),{rows:(o=r.rows)==null?void 0:o.map((a,i)=>{const l=n.rows.find(({rowIndex:u})=>u===i);return l?l.sort===null?s.safeCombine(a,{sortType:void 0}):s.safeCombine(a,{sortType:l.sort}):a})}))}}},Mm=e=>(r,t,n,o)=>{var u;const a=s.getPivotDataOptionByJaqlIndex(e,(u=o==null?void 0:o.field)==null?void 0:u.index),i=s.getNumberFormatConfig(a),l=r.value===null||typeof r.value=="undefined";r.content=l?"":s.applyFormatPlainText(i,r.value)},Pm=()=>(e,r,t)=>{var c,d;const n=e.userType===s.nt.CORNER,o=e.userType===s.nt.SUB_TOTAL;if(!r||n||o)return;const a=t.metadata.find(({panel:f,jaql:h})=>{var x;const m=["rows","columns"].includes(f),y=h.dim===r.jaql.dim,b=r.jaql.datatype===h.datatype&&r.jaql.level===h.level,v=(x=h.in)==null?void 0:x.selected;return m&&y&&b&&v}),i=(d=(c=a==null?void 0:a.jaql)==null?void 0:c.in)==null?void 0:d.selected;if(!i)return;Uf(i.jaql)(e.value)&&(e.state={isSelected:!0})};function Om(e,r){return t=>{var n,o,a,i;if(t.userType===s.nt.SUB_TOTAL&&(t.content=r("pivotTable.subTotal",{value:(n=t.content)!=null?n:""})),t.userType===s.nt.GRAND_TOTAL){if(t.metadataType===s.xe.ROWS&&(t.content=r("pivotTable.grandTotal"),((o=e.values)==null?void 0:o.length)===1&&!((a=e.columns)!=null&&a.length))){const[l]=e.values,u="column"in l?l.column:l;t.content=(i=u.name)!=null?i:t.content}t.metadataType===s.xe.COLUMNS&&t.parent&&(t.content=r("pivotTable.grandTotal"))}}}const Am="#000000",Fm="#ffffff";function Rm(e,r){return(t,n,o,a)=>{var d;const i={};if(n.userType===s.nt.SUB_TOTAL||n.userType===s.nt.GRAND_TOTAL||o.userType===s.nt.SUB_TOTAL||o.userType===s.nt.GRAND_TOTAL||o.parent&&o.parent.userType===s.nt.SUB_TOTAL||o.parent&&o.parent.userType===s.nt.GRAND_TOTAL)return;const l=s.getPivotDataOptionByJaqlIndex(e,(d=a==null?void 0:a.field)==null?void 0:d.index),u=l==null?void 0:l.color,c=l==null?void 0:l.dataBarsColor;if(u){const f=s.getColoringServiceByColorOptions(u);if(f.type==="Static"||f.type==="Absolute"){const h=f.getColor(t.value);h&&(i.backgroundColor=h)}else if(f.type==="Relative"){const h=u,[m]=r.palette.variantColors,y=m?s.scaleBrightness(m,.2):Am,b=m?s.scaleBrightness(m,-.2):Fm,v={steps:h.steps,min:h.minColor,max:h.maxColor,minDef:y,maxDef:b,minGray:s.toGray(y),maxGray:s.toGray(b)};t.store=t.store||{},t.store.compileRange=({min:x,max:w,minvalue:T,midvalue:S,maxvalue:D})=>s.getInterpolatorFn(x!=null?x:"#000000",w!=null?w:"#ffffff",T!=null?T:0,S!=null?S:0,D!=null?D:0),t.store.compileRangeContext={},t.store.compileRangeArgs=v}}if(c){const f=s.getColoringServiceByColorOptions(c);if(f.type==="Static"||f.type==="Absolute"){const h=f.getColor(t.value);h&&(i.databarColor=h)}}Object.keys(i).length>0&&(t.style=t.style||{},Object.assign(t.style,i))}}const Lm=({dataService:e,dataOptions:r})=>{const{app:t}=s.useSisenseContext(),{t:n}=s.useTranslation(),{themeSettings:o}=s.useThemeContext(),a=g.useCallback(s.over([Mm(r),Rm(r,o)]),[r]),i=g.useCallback((u,c)=>s.applyDateFormat(u,c,t==null?void 0:t.settings.locale,t==null?void 0:t.settings.dateConfig),[t]),l=g.useCallback(s.over([s.createHeaderCellValueFormatter(r,i),Om(r,n),Pm()]),[r,n]);g.useEffect(()=>(e.on(s.rE,a),e.on(s.am,l),()=>{e.off(s.rE,a),e.off(s.am,l)}),[e,a])};function rl(e,r){return p.dataLoadStateReducer(e,r)}const Nm=p.withTracking("useExecutePivotQuery")(nu);function nu(e){const r=jm(e),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(rl,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext();return g.useEffect(()=>{if(a||o({type:"error",error:new s.TranslatableError("errors.executeQueryNoSisenseContext")}),t(i)){o({type:"loading"});const{dataSource:l,rows:u,columns:c,values:d,grandTotals:f,filters:h,highlights:m,count:y,offset:b,onBeforeQuery:v}=e,{filters:x,relations:w}=s.getFilterListAndRelationsJaql(h);s.executePivotQuery({dataSource:l,rows:u,columns:c,values:d,grandTotals:f,filters:x,filterRelations:w,highlights:m,count:y,offset:b},i,{onBeforeQuery:v}).then(T=>{o({type:"success",data:T})}).catch(T=>{o({type:"error",error:T})})}},[i,a,e,t]),n.data&&r?rl(n,{type:"loading"}):n}const Im=["dataSource","rows","columns","values","grandTotals","count","offset","onBeforeQuery"];function jm(e){return p.useHasChanged(e,Im,(r,t)=>{const{filters:n}=s.getFilterListAndRelationsJaql(t.filters),{filters:o}=s.getFilterListAndRelationsJaql(r.filters);return p.isFiltersChanged(n,o)||p.isFiltersChanged(t.highlights,r.highlights)})}function ru(e,r){const[t,n]=g.useState(e),o=g.useMemo(()=>p.debounce(a=>{n(a)},r),[r]);return g.useEffect(()=>{o(e)},[e,o]),t}const Wm=200,ol=e=>C({attribute:s.translateColumnToAttribute(e),includeSubTotals:e.includeSubTotals||!1},e.sortType&&{sort:tu(e.sortType)}),Bm=e=>{var r;return{measure:s.translateColumnToMeasure(e),totalsCalculation:e.totalsCalculation,dataBars:e.dataBars||!1,shouldRequestMinMax:((r=e.color)==null?void 0:r.type)==="range"}},ou=e=>{const{rows:r=[],columns:t=[],values:n=[],grandTotals:o}=e,a=r.flatMap(ol),i=t.flatMap(ol),l=n.flatMap(Bm);return{rows:a,columns:i,values:l,grandTotals:o}},Hm=({dataSet:e,dataOptionsInternal:r,filters:t,highlights:n})=>{const[o,a]=g.useState(),{rows:i,columns:l,values:u,grandTotals:c}=ou(r),d=g.useCallback(m=>{a(y=>s.isEqual(y,m)?y:m)},[a]),f=ru({dataSource:e,rows:i,columns:l,values:u,grandTotals:c,filters:t,highlights:n,onBeforeQuery:d},Wm),{error:h}=nu(f);return{jaql:o,error:h}},Ym="#cbced7",$m="#ffff9c";function Um(e,r){var o,a,i,l,u,c,d,f,h,m,y;let t,n;if((o=r==null?void 0:r.chart)!=null&&o.backgroundColor){const b=s.getDarkFactor(s.toColor((a=r==null?void 0:r.chart)==null?void 0:a.backgroundColor))<.5?.07:-.07;t=s.getSlightlyDifferentColor((i=r==null?void 0:r.chart)==null?void 0:i.backgroundColor,b),n=s.getSlightlyDifferentColor((l=r==null?void 0:r.chart)==null?void 0:l.backgroundColor,b*1.5)}return{fontFamily:(u=r==null?void 0:r.typography)==null?void 0:u.fontFamily,textColor:(c=r==null?void 0:r.chart)==null?void 0:c.textColor,backgroundColor:(d=r==null?void 0:r.chart)==null?void 0:d.backgroundColor,borderColor:Ym,fillColor:t,additionalFillColor:n,fillOptions:{alternatingRows:e==null?void 0:e.alternatingRowsColor,alternatingColumns:e==null?void 0:e.alternatingColumnsColor,columnsHeaders:e==null?void 0:e.headersColor,rowMembers:e==null?void 0:e.membersColor,totals:e==null?void 0:e.totalsColor},rowHeight:e==null?void 0:e.rowHeight,isAutoHeight:(f=e==null?void 0:e.isAutoHeight)!=null?f:!1,navigationPrimaryColor:(h=r==null?void 0:r.typography)==null?void 0:h.primaryTextColor,navigationSecondaryColor:(m=r==null?void 0:r.typography)==null?void 0:m.secondaryTextColor,selectionColor:(y=e==null?void 0:e.highlightColor)!=null?y:$m}}const Vm=25;function zm({nodeRef:e,pivotBuilder:r,dataOptions:t,styleOptions:n,themeSettings:o,size:a,onTotalHeightChange:i}){const[l,u]=p.useSyncedState((n==null?void 0:n.rowsPerPage)||Vm),c=g.useCallback((m,y)=>{const v=[...t.rows?t.rows:[],...t.columns?t.columns:[],...t.values?t.values:[]].map(w=>w==null?void 0:w.width);if(y){const[w,T]=y,S=m[w];S&&typeof S.jaqlIndex!="undefined"&&(v[S.jaqlIndex]=T)}const x=[];return m.forEach((w,T)=>{typeof w.jaqlIndex!="undefined"&&typeof v[w.jaqlIndex]!="undefined"&&x.push([T,v[w.jaqlIndex]])}),x},[t]),d=g.useCallback(m=>{u(m)},[u]),f=g.useMemo(()=>Um(n,o),[n,o]),h=g.useMemo(()=>a?C({width:a.width,height:a.height,isPaginated:!0,itemsPerPage:l,isSelectedMode:!0,onUpdatePredefinedColumnWidth:c,onItemsPerPageChange:d,onTotalHeightChange:i},f):null,[a,l,c,f,i,d]);g.useEffect(()=>{e.current&&h&&(!!e.current.children.length?r.updateProps(h):r.render(e.current,h))},[e,r,h])}function qm(e){const{pivotClient:r}=e,t=g.useMemo(()=>r.preparePivotBuilder(),[r]);return g.useEffect(()=>()=>{t.destroy()},[t]),t}const au=p.asSisenseComponent({componentName:"PivotTable"})(e=>{const{dataSet:r,dataOptions:t,filters:n,highlights:o,refreshCounter:a=0}=e,i=g.useMemo(()=>{var I;return(I=e.styleOptions)!=null?I:{}},[e.styleOptions]),l=g.useRef(null),[u,c]=g.useState(null),[d,f]=g.useState(null),{app:h}=s.useSisenseContext(),{themeSettings:m}=s.useThemeContext(),y=h==null?void 0:h.pivotClient;if(!y)throw new s.TranslatableError("errors.noPivotClient");const{dataOptionsInternal:b,updateSort:v}=Em({dataOptions:t}),{error:x,jaql:w}=Hm({dataSet:r,dataOptionsInternal:b,filters:n,highlights:o});if(x)throw x;const T=qm({pivotClient:y}),S=p.useHasChanged(w),D=a>0&&p.useHasChanged(a),_=_m({pivotClient:y,pivotBuilder:T,shouldBeRecreated:S||D});Lm({dataService:_,dataOptions:t}),zm({nodeRef:l,pivotBuilder:T,dataOptions:t,styleOptions:i,themeSettings:m,size:u,onTotalHeightChange:f});const{isLoading:E,isNoResults:F}=km({jaql:w,pivotBuilder:T,isForceReload:D}),N=g.useCallback(I=>{const H=Dm(I,b);v({rows:H})},[b,v]);g.useEffect(()=>(T.on(s.uv,N),()=>{T.off(s.uv,N)}),[T,N]);const j=g.useCallback(I=>{(I.width!==(u==null?void 0:u.width)||I.height!==(u==null?void 0:u.height))&&c(I)},[u,c]);return s.jsx(p.DynamicSizeContainer,{defaultSize:p.DEFAULT_PIVOT_TABLE_SIZE,size:{width:i==null?void 0:i.width,height:i!=null&&i.isAutoHeight&&!F&&d!=null?d:i==null?void 0:i.height},onSizeChange:j,children:s.jsx(p.LoadingOverlay,{themeSettings:m,isVisible:E,children:s.jsxs(s.Fragment,{children:[F&&s.jsx(p.NoResultsOverlay,{iconType:"table"}),s.jsx("div",{ref:l,"aria-label":"pivot-table-root"})]})})})}),vs=p.asSisenseComponent({componentName:"PivotTableWidget"})(e=>{var f;const[r,t]=g.useState(0),{app:n}=s.useSisenseContext(),{styleOptions:o,dataSource:a=n==null?void 0:n.defaultDataSource,dataOptions:i}=e,l=p.getWidgetDefaultSize("pivot",{hasHeader:!((f=o==null?void 0:o.header)!=null&&f.hidden)}),h=e.styleOptions||{},{width:u,height:c}=h,d=le(h,["width","height"]);return i?s.jsx(p.DynamicSizeContainer,{defaultSize:l,size:{width:u,height:o!=null&&o.isAutoHeight?void 0:c},children:s.jsx(p.WidgetContainer,k(C({},e),{dataSetName:a&&s.getDataSourceName(a),onRefresh:()=>t(r+1),children:s.jsx(au,{dataSet:e.dataSource,dataOptions:e.dataOptions,styleOptions:d,filters:e.filters,highlights:e.highlights,refreshCounter:r})}))}):null}),Qm=e=>{const r=[],t=n=>{Array.isArray(n)?n.forEach(t):typeof n=="object"&&n!==null&&(n.widgetid&&r.push(n.widgetid),Object.values(n).forEach(t))};return t(e.layout),r},Gm=e=>"levels"in e&&e.isCascading===!0;function Km(e,r){if(!e)return[];return t(e);function t(n){var o,a;if(p.isRelationsRuleIdNode(n))return[{nodeType:"attribute",attribute:((a=(o=p.findFilterByGuid(r,n.instanceid))==null?void 0:o.attribute)==null?void 0:a.name)||n.instanceid}];if(p.isRelationsRule(n))return[{nodeType:"openBracket"},...t(n.left),{nodeType:"operator",operator:n.operator},...t(n.right),{nodeType:"closeBracket"}];throw new p.UnknownRelationsNodeError}}function lo(e=[],r=[],t){switch(t){case"widgetFirst":return p.mergeFiltersOrFilterRelations(r,e);case"codeFirst":return p.mergeFiltersOrFilterRelations(e,r);case"codeOnly":return r;default:return p.mergeFiltersOrFilterRelations(e,r)}}var Xm=function(e){return e.FILTER="filter",e.SELECT="select",e}({});function al(e){return!!e&&e.min!==null&&e.max!==null}var Zm=function(e){return e.PRE="pre",e.POST="post",e}({});function su(e){return"formula"in e}function iu(e){return"formulaRef"in e}const Jm=e=>({columns:(e.columns||[]).map(r=>({widthPercentage:r.width,rows:(r.cells||[]).map(t=>{const n=t.subcells.reduce((o,a)=>o+a.width,0);return{cells:t.subcells.map(o=>({widthPercentage:n<100?o.width/(n/100):o.width,height:o.elements[0].height,widgetId:o.elements[0].widgetid}))}})}))}),eg=e=>s.createFilterFromJaql(e.jaql,e.instanceid,e.disabled,e.locked),tg=e=>{const{levels:r,instanceid:t,disabled:n,locked:o}=e,a=r.map(i=>s.createFilterFromJaql(i,i.instanceid));return new s.CascadingFilter(a,{guid:t,disabled:n,locked:o})};function ng(e,r){const t=e.map(o=>Gm(o)?tg(o):eg(o));if(!r)return t;const n=p.convertFilterRelationsModelToRelationRules(r,t);return!n||p.isTrivialSingleNodeRelations(n)?t:p.combineFiltersAndRelations(t,n)}const rg=e=>e.subtype==="WidgetsTabber";function og(e=[]){const r={};return e.forEach(t=>{var n,o,a,i;r[t.oid]={filtersOptions:{applyMode:((n=t.options)==null?void 0:n.dashboardFiltersMode)==="filter"?p.CommonFiltersApplyMode.FILTER:p.CommonFiltersApplyMode.HIGHLIGHT,shouldAffectFilters:(o=t.options)==null?void 0:o.selector,ignoreFilters:{all:(a=t.metadata.ignore)==null?void 0:a.all,ids:(i=t.metadata.ignore)==null?void 0:i.ids},forceApplyBackgroundFilters:!0}}}),r}function ag(e=[]){const r={};return e.forEach(t=>{rg(t)&&(r[t.oid]={tabs:t.style.tabs,activeTab:parseInt(t.style.activeTab||"1",10)})}),r}function sg(e,r){return Te(this,null,function*(){var o;const t=ig(e.widgets||[]);if(t.length===0)return e;const n=yield r.getSharedFormulas(t);return k(C({},e),{widgets:(o=e.widgets)==null?void 0:o.map(a=>lg(a,n))})})}function ig(e){const r=e.flatMap(t=>t.metadata.panels.flatMap(n=>n.items.flatMap(o=>!su(o.jaql)||!o.jaql.context?[]:Object.values(o.jaql.context).filter(iu).map(i=>i.formulaRef))));return Array.from(new Set(r))}function lg(e,r){const t=e.metadata.panels.map(n=>{const o=n.items.map(a=>{const{jaql:i}=a;if(!su(i)||!i.context)return a;const l=Object.fromEntries(Object.entries(i.context).map(([u,c])=>iu(c)?[u,r[c.formulaRef]]:[u,c]));return k(C({},a),{jaql:k(C({},i),{context:l})})});return k(C({},n),{items:o})});return k(C({},e),{metadata:k(C({},e.metadata),{panels:t})})}function lu(a,i){return Te(this,arguments,function*(e,r,t={},n,o){var y,b;const{includeWidgets:l,includeFilters:u}=t,c=new s.RestApi(e),d=["oid","title","datasource","style"],f=((y=e.auth)==null?void 0:y.type)==="wat";l&&d.push("layout"),u&&(d.push("filters"),d.push("filterRelations"));const h=yield c.getDashboard(r,{fields:d});if(!h)throw new s.TranslatableError("errors.dashboardWithOidNotFound",{dashboardOid:r});if(l){let v;if(f){const x=Qm(h);v=(yield Promise.all(x.map(T=>c.getWidget(T,h.oid)))).filter(T=>T!==void 0)}else v=(yield c.getDashboardWidgets(r))||[];h.widgets=v}if((b=h.style)!=null&&b.paletteId&&!h.style.palette){const v=yield c.getPalettes(),x=v==null?void 0:v.find(({_id:w})=>{var T;return w===((T=h.style)==null?void 0:T.paletteId)});x&&(h.style.palette={name:x.name,colors:x.colors})}const m=yield sg(h,c);return Ps(m,n,o)})}const cu=(e,r)=>{const t={};for(const n of e){const o=r(n);o in t||(t[o]=n)}return Object.values(t)};function uu(t){return Te(this,arguments,function*(e,r={}){const{includeWidgets:n,searchByTitle:o}=r,a=new s.RestApi(e),i=[];let l=["oid","title","datasource"];n&&(l=[],i.push("widgets"));const u=yield a.getDashboards({fields:l,expand:i,searchByTitle:o});if(!u)return[];const c=cu(u,d=>d.oid);return c.length!==u.length&&console.warn("Removing detected duplicate dashboard(s)"),c.map(d=>Ps(d))})}const du=p.withTracking("useGetDashboardModel")(pu);function pu(e){const r=p.useHasChanged(e,["dashboardOid"]),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext(),{themeSettings:l}=s.useThemeContext();return g.useEffect(()=>{if(a||o({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(i)){o({type:"loading"});const{dashboardOid:u,includeWidgets:c,includeFilters:d}=e;lu(i.httpClient,u,{includeWidgets:c,includeFilters:d},l,i.settings).then(f=>{o({type:"success",data:f})}).catch(f=>{o({type:"error",error:f})})}},[i,a,e,t,l]),n.data&&r?Ya(p.dataLoadStateReducer(n,{type:"loading"})):Ya(n)}function Ya(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{dashboard:r})}const cg=p.withTracking("useGetDashboardModels")(ug);function ug(e={}){const r=p.useHasChanged(e,["includeWidgets"]),t=p.useShouldLoad(e,r),[n,o]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:a,app:i}=s.useSisenseContext();return g.useEffect(()=>{a||o({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(i)&&(o({type:"loading"}),uu(i.httpClient,e).then(l=>{o({type:"success",data:l})}).catch(l=>{o({type:"error",error:l})}))},[i,a,e,t]),n.data&&r?$a(p.dataLoadStateReducer(n,{type:"loading"})):$a(n)}function $a(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{dashboards:r})}const fu=o=>Te(exports,[o],function*({widgetOid:e,dashboardOid:r,includeDashboard:t,api:n}){const[a,i]=yield Promise.all([n.getWidget(e,r),t?n.getDashboard(r):void 0]);return{widget:a,dashboard:i}});function hu(e,r,t,n,o){return Te(this,null,function*(){const a=new s.RestApi(e),{widget:i}=yield fu({widgetOid:t,dashboardOid:r,api:a});if(!i)throw new s.TranslatableError("errors.widgetWithOidNotFound",{widgetOid:t});return wr(i,n,o)})}const dg=p.withTracking("useGetWidgetModel")(mu);function mu(e){const r=p.useHasChanged(e,["dashboardOid","widgetOid"]),t=p.useShouldLoad(e,r),{themeSettings:n}=s.useThemeContext(),[o,a]=g.useReducer(p.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:i,app:l}=s.useSisenseContext();return g.useEffect(()=>{if(i||a({type:"error",error:new s.TranslatableError("errors.sisenseContextNotFound")}),t(l)){a({type:"loading"});const{dashboardOid:u,widgetOid:c}=e;hu(l.httpClient,u,c,n,l.settings).then(d=>{a({type:"success",data:d})}).catch(d=>{a({type:"error",error:d})})}},[l,i,e,t,n]),o.data&&r?sl(p.dataLoadStateReducer(o,{type:"loading"})):sl(o)}function sl(e){const n=e,{data:r}=n,t=le(n,["data"]);return k(C({},t),{widget:r})}function pg(e,r,t){var n;return t(e,function(o,a,i){if(r(o,a,i))return n=a,!1}),n}function fg(e,r){return pg(e,s.baseIteratee(r),s.baseForOwn)}function hg(e){return e.percent||e.type==="percent"?"Percent":e.currency?"Currency":"Numbers"}function mg(e){return e.decimals!==void 0&&e.decimals!=="auto"?typeof e.decimals=="string"?Number.parseFloat(e.decimals):e.decimals:"auto"}function gg(e){var n,o,a,i,l,u,c,d,f;const r=e.jaql.datatype==="numeric"||e.jaql.agg==="count"||"context"in e.jaql,t=(n=e.format)==null?void 0:n.mask;return r&&t?{decimalScale:mg(t),kilo:(o=t.abbreviations)==null?void 0:o.k,million:(a=t.abbreviations)==null?void 0:a.m,billion:(i=t.abbreviations)==null?void 0:i.b,trillion:(l=t.abbreviations)==null?void 0:l.t,thousandSeparator:(c=(u=t.number)==null?void 0:u.separated)!=null?c:t.separated,prefix:((d=t.currency)==null?void 0:d.position)===Zm.PRE,symbol:(f=t.currency)==null?void 0:f.symbol,name:hg(t)}:null}const yg=!0;function bg(e,r){if(!r||!yg)return e;const{forecast:t,trend:n}=r;let o=C({},e);return t&&!t.isViewerDisabled&&t.isEnabled&&(o=k(C({},o),{forecast:{confidenceInterval:t.confidence/100,forecastHorizon:t.forecastPeriod,modelType:"auto"}})),n&&!n.isViewerDisabled&&n.isEnabled&&(o=k(C({},o),{trend:{modelType:n.trendType}})),o}const vg=e=>{var r,t,n,o,a,i,l;return e.jaql&&"level"in e.jaql?(a=(t=(r=e.format)==null?void 0:r.mask)==null?void 0:t[e.jaql.level])!=null?a:(o=(n=e.format)==null?void 0:n.mask)==null?void 0:o.dateAndTime:(l=(i=e.format)==null?void 0:i.mask)==null?void 0:l.dateAndTime};function ln(e,r){var d,f,h,m,y,b,v,x;const t=s.createDimensionalElementFromJaql(e.jaql,vg(e),e.panel),n=s.getSortType((d=e.jaql.sort)!=null?d:e.categoriesSorting),o=gg(e),a=(f=e.format)==null?void 0:f.subtotal,i=(h=e.format)==null?void 0:h.width;let l=s.createValueColorOptions((m=e.format)==null?void 0:m.color,r);const u=s.createValueColorOptions((y=e.format)==null?void 0:y.colorSecond,r),c=e.panel==="columns"&&e.panel;if(!l&&!((b=e.format)!=null&&b.color)&&e.format&&"colorIndex"in e.format&&(l=s.createValueColorOptions({type:"color",colorIndex:e.format.colorIndex},r)),s.MetadataTypes.isMeasure(t)){const w=e.y2,T=e.singleSeriesType,S="subtotalAgg"in e.jaql&&e.jaql.subtotalAgg,D=(v=e.format)==null?void 0:v.databars,_=C(C(C(C(C(C(C(C(C(C({column:t},l&&{color:l}),u&&{dataBarsColor:u}),w&&{showOnRightAxis:w}),n&&{sortType:n}),T&&{chartType:T}),o&&{numberFormatConfig:o}),S&&{totalsCalculation:S}),D&&{dataBars:D}),i&&{width:i}),c&&{panel:c});return bg(_,e.statisticalModels)}return C(C(C(C(C(C({column:t,isColored:(x=e.isColored)!=null?x:!1},n&&{sortType:n}),o&&{numberFormatConfig:o}),a&&{includeSubTotals:a}),i&&{width:i}),l&&{color:l}),c&&{panel:c})}function Ct(e){const r=e.column;let t;if(s.MetadataTypes.isAttribute(r))t=r.jaql(!0);else if(s.MetadataTypes.isMeasure(r))t=r.jaql(!0);else throw new s.TranslatableError("errors.unsupportedDimensionalElement");return t.jaql?t:{jaql:t}}const gu=(e,r)=>{const t={};return e.forEach(n=>{n.name!=="filters"&&(t[p.camelCase(n.name)]=be(e,n.name,r))}),t};function Ua(e,r,t){return s.getEnabledPanelItems(e,r).map(s.getRootPanelItem).map(t)}function be(e,r,t){return Ua(e,r,n=>ln(n,t))}function xg(e,r,t){var d,f;const o=["chart/line","chart/area"].includes(r)?"x-axis":"categories",a=be(e,o,t),i=be(e,"values",t),l=be(e,"break by",t),u=(f=(d=s.getEnabledPanelItems(e,"break by")[0])==null?void 0:d.format)==null?void 0:f.members,c=u&&s.createValueToColorMap(u);return C({category:a,value:i,breakBy:l},c&&{seriesToColorMap:c})}function wg(e,r,t){var u,c,d,f;const n=be(r,"categories",t),o=be(r,"values",t),a=be(r,"size",t);let i,l;return e==="sunburst"?l=s.createValueToColorMultiColumnsMap(s.getEnabledPanelItems(r,"categories")):(i=(c=(u=s.getEnabledPanelItems(r,"categories")[0])==null?void 0:u.format)==null?void 0:c.members,s.getEnabledPanelItems(r,"color").length&&(i=(f=(d=s.getEnabledPanelItems(r,"color")[0])==null?void 0:d.format)==null?void 0:f.members),l=i&&s.createValueToColorMap(i)),C({category:n,value:[...o,...a]},l&&{seriesToColorMap:l})}function Cg(e,r){var c,d;const[t]=be(e,"x-axis",r),[n]=be(e,"y-axis",r),[o]=be(e,"point",r),[a]=be(e,"Break By / Color",r),[i]=be(e,"size",r),l=(d=(c=s.getEnabledPanelItems(e,"Break By / Color")[0])==null?void 0:c.format)==null?void 0:d.members,u=l&&s.createValueToColorMap(l);return C({x:t,y:n,breakByPoint:o,breakByColor:a,size:i},u&&{seriesToColorMap:u})}function Tg(e,r){const t=be(e,"value",r),n=be(e,"secondary",r),o=be(e,"min",r),a=be(e,"max",r);return{value:t,secondary:n,min:o,max:a}}function Sg(e,r){return{columns:be(e,"columns",r)}}function Dg(e,r,t){let n;const o={},a=be(e,"columns",t),i=Ua(e,"values",(u,c)=>{var y,b,v,x,w;const{field:d,jaql:f}=u,{sortDetails:h}=f;h&&(n=h),d&&(o[d.index]=c),((b=(y=u.format)==null?void 0:y.color)==null?void 0:b.type)==="color"&&!((x=(v=u.format)==null?void 0:v.color)!=null&&x.color)&&delete u.format.color;const m=ln(u,t);return typeof m.color!="string"&&((w=m.color)==null?void 0:w.type)==="conditional"&&delete m.color.defaultColor,m});return{rows:Ua(e,"rows",(u,c,d)=>{var b;const f=c===d.length-1;let{sortDetails:h}=u==null?void 0:u.jaql;const m=ln(u,t);m.column&&s.MetadataTypes.isAttribute(m.column)&&(m.column=m.column.sort(s.Sort.None)),f&&n&&(h=n);const y=(h==null?void 0:h.field)!==((b=u.field)==null?void 0:b.index);return h&&(m.sortType=C({direction:s.getSortType(h.dir)},y&&{by:{valuesIndex:o[h.field],columnsMembersPath:Object.values(h.measurePath||{})}})),m}),columns:a,values:i,grandTotals:{rows:r.rowsGrandTotal,columns:r.columnsGrandTotal}}}function kg(e){const r={"whisker/iqr":"iqr","whisker/extremums":"extremums","whisker/deviation":"standardDeviation"},t=fg(e.whisker,n=>n);return r[t]}function _g(e,r,t){const n=be(e,"category",t),o=be(e,"value",t),a=kg(r),i=r.outliers.enabled;return{category:n,value:o,boxType:a,outliersEnabled:i}}function Eg(e,r){return s.getEnabledPanelItems(e,"geo").map(s.getRootPanelItem).map(t=>{const n=ln(t,r);return"geoLevel"in t?k(C({},n),{level:t.geoLevel}):n})}function Mg(e,r){const t=Eg(e,r),n=be(e,"size",r)[0],o=be(e,"color",r)[0],a=be(e,"details",r)[0];return{geo:t,size:n,colorBy:o,details:a}}function Pg(e,r){const t=[be(e,"geo",r)[0]],n=be(e,"color",r)[0];return C({geo:t},n&&{color:[n]})}function Va(e,r){const t="dim"in e.jaql?k(C({},e),{jaql:k(C({},e.jaql),{datasource:r})}):e,n=e.parent?Va(e.parent,r):void 0,o=e.through?Va(e.through,r):void 0;return k(C({},t),{parent:n,through:o})}function Og(e,r){return e.map(t=>k(C({},t),{items:t.items.map(n=>Va(n,r))}))}function Ag(e,r,t,n){if(Fg(e))return xg(r,e,n);if(Rg(e))return wg(e,r,n);if(e==="chart/scatter")return Cg(r,n);if(e==="indicator")return Tg(r,n);if(s.isTableWidget(e))return Sg(r,n);if(s.isPivotTableWidget(e))return Dg(r,t,n);if(e==="chart/boxplot")return _g(r,t,n);if(e==="map/scatter")return Mg(r,n);if(e==="map/area")return Pg(r,n);if(e==="richtexteditor")return{};throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetType:e})}function Fg(e){return["chart/line","chart/area","chart/bar","chart/column","chart/polar"].includes(e)}function Rg(e){return["chart/pie","chart/funnel","treemap","sunburst"].includes(e)}function gn(e,r){const t=s.getChartSubtype(e);return C(C({},r),t&&{subtype:t})}function Dt(e){const{min:r,max:t}=e||{};return k(C({},e),{min:typeof r=="number"?r:null,max:typeof t=="number"?t:null})}function Lg(e,r,t){var x,w,T,S,D,_,E,F,N,j;const n={xAxis:Dt(r.xAxis),yAxis:Dt(r.yAxis),y2Axis:Dt(r.y2Axis)},a=["chart/line","chart/area"].includes(e)?"x-axis":"categories",i=s.getEnabledPanelItems(t,a),l=s.getEnabledPanelItems(t,"values"),u=i.length===2;u&&(n.xAxis=k(C({},n.xAxis),{title:(x=n.xAxis)==null?void 0:x.x2Title,x2Title:(w=n.xAxis)==null?void 0:w.title}));const c=!!((T=n.xAxis)!=null&&T.title&&"text"in n.xAxis.title),d=i[i.length-1];!c&&d&&(n.xAxis=k(C({},n.xAxis),{title:k(C({},(S=n.xAxis)==null?void 0:S.title),{text:d.jaql.title})}));const f=!!((D=n.xAxis)!=null&&D.x2Title&&"text"in n.xAxis.x2Title),h=i[0];!f&&u&&(n.xAxis=k(C({},n.xAxis),{x2Title:k(C({},(_=n.xAxis)==null?void 0:_.x2Title),{text:h.jaql.title})}));const m=!!((E=n.yAxis)!=null&&E.title&&"text"in n.yAxis.title),y=l.filter(I=>!I.y2);!m&&y.length===1&&(n.yAxis=k(C({},n.yAxis),{title:k(C({},(F=n.yAxis)==null?void 0:F.title),{text:y[0].jaql.title})}));const b=!!((N=n.y2Axis)!=null&&N.title&&"text"in n.y2Axis.title),v=l.filter(I=>I.y2);return!b&&v.length===1&&(n.y2Axis=k(C({},n.y2Axis),{title:k(C({},(j=n.y2Axis)==null?void 0:j.title),{text:v[0].jaql.title})})),n}function Ng(e,r){var a,i;const t={xAxis:Dt(e.categories),yAxis:Dt(e.axis)},n=s.getEnabledPanelItems(r,"categories")[0];return!!!((a=t.xAxis)!=null&&a.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(i=t.xAxis)==null?void 0:i.title),{text:n.jaql.title})})),t.yAxis=k(C({},t.yAxis),{title:{enabled:!1}}),t}function Ig(e,r){var l,u,c,d;const t={xAxis:Dt(e.xAxis),yAxis:Dt(e.yAxis)},n=s.getEnabledPanelItems(r,"x-axis")[0],o=s.getEnabledPanelItems(r,"y-axis")[0];return!!!((l=t.xAxis)!=null&&l.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(u=t.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((c=t.yAxis)!=null&&c.title&&"text"in t.yAxis.title)&&o&&(t.yAxis=k(C({},t.yAxis),{title:k(C({},(d=t.yAxis)==null?void 0:d.title),{text:o.jaql.title})})),t}function jg(e,r){var l,u,c,d;const t={xAxis:Dt(e.xAxis),yAxis:Dt(e.yAxis)},n=s.getEnabledPanelItems(r,"category")[0],o=s.getEnabledPanelItems(r,"value")[0];return!!!((l=t.xAxis)!=null&&l.title&&"text"in t.xAxis.title)&&n&&(t.xAxis=k(C({},t.xAxis),{title:k(C({},(u=t.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((c=t.yAxis)!=null&&c.title&&"text"in t.yAxis.title)&&o&&(t.yAxis=k(C({},t.yAxis),{title:k(C({},(d=t.yAxis)==null?void 0:d.title),{text:o.jaql.title})})),t}function Wg(e,r){var i,l,u,c,d,f,h,m,y,b,v,x,w,T,S,D,_,E,F,N,j;const t=((i=r.seriesLabels)==null?void 0:i.enabled)&&((c=(u=(l=r.seriesLabels)==null?void 0:l.labels)==null?void 0:u.types)==null?void 0:c.totals),n=e==="area/stacked"||e==="area/stackedspline"||e==="column/stackedcolumn"||e==="bar/stacked",o=e==="area/stacked100"||e==="area/stackedspline100"||e==="column/stackedcolumn100"||e==="bar/stacked100";let a=(f=(d=r.seriesLabels)==null?void 0:d.enabled)!=null?f:!1;return(n||o)&&(a=!!(n&&((y=(m=(h=r.seriesLabels)==null?void 0:h.labels)==null?void 0:m.types)!=null&&y.relative)||o&&((x=(v=(b=r.seriesLabels)==null?void 0:b.labels)==null?void 0:v.types)!=null&&x.count))),k(C({},t&&{totalLabels:{enabled:t,rotation:(T=(w=r.seriesLabels)==null?void 0:w.rotation)!=null?T:0}}),{seriesLabels:{enabled:(D=(S=r.seriesLabels)==null?void 0:S.enabled)!=null?D:!1,rotation:(E=(_=r.seriesLabels)==null?void 0:_.rotation)!=null?E:0,showValue:a,showPercentage:!!(o&&((j=(N=(F=r.seriesLabels)==null?void 0:F.labels)==null?void 0:N.types)!=null&&j.percentage))}})}function Bg(e,r,t,n){return k(C(C(C({},gn(r,t)),Lg(e,t,n)),Wg(r,t)),{lineWidth:t.lineWidth,markers:t.markers})}function Hg(e,r,t){return C(C({},gn(e,r)),Ng(r,t))}function Yg(e,r,t){var n,o,a;return k(C(C({},gn(e,r)),Ig(r,t)),{markerSize:{scatterDefaultSize:(n=r.markerSize)==null?void 0:n.defaultSize,scatterBubbleMinSize:(o=r.markerSize)==null?void 0:o.min,scatterBubbleMaxSize:(a=r.markerSize)==null?void 0:a.max}})}function $g(e){return{header:{color:{enabled:e["colors/headers"]}},rows:{alternatingColor:{enabled:e["colors/rows"]}},columns:{alternatingColor:{enabled:e["colors/columns"]}}}}function Ug(e,r){return k(C({},gn(e,r)),{funnelSize:r.size,funnelType:r.type,funnelDirection:r.direction,labels:r.labels,legend:r.legend})}const Vg=(e,r)=>{const t=s.getChartSubtype(e);return t==="indicator/gauge"?{subtype:t,skin:+r.skin}:r.subtype==="bar"?{subtype:t,numericSubtype:"numericBar"}:{subtype:t,numericSubtype:"numericSimple",skin:r.skin}};function zg(e,r,t){var i,l,u,c,d,f,h,m;const n=Vg(e,r),o=(i=s.getEnabledPanelItems(t,"value")[0])==null?void 0:i.jaql.title,a=(l=s.getEnabledPanelItems(t,"secondary")[0])==null?void 0:l.jaql.title;return k(C({},n),{indicatorComponents:{title:{shouldBeShown:((c=(u=r.components)==null?void 0:u.title)==null?void 0:c.enabled)||!1,text:o},secondaryTitle:{text:a||""},ticks:{shouldBeShown:((f=(d=r.components)==null?void 0:d.ticks)==null?void 0:f.enabled)||!1},labels:{shouldBeShown:((m=(h=r.components)==null?void 0:h.labels)==null?void 0:m.enabled)||!1}}})}function qg(e){var r,t,n,o;return{labels:{category:[{enabled:(r=e["title/1"])!=null?r:!0},{enabled:(t=e["title/2"])!=null?t:!0},{enabled:(n=e["title/3"])!=null?n:!0}]},tooltip:{mode:(o=e["tooltip/value"])==null||o?"value":"contribution"}}}function Qg(e){var r;return{legend:{enabled:e["legend/enabled"],position:e["legend/position"]},tooltip:{mode:(r=e["tooltip/value"])==null||r?"value":"contribution"}}}function Gg(e,r,t){return C(C({},gn(e,r)),jg(r,t))}function Kg(e,r){return k(C({},gn(e,r)),{markers:{fill:r.markers.fill,size:{defaultSize:r.markers.size.defaultSize,minSize:r.markers.size.min,maxSize:r.markers.size.max}}})}function Xg(e){let r;switch(e){case"areamap/world":r="world";break;case"areamap/usa":r="usa";break;default:throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetSubtype:e})}return{mapType:r}}function Zg(e){var r,t,n,o,a;return{rowsPerPage:parseInt(`${e.pageSize}`),isAutoHeight:e.automaticHeight,rowHeight:e.rowHeight,alternatingRowsColor:(r=e.colors)==null?void 0:r.rows,alternatingColumnsColor:(t=e.colors)==null?void 0:t.columns,headersColor:(n=e.colors)==null?void 0:n.headers,membersColor:(o=e.colors)==null?void 0:o.members,totalsColor:(a=e.colors)==null?void 0:a.totals}}function Jg(e,r){var a,i,l;const{subtype:t,style:n,metadata:{panels:o}}=r;switch(e){case"chart/line":case"chart/area":case"chart/bar":case"chart/column":{const u=Bg(e,t,n,o);if(u.navigator){const c=(a=r.options)==null?void 0:a.previousScrollerLocation;u.navigator.scrollerLocation=al(c)?c:void 0}return u}case"chart/polar":return Hg(t,n,o);case"chart/scatter":return Yg(t,n,o);case"chart/funnel":return Ug(t,n);case"treemap":return qg(n);case"sunburst":return Qg(n);case"chart/pie":return gn(t,n);case"tablewidget":case"tablewidgetagg":return $g(n);case"pivot":case"pivot2":return Zg(n);case"indicator":return zg(t,n,o);case"chart/boxplot":{const u=Gg(t,n,o);return u.navigator&&(u.navigator.scrollerLocation=al((i=r.options)==null?void 0:i.previousScrollerLocation)?(l=r.options)==null?void 0:l.previousScrollerLocation:void 0),u}case"map/scatter":return Kg(t,n);case"map/area":return Xg(t);case"richtexteditor":return n.content;default:throw new s.TranslatableError("errors.unsupportedWidgetType",{widgetType:e})}}const yu=e=>({backgroundColor:e.widgetBackgroundColor,spaceAround:p.LEGACY_DESIGN_TYPES[e.widgetSpacing],cornerRadius:p.LEGACY_DESIGN_TYPES[e.widgetCornerRadius],shadow:p.LEGACY_DESIGN_TYPES[e.widgetShadow],border:e.widgetBorderEnabled,borderColor:e.widgetBorderColor,header:{titleTextColor:e.widgetTitleColor,titleAlignment:p.LEGACY_DESIGN_TYPES[e.widgetTitleAlignment],dividerLine:e.widgetTitleDividerEnabled,dividerLineColor:e.widgetTitleDividerColor,backgroundColor:e.widgetTitleBackgroundColor}});function ey(e,r,t){if(!r||!t)return e;const n=yu(r);return C(C({},e),n)}function ty(e,r){return e&&e.length?p.baseUniq(e,s.baseIteratee(r)):[]}function ny(e,r){var n;const t=(n=e==null?void 0:e.findIndex(o=>o===r))!=null?n:-1;return t===-1?[]:e.slice(t)}const bu=e=>e!=null&&e.parent?[...bu(e.parent),ln(e).column]:[],vu=e=>{var r,t,n;if(e!=null&&e.parent&&e.through&&"filter"in e.through.jaql){const o=ln(e).column,{jaql:a,format:{mask:i}={}}=e.parent,l="level"in a&&a.level&&i&&i[a.level],u=(n=(t=(r=e.through.jaql.filter)==null?void 0:r.members)==null?void 0:t.map(l?c=>({categoryValue:c,categoryDisplayValue:s.applyDateFormat(s.parseISO(c),l)}):c=>({categoryValue:c})))!=null?n:[];return[...vu(e.parent),{nextDimension:o,points:u}]}return[]};function ry(e){switch(e){case"chart/line":case"chart/area":return["x-axis"];case"chart/boxplot":return["category"];case"chart/scatter":return["x-axis","y-axis","point","Break By / Color"];default:return["categories"]}}const oy=(e,r)=>{const t=ry(e).map(o=>s.getEnabledPanelItems(r,o)).flat().filter(o=>{const a="agg"in o.jaql&&o.jaql.agg,i="formula"in o.jaql&&o.jaql.formula;return!a&&!i});return t.length===1?t[0]:void 0},xu="calendar",wu="calendar - weeks",ay=[s.DateLevels.Years,s.DateLevels.Quarters,s.DateLevels.Months,s.DateLevels.Days],sy=[s.DateLevels.Years,s.DateLevels.Weeks,s.DateLevels.Days],iy=[s.DateLevels.Years,s.DateLevels.Quarters,s.DateLevels.Months,s.DateLevels.Weeks,s.DateLevels.Days],ly=e=>e.length===2?iy:e[0]===xu?ay:e[0]===wu?sy:[],cy=(e,r)=>{const[t=[],n]=p.partition(e,a=>[xu,wu].includes(a)),o=ny(ly(t),r.granularity);return o.length?[{title:"Calendar Hierarchy",levels:o.map(l=>new s.DimensionalLevelAttribute(`${l} in ${r.name}`,r.expression,l,s.DimensionalLevelAttribute.getDefaultFormatForGranularity(l)))},...n]:n},uy=e=>{const r=e&&ln(e),t=(e==null?void 0:e.hierarchies)||[];return r&&s.isDatetime(r.column.type)?(r.column.name=(e==null?void 0:e.jaql).column,cy(t,r.column)):t},dy=(e,r,t=[],n)=>{const o=oy(e,r),a=o&&s.getRootPanelItem(o),i=vu(o),l=uy(a);return{drilldownPaths:[...ty([...o?bu(o):[]],({expression:c})=>c),...l],drilldownSelections:i}};function xs(e){const i=e.filter,{filter:r}=i,t=le(i,["filter"]),n=r&&"turnedOff"in r&&r.turnedOff;let o,a;return n?a=r:o=r,t.members&&t.members.length===0&&(t.all=!0),{filter:t,backgroundFilter:o,turnOffMembersFilter:a}}function py(e){const{filter:r,backgroundFilter:t,turnOffMembersFilter:n}=xs(e.jaql),o=[k(C({},e),{jaql:k(C({},e.jaql),{filter:C(C({},r),n&&{filter:n})})})];return t&&o.push(k(C({},e),{jaql:k(C({},e.jaql),{filter:t}),disabled:!1})),o}function fy(e){const r=e.find(n=>n.name==="filters"),t=[];return r==null||r.items.forEach(n=>{t.push(...py(n).filter(({disabled:o})=>!o))}),t}function Cu(e){return fy(e).map(r=>s.createFilterFromJaql(r.jaql,r.instanceid))}function ws(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toExecuteQueryParams");let r,t,n,o;if(s.isTableWidget(e.widgetType)){const{attributes:a,measures:i}=p.getTableAttributesAndMeasures(p.translateTableDataOptions(e.dataOptions));r=a,t=i,n=p.DEFAULT_TABLE_ROWS_PER_PAGE*p.PAGES_BATCH_SIZE+1,o=!0}else{const{attributes:a,measures:i}=p.getTranslatedDataOptions(e.dataOptions,e.chartType);r=a,t=i}return{dataSource:e.dataSource,dimensions:r,measures:t,filters:e.filters,highlights:e.highlights,count:n,ungroup:o}}function Cs(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toExecutePivotQueryParams"});const{rows:r,columns:t,values:n,grandTotals:o}=ou(p.translatePivotTableDataOptions(e.dataOptions));return{dataSource:e.dataSource,rows:r,columns:t,values:n,grandTotals:o,filters:e.filters,highlights:e.highlights}}function Tu(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toChartProps");if(s.isTextWidget(e.widgetType))throw new Au("toChartProps");return s.isTableWidget(e.widgetType)?C({chartType:e.chartType},Ts(e)):{chartType:e.chartType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters,highlights:e.highlights}}function Ts(e){if(!s.isTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters}}function Su(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSet:e.dataSource,filters:e.filters,highlights:e.highlights}}function Ss(e){if(s.isPivotTableWidget(e.widgetType))throw new Es("toChartWidgetProps");if(s.isTextWidget(e.widgetType))throw new Au("toChartWidgetProps");return{chartType:e.chartType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||"",drilldownOptions:e.drilldownOptions}}function Du(e){if(!s.isTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableWidgetProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,title:e.title,description:e.description||""}}function Ds(e){if(!s.isPivotTableWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableWidgetProps"});return{dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||""}}function ks(e){if(!s.isTextWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyTextWidgetSupported",{methodName:"toTextWidgetProps"});return{styleOptions:e.styleOptions}}function ku(e){if(!s.isPluginWidget(e.widgetType))throw new s.TranslatableError("errors.widgetModel.onlyPluginWidgetSupported",{methodName:"toPluginWidgetProps"});return{pluginType:e.pluginType,dataOptions:e.dataOptions,styleOptions:e.styleOptions,dataSource:e.dataSource,filters:e.filters,highlights:e.highlights,title:e.title,description:e.description||""}}function _u(e){const{widgetType:r}=e;return s.isPivotTableWidget(r)?C({widgetType:"pivot"},Ds(e)):s.isTextWidget(r)?C({widgetType:"text"},ks(e)):s.isPluginWidget(r)?C({widgetType:"plugin"},ku(e)):C({widgetType:"chart"},Ss(e))}function _s(e){const{oid:r}=e;return k(C({},_u(e)),{id:r})}const Tt=()=>{throw new s.TranslatableError("errors.methodNotImplemented")},Eu={oid:"",title:"",dataSource:"",description:"",widgetType:"plugin",pluginType:"",dataOptions:{},styleOptions:{},drilldownOptions:{},filters:[],highlights:[],chartType:void 0,getExecuteQueryParams:Tt,getExecutePivotQueryParams:Tt,getChartProps:Tt,getTableProps:Tt,getPivotTableProps:Tt,getPivotTableWidgetProps:Tt,getChartWidgetProps:Tt,getTableWidgetProps:Tt,getTextWidgetProps:Tt};function Mu(e){return k(C({},e),{getExecuteQueryParams:()=>ws(e),getExecutePivotQueryParams:()=>Cs(e),getChartProps:()=>Tu(e),getTableProps:()=>Ts(e),getPivotTableProps:()=>Su(e),getChartWidgetProps:()=>Ss(e),getTableWidgetProps:()=>Du(e),getPivotTableWidgetProps:()=>Ds(e),getTextWidgetProps:()=>ks(e)})}function wr(e,r,t){var h,y,b,v;let n,o,a,i;const l=Og(e.metadata.panels,e.datasource);if(n=e.type,s.isSupportedWidgetType(n)){a=Ag(n,l,e.style,r==null?void 0:r.palette.variantColors),i=Jg(n,e);const x=(v=(b=(y=t==null?void 0:t.serverFeatures)==null?void 0:y.widgetDesignStyle)==null?void 0:b.active)!=null?v:!0;i=ey(i,e.style.widgetDesign,x)}else{o=n,n="plugin",a=gu(l,(h=r==null?void 0:r.palette.variantColors)!=null?h:[]);const m=e.style,{widgetDesign:x}=m,w=le(m,["widgetDesign"]);i=C(C({},w),x?yu(x):{})}const u=dy(n,l),c=Cu(l),d=s.isChartWidget(n)?s.getChartType(n):void 0,f=k(C({},Eu),{oid:e.oid,title:e.title,dataSource:s.convertDataSource(e.datasource),description:e.desc||"",widgetType:n,chartType:d,pluginType:o||"",dataOptions:a||{},styleOptions:i||{},drilldownOptions:u,filters:c});return Mu(f)}function Pu(e){const r=s.getWidgetTypeFromChartType(e.chartType),t=k(C(C({},Eu),e),{filters:e.filters||[],widgetType:r});return Mu(t)}function hy(e){if(s.isChartWidgetProps(e))return Pu(e);throw new s.TranslatableError("errors.otherWidgetTypesNotSupported")}function Ou(e,r){const t=r||e.dataSource;if(typeof t=="string")throw new il("dataSource");if(!t.id||!t.live&&!t.address)throw new il("dataSource");const n=e.chartType;let o=e.widgetType,a={},i=e.styleOptions.subtype||"";if(!n)throw new Error("Chart type is required");const l=[];if(s.isCartesian(n)){const d=["chart/line","chart/area"].includes(e.widgetType)?"x-axis":"categories",f=e.dataOptions.category.map(b=>Ct(s.normalizeColumn(b))),h={name:d,items:f};l.push(h);const m=e.dataOptions.value.map(b=>Ct(s.normalizeMeasureColumn(b)));l.push({name:"values",items:m});const y=e.dataOptions.breakBy.map(b=>Ct(s.normalizeColumn(b)));l.push({name:"break by",items:y}),n==="polar"?i="column/polar":n==="bar"?i=i||"bar/classic":n==="column"?i=i||"column/classic":n==="area"?i=i||"area/basic":n==="line"&&(i=i||"line/basic")}else if(s.isTable(n)){const{attributes:d,measures:f}=p.getTableAttributesAndMeasures(e.dataOptions),h=[...d.map(m=>Ct(s.normalizeColumn(m))),...f.map(m=>Ct(s.normalizeMeasureColumn(m)))];l.push({name:"columns",items:h}),o="tablewidget"}else if(s.isIndicator(n))["value","min","max","secondary"].forEach(d=>{const f=(e.dataOptions[d]||[]).map(h=>Ct(s.normalizeMeasureColumn(h)));l.push({name:d,items:f})}),i=i||"indicator/numeric",a=k(C({},i==="indicator/gauge"?{subtype:"round",skin:"1"}:{subtype:"simple",skin:"vertical"}),{components:{ticks:{inactive:!1,enabled:!0},labels:{inactive:!1,enabled:!0},title:{inactive:!1,enabled:!0},secondaryTitle:{inactive:!0,enabled:!0}}});else if(s.isCategorical(n)){const d=e.dataOptions.category.map(m=>Ct(s.normalizeAnyColumn(m)));l.push({name:"categories",items:d});const f=e.dataOptions.value.map(m=>Ct(s.normalizeAnyColumn(m))),h=n==="treemap";l.push({name:h?"size":"values",items:f}),h&&["color","values"].forEach(y=>{l.push({name:y,items:[]})}),n==="pie"?(i=i||"pie/basic",a={convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",minimalIndependentSlicePercentage:3,independentSlicesCount:7}}):n==="treemap"||n==="sunburst"?i=i||n:n==="funnel"&&(i=i||"chart/funnel")}else if(s.isScatter(n))["x","y","size","breakByColor","breakByPoint"].forEach(d=>{if(e.dataOptions[d]){const f={breakByColor:"Break By / Color",breakByPoint:"point",x:"x-axis",y:"y-axis"},h=[Ct(s.normalizeAnyColumn(e.dataOptions[d]))];l.push({name:f[d]||d,items:h})}}),i=i||"bubble/scatter";else throw new my(n);const u=(e.filters||[]).map(d=>d.jaql());return l.push({name:"filters",items:u}),{oid:e.oid||"",title:e.title,desc:e.description,datasource:t,type:o,metadata:{panels:l},style:a,subtype:i}}class il extends s.TranslatableError{constructor(r){super("errors.widgetModel.incomleteWidget",{prop:r})}}class my extends s.TranslatableError{constructor(r){super("errors.widgetModel.unsupportedWidgetTypeDto",{chartType:r})}}class Es extends s.TranslatableError{constructor(r){super("errors.widgetModel.pivotWidgetNotSupported",{methodName:r})}}class Au extends s.TranslatableError{constructor(r){super("errors.widgetModel.textWidgetNotSupported",{methodName:r})}}const gy=Object.freeze(Object.defineProperty({__proto__:null,fromChartWidgetProps:Pu,fromWidgetDto:wr,fromWidgetProps:hy,toChartProps:Tu,toChartWidgetProps:Ss,toCommonWidgetProps:_u,toExecutePivotQueryParams:Cs,toExecuteQueryParams:ws,toPivotTableProps:Su,toPivotTableWidgetProps:Ds,toPluginWidgetProps:ku,toTableProps:Ts,toTableWidgetProps:Du,toTextWidgetProps:ks,toWidgetDto:Ou,toWidgetProps:_s},Symbol.toStringTag,{value:"Module"}));function Ms(e){const{title:r,dataSource:t,widgets:n,layoutOptions:o,filters:a,widgetsOptions:i,tabbersOptions:l,styleOptions:u}=e;return{title:r,defaultDataSource:t,widgets:n.map(_s),layoutOptions:o,config:{},filters:a,widgetsOptions:i,styleOptions:u,tabbersOptions:l}}function Ps(e,r,t){var D;const{oid:n,title:o,datasource:a,widgets:i,layout:l,filters:u,filterRelations:c,style:d}=e,f={title:a.title,type:a.live?"live":"elasticube"},h=C({},d!=null&&d.palette?{palette:{variantColors:d==null?void 0:d.palette.colors}}:null),m=r&&C(C({},r),h.palette?{palette:h.palette}:null),y=(i==null?void 0:i.map(_=>wr(_,m,t)))||[],b=l?Jm(l):{columns:[]},v=(D=c==null?void 0:c[0])==null?void 0:D.filterRelations,x=ng(u||[],v),w=og(i),T=ag(i);return{oid:n,title:o,dataSource:f,styleOptions:h,widgets:y,layoutOptions:{widgetsPanel:b},filters:x,widgetsOptions:w,tabbersOptions:T}}const yy=Object.freeze(Object.defineProperty({__proto__:null,fromDashboardDto:Ps,toDashboardProps:Ms},Symbol.toStringTag,{value:"Module"}));function by(e){return s.isCascadingFilter(e)?vy(e):Os(e)}function Os(e){return s.isMembersFilter(e)?xy(e):s.isRankingFilter(e)?wy(e):As(e)}function vy(e){return{isCascading:!0,instanceid:e.config.guid,disabled:e.config.disabled,levels:e.filters.map(r=>{const t=Os(r);return k(C({},t.jaql),{instanceid:t.instanceid})})}}function As(e){const{config:{disabled:r}}=e,t=Object.assign(Object.create(e),{config:k(C({},e.config),{disabled:!1})}).jaql(!0);return{jaql:k(C({},t),{table:s.getTableNameFromAttribute(e.attribute),column:s.getColumnNameFromAttribute(e.attribute)}),disabled:r,instanceid:e.config.guid,isCascading:!1}}function xy(e){const r=As(e);return r.jaql.filter.multiSelection=e.config.enableMultiSelection,e.config.deactivatedMembers.length>0&&(e.config.excludeMembers?r.jaql.filter.exclude.members=[...e.members,...e.config.deactivatedMembers]:r.jaql.filter.members=[...e.members,...e.config.deactivatedMembers]),e.config.backgroundFilter&&za(r.jaql,Os(e.config.backgroundFilter).jaql.filter),e.config.deactivatedMembers.length>0&&za(r.jaql,{exclude:{members:e.config.deactivatedMembers},turnedOff:!0}),r}function wy(e){const r=As(e);if(e.measure instanceof s.DimensionalBaseMeasure){const t=r.jaql.filter;t.by.table=s.getTableNameFromAttribute(e.measure.attribute),t.by.column=s.getColumnNameFromAttribute(e.measure.attribute),t.rankingMessage=e.measure.name}return r}function za(e,r){if(e.filter)return za(e.filter,r);e.filter=r}var Cy=function(e){return e.DASHBOARD_INIT="DASHBOARD.INIT",e.DASHBOARD_UPDATE_LAYOUT="DASHBOARD.UPDATE_LAYOUT",e}({}),Fu=function(e){return e.FILTERS_UPDATE="FILTERS.UPDATE",e.ADD_WIDGET="WIDGETS.ADD",e}({});function Ty(e,r){var t,n;switch(r.type){case"DASHBOARD.INIT":return C(C({},e),r.payload);case"FILTERS.UPDATE":return k(C({},e),{filters:r.payload});case"WIDGETS.ADD":{const o=[...e.widgets,r.payload],a=[...((n=(t=e==null?void 0:e.layoutOptions)==null?void 0:t.widgetsPanel)==null?void 0:n.columns)||[]];return a[0]&&(a[0].rows.length||a[0].rows.push({cells:[]}),a[0].rows[0].cells.push({widgetId:r.payload.oid,widthPercentage:100})),k(C(C({},e),e!=null&&e.layoutOptions.widgetsPanel?{layoutOptions:k(C({},e==null?void 0:e.layoutOptions),{widgetsPanel:k(C({},e==null?void 0:e.layoutOptions.widgetsPanel),{columns:a})})}:null),{widgets:o})}default:return e}}function Sy(e,r,t){return Te(this,null,function*(){if(!e)throw new Error("Dashboard model is not initialized");if(r.type==="FILTERS.UPDATE"){const{filters:n,relations:o}=p.splitFiltersAndRelations(r.payload),a=n.map(by),i=p.filterRelationRulesToFilterRelationsModel(o,n),l=Dy(n);yield t.patchDashboard(e,{filters:a,filterRelations:i?[{datasource:l,filterRelations:i}]:void 0})}else if(r.type==="WIDGETS.ADD"){const n=yield t.addWidgetToDashboard(e,Ou(r.payload));if(!n)throw new Error("Failed to add widget to dashboard");return{type:"WIDGETS.ADD",payload:wr(n)}}return r})}function Dy(e){const r=new Set(e.map(t=>{var n;return(n=t.dataSource)==null?void 0:n.title}));if(r.size>1)throw new Error("Persisting filters from multiple datasources is not supported now");return r.values().next().value}function ky(e){return e.type===Rp.FILTERS_UPDATE?{type:Fu.FILTERS_UPDATE,payload:e.payload}:null}function _y(e,r){return e==="wat"?(r&&console.warn('WAT authentication does not support persistence. The changes will not be saved. Set "persist" flag to false to avoid this warning.'),!1):!0}const Ru=p.withTracking("useDashboardModel")(Ey);function Ey({dashboardOid:e,includeWidgets:r,includeFilters:t,persist:n=!0}){const{restApi:o,isReady:a}=s.useRestApi(),{app:i}=s.useSisenseContext(),l=g.useMemo(()=>!!(i!=null&&i.httpClient.auth)&&_y(i.httpClient.auth.type,n),[i==null?void 0:i.httpClient.auth,n]),u=n&&l,[c,d]=g.useReducer(Ty,null),f=g.useCallback(v=>Te(this,null,function*(){if(!a||!o)throw new s.RestApiNotReadyError;return u&&(v=yield Sy(c==null?void 0:c.oid,v,o)),d(v)}),[u,c==null?void 0:c.oid,o,a,d]),{dashboard:h,isLoading:m,isError:y,error:b}=du({dashboardOid:e,includeWidgets:r,includeFilters:t});return g.useEffect(()=>{h&&d({type:Cy.DASHBOARD_INIT,payload:h})},[h,d]),{dashboard:c,isLoading:m,isError:y,error:b,dispatchChanges:f}}/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */const{entries:Lu,setPrototypeOf:ll,isFrozen:My,getPrototypeOf:Py,getOwnPropertyDescriptor:Oy}=Object;let{freeze:Ve,seal:rt,create:Nu}=Object,{apply:qa,construct:Qa}=typeof Reflect!="undefined"&&Reflect;Ve||(Ve=function(r){return r});rt||(rt=function(r){return r});qa||(qa=function(r,t,n){return r.apply(t,n)});Qa||(Qa=function(r,t){return new r(...t)});const Wr=Ze(Array.prototype.forEach),cl=Ze(Array.prototype.pop),Qn=Ze(Array.prototype.push),Kr=Ze(String.prototype.toLowerCase),Da=Ze(String.prototype.toString),ul=Ze(String.prototype.match),Gn=Ze(String.prototype.replace),Ay=Ze(String.prototype.indexOf),Fy=Ze(String.prototype.trim),ot=Ze(Object.prototype.hasOwnProperty),He=Ze(RegExp.prototype.test),Kn=Ry(TypeError);function Ze(e){return function(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return qa(e,r,n)}}function Ry(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return Qa(e,t)}}function te(e,r){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Kr;ll&&ll(e,null);let n=r.length;for(;n--;){let o=r[n];if(typeof o=="string"){const a=t(o);a!==o&&(My(r)||(r[n]=a),o=a)}e[o]=!0}return e}function Ly(e){for(let r=0;r<e.length;r++)ot(e,r)||(e[r]=null);return e}function Jt(e){const r=Nu(null);for(const[t,n]of Lu(e))ot(e,t)&&(Array.isArray(n)?r[t]=Ly(n):n&&typeof n=="object"&&n.constructor===Object?r[t]=Jt(n):r[t]=n);return r}function Xn(e,r){for(;e!==null;){const n=Oy(e,r);if(n){if(n.get)return Ze(n.get);if(typeof n.value=="function")return Ze(n.value)}e=Py(e)}function t(){return null}return t}const dl=Ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ka=Ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),_a=Ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ny=Ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ea=Ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Iy=Ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pl=Ve(["#text"]),fl=Ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ma=Ve(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),hl=Ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Br=Ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jy=rt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Wy=rt(/<%[\w\W]*|[\w\W]*%>/gm),By=rt(/\${[\w\W]*}/gm),Hy=rt(/^data-[\-\w.\u00B7-\uFFFF]/),Yy=rt(/^aria-[\-\w]+$/),Iu=rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$y=rt(/^(?:\w+script|data):/i),Uy=rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ju=rt(/^html$/i),Vy=rt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ml=Object.freeze({__proto__:null,MUSTACHE_EXPR:jy,ERB_EXPR:Wy,TMPLIT_EXPR:By,DATA_ATTR:Hy,ARIA_ATTR:Yy,IS_ALLOWED_URI:Iu,IS_SCRIPT_OR_DATA:$y,ATTR_WHITESPACE:Uy,DOCTYPE_NAME:ju,CUSTOM_ELEMENT:Vy});const Zn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},zy=function(){return typeof window=="undefined"?null:window},qy=function(r,t){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const a="dompurify"+(n?"#"+n:"");try{return r.createPolicy(a,{createHTML(i){return i},createScriptURL(i){return i}})}catch(i){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function Wu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zy();const r=K=>Wu(K);if(r.version="3.1.6",r.removed=[],!e||!e.document||e.document.nodeType!==Zn.document)return r.isSupported=!1,r;let{document:t}=e;const n=t,o=n.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:m}=e,y=u.prototype,b=Xn(y,"cloneNode"),v=Xn(y,"remove"),x=Xn(y,"nextSibling"),w=Xn(y,"childNodes"),T=Xn(y,"parentNode");if(typeof i=="function"){const K=t.createElement("template");K.content&&K.content.ownerDocument&&(t=K.content.ownerDocument)}let S,D="";const{implementation:_,createNodeIterator:E,createDocumentFragment:F,getElementsByTagName:N}=t,{importNode:j}=n;let I={};r.isSupported=typeof Lu=="function"&&typeof T=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:B,TMPLIT_EXPR:R,DATA_ATTR:O,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:W}=ml;let{IS_ALLOWED_URI:z}=ml,Q=null;const ie=te({},[...dl,...ka,..._a,...Ea,...pl]);let Z=null;const xe=te({},[...fl,...Ma,...hl,...Br]);let J=Object.seal(Nu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,fe=null,he=!0,Pe=!0,Ce=!1,ze=!0,tt=!1,Rt=!0,Xt=!1,la=!1,ca=!1,xn=!1,Or=!1,Ar=!1,Di=!0,ki=!1;const Gp="user-content-";let ua=!0,Vn=!1,wn={},Cn=null;const _i=te({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ei=null;const Mi=te({},["audio","video","img","source","image","track"]);let da=null;const Pi=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fr="http://www.w3.org/1998/Math/MathML",Rr="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let Tn=xt,pa=!1,fa=null;const Kp=te({},[Fr,Rr,xt],Da);let zn=null;const Xp=["application/xhtml+xml","text/html"],Zp="text/html";let Ee=null,Sn=null;const Jp=t.createElement("form"),Oi=function(M){return M instanceof RegExp||M instanceof Function},ha=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sn&&Sn===M)){if((!M||typeof M!="object")&&(M={}),M=Jt(M),zn=Xp.indexOf(M.PARSER_MEDIA_TYPE)===-1?Zp:M.PARSER_MEDIA_TYPE,Ee=zn==="application/xhtml+xml"?Da:Kr,Q=ot(M,"ALLOWED_TAGS")?te({},M.ALLOWED_TAGS,Ee):ie,Z=ot(M,"ALLOWED_ATTR")?te({},M.ALLOWED_ATTR,Ee):xe,fa=ot(M,"ALLOWED_NAMESPACES")?te({},M.ALLOWED_NAMESPACES,Da):Kp,da=ot(M,"ADD_URI_SAFE_ATTR")?te(Jt(Pi),M.ADD_URI_SAFE_ATTR,Ee):Pi,Ei=ot(M,"ADD_DATA_URI_TAGS")?te(Jt(Mi),M.ADD_DATA_URI_TAGS,Ee):Mi,Cn=ot(M,"FORBID_CONTENTS")?te({},M.FORBID_CONTENTS,Ee):_i,X=ot(M,"FORBID_TAGS")?te({},M.FORBID_TAGS,Ee):{},fe=ot(M,"FORBID_ATTR")?te({},M.FORBID_ATTR,Ee):{},wn=ot(M,"USE_PROFILES")?M.USE_PROFILES:!1,he=M.ALLOW_ARIA_ATTR!==!1,Pe=M.ALLOW_DATA_ATTR!==!1,Ce=M.ALLOW_UNKNOWN_PROTOCOLS||!1,ze=M.ALLOW_SELF_CLOSE_IN_ATTR!==!1,tt=M.SAFE_FOR_TEMPLATES||!1,Rt=M.SAFE_FOR_XML!==!1,Xt=M.WHOLE_DOCUMENT||!1,xn=M.RETURN_DOM||!1,Or=M.RETURN_DOM_FRAGMENT||!1,Ar=M.RETURN_TRUSTED_TYPE||!1,ca=M.FORCE_BODY||!1,Di=M.SANITIZE_DOM!==!1,ki=M.SANITIZE_NAMED_PROPS||!1,ua=M.KEEP_CONTENT!==!1,Vn=M.IN_PLACE||!1,z=M.ALLOWED_URI_REGEXP||Iu,Tn=M.NAMESPACE||xt,J=M.CUSTOM_ELEMENT_HANDLING||{},M.CUSTOM_ELEMENT_HANDLING&&Oi(M.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=M.CUSTOM_ELEMENT_HANDLING.tagNameCheck),M.CUSTOM_ELEMENT_HANDLING&&Oi(M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=M.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),M.CUSTOM_ELEMENT_HANDLING&&typeof M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=M.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),tt&&(Pe=!1),Or&&(xn=!0),wn&&(Q=te({},pl),Z=[],wn.html===!0&&(te(Q,dl),te(Z,fl)),wn.svg===!0&&(te(Q,ka),te(Z,Ma),te(Z,Br)),wn.svgFilters===!0&&(te(Q,_a),te(Z,Ma),te(Z,Br)),wn.mathMl===!0&&(te(Q,Ea),te(Z,hl),te(Z,Br))),M.ADD_TAGS&&(Q===ie&&(Q=Jt(Q)),te(Q,M.ADD_TAGS,Ee)),M.ADD_ATTR&&(Z===xe&&(Z=Jt(Z)),te(Z,M.ADD_ATTR,Ee)),M.ADD_URI_SAFE_ATTR&&te(da,M.ADD_URI_SAFE_ATTR,Ee),M.FORBID_CONTENTS&&(Cn===_i&&(Cn=Jt(Cn)),te(Cn,M.FORBID_CONTENTS,Ee)),ua&&(Q["#text"]=!0),Xt&&te(Q,["html","head","body"]),Q.table&&(te(Q,["tbody"]),delete X.tbody),M.TRUSTED_TYPES_POLICY){if(typeof M.TRUSTED_TYPES_POLICY.createHTML!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof M.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Kn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=M.TRUSTED_TYPES_POLICY,D=S.createHTML("")}else S===void 0&&(S=qy(m,o)),S!==null&&typeof D=="string"&&(D=S.createHTML(""));Ve&&Ve(M),Sn=M}},Ai=te({},["mi","mo","mn","ms","mtext"]),Fi=te({},["foreignobject","annotation-xml"]),ef=te({},["title","style","font","a","script"]),Ri=te({},[...ka,..._a,...Ny]),Li=te({},[...Ea,...Iy]),tf=function(M){let $=T(M);(!$||!$.tagName)&&($={namespaceURI:Tn,tagName:"template"});const G=Kr(M.tagName),me=Kr($.tagName);return fa[M.namespaceURI]?M.namespaceURI===Rr?$.namespaceURI===xt?G==="svg":$.namespaceURI===Fr?G==="svg"&&(me==="annotation-xml"||Ai[me]):!!Ri[G]:M.namespaceURI===Fr?$.namespaceURI===xt?G==="math":$.namespaceURI===Rr?G==="math"&&Fi[me]:!!Li[G]:M.namespaceURI===xt?$.namespaceURI===Rr&&!Fi[me]||$.namespaceURI===Fr&&!Ai[me]?!1:!Li[G]&&(ef[G]||!Ri[G]):!!(zn==="application/xhtml+xml"&&fa[M.namespaceURI]):!1},it=function(M){Qn(r.removed,{element:M});try{T(M).removeChild(M)}catch($){v(M)}},Lr=function(M,$){try{Qn(r.removed,{attribute:$.getAttributeNode(M),from:$})}catch(G){Qn(r.removed,{attribute:null,from:$})}if($.removeAttribute(M),M==="is"&&!Z[M])if(xn||Or)try{it($)}catch(G){}else try{$.setAttribute(M,"")}catch(G){}},Ni=function(M){let $=null,G=null;if(ca)M="<remove></remove>"+M;else{const Oe=ul(M,/^[\r\n\t ]+/);G=Oe&&Oe[0]}zn==="application/xhtml+xml"&&Tn===xt&&(M='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+M+"</body></html>");const me=S?S.createHTML(M):M;if(Tn===xt)try{$=new h().parseFromString(me,zn)}catch(Oe){}if(!$||!$.documentElement){$=_.createDocument(Tn,"template",null);try{$.documentElement.innerHTML=pa?D:me}catch(Oe){}}const Re=$.body||$.documentElement;return M&&G&&Re.insertBefore(t.createTextNode(G),Re.childNodes[0]||null),Tn===xt?N.call($,Xt?"html":"body")[0]:Xt?$.documentElement:Re},Ii=function(M){return E.call(M.ownerDocument||M,M,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ji=function(M){return M instanceof f&&(typeof M.nodeName!="string"||typeof M.textContent!="string"||typeof M.removeChild!="function"||!(M.attributes instanceof d)||typeof M.removeAttribute!="function"||typeof M.setAttribute!="function"||typeof M.namespaceURI!="string"||typeof M.insertBefore!="function"||typeof M.hasChildNodes!="function")},Wi=function(M){return typeof l=="function"&&M instanceof l},wt=function(M,$,G){I[M]&&Wr(I[M],me=>{me.call(r,$,G,Sn)})},Bi=function(M){let $=null;if(wt("beforeSanitizeElements",M,null),ji(M))return it(M),!0;const G=Ee(M.nodeName);if(wt("uponSanitizeElement",M,{tagName:G,allowedTags:Q}),M.hasChildNodes()&&!Wi(M.firstElementChild)&&He(/<[/\w]/g,M.innerHTML)&&He(/<[/\w]/g,M.textContent)||M.nodeType===Zn.progressingInstruction||Rt&&M.nodeType===Zn.comment&&He(/<[/\w]/g,M.data))return it(M),!0;if(!Q[G]||X[G]){if(!X[G]&&Yi(G)&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,G)||J.tagNameCheck instanceof Function&&J.tagNameCheck(G)))return!1;if(ua&&!Cn[G]){const me=T(M)||M.parentNode,Re=w(M)||M.childNodes;if(Re&&me){const Oe=Re.length;for(let qe=Oe-1;qe>=0;--qe){const lt=b(Re[qe],!0);lt.__removalCount=(M.__removalCount||0)+1,me.insertBefore(lt,x(M))}}}return it(M),!0}return M instanceof u&&!tf(M)||(G==="noscript"||G==="noembed"||G==="noframes")&&He(/<\/no(script|embed|frames)/i,M.innerHTML)?(it(M),!0):(tt&&M.nodeType===Zn.text&&($=M.textContent,Wr([H,B,R],me=>{$=Gn($,me," ")}),M.textContent!==$&&(Qn(r.removed,{element:M.cloneNode()}),M.textContent=$)),wt("afterSanitizeElements",M,null),!1)},Hi=function(M,$,G){if(Di&&($==="id"||$==="name")&&(G in t||G in Jp))return!1;if(!(Pe&&!fe[$]&&He(O,$))){if(!(he&&He(A,$))){if(!Z[$]||fe[$]){if(!(Yi(M)&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,M)||J.tagNameCheck instanceof Function&&J.tagNameCheck(M))&&(J.attributeNameCheck instanceof RegExp&&He(J.attributeNameCheck,$)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck($))||$==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&He(J.tagNameCheck,G)||J.tagNameCheck instanceof Function&&J.tagNameCheck(G))))return!1}else if(!da[$]){if(!He(z,Gn(G,L,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&M!=="script"&&Ay(G,"data:")===0&&Ei[M])){if(!(Ce&&!He(P,Gn(G,L,"")))){if(G)return!1}}}}}}return!0},Yi=function(M){return M!=="annotation-xml"&&ul(M,W)},$i=function(M){wt("beforeSanitizeAttributes",M,null);const{attributes:$}=M;if(!$)return;const G={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z};let me=$.length;for(;me--;){const Re=$[me],{name:Oe,namespaceURI:qe,value:lt}=Re,qn=Ee(Oe);let Be=Oe==="value"?lt:Fy(lt);if(G.attrName=qn,G.attrValue=Be,G.keepAttr=!0,G.forceKeepAttr=void 0,wt("uponSanitizeAttribute",M,G),Be=G.attrValue,Rt&&He(/((--!?|])>)|<\/(style|title)/i,Be)){Lr(Oe,M);continue}if(G.forceKeepAttr||(Lr(Oe,M),!G.keepAttr))continue;if(!ze&&He(/\/>/i,Be)){Lr(Oe,M);continue}tt&&Wr([H,B,R],Vi=>{Be=Gn(Be,Vi," ")});const Ui=Ee(M.nodeName);if(Hi(Ui,qn,Be)){if(ki&&(qn==="id"||qn==="name")&&(Lr(Oe,M),Be=Gp+Be),S&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!qe)switch(m.getAttributeType(Ui,qn)){case"TrustedHTML":{Be=S.createHTML(Be);break}case"TrustedScriptURL":{Be=S.createScriptURL(Be);break}}try{qe?M.setAttributeNS(qe,Oe,Be):M.setAttribute(Oe,Be),ji(M)?it(M):cl(r.removed)}catch(Vi){}}}wt("afterSanitizeAttributes",M,null)},nf=function K(M){let $=null;const G=Ii(M);for(wt("beforeSanitizeShadowDOM",M,null);$=G.nextNode();)wt("uponSanitizeShadowNode",$,null),!Bi($)&&($.content instanceof a&&K($.content),$i($));wt("afterSanitizeShadowDOM",M,null)};return r.sanitize=function(K){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,G=null,me=null,Re=null;if(pa=!K,pa&&(K="<!-->"),typeof K!="string"&&!Wi(K))if(typeof K.toString=="function"){if(K=K.toString(),typeof K!="string")throw Kn("dirty is not a string, aborting")}else throw Kn("toString is not a function");if(!r.isSupported)return K;if(la||ha(M),r.removed=[],typeof K=="string"&&(Vn=!1),Vn){if(K.nodeName){const lt=Ee(K.nodeName);if(!Q[lt]||X[lt])throw Kn("root node is forbidden and cannot be sanitized in-place")}}else if(K instanceof l)$=Ni("<!---->"),G=$.ownerDocument.importNode(K,!0),G.nodeType===Zn.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?$=G:$.appendChild(G);else{if(!xn&&!tt&&!Xt&&K.indexOf("<")===-1)return S&&Ar?S.createHTML(K):K;if($=Ni(K),!$)return xn?null:Ar?D:""}$&&ca&&it($.firstChild);const Oe=Ii(Vn?K:$);for(;me=Oe.nextNode();)Bi(me)||(me.content instanceof a&&nf(me.content),$i(me));if(Vn)return K;if(xn){if(Or)for(Re=F.call($.ownerDocument);$.firstChild;)Re.appendChild($.firstChild);else Re=$;return(Z.shadowroot||Z.shadowrootmode)&&(Re=j.call(n,Re,!0)),Re}let qe=Xt?$.outerHTML:$.innerHTML;return Xt&&Q["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&He(ju,$.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
8
8
  `+qe),tt&&Wr([H,B,R],lt=>{qe=Gn(qe,lt," ")}),S&&Ar?S.createHTML(qe):qe},r.setConfig=function(){let K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ha(K),la=!0},r.clearConfig=function(){Sn=null,la=!1},r.isValidAttribute=function(K,M,$){Sn||ha({});const G=Ee(K),me=Ee(M);return Hi(G,me,$)},r.addHook=function(K,M){typeof M=="function"&&(I[K]=I[K]||[],Qn(I[K],M))},r.removeHook=function(K){if(I[K])return cl(I[K])},r.removeHooks=function(K){I[K]&&(I[K]=[])},r.removeAllHooks=function(){I={}},r}var Qy=Wu();function Gy(e){return e!==null&&typeof e=="object"&&typeof e.styleOptions=="object"&&typeof e.styleOptions.html=="string"&&typeof e.styleOptions.bgColor=="string"&&typeof e.styleOptions.vAlign=="string"}const Ky={"valign-top":"flex-start","valign-middle":"center","valign-bottom":"flex-end"},Xy=s.newStyled("div",{target:"eryn7kb0",label:"TextWidgetSpaceAroundWrapper"})("padding:",e=>p.WidgetSpaceAround[s.get(e.styleOptions,"spaceAround",e.themeSettings.widget.spaceAround)]||"0px",";"),Zy=s.newStyled("div",{target:"eryn7kb1",label:"TextWidgetContainer"})("background-color:",e=>e.styleOptions.bgColor,";display:flex;align-items:",e=>Ky[e.styleOptions.vAlign],";text-align:center;height:100%;width:100%;padding:10px;box-sizing:border-box;"),Jy=s.newStyled("div",{target:"eryn7kb2",label:"InnerHtml"})("width:100%;"),Fs=p.asSisenseComponent({componentName:"TextWidget"})(e=>{const r=Qy.sanitize(e.styleOptions.html),{themeSettings:t}=s.useThemeContext();return s.jsx(Xy,{themeSettings:t,styleOptions:e.styleOptions,children:s.jsx(Zy,{styleOptions:e.styleOptions,children:s.jsx(Jy,{dangerouslySetInnerHTML:{__html:r}})})})}),eb=new Map,Rs=g.createContext({plugins:eb,registerPlugin:()=>{},getPlugin:()=>{}}),tb=({children:e})=>{const r=g.useRef(new Map),t=g.useCallback((a,i)=>{r.current.has(a)||r.current.set(a,i)},[]),n=g.useCallback(a=>r.current.get(a),[]),o=g.useMemo(()=>r.current,[]);return s.jsx(Rs.Provider,{value:{registerPlugin:t,getPlugin:n,plugins:o},children:e})},Ls=()=>g.useContext(Rs),nb=e=>{var l;const{t:r}=s.useTranslation(),{plugins:t}=Ls(),{app:n}=s.useSisenseContext(),o=t.get(e.pluginType);if(!o)return s.jsx(p.ErrorBoundaryBox,{error:r("plugins.registerPrompt",{pluginType:e.pluginType})});const a=(l=e.dataSource)!=null?l:n==null?void 0:n.defaultDataSource,i=k(C({},e),{dataSource:a,dataOptions:e.dataOptions,styleOptions:e.styleOptions,filters:e.filters,highlights:e.highlights,description:e.description});return s.jsx(p.DynamicSizeContainer,{defaultSize:p.getWidgetDefaultSize("line",{hasHeader:!0}),children:s.jsx(p.WidgetContainer,{title:e.title,description:e.description,styleOptions:e.styleOptions,dataSetName:a&&s.getDataSourceName(a),children:o(i)})})},rb=e=>s.jsxs(p.MenuProvider,{onBeforeMenuOpen:e.onBeforeMenuOpen,children:[s.isPluginWidgetProps(e)&&s.jsx(nb,C({},e)),s.isPivotTableWidgetProps(e)&&s.jsx(vs,C({},e)),s.isTextWidgetProps(e)&&s.jsx(Fs,C({},e)),s.isChartWidgetProps(e)&&s.jsx(p.ChartWidget,k(C({},e),{highlightSelectionDisabled:!0}))]}),Bu=e=>s.jsx(rb,C({},e),e.id),Yt="600px",Yo="900px",ob=s.newStyled("div",{target:"ey54pln0",label:"GridContainer"})("display:grid;padding:",({padding:e})=>e,";grid-template-columns:",({widths:e})=>e.map(r=>`${r}%`).join(" "),";@container content-panel-container (max-width:",Yt,"){grid-template-columns:repeat(1,1fr);}@container content-panel-container ((min-width:",Yt,") and (max-width:",Yo,")){grid-template-columns:",({widths:e})=>e.length>1?"repeat(2, 1fr)":"repeat(1, 1fr)",";}"),ab=s.newStyled("div",{target:"ey54pln1",label:"Column"})("container-name:content-panel-column;container-type:",({responsive:e})=>e?"inline-size":"unset",";&:not(:first-of-type){border-left:",({dividerWidth:e,dividerColor:r})=>rn(r,e),";}@container content-panel-container ((min-width:",Yt,") and (max-width:",Yo,")){&:last-of-type{grid-column-end:",({colWidths:e})=>e.length%2===0?"span 1":"span 2",";}}@container content-panel-container (max-width:",Yt,"){&:not(:first-of-type){border-left:none;}}"),sb=s.newStyled("div",{target:"ey54pln2",label:"Row"})("display:grid;grid-template-columns:",({widths:e})=>e.map(r=>`${r}%`).join(" "),";@container content-panel-column (max-width:",Yt,"){grid-template-columns:repeat(1,1fr);}@container content-panel-column ((min-width:",Yt,") and (max-width:",Yo,")){grid-template-columns:",({widths:e})=>e.length===1?"repeat(1, 1fr)":"repeat(2, 1fr)",";}"),ib=s.newStyled("div",{target:"ey54pln3",label:"Subcell"})("border-bottom:",({dividerWidth:e,dividerColor:r})=>rn(r,e),";&:not(:first-of-type){border-left:",({dividerWidth:e,dividerColor:r})=>rn(r,e),";}height:",({height:e})=>s.isUndefined(e)?"auto":Number.isInteger(e)?`calc(${e}px + 32px)`:`calc(${e} + 32px)`,";@container ((min-width:",Yt,") and (max-width:",Yo,")){&:last-of-type{grid-column-end:",({rowWidths:e})=>e.length%2===0?"span 1":"span 2",";}}@container (max-width:",Yt,"){&:not(:first-of-type){border-left:none;}}"),lb=({layout:e,responsive:r,widgets:t})=>{const{themeSettings:n}=s.useThemeContext(),o=g.useMemo(()=>e!=null?e:eu(t),[e,t]),a=p.WidgetSpaceAround[n.widget.spaceAround]||"0px";g.useEffect(()=>{window.dispatchEvent(new Event("resize"))},[r]);const i=o.columns.map(l=>l.widthPercentage);return s.jsx(ob,{padding:a,widths:i,children:o.columns.map((l,u)=>{var c;return s.jsx(ab,{colWidths:i,responsive:r,dividerWidth:n.dashboard.dividerLineWidth,dividerColor:n.dashboard.dividerLineColor,children:(c=l.rows)==null?void 0:c.map((d,f)=>{const h=d.cells.map(m=>m.widthPercentage);return s.jsx(sb,{widths:h,children:d.cells.map(m=>{var b;const y=t.find(v=>v.id===m.widgetId);return(y==null?void 0:y.widgetType)==="pivot"&&m.height&&((b=y==null?void 0:y.styleOptions)!=null&&b.isAutoHeight)&&(y.styleOptions.isAutoHeight=!1),s.jsx(ib,{responsive:r,rowWidths:h,height:m.height,dividerWidth:n.dashboard.dividerLineWidth,dividerColor:n.dashboard.dividerLineColor,children:y&&s.jsx(Bu,C({},y))},`${m.widgetId},${m.widthPercentage}`)})},`${u},${f}`)})},u)})})},Xr="#d5d5d5",Zr=1,Hu={filtersPanel:{visible:!0,collapsedInitially:!1,persistCollapsedStateToLocalStorage:!1,actions:{addFilter:{enabled:!1,multiSelect:{visible:!0}},editFilter:{enabled:!1,multiSelect:{visible:!0}},deleteFilter:{enabled:!1}}},toolbar:{visible:!0},widgetsPanel:{responsive:!1}},gl=k(C({},Hu),{persist:!1}),Yu=48,cb=s.newStyled("div",{target:"e14fvu5w0",label:"DashboardHeaderContainer"})("height:",Yu,"px;font-family:",({font:e})=>e,";background-color:",({background:e})=>e,";color:",({color:e})=>e,";border-bottom:",rn(Xr,Zr),";padding:10px 20px;display:flex;align-items:center;box-sizing:border-box;"),ub=s.newStyled("div",{target:"e14fvu5w1",label:"DashboardHeaderTitle"})("font-size:13px;font-weight:700;"),db=({title:e})=>{const{themeSettings:r}=s.useThemeContext();return s.jsx(cb,{font:r.typography.fontFamily,color:r.typography.primaryTextColor,background:r.general.backgroundColor,children:s.jsx(ub,{children:e})})},$u=g.forwardRef((e,r)=>s.jsx("button",k(C({},e),{ref:r,className:"csdk-rounded disabled:csdk-cursor-not-allowed csdk-leading-[18px] csdk-text-[13px] csdk-py-[5px] csdk-px-[8px] csdk-text-text-content disabled:csdk-opacity-30 "+(e.className||""),children:e.children}))),pb=e=>{const i=e,{tooltipTitle:r,disableTooltip:t,children:n,disabled:o}=i,a=le(i,["tooltipTitle","disableTooltip","children","disabled"]);return s.jsx(p.Tooltip,{title:r,disableHoverListener:t,children:s.jsx("span",{children:s.jsx($u,k(C({disabled:o,style:o?k(C({},a.style||{}),{pointerEvents:"none"}):a.style},a),{children:n}))})})},$o=e=>{const d=e,{wrapperClassName:r,label:t,isLabelInactive:n,indeterminate:o,className:a,labelProps:i}=d,l=le(d,["wrapperClassName","label","isLabelInactive","indeterminate","className","labelProps"]),u=["csdk-border-l","csdk-pl-3"],c=g.useRef(null);return g.useEffect(()=>{c.current&&(c.current.indeterminate=o!=null?o:!1)},[c,o]),n&&u.push("csdk-opacity-50"),s.jsxs("label",k(C({},i),{className:p.classNames("csdk-my-[2px] csdk-flex csdk-items-center csdk-leading-4 csdk-text-[13px]",r,{"csdk-cursor-pointer":!e.disabled},a,i==null?void 0:i.className),children:[s.jsx("input",k(C({},l),{ref:c,type:"checkbox",className:p.classNames("csdk-accent-UI-default csdk-h-checkbox csdk-w-checkbox csdk-m-checkbox",{"csdk-cursor-pointer":!e.disabled})})),t&&s.jsx("span",{className:u.join(" "),children:t})]}))},fb=s.newStyled("input",{target:"e1y9klst0",label:"StyledBasicInput"})("box-sizing:border-box;height:100%;border-width:1px;border-style:solid;background-color:transparent;font-size:13px;color:inherit;padding:0 8px;border-radius:0;transition:border-color 250ms;border-color:#e6e6e6;width:100%;height:24px;box-sizing:border-box;&:disabled{cursor:not-allowed;}&:invalid{border-color:#fb7570;}&::placeholder{color:inherit;opacity:0.75;}&:focus{outline:none;border-color:inherit;}&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"),hb=s.newStyled("div",{target:"e1y9klst1",label:"ArrowsContainer"})("border:1px solid #e6e6e6;border-left:none;display:flex;flex-direction:column;width:14px;height:24px;box-sizing:border-box;"),yl=s.newStyled("button",{target:"e1y9klst2",label:"ButtonWithIcon"})("height:12px;width:14px;position:relative;overflow:hidden;padding:0;margin:0;border:none;background-color:transparent;cursor:pointer;svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);margin-left:-0.5px;}"),ur=e=>{var v;const b=e,{callback:r,className:t,type:n="text",value:o,disabled:a,containerStyle:i,labelStyle:l,inputStyle:u}=b,c=le(b,["callback","className","type","value","disabled","containerStyle","labelStyle","inputStyle"]),[d,f]=g.useState((v=o==null?void 0:o.toString())!=null?v:""),h=g.createRef(),{themeSettings:m}=s.useThemeContext(),y=g.useCallback((x,w)=>{const T=w==="increment"?parseFloat(x)+1:parseFloat(x)-1;s.isNumber(T)&&(r(T.toString()),f(T.toString()))},[r,f]);return s.jsxs("div",{className:"csdk-flex csdk-items-center csdk-gap-x-2",style:i,children:[e.label&&s.jsx("label",{style:l,className:"csdk-min-w-fit",htmlFor:e.id,children:e.label}),s.jsxs("div",{className:"csdk-h-full csdk-w-[100%] csdk-flex csdk-justify-end",children:[s.jsx(fb,k(C({},c),{type:n,style:u,ref:h,className:["csdk-border-UI-default",t].join(" "),value:d,onChange:x=>{r(x.target.value),f(x.target.value)},disabled:a})),n==="number"&&s.jsxs(hb,{children:[s.jsx(yl,{onClick:()=>y(d,"increment"),children:s.jsx("svg",{className:"csdk-mt-[2px]",width:24,height:24,viewBox:"0 0 24 24",children:s.jsx("path",{fill:m.typography.primaryTextColor,d:"M12 10.16l-3.174 2.719a.5.5 0 0 1-.65-.76l3.5-2.998a.5.5 0 0 1 .65 0l3.5 2.998a.5.5 0 1 1-.65.76L12 10.159z"})})}),s.jsx(yl,{onClick:()=>y(d,"decrement"),children:s.jsx("svg",{className:"csdk-mt-[-2px]",width:24,height:24,viewBox:"0 0 24 24",children:s.jsx("path",{fill:m.typography.primaryTextColor,d:"M12 13.84l3.174-2.719a.5.5 0 0 1 .65.76l-3.5 2.998a.5.5 0 0 1-.65 0l-3.5-2.998a.5.5 0 1 1 .65-.76L12 13.841z"})})})]})]})]})},Uu=e=>s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 15C7.23858 15 5 12.7614 5 10C5 7.23858 7.23858 5 10 5C12.7614 5 15 7.23858 15 10C15 11.2006 14.5768 12.3024 13.8715 13.1644L18.8536 18.1464C19.0488 18.3417 19.0488 18.6583 18.8536 18.8536C18.6583 19.0488 18.3417 19.0488 18.1464 18.8536L13.1644 13.8715C12.3024 14.5768 11.2006 15 10 15ZM10 14C12.2091 14 14 12.2091 14 10C14 7.79086 12.2091 6 10 6C7.79086 6 6 7.79086 6 10C6 12.2091 7.79086 14 10 14Z",fill:"#262E3D",fillOpacity:"0.67"})})),mb=e=>s.jsxs("label",{children:[s.jsx("input",k(C({},e),{className:"csdk-accent-UI-default csdk-text-UI-default csdk-w-radio csdk-h-radio csdk-m-radio "+e.className,type:"radio"})),e.label]}),gb=s.newStyled("div",{target:"e15tkvqq0",label:"StyledDiv"})({"::-webkit-scrollbar":{width:"8px",height:"8px"},"::-webkit-scrollbar-track":{backgroundColor:"transparent"},"::-webkit-scrollbar-thumb":{backgroundColor:"#c2c2c2",borderRadius:"4px",border:"1px solid transparent",backgroundClip:"content-box",minHeight:"20px",minWidth:"20px"},"::-webkit-scrollbar-thumb:hover":{backgroundColor:"#7d7d7d",border:"none"}}),yb=a=>{var i=a,{items:e,currentSelection:r,title:t,className:n}=i,o=le(i,["items","currentSelection","title","className"]);return s.jsxs(gb,{className:n,children:[s.jsx("div",{className:"csdk-ml-1.5",children:t}),e.map((l,u)=>s.jsx(mb,C({value:l,label:l,checked:l===r},o),u))]})},Vu=Y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Vu.displayName="FormControlContext");function bb(){return Y.useContext(Vu)}function vb(e){return p.generateUtilityClass("PrivateSwitchBase",e)}p.generateUtilityClasses("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const xb=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],wb=e=>{const{classes:r,checked:t,disabled:n,edge:o}=e,a={root:["root",t&&"checked",n&&"disabled",o&&`edge${p.capitalize$1(o)}`],input:["input"]};return p.composeClasses(a,vb,r)},Cb=p.styled$1(p.ButtonBase)(({ownerState:e})=>s._extends({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),Tb=p.styled$1("input",{shouldForwardProp:p.rootShouldForwardProp})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),Ns=Y.forwardRef(function(r,t){const{autoFocus:n,checked:o,checkedIcon:a,className:i,defaultChecked:l,disabled:u,disableFocusRipple:c=!1,edge:d=!1,icon:f,id:h,inputProps:m,inputRef:y,name:b,onBlur:v,onChange:x,onFocus:w,readOnly:T,required:S=!1,tabIndex:D,type:_,value:E}=r,F=p._objectWithoutPropertiesLoose(r,xb),[N,j]=p.useControlled({controlled:o,default:!!l,name:"SwitchBase",state:"checked"}),I=bb(),H=W=>{w&&w(W),I&&I.onFocus&&I.onFocus(W)},B=W=>{v&&v(W),I&&I.onBlur&&I.onBlur(W)},R=W=>{if(W.nativeEvent.defaultPrevented)return;const z=W.target.checked;j(z),x&&x(W,z)};let O=u;I&&typeof O=="undefined"&&(O=I.disabled);const A=_==="checkbox"||_==="radio",P=s._extends({},r,{checked:N,disabled:O,disableFocusRipple:c,edge:d}),L=wb(P);return se.jsxs(Cb,s._extends({component:"span",className:p.clsx(L.root,i),centerRipple:!0,focusRipple:!c,disabled:O,tabIndex:null,role:void 0,onFocus:H,onBlur:B,ownerState:P,ref:t},F,{children:[se.jsx(Tb,s._extends({autoFocus:n,checked:o,defaultChecked:l,className:L.input,disabled:O,id:A?h:void 0,name:b,onChange:R,readOnly:T,ref:y,required:S,ownerState:P,tabIndex:D,type:_},_==="checkbox"&&E===void 0?{}:{value:E},m)),N?a:f]}))});process.env.NODE_ENV!=="production"&&(Ns.propTypes={autoFocus:p.PropTypes.bool,checked:p.PropTypes.bool,checkedIcon:p.PropTypes.node.isRequired,classes:p.PropTypes.object,className:p.PropTypes.string,defaultChecked:p.PropTypes.bool,disabled:p.PropTypes.bool,disableFocusRipple:p.PropTypes.bool,edge:p.PropTypes.oneOf(["end","start",!1]),icon:p.PropTypes.node.isRequired,id:p.PropTypes.string,inputProps:p.PropTypes.object,inputRef:p.refType,name:p.PropTypes.string,onBlur:p.PropTypes.func,onChange:p.PropTypes.func,onFocus:p.PropTypes.func,readOnly:p.PropTypes.bool,required:p.PropTypes.bool,sx:p.PropTypes.object,tabIndex:p.PropTypes.oneOfType([p.PropTypes.number,p.PropTypes.string]),type:p.PropTypes.string.isRequired,value:p.PropTypes.any});function Sb(e){return p.generateUtilityClass("MuiSwitch",e)}const Ye=p.generateUtilityClasses("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),Db=["className","color","edge","size","sx"],kb=e=>{const{classes:r,edge:t,size:n,color:o,checked:a,disabled:i}=e,l={root:["root",t&&`edge${p.capitalize$1(t)}`,`size${p.capitalize$1(n)}`],switchBase:["switchBase",`color${p.capitalize$1(o)}`,a&&"checked",i&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},u=p.composeClasses(l,Sb,r);return s._extends({},r,u)},_b=p.styled$1("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.root,t.edge&&r[`edge${p.capitalize$1(t.edge)}`],r[`size${p.capitalize$1(t.size)}`]]}})({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${Ye.thumb}`]:{width:16,height:16},[`& .${Ye.switchBase}`]:{padding:4,[`&.${Ye.checked}`]:{transform:"translateX(16px)"}}}}]}),Eb=p.styled$1(Ns,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.switchBase,{[`& .${Ye.input}`]:r.input},t.color!=="default"&&r[`color${p.capitalize$1(t.color)}`]]}})(({theme:e})=>({position:"absolute",top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${e.palette.mode==="light"?e.palette.common.white:e.palette.grey[300]}`,transition:e.transitions.create(["left","transform"],{duration:e.transitions.duration.shortest}),[`&.${Ye.checked}`]:{transform:"translateX(20px)"},[`&.${Ye.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${e.palette.mode==="light"?e.palette.grey[100]:e.palette.grey[600]}`},[`&.${Ye.checked} + .${Ye.track}`]:{opacity:.5},[`&.${Ye.disabled} + .${Ye.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode==="light"?.12:.2}`},[`& .${Ye.input}`]:{left:"-100%",width:"300%"}}),({theme:e})=>({"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:p.alpha_1(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(e.palette).filter(([,r])=>r.main&&r.light).map(([r])=>({props:{color:r},style:{[`&.${Ye.checked}`]:{color:(e.vars||e).palette[r].main,"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[r].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:p.alpha_1(e.palette[r].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Ye.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${r}DisabledColor`]:`${e.palette.mode==="light"?p.lighten_1(e.palette[r].main,.62):p.darken_1(e.palette[r].main,.55)}`}},[`&.${Ye.checked} + .${Ye.track}`]:{backgroundColor:(e.vars||e).palette[r].main}}}))]})),Mb=p.styled$1("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(e,r)=>r.track})(({theme:e})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:e.transitions.create(["opacity","background-color"],{duration:e.transitions.duration.shortest}),backgroundColor:e.vars?e.vars.palette.common.onBackground:`${e.palette.mode==="light"?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:`${e.palette.mode==="light"?.38:.3}`})),Pb=p.styled$1("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(e,r)=>r.thumb})(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),zu=Y.forwardRef(function(r,t){const n=p.useDefaultProps({props:r,name:"MuiSwitch"}),{className:o,color:a="primary",edge:i=!1,size:l="medium",sx:u}=n,c=p._objectWithoutPropertiesLoose(n,Db),d=s._extends({},n,{color:a,edge:i,size:l}),f=kb(d),h=se.jsx(Pb,{className:f.thumb,ownerState:d});return se.jsxs(_b,{className:p.clsx(f.root,o),sx:u,ownerState:d,children:[se.jsx(Eb,s._extends({type:"checkbox",icon:h,checkedIcon:h,ref:t,ownerState:d},c,{classes:s._extends({},f,{root:f.switchBase})})),se.jsx(Mb,{className:f.track,ownerState:d})]})});process.env.NODE_ENV!=="production"&&(zu.propTypes={checked:p.PropTypes.bool,checkedIcon:p.PropTypes.node,classes:p.PropTypes.object,className:p.PropTypes.string,color:p.PropTypes.oneOfType([p.PropTypes.oneOf(["default","primary","secondary","error","info","success","warning"]),p.PropTypes.string]),defaultChecked:p.PropTypes.bool,disabled:p.PropTypes.bool,disableRipple:p.PropTypes.bool,edge:p.PropTypes.oneOf(["end","start",!1]),icon:p.PropTypes.node,id:p.PropTypes.string,inputProps:p.PropTypes.object,inputRef:p.refType,onChange:p.PropTypes.func,required:p.PropTypes.bool,size:p.PropTypes.oneOfType([p.PropTypes.oneOf(["medium","small"]),p.PropTypes.string]),sx:p.PropTypes.oneOfType([p.PropTypes.arrayOf(p.PropTypes.oneOfType([p.PropTypes.func,p.PropTypes.object,p.PropTypes.bool])),p.PropTypes.func,p.PropTypes.object]),value:p.PropTypes.any});const qu=s.newStyled(zu,{target:"e151xo3r0",label:"SisenseSwitchButton"})(({theme:e})=>{var r;return{height:"23px",width:"33px","& .MuiSwitch-switchBase":{transform:"translateX(1px)",top:"2px",transition:"all .3s ease","&.Mui-checked":{color:"#fff",transform:"translateX(13px)","& + .MuiSwitch-track":{opacity:1,backgroundColor:(r=e.general.brandColor)!=null?r:"#FFC805"},"&:hover":{background:"transparent"}},"&:hover":{background:"transparent"}},"&:hover":{"& .MuiSwitch-thumb":{transform:"scale(1.2)"}},"& .MuiSwitch-thumb":{backgroundColor:"#fff",width:11,height:11,border:"1px solid #c4c8cd",boxShadow:"none",transition:"all .3s ease",boxSizing:"border-box"},"& .MuiSwitch-track":{opacity:1,height:"9px",width:"19px",backgroundColor:"#6e737d",borderRadius:9},"&:focus-visible, & .Mui-focusVisible":{outline:"-webkit-focus-ring-color auto 1px"}}}),Qu=()=>{const{themeSettings:e}=s.useThemeContext(),{backgroundColor:r}=e.general,t=s.getSlightlyDifferentColor(r,s.TRIANGLE_COLOR_ADJUSTMENT);return s.jsx("div",{className:"csdk-flex csdk-justify-center","data-testid":"triangle-indicator",children:s.jsx("div",{style:{borderTopColor:t},className:"csdk-border-l-[70px] csdk-border-l-[transparent] csdk-border-r-[70px] csdk-border-r-[transparent] csdk-border-t-[13px]"})})},Ob=e=>{const n=e,{color:r=s.DEFAULT_TEXT_COLOR}=n,t=le(n,["color"]);return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 18.808L20 8.80798L15.0995 4L5 13.808V18.7949L10 18.808ZM6 14.2308L12.8609 7.56797L16.3433 11.0504L9.58687 17.8069L6 17.7975V14.2308ZM15.0959 5.39742L13.5783 6.87121L17.0504 10.3433L18.579 8.81475L15.0959 5.39742ZM13.499 10.4355L9.64164 14.2398L8.93945 13.5278L12.7968 9.72353L13.499 10.4355Z",fill:r})}))},Ab=e=>s.jsxs("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[s.jsx("path",{d:"M10 10.5V15.5C10 15.7761 10.2239 16 10.5 16C10.7761 16 11 15.7761 11 15.5V10.5C11 10.2239 10.7761 10 10.5 10C10.2239 10 10 10.2239 10 10.5Z",fill:e.fill||s.DEFAULT_TEXT_COLOR}),s.jsx("path",{d:"M13 15.5V10.5C13 10.2239 13.2239 10 13.5 10C13.7761 10 14 10.2239 14 10.5V15.5C14 15.7761 13.7761 16 13.5 16C13.2239 16 13 15.7761 13 15.5Z",fill:e.fill||s.DEFAULT_TEXT_COLOR}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 5H11C9.89543 5 9 5.89543 9 7H6.5C6.22386 7 6 7.22386 6 7.5C6 7.77614 6.22386 8 6.5 8H7V16.5C7 17.8807 8.11929 19 9.5 19H14.5C15.8807 19 17 17.8807 17 16.5V8H17.5C17.7761 8 18 7.77614 18 7.5C18 7.22386 17.7761 7 17.5 7H15C15 5.89543 14.1046 5 13 5ZM8 8V16.5C8 17.3284 8.67157 18 9.5 18H14.5C15.3284 18 16 17.3284 16 16.5V8H8ZM14 7H10C10 6.44772 10.4477 6 11 6H13C13.5523 6 14 6.44772 14 7Z",fill:e.fill||s.DEFAULT_TEXT_COLOR})]})),Fb=e=>s.jsx("svg",k(C({width:"22",height:"22",viewBox:"0 0 22 22",fill:"#b4b4b4",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsxs("g",{transform:"translate(5.000000,5.000000) scale(.70, 0.6)",children:[s.jsx("path",{d:"m3,9v11h14V9M4,9V6c0-3.3 2.7-6 6-6c3.3,0 6,2.7 6,6v3H14V6c0-2.2-1.8-4-4-4-2.2,0-4,1.8-4,4v3"}),s.jsx("rect",{y:"10",x:"4",width:"12",height:"9",fill:"#dcdcdc"})]})})),Gu=e=>{const r=e.width||"24",t=e.height||"24";return s.jsx("svg",{viewBox:`0 0 ${r} ${t}`,fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,style:e.style,width:r,height:t,children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 5V3.5C9 3.22386 9.22386 3 9.5 3C9.77614 3 10 3.22386 10 3.5V5H13V3.5C13 3.22386 13.2239 3 13.5 3C13.7761 3 14 3.22386 14 3.5V5H17C18.1046 5 19 5.89543 19 7V8V9V17C19 18.1046 18.1046 19 17 19H6C4.89543 19 4 18.1046 4 17V9V8V7C4 5.89543 4.89543 5 6 5H9ZM10 6H13V6.5C13 6.77614 13.2239 7 13.5 7C13.7761 7 14 6.77614 14 6.5V6H17C17.5523 6 18 6.44772 18 7V8H5V7C5 6.44772 5.44772 6 6 6H9V6.5C9 6.77614 9.22386 7 9.5 7C9.77614 7 10 6.77614 10 6.5V6ZM5 17V9H18V17C18 17.5523 17.5523 18 17 18H6C5.44772 18 5 17.5523 5 17ZM14.5 12H8.5C8.22386 12 8 11.7761 8 11.5C8 11.2239 8.22386 11 8.5 11H14.5C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12ZM8.5 14H14.5C14.7761 14 15 13.7761 15 13.5C15 13.2239 14.7761 13 14.5 13H8.5C8.22386 13 8 13.2239 8 13.5C8 13.7761 8.22386 14 8.5 14ZM14.5 16H8.5C8.22386 16 8 15.7761 8 15.5C8 15.2239 8.22386 15 8.5 15H14.5C14.7761 15 15 15.2239 15 15.5C15 15.7761 14.7761 16 14.5 16Z",fill:e.iconColor||s.DEFAULT_TEXT_COLOR})})},Uo=e=>{var r;return s.jsx("svg",k(C({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),{children:s.jsx("path",{fill:(r=e.fill)!=null?r:"#000",fillRule:"nonzero",d:"M7.589 10L7 10.777 11.99 15 17 10.777 16.413 10l-4.422 3.727z"})}))},Rb=e=>s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:"currentColor",d:"M18.5 8.228L13 10.343v6.894l5.5-2.39v-6.62zm-.893-.728l-5.113-1.967-5.297 1.892 5.303 2.04L17.607 7.5zM6 8.036v6.8l6 2.423v-6.916L6 8.036zm-1-.888l7.506-2.681 6.994 2.69v8.345l-6.993 3.04L5 15.512V7.147z"})})),Lb=e=>s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:e.color,d:"M8.354 11.646l-.708.708 3.418 3.417 5.343-7.48-.814-.582-4.657 6.52z"})})),Nb=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M9 11h7v1H9v-1zm0 2h7v1H9v-1z"})}))},Ib=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M11.715 12l.488-1H9v-1h3.69l.989-2.025.898.438L13.804 10H16v1h-2.684l-.488 1H16v1h-3.66l-1.035 2.124-.9-.439.823-1.685H9v-1h2.715z"})}))},jb=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M16.242 15.066l-.456.89L9 12.476 15.85 9l.452.892L11.2 12.48z"})}))},Wb=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M9 17h7v1H9v-1zm6.942-2.934l-.437.89L9 11.476 15.566 8l.434.892-4.89 2.589 4.832 2.585z"})}))},Bb=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M8.06 9.89L8.517 9l6.785 3.48-6.85 3.476L8 15.065l5.102-2.59z"})}))},Hb=e=>{var r;return s.jsx("svg",k(C({width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:s.jsx("path",{fill:(r=e.color)!=null?r:"#5B6372",d:"M9.06 8.89L9.517 8l6.785 3.48-6.85 3.476L9 14.065l5.102-2.59L9.06 8.89zM9 17h7v1H9v-1z"})}))},Jr=e=>e==="white",bl="rgb(240, 240, 240)",Yb="rgba(0, 0, 0, 0.26)",$b=s.newStyled("button",{target:"e1pmmnp20",label:"CalendarButton"})("cursor:pointer;background-color:",({theme:e,variant:r,disabled:t})=>t?bl:Jr(r)?e.general.backgroundColor:s.DEFAULT_BACKGROUND_COLOR,";border:",({variant:e})=>Jr(e)?"1px solid rgb(110 115 125 / var(--tw-border-opacity))":"none",";color:",({theme:e,isActive:r,disabled:t})=>t?Yb:r?e.general.primaryButtonTextColor:e.typography.primaryTextColor,";border-radius:0.375rem;&:hover{background-color:",({theme:e,variant:r,disabled:t})=>t?bl:s.getSlightlyDifferentColor(Jr(r)?e.general.backgroundColor:s.DEFAULT_BACKGROUND_COLOR),";transition:0.2s;}transition:color 250ms;"),Ub=s.newStyled("label",{target:"e1pmmnp21",label:"CalendarLabel"})("color:",({theme:e,variant:r})=>Jr(r)?e.typography.primaryTextColor:e.general.primaryButtonTextColor,";"),Ga=e=>{const{variant:r="grey",label:t,isActive:n,theme:o}=e,a=`csdk-text-left csdk-w-[152px] csdk-bg-[${s.DEFAULT_BACKGROUND_COLOR}] csdk-text-[13px] csdk-outline-0 csdk-border csdk-border-transparent csdk-p-input csdk-h-6 csdk-rounded-[4px] `;return s.jsxs("div",{className:"csdk-relative csdk-flex csdk-mr-[5px] csdk-cursor-pointer","aria-label":"DateRangeField",children:[t&&s.jsx(Ub,{htmlFor:e.id,className:"csdk-my-[5px] csdk-mr-[7px] csdk-text-[13px] csdk-leading-[18px]",theme:o,variant:r,children:t}),s.jsx("div",{className:"csdk-relative csdk-h-6",children:s.jsxs($b,k(C({},e),{variant:r,"aria-label":"DateRangeFieldButton",className:a+"disabled:csdk-placeholder:csdk-opacity-30 disabled:csdk-cursor-not-allowed "+"focus:csdk-border-solid focus:csdk-border-input focus:csdk-border-UI-default "+"hover:csdk-border-guiding csdk-text-text-active "+"csdk-pl-2.5 csdk-pr-10 csdk-overflow-hidden "+(e.className||""),children:[e.value,s.jsx("div",{"aria-label":"DateRangeFieldIcon",className:"csdk-absolute csdk-right-[4px] csdk-top-1/2 csdk-transform -csdk-translate-y-1/2",children:s.jsx(Gu,{className:"csdk-flex csdk-text-text-active","aria-hidden":"true",iconColor:n?o.general.primaryButtonTextColor:o.typography.primaryTextColor})})]}))})]})};function vl(e){return e.substring(2).toLowerCase()}function Vb(e,r){return r.documentElement.clientWidth<e.clientX||r.documentElement.clientHeight<e.clientY}function $t(e){const{children:r,disableReactTree:t=!1,mouseEvent:n="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,i=Y.useRef(!1),l=Y.useRef(null),u=Y.useRef(!1),c=Y.useRef(!1);Y.useEffect(()=>(setTimeout(()=>{u.current=!0},0),()=>{u.current=!1}),[]);const d=p.useForkRef(r.ref,l),f=p.useEventCallback(y=>{const b=c.current;c.current=!1;const v=p.ownerDocument(l.current);if(!u.current||!l.current||"clientX"in y&&Vb(y,v))return;if(i.current){i.current=!1;return}let x;y.composedPath?x=y.composedPath().indexOf(l.current)>-1:x=!v.documentElement.contains(y.target)||l.current.contains(y.target),!x&&(t||!b)&&o(y)}),h=y=>b=>{c.current=!0;const v=r.props[y];v&&v(b)},m={ref:d};return a!==!1&&(m[a]=h(a)),Y.useEffect(()=>{if(a!==!1){const y=vl(a),b=p.ownerDocument(l.current),v=()=>{i.current=!0};return b.addEventListener(y,f),b.addEventListener("touchmove",v),()=>{b.removeEventListener(y,f),b.removeEventListener("touchmove",v)}}},[f,a]),n!==!1&&(m[n]=h(n)),Y.useEffect(()=>{if(n!==!1){const y=vl(n),b=p.ownerDocument(l.current);return b.addEventListener(y,f),()=>{b.removeEventListener(y,f)}}},[f,n]),se.jsx(Y.Fragment,{children:Y.cloneElement(r,m)})}process.env.NODE_ENV!=="production"&&($t.propTypes={children:p.elementAcceptingRef.isRequired,disableReactTree:p.PropTypes.bool,mouseEvent:p.PropTypes.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:p.PropTypes.func.isRequired,touchEvent:p.PropTypes.oneOf(["onTouchEnd","onTouchStart",!1])});process.env.NODE_ENV!=="production"&&($t.propTypes=p.exactProp($t.propTypes));const Ka=e=>{var c,d;const[r,t]=g.useState(!1),{themeSettings:n}=s.useThemeContext(),o=()=>{t(!r)},a=g.useRef(null),i=(c=e.selectedIdx)!=null?c:null,l={fontFamily:n.typography.fontFamily,fontWeight:400,textTransform:"none",fontSize:"13px",color:n.typography.primaryTextColor},u=e.elements.map((f,h)=>s.jsx(p.MenuItem,{onClick:()=>{t(!1)},sx:k(C({},l),{minHeight:"unset","&:hover":{backgroundColor:s.getSlightlyDifferentColor(n.general.backgroundColor)}}),disabled:e.disabled,children:f},h));return s.jsxs(s.Fragment,{children:[s.jsx(p.Button,{ref:a,onClick:o,className:"csdk-h-full csdk-border-solid csdk-border-input csdk-box-border",sx:k(C({},l),{border:"1px solid rgb(110 115 125 / var(--tw-border-opacity))",marginLeft:"5px",marginRight:"5px",borderRadius:"0.375rem",verticalAlign:"unset","&:hover":{backgroundColor:s.getSlightlyDifferentColor(n.general.backgroundColor)}}),disabled:e.disabled,children:((d=e.icon)!=null?d:i!==null)?e.elements[i!=null?i:0]:s.jsx("div",{children:"Select..."})}),s.jsx(p.Popper,{open:r,anchorEl:a.current,placement:"bottom-start",sx:{backgroundColor:n.general.backgroundColor,border:"1px solid #c4c8cd",borderRadius:"4px",boxShadow:"0px 2px 2px rgba(0, 0, 0, 0.25)"},children:s.jsx($t,{onClickAway:()=>t(!1),children:s.jsx(p.MenuList,{autoFocusItem:r,children:u})})})]})},Yn=s.newStyled("div",{target:"e1f1pk9t0",label:"FilterContentDisplay"})("padding:12px;font-size:13px;"),kt=e=>e==="vertical",zb=s.newStyled("div",{target:"e1jswn0s0",label:"BackgroundFilterIcon"})(`background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpkZmY0YWNkMy1lYWYxLTQwNzItYTdlMy1hMjk3YzZjZTFlODUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTBFNDE0ODgwMjBFMTFFNThCQzJGRjdDRkI3RTQ1RUMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODRDMjI3QTIwMUU4MTFFNThCQzJGRjdDRkI3RTQ1RUMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpkZmY0YWNkMy1lYWYxLTQwNzItYTdlMy1hMjk3YzZjZTFlODUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6ZGZmNGFjZDMtZWFmMS00MDcyLWE3ZTMtYTI5N2M2Y2UxZTg1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+caeyqgAAAIdJREFUeNpi/P
9
9
  center center no-repeat;float:left;margin:4px 0 0 0;width:16px;height:16px;display:inline-block;`),Is="1px solid #dadada",xl=215,qb=s.newStyled("div",{target:"e1grm6eo0",label:"BaseContainer"})("width:min-content;max-width:100%;align-self:flex-start;box-sizing:border-box;",({shouldShowBorder:e})=>e&&s.css`
10
10
  border: ${Is};