@sisense/sdk-ui 1.27.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";var $u=Object.defineProperty,qu=Object.defineProperties;var Qu=Object.getOwnPropertyDescriptors;var cr=Object.getOwnPropertySymbols;var Is=Object.prototype.hasOwnProperty,Ls=Object.prototype.propertyIsEnumerable;var _a=(t,r,e)=>r in t?$u(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))Is.call(r,e)&&_a(t,e,r[e]);if(cr)for(var e of cr(r))Ls.call(r,e)&&_a(t,e,r[e]);return t},T=(t,r)=>qu(t,Qu(r));var pe=(t,r)=>{var e={};for(var n in t)Is.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&cr)for(var n of cr(t))r.indexOf(n)<0&&Ls.call(t,n)&&(e[n]=t[n]);return e};var Q=(t,r,e)=>(_a(t,typeof r!="symbol"?r+"":r,e),e);var he=(t,r,e)=>new Promise((n,a)=>{var o=u=>{try{i(e.next(u))}catch(l){a(l)}},s=u=>{try{i(e.throw(u))}catch(l){a(l)}},i=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,s);i((e=e.apply(t,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./useQuery-DHk01evX.cjs"),h=require("./derive-chart-family-BXkBWhAA.cjs"),y=require("react/jsx-runtime"),w=require("react"),Co=require("react-dom");function il(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const G=il(w),Uu=il(Co);function xn(t){return t.endsWith("/")?t:`${t}/`}const zu={errorPrefix:"[request-error]",errors:{networkError:"Network error. Probably you forgot to add your domain to 'CORS Allowed Origins' in Sisense Admin Panel -> Security Settings.",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}}"}},Gu={errorPrefix:"[request-error]",errors:{networkError:"Помилка мережі. Можливо ви забули додати свій домен до «CORS Allowed Origins» в панелі адміністратора Sisense -> Security Settings.",ssoNotEnabled:"SSO не ввімкнено на цьому сервері, будь ласка, виберіть інший метод аутентифікації",ssoNoLoginUrl:"Неможливо отримати loginUrl з сервера. Перевірте налаштування SSO.",passwordAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою імені користувача та пароля. Перевірте дані для входу.",tokenAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою токена. Перевірте дані для входу.",responseError_onlyStatus:"$t(errorPrefix) Статус: {{status}}",responseError_withStatusText:"$t(errorPrefix) Статус: {{status}} - {{statusText}}"}},ll="sdkRestClient",Vu={en:zu,uk:Gu};function Ku(){return h.initI18next({resource:Vu,language:"en",namespace:ll})}const{i18nextInstance:Xu}=Ku();class Kn{constructor(r){this._valid=!0,this._authenticating=!1,this._tried=!1,this._result=new Promise(e=>{this._resolve=e}),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 Zr=(t,r)=>{for(const[e,n]of Object.entries(r))Array.isArray(t)?t.push([e,n]):typeof t.set=="function"?t.set(e,n):t[e]=n},cl=(t,r)=>{if(!t||typeof t!="string")return t;const e=new URL(t);for(const[n,a]of Object.entries(r))e.searchParams.append(n,a);return e.toString().replace(/\/([?&])/,"$1")},Ju=(t,r)=>t===null||r===null;class Zu extends Kn{constructor(r,e){super("bearer"),this.bearer=e,this._resolve(!0)}applyHeader(r){const e="Bearer "+this.bearer;Zr(r,{Authorization:e})}authenticate(){return this._result}authenticated(){return this._result}}function ed(t){return t.type==="bearer"}let Ut=class extends h.AbstractTranslatableError{constructor(r,e){super(ll,{key:r,interpolationOptions:e},Xu.t)}get status(){return this.interpolationOptions.status}};var td=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class nd extends Kn{constructor(r,e){super("wat"),this.url=`${xn(r)}api/v1/wat/sessionToken`,this.body=`{"webAccessToken": "${e}"}`}authenticate(){return td(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(ea);if(r.ok){const e=yield r.json();this._initialiser=e.initialiser,this._webSessionToken=e.webSessionToken,this._resolve(!0)}}catch(r){throw new Ut("errors.tokenAuthFailed")}finally{this._resolve(!1),this._authenticating=!1}return this._result})}applyHeader(r){if(this._webSessionToken&&this._initialiser){const e=this._webSessionToken,n=this._initialiser;Zr(r,{Authorization:e,Initialiser:n})}}}function ul(t){return t.type==="wat"}var Ta=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class rd extends Kn{constructor(r,e=!1){super("sso"),this.url=xn(r),this._enableSilentPreAuth=e}authenticate(r=!0){var e;return Ta(this,void 0,void 0,function*(){try{this._authenticating=!0;const{isAuthenticated:n,loginUrl:a}=yield this.checkAuthentication();if(n)return this._resolve(!0),yield this._result;const o=cl(a,{return_to:window.location.href});if(this._enableSilentPreAuth&&r){yield this.authenticateSilent(o);const{isAuthenticated:s}=yield this.checkAuthentication();if(s)return this._resolve(!0),yield this._result}(e=window==null?void 0:window.location)===null||e===void 0||e.replace(o)}finally{this._resolve(!1),this._authenticating=!1}return this._result})}authenticateSilent(r){return Ta(this,void 0,void 0,function*(){const e=document.createElement("iframe");e.style.display="none",document.body.appendChild(e),e.src=r,yield new Promise(n=>{e.onload=()=>{n(!0)}}),document.body.removeChild(e)})}checkAuthentication(){return Ta(this,void 0,void 0,function*(){const r=`${this.url}api/auth/isauth`,n=yield(yield fetch(r,{headers:{Internal:"true"},credentials:"include"}).catch(ea)).json();if(!n.isAuthenticated){if(!n.ssoEnabled)throw new Ut("errors.ssoNotEnabled");if(!n.loginUrl)throw new Ut("errors.ssoNoLoginUrl")}return{isAuthenticated:n.isAuthenticated,loginUrl:n.loginUrl||""}})}}function dl(t){return t.type==="sso"}function ad(t){if(!t.ok)throw new Ut("errors.responseError",{status:t.status.toString(),statusText:t.statusText,context:t.statusText?"withStatusText":"onlyStatus"});return t}function od(t,r){if(r.invalidate(),dd(r))throw new Ut("errors.passwordAuthFailed");if(ed(r)||ul(r))throw new Ut("errors.tokenAuthFailed");return dl(r)&&!r.isAuthenticating()&&r.authenticate(),t}function sd(t){return t.message==="Failed to fetch"&&t.name==="TypeError"}function id(){return Promise.reject(new Ut("errors.networkError"))}const ld=t=>r=>r.status===401?od(r,t):r.ok?r:ad(r),ea=t=>sd(t)?id():Promise.reject(t);var cd=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class ud extends Kn{constructor(r,e,n){super("password"),this._authheader="",this.url=`${xn(r)}api/v1/authentication/login`;const a=encodeURIComponent(e),o=encodeURIComponent(n);this.body=`username=${a}&password=${o}`}authenticate(){return cd(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(ea);if(r.ok){const e=yield r.json();this._authheader=e.access_token}}finally{this._resolve(!!this._authheader),this._authenticating=!1}return this._result})}applyHeader(r){const e="Bearer "+this._authheader;Zr(r,{Authorization:e})}}function dd(t){return t.type==="password"}class fd extends Kn{constructor(){super("fusion")}authenticate(){var r,e,n,a,o;const s=!!(!((e=(r=window.prism)===null||r===void 0?void 0:r.user)===null||e===void 0)&&e._id);this._resolve(s);const i=(o=(a=(n=window.document)===null||n===void 0?void 0:n.cookie)===null||a===void 0?void 0:a.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/))===null||o===void 0?void 0:o[1];return i&&(this.antiCsrfToken=i),this._result}applyHeader(r){this.antiCsrfToken&&Zr(r,{"X-Xsrf-Token":this.antiCsrfToken})}}function pd({url:t,username:r,password:e,token:n,wat:a,ssoEnabled:o=!1,enableSilentPreAuth:s=!1,useFusionAuth:i=!1}){const u=xn(t);return o?new rd(u,s):r&&e?new ud(u,r,e):n?new Zu(u,n):a?new nd(u,a):i?new fd:null}var hd=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class md{constructor(r,e,n){this.url=xn(r),this.auth=e,this.env=n}login(){return this.auth.authenticate()}call(r,e,n){return hd(this,void 0,void 0,function*(){this.auth.isAuthenticating()&&(yield this.auth.authenticated()),e.headers=e.headers||{},dl(this.auth)&&(e.credentials="include"),this.auth.applyHeader(e.headers);const a=n!=null&&n.skipTrackingParam?r:cl(r,{trc:this.env}),o=yield fetch(a,e).then(ld(this.auth)).catch(ea);if(!(o.status===204||o.status===304))return n!=null&&n.returnBlob?o.blob():o.json().catch(s=>{var i,u;if(!(!((u=(i=s==null?void 0:s.message)===null||i===void 0?void 0:i.includes)===null||u===void 0)&&u.call(i,"Unexpected end of JSON input")))throw s})})}post(r,e,n={},a,o){const s=Object.assign({method:"POST",body:o!=null&&o.nonJSONBody?e:JSON.stringify(e),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:a},n);return this.call(this.url+r,s,o)}patch(r,e,n={},a,o){const s=Object.assign({method:"PATCH",body:o!=null&&o.nonJSONBody?e:JSON.stringify(e),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:a},n);return this.call(this.url+r,s,o)}get(r,e={},n){return this.call(this.url+r,Object.assign(Object.assign({},e),{method:"GET"}),n)}delete(r,e={},n){return this.call(this.url+r,Object.assign(Object.assign({},e),{method:"DELETE"}),n)}}const gd={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.'}},yd={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}}". Переконайтесь що джерело існує і доступне.'}},fl="sdkQueryClient",bd={en:gd,uk:yd};function vd(){return h.initI18next({resource:bd,language:"en",namespace:fl})}const{i18nextInstance:wd}=vd();var We={},pl={},ta={},ko={};(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(a,o,s,i){function u(l){return l instanceof s?l:new s(function(c){c(l)})}return new(s||(s=Promise))(function(l,c){function d(g){try{m(i.next(g))}catch(v){c(v)}}function p(g){try{m(i.throw(g))}catch(v){c(v)}}function m(g){g.done?l(g.value):u(g.value).then(d,p)}m((i=i.apply(a,o||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Task=t.ExecutionResultStatus=void 0;var e;(function(a){a.SUCCESS="SUCCESS",a.ERROR="ERROR"})(e=t.ExecutionResultStatus||(t.ExecutionResultStatus={}));class n{constructor(o,s,i){this.steps=o,this.passport=s,this.addons=i,this.statistics={startTime:new Date,steps:[],runtimeInfo:{}},this.currentStep=void 0}run(o){return r(this,void 0,void 0,function*(){let s=o,i;for(let l=0;l<this.steps.length;l+=1){this.currentStep=this.steps[l];const{resultValue:c,info:d}=yield this.currentStep.run(this,s);if(this.statistics.steps.push(d),d.success)s=c;else{i=d.error;break}}const u=this.statistics.steps.length===this.steps.length&&this.statistics.steps.every(l=>l.success);return this.statistics.endTime=new Date,{status:u?e.SUCCESS:e.ERROR,error:i,result:u?s:void 0,statistics:this.statistics}})}cancel(o){var s;return r(this,void 0,void 0,function*(){yield(s=this.currentStep)===null||s===void 0?void 0:s.cancel(this,o)})}addRuntimeInfo(o,s){this.statistics.runtimeInfo[o]=s}emitAddonEvent(o,...s){var i;const u=o.split("."),l=u[0],c=u[1],d=(i=this.addons)===null||i===void 0?void 0:i.find(m=>m.addonName===l),p=(d==null?void 0:d.events)[c];p(...s)}}t.Task=n})(ko);var Sa=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};Object.defineProperty(ta,"__esModule",{value:!0});ta.AbstractTaskManager=void 0;const xd=ko;class Dd{constructor(r){this.runningTasks=new Map,this.addons=r||[]}runTask(r){return Sa(this,void 0,void 0,function*(){const{taskId:e}=r.passport;this.runningTasks.set(e,r);const n=yield r.run();return this.runningTasks.delete(e),n})}createFlow(r){return e=>Sa(this,void 0,void 0,function*(){const n=new xd.Task(r,e,this.addons);return this.runTask(n)})}cancel(r,e){return Sa(this,void 0,void 0,function*(){const n=this.runningTasks.get(r);n&&(yield n.cancel(e))})}}ta.AbstractTaskManager=Dd;var na={},Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.TaskCanceledError=void 0;class Cd extends Error{constructor(r){const e=`Task was canceled due to: "${r}"`;super(e)}}Xn.TaskCanceledError=Cd;var js=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};Object.defineProperty(na,"__esModule",{value:!0});na.Step=void 0;const kd=Xn;class _d{constructor(r,e,n){this.taskSelfResolvers=new Map,this.taskStepInfos=new Map,this.name=r,this.runLogic=e,this.cancelLogic=n}run(r,e){return js(this,void 0,void 0,function*(){return this.addStepInfo(r,{name:this.name}),new Promise(n=>{const a=new Date,o=(s,i)=>{const u=new Date,l=u.getTime()-a.getTime();this.addStepInfo(r,{startTime:a,endTime:u,duration:l}),this.addStepInfo(r,i?{success:!1,error:i}:{success:!0}),n({resultValue:s,info:this.getStepInfo(r)})};this.taskSelfResolvers.set(r,o),this.runLogic(r,e).then(s=>o(s)).finally(()=>{this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r)}).catch(s=>o(void 0,s))})})}cancel(r,e){return js(this,void 0,void 0,function*(){this.addStepInfo(r,{wasCanceled:!0,cancelingReason:e});const n=this.taskSelfResolvers.get(r);n==null||n(void 0,new kd.TaskCanceledError(e)),this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r),yield this.cancelLogic(r,e)})}addStepInfo(r,e){const n=this.taskStepInfos.get(r)||{},a=Object.assign(Object.assign({},n),e);this.taskStepInfos.set(r,a)}getStepInfo(r){return this.taskStepInfos.get(r)}}na.Step=_d;var ra={};Object.defineProperty(ra,"__esModule",{value:!0});ra.Addon=void 0;class Td{constructor(){this.events={}}}ra.Addon=Td;var aa={},ur,Sd=new Uint8Array(16);function hl(){if(!ur&&(ur=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ur))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ur(Sd)}const Ed=/^(?:[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 oa(t){return typeof t=="string"&&Ed.test(t)}var ke=[];for(var Ea=0;Ea<256;++Ea)ke.push((Ea+256).toString(16).substr(1));function sa(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(ke[t[r+0]]+ke[t[r+1]]+ke[t[r+2]]+ke[t[r+3]]+"-"+ke[t[r+4]]+ke[t[r+5]]+"-"+ke[t[r+6]]+ke[t[r+7]]+"-"+ke[t[r+8]]+ke[t[r+9]]+"-"+ke[t[r+10]]+ke[t[r+11]]+ke[t[r+12]]+ke[t[r+13]]+ke[t[r+14]]+ke[t[r+15]]).toLowerCase();if(!oa(e))throw TypeError("Stringified UUID is invalid");return e}var Ws,Pa,Ma=0,Aa=0;function Pd(t,r,e){var n=r&&e||0,a=r||new Array(16);t=t||{};var o=t.node||Ws,s=t.clockseq!==void 0?t.clockseq:Pa;if(o==null||s==null){var i=t.random||(t.rng||hl)();o==null&&(o=Ws=[i[0]|1,i[1],i[2],i[3],i[4],i[5]]),s==null&&(s=Pa=(i[6]<<8|i[7])&16383)}var u=t.msecs!==void 0?t.msecs:Date.now(),l=t.nsecs!==void 0?t.nsecs:Aa+1,c=u-Ma+(l-Aa)/1e4;if(c<0&&t.clockseq===void 0&&(s=s+1&16383),(c<0||u>Ma)&&t.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ma=u,Aa=l,Pa=s,u+=122192928e5;var d=((u&268435455)*1e4+l)%4294967296;a[n++]=d>>>24&255,a[n++]=d>>>16&255,a[n++]=d>>>8&255,a[n++]=d&255;var p=u/4294967296*1e4&268435455;a[n++]=p>>>8&255,a[n++]=p&255,a[n++]=p>>>24&15|16,a[n++]=p>>>16&255,a[n++]=s>>>8|128,a[n++]=s&255;for(var m=0;m<6;++m)a[n+m]=o[m];return r||sa(a)}function ml(t){if(!oa(t))throw TypeError("Invalid UUID");var r,e=new Uint8Array(16);return e[0]=(r=parseInt(t.slice(0,8),16))>>>24,e[1]=r>>>16&255,e[2]=r>>>8&255,e[3]=r&255,e[4]=(r=parseInt(t.slice(9,13),16))>>>8,e[5]=r&255,e[6]=(r=parseInt(t.slice(14,18),16))>>>8,e[7]=r&255,e[8]=(r=parseInt(t.slice(19,23),16))>>>8,e[9]=r&255,e[10]=(r=parseInt(t.slice(24,36),16))/1099511627776&255,e[11]=r/4294967296&255,e[12]=r>>>24&255,e[13]=r>>>16&255,e[14]=r>>>8&255,e[15]=r&255,e}function Md(t){t=unescape(encodeURIComponent(t));for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e));return r}var Ad="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Od="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gl(t,r,e){function n(a,o,s,i){if(typeof a=="string"&&(a=Md(a)),typeof o=="string"&&(o=ml(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+a.length);if(u.set(o),u.set(a,o.length),u=e(u),u[6]=u[6]&15|r,u[8]=u[8]&63|128,s){i=i||0;for(var l=0;l<16;++l)s[i+l]=u[l];return s}return sa(u)}try{n.name=t}catch(a){}return n.DNS=Ad,n.URL=Od,n}function Fd(t){if(typeof t=="string"){var r=unescape(encodeURIComponent(t));t=new Uint8Array(r.length);for(var e=0;e<r.length;++e)t[e]=r.charCodeAt(e)}return Nd(Rd(Id(t),t.length*8))}function Nd(t){for(var r=[],e=t.length*32,n="0123456789abcdef",a=0;a<e;a+=8){var o=t[a>>5]>>>a%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(o&15),16);r.push(s)}return r}function yl(t){return(t+64>>>9<<4)+14+1}function Rd(t,r){t[r>>5]|=128<<r%32,t[yl(r)-1]=r;for(var e=1732584193,n=-271733879,a=-1732584194,o=271733878,s=0;s<t.length;s+=16){var i=e,u=n,l=a,c=o;e=Te(e,n,a,o,t[s],7,-680876936),o=Te(o,e,n,a,t[s+1],12,-389564586),a=Te(a,o,e,n,t[s+2],17,606105819),n=Te(n,a,o,e,t[s+3],22,-1044525330),e=Te(e,n,a,o,t[s+4],7,-176418897),o=Te(o,e,n,a,t[s+5],12,1200080426),a=Te(a,o,e,n,t[s+6],17,-1473231341),n=Te(n,a,o,e,t[s+7],22,-45705983),e=Te(e,n,a,o,t[s+8],7,1770035416),o=Te(o,e,n,a,t[s+9],12,-1958414417),a=Te(a,o,e,n,t[s+10],17,-42063),n=Te(n,a,o,e,t[s+11],22,-1990404162),e=Te(e,n,a,o,t[s+12],7,1804603682),o=Te(o,e,n,a,t[s+13],12,-40341101),a=Te(a,o,e,n,t[s+14],17,-1502002290),n=Te(n,a,o,e,t[s+15],22,1236535329),e=Se(e,n,a,o,t[s+1],5,-165796510),o=Se(o,e,n,a,t[s+6],9,-1069501632),a=Se(a,o,e,n,t[s+11],14,643717713),n=Se(n,a,o,e,t[s],20,-373897302),e=Se(e,n,a,o,t[s+5],5,-701558691),o=Se(o,e,n,a,t[s+10],9,38016083),a=Se(a,o,e,n,t[s+15],14,-660478335),n=Se(n,a,o,e,t[s+4],20,-405537848),e=Se(e,n,a,o,t[s+9],5,568446438),o=Se(o,e,n,a,t[s+14],9,-1019803690),a=Se(a,o,e,n,t[s+3],14,-187363961),n=Se(n,a,o,e,t[s+8],20,1163531501),e=Se(e,n,a,o,t[s+13],5,-1444681467),o=Se(o,e,n,a,t[s+2],9,-51403784),a=Se(a,o,e,n,t[s+7],14,1735328473),n=Se(n,a,o,e,t[s+12],20,-1926607734),e=Ee(e,n,a,o,t[s+5],4,-378558),o=Ee(o,e,n,a,t[s+8],11,-2022574463),a=Ee(a,o,e,n,t[s+11],16,1839030562),n=Ee(n,a,o,e,t[s+14],23,-35309556),e=Ee(e,n,a,o,t[s+1],4,-1530992060),o=Ee(o,e,n,a,t[s+4],11,1272893353),a=Ee(a,o,e,n,t[s+7],16,-155497632),n=Ee(n,a,o,e,t[s+10],23,-1094730640),e=Ee(e,n,a,o,t[s+13],4,681279174),o=Ee(o,e,n,a,t[s],11,-358537222),a=Ee(a,o,e,n,t[s+3],16,-722521979),n=Ee(n,a,o,e,t[s+6],23,76029189),e=Ee(e,n,a,o,t[s+9],4,-640364487),o=Ee(o,e,n,a,t[s+12],11,-421815835),a=Ee(a,o,e,n,t[s+15],16,530742520),n=Ee(n,a,o,e,t[s+2],23,-995338651),e=Pe(e,n,a,o,t[s],6,-198630844),o=Pe(o,e,n,a,t[s+7],10,1126891415),a=Pe(a,o,e,n,t[s+14],15,-1416354905),n=Pe(n,a,o,e,t[s+5],21,-57434055),e=Pe(e,n,a,o,t[s+12],6,1700485571),o=Pe(o,e,n,a,t[s+3],10,-1894986606),a=Pe(a,o,e,n,t[s+10],15,-1051523),n=Pe(n,a,o,e,t[s+1],21,-2054922799),e=Pe(e,n,a,o,t[s+8],6,1873313359),o=Pe(o,e,n,a,t[s+15],10,-30611744),a=Pe(a,o,e,n,t[s+6],15,-1560198380),n=Pe(n,a,o,e,t[s+13],21,1309151649),e=Pe(e,n,a,o,t[s+4],6,-145523070),o=Pe(o,e,n,a,t[s+11],10,-1120210379),a=Pe(a,o,e,n,t[s+2],15,718787259),n=Pe(n,a,o,e,t[s+9],21,-343485551),e=Tt(e,i),n=Tt(n,u),a=Tt(a,l),o=Tt(o,c)}return[e,n,a,o]}function Id(t){if(t.length===0)return[];for(var r=t.length*8,e=new Uint32Array(yl(r)),n=0;n<r;n+=8)e[n>>5]|=(t[n/8]&255)<<n%32;return e}function Tt(t,r){var e=(t&65535)+(r&65535),n=(t>>16)+(r>>16)+(e>>16);return n<<16|e&65535}function Ld(t,r){return t<<r|t>>>32-r}function ia(t,r,e,n,a,o){return Tt(Ld(Tt(Tt(r,t),Tt(n,o)),a),e)}function Te(t,r,e,n,a,o,s){return ia(r&e|~r&n,t,r,a,o,s)}function Se(t,r,e,n,a,o,s){return ia(r&n|e&~n,t,r,a,o,s)}function Ee(t,r,e,n,a,o,s){return ia(r^e^n,t,r,a,o,s)}function Pe(t,r,e,n,a,o,s){return ia(e^(r|~n),t,r,a,o,s)}var jd=gl("v3",48,Fd);const Wd=jd;function Yd(t,r,e){t=t||{};var n=t.random||(t.rng||hl)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){e=e||0;for(var a=0;a<16;++a)r[e+a]=n[a];return r}return sa(n)}function Bd(t,r,e,n){switch(t){case 0:return r&e^~r&n;case 1:return r^e^n;case 2:return r&e^r&n^e&n;case 3:return r^e^n}}function Oa(t,r){return t<<r|t>>>32-r}function Hd(t){var r=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var a=0;a<n.length;++a)t.push(n.charCodeAt(a))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,s=Math.ceil(o/16),i=new Array(s),u=0;u<s;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];i[u]=l}i[s-1][14]=(t.length-1)*8/Math.pow(2,32),i[s-1][14]=Math.floor(i[s-1][14]),i[s-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<s;++d){for(var p=new Uint32Array(80),m=0;m<16;++m)p[m]=i[d][m];for(var g=16;g<80;++g)p[g]=Oa(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);for(var v=e[0],b=e[1],x=e[2],C=e[3],_=e[4],S=0;S<80;++S){var O=Math.floor(S/20),j=Oa(v,5)+Bd(O,b,x,C)+_+r[O]+p[S]>>>0;_=C,C=x,x=Oa(b,30)>>>0,b=v,v=j}e[0]=e[0]+v>>>0,e[1]=e[1]+b>>>0,e[2]=e[2]+x>>>0,e[3]=e[3]+C>>>0,e[4]=e[4]+_>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var $d=gl("v5",80,Hd);const qd=$d,Qd="00000000-0000-0000-0000-000000000000";function Ud(t){if(!oa(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const zd=Object.freeze(Object.defineProperty({__proto__:null,NIL:Qd,parse:ml,stringify:sa,v1:Pd,v3:Wd,v4:Yd,v5:qd,validate:oa,version:Ud},Symbol.toStringTag,{value:"Module"})),Gd=h.getAugmentedNamespace(zd);Object.defineProperty(aa,"__esModule",{value:!0});aa.TaskPassport=void 0;const Vd=Gd;class Kd{constructor(){this.taskId=(0,Vd.v4)()}}aa.TaskPassport=Kd;(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__createBinding||(Object.create?function(n,a,o,s){s===void 0&&(s=o);var i=Object.getOwnPropertyDescriptor(a,o);(!i||("get"in i?!a.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(n,s,i)}:function(n,a,o,s){s===void 0&&(s=o),n[s]=a[o]}),e=h.commonjsGlobal&&h.commonjsGlobal.__exportStar||function(n,a){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&r(a,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),e(ta,t),e(na,t),e(ko,t),e(ra,t),e(aa,t),e(Xn,t)})(pl);(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__createBinding||(Object.create?function(n,a,o,s){s===void 0&&(s=o);var i=Object.getOwnPropertyDescriptor(a,o);(!i||("get"in i?!a.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(n,s,i)}:function(n,a,o,s){s===void 0&&(s=o),n[s]=a[o]}),e=h.commonjsGlobal&&h.commonjsGlobal.__exportStar||function(n,a){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&r(a,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),e(pl,t)})(We);const bl=t=>{if(t!==void 0)return`${t}`},vl=t=>{if(t!==void 0)return new Date(t).toISOString()},_o=()=>!1;function Ys(t,r){const e=r.filter;return"or"in e?n=>e.or.map(a=>t(Object.assign(Object.assign({},r),{filter:a}))).reduce((a,o)=>a||o(n),!1):"and"in e?n=>e.and.map(a=>t(Object.assign(Object.assign({},r),{filter:a}))).reduce((a,o)=>a&&o(n),!0):t(r)}function Xd(t){const{datatype:r}=t,e=t.filter,n=r==="datetime"?vl:bl;return a=>{const o=e.members.map(n),s=n(a);return o.includes(s)}}function Jd(t){const{datatype:r}=t,e=t.filter,n=r==="datetime"?vl:bl;return a=>{var o,s;const i=((s=(o=e.exclude)===null||o===void 0?void 0:o.members)===null||s===void 0?void 0:s.map(n))||[],u=n(a);return!i.includes(u)}}function Zd(t){const r=t.filter,e=h.getSelectedConditionOption(r);return e===h.ConditionFilterType.STARTS_WITH?n=>new RegExp(`^${r.startsWith}`,"i").test(n):e===h.ConditionFilterType.ENDS_WITH?n=>new RegExp(`${r.endsWith}$`,"i").test(n):e===h.ConditionFilterType.CONTAINS?n=>new RegExp(r.contains,"i").test(n):e===h.ConditionFilterType.EQUALS?n=>n.localeCompare(r.equals,void 0,{sensitivity:"base"})===0:e===h.ConditionFilterType.DOESNT_START_WITH?n=>!new RegExp(`^${r.doesntStartWith}`,"i").test(n):e===h.ConditionFilterType.DOESNT_END_WITH?n=>!new RegExp(`${r.doesntEndWith}$`,"i").test(n):e===h.ConditionFilterType.DOESNT_CONTAIN?n=>!new RegExp(r.doesntContain,"i").test(n):e===h.ConditionFilterType.DOESNT_EQUAL?n=>n.localeCompare(r.doesntEqual,void 0,{sensitivity:"base"})!==0:_o}function ef(t){const r=t.filter,e=h.getSelectedConditionOption(r);return e===h.ConditionFilterType.EQUALS?n=>Number(r.equals)===Number(n):e===h.ConditionFilterType.DOESNT_EQUAL?n=>Number(r.doesntEqual)!==Number(n):e===h.ConditionFilterType.LESS_THAN?n=>Number(n)<Number(r.toNotEqual):e===h.ConditionFilterType.GREATER_THAN?n=>Number(n)>Number(r.fromNotEqual):e===h.ConditionFilterType.BETWEEN?n=>Number(r.to)>=Number(n)&&Number(n)>=Number(r.from):e===h.ConditionFilterType.GREATER_THAN_OR_EQUAL?n=>Number(n)>=Number(r.from):e===h.ConditionFilterType.LESS_THAN_OR_EQUAL?n=>Number(r.to)>=Number(n):_o}function tf(t){const r=t,{datatype:e}=r,n=r.filter;return h.isSpecificItemsFilter(n)?Xd(r):h.isConditionFilter(n)&&h.getSelectedConditionOption(n)===h.ConditionFilterType.IS_NOT?Jd(r):e==="text"?Ys(Zd,r):e==="numeric"?Ys(ef,r):_o}var wl={exports:{}};/*! @preserve
1
+ "use strict";var $u=Object.defineProperty,qu=Object.defineProperties;var Qu=Object.getOwnPropertyDescriptors;var cr=Object.getOwnPropertySymbols;var Is=Object.prototype.hasOwnProperty,Ls=Object.prototype.propertyIsEnumerable;var _a=(t,r,e)=>r in t?$u(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))Is.call(r,e)&&_a(t,e,r[e]);if(cr)for(var e of cr(r))Ls.call(r,e)&&_a(t,e,r[e]);return t},T=(t,r)=>qu(t,Qu(r));var pe=(t,r)=>{var e={};for(var n in t)Is.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&cr)for(var n of cr(t))r.indexOf(n)<0&&Ls.call(t,n)&&(e[n]=t[n]);return e};var Q=(t,r,e)=>(_a(t,typeof r!="symbol"?r+"":r,e),e);var he=(t,r,e)=>new Promise((n,a)=>{var o=u=>{try{i(e.next(u))}catch(l){a(l)}},s=u=>{try{i(e.throw(u))}catch(l){a(l)}},i=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,s);i((e=e.apply(t,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./useQuery-KI9icU5_.cjs"),h=require("./derive-chart-family-DDkQybGb.cjs"),y=require("react/jsx-runtime"),w=require("react"),Co=require("react-dom");function il(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const G=il(w),Uu=il(Co);function xn(t){return t.endsWith("/")?t:`${t}/`}const zu={errorPrefix:"[request-error]",errors:{networkError:"Network error. Probably you forgot to add your domain to 'CORS Allowed Origins' in Sisense Admin Panel -> Security Settings.",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}}"}},Gu={errorPrefix:"[request-error]",errors:{networkError:"Помилка мережі. Можливо ви забули додати свій домен до «CORS Allowed Origins» в панелі адміністратора Sisense -> Security Settings.",ssoNotEnabled:"SSO не ввімкнено на цьому сервері, будь ласка, виберіть інший метод аутентифікації",ssoNoLoginUrl:"Неможливо отримати loginUrl з сервера. Перевірте налаштування SSO.",passwordAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою імені користувача та пароля. Перевірте дані для входу.",tokenAuthFailed:"$t(errorPrefix) Помилка автентифікації за допомогою токена. Перевірте дані для входу.",responseError_onlyStatus:"$t(errorPrefix) Статус: {{status}}",responseError_withStatusText:"$t(errorPrefix) Статус: {{status}} - {{statusText}}"}},ll="sdkRestClient",Vu={en:zu,uk:Gu};function Ku(){return h.initI18next({resource:Vu,language:"en",namespace:ll})}const{i18nextInstance:Xu}=Ku();class Kn{constructor(r){this._valid=!0,this._authenticating=!1,this._tried=!1,this._result=new Promise(e=>{this._resolve=e}),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 Zr=(t,r)=>{for(const[e,n]of Object.entries(r))Array.isArray(t)?t.push([e,n]):typeof t.set=="function"?t.set(e,n):t[e]=n},cl=(t,r)=>{if(!t||typeof t!="string")return t;const e=new URL(t);for(const[n,a]of Object.entries(r))e.searchParams.append(n,a);return e.toString().replace(/\/([?&])/,"$1")},Ju=(t,r)=>t===null||r===null;class Zu extends Kn{constructor(r,e){super("bearer"),this.bearer=e,this._resolve(!0)}applyHeader(r){const e="Bearer "+this.bearer;Zr(r,{Authorization:e})}authenticate(){return this._result}authenticated(){return this._result}}function ed(t){return t.type==="bearer"}let Ut=class extends h.AbstractTranslatableError{constructor(r,e){super(ll,{key:r,interpolationOptions:e},Xu.t)}get status(){return this.interpolationOptions.status}};var td=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class nd extends Kn{constructor(r,e){super("wat"),this.url=`${xn(r)}api/v1/wat/sessionToken`,this.body=`{"webAccessToken": "${e}"}`}authenticate(){return td(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(ea);if(r.ok){const e=yield r.json();this._initialiser=e.initialiser,this._webSessionToken=e.webSessionToken,this._resolve(!0)}}catch(r){throw new Ut("errors.tokenAuthFailed")}finally{this._resolve(!1),this._authenticating=!1}return this._result})}applyHeader(r){if(this._webSessionToken&&this._initialiser){const e=this._webSessionToken,n=this._initialiser;Zr(r,{Authorization:e,Initialiser:n})}}}function ul(t){return t.type==="wat"}var Ta=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class rd extends Kn{constructor(r,e=!1){super("sso"),this.url=xn(r),this._enableSilentPreAuth=e}authenticate(r=!0){var e;return Ta(this,void 0,void 0,function*(){try{this._authenticating=!0;const{isAuthenticated:n,loginUrl:a}=yield this.checkAuthentication();if(n)return this._resolve(!0),yield this._result;const o=cl(a,{return_to:window.location.href});if(this._enableSilentPreAuth&&r){yield this.authenticateSilent(o);const{isAuthenticated:s}=yield this.checkAuthentication();if(s)return this._resolve(!0),yield this._result}(e=window==null?void 0:window.location)===null||e===void 0||e.replace(o)}finally{this._resolve(!1),this._authenticating=!1}return this._result})}authenticateSilent(r){return Ta(this,void 0,void 0,function*(){const e=document.createElement("iframe");e.style.display="none",document.body.appendChild(e),e.src=r,yield new Promise(n=>{e.onload=()=>{n(!0)}}),document.body.removeChild(e)})}checkAuthentication(){return Ta(this,void 0,void 0,function*(){const r=`${this.url}api/auth/isauth`,n=yield(yield fetch(r,{headers:{Internal:"true"},credentials:"include"}).catch(ea)).json();if(!n.isAuthenticated){if(!n.ssoEnabled)throw new Ut("errors.ssoNotEnabled");if(!n.loginUrl)throw new Ut("errors.ssoNoLoginUrl")}return{isAuthenticated:n.isAuthenticated,loginUrl:n.loginUrl||""}})}}function dl(t){return t.type==="sso"}function ad(t){if(!t.ok)throw new Ut("errors.responseError",{status:t.status.toString(),statusText:t.statusText,context:t.statusText?"withStatusText":"onlyStatus"});return t}function od(t,r){if(r.invalidate(),dd(r))throw new Ut("errors.passwordAuthFailed");if(ed(r)||ul(r))throw new Ut("errors.tokenAuthFailed");return dl(r)&&!r.isAuthenticating()&&r.authenticate(),t}function sd(t){return t.message==="Failed to fetch"&&t.name==="TypeError"}function id(){return Promise.reject(new Ut("errors.networkError"))}const ld=t=>r=>r.status===401?od(r,t):r.ok?r:ad(r),ea=t=>sd(t)?id():Promise.reject(t);var cd=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class ud extends Kn{constructor(r,e,n){super("password"),this._authheader="",this.url=`${xn(r)}api/v1/authentication/login`;const a=encodeURIComponent(e),o=encodeURIComponent(n);this.body=`username=${a}&password=${o}`}authenticate(){return cd(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(ea);if(r.ok){const e=yield r.json();this._authheader=e.access_token}}finally{this._resolve(!!this._authheader),this._authenticating=!1}return this._result})}applyHeader(r){const e="Bearer "+this._authheader;Zr(r,{Authorization:e})}}function dd(t){return t.type==="password"}class fd extends Kn{constructor(){super("fusion")}authenticate(){var r,e,n,a,o;const s=!!(!((e=(r=window.prism)===null||r===void 0?void 0:r.user)===null||e===void 0)&&e._id);this._resolve(s);const i=(o=(a=(n=window.document)===null||n===void 0?void 0:n.cookie)===null||a===void 0?void 0:a.match(/(?:^|;\s*)XSRF-TOKEN=([^;]+)/))===null||o===void 0?void 0:o[1];return i&&(this.antiCsrfToken=i),this._result}applyHeader(r){this.antiCsrfToken&&Zr(r,{"X-Xsrf-Token":this.antiCsrfToken})}}function pd({url:t,username:r,password:e,token:n,wat:a,ssoEnabled:o=!1,enableSilentPreAuth:s=!1,useFusionAuth:i=!1}){const u=xn(t);return o?new rd(u,s):r&&e?new ud(u,r,e):n?new Zu(u,n):a?new nd(u,a):i?new fd:null}var hd=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class md{constructor(r,e,n){this.url=xn(r),this.auth=e,this.env=n}login(){return this.auth.authenticate()}call(r,e,n){return hd(this,void 0,void 0,function*(){this.auth.isAuthenticating()&&(yield this.auth.authenticated()),e.headers=e.headers||{},dl(this.auth)&&(e.credentials="include"),this.auth.applyHeader(e.headers);const a=n!=null&&n.skipTrackingParam?r:cl(r,{trc:this.env}),o=yield fetch(a,e).then(ld(this.auth)).catch(ea);if(!(o.status===204||o.status===304))return n!=null&&n.returnBlob?o.blob():o.json().catch(s=>{var i,u;if(!(!((u=(i=s==null?void 0:s.message)===null||i===void 0?void 0:i.includes)===null||u===void 0)&&u.call(i,"Unexpected end of JSON input")))throw s})})}post(r,e,n={},a,o){const s=Object.assign({method:"POST",body:o!=null&&o.nonJSONBody?e:JSON.stringify(e),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:a},n);return this.call(this.url+r,s,o)}patch(r,e,n={},a,o){const s=Object.assign({method:"PATCH",body:o!=null&&o.nonJSONBody?e:JSON.stringify(e),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json;charset=UTF-8"},signal:a},n);return this.call(this.url+r,s,o)}get(r,e={},n){return this.call(this.url+r,Object.assign(Object.assign({},e),{method:"GET"}),n)}delete(r,e={},n){return this.call(this.url+r,Object.assign(Object.assign({},e),{method:"DELETE"}),n)}}const gd={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.'}},yd={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}}". Переконайтесь що джерело існує і доступне.'}},fl="sdkQueryClient",bd={en:gd,uk:yd};function vd(){return h.initI18next({resource:bd,language:"en",namespace:fl})}const{i18nextInstance:wd}=vd();var We={},pl={},ta={},ko={};(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(a,o,s,i){function u(l){return l instanceof s?l:new s(function(c){c(l)})}return new(s||(s=Promise))(function(l,c){function d(g){try{m(i.next(g))}catch(v){c(v)}}function p(g){try{m(i.throw(g))}catch(v){c(v)}}function m(g){g.done?l(g.value):u(g.value).then(d,p)}m((i=i.apply(a,o||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Task=t.ExecutionResultStatus=void 0;var e;(function(a){a.SUCCESS="SUCCESS",a.ERROR="ERROR"})(e=t.ExecutionResultStatus||(t.ExecutionResultStatus={}));class n{constructor(o,s,i){this.steps=o,this.passport=s,this.addons=i,this.statistics={startTime:new Date,steps:[],runtimeInfo:{}},this.currentStep=void 0}run(o){return r(this,void 0,void 0,function*(){let s=o,i;for(let l=0;l<this.steps.length;l+=1){this.currentStep=this.steps[l];const{resultValue:c,info:d}=yield this.currentStep.run(this,s);if(this.statistics.steps.push(d),d.success)s=c;else{i=d.error;break}}const u=this.statistics.steps.length===this.steps.length&&this.statistics.steps.every(l=>l.success);return this.statistics.endTime=new Date,{status:u?e.SUCCESS:e.ERROR,error:i,result:u?s:void 0,statistics:this.statistics}})}cancel(o){var s;return r(this,void 0,void 0,function*(){yield(s=this.currentStep)===null||s===void 0?void 0:s.cancel(this,o)})}addRuntimeInfo(o,s){this.statistics.runtimeInfo[o]=s}emitAddonEvent(o,...s){var i;const u=o.split("."),l=u[0],c=u[1],d=(i=this.addons)===null||i===void 0?void 0:i.find(m=>m.addonName===l),p=(d==null?void 0:d.events)[c];p(...s)}}t.Task=n})(ko);var Sa=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};Object.defineProperty(ta,"__esModule",{value:!0});ta.AbstractTaskManager=void 0;const xd=ko;class Dd{constructor(r){this.runningTasks=new Map,this.addons=r||[]}runTask(r){return Sa(this,void 0,void 0,function*(){const{taskId:e}=r.passport;this.runningTasks.set(e,r);const n=yield r.run();return this.runningTasks.delete(e),n})}createFlow(r){return e=>Sa(this,void 0,void 0,function*(){const n=new xd.Task(r,e,this.addons);return this.runTask(n)})}cancel(r,e){return Sa(this,void 0,void 0,function*(){const n=this.runningTasks.get(r);n&&(yield n.cancel(e))})}}ta.AbstractTaskManager=Dd;var na={},Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.TaskCanceledError=void 0;class Cd extends Error{constructor(r){const e=`Task was canceled due to: "${r}"`;super(e)}}Xn.TaskCanceledError=Cd;var js=h.commonjsGlobal&&h.commonjsGlobal.__awaiter||function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};Object.defineProperty(na,"__esModule",{value:!0});na.Step=void 0;const kd=Xn;class _d{constructor(r,e,n){this.taskSelfResolvers=new Map,this.taskStepInfos=new Map,this.name=r,this.runLogic=e,this.cancelLogic=n}run(r,e){return js(this,void 0,void 0,function*(){return this.addStepInfo(r,{name:this.name}),new Promise(n=>{const a=new Date,o=(s,i)=>{const u=new Date,l=u.getTime()-a.getTime();this.addStepInfo(r,{startTime:a,endTime:u,duration:l}),this.addStepInfo(r,i?{success:!1,error:i}:{success:!0}),n({resultValue:s,info:this.getStepInfo(r)})};this.taskSelfResolvers.set(r,o),this.runLogic(r,e).then(s=>o(s)).finally(()=>{this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r)}).catch(s=>o(void 0,s))})})}cancel(r,e){return js(this,void 0,void 0,function*(){this.addStepInfo(r,{wasCanceled:!0,cancelingReason:e});const n=this.taskSelfResolvers.get(r);n==null||n(void 0,new kd.TaskCanceledError(e)),this.taskSelfResolvers.delete(r),this.taskStepInfos.delete(r),yield this.cancelLogic(r,e)})}addStepInfo(r,e){const n=this.taskStepInfos.get(r)||{},a=Object.assign(Object.assign({},n),e);this.taskStepInfos.set(r,a)}getStepInfo(r){return this.taskStepInfos.get(r)}}na.Step=_d;var ra={};Object.defineProperty(ra,"__esModule",{value:!0});ra.Addon=void 0;class Td{constructor(){this.events={}}}ra.Addon=Td;var aa={},ur,Sd=new Uint8Array(16);function hl(){if(!ur&&(ur=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ur))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ur(Sd)}const Ed=/^(?:[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 oa(t){return typeof t=="string"&&Ed.test(t)}var ke=[];for(var Ea=0;Ea<256;++Ea)ke.push((Ea+256).toString(16).substr(1));function sa(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(ke[t[r+0]]+ke[t[r+1]]+ke[t[r+2]]+ke[t[r+3]]+"-"+ke[t[r+4]]+ke[t[r+5]]+"-"+ke[t[r+6]]+ke[t[r+7]]+"-"+ke[t[r+8]]+ke[t[r+9]]+"-"+ke[t[r+10]]+ke[t[r+11]]+ke[t[r+12]]+ke[t[r+13]]+ke[t[r+14]]+ke[t[r+15]]).toLowerCase();if(!oa(e))throw TypeError("Stringified UUID is invalid");return e}var Ws,Pa,Ma=0,Aa=0;function Pd(t,r,e){var n=r&&e||0,a=r||new Array(16);t=t||{};var o=t.node||Ws,s=t.clockseq!==void 0?t.clockseq:Pa;if(o==null||s==null){var i=t.random||(t.rng||hl)();o==null&&(o=Ws=[i[0]|1,i[1],i[2],i[3],i[4],i[5]]),s==null&&(s=Pa=(i[6]<<8|i[7])&16383)}var u=t.msecs!==void 0?t.msecs:Date.now(),l=t.nsecs!==void 0?t.nsecs:Aa+1,c=u-Ma+(l-Aa)/1e4;if(c<0&&t.clockseq===void 0&&(s=s+1&16383),(c<0||u>Ma)&&t.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ma=u,Aa=l,Pa=s,u+=122192928e5;var d=((u&268435455)*1e4+l)%4294967296;a[n++]=d>>>24&255,a[n++]=d>>>16&255,a[n++]=d>>>8&255,a[n++]=d&255;var p=u/4294967296*1e4&268435455;a[n++]=p>>>8&255,a[n++]=p&255,a[n++]=p>>>24&15|16,a[n++]=p>>>16&255,a[n++]=s>>>8|128,a[n++]=s&255;for(var m=0;m<6;++m)a[n+m]=o[m];return r||sa(a)}function ml(t){if(!oa(t))throw TypeError("Invalid UUID");var r,e=new Uint8Array(16);return e[0]=(r=parseInt(t.slice(0,8),16))>>>24,e[1]=r>>>16&255,e[2]=r>>>8&255,e[3]=r&255,e[4]=(r=parseInt(t.slice(9,13),16))>>>8,e[5]=r&255,e[6]=(r=parseInt(t.slice(14,18),16))>>>8,e[7]=r&255,e[8]=(r=parseInt(t.slice(19,23),16))>>>8,e[9]=r&255,e[10]=(r=parseInt(t.slice(24,36),16))/1099511627776&255,e[11]=r/4294967296&255,e[12]=r>>>24&255,e[13]=r>>>16&255,e[14]=r>>>8&255,e[15]=r&255,e}function Md(t){t=unescape(encodeURIComponent(t));for(var r=[],e=0;e<t.length;++e)r.push(t.charCodeAt(e));return r}var Ad="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Od="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gl(t,r,e){function n(a,o,s,i){if(typeof a=="string"&&(a=Md(a)),typeof o=="string"&&(o=ml(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+a.length);if(u.set(o),u.set(a,o.length),u=e(u),u[6]=u[6]&15|r,u[8]=u[8]&63|128,s){i=i||0;for(var l=0;l<16;++l)s[i+l]=u[l];return s}return sa(u)}try{n.name=t}catch(a){}return n.DNS=Ad,n.URL=Od,n}function Fd(t){if(typeof t=="string"){var r=unescape(encodeURIComponent(t));t=new Uint8Array(r.length);for(var e=0;e<r.length;++e)t[e]=r.charCodeAt(e)}return Nd(Rd(Id(t),t.length*8))}function Nd(t){for(var r=[],e=t.length*32,n="0123456789abcdef",a=0;a<e;a+=8){var o=t[a>>5]>>>a%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(o&15),16);r.push(s)}return r}function yl(t){return(t+64>>>9<<4)+14+1}function Rd(t,r){t[r>>5]|=128<<r%32,t[yl(r)-1]=r;for(var e=1732584193,n=-271733879,a=-1732584194,o=271733878,s=0;s<t.length;s+=16){var i=e,u=n,l=a,c=o;e=Te(e,n,a,o,t[s],7,-680876936),o=Te(o,e,n,a,t[s+1],12,-389564586),a=Te(a,o,e,n,t[s+2],17,606105819),n=Te(n,a,o,e,t[s+3],22,-1044525330),e=Te(e,n,a,o,t[s+4],7,-176418897),o=Te(o,e,n,a,t[s+5],12,1200080426),a=Te(a,o,e,n,t[s+6],17,-1473231341),n=Te(n,a,o,e,t[s+7],22,-45705983),e=Te(e,n,a,o,t[s+8],7,1770035416),o=Te(o,e,n,a,t[s+9],12,-1958414417),a=Te(a,o,e,n,t[s+10],17,-42063),n=Te(n,a,o,e,t[s+11],22,-1990404162),e=Te(e,n,a,o,t[s+12],7,1804603682),o=Te(o,e,n,a,t[s+13],12,-40341101),a=Te(a,o,e,n,t[s+14],17,-1502002290),n=Te(n,a,o,e,t[s+15],22,1236535329),e=Se(e,n,a,o,t[s+1],5,-165796510),o=Se(o,e,n,a,t[s+6],9,-1069501632),a=Se(a,o,e,n,t[s+11],14,643717713),n=Se(n,a,o,e,t[s],20,-373897302),e=Se(e,n,a,o,t[s+5],5,-701558691),o=Se(o,e,n,a,t[s+10],9,38016083),a=Se(a,o,e,n,t[s+15],14,-660478335),n=Se(n,a,o,e,t[s+4],20,-405537848),e=Se(e,n,a,o,t[s+9],5,568446438),o=Se(o,e,n,a,t[s+14],9,-1019803690),a=Se(a,o,e,n,t[s+3],14,-187363961),n=Se(n,a,o,e,t[s+8],20,1163531501),e=Se(e,n,a,o,t[s+13],5,-1444681467),o=Se(o,e,n,a,t[s+2],9,-51403784),a=Se(a,o,e,n,t[s+7],14,1735328473),n=Se(n,a,o,e,t[s+12],20,-1926607734),e=Ee(e,n,a,o,t[s+5],4,-378558),o=Ee(o,e,n,a,t[s+8],11,-2022574463),a=Ee(a,o,e,n,t[s+11],16,1839030562),n=Ee(n,a,o,e,t[s+14],23,-35309556),e=Ee(e,n,a,o,t[s+1],4,-1530992060),o=Ee(o,e,n,a,t[s+4],11,1272893353),a=Ee(a,o,e,n,t[s+7],16,-155497632),n=Ee(n,a,o,e,t[s+10],23,-1094730640),e=Ee(e,n,a,o,t[s+13],4,681279174),o=Ee(o,e,n,a,t[s],11,-358537222),a=Ee(a,o,e,n,t[s+3],16,-722521979),n=Ee(n,a,o,e,t[s+6],23,76029189),e=Ee(e,n,a,o,t[s+9],4,-640364487),o=Ee(o,e,n,a,t[s+12],11,-421815835),a=Ee(a,o,e,n,t[s+15],16,530742520),n=Ee(n,a,o,e,t[s+2],23,-995338651),e=Pe(e,n,a,o,t[s],6,-198630844),o=Pe(o,e,n,a,t[s+7],10,1126891415),a=Pe(a,o,e,n,t[s+14],15,-1416354905),n=Pe(n,a,o,e,t[s+5],21,-57434055),e=Pe(e,n,a,o,t[s+12],6,1700485571),o=Pe(o,e,n,a,t[s+3],10,-1894986606),a=Pe(a,o,e,n,t[s+10],15,-1051523),n=Pe(n,a,o,e,t[s+1],21,-2054922799),e=Pe(e,n,a,o,t[s+8],6,1873313359),o=Pe(o,e,n,a,t[s+15],10,-30611744),a=Pe(a,o,e,n,t[s+6],15,-1560198380),n=Pe(n,a,o,e,t[s+13],21,1309151649),e=Pe(e,n,a,o,t[s+4],6,-145523070),o=Pe(o,e,n,a,t[s+11],10,-1120210379),a=Pe(a,o,e,n,t[s+2],15,718787259),n=Pe(n,a,o,e,t[s+9],21,-343485551),e=Tt(e,i),n=Tt(n,u),a=Tt(a,l),o=Tt(o,c)}return[e,n,a,o]}function Id(t){if(t.length===0)return[];for(var r=t.length*8,e=new Uint32Array(yl(r)),n=0;n<r;n+=8)e[n>>5]|=(t[n/8]&255)<<n%32;return e}function Tt(t,r){var e=(t&65535)+(r&65535),n=(t>>16)+(r>>16)+(e>>16);return n<<16|e&65535}function Ld(t,r){return t<<r|t>>>32-r}function ia(t,r,e,n,a,o){return Tt(Ld(Tt(Tt(r,t),Tt(n,o)),a),e)}function Te(t,r,e,n,a,o,s){return ia(r&e|~r&n,t,r,a,o,s)}function Se(t,r,e,n,a,o,s){return ia(r&n|e&~n,t,r,a,o,s)}function Ee(t,r,e,n,a,o,s){return ia(r^e^n,t,r,a,o,s)}function Pe(t,r,e,n,a,o,s){return ia(e^(r|~n),t,r,a,o,s)}var jd=gl("v3",48,Fd);const Wd=jd;function Yd(t,r,e){t=t||{};var n=t.random||(t.rng||hl)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){e=e||0;for(var a=0;a<16;++a)r[e+a]=n[a];return r}return sa(n)}function Bd(t,r,e,n){switch(t){case 0:return r&e^~r&n;case 1:return r^e^n;case 2:return r&e^r&n^e&n;case 3:return r^e^n}}function Oa(t,r){return t<<r|t>>>32-r}function Hd(t){var r=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var a=0;a<n.length;++a)t.push(n.charCodeAt(a))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,s=Math.ceil(o/16),i=new Array(s),u=0;u<s;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];i[u]=l}i[s-1][14]=(t.length-1)*8/Math.pow(2,32),i[s-1][14]=Math.floor(i[s-1][14]),i[s-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<s;++d){for(var p=new Uint32Array(80),m=0;m<16;++m)p[m]=i[d][m];for(var g=16;g<80;++g)p[g]=Oa(p[g-3]^p[g-8]^p[g-14]^p[g-16],1);for(var v=e[0],b=e[1],x=e[2],C=e[3],_=e[4],S=0;S<80;++S){var O=Math.floor(S/20),j=Oa(v,5)+Bd(O,b,x,C)+_+r[O]+p[S]>>>0;_=C,C=x,x=Oa(b,30)>>>0,b=v,v=j}e[0]=e[0]+v>>>0,e[1]=e[1]+b>>>0,e[2]=e[2]+x>>>0,e[3]=e[3]+C>>>0,e[4]=e[4]+_>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var $d=gl("v5",80,Hd);const qd=$d,Qd="00000000-0000-0000-0000-000000000000";function Ud(t){if(!oa(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const zd=Object.freeze(Object.defineProperty({__proto__:null,NIL:Qd,parse:ml,stringify:sa,v1:Pd,v3:Wd,v4:Yd,v5:qd,validate:oa,version:Ud},Symbol.toStringTag,{value:"Module"})),Gd=h.getAugmentedNamespace(zd);Object.defineProperty(aa,"__esModule",{value:!0});aa.TaskPassport=void 0;const Vd=Gd;class Kd{constructor(){this.taskId=(0,Vd.v4)()}}aa.TaskPassport=Kd;(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__createBinding||(Object.create?function(n,a,o,s){s===void 0&&(s=o);var i=Object.getOwnPropertyDescriptor(a,o);(!i||("get"in i?!a.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(n,s,i)}:function(n,a,o,s){s===void 0&&(s=o),n[s]=a[o]}),e=h.commonjsGlobal&&h.commonjsGlobal.__exportStar||function(n,a){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&r(a,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),e(ta,t),e(na,t),e(ko,t),e(ra,t),e(aa,t),e(Xn,t)})(pl);(function(t){var r=h.commonjsGlobal&&h.commonjsGlobal.__createBinding||(Object.create?function(n,a,o,s){s===void 0&&(s=o);var i=Object.getOwnPropertyDescriptor(a,o);(!i||("get"in i?!a.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(n,s,i)}:function(n,a,o,s){s===void 0&&(s=o),n[s]=a[o]}),e=h.commonjsGlobal&&h.commonjsGlobal.__exportStar||function(n,a){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&r(a,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),e(pl,t)})(We);const bl=t=>{if(t!==void 0)return`${t}`},vl=t=>{if(t!==void 0)return new Date(t).toISOString()},_o=()=>!1;function Ys(t,r){const e=r.filter;return"or"in e?n=>e.or.map(a=>t(Object.assign(Object.assign({},r),{filter:a}))).reduce((a,o)=>a||o(n),!1):"and"in e?n=>e.and.map(a=>t(Object.assign(Object.assign({},r),{filter:a}))).reduce((a,o)=>a&&o(n),!0):t(r)}function Xd(t){const{datatype:r}=t,e=t.filter,n=r==="datetime"?vl:bl;return a=>{const o=e.members.map(n),s=n(a);return o.includes(s)}}function Jd(t){const{datatype:r}=t,e=t.filter,n=r==="datetime"?vl:bl;return a=>{var o,s;const i=((s=(o=e.exclude)===null||o===void 0?void 0:o.members)===null||s===void 0?void 0:s.map(n))||[],u=n(a);return!i.includes(u)}}function Zd(t){const r=t.filter,e=h.getSelectedConditionOption(r);return e===h.ConditionFilterType.STARTS_WITH?n=>new RegExp(`^${r.startsWith}`,"i").test(n):e===h.ConditionFilterType.ENDS_WITH?n=>new RegExp(`${r.endsWith}$`,"i").test(n):e===h.ConditionFilterType.CONTAINS?n=>new RegExp(r.contains,"i").test(n):e===h.ConditionFilterType.EQUALS?n=>n.localeCompare(r.equals,void 0,{sensitivity:"base"})===0:e===h.ConditionFilterType.DOESNT_START_WITH?n=>!new RegExp(`^${r.doesntStartWith}`,"i").test(n):e===h.ConditionFilterType.DOESNT_END_WITH?n=>!new RegExp(`${r.doesntEndWith}$`,"i").test(n):e===h.ConditionFilterType.DOESNT_CONTAIN?n=>!new RegExp(r.doesntContain,"i").test(n):e===h.ConditionFilterType.DOESNT_EQUAL?n=>n.localeCompare(r.doesntEqual,void 0,{sensitivity:"base"})!==0:_o}function ef(t){const r=t.filter,e=h.getSelectedConditionOption(r);return e===h.ConditionFilterType.EQUALS?n=>Number(r.equals)===Number(n):e===h.ConditionFilterType.DOESNT_EQUAL?n=>Number(r.doesntEqual)!==Number(n):e===h.ConditionFilterType.LESS_THAN?n=>Number(n)<Number(r.toNotEqual):e===h.ConditionFilterType.GREATER_THAN?n=>Number(n)>Number(r.fromNotEqual):e===h.ConditionFilterType.BETWEEN?n=>Number(r.to)>=Number(n)&&Number(n)>=Number(r.from):e===h.ConditionFilterType.GREATER_THAN_OR_EQUAL?n=>Number(n)>=Number(r.from):e===h.ConditionFilterType.LESS_THAN_OR_EQUAL?n=>Number(r.to)>=Number(n):_o}function tf(t){const r=t,{datatype:e}=r,n=r.filter;return h.isSpecificItemsFilter(n)?Xd(r):h.isConditionFilter(n)&&h.getSelectedConditionOption(n)===h.ConditionFilterType.IS_NOT?Jd(r):e==="text"?Ys(Zd,r):e==="numeric"?Ys(ef,r):_o}var wl={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(t){(function(r,e){t.exports?t.exports=e():r.numeral=e()})(h.commonjsGlobal,function(){var r,e,n="2.0.6",a={},o={},s={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},i={currentLocale:s.currentLocale,zeroFormat:s.zeroFormat,nullFormat:s.nullFormat,defaultFormat:s.defaultFormat,scalePercentBy100:s.scalePercentBy100};function u(l,c){this._input=l,this._value=c}return r=function(l){var c,d,p,m;if(r.isNumeral(l))c=l.value();else if(l===0||typeof l=="undefined")c=0;else if(l===null||e.isNaN(l))c=null;else if(typeof l=="string")if(i.zeroFormat&&l===i.zeroFormat)c=0;else if(i.nullFormat&&l===i.nullFormat||!l.replace(/[^0-9]+/g,"").length)c=null;else{for(d in a)if(m=typeof a[d].regexps.unformat=="function"?a[d].regexps.unformat():a[d].regexps.unformat,m&&l.match(m)){p=a[d].unformat;break}p=p||r._.stringToNumber,c=p(l)}else c=Number(l)||null;return new u(l,c)},r.version=n,r.isNumeral=function(l){return l instanceof u},r._=e={numberToFormat:function(l,c,d){var p=o[r.options.currentLocale],m=!1,g=!1,v=0,b="",x=1e12,C=1e9,_=1e6,S=1e3,O="",j=!1,B,H,R,I,P,Y,$;if(l=l||0,H=Math.abs(l),r._.includes(c,"(")?(m=!0,c=c.replace(/[\(|\)]/g,"")):(r._.includes(c,"+")||r._.includes(c,"-"))&&(P=r._.includes(c,"+")?c.indexOf("+"):l<0?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),r._.includes(c,"a")&&(B=c.match(/a(k|m|b|t)?/),B=B?B[1]:!1,r._.includes(c," a")&&(b=" "),c=c.replace(new RegExp(b+"a[kmbt]?"),""),H>=x&&!B||B==="t"?(b+=p.abbreviations.trillion,l=l/x):H<x&&H>=C&&!B||B==="b"?(b+=p.abbreviations.billion,l=l/C):H<C&&H>=_&&!B||B==="m"?(b+=p.abbreviations.million,l=l/_):(H<_&&H>=S&&!B||B==="k")&&(b+=p.abbreviations.thousand,l=l/S)),r._.includes(c,"[.]")&&(g=!0,c=c.replace("[.]",".")),R=l.toString().split(".")[0],I=c.split(".")[1],Y=c.indexOf(","),v=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,I?(r._.includes(I,"[")?(I=I.replace("]",""),I=I.split("["),O=r._.toFixed(l,I[0].length+I[1].length,d,I[1].length)):O=r._.toFixed(l,I.length,d),R=O.split(".")[0],r._.includes(O,".")?O=p.delimiters.decimal+O.split(".")[1]:O="",g&&Number(O.slice(1))===0&&(O="")):R=r._.toFixed(l,0,d),b&&!B&&Number(R)>=1e3&&b!==p.abbreviations.trillion)switch(R=String(Number(R)/1e3),b){case p.abbreviations.thousand:b=p.abbreviations.million;break;case p.abbreviations.million:b=p.abbreviations.billion;break;case p.abbreviations.billion:b=p.abbreviations.trillion;break}if(r._.includes(R,"-")&&(R=R.slice(1),j=!0),R.length<v)for(var N=v-R.length;N>0;N--)R="0"+R;return Y>-1&&(R=R.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+p.delimiters.thousands)),c.indexOf(".")===0&&(R=""),$=R+O+(b||""),m?$=(m&&j?"(":"")+$+(m&&j?")":""):P>=0?$=P===0?(j?"-":"+")+$:$+(j?"-":"+"):j&&($="-"+$),$},stringToNumber:function(l){var c=o[i.currentLocale],d=l,p={thousand:3,million:6,billion:9,trillion:12},m,g,v;if(i.zeroFormat&&l===i.zeroFormat)g=0;else if(i.nullFormat&&l===i.nullFormat||!l.replace(/[^0-9]+/g,"").length)g=null;else{g=1,c.delimiters.decimal!=="."&&(l=l.replace(/\./g,"").replace(c.delimiters.decimal,"."));for(m in p)if(v=new RegExp("[^a-zA-Z]"+c.abbreviations[m]+"(?:\\)|(\\"+c.currency.symbol+")?(?:\\))?)?$"),d.match(v)){g*=Math.pow(10,p[m]);break}g*=(l.split("-").length+Math.min(l.split("(").length-1,l.split(")").length-1))%2?1:-1,l=l.replace(/[^0-9\.]+/g,""),g*=Number(l)}return g},isNaN:function(l){return typeof l=="number"&&isNaN(l)},includes:function(l,c){return l.indexOf(c)!==-1},insert:function(l,c,d){return l.slice(0,d)+c+l.slice(d)},reduce:function(l,c){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof c!="function")throw new TypeError(c+" is not a function");var d=Object(l),p=d.length>>>0,m=0,g;if(arguments.length===3)g=arguments[2];else{for(;m<p&&!(m in d);)m++;if(m>=p)throw new TypeError("Reduce of empty array with no initial value");g=d[m++]}for(;m<p;m++)m in d&&(g=c(g,d[m],m,d));return g},multiplier:function(l){var c=l.toString().split(".");return c.length<2?1:Math.pow(10,c[1].length)},correctionFactor:function(){var l=Array.prototype.slice.call(arguments);return l.reduce(function(c,d){var p=e.multiplier(d);return c>p?c:p},1)},toFixed:function(l,c,d,p){var m=l.toString().split("."),g=c-(p||0),v,b,x,C;return m.length===2?v=Math.min(Math.max(m[1].length,g),c):v=g,x=Math.pow(10,v),C=(d(l+"e+"+v)/x).toFixed(v),p>c-v&&(b=new RegExp("\\.?0{1,"+(p-(c-v))+"}$"),C=C.replace(b,"")),C}},r.options=i,r.formats=a,r.locales=o,r.locale=function(l){return l&&(i.currentLocale=l.toLowerCase()),i.currentLocale},r.localeData=function(l){if(!l)return o[i.currentLocale];if(l=l.toLowerCase(),!o[l])throw new Error("Unknown locale : "+l);return o[l]},r.reset=function(){for(var l in s)i[l]=s[l]},r.zeroFormat=function(l){i.zeroFormat=typeof l=="string"?l:null},r.nullFormat=function(l){i.nullFormat=typeof l=="string"?l:null},r.defaultFormat=function(l){i.defaultFormat=typeof l=="string"?l:"0.0"},r.register=function(l,c,d){if(c=c.toLowerCase(),this[l+"s"][c])throw new TypeError(c+" "+l+" already registered.");return this[l+"s"][c]=d,d},r.validate=function(l,c){var d,p,m,g,v,b,x,C;if(typeof l!="string"&&(l+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",l)),l=l.trim(),l.match(/^\d+$/))return!0;if(l==="")return!1;try{x=r.localeData(c)}catch(_){x=r.localeData(r.locale())}return m=x.currency.symbol,v=x.abbreviations,d=x.delimiters.decimal,x.delimiters.thousands==="."?p="\\.":p=x.delimiters.thousands,C=l.match(/^[^\d]+/),C!==null&&(l=l.substr(1),C[0]!==m)||(C=l.match(/[^\d]+$/),C!==null&&(l=l.slice(0,-1),C[0]!==v.thousand&&C[0]!==v.million&&C[0]!==v.billion&&C[0]!==v.trillion))?!1:(b=new RegExp(p+"{2}"),l.match(/[^\d.,]/g)?!1:(g=l.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(b):g[0].length===1?!!g[0].match(/^\d+$/)&&!g[0].match(b)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(b)&&!!g[1].match(/^\d+$/)))},r.fn=u.prototype={clone:function(){return r(this)},format:function(l,c){var d=this._value,p=l||i.defaultFormat,m,g,v;if(c=c||Math.round,d===0&&i.zeroFormat!==null)g=i.zeroFormat;else if(d===null&&i.nullFormat!==null)g=i.nullFormat;else{for(m in a)if(p.match(a[m].regexps.format)){v=a[m].format;break}v=v||r._.numberToFormat,g=v(d,p,c)}return g},value:function(){return this._value},input:function(){return this._input},set:function(l){return this._value=Number(l),this},add:function(l){var c=e.correctionFactor.call(null,this._value,l);function d(p,m,g,v){return p+Math.round(c*m)}return this._value=e.reduce([this._value,l],d,0)/c,this},subtract:function(l){var c=e.correctionFactor.call(null,this._value,l);function d(p,m,g,v){return p-Math.round(c*m)}return this._value=e.reduce([l],d,Math.round(this._value*c))/c,this},multiply:function(l){function c(d,p,m,g){var v=e.correctionFactor(d,p);return Math.round(d*v)*Math.round(p*v)/Math.round(v*v)}return this._value=e.reduce([this._value,l],c,1),this},divide:function(l){function c(d,p,m,g){var v=e.correctionFactor(d,p);return Math.round(d*v)/Math.round(p*v)}return this._value=e.reduce([this._value,l],c),this},difference:function(l){return Math.abs(r(this._value).subtract(l).value())}},r.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(l){var c=l%10;return~~(l%100/10)===1?"th":c===1?"st":c===2?"nd":c===3?"rd":"th"},currency:{symbol:"$"}}),function(){r.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(l,c,d){var p=r._.includes(c," BPS")?" ":"",m;return l=l*1e4,c=c.replace(/\s?BPS/,""),m=r._.numberToFormat(l,c,d),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,p+"BPS"),m=m.join("")):m=m+p+"BPS",m},unformat:function(l){return+(r._.stringToNumber(l)*1e-4).toFixed(15)}})}(),function(){var l={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=l.suffixes.concat(c.suffixes.filter(function(m){return l.suffixes.indexOf(m)<0})),p=d.join("|");p="("+p.replace("B","B(?!PS)")+")",r.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(p)},format:function(m,g,v){var b,x=r._.includes(g,"ib")?c:l,C=r._.includes(g," b")||r._.includes(g," ib")?" ":"",_,S,O;for(g=g.replace(/\s?i?b/,""),_=0;_<=x.suffixes.length;_++)if(S=Math.pow(x.base,_),O=Math.pow(x.base,_+1),m===null||m===0||m>=S&&m<O){C+=x.suffixes[_],S>0&&(m=m/S);break}return b=r._.numberToFormat(m,g,v),b+C},unformat:function(m){var g=r._.stringToNumber(m),v,b;if(g){for(v=l.suffixes.length-1;v>=0;v--){if(r._.includes(m,l.suffixes[v])){b=Math.pow(l.base,v);break}if(r._.includes(m,c.suffixes[v])){b=Math.pow(c.base,v);break}}g*=b||1}return g}})}(),function(){r.register("format","currency",{regexps:{format:/(\$)/},format:function(l,c,d){var p=r.locales[r.options.currentLocale],m={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]},g,v,b;for(c=c.replace(/\s?\$\s?/,""),g=r._.numberToFormat(l,c,d),l>=0?(m.before=m.before.replace(/[\-\(]/,""),m.after=m.after.replace(/[\-\)]/,"")):l<0&&!r._.includes(m.before,"-")&&!r._.includes(m.before,"(")&&(m.before="-"+m.before),b=0;b<m.before.length;b++)switch(v=m.before[b],v){case"$":g=r._.insert(g,p.currency.symbol,b);break;case" ":g=r._.insert(g," ",b+p.currency.symbol.length-1);break}for(b=m.after.length-1;b>=0;b--)switch(v=m.after[b],v){case"$":g=b===m.after.length-1?g+p.currency.symbol:r._.insert(g,p.currency.symbol,-(m.after.length-(1+b)));break;case" ":g=b===m.after.length-1?g+" ":r._.insert(g," ",-(m.after.length-(1+b)+p.currency.symbol.length-1));break}return g}})}(),function(){r.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(l,c,d){var p,m=typeof l=="number"&&!r._.isNaN(l)?l.toExponential():"0e+0",g=m.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),p=r._.numberToFormat(Number(g[0]),c,d),p+"e"+g[1]},unformat:function(l){var c=r._.includes(l,"e+")?l.split("e+"):l.split("e-"),d=Number(c[0]),p=Number(c[1]);p=r._.includes(l,"e-")?p*=-1:p;function m(g,v,b,x){var C=r._.correctionFactor(g,v),_=g*C*(v*C)/(C*C);return _}return r._.reduce([d,Math.pow(10,p)],m,1)}})}(),function(){r.register("format","ordinal",{regexps:{format:/(o)/},format:function(l,c,d){var p=r.locales[r.options.currentLocale],m,g=r._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=p.ordinal(l),m=r._.numberToFormat(l,c,d),m+g}})}(),function(){r.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(l,c,d){var p=r._.includes(c," %")?" ":"",m;return r.options.scalePercentBy100&&(l=l*100),c=c.replace(/\s?\%/,""),m=r._.numberToFormat(l,c,d),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,p+"%"),m=m.join("")):m=m+p+"%",m},unformat:function(l){var c=r._.stringToNumber(l);return r.options.scalePercentBy100?c*.01:c}})}(),function(){r.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(l,c,d){var p=Math.floor(l/60/60),m=Math.floor((l-p*60*60)/60),g=Math.round(l-p*60*60-m*60);return p+":"+(m<10?"0"+m:m)+":"+(g<10?"0"+g:g)},unformat:function(l){var c=l.split(":"),d=0;return c.length===3?(d=d+Number(c[0])*60*60,d=d+Number(c[1])*60,d=d+Number(c[2])):c.length===2&&(d=d+Number(c[0])*60,d=d+Number(c[1])),Number(d)}})}(),r})})(wl);var nf=wl.exports;const rf=h.getDefaultExportFromCjs(nf),af=(t,r)=>{const e=lf(t);return of(e,r)};function of(t,r){return{columns:r==null?void 0:r.map(e=>({name:e.name,type:h.simpleColumnType(e.type)})),rows:sf(t)}}function sf(t){var r;let e=!1;const n=(r=t[0])===null||r===void 0?void 0:r.map((a,o)=>{const s=t.some(i=>"selected"in i[o]);return s&&(e=!0),s});return t.map(a=>{const o=e?n.some((s,i)=>s&&!a[i].selected):void 0;return a.map(s=>o!==void 0?{data:s.data,text:s.text,blur:o}:{data:s.data,text:s.text})})}function lf({values:t=[],metadata:r=[]}){var e,n,a,o;t[0]&&!Array.isArray(t[0])&&(t=[t]);for(let s=0;s<t.length;s++){const i=t[s];for(let u=0;u<i.length;u++)r[u].format&&(!((n=(e=r[u])===null||e===void 0?void 0:e.format)===null||n===void 0)&&n.number)&&(i[u].text=rf(i[u].data).format((o=(a=r[u])===null||a===void 0?void 0:a.format)===null||o===void 0?void 0:o.number))}return t}class Me extends h.AbstractTranslatableError{constructor(r,e){super(fl,{key:r,interpolationOptions:e},wd.t)}get status(){return this.interpolationOptions.status}}var Lt=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class cf extends We.AbstractTaskManager{constructor(r,e){super(),this.sentRequestsAbortersMap=new Map,this.executeQuerySending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_JAQL_QUERY",this.sendJaqlQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executeDownloadCsvSending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_DOWNLOAD_CSV_QUERY",this.sendCsvQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executePivotQuerySending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.preparePivotJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_JAQL_QUERY",this.sendPivotJaqlQuery.bind(this),this.cancelPivotJaqlQuery.bind(this))]),this.queryApi=r,this.pivotClient=e}prepareJaqlPayload(r){return Lt(this,void 0,void 0,function*(){const{queryDescription:e,executionConfig:n}=r.passport,a=f.getJaqlQueryPayload(e,n.shouldSkipHighlightsWithoutAttributes),o=r.passport.executionConfig.onBeforeQuery;return o?o(a):a})}sendJaqlQuery(r,e){return Lt(this,void 0,void 0,function*(){const{queryDescription:n,taskId:a}=r.passport,{responsePromise:o,abortHttpRequest:s}=this.queryApi.sendJaqlRequest(r.passport.queryDescription.dataSource,e);this.sentRequestsAbortersMap.set(a,s);const i=yield o.finally(()=>{this.sentRequestsAbortersMap.delete(a)});uf(i);const u=[...n.attributes,...n.measures],l=(i.headers||[]).slice(u.length).map(c=>({name:c,type:"number"}));return af(i,[...u,...l])})}sendCsvQuery(r,e){return Lt(this,void 0,void 0,function*(){const{taskId:n}=r.passport,{responsePromise:a,abortHttpRequest:o}=this.queryApi.sendDownloadCsvRequest(r.passport.queryDescription.dataSource,e);return this.sentRequestsAbortersMap.set(n,o),a.finally(()=>{this.sentRequestsAbortersMap.delete(n)})})}cancelDataRetrievalQuery(r){const e=r.passport.taskId,n=this.sentRequestsAbortersMap.get(e);return n&&(n(),this.sentRequestsAbortersMap.delete(e)),this.queryApi.sendCancelJaqlQueryRequest(e,r.passport.queryDescription.dataSource)}preparePivotJaqlPayload(r){return Lt(this,void 0,void 0,function*(){const{pivotQueryDescription:e,executionConfig:n}=r.passport,a=f.getPivotJaqlQueryPayload(e,n.shouldSkipHighlightsWithoutAttributes),o=r.passport.executionConfig.onBeforeQuery;return o?o(a):a})}sendPivotJaqlQuery(r,e){var n;const{pivotQueryDescription:a}=r.passport;return this.pivotClient.queryData(e,!0,(n=a.count)!==null&&n!==void 0?n:bf,!1)}cancelPivotJaqlQuery(r){const e=r.passport.taskId,n=this.sentRequestsAbortersMap.get(e);return n&&(n(),this.sentRequestsAbortersMap.delete(e)),this.queryApi.sendCancelJaqlQueryRequest(e,r.passport.pivotQueryDescription.dataSource)}}function uf(t){var r;if(!t)throw new Me("errors.noJaqlResponse");if(t.error)throw new Error(`${t.details} ${(r=t.database)!==null&&r!==void 0?r:""} ${t.extraDetails?JSON.stringify(t.extraDetails):""}`)}class Bs extends We.TaskPassport{constructor(r,e,n){super(),this.queryDescription=e,this.type=r,this.executionConfig=n}}class df extends We.TaskPassport{constructor(r,e,n){super(),this.pivotQueryDescription=e,this.type=r,this.executionConfig=n}}var ff=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};const Hn="api/datasources",pf="api/v2/datamodels";class hf{constructor(r){this.httpClient=r}getDataSourceFields(r,e=9999,n=0){const a=h.getDataSourceName(r),o=`${Hn}/${encodeURI(a)}/fields/search`;return this.httpClient.post(o,{offset:n,count:e}).catch(()=>{throw new Me("errors.dataSourceNotFound",{dataSource:typeof r=="string"?r:r.title})})}getDataSourceList(){const r=`${Hn}/?sharedWith=r,w`;return this.httpClient.get(r)}getDataSourceSchema(r){const e=`${pf}/schema?title=${encodeURIComponent(r)}`;return this.httpClient.get(e)}sendJaqlRequest(r,e){const n=xl(r),a=new AbortController;return{responsePromise:this.httpClient.post(n,e,void 0,a.signal).then(o=>Array.isArray(o)?{values:[],metadata:[]}:o),abortHttpRequest:o=>a.abort(o)}}sendDownloadCsvRequest(r,e){const n=yf(r),a=new AbortController,o=new URLSearchParams;return o.append("data",encodeURIComponent(JSON.stringify(e))),{responsePromise:this.httpClient.post(n,o,{headers:{"Content-Type":"application/x-www-form-urlencoded"}},a.signal,{nonJSONBody:!0,returnBlob:!0}),abortHttpRequest:s=>a.abort(s)}}sendCancelJaqlQueryRequest(r,e){return this.sendCancelMultipleJaqlQueriesRequest([r],e)}sendCancelMultipleJaqlQueriesRequest(r,e){return ff(this,void 0,void 0,function*(){const n={queries:r.join(";")},a=mf(e);try{yield this.httpClient.post(a,n)}catch(o){if(o.status==="404"){const s=gf(e);yield this.httpClient.post(s,n)}else throw o}})}}function mf(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/localhost/${r}/cancel_queries`}function gf(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/live/${r}/cancel_queries`}function xl(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/${r}/jaql`}function yf(t){return`${xl(t)}/csv`}var Hs=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};const bf=2e4,Fa="Unspecified reason";class vf{constructor(r,e=new f.ez(r.url,r.auth),n){xf(r),this.queryApi=new hf(r),this.taskManager=new cf(this.queryApi,e),this.shouldSkipHighlightsWithoutAttributes=n!=null?n:!1}executeQuery(r,e){const n=new Bs("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{$s(r),this.taskManager.executeQuerySending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}executeCsvQuery(r,e){const n=new Bs("SEND_DOWNLOAD_CSV_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{$s(r),this.taskManager.executeDownloadCsvSending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}executePivotQuery(r,e){const n=new df("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{wf(r),this.taskManager.executePivotQuerySending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}getDataSourceFields(r,e=9999,n=0){return Hs(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceFields(r,e,n))||[]})}getDataSourceSchema(r){return this.queryApi.getDataSourceSchema(r)}getDataSourceList(){return Hs(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceList())||[]})}}function $s(t){const{attributes:r,measures:e,filters:n,highlights:a,count:o,offset:s}=t;if(o&&o<0)throw new Me("errors.invalidCountNegative",{count:o.toString()});if(s&&s<0)throw new Me("errors.invalidOffset",{offset:s.toString()});if(r.length+e.length===0)throw new Me("errors.noDimensionsOrMeasures");r.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isAttribute(i)){const{name:u}=i;throw new Me("errors.invalidAttribute",{attributeName:u})}}),e.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isMeasure(i))throw new Me("errors.invalidMeasure",{measureName:i.name})}),n.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isFilter(i))throw new Me("errors.invalidFilter",{filterName:i.name})}),a.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isFilter(i))throw new Me("errors.invalidHighlight",{highlightName:i.name})})}function wf(t){const{rowsAttributes:r,columnsAttributes:e,measures:n,filters:a,highlights:o,count:s,offset:i}=t;if(s&&s<0)throw new Me("errors.invalidCountNegative",{count:s.toString()});if(i&&i<0)throw new Me("errors.invalidOffset",{offset:i.toString()});if(r.length+e.length+n.length===0)throw new Me("errors.noDimensionsOrMeasures");a.forEach(u=>{if(!u.skipValidation&&!h.MetadataTypes.isFilter(u))throw new Me("errors.invalidFilter",{filterName:u.name})}),o.forEach(u=>{if(!u.skipValidation&&!h.MetadataTypes.isFilter(u))throw new Me("errors.invalidHighlight",{highlightName:u.name})})}function xf(t){if(!t)throw new Me("errors.missingHttpClient");if(!t.post)throw new Me("errors.missingPostMethod")}const Df=2e4,Cf={enabled:!0,delay:500},kf={locale:f.getBaseDateFnsLocale(),dateConfig:f.defaultDateConfig,loadingIndicatorConfig:Cf,translationConfig:{language:"en",customTranslations:[]},language:"en",queryCacheConfig:{enabled:!1},queryLimit:Df,accessibilityConfig:{enabled:!1},errorBoundaryConfig:{alwaysShowErrorText:!1},trackingConfig:{enabled:!0}};function _f(t,r,e){return he(this,null,function*(){var a;const n=yield Sf(r,e);return h.merge.withOptions({mergeArrays:!1},kf,{locale:f.getBaseDateFnsLocale((a=t==null?void 0:t.translationConfig)==null?void 0:a.language)},n,t)})}function Tf(t){const r={};return t.forEach(e=>{r[e.key]=e}),r}function Sf(t,r=!1){return he(this,null,function*(){const e=yield t.get("api/globals");if(!e)throw new h.TranslatableError("errors.serverSettingsNotLoaded");const n=r?{colors:f.getDefaultThemeSettings().palette.variantColors}:yield f.getLegacyPalette(f.getPaletteName(e.designSettings),t);return{serverThemeSettings:f.convertToThemeSettings(e.designSettings,n,t.url),serverLanguage:e.language,serverVersion:e.version,serverFeatures:Tf(e.features),user:{tenant:{name:e.user.tenant.name}}}})}const Ef="system";function Pf(t,r){return r===Ef?t:t.replace(`/${r}`,"")}function Mf(){window.addEventListener("unhandledrejection",t=>{t.reason instanceof Error?console.error(t.reason.message):console.error(t.reason)})}const Dl=u=>he(exports,[u],function*({defaultDataSource:t,url:r,token:e,wat:n,ssoEnabled:a,appConfig:o,enableSilentPreAuth:s,useFusionAuth:i}){if(r===void 0)throw new h.TranslatableError("errors.sisenseContextNoAuthentication");const l=xn(r),c=pd({url:l,token:e,wat:n,ssoEnabled:a,enableSilentPreAuth:s,useFusionAuth:i});if(!c)throw new h.TranslatableError("errors.sisenseContextNoAuthentication");Mf();const d=new md(l,c,"sdk-ui-1.27.0"),p=yield d.login(),m=ul(c)||!p,g=yield _f(o||{},d,m),v=new f.ez(Pf(l,g.user.tenant.name),c),b=new vf(d,v),x={clear:f.clearExecuteQueryCache};return{httpClient:d,pivotClient:v,queryClient:b,settings:g,defaultDataSource:t,queryCache:x}}),Cl=G.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cl.displayName="FormControlContext");function Af(){return G.useContext(Cl)}function Of(t){return f.generateUtilityClass("PrivateSwitchBase",t)}f.generateUtilityClasses("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Ff=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],Nf=t=>{const{classes:r,checked:e,disabled:n,edge:a}=t,o={root:["root",e&&"checked",n&&"disabled",a&&`edge${f.capitalize(a)}`],input:["input"]};return f.composeClasses(o,Of,r)},Rf=f.styled(f.ButtonBase)(({ownerState:t})=>f._extends({padding:9,borderRadius:"50%"},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12})),If=f.styled("input",{shouldForwardProp:f.rootShouldForwardProp})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),kl=G.forwardRef(function(r,e){const{autoFocus:n,checked:a,checkedIcon:o,className:s,defaultChecked:i,disabled:u,disableFocusRipple:l=!1,edge:c=!1,icon:d,id:p,inputProps:m,inputRef:g,name:v,onBlur:b,onChange:x,onFocus:C,readOnly:_,required:S=!1,tabIndex:O,type:j,value:B}=r,H=f._objectWithoutPropertiesLoose(r,Ff),[R,I]=f.useControlled({controlled:a,default:!!i,name:"SwitchBase",state:"checked"}),P=Af(),Y=L=>{C&&C(L),P&&P.onFocus&&P.onFocus(L)},$=L=>{b&&b(L),P&&P.onBlur&&P.onBlur(L)},N=L=>{if(L.nativeEvent.defaultPrevented)return;const K=L.target.checked;I(K),x&&x(L,K)};let M=u;P&&typeof M=="undefined"&&(M=P.disabled);const F=j==="checkbox"||j==="radio",E=f._extends({},r,{checked:R,disabled:M,disableFocusRipple:l,edge:c}),A=Nf(E);return y.jsxs(Rf,f._extends({component:"span",className:f.clsx(A.root,s),centerRipple:!0,focusRipple:!l,disabled:M,tabIndex:null,role:void 0,onFocus:Y,onBlur:$,ownerState:E,ref:e},H,{children:[y.jsx(If,f._extends({autoFocus:n,checked:a,defaultChecked:i,className:A.input,disabled:M,id:F?p:void 0,name:v,onChange:N,readOnly:_,ref:g,required:S,ownerState:E,tabIndex:O,type:j},j==="checkbox"&&B===void 0?{}:{value:B},m)),R?o:d]}))});process.env.NODE_ENV!=="production"&&(kl.propTypes={autoFocus:f.PropTypes.bool,checked:f.PropTypes.bool,checkedIcon:f.PropTypes.node.isRequired,classes:f.PropTypes.object,className:f.PropTypes.string,defaultChecked:f.PropTypes.bool,disabled:f.PropTypes.bool,disableFocusRipple:f.PropTypes.bool,edge:f.PropTypes.oneOf(["end","start",!1]),icon:f.PropTypes.node.isRequired,id:f.PropTypes.string,inputProps:f.PropTypes.object,inputRef:f.refType,name:f.PropTypes.string,onBlur:f.PropTypes.func,onChange:f.PropTypes.func,onFocus:f.PropTypes.func,readOnly:f.PropTypes.bool,required:f.PropTypes.bool,sx:f.PropTypes.object,tabIndex:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string]),type:f.PropTypes.string.isRequired,value:f.PropTypes.any});function qs(t){return t.substring(2).toLowerCase()}function Lf(t,r){return r.documentElement.clientWidth<t.clientX||r.documentElement.clientHeight<t.clientY}function Or(t){const{children:r,disableReactTree:e=!1,mouseEvent:n="onClick",onClickAway:a,touchEvent:o="onTouchEnd"}=t,s=G.useRef(!1),i=G.useRef(null),u=G.useRef(!1),l=G.useRef(!1);G.useEffect(()=>(setTimeout(()=>{u.current=!0},0),()=>{u.current=!1}),[]);const c=f.useForkRef(r.ref,i),d=f.useEventCallback(g=>{const v=l.current;l.current=!1;const b=f.ownerDocument(i.current);if(!u.current||!i.current||"clientX"in g&&Lf(g,b))return;if(s.current){s.current=!1;return}let x;g.composedPath?x=g.composedPath().indexOf(i.current)>-1:x=!b.documentElement.contains(g.target)||i.current.contains(g.target),!x&&(e||!v)&&a(g)}),p=g=>v=>{l.current=!0;const b=r.props[g];b&&b(v)},m={ref:c};return o!==!1&&(m[o]=p(o)),G.useEffect(()=>{if(o!==!1){const g=qs(o),v=f.ownerDocument(i.current),b=()=>{s.current=!0};return v.addEventListener(g,d),v.addEventListener("touchmove",b),()=>{v.removeEventListener(g,d),v.removeEventListener("touchmove",b)}}},[d,o]),n!==!1&&(m[n]=p(n)),G.useEffect(()=>{if(n!==!1){const g=qs(n),v=f.ownerDocument(i.current);return v.addEventListener(g,d),()=>{v.removeEventListener(g,d)}}},[d,n]),y.jsx(G.Fragment,{children:G.cloneElement(r,m)})}process.env.NODE_ENV!=="production"&&(Or.propTypes={children:f.elementAcceptingRef.isRequired,disableReactTree:f.PropTypes.bool,mouseEvent:f.PropTypes.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:f.PropTypes.func.isRequired,touchEvent:f.PropTypes.oneOf(["onTouchEnd","onTouchStart",!1])});process.env.NODE_ENV!=="production"&&(Or.propTypes=f.exactProp(Or.propTypes));function jf(t){return f.generateUtilityClass("MuiSwitch",t)}const Fe=f.generateUtilityClasses("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),Wf=["className","color","edge","size","sx"],Yf=t=>{const{classes:r,edge:e,size:n,color:a,checked:o,disabled:s}=t,i={root:["root",e&&`edge${f.capitalize(e)}`,`size${f.capitalize(n)}`],switchBase:["switchBase",`color${f.capitalize(a)}`,o&&"checked",s&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},u=f.composeClasses(i,jf,r);return f._extends({},r,u)},Bf=f.styled("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(t,r)=>{const{ownerState:e}=t;return[r.root,e.edge&&r[`edge${f.capitalize(e.edge)}`],r[`size${f.capitalize(e.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,[`& .${Fe.thumb}`]:{width:16,height:16},[`& .${Fe.switchBase}`]:{padding:4,[`&.${Fe.checked}`]:{transform:"translateX(16px)"}}}}]}),Hf=f.styled(kl,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(t,r)=>{const{ownerState:e}=t;return[r.switchBase,{[`& .${Fe.input}`]:r.input},e.color!=="default"&&r[`color${f.capitalize(e.color)}`]]}})(({theme:t})=>({position:"absolute",top:0,left:0,zIndex:1,color:t.vars?t.vars.palette.Switch.defaultColor:`${t.palette.mode==="light"?t.palette.common.white:t.palette.grey[300]}`,transition:t.transitions.create(["left","transform"],{duration:t.transitions.duration.shortest}),[`&.${Fe.checked}`]:{transform:"translateX(20px)"},[`&.${Fe.disabled}`]:{color:t.vars?t.vars.palette.Switch.defaultDisabledColor:`${t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]}`},[`&.${Fe.checked} + .${Fe.track}`]:{opacity:.5},[`&.${Fe.disabled} + .${Fe.track}`]:{opacity:t.vars?t.vars.opacity.switchTrackDisabled:`${t.palette.mode==="light"?.12:.2}`},[`& .${Fe.input}`]:{left:"-100%",width:"300%"}}),({theme:t})=>({"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.action.activeChannel} / ${t.vars.palette.action.hoverOpacity})`:f.alpha_1(t.palette.action.active,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(t.palette).filter(([,r])=>r.main&&r.light).map(([r])=>({props:{color:r},style:{[`&.${Fe.checked}`]:{color:(t.vars||t).palette[r].main,"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:f.alpha_1(t.palette[r].main,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Fe.disabled}`]:{color:t.vars?t.vars.palette.Switch[`${r}DisabledColor`]:`${t.palette.mode==="light"?f.lighten_1(t.palette[r].main,.62):f.darken_1(t.palette[r].main,.55)}`}},[`&.${Fe.checked} + .${Fe.track}`]:{backgroundColor:(t.vars||t).palette[r].main}}}))]})),$f=f.styled("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(t,r)=>r.track})(({theme:t})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:t.transitions.create(["opacity","background-color"],{duration:t.transitions.duration.shortest}),backgroundColor:t.vars?t.vars.palette.common.onBackground:`${t.palette.mode==="light"?t.palette.common.black:t.palette.common.white}`,opacity:t.vars?t.vars.opacity.switchTrack:`${t.palette.mode==="light"?.38:.3}`})),qf=f.styled("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(t,r)=>r.thumb})(({theme:t})=>({boxShadow:(t.vars||t).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),_l=G.forwardRef(function(r,e){const n=f.useDefaultProps({props:r,name:"MuiSwitch"}),{className:a,color:o="primary",edge:s=!1,size:i="medium",sx:u}=n,l=f._objectWithoutPropertiesLoose(n,Wf),c=f._extends({},n,{color:o,edge:s,size:i}),d=Yf(c),p=y.jsx(qf,{className:d.thumb,ownerState:c});return y.jsxs(Bf,{className:f.clsx(d.root,a),sx:u,ownerState:c,children:[y.jsx(Hf,f._extends({type:"checkbox",icon:p,checkedIcon:p,ref:e,ownerState:c},l,{classes:f._extends({},d,{root:d.switchBase})})),y.jsx($f,{className:d.track,ownerState:c})]})});process.env.NODE_ENV!=="production"&&(_l.propTypes={checked:f.PropTypes.bool,checkedIcon:f.PropTypes.node,classes:f.PropTypes.object,className:f.PropTypes.string,color:f.PropTypes.oneOfType([f.PropTypes.oneOf(["default","primary","secondary","error","info","success","warning"]),f.PropTypes.string]),defaultChecked:f.PropTypes.bool,disabled:f.PropTypes.bool,disableRipple:f.PropTypes.bool,edge:f.PropTypes.oneOf(["end","start",!1]),icon:f.PropTypes.node,id:f.PropTypes.string,inputProps:f.PropTypes.object,inputRef:f.refType,onChange:f.PropTypes.func,required:f.PropTypes.bool,size:f.PropTypes.oneOfType([f.PropTypes.oneOf(["medium","small"]),f.PropTypes.string]),sx:f.PropTypes.oneOfType([f.PropTypes.arrayOf(f.PropTypes.oneOfType([f.PropTypes.func,f.PropTypes.object,f.PropTypes.bool])),f.PropTypes.func,f.PropTypes.object]),value:f.PropTypes.any});const Ht=(t,r)=>`${r}px solid ${t}`,Qf=t=>({columns:[{widthPercentage:100,rows:t.map(r=>({cells:[{widthPercentage:100,widgetId:r.id}]}))}]});function Tl(t){return f.isString(t)?{direction:t}:t}function Qs(t,r){return{valuesIndex:t.field-(r.rows||[]).length-(r.columns||[]).length,columnsMembersPath:Object.values(t.measurePath||{})}}function Uf({type:t,settings:r,sortDetails:e},n){return t==="simple"?e.field>=(n.rows||[]).length?[{rowIndex:0,sort:{direction:h.getSortType(r[0].direction),by:Qs(e,n)}}]:[{rowIndex:e.field,sort:{direction:h.getSortType(r[0].direction)}}]:r.reduce((a,o,s)=>{var d;const i=(d=n.rows)==null?void 0:d[s],u=(i==null?void 0:i.sortType)&&Tl(i==null?void 0:i.sortType),l={direction:h.getSortType(o.direction),by:Qs(e,n)};return!o.selected&&h.isEqual(u==null?void 0:u.by,l.by)&&a.push({rowIndex:s,sort:null}),o.selected&&a.push({rowIndex:s,sort:l}),a},[])}function zf(t){const{jaql:r,pivotBuilder:e,isForceReload:n}=t,[a,o]=w.useState({isLoading:!1,isNoResults:!1}),s=f.useHasChanged(r);w.useEffect(()=>{r&&(s||n)&&e.updateJaql(r)},[n,s,r,e]);const i=w.useCallback(()=>{o({isLoading:!0,isNoResults:!1})},[]),u=w.useCallback(l=>{o({isLoading:!1,isNoResults:!l.cellsMetadata})},[]);return w.useEffect(()=>{const l=[{event:f.wv,handler:i},{event:f.Ev,handler:u}];return l.forEach(({event:c,handler:d})=>{e.on(c,d)}),()=>{l.forEach(({event:c,handler:d})=>{e.off(c,d)})}},[e,i,u]),a}function Gf(t){const{pivotClient:r,pivotBuilder:e,shouldBeRecreated:n}=t,[a,o]=w.useState(()=>r.prepareDataService());return w.useEffect(()=>{if(n){const s=r.prepareDataService();o(s),e.updateDataService(s)}},[r,e,n]),a}const Vf=({dataOptions:t})=>{const[r,e]=w.useState(f.translatePivotTableDataOptions(t));return{dataOptionsInternal:r,updateSort(n){var a;e(T(D({},r),{rows:(a=r.rows)==null?void 0:a.map((o,s)=>{const i=n.rows.find(({rowIndex:u})=>u===s);return i?i.sort===null?h.safeCombine(o,{sortType:void 0}):h.safeCombine(o,{sortType:i.sort}):o})}))}}},Kf=t=>(r,e,n,a)=>{var u;const o=f.getPivotDataOptionByJaqlIndex(t,(u=a==null?void 0:a.field)==null?void 0:u.index),s=f.getNumberFormatConfig(o),i=r.value===null||typeof r.value=="undefined";r.content=i?"":h.applyFormatPlainText(s,r.value)},Xf=()=>(t,r,e)=>{var l,c;const n=t.userType===f.lt.CORNER,a=t.userType===f.lt.SUB_TOTAL;if(!r||n||a)return;const o=e.metadata.find(({panel:d,jaql:p})=>{var x;const m=["rows","columns"].includes(d),g=p.dim===r.jaql.dim,v=r.jaql.datatype===p.datatype&&r.jaql.level===p.level,b=(x=p.in)==null?void 0:x.selected;return m&&g&&v&&b}),s=(c=(l=o==null?void 0:o.jaql)==null?void 0:l.in)==null?void 0:c.selected;if(!s)return;tf(s.jaql)(t.value)&&(t.state={isSelected:!0})},Jf=({dataService:t,dataOptions:r})=>{const{app:e}=f.useSisenseContext(),n=w.useCallback(h.over([Kf(r)]),[r]),a=w.useCallback((s,i)=>f.applyDateFormat(s,i,e==null?void 0:e.settings.locale,e==null?void 0:e.settings.dateConfig),[e]),o=w.useCallback(h.over([f.createHeaderCellValueFormatter(r,a),Xf()]),[r]);w.useEffect(()=>(t.on(f.pR,n),t.on(f.Sh,o),()=>{t.off(f.pR,n),t.off(f.Sh,o)}),[t,n])};function Us(t,r){return f.dataLoadStateReducer(t,r)}const Zf=f.withTracking("useExecutePivotQuery")(Sl);function Sl(t){const r=tp(t),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(Us,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext();return w.useEffect(()=>{if(o||a({type:"error",error:new h.TranslatableError("errors.executeQueryNoSisenseContext")}),e(s)){a({type:"loading"});const{dataSource:i,rows:u,columns:l,values:c,grandTotals:d,filters:p,highlights:m,count:g,offset:v,onBeforeQuery:b}=t,{filters:x,relations:C}=h.getFilterListAndRelationsJaql(p);f.executePivotQuery({dataSource:i,rows:u,columns:l,values:c,grandTotals:d,filters:x,filterRelations:C,highlights:m,count:g,offset:v},s,{onBeforeQuery:b}).then(_=>{a({type:"success",data:_})}).catch(_=>{a({type:"error",error:_})})}},[s,o,t,e]),n.data&&r?Us(n,{type:"loading"}):n}const ep=["dataSource","rows","columns","values","grandTotals","count","offset","onBeforeQuery"];function tp(t){return f.useHasChanged(t,ep,(r,e)=>{const{filters:n}=h.getFilterListAndRelationsJaql(e.filters),{filters:a}=h.getFilterListAndRelationsJaql(r.filters);return f.isFiltersChanged(n,a)||f.isFiltersChanged(e.highlights,r.highlights)})}const zs=t=>D({attribute:h.translateColumnToAttribute(t),includeSubTotals:t.includeSubTotals||!1},t.sortType&&{sort:Tl(t.sortType)}),np=t=>({measure:h.translateColumnToMeasure(t),totalsCalculation:t.totalsCalculation,dataBars:t.dataBars||!1}),El=t=>{const{rows:r=[],columns:e=[],values:n=[],grandTotals:a}=t,o=r.flatMap(zs),s=e.flatMap(zs),i=n.flatMap(np);return{rows:o,columns:s,values:i,grandTotals:a}},rp=({dataSet:t,dataOptionsInternal:r,filters:e,highlights:n})=>{const[a,o]=w.useState(),{rows:s,columns:i,values:u,grandTotals:l}=El(r),c=w.useCallback(m=>{o(g=>h.isEqual(g,m)?g:m)},[o]),d={dataSource:t,rows:s,columns:i,values:u,grandTotals:l,filters:e,highlights:n,onBeforeQuery:c},{error:p}=Sl(d);return{jaql:a,error:p}},ap="#cbced7",op="#ffff9c";function sp(t,r){var a,o,s,i,u,l,c,d,p,m,g;let e,n;if((a=r==null?void 0:r.chart)!=null&&a.backgroundColor){const v=h.getDarkFactor(h.toColor((o=r==null?void 0:r.chart)==null?void 0:o.backgroundColor))<.5?.07:-.07;e=h.getSlightlyDifferentColor((s=r==null?void 0:r.chart)==null?void 0:s.backgroundColor,v),n=h.getSlightlyDifferentColor((i=r==null?void 0:r.chart)==null?void 0:i.backgroundColor,v*1.5)}return{fontFamily:(u=r==null?void 0:r.typography)==null?void 0:u.fontFamily,textColor:(l=r==null?void 0:r.chart)==null?void 0:l.textColor,backgroundColor:(c=r==null?void 0:r.chart)==null?void 0:c.backgroundColor,borderColor:ap,fillColor:e,additionalFillColor:n,fillOptions:{alternatingRows:t==null?void 0:t.alternatingRowsColor,alternatingColumns:t==null?void 0:t.alternatingColumnsColor,columnsHeaders:t==null?void 0:t.headersColor,rowMembers:t==null?void 0:t.membersColor,totals:t==null?void 0:t.totalsColor},rowHeight:t==null?void 0:t.rowHeight,isAutoHeight:(d=t==null?void 0:t.isAutoHeight)!=null?d:!1,navigationPrimaryColor:(p=r==null?void 0:r.typography)==null?void 0:p.primaryTextColor,navigationSecondaryColor:(m=r==null?void 0:r.typography)==null?void 0:m.secondaryTextColor,selectionColor:(g=t==null?void 0:t.highlightColor)!=null?g:op}}const ip=25;function lp({nodeRef:t,pivotBuilder:r,dataOptions:e,styleOptions:n,themeSettings:a,size:o,onTotalHeightChange:s}){const i=w.useCallback((d,p)=>{const g=[...e.rows?e.rows:[],...e.columns?e.columns:[],...e.values?e.values:[]].map(b=>b==null?void 0:b.width);if(p){const[b,x]=p,C=d[b];C&&typeof C.jaqlIndex!="undefined"&&(g[C.jaqlIndex]=x)}const v=[];return d.forEach((b,x)=>{typeof b.jaqlIndex!="undefined"&&typeof g[b.jaqlIndex]!="undefined"&&v.push([x,g[b.jaqlIndex]])}),v},[e]),u=w.useMemo(()=>sp(n,a),[n,a]),{rowsPerPage:l=ip}=n,c=w.useMemo(()=>o?D({width:o.width,height:o.height,isPaginated:!0,itemsPerPage:l,isSelectedMode:!0,onUpdatePredefinedColumnWidth:i,onTotalHeightChange:s},u):null,[o,l,i,u,s]);w.useEffect(()=>{t.current&&c&&(!!t.current.children.length?r.updateProps(c):r.render(t.current,c))},[t,r,c])}const Pl=f.asSisenseComponent({componentName:"PivotTable"})(t=>{const{dataSet:r,dataOptions:e,filters:n,highlights:a,refreshCounter:o=0}=t,s=w.useMemo(()=>{var P;return(P=t.styleOptions)!=null?P:{}},[t.styleOptions]),i=w.useRef(null),[u,l]=w.useState(null),[c,d]=w.useState(null),{app:p}=f.useSisenseContext(),{themeSettings:m}=f.useThemeContext(),g=p==null?void 0:p.pivotClient;if(!g)throw new h.TranslatableError("errors.noPivotClient");const{dataOptionsInternal:v,updateSort:b}=Vf({dataOptions:e}),{error:x,jaql:C}=rp({dataSet:r,dataOptionsInternal:v,filters:n,highlights:a});if(x)throw x;const _=w.useMemo(()=>g.preparePivotBuilder(),[g]),S=f.useHasChanged(C),O=o>0&&f.useHasChanged(o),j=Gf({pivotClient:g,pivotBuilder:_,shouldBeRecreated:S||O});Jf({dataService:j,dataOptions:e}),lp({nodeRef:i,pivotBuilder:_,dataOptions:e,styleOptions:s,themeSettings:m,size:u,onTotalHeightChange:d});const{isLoading:B,isNoResults:H}=zf({jaql:C,pivotBuilder:_,isForceReload:O}),R=w.useCallback(P=>{const Y=Uf(P,v);b({rows:Y})},[v,b]);w.useEffect(()=>(_.on(f.Rv,R),()=>{_.off(f.Rv,R)}),[_,R]);const I=w.useCallback(P=>{(P.width!==(u==null?void 0:u.width)||P.height!==(u==null?void 0:u.height))&&l(P)},[u,l]);return y.jsx(f.DynamicSizeContainer,{defaultSize:f.DEFAULT_PIVOT_TABLE_SIZE,size:{width:s==null?void 0:s.width,height:s!=null&&s.isAutoHeight&&!H&&c!=null?c:s==null?void 0:s.height},onSizeChange:I,children:y.jsx(f.LoadingOverlay,{themeSettings:m,isVisible:B,children:y.jsxs(y.Fragment,{children:[H&&y.jsx(f.NoResultsOverlay,{iconType:"table"}),y.jsx("div",{ref:i,"aria-label":"pivot-table-root"})]})})})}),To=f.asSisenseComponent({componentName:"PivotTableWidget"})(t=>{var d;const[r,e]=w.useState(0),{app:n}=f.useSisenseContext(),{styleOptions:a,dataSource:o=n==null?void 0:n.defaultDataSource,dataOptions:s}=t,i=f.getWidgetDefaultSize("pivot",{hasHeader:!((d=a==null?void 0:a.header)!=null&&d.hidden)}),p=t.styleOptions||{},{width:u,height:l}=p,c=pe(p,["width","height"]);return s?y.jsx(f.DynamicSizeContainer,{defaultSize:i,size:{width:u,height:a!=null&&a.isAutoHeight?void 0:l},children:y.jsx(f.WidgetContainer,T(D({},t),{dataSetName:o&&h.getDataSourceName(o),onRefresh:()=>e(r+1),children:y.jsx(Pl,{dataSet:t.dataSource,dataOptions:t.dataOptions,styleOptions:c,filters:t.filters,highlights:t.highlights,refreshCounter:r})}))}):null}),cp=t=>{const r=[],e=n=>{Array.isArray(n)?n.forEach(e):typeof n=="object"&&n!==null&&(n.widgetid&&r.push(n.widgetid),Object.values(n).forEach(e))};return e(t.layout),r},up=t=>"levels"in t&&t.isCascading===!0,dp=t=>({columns:(t.columns||[]).map(r=>({widthPercentage:r.width,rows:(r.cells||[]).map(e=>{const n=e.subcells.reduce((a,o)=>a+o.width,0);return{cells:e.subcells.map(a=>({widthPercentage:n<100?a.width/(n/100):a.width,height:a.elements[0].height,widgetId:a.elements[0].widgetid}))}})}))}),fp=t=>h.createFilterFromJaql(t.jaql,t.instanceid,t.disabled,t.locked),pp=t=>{const{levels:r,instanceid:e,disabled:n,locked:a}=t,o=r.map(s=>h.createFilterFromJaql(s,s.instanceid));return new h.CascadingFilter(o,{guid:e,disabled:n,locked:a})};function hp(t,r){const e=t.map(a=>up(a)?pp(a):fp(a));if(!r)return e;const n=h.convertFilterRelationsModelToRelationRules(r,e);return!n||h.isTrivialSingleNodeRelations(n)?e:h.combineFiltersAndRelations(e,n)}function mp(t=[]){const r={};return t.forEach(e=>{var n,a,o,s;r[e.oid]={filtersOptions:{applyMode:((n=e.options)==null?void 0:n.dashboardFiltersMode)==="filter"?f.CommonFiltersApplyMode.FILTER:f.CommonFiltersApplyMode.HIGHLIGHT,shouldAffectFilters:(a=e.options)==null?void 0:a.selector,ignoreFilters:{all:(o=e.metadata.ignore)==null?void 0:o.all,ids:(s=e.metadata.ignore)==null?void 0:s.ids},forceApplyBackgroundFilters:!0}}}),r}function gp(t,r){return he(this,null,function*(){var a;const e=yp(t.widgets||[]);if(e.length===0)return t;const n=yield r.getSharedFormulas(e);return T(D({},t),{widgets:(a=t.widgets)==null?void 0:a.map(o=>bp(o,n))})})}function yp(t){const r=t.flatMap(e=>e.metadata.panels.flatMap(n=>n.items.flatMap(a=>!h.isJaqlWithFormula(a.jaql)||!a.jaql.context?[]:Object.values(a.jaql.context).filter(h.isSharedFormulaReferenceContext).map(s=>s.formulaRef))));return Array.from(new Set(r))}function bp(t,r){const e=t.metadata.panels.map(n=>{const a=n.items.map(o=>{const{jaql:s}=o;if(!h.isJaqlWithFormula(s)||!s.context)return o;const i=Object.fromEntries(Object.entries(s.context).map(([u,l])=>h.isSharedFormulaReferenceContext(l)?[u,r[l.formulaRef]]:[u,l]));return T(D({},o),{jaql:T(D({},s),{context:i})})});return T(D({},n),{items:a})});return T(D({},t),{metadata:T(D({},t.metadata),{panels:e})})}function Ml(o,s){return he(this,arguments,function*(t,r,e={},n,a){var g,v;const{includeWidgets:i,includeFilters:u}=e,l=new f.RestApi(t),c=["oid","title","datasource","style"],d=((g=t.auth)==null?void 0:g.type)==="wat";i&&c.push("layout"),u&&(c.push("filters"),c.push("filterRelations"));const p=yield l.getDashboard(r,{fields:c});if(!p)throw new h.TranslatableError("errors.dashboardWithOidNotFound",{dashboardOid:r});if(i){let b;if(d){const x=cp(p);b=(yield Promise.all(x.map(_=>l.getWidget(_,p.oid)))).filter(_=>_!==void 0)}else b=(yield l.getDashboardWidgets(r))||[];p.widgets=b}if((v=p.style)!=null&&v.paletteId&&!p.style.palette){const b=yield l.getPalettes(),x=b==null?void 0:b.find(({_id:C})=>{var _;return C===((_=p.style)==null?void 0:_.paletteId)});x&&(p.style.palette={name:x.name,colors:x.colors})}const m=yield gp(p,l);return Lo(m,n,a)})}const Al=(t,r)=>{const e={};for(const n of t){const a=r(n);a in e||(e[a]=n)}return Object.values(e)};function Ol(e){return he(this,arguments,function*(t,r={}){const{includeWidgets:n,searchByTitle:a}=r,o=new f.RestApi(t),s=[];let i=["oid","title","datasource"];n&&(i=[],s.push("widgets"));const u=yield o.getDashboards({fields:i,expand:s,searchByTitle:a});if(!u)return[];const l=Al(u,c=>c.oid);return l.length!==u.length&&console.warn("Removing detected duplicate dashboard(s)"),l.map(c=>Lo(c))})}const Fl=f.withTracking("useGetDashboardModel")(Nl);function Nl(t){const r=f.useHasChanged(t,["dashboardOid"]),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext(),{themeSettings:i}=f.useThemeContext();return w.useEffect(()=>{if(o||a({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(s)){a({type:"loading"});const{dashboardOid:u,includeWidgets:l,includeFilters:c}=t;Ml(s.httpClient,u,{includeWidgets:l,includeFilters:c},i,s.settings).then(d=>{a({type:"success",data:d})}).catch(d=>{a({type:"error",error:d})})}},[s,o,t,e,i]),n.data&&r?Xa(f.dataLoadStateReducer(n,{type:"loading"})):Xa(n)}function Xa(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{dashboard:r})}const vp=f.withTracking("useGetDashboardModels")(wp);function wp(t={}){const r=f.useHasChanged(t,["includeWidgets"]),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext();return w.useEffect(()=>{o||a({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(s)&&(a({type:"loading"}),Ol(s.httpClient,t).then(i=>{a({type:"success",data:i})}).catch(i=>{a({type:"error",error:i})}))},[s,o,t,e]),n.data&&r?Ja(f.dataLoadStateReducer(n,{type:"loading"})):Ja(n)}function Ja(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{dashboards:r})}const Rl=a=>he(exports,[a],function*({widgetOid:t,dashboardOid:r,includeDashboard:e,api:n}){const[o,s]=yield Promise.all([n.getWidget(t,r),e?n.getDashboard(r):void 0]);return{widget:o,dashboard:s}});function Il(t,r,e,n,a){return he(this,null,function*(){const o=new f.RestApi(t),{widget:s}=yield Rl({widgetOid:e,dashboardOid:r,api:o});if(!s)throw new h.TranslatableError("errors.widgetWithOidNotFound",{widgetOid:e});return Jn(s,n,a)})}const xp=f.withTracking("useGetWidgetModel")(Ll);function Ll(t){const r=f.useHasChanged(t,["dashboardOid","widgetOid"]),e=f.useShouldLoad(t,r),{themeSettings:n}=f.useThemeContext(),[a,o]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:s,app:i}=f.useSisenseContext();return w.useEffect(()=>{if(s||o({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(i)){o({type:"loading"});const{dashboardOid:u,widgetOid:l}=t;Il(i.httpClient,u,l,n,i.settings).then(c=>{o({type:"success",data:c})}).catch(c=>{o({type:"error",error:c})})}},[i,s,t,e,n]),a.data&&r?Gs(f.dataLoadStateReducer(a,{type:"loading"})):Gs(a)}function Gs(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{widget:r})}function Jt(t,r){const e=h.getChartSubtype(t);return D(D({},r),e&&{subtype:e})}function gt(t){const{min:r,max:e}=t||{};return T(D({},t),{min:typeof r=="number"?r:null,max:typeof e=="number"?e:null})}function Dp(t,r,e){var x,C,_,S,O,j,B,H,R,I;const n={xAxis:gt(r.xAxis),yAxis:gt(r.yAxis),y2Axis:gt(r.y2Axis)},o=["chart/line","chart/area"].includes(t)?"x-axis":"categories",s=h.getEnabledPanelItems(e,o),i=h.getEnabledPanelItems(e,"values"),u=s.length===2;u&&(n.xAxis=T(D({},n.xAxis),{title:(x=n.xAxis)==null?void 0:x.x2Title,x2Title:(C=n.xAxis)==null?void 0:C.title}));const l=!!((_=n.xAxis)!=null&&_.title&&"text"in n.xAxis.title),c=s[s.length-1];!l&&c&&(n.xAxis=T(D({},n.xAxis),{title:T(D({},(S=n.xAxis)==null?void 0:S.title),{text:c.jaql.title})}));const d=!!((O=n.xAxis)!=null&&O.x2Title&&"text"in n.xAxis.x2Title),p=s[0];!d&&u&&(n.xAxis=T(D({},n.xAxis),{x2Title:T(D({},(j=n.xAxis)==null?void 0:j.x2Title),{text:p.jaql.title})}));const m=!!((B=n.yAxis)!=null&&B.title&&"text"in n.yAxis.title),g=i.filter(P=>!P.y2);!m&&g.length===1&&(n.yAxis=T(D({},n.yAxis),{title:T(D({},(H=n.yAxis)==null?void 0:H.title),{text:g[0].jaql.title})}));const v=!!((R=n.y2Axis)!=null&&R.title&&"text"in n.y2Axis.title),b=i.filter(P=>P.y2);return!v&&b.length===1&&(n.y2Axis=T(D({},n.y2Axis),{title:T(D({},(I=n.y2Axis)==null?void 0:I.title),{text:b[0].jaql.title})})),n}function Cp(t,r){var o,s;const e={xAxis:gt(t.categories),yAxis:gt(t.axis)},n=h.getEnabledPanelItems(r,"categories")[0];return!!!((o=e.xAxis)!=null&&o.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(s=e.xAxis)==null?void 0:s.title),{text:n.jaql.title})})),e.yAxis=T(D({},e.yAxis),{title:{enabled:!1}}),e}function kp(t,r){var i,u,l,c;const e={xAxis:gt(t.xAxis),yAxis:gt(t.yAxis)},n=h.getEnabledPanelItems(r,"x-axis")[0],a=h.getEnabledPanelItems(r,"y-axis")[0];return!!!((i=e.xAxis)!=null&&i.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(u=e.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((l=e.yAxis)!=null&&l.title&&"text"in e.yAxis.title)&&a&&(e.yAxis=T(D({},e.yAxis),{title:T(D({},(c=e.yAxis)==null?void 0:c.title),{text:a.jaql.title})})),e}function _p(t,r){var i,u,l,c;const e={xAxis:gt(t.xAxis),yAxis:gt(t.yAxis)},n=h.getEnabledPanelItems(r,"category")[0],a=h.getEnabledPanelItems(r,"value")[0];return!!!((i=e.xAxis)!=null&&i.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(u=e.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((l=e.yAxis)!=null&&l.title&&"text"in e.yAxis.title)&&a&&(e.yAxis=T(D({},e.yAxis),{title:T(D({},(c=e.yAxis)==null?void 0:c.title),{text:a.jaql.title})})),e}function Tp(t,r,e,n){return T(D(D({},Jt(r,e)),Dp(t,e,n)),{lineWidth:e.lineWidth,markers:e.markers})}function Sp(t,r,e){return D(D({},Jt(t,r)),Cp(r,e))}function Ep(t,r,e){var n,a,o;return T(D(D({},Jt(t,r)),kp(r,e)),{markerSize:{scatterDefaultSize:(n=r.markerSize)==null?void 0:n.defaultSize,scatterBubbleMinSize:(a=r.markerSize)==null?void 0:a.min,scatterBubbleMaxSize:(o=r.markerSize)==null?void 0:o.max}})}function Pp(t){return{header:{color:{enabled:t["colors/headers"]}},rows:{alternatingColor:{enabled:t["colors/rows"]}},columns:{alternatingColor:{enabled:t["colors/columns"]}}}}function Mp(t,r){return T(D({},Jt(t,r)),{funnelSize:r.size,funnelType:r.type,funnelDirection:r.direction,labels:r.labels,legend:r.legend})}const Ap=(t,r)=>{const e=h.getChartSubtype(t);return e==="indicator/gauge"?{subtype:e,skin:+r.skin}:r.subtype==="bar"?{subtype:e,numericSubtype:"numericBar"}:{subtype:e,numericSubtype:"numericSimple",skin:r.skin}};function Op(t,r,e){var s,i,u,l,c,d,p,m;const n=Ap(t,r),a=(s=h.getEnabledPanelItems(e,"value")[0])==null?void 0:s.jaql.title,o=(i=h.getEnabledPanelItems(e,"secondary")[0])==null?void 0:i.jaql.title;return T(D({},n),{indicatorComponents:{title:{shouldBeShown:((l=(u=r.components)==null?void 0:u.title)==null?void 0:l.enabled)||!1,text:a},secondaryTitle:{text:o||""},ticks:{shouldBeShown:((d=(c=r.components)==null?void 0:c.ticks)==null?void 0:d.enabled)||!1},labels:{shouldBeShown:((m=(p=r.components)==null?void 0:p.labels)==null?void 0:m.enabled)||!1}}})}function Fp(t){var r,e,n,a;return{labels:{category:[{enabled:(r=t["title/1"])!=null?r:!0},{enabled:(e=t["title/2"])!=null?e:!0},{enabled:(n=t["title/3"])!=null?n:!0}]},tooltip:{mode:(a=t["tooltip/value"])==null||a?"value":"contribution"}}}function Np(t){var r;return{legend:{enabled:t["legend/enabled"],position:t["legend/position"]},tooltip:{mode:(r=t["tooltip/value"])==null||r?"value":"contribution"}}}function Rp(t,r,e){return D(D({},Jt(t,r)),_p(r,e))}function Ip(t,r){return T(D({},Jt(t,r)),{markers:{fill:r.markers.fill,size:{defaultSize:r.markers.size.defaultSize,minSize:r.markers.size.min,maxSize:r.markers.size.max}}})}function Lp(t){let r;switch(t){case"areamap/world":r="world";break;case"areamap/usa":r="usa";break;default:throw new h.TranslatableError("errors.unsupportedWidgetType",{widgetSubtype:t})}return{mapType:r}}function jp(t){var r,e,n,a,o;return{rowsPerPage:parseInt(`${t.pageSize}`),isAutoHeight:t.automaticHeight,rowHeight:t.rowHeight,alternatingRowsColor:(r=t.colors)==null?void 0:r.rows,alternatingColumnsColor:(e=t.colors)==null?void 0:e.columns,headersColor:(n=t.colors)==null?void 0:n.headers,membersColor:(a=t.colors)==null?void 0:a.members,totalsColor:(o=t.colors)==null?void 0:o.totals}}function Wp(t,r){var o,s,i;const{subtype:e,style:n,metadata:{panels:a}}=r;switch(t){case"chart/line":case"chart/area":case"chart/bar":case"chart/column":{const u=Tp(t,e,n,a);if(u.navigator){const l=(o=r.options)==null?void 0:o.previousScrollerLocation;u.navigator.scrollerLocation=h.isValidScrollerLocation(l)?l:void 0}return u}case"chart/polar":return Sp(e,n,a);case"chart/scatter":return Ep(e,n,a);case"chart/funnel":return Mp(e,n);case"treemap":return Fp(n);case"sunburst":return Np(n);case"chart/pie":return Jt(e,n);case"tablewidget":case"tablewidgetagg":return Pp(n);case"pivot":case"pivot2":return jp(n);case"indicator":return Op(e,n,a);case"chart/boxplot":{const u=Rp(e,n,a);return u.navigator&&(u.navigator.scrollerLocation=h.isValidScrollerLocation((s=r.options)==null?void 0:s.previousScrollerLocation)?(i=r.options)==null?void 0:i.previousScrollerLocation:void 0),u}case"map/scatter":return Ip(e,n);case"map/area":return Lp(e);case"richtexteditor":return n.content;default:throw new h.TranslatableError("errors.unsupportedWidgetType",{widgetType:t})}}function Yp(t,r,e){if(!r||!e)return t;const n={backgroundColor:r.widgetBackgroundColor,spaceAround:f.LEGACY_DESIGN_TYPES[r.widgetSpacing],cornerRadius:f.LEGACY_DESIGN_TYPES[r.widgetCornerRadius],shadow:f.LEGACY_DESIGN_TYPES[r.widgetShadow],border:r.widgetBorderEnabled,borderColor:r.widgetBorderColor,header:{titleTextColor:r.widgetTitleColor,titleAlignment:f.LEGACY_DESIGN_TYPES[r.widgetTitleAlignment],dividerLine:r.widgetTitleDividerEnabled,dividerLineColor:r.widgetTitleDividerColor,backgroundColor:r.widgetTitleBackgroundColor}};return D(D({},t),n)}function Bp(t,r){return t&&t.length?f.baseUniq(t,h.baseIteratee(r)):[]}function Hp(t,r){const e=t.findIndex(n=>n===r);return e===-1?[]:t.slice(e)}const jl=t=>t!=null&&t.parent?[...jl(t.parent),f.createDataColumn(t).column]:[],Wl=t=>{var r,e,n;if(t!=null&&t.parent&&t.through&&"filter"in t.through.jaql){const a=f.createDataColumn(t).column,{jaql:o,format:{mask:s}={}}=t.parent,i="level"in o&&o.level&&s&&s[o.level],u=(n=(e=(r=t.through.jaql.filter)==null?void 0:r.members)==null?void 0:e.map(i?l=>({categoryValue:l,categoryDisplayValue:f.applyDateFormat(h.parseISO(l),i)}):l=>({categoryValue:l})))!=null?n:[];return[...Wl(t.parent),{nextDimension:a,points:u}]}return[]};function $p(t){switch(t){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 qp=(t,r)=>{const e=$p(t).map(a=>h.getEnabledPanelItems(r,a)).flat().filter(a=>{const o="agg"in a.jaql&&a.jaql.agg,s="formula"in a.jaql&&a.jaql.formula;return!o&&!s});return e.length===1?e[0]:void 0},Yl="calendar",Bl="calendar - weeks",Qp=[h.DateLevels.Years,h.DateLevels.Quarters,h.DateLevels.Months,h.DateLevels.Days],Up=[h.DateLevels.Years,h.DateLevels.Weeks,h.DateLevels.Days],zp=[h.DateLevels.Years,h.DateLevels.Quarters,h.DateLevels.Months,h.DateLevels.Weeks,h.DateLevels.Days],Gp=t=>t.length===2?zp:t[0]===Yl?Qp:t[0]===Bl?Up:[],Vp=(t,r)=>{const[e=[],n]=f.partition(t,o=>[Yl,Bl].includes(o)),a=Hp(Gp(e),r.granularity);return a.length?[{title:"Calendar Hierarchy",levels:a.map(i=>new h.DimensionalLevelAttribute(`${i} in ${r.name}`,r.expression,i,h.DimensionalLevelAttribute.getDefaultFormatForGranularity(i)))},...n]:n},Kp=t=>{const r=t&&f.createDataColumn(t),e=(t==null?void 0:t.hierarchies)||[];return r&&h.isDatetime(r.column.type)?(r.column.name=(t==null?void 0:t.jaql).column,Vp(e,r.column)):e},Xp=(t,r,e=[],n)=>{const a=qp(t,r),o=a&&h.getRootPanelItem(a),s=Wl(a),i=Kp(o);return{drilldownPaths:[...Bp([...a?jl(a):[]],({expression:l})=>l),...i],drilldownSelections:s}};function So(t){const s=t.filter,{filter:r}=s,e=pe(s,["filter"]),n=r&&"turnedOff"in r&&r.turnedOff;let a,o;return n?o=r:a=r,e.members&&e.members.length===0&&(e.all=!0),{filter:e,backgroundFilter:a,turnOffMembersFilter:o}}function Jp(t){const{filter:r,backgroundFilter:e,turnOffMembersFilter:n}=So(t.jaql),a=[T(D({},t),{jaql:T(D({},t.jaql),{filter:D(D({},r),n&&{filter:n})})})];return e&&a.push(T(D({},t),{jaql:T(D({},t.jaql),{filter:e}),disabled:!1})),a}function Zp(t){const r=t.find(n=>n.name==="filters"),e=[];return r==null||r.items.forEach(n=>{e.push(...Jp(n).filter(({disabled:a})=>!a))}),e}function Hl(t){return Zp(t).map(r=>h.createFilterFromJaql(r.jaql,r.instanceid))}function Eo(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toExecuteQueryParams");let r,e,n,a;if(h.isTableWidget(t.widgetType)){const{attributes:o,measures:s}=f.getTableAttributesAndMeasures(f.translateTableDataOptions(t.dataOptions));r=o,e=s,n=f.DEFAULT_TABLE_ROWS_PER_PAGE*f.PAGES_BATCH_SIZE+1,a=!0}else{const{attributes:o,measures:s}=f.getTranslatedDataOptions(t.dataOptions,t.chartType);r=o,e=s}return{dataSource:t.dataSource,dimensions:r,measures:e,filters:t.filters,highlights:t.highlights,count:n,ungroup:a}}function Po(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toExecutePivotQueryParams"});const{rows:r,columns:e,values:n,grandTotals:a}=El(f.translatePivotTableDataOptions(t.dataOptions));return{dataSource:t.dataSource,rows:r,columns:e,values:n,grandTotals:a,filters:t.filters,highlights:t.highlights}}function $l(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toChartProps");if(h.isTextWidget(t.widgetType))throw new Xl("toChartProps");return h.isTableWidget(t.widgetType)?D({chartType:t.chartType},Mo(t)):{chartType:t.chartType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters,highlights:t.highlights}}function Mo(t){if(!h.isTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters}}function ql(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters,highlights:t.highlights}}function Ao(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toChartWidgetProps");if(h.isTextWidget(t.widgetType))throw new Xl("toChartWidgetProps");return{chartType:t.chartType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||"",drilldownOptions:t.drilldownOptions}}function Ql(t){if(!h.isTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableWidgetProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,title:t.title,description:t.description||""}}function Oo(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableWidgetProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||""}}function Fo(t){if(!h.isTextWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTextWidgetSupported",{methodName:"toTextWidgetProps"});return{styleOptions:t.styleOptions}}function Ul(t){if(!h.isPluginWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPluginWidgetSupported",{methodName:"toPluginWidgetProps"});return{pluginType:t.pluginType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||""}}function zl(t){const{widgetType:r}=t;return h.isPivotTableWidget(r)?D({widgetType:"pivot"},Oo(t)):h.isTextWidget(r)?D({widgetType:"text"},Fo(t)):h.isPluginWidget(r)?D({widgetType:"plugin"},Ul(t)):D({widgetType:"chart"},Ao(t))}function No(t){const{oid:r}=t;return T(D({},zl(t)),{id:r})}const ht=()=>{throw new h.TranslatableError("errors.methodNotImplemented")},Gl={oid:"",title:"",dataSource:"",description:"",widgetType:"plugin",pluginType:"",dataOptions:{},styleOptions:{},drilldownOptions:{},filters:[],highlights:[],chartType:void 0,getExecuteQueryParams:ht,getExecutePivotQueryParams:ht,getChartProps:ht,getTableProps:ht,getPivotTableProps:ht,getPivotTableWidgetProps:ht,getChartWidgetProps:ht,getTableWidgetProps:ht,getTextWidgetProps:ht};function Vl(t){return T(D({},t),{getExecuteQueryParams:()=>Eo(t),getExecutePivotQueryParams:()=>Po(t),getChartProps:()=>$l(t),getTableProps:()=>Mo(t),getPivotTableProps:()=>ql(t),getChartWidgetProps:()=>Ao(t),getTableWidgetProps:()=>Ql(t),getPivotTableWidgetProps:()=>Oo(t),getTextWidgetProps:()=>Fo(t)})}function Jn(t,r,e){var p,m,g,v;let n,a,o,s;const i=f.attachDataSourceToPanels(t.metadata.panels,t.datasource);if(n=t.type,!h.isSupportedWidgetType(n))a=n,n="plugin",o=f.createDataOptionsFromPanels(i,(p=r==null?void 0:r.palette.variantColors)!=null?p:[]),s=t.style;else{o=f.extractDataOptions(n,i,t.style,r==null?void 0:r.palette.variantColors),s=Wp(n,t);const b=(v=(g=(m=e==null?void 0:e.serverFeatures)==null?void 0:m.widgetDesignStyle)==null?void 0:g.active)!=null?v:!0;s=Yp(s,t.style.widgetDesign,b)}const u=Xp(n,i),l=Hl(i),c=h.isChartWidget(n)?h.getChartType(n):void 0,d=T(D({},Gl),{oid:t.oid,title:t.title,dataSource:h.convertDataSource(t.datasource),description:t.desc||"",widgetType:n,chartType:c,pluginType:a||"",dataOptions:o||{},styleOptions:s||{},drilldownOptions:u,filters:l});return Vl(d)}function eh(t){const r=h.getWidgetTypeFromChartType(t.chartType),e=T(D(D({},Gl),t),{filters:t.filters||[],widgetType:r});return Vl(e)}function Kl(t,r){const e=r||t.dataSource;if(typeof e=="string")throw new Vs("dataSource");if(!e.id||!e.address)throw new Vs("dataSource");const n=t.chartType;let a=t.widgetType,o={},s=t.styleOptions.subtype||"";if(!n)throw new Error("Chart type is required");const i=[];if(h.isCartesian(n)){const c=["chart/line","chart/area"].includes(t.widgetType)?"x-axis":"categories",d=t.dataOptions.category.map(v=>f.createPanelItem(h.normalizeColumn(v))),p={name:c,items:d};i.push(p);const m=t.dataOptions.value.map(v=>f.createPanelItem(h.normalizeMeasureColumn(v)));i.push({name:"values",items:m});const g=t.dataOptions.breakBy.map(v=>f.createPanelItem(h.normalizeColumn(v)));i.push({name:"break by",items:g}),n==="polar"?s="column/polar":n==="bar"?s=s||"bar/classic":n==="column"?s=s||"column/classic":n==="area"?s=s||"area/basic":n==="line"&&(s=s||"line/basic")}else if(h.isTable(n)){const{attributes:c,measures:d}=f.getTableAttributesAndMeasures(t.dataOptions),p=[...c.map(m=>f.createPanelItem(h.normalizeColumn(m))),...d.map(m=>f.createPanelItem(h.normalizeMeasureColumn(m)))];i.push({name:"columns",items:p}),a="tablewidget"}else if(h.isIndicator(n))["value","min","max","secondary"].forEach(c=>{const d=(t.dataOptions[c]||[]).map(p=>f.createPanelItem(h.normalizeMeasureColumn(p)));i.push({name:c,items:d})}),s=s||"indicator/numeric",o=T(D({},s==="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(h.isCategorical(n)){const c=t.dataOptions.category.map(m=>f.createPanelItem(h.normalizeAnyColumn(m)));i.push({name:"categories",items:c});const d=t.dataOptions.value.map(m=>f.createPanelItem(h.normalizeAnyColumn(m))),p=n==="treemap";i.push({name:p?"size":"values",items:d}),p&&["color","values"].forEach(g=>{i.push({name:g,items:[]})}),n==="pie"?(s=s||"pie/basic",o={convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",minimalIndependentSlicePercentage:3,independentSlicesCount:7}}):n==="treemap"||n==="sunburst"?s=s||n:n==="funnel"&&(s=s||"chart/funnel")}else if(h.isScatter(n))["x","y","size","breakByColor","breakByPoint"].forEach(c=>{if(t.dataOptions[c]){const d={breakByColor:"Break By / Color",breakByPoint:"point",x:"x-axis",y:"y-axis"},p=[f.createPanelItem(h.normalizeAnyColumn(t.dataOptions[c]))];i.push({name:d[c]||c,items:p})}}),s=s||"bubble/scatter";else throw new th(n);const u=(t.filters||[]).map(c=>c.jaql());return i.push({name:"filters",items:u}),{oid:t.oid||"",title:t.title,desc:t.description,datasource:e,type:a,metadata:{panels:i},style:o,subtype:s}}class Vs extends h.TranslatableError{constructor(r){super("errors.widgetModel.incomleteWidget",{prop:r})}}class th extends h.TranslatableError{constructor(r){super("errors.widgetModel.unsupportedWidgetTypeDto",{chartType:r})}}class Ro extends h.TranslatableError{constructor(r){super("errors.widgetModel.pivotWidgetNotSupported",{methodName:r})}}class Xl extends h.TranslatableError{constructor(r){super("errors.widgetModel.textWidgetNotSupported",{methodName:r})}}const nh=Object.freeze(Object.defineProperty({__proto__:null,fromChartWidgetProps:eh,fromWidgetDto:Jn,toChartProps:$l,toChartWidgetProps:Ao,toCommonWidgetProps:zl,toExecutePivotQueryParams:Po,toExecuteQueryParams:Eo,toPivotTableProps:ql,toPivotTableWidgetProps:Oo,toPluginWidgetProps:Ul,toTableProps:Mo,toTableWidgetProps:Ql,toTextWidgetProps:Fo,toWidgetDto:Kl,toWidgetProps:No},Symbol.toStringTag,{value:"Module"}));function Io(t){const{title:r,dataSource:e,widgets:n,layoutOptions:a,filters:o,widgetsOptions:s,styleOptions:i}=t;return{title:r,defaultDataSource:e,widgets:n.map(No),layoutOptions:a,config:{},filters:o,widgetsOptions:s,styleOptions:i}}function Lo(t,r,e){var S;const{oid:n,title:a,datasource:o,widgets:s,layout:i,filters:u,filterRelations:l,style:c}=t,d={title:o.title,type:o.live?"live":"elasticube"},p=D({},c!=null&&c.palette?{palette:{variantColors:c==null?void 0:c.palette.colors}}:null),m=r&&D(D({},r),p.palette?{palette:p.palette}:null),g=(s==null?void 0:s.map(O=>Jn(O,m,e)))||[],v=i?dp(i):{columns:[]},b=(S=l==null?void 0:l[0])==null?void 0:S.filterRelations,x=hp(u||[],b),C=mp(s);return{oid:n,title:a,dataSource:d,styleOptions:p,widgets:g,layoutOptions:{widgetsPanel:v},filters:x,widgetsOptions:C}}const rh=Object.freeze(Object.defineProperty({__proto__:null,fromDashboardDto:Lo,toDashboardProps:Io},Symbol.toStringTag,{value:"Module"}));function ah(t){return h.isCascadingFilter(t)?oh(t):jo(t)}function jo(t){return h.isMembersFilter(t)?sh(t):h.isRankingFilter(t)?ih(t):Wo(t)}function oh(t){return{isCascading:!0,instanceid:t.config.guid,disabled:t.config.disabled,levels:t.filters.map(r=>{const e=jo(r);return T(D({},e.jaql),{instanceid:e.instanceid})})}}function Wo(t){const{config:{disabled:r}}=t,e=Object.assign(Object.create(t),{config:T(D({},t.config),{disabled:!1})}).jaql(!0);return{jaql:T(D({},e),{table:h.getTableNameFromAttribute(t.attribute),column:h.getColumnNameFromAttribute(t.attribute)}),disabled:r,instanceid:t.config.guid,isCascading:!1}}function sh(t){const r=Wo(t);return r.jaql.filter.multiSelection=t.config.enableMultiSelection,t.config.deactivatedMembers.length>0&&(t.config.excludeMembers?r.jaql.filter.exclude.members=[...t.members,...t.config.deactivatedMembers]:r.jaql.filter.members=[...t.members,...t.config.deactivatedMembers]),t.config.backgroundFilter&&Za(r.jaql,jo(t.config.backgroundFilter).jaql.filter),t.config.deactivatedMembers.length>0&&Za(r.jaql,{exclude:{members:t.config.deactivatedMembers},turnedOff:!0}),r}function ih(t){const r=Wo(t);if(t.measure instanceof h.DimensionalBaseMeasure){const e=r.jaql.filter;e.by.table=h.getTableNameFromAttribute(t.measure.attribute),e.by.column=h.getColumnNameFromAttribute(t.measure.attribute),e.rankingMessage=t.measure.name}return r}function Za(t,r){if(t.filter)return Za(t.filter,r);t.filter=r}var Jl=(t=>(t.DASHBOARD_INIT="DASHBOARD.INIT",t.DASHBOARD_UPDATE_LAYOUT="DASHBOARD.UPDATE_LAYOUT",t))(Jl||{}),Yo=(t=>(t.FILTERS_UPDATE="FILTERS.UPDATE",t.ADD_WIDGET="WIDGETS.ADD",t))(Yo||{});function lh(t,r){var e,n;switch(r.type){case"DASHBOARD.INIT":return D(D({},t),r.payload);case"FILTERS.UPDATE":return T(D({},t),{filters:r.payload});case"WIDGETS.ADD":{const a=[...t.widgets,r.payload],o=[...((n=(e=t==null?void 0:t.layoutOptions)==null?void 0:e.widgetsPanel)==null?void 0:n.columns)||[]];return o[0]&&(o[0].rows.length||o[0].rows.push({cells:[]}),o[0].rows[0].cells.push({widgetId:r.payload.oid,widthPercentage:100})),T(D(D({},t),t!=null&&t.layoutOptions.widgetsPanel?{layoutOptions:T(D({},t==null?void 0:t.layoutOptions),{widgetsPanel:T(D({},t==null?void 0:t.layoutOptions.widgetsPanel),{columns:o})})}:null),{widgets:a})}default:return t}}function ch(t,r,e){return he(this,null,function*(){if(!t)throw new Error("Dashboard model is not initialized");if(r.type==="FILTERS.UPDATE"){const{filters:n,relations:a}=h.splitFiltersAndRelations(r.payload),o=n.map(ah),s=h.filterRelationRulesToFilterRelationsModel(a,n),i=uh(n);yield e.patchDashboard(t,{filters:o,filterRelations:s?[{datasource:i,filterRelations:s}]:void 0})}else if(r.type==="WIDGETS.ADD"){const n=yield e.addWidgetToDashboard(t,Kl(r.payload));if(!n)throw new Error("Failed to add widget to dashboard");return{type:"WIDGETS.ADD",payload:Jn(n)}}return r})}function uh(t){const r=new Set(t.map(e=>{var n;return(n=e.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 dh(t){return t.type===hs.FILTERS_UPDATE?{type:Yo.FILTERS_UPDATE,payload:t.payload}:null}function fh(t,r){return t==="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 Zl=f.withTracking("useDashboardModel")(ph);function ph({dashboardOid:t,includeWidgets:r,includeFilters:e,persist:n=!0}){const{restApi:a,isReady:o}=f.useRestApi(),{app:s}=f.useSisenseContext(),i=w.useMemo(()=>!!(s!=null&&s.httpClient.auth)&&fh(s.httpClient.auth.type,n),[s==null?void 0:s.httpClient.auth,n]),u=n&&i,[l,c]=w.useReducer(lh,null),d=w.useCallback(b=>he(this,null,function*(){if(!o||!a)throw new f.RestApiNotReadyError;return u&&(b=yield ch(l==null?void 0:l.oid,b,a)),c(b)}),[u,l==null?void 0:l.oid,a,o,c]),{dashboard:p,isLoading:m,isError:g,error:v}=Fl({dashboardOid:t,includeWidgets:r,includeFilters:e});return w.useEffect(()=>{p&&c({type:Jl.DASHBOARD_INIT,payload:p})},[p,c]),{dashboard:l,isLoading:m,isError:g,error:v,dispatchChanges:d}}/*! @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:ec,setPrototypeOf:Ks,isFrozen:hh,getPrototypeOf:mh,getOwnPropertyDescriptor:gh}=Object;let{freeze:Ie,seal:Ge,create:tc}=Object,{apply:eo,construct:to}=typeof Reflect!="undefined"&&Reflect;Ie||(Ie=function(r){return r});Ge||(Ge=function(r){return r});eo||(eo=function(r,e,n){return r.apply(e,n)});to||(to=function(r,e){return new r(...e)});const dr=He(Array.prototype.forEach),Xs=He(Array.prototype.pop),Pn=He(Array.prototype.push),xr=He(String.prototype.toLowerCase),Na=He(String.prototype.toString),Js=He(String.prototype.match),Mn=He(String.prototype.replace),yh=He(String.prototype.indexOf),bh=He(String.prototype.trim),Je=He(Object.prototype.hasOwnProperty),Oe=He(RegExp.prototype.test),An=vh(TypeError);function He(t){return function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),a=1;a<e;a++)n[a-1]=arguments[a];return eo(t,r,n)}}function vh(t){return function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return to(t,e)}}function ee(t,r){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xr;Ks&&Ks(t,null);let n=r.length;for(;n--;){let a=r[n];if(typeof a=="string"){const o=e(a);o!==a&&(hh(r)||(r[n]=o),a=o)}t[a]=!0}return t}function wh(t){for(let r=0;r<t.length;r++)Je(t,r)||(t[r]=null);return t}function jt(t){const r=tc(null);for(const[e,n]of ec(t))Je(t,e)&&(Array.isArray(n)?r[e]=wh(n):n&&typeof n=="object"&&n.constructor===Object?r[e]=jt(n):r[e]=n);return r}function On(t,r){for(;t!==null;){const n=gh(t,r);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}t=mh(t)}function e(){return null}return e}const Zs=Ie(["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"]),Ra=Ie(["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"]),Ia=Ie(["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"]),xh=Ie(["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"]),La=Ie(["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"]),Dh=Ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ei=Ie(["#text"]),ti=Ie(["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"]),ja=Ie(["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"]),ni=Ie(["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"]),fr=Ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ch=Ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),kh=Ge(/<%[\w\W]*|[\w\W]*%>/gm),_h=Ge(/\${[\w\W]*}/gm),Th=Ge(/^data-[\-\w.\u00B7-\uFFFF]/),Sh=Ge(/^aria-[\-\w]+$/),nc=Ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Eh=Ge(/^(?:\w+script|data):/i),Ph=Ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rc=Ge(/^html$/i),Mh=Ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var ri=Object.freeze({__proto__:null,MUSTACHE_EXPR:Ch,ERB_EXPR:kh,TMPLIT_EXPR:_h,DATA_ATTR:Th,ARIA_ATTR:Sh,IS_ALLOWED_URI:nc,IS_SCRIPT_OR_DATA:Eh,ATTR_WHITESPACE:Ph,DOCTYPE_NAME:rc,CUSTOM_ELEMENT:Mh});const Fn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ah=function(){return typeof window=="undefined"?null:window},Oh=function(r,e){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(n=e.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return r.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function ac(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ah();const r=V=>ac(V);if(r.version="3.1.6",r.removed=[],!t||!t.document||t.document.nodeType!==Fn.document)return r.isSupported=!1,r;let{document:e}=t;const n=e,a=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:i,Element:u,NodeFilter:l,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:m}=t,g=u.prototype,v=On(g,"cloneNode"),b=On(g,"remove"),x=On(g,"nextSibling"),C=On(g,"childNodes"),_=On(g,"parentNode");if(typeof s=="function"){const V=e.createElement("template");V.content&&V.content.ownerDocument&&(e=V.content.ownerDocument)}let S,O="";const{implementation:j,createNodeIterator:B,createDocumentFragment:H,getElementsByTagName:R}=e,{importNode:I}=n;let P={};r.isSupported=typeof ec=="function"&&typeof _=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:$,TMPLIT_EXPR:N,DATA_ATTR:M,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:A,CUSTOM_ELEMENT:L}=ri;let{IS_ALLOWED_URI:K}=ri,X=null;const le=ee({},[...Zs,...Ra,...Ia,...La,...ei]);let J=null;const ve=ee({},[...ti,...ja,...ni,...fr]);let te=Object.seal(tc(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}})),Qe=null,Ve=null,Ct=!0,Ke=!0,De=!1,Xe=!0,Ue=!1,kt=!0,It=!1,ba=!1,va=!1,tn=!1,ar=!1,or=!1,ms=!0,gs=!1;const Ru="user-content-";let wa=!0,Tn=!1,nn={},rn=null;const ys=ee({},["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 bs=null;const vs=ee({},["audio","video","img","source","image","track"]);let xa=null;const ws=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),sr="http://www.w3.org/1998/Math/MathML",ir="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let an=ft,Da=!1,Ca=null;const Iu=ee({},[sr,ir,ft],Na);let Sn=null;const Lu=["application/xhtml+xml","text/html"],ju="text/html";let we=null,on=null;const Wu=e.createElement("form"),xs=function(k){return k instanceof RegExp||k instanceof Function},ka=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=jt(k),Sn=Lu.indexOf(k.PARSER_MEDIA_TYPE)===-1?ju:k.PARSER_MEDIA_TYPE,we=Sn==="application/xhtml+xml"?Na:xr,X=Je(k,"ALLOWED_TAGS")?ee({},k.ALLOWED_TAGS,we):le,J=Je(k,"ALLOWED_ATTR")?ee({},k.ALLOWED_ATTR,we):ve,Ca=Je(k,"ALLOWED_NAMESPACES")?ee({},k.ALLOWED_NAMESPACES,Na):Iu,xa=Je(k,"ADD_URI_SAFE_ATTR")?ee(jt(ws),k.ADD_URI_SAFE_ATTR,we):ws,bs=Je(k,"ADD_DATA_URI_TAGS")?ee(jt(vs),k.ADD_DATA_URI_TAGS,we):vs,rn=Je(k,"FORBID_CONTENTS")?ee({},k.FORBID_CONTENTS,we):ys,Qe=Je(k,"FORBID_TAGS")?ee({},k.FORBID_TAGS,we):{},Ve=Je(k,"FORBID_ATTR")?ee({},k.FORBID_ATTR,we):{},nn=Je(k,"USE_PROFILES")?k.USE_PROFILES:!1,Ct=k.ALLOW_ARIA_ATTR!==!1,Ke=k.ALLOW_DATA_ATTR!==!1,De=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Xe=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=k.SAFE_FOR_TEMPLATES||!1,kt=k.SAFE_FOR_XML!==!1,It=k.WHOLE_DOCUMENT||!1,tn=k.RETURN_DOM||!1,ar=k.RETURN_DOM_FRAGMENT||!1,or=k.RETURN_TRUSTED_TYPE||!1,va=k.FORCE_BODY||!1,ms=k.SANITIZE_DOM!==!1,gs=k.SANITIZE_NAMED_PROPS||!1,wa=k.KEEP_CONTENT!==!1,Tn=k.IN_PLACE||!1,K=k.ALLOWED_URI_REGEXP||nc,an=k.NAMESPACE||ft,te=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&xs(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&xs(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(Ke=!1),ar&&(tn=!0),nn&&(X=ee({},ei),J=[],nn.html===!0&&(ee(X,Zs),ee(J,ti)),nn.svg===!0&&(ee(X,Ra),ee(J,ja),ee(J,fr)),nn.svgFilters===!0&&(ee(X,Ia),ee(J,ja),ee(J,fr)),nn.mathMl===!0&&(ee(X,La),ee(J,ni),ee(J,fr))),k.ADD_TAGS&&(X===le&&(X=jt(X)),ee(X,k.ADD_TAGS,we)),k.ADD_ATTR&&(J===ve&&(J=jt(J)),ee(J,k.ADD_ATTR,we)),k.ADD_URI_SAFE_ATTR&&ee(xa,k.ADD_URI_SAFE_ATTR,we),k.FORBID_CONTENTS&&(rn===ys&&(rn=jt(rn)),ee(rn,k.FORBID_CONTENTS,we)),wa&&(X["#text"]=!0),It&&ee(X,["html","head","body"]),X.table&&(ee(X,["tbody"]),delete Qe.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw An('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw An('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=k.TRUSTED_TYPES_POLICY,O=S.createHTML("")}else S===void 0&&(S=Oh(m,a)),S!==null&&typeof O=="string"&&(O=S.createHTML(""));Ie&&Ie(k),on=k}},Ds=ee({},["mi","mo","mn","ms","mtext"]),Cs=ee({},["foreignobject","annotation-xml"]),Yu=ee({},["title","style","font","a","script"]),ks=ee({},[...Ra,...Ia,...xh]),_s=ee({},[...La,...Dh]),Bu=function(k){let W=_(k);(!W||!W.tagName)&&(W={namespaceURI:an,tagName:"template"});const z=xr(k.tagName),ce=xr(W.tagName);return Ca[k.namespaceURI]?k.namespaceURI===ir?W.namespaceURI===ft?z==="svg":W.namespaceURI===sr?z==="svg"&&(ce==="annotation-xml"||Ds[ce]):!!ks[z]:k.namespaceURI===sr?W.namespaceURI===ft?z==="math":W.namespaceURI===ir?z==="math"&&Cs[ce]:!!_s[z]:k.namespaceURI===ft?W.namespaceURI===ir&&!Cs[ce]||W.namespaceURI===sr&&!Ds[ce]?!1:!_s[z]&&(Yu[z]||!ks[z]):!!(Sn==="application/xhtml+xml"&&Ca[k.namespaceURI]):!1},tt=function(k){Pn(r.removed,{element:k});try{_(k).removeChild(k)}catch(W){b(k)}},lr=function(k,W){try{Pn(r.removed,{attribute:W.getAttributeNode(k),from:W})}catch(z){Pn(r.removed,{attribute:null,from:W})}if(W.removeAttribute(k),k==="is"&&!J[k])if(tn||ar)try{tt(W)}catch(z){}else try{W.setAttribute(k,"")}catch(z){}},Ts=function(k){let W=null,z=null;if(va)k="<remove></remove>"+k;else{const Ce=Js(k,/^[\r\n\t ]+/);z=Ce&&Ce[0]}Sn==="application/xhtml+xml"&&an===ft&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=S?S.createHTML(k):k;if(an===ft)try{W=new p().parseFromString(ce,Sn)}catch(Ce){}if(!W||!W.documentElement){W=j.createDocument(an,"template",null);try{W.documentElement.innerHTML=Da?O:ce}catch(Ce){}}const _e=W.body||W.documentElement;return k&&z&&_e.insertBefore(e.createTextNode(z),_e.childNodes[0]||null),an===ft?R.call(W,It?"html":"body")[0]:It?W.documentElement:_e},Ss=function(k){return B.call(k.ownerDocument||k,k,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Es=function(k){return k instanceof d&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof c)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Ps=function(k){return typeof i=="function"&&k instanceof i},pt=function(k,W,z){P[k]&&dr(P[k],ce=>{ce.call(r,W,z,on)})},Ms=function(k){let W=null;if(pt("beforeSanitizeElements",k,null),Es(k))return tt(k),!0;const z=we(k.nodeName);if(pt("uponSanitizeElement",k,{tagName:z,allowedTags:X}),k.hasChildNodes()&&!Ps(k.firstElementChild)&&Oe(/<[/\w]/g,k.innerHTML)&&Oe(/<[/\w]/g,k.textContent)||k.nodeType===Fn.progressingInstruction||kt&&k.nodeType===Fn.comment&&Oe(/<[/\w]/g,k.data))return tt(k),!0;if(!X[z]||Qe[z]){if(!Qe[z]&&Os(z)&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,z)||te.tagNameCheck instanceof Function&&te.tagNameCheck(z)))return!1;if(wa&&!rn[z]){const ce=_(k)||k.parentNode,_e=C(k)||k.childNodes;if(_e&&ce){const Ce=_e.length;for(let Le=Ce-1;Le>=0;--Le){const nt=v(_e[Le],!0);nt.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(nt,x(k))}}}return tt(k),!0}return k instanceof u&&!Bu(k)||(z==="noscript"||z==="noembed"||z==="noframes")&&Oe(/<\/no(script|embed|frames)/i,k.innerHTML)?(tt(k),!0):(Ue&&k.nodeType===Fn.text&&(W=k.textContent,dr([Y,$,N],ce=>{W=Mn(W,ce," ")}),k.textContent!==W&&(Pn(r.removed,{element:k.cloneNode()}),k.textContent=W)),pt("afterSanitizeElements",k,null),!1)},As=function(k,W,z){if(ms&&(W==="id"||W==="name")&&(z in e||z in Wu))return!1;if(!(Ke&&!Ve[W]&&Oe(M,W))){if(!(Ct&&Oe(F,W))){if(!J[W]||Ve[W]){if(!(Os(k)&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,k)||te.tagNameCheck instanceof Function&&te.tagNameCheck(k))&&(te.attributeNameCheck instanceof RegExp&&Oe(te.attributeNameCheck,W)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(W))||W==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,z)||te.tagNameCheck instanceof Function&&te.tagNameCheck(z))))return!1}else if(!xa[W]){if(!Oe(K,Mn(z,A,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&k!=="script"&&yh(z,"data:")===0&&bs[k])){if(!(De&&!Oe(E,Mn(z,A,"")))){if(z)return!1}}}}}}return!0},Os=function(k){return k!=="annotation-xml"&&Js(k,L)},Fs=function(k){pt("beforeSanitizeAttributes",k,null);const{attributes:W}=k;if(!W)return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J};let ce=W.length;for(;ce--;){const _e=W[ce],{name:Ce,namespaceURI:Le,value:nt}=_e,En=we(Ce);let Ae=Ce==="value"?nt:bh(nt);if(z.attrName=En,z.attrValue=Ae,z.keepAttr=!0,z.forceKeepAttr=void 0,pt("uponSanitizeAttribute",k,z),Ae=z.attrValue,kt&&Oe(/((--!?|])>)|<\/(style|title)/i,Ae)){lr(Ce,k);continue}if(z.forceKeepAttr||(lr(Ce,k),!z.keepAttr))continue;if(!Xe&&Oe(/\/>/i,Ae)){lr(Ce,k);continue}Ue&&dr([Y,$,N],Rs=>{Ae=Mn(Ae,Rs," ")});const Ns=we(k.nodeName);if(As(Ns,En,Ae)){if(gs&&(En==="id"||En==="name")&&(lr(Ce,k),Ae=Ru+Ae),S&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Le)switch(m.getAttributeType(Ns,En)){case"TrustedHTML":{Ae=S.createHTML(Ae);break}case"TrustedScriptURL":{Ae=S.createScriptURL(Ae);break}}try{Le?k.setAttributeNS(Le,Ce,Ae):k.setAttribute(Ce,Ae),Es(k)?tt(k):Xs(r.removed)}catch(Rs){}}}pt("afterSanitizeAttributes",k,null)},Hu=function V(k){let W=null;const z=Ss(k);for(pt("beforeSanitizeShadowDOM",k,null);W=z.nextNode();)pt("uponSanitizeShadowNode",W,null),!Ms(W)&&(W.content instanceof o&&V(W.content),Fs(W));pt("afterSanitizeShadowDOM",k,null)};return r.sanitize=function(V){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,z=null,ce=null,_e=null;if(Da=!V,Da&&(V="<!-->"),typeof V!="string"&&!Ps(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw An("dirty is not a string, aborting")}else throw An("toString is not a function");if(!r.isSupported)return V;if(ba||ka(k),r.removed=[],typeof V=="string"&&(Tn=!1),Tn){if(V.nodeName){const nt=we(V.nodeName);if(!X[nt]||Qe[nt])throw An("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof i)W=Ts("<!---->"),z=W.ownerDocument.importNode(V,!0),z.nodeType===Fn.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?W=z:W.appendChild(z);else{if(!tn&&!Ue&&!It&&V.indexOf("<")===-1)return S&&or?S.createHTML(V):V;if(W=Ts(V),!W)return tn?null:or?O:""}W&&va&&tt(W.firstChild);const Ce=Ss(Tn?V:W);for(;ce=Ce.nextNode();)Ms(ce)||(ce.content instanceof o&&Hu(ce.content),Fs(ce));if(Tn)return V;if(tn){if(ar)for(_e=H.call(W.ownerDocument);W.firstChild;)_e.appendChild(W.firstChild);else _e=W;return(J.shadowroot||J.shadowrootmode)&&(_e=I.call(n,_e,!0)),_e}let Le=It?W.outerHTML:W.innerHTML;return It&&X["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&Oe(rc,W.ownerDocument.doctype.name)&&(Le="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
7
+ */(function(t){(function(r,e){t.exports?t.exports=e():r.numeral=e()})(h.commonjsGlobal,function(){var r,e,n="2.0.6",a={},o={},s={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},i={currentLocale:s.currentLocale,zeroFormat:s.zeroFormat,nullFormat:s.nullFormat,defaultFormat:s.defaultFormat,scalePercentBy100:s.scalePercentBy100};function u(l,c){this._input=l,this._value=c}return r=function(l){var c,d,p,m;if(r.isNumeral(l))c=l.value();else if(l===0||typeof l=="undefined")c=0;else if(l===null||e.isNaN(l))c=null;else if(typeof l=="string")if(i.zeroFormat&&l===i.zeroFormat)c=0;else if(i.nullFormat&&l===i.nullFormat||!l.replace(/[^0-9]+/g,"").length)c=null;else{for(d in a)if(m=typeof a[d].regexps.unformat=="function"?a[d].regexps.unformat():a[d].regexps.unformat,m&&l.match(m)){p=a[d].unformat;break}p=p||r._.stringToNumber,c=p(l)}else c=Number(l)||null;return new u(l,c)},r.version=n,r.isNumeral=function(l){return l instanceof u},r._=e={numberToFormat:function(l,c,d){var p=o[r.options.currentLocale],m=!1,g=!1,v=0,b="",x=1e12,C=1e9,_=1e6,S=1e3,O="",j=!1,B,H,R,I,P,Y,$;if(l=l||0,H=Math.abs(l),r._.includes(c,"(")?(m=!0,c=c.replace(/[\(|\)]/g,"")):(r._.includes(c,"+")||r._.includes(c,"-"))&&(P=r._.includes(c,"+")?c.indexOf("+"):l<0?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),r._.includes(c,"a")&&(B=c.match(/a(k|m|b|t)?/),B=B?B[1]:!1,r._.includes(c," a")&&(b=" "),c=c.replace(new RegExp(b+"a[kmbt]?"),""),H>=x&&!B||B==="t"?(b+=p.abbreviations.trillion,l=l/x):H<x&&H>=C&&!B||B==="b"?(b+=p.abbreviations.billion,l=l/C):H<C&&H>=_&&!B||B==="m"?(b+=p.abbreviations.million,l=l/_):(H<_&&H>=S&&!B||B==="k")&&(b+=p.abbreviations.thousand,l=l/S)),r._.includes(c,"[.]")&&(g=!0,c=c.replace("[.]",".")),R=l.toString().split(".")[0],I=c.split(".")[1],Y=c.indexOf(","),v=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,I?(r._.includes(I,"[")?(I=I.replace("]",""),I=I.split("["),O=r._.toFixed(l,I[0].length+I[1].length,d,I[1].length)):O=r._.toFixed(l,I.length,d),R=O.split(".")[0],r._.includes(O,".")?O=p.delimiters.decimal+O.split(".")[1]:O="",g&&Number(O.slice(1))===0&&(O="")):R=r._.toFixed(l,0,d),b&&!B&&Number(R)>=1e3&&b!==p.abbreviations.trillion)switch(R=String(Number(R)/1e3),b){case p.abbreviations.thousand:b=p.abbreviations.million;break;case p.abbreviations.million:b=p.abbreviations.billion;break;case p.abbreviations.billion:b=p.abbreviations.trillion;break}if(r._.includes(R,"-")&&(R=R.slice(1),j=!0),R.length<v)for(var N=v-R.length;N>0;N--)R="0"+R;return Y>-1&&(R=R.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+p.delimiters.thousands)),c.indexOf(".")===0&&(R=""),$=R+O+(b||""),m?$=(m&&j?"(":"")+$+(m&&j?")":""):P>=0?$=P===0?(j?"-":"+")+$:$+(j?"-":"+"):j&&($="-"+$),$},stringToNumber:function(l){var c=o[i.currentLocale],d=l,p={thousand:3,million:6,billion:9,trillion:12},m,g,v;if(i.zeroFormat&&l===i.zeroFormat)g=0;else if(i.nullFormat&&l===i.nullFormat||!l.replace(/[^0-9]+/g,"").length)g=null;else{g=1,c.delimiters.decimal!=="."&&(l=l.replace(/\./g,"").replace(c.delimiters.decimal,"."));for(m in p)if(v=new RegExp("[^a-zA-Z]"+c.abbreviations[m]+"(?:\\)|(\\"+c.currency.symbol+")?(?:\\))?)?$"),d.match(v)){g*=Math.pow(10,p[m]);break}g*=(l.split("-").length+Math.min(l.split("(").length-1,l.split(")").length-1))%2?1:-1,l=l.replace(/[^0-9\.]+/g,""),g*=Number(l)}return g},isNaN:function(l){return typeof l=="number"&&isNaN(l)},includes:function(l,c){return l.indexOf(c)!==-1},insert:function(l,c,d){return l.slice(0,d)+c+l.slice(d)},reduce:function(l,c){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof c!="function")throw new TypeError(c+" is not a function");var d=Object(l),p=d.length>>>0,m=0,g;if(arguments.length===3)g=arguments[2];else{for(;m<p&&!(m in d);)m++;if(m>=p)throw new TypeError("Reduce of empty array with no initial value");g=d[m++]}for(;m<p;m++)m in d&&(g=c(g,d[m],m,d));return g},multiplier:function(l){var c=l.toString().split(".");return c.length<2?1:Math.pow(10,c[1].length)},correctionFactor:function(){var l=Array.prototype.slice.call(arguments);return l.reduce(function(c,d){var p=e.multiplier(d);return c>p?c:p},1)},toFixed:function(l,c,d,p){var m=l.toString().split("."),g=c-(p||0),v,b,x,C;return m.length===2?v=Math.min(Math.max(m[1].length,g),c):v=g,x=Math.pow(10,v),C=(d(l+"e+"+v)/x).toFixed(v),p>c-v&&(b=new RegExp("\\.?0{1,"+(p-(c-v))+"}$"),C=C.replace(b,"")),C}},r.options=i,r.formats=a,r.locales=o,r.locale=function(l){return l&&(i.currentLocale=l.toLowerCase()),i.currentLocale},r.localeData=function(l){if(!l)return o[i.currentLocale];if(l=l.toLowerCase(),!o[l])throw new Error("Unknown locale : "+l);return o[l]},r.reset=function(){for(var l in s)i[l]=s[l]},r.zeroFormat=function(l){i.zeroFormat=typeof l=="string"?l:null},r.nullFormat=function(l){i.nullFormat=typeof l=="string"?l:null},r.defaultFormat=function(l){i.defaultFormat=typeof l=="string"?l:"0.0"},r.register=function(l,c,d){if(c=c.toLowerCase(),this[l+"s"][c])throw new TypeError(c+" "+l+" already registered.");return this[l+"s"][c]=d,d},r.validate=function(l,c){var d,p,m,g,v,b,x,C;if(typeof l!="string"&&(l+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",l)),l=l.trim(),l.match(/^\d+$/))return!0;if(l==="")return!1;try{x=r.localeData(c)}catch(_){x=r.localeData(r.locale())}return m=x.currency.symbol,v=x.abbreviations,d=x.delimiters.decimal,x.delimiters.thousands==="."?p="\\.":p=x.delimiters.thousands,C=l.match(/^[^\d]+/),C!==null&&(l=l.substr(1),C[0]!==m)||(C=l.match(/[^\d]+$/),C!==null&&(l=l.slice(0,-1),C[0]!==v.thousand&&C[0]!==v.million&&C[0]!==v.billion&&C[0]!==v.trillion))?!1:(b=new RegExp(p+"{2}"),l.match(/[^\d.,]/g)?!1:(g=l.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(b):g[0].length===1?!!g[0].match(/^\d+$/)&&!g[0].match(b)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(b)&&!!g[1].match(/^\d+$/)))},r.fn=u.prototype={clone:function(){return r(this)},format:function(l,c){var d=this._value,p=l||i.defaultFormat,m,g,v;if(c=c||Math.round,d===0&&i.zeroFormat!==null)g=i.zeroFormat;else if(d===null&&i.nullFormat!==null)g=i.nullFormat;else{for(m in a)if(p.match(a[m].regexps.format)){v=a[m].format;break}v=v||r._.numberToFormat,g=v(d,p,c)}return g},value:function(){return this._value},input:function(){return this._input},set:function(l){return this._value=Number(l),this},add:function(l){var c=e.correctionFactor.call(null,this._value,l);function d(p,m,g,v){return p+Math.round(c*m)}return this._value=e.reduce([this._value,l],d,0)/c,this},subtract:function(l){var c=e.correctionFactor.call(null,this._value,l);function d(p,m,g,v){return p-Math.round(c*m)}return this._value=e.reduce([l],d,Math.round(this._value*c))/c,this},multiply:function(l){function c(d,p,m,g){var v=e.correctionFactor(d,p);return Math.round(d*v)*Math.round(p*v)/Math.round(v*v)}return this._value=e.reduce([this._value,l],c,1),this},divide:function(l){function c(d,p,m,g){var v=e.correctionFactor(d,p);return Math.round(d*v)/Math.round(p*v)}return this._value=e.reduce([this._value,l],c),this},difference:function(l){return Math.abs(r(this._value).subtract(l).value())}},r.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(l){var c=l%10;return~~(l%100/10)===1?"th":c===1?"st":c===2?"nd":c===3?"rd":"th"},currency:{symbol:"$"}}),function(){r.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(l,c,d){var p=r._.includes(c," BPS")?" ":"",m;return l=l*1e4,c=c.replace(/\s?BPS/,""),m=r._.numberToFormat(l,c,d),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,p+"BPS"),m=m.join("")):m=m+p+"BPS",m},unformat:function(l){return+(r._.stringToNumber(l)*1e-4).toFixed(15)}})}(),function(){var l={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=l.suffixes.concat(c.suffixes.filter(function(m){return l.suffixes.indexOf(m)<0})),p=d.join("|");p="("+p.replace("B","B(?!PS)")+")",r.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(p)},format:function(m,g,v){var b,x=r._.includes(g,"ib")?c:l,C=r._.includes(g," b")||r._.includes(g," ib")?" ":"",_,S,O;for(g=g.replace(/\s?i?b/,""),_=0;_<=x.suffixes.length;_++)if(S=Math.pow(x.base,_),O=Math.pow(x.base,_+1),m===null||m===0||m>=S&&m<O){C+=x.suffixes[_],S>0&&(m=m/S);break}return b=r._.numberToFormat(m,g,v),b+C},unformat:function(m){var g=r._.stringToNumber(m),v,b;if(g){for(v=l.suffixes.length-1;v>=0;v--){if(r._.includes(m,l.suffixes[v])){b=Math.pow(l.base,v);break}if(r._.includes(m,c.suffixes[v])){b=Math.pow(c.base,v);break}}g*=b||1}return g}})}(),function(){r.register("format","currency",{regexps:{format:/(\$)/},format:function(l,c,d){var p=r.locales[r.options.currentLocale],m={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]},g,v,b;for(c=c.replace(/\s?\$\s?/,""),g=r._.numberToFormat(l,c,d),l>=0?(m.before=m.before.replace(/[\-\(]/,""),m.after=m.after.replace(/[\-\)]/,"")):l<0&&!r._.includes(m.before,"-")&&!r._.includes(m.before,"(")&&(m.before="-"+m.before),b=0;b<m.before.length;b++)switch(v=m.before[b],v){case"$":g=r._.insert(g,p.currency.symbol,b);break;case" ":g=r._.insert(g," ",b+p.currency.symbol.length-1);break}for(b=m.after.length-1;b>=0;b--)switch(v=m.after[b],v){case"$":g=b===m.after.length-1?g+p.currency.symbol:r._.insert(g,p.currency.symbol,-(m.after.length-(1+b)));break;case" ":g=b===m.after.length-1?g+" ":r._.insert(g," ",-(m.after.length-(1+b)+p.currency.symbol.length-1));break}return g}})}(),function(){r.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(l,c,d){var p,m=typeof l=="number"&&!r._.isNaN(l)?l.toExponential():"0e+0",g=m.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),p=r._.numberToFormat(Number(g[0]),c,d),p+"e"+g[1]},unformat:function(l){var c=r._.includes(l,"e+")?l.split("e+"):l.split("e-"),d=Number(c[0]),p=Number(c[1]);p=r._.includes(l,"e-")?p*=-1:p;function m(g,v,b,x){var C=r._.correctionFactor(g,v),_=g*C*(v*C)/(C*C);return _}return r._.reduce([d,Math.pow(10,p)],m,1)}})}(),function(){r.register("format","ordinal",{regexps:{format:/(o)/},format:function(l,c,d){var p=r.locales[r.options.currentLocale],m,g=r._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=p.ordinal(l),m=r._.numberToFormat(l,c,d),m+g}})}(),function(){r.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(l,c,d){var p=r._.includes(c," %")?" ":"",m;return r.options.scalePercentBy100&&(l=l*100),c=c.replace(/\s?\%/,""),m=r._.numberToFormat(l,c,d),r._.includes(m,")")?(m=m.split(""),m.splice(-1,0,p+"%"),m=m.join("")):m=m+p+"%",m},unformat:function(l){var c=r._.stringToNumber(l);return r.options.scalePercentBy100?c*.01:c}})}(),function(){r.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(l,c,d){var p=Math.floor(l/60/60),m=Math.floor((l-p*60*60)/60),g=Math.round(l-p*60*60-m*60);return p+":"+(m<10?"0"+m:m)+":"+(g<10?"0"+g:g)},unformat:function(l){var c=l.split(":"),d=0;return c.length===3?(d=d+Number(c[0])*60*60,d=d+Number(c[1])*60,d=d+Number(c[2])):c.length===2&&(d=d+Number(c[0])*60,d=d+Number(c[1])),Number(d)}})}(),r})})(wl);var nf=wl.exports;const rf=h.getDefaultExportFromCjs(nf),af=(t,r)=>{const e=lf(t);return of(e,r)};function of(t,r){return{columns:r==null?void 0:r.map(e=>({name:e.name,type:h.simpleColumnType(e.type)})),rows:sf(t)}}function sf(t){var r;let e=!1;const n=(r=t[0])===null||r===void 0?void 0:r.map((a,o)=>{const s=t.some(i=>"selected"in i[o]);return s&&(e=!0),s});return t.map(a=>{const o=e?n.some((s,i)=>s&&!a[i].selected):void 0;return a.map(s=>o!==void 0?{data:s.data,text:s.text,blur:o}:{data:s.data,text:s.text})})}function lf({values:t=[],metadata:r=[]}){var e,n,a,o;t[0]&&!Array.isArray(t[0])&&(t=[t]);for(let s=0;s<t.length;s++){const i=t[s];for(let u=0;u<i.length;u++)r[u].format&&(!((n=(e=r[u])===null||e===void 0?void 0:e.format)===null||n===void 0)&&n.number)&&(i[u].text=rf(i[u].data).format((o=(a=r[u])===null||a===void 0?void 0:a.format)===null||o===void 0?void 0:o.number))}return t}class Me extends h.AbstractTranslatableError{constructor(r,e){super(fl,{key:r,interpolationOptions:e},wd.t)}get status(){return this.interpolationOptions.status}}var Lt=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};class cf extends We.AbstractTaskManager{constructor(r,e){super(),this.sentRequestsAbortersMap=new Map,this.executeQuerySending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_JAQL_QUERY",this.sendJaqlQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executeDownloadCsvSending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.prepareJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_DOWNLOAD_CSV_QUERY",this.sendCsvQuery.bind(this),this.cancelDataRetrievalQuery.bind(this))]),this.executePivotQuerySending=super.createFlow([new We.Step("PREPARE_JAQL_PAYLOAD",this.preparePivotJaqlPayload.bind(this),()=>Lt(this,void 0,void 0,function*(){})),new We.Step("SEND_JAQL_QUERY",this.sendPivotJaqlQuery.bind(this),this.cancelPivotJaqlQuery.bind(this))]),this.queryApi=r,this.pivotClient=e}prepareJaqlPayload(r){return Lt(this,void 0,void 0,function*(){const{queryDescription:e,executionConfig:n}=r.passport,a=f.getJaqlQueryPayload(e,n.shouldSkipHighlightsWithoutAttributes),o=r.passport.executionConfig.onBeforeQuery;return o?o(a):a})}sendJaqlQuery(r,e){return Lt(this,void 0,void 0,function*(){const{queryDescription:n,taskId:a}=r.passport,{responsePromise:o,abortHttpRequest:s}=this.queryApi.sendJaqlRequest(r.passport.queryDescription.dataSource,e);this.sentRequestsAbortersMap.set(a,s);const i=yield o.finally(()=>{this.sentRequestsAbortersMap.delete(a)});uf(i);const u=[...n.attributes,...n.measures],l=(i.headers||[]).slice(u.length).map(c=>({name:c,type:"number"}));return af(i,[...u,...l])})}sendCsvQuery(r,e){return Lt(this,void 0,void 0,function*(){const{taskId:n}=r.passport,{responsePromise:a,abortHttpRequest:o}=this.queryApi.sendDownloadCsvRequest(r.passport.queryDescription.dataSource,e);return this.sentRequestsAbortersMap.set(n,o),a.finally(()=>{this.sentRequestsAbortersMap.delete(n)})})}cancelDataRetrievalQuery(r){const e=r.passport.taskId,n=this.sentRequestsAbortersMap.get(e);return n&&(n(),this.sentRequestsAbortersMap.delete(e)),this.queryApi.sendCancelJaqlQueryRequest(e,r.passport.queryDescription.dataSource)}preparePivotJaqlPayload(r){return Lt(this,void 0,void 0,function*(){const{pivotQueryDescription:e,executionConfig:n}=r.passport,a=f.getPivotJaqlQueryPayload(e,n.shouldSkipHighlightsWithoutAttributes),o=r.passport.executionConfig.onBeforeQuery;return o?o(a):a})}sendPivotJaqlQuery(r,e){var n;const{pivotQueryDescription:a}=r.passport;return this.pivotClient.queryData(e,!0,(n=a.count)!==null&&n!==void 0?n:bf,!1)}cancelPivotJaqlQuery(r){const e=r.passport.taskId,n=this.sentRequestsAbortersMap.get(e);return n&&(n(),this.sentRequestsAbortersMap.delete(e)),this.queryApi.sendCancelJaqlQueryRequest(e,r.passport.pivotQueryDescription.dataSource)}}function uf(t){var r;if(!t)throw new Me("errors.noJaqlResponse");if(t.error)throw new Error(`${t.details} ${(r=t.database)!==null&&r!==void 0?r:""} ${t.extraDetails?JSON.stringify(t.extraDetails):""}`)}class Bs extends We.TaskPassport{constructor(r,e,n){super(),this.queryDescription=e,this.type=r,this.executionConfig=n}}class df extends We.TaskPassport{constructor(r,e,n){super(),this.pivotQueryDescription=e,this.type=r,this.executionConfig=n}}var ff=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};const Hn="api/datasources",pf="api/v2/datamodels";class hf{constructor(r){this.httpClient=r}getDataSourceFields(r,e=9999,n=0){const a=h.getDataSourceName(r),o=`${Hn}/${encodeURI(a)}/fields/search`;return this.httpClient.post(o,{offset:n,count:e}).catch(()=>{throw new Me("errors.dataSourceNotFound",{dataSource:typeof r=="string"?r:r.title})})}getDataSourceList(){const r=`${Hn}/?sharedWith=r,w`;return this.httpClient.get(r)}getDataSourceSchema(r){const e=`${pf}/schema?title=${encodeURIComponent(r)}`;return this.httpClient.get(e)}sendJaqlRequest(r,e){const n=xl(r),a=new AbortController;return{responsePromise:this.httpClient.post(n,e,void 0,a.signal).then(o=>Array.isArray(o)?{values:[],metadata:[]}:o),abortHttpRequest:o=>a.abort(o)}}sendDownloadCsvRequest(r,e){const n=yf(r),a=new AbortController,o=new URLSearchParams;return o.append("data",encodeURIComponent(JSON.stringify(e))),{responsePromise:this.httpClient.post(n,o,{headers:{"Content-Type":"application/x-www-form-urlencoded"}},a.signal,{nonJSONBody:!0,returnBlob:!0}),abortHttpRequest:s=>a.abort(s)}}sendCancelJaqlQueryRequest(r,e){return this.sendCancelMultipleJaqlQueriesRequest([r],e)}sendCancelMultipleJaqlQueriesRequest(r,e){return ff(this,void 0,void 0,function*(){const n={queries:r.join(";")},a=mf(e);try{yield this.httpClient.post(a,n)}catch(o){if(o.status==="404"){const s=gf(e);yield this.httpClient.post(s,n)}else throw o}})}}function mf(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/localhost/${r}/cancel_queries`}function gf(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/live/${r}/cancel_queries`}function xl(t){const r=encodeURIComponent(h.getDataSourceName(t));return`${Hn}/${r}/jaql`}function yf(t){return`${xl(t)}/csv`}var Hs=function(t,r,e,n){function a(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function i(c){try{l(n.next(c))}catch(d){s(d)}}function u(c){try{l(n.throw(c))}catch(d){s(d)}}function l(c){c.done?o(c.value):a(c.value).then(i,u)}l((n=n.apply(t,r||[])).next())})};const bf=2e4,Fa="Unspecified reason";class vf{constructor(r,e=new f.tj(r.url,r.auth),n){xf(r),this.queryApi=new hf(r),this.taskManager=new cf(this.queryApi,e),this.shouldSkipHighlightsWithoutAttributes=n!=null?n:!1}executeQuery(r,e){const n=new Bs("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{$s(r),this.taskManager.executeQuerySending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}executeCsvQuery(r,e){const n=new Bs("SEND_DOWNLOAD_CSV_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{$s(r),this.taskManager.executeDownloadCsvSending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}executePivotQuery(r,e){const n=new df("SEND_JAQL_QUERY",r,Object.assign(Object.assign({},e||{}),{shouldSkipHighlightsWithoutAttributes:this.shouldSkipHighlightsWithoutAttributes||!1}));return{resultPromise:new Promise((a,o)=>{wf(r),this.taskManager.executePivotQuerySending(n).then(s=>{s.status===We.ExecutionResultStatus.SUCCESS?a(s.result):o(s.error)})}),cancel:a=>this.taskManager.cancel(n.taskId,a||Fa)}}getDataSourceFields(r,e=9999,n=0){return Hs(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceFields(r,e,n))||[]})}getDataSourceSchema(r){return this.queryApi.getDataSourceSchema(r)}getDataSourceList(){return Hs(this,void 0,void 0,function*(){return(yield this.queryApi.getDataSourceList())||[]})}}function $s(t){const{attributes:r,measures:e,filters:n,highlights:a,count:o,offset:s}=t;if(o&&o<0)throw new Me("errors.invalidCountNegative",{count:o.toString()});if(s&&s<0)throw new Me("errors.invalidOffset",{offset:s.toString()});if(r.length+e.length===0)throw new Me("errors.noDimensionsOrMeasures");r.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isAttribute(i)){const{name:u}=i;throw new Me("errors.invalidAttribute",{attributeName:u})}}),e.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isMeasure(i))throw new Me("errors.invalidMeasure",{measureName:i.name})}),n.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isFilter(i))throw new Me("errors.invalidFilter",{filterName:i.name})}),a.forEach(i=>{if(!i.skipValidation&&!h.MetadataTypes.isFilter(i))throw new Me("errors.invalidHighlight",{highlightName:i.name})})}function wf(t){const{rowsAttributes:r,columnsAttributes:e,measures:n,filters:a,highlights:o,count:s,offset:i}=t;if(s&&s<0)throw new Me("errors.invalidCountNegative",{count:s.toString()});if(i&&i<0)throw new Me("errors.invalidOffset",{offset:i.toString()});if(r.length+e.length+n.length===0)throw new Me("errors.noDimensionsOrMeasures");a.forEach(u=>{if(!u.skipValidation&&!h.MetadataTypes.isFilter(u))throw new Me("errors.invalidFilter",{filterName:u.name})}),o.forEach(u=>{if(!u.skipValidation&&!h.MetadataTypes.isFilter(u))throw new Me("errors.invalidHighlight",{highlightName:u.name})})}function xf(t){if(!t)throw new Me("errors.missingHttpClient");if(!t.post)throw new Me("errors.missingPostMethod")}const Df=2e4,Cf={enabled:!0,delay:500},kf={locale:f.getBaseDateFnsLocale(),dateConfig:f.defaultDateConfig,loadingIndicatorConfig:Cf,translationConfig:{language:"en",customTranslations:[]},language:"en",queryCacheConfig:{enabled:!1},queryLimit:Df,accessibilityConfig:{enabled:!1},errorBoundaryConfig:{alwaysShowErrorText:!1},trackingConfig:{enabled:!0}};function _f(t,r,e){return he(this,null,function*(){var a;const n=yield Sf(r,e);return h.merge.withOptions({mergeArrays:!1},kf,{locale:f.getBaseDateFnsLocale((a=t==null?void 0:t.translationConfig)==null?void 0:a.language)},n,t)})}function Tf(t){const r={};return t.forEach(e=>{r[e.key]=e}),r}function Sf(t,r=!1){return he(this,null,function*(){const e=yield t.get("api/globals");if(!e)throw new h.TranslatableError("errors.serverSettingsNotLoaded");const n=r?{colors:f.getDefaultThemeSettings().palette.variantColors}:yield f.getLegacyPalette(f.getPaletteName(e.designSettings),t);return{serverThemeSettings:f.convertToThemeSettings(e.designSettings,n,t.url),serverLanguage:e.language,serverVersion:e.version,serverFeatures:Tf(e.features),user:{tenant:{name:e.user.tenant.name}}}})}const Ef="system";function Pf(t,r){return r===Ef?t:t.replace(`/${r}`,"")}function Mf(){window.addEventListener("unhandledrejection",t=>{t.reason instanceof Error?console.error(t.reason.message):console.error(t.reason)})}const Dl=u=>he(exports,[u],function*({defaultDataSource:t,url:r,token:e,wat:n,ssoEnabled:a,appConfig:o,enableSilentPreAuth:s,useFusionAuth:i}){if(r===void 0)throw new h.TranslatableError("errors.sisenseContextNoAuthentication");const l=xn(r),c=pd({url:l,token:e,wat:n,ssoEnabled:a,enableSilentPreAuth:s,useFusionAuth:i});if(!c)throw new h.TranslatableError("errors.sisenseContextNoAuthentication");Mf();const d=new md(l,c,"sdk-ui-1.27.1"),p=yield d.login(),m=ul(c)||!p,g=yield _f(o||{},d,m),v=new f.tj(Pf(l,g.user.tenant.name),c),b=new vf(d,v),x={clear:f.clearExecuteQueryCache};return{httpClient:d,pivotClient:v,queryClient:b,settings:g,defaultDataSource:t,queryCache:x}}),Cl=G.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cl.displayName="FormControlContext");function Af(){return G.useContext(Cl)}function Of(t){return f.generateUtilityClass("PrivateSwitchBase",t)}f.generateUtilityClasses("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Ff=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],Nf=t=>{const{classes:r,checked:e,disabled:n,edge:a}=t,o={root:["root",e&&"checked",n&&"disabled",a&&`edge${f.capitalize(a)}`],input:["input"]};return f.composeClasses(o,Of,r)},Rf=f.styled(f.ButtonBase)(({ownerState:t})=>f._extends({padding:9,borderRadius:"50%"},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12})),If=f.styled("input",{shouldForwardProp:f.rootShouldForwardProp})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),kl=G.forwardRef(function(r,e){const{autoFocus:n,checked:a,checkedIcon:o,className:s,defaultChecked:i,disabled:u,disableFocusRipple:l=!1,edge:c=!1,icon:d,id:p,inputProps:m,inputRef:g,name:v,onBlur:b,onChange:x,onFocus:C,readOnly:_,required:S=!1,tabIndex:O,type:j,value:B}=r,H=f._objectWithoutPropertiesLoose(r,Ff),[R,I]=f.useControlled({controlled:a,default:!!i,name:"SwitchBase",state:"checked"}),P=Af(),Y=L=>{C&&C(L),P&&P.onFocus&&P.onFocus(L)},$=L=>{b&&b(L),P&&P.onBlur&&P.onBlur(L)},N=L=>{if(L.nativeEvent.defaultPrevented)return;const K=L.target.checked;I(K),x&&x(L,K)};let M=u;P&&typeof M=="undefined"&&(M=P.disabled);const F=j==="checkbox"||j==="radio",E=f._extends({},r,{checked:R,disabled:M,disableFocusRipple:l,edge:c}),A=Nf(E);return y.jsxs(Rf,f._extends({component:"span",className:f.clsx(A.root,s),centerRipple:!0,focusRipple:!l,disabled:M,tabIndex:null,role:void 0,onFocus:Y,onBlur:$,ownerState:E,ref:e},H,{children:[y.jsx(If,f._extends({autoFocus:n,checked:a,defaultChecked:i,className:A.input,disabled:M,id:F?p:void 0,name:v,onChange:N,readOnly:_,ref:g,required:S,ownerState:E,tabIndex:O,type:j},j==="checkbox"&&B===void 0?{}:{value:B},m)),R?o:d]}))});process.env.NODE_ENV!=="production"&&(kl.propTypes={autoFocus:f.PropTypes.bool,checked:f.PropTypes.bool,checkedIcon:f.PropTypes.node.isRequired,classes:f.PropTypes.object,className:f.PropTypes.string,defaultChecked:f.PropTypes.bool,disabled:f.PropTypes.bool,disableFocusRipple:f.PropTypes.bool,edge:f.PropTypes.oneOf(["end","start",!1]),icon:f.PropTypes.node.isRequired,id:f.PropTypes.string,inputProps:f.PropTypes.object,inputRef:f.refType,name:f.PropTypes.string,onBlur:f.PropTypes.func,onChange:f.PropTypes.func,onFocus:f.PropTypes.func,readOnly:f.PropTypes.bool,required:f.PropTypes.bool,sx:f.PropTypes.object,tabIndex:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string]),type:f.PropTypes.string.isRequired,value:f.PropTypes.any});function qs(t){return t.substring(2).toLowerCase()}function Lf(t,r){return r.documentElement.clientWidth<t.clientX||r.documentElement.clientHeight<t.clientY}function Or(t){const{children:r,disableReactTree:e=!1,mouseEvent:n="onClick",onClickAway:a,touchEvent:o="onTouchEnd"}=t,s=G.useRef(!1),i=G.useRef(null),u=G.useRef(!1),l=G.useRef(!1);G.useEffect(()=>(setTimeout(()=>{u.current=!0},0),()=>{u.current=!1}),[]);const c=f.useForkRef(r.ref,i),d=f.useEventCallback(g=>{const v=l.current;l.current=!1;const b=f.ownerDocument(i.current);if(!u.current||!i.current||"clientX"in g&&Lf(g,b))return;if(s.current){s.current=!1;return}let x;g.composedPath?x=g.composedPath().indexOf(i.current)>-1:x=!b.documentElement.contains(g.target)||i.current.contains(g.target),!x&&(e||!v)&&a(g)}),p=g=>v=>{l.current=!0;const b=r.props[g];b&&b(v)},m={ref:c};return o!==!1&&(m[o]=p(o)),G.useEffect(()=>{if(o!==!1){const g=qs(o),v=f.ownerDocument(i.current),b=()=>{s.current=!0};return v.addEventListener(g,d),v.addEventListener("touchmove",b),()=>{v.removeEventListener(g,d),v.removeEventListener("touchmove",b)}}},[d,o]),n!==!1&&(m[n]=p(n)),G.useEffect(()=>{if(n!==!1){const g=qs(n),v=f.ownerDocument(i.current);return v.addEventListener(g,d),()=>{v.removeEventListener(g,d)}}},[d,n]),y.jsx(G.Fragment,{children:G.cloneElement(r,m)})}process.env.NODE_ENV!=="production"&&(Or.propTypes={children:f.elementAcceptingRef.isRequired,disableReactTree:f.PropTypes.bool,mouseEvent:f.PropTypes.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:f.PropTypes.func.isRequired,touchEvent:f.PropTypes.oneOf(["onTouchEnd","onTouchStart",!1])});process.env.NODE_ENV!=="production"&&(Or.propTypes=f.exactProp(Or.propTypes));function jf(t){return f.generateUtilityClass("MuiSwitch",t)}const Fe=f.generateUtilityClasses("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),Wf=["className","color","edge","size","sx"],Yf=t=>{const{classes:r,edge:e,size:n,color:a,checked:o,disabled:s}=t,i={root:["root",e&&`edge${f.capitalize(e)}`,`size${f.capitalize(n)}`],switchBase:["switchBase",`color${f.capitalize(a)}`,o&&"checked",s&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},u=f.composeClasses(i,jf,r);return f._extends({},r,u)},Bf=f.styled("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(t,r)=>{const{ownerState:e}=t;return[r.root,e.edge&&r[`edge${f.capitalize(e.edge)}`],r[`size${f.capitalize(e.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,[`& .${Fe.thumb}`]:{width:16,height:16},[`& .${Fe.switchBase}`]:{padding:4,[`&.${Fe.checked}`]:{transform:"translateX(16px)"}}}}]}),Hf=f.styled(kl,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(t,r)=>{const{ownerState:e}=t;return[r.switchBase,{[`& .${Fe.input}`]:r.input},e.color!=="default"&&r[`color${f.capitalize(e.color)}`]]}})(({theme:t})=>({position:"absolute",top:0,left:0,zIndex:1,color:t.vars?t.vars.palette.Switch.defaultColor:`${t.palette.mode==="light"?t.palette.common.white:t.palette.grey[300]}`,transition:t.transitions.create(["left","transform"],{duration:t.transitions.duration.shortest}),[`&.${Fe.checked}`]:{transform:"translateX(20px)"},[`&.${Fe.disabled}`]:{color:t.vars?t.vars.palette.Switch.defaultDisabledColor:`${t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]}`},[`&.${Fe.checked} + .${Fe.track}`]:{opacity:.5},[`&.${Fe.disabled} + .${Fe.track}`]:{opacity:t.vars?t.vars.opacity.switchTrackDisabled:`${t.palette.mode==="light"?.12:.2}`},[`& .${Fe.input}`]:{left:"-100%",width:"300%"}}),({theme:t})=>({"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.action.activeChannel} / ${t.vars.palette.action.hoverOpacity})`:f.alpha_1(t.palette.action.active,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(t.palette).filter(([,r])=>r.main&&r.light).map(([r])=>({props:{color:r},style:{[`&.${Fe.checked}`]:{color:(t.vars||t).palette[r].main,"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:f.alpha_1(t.palette[r].main,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Fe.disabled}`]:{color:t.vars?t.vars.palette.Switch[`${r}DisabledColor`]:`${t.palette.mode==="light"?f.lighten_1(t.palette[r].main,.62):f.darken_1(t.palette[r].main,.55)}`}},[`&.${Fe.checked} + .${Fe.track}`]:{backgroundColor:(t.vars||t).palette[r].main}}}))]})),$f=f.styled("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(t,r)=>r.track})(({theme:t})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:t.transitions.create(["opacity","background-color"],{duration:t.transitions.duration.shortest}),backgroundColor:t.vars?t.vars.palette.common.onBackground:`${t.palette.mode==="light"?t.palette.common.black:t.palette.common.white}`,opacity:t.vars?t.vars.opacity.switchTrack:`${t.palette.mode==="light"?.38:.3}`})),qf=f.styled("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(t,r)=>r.thumb})(({theme:t})=>({boxShadow:(t.vars||t).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),_l=G.forwardRef(function(r,e){const n=f.useDefaultProps({props:r,name:"MuiSwitch"}),{className:a,color:o="primary",edge:s=!1,size:i="medium",sx:u}=n,l=f._objectWithoutPropertiesLoose(n,Wf),c=f._extends({},n,{color:o,edge:s,size:i}),d=Yf(c),p=y.jsx(qf,{className:d.thumb,ownerState:c});return y.jsxs(Bf,{className:f.clsx(d.root,a),sx:u,ownerState:c,children:[y.jsx(Hf,f._extends({type:"checkbox",icon:p,checkedIcon:p,ref:e,ownerState:c},l,{classes:f._extends({},d,{root:d.switchBase})})),y.jsx($f,{className:d.track,ownerState:c})]})});process.env.NODE_ENV!=="production"&&(_l.propTypes={checked:f.PropTypes.bool,checkedIcon:f.PropTypes.node,classes:f.PropTypes.object,className:f.PropTypes.string,color:f.PropTypes.oneOfType([f.PropTypes.oneOf(["default","primary","secondary","error","info","success","warning"]),f.PropTypes.string]),defaultChecked:f.PropTypes.bool,disabled:f.PropTypes.bool,disableRipple:f.PropTypes.bool,edge:f.PropTypes.oneOf(["end","start",!1]),icon:f.PropTypes.node,id:f.PropTypes.string,inputProps:f.PropTypes.object,inputRef:f.refType,onChange:f.PropTypes.func,required:f.PropTypes.bool,size:f.PropTypes.oneOfType([f.PropTypes.oneOf(["medium","small"]),f.PropTypes.string]),sx:f.PropTypes.oneOfType([f.PropTypes.arrayOf(f.PropTypes.oneOfType([f.PropTypes.func,f.PropTypes.object,f.PropTypes.bool])),f.PropTypes.func,f.PropTypes.object]),value:f.PropTypes.any});const Ht=(t,r)=>`${r}px solid ${t}`,Qf=t=>({columns:[{widthPercentage:100,rows:t.map(r=>({cells:[{widthPercentage:100,widgetId:r.id}]}))}]});function Tl(t){return f.isString(t)?{direction:t}:t}function Qs(t,r){return{valuesIndex:t.field-(r.rows||[]).length-(r.columns||[]).length,columnsMembersPath:Object.values(t.measurePath||{})}}function Uf({type:t,settings:r,sortDetails:e},n){return t==="simple"?e.field>=(n.rows||[]).length?[{rowIndex:0,sort:{direction:h.getSortType(r[0].direction),by:Qs(e,n)}}]:[{rowIndex:e.field,sort:{direction:h.getSortType(r[0].direction)}}]:r.reduce((a,o,s)=>{var d;const i=(d=n.rows)==null?void 0:d[s],u=(i==null?void 0:i.sortType)&&Tl(i==null?void 0:i.sortType),l={direction:h.getSortType(o.direction),by:Qs(e,n)};return!o.selected&&h.isEqual(u==null?void 0:u.by,l.by)&&a.push({rowIndex:s,sort:null}),o.selected&&a.push({rowIndex:s,sort:l}),a},[])}function zf(t){const{jaql:r,pivotBuilder:e,isForceReload:n}=t,[a,o]=w.useState({isLoading:!1,isNoResults:!1}),s=f.useHasChanged(r);w.useEffect(()=>{r&&(s||n)&&e.updateJaql(r)},[n,s,r,e]);const i=w.useCallback(()=>{o({isLoading:!0,isNoResults:!1})},[]),u=w.useCallback(l=>{o({isLoading:!1,isNoResults:!l.cellsMetadata})},[]);return w.useEffect(()=>{const l=[{event:f.sv,handler:i},{event:f.av,handler:u}];return l.forEach(({event:c,handler:d})=>{e.on(c,d)}),()=>{l.forEach(({event:c,handler:d})=>{e.off(c,d)})}},[e,i,u]),a}function Gf(t){const{pivotClient:r,pivotBuilder:e,shouldBeRecreated:n}=t,[a,o]=w.useState(()=>r.prepareDataService());return w.useEffect(()=>{if(n){const s=r.prepareDataService();o(s),e.updateDataService(s)}},[r,e,n]),a}const Vf=({dataOptions:t})=>{const[r,e]=w.useState(f.translatePivotTableDataOptions(t));return{dataOptionsInternal:r,updateSort(n){var a;e(T(D({},r),{rows:(a=r.rows)==null?void 0:a.map((o,s)=>{const i=n.rows.find(({rowIndex:u})=>u===s);return i?i.sort===null?h.safeCombine(o,{sortType:void 0}):h.safeCombine(o,{sortType:i.sort}):o})}))}}},Kf=t=>(r,e,n,a)=>{var u;const o=f.getPivotDataOptionByJaqlIndex(t,(u=a==null?void 0:a.field)==null?void 0:u.index),s=f.getNumberFormatConfig(o),i=r.value===null||typeof r.value=="undefined";r.content=i?"":h.applyFormatPlainText(s,r.value)},Xf=()=>(t,r,e)=>{var l,c;const n=t.userType===f.nt.CORNER,a=t.userType===f.nt.SUB_TOTAL;if(!r||n||a)return;const o=e.metadata.find(({panel:d,jaql:p})=>{var x;const m=["rows","columns"].includes(d),g=p.dim===r.jaql.dim,v=r.jaql.datatype===p.datatype&&r.jaql.level===p.level,b=(x=p.in)==null?void 0:x.selected;return m&&g&&v&&b}),s=(c=(l=o==null?void 0:o.jaql)==null?void 0:l.in)==null?void 0:c.selected;if(!s)return;tf(s.jaql)(t.value)&&(t.state={isSelected:!0})},Jf=({dataService:t,dataOptions:r})=>{const{app:e}=f.useSisenseContext(),n=w.useCallback(h.over([Kf(r)]),[r]),a=w.useCallback((s,i)=>f.applyDateFormat(s,i,e==null?void 0:e.settings.locale,e==null?void 0:e.settings.dateConfig),[e]),o=w.useCallback(h.over([f.createHeaderCellValueFormatter(r,a),Xf()]),[r]);w.useEffect(()=>(t.on(f.tE,n),t.on(f.im,o),()=>{t.off(f.tE,n),t.off(f.im,o)}),[t,n])};function Us(t,r){return f.dataLoadStateReducer(t,r)}const Zf=f.withTracking("useExecutePivotQuery")(Sl);function Sl(t){const r=tp(t),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(Us,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext();return w.useEffect(()=>{if(o||a({type:"error",error:new h.TranslatableError("errors.executeQueryNoSisenseContext")}),e(s)){a({type:"loading"});const{dataSource:i,rows:u,columns:l,values:c,grandTotals:d,filters:p,highlights:m,count:g,offset:v,onBeforeQuery:b}=t,{filters:x,relations:C}=h.getFilterListAndRelationsJaql(p);f.executePivotQuery({dataSource:i,rows:u,columns:l,values:c,grandTotals:d,filters:x,filterRelations:C,highlights:m,count:g,offset:v},s,{onBeforeQuery:b}).then(_=>{a({type:"success",data:_})}).catch(_=>{a({type:"error",error:_})})}},[s,o,t,e]),n.data&&r?Us(n,{type:"loading"}):n}const ep=["dataSource","rows","columns","values","grandTotals","count","offset","onBeforeQuery"];function tp(t){return f.useHasChanged(t,ep,(r,e)=>{const{filters:n}=h.getFilterListAndRelationsJaql(e.filters),{filters:a}=h.getFilterListAndRelationsJaql(r.filters);return f.isFiltersChanged(n,a)||f.isFiltersChanged(e.highlights,r.highlights)})}const zs=t=>D({attribute:h.translateColumnToAttribute(t),includeSubTotals:t.includeSubTotals||!1},t.sortType&&{sort:Tl(t.sortType)}),np=t=>({measure:h.translateColumnToMeasure(t),totalsCalculation:t.totalsCalculation,dataBars:t.dataBars||!1}),El=t=>{const{rows:r=[],columns:e=[],values:n=[],grandTotals:a}=t,o=r.flatMap(zs),s=e.flatMap(zs),i=n.flatMap(np);return{rows:o,columns:s,values:i,grandTotals:a}},rp=({dataSet:t,dataOptionsInternal:r,filters:e,highlights:n})=>{const[a,o]=w.useState(),{rows:s,columns:i,values:u,grandTotals:l}=El(r),c=w.useCallback(m=>{o(g=>h.isEqual(g,m)?g:m)},[o]),d={dataSource:t,rows:s,columns:i,values:u,grandTotals:l,filters:e,highlights:n,onBeforeQuery:c},{error:p}=Sl(d);return{jaql:a,error:p}},ap="#cbced7",op="#ffff9c";function sp(t,r){var a,o,s,i,u,l,c,d,p,m,g;let e,n;if((a=r==null?void 0:r.chart)!=null&&a.backgroundColor){const v=h.getDarkFactor(h.toColor((o=r==null?void 0:r.chart)==null?void 0:o.backgroundColor))<.5?.07:-.07;e=h.getSlightlyDifferentColor((s=r==null?void 0:r.chart)==null?void 0:s.backgroundColor,v),n=h.getSlightlyDifferentColor((i=r==null?void 0:r.chart)==null?void 0:i.backgroundColor,v*1.5)}return{fontFamily:(u=r==null?void 0:r.typography)==null?void 0:u.fontFamily,textColor:(l=r==null?void 0:r.chart)==null?void 0:l.textColor,backgroundColor:(c=r==null?void 0:r.chart)==null?void 0:c.backgroundColor,borderColor:ap,fillColor:e,additionalFillColor:n,fillOptions:{alternatingRows:t==null?void 0:t.alternatingRowsColor,alternatingColumns:t==null?void 0:t.alternatingColumnsColor,columnsHeaders:t==null?void 0:t.headersColor,rowMembers:t==null?void 0:t.membersColor,totals:t==null?void 0:t.totalsColor},rowHeight:t==null?void 0:t.rowHeight,isAutoHeight:(d=t==null?void 0:t.isAutoHeight)!=null?d:!1,navigationPrimaryColor:(p=r==null?void 0:r.typography)==null?void 0:p.primaryTextColor,navigationSecondaryColor:(m=r==null?void 0:r.typography)==null?void 0:m.secondaryTextColor,selectionColor:(g=t==null?void 0:t.highlightColor)!=null?g:op}}const ip=25;function lp({nodeRef:t,pivotBuilder:r,dataOptions:e,styleOptions:n,themeSettings:a,size:o,onTotalHeightChange:s}){const i=w.useCallback((d,p)=>{const g=[...e.rows?e.rows:[],...e.columns?e.columns:[],...e.values?e.values:[]].map(b=>b==null?void 0:b.width);if(p){const[b,x]=p,C=d[b];C&&typeof C.jaqlIndex!="undefined"&&(g[C.jaqlIndex]=x)}const v=[];return d.forEach((b,x)=>{typeof b.jaqlIndex!="undefined"&&typeof g[b.jaqlIndex]!="undefined"&&v.push([x,g[b.jaqlIndex]])}),v},[e]),u=w.useMemo(()=>sp(n,a),[n,a]),{rowsPerPage:l=ip}=n,c=w.useMemo(()=>o?D({width:o.width,height:o.height,isPaginated:!0,itemsPerPage:l,isSelectedMode:!0,onUpdatePredefinedColumnWidth:i,onTotalHeightChange:s},u):null,[o,l,i,u,s]);w.useEffect(()=>{t.current&&c&&(!!t.current.children.length?r.updateProps(c):r.render(t.current,c))},[t,r,c])}const Pl=f.asSisenseComponent({componentName:"PivotTable"})(t=>{const{dataSet:r,dataOptions:e,filters:n,highlights:a,refreshCounter:o=0}=t,s=w.useMemo(()=>{var P;return(P=t.styleOptions)!=null?P:{}},[t.styleOptions]),i=w.useRef(null),[u,l]=w.useState(null),[c,d]=w.useState(null),{app:p}=f.useSisenseContext(),{themeSettings:m}=f.useThemeContext(),g=p==null?void 0:p.pivotClient;if(!g)throw new h.TranslatableError("errors.noPivotClient");const{dataOptionsInternal:v,updateSort:b}=Vf({dataOptions:e}),{error:x,jaql:C}=rp({dataSet:r,dataOptionsInternal:v,filters:n,highlights:a});if(x)throw x;const _=w.useMemo(()=>g.preparePivotBuilder(),[g]),S=f.useHasChanged(C),O=o>0&&f.useHasChanged(o),j=Gf({pivotClient:g,pivotBuilder:_,shouldBeRecreated:S||O});Jf({dataService:j,dataOptions:e}),lp({nodeRef:i,pivotBuilder:_,dataOptions:e,styleOptions:s,themeSettings:m,size:u,onTotalHeightChange:d});const{isLoading:B,isNoResults:H}=zf({jaql:C,pivotBuilder:_,isForceReload:O}),R=w.useCallback(P=>{const Y=Uf(P,v);b({rows:Y})},[v,b]);w.useEffect(()=>(_.on(f.lv,R),()=>{_.off(f.lv,R)}),[_,R]);const I=w.useCallback(P=>{(P.width!==(u==null?void 0:u.width)||P.height!==(u==null?void 0:u.height))&&l(P)},[u,l]);return y.jsx(f.DynamicSizeContainer,{defaultSize:f.DEFAULT_PIVOT_TABLE_SIZE,size:{width:s==null?void 0:s.width,height:s!=null&&s.isAutoHeight&&!H&&c!=null?c:s==null?void 0:s.height},onSizeChange:I,children:y.jsx(f.LoadingOverlay,{themeSettings:m,isVisible:B,children:y.jsxs(y.Fragment,{children:[H&&y.jsx(f.NoResultsOverlay,{iconType:"table"}),y.jsx("div",{ref:i,"aria-label":"pivot-table-root"})]})})})}),To=f.asSisenseComponent({componentName:"PivotTableWidget"})(t=>{var d;const[r,e]=w.useState(0),{app:n}=f.useSisenseContext(),{styleOptions:a,dataSource:o=n==null?void 0:n.defaultDataSource,dataOptions:s}=t,i=f.getWidgetDefaultSize("pivot",{hasHeader:!((d=a==null?void 0:a.header)!=null&&d.hidden)}),p=t.styleOptions||{},{width:u,height:l}=p,c=pe(p,["width","height"]);return s?y.jsx(f.DynamicSizeContainer,{defaultSize:i,size:{width:u,height:a!=null&&a.isAutoHeight?void 0:l},children:y.jsx(f.WidgetContainer,T(D({},t),{dataSetName:o&&h.getDataSourceName(o),onRefresh:()=>e(r+1),children:y.jsx(Pl,{dataSet:t.dataSource,dataOptions:t.dataOptions,styleOptions:c,filters:t.filters,highlights:t.highlights,refreshCounter:r})}))}):null}),cp=t=>{const r=[],e=n=>{Array.isArray(n)?n.forEach(e):typeof n=="object"&&n!==null&&(n.widgetid&&r.push(n.widgetid),Object.values(n).forEach(e))};return e(t.layout),r},up=t=>"levels"in t&&t.isCascading===!0,dp=t=>({columns:(t.columns||[]).map(r=>({widthPercentage:r.width,rows:(r.cells||[]).map(e=>{const n=e.subcells.reduce((a,o)=>a+o.width,0);return{cells:e.subcells.map(a=>({widthPercentage:n<100?a.width/(n/100):a.width,height:a.elements[0].height,widgetId:a.elements[0].widgetid}))}})}))}),fp=t=>h.createFilterFromJaql(t.jaql,t.instanceid,t.disabled,t.locked),pp=t=>{const{levels:r,instanceid:e,disabled:n,locked:a}=t,o=r.map(s=>h.createFilterFromJaql(s,s.instanceid));return new h.CascadingFilter(o,{guid:e,disabled:n,locked:a})};function hp(t,r){const e=t.map(a=>up(a)?pp(a):fp(a));if(!r)return e;const n=h.convertFilterRelationsModelToRelationRules(r,e);return!n||h.isTrivialSingleNodeRelations(n)?e:h.combineFiltersAndRelations(e,n)}function mp(t=[]){const r={};return t.forEach(e=>{var n,a,o,s;r[e.oid]={filtersOptions:{applyMode:((n=e.options)==null?void 0:n.dashboardFiltersMode)==="filter"?f.CommonFiltersApplyMode.FILTER:f.CommonFiltersApplyMode.HIGHLIGHT,shouldAffectFilters:(a=e.options)==null?void 0:a.selector,ignoreFilters:{all:(o=e.metadata.ignore)==null?void 0:o.all,ids:(s=e.metadata.ignore)==null?void 0:s.ids},forceApplyBackgroundFilters:!0}}}),r}function gp(t,r){return he(this,null,function*(){var a;const e=yp(t.widgets||[]);if(e.length===0)return t;const n=yield r.getSharedFormulas(e);return T(D({},t),{widgets:(a=t.widgets)==null?void 0:a.map(o=>bp(o,n))})})}function yp(t){const r=t.flatMap(e=>e.metadata.panels.flatMap(n=>n.items.flatMap(a=>!h.isJaqlWithFormula(a.jaql)||!a.jaql.context?[]:Object.values(a.jaql.context).filter(h.isSharedFormulaReferenceContext).map(s=>s.formulaRef))));return Array.from(new Set(r))}function bp(t,r){const e=t.metadata.panels.map(n=>{const a=n.items.map(o=>{const{jaql:s}=o;if(!h.isJaqlWithFormula(s)||!s.context)return o;const i=Object.fromEntries(Object.entries(s.context).map(([u,l])=>h.isSharedFormulaReferenceContext(l)?[u,r[l.formulaRef]]:[u,l]));return T(D({},o),{jaql:T(D({},s),{context:i})})});return T(D({},n),{items:a})});return T(D({},t),{metadata:T(D({},t.metadata),{panels:e})})}function Ml(o,s){return he(this,arguments,function*(t,r,e={},n,a){var g,v;const{includeWidgets:i,includeFilters:u}=e,l=new f.RestApi(t),c=["oid","title","datasource","style"],d=((g=t.auth)==null?void 0:g.type)==="wat";i&&c.push("layout"),u&&(c.push("filters"),c.push("filterRelations"));const p=yield l.getDashboard(r,{fields:c});if(!p)throw new h.TranslatableError("errors.dashboardWithOidNotFound",{dashboardOid:r});if(i){let b;if(d){const x=cp(p);b=(yield Promise.all(x.map(_=>l.getWidget(_,p.oid)))).filter(_=>_!==void 0)}else b=(yield l.getDashboardWidgets(r))||[];p.widgets=b}if((v=p.style)!=null&&v.paletteId&&!p.style.palette){const b=yield l.getPalettes(),x=b==null?void 0:b.find(({_id:C})=>{var _;return C===((_=p.style)==null?void 0:_.paletteId)});x&&(p.style.palette={name:x.name,colors:x.colors})}const m=yield gp(p,l);return Lo(m,n,a)})}const Al=(t,r)=>{const e={};for(const n of t){const a=r(n);a in e||(e[a]=n)}return Object.values(e)};function Ol(e){return he(this,arguments,function*(t,r={}){const{includeWidgets:n,searchByTitle:a}=r,o=new f.RestApi(t),s=[];let i=["oid","title","datasource"];n&&(i=[],s.push("widgets"));const u=yield o.getDashboards({fields:i,expand:s,searchByTitle:a});if(!u)return[];const l=Al(u,c=>c.oid);return l.length!==u.length&&console.warn("Removing detected duplicate dashboard(s)"),l.map(c=>Lo(c))})}const Fl=f.withTracking("useGetDashboardModel")(Nl);function Nl(t){const r=f.useHasChanged(t,["dashboardOid"]),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext(),{themeSettings:i}=f.useThemeContext();return w.useEffect(()=>{if(o||a({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(s)){a({type:"loading"});const{dashboardOid:u,includeWidgets:l,includeFilters:c}=t;Ml(s.httpClient,u,{includeWidgets:l,includeFilters:c},i,s.settings).then(d=>{a({type:"success",data:d})}).catch(d=>{a({type:"error",error:d})})}},[s,o,t,e,i]),n.data&&r?Xa(f.dataLoadStateReducer(n,{type:"loading"})):Xa(n)}function Xa(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{dashboard:r})}const vp=f.withTracking("useGetDashboardModels")(wp);function wp(t={}){const r=f.useHasChanged(t,["includeWidgets"]),e=f.useShouldLoad(t,r),[n,a]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:o,app:s}=f.useSisenseContext();return w.useEffect(()=>{o||a({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(s)&&(a({type:"loading"}),Ol(s.httpClient,t).then(i=>{a({type:"success",data:i})}).catch(i=>{a({type:"error",error:i})}))},[s,o,t,e]),n.data&&r?Ja(f.dataLoadStateReducer(n,{type:"loading"})):Ja(n)}function Ja(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{dashboards:r})}const Rl=a=>he(exports,[a],function*({widgetOid:t,dashboardOid:r,includeDashboard:e,api:n}){const[o,s]=yield Promise.all([n.getWidget(t,r),e?n.getDashboard(r):void 0]);return{widget:o,dashboard:s}});function Il(t,r,e,n,a){return he(this,null,function*(){const o=new f.RestApi(t),{widget:s}=yield Rl({widgetOid:e,dashboardOid:r,api:o});if(!s)throw new h.TranslatableError("errors.widgetWithOidNotFound",{widgetOid:e});return Jn(s,n,a)})}const xp=f.withTracking("useGetWidgetModel")(Ll);function Ll(t){const r=f.useHasChanged(t,["dashboardOid","widgetOid"]),e=f.useShouldLoad(t,r),{themeSettings:n}=f.useThemeContext(),[a,o]=w.useReducer(f.dataLoadStateReducer,{isLoading:!0,isError:!1,isSuccess:!1,status:"loading",error:void 0,data:void 0}),{isInitialized:s,app:i}=f.useSisenseContext();return w.useEffect(()=>{if(s||o({type:"error",error:new h.TranslatableError("errors.sisenseContextNotFound")}),e(i)){o({type:"loading"});const{dashboardOid:u,widgetOid:l}=t;Il(i.httpClient,u,l,n,i.settings).then(c=>{o({type:"success",data:c})}).catch(c=>{o({type:"error",error:c})})}},[i,s,t,e,n]),a.data&&r?Gs(f.dataLoadStateReducer(a,{type:"loading"})):Gs(a)}function Gs(t){const n=t,{data:r}=n,e=pe(n,["data"]);return T(D({},e),{widget:r})}function Jt(t,r){const e=h.getChartSubtype(t);return D(D({},r),e&&{subtype:e})}function gt(t){const{min:r,max:e}=t||{};return T(D({},t),{min:typeof r=="number"?r:null,max:typeof e=="number"?e:null})}function Dp(t,r,e){var x,C,_,S,O,j,B,H,R,I;const n={xAxis:gt(r.xAxis),yAxis:gt(r.yAxis),y2Axis:gt(r.y2Axis)},o=["chart/line","chart/area"].includes(t)?"x-axis":"categories",s=h.getEnabledPanelItems(e,o),i=h.getEnabledPanelItems(e,"values"),u=s.length===2;u&&(n.xAxis=T(D({},n.xAxis),{title:(x=n.xAxis)==null?void 0:x.x2Title,x2Title:(C=n.xAxis)==null?void 0:C.title}));const l=!!((_=n.xAxis)!=null&&_.title&&"text"in n.xAxis.title),c=s[s.length-1];!l&&c&&(n.xAxis=T(D({},n.xAxis),{title:T(D({},(S=n.xAxis)==null?void 0:S.title),{text:c.jaql.title})}));const d=!!((O=n.xAxis)!=null&&O.x2Title&&"text"in n.xAxis.x2Title),p=s[0];!d&&u&&(n.xAxis=T(D({},n.xAxis),{x2Title:T(D({},(j=n.xAxis)==null?void 0:j.x2Title),{text:p.jaql.title})}));const m=!!((B=n.yAxis)!=null&&B.title&&"text"in n.yAxis.title),g=i.filter(P=>!P.y2);!m&&g.length===1&&(n.yAxis=T(D({},n.yAxis),{title:T(D({},(H=n.yAxis)==null?void 0:H.title),{text:g[0].jaql.title})}));const v=!!((R=n.y2Axis)!=null&&R.title&&"text"in n.y2Axis.title),b=i.filter(P=>P.y2);return!v&&b.length===1&&(n.y2Axis=T(D({},n.y2Axis),{title:T(D({},(I=n.y2Axis)==null?void 0:I.title),{text:b[0].jaql.title})})),n}function Cp(t,r){var o,s;const e={xAxis:gt(t.categories),yAxis:gt(t.axis)},n=h.getEnabledPanelItems(r,"categories")[0];return!!!((o=e.xAxis)!=null&&o.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(s=e.xAxis)==null?void 0:s.title),{text:n.jaql.title})})),e.yAxis=T(D({},e.yAxis),{title:{enabled:!1}}),e}function kp(t,r){var i,u,l,c;const e={xAxis:gt(t.xAxis),yAxis:gt(t.yAxis)},n=h.getEnabledPanelItems(r,"x-axis")[0],a=h.getEnabledPanelItems(r,"y-axis")[0];return!!!((i=e.xAxis)!=null&&i.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(u=e.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((l=e.yAxis)!=null&&l.title&&"text"in e.yAxis.title)&&a&&(e.yAxis=T(D({},e.yAxis),{title:T(D({},(c=e.yAxis)==null?void 0:c.title),{text:a.jaql.title})})),e}function _p(t,r){var i,u,l,c;const e={xAxis:gt(t.xAxis),yAxis:gt(t.yAxis)},n=h.getEnabledPanelItems(r,"category")[0],a=h.getEnabledPanelItems(r,"value")[0];return!!!((i=e.xAxis)!=null&&i.title&&"text"in e.xAxis.title)&&n&&(e.xAxis=T(D({},e.xAxis),{title:T(D({},(u=e.xAxis)==null?void 0:u.title),{text:n.jaql.title})})),!!!((l=e.yAxis)!=null&&l.title&&"text"in e.yAxis.title)&&a&&(e.yAxis=T(D({},e.yAxis),{title:T(D({},(c=e.yAxis)==null?void 0:c.title),{text:a.jaql.title})})),e}function Tp(t,r,e,n){return T(D(D({},Jt(r,e)),Dp(t,e,n)),{lineWidth:e.lineWidth,markers:e.markers})}function Sp(t,r,e){return D(D({},Jt(t,r)),Cp(r,e))}function Ep(t,r,e){var n,a,o;return T(D(D({},Jt(t,r)),kp(r,e)),{markerSize:{scatterDefaultSize:(n=r.markerSize)==null?void 0:n.defaultSize,scatterBubbleMinSize:(a=r.markerSize)==null?void 0:a.min,scatterBubbleMaxSize:(o=r.markerSize)==null?void 0:o.max}})}function Pp(t){return{header:{color:{enabled:t["colors/headers"]}},rows:{alternatingColor:{enabled:t["colors/rows"]}},columns:{alternatingColor:{enabled:t["colors/columns"]}}}}function Mp(t,r){return T(D({},Jt(t,r)),{funnelSize:r.size,funnelType:r.type,funnelDirection:r.direction,labels:r.labels,legend:r.legend})}const Ap=(t,r)=>{const e=h.getChartSubtype(t);return e==="indicator/gauge"?{subtype:e,skin:+r.skin}:r.subtype==="bar"?{subtype:e,numericSubtype:"numericBar"}:{subtype:e,numericSubtype:"numericSimple",skin:r.skin}};function Op(t,r,e){var s,i,u,l,c,d,p,m;const n=Ap(t,r),a=(s=h.getEnabledPanelItems(e,"value")[0])==null?void 0:s.jaql.title,o=(i=h.getEnabledPanelItems(e,"secondary")[0])==null?void 0:i.jaql.title;return T(D({},n),{indicatorComponents:{title:{shouldBeShown:((l=(u=r.components)==null?void 0:u.title)==null?void 0:l.enabled)||!1,text:a},secondaryTitle:{text:o||""},ticks:{shouldBeShown:((d=(c=r.components)==null?void 0:c.ticks)==null?void 0:d.enabled)||!1},labels:{shouldBeShown:((m=(p=r.components)==null?void 0:p.labels)==null?void 0:m.enabled)||!1}}})}function Fp(t){var r,e,n,a;return{labels:{category:[{enabled:(r=t["title/1"])!=null?r:!0},{enabled:(e=t["title/2"])!=null?e:!0},{enabled:(n=t["title/3"])!=null?n:!0}]},tooltip:{mode:(a=t["tooltip/value"])==null||a?"value":"contribution"}}}function Np(t){var r;return{legend:{enabled:t["legend/enabled"],position:t["legend/position"]},tooltip:{mode:(r=t["tooltip/value"])==null||r?"value":"contribution"}}}function Rp(t,r,e){return D(D({},Jt(t,r)),_p(r,e))}function Ip(t,r){return T(D({},Jt(t,r)),{markers:{fill:r.markers.fill,size:{defaultSize:r.markers.size.defaultSize,minSize:r.markers.size.min,maxSize:r.markers.size.max}}})}function Lp(t){let r;switch(t){case"areamap/world":r="world";break;case"areamap/usa":r="usa";break;default:throw new h.TranslatableError("errors.unsupportedWidgetType",{widgetSubtype:t})}return{mapType:r}}function jp(t){var r,e,n,a,o;return{rowsPerPage:parseInt(`${t.pageSize}`),isAutoHeight:t.automaticHeight,rowHeight:t.rowHeight,alternatingRowsColor:(r=t.colors)==null?void 0:r.rows,alternatingColumnsColor:(e=t.colors)==null?void 0:e.columns,headersColor:(n=t.colors)==null?void 0:n.headers,membersColor:(a=t.colors)==null?void 0:a.members,totalsColor:(o=t.colors)==null?void 0:o.totals}}function Wp(t,r){var o,s,i;const{subtype:e,style:n,metadata:{panels:a}}=r;switch(t){case"chart/line":case"chart/area":case"chart/bar":case"chart/column":{const u=Tp(t,e,n,a);if(u.navigator){const l=(o=r.options)==null?void 0:o.previousScrollerLocation;u.navigator.scrollerLocation=h.isValidScrollerLocation(l)?l:void 0}return u}case"chart/polar":return Sp(e,n,a);case"chart/scatter":return Ep(e,n,a);case"chart/funnel":return Mp(e,n);case"treemap":return Fp(n);case"sunburst":return Np(n);case"chart/pie":return Jt(e,n);case"tablewidget":case"tablewidgetagg":return Pp(n);case"pivot":case"pivot2":return jp(n);case"indicator":return Op(e,n,a);case"chart/boxplot":{const u=Rp(e,n,a);return u.navigator&&(u.navigator.scrollerLocation=h.isValidScrollerLocation((s=r.options)==null?void 0:s.previousScrollerLocation)?(i=r.options)==null?void 0:i.previousScrollerLocation:void 0),u}case"map/scatter":return Ip(e,n);case"map/area":return Lp(e);case"richtexteditor":return n.content;default:throw new h.TranslatableError("errors.unsupportedWidgetType",{widgetType:t})}}function Yp(t,r,e){if(!r||!e)return t;const n={backgroundColor:r.widgetBackgroundColor,spaceAround:f.LEGACY_DESIGN_TYPES[r.widgetSpacing],cornerRadius:f.LEGACY_DESIGN_TYPES[r.widgetCornerRadius],shadow:f.LEGACY_DESIGN_TYPES[r.widgetShadow],border:r.widgetBorderEnabled,borderColor:r.widgetBorderColor,header:{titleTextColor:r.widgetTitleColor,titleAlignment:f.LEGACY_DESIGN_TYPES[r.widgetTitleAlignment],dividerLine:r.widgetTitleDividerEnabled,dividerLineColor:r.widgetTitleDividerColor,backgroundColor:r.widgetTitleBackgroundColor}};return D(D({},t),n)}function Bp(t,r){return t&&t.length?f.baseUniq(t,h.baseIteratee(r)):[]}function Hp(t,r){const e=t.findIndex(n=>n===r);return e===-1?[]:t.slice(e)}const jl=t=>t!=null&&t.parent?[...jl(t.parent),f.createDataColumn(t).column]:[],Wl=t=>{var r,e,n;if(t!=null&&t.parent&&t.through&&"filter"in t.through.jaql){const a=f.createDataColumn(t).column,{jaql:o,format:{mask:s}={}}=t.parent,i="level"in o&&o.level&&s&&s[o.level],u=(n=(e=(r=t.through.jaql.filter)==null?void 0:r.members)==null?void 0:e.map(i?l=>({categoryValue:l,categoryDisplayValue:f.applyDateFormat(h.parseISO(l),i)}):l=>({categoryValue:l})))!=null?n:[];return[...Wl(t.parent),{nextDimension:a,points:u}]}return[]};function $p(t){switch(t){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 qp=(t,r)=>{const e=$p(t).map(a=>h.getEnabledPanelItems(r,a)).flat().filter(a=>{const o="agg"in a.jaql&&a.jaql.agg,s="formula"in a.jaql&&a.jaql.formula;return!o&&!s});return e.length===1?e[0]:void 0},Yl="calendar",Bl="calendar - weeks",Qp=[h.DateLevels.Years,h.DateLevels.Quarters,h.DateLevels.Months,h.DateLevels.Days],Up=[h.DateLevels.Years,h.DateLevels.Weeks,h.DateLevels.Days],zp=[h.DateLevels.Years,h.DateLevels.Quarters,h.DateLevels.Months,h.DateLevels.Weeks,h.DateLevels.Days],Gp=t=>t.length===2?zp:t[0]===Yl?Qp:t[0]===Bl?Up:[],Vp=(t,r)=>{const[e=[],n]=f.partition(t,o=>[Yl,Bl].includes(o)),a=Hp(Gp(e),r.granularity);return a.length?[{title:"Calendar Hierarchy",levels:a.map(i=>new h.DimensionalLevelAttribute(`${i} in ${r.name}`,r.expression,i,h.DimensionalLevelAttribute.getDefaultFormatForGranularity(i)))},...n]:n},Kp=t=>{const r=t&&f.createDataColumn(t),e=(t==null?void 0:t.hierarchies)||[];return r&&h.isDatetime(r.column.type)?(r.column.name=(t==null?void 0:t.jaql).column,Vp(e,r.column)):e},Xp=(t,r,e=[],n)=>{const a=qp(t,r),o=a&&h.getRootPanelItem(a),s=Wl(a),i=Kp(o);return{drilldownPaths:[...Bp([...a?jl(a):[]],({expression:l})=>l),...i],drilldownSelections:s}};function So(t){const s=t.filter,{filter:r}=s,e=pe(s,["filter"]),n=r&&"turnedOff"in r&&r.turnedOff;let a,o;return n?o=r:a=r,e.members&&e.members.length===0&&(e.all=!0),{filter:e,backgroundFilter:a,turnOffMembersFilter:o}}function Jp(t){const{filter:r,backgroundFilter:e,turnOffMembersFilter:n}=So(t.jaql),a=[T(D({},t),{jaql:T(D({},t.jaql),{filter:D(D({},r),n&&{filter:n})})})];return e&&a.push(T(D({},t),{jaql:T(D({},t.jaql),{filter:e}),disabled:!1})),a}function Zp(t){const r=t.find(n=>n.name==="filters"),e=[];return r==null||r.items.forEach(n=>{e.push(...Jp(n).filter(({disabled:a})=>!a))}),e}function Hl(t){return Zp(t).map(r=>h.createFilterFromJaql(r.jaql,r.instanceid))}function Eo(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toExecuteQueryParams");let r,e,n,a;if(h.isTableWidget(t.widgetType)){const{attributes:o,measures:s}=f.getTableAttributesAndMeasures(f.translateTableDataOptions(t.dataOptions));r=o,e=s,n=f.DEFAULT_TABLE_ROWS_PER_PAGE*f.PAGES_BATCH_SIZE+1,a=!0}else{const{attributes:o,measures:s}=f.getTranslatedDataOptions(t.dataOptions,t.chartType);r=o,e=s}return{dataSource:t.dataSource,dimensions:r,measures:e,filters:t.filters,highlights:t.highlights,count:n,ungroup:a}}function Po(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toExecutePivotQueryParams"});const{rows:r,columns:e,values:n,grandTotals:a}=El(f.translatePivotTableDataOptions(t.dataOptions));return{dataSource:t.dataSource,rows:r,columns:e,values:n,grandTotals:a,filters:t.filters,highlights:t.highlights}}function $l(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toChartProps");if(h.isTextWidget(t.widgetType))throw new Xl("toChartProps");return h.isTableWidget(t.widgetType)?D({chartType:t.chartType},Mo(t)):{chartType:t.chartType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters,highlights:t.highlights}}function Mo(t){if(!h.isTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters}}function ql(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSet:t.dataSource,filters:t.filters,highlights:t.highlights}}function Ao(t){if(h.isPivotTableWidget(t.widgetType))throw new Ro("toChartWidgetProps");if(h.isTextWidget(t.widgetType))throw new Xl("toChartWidgetProps");return{chartType:t.chartType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||"",drilldownOptions:t.drilldownOptions}}function Ql(t){if(!h.isTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTableWidgetSupported",{methodName:"toTableWidgetProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,title:t.title,description:t.description||""}}function Oo(t){if(!h.isPivotTableWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPivotWidgetSupported",{methodName:"toPivotTableWidgetProps"});return{dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||""}}function Fo(t){if(!h.isTextWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyTextWidgetSupported",{methodName:"toTextWidgetProps"});return{styleOptions:t.styleOptions}}function Ul(t){if(!h.isPluginWidget(t.widgetType))throw new h.TranslatableError("errors.widgetModel.onlyPluginWidgetSupported",{methodName:"toPluginWidgetProps"});return{pluginType:t.pluginType,dataOptions:t.dataOptions,styleOptions:t.styleOptions,dataSource:t.dataSource,filters:t.filters,highlights:t.highlights,title:t.title,description:t.description||""}}function zl(t){const{widgetType:r}=t;return h.isPivotTableWidget(r)?D({widgetType:"pivot"},Oo(t)):h.isTextWidget(r)?D({widgetType:"text"},Fo(t)):h.isPluginWidget(r)?D({widgetType:"plugin"},Ul(t)):D({widgetType:"chart"},Ao(t))}function No(t){const{oid:r}=t;return T(D({},zl(t)),{id:r})}const ht=()=>{throw new h.TranslatableError("errors.methodNotImplemented")},Gl={oid:"",title:"",dataSource:"",description:"",widgetType:"plugin",pluginType:"",dataOptions:{},styleOptions:{},drilldownOptions:{},filters:[],highlights:[],chartType:void 0,getExecuteQueryParams:ht,getExecutePivotQueryParams:ht,getChartProps:ht,getTableProps:ht,getPivotTableProps:ht,getPivotTableWidgetProps:ht,getChartWidgetProps:ht,getTableWidgetProps:ht,getTextWidgetProps:ht};function Vl(t){return T(D({},t),{getExecuteQueryParams:()=>Eo(t),getExecutePivotQueryParams:()=>Po(t),getChartProps:()=>$l(t),getTableProps:()=>Mo(t),getPivotTableProps:()=>ql(t),getChartWidgetProps:()=>Ao(t),getTableWidgetProps:()=>Ql(t),getPivotTableWidgetProps:()=>Oo(t),getTextWidgetProps:()=>Fo(t)})}function Jn(t,r,e){var p,m,g,v;let n,a,o,s;const i=f.attachDataSourceToPanels(t.metadata.panels,t.datasource);if(n=t.type,!h.isSupportedWidgetType(n))a=n,n="plugin",o=f.createDataOptionsFromPanels(i,(p=r==null?void 0:r.palette.variantColors)!=null?p:[]),s=t.style;else{o=f.extractDataOptions(n,i,t.style,r==null?void 0:r.palette.variantColors),s=Wp(n,t);const b=(v=(g=(m=e==null?void 0:e.serverFeatures)==null?void 0:m.widgetDesignStyle)==null?void 0:g.active)!=null?v:!0;s=Yp(s,t.style.widgetDesign,b)}const u=Xp(n,i),l=Hl(i),c=h.isChartWidget(n)?h.getChartType(n):void 0,d=T(D({},Gl),{oid:t.oid,title:t.title,dataSource:h.convertDataSource(t.datasource),description:t.desc||"",widgetType:n,chartType:c,pluginType:a||"",dataOptions:o||{},styleOptions:s||{},drilldownOptions:u,filters:l});return Vl(d)}function eh(t){const r=h.getWidgetTypeFromChartType(t.chartType),e=T(D(D({},Gl),t),{filters:t.filters||[],widgetType:r});return Vl(e)}function Kl(t,r){const e=r||t.dataSource;if(typeof e=="string")throw new Vs("dataSource");if(!e.id||!e.address)throw new Vs("dataSource");const n=t.chartType;let a=t.widgetType,o={},s=t.styleOptions.subtype||"";if(!n)throw new Error("Chart type is required");const i=[];if(h.isCartesian(n)){const c=["chart/line","chart/area"].includes(t.widgetType)?"x-axis":"categories",d=t.dataOptions.category.map(v=>f.createPanelItem(h.normalizeColumn(v))),p={name:c,items:d};i.push(p);const m=t.dataOptions.value.map(v=>f.createPanelItem(h.normalizeMeasureColumn(v)));i.push({name:"values",items:m});const g=t.dataOptions.breakBy.map(v=>f.createPanelItem(h.normalizeColumn(v)));i.push({name:"break by",items:g}),n==="polar"?s="column/polar":n==="bar"?s=s||"bar/classic":n==="column"?s=s||"column/classic":n==="area"?s=s||"area/basic":n==="line"&&(s=s||"line/basic")}else if(h.isTable(n)){const{attributes:c,measures:d}=f.getTableAttributesAndMeasures(t.dataOptions),p=[...c.map(m=>f.createPanelItem(h.normalizeColumn(m))),...d.map(m=>f.createPanelItem(h.normalizeMeasureColumn(m)))];i.push({name:"columns",items:p}),a="tablewidget"}else if(h.isIndicator(n))["value","min","max","secondary"].forEach(c=>{const d=(t.dataOptions[c]||[]).map(p=>f.createPanelItem(h.normalizeMeasureColumn(p)));i.push({name:c,items:d})}),s=s||"indicator/numeric",o=T(D({},s==="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(h.isCategorical(n)){const c=t.dataOptions.category.map(m=>f.createPanelItem(h.normalizeAnyColumn(m)));i.push({name:"categories",items:c});const d=t.dataOptions.value.map(m=>f.createPanelItem(h.normalizeAnyColumn(m))),p=n==="treemap";i.push({name:p?"size":"values",items:d}),p&&["color","values"].forEach(g=>{i.push({name:g,items:[]})}),n==="pie"?(s=s||"pie/basic",o={convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",minimalIndependentSlicePercentage:3,independentSlicesCount:7}}):n==="treemap"||n==="sunburst"?s=s||n:n==="funnel"&&(s=s||"chart/funnel")}else if(h.isScatter(n))["x","y","size","breakByColor","breakByPoint"].forEach(c=>{if(t.dataOptions[c]){const d={breakByColor:"Break By / Color",breakByPoint:"point",x:"x-axis",y:"y-axis"},p=[f.createPanelItem(h.normalizeAnyColumn(t.dataOptions[c]))];i.push({name:d[c]||c,items:p})}}),s=s||"bubble/scatter";else throw new th(n);const u=(t.filters||[]).map(c=>c.jaql());return i.push({name:"filters",items:u}),{oid:t.oid||"",title:t.title,desc:t.description,datasource:e,type:a,metadata:{panels:i},style:o,subtype:s}}class Vs extends h.TranslatableError{constructor(r){super("errors.widgetModel.incomleteWidget",{prop:r})}}class th extends h.TranslatableError{constructor(r){super("errors.widgetModel.unsupportedWidgetTypeDto",{chartType:r})}}class Ro extends h.TranslatableError{constructor(r){super("errors.widgetModel.pivotWidgetNotSupported",{methodName:r})}}class Xl extends h.TranslatableError{constructor(r){super("errors.widgetModel.textWidgetNotSupported",{methodName:r})}}const nh=Object.freeze(Object.defineProperty({__proto__:null,fromChartWidgetProps:eh,fromWidgetDto:Jn,toChartProps:$l,toChartWidgetProps:Ao,toCommonWidgetProps:zl,toExecutePivotQueryParams:Po,toExecuteQueryParams:Eo,toPivotTableProps:ql,toPivotTableWidgetProps:Oo,toPluginWidgetProps:Ul,toTableProps:Mo,toTableWidgetProps:Ql,toTextWidgetProps:Fo,toWidgetDto:Kl,toWidgetProps:No},Symbol.toStringTag,{value:"Module"}));function Io(t){const{title:r,dataSource:e,widgets:n,layoutOptions:a,filters:o,widgetsOptions:s,styleOptions:i}=t;return{title:r,defaultDataSource:e,widgets:n.map(No),layoutOptions:a,config:{},filters:o,widgetsOptions:s,styleOptions:i}}function Lo(t,r,e){var S;const{oid:n,title:a,datasource:o,widgets:s,layout:i,filters:u,filterRelations:l,style:c}=t,d={title:o.title,type:o.live?"live":"elasticube"},p=D({},c!=null&&c.palette?{palette:{variantColors:c==null?void 0:c.palette.colors}}:null),m=r&&D(D({},r),p.palette?{palette:p.palette}:null),g=(s==null?void 0:s.map(O=>Jn(O,m,e)))||[],v=i?dp(i):{columns:[]},b=(S=l==null?void 0:l[0])==null?void 0:S.filterRelations,x=hp(u||[],b),C=mp(s);return{oid:n,title:a,dataSource:d,styleOptions:p,widgets:g,layoutOptions:{widgetsPanel:v},filters:x,widgetsOptions:C}}const rh=Object.freeze(Object.defineProperty({__proto__:null,fromDashboardDto:Lo,toDashboardProps:Io},Symbol.toStringTag,{value:"Module"}));function ah(t){return h.isCascadingFilter(t)?oh(t):jo(t)}function jo(t){return h.isMembersFilter(t)?sh(t):h.isRankingFilter(t)?ih(t):Wo(t)}function oh(t){return{isCascading:!0,instanceid:t.config.guid,disabled:t.config.disabled,levels:t.filters.map(r=>{const e=jo(r);return T(D({},e.jaql),{instanceid:e.instanceid})})}}function Wo(t){const{config:{disabled:r}}=t,e=Object.assign(Object.create(t),{config:T(D({},t.config),{disabled:!1})}).jaql(!0);return{jaql:T(D({},e),{table:h.getTableNameFromAttribute(t.attribute),column:h.getColumnNameFromAttribute(t.attribute)}),disabled:r,instanceid:t.config.guid,isCascading:!1}}function sh(t){const r=Wo(t);return r.jaql.filter.multiSelection=t.config.enableMultiSelection,t.config.deactivatedMembers.length>0&&(t.config.excludeMembers?r.jaql.filter.exclude.members=[...t.members,...t.config.deactivatedMembers]:r.jaql.filter.members=[...t.members,...t.config.deactivatedMembers]),t.config.backgroundFilter&&Za(r.jaql,jo(t.config.backgroundFilter).jaql.filter),t.config.deactivatedMembers.length>0&&Za(r.jaql,{exclude:{members:t.config.deactivatedMembers},turnedOff:!0}),r}function ih(t){const r=Wo(t);if(t.measure instanceof h.DimensionalBaseMeasure){const e=r.jaql.filter;e.by.table=h.getTableNameFromAttribute(t.measure.attribute),e.by.column=h.getColumnNameFromAttribute(t.measure.attribute),e.rankingMessage=t.measure.name}return r}function Za(t,r){if(t.filter)return Za(t.filter,r);t.filter=r}var Jl=(t=>(t.DASHBOARD_INIT="DASHBOARD.INIT",t.DASHBOARD_UPDATE_LAYOUT="DASHBOARD.UPDATE_LAYOUT",t))(Jl||{}),Yo=(t=>(t.FILTERS_UPDATE="FILTERS.UPDATE",t.ADD_WIDGET="WIDGETS.ADD",t))(Yo||{});function lh(t,r){var e,n;switch(r.type){case"DASHBOARD.INIT":return D(D({},t),r.payload);case"FILTERS.UPDATE":return T(D({},t),{filters:r.payload});case"WIDGETS.ADD":{const a=[...t.widgets,r.payload],o=[...((n=(e=t==null?void 0:t.layoutOptions)==null?void 0:e.widgetsPanel)==null?void 0:n.columns)||[]];return o[0]&&(o[0].rows.length||o[0].rows.push({cells:[]}),o[0].rows[0].cells.push({widgetId:r.payload.oid,widthPercentage:100})),T(D(D({},t),t!=null&&t.layoutOptions.widgetsPanel?{layoutOptions:T(D({},t==null?void 0:t.layoutOptions),{widgetsPanel:T(D({},t==null?void 0:t.layoutOptions.widgetsPanel),{columns:o})})}:null),{widgets:a})}default:return t}}function ch(t,r,e){return he(this,null,function*(){if(!t)throw new Error("Dashboard model is not initialized");if(r.type==="FILTERS.UPDATE"){const{filters:n,relations:a}=h.splitFiltersAndRelations(r.payload),o=n.map(ah),s=h.filterRelationRulesToFilterRelationsModel(a,n),i=uh(n);yield e.patchDashboard(t,{filters:o,filterRelations:s?[{datasource:i,filterRelations:s}]:void 0})}else if(r.type==="WIDGETS.ADD"){const n=yield e.addWidgetToDashboard(t,Kl(r.payload));if(!n)throw new Error("Failed to add widget to dashboard");return{type:"WIDGETS.ADD",payload:Jn(n)}}return r})}function uh(t){const r=new Set(t.map(e=>{var n;return(n=e.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 dh(t){return t.type===hs.FILTERS_UPDATE?{type:Yo.FILTERS_UPDATE,payload:t.payload}:null}function fh(t,r){return t==="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 Zl=f.withTracking("useDashboardModel")(ph);function ph({dashboardOid:t,includeWidgets:r,includeFilters:e,persist:n=!0}){const{restApi:a,isReady:o}=f.useRestApi(),{app:s}=f.useSisenseContext(),i=w.useMemo(()=>!!(s!=null&&s.httpClient.auth)&&fh(s.httpClient.auth.type,n),[s==null?void 0:s.httpClient.auth,n]),u=n&&i,[l,c]=w.useReducer(lh,null),d=w.useCallback(b=>he(this,null,function*(){if(!o||!a)throw new f.RestApiNotReadyError;return u&&(b=yield ch(l==null?void 0:l.oid,b,a)),c(b)}),[u,l==null?void 0:l.oid,a,o,c]),{dashboard:p,isLoading:m,isError:g,error:v}=Fl({dashboardOid:t,includeWidgets:r,includeFilters:e});return w.useEffect(()=>{p&&c({type:Jl.DASHBOARD_INIT,payload:p})},[p,c]),{dashboard:l,isLoading:m,isError:g,error:v,dispatchChanges:d}}/*! @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:ec,setPrototypeOf:Ks,isFrozen:hh,getPrototypeOf:mh,getOwnPropertyDescriptor:gh}=Object;let{freeze:Ie,seal:Ge,create:tc}=Object,{apply:eo,construct:to}=typeof Reflect!="undefined"&&Reflect;Ie||(Ie=function(r){return r});Ge||(Ge=function(r){return r});eo||(eo=function(r,e,n){return r.apply(e,n)});to||(to=function(r,e){return new r(...e)});const dr=He(Array.prototype.forEach),Xs=He(Array.prototype.pop),Pn=He(Array.prototype.push),xr=He(String.prototype.toLowerCase),Na=He(String.prototype.toString),Js=He(String.prototype.match),Mn=He(String.prototype.replace),yh=He(String.prototype.indexOf),bh=He(String.prototype.trim),Je=He(Object.prototype.hasOwnProperty),Oe=He(RegExp.prototype.test),An=vh(TypeError);function He(t){return function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),a=1;a<e;a++)n[a-1]=arguments[a];return eo(t,r,n)}}function vh(t){return function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return to(t,e)}}function ee(t,r){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xr;Ks&&Ks(t,null);let n=r.length;for(;n--;){let a=r[n];if(typeof a=="string"){const o=e(a);o!==a&&(hh(r)||(r[n]=o),a=o)}t[a]=!0}return t}function wh(t){for(let r=0;r<t.length;r++)Je(t,r)||(t[r]=null);return t}function jt(t){const r=tc(null);for(const[e,n]of ec(t))Je(t,e)&&(Array.isArray(n)?r[e]=wh(n):n&&typeof n=="object"&&n.constructor===Object?r[e]=jt(n):r[e]=n);return r}function On(t,r){for(;t!==null;){const n=gh(t,r);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}t=mh(t)}function e(){return null}return e}const Zs=Ie(["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"]),Ra=Ie(["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"]),Ia=Ie(["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"]),xh=Ie(["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"]),La=Ie(["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"]),Dh=Ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ei=Ie(["#text"]),ti=Ie(["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"]),ja=Ie(["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"]),ni=Ie(["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"]),fr=Ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ch=Ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),kh=Ge(/<%[\w\W]*|[\w\W]*%>/gm),_h=Ge(/\${[\w\W]*}/gm),Th=Ge(/^data-[\-\w.\u00B7-\uFFFF]/),Sh=Ge(/^aria-[\-\w]+$/),nc=Ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Eh=Ge(/^(?:\w+script|data):/i),Ph=Ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rc=Ge(/^html$/i),Mh=Ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var ri=Object.freeze({__proto__:null,MUSTACHE_EXPR:Ch,ERB_EXPR:kh,TMPLIT_EXPR:_h,DATA_ATTR:Th,ARIA_ATTR:Sh,IS_ALLOWED_URI:nc,IS_SCRIPT_OR_DATA:Eh,ATTR_WHITESPACE:Ph,DOCTYPE_NAME:rc,CUSTOM_ELEMENT:Mh});const Fn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ah=function(){return typeof window=="undefined"?null:window},Oh=function(r,e){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(n=e.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return r.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function ac(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ah();const r=V=>ac(V);if(r.version="3.1.6",r.removed=[],!t||!t.document||t.document.nodeType!==Fn.document)return r.isSupported=!1,r;let{document:e}=t;const n=e,a=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:i,Element:u,NodeFilter:l,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:m}=t,g=u.prototype,v=On(g,"cloneNode"),b=On(g,"remove"),x=On(g,"nextSibling"),C=On(g,"childNodes"),_=On(g,"parentNode");if(typeof s=="function"){const V=e.createElement("template");V.content&&V.content.ownerDocument&&(e=V.content.ownerDocument)}let S,O="";const{implementation:j,createNodeIterator:B,createDocumentFragment:H,getElementsByTagName:R}=e,{importNode:I}=n;let P={};r.isSupported=typeof ec=="function"&&typeof _=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:$,TMPLIT_EXPR:N,DATA_ATTR:M,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:A,CUSTOM_ELEMENT:L}=ri;let{IS_ALLOWED_URI:K}=ri,X=null;const le=ee({},[...Zs,...Ra,...Ia,...La,...ei]);let J=null;const ve=ee({},[...ti,...ja,...ni,...fr]);let te=Object.seal(tc(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}})),Qe=null,Ve=null,Ct=!0,Ke=!0,De=!1,Xe=!0,Ue=!1,kt=!0,It=!1,ba=!1,va=!1,tn=!1,ar=!1,or=!1,ms=!0,gs=!1;const Ru="user-content-";let wa=!0,Tn=!1,nn={},rn=null;const ys=ee({},["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 bs=null;const vs=ee({},["audio","video","img","source","image","track"]);let xa=null;const ws=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),sr="http://www.w3.org/1998/Math/MathML",ir="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let an=ft,Da=!1,Ca=null;const Iu=ee({},[sr,ir,ft],Na);let Sn=null;const Lu=["application/xhtml+xml","text/html"],ju="text/html";let we=null,on=null;const Wu=e.createElement("form"),xs=function(k){return k instanceof RegExp||k instanceof Function},ka=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===k)){if((!k||typeof k!="object")&&(k={}),k=jt(k),Sn=Lu.indexOf(k.PARSER_MEDIA_TYPE)===-1?ju:k.PARSER_MEDIA_TYPE,we=Sn==="application/xhtml+xml"?Na:xr,X=Je(k,"ALLOWED_TAGS")?ee({},k.ALLOWED_TAGS,we):le,J=Je(k,"ALLOWED_ATTR")?ee({},k.ALLOWED_ATTR,we):ve,Ca=Je(k,"ALLOWED_NAMESPACES")?ee({},k.ALLOWED_NAMESPACES,Na):Iu,xa=Je(k,"ADD_URI_SAFE_ATTR")?ee(jt(ws),k.ADD_URI_SAFE_ATTR,we):ws,bs=Je(k,"ADD_DATA_URI_TAGS")?ee(jt(vs),k.ADD_DATA_URI_TAGS,we):vs,rn=Je(k,"FORBID_CONTENTS")?ee({},k.FORBID_CONTENTS,we):ys,Qe=Je(k,"FORBID_TAGS")?ee({},k.FORBID_TAGS,we):{},Ve=Je(k,"FORBID_ATTR")?ee({},k.FORBID_ATTR,we):{},nn=Je(k,"USE_PROFILES")?k.USE_PROFILES:!1,Ct=k.ALLOW_ARIA_ATTR!==!1,Ke=k.ALLOW_DATA_ATTR!==!1,De=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Xe=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=k.SAFE_FOR_TEMPLATES||!1,kt=k.SAFE_FOR_XML!==!1,It=k.WHOLE_DOCUMENT||!1,tn=k.RETURN_DOM||!1,ar=k.RETURN_DOM_FRAGMENT||!1,or=k.RETURN_TRUSTED_TYPE||!1,va=k.FORCE_BODY||!1,ms=k.SANITIZE_DOM!==!1,gs=k.SANITIZE_NAMED_PROPS||!1,wa=k.KEEP_CONTENT!==!1,Tn=k.IN_PLACE||!1,K=k.ALLOWED_URI_REGEXP||nc,an=k.NAMESPACE||ft,te=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&xs(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&xs(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(Ke=!1),ar&&(tn=!0),nn&&(X=ee({},ei),J=[],nn.html===!0&&(ee(X,Zs),ee(J,ti)),nn.svg===!0&&(ee(X,Ra),ee(J,ja),ee(J,fr)),nn.svgFilters===!0&&(ee(X,Ia),ee(J,ja),ee(J,fr)),nn.mathMl===!0&&(ee(X,La),ee(J,ni),ee(J,fr))),k.ADD_TAGS&&(X===le&&(X=jt(X)),ee(X,k.ADD_TAGS,we)),k.ADD_ATTR&&(J===ve&&(J=jt(J)),ee(J,k.ADD_ATTR,we)),k.ADD_URI_SAFE_ATTR&&ee(xa,k.ADD_URI_SAFE_ATTR,we),k.FORBID_CONTENTS&&(rn===ys&&(rn=jt(rn)),ee(rn,k.FORBID_CONTENTS,we)),wa&&(X["#text"]=!0),It&&ee(X,["html","head","body"]),X.table&&(ee(X,["tbody"]),delete Qe.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw An('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw An('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=k.TRUSTED_TYPES_POLICY,O=S.createHTML("")}else S===void 0&&(S=Oh(m,a)),S!==null&&typeof O=="string"&&(O=S.createHTML(""));Ie&&Ie(k),on=k}},Ds=ee({},["mi","mo","mn","ms","mtext"]),Cs=ee({},["foreignobject","annotation-xml"]),Yu=ee({},["title","style","font","a","script"]),ks=ee({},[...Ra,...Ia,...xh]),_s=ee({},[...La,...Dh]),Bu=function(k){let W=_(k);(!W||!W.tagName)&&(W={namespaceURI:an,tagName:"template"});const z=xr(k.tagName),ce=xr(W.tagName);return Ca[k.namespaceURI]?k.namespaceURI===ir?W.namespaceURI===ft?z==="svg":W.namespaceURI===sr?z==="svg"&&(ce==="annotation-xml"||Ds[ce]):!!ks[z]:k.namespaceURI===sr?W.namespaceURI===ft?z==="math":W.namespaceURI===ir?z==="math"&&Cs[ce]:!!_s[z]:k.namespaceURI===ft?W.namespaceURI===ir&&!Cs[ce]||W.namespaceURI===sr&&!Ds[ce]?!1:!_s[z]&&(Yu[z]||!ks[z]):!!(Sn==="application/xhtml+xml"&&Ca[k.namespaceURI]):!1},tt=function(k){Pn(r.removed,{element:k});try{_(k).removeChild(k)}catch(W){b(k)}},lr=function(k,W){try{Pn(r.removed,{attribute:W.getAttributeNode(k),from:W})}catch(z){Pn(r.removed,{attribute:null,from:W})}if(W.removeAttribute(k),k==="is"&&!J[k])if(tn||ar)try{tt(W)}catch(z){}else try{W.setAttribute(k,"")}catch(z){}},Ts=function(k){let W=null,z=null;if(va)k="<remove></remove>"+k;else{const Ce=Js(k,/^[\r\n\t ]+/);z=Ce&&Ce[0]}Sn==="application/xhtml+xml"&&an===ft&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ce=S?S.createHTML(k):k;if(an===ft)try{W=new p().parseFromString(ce,Sn)}catch(Ce){}if(!W||!W.documentElement){W=j.createDocument(an,"template",null);try{W.documentElement.innerHTML=Da?O:ce}catch(Ce){}}const _e=W.body||W.documentElement;return k&&z&&_e.insertBefore(e.createTextNode(z),_e.childNodes[0]||null),an===ft?R.call(W,It?"html":"body")[0]:It?W.documentElement:_e},Ss=function(k){return B.call(k.ownerDocument||k,k,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Es=function(k){return k instanceof d&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof c)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Ps=function(k){return typeof i=="function"&&k instanceof i},pt=function(k,W,z){P[k]&&dr(P[k],ce=>{ce.call(r,W,z,on)})},Ms=function(k){let W=null;if(pt("beforeSanitizeElements",k,null),Es(k))return tt(k),!0;const z=we(k.nodeName);if(pt("uponSanitizeElement",k,{tagName:z,allowedTags:X}),k.hasChildNodes()&&!Ps(k.firstElementChild)&&Oe(/<[/\w]/g,k.innerHTML)&&Oe(/<[/\w]/g,k.textContent)||k.nodeType===Fn.progressingInstruction||kt&&k.nodeType===Fn.comment&&Oe(/<[/\w]/g,k.data))return tt(k),!0;if(!X[z]||Qe[z]){if(!Qe[z]&&Os(z)&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,z)||te.tagNameCheck instanceof Function&&te.tagNameCheck(z)))return!1;if(wa&&!rn[z]){const ce=_(k)||k.parentNode,_e=C(k)||k.childNodes;if(_e&&ce){const Ce=_e.length;for(let Le=Ce-1;Le>=0;--Le){const nt=v(_e[Le],!0);nt.__removalCount=(k.__removalCount||0)+1,ce.insertBefore(nt,x(k))}}}return tt(k),!0}return k instanceof u&&!Bu(k)||(z==="noscript"||z==="noembed"||z==="noframes")&&Oe(/<\/no(script|embed|frames)/i,k.innerHTML)?(tt(k),!0):(Ue&&k.nodeType===Fn.text&&(W=k.textContent,dr([Y,$,N],ce=>{W=Mn(W,ce," ")}),k.textContent!==W&&(Pn(r.removed,{element:k.cloneNode()}),k.textContent=W)),pt("afterSanitizeElements",k,null),!1)},As=function(k,W,z){if(ms&&(W==="id"||W==="name")&&(z in e||z in Wu))return!1;if(!(Ke&&!Ve[W]&&Oe(M,W))){if(!(Ct&&Oe(F,W))){if(!J[W]||Ve[W]){if(!(Os(k)&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,k)||te.tagNameCheck instanceof Function&&te.tagNameCheck(k))&&(te.attributeNameCheck instanceof RegExp&&Oe(te.attributeNameCheck,W)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(W))||W==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Oe(te.tagNameCheck,z)||te.tagNameCheck instanceof Function&&te.tagNameCheck(z))))return!1}else if(!xa[W]){if(!Oe(K,Mn(z,A,""))){if(!((W==="src"||W==="xlink:href"||W==="href")&&k!=="script"&&yh(z,"data:")===0&&bs[k])){if(!(De&&!Oe(E,Mn(z,A,"")))){if(z)return!1}}}}}}return!0},Os=function(k){return k!=="annotation-xml"&&Js(k,L)},Fs=function(k){pt("beforeSanitizeAttributes",k,null);const{attributes:W}=k;if(!W)return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J};let ce=W.length;for(;ce--;){const _e=W[ce],{name:Ce,namespaceURI:Le,value:nt}=_e,En=we(Ce);let Ae=Ce==="value"?nt:bh(nt);if(z.attrName=En,z.attrValue=Ae,z.keepAttr=!0,z.forceKeepAttr=void 0,pt("uponSanitizeAttribute",k,z),Ae=z.attrValue,kt&&Oe(/((--!?|])>)|<\/(style|title)/i,Ae)){lr(Ce,k);continue}if(z.forceKeepAttr||(lr(Ce,k),!z.keepAttr))continue;if(!Xe&&Oe(/\/>/i,Ae)){lr(Ce,k);continue}Ue&&dr([Y,$,N],Rs=>{Ae=Mn(Ae,Rs," ")});const Ns=we(k.nodeName);if(As(Ns,En,Ae)){if(gs&&(En==="id"||En==="name")&&(lr(Ce,k),Ae=Ru+Ae),S&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Le)switch(m.getAttributeType(Ns,En)){case"TrustedHTML":{Ae=S.createHTML(Ae);break}case"TrustedScriptURL":{Ae=S.createScriptURL(Ae);break}}try{Le?k.setAttributeNS(Le,Ce,Ae):k.setAttribute(Ce,Ae),Es(k)?tt(k):Xs(r.removed)}catch(Rs){}}}pt("afterSanitizeAttributes",k,null)},Hu=function V(k){let W=null;const z=Ss(k);for(pt("beforeSanitizeShadowDOM",k,null);W=z.nextNode();)pt("uponSanitizeShadowNode",W,null),!Ms(W)&&(W.content instanceof o&&V(W.content),Fs(W));pt("afterSanitizeShadowDOM",k,null)};return r.sanitize=function(V){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},W=null,z=null,ce=null,_e=null;if(Da=!V,Da&&(V="<!-->"),typeof V!="string"&&!Ps(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw An("dirty is not a string, aborting")}else throw An("toString is not a function");if(!r.isSupported)return V;if(ba||ka(k),r.removed=[],typeof V=="string"&&(Tn=!1),Tn){if(V.nodeName){const nt=we(V.nodeName);if(!X[nt]||Qe[nt])throw An("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof i)W=Ts("<!---->"),z=W.ownerDocument.importNode(V,!0),z.nodeType===Fn.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?W=z:W.appendChild(z);else{if(!tn&&!Ue&&!It&&V.indexOf("<")===-1)return S&&or?S.createHTML(V):V;if(W=Ts(V),!W)return tn?null:or?O:""}W&&va&&tt(W.firstChild);const Ce=Ss(Tn?V:W);for(;ce=Ce.nextNode();)Ms(ce)||(ce.content instanceof o&&Hu(ce.content),Fs(ce));if(Tn)return V;if(tn){if(ar)for(_e=H.call(W.ownerDocument);W.firstChild;)_e.appendChild(W.firstChild);else _e=W;return(J.shadowroot||J.shadowrootmode)&&(_e=I.call(n,_e,!0)),_e}let Le=It?W.outerHTML:W.innerHTML;return It&&X["!doctype"]&&W.ownerDocument&&W.ownerDocument.doctype&&W.ownerDocument.doctype.name&&Oe(rc,W.ownerDocument.doctype.name)&&(Le="<!DOCTYPE "+W.ownerDocument.doctype.name+`>
8
8
  `+Le),Ue&&dr([Y,$,N],nt=>{Le=Mn(Le,nt," ")}),S&&or?S.createHTML(Le):Le},r.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ka(V),ba=!0},r.clearConfig=function(){on=null,ba=!1},r.isValidAttribute=function(V,k,W){on||ka({});const z=we(V),ce=we(k);return As(z,ce,W)},r.addHook=function(V,k){typeof k=="function"&&(P[V]=P[V]||[],Pn(P[V],k))},r.removeHook=function(V){if(P[V])return Xs(P[V])},r.removeHooks=function(V){P[V]&&(P[V]=[])},r.removeAllHooks=function(){P={}},r}var Fh=ac();function Nh(t){return t!==null&&typeof t=="object"&&typeof t.styleOptions=="object"&&typeof t.styleOptions.html=="string"&&typeof t.styleOptions.bgColor=="string"&&typeof t.styleOptions.vAlign=="string"}const Rh={"valign-top":"flex-start","valign-middle":"center","valign-bottom":"flex-end"},Ih=f.newStyled.div`
9
9
  background-color: ${t=>t.styleOptions.bgColor};
10
10
  display: flex;