@sisense/sdk-ui 2.23.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/ai.cjs +59 -59
  2. package/dist/ai.js +919 -980
  3. package/dist/analytics-composer/node.cjs +1 -1
  4. package/dist/analytics-composer/node.js +1232 -1220
  5. package/dist/analytics-composer.cjs +1 -1
  6. package/dist/analytics-composer.js +6 -6
  7. package/dist/{execute-query-CHYTupEo.js → apply-styled-options-to-query-BsBTwL6W.js} +1522 -1447
  8. package/dist/apply-styled-options-to-query-mFJvsssw.cjs +1 -0
  9. package/dist/{index-Dx6wvLd3.cjs → index-BX9p-XrU.cjs} +1 -1
  10. package/dist/{index-DCAC0mJe.js → index-D7mHzfx0.js} +30 -1
  11. package/dist/index.cjs +731 -712
  12. package/dist/index.js +26018 -33110
  13. package/dist/index.umd.js +985 -958
  14. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +1 -1
  15. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +17 -5
  16. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +4 -1
  17. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +1 -1
  18. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/rename-widget/use-widget-renaming.d.ts +1 -1
  19. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-csv-download.d.ts +24 -0
  20. package/dist/packages/sdk-ui/src/domains/dashboarding/index.d.ts +2 -0
  21. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/persistence-manager.d.ts +11 -0
  22. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +52 -0
  23. package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +25 -28
  24. package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +4 -2
  25. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-collapsible.d.ts +13 -0
  26. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-top-slot-shell.d.ts +21 -0
  27. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative-interactive.d.ts +11 -0
  28. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative.d.ts +40 -0
  29. package/dist/packages/sdk-ui/src/domains/narrative/core/build-narrative-request.d.ts +36 -0
  30. package/dist/packages/sdk-ui/src/domains/narrative/core/get-narrative-dimensions-and-measures.d.ts +22 -0
  31. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-narrative-options.d.ts +28 -0
  32. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-props-to-narrative-params.d.ts +36 -0
  33. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-get-widget-narrative.d.ts +62 -0
  34. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-widget-narrative-state.d.ts +39 -0
  35. package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/helpers/use-translated-data-options.d.ts +12 -1
  36. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/apply-styled-options-to-query.d.ts +87 -0
  37. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-data-options.d.ts +13 -1
  38. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/compose-code-to-readable.d.ts +12 -0
  39. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +6 -0
  40. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +26 -0
  41. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-params-to-view-model.d.ts +12 -0
  42. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill-bubble-tooltip.d.ts +12 -0
  43. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +13 -0
  44. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/types.d.ts +51 -0
  45. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/use-chart-widget-csv-download.d.ts +18 -0
  46. package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/use-custom-widget-csv-download.d.ts +15 -0
  47. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/use-pivot-widget-csv-download.d.ts +18 -0
  48. package/dist/packages/sdk-ui/src/domains/widgets/components/tabber-buttons-widget/types.d.ts +8 -8
  49. package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +21 -1
  50. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +59 -2
  51. package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-csv-query-file-loader.d.ts +16 -0
  52. package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-with-csv-download-menu-item.d.ts +22 -0
  53. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-menu-button.d.ts +1 -1
  54. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/utils.d.ts +9 -0
  55. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +5 -2
  56. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-api-types.d.ts +32 -0
  57. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-constants.d.ts +6 -0
  58. package/dist/packages/sdk-ui/src/{modules/ai/api/narration-endpoints.d.ts → infra/api/narrative/narrative-endpoints.d.ts} +8 -7
  59. package/dist/packages/sdk-ui/src/infra/api/narrative/send-ai-feedback.d.ts +8 -0
  60. package/dist/packages/sdk-ui/src/infra/app/client-application.d.ts +2 -2
  61. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/custom-widgets-provider-adapter.d.ts +2 -1
  62. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-custom-widgets.d.ts +11 -4
  63. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/emotion-cache-provider.d.ts +31 -3
  64. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/stylis-plugins/css-selector-prefix-plugin.d.ts +18 -0
  65. package/dist/packages/sdk-ui/src/infra/plugins/custom-plugin-context-provider.d.ts +18 -0
  66. package/dist/packages/sdk-ui/src/infra/plugins/plugin-context.d.ts +29 -0
  67. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/plugin-provider.d.ts +4 -2
  68. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/types.d.ts +12 -4
  69. package/dist/packages/sdk-ui/src/infra/plugins/use-widget-plugin-registry.d.ts +7 -0
  70. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/validate-plugins.d.ts +1 -1
  71. package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +302 -0
  72. package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/widget-plugin-registry.d.ts +33 -0
  73. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +29 -0
  74. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +29 -0
  75. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +29 -0
  76. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +29 -0
  77. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +29 -0
  78. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +29 -0
  79. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +29 -0
  80. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +29 -0
  81. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +29 -0
  82. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +29 -0
  83. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +29 -0
  84. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +29 -0
  85. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +29 -0
  86. package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +29 -0
  87. package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +58 -0
  88. package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +1 -1
  89. package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +5 -18
  90. package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -0
  91. package/dist/packages/sdk-ui/src/modules/ai/common/collapsible.d.ts +3 -0
  92. package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +5 -13
  93. package/dist/packages/sdk-ui/src/modules/ai/index.d.ts +1 -1
  94. package/dist/packages/sdk-ui/src/modules/ai/use-get-nlg-insights.d.ts +4 -26
  95. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/expression/custom-formula/validate-custom-formula.d.ts +15 -3
  96. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/expression/formula-function-schemas.d.ts +22 -6
  97. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/schema-index.d.ts +5 -2
  98. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +3 -7
  99. package/dist/packages/sdk-ui/src/props.d.ts +20 -2
  100. package/dist/packages/sdk-ui/src/public-api/internal.d.ts +2 -0
  101. package/dist/packages/sdk-ui/src/public-api/public.d.ts +1 -1
  102. package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +9 -1
  103. package/dist/packages/sdk-ui/src/shared/const.d.ts +5 -0
  104. package/dist/packages/sdk-ui/src/shared/types/menu-item.d.ts +5 -1
  105. package/dist/packages/sdk-ui/src/shared/utils/menu-item-converters.d.ts +12 -0
  106. package/dist/packages/sdk-ui/src/types.d.ts +1 -1
  107. package/dist/parse-compose-code-DfZskSng.js +352 -0
  108. package/dist/parse-compose-code-v4J9BrUg.cjs +1 -0
  109. package/dist/translations/de-de.cjs +1 -1
  110. package/dist/translations/de-de.js +31 -2
  111. package/dist/translations/en-us.cjs +1 -1
  112. package/dist/translations/en-us.js +1 -1
  113. package/dist/translations/es-ar.cjs +1 -1
  114. package/dist/translations/es-ar.js +31 -2
  115. package/dist/translations/es-es.cjs +1 -1
  116. package/dist/translations/es-es.js +31 -2
  117. package/dist/translations/fr-fr.cjs +1 -1
  118. package/dist/translations/fr-fr.js +31 -2
  119. package/dist/translations/it-it.cjs +1 -1
  120. package/dist/translations/it-it.js +31 -2
  121. package/dist/translations/ja-jp.cjs +1 -1
  122. package/dist/translations/ja-jp.js +31 -2
  123. package/dist/translations/ko-kr.cjs +1 -1
  124. package/dist/translations/ko-kr.js +31 -2
  125. package/dist/translations/nl-nl.cjs +1 -1
  126. package/dist/translations/nl-nl.js +31 -2
  127. package/dist/translations/pt-br.cjs +1 -1
  128. package/dist/translations/pt-br.js +31 -2
  129. package/dist/translations/ru-ru.cjs +1 -1
  130. package/dist/translations/ru-ru.js +31 -2
  131. package/dist/translations/tr-tr.cjs +1 -1
  132. package/dist/translations/tr-tr.js +31 -2
  133. package/dist/translations/zh-cn.cjs +1 -1
  134. package/dist/translations/zh-cn.js +31 -2
  135. package/dist/{types-B96nVbgX.js → types-BBp2sp_s.js} +1 -1
  136. package/dist/types-GFLaiax5.cjs +1 -0
  137. package/dist/use-hover-DsnmY-p_.cjs +721 -0
  138. package/dist/{quota-notification-CVl0isIV.js → use-hover-mptQLQ4S.js} +27865 -19277
  139. package/dist/{utils-CgV-jWWQ.cjs → utils-BlNqPAG8.cjs} +45 -45
  140. package/dist/{utils-ChqSLRbz.js → utils-DTUC-wtI.js} +7729 -7513
  141. package/dist/{widget-composer-Blul90Zb.cjs → widget-composer-CDb2iOoS.cjs} +1 -1
  142. package/dist/{widget-composer-Cf_CN3Ux.js → widget-composer-D0BZrLna.js} +3 -3
  143. package/package.json +11 -10
  144. package/dist/dimensions-2t18RSZC.cjs +0 -1
  145. package/dist/dimensions-C0BmtTH2.js +0 -204
  146. package/dist/execute-query-DmAyVFF5.cjs +0 -1
  147. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/index.d.ts +0 -5
  148. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-context.d.ts +0 -15
  149. package/dist/packages/sdk-ui/src/infra/styled/index.d.ts +0 -4
  150. package/dist/packages/sdk-ui/src/infra/styled/with-css-selector-prefix.d.ts +0 -2
  151. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts +0 -8
  152. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/parse-compose-code.d.ts +0 -15
  153. package/dist/quota-notification-RAaHp-eO.cjs +0 -713
  154. package/dist/types-DZ4vWh8j.cjs +0 -1
@@ -1,27 +1,27 @@
1
- var zt = Object.defineProperty, Pt = Object.defineProperties;
2
- var Lt = Object.getOwnPropertyDescriptors;
3
- var ze = Object.getOwnPropertySymbols;
4
- var _t = Object.prototype.hasOwnProperty, Ut = Object.prototype.propertyIsEnumerable;
5
- var Pe = (e, t, r) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, g = (e, t) => {
1
+ var Lt = Object.defineProperty, Ut = Object.defineProperties;
2
+ var _t = Object.getOwnPropertyDescriptors;
3
+ var Pe = Object.getOwnPropertySymbols;
4
+ var Vt = Object.prototype.hasOwnProperty, jt = Object.prototype.propertyIsEnumerable;
5
+ var ke = (e, t, r) => t in e ? Lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, y = (e, t) => {
6
6
  for (var r in t || (t = {}))
7
- _t.call(t, r) && Pe(e, r, t[r]);
8
- if (ze)
9
- for (var r of ze(t))
10
- Ut.call(t, r) && Pe(e, r, t[r]);
7
+ Vt.call(t, r) && ke(e, r, t[r]);
8
+ if (Pe)
9
+ for (var r of Pe(t))
10
+ jt.call(t, r) && ke(e, r, t[r]);
11
11
  return e;
12
- }, F = (e, t) => Pt(e, Lt(t));
13
- import { f as jt, J as Vt } from "../types-B96nVbgX.js";
14
- import { b as ri, E as si, a as ni, i as ii, e as oi, d as ai } from "../types-B96nVbgX.js";
15
- import { cb as Wt, bK as Kt, cc as Jt, cd as Yt, ce as Gt, aG as be, cf as Qt, aF as Ht, cg as Xt, bi as Zt, aH as er, ch as tr, bl as rr, bj as sr, aV as nr, bh as ir, bk as or, d as ar, c as ur, k as cr, ci as lr, cj as fr, ck as dr, cl as mr, cm as pr, cn as yr, co as gr, cp as hr, cq as br, cr as Fr, cs as wr, aE as qr, ct as Ar, cu as Cr, S as B, t as H, h as Er, b as $, av as _, at as te, cv as xr, cw as $r, cx as Tr, M as L, cy as Dr, cz as Sr, aR as Or, ax as Le, aw as Fe, bQ as re, U as Mr, V as vr, cA as tt, ag as Nr, A as Rr, cB as Ir, y as kr, x as Br } from "../execute-query-CHYTupEo.js";
16
- import { i as zr, b as Pr, D as Lr, d as _r, a as Ur } from "../dimensions-C0BmtTH2.js";
17
- function jr(e, t) {
18
- const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, o) => Array.from({ length: s + 1 }, (a, u) => o === 0 ? u : u === 0 ? o : 0));
12
+ }, A = (e, t) => Ut(e, _t(t));
13
+ import { f as Wt, J as Kt } from "../types-BBp2sp_s.js";
14
+ import { b as ni, E as ii, a as ai, i as oi, e as ui, d as li } from "../types-BBp2sp_s.js";
15
+ import { cg as Gt, bJ as Yt, ch as Jt, ci as Ht, cj as Qt, aw as be, ck as Xt, av as Zt, cl as er, bb as tr, ax as rr, cm as sr, be as nr, bc as ir, aO as ar, ba as or, bd as ur, d as lr, c as cr, k as fr, cn as dr, co as mr, cp as pr, cq as gr, cr as yr, cs as hr, ct as br, cu as Fr, cv as Ar, cw as wr, cx as Er, au as Cr, cy as Tr, cz as qr, S as B, t as X, h as xr, b as $, al as _, aj as et, cA as $r, cB as Sr, cC as Or, M as U, cD as Dr, cE as Mr, aK as Nr, an as Be, am as Fe, cd as vr, ce as Rr, bP as tt, cF as rt, ad as Ir, cG as st, cH as nt, A as Pr, cI as kr, bF as Br, aD as zr } from "../apply-styled-options-to-query-BsBTwL6W.js";
16
+ import { i as Lr, b as Ur, D as _r, d as Vr, a as jr, s as Wr, f as Kr, p as K } from "../parse-compose-code-DfZskSng.js";
17
+ function Gr(e, t) {
18
+ const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, a) => Array.from({ length: s + 1 }, (o, u) => a === 0 ? u : u === 0 ? a : 0));
19
19
  for (let i = 1; i <= r; i++)
20
- for (let o = 1; o <= s; o++)
21
- n[i][o] = Math.min(n[i - 1][o] + 1, n[i][o - 1] + 1, n[i - 1][o - 1] + (e[i - 1] === t[o - 1] ? 0 : 1));
20
+ for (let a = 1; a <= s; a++)
21
+ n[i][a] = Math.min(n[i - 1][a] + 1, n[i][a - 1] + 1, n[i - 1][a - 1] + (e[i - 1] === t[a - 1] ? 0 : 1));
22
22
  return n[r][s];
23
23
  }
24
- class Vr {
24
+ class Yr {
25
25
  constructor() {
26
26
  this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
27
27
  }
@@ -38,9 +38,9 @@ class Vr {
38
38
  this.keyToValue.clear(), this.valueToKey.clear();
39
39
  }
40
40
  }
41
- class rt {
41
+ class it {
42
42
  constructor(t) {
43
- this.generateIdentifier = t, this.kv = new Vr();
43
+ this.generateIdentifier = t, this.kv = new Yr();
44
44
  }
45
45
  register(t, r) {
46
46
  this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
@@ -55,7 +55,7 @@ class rt {
55
55
  return this.kv.getByKey(t);
56
56
  }
57
57
  }
58
- class Wr extends rt {
58
+ class Jr extends it {
59
59
  constructor() {
60
60
  super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
61
61
  }
@@ -66,7 +66,7 @@ class Wr extends rt {
66
66
  return this.classToAllowedProps.get(t);
67
67
  }
68
68
  }
69
- function Kr(e) {
69
+ function Hr(e) {
70
70
  if ("values" in Object)
71
71
  return Object.values(e);
72
72
  const t = [];
@@ -74,8 +74,8 @@ function Kr(e) {
74
74
  e.hasOwnProperty(r) && t.push(e[r]);
75
75
  return t;
76
76
  }
77
- function Jr(e, t) {
78
- const r = Kr(e);
77
+ function Qr(e, t) {
78
+ const r = Hr(e);
79
79
  if ("find" in r)
80
80
  return r.find(t);
81
81
  const s = r;
@@ -85,20 +85,20 @@ function Jr(e, t) {
85
85
  return i;
86
86
  }
87
87
  }
88
- function U(e, t) {
88
+ function V(e, t) {
89
89
  Object.entries(e).forEach(([r, s]) => t(s, r));
90
90
  }
91
- function Z(e, t) {
91
+ function ee(e, t) {
92
92
  return e.indexOf(t) !== -1;
93
93
  }
94
- function _e(e, t) {
94
+ function ze(e, t) {
95
95
  for (let r = 0; r < e.length; r++) {
96
96
  const s = e[r];
97
97
  if (t(s))
98
98
  return s;
99
99
  }
100
100
  }
101
- class Yr {
101
+ class Xr {
102
102
  constructor() {
103
103
  this.transfomers = {};
104
104
  }
@@ -106,13 +106,13 @@ class Yr {
106
106
  this.transfomers[t.name] = t;
107
107
  }
108
108
  findApplicable(t) {
109
- return Jr(this.transfomers, (r) => r.isApplicable(t));
109
+ return Qr(this.transfomers, (r) => r.isApplicable(t));
110
110
  }
111
111
  findByName(t) {
112
112
  return this.transfomers[t];
113
113
  }
114
114
  }
115
- const Gr = (e) => Object.prototype.toString.call(e).slice(8, -1), st = (e) => typeof e == "undefined", Qr = (e) => e === null, K = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, fe = (e) => K(e) && Object.keys(e).length === 0, R = (e) => Array.isArray(e), Hr = (e) => typeof e == "string", Xr = (e) => typeof e == "number" && !isNaN(e), Zr = (e) => typeof e == "boolean", es = (e) => e instanceof RegExp, J = (e) => e instanceof Map, Y = (e) => e instanceof Set, nt = (e) => Gr(e) === "Symbol", ts = (e) => e instanceof Date && !isNaN(e.valueOf()), rs = (e) => e instanceof Error, Ue = (e) => typeof e == "number" && isNaN(e), ss = (e) => Zr(e) || Qr(e) || st(e) || Xr(e) || Hr(e) || nt(e), ns = (e) => typeof e == "bigint", is = (e) => e === 1 / 0 || e === -1 / 0, os = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), as = (e) => e instanceof URL, it = (e) => e.replace(/\./g, "\\."), ae = (e) => e.map(String).map(it).join("."), W = (e) => {
115
+ const Zr = (e) => Object.prototype.toString.call(e).slice(8, -1), at = (e) => typeof e == "undefined", es = (e) => e === null, G = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, de = (e) => G(e) && Object.keys(e).length === 0, I = (e) => Array.isArray(e), ts = (e) => typeof e == "string", rs = (e) => typeof e == "number" && !isNaN(e), ss = (e) => typeof e == "boolean", ns = (e) => e instanceof RegExp, Y = (e) => e instanceof Map, J = (e) => e instanceof Set, ot = (e) => Zr(e) === "Symbol", is = (e) => e instanceof Date && !isNaN(e.valueOf()), as = (e) => e instanceof Error, Le = (e) => typeof e == "number" && isNaN(e), os = (e) => ss(e) || es(e) || at(e) || rs(e) || ts(e) || ot(e), us = (e) => typeof e == "bigint", ls = (e) => e === 1 / 0 || e === -1 / 0, cs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), fs = (e) => e instanceof URL, ut = (e) => e.replace(/\./g, "\\."), oe = (e) => e.map(String).map(ut).join("."), W = (e) => {
116
116
  const t = [];
117
117
  let r = "";
118
118
  for (let n = 0; n < e.length; n++) {
@@ -130,7 +130,7 @@ const Gr = (e) => Object.prototype.toString.call(e).slice(8, -1), st = (e) => ty
130
130
  const s = r;
131
131
  return t.push(s), t;
132
132
  };
133
- function v(e, t, r, s) {
133
+ function R(e, t, r, s) {
134
134
  return {
135
135
  isApplicable: e,
136
136
  annotation: t,
@@ -138,12 +138,12 @@ function v(e, t, r, s) {
138
138
  untransform: s
139
139
  };
140
140
  }
141
- const ot = [
142
- v(st, "undefined", () => null, () => {
141
+ const lt = [
142
+ R(at, "undefined", () => null, () => {
143
143
  }),
144
- v(ns, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
145
- v(ts, "Date", (e) => e.toISOString(), (e) => new Date(e)),
146
- v(rs, "Error", (e, t) => {
144
+ R(us, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
145
+ R(is, "Date", (e) => e.toISOString(), (e) => new Date(e)),
146
+ R(as, "Error", (e, t) => {
147
147
  const r = {
148
148
  name: e.name,
149
149
  message: e.message
@@ -157,22 +157,22 @@ const ot = [
157
157
  r[s] = e[s];
158
158
  }), r;
159
159
  }),
160
- v(es, "regexp", (e) => "" + e, (e) => {
160
+ R(ns, "regexp", (e) => "" + e, (e) => {
161
161
  const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
162
162
  return new RegExp(t, r);
163
163
  }),
164
- v(
165
- Y,
164
+ R(
165
+ J,
166
166
  "set",
167
167
  // (sets only exist in es6+)
168
168
  // eslint-disable-next-line es5/no-es6-methods
169
169
  (e) => [...e.values()],
170
170
  (e) => new Set(e)
171
171
  ),
172
- v(J, "map", (e) => [...e.entries()], (e) => new Map(e)),
173
- v((e) => Ue(e) || is(e), "number", (e) => Ue(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
174
- v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
175
- v(as, "URL", (e) => e.toString(), (e) => new URL(e))
172
+ R(Y, "map", (e) => [...e.entries()], (e) => new Map(e)),
173
+ R((e) => Le(e) || ls(e), "number", (e) => Le(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
174
+ R((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
175
+ R(fs, "URL", (e) => e.toString(), (e) => new URL(e))
176
176
  ];
177
177
  function se(e, t, r, s) {
178
178
  return {
@@ -182,12 +182,12 @@ function se(e, t, r, s) {
182
182
  untransform: s
183
183
  };
184
184
  }
185
- const at = se((e, t) => nt(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
185
+ const ct = se((e, t) => ot(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
186
186
  const s = r.symbolRegistry.getValue(t[1]);
187
187
  if (!s)
188
188
  throw new Error("Trying to deserialize unknown symbol");
189
189
  return s;
190
- }), us = [
190
+ }), ds = [
191
191
  Int8Array,
192
192
  Uint8Array,
193
193
  Int16Array,
@@ -197,19 +197,19 @@ const at = se((e, t) => nt(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t)
197
197
  Float32Array,
198
198
  Float64Array,
199
199
  Uint8ClampedArray
200
- ].reduce((e, t) => (e[t.name] = t, e), {}), ut = se(os, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
201
- const r = us[t[1]];
200
+ ].reduce((e, t) => (e[t.name] = t, e), {}), ft = se(cs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
201
+ const r = ds[t[1]];
202
202
  if (!r)
203
203
  throw new Error("Trying to deserialize unknown typed array");
204
204
  return new r(e);
205
205
  });
206
- function ct(e, t) {
206
+ function dt(e, t) {
207
207
  return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
208
208
  }
209
- const lt = se(ct, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
209
+ const mt = se(dt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
210
210
  const r = t.classRegistry.getAllowedProps(e.constructor);
211
211
  if (!r)
212
- return g({}, e);
212
+ return y({}, e);
213
213
  const s = {};
214
214
  return r.forEach((n) => {
215
215
  s[n] = e[n];
@@ -219,49 +219,49 @@ const lt = se(ct, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructo
219
219
  if (!s)
220
220
  throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
221
221
  return Object.assign(Object.create(s.prototype), e);
222
- }), ft = se((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
222
+ }), pt = se((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
223
223
  const s = r.customTransformerRegistry.findByName(t[1]);
224
224
  if (!s)
225
225
  throw new Error("Trying to deserialize unknown custom value");
226
226
  return s.deserialize(e);
227
- }), cs = [lt, at, ft, ut], je = (e, t) => {
228
- const r = _e(cs, (n) => n.isApplicable(e, t));
227
+ }), ms = [mt, ct, pt, ft], Ue = (e, t) => {
228
+ const r = ze(ms, (n) => n.isApplicable(e, t));
229
229
  if (r)
230
230
  return {
231
231
  value: r.transform(e, t),
232
232
  type: r.annotation(e, t)
233
233
  };
234
- const s = _e(ot, (n) => n.isApplicable(e, t));
234
+ const s = ze(lt, (n) => n.isApplicable(e, t));
235
235
  if (s)
236
236
  return {
237
237
  value: s.transform(e, t),
238
238
  type: s.annotation
239
239
  };
240
- }, dt = {};
241
- ot.forEach((e) => {
242
- dt[e.annotation] = e;
240
+ }, gt = {};
241
+ lt.forEach((e) => {
242
+ gt[e.annotation] = e;
243
243
  });
244
- const ls = (e, t, r) => {
245
- if (R(t))
244
+ const ps = (e, t, r) => {
245
+ if (I(t))
246
246
  switch (t[0]) {
247
247
  case "symbol":
248
- return at.untransform(e, t, r);
248
+ return ct.untransform(e, t, r);
249
249
  case "class":
250
- return lt.untransform(e, t, r);
250
+ return mt.untransform(e, t, r);
251
251
  case "custom":
252
- return ft.untransform(e, t, r);
252
+ return pt.untransform(e, t, r);
253
253
  case "typed-array":
254
- return ut.untransform(e, t, r);
254
+ return ft.untransform(e, t, r);
255
255
  default:
256
256
  throw new Error("Unknown transformation: " + t);
257
257
  }
258
258
  else {
259
- const s = dt[t];
259
+ const s = gt[t];
260
260
  if (!s)
261
261
  throw new Error("Unknown transformation: " + t);
262
262
  return s.untransform(e, r);
263
263
  }
264
- }, P = (e, t) => {
264
+ }, L = (e, t) => {
265
265
  if (t > e.size)
266
266
  throw new Error("index out of bounds");
267
267
  const r = e.keys();
@@ -269,187 +269,187 @@ const ls = (e, t, r) => {
269
269
  r.next(), t--;
270
270
  return r.next().value;
271
271
  };
272
- function mt(e) {
273
- if (Z(e, "__proto__"))
272
+ function yt(e) {
273
+ if (ee(e, "__proto__"))
274
274
  throw new Error("__proto__ is not allowed as a property");
275
- if (Z(e, "prototype"))
275
+ if (ee(e, "prototype"))
276
276
  throw new Error("prototype is not allowed as a property");
277
- if (Z(e, "constructor"))
277
+ if (ee(e, "constructor"))
278
278
  throw new Error("constructor is not allowed as a property");
279
279
  }
280
- const fs = (e, t) => {
281
- mt(t);
280
+ const gs = (e, t) => {
281
+ yt(t);
282
282
  for (let r = 0; r < t.length; r++) {
283
283
  const s = t[r];
284
- if (Y(e))
285
- e = P(e, +s);
286
- else if (J(e)) {
287
- const n = +s, i = +t[++r] == 0 ? "key" : "value", o = P(e, n);
284
+ if (J(e))
285
+ e = L(e, +s);
286
+ else if (Y(e)) {
287
+ const n = +s, i = +t[++r] == 0 ? "key" : "value", a = L(e, n);
288
288
  switch (i) {
289
289
  case "key":
290
- e = o;
290
+ e = a;
291
291
  break;
292
292
  case "value":
293
- e = e.get(o);
293
+ e = e.get(a);
294
294
  break;
295
295
  }
296
296
  } else
297
297
  e = e[s];
298
298
  }
299
299
  return e;
300
- }, de = (e, t, r) => {
301
- if (mt(t), t.length === 0)
300
+ }, me = (e, t, r) => {
301
+ if (yt(t), t.length === 0)
302
302
  return r(e);
303
303
  let s = e;
304
304
  for (let i = 0; i < t.length - 1; i++) {
305
- const o = t[i];
306
- if (R(s)) {
307
- const a = +o;
308
- s = s[a];
309
- } else if (K(s))
305
+ const a = t[i];
306
+ if (I(s)) {
307
+ const o = +a;
310
308
  s = s[o];
311
- else if (Y(s)) {
312
- const a = +o;
313
- s = P(s, a);
314
- } else if (J(s)) {
309
+ } else if (G(s))
310
+ s = s[a];
311
+ else if (J(s)) {
312
+ const o = +a;
313
+ s = L(s, o);
314
+ } else if (Y(s)) {
315
315
  if (i === t.length - 2)
316
316
  break;
317
- const u = +o, c = +t[++i] == 0 ? "key" : "value", m = P(s, u);
318
- switch (c) {
317
+ const u = +a, l = +t[++i] == 0 ? "key" : "value", p = L(s, u);
318
+ switch (l) {
319
319
  case "key":
320
- s = m;
320
+ s = p;
321
321
  break;
322
322
  case "value":
323
- s = s.get(m);
323
+ s = s.get(p);
324
324
  break;
325
325
  }
326
326
  }
327
327
  }
328
328
  const n = t[t.length - 1];
329
- if (R(s) ? s[+n] = r(s[+n]) : K(s) && (s[n] = r(s[n])), Y(s)) {
330
- const i = P(s, +n), o = r(i);
331
- i !== o && (s.delete(i), s.add(o));
329
+ if (I(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J(s)) {
330
+ const i = L(s, +n), a = r(i);
331
+ i !== a && (s.delete(i), s.add(a));
332
332
  }
333
- if (J(s)) {
334
- const i = +t[t.length - 2], o = P(s, i);
333
+ if (Y(s)) {
334
+ const i = +t[t.length - 2], a = L(s, i);
335
335
  switch (+n == 0 ? "key" : "value") {
336
336
  case "key": {
337
- const u = r(o);
338
- s.set(u, s.get(o)), u !== o && s.delete(o);
337
+ const u = r(a);
338
+ s.set(u, s.get(a)), u !== a && s.delete(a);
339
339
  break;
340
340
  }
341
341
  case "value": {
342
- s.set(o, r(s.get(o)));
342
+ s.set(a, r(s.get(a)));
343
343
  break;
344
344
  }
345
345
  }
346
346
  }
347
347
  return e;
348
348
  };
349
- function me(e, t, r = []) {
349
+ function pe(e, t, r = []) {
350
350
  if (!e)
351
351
  return;
352
- if (!R(e)) {
353
- U(e, (i, o) => me(i, t, [...r, ...W(o)]));
352
+ if (!I(e)) {
353
+ V(e, (i, a) => pe(i, t, [...r, ...W(a)]));
354
354
  return;
355
355
  }
356
356
  const [s, n] = e;
357
- n && U(n, (i, o) => {
358
- me(i, t, [...r, ...W(o)]);
357
+ n && V(n, (i, a) => {
358
+ pe(i, t, [...r, ...W(a)]);
359
359
  }), t(s, r);
360
360
  }
361
- function ds(e, t, r) {
362
- return me(t, (s, n) => {
363
- e = de(e, n, (i) => ls(i, s, r));
361
+ function ys(e, t, r) {
362
+ return pe(t, (s, n) => {
363
+ e = me(e, n, (i) => ps(i, s, r));
364
364
  }), e;
365
365
  }
366
- function ms(e, t) {
366
+ function hs(e, t) {
367
367
  function r(s, n) {
368
- const i = fs(e, W(n));
369
- s.map(W).forEach((o) => {
370
- e = de(e, o, () => i);
368
+ const i = gs(e, W(n));
369
+ s.map(W).forEach((a) => {
370
+ e = me(e, a, () => i);
371
371
  });
372
372
  }
373
- if (R(t)) {
373
+ if (I(t)) {
374
374
  const [s, n] = t;
375
375
  s.forEach((i) => {
376
- e = de(e, W(i), () => e);
377
- }), n && U(n, r);
376
+ e = me(e, W(i), () => e);
377
+ }), n && V(n, r);
378
378
  } else
379
- U(t, r);
379
+ V(t, r);
380
380
  return e;
381
381
  }
382
- const ps = (e, t) => K(e) || R(e) || J(e) || Y(e) || ct(e, t);
383
- function ys(e, t, r) {
382
+ const bs = (e, t) => G(e) || I(e) || Y(e) || J(e) || dt(e, t);
383
+ function Fs(e, t, r) {
384
384
  const s = r.get(e);
385
385
  s ? s.push(t) : r.set(e, [t]);
386
386
  }
387
- function gs(e, t) {
387
+ function As(e, t) {
388
388
  const r = {};
389
389
  let s;
390
390
  return e.forEach((n) => {
391
391
  if (n.length <= 1)
392
392
  return;
393
- t || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
394
- const [i, ...o] = n;
395
- i.length === 0 ? s = o.map(ae) : r[ae(i)] = o.map(ae);
396
- }), s ? fe(r) ? [s] : [s, r] : fe(r) ? void 0 : r;
397
- }
398
- const pt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map()) => {
399
- var h;
400
- const a = ss(e);
401
- if (!a) {
402
- ys(e, n, t);
403
- const p = o.get(e);
404
- if (p)
393
+ t || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
394
+ const [i, ...a] = n;
395
+ i.length === 0 ? s = a.map(oe) : r[oe(i)] = a.map(oe);
396
+ }), s ? de(r) ? [s] : [s, r] : de(r) ? void 0 : r;
397
+ }
398
+ const ht = (e, t, r, s, n = [], i = [], a = /* @__PURE__ */ new Map()) => {
399
+ var b;
400
+ const o = os(e);
401
+ if (!o) {
402
+ Fs(e, n, t);
403
+ const g = a.get(e);
404
+ if (g)
405
405
  return s ? {
406
406
  transformedValue: null
407
- } : p;
407
+ } : g;
408
408
  }
409
- if (!ps(e, r)) {
410
- const p = je(e, r), d = p ? {
411
- transformedValue: p.value,
412
- annotations: [p.type]
409
+ if (!bs(e, r)) {
410
+ const g = Ue(e, r), m = g ? {
411
+ transformedValue: g.value,
412
+ annotations: [g.type]
413
413
  } : {
414
414
  transformedValue: e
415
415
  };
416
- return a || o.set(e, d), d;
416
+ return o || a.set(e, m), m;
417
417
  }
418
- if (Z(i, e))
418
+ if (ee(i, e))
419
419
  return {
420
420
  transformedValue: null
421
421
  };
422
- const u = je(e, r), c = (h = u == null ? void 0 : u.value) != null ? h : e, m = R(c) ? [] : {}, l = {};
423
- U(c, (p, d) => {
424
- if (d === "__proto__" || d === "constructor" || d === "prototype")
425
- throw new Error(`Detected property ${d}. This is a prototype pollution risk, please remove it from your object.`);
426
- const b = pt(p, t, r, s, [...n, d], [...i, e], o);
427
- m[d] = b.transformedValue, R(b.annotations) ? l[d] = b.annotations : K(b.annotations) && U(b.annotations, (A, O) => {
428
- l[it(d) + "." + O] = A;
422
+ const u = Ue(e, r), l = (b = u == null ? void 0 : u.value) != null ? b : e, p = I(l) ? [] : {}, c = {};
423
+ V(l, (g, m) => {
424
+ if (m === "__proto__" || m === "constructor" || m === "prototype")
425
+ throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);
426
+ const F = ht(g, t, r, s, [...n, m], [...i, e], a);
427
+ p[m] = F.transformedValue, I(F.annotations) ? c[m] = F.annotations : G(F.annotations) && V(F.annotations, (C, N) => {
428
+ c[ut(m) + "." + N] = C;
429
429
  });
430
430
  });
431
- const f = fe(l) ? {
432
- transformedValue: m,
431
+ const d = de(c) ? {
432
+ transformedValue: p,
433
433
  annotations: u ? [u.type] : void 0
434
434
  } : {
435
- transformedValue: m,
436
- annotations: u ? [u.type, l] : l
435
+ transformedValue: p,
436
+ annotations: u ? [u.type, c] : c
437
437
  };
438
- return a || o.set(e, f), f;
438
+ return o || a.set(e, d), d;
439
439
  };
440
- function yt(e) {
440
+ function bt(e) {
441
441
  return Object.prototype.toString.call(e).slice(8, -1);
442
442
  }
443
- function Ve(e) {
444
- return yt(e) === "Array";
443
+ function _e(e) {
444
+ return bt(e) === "Array";
445
445
  }
446
- function hs(e) {
447
- if (yt(e) !== "Object")
446
+ function ws(e) {
447
+ if (bt(e) !== "Object")
448
448
  return !1;
449
449
  const t = Object.getPrototypeOf(e);
450
450
  return !!t && t.constructor === Object && t === Object.prototype;
451
451
  }
452
- function bs(e, t, r, s, n) {
452
+ function Es(e, t, r, s, n) {
453
453
  const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
454
454
  i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
455
455
  value: r,
@@ -458,45 +458,45 @@ function bs(e, t, r, s, n) {
458
458
  configurable: !0
459
459
  });
460
460
  }
461
- function pe(e, t = {}) {
462
- if (Ve(e))
463
- return e.map((n) => pe(n, t));
464
- if (!hs(e))
461
+ function ge(e, t = {}) {
462
+ if (_e(e))
463
+ return e.map((n) => ge(n, t));
464
+ if (!ws(e))
465
465
  return e;
466
466
  const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
467
467
  return [...r, ...s].reduce((n, i) => {
468
- if (Ve(t.props) && !t.props.includes(i))
468
+ if (_e(t.props) && !t.props.includes(i))
469
469
  return n;
470
- const o = e[i], a = pe(o, t);
471
- return bs(n, i, a, e, t.nonenumerable), n;
470
+ const a = e[i], o = ge(a, t);
471
+ return Es(n, i, o, e, t.nonenumerable), n;
472
472
  }, {});
473
473
  }
474
- class y {
474
+ class h {
475
475
  /**
476
476
  * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
477
477
  */
478
478
  constructor({ dedupe: t = !1 } = {}) {
479
- this.classRegistry = new Wr(), this.symbolRegistry = new rt((r) => {
479
+ this.classRegistry = new Jr(), this.symbolRegistry = new it((r) => {
480
480
  var s;
481
481
  return (s = r.description) != null ? s : "";
482
- }), this.customTransformerRegistry = new Yr(), this.allowedErrorProps = [], this.dedupe = t;
482
+ }), this.customTransformerRegistry = new Xr(), this.allowedErrorProps = [], this.dedupe = t;
483
483
  }
484
484
  serialize(t) {
485
- const r = /* @__PURE__ */ new Map(), s = pt(t, r, this, this.dedupe), n = {
485
+ const r = /* @__PURE__ */ new Map(), s = ht(t, r, this, this.dedupe), n = {
486
486
  json: s.transformedValue
487
487
  };
488
- s.annotations && (n.meta = F(g({}, n.meta), {
488
+ s.annotations && (n.meta = A(y({}, n.meta), {
489
489
  values: s.annotations
490
490
  }));
491
- const i = gs(r, this.dedupe);
492
- return i && (n.meta = F(g({}, n.meta), {
491
+ const i = As(r, this.dedupe);
492
+ return i && (n.meta = A(y({}, n.meta), {
493
493
  referentialEqualities: i
494
494
  })), n;
495
495
  }
496
496
  deserialize(t) {
497
497
  const { json: r, meta: s } = t;
498
- let n = pe(r);
499
- return s != null && s.values && (n = ds(n, s.values, this)), s != null && s.referentialEqualities && (n = ms(n, s.referentialEqualities)), n;
498
+ let n = ge(r);
499
+ return s != null && s.values && (n = ys(n, s.values, this)), s != null && s.referentialEqualities && (n = hs(n, s.referentialEqualities)), n;
500
500
  }
501
501
  stringify(t) {
502
502
  return JSON.stringify(this.serialize(t));
@@ -511,7 +511,7 @@ class y {
511
511
  this.symbolRegistry.register(t, r);
512
512
  }
513
513
  registerCustom(t, r) {
514
- this.customTransformerRegistry.register(g({
514
+ this.customTransformerRegistry.register(y({
515
515
  name: r
516
516
  }, t));
517
517
  }
@@ -519,16 +519,16 @@ class y {
519
519
  this.allowedErrorProps.push(...t);
520
520
  }
521
521
  }
522
- y.defaultInstance = new y();
523
- y.serialize = y.defaultInstance.serialize.bind(y.defaultInstance);
524
- y.deserialize = y.defaultInstance.deserialize.bind(y.defaultInstance);
525
- y.stringify = y.defaultInstance.stringify.bind(y.defaultInstance);
526
- y.parse = y.defaultInstance.parse.bind(y.defaultInstance);
527
- y.registerClass = y.defaultInstance.registerClass.bind(y.defaultInstance);
528
- y.registerSymbol = y.defaultInstance.registerSymbol.bind(y.defaultInstance);
529
- y.registerCustom = y.defaultInstance.registerCustom.bind(y.defaultInstance);
530
- y.allowErrorProps = y.defaultInstance.allowErrorProps.bind(y.defaultInstance);
531
- const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e.type), we = (e) => new ar(
522
+ h.defaultInstance = new h();
523
+ h.serialize = h.defaultInstance.serialize.bind(h.defaultInstance);
524
+ h.deserialize = h.defaultInstance.deserialize.bind(h.defaultInstance);
525
+ h.stringify = h.defaultInstance.stringify.bind(h.defaultInstance);
526
+ h.parse = h.defaultInstance.parse.bind(h.defaultInstance);
527
+ h.registerClass = h.defaultInstance.registerClass.bind(h.defaultInstance);
528
+ h.registerSymbol = h.defaultInstance.registerSymbol.bind(h.defaultInstance);
529
+ h.registerCustom = h.defaultInstance.registerCustom.bind(h.defaultInstance);
530
+ h.allowErrorProps = h.defaultInstance.allowErrorProps.bind(h.defaultInstance);
531
+ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e.type), Ae = (e) => new lr(
532
532
  e.name,
533
533
  e.expression,
534
534
  e.type,
@@ -536,7 +536,7 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
536
536
  z(e.sort),
537
537
  e.dataSource,
538
538
  e.composeCode
539
- ), qe = (e) => new ur(
539
+ ), we = (e) => new cr(
540
540
  e.name,
541
541
  e.expression,
542
542
  e.granularity,
@@ -545,27 +545,27 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
545
545
  z(e.sort),
546
546
  e.dataSource,
547
547
  e.composeCode
548
- ), D = (e) => {
548
+ ), O = (e) => {
549
549
  switch (e.__serializable) {
550
550
  case "DimensionalAttribute":
551
- return we(e);
551
+ return Ae(e);
552
552
  case "DimensionalLevelAttribute":
553
- return qe(e);
553
+ return we(e);
554
554
  default:
555
555
  return e;
556
556
  }
557
- }, gt = (e) => new Lr(
557
+ }, Ft = (e) => new _r(
558
558
  e.name,
559
559
  e.expression,
560
- e.attributes.map(D),
561
- e.dimensions.map(ws),
560
+ e.attributes.map(O),
561
+ e.dimensions.map(Ts),
562
562
  e.type,
563
563
  e.description,
564
564
  z(e.sort),
565
565
  e.dataSource,
566
566
  e.composeCode,
567
- e.defaultAttribute ? D(e.defaultAttribute) : void 0
568
- ), ht = (e) => new _r(
567
+ e.defaultAttribute ? O(e.defaultAttribute) : void 0
568
+ ), At = (e) => new Vr(
569
569
  e.name,
570
570
  e.expression,
571
571
  e.description,
@@ -574,18 +574,18 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
574
574
  e.composeCode,
575
575
  e.indexed,
576
576
  e.merged
577
- ), ws = (e) => {
577
+ ), Ts = (e) => {
578
578
  switch (e.__serializable) {
579
579
  case "DimensionalDimension":
580
- return gt(e);
580
+ return Ft(e);
581
581
  case "DimensionalDateDimension":
582
- return ht(e);
582
+ return At(e);
583
583
  default:
584
584
  return e;
585
585
  }
586
- }, Ae = (e) => new cr(
586
+ }, Ee = (e) => new fr(
587
587
  e.name,
588
- D(e.attribute),
588
+ O(e.attribute),
589
589
  e.aggregation,
590
590
  e.format,
591
591
  e.description,
@@ -598,11 +598,11 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
598
598
  if (s && typeof s == "object" && "__serializable" in s)
599
599
  switch (s.__serializable) {
600
600
  case "DimensionalAttribute":
601
- return [r, we(s)];
601
+ return [r, Ae(s)];
602
602
  case "DimensionalLevelAttribute":
603
- return [r, qe(s)];
603
+ return [r, we(s)];
604
604
  case "DimensionalBaseMeasure":
605
- return [r, Ae(s)];
605
+ return [r, Ee(s)];
606
606
  case "DimensionalCalculatedMeasure":
607
607
  return [r, Ce(s)];
608
608
  default:
@@ -611,7 +611,7 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
611
611
  return [r, s];
612
612
  })
613
613
  );
614
- return new lr(
614
+ return new dr(
615
615
  e.name,
616
616
  e.expression,
617
617
  t,
@@ -621,9 +621,9 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
621
621
  e.dataSource,
622
622
  e.composeCode
623
623
  );
624
- }, bt = (e) => new fr(
624
+ }, wt = (e) => new mr(
625
625
  e.name,
626
- D(e.attribute),
626
+ O(e.attribute),
627
627
  e.format,
628
628
  e.description,
629
629
  z(e.sort),
@@ -632,46 +632,46 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
632
632
  ), ue = (e) => {
633
633
  switch (e.__serializable) {
634
634
  case "DimensionalBaseMeasure":
635
- return Ae(e);
635
+ return Ee(e);
636
636
  case "DimensionalCalculatedMeasure":
637
637
  return Ce(e);
638
638
  case "DimensionalMeasureTemplate":
639
- return bt(e);
639
+ return wt(e);
640
640
  default:
641
641
  return e;
642
642
  }
643
- }, C = (e) => {
643
+ }, T = (e) => {
644
644
  switch (e.__serializable) {
645
645
  case "MembersFilter":
646
- return new Cr(
647
- D(e.attribute),
646
+ return new qr(
647
+ O(e.attribute),
648
648
  e.members,
649
- e.config.backgroundFilter ? F(g({}, e.config), { backgroundFilter: C(e.config.backgroundFilter) }) : e.config,
649
+ e.config.backgroundFilter ? A(y({}, e.config), { backgroundFilter: T(e.config.backgroundFilter) }) : e.config,
650
650
  e.composeCode
651
651
  );
652
652
  case "LogicalAttributeFilter":
653
- return new Ar(
654
- e.filters.map((r) => C(r)),
653
+ return new Tr(
654
+ e.filters.map((r) => T(r)),
655
655
  e.operator,
656
656
  e.config,
657
657
  e.composeCode
658
658
  );
659
659
  case "CascadingFilter":
660
- return new qr(
661
- e._filters.map((r) => C(r)),
660
+ return new Cr(
661
+ e._filters.map((r) => T(r)),
662
662
  e.config,
663
663
  e.composeCode
664
664
  );
665
665
  case "ExcludeFilter":
666
- return new wr(
667
- C(e.filter),
668
- e.input ? C(e.input) : void 0,
666
+ return new Er(
667
+ T(e.filter),
668
+ e.input ? T(e.input) : void 0,
669
669
  e.config,
670
670
  e.composeCode
671
671
  );
672
672
  case "MeasureFilter":
673
- return new Fr(
674
- D(e.attribute),
673
+ return new wr(
674
+ O(e.attribute),
675
675
  ue(e.measure),
676
676
  e.operatorA,
677
677
  e.valueA,
@@ -681,8 +681,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
681
681
  e.composeCode
682
682
  );
683
683
  case "RankingFilter":
684
- return new br(
685
- D(e.attribute),
684
+ return new Ar(
685
+ O(e.attribute),
686
686
  ue(e.measure),
687
687
  e.operator,
688
688
  e.count,
@@ -690,7 +690,7 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
690
690
  e.composeCode
691
691
  );
692
692
  case "MeasureRankingFilter":
693
- return new hr(
693
+ return new Fr(
694
694
  ue(e.measure),
695
695
  e.operator,
696
696
  e.count,
@@ -698,8 +698,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
698
698
  e.composeCode
699
699
  );
700
700
  case "NumericFilter":
701
- return new gr(
702
- D(e.attribute),
701
+ return new br(
702
+ O(e.attribute),
703
703
  e.operatorA,
704
704
  e.valueA,
705
705
  e.operatorB,
@@ -708,8 +708,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
708
708
  e.composeCode
709
709
  );
710
710
  case "TextFilter":
711
- return new yr(
712
- D(e.attribute),
711
+ return new hr(
712
+ O(e.attribute),
713
713
  e.operatorA,
714
714
  e.valueA,
715
715
  e.config,
@@ -717,8 +717,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
717
717
  );
718
718
  case "DateRangeFilter": {
719
719
  const { valueA: r, valueB: s } = e;
720
- return new pr(
721
- D(e.attribute),
720
+ return new yr(
721
+ O(e.attribute),
722
722
  r,
723
723
  s,
724
724
  e.config,
@@ -726,8 +726,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
726
726
  );
727
727
  }
728
728
  case "RelativeDateFilter":
729
- return new mr(
730
- D(e.attribute),
729
+ return new gr(
730
+ O(e.attribute),
731
731
  e.offset,
732
732
  e.count,
733
733
  e.operator,
@@ -736,8 +736,8 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
736
736
  e.composeCode
737
737
  );
738
738
  case "CustomFilter":
739
- return new dr(
740
- D(e.attribute),
739
+ return new pr(
740
+ O(e.attribute),
741
741
  e.jaqlExpression,
742
742
  e.config,
743
743
  e.composeCode
@@ -746,211 +746,218 @@ const z = (e) => e === void 0 ? B.None : e, Fs = (e) => new Vt(e.metadataItem, e
746
746
  return e;
747
747
  }
748
748
  };
749
- y.registerCustom(
749
+ h.registerCustom(
750
750
  {
751
- isApplicable: jt,
751
+ isApplicable: Wt,
752
752
  serialize: (e) => e.serialize(),
753
- deserialize: (e) => Fs(e)
753
+ deserialize: (e) => Cs(e)
754
754
  },
755
755
  "JaqlElement"
756
756
  );
757
- y.registerCustom(
757
+ h.registerCustom(
758
758
  {
759
- isApplicable: Wt,
759
+ isApplicable: Gt,
760
760
  serialize: (e) => e.serialize(),
761
- deserialize: (e) => we(e)
761
+ deserialize: (e) => Ae(e)
762
762
  },
763
763
  "DimensionalAttribute"
764
764
  );
765
- y.registerCustom(
765
+ h.registerCustom(
766
766
  {
767
- isApplicable: Kt,
767
+ isApplicable: Yt,
768
768
  serialize: (e) => e.serialize(),
769
- deserialize: (e) => qe(e)
769
+ deserialize: (e) => we(e)
770
770
  },
771
771
  "DimensionalLevelAttribute"
772
772
  );
773
- y.registerCustom(
773
+ h.registerCustom(
774
774
  {
775
- isApplicable: zr,
775
+ isApplicable: Lr,
776
776
  serialize: (e) => e.serialize(),
777
- deserialize: (e) => gt(e)
777
+ deserialize: (e) => Ft(e)
778
778
  },
779
779
  "DimensionalDimension"
780
780
  );
781
- y.registerCustom(
781
+ h.registerCustom(
782
782
  {
783
- isApplicable: Pr,
783
+ isApplicable: Ur,
784
784
  serialize: (e) => e.serialize(),
785
- deserialize: (e) => ht(e)
785
+ deserialize: (e) => At(e)
786
786
  },
787
787
  "DimensionalDateDimension"
788
788
  );
789
- y.registerCustom(
789
+ h.registerCustom(
790
790
  {
791
791
  isApplicable: Jt,
792
792
  serialize: (e) => e.serialize(),
793
- deserialize: (e) => Ae(e)
793
+ deserialize: (e) => Ee(e)
794
794
  },
795
795
  "DimensionalBaseMeasure"
796
796
  );
797
- y.registerCustom(
797
+ h.registerCustom(
798
798
  {
799
- isApplicable: Yt,
799
+ isApplicable: Ht,
800
800
  serialize: (e) => e.serialize(),
801
801
  deserialize: (e) => Ce(e)
802
802
  },
803
803
  "DimensionalCalculatedMeasure"
804
804
  );
805
- y.registerCustom(
805
+ h.registerCustom(
806
806
  {
807
- isApplicable: Gt,
807
+ isApplicable: Qt,
808
808
  serialize: (e) => e.serialize(),
809
- deserialize: (e) => bt(e)
809
+ deserialize: (e) => wt(e)
810
810
  },
811
811
  "DimensionalMeasureTemplate"
812
812
  );
813
- y.registerCustom(
813
+ h.registerCustom(
814
814
  {
815
815
  isApplicable: be,
816
816
  serialize: (e) => e.serialize(),
817
- deserialize: (e) => C(e)
817
+ deserialize: (e) => T(e)
818
818
  },
819
819
  "MembersFilter"
820
820
  );
821
- y.registerCustom(
821
+ h.registerCustom(
822
822
  {
823
- isApplicable: Qt,
823
+ isApplicable: Xt,
824
824
  serialize: (e) => e.serialize(),
825
- deserialize: (e) => C(e)
825
+ deserialize: (e) => T(e)
826
826
  },
827
827
  "LogicalAttributeFilter"
828
828
  );
829
- y.registerCustom(
829
+ h.registerCustom(
830
830
  {
831
- isApplicable: Ht,
831
+ isApplicable: Zt,
832
832
  serialize: (e) => e.serialize(),
833
- deserialize: (e) => C(e)
833
+ deserialize: (e) => T(e)
834
834
  },
835
835
  "CascadingFilter"
836
836
  );
837
- y.registerCustom(
837
+ h.registerCustom(
838
838
  {
839
- isApplicable: Xt,
839
+ isApplicable: er,
840
840
  serialize: (e) => e.serialize(),
841
- deserialize: (e) => C(e)
841
+ deserialize: (e) => T(e)
842
842
  },
843
843
  "ExcludeFilter"
844
844
  );
845
- y.registerCustom(
845
+ h.registerCustom(
846
846
  {
847
- isApplicable: Zt,
847
+ isApplicable: tr,
848
848
  serialize: (e) => e.serialize(),
849
- deserialize: (e) => C(e)
849
+ deserialize: (e) => T(e)
850
850
  },
851
851
  "MeasureFilter"
852
852
  );
853
- y.registerCustom(
853
+ h.registerCustom(
854
854
  {
855
- isApplicable: er,
855
+ isApplicable: rr,
856
856
  serialize: (e) => e.serialize(),
857
- deserialize: (e) => C(e)
857
+ deserialize: (e) => T(e)
858
858
  },
859
859
  "RankingFilter"
860
860
  );
861
- y.registerCustom(
861
+ h.registerCustom(
862
862
  {
863
- isApplicable: tr,
863
+ isApplicable: sr,
864
864
  serialize: (e) => e.serialize(),
865
- deserialize: (e) => C(e)
865
+ deserialize: (e) => T(e)
866
866
  },
867
867
  "MeasureRankingFilter"
868
868
  );
869
- y.registerCustom(
869
+ h.registerCustom(
870
870
  {
871
- isApplicable: rr,
871
+ isApplicable: nr,
872
872
  serialize: (e) => e.serialize(),
873
- deserialize: (e) => C(e)
873
+ deserialize: (e) => T(e)
874
874
  },
875
875
  "NumericFilter"
876
876
  );
877
- y.registerCustom(
877
+ h.registerCustom(
878
878
  {
879
- isApplicable: sr,
879
+ isApplicable: ir,
880
880
  serialize: (e) => e.serialize(),
881
- deserialize: (e) => C(e)
881
+ deserialize: (e) => T(e)
882
882
  },
883
883
  "TextFilter"
884
884
  );
885
- y.registerCustom(
885
+ h.registerCustom(
886
886
  {
887
- isApplicable: nr,
887
+ isApplicable: ar,
888
888
  serialize: (e) => e.serialize(),
889
- deserialize: (e) => C(e)
889
+ deserialize: (e) => T(e)
890
890
  },
891
891
  "DateRangeFilter"
892
892
  );
893
- y.registerCustom(
893
+ h.registerCustom(
894
894
  {
895
- isApplicable: ir,
895
+ isApplicable: or,
896
896
  serialize: (e) => e.serialize(),
897
- deserialize: (e) => C(e)
897
+ deserialize: (e) => T(e)
898
898
  },
899
899
  "RelativeDateFilter"
900
900
  );
901
- y.registerCustom(
901
+ h.registerCustom(
902
902
  {
903
- isApplicable: or,
903
+ isApplicable: ur,
904
904
  serialize: (e) => e.serialize(),
905
- deserialize: (e) => C(e)
905
+ deserialize: (e) => T(e)
906
906
  },
907
907
  "CustomFilter"
908
908
  );
909
- const Kn = y, q = "DM.";
910
- function T(e) {
909
+ const Yn = h, E = "DM.";
910
+ function S(e) {
911
911
  return typeof e == "object" && e !== null;
912
912
  }
913
- function E(e) {
913
+ function q(e) {
914
914
  return typeof e == "object" && e !== null && "function" in e && "args" in e;
915
915
  }
916
- function Ft(e) {
917
- return e.every(E);
916
+ function Et(e) {
917
+ return e.every(q);
918
918
  }
919
919
  function ne(e) {
920
920
  return "attribute" in e && "config" in e;
921
921
  }
922
- function X(e) {
922
+ function Z(e) {
923
923
  return "left" in e && "right" in e && "operator" in e;
924
924
  }
925
- function Ee(e) {
926
- return !ne(e) && !X(e);
925
+ function Te(e) {
926
+ return !ne(e) && !Z(e);
927
927
  }
928
928
  function qs(e) {
929
- return T(e) && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
929
+ return S(e) && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
930
930
  }
931
- function As(e) {
932
- return !T(e) || !("column" in e) ? !1 : E(e.column);
931
+ function xs(e) {
932
+ return !S(e) || !("column" in e) ? !1 : q(e.column);
933
933
  }
934
934
  const x = 3;
935
- function M(e, t, r) {
935
+ function v(e, t, r) {
936
936
  if (t.length === 0) return;
937
937
  let s = Number.MAX_SAFE_INTEGER, n;
938
938
  for (const i of t) {
939
- const o = r(i), a = jr(e, o);
940
- a < s && (s = a, n = i);
939
+ const a = r(i), o = Gr(e, a);
940
+ o < s && (s = o, n = i);
941
941
  }
942
942
  return n !== void 0 ? { best: n, distance: s } : void 0;
943
943
  }
944
- function xe(e) {
945
- const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
944
+ const Ct = "en";
945
+ function le(e, t) {
946
+ return e.localeCompare(t, Ct, { sensitivity: "accent" }) === 0;
947
+ }
948
+ function Ve(e, t) {
949
+ return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Ct, { sensitivity: "accent" }) === 0;
950
+ }
951
+ function qe(e) {
952
+ const t = [...e].sort((i, a) => a.name.length - i.name.length), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
946
953
  for (const i of e) {
947
954
  r.set(i.name, i);
948
- const o = [...i.columns].sort((u, c) => c.name.length - u.name.length);
949
- n.set(i.name, o);
950
- const a = /* @__PURE__ */ new Map();
955
+ const a = [...i.columns].sort((u, l) => l.name.length - u.name.length);
956
+ n.set(i.name, a);
957
+ const o = /* @__PURE__ */ new Map();
951
958
  for (const u of i.columns)
952
- a.set(u.name, u);
953
- s.set(i.name, a);
959
+ o.set(u.name, u);
960
+ s.set(i.name, o);
954
961
  }
955
962
  return {
956
963
  sortedTables: t,
@@ -959,79 +966,79 @@ function xe(e) {
959
966
  columnMap: s
960
967
  };
961
968
  }
962
- function $e(e, t) {
963
- if (!e.startsWith(q))
969
+ function xe(e, t) {
970
+ if (!e.startsWith(E))
964
971
  throw new Error(
965
- `Invalid dimensional element name format: '${e}'. Expected format: '${q}TableName.ColumnName[.Level]'`
972
+ `Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
966
973
  );
967
- const r = e.slice(q.length);
974
+ const r = e.slice(E.length);
968
975
  if (!r)
969
976
  throw new Error(
970
- `Invalid dimensional element name format: '${e}'. Expected format: '${q}TableName.ColumnName[.Level]'`
977
+ `Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
971
978
  );
972
979
  let s, n;
973
- for (const d of t.sortedTables)
974
- if (r.startsWith(d.name + ".")) {
975
- const b = r.slice(d.name.length + 1);
976
- if (!b)
980
+ for (const m of t.sortedTables)
981
+ if (Ve(r, m.name + ".")) {
982
+ const F = r.slice(m.name.length + 1);
983
+ if (!F)
977
984
  throw new Error(
978
- `Invalid dimensional element name format: '${e}'. Expected format: '${q}TableName.ColumnName[.Level]'`
985
+ `Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
979
986
  );
980
- s = d, n = b;
987
+ s = m, n = F;
981
988
  break;
982
989
  }
983
990
  if (!s) {
984
- const d = r.indexOf(".");
985
- if (d === -1)
991
+ const m = r.indexOf(".");
992
+ if (m === -1)
986
993
  throw new Error(
987
- `Invalid dimensional element name format: '${e}'. Expected format: '${q}TableName.ColumnName[.Level]'`
994
+ `Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
988
995
  );
989
- const b = r.slice(0, d), A = M(b, t.sortedTables, (oe) => oe.name), O = A && A.distance <= x ? ` Did you mean '${A.best.name}'?` : "";
990
- throw new Error(`Table '${b}' not found in the data model.${O}`);
996
+ const F = r.slice(0, m), C = v(F, t.sortedTables, (ae) => ae.name), N = C && C.distance <= x ? ` Did you mean '${C.best.name}'?` : "";
997
+ throw new Error(`Table '${F}' not found in the data model.${N}`);
991
998
  }
992
999
  const i = t.tableColumnMap.get(s.name);
993
1000
  if (!i)
994
1001
  throw new Error(`Table '${s.name}' found but has no columns`);
995
- let o, a;
1002
+ let a, o;
996
1003
  const u = $.all;
997
- for (const d of i) {
998
- if (n === d.name)
999
- return { table: s, column: d };
1000
- if (!n.startsWith(d.name + "."))
1004
+ for (const m of i) {
1005
+ if (le(n, m.name))
1006
+ return { table: s, column: m };
1007
+ if (!Ve(n, m.name + "."))
1001
1008
  continue;
1002
- const b = n.slice(d.name.length + 1);
1003
- if (!b)
1009
+ const F = n.slice(m.name.length + 1);
1010
+ if (!F)
1004
1011
  continue;
1005
- const A = u.includes(b), O = H(d.dataType);
1006
- if (A) {
1007
- if (O)
1008
- return { table: s, column: d, level: b };
1009
- o || (o = d, a = b);
1012
+ const C = u.includes(F), N = X(m.dataType);
1013
+ if (C) {
1014
+ if (N)
1015
+ return { table: s, column: m, level: F };
1016
+ a || (a = m, o = F);
1010
1017
  continue;
1011
1018
  }
1012
- O && !o && (o = d, a = b);
1019
+ N && !a && (a = m, o = F);
1013
1020
  }
1014
- if (o && a) {
1015
- if (u.includes(a))
1021
+ if (a && o) {
1022
+ if (u.includes(o))
1016
1023
  throw new Error(
1017
- `Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`
1024
+ `Invalid date level '${o}' in dimensional element '${e}'. Column '${s.name}.${a.name}' is not a datetime column`
1018
1025
  );
1019
- const d = M(a, u, (A) => A), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
1026
+ const m = v(o, u, (C) => C), F = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
1020
1027
  throw new Error(
1021
- `Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(
1028
+ `Invalid date level '${o}' in dimensional element '${e}'. Valid levels are: ${u.join(
1022
1029
  ", "
1023
- )}.${b}`
1030
+ )}.${F}`
1024
1031
  );
1025
1032
  }
1026
- const c = n.indexOf("."), m = c === -1 ? n : n.slice(0, c), l = M(n, i, (d) => d.name), f = l && l.distance <= x && l.best.name !== m, h = f ? ` Did you mean '${l.best.name}'?` : "", p = !f && n.endsWith(".") && (l == null ? void 0 : l.best.name) === m ? ` Use '${m}' without a trailing dot.` : "";
1033
+ const l = n.indexOf("."), p = l === -1 ? n : n.slice(0, l), c = v(n, i, (m) => m.name), d = c && c.distance <= x && !le(c.best.name, p), b = d ? ` Did you mean '${c.best.name}'?` : "", g = !d && n.endsWith(".") && c !== void 0 && le(c.best.name, p) ? ` Use '${p}' without a trailing dot.` : "";
1027
1034
  throw new Error(
1028
- `Column '${m}' not found in table '${s.name}'.${h}${p}`
1035
+ `Column '${p}' not found in table '${s.name}'.${b}${g}`
1029
1036
  );
1030
1037
  }
1031
- function Cs(e, t) {
1032
- const { table: r, column: s, level: n } = $e(e, t);
1038
+ function $s(e, t) {
1039
+ const { table: r, column: s, level: n } = xe(e, t);
1033
1040
  if (n) {
1034
- if (!H(s.dataType))
1041
+ if (!X(s.dataType))
1035
1042
  throw new Error(
1036
1043
  `Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`
1037
1044
  );
@@ -1042,87 +1049,87 @@ function Cs(e, t) {
1042
1049
  ", "
1043
1050
  )}`
1044
1051
  );
1045
- const o = $.dateOnly;
1046
- if (s.dataType === "date" && !o.includes(n))
1052
+ const a = $.dateOnly;
1053
+ if (s.dataType === "date" && !a.includes(n))
1047
1054
  throw new Error(
1048
1055
  `Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`
1049
1056
  );
1050
- const a = $.timeOnly;
1051
- if (s.dataType === "time" && !a.includes(n))
1057
+ const o = $.timeOnly;
1058
+ if (s.dataType === "time" && !o.includes(n))
1052
1059
  throw new Error(
1053
1060
  `Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`
1054
1061
  );
1055
1062
  }
1056
1063
  return { table: r, column: s, level: n };
1057
1064
  }
1058
- function G(e, t, r, s) {
1059
- const { table: n, column: i, level: o } = Cs(e, r);
1060
- let a = o;
1061
- if (H(i.dataType) && a === void 0 && (s != null && s.inferredDateLevel)) {
1062
- const u = s.inferredDateLevel, c = $.all;
1063
- if (!c.includes(u))
1065
+ function H(e, t, r, s) {
1066
+ const { table: n, column: i, level: a } = $s(e, r);
1067
+ let o = a;
1068
+ if (X(i.dataType) && o === void 0 && (s != null && s.inferredDateLevel)) {
1069
+ const u = s.inferredDateLevel, l = $.all;
1070
+ if (!l.includes(u))
1064
1071
  throw new Error(
1065
- `Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`
1072
+ `Invalid inferred date level '${u}'. Valid levels are: ${l.join(", ")}`
1066
1073
  );
1067
- const m = `${e}.${u}`, l = $.dateOnly;
1068
- if (i.dataType === "date" && !l.includes(u))
1074
+ const p = `${e}.${u}`, c = $.dateOnly;
1075
+ if (i.dataType === "date" && !c.includes(u))
1069
1076
  throw new Error(
1070
- `Invalid level '${u}' in dimensional element '${m}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`
1077
+ `Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`
1071
1078
  );
1072
- const f = $.timeOnly;
1073
- if (i.dataType === "time" && !f.includes(u))
1079
+ const d = $.timeOnly;
1080
+ if (i.dataType === "time" && !d.includes(u))
1074
1081
  throw new Error(
1075
- `Invalid level '${u}' in dimensional element '${m}'. Column '${n.name}.${i.name}' is only a time column, not a date column`
1082
+ `Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a time column, not a date column`
1076
1083
  );
1077
- a = u;
1084
+ o = u;
1078
1085
  }
1079
- return Er({
1086
+ return xr({
1080
1087
  expression: i.expression,
1081
1088
  dataType: i.dataType,
1082
- granularity: a,
1089
+ granularity: o,
1083
1090
  format: void 0,
1084
1091
  sort: void 0,
1085
1092
  dataSource: t
1086
1093
  });
1087
1094
  }
1088
- function Es(e, t, r) {
1089
- const { column: s, level: n } = $e(e, r);
1095
+ function Ss(e, t, r) {
1096
+ const { column: s, level: n } = xe(e, r);
1090
1097
  if (n)
1091
1098
  throw new Error(
1092
- `Invalid DateDimension name format: '${e}'. Expected format: '${q}TableName.ColumnName'`
1099
+ `Invalid DateDimension name format: '${e}'. Expected format: '${E}TableName.ColumnName'`
1093
1100
  );
1094
- if (!H(s.dataType))
1101
+ if (!X(s.dataType))
1095
1102
  throw new Error(
1096
1103
  `Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`
1097
1104
  );
1098
- return Ur({
1105
+ return jr({
1099
1106
  name: s.name,
1100
1107
  expression: s.expression,
1101
1108
  dataSource: t
1102
1109
  });
1103
1110
  }
1104
- const xs = (e, t) => {
1111
+ const Os = (e, t) => {
1105
1112
  if (!e) return;
1106
1113
  const r = typeof e == "object" ? e.direction : e;
1107
- if (!te(r))
1108
- return F(g({}, t), {
1114
+ if (!et(r))
1115
+ return A(y({}, t), {
1109
1116
  message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
1110
1117
  });
1111
- }, $s = (e, t, r, s) => {
1112
- const n = xs(e.sortType, s);
1118
+ }, Ds = (e, t, r, s) => {
1119
+ const n = Os(e.sortType, s);
1113
1120
  if (n)
1114
1121
  return {
1115
- attribute: G(e.column, t, r),
1122
+ attribute: H(e.column, t, r),
1116
1123
  style: {},
1117
1124
  error: n
1118
1125
  };
1119
- const i = G(e.column, t, r), o = _(e, "column");
1120
- return { attribute: i, style: o };
1121
- }, Ts = (e, t, r, s) => typeof e == "string" ? { attribute: G(e, t, r) } : qs(e) ? $s(e, t, r, s) : {
1122
- error: F(g({}, s), {
1126
+ const i = H(e.column, t, r), a = _(e, "column");
1127
+ return { attribute: i, style: a };
1128
+ }, Ms = (e, t, r, s) => typeof e == "string" ? { attribute: H(e, t, r) } : qs(e) ? Ds(e, t, r, s) : {
1129
+ error: A(y({}, s), {
1123
1130
  message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
1124
1131
  })
1125
- }, wt = (e) => {
1132
+ }, Tt = (e) => {
1126
1133
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
1127
1134
  if (!t)
1128
1135
  return { success: !0, data: [] };
@@ -1139,122 +1146,211 @@ const xs = (e, t) => {
1139
1146
  ]
1140
1147
  };
1141
1148
  const n = [], i = [];
1142
- return t.forEach((o, a) => {
1149
+ return t.forEach((a, o) => {
1143
1150
  const u = {
1144
1151
  category: "dimensions",
1145
- index: a,
1146
- input: o
1152
+ index: o,
1153
+ input: a
1147
1154
  };
1148
1155
  try {
1149
- const c = Ts(o, r, s, u);
1150
- if (c.error) {
1151
- i.push(c.error);
1156
+ const l = Ms(a, r, s, u);
1157
+ if (l.error) {
1158
+ i.push(l.error);
1152
1159
  return;
1153
1160
  }
1154
- c.attribute && n.push(
1155
- c.style !== void 0 ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute }
1161
+ l.attribute && n.push(
1162
+ l.style !== void 0 ? { attribute: l.attribute, style: l.style } : { attribute: l.attribute }
1156
1163
  );
1157
- } catch (c) {
1158
- const m = c instanceof Error ? c.message : "Unknown error";
1159
- i.push(F(g({}, u), { message: m }));
1164
+ } catch (l) {
1165
+ const p = l instanceof Error ? l.message : "Unknown error";
1166
+ i.push(A(y({}, u), { message: p }));
1160
1167
  }
1161
1168
  }), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
1162
1169
  };
1163
- function Te(e, t) {
1170
+ function $e(e, t) {
1164
1171
  const r = Reflect.get(e, t);
1165
1172
  if (typeof r != "function")
1166
1173
  throw new Error(`Function '${t}' not found or is not a function`);
1167
1174
  return r;
1168
1175
  }
1169
- function Ds(e, t) {
1170
- const r = e.replace("measureFactory.", ""), n = Te(xr, r)(...t);
1171
- if (!Ee(n))
1176
+ function Ns(e, t) {
1177
+ const r = e.replace("measureFactory.", ""), n = $e($r, r)(...t);
1178
+ if (!Te(n))
1172
1179
  throw new Error(`Function '${e}' did not return a valid Measure`);
1173
1180
  return n;
1174
1181
  }
1175
- function Ss(e, t) {
1176
- const r = e.replace("filterFactory.logic.", ""), n = Te($r, r)(...t);
1177
- if (!X(n))
1182
+ function vs(e, t) {
1183
+ const r = e.replace("filterFactory.logic.", ""), n = $e(Sr, r)(...t);
1184
+ if (!Z(n))
1178
1185
  throw new Error(`Function '${e}' did not return a valid FilterRelations`);
1179
1186
  return n;
1180
1187
  }
1181
- function Os(e, t) {
1188
+ function Rs(e, t) {
1182
1189
  if (e.startsWith("filterFactory.logic."))
1183
- return Ss(e, t);
1184
- const r = e.replace("filterFactory.", ""), n = Te(Tr, r)(...t);
1185
- if (!ne(n) && !X(n))
1190
+ return vs(e, t);
1191
+ const r = e.replace("filterFactory.", ""), n = $e(Or, r)(...t);
1192
+ if (!ne(n) && !Z(n))
1186
1193
  throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
1187
1194
  return n;
1188
1195
  }
1189
- function Ms(e, t) {
1196
+ function Is(e, t) {
1190
1197
  const s = e.split(".")[0];
1191
1198
  if (s === "measureFactory")
1192
- return Ds(e, t);
1199
+ return Ns(e, t);
1193
1200
  if (s === "filterFactory")
1194
- return Os(e, t);
1201
+ return Rs(e, t);
1195
1202
  throw new Error(
1196
1203
  `Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`
1197
1204
  );
1198
1205
  }
1199
- const ye = {
1200
- SDIFF: {
1201
- category: "time-diff",
1202
- argCount: 2,
1206
+ const f = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s), Ps = /* @__PURE__ */ new Set([
1207
+ "CORREL",
1208
+ "COVARP",
1209
+ "COVAR",
1210
+ "EXPONDIST",
1211
+ "INTERCEPT",
1212
+ "LARGEST",
1213
+ "NORMDIST",
1214
+ "POISSONDIST",
1215
+ "SKEWP",
1216
+ "SKEW",
1217
+ "SLOPE",
1218
+ "TDIST",
1219
+ "COSH",
1220
+ "SINH",
1221
+ "TANH",
1222
+ "ORDERING",
1223
+ "RDOUBLE",
1224
+ "RINT"
1225
+ ]), te = {
1226
+ // ── X-diff (datetime difference operators) ──
1227
+ SDIFF: f("xdiff", 2, 2, {
1203
1228
  requiredDateLevel: $.Seconds,
1204
1229
  argType: "datetime"
1205
- },
1206
- MNDIFF: {
1207
- category: "time-diff",
1208
- argCount: 2,
1230
+ }),
1231
+ MNDIFF: f("xdiff", 2, 2, {
1209
1232
  requiredDateLevel: $.Minutes,
1210
1233
  argType: "datetime"
1211
- },
1212
- HDIFF: {
1213
- category: "time-diff",
1214
- argCount: 2,
1234
+ }),
1235
+ HDIFF: f("xdiff", 2, 2, {
1215
1236
  requiredDateLevel: $.Hours,
1216
1237
  argType: "datetime"
1217
- },
1218
- DDIFF: {
1219
- category: "time-diff",
1220
- argCount: 2,
1238
+ }),
1239
+ DDIFF: f("xdiff", 2, 2, {
1221
1240
  requiredDateLevel: $.Days,
1222
1241
  argType: "datetime"
1223
- },
1224
- MDIFF: {
1225
- category: "time-diff",
1226
- argCount: 2,
1242
+ }),
1243
+ MDIFF: f("xdiff", 2, 2, {
1227
1244
  requiredDateLevel: $.Months,
1228
1245
  argType: "datetime"
1229
- },
1230
- QDIFF: {
1231
- category: "time-diff",
1232
- argCount: 2,
1246
+ }),
1247
+ QDIFF: f("xdiff", 2, 2, {
1233
1248
  requiredDateLevel: $.Quarters,
1234
1249
  argType: "datetime"
1235
- },
1236
- YDIFF: {
1237
- category: "time-diff",
1238
- argCount: 2,
1250
+ }),
1251
+ YDIFF: f("xdiff", 2, 2, {
1239
1252
  requiredDateLevel: $.Years,
1240
1253
  argType: "datetime"
1241
- }
1242
- }, vs = Object.keys(ye).filter(
1243
- (e) => ye[e].category === "time-diff"
1254
+ }),
1255
+ // ── Aggregation ──
1256
+ ANYVALUE: f("aggregative", 1, 1),
1257
+ SUM: f("aggregative", 1, 2),
1258
+ AVG: f("aggregative", 1, 2),
1259
+ MIN: f("aggregative", 1, 2),
1260
+ MAX: f("aggregative", 1, 2),
1261
+ COUNT: f("aggregative", 1, 2),
1262
+ DUPCOUNT: f("aggregative", 1, 1),
1263
+ COUNTDUPLICATES: f("aggregative", 1, 1),
1264
+ STDEV: f("aggregative", 1, 2),
1265
+ STDEVP: f("aggregative", 1, 2),
1266
+ VAR: f("aggregative", 1, 2),
1267
+ VARP: f("aggregative", 1, 2),
1268
+ MEDIAN: f("aggregative", 1, 2),
1269
+ QUARTILE: f("aggregative", 2, 3),
1270
+ PERCENTILE: f("aggregative", 2, 3),
1271
+ LOWERWHISKERMAX_IQR: f("aggregative", 1, 1),
1272
+ LOWERWHISKERMAX_STDEVP: f("aggregative", 1, 1),
1273
+ UPPERWHISKERMIN_IQR: f("aggregative", 1, 1),
1274
+ UPPERWHISKERMIN_STDEVP: f("aggregative", 1, 1),
1275
+ OUTLIERSCOUNT_IQR: f("aggregative", 1, 1),
1276
+ OUTLIERSCOUNT_STDEVP: f("aggregative", 1, 1),
1277
+ MODE: f("aggregative", 1, 1),
1278
+ NOAGGFUNCTION: f("aggregative", 1, 1),
1279
+ // ── Window ──
1280
+ RANK: f("window", 0, Number.POSITIVE_INFINITY),
1281
+ RSUM: f("window", 1, 2),
1282
+ RAVG: f("window", 1, 2),
1283
+ YTDSUM: f("window", 1, 1),
1284
+ QTDSUM: f("window", 1, 1),
1285
+ MTDSUM: f("window", 1, 1),
1286
+ WTDSUM: f("window", 1, 1),
1287
+ YTDAVG: f("window", 1, 1),
1288
+ QTDAVG: f("window", 1, 1),
1289
+ MTDAVG: f("window", 1, 1),
1290
+ WTDAVG: f("window", 1, 1),
1291
+ // ── String ──
1292
+ CONCAT: f("string", 2, Number.POSITIVE_INFINITY),
1293
+ LEFT: f("string", 2, 2),
1294
+ RIGHT: f("string", 2, 2),
1295
+ // ── Scalar / math ──
1296
+ ABS: f("scalar", 1, 1),
1297
+ ACOS: f("scalar", 1, 1),
1298
+ ASIN: f("scalar", 1, 1),
1299
+ ATAN: f("scalar", 1, 1),
1300
+ CEILING: f("scalar", 1, 1),
1301
+ CONTRIBUTION: f("scalar", 1, 1),
1302
+ COS: f("scalar", 1, 1),
1303
+ COT: f("scalar", 1, 1),
1304
+ DIFFPASTDAY: f("scalar", 1, 1),
1305
+ DIFFPASTMONTH: f("scalar", 1, 1),
1306
+ DIFFPASTPERIOD: f("scalar", 1, 1),
1307
+ DIFFPASTQUARTER: f("scalar", 1, 1),
1308
+ DIFFPASTWEEK: f("scalar", 1, 1),
1309
+ DIFFPASTYEAR: f("scalar", 1, 1),
1310
+ EXP: f("scalar", 1, 1),
1311
+ FLOOR: f("scalar", 1, 1),
1312
+ GROWTH: f("growth", 1, 1),
1313
+ GROWTHPASTMONTH: f("growth", 1, 1),
1314
+ GROWTHPASTQUARTER: f("growth", 1, 1),
1315
+ GROWTHPASTWEEK: f("growth", 1, 1),
1316
+ GROWTHPASTYEAR: f("growth", 1, 1),
1317
+ GROWTHRATE: f("growth", 1, 1),
1318
+ LN: f("scalar", 1, 1),
1319
+ LOG10: f("scalar", 1, 1),
1320
+ MINUS: f("scalar", 1, 1),
1321
+ MOD: f("scalar", 2, 2),
1322
+ QUOTIENT: f("scalar", 2, 2),
1323
+ PASTDAY: f("date", 1, 2),
1324
+ PASTMONTH: f("date", 1, 2),
1325
+ PASTPERIOD: f("date", 1, 2),
1326
+ PASTQUARTER: f("date", 1, 2),
1327
+ PASTWEEK: f("date", 1, 2),
1328
+ PASTYEAR: f("date", 1, 2),
1329
+ PERCENTILEDISCFORINTERNALUSEONLY: f("scalar", 1, 1),
1330
+ PERCENTILECONTFORINTERNALUSEONLY: f("scalar", 1, 1),
1331
+ POWER: f("scalar", 2, 2),
1332
+ ROUND: f("scalar", 2, 2),
1333
+ SIN: f("scalar", 1, 1),
1334
+ SQRT: f("scalar", 1, 1),
1335
+ TAN: f("scalar", 1, 1)
1336
+ }, ks = Object.keys(te).filter(
1337
+ (e) => te[e].category === "xdiff"
1244
1338
  );
1245
1339
  function qt() {
1246
- return vs;
1340
+ return ks;
1247
1341
  }
1248
- function At(e) {
1249
- const t = ye[e.toUpperCase()];
1342
+ function xt(e) {
1343
+ const t = te[e.toUpperCase()];
1250
1344
  return t == null ? void 0 : t.requiredDateLevel;
1251
1345
  }
1252
- const Ns = /\[(\w[\w.-]*)\]/g, Ct = /* @__PURE__ */ new Set([
1346
+ function Bs(e, t) {
1347
+ return e === t ? e === 1 ? "1 parameter" : `${e} parameters` : t === Number.POSITIVE_INFINITY ? e <= 1 ? "any number of parameters" : `at least ${e} parameters` : `${e} or ${t} parameters`;
1348
+ }
1349
+ const zs = /\[(\w[\w.-]*)\]/g, $t = /* @__PURE__ */ new Set([
1253
1350
  // Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
1254
1351
  "AVG",
1255
1352
  "COUNT",
1256
1353
  "DUPCOUNT",
1257
- "LARGEST",
1258
1354
  "MAX",
1259
1355
  "MEDIAN",
1260
1356
  "MIN",
@@ -1268,39 +1364,33 @@ const Ns = /\[(\w[\w.-]*)\]/g, Ct = /* @__PURE__ */ new Set([
1268
1364
  "QTDAVG",
1269
1365
  "QTDSUM",
1270
1366
  "YTDAVG",
1271
- "YTDSUM",
1367
+ "YTDSUM"
1272
1368
  // RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
1273
- // Elasticube Aggregative
1274
- "CORREL",
1275
- "COVARP",
1276
- "COVAR",
1277
- "SKEWP",
1278
- "SKEW",
1279
- "SLOPE"
1280
- ]), Rs = new RegExp(
1281
- `\\b(${Array.from(Ct).join("|")})\\s*\\(`,
1369
+ // CORREL, COVAR*, SKEW*, SLOPE, LARGEST are unsupported in custom formulas (see UNSUPPORTED_FORMULA_FUNCTIONS).
1370
+ ]), Ls = new RegExp(
1371
+ `\\b(${Array.from($t).join("|")})\\s*\\(`,
1282
1372
  "i"
1283
1373
  );
1284
- function Et(e) {
1285
- return E(e) ? !0 : typeof e == "string" && e.startsWith(q) ? !1 : T(e) && "kind" in e ? e.kind === "measure" : !0;
1374
+ function St(e) {
1375
+ return q(e) ? !0 : typeof e == "string" && e.startsWith(E) ? !1 : S(e) && "kind" in e ? e.kind === "measure" : !0;
1286
1376
  }
1287
- function Is(e) {
1377
+ function Us(e) {
1288
1378
  const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set();
1289
1379
  let s;
1290
1380
  for (; (s = t.exec(e)) !== null; ) {
1291
1381
  const n = s[1];
1292
- Ct.has(n.toUpperCase()) || r.add(n);
1382
+ $t.has(n.toUpperCase()) || r.add(n);
1293
1383
  }
1294
1384
  return Array.from(r);
1295
1385
  }
1296
- function ks(e) {
1386
+ function _s(e) {
1297
1387
  return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
1298
1388
  }
1299
- function Bs(e) {
1389
+ function Vs(e) {
1300
1390
  return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
1301
1391
  }
1302
- const j = (e) => e.startsWith("[") ? e : `[${e}]`, xt = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
1303
- function $t(e, t) {
1392
+ const j = (e) => e.startsWith("[") ? e : `[${e}]`, Ot = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
1393
+ function Dt(e, t) {
1304
1394
  if (t.length === 0) return [];
1305
1395
  const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(
1306
1396
  `\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`,
@@ -1312,125 +1402,195 @@ function $t(e, t) {
1312
1402
  ref2: n[3].trim()
1313
1403
  }));
1314
1404
  }
1315
- function zs(e, t, r) {
1316
- var o, a, u;
1317
- const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
1405
+ function js(e, t, r) {
1406
+ var a, o, u;
1407
+ const s = Object.keys(t), n = ((a = r.errorPrefix) != null ? a : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
1318
1408
  return {
1319
1409
  formula: e,
1320
1410
  context: t,
1321
1411
  contextKeys: s,
1322
1412
  canonicalContextKeys: new Set(s.map(j)),
1323
1413
  errorPrefix: i,
1324
- warnUnusedContext: (a = r.warnUnusedContext) != null ? a : !0,
1414
+ warnUnusedContext: (o = r.warnUnusedContext) != null ? o : !0,
1325
1415
  errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : !0,
1326
1416
  schemaIndex: r.schemaIndex,
1327
1417
  result: { isValid: !0, errors: [], warnings: [], references: [], unusedContextKeys: [] }
1328
1418
  };
1329
1419
  }
1330
- function N(e, t) {
1420
+ function M(e, t) {
1331
1421
  e.result.errors.push(t), e.result.isValid = !1;
1332
1422
  }
1333
- const Ps = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
1334
- function Ls(e) {
1423
+ const Ws = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
1424
+ function Ks(e) {
1335
1425
  const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find(
1336
- (s) => !Ps.has(s[1].toUpperCase())
1426
+ (s) => !Ws.has(s[1].toUpperCase())
1337
1427
  );
1338
- r && N(
1428
+ r && M(
1339
1429
  e,
1340
1430
  `${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`
1341
1431
  );
1342
1432
  }
1343
- function _s(e) {
1433
+ function Gs(e, t) {
1434
+ const r = e[t];
1435
+ let s = t + 1;
1436
+ for (; s < e.length; ) {
1437
+ const n = e[s], i = e[s + 1];
1438
+ if (n !== r) {
1439
+ s++;
1440
+ continue;
1441
+ }
1442
+ if (i === r) {
1443
+ s += 2;
1444
+ continue;
1445
+ }
1446
+ return s + 1;
1447
+ }
1448
+ return e.length;
1449
+ }
1450
+ function Ys(e) {
1451
+ return Wr(e, ",").filter((t) => t.trim().length > 0).length;
1452
+ }
1453
+ function Js(e, t, r, s) {
1454
+ for (; t < e.length && /\s/.test(e[t]); )
1455
+ t++;
1456
+ if (e[t] !== "(")
1457
+ return t;
1458
+ const n = t, i = Kr(e, n);
1459
+ if (i === -1)
1460
+ return n + 1;
1461
+ const a = e.slice(n + 1, i);
1462
+ return s.push({ name: r.toUpperCase(), argCount: Ys(a) }), s.push(...Mt(a)), i + 1;
1463
+ }
1464
+ function Mt(e) {
1465
+ const t = [];
1466
+ let r = 0;
1467
+ for (; r < e.length; ) {
1468
+ const s = e[r];
1469
+ if (s === "'" || s === '"') {
1470
+ r = Gs(e, r);
1471
+ continue;
1472
+ }
1473
+ if (/[A-Za-z_]/.test(s)) {
1474
+ const n = r;
1475
+ for (r++; r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
1476
+ r++;
1477
+ const i = e.slice(n, r);
1478
+ r = Js(e, r, i, t);
1479
+ continue;
1480
+ }
1481
+ r++;
1482
+ }
1483
+ return t;
1484
+ }
1485
+ function Hs(e) {
1486
+ const t = Mt(e.formula), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
1487
+ for (const { name: n, argCount: i } of t) {
1488
+ if (Ps.has(n)) {
1489
+ r.has(n) || (r.add(n), M(
1490
+ e,
1491
+ `${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`
1492
+ ));
1493
+ continue;
1494
+ }
1495
+ const a = te[n];
1496
+ if (a && (i < a.minArgs || i > a.maxArgs) && !s.has(n)) {
1497
+ s.add(n);
1498
+ const o = Bs(a.minArgs, a.maxArgs);
1499
+ M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${o}`);
1500
+ }
1501
+ }
1502
+ }
1503
+ function Qs(e) {
1344
1504
  return [
1345
1505
  ...new Set(
1346
- [...e.matchAll(new RegExp(Ns.source, "g"))].map((t) => t[1])
1506
+ [...e.matchAll(new RegExp(zs.source, "g"))].map((t) => t[1])
1347
1507
  )
1348
1508
  ];
1349
1509
  }
1350
- function Us(e) {
1510
+ function Xs(e) {
1351
1511
  const t = e.result.references.filter(
1352
1512
  (n) => !e.canonicalContextKeys.has(j(n))
1353
1513
  );
1354
1514
  if (t.length === 0) return;
1355
- const r = e.contextKeys.map((n) => `[${xt(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
1356
- N(
1515
+ const r = e.contextKeys.map((n) => `[${Ot(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
1516
+ M(
1357
1517
  e,
1358
1518
  `${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`
1359
1519
  );
1360
1520
  }
1361
- function js(e) {
1362
- if (Rs.test(e.formula)) return;
1521
+ function Zs(e) {
1522
+ if (Ls.test(e.formula)) return;
1363
1523
  const t = e.result.references.filter((r) => {
1364
1524
  var n;
1365
1525
  const s = (n = e.context[j(r)]) != null ? n : e.context[r];
1366
- return s !== void 0 && !Et(s);
1526
+ return s !== void 0 && !St(s);
1367
1527
  });
1368
- t.length !== 0 && N(
1528
+ t.length !== 0 && M(
1369
1529
  e,
1370
- `${e.errorPrefix}args[1]: ${Bs(
1371
- Is(e.formula)
1372
- )}Bracket reference(s) ${ks(
1530
+ `${e.errorPrefix}args[1]: ${Vs(
1531
+ Us(e.formula)
1532
+ )}Bracket reference(s) ${_s(
1373
1533
  t
1374
1534
  )} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
1375
1535
  );
1376
1536
  }
1377
- function Vs(e) {
1537
+ function en(e) {
1378
1538
  if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0) return;
1379
1539
  const t = new Set(e.result.references.map(j)), r = e.contextKeys.filter((i) => !t.has(j(i)));
1380
1540
  if (e.result.unusedContextKeys = r, r.length === 0) return;
1381
- const s = r.map((i) => `[${xt(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
1382
- e.errorOnUnusedContext ? N(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
1541
+ const s = r.map((i) => `[${Ot(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
1542
+ e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
1383
1543
  }
1384
- function We(e, t, r, s) {
1385
- var o;
1386
- const n = (o = s.context[j(e)]) != null ? o : s.context[e];
1544
+ function je(e, t, r, s) {
1545
+ var a;
1546
+ const n = (a = s.context[j(e)]) != null ? a : s.context[e];
1387
1547
  if (n === void 0) return;
1388
- if (!(typeof n == "string" && n.startsWith(q))) {
1389
- Et(n) && N(
1548
+ if (!(typeof n == "string" && n.startsWith(E))) {
1549
+ St(n) && M(
1390
1550
  s,
1391
- `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${q}Table.Column.Level).`
1551
+ `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E}Table.Column.Level).`
1392
1552
  );
1393
1553
  return;
1394
1554
  }
1395
1555
  if (s.schemaIndex)
1396
1556
  try {
1397
- const a = $e(n, s.schemaIndex);
1398
- H(a.column.dataType) ? r && a.level && a.level !== r && N(
1557
+ const o = xe(n, s.schemaIndex);
1558
+ X(o.column.dataType) ? r && o.level && o.level !== r && M(
1399
1559
  s,
1400
- `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`
1401
- ) : N(
1560
+ `${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${o.level}'.`
1561
+ ) : M(
1402
1562
  s,
1403
- `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`
1563
+ `${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${o.column.name}'.`
1404
1564
  );
1405
- } catch (a) {
1406
- const u = a instanceof Error ? a.message : "Unknown error";
1407
- N(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
1565
+ } catch (o) {
1566
+ const u = o instanceof Error ? o.message : "Unknown error";
1567
+ M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
1408
1568
  }
1409
1569
  }
1410
- function Ws(e) {
1411
- const t = qt(), r = $t(e.formula, t);
1570
+ function tn(e) {
1571
+ const t = qt(), r = Dt(e.formula, t);
1412
1572
  for (const s of r) {
1413
- const n = At(s.functionName);
1414
- We(s.ref1, s, n, e), We(s.ref2, s, n, e);
1573
+ const n = xt(s.functionName);
1574
+ je(s.ref1, s, n, e), je(s.ref2, s, n, e);
1415
1575
  }
1416
1576
  }
1417
- function Ks(e, t, r = {}) {
1577
+ function rn(e, t, r = {}) {
1418
1578
  var n;
1419
- const s = zs(e, t, r);
1420
- return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || N(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Ls(s), s.result.references = _s(e), s.result.references.length === 0 ? (s.result.warnings.push(
1579
+ const s = js(e, t, r);
1580
+ return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Ks(s), Hs(s), s.result.references = Qs(e), s.result.references.length === 0 ? (s.result.warnings.push(
1421
1581
  `${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`
1422
- ), s.result) : s.contextKeys.length === 0 ? (N(
1582
+ ), s.result) : s.contextKeys.length === 0 ? (M(
1423
1583
  s,
1424
1584
  `${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`
1425
- ), s.result) : (Us(s), js(s), Vs(s), Ws(s), s.result));
1585
+ ), s.result) : (Xs(s), Zs(s), en(s), tn(s), s.result));
1426
1586
  }
1427
- function Js(e, t, r = {}) {
1428
- const s = Ks(e, t, r);
1587
+ function sn(e, t, r = {}) {
1588
+ const s = rn(e, t, r);
1429
1589
  if (!s.isValid)
1430
1590
  throw new Error(s.errors.join("; "));
1431
1591
  s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
1432
1592
  }
1433
- function Ys(e, t) {
1593
+ function nn(e, t) {
1434
1594
  if (e.length < 3 || e.length > 5)
1435
1595
  throw new Error(
1436
1596
  `${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
@@ -1441,12 +1601,12 @@ function Ys(e, t) {
1441
1601
  `${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`
1442
1602
  );
1443
1603
  const s = r, n = e[2];
1444
- if (!T(n))
1604
+ if (!S(n))
1445
1605
  throw new Error(
1446
1606
  `${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`
1447
1607
  );
1448
1608
  const i = n;
1449
- Js(s, i, {
1609
+ sn(s, i, {
1450
1610
  errorPrefix: `${t.pathPrefix}`,
1451
1611
  errorOnUnusedContext: !0,
1452
1612
  // Strict validation: all context keys must be used
@@ -1454,89 +1614,89 @@ function Ys(e, t) {
1454
1614
  // Custom formulas must have content
1455
1615
  schemaIndex: t.schemaIndex
1456
1616
  });
1457
- const o = Gs(s), a = {};
1458
- for (const [u, c] of Object.entries(i)) {
1459
- const m = `args[2].${u}`;
1460
- if (E(c))
1461
- a[`${u}`] = S({
1462
- data: c,
1617
+ const a = an(s), o = {};
1618
+ for (const [u, l] of Object.entries(i)) {
1619
+ const p = `args[2].${u}`;
1620
+ if (q(l))
1621
+ o[`${u}`] = D({
1622
+ data: l,
1463
1623
  context: {
1464
1624
  dataSource: t.dataSource,
1465
1625
  schemaIndex: t.schemaIndex,
1466
- pathPrefix: m
1626
+ pathPrefix: p
1467
1627
  }
1468
1628
  });
1469
- else if (typeof c == "string" && c.startsWith(q)) {
1470
- const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, f = o[l];
1629
+ else if (typeof l == "string" && l.startsWith(E)) {
1630
+ const c = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = a[c];
1471
1631
  try {
1472
- a[`${u}`] = G(
1473
- c,
1632
+ o[`${u}`] = H(
1633
+ l,
1474
1634
  t.dataSource,
1475
1635
  t.schemaIndex,
1476
- f !== void 0 ? { inferredDateLevel: f } : void 0
1636
+ d !== void 0 ? { inferredDateLevel: d } : void 0
1477
1637
  );
1478
- } catch (h) {
1479
- const p = h instanceof Error ? h.message : "Unknown error";
1480
- throw new Error(`${m}: ${p}`);
1638
+ } catch (b) {
1639
+ const g = b instanceof Error ? b.message : "Unknown error";
1640
+ throw new Error(`${p}: ${g}`);
1481
1641
  }
1482
- } else if (c && typeof c == "object" && "kind" in c)
1483
- a[`${u}`] = c;
1642
+ } else if (l && typeof l == "object" && "kind" in l)
1643
+ o[`${u}`] = l;
1484
1644
  else
1485
1645
  throw new Error(
1486
- `${m}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${q}...), but got: ${typeof c}`
1646
+ `${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E}...), but got: ${typeof l}`
1487
1647
  );
1488
1648
  }
1489
- e[2] = a;
1649
+ e[2] = o;
1490
1650
  }
1491
- function Gs(e) {
1492
- const t = qt(), r = $t(e, t), s = {};
1651
+ function an(e) {
1652
+ const t = qt(), r = Dt(e, t), s = {};
1493
1653
  for (const n of r) {
1494
- const i = At(n.functionName);
1654
+ const i = xt(n.functionName);
1495
1655
  if (i !== void 0)
1496
- for (const o of [n.ref1, n.ref2]) {
1497
- const a = s[o];
1498
- if (a !== void 0 && a !== i)
1656
+ for (const a of [n.ref1, n.ref2]) {
1657
+ const o = s[a];
1658
+ if (o !== void 0 && o !== i)
1499
1659
  throw new Error(
1500
- `Reference [${o}] is used in time-diff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`
1660
+ `Reference [${a}] is used in xdiff functions with conflicting date levels ('${o}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`
1501
1661
  );
1502
- s[o] = i;
1662
+ s[a] = i;
1503
1663
  }
1504
1664
  }
1505
1665
  return s;
1506
1666
  }
1507
- function Tt(e) {
1508
- return e.type === L.TextAttribute;
1667
+ function Nt(e) {
1668
+ return e.type === U.TextAttribute;
1509
1669
  }
1510
- function Dt(e) {
1511
- return e.type === L.NumericAttribute;
1670
+ function vt(e) {
1671
+ return e.type === U.NumericAttribute;
1512
1672
  }
1513
- function Qs(e) {
1514
- return e.type === L.DateLevel;
1673
+ function on(e) {
1674
+ return e.type === U.DateLevel;
1515
1675
  }
1516
- function Hs(e) {
1517
- return Tt(e) || Dt(e);
1676
+ function un(e) {
1677
+ return Nt(e) || vt(e);
1518
1678
  }
1519
1679
  function ie(e) {
1520
- return e.type === L.TextAttribute ? "text" : e.type === L.NumericAttribute ? "numeric" : e.type === L.DateLevel ? "date/datetime" : "unknown";
1680
+ return e.type === U.TextAttribute ? "text" : e.type === U.NumericAttribute ? "numeric" : e.type === U.DateLevel ? "date/datetime" : "unknown";
1521
1681
  }
1522
- function De(e, t) {
1682
+ function Se(e, t) {
1523
1683
  const r = e[0];
1524
1684
  if (!r || typeof r != "object" || !("type" in r))
1525
1685
  throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
1526
1686
  return r;
1527
1687
  }
1528
- function Ke(e, t) {
1529
- const r = De(e, t);
1530
- if (!Hs(r))
1688
+ function We(e, t) {
1689
+ const r = Se(e, t);
1690
+ if (!un(r))
1531
1691
  throw new Error(
1532
1692
  `${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ie(
1533
1693
  r
1534
1694
  )} attribute`
1535
1695
  );
1536
1696
  }
1537
- function I(e, t) {
1538
- const r = De(e, t);
1539
- if (!Dt(r))
1697
+ function P(e, t) {
1698
+ const r = Se(e, t);
1699
+ if (!vt(r))
1540
1700
  throw new Error(
1541
1701
  `${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ie(
1542
1702
  r
@@ -1544,40 +1704,40 @@ function I(e, t) {
1544
1704
  );
1545
1705
  }
1546
1706
  function k(e, t) {
1547
- const r = De(e, t);
1548
- if (!Tt(r))
1707
+ const r = Se(e, t);
1708
+ if (!Nt(r))
1549
1709
  throw new Error(
1550
1710
  `${t.pathPrefix}args[0]: Attribute must be string type, got ${ie(
1551
1711
  r
1552
1712
  )} attribute`
1553
1713
  );
1554
1714
  }
1555
- function Xs(e, t) {
1715
+ function ln(e, t) {
1556
1716
  const r = e[0];
1557
1717
  if (!r || typeof r != "object" || !("attribute" in r))
1558
1718
  throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
1559
1719
  return r;
1560
1720
  }
1561
- function Zs(e, t) {
1562
- const r = Xs(e, t);
1721
+ function cn(e, t) {
1722
+ const r = ln(e, t);
1563
1723
  if (!be(r))
1564
1724
  throw new Error(
1565
1725
  `${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`
1566
1726
  );
1567
1727
  }
1568
- const en = {
1569
- "measureFactory.customFormula": Ys,
1728
+ const fn = {
1729
+ "measureFactory.customFormula": nn,
1570
1730
  // String | Number filters
1571
- "filterFactory.equals": Ke,
1572
- "filterFactory.doesntEqual": Ke,
1731
+ "filterFactory.equals": We,
1732
+ "filterFactory.doesntEqual": We,
1573
1733
  // Numeric filters
1574
- "filterFactory.greaterThan": I,
1575
- "filterFactory.greaterThanOrEqual": I,
1576
- "filterFactory.lessThan": I,
1577
- "filterFactory.lessThanOrEqual": I,
1578
- "filterFactory.between": I,
1579
- "filterFactory.betweenNotEqual": I,
1580
- "filterFactory.numeric": I,
1734
+ "filterFactory.greaterThan": P,
1735
+ "filterFactory.greaterThanOrEqual": P,
1736
+ "filterFactory.lessThan": P,
1737
+ "filterFactory.lessThanOrEqual": P,
1738
+ "filterFactory.between": P,
1739
+ "filterFactory.betweenNotEqual": P,
1740
+ "filterFactory.numeric": P,
1581
1741
  // String filters
1582
1742
  "filterFactory.contains": k,
1583
1743
  "filterFactory.doesntContain": k,
@@ -1587,12 +1747,12 @@ const en = {
1587
1747
  "filterFactory.doesntEndWith": k,
1588
1748
  "filterFactory.like": k,
1589
1749
  // Exclude filter
1590
- "filterFactory.exclude": Zs
1750
+ "filterFactory.exclude": cn
1591
1751
  };
1592
- function tn(e) {
1593
- return en[`${e}`];
1752
+ function dn(e) {
1753
+ return fn[`${e}`];
1594
1754
  }
1595
- const St = {
1755
+ const Rt = {
1596
1756
  // ==================== MEASURE FACTORY FUNCTIONS ====================
1597
1757
  // Basic aggregations
1598
1758
  "measureFactory.sum": [
@@ -2119,18 +2279,18 @@ const St = {
2119
2279
  { type: "FilterRelationsNode", required: !0 }
2120
2280
  ]
2121
2281
  };
2122
- function Se(e) {
2123
- return St[`${e}`];
2282
+ function Oe(e) {
2283
+ return Rt[`${e}`];
2124
2284
  }
2125
- function rn(e) {
2126
- const t = Se(e);
2285
+ function mn(e) {
2286
+ const t = Oe(e);
2127
2287
  return t ? t.filter((r) => r.required).length : 0;
2128
2288
  }
2129
- function sn(e) {
2130
- const t = Se(e);
2289
+ function pn(e) {
2290
+ const t = Oe(e);
2131
2291
  return t ? t.length : 0;
2132
2292
  }
2133
- function nn(e) {
2293
+ function gn(e) {
2134
2294
  if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
2135
2295
  return !1;
2136
2296
  const r = Date.parse(e);
@@ -2140,318 +2300,318 @@ function nn(e) {
2140
2300
  return !isNaN(s.getTime());
2141
2301
  }
2142
2302
  function ce(e, t, r, s) {
2143
- if (e.startsWith(q))
2303
+ if (e.startsWith(E))
2144
2304
  try {
2145
- return G(e, t, r);
2305
+ return H(e, t, r);
2146
2306
  } catch (n) {
2147
2307
  const i = n instanceof Error ? n.message : "Unknown error";
2148
2308
  throw new Error(`${s}: ${i}`);
2149
2309
  }
2150
2310
  throw new Error(
2151
- `${s}: Invalid attribute '${e}'. Expected format: '${q}TableName.ColumnName[.Level]'`
2311
+ `${s}: Invalid attribute '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
2152
2312
  );
2153
2313
  }
2154
- function on(e, t, r, s) {
2155
- if (e.startsWith(q))
2314
+ function yn(e, t, r, s) {
2315
+ if (e.startsWith(E))
2156
2316
  try {
2157
- return Es(e, t, r);
2317
+ return Ss(e, t, r);
2158
2318
  } catch (n) {
2159
2319
  const i = n instanceof Error ? n.message : "Unknown error";
2160
2320
  throw new Error(`${s}: ${i}`);
2161
2321
  }
2162
2322
  throw new Error(
2163
- `${s}: Invalid date dimension string '${e}'. Expected format: '${q}TableName.ColumnName'`
2323
+ `${s}: Invalid date dimension string '${e}'. Expected format: '${E}TableName.ColumnName'`
2164
2324
  );
2165
2325
  }
2166
- function an(e) {
2167
- const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
2326
+ function hn(e) {
2327
+ const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, a = i;
2168
2328
  if (t === void 0) {
2169
2329
  if (r.required)
2170
- throw new Error(`${o}: Required argument is missing (expected ${r.type})`);
2330
+ throw new Error(`${a}: Required argument is missing (expected ${r.type})`);
2171
2331
  return;
2172
2332
  }
2173
2333
  if (!(t === null && !r.required))
2174
2334
  switch (r.type) {
2175
2335
  case "string":
2176
2336
  if (typeof t != "string")
2177
- throw new Error(`${o}: Expected string, got ${typeof t}`);
2337
+ throw new Error(`${a}: Expected string, got ${typeof t}`);
2178
2338
  return t;
2179
2339
  case "number":
2180
2340
  if (typeof t != "number")
2181
- throw new Error(`${o}: Expected number, got ${typeof t}`);
2341
+ throw new Error(`${a}: Expected number, got ${typeof t}`);
2182
2342
  return t;
2183
2343
  case "boolean":
2184
2344
  if (typeof t != "boolean")
2185
- throw new Error(`${o}: Expected boolean, got ${typeof t}`);
2345
+ throw new Error(`${a}: Expected boolean, got ${typeof t}`);
2186
2346
  return t;
2187
2347
  case "string[]":
2188
2348
  if (!Array.isArray(t))
2189
2349
  throw new Error(
2190
- `${o}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`
2350
+ `${a}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`
2191
2351
  );
2192
- if (!t.every((a) => typeof a == "string"))
2352
+ if (!t.every((o) => typeof o == "string"))
2193
2353
  throw new Error(
2194
- `${o}: Expected array of strings, but contains non-string values`
2354
+ `${a}: Expected array of strings, but contains non-string values`
2195
2355
  );
2196
2356
  return t;
2197
2357
  case "number[]":
2198
2358
  if (!Array.isArray(t))
2199
2359
  throw new Error(
2200
- `${o}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`
2360
+ `${a}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`
2201
2361
  );
2202
- if (!t.every((a) => typeof a == "number"))
2362
+ if (!t.every((o) => typeof o == "number"))
2203
2363
  throw new Error(
2204
- `${o}: Expected array of numbers, but contains non-number values`
2364
+ `${a}: Expected array of numbers, but contains non-number values`
2205
2365
  );
2206
2366
  return t;
2207
2367
  case "Attribute":
2208
2368
  if (typeof t != "string")
2209
2369
  throw new Error(
2210
- `${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`
2370
+ `${a}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`
2211
2371
  );
2212
- return ce(t, s, n, o);
2372
+ return ce(t, s, n, a);
2213
2373
  case "Attribute[]":
2214
2374
  if (!Array.isArray(t))
2215
2375
  throw new Error(
2216
- `${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`
2376
+ `${a}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`
2217
2377
  );
2218
- return t.map((a, u) => {
2219
- if (typeof a != "string")
2220
- throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
2221
- return ce(a, s, n, `${o}[${u}]`);
2378
+ return t.map((o, u) => {
2379
+ if (typeof o != "string")
2380
+ throw new Error(`${a}[${u}]: Expected attribute string, got ${typeof o}`);
2381
+ return ce(o, s, n, `${a}[${u}]`);
2222
2382
  });
2223
2383
  case "Measure":
2224
2384
  case "BaseMeasure":
2225
- if (!E(t))
2385
+ if (!q(t))
2226
2386
  throw new Error(
2227
- `${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`
2387
+ `${a}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`
2228
2388
  );
2229
- return S({
2389
+ return D({
2230
2390
  data: t,
2231
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2391
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2232
2392
  });
2233
2393
  case "Measure[]":
2234
2394
  if (!Array.isArray(t))
2235
2395
  throw new Error(
2236
- `${o}: Expected array of measure function calls, got ${typeof t}`
2396
+ `${a}: Expected array of measure function calls, got ${typeof t}`
2237
2397
  );
2238
- return t.map((a, u) => {
2239
- if (!E(a))
2398
+ return t.map((o, u) => {
2399
+ if (!q(o))
2240
2400
  throw new Error(
2241
- `${o}[${u}]: Expected measure function call, got ${typeof a}`
2401
+ `${a}[${u}]: Expected measure function call, got ${typeof o}`
2242
2402
  );
2243
- return S({
2244
- data: a,
2245
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2403
+ return D({
2404
+ data: o,
2405
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2246
2406
  });
2247
2407
  });
2248
2408
  case "Filter":
2249
- if (!E(t))
2409
+ if (!q(t))
2250
2410
  throw new Error(
2251
- `${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`
2411
+ `${a}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`
2252
2412
  );
2253
- return S({
2413
+ return D({
2254
2414
  data: t,
2255
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2415
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2256
2416
  });
2257
2417
  case "Filter[]":
2258
2418
  if (!Array.isArray(t))
2259
2419
  throw new Error(
2260
- `${o}: Expected array of filter function calls, got ${typeof t}`
2420
+ `${a}: Expected array of filter function calls, got ${typeof t}`
2261
2421
  );
2262
- return t.map((a, u) => {
2263
- if (!E(a))
2422
+ return t.map((o, u) => {
2423
+ if (!q(o))
2264
2424
  throw new Error(
2265
- `${o}[${u}]: Expected filter function call, got ${typeof a}`
2425
+ `${a}[${u}]: Expected filter function call, got ${typeof o}`
2266
2426
  );
2267
- return S({
2268
- data: a,
2269
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2427
+ return D({
2428
+ data: o,
2429
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2270
2430
  });
2271
2431
  });
2272
2432
  case "FilterRelationsNode":
2273
2433
  if (Array.isArray(t))
2274
- return t.map((a, u) => {
2275
- if (!E(a))
2434
+ return t.map((o, u) => {
2435
+ if (!q(o))
2276
2436
  throw new Error(
2277
- `${o}[${u}]: Expected filter function call, got ${typeof a}`
2437
+ `${a}[${u}]: Expected filter function call, got ${typeof o}`
2278
2438
  );
2279
- return S({
2280
- data: a,
2281
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
2439
+ return D({
2440
+ data: o,
2441
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
2282
2442
  });
2283
2443
  });
2284
- if (E(t))
2285
- return S({
2444
+ if (q(t))
2445
+ return D({
2286
2446
  data: t,
2287
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2447
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2288
2448
  });
2289
2449
  throw new Error(
2290
- `${o}: Expected filter function call or array of filters, got ${typeof t}`
2450
+ `${a}: Expected filter function call or array of filters, got ${typeof t}`
2291
2451
  );
2292
2452
  case "DateDimension":
2293
2453
  if (typeof t != "string")
2294
2454
  throw new Error(
2295
- `${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`
2455
+ `${a}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`
2296
2456
  );
2297
- return on(t, s, n, o);
2457
+ return yn(t, s, n, a);
2298
2458
  case "LevelAttribute": {
2299
2459
  if (typeof t != "string")
2300
2460
  throw new Error(
2301
- `${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`
2461
+ `${a}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`
2302
2462
  );
2303
- const a = ce(
2463
+ const o = ce(
2304
2464
  t,
2305
2465
  s,
2306
2466
  n,
2307
- o
2467
+ a
2308
2468
  );
2309
- if (!Qs(a))
2469
+ if (!on(o))
2310
2470
  throw new Error(
2311
- `${o}: Attribute must be date/datetime type, got ${ie(
2312
- a
2471
+ `${a}: Attribute must be date/datetime type, got ${ie(
2472
+ o
2313
2473
  )} attribute`
2314
2474
  );
2315
- return a;
2475
+ return o;
2316
2476
  }
2317
2477
  case "Measure | number":
2318
2478
  if (typeof t == "number")
2319
2479
  return t;
2320
- if (E(t))
2321
- return S({
2480
+ if (q(t))
2481
+ return D({
2322
2482
  data: t,
2323
- context: { dataSource: s, schemaIndex: n, pathPrefix: o }
2483
+ context: { dataSource: s, schemaIndex: n, pathPrefix: a }
2324
2484
  });
2325
2485
  throw new Error(
2326
- `${o}: Expected measure function call or number, got ${typeof t}`
2486
+ `${a}: Expected measure function call or number, got ${typeof t}`
2327
2487
  );
2328
2488
  case "Date | string":
2329
2489
  if (typeof t == "string") {
2330
- if (nn(t))
2490
+ if (gn(t))
2331
2491
  return t;
2332
2492
  throw new Error(
2333
- `${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`
2493
+ `${a}: Expected valid ISO date string or Date object, got invalid date string '${t}'`
2334
2494
  );
2335
2495
  } else {
2336
2496
  if (t instanceof Date)
2337
2497
  return t;
2338
2498
  throw new Error(
2339
- `${o}: Expected date string or Date object, got ${typeof t}`
2499
+ `${a}: Expected date string or Date object, got ${typeof t}`
2340
2500
  );
2341
2501
  }
2342
2502
  case "string | number":
2343
2503
  if (typeof t == "string" || typeof t == "number")
2344
2504
  return t;
2345
- throw new Error(`${o}: Expected string or number, got ${typeof t}`);
2505
+ throw new Error(`${a}: Expected string or number, got ${typeof t}`);
2346
2506
  case "BaseFilterConfig":
2347
2507
  case "MembersFilterConfig":
2348
2508
  case "CustomFormulaContext":
2349
2509
  case "any":
2350
2510
  if (t == null && r.required)
2351
- throw new Error(`${o}: Required argument is null/undefined`);
2511
+ throw new Error(`${a}: Required argument is null/undefined`);
2352
2512
  return t;
2353
2513
  default:
2354
2514
  return t;
2355
2515
  }
2356
2516
  }
2357
- function S(e) {
2358
- const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = Se(i);
2517
+ function D(e) {
2518
+ const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: a } = t, o = n ? `${n}.` : "", u = Oe(i);
2359
2519
  if (!u) {
2360
- const p = Object.keys(St), d = M(i, p, (A) => A), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
2520
+ const g = Object.keys(Rt), m = v(i, g, (C) => C), F = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
2361
2521
  throw new Error(
2362
- `${a}function: Unknown function '${i}'.${b}`
2522
+ `${o}function: Unknown function '${i}'.${F}`
2363
2523
  );
2364
2524
  }
2365
- const c = rn(i), m = sn(i);
2366
- if (o.length < c)
2525
+ const l = mn(i), p = pn(i);
2526
+ if (a.length < l)
2367
2527
  throw new Error(
2368
- `${a}function: Expected at least ${c} arguments, got ${o.length}`
2528
+ `${o}function: Expected at least ${l} arguments, got ${a.length}`
2369
2529
  );
2370
- if (o.length > m)
2530
+ if (a.length > p)
2371
2531
  throw new Error(
2372
- `${a}function: Expected at most ${m} arguments, got ${o.length}`
2532
+ `${o}function: Expected at most ${p} arguments, got ${a.length}`
2373
2533
  );
2374
- const l = [], f = [];
2375
- for (let p = 0; p < Math.max(o.length, u.length); p++) {
2376
- const d = u[`${p}`], b = o[`${p}`], A = a ? `${a}args[${p}]` : `args[${p}]`;
2377
- if (b === void 0) {
2378
- d != null && d.required && f.push(`${A}: Missing required argument (expected ${d.type})`);
2534
+ const c = [], d = [];
2535
+ for (let g = 0; g < Math.max(a.length, u.length); g++) {
2536
+ const m = u[`${g}`], F = a[`${g}`], C = o ? `${o}args[${g}]` : `args[${g}]`;
2537
+ if (F === void 0) {
2538
+ m != null && m.required && d.push(`${C}: Missing required argument (expected ${m.type})`);
2379
2539
  continue;
2380
2540
  }
2381
- if (!d) {
2382
- f.push(`${A}: Unexpected argument`);
2541
+ if (!m) {
2542
+ d.push(`${C}: Unexpected argument`);
2383
2543
  continue;
2384
2544
  }
2385
2545
  try {
2386
- const O = an({
2387
- data: b,
2546
+ const N = hn({
2547
+ data: F,
2388
2548
  context: {
2389
2549
  dataSource: r,
2390
2550
  schemaIndex: s,
2391
- pathPrefix: A,
2392
- argSchema: d
2551
+ pathPrefix: C,
2552
+ argSchema: m
2393
2553
  }
2394
2554
  });
2395
- l.push(O);
2396
- } catch (O) {
2397
- const oe = O instanceof Error ? O.message : "Unknown error";
2398
- f.push(oe);
2555
+ c.push(N);
2556
+ } catch (N) {
2557
+ const ae = N instanceof Error ? N.message : "Unknown error";
2558
+ d.push(ae);
2399
2559
  }
2400
2560
  }
2401
- if (f.length > 0) {
2402
- const p = f.join("; ");
2403
- throw new Error(p);
2561
+ if (d.length > 0) {
2562
+ const g = d.join("; ");
2563
+ throw new Error(g);
2404
2564
  }
2405
- const h = tn(i);
2406
- if (h)
2565
+ const b = dn(i);
2566
+ if (b)
2407
2567
  try {
2408
- h(l, {
2568
+ b(c, {
2409
2569
  dataSource: r,
2410
2570
  schemaIndex: s,
2411
- pathPrefix: a
2571
+ pathPrefix: o
2412
2572
  });
2413
- } catch (p) {
2414
- const d = p instanceof Error ? p.message : "Unknown validation error";
2415
- throw new Error(d);
2573
+ } catch (g) {
2574
+ const m = g instanceof Error ? g.message : "Unknown validation error";
2575
+ throw new Error(m);
2416
2576
  }
2417
- return Ms(i, l);
2577
+ return Is(i, c);
2418
2578
  }
2419
- function Ot(e) {
2579
+ function It(e) {
2420
2580
  const { attribute: t, config: r } = e;
2421
2581
  if (be(e) && Dr(t)) {
2422
- const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = Sr(r), o = Object.keys(i).length === 0 ? void 0 : i;
2423
- return Or(t, n, o);
2582
+ const { granularity: s } = t, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), i = Mr(r), a = Object.keys(i).length === 0 ? void 0 : i;
2583
+ return Nr(t, n, a);
2424
2584
  }
2425
2585
  return e;
2426
2586
  }
2427
- function un(e) {
2587
+ function bn(e) {
2428
2588
  let t = [];
2429
2589
  for (const r of e)
2430
- X(r) ? t = Le(r, t) : t = Le([Ot(r)], t);
2590
+ Z(r) ? t = Be(r, t) : t = Be([It(r)], t);
2431
2591
  return t != null ? t : [];
2432
2592
  }
2433
- const cn = (e) => {
2593
+ const Fn = (e) => {
2434
2594
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
2435
- return t.forEach((o, a) => {
2595
+ return t.forEach((a, o) => {
2436
2596
  const u = {
2437
2597
  category: "filters",
2438
- index: a,
2439
- input: o
2598
+ index: o,
2599
+ input: a
2440
2600
  };
2441
2601
  try {
2442
- const c = S({
2443
- data: o,
2602
+ const l = D({
2603
+ data: a,
2444
2604
  context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
2445
2605
  });
2446
- !X(c) && !ne(c) ? i.push(F(g({}, u), { message: "Invalid filter JSON" })) : n.push(c);
2447
- } catch (c) {
2448
- const m = c instanceof Error ? c.message : "Unknown error";
2449
- i.push(F(g({}, u), { message: m }));
2606
+ !Z(l) && !ne(l) ? i.push(A(y({}, u), { message: "Invalid filter JSON" })) : n.push(l);
2607
+ } catch (l) {
2608
+ const p = l instanceof Error ? l.message : "Unknown error";
2609
+ i.push(A(y({}, u), { message: p }));
2450
2610
  }
2451
- }), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: un(n) };
2452
- }, Oe = (e) => {
2611
+ }), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: bn(n) };
2612
+ }, De = (e) => {
2453
2613
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2454
- return t ? Ft(t) ? cn({
2614
+ return t ? Et(t) ? Fn({
2455
2615
  data: t,
2456
2616
  context: { dataSource: r, schemaIndex: s }
2457
2617
  }) : {
@@ -2465,28 +2625,28 @@ const cn = (e) => {
2465
2625
  }
2466
2626
  ]
2467
2627
  } : { success: !0, data: [] };
2468
- }, ln = (e) => {
2628
+ }, An = (e) => {
2469
2629
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
2470
- return t.forEach((o, a) => {
2630
+ return t.forEach((a, o) => {
2471
2631
  const u = {
2472
2632
  category: "highlights",
2473
- index: a,
2474
- input: o
2633
+ index: o,
2634
+ input: a
2475
2635
  };
2476
2636
  try {
2477
- const c = S({
2478
- data: o,
2637
+ const l = D({
2638
+ data: a,
2479
2639
  context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
2480
2640
  });
2481
- ne(c) ? n.push(Ot(c)) : i.push(F(g({}, u), { message: "Invalid filter JSON" }));
2482
- } catch (c) {
2483
- const m = c instanceof Error ? c.message : "Unknown error";
2484
- i.push(F(g({}, u), { message: m }));
2641
+ ne(l) ? n.push(It(l)) : i.push(A(y({}, u), { message: "Invalid filter JSON" }));
2642
+ } catch (l) {
2643
+ const p = l instanceof Error ? l.message : "Unknown error";
2644
+ i.push(A(y({}, u), { message: p }));
2485
2645
  }
2486
2646
  }), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
2487
2647
  }, Me = (e) => {
2488
2648
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2489
- return t ? Ft(t) ? ln({
2649
+ return t ? Et(t) ? An({
2490
2650
  data: t,
2491
2651
  context: { dataSource: r, schemaIndex: s }
2492
2652
  }) : {
@@ -2500,51 +2660,51 @@ const cn = (e) => {
2500
2660
  }
2501
2661
  ]
2502
2662
  } : { success: !0, data: [] };
2503
- }, fn = (e, t) => {
2504
- if (e && !te(e))
2505
- return F(g({}, t), {
2663
+ }, wn = (e, t) => {
2664
+ if (e && !et(e))
2665
+ return A(y({}, t), {
2506
2666
  message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
2507
2667
  });
2508
- }, dn = (e, t, r) => {
2668
+ }, En = (e, t, r) => {
2509
2669
  const { dataSource: s, schemaIndex: n } = t;
2510
2670
  try {
2511
- const i = S({
2671
+ const i = D({
2512
2672
  data: e,
2513
2673
  context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
2514
2674
  });
2515
- return Ee(i) ? { success: !0, data: i } : {
2675
+ return Te(i) ? { success: !0, data: i } : {
2516
2676
  success: !1,
2517
- errors: [F(g({}, r), { message: "Invalid measure JSON" })]
2677
+ errors: [A(y({}, r), { message: "Invalid measure JSON" })]
2518
2678
  };
2519
2679
  } catch (i) {
2520
- const o = i instanceof Error ? i.message : "Unknown error";
2680
+ const a = i instanceof Error ? i.message : "Unknown error";
2521
2681
  return {
2522
2682
  success: !1,
2523
- errors: [F(g({}, r), { message: o })]
2683
+ errors: [A(y({}, r), { message: a })]
2524
2684
  };
2525
2685
  }
2526
- }, mn = (e, t, r, s) => {
2527
- const n = S({
2686
+ }, Cn = (e, t, r, s) => {
2687
+ const n = D({
2528
2688
  data: e.column,
2529
2689
  context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
2530
2690
  });
2531
- if (!Ee(n))
2691
+ if (!Te(n))
2532
2692
  return {
2533
2693
  style: {},
2534
- error: F(g({}, s), { message: "Invalid measure JSON" })
2694
+ error: A(y({}, s), { message: "Invalid measure JSON" })
2535
2695
  };
2536
- const i = fn(e.sortType, s);
2696
+ const i = wn(e.sortType, s);
2537
2697
  if (i) {
2538
- const a = _(e, "column");
2539
- return { measure: n, style: a, error: i };
2540
- }
2541
- const o = _(e, "column");
2542
- return { measure: n, style: o };
2543
- }, pn = (e, t, r, s) => {
2544
- if (As(e))
2545
- return mn(e, t, r, s);
2546
- if (E(e)) {
2547
- const n = dn(
2698
+ const o = _(e, "column");
2699
+ return { measure: n, style: o, error: i };
2700
+ }
2701
+ const a = _(e, "column");
2702
+ return { measure: n, style: a };
2703
+ }, Tn = (e, t, r, s) => {
2704
+ if (xs(e))
2705
+ return Cn(e, t, r, s);
2706
+ if (q(e)) {
2707
+ const n = En(
2548
2708
  e,
2549
2709
  { dataSource: t, schemaIndex: r },
2550
2710
  s
@@ -2552,11 +2712,11 @@ const cn = (e) => {
2552
2712
  return n.success ? { measure: n.data } : { error: n.errors[0] };
2553
2713
  }
2554
2714
  return {
2555
- error: F(g({}, s), {
2715
+ error: A(y({}, s), {
2556
2716
  message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
2557
2717
  })
2558
2718
  };
2559
- }, Mt = (e) => {
2719
+ }, Pt = (e) => {
2560
2720
  const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
2561
2721
  if (!t)
2562
2722
  return { success: !0, data: [] };
@@ -2573,24 +2733,24 @@ const cn = (e) => {
2573
2733
  ]
2574
2734
  };
2575
2735
  const n = [], i = [];
2576
- return t.forEach((o, a) => {
2736
+ return t.forEach((a, o) => {
2577
2737
  const u = {
2578
2738
  category: "measures",
2579
- index: a,
2580
- input: o
2739
+ index: o,
2740
+ input: a
2581
2741
  };
2582
2742
  try {
2583
- const c = pn(o, r, s, u);
2584
- if (c.error) {
2585
- i.push(c.error);
2743
+ const l = Tn(a, r, s, u);
2744
+ if (l.error) {
2745
+ i.push(l.error);
2586
2746
  return;
2587
2747
  }
2588
- c.measure && n.push(
2589
- c.style !== void 0 ? { measure: c.measure, style: c.style } : { measure: c.measure }
2748
+ l.measure && n.push(
2749
+ l.style !== void 0 ? { measure: l.measure, style: l.style } : { measure: l.measure }
2590
2750
  );
2591
- } catch (c) {
2592
- const m = c instanceof Error ? c.message : "Unknown error";
2593
- i.push(F(g({}, u), { message: m }));
2751
+ } catch (l) {
2752
+ const p = l instanceof Error ? l.message : "Unknown error";
2753
+ i.push(A(y({}, u), { message: p }));
2594
2754
  }
2595
2755
  }), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
2596
2756
  };
@@ -2607,62 +2767,28 @@ function w(e, t, r) {
2607
2767
  }
2608
2768
  return s.data;
2609
2769
  }
2610
- const ve = "$trend", Ne = "$forecast";
2611
- function yn(e) {
2612
- return e.map(({ attribute: t, style: r }) => {
2613
- const s = r == null ? void 0 : r.sortType;
2614
- if (!s) return t;
2615
- const n = typeof s == "object" ? s.direction : s;
2616
- return te(n) ? t.sort(re(n)) : t;
2617
- });
2618
- }
2619
- function gn(e) {
2620
- var t, r;
2621
- return (r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1;
2622
- }
2623
- function hn(e) {
2624
- var t, r;
2625
- return (r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1;
2626
- }
2627
- function bn(e) {
2628
- var r, s;
2629
- const t = [];
2630
- for (const { measure: n, style: i } of e) {
2631
- const o = i == null ? void 0 : i.sortType, a = o && te(o) ? n.sort(re(o)) : n;
2632
- t.push(a), i != null && i.trend && !gn(n) && t.push(
2633
- Mr(n, `${ve}_${(r = n.name) != null ? r : "Measure"}`, i.trend)
2634
- ), i != null && i.forecast && !hn(n) && t.push(
2635
- vr(
2636
- n,
2637
- `${Ne}_${(s = n.name) != null ? s : "Measure"}`,
2638
- i.forecast
2639
- )
2640
- );
2641
- }
2642
- return t;
2643
- }
2644
2770
  const Jn = (e) => {
2645
- const { data: t } = e, { dataSource: r, tables: s } = e.context, n = xe(s), i = [], o = w(
2646
- () => wt({
2771
+ const { data: t } = e, { dataSource: r, tables: s } = e.context, n = qe(s), i = [], a = w(
2772
+ () => Tt({
2647
2773
  data: t.dimensions || [],
2648
2774
  context: { dataSource: r, schemaIndex: n }
2649
2775
  }),
2650
2776
  i
2651
- ), a = w(
2652
- () => Mt({
2777
+ ), o = w(
2778
+ () => Pt({
2653
2779
  data: t.measures || [],
2654
2780
  context: { dataSource: r, schemaIndex: n }
2655
2781
  }),
2656
2782
  i
2657
2783
  ), u = w(
2658
- () => Oe({
2784
+ () => De({
2659
2785
  data: t.filters || [],
2660
2786
  context: { dataSource: r, schemaIndex: n }
2661
2787
  }),
2662
2788
  i
2663
2789
  );
2664
- let c = null;
2665
- return t.highlights && (c = w(
2790
+ let l = null;
2791
+ return t.highlights && (l = w(
2666
2792
  () => Me({
2667
2793
  data: t.highlights || [],
2668
2794
  context: { dataSource: r, schemaIndex: n }
@@ -2673,170 +2799,56 @@ const Jn = (e) => {
2673
2799
  errors: i
2674
2800
  } : {
2675
2801
  success: !0,
2676
- data: g({
2802
+ data: y({
2677
2803
  dataSource: Fe(r),
2678
- dimensions: o ? yn(o) : [],
2679
- measures: a ? bn(a) : [],
2804
+ dimensions: a ? vr(a) : [],
2805
+ measures: o ? Rr(o) : [],
2680
2806
  filters: u || []
2681
- }, c && { highlights: c })
2807
+ }, l && { highlights: l })
2682
2808
  };
2683
2809
  };
2684
- function Je(e) {
2810
+ function Ke(e) {
2685
2811
  return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
2686
2812
  }
2687
- function Re(e) {
2813
+ function Ne(e) {
2688
2814
  const t = [], r = [];
2689
2815
  return e.forEach((s, n) => {
2690
- var l, f, h;
2691
- const i = Je(s) ? s.column : s, o = Je(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2816
+ var c, d, b;
2817
+ const i = Ke(s) ? s.column : s, a = Ke(s) ? s : void 0, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2692
2818
  if (!i.composeCode) {
2693
2819
  r.push({
2694
2820
  category: "dimensions",
2695
2821
  index: n,
2696
- input: a(),
2822
+ input: o(),
2697
2823
  message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
2698
2824
  });
2699
2825
  return;
2700
2826
  }
2701
- if (!i.composeCode.startsWith(q)) {
2827
+ if (!i.composeCode.startsWith(E)) {
2702
2828
  r.push({
2703
2829
  category: "dimensions",
2704
2830
  index: n,
2705
- input: a(),
2706
- message: `Expected composeCode to start with '${q}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
2831
+ input: o(),
2832
+ message: `Expected composeCode to start with '${E}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
2707
2833
  });
2708
2834
  return;
2709
2835
  }
2710
- const u = (h = o != null && o.sortType ? re(o.sortType) : void 0) != null ? h : ((l = i.getSort) == null ? void 0 : l.call(i)) !== void 0 && ((f = i.getSort) == null ? void 0 : f.call(i)) !== B.None ? i.getSort() : void 0, c = o ? _(o, "column") : {};
2711
- if (u !== void 0 && u !== B.None || o && Object.keys(c).length > 0) {
2712
- const p = g(g({
2836
+ const u = (b = a != null && a.sortType ? tt(a.sortType) : void 0) != null ? b : ((c = i.getSort) == null ? void 0 : c.call(i)) !== void 0 && ((d = i.getSort) == null ? void 0 : d.call(i)) !== B.None ? i.getSort() : void 0, l = a ? _(a, "column") : {};
2837
+ if (u !== void 0 && u !== B.None || a && Object.keys(l).length > 0) {
2838
+ const g = y(y({
2713
2839
  column: i.composeCode
2714
- }, u !== void 0 && u !== B.None && { sortType: tt(u) }), c);
2715
- t.push(p);
2840
+ }, u !== void 0 && u !== B.None && { sortType: rt(u) }), l);
2841
+ t.push(g);
2716
2842
  } else
2717
2843
  t.push(i.composeCode);
2718
2844
  }), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
2719
2845
  }
2720
- function vt(e, t) {
2721
- const r = [];
2722
- let s = "", n = 0, i = !1, o = null;
2723
- for (let a = 0; a < e.length; a++) {
2724
- const u = e[a], c = e[a + 1];
2725
- if (i) {
2726
- if (u !== o) {
2727
- s += u;
2728
- continue;
2729
- }
2730
- if (c === o) {
2731
- s += u + c, a++;
2732
- continue;
2733
- }
2734
- i = !1, o = null, s += u;
2735
- continue;
2736
- } else {
2737
- if (u === "'" || u === '"') {
2738
- i = !0, o = u, s += u;
2739
- continue;
2740
- }
2741
- if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
2742
- r.push(s.trim()), s = "";
2743
- continue;
2744
- }
2745
- }
2746
- s += u;
2747
- }
2748
- return s.trim() && r.push(s.trim()), r;
2749
- }
2750
- function Fn(e, t) {
2751
- let r = 0, s = !1, n = null;
2752
- for (let i = 0; i < e.length; i++) {
2753
- const o = e[i], a = e[i + 1];
2754
- if (s) {
2755
- if (o !== n) continue;
2756
- if (a === n) {
2757
- i++;
2758
- continue;
2759
- }
2760
- s = !1, n = null;
2761
- } else {
2762
- if (o === "'" || o === '"') {
2763
- s = !0, n = o;
2764
- continue;
2765
- }
2766
- if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0) return i;
2767
- }
2768
- }
2769
- return -1;
2770
- }
2771
- function wn(e) {
2772
- return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
2773
- }
2774
- function V(e) {
2775
- if (!e || typeof e != "string")
2776
- throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
2777
- const t = e.trim();
2778
- if (!t)
2779
- throw new Error("Invalid composeCode: empty string");
2780
- const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
2781
- if (!r)
2782
- throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
2783
- const s = r[1], n = r[2], i = Nt(n);
2784
- return {
2785
- function: s,
2786
- args: i
2787
- };
2788
- }
2789
- function Nt(e) {
2790
- return e.trim() ? vt(e, ",").map(Rt) : [];
2791
- }
2792
- function Rt(e) {
2793
- if (!e)
2794
- throw new Error("Cannot parse empty argument value");
2795
- if (e === "null")
2796
- return null;
2797
- if (e === "undefined")
2798
- return;
2799
- if (e === "true")
2800
- return !0;
2801
- if (e === "false")
2802
- return !1;
2803
- if (e.match(/^-?\d+(\.\d+)?$/))
2804
- return parseFloat(e);
2805
- if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
2806
- const r = e[0];
2807
- return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
2808
- }
2809
- if (e.startsWith("[") && e.endsWith("]")) {
2810
- const r = e.slice(1, -1).trim();
2811
- if (!r)
2812
- return [];
2813
- const s = Nt(r);
2814
- return s.every((n) => typeof n == "string"), s;
2815
- }
2816
- if (e.startsWith("{") && e.endsWith("}")) {
2817
- const r = e.slice(1, -1).trim();
2818
- return r ? An(r) : {};
2819
- }
2820
- return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
2821
- }
2822
- function qn(e) {
2823
- const t = Fn(e, ":");
2824
- if (t === -1)
2825
- throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
2826
- const r = wn(e.slice(0, t).trim()), s = Rt(e.slice(t + 1).trim());
2827
- return [r, s];
2828
- }
2829
- function An(e) {
2830
- if (!e.trim()) return {};
2831
- const t = vt(e, ",").map(qn).filter(([, r]) => r !== null);
2832
- return Object.fromEntries(t);
2833
- }
2834
- const ge = "Unknown error";
2835
- function Ie(e) {
2846
+ const ye = "Unknown error";
2847
+ function ve(e) {
2836
2848
  if (!e)
2837
2849
  return { success: !0, data: [] };
2838
2850
  const t = [];
2839
- if (Nr(e)) {
2851
+ if (Ir(e)) {
2840
2852
  if (!e.composeCode)
2841
2853
  return {
2842
2854
  success: !1,
@@ -2850,9 +2862,9 @@ function Ie(e) {
2850
2862
  ]
2851
2863
  };
2852
2864
  try {
2853
- return { success: !0, data: [V(e.composeCode)] };
2865
+ return { success: !0, data: [K(e.composeCode)] };
2854
2866
  } catch (s) {
2855
- const n = s instanceof Error ? s.message : ge;
2867
+ const n = s instanceof Error ? s.message : ye;
2856
2868
  return {
2857
2869
  success: !1,
2858
2870
  errors: [
@@ -2879,20 +2891,20 @@ function Ie(e) {
2879
2891
  return;
2880
2892
  }
2881
2893
  try {
2882
- const o = V(s.composeCode);
2883
- r.push(o);
2884
- } catch (o) {
2885
- const a = o instanceof Error ? o.message : ge;
2894
+ const a = K(s.composeCode);
2895
+ r.push(a);
2896
+ } catch (a) {
2897
+ const o = a instanceof Error ? a.message : ye;
2886
2898
  t.push({
2887
2899
  category: "filters",
2888
2900
  index: n,
2889
2901
  input: s,
2890
- message: `Failed to parse composeCode for filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
2902
+ message: `Failed to parse composeCode for filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
2891
2903
  });
2892
2904
  }
2893
2905
  }), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
2894
2906
  }
2895
- function ke(e) {
2907
+ function Re(e) {
2896
2908
  if (!e)
2897
2909
  return { success: !0, data: [] };
2898
2910
  const t = [], r = [];
@@ -2908,133 +2920,133 @@ function ke(e) {
2908
2920
  return;
2909
2921
  }
2910
2922
  try {
2911
- const o = V(s.composeCode);
2912
- t.push(o);
2913
- } catch (o) {
2914
- const a = o instanceof Error ? o.message : ge;
2923
+ const a = K(s.composeCode);
2924
+ t.push(a);
2925
+ } catch (a) {
2926
+ const o = a instanceof Error ? a.message : ye;
2915
2927
  r.push({
2916
2928
  category: "highlights",
2917
2929
  index: n,
2918
2930
  input: s,
2919
- message: `Failed to parse composeCode for highlight filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
2931
+ message: `Failed to parse composeCode for highlight filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
2920
2932
  });
2921
2933
  }
2922
2934
  }), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
2923
2935
  }
2924
- function Ye(e) {
2936
+ function Ge(e) {
2925
2937
  return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
2926
2938
  }
2927
- function Be(e) {
2939
+ function Ie(e) {
2928
2940
  const t = [], r = [];
2929
2941
  return e.forEach((s, n) => {
2930
- var u, c, m;
2931
- const i = Ye(s) ? s.column : s, o = Ye(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2942
+ var u, l, p;
2943
+ const i = Ge(s) ? s.column : s, a = Ge(s) ? s : void 0, o = () => typeof i.toJSON == "function" ? i.toJSON() : i;
2932
2944
  if (!i.composeCode) {
2933
2945
  r.push({
2934
2946
  category: "measures",
2935
2947
  index: n,
2936
- input: a(),
2948
+ input: o(),
2937
2949
  message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
2938
2950
  });
2939
2951
  return;
2940
2952
  }
2941
2953
  try {
2942
- const l = V(i.composeCode), f = (m = o != null && o.sortType ? re(o.sortType) : void 0) != null ? m : ((u = i.getSort) == null ? void 0 : u.call(i)) !== void 0 && ((c = i.getSort) == null ? void 0 : c.call(i)) !== B.None ? i.getSort() : void 0;
2943
- if (f !== void 0 && f !== B.None || o && Object.keys(_(o, "column")).length > 0) {
2944
- const p = o ? _(o, "column") : {}, d = g(g({
2945
- column: l
2946
- }, f !== void 0 && f !== B.None && { sortType: tt(f) }), p);
2947
- t.push(d);
2954
+ const c = K(i.composeCode), d = (p = a != null && a.sortType ? tt(a.sortType) : void 0) != null ? p : ((u = i.getSort) == null ? void 0 : u.call(i)) !== void 0 && ((l = i.getSort) == null ? void 0 : l.call(i)) !== B.None ? i.getSort() : void 0;
2955
+ if (d !== void 0 && d !== B.None || a && Object.keys(_(a, "column")).length > 0) {
2956
+ const g = a ? _(a, "column") : {}, m = y(y({
2957
+ column: c
2958
+ }, d !== void 0 && d !== B.None && { sortType: rt(d) }), g);
2959
+ t.push(m);
2948
2960
  } else
2949
- t.push(l);
2950
- } catch (l) {
2951
- const f = l instanceof Error ? l.message : "Unknown error";
2961
+ t.push(c);
2962
+ } catch (c) {
2963
+ const d = c instanceof Error ? c.message : "Unknown error";
2952
2964
  r.push({
2953
2965
  category: "measures",
2954
2966
  index: n,
2955
- input: a(),
2956
- message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${f}. ComposeCode: '${i.composeCode}'`
2967
+ input: o(),
2968
+ message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
2957
2969
  });
2958
2970
  }
2959
2971
  }), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
2960
2972
  }
2961
- function Ge(e) {
2973
+ function Ye(e) {
2962
2974
  var t, r, s, n;
2963
- return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(ve)) != null ? n : !1);
2975
+ return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(st)) != null ? n : !1);
2964
2976
  }
2965
- function Qe(e) {
2977
+ function Je(e) {
2966
2978
  var t, r, s, n;
2967
- return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(Ne)) != null ? n : !1);
2979
+ return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(nt)) != null ? n : !1);
2968
2980
  }
2969
2981
  function He(e) {
2970
2982
  try {
2971
- const t = V(e.trim());
2983
+ const t = K(e.trim());
2972
2984
  return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : void 0;
2973
2985
  } catch (t) {
2974
2986
  return;
2975
2987
  }
2976
2988
  }
2977
- function Cn(e) {
2989
+ function qn(e) {
2978
2990
  var s, n, i;
2979
2991
  if (!(e != null && e.length)) return [];
2980
2992
  const t = /* @__PURE__ */ new Set(), r = [];
2981
- for (let o = 0; o < e.length; o++) {
2982
- if (t.has(o)) continue;
2983
- const a = e[o];
2984
- if (Ge(a) || Qe(a)) {
2985
- r.push(a);
2993
+ for (let a = 0; a < e.length; a++) {
2994
+ if (t.has(a)) continue;
2995
+ const o = e[a];
2996
+ if (Ye(o) || Je(o)) {
2997
+ r.push(o);
2986
2998
  continue;
2987
2999
  }
2988
- const u = (s = a.name) != null ? s : "Measure", c = `${ve}_${u}`, m = `${Ne}_${u}`;
2989
- let l, f, h = o + 1;
2990
- if (h < e.length && !t.has(h) && Ge(e[h]) && e[h].name === c) {
2991
- const p = (n = e[h].composeCode) == null ? void 0 : n.trim();
2992
- p && (l = He(p), t.add(h), h++);
3000
+ const u = (s = o.name) != null ? s : "Measure", l = `${st}_${u}`, p = `${nt}_${u}`;
3001
+ let c, d, b = a + 1;
3002
+ if (b < e.length && !t.has(b) && Ye(e[b]) && e[b].name === l) {
3003
+ const g = (n = e[b].composeCode) == null ? void 0 : n.trim();
3004
+ g && (c = He(g), t.add(b), b++);
2993
3005
  }
2994
- if (h < e.length && !t.has(h) && Qe(e[h]) && e[h].name === m) {
2995
- const p = (i = e[h].composeCode) == null ? void 0 : i.trim();
2996
- p && (f = He(p), t.add(h));
3006
+ if (b < e.length && !t.has(b) && Je(e[b]) && e[b].name === p) {
3007
+ const g = (i = e[b].composeCode) == null ? void 0 : i.trim();
3008
+ g && (d = He(g), t.add(b));
2997
3009
  }
2998
- l !== void 0 || f !== void 0 ? r.push(g(g({
2999
- column: a
3000
- }, l && Object.keys(l).length > 0 && { trend: l }), f && Object.keys(f).length > 0 && { forecast: f })) : r.push(a);
3010
+ c !== void 0 || d !== void 0 ? r.push(y(y({
3011
+ column: o
3012
+ }, c && Object.keys(c).length > 0 && { trend: c }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(o);
3001
3013
  }
3002
3014
  return r;
3003
3015
  }
3004
- function Yn(e) {
3016
+ function Hn(e) {
3005
3017
  const t = [], r = w(
3006
- () => Re(e.dimensions || []),
3018
+ () => Ne(e.dimensions || []),
3007
3019
  t
3008
- ), s = Cn(e.measures || []), n = w(
3009
- () => Be(s),
3020
+ ), s = qn(e.measures || []), n = w(
3021
+ () => Ie(s),
3010
3022
  t
3011
3023
  ), i = w(
3012
- () => Ie(e.filters),
3024
+ () => ve(e.filters),
3013
3025
  t
3014
3026
  );
3015
- let o = null;
3016
- if (e.highlights && e.highlights.length > 0 && (o = w(
3017
- () => ke(e.highlights),
3027
+ let a = null;
3028
+ if (e.highlights && e.highlights.length > 0 && (a = w(
3029
+ () => Re(e.highlights),
3018
3030
  t
3019
3031
  )), t.length > 0)
3020
3032
  return {
3021
3033
  success: !1,
3022
3034
  errors: t
3023
3035
  };
3024
- const a = g({
3036
+ const o = y({
3025
3037
  dimensions: r || [],
3026
3038
  measures: n || [],
3027
3039
  filters: i || []
3028
- }, o && { highlights: o });
3040
+ }, a && { highlights: a });
3029
3041
  return {
3030
3042
  success: !0,
3031
3043
  // Strip [[delimiters]] from all strings to preserve original names with spaces
3032
- data: Q(a)
3044
+ data: Q(o)
3033
3045
  };
3034
3046
  }
3035
- const It = new Set(
3036
- Rr.filter((e) => e !== "image")
3037
- ), Xe = Object.freeze([...It]), le = /* @__PURE__ */ new Set([
3047
+ const kt = new Set(
3048
+ Pr.filter((e) => e !== "image")
3049
+ ), Qe = Object.freeze([...kt]), fe = /* @__PURE__ */ new Set([
3038
3050
  "category",
3039
3051
  "value",
3040
3052
  "breakBy",
@@ -3057,7 +3069,7 @@ const It = new Set(
3057
3069
  "min",
3058
3070
  "max",
3059
3071
  "seriesToColorMap"
3060
- ]), En = {
3072
+ ]), xn = {
3061
3073
  line: {
3062
3074
  validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
3063
3075
  requiredAxes: ["category", "value"]
@@ -3130,7 +3142,7 @@ const It = new Set(
3130
3142
  validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
3131
3143
  requiredAxes: ["category", "value"]
3132
3144
  }
3133
- }, xn = /* @__PURE__ */ new Set([
3145
+ }, $n = /* @__PURE__ */ new Set([
3134
3146
  "category",
3135
3147
  "breakBy",
3136
3148
  "breakByPoint",
@@ -3138,7 +3150,7 @@ const It = new Set(
3138
3150
  "geo",
3139
3151
  "details",
3140
3152
  "date"
3141
- ]), $n = /* @__PURE__ */ new Set([
3153
+ ]), Sn = /* @__PURE__ */ new Set([
3142
3154
  "value",
3143
3155
  "size",
3144
3156
  "colorBy",
@@ -3150,34 +3162,34 @@ const It = new Set(
3150
3162
  "max",
3151
3163
  "color"
3152
3164
  ]);
3153
- function Tn(e) {
3154
- const t = En[e];
3165
+ function On(e) {
3166
+ const t = xn[e];
3155
3167
  if (t)
3156
3168
  return {
3157
3169
  validAxes: new Set(t.validAxes),
3158
3170
  requiredAxes: Object.freeze([...t.requiredAxes])
3159
3171
  };
3160
3172
  }
3161
- function kt(e) {
3162
- return typeof e == "string" && It.has(e);
3173
+ function Bt(e) {
3174
+ return typeof e == "string" && kt.has(e);
3163
3175
  }
3164
3176
  function Dn(e, t, r) {
3165
- if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" || xn.has(e))
3177
+ if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" || $n.has(e))
3166
3178
  return !0;
3167
- if ($n.has(e))
3179
+ if (Sn.has(e))
3168
3180
  return !1;
3169
3181
  const s = Array.isArray(t) ? t[0] : t;
3170
3182
  if (!s)
3171
3183
  return !0;
3172
3184
  let n;
3173
- return T(s) && "column" in s && (n = s.column), !(E(s) || n !== void 0 && E(n));
3185
+ return S(s) && "column" in s && (n = s.column), !(q(s) || n !== void 0 && q(n));
3174
3186
  }
3175
- function Sn(e) {
3187
+ function Mn(e) {
3176
3188
  const t = [], r = {
3177
3189
  chartType: "",
3178
3190
  dataOptions: {}
3179
3191
  };
3180
- if (!T(e))
3192
+ if (!S(e))
3181
3193
  return t.push({
3182
3194
  category: "chartType",
3183
3195
  index: -1,
@@ -3186,165 +3198,165 @@ function Sn(e) {
3186
3198
  }), { normalized: r, errors: t };
3187
3199
  const s = e.chartType;
3188
3200
  if (s === void 0) {
3189
- const i = Object.keys(e), o = M("chartType", i, (c) => c), a = o && o.distance <= x ? ` Did you mean 'chartType'? (You may have typed '${o.best}')` : "", u = o && o.distance <= x ? { [o.best]: e[o.best] } : e;
3201
+ const i = Object.keys(e), a = v("chartType", i, (l) => l), o = a && a.distance <= x ? ` Did you mean 'chartType'? (You may have typed '${a.best}')` : "", u = a && a.distance <= x ? { [a.best]: e[a.best] } : e;
3190
3202
  t.push({
3191
3203
  category: "chartType",
3192
3204
  index: -1,
3193
3205
  input: u,
3194
- message: `chartType is required.${a}`
3206
+ message: `chartType is required.${o}`
3195
3207
  });
3196
- } else if (kt(s))
3208
+ } else if (Bt(s))
3197
3209
  r.chartType = s;
3198
3210
  else {
3199
- const i = M(String(s), Xe, (u) => u), o = i && i.distance <= x ? ` Did you mean '${i.best}'?` : "", a = Xe.slice(0, 8).join(", ");
3211
+ const i = v(String(s), Qe, (u) => u), a = i && i.distance <= x ? ` Did you mean '${i.best}'?` : "", o = Qe.slice(0, 8).join(", ");
3200
3212
  t.push({
3201
3213
  category: "chartType",
3202
3214
  index: -1,
3203
3215
  input: s,
3204
- message: `Invalid chartType '${s}'. Valid types: ${a}, ...${o}`
3216
+ message: `Invalid chartType '${s}'. Valid types: ${o}, ...${a}`
3205
3217
  });
3206
3218
  }
3207
3219
  const n = e.dataOptions;
3208
3220
  if (n === void 0) {
3209
- const i = Object.keys(e), o = M("dataOptions", i, (c) => c), a = o && o.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${o.best}')` : "", u = o && o.distance <= x ? { [o.best]: e[o.best] } : e;
3221
+ const i = Object.keys(e), a = v("dataOptions", i, (l) => l), o = a && a.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${a.best}')` : "", u = a && a.distance <= x ? { [a.best]: e[a.best] } : e;
3210
3222
  t.push({
3211
3223
  category: "dataOptions",
3212
3224
  index: -1,
3213
3225
  input: u,
3214
- message: `dataOptions is required.${a}`
3226
+ message: `dataOptions is required.${o}`
3215
3227
  });
3216
3228
  } else n !== null && typeof n == "object" && (r.dataOptions = n);
3217
3229
  return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
3218
3230
  }
3219
- function On(e) {
3231
+ function Nn(e) {
3220
3232
  return e.map(
3221
- ({ attribute: t, style: r }) => r ? g({ column: t }, r) : t
3233
+ ({ attribute: t, style: r }) => r ? y({ column: t }, r) : t
3222
3234
  );
3223
3235
  }
3224
- function Mn(e) {
3236
+ function vn(e) {
3225
3237
  return e.map(
3226
- ({ measure: t, style: r }) => r ? g({ column: t }, r) : t
3238
+ ({ measure: t, style: r }) => r ? y({ column: t }, r) : t
3227
3239
  );
3228
3240
  }
3229
- function Bt(e) {
3241
+ function zt(e) {
3230
3242
  return Array.isArray(e) ? e : [e];
3231
3243
  }
3232
3244
  function he(e) {
3233
- return (t) => F(g({}, t), {
3245
+ return (t) => A(y({}, t), {
3234
3246
  category: "dataOptions",
3235
3247
  index: e
3236
3248
  });
3237
3249
  }
3238
- function ee(e, t, r, s, n) {
3239
- const i = t ? Bt(
3250
+ function re(e, t, r, s, n) {
3251
+ const i = t ? zt(
3240
3252
  t
3241
3253
  ) : [];
3242
3254
  if (i.length === 0)
3243
3255
  return [];
3244
3256
  if (r === "dimension") {
3245
- const a = w(
3246
- () => wt({
3257
+ const o = w(
3258
+ () => Tt({
3247
3259
  data: i,
3248
3260
  context: s
3249
3261
  }),
3250
3262
  n,
3251
3263
  he(e)
3252
3264
  );
3253
- return a !== null ? On(a) : null;
3265
+ return o !== null ? Nn(o) : null;
3254
3266
  }
3255
- const o = w(
3256
- () => Mt({
3267
+ const a = w(
3268
+ () => Pt({
3257
3269
  data: i,
3258
3270
  context: s
3259
3271
  }),
3260
3272
  n,
3261
3273
  he(e)
3262
3274
  );
3263
- return o !== null ? Mn(o) : null;
3275
+ return a !== null ? vn(a) : null;
3264
3276
  }
3265
- function Ze(e, t, r) {
3277
+ function Xe(e, t, r) {
3266
3278
  const s = Array.isArray(t) ? t : t != null ? [t] : [];
3267
3279
  if (r === "dimension") {
3268
- const i = Re(
3280
+ const i = Ne(
3269
3281
  s
3270
3282
  );
3271
3283
  return i.success ? { success: !0, data: i.data } : {
3272
3284
  success: !1,
3273
- errors: i.errors.map((o) => F(g({}, o), {
3285
+ errors: i.errors.map((a) => A(y({}, a), {
3274
3286
  category: "dataOptions",
3275
3287
  index: e
3276
3288
  }))
3277
3289
  };
3278
3290
  }
3279
- const n = Be(s);
3291
+ const n = Ie(s);
3280
3292
  return n.success ? { success: !0, data: n.data } : {
3281
3293
  success: !1,
3282
- errors: n.errors.map((i) => F(g({}, i), {
3294
+ errors: n.errors.map((i) => A(y({}, i), {
3283
3295
  category: "dataOptions",
3284
3296
  index: e
3285
3297
  }))
3286
3298
  };
3287
3299
  }
3288
- function vn(e, t) {
3300
+ function Rn(e, t) {
3289
3301
  let r;
3290
- T(e) && "column" in e && (r = e.column);
3291
- const n = !(E(e) || r !== void 0 && E(r)) ? "dimension" : "measure", i = [], o = ee("columns", [e], n, t, i);
3292
- return o !== null ? { success: !0, data: o } : { success: !1, errors: i };
3302
+ S(e) && "column" in e && (r = e.column);
3303
+ const n = !(q(e) || r !== void 0 && q(r)) ? "dimension" : "measure", i = [], a = re("columns", [e], n, t, i);
3304
+ return a !== null ? { success: !0, data: a } : { success: !1, errors: i };
3293
3305
  }
3294
- function Nn(e, t, r, s) {
3306
+ function In(e, t, r, s) {
3295
3307
  const n = [];
3296
3308
  for (const i of e) {
3297
- const o = w(
3298
- () => vn(i, t),
3309
+ const a = w(
3310
+ () => Rn(i, t),
3299
3311
  r,
3300
3312
  s
3301
3313
  );
3302
- o && n.push(...o);
3314
+ a && n.push(...a);
3303
3315
  }
3304
3316
  return n;
3305
3317
  }
3306
- function Rn(e, t, r) {
3307
- if (!e || !T(e))
3318
+ function Pn(e, t, r) {
3319
+ if (!e || !S(e))
3308
3320
  return r.push({
3309
3321
  category: "dataOptions",
3310
3322
  index: -1,
3311
3323
  input: e,
3312
3324
  message: "dataOptions is required"
3313
3325
  }), null;
3314
- const s = {}, { chartType: n } = t, i = r.length, o = e, a = Object.keys(e), u = /* @__PURE__ */ new Map();
3315
- for (const l of a)
3316
- if (!le.has(l)) {
3317
- const f = M(l, [...le], (p) => p), h = f && f.distance <= x ? ` Did you mean '${f.best}'?` : "";
3318
- f && f.distance <= x && u.set(l, f.best), r.push({
3326
+ const s = {}, { chartType: n } = t, i = r.length, a = e, o = Object.keys(e), u = /* @__PURE__ */ new Map();
3327
+ for (const c of o)
3328
+ if (!fe.has(c)) {
3329
+ const d = v(c, [...fe], (g) => g), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
3330
+ d && d.distance <= x && u.set(c, d.best), r.push({
3319
3331
  category: "dataOptions",
3320
- index: l,
3321
- input: o[l],
3322
- message: `Unknown dataOptions key '${l}'.${h}`
3332
+ index: c,
3333
+ input: a[c],
3334
+ message: `Unknown dataOptions key '${c}'.${b}`
3323
3335
  });
3324
3336
  }
3325
- const c = n ? Tn(n) : void 0;
3326
- if (c) {
3327
- for (const l of a)
3328
- if (l !== "seriesToColorMap" && !c.validAxes.has(l) && le.has(l)) {
3329
- const f = M(l, [...c.validAxes], (d) => d), h = f && f.distance <= x ? ` Did you mean '${f.best}'?` : "", p = [...c.validAxes].join(", ");
3337
+ const l = n ? On(n) : void 0;
3338
+ if (l) {
3339
+ for (const c of o)
3340
+ if (c !== "seriesToColorMap" && !l.validAxes.has(c) && fe.has(c)) {
3341
+ const d = v(c, [...l.validAxes], (m) => m), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "", g = [...l.validAxes].join(", ");
3330
3342
  r.push({
3331
3343
  category: "dataOptions",
3332
- index: l,
3333
- input: o[l],
3334
- message: `Axis '${l}' is not valid for chart type '${n}'. Valid axes: ${p}.${h}`
3344
+ index: c,
3345
+ input: a[c],
3346
+ message: `Axis '${c}' is not valid for chart type '${n}'. Valid axes: ${g}.${b}`
3335
3347
  });
3336
3348
  }
3337
- for (const l of c.requiredAxes)
3338
- [...u.values()].includes(l) || (!(l in o) || o[l] == null) && r.push({
3349
+ for (const c of l.requiredAxes)
3350
+ [...u.values()].includes(c) || (!(c in a) || a[c] == null) && r.push({
3339
3351
  category: "dataOptions",
3340
- index: l,
3352
+ index: c,
3341
3353
  input: null,
3342
- message: `Chart type '${n}' requires '${c.requiredAxes.join(
3354
+ message: `Chart type '${n}' requires '${l.requiredAxes.join(
3343
3355
  "' and '"
3344
- )}'. Missing: ${l}.`
3356
+ )}'. Missing: ${c}.`
3345
3357
  });
3346
3358
  n === "indicator" && (["value", "secondary", "min", "max"].some(
3347
- (h) => h in o && o[h] != null
3359
+ (b) => b in a && a[b] != null
3348
3360
  ) || r.push({
3349
3361
  category: "dataOptions",
3350
3362
  index: -1,
@@ -3359,77 +3371,77 @@ function Rn(e, t, r) {
3359
3371
  }
3360
3372
  if (r.length > i)
3361
3373
  return null;
3362
- const m = Object.entries(e);
3363
- for (const [l, f] of m) {
3364
- if (!f) continue;
3365
- if (l === "seriesToColorMap") {
3366
- s[l] = f;
3374
+ const p = Object.entries(e);
3375
+ for (const [c, d] of p) {
3376
+ if (!d) continue;
3377
+ if (c === "seriesToColorMap") {
3378
+ s[c] = d;
3367
3379
  continue;
3368
3380
  }
3369
- if (l === "columns") {
3370
- s[l] = Nn(
3371
- Bt(f),
3381
+ if (c === "columns") {
3382
+ s[c] = In(
3383
+ zt(d),
3372
3384
  t,
3373
3385
  r,
3374
3386
  he("columns")
3375
3387
  );
3376
3388
  continue;
3377
3389
  }
3378
- const h = Dn(l, f, n) ? "dimension" : "measure", p = ee(
3379
- l,
3380
- f,
3381
- h,
3390
+ const b = Dn(c, d, n) ? "dimension" : "measure", g = re(
3391
+ c,
3392
+ d,
3393
+ b,
3382
3394
  t,
3383
3395
  r
3384
3396
  );
3385
- if (p !== null) {
3386
- const d = n === "calendar-heatmap" && l === "value";
3387
- s[l] = d || !Array.isArray(f) ? p[0] : p;
3397
+ if (g !== null) {
3398
+ const m = n === "calendar-heatmap" && c === "value";
3399
+ s[c] = m || !Array.isArray(d) ? g[0] : g;
3388
3400
  }
3389
3401
  }
3390
3402
  return r.length > i ? null : s;
3391
3403
  }
3392
- function In(e) {
3404
+ function kn(e) {
3393
3405
  if (typeof e != "string") return "iqr";
3394
3406
  const t = e.split("/")[1];
3395
3407
  return t === "iqr" || t === "extremums" || t === "standardDeviation" ? t : "iqr";
3396
3408
  }
3397
- const Gn = (e) => {
3398
- var d;
3399
- const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = Sn(t);
3400
- if (o.length > 0)
3401
- return { success: !1, errors: o };
3402
- const a = i.chartType, u = xe(n), c = [];
3403
- let m = Rn(
3409
+ const Qn = (e) => {
3410
+ var m;
3411
+ const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: a } = Mn(t);
3412
+ if (a.length > 0)
3413
+ return { success: !1, errors: a };
3414
+ const o = i.chartType, u = qe(n), l = [];
3415
+ let p = Pn(
3404
3416
  i.dataOptions,
3405
- { dataSource: s, schemaIndex: u, chartType: a },
3406
- c
3417
+ { dataSource: s, schemaIndex: u, chartType: o },
3418
+ l
3407
3419
  );
3408
- if (a === "boxplot" && m) {
3409
- const b = In((d = i.styleOptions) == null ? void 0 : d.subtype), A = b === "iqr" || b === "standardDeviation";
3410
- m = F(g({}, m), { boxType: b, outliersEnabled: A });
3420
+ if (o === "boxplot" && p) {
3421
+ const F = kn((m = i.styleOptions) == null ? void 0 : m.subtype), C = F === "iqr" || F === "standardDeviation";
3422
+ p = A(y({}, p), { boxType: F, outliersEnabled: C });
3411
3423
  }
3412
- let l = null;
3413
- i.filters && i.filters.length > 0 && (l = w(
3414
- () => Oe({
3424
+ let c = null;
3425
+ i.filters && i.filters.length > 0 && (c = w(
3426
+ () => De({
3415
3427
  data: i.filters || [],
3416
3428
  context: { dataSource: s, schemaIndex: u }
3417
3429
  }),
3418
- c
3430
+ l
3419
3431
  ));
3420
- let f = null;
3421
- if (i.highlights && i.highlights.length > 0 && (f = w(
3432
+ let d = null;
3433
+ if (i.highlights && i.highlights.length > 0 && (d = w(
3422
3434
  () => Me({
3423
3435
  data: i.highlights || [],
3424
3436
  context: { dataSource: s, schemaIndex: u }
3425
3437
  }),
3426
- c
3427
- )), c.length > 0 || m === null)
3438
+ l
3439
+ )), l.length > 0 || p === null)
3428
3440
  return {
3429
3441
  success: !1,
3430
- errors: c
3442
+ errors: l
3431
3443
  };
3432
- if (!kt(i.chartType))
3444
+ if (!Bt(i.chartType))
3433
3445
  return {
3434
3446
  success: !1,
3435
3447
  errors: [
@@ -3441,19 +3453,19 @@ const Gn = (e) => {
3441
3453
  }
3442
3454
  ]
3443
3455
  };
3444
- const h = i.chartType;
3456
+ const b = i.chartType;
3445
3457
  return {
3446
3458
  success: !0,
3447
- data: g(g(g({
3459
+ data: y(y(y({
3448
3460
  dataSet: Fe(s),
3449
- chartType: h,
3450
- dataOptions: m
3461
+ chartType: b,
3462
+ dataOptions: p
3451
3463
  }, i.styleOptions && {
3452
3464
  // Pass-through NLQ JSON; shape matches ChartStyleOptions.
3453
3465
  styleOptions: i.styleOptions
3454
- }), l && { filters: l }), f && { highlights: f })
3466
+ }), c && { filters: c }), d && { highlights: d })
3455
3467
  };
3456
- }, Qn = (e) => {
3468
+ }, Xn = (e) => {
3457
3469
  const t = [];
3458
3470
  if (!e.chartType)
3459
3471
  return {
@@ -3480,12 +3492,12 @@ const Gn = (e) => {
3480
3492
  ]
3481
3493
  };
3482
3494
  let r = null;
3483
- const s = kn(e.dataOptions);
3495
+ const s = Bn(e.dataOptions);
3484
3496
  s.success ? r = s.data : t.push(...s.errors);
3485
3497
  let n;
3486
3498
  if (e.filters) {
3487
3499
  const u = w(
3488
- () => Ie(e.filters),
3500
+ () => ve(e.filters),
3489
3501
  t
3490
3502
  );
3491
3503
  n = u != null ? u : void 0;
@@ -3493,14 +3505,14 @@ const Gn = (e) => {
3493
3505
  let i;
3494
3506
  if (e.highlights && e.highlights.length > 0) {
3495
3507
  const u = w(
3496
- () => ke(e.highlights),
3508
+ () => Re(e.highlights),
3497
3509
  t
3498
3510
  );
3499
3511
  i = u != null ? u : void 0;
3500
3512
  }
3501
3513
  if (t.length > 0 || r === null)
3502
3514
  return { success: !1, errors: t };
3503
- const o = g(g(g({
3515
+ const a = y(y(y({
3504
3516
  chartType: e.chartType,
3505
3517
  dataOptions: r
3506
3518
  }, e.styleOptions && {
@@ -3509,11 +3521,11 @@ const Gn = (e) => {
3509
3521
  return {
3510
3522
  success: !0,
3511
3523
  data: Q(
3512
- o
3524
+ a
3513
3525
  )
3514
3526
  };
3515
3527
  };
3516
- function kn(e) {
3528
+ function Bn(e) {
3517
3529
  const t = {}, r = [], s = /* @__PURE__ */ new Set(["seriesToColorMap", "boxType", "outliersEnabled", "valueTitle"]);
3518
3530
  for (const [n, i] of Object.entries(e)) {
3519
3531
  if (n === "seriesToColorMap" && i) {
@@ -3524,29 +3536,29 @@ function kn(e) {
3524
3536
  i != null && (t[n] = i);
3525
3537
  continue;
3526
3538
  }
3527
- const o = Array.isArray(i) ? i : [i], a = Array.isArray(i), u = [], c = [];
3528
- for (let m = 0; m < o.length; m++) {
3529
- const l = o[m], h = Bn(l) ? Re([
3530
- l
3531
- ]) : Be([l]);
3532
- h.success ? u.push(...h.data) : h.errors.forEach((p) => {
3533
- var d;
3534
- c.push(F(g({}, p), { index: m, input: (d = p.input) != null ? d : l }));
3539
+ const a = Array.isArray(i) ? i : [i], o = Array.isArray(i), u = [], l = [];
3540
+ for (let p = 0; p < a.length; p++) {
3541
+ const c = a[p], b = zn(c) ? Ne([
3542
+ c
3543
+ ]) : Ie([c]);
3544
+ b.success ? u.push(...b.data) : b.errors.forEach((g) => {
3545
+ var m;
3546
+ l.push(A(y({}, g), { index: p, input: (m = g.input) != null ? m : c }));
3535
3547
  });
3536
3548
  }
3537
- if (c.length > 0) {
3538
- r.push(...c);
3549
+ if (l.length > 0) {
3550
+ r.push(...l);
3539
3551
  continue;
3540
3552
  }
3541
- t[n] = a ? u : u[0];
3553
+ t[n] = o ? u : u[0];
3542
3554
  }
3543
3555
  return r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
3544
3556
  }
3545
- function Bn(e) {
3557
+ function zn(e) {
3546
3558
  const t = Array.isArray(e) ? e[0] : e;
3547
- if (!t || !T(t))
3559
+ if (!t || !S(t))
3548
3560
  return !0;
3549
- const r = "column" in t && t.column != null && T(t.column) ? t.column : t;
3561
+ const r = "column" in t && t.column != null && S(t.column) ? t.column : t;
3550
3562
  if ("composeCode" in r) {
3551
3563
  const s = r.composeCode;
3552
3564
  if (typeof s == "string" && s.startsWith("DM."))
@@ -3561,17 +3573,17 @@ function Bn(e) {
3561
3573
  }
3562
3574
  return !("aggregation" in r || "attribute" in r && "aggregation" in r);
3563
3575
  }
3564
- const et = ["rows", "columns", "values", "grandTotals"];
3565
- function zn(e) {
3566
- if (!T(e)) return !1;
3576
+ const Ze = ["rows", "columns", "values", "grandTotals"];
3577
+ function Ln(e) {
3578
+ if (!S(e)) return !1;
3567
3579
  const t = Object.keys(e);
3568
3580
  return t.every((r) => r === "rows" || r === "columns") && t.every((r) => typeof e[r] == "boolean");
3569
3581
  }
3570
- function Pn(e) {
3582
+ function Un(e) {
3571
3583
  const t = [], r = {
3572
3584
  dataOptions: {}
3573
3585
  };
3574
- if (!T(e))
3586
+ if (!S(e))
3575
3587
  return t.push({
3576
3588
  category: "dataOptions",
3577
3589
  index: -1,
@@ -3580,37 +3592,37 @@ function Pn(e) {
3580
3592
  }), { normalized: r, errors: t };
3581
3593
  const s = e.dataOptions;
3582
3594
  if (s === void 0) {
3583
- const n = Object.keys(e), i = M("dataOptions", n, (u) => u), o = i && i.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${i.best}')` : "", a = i && i.distance <= x ? { [i.best]: e[i.best] } : e;
3595
+ const n = Object.keys(e), i = v("dataOptions", n, (u) => u), a = i && i.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${i.best}')` : "", o = i && i.distance <= x ? { [i.best]: e[i.best] } : e;
3584
3596
  t.push({
3585
3597
  category: "dataOptions",
3586
3598
  index: -1,
3587
- input: a,
3588
- message: `dataOptions is required.${o}`
3599
+ input: o,
3600
+ message: `dataOptions is required.${a}`
3589
3601
  });
3590
- } else if (T(s)) {
3602
+ } else if (S(s)) {
3591
3603
  const n = s;
3592
3604
  r.dataOptions = n;
3593
- for (const o of Object.keys(n))
3594
- if (!et.includes(o)) {
3595
- const a = M(o, [...et], (c) => c), u = a && a.distance <= x ? ` Did you mean '${a.best}'?` : "";
3605
+ for (const a of Object.keys(n))
3606
+ if (!Ze.includes(a)) {
3607
+ const o = v(a, [...Ze], (l) => l), u = o && o.distance <= x ? ` Did you mean '${o.best}'?` : "";
3596
3608
  t.push({
3597
3609
  category: "dataOptions",
3598
- index: o,
3599
- input: n[o],
3600
- message: `Unknown dataOptions key '${o}'. Valid keys: rows, columns, values, grandTotals.${u}`
3610
+ index: a,
3611
+ input: n[a],
3612
+ message: `Unknown dataOptions key '${a}'. Valid keys: rows, columns, values, grandTotals.${u}`
3601
3613
  });
3602
3614
  }
3603
- for (const o of ["rows", "columns", "values"]) {
3604
- const a = n[o];
3605
- a != null && !Array.isArray(a) && t.push({
3615
+ for (const a of ["rows", "columns", "values"]) {
3616
+ const o = n[a];
3617
+ o != null && !Array.isArray(o) && t.push({
3606
3618
  category: "dataOptions",
3607
- index: o,
3608
- input: a,
3609
- message: `dataOptions.${o} must be an array`
3619
+ index: a,
3620
+ input: o,
3621
+ message: `dataOptions.${a} must be an array`
3610
3622
  });
3611
3623
  }
3612
3624
  const i = n.grandTotals;
3613
- i != null && !zn(i) && t.push({
3625
+ i != null && !Ln(i) && t.push({
3614
3626
  category: "dataOptions",
3615
3627
  index: "grandTotals",
3616
3628
  input: i,
@@ -3619,7 +3631,7 @@ function Pn(e) {
3619
3631
  }
3620
3632
  return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
3621
3633
  }
3622
- function Ln(e, t, r) {
3634
+ function _n(e, t, r) {
3623
3635
  if (!e || typeof e != "object")
3624
3636
  return r.push({
3625
3637
  category: "dataOptions",
@@ -3628,17 +3640,17 @@ function Ln(e, t, r) {
3628
3640
  message: "dataOptions is required"
3629
3641
  }), null;
3630
3642
  const s = {}, n = r.length;
3631
- for (const o of ["rows", "columns"]) {
3632
- const a = ee(
3633
- o,
3634
- e[o],
3643
+ for (const a of ["rows", "columns"]) {
3644
+ const o = re(
3645
+ a,
3646
+ e[a],
3635
3647
  "dimension",
3636
3648
  t,
3637
3649
  r
3638
3650
  );
3639
- a && (s[o] = a);
3651
+ o && (s[a] = o);
3640
3652
  }
3641
- const i = ee(
3653
+ const i = re(
3642
3654
  "values",
3643
3655
  e.values,
3644
3656
  "measure",
@@ -3647,41 +3659,41 @@ function Ln(e, t, r) {
3647
3659
  );
3648
3660
  return i && (s.values = i), e.grandTotals !== void 0 && (s.grandTotals = e.grandTotals), r.length > n ? null : s;
3649
3661
  }
3650
- const Hn = (e) => {
3651
- const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = Pn(t);
3652
- if (o.length > 0)
3653
- return { success: !1, errors: o };
3654
- const a = xe(n), u = [], c = Ln(
3662
+ const Zn = (e) => {
3663
+ const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: a } = Un(t);
3664
+ if (a.length > 0)
3665
+ return { success: !1, errors: a };
3666
+ const o = qe(n), u = [], l = _n(
3655
3667
  i.dataOptions,
3656
- { dataSource: s, schemaIndex: a },
3668
+ { dataSource: s, schemaIndex: o },
3657
3669
  u
3658
3670
  );
3659
- let m = null;
3660
- i.filters && i.filters.length > 0 && (m = w(
3661
- () => Oe({
3671
+ let p = null;
3672
+ i.filters && i.filters.length > 0 && (p = w(
3673
+ () => De({
3662
3674
  data: i.filters || [],
3663
- context: { dataSource: s, schemaIndex: a }
3675
+ context: { dataSource: s, schemaIndex: o }
3664
3676
  }),
3665
3677
  u
3666
3678
  ));
3667
- let l = null;
3668
- return i.highlights && i.highlights.length > 0 && (l = w(
3679
+ let c = null;
3680
+ return i.highlights && i.highlights.length > 0 && (c = w(
3669
3681
  () => Me({
3670
3682
  data: i.highlights || [],
3671
- context: { dataSource: s, schemaIndex: a }
3683
+ context: { dataSource: s, schemaIndex: o }
3672
3684
  }),
3673
3685
  u
3674
- )), u.length > 0 || c === null ? {
3686
+ )), u.length > 0 || l === null ? {
3675
3687
  success: !1,
3676
3688
  errors: u
3677
3689
  } : {
3678
3690
  success: !0,
3679
- data: g(g(g({
3691
+ data: y(y(y({
3680
3692
  dataSet: Fe(s),
3681
- dataOptions: c
3682
- }, i.styleOptions && { styleOptions: i.styleOptions }), m && { filters: m }), l && { highlights: l })
3693
+ dataOptions: l
3694
+ }, i.styleOptions && { styleOptions: i.styleOptions }), p && { filters: p }), c && { highlights: c })
3683
3695
  };
3684
- }, Xn = (e) => {
3696
+ }, ei = (e) => {
3685
3697
  const t = [];
3686
3698
  if (!e.dataOptions)
3687
3699
  return {
@@ -3696,49 +3708,49 @@ const Hn = (e) => {
3696
3708
  ]
3697
3709
  };
3698
3710
  const r = e.dataOptions, s = {};
3699
- for (const c of ["rows", "columns"]) {
3700
- const m = r[c];
3701
- if (m && m.length > 0) {
3702
- const l = Ze(c, m, "dimension");
3703
- l.success ? s[c] = l.data : t.push(...l.errors);
3711
+ for (const l of ["rows", "columns"]) {
3712
+ const p = r[l];
3713
+ if (p && p.length > 0) {
3714
+ const c = Xe(l, p, "dimension");
3715
+ c.success ? s[l] = c.data : t.push(...c.errors);
3704
3716
  }
3705
3717
  }
3706
3718
  const n = r.values;
3707
3719
  if (n && n.length > 0) {
3708
- const c = Ze("values", n, "measure");
3709
- c.success ? s.values = c.data : t.push(...c.errors);
3720
+ const l = Xe("values", n, "measure");
3721
+ l.success ? s.values = l.data : t.push(...l.errors);
3710
3722
  }
3711
3723
  r.grandTotals !== void 0 && (s.grandTotals = r.grandTotals);
3712
3724
  let i;
3713
3725
  if (e.filters) {
3714
- const c = w(
3715
- () => Ie(e.filters),
3726
+ const l = w(
3727
+ () => ve(e.filters),
3716
3728
  t
3717
3729
  );
3718
- i = c != null ? c : void 0;
3730
+ i = l != null ? l : void 0;
3719
3731
  }
3720
- let o;
3732
+ let a;
3721
3733
  if (e.highlights && e.highlights.length > 0) {
3722
- const c = w(
3723
- () => ke(e.highlights),
3734
+ const l = w(
3735
+ () => Re(e.highlights),
3724
3736
  t
3725
3737
  );
3726
- o = c != null ? c : void 0;
3738
+ a = l != null ? l : void 0;
3727
3739
  }
3728
3740
  if (t.length > 0)
3729
3741
  return { success: !1, errors: t };
3730
- const a = g(g(g({
3742
+ const o = y(y(y({
3731
3743
  dataOptions: s
3732
- }, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }), o && o.length > 0 && { highlights: o });
3744
+ }, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }), a && a.length > 0 && { highlights: a });
3733
3745
  return {
3734
3746
  success: !0,
3735
3747
  data: Q(
3736
- a
3748
+ o
3737
3749
  )
3738
3750
  };
3739
3751
  };
3740
- function _n(e) {
3741
- const { filters: t, relations: r } = Br(
3752
+ function Vn(e) {
3753
+ const { filters: t, relations: r } = zr(
3742
3754
  e.filters || []
3743
3755
  );
3744
3756
  return {
@@ -3751,23 +3763,23 @@ function _n(e) {
3751
3763
  // No count/offset/ungroup - these are execution concerns, not translation concerns
3752
3764
  };
3753
3765
  }
3754
- function Zn(e, t, r = !1) {
3755
- const s = _n(e), n = Ir(s, t);
3756
- return kr(n, r);
3766
+ function ti(e, t, r = !1) {
3767
+ const s = Vn(e), n = kr(s, t);
3768
+ return Br(n, r);
3757
3769
  }
3758
3770
  export {
3759
- Kn as CustomSuperJSON,
3760
- ri as EMPTY_EXPANDED_QUERY_MODEL,
3761
- si as EMPTY_SIMPLE_QUERY_MODEL,
3762
- ni as isByIdDashboardCodeParams,
3763
- ii as isByIdWidgetCodeParams,
3764
- oi as isClientSideDashboardCodeParams,
3765
- ai as isClientSideWidgetCodeParams,
3766
- Gn as translateChartFromJSON,
3767
- Qn as translateChartToJSON,
3768
- Hn as translatePivotTableFromJSON,
3769
- Xn as translatePivotTableToJSON,
3771
+ Yn as CustomSuperJSON,
3772
+ ni as EMPTY_EXPANDED_QUERY_MODEL,
3773
+ ii as EMPTY_SIMPLE_QUERY_MODEL,
3774
+ ai as isByIdDashboardCodeParams,
3775
+ oi as isByIdWidgetCodeParams,
3776
+ ui as isClientSideDashboardCodeParams,
3777
+ li as isClientSideWidgetCodeParams,
3778
+ Qn as translateChartFromJSON,
3779
+ Xn as translateChartToJSON,
3780
+ Zn as translatePivotTableFromJSON,
3781
+ ei as translatePivotTableToJSON,
3770
3782
  Jn as translateQueryFromJSON,
3771
- Yn as translateQueryToJSON,
3772
- Zn as translateQueryToJaql
3783
+ Hn as translateQueryToJSON,
3784
+ ti as translateQueryToJaql
3773
3785
  };