@sisense/sdk-ui 2.20.0 → 2.22.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 (212) hide show
  1. package/dist/ai.cjs +68 -68
  2. package/dist/ai.js +891 -845
  3. package/dist/analytics-composer/node.cjs +1 -1
  4. package/dist/analytics-composer/node.js +1002 -858
  5. package/dist/analytics-composer.cjs +23 -23
  6. package/dist/analytics-composer.js +8 -8
  7. package/dist/{dimensions-Blw0p98x.js → dimensions-BiLyFpCg.js} +1 -1
  8. package/dist/{dimensions-CgMckRe2.cjs → dimensions-X4_igtmO.cjs} +1 -1
  9. package/dist/{execute-query-VxgY3tbz.js → execute-query-BEeqqDl6.js} +1499 -1491
  10. package/dist/execute-query-DJDE0zRU.cjs +1 -0
  11. package/dist/{index-0brX9D6q.cjs → index-NyouhE_A.cjs} +1 -1
  12. package/dist/{index-Ck90GjPy.js → index-kxX21arA.js} +15 -1
  13. package/dist/index.cjs +451 -436
  14. package/dist/index.js +24710 -23005
  15. package/dist/index.umd.js +689 -624
  16. package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/common-filters-connector.d.ts +1 -1
  17. package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/selection-utils.d.ts +4 -3
  18. package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/types.d.ts +10 -0
  19. package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/use-common-filters.d.ts +1 -1
  20. package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/utils.d.ts +2 -1
  21. package/dist/packages/sdk-ui/src/domains/dashboarding/components/content-panel.d.ts +1 -1
  22. package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/components/editable-layout-row.d.ts +1 -1
  23. package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/editable-layout.d.ts +1 -1
  24. package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/helpers.d.ts +1 -1
  25. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/index.d.ts +1 -1
  26. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/translate-dashboard-utils.d.ts +8 -1
  27. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +9 -2
  28. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/index.d.ts +4 -0
  29. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +13 -0
  30. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/{use-dashboard-model-reducer.d.ts → dashboard-model-reducer/types.d.ts} +19 -36
  31. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/use-dashboard-model-reducer.d.ts +9 -0
  32. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/utils.d.ts +28 -0
  33. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/use-dashboard-persistence.d.ts +4 -4
  34. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/duplicate-widget-utils.d.ts +34 -0
  35. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/index.d.ts +2 -0
  36. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +57 -0
  37. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-config-transformers.d.ts +1 -1
  38. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-filters.d.ts +1 -1
  39. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-handlers.d.ts +1 -1
  40. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-types.d.ts +1 -1
  41. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-widget-transforms.d.ts +1 -1
  42. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-jtd-widget.d.ts +1 -1
  43. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-jtd.d.ts +1 -1
  44. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-tabber.d.ts +2 -1
  45. package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +44 -3
  46. package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +15 -3
  47. package/dist/packages/sdk-ui/src/domains/dashboarding/utils.d.ts +1 -1
  48. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-filter-tile.d.ts +13 -0
  49. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-level-filter.d.ts +11 -1
  50. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/use-cascadding-filter-tile-menu-items/use-cascadding-filter-tile-lock-menu-item.d.ts +13 -0
  51. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/use-cascadding-filter-tile-menu-items/use-cascadding-filter-tile-menu-items.d.ts +14 -0
  52. package/dist/packages/sdk-ui/src/domains/filters/components/common/reorderable-list.d.ts +32 -0
  53. package/dist/packages/sdk-ui/src/domains/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +13 -0
  54. package/dist/packages/sdk-ui/src/domains/filters/components/custom-filter-tile.d.ts +13 -0
  55. package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +13 -0
  56. package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +13 -0
  57. package/dist/packages/sdk-ui/src/domains/filters/components/{filter-tile.d.ts → filter-tile/filter-tile.d.ts} +13 -0
  58. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile/index.d.ts +1 -0
  59. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile/types.d.ts +36 -0
  60. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile-container.d.ts +12 -0
  61. package/dist/packages/sdk-ui/src/domains/filters/components/filters-panel/types.d.ts +27 -1
  62. package/dist/packages/sdk-ui/src/domains/filters/components/index.d.ts +1 -1
  63. package/dist/packages/sdk-ui/src/domains/filters/components/member-filter-tile/member-filter-tile.d.ts +13 -0
  64. package/dist/packages/sdk-ui/src/domains/filters/components/unsupported-filter-tile.d.ts +17 -1
  65. package/dist/packages/sdk-ui/src/domains/filters/shared/clone-filter-and-toggle-locked.d.ts +7 -0
  66. package/dist/packages/sdk-ui/src/domains/filters/shared/filter-tile-menu-button.d.ts +10 -0
  67. package/dist/packages/sdk-ui/src/domains/filters/shared/use-filter-tile-menu-items/use-filter-tile-lock-menu-item.d.ts +15 -0
  68. package/dist/packages/sdk-ui/src/domains/filters/shared/use-filter-tile-menu-items/use-filter-tile-menu-items.d.ts +14 -0
  69. package/dist/packages/sdk-ui/src/domains/formulas/index.d.ts +0 -1
  70. package/dist/packages/sdk-ui/src/domains/formulas/use-get-shared-formula.d.ts +20 -7
  71. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-boxplot-data-options.d.ts +2 -2
  72. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/chart-widget.d.ts +1 -1
  73. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/index.d.ts +1 -0
  74. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/types.d.ts +100 -0
  75. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/use-with-chart-widget-drilldown.d.ts +1 -1
  76. package/dist/packages/sdk-ui/src/domains/widgets/components/{common-widget.d.ts → common-widget/common-widget.d.ts} +1 -1
  77. package/dist/packages/sdk-ui/src/domains/widgets/components/common-widget/index.d.ts +2 -0
  78. package/dist/packages/sdk-ui/src/domains/widgets/components/common-widget/types.d.ts +8 -0
  79. package/dist/packages/sdk-ui/src/domains/widgets/components/{custom-widget.d.ts → custom-widget/custom-widget.d.ts} +1 -1
  80. package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/index.d.ts +2 -0
  81. package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/types.d.ts +71 -0
  82. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/index.d.ts +1 -0
  83. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/pivot-table-widget.d.ts +1 -1
  84. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/types.d.ts +141 -0
  85. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/use-with-pivot-table-widget-drilldown.d.ts +1 -1
  86. package/dist/packages/sdk-ui/src/domains/widgets/components/tabber-buttons-widget/types.d.ts +1 -1
  87. package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/index.d.ts +2 -0
  88. package/dist/packages/sdk-ui/src/domains/widgets/components/{table-widget.d.ts → table-widget/table-widget.d.ts} +1 -1
  89. package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/types.d.ts +61 -0
  90. package/dist/packages/sdk-ui/src/domains/widgets/components/text-widget/index.d.ts +2 -0
  91. package/dist/packages/sdk-ui/src/domains/widgets/components/{text-widget.d.ts → text-widget/text-widget.d.ts} +1 -1
  92. package/dist/packages/sdk-ui/src/domains/widgets/components/text-widget/types.d.ts +29 -0
  93. package/dist/packages/sdk-ui/src/domains/widgets/components/widget/index.d.ts +2 -0
  94. package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +45 -0
  95. package/dist/packages/sdk-ui/src/domains/widgets/components/{widget.d.ts → widget/widget.d.ts} +1 -1
  96. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-dashboard-filters.d.ts +425 -425
  97. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-filters.d.ts +34 -34
  98. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/index.d.ts +1 -0
  99. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +63 -0
  100. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/utils.d.ts +11 -5
  101. package/dist/packages/sdk-ui/src/domains/widgets/helpers/header-menu-utils.d.ts +9 -0
  102. package/dist/packages/sdk-ui/src/domains/widgets/helpers/index.d.ts +7 -0
  103. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-container/index.d.ts +2 -0
  104. package/dist/packages/sdk-ui/src/domains/widgets/shared/{widget-container.d.ts → widget-container/widget-container.d.ts} +7 -3
  105. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/types.d.ts +42 -0
  106. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header-info-button.d.ts +13 -0
  107. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header-toolbar.d.ts +23 -0
  108. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header.d.ts +14 -0
  109. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-menu-button.d.ts +5 -0
  110. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +8 -1
  111. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model.d.ts +1 -1
  112. package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +2 -1
  113. package/dist/packages/sdk-ui/src/infra/api/types/dashboard-dto.d.ts +2 -1
  114. package/dist/packages/sdk-ui/src/infra/app/client-application.d.ts +17 -0
  115. package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +4 -0
  116. package/dist/packages/sdk-ui/src/infra/app/settings/types/deployment-props.d.ts +2 -1
  117. package/dist/packages/sdk-ui/src/infra/app/settings/types/features.d.ts +18 -1
  118. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/types.d.ts +41 -12
  119. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-execute-custom-widget-query.d.ts +12 -3
  120. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/index.d.ts +5 -0
  121. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-context.d.ts +15 -0
  122. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-provider.d.ts +21 -0
  123. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/types.d.ts +50 -0
  124. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/validate-plugins.d.ts +9 -0
  125. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +14 -0
  126. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +14 -0
  127. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +14 -0
  128. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +14 -0
  129. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +14 -0
  130. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +14 -0
  131. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +14 -0
  132. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +14 -0
  133. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +14 -0
  134. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +14 -0
  135. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +14 -0
  136. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +14 -0
  137. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +14 -0
  138. package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +14 -0
  139. package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +28 -0
  140. package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +5 -3
  141. package/dist/packages/sdk-ui/src/modules/ai/api/narration-endpoints.d.ts +25 -0
  142. package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +1 -1
  143. package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -2
  144. package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +4 -1
  145. package/dist/packages/sdk-ui/src/modules/ai/use-get-nlq-result.d.ts +1 -1
  146. package/dist/packages/sdk-ui/src/modules/analytics-composer/common/utils.d.ts +2 -1
  147. package/dist/packages/sdk-ui/src/modules/analytics-composer/dashboard/stringify-widgets.d.ts +1 -1
  148. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-from-json.d.ts +3 -2
  149. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-to-json.d.ts +6 -6
  150. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-filters-to-json.d.ts +3 -4
  151. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-measures-from-json.d.ts +13 -28
  152. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-measures-to-json.d.ts +6 -7
  153. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +45 -0
  154. package/dist/packages/sdk-ui/src/modules/analytics-composer/types.d.ts +3 -1
  155. package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/to-widget-code.d.ts +1 -1
  156. package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/to-widget-props.d.ts +1 -1
  157. package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/widget-composer.d.ts +1 -1
  158. package/dist/packages/sdk-ui/src/props.d.ts +19 -427
  159. package/dist/packages/sdk-ui/src/public-api/internal.d.ts +4 -0
  160. package/dist/packages/sdk-ui/src/public-api/public.d.ts +7 -7
  161. package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +6 -0
  162. package/dist/packages/sdk-ui/src/shared/components/alert/alert.d.ts +91 -0
  163. package/dist/packages/sdk-ui/src/shared/components/alert/index.d.ts +2 -0
  164. package/dist/packages/sdk-ui/src/shared/components/dynamic-size-container/default-size.d.ts +6 -6
  165. package/dist/packages/sdk-ui/src/shared/components/menu/menu-button.d.ts +2 -1
  166. package/dist/packages/sdk-ui/src/shared/components/quota-notification/quota-notification.d.ts +32 -0
  167. package/dist/packages/sdk-ui/src/shared/hooks/use-app-settings.d.ts +11 -0
  168. package/dist/packages/sdk-ui/src/shared/hooks/use-quota-notification.d.ts +54 -0
  169. package/dist/packages/sdk-ui/src/shared/hooks/use-quota-warning-dismissed.d.ts +8 -0
  170. package/dist/packages/sdk-ui/src/shared/icons/warning-icon.d.ts +6 -0
  171. package/dist/packages/sdk-ui/src/shared/icons/x-circle-icon.d.ts +6 -0
  172. package/dist/packages/sdk-ui/src/shared/types/menu-item.d.ts +17 -0
  173. package/dist/packages/sdk-ui/src/types.d.ts +113 -6
  174. package/dist/{use-common-filters-B2wOzse2.js → quota-notification-D6oMJal8.js} +11177 -10827
  175. package/dist/{use-common-filters-BCebg2_K.cjs → quota-notification-z3dv2KoH.cjs} +164 -114
  176. package/dist/translations/de-de.cjs +1 -1
  177. package/dist/translations/de-de.js +16 -2
  178. package/dist/translations/en-us.cjs +1 -1
  179. package/dist/translations/en-us.js +1 -1
  180. package/dist/translations/es-ar.cjs +1 -1
  181. package/dist/translations/es-ar.js +16 -2
  182. package/dist/translations/es-es.cjs +1 -1
  183. package/dist/translations/es-es.js +16 -2
  184. package/dist/translations/fr-fr.cjs +1 -1
  185. package/dist/translations/fr-fr.js +16 -2
  186. package/dist/translations/it-it.cjs +1 -1
  187. package/dist/translations/it-it.js +16 -2
  188. package/dist/translations/ja-jp.cjs +1 -1
  189. package/dist/translations/ja-jp.js +16 -2
  190. package/dist/translations/ko-kr.cjs +1 -1
  191. package/dist/translations/ko-kr.js +16 -2
  192. package/dist/translations/nl-nl.cjs +1 -1
  193. package/dist/translations/nl-nl.js +16 -2
  194. package/dist/translations/pt-br.cjs +1 -1
  195. package/dist/translations/pt-br.js +16 -2
  196. package/dist/translations/ru-ru.cjs +1 -1
  197. package/dist/translations/ru-ru.js +16 -2
  198. package/dist/translations/tr-tr.cjs +1 -1
  199. package/dist/translations/tr-tr.js +16 -2
  200. package/dist/translations/zh-cn.cjs +1 -1
  201. package/dist/translations/zh-cn.js +16 -2
  202. package/dist/{types-YU936hyL.cjs → types-CoY6F8Ma.cjs} +1 -1
  203. package/dist/{types-tDJE6TNR.js → types-ixSwJkxM.js} +1 -1
  204. package/dist/{utils-BRCTwjTN.js → utils-BP-BglHE.js} +5797 -5781
  205. package/dist/{utils-pvzOGByh.cjs → utils-C8YMrOdw.cjs} +36 -36
  206. package/dist/{widget-composer-T6nvM6Xc.js → widget-composer-CUUFoCb9.js} +3 -3
  207. package/dist/{widget-composer-ChJ9V_fN.cjs → widget-composer-DI4sHaNe.cjs} +3 -3
  208. package/package.json +13 -10
  209. package/dist/execute-query-CgkFRn7s.cjs +0 -1
  210. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header-info-button.d.ts +0 -9
  211. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header.d.ts +0 -13
  212. /package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/{use-dasboard-model-utils.d.ts → use-dashboard-model-utils.d.ts} +0 -0
@@ -1,20 +1,20 @@
1
- var Qe = Object.defineProperty, Ye = Object.defineProperties;
2
- var He = Object.getOwnPropertyDescriptors;
3
- var pe = Object.getOwnPropertySymbols;
4
- var Ze = Object.prototype.hasOwnProperty, Ge = Object.prototype.propertyIsEnumerable;
5
- var ye = (e, r, t) => r in e ? Qe(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, b = (e, r) => {
1
+ var er = Object.defineProperty, rr = Object.defineProperties;
2
+ var tr = Object.getOwnPropertyDescriptors;
3
+ var ye = Object.getOwnPropertySymbols;
4
+ var sr = Object.prototype.hasOwnProperty, nr = Object.prototype.propertyIsEnumerable;
5
+ var ge = (e, r, t) => r in e ? er(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, g = (e, r) => {
6
6
  for (var t in r || (r = {}))
7
- Ze.call(r, t) && ye(e, t, r[t]);
8
- if (pe)
9
- for (var t of pe(r))
10
- Ge.call(r, t) && ye(e, t, r[t]);
7
+ sr.call(r, t) && ge(e, t, r[t]);
8
+ if (ye)
9
+ for (var t of ye(r))
10
+ nr.call(r, t) && ge(e, t, r[t]);
11
11
  return e;
12
- }, E = (e, r) => Ye(e, He(r));
13
- import { f as Xe, J as ve } from "../types-tDJE6TNR.js";
14
- import { b as xs, E as As, a as Ds, i as Ms, e as Ns, d as Rs } from "../types-tDJE6TNR.js";
15
- import { bW as er, bA as rr, bX as tr, bY as sr, bZ as nr, aw as se, b_ as ir, av as ar, b$ as or, b8 as ur, ax as lr, c0 as cr, bb as fr, b9 as dr, aL as mr, b7 as pr, ba as yr, d as gr, c as hr, k as br, c1 as Fr, c2 as wr, c3 as qr, c4 as Er, c5 as Cr, c6 as $r, c7 as xr, c8 as Ar, c9 as Dr, ca as Mr, cb as Nr, au as Rr, cc as Sr, cd as Or, S as Tr, h as Ir, s as ne, b as J, M as z, ce as zr, cf as Br, cg as Pr, ch as kr, ci as _r, aH as Lr, an as ge, am as Vr, a7 as Wr, cj as Jr, y as Ur, x as jr } from "../execute-query-VxgY3tbz.js";
16
- import { i as Kr, b as Qr, D as Yr, d as Hr, a as Zr } from "../dimensions-Blw0p98x.js";
17
- class Gr {
12
+ }, h = (e, r) => rr(e, tr(r));
13
+ import { f as ir, J as or } from "../types-ixSwJkxM.js";
14
+ import { b as Ws, E as js, a as Js, i as Ks, e as Gs, d as Qs } from "../types-ixSwJkxM.js";
15
+ import { bW as ar, bA as ur, bX as cr, bY as lr, bZ as fr, aw as ne, b_ as dr, av as mr, b$ as pr, b8 as yr, ax as gr, c0 as hr, bb as br, b9 as Fr, aL as wr, b7 as qr, ba as Er, d as Cr, c as $r, k as Ar, c1 as xr, c2 as Dr, c3 as Mr, c4 as Sr, c5 as Tr, c6 as Nr, c7 as Rr, c8 as Or, c9 as Ir, ca as zr, cb as Br, au as Pr, cc as kr, cd as Lr, S as ie, h as Vr, s as oe, b as W, M as I, aj as $e, bG as Ae, ce as _r, cf as Ur, cg as Wr, ch as jr, ci as Jr, aH as Kr, an as he, am as Gr, cj as xe, a6 as Qr, ck as Yr, x as Hr, v as Zr } from "../execute-query-BEeqqDl6.js";
16
+ import { i as Xr, b as vr, D as et, d as rt, a as tt } from "../dimensions-BiLyFpCg.js";
17
+ class st {
18
18
  constructor() {
19
19
  this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
20
20
  }
@@ -31,9 +31,9 @@ class Gr {
31
31
  this.keyToValue.clear(), this.valueToKey.clear();
32
32
  }
33
33
  }
34
- class Ee {
34
+ class De {
35
35
  constructor(r) {
36
- this.generateIdentifier = r, this.kv = new Gr();
36
+ this.generateIdentifier = r, this.kv = new st();
37
37
  }
38
38
  register(r, t) {
39
39
  this.kv.getByValue(r) || (t || (t = this.generateIdentifier(r)), this.kv.set(t, r));
@@ -48,7 +48,7 @@ class Ee {
48
48
  return this.kv.getByKey(r);
49
49
  }
50
50
  }
51
- class Xr extends Ee {
51
+ class nt extends De {
52
52
  constructor() {
53
53
  super((r) => r.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
54
54
  }
@@ -59,7 +59,7 @@ class Xr extends Ee {
59
59
  return this.classToAllowedProps.get(r);
60
60
  }
61
61
  }
62
- function vr(e) {
62
+ function it(e) {
63
63
  if ("values" in Object)
64
64
  return Object.values(e);
65
65
  const r = [];
@@ -67,31 +67,31 @@ function vr(e) {
67
67
  e.hasOwnProperty(t) && r.push(e[t]);
68
68
  return r;
69
69
  }
70
- function et(e, r) {
71
- const t = vr(e);
70
+ function ot(e, r) {
71
+ const t = it(e);
72
72
  if ("find" in t)
73
73
  return t.find(r);
74
74
  const s = t;
75
75
  for (let n = 0; n < s.length; n++) {
76
- const a = s[n];
77
- if (r(a))
78
- return a;
76
+ const o = s[n];
77
+ if (r(o))
78
+ return o;
79
79
  }
80
80
  }
81
- function B(e, r) {
81
+ function z(e, r) {
82
82
  Object.entries(e).forEach(([t, s]) => r(s, t));
83
83
  }
84
- function U(e, r) {
84
+ function j(e, r) {
85
85
  return e.indexOf(r) !== -1;
86
86
  }
87
- function he(e, r) {
87
+ function be(e, r) {
88
88
  for (let t = 0; t < e.length; t++) {
89
89
  const s = e[t];
90
90
  if (r(s))
91
91
  return s;
92
92
  }
93
93
  }
94
- class rt {
94
+ class at {
95
95
  constructor() {
96
96
  this.transfomers = {};
97
97
  }
@@ -99,31 +99,31 @@ class rt {
99
99
  this.transfomers[r.name] = r;
100
100
  }
101
101
  findApplicable(r) {
102
- return et(this.transfomers, (t) => t.isApplicable(r));
102
+ return ot(this.transfomers, (t) => t.isApplicable(r));
103
103
  }
104
104
  findByName(r) {
105
105
  return this.transfomers[r];
106
106
  }
107
107
  }
108
- const tt = (e) => Object.prototype.toString.call(e).slice(8, -1), Ce = (e) => typeof e == "undefined", st = (e) => e === null, k = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, G = (e) => k(e) && Object.keys(e).length === 0, N = (e) => Array.isArray(e), nt = (e) => typeof e == "string", it = (e) => typeof e == "number" && !isNaN(e), at = (e) => typeof e == "boolean", ot = (e) => e instanceof RegExp, _ = (e) => e instanceof Map, L = (e) => e instanceof Set, $e = (e) => tt(e) === "Symbol", ut = (e) => e instanceof Date && !isNaN(e.valueOf()), lt = (e) => e instanceof Error, be = (e) => typeof e == "number" && isNaN(e), ct = (e) => at(e) || st(e) || Ce(e) || it(e) || nt(e) || $e(e), ft = (e) => typeof e == "bigint", dt = (e) => e === 1 / 0 || e === -1 / 0, mt = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), pt = (e) => e instanceof URL, xe = (e) => e.replace(/\./g, "\\."), Y = (e) => e.map(String).map(xe).join("."), P = (e) => {
108
+ const ut = (e) => Object.prototype.toString.call(e).slice(8, -1), Me = (e) => typeof e == "undefined", ct = (e) => e === null, k = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, X = (e) => k(e) && Object.keys(e).length === 0, S = (e) => Array.isArray(e), lt = (e) => typeof e == "string", ft = (e) => typeof e == "number" && !isNaN(e), dt = (e) => typeof e == "boolean", mt = (e) => e instanceof RegExp, L = (e) => e instanceof Map, V = (e) => e instanceof Set, Se = (e) => ut(e) === "Symbol", pt = (e) => e instanceof Date && !isNaN(e.valueOf()), yt = (e) => e instanceof Error, Fe = (e) => typeof e == "number" && isNaN(e), gt = (e) => dt(e) || ct(e) || Me(e) || ft(e) || lt(e) || Se(e), ht = (e) => typeof e == "bigint", bt = (e) => e === 1 / 0 || e === -1 / 0, Ft = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), wt = (e) => e instanceof URL, Te = (e) => e.replace(/\./g, "\\."), Y = (e) => e.map(String).map(Te).join("."), P = (e) => {
109
109
  const r = [];
110
110
  let t = "";
111
111
  for (let n = 0; n < e.length; n++) {
112
- let a = e.charAt(n);
113
- if (a === "\\" && e.charAt(n + 1) === ".") {
112
+ let o = e.charAt(n);
113
+ if (o === "\\" && e.charAt(n + 1) === ".") {
114
114
  t += ".", n++;
115
115
  continue;
116
116
  }
117
- if (a === ".") {
117
+ if (o === ".") {
118
118
  r.push(t), t = "";
119
119
  continue;
120
120
  }
121
- t += a;
121
+ t += o;
122
122
  }
123
123
  const s = t;
124
124
  return r.push(s), r;
125
125
  };
126
- function $(e, r, t, s) {
126
+ function A(e, r, t, s) {
127
127
  return {
128
128
  isApplicable: e,
129
129
  annotation: r,
@@ -131,12 +131,12 @@ function $(e, r, t, s) {
131
131
  untransform: s
132
132
  };
133
133
  }
134
- const Ae = [
135
- $(Ce, "undefined", () => null, () => {
134
+ const Ne = [
135
+ A(Me, "undefined", () => null, () => {
136
136
  }),
137
- $(ft, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
138
- $(ut, "Date", (e) => e.toISOString(), (e) => new Date(e)),
139
- $(lt, "Error", (e, r) => {
137
+ A(ht, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
138
+ A(pt, "Date", (e) => e.toISOString(), (e) => new Date(e)),
139
+ A(yt, "Error", (e, r) => {
140
140
  const t = {
141
141
  name: e.name,
142
142
  message: e.message
@@ -150,24 +150,24 @@ const Ae = [
150
150
  t[s] = e[s];
151
151
  }), t;
152
152
  }),
153
- $(ot, "regexp", (e) => "" + e, (e) => {
153
+ A(mt, "regexp", (e) => "" + e, (e) => {
154
154
  const r = e.slice(1, e.lastIndexOf("/")), t = e.slice(e.lastIndexOf("/") + 1);
155
155
  return new RegExp(r, t);
156
156
  }),
157
- $(
158
- L,
157
+ A(
158
+ V,
159
159
  "set",
160
160
  // (sets only exist in es6+)
161
161
  // eslint-disable-next-line es5/no-es6-methods
162
162
  (e) => [...e.values()],
163
163
  (e) => new Set(e)
164
164
  ),
165
- $(_, "map", (e) => [...e.entries()], (e) => new Map(e)),
166
- $((e) => be(e) || dt(e), "number", (e) => be(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
167
- $((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
168
- $(pt, "URL", (e) => e.toString(), (e) => new URL(e))
165
+ A(L, "map", (e) => [...e.entries()], (e) => new Map(e)),
166
+ A((e) => Fe(e) || bt(e), "number", (e) => Fe(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
167
+ A((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
168
+ A(wt, "URL", (e) => e.toString(), (e) => new URL(e))
169
169
  ];
170
- function j(e, r, t, s) {
170
+ function J(e, r, t, s) {
171
171
  return {
172
172
  isApplicable: e,
173
173
  annotation: r,
@@ -175,12 +175,12 @@ function j(e, r, t, s) {
175
175
  untransform: s
176
176
  };
177
177
  }
178
- const De = j((e, r) => $e(e) ? !!r.symbolRegistry.getIdentifier(e) : !1, (e, r) => ["symbol", r.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, r, t) => {
178
+ const Re = J((e, r) => Se(e) ? !!r.symbolRegistry.getIdentifier(e) : !1, (e, r) => ["symbol", r.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, r, t) => {
179
179
  const s = t.symbolRegistry.getValue(r[1]);
180
180
  if (!s)
181
181
  throw new Error("Trying to deserialize unknown symbol");
182
182
  return s;
183
- }), yt = [
183
+ }), qt = [
184
184
  Int8Array,
185
185
  Uint8Array,
186
186
  Int16Array,
@@ -190,19 +190,19 @@ const De = j((e, r) => $e(e) ? !!r.symbolRegistry.getIdentifier(e) : !1, (e, r)
190
190
  Float32Array,
191
191
  Float64Array,
192
192
  Uint8ClampedArray
193
- ].reduce((e, r) => (e[r.name] = r, e), {}), Me = j(mt, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, r) => {
194
- const t = yt[r[1]];
193
+ ].reduce((e, r) => (e[r.name] = r, e), {}), Oe = J(Ft, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, r) => {
194
+ const t = qt[r[1]];
195
195
  if (!t)
196
196
  throw new Error("Trying to deserialize unknown typed array");
197
197
  return new t(e);
198
198
  });
199
- function Ne(e, r) {
199
+ function Ie(e, r) {
200
200
  return e != null && e.constructor ? !!r.classRegistry.getIdentifier(e.constructor) : !1;
201
201
  }
202
- const Re = j(Ne, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)], (e, r) => {
202
+ const ze = J(Ie, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)], (e, r) => {
203
203
  const t = r.classRegistry.getAllowedProps(e.constructor);
204
204
  if (!t)
205
- return b({}, e);
205
+ return g({}, e);
206
206
  const s = {};
207
207
  return t.forEach((n) => {
208
208
  s[n] = e[n];
@@ -212,49 +212,49 @@ const Re = j(Ne, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor
212
212
  if (!s)
213
213
  throw new Error(`Trying to deserialize unknown class '${r[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
214
214
  return Object.assign(Object.create(s.prototype), e);
215
- }), Se = j((e, r) => !!r.customTransformerRegistry.findApplicable(e), (e, r) => ["custom", r.customTransformerRegistry.findApplicable(e).name], (e, r) => r.customTransformerRegistry.findApplicable(e).serialize(e), (e, r, t) => {
215
+ }), Be = J((e, r) => !!r.customTransformerRegistry.findApplicable(e), (e, r) => ["custom", r.customTransformerRegistry.findApplicable(e).name], (e, r) => r.customTransformerRegistry.findApplicable(e).serialize(e), (e, r, t) => {
216
216
  const s = t.customTransformerRegistry.findByName(r[1]);
217
217
  if (!s)
218
218
  throw new Error("Trying to deserialize unknown custom value");
219
219
  return s.deserialize(e);
220
- }), gt = [Re, De, Se, Me], Fe = (e, r) => {
221
- const t = he(gt, (n) => n.isApplicable(e, r));
220
+ }), Et = [ze, Re, Be, Oe], we = (e, r) => {
221
+ const t = be(Et, (n) => n.isApplicable(e, r));
222
222
  if (t)
223
223
  return {
224
224
  value: t.transform(e, r),
225
225
  type: t.annotation(e, r)
226
226
  };
227
- const s = he(Ae, (n) => n.isApplicable(e, r));
227
+ const s = be(Ne, (n) => n.isApplicable(e, r));
228
228
  if (s)
229
229
  return {
230
230
  value: s.transform(e, r),
231
231
  type: s.annotation
232
232
  };
233
- }, Oe = {};
234
- Ae.forEach((e) => {
235
- Oe[e.annotation] = e;
233
+ }, Pe = {};
234
+ Ne.forEach((e) => {
235
+ Pe[e.annotation] = e;
236
236
  });
237
- const ht = (e, r, t) => {
238
- if (N(r))
237
+ const Ct = (e, r, t) => {
238
+ if (S(r))
239
239
  switch (r[0]) {
240
240
  case "symbol":
241
- return De.untransform(e, r, t);
242
- case "class":
243
241
  return Re.untransform(e, r, t);
242
+ case "class":
243
+ return ze.untransform(e, r, t);
244
244
  case "custom":
245
- return Se.untransform(e, r, t);
245
+ return Be.untransform(e, r, t);
246
246
  case "typed-array":
247
- return Me.untransform(e, r, t);
247
+ return Oe.untransform(e, r, t);
248
248
  default:
249
249
  throw new Error("Unknown transformation: " + r);
250
250
  }
251
251
  else {
252
- const s = Oe[r];
252
+ const s = Pe[r];
253
253
  if (!s)
254
254
  throw new Error("Unknown transformation: " + r);
255
255
  return s.untransform(e, t);
256
256
  }
257
- }, I = (e, r) => {
257
+ }, O = (e, r) => {
258
258
  if (r > e.size)
259
259
  throw new Error("index out of bounds");
260
260
  const t = e.keys();
@@ -262,23 +262,23 @@ const ht = (e, r, t) => {
262
262
  t.next(), r--;
263
263
  return t.next().value;
264
264
  };
265
- function Te(e) {
266
- if (U(e, "__proto__"))
265
+ function ke(e) {
266
+ if (j(e, "__proto__"))
267
267
  throw new Error("__proto__ is not allowed as a property");
268
- if (U(e, "prototype"))
268
+ if (j(e, "prototype"))
269
269
  throw new Error("prototype is not allowed as a property");
270
- if (U(e, "constructor"))
270
+ if (j(e, "constructor"))
271
271
  throw new Error("constructor is not allowed as a property");
272
272
  }
273
- const bt = (e, r) => {
274
- Te(r);
273
+ const $t = (e, r) => {
274
+ ke(r);
275
275
  for (let t = 0; t < r.length; t++) {
276
276
  const s = r[t];
277
- if (L(e))
278
- e = I(e, +s);
279
- else if (_(e)) {
280
- const n = +s, a = +r[++t] == 0 ? "key" : "value", i = I(e, n);
281
- switch (a) {
277
+ if (V(e))
278
+ e = O(e, +s);
279
+ else if (L(e)) {
280
+ const n = +s, o = +r[++t] == 0 ? "key" : "value", i = O(e, n);
281
+ switch (o) {
282
282
  case "key":
283
283
  e = i;
284
284
  break;
@@ -290,25 +290,25 @@ const bt = (e, r) => {
290
290
  e = e[s];
291
291
  }
292
292
  return e;
293
- }, X = (e, r, t) => {
294
- if (Te(r), r.length === 0)
293
+ }, v = (e, r, t) => {
294
+ if (ke(r), r.length === 0)
295
295
  return t(e);
296
296
  let s = e;
297
- for (let a = 0; a < r.length - 1; a++) {
298
- const i = r[a];
299
- if (N(s)) {
300
- const o = +i;
301
- s = s[o];
297
+ for (let o = 0; o < r.length - 1; o++) {
298
+ const i = r[o];
299
+ if (S(s)) {
300
+ const a = +i;
301
+ s = s[a];
302
302
  } else if (k(s))
303
303
  s = s[i];
304
- else if (L(s)) {
305
- const o = +i;
306
- s = I(s, o);
307
- } else if (_(s)) {
308
- if (a === r.length - 2)
304
+ else if (V(s)) {
305
+ const a = +i;
306
+ s = O(s, a);
307
+ } else if (L(s)) {
308
+ if (o === r.length - 2)
309
309
  break;
310
- const u = +i, l = +r[++a] == 0 ? "key" : "value", p = I(s, u);
311
- switch (l) {
310
+ const u = +i, c = +r[++o] == 0 ? "key" : "value", p = O(s, u);
311
+ switch (c) {
312
312
  case "key":
313
313
  s = p;
314
314
  break;
@@ -319,12 +319,12 @@ const bt = (e, r) => {
319
319
  }
320
320
  }
321
321
  const n = r[r.length - 1];
322
- if (N(s) ? s[+n] = t(s[+n]) : k(s) && (s[n] = t(s[n])), L(s)) {
323
- const a = I(s, +n), i = t(a);
324
- a !== i && (s.delete(a), s.add(i));
322
+ if (S(s) ? s[+n] = t(s[+n]) : k(s) && (s[n] = t(s[n])), V(s)) {
323
+ const o = O(s, +n), i = t(o);
324
+ o !== i && (s.delete(o), s.add(i));
325
325
  }
326
- if (_(s)) {
327
- const a = +r[r.length - 2], i = I(s, a);
326
+ if (L(s)) {
327
+ const o = +r[r.length - 2], i = O(s, o);
328
328
  switch (+n == 0 ? "key" : "value") {
329
329
  case "key": {
330
330
  const u = t(i);
@@ -339,157 +339,157 @@ const bt = (e, r) => {
339
339
  }
340
340
  return e;
341
341
  };
342
- function v(e, r, t = []) {
342
+ function ee(e, r, t = []) {
343
343
  if (!e)
344
344
  return;
345
- if (!N(e)) {
346
- B(e, (a, i) => v(a, r, [...t, ...P(i)]));
345
+ if (!S(e)) {
346
+ z(e, (o, i) => ee(o, r, [...t, ...P(i)]));
347
347
  return;
348
348
  }
349
349
  const [s, n] = e;
350
- n && B(n, (a, i) => {
351
- v(a, r, [...t, ...P(i)]);
350
+ n && z(n, (o, i) => {
351
+ ee(o, r, [...t, ...P(i)]);
352
352
  }), r(s, t);
353
353
  }
354
- function Ft(e, r, t) {
355
- return v(r, (s, n) => {
356
- e = X(e, n, (a) => ht(a, s, t));
354
+ function At(e, r, t) {
355
+ return ee(r, (s, n) => {
356
+ e = v(e, n, (o) => Ct(o, s, t));
357
357
  }), e;
358
358
  }
359
- function wt(e, r) {
359
+ function xt(e, r) {
360
360
  function t(s, n) {
361
- const a = bt(e, P(n));
361
+ const o = $t(e, P(n));
362
362
  s.map(P).forEach((i) => {
363
- e = X(e, i, () => a);
363
+ e = v(e, i, () => o);
364
364
  });
365
365
  }
366
- if (N(r)) {
366
+ if (S(r)) {
367
367
  const [s, n] = r;
368
- s.forEach((a) => {
369
- e = X(e, P(a), () => e);
370
- }), n && B(n, t);
368
+ s.forEach((o) => {
369
+ e = v(e, P(o), () => e);
370
+ }), n && z(n, t);
371
371
  } else
372
- B(r, t);
372
+ z(r, t);
373
373
  return e;
374
374
  }
375
- const qt = (e, r) => k(e) || N(e) || _(e) || L(e) || Ne(e, r);
376
- function Et(e, r, t) {
375
+ const Dt = (e, r) => k(e) || S(e) || L(e) || V(e) || Ie(e, r);
376
+ function Mt(e, r, t) {
377
377
  const s = t.get(e);
378
378
  s ? s.push(r) : t.set(e, [r]);
379
379
  }
380
- function Ct(e, r) {
380
+ function St(e, r) {
381
381
  const t = {};
382
382
  let s;
383
383
  return e.forEach((n) => {
384
384
  if (n.length <= 1)
385
385
  return;
386
- r || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
387
- const [a, ...i] = n;
388
- a.length === 0 ? s = i.map(Y) : t[Y(a)] = i.map(Y);
389
- }), s ? G(t) ? [s] : [s, t] : G(t) ? void 0 : t;
390
- }
391
- const Ie = (e, r, t, s, n = [], a = [], i = /* @__PURE__ */ new Map()) => {
392
- var F;
393
- const o = ct(e);
394
- if (!o) {
395
- Et(e, n, r);
396
- const d = i.get(e);
397
- if (d)
386
+ r || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
387
+ const [o, ...i] = n;
388
+ o.length === 0 ? s = i.map(Y) : t[Y(o)] = i.map(Y);
389
+ }), s ? X(t) ? [s] : [s, t] : X(t) ? void 0 : t;
390
+ }
391
+ const Le = (e, r, t, s, n = [], o = [], i = /* @__PURE__ */ new Map()) => {
392
+ var x;
393
+ const a = gt(e);
394
+ if (!a) {
395
+ Mt(e, n, r);
396
+ const f = i.get(e);
397
+ if (f)
398
398
  return s ? {
399
399
  transformedValue: null
400
- } : d;
400
+ } : f;
401
401
  }
402
- if (!qt(e, t)) {
403
- const d = Fe(e, t), f = d ? {
404
- transformedValue: d.value,
405
- annotations: [d.type]
402
+ if (!Dt(e, t)) {
403
+ const f = we(e, t), d = f ? {
404
+ transformedValue: f.value,
405
+ annotations: [f.type]
406
406
  } : {
407
407
  transformedValue: e
408
408
  };
409
- return o || i.set(e, f), f;
409
+ return a || i.set(e, d), d;
410
410
  }
411
- if (U(a, e))
411
+ if (j(o, e))
412
412
  return {
413
413
  transformedValue: null
414
414
  };
415
- const u = Fe(e, t), l = (F = u == null ? void 0 : u.value) != null ? F : e, p = N(l) ? [] : {}, m = {};
416
- B(l, (d, f) => {
417
- if (f === "__proto__" || f === "constructor" || f === "prototype")
418
- throw new Error(`Detected property ${f}. This is a prototype pollution risk, please remove it from your object.`);
419
- const w = Ie(d, r, t, s, [...n, f], [...a, e], i);
420
- p[f] = w.transformedValue, N(w.annotations) ? m[f] = w.annotations : k(w.annotations) && B(w.annotations, (T, A) => {
421
- m[xe(f) + "." + A] = T;
415
+ const u = we(e, t), c = (x = u == null ? void 0 : u.value) != null ? x : e, p = S(c) ? [] : {}, m = {};
416
+ z(c, (f, d) => {
417
+ if (d === "__proto__" || d === "constructor" || d === "prototype")
418
+ throw new Error(`Detected property ${d}. This is a prototype pollution risk, please remove it from your object.`);
419
+ const w = Le(f, r, t, s, [...n, d], [...o, e], i);
420
+ p[d] = w.transformedValue, S(w.annotations) ? m[d] = w.annotations : k(w.annotations) && z(w.annotations, ($, D) => {
421
+ m[Te(d) + "." + D] = $;
422
422
  });
423
423
  });
424
- const y = G(m) ? {
424
+ const y = X(m) ? {
425
425
  transformedValue: p,
426
426
  annotations: u ? [u.type] : void 0
427
427
  } : {
428
428
  transformedValue: p,
429
429
  annotations: u ? [u.type, m] : m
430
430
  };
431
- return o || i.set(e, y), y;
431
+ return a || i.set(e, y), y;
432
432
  };
433
- function ze(e) {
433
+ function Ve(e) {
434
434
  return Object.prototype.toString.call(e).slice(8, -1);
435
435
  }
436
- function we(e) {
437
- return ze(e) === "Array";
436
+ function qe(e) {
437
+ return Ve(e) === "Array";
438
438
  }
439
- function $t(e) {
440
- if (ze(e) !== "Object")
439
+ function Tt(e) {
440
+ if (Ve(e) !== "Object")
441
441
  return !1;
442
442
  const r = Object.getPrototypeOf(e);
443
443
  return !!r && r.constructor === Object && r === Object.prototype;
444
444
  }
445
- function xt(e, r, t, s, n) {
446
- const a = {}.propertyIsEnumerable.call(s, r) ? "enumerable" : "nonenumerable";
447
- a === "enumerable" && (e[r] = t), n && a === "nonenumerable" && Object.defineProperty(e, r, {
445
+ function Nt(e, r, t, s, n) {
446
+ const o = {}.propertyIsEnumerable.call(s, r) ? "enumerable" : "nonenumerable";
447
+ o === "enumerable" && (e[r] = t), n && o === "nonenumerable" && Object.defineProperty(e, r, {
448
448
  value: t,
449
449
  enumerable: !1,
450
450
  writable: !0,
451
451
  configurable: !0
452
452
  });
453
453
  }
454
- function ee(e, r = {}) {
455
- if (we(e))
456
- return e.map((n) => ee(n, r));
457
- if (!$t(e))
454
+ function re(e, r = {}) {
455
+ if (qe(e))
456
+ return e.map((n) => re(n, r));
457
+ if (!Tt(e))
458
458
  return e;
459
459
  const t = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
460
- return [...t, ...s].reduce((n, a) => {
461
- if (we(r.props) && !r.props.includes(a))
460
+ return [...t, ...s].reduce((n, o) => {
461
+ if (qe(r.props) && !r.props.includes(o))
462
462
  return n;
463
- const i = e[a], o = ee(i, r);
464
- return xt(n, a, o, e, r.nonenumerable), n;
463
+ const i = e[o], a = re(i, r);
464
+ return Nt(n, o, a, e, r.nonenumerable), n;
465
465
  }, {});
466
466
  }
467
- class c {
467
+ class l {
468
468
  /**
469
469
  * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
470
470
  */
471
471
  constructor({ dedupe: r = !1 } = {}) {
472
- this.classRegistry = new Xr(), this.symbolRegistry = new Ee((t) => {
472
+ this.classRegistry = new nt(), this.symbolRegistry = new De((t) => {
473
473
  var s;
474
474
  return (s = t.description) != null ? s : "";
475
- }), this.customTransformerRegistry = new rt(), this.allowedErrorProps = [], this.dedupe = r;
475
+ }), this.customTransformerRegistry = new at(), this.allowedErrorProps = [], this.dedupe = r;
476
476
  }
477
477
  serialize(r) {
478
- const t = /* @__PURE__ */ new Map(), s = Ie(r, t, this, this.dedupe), n = {
478
+ const t = /* @__PURE__ */ new Map(), s = Le(r, t, this, this.dedupe), n = {
479
479
  json: s.transformedValue
480
480
  };
481
- s.annotations && (n.meta = E(b({}, n.meta), {
481
+ s.annotations && (n.meta = h(g({}, n.meta), {
482
482
  values: s.annotations
483
483
  }));
484
- const a = Ct(t, this.dedupe);
485
- return a && (n.meta = E(b({}, n.meta), {
486
- referentialEqualities: a
484
+ const o = St(t, this.dedupe);
485
+ return o && (n.meta = h(g({}, n.meta), {
486
+ referentialEqualities: o
487
487
  })), n;
488
488
  }
489
489
  deserialize(r) {
490
490
  const { json: t, meta: s } = r;
491
- let n = ee(t);
492
- return s != null && s.values && (n = Ft(n, s.values, this)), s != null && s.referentialEqualities && (n = wt(n, s.referentialEqualities)), n;
491
+ let n = re(t);
492
+ return s != null && s.values && (n = At(n, s.values, this)), s != null && s.referentialEqualities && (n = xt(n, s.referentialEqualities)), n;
493
493
  }
494
494
  stringify(r) {
495
495
  return JSON.stringify(this.serialize(r));
@@ -504,7 +504,7 @@ class c {
504
504
  this.symbolRegistry.register(r, t);
505
505
  }
506
506
  registerCustom(r, t) {
507
- this.customTransformerRegistry.register(b({
507
+ this.customTransformerRegistry.register(g({
508
508
  name: t
509
509
  }, r));
510
510
  }
@@ -512,156 +512,156 @@ class c {
512
512
  this.allowedErrorProps.push(...r);
513
513
  }
514
514
  }
515
- c.defaultInstance = new c();
516
- c.serialize = c.defaultInstance.serialize.bind(c.defaultInstance);
517
- c.deserialize = c.defaultInstance.deserialize.bind(c.defaultInstance);
518
- c.stringify = c.defaultInstance.stringify.bind(c.defaultInstance);
519
- c.parse = c.defaultInstance.parse.bind(c.defaultInstance);
520
- c.registerClass = c.defaultInstance.registerClass.bind(c.defaultInstance);
521
- c.registerSymbol = c.defaultInstance.registerSymbol.bind(c.defaultInstance);
522
- c.registerCustom = c.defaultInstance.registerCustom.bind(c.defaultInstance);
523
- c.allowErrorProps = c.defaultInstance.allowErrorProps.bind(c.defaultInstance);
524
- const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem, e.type), ie = (e) => new gr(
515
+ l.defaultInstance = new l();
516
+ l.serialize = l.defaultInstance.serialize.bind(l.defaultInstance);
517
+ l.deserialize = l.defaultInstance.deserialize.bind(l.defaultInstance);
518
+ l.stringify = l.defaultInstance.stringify.bind(l.defaultInstance);
519
+ l.parse = l.defaultInstance.parse.bind(l.defaultInstance);
520
+ l.registerClass = l.defaultInstance.registerClass.bind(l.defaultInstance);
521
+ l.registerSymbol = l.defaultInstance.registerSymbol.bind(l.defaultInstance);
522
+ l.registerCustom = l.defaultInstance.registerCustom.bind(l.defaultInstance);
523
+ l.allowErrorProps = l.defaultInstance.allowErrorProps.bind(l.defaultInstance);
524
+ const R = (e) => e === void 0 ? ie.None : e, Rt = (e) => new or(e.metadataItem, e.type), ae = (e) => new Cr(
525
525
  e.name,
526
526
  e.expression,
527
527
  e.type,
528
528
  e.description,
529
- O(e.sort),
529
+ R(e.sort),
530
530
  e.dataSource,
531
531
  e.composeCode
532
- ), ae = (e) => new hr(
532
+ ), ue = (e) => new $r(
533
533
  e.name,
534
534
  e.expression,
535
535
  e.granularity,
536
536
  e.format,
537
537
  e.description,
538
- O(e.sort),
538
+ R(e.sort),
539
539
  e.dataSource,
540
540
  e.composeCode
541
541
  ), q = (e) => {
542
542
  switch (e.__serializable) {
543
543
  case "DimensionalAttribute":
544
- return ie(e);
545
- case "DimensionalLevelAttribute":
546
544
  return ae(e);
545
+ case "DimensionalLevelAttribute":
546
+ return ue(e);
547
547
  default:
548
548
  return e;
549
549
  }
550
- }, Be = (e) => new Yr(
550
+ }, _e = (e) => new et(
551
551
  e.name,
552
552
  e.expression,
553
553
  e.attributes.map(q),
554
- e.dimensions.map(Dt),
554
+ e.dimensions.map(Ot),
555
555
  e.type,
556
556
  e.description,
557
- O(e.sort),
557
+ R(e.sort),
558
558
  e.dataSource,
559
559
  e.composeCode,
560
560
  e.defaultAttribute ? q(e.defaultAttribute) : void 0
561
- ), Pe = (e) => new Hr(
561
+ ), Ue = (e) => new rt(
562
562
  e.name,
563
563
  e.expression,
564
564
  e.description,
565
- O(e.sort),
565
+ R(e.sort),
566
566
  e.dataSource,
567
567
  e.composeCode
568
- ), Dt = (e) => {
568
+ ), Ot = (e) => {
569
569
  switch (e.__serializable) {
570
570
  case "DimensionalDimension":
571
- return Be(e);
571
+ return _e(e);
572
572
  case "DimensionalDateDimension":
573
- return Pe(e);
573
+ return Ue(e);
574
574
  default:
575
575
  return e;
576
576
  }
577
- }, oe = (e) => new br(
577
+ }, ce = (e) => new Ar(
578
578
  e.name,
579
579
  q(e.attribute),
580
580
  e.aggregation,
581
581
  e.format,
582
582
  e.description,
583
- O(e.sort),
583
+ R(e.sort),
584
584
  e.dataSource,
585
585
  e.composeCode
586
- ), ue = (e) => {
586
+ ), le = (e) => {
587
587
  const r = Object.fromEntries(
588
588
  Object.entries(e.context).map(([t, s]) => {
589
589
  if (s && typeof s == "object" && "__serializable" in s)
590
590
  switch (s.__serializable) {
591
591
  case "DimensionalAttribute":
592
- return [t, ie(s)];
593
- case "DimensionalLevelAttribute":
594
592
  return [t, ae(s)];
593
+ case "DimensionalLevelAttribute":
594
+ return [t, ue(s)];
595
595
  case "DimensionalBaseMeasure":
596
- return [t, oe(s)];
596
+ return [t, ce(s)];
597
597
  case "DimensionalCalculatedMeasure":
598
- return [t, ue(s)];
598
+ return [t, le(s)];
599
599
  default:
600
600
  return [t, s];
601
601
  }
602
602
  return [t, s];
603
603
  })
604
604
  );
605
- return new Fr(
605
+ return new xr(
606
606
  e.name,
607
607
  e.expression,
608
608
  r,
609
609
  e.format,
610
610
  e.description,
611
- O(e.sort),
611
+ R(e.sort),
612
612
  e.dataSource,
613
613
  e.composeCode
614
614
  );
615
- }, ke = (e) => new wr(
615
+ }, We = (e) => new Dr(
616
616
  e.name,
617
617
  q(e.attribute),
618
618
  e.format,
619
619
  e.description,
620
- O(e.sort),
620
+ R(e.sort),
621
621
  e.dataSource,
622
622
  e.composeCode
623
623
  ), H = (e) => {
624
624
  switch (e.__serializable) {
625
625
  case "DimensionalBaseMeasure":
626
- return oe(e);
626
+ return ce(e);
627
627
  case "DimensionalCalculatedMeasure":
628
- return ue(e);
628
+ return le(e);
629
629
  case "DimensionalMeasureTemplate":
630
- return ke(e);
630
+ return We(e);
631
631
  default:
632
632
  return e;
633
633
  }
634
- }, g = (e) => {
634
+ }, b = (e) => {
635
635
  switch (e.__serializable) {
636
636
  case "MembersFilter":
637
- return new Or(
637
+ return new Lr(
638
638
  q(e.attribute),
639
639
  e.members,
640
- e.config.backgroundFilter ? E(b({}, e.config), { backgroundFilter: g(e.config.backgroundFilter) }) : e.config,
640
+ e.config.backgroundFilter ? h(g({}, e.config), { backgroundFilter: b(e.config.backgroundFilter) }) : e.config,
641
641
  e.composeCode
642
642
  );
643
643
  case "LogicalAttributeFilter":
644
- return new Sr(
645
- e.filters.map((t) => g(t)),
644
+ return new kr(
645
+ e.filters.map((t) => b(t)),
646
646
  e.operator,
647
647
  e.config,
648
648
  e.composeCode
649
649
  );
650
650
  case "CascadingFilter":
651
- return new Rr(
652
- e._filters.map((t) => g(t)),
651
+ return new Pr(
652
+ e._filters.map((t) => b(t)),
653
653
  e.config,
654
654
  e.composeCode
655
655
  );
656
656
  case "ExcludeFilter":
657
- return new Nr(
658
- g(e.filter),
659
- e.input ? g(e.input) : void 0,
657
+ return new Br(
658
+ b(e.filter),
659
+ e.input ? b(e.input) : void 0,
660
660
  e.config,
661
661
  e.composeCode
662
662
  );
663
663
  case "MeasureFilter":
664
- return new Mr(
664
+ return new zr(
665
665
  q(e.attribute),
666
666
  H(e.measure),
667
667
  e.operatorA,
@@ -672,7 +672,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
672
672
  e.composeCode
673
673
  );
674
674
  case "RankingFilter":
675
- return new Dr(
675
+ return new Ir(
676
676
  q(e.attribute),
677
677
  H(e.measure),
678
678
  e.operator,
@@ -681,7 +681,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
681
681
  e.composeCode
682
682
  );
683
683
  case "MeasureRankingFilter":
684
- return new Ar(
684
+ return new Or(
685
685
  H(e.measure),
686
686
  e.operator,
687
687
  e.count,
@@ -689,7 +689,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
689
689
  e.composeCode
690
690
  );
691
691
  case "NumericFilter":
692
- return new xr(
692
+ return new Rr(
693
693
  q(e.attribute),
694
694
  e.operatorA,
695
695
  e.valueA,
@@ -699,7 +699,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
699
699
  e.composeCode
700
700
  );
701
701
  case "TextFilter":
702
- return new $r(
702
+ return new Nr(
703
703
  q(e.attribute),
704
704
  e.operatorA,
705
705
  e.valueA,
@@ -708,7 +708,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
708
708
  );
709
709
  case "DateRangeFilter": {
710
710
  const { valueA: t, valueB: s } = e;
711
- return new Cr(
711
+ return new Tr(
712
712
  q(e.attribute),
713
713
  t,
714
714
  s,
@@ -717,7 +717,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
717
717
  );
718
718
  }
719
719
  case "RelativeDateFilter":
720
- return new Er(
720
+ return new Sr(
721
721
  q(e.attribute),
722
722
  e.offset,
723
723
  e.count,
@@ -727,7 +727,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
727
727
  e.composeCode
728
728
  );
729
729
  case "CustomFilter":
730
- return new qr(
730
+ return new Mr(
731
731
  q(e.attribute),
732
732
  e.jaqlExpression,
733
733
  e.config,
@@ -737,195 +737,199 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
737
737
  return e;
738
738
  }
739
739
  };
740
- c.registerCustom(
740
+ l.registerCustom(
741
741
  {
742
- isApplicable: Xe,
742
+ isApplicable: ir,
743
743
  serialize: (e) => e.serialize(),
744
- deserialize: (e) => At(e)
744
+ deserialize: (e) => Rt(e)
745
745
  },
746
746
  "JaqlElement"
747
747
  );
748
- c.registerCustom(
748
+ l.registerCustom(
749
749
  {
750
- isApplicable: er,
750
+ isApplicable: ar,
751
751
  serialize: (e) => e.serialize(),
752
- deserialize: (e) => ie(e)
752
+ deserialize: (e) => ae(e)
753
753
  },
754
754
  "DimensionalAttribute"
755
755
  );
756
- c.registerCustom(
756
+ l.registerCustom(
757
757
  {
758
- isApplicable: rr,
758
+ isApplicable: ur,
759
759
  serialize: (e) => e.serialize(),
760
- deserialize: (e) => ae(e)
760
+ deserialize: (e) => ue(e)
761
761
  },
762
762
  "DimensionalLevelAttribute"
763
763
  );
764
- c.registerCustom(
764
+ l.registerCustom(
765
765
  {
766
- isApplicable: Kr,
766
+ isApplicable: Xr,
767
767
  serialize: (e) => e.serialize(),
768
- deserialize: (e) => Be(e)
768
+ deserialize: (e) => _e(e)
769
769
  },
770
770
  "DimensionalDimension"
771
771
  );
772
- c.registerCustom(
772
+ l.registerCustom(
773
773
  {
774
- isApplicable: Qr,
774
+ isApplicable: vr,
775
775
  serialize: (e) => e.serialize(),
776
- deserialize: (e) => Pe(e)
776
+ deserialize: (e) => Ue(e)
777
777
  },
778
778
  "DimensionalDateDimension"
779
779
  );
780
- c.registerCustom(
780
+ l.registerCustom(
781
781
  {
782
- isApplicable: tr,
782
+ isApplicable: cr,
783
783
  serialize: (e) => e.serialize(),
784
- deserialize: (e) => oe(e)
784
+ deserialize: (e) => ce(e)
785
785
  },
786
786
  "DimensionalBaseMeasure"
787
787
  );
788
- c.registerCustom(
788
+ l.registerCustom(
789
789
  {
790
- isApplicable: sr,
790
+ isApplicable: lr,
791
791
  serialize: (e) => e.serialize(),
792
- deserialize: (e) => ue(e)
792
+ deserialize: (e) => le(e)
793
793
  },
794
794
  "DimensionalCalculatedMeasure"
795
795
  );
796
- c.registerCustom(
796
+ l.registerCustom(
797
797
  {
798
- isApplicable: nr,
798
+ isApplicable: fr,
799
799
  serialize: (e) => e.serialize(),
800
- deserialize: (e) => ke(e)
800
+ deserialize: (e) => We(e)
801
801
  },
802
802
  "DimensionalMeasureTemplate"
803
803
  );
804
- c.registerCustom(
804
+ l.registerCustom(
805
805
  {
806
- isApplicable: se,
806
+ isApplicable: ne,
807
807
  serialize: (e) => e.serialize(),
808
- deserialize: (e) => g(e)
808
+ deserialize: (e) => b(e)
809
809
  },
810
810
  "MembersFilter"
811
811
  );
812
- c.registerCustom(
812
+ l.registerCustom(
813
813
  {
814
- isApplicable: ir,
814
+ isApplicable: dr,
815
815
  serialize: (e) => e.serialize(),
816
- deserialize: (e) => g(e)
816
+ deserialize: (e) => b(e)
817
817
  },
818
818
  "LogicalAttributeFilter"
819
819
  );
820
- c.registerCustom(
820
+ l.registerCustom(
821
821
  {
822
- isApplicable: ar,
822
+ isApplicable: mr,
823
823
  serialize: (e) => e.serialize(),
824
- deserialize: (e) => g(e)
824
+ deserialize: (e) => b(e)
825
825
  },
826
826
  "CascadingFilter"
827
827
  );
828
- c.registerCustom(
828
+ l.registerCustom(
829
829
  {
830
- isApplicable: or,
830
+ isApplicable: pr,
831
831
  serialize: (e) => e.serialize(),
832
- deserialize: (e) => g(e)
832
+ deserialize: (e) => b(e)
833
833
  },
834
834
  "ExcludeFilter"
835
835
  );
836
- c.registerCustom(
836
+ l.registerCustom(
837
837
  {
838
- isApplicable: ur,
838
+ isApplicable: yr,
839
839
  serialize: (e) => e.serialize(),
840
- deserialize: (e) => g(e)
840
+ deserialize: (e) => b(e)
841
841
  },
842
842
  "MeasureFilter"
843
843
  );
844
- c.registerCustom(
844
+ l.registerCustom(
845
845
  {
846
- isApplicable: lr,
846
+ isApplicable: gr,
847
847
  serialize: (e) => e.serialize(),
848
- deserialize: (e) => g(e)
848
+ deserialize: (e) => b(e)
849
849
  },
850
850
  "RankingFilter"
851
851
  );
852
- c.registerCustom(
852
+ l.registerCustom(
853
853
  {
854
- isApplicable: cr,
854
+ isApplicable: hr,
855
855
  serialize: (e) => e.serialize(),
856
- deserialize: (e) => g(e)
856
+ deserialize: (e) => b(e)
857
857
  },
858
858
  "MeasureRankingFilter"
859
859
  );
860
- c.registerCustom(
860
+ l.registerCustom(
861
861
  {
862
- isApplicable: fr,
862
+ isApplicable: br,
863
863
  serialize: (e) => e.serialize(),
864
- deserialize: (e) => g(e)
864
+ deserialize: (e) => b(e)
865
865
  },
866
866
  "NumericFilter"
867
867
  );
868
- c.registerCustom(
868
+ l.registerCustom(
869
869
  {
870
- isApplicable: dr,
870
+ isApplicable: Fr,
871
871
  serialize: (e) => e.serialize(),
872
- deserialize: (e) => g(e)
872
+ deserialize: (e) => b(e)
873
873
  },
874
874
  "TextFilter"
875
875
  );
876
- c.registerCustom(
876
+ l.registerCustom(
877
877
  {
878
- isApplicable: mr,
878
+ isApplicable: wr,
879
879
  serialize: (e) => e.serialize(),
880
- deserialize: (e) => g(e)
880
+ deserialize: (e) => b(e)
881
881
  },
882
882
  "DateRangeFilter"
883
883
  );
884
- c.registerCustom(
884
+ l.registerCustom(
885
885
  {
886
- isApplicable: pr,
886
+ isApplicable: qr,
887
887
  serialize: (e) => e.serialize(),
888
- deserialize: (e) => g(e)
888
+ deserialize: (e) => b(e)
889
889
  },
890
890
  "RelativeDateFilter"
891
891
  );
892
- c.registerCustom(
892
+ l.registerCustom(
893
893
  {
894
- isApplicable: yr,
894
+ isApplicable: Er,
895
895
  serialize: (e) => e.serialize(),
896
- deserialize: (e) => g(e)
896
+ deserialize: (e) => b(e)
897
897
  },
898
898
  "CustomFilter"
899
899
  );
900
- const Fs = c, h = "DM.";
901
- function x(e) {
900
+ const Ps = l, F = "DM.";
901
+ function E(e) {
902
902
  return typeof e == "object" && e !== null && "function" in e && "args" in e;
903
903
  }
904
- function le(e) {
905
- return e.every(x);
904
+ function je(e) {
905
+ return e.every(E);
906
906
  }
907
907
  function K(e) {
908
908
  return "attribute" in e && "config" in e;
909
909
  }
910
- function W(e) {
910
+ function U(e) {
911
911
  return "left" in e && "right" in e && "operator" in e;
912
912
  }
913
- function _e(e) {
914
- return !K(e) && !W(e);
915
- }
916
- function Mt(e) {
917
- return e.every((r) => typeof r == "string");
918
- }
919
- function Nt(e) {
920
- const r = [...e].sort((a, i) => i.name.length - a.name.length), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
921
- for (const a of e) {
922
- t.set(a.name, a);
923
- const i = [...a.columns].sort((u, l) => l.name.length - u.name.length);
924
- n.set(a.name, i);
925
- const o = /* @__PURE__ */ new Map();
926
- for (const u of a.columns)
927
- o.set(u.name, u);
928
- s.set(a.name, o);
913
+ function fe(e) {
914
+ return !K(e) && !U(e);
915
+ }
916
+ function It(e) {
917
+ return typeof e == "object" && e !== null && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
918
+ }
919
+ function zt(e) {
920
+ const r = e;
921
+ return typeof e != "object" || e === null || r === null || !("column" in r) ? !1 : E(r.column);
922
+ }
923
+ function Bt(e) {
924
+ const r = [...e].sort((o, i) => i.name.length - o.name.length), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
925
+ for (const o of e) {
926
+ t.set(o.name, o);
927
+ const i = [...o.columns].sort((u, c) => c.name.length - u.name.length);
928
+ n.set(o.name, i);
929
+ const a = /* @__PURE__ */ new Map();
930
+ for (const u of o.columns)
931
+ a.set(u.name, u);
932
+ s.set(o.name, a);
929
933
  }
930
934
  return {
931
935
  sortedTables: r,
@@ -934,15 +938,15 @@ function Nt(e) {
934
938
  columnMap: s
935
939
  };
936
940
  }
937
- function Le(e, r) {
938
- if (!e.startsWith(h))
941
+ function Je(e, r) {
942
+ if (!e.startsWith(F))
939
943
  throw new Error(
940
- `Invalid dimensional element name format: "${e}". Expected format: "${h}TableName.ColumnName[.Level]"`
944
+ `Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`
941
945
  );
942
- const t = e.slice(h.length);
946
+ const t = e.slice(F.length);
943
947
  if (!t)
944
948
  throw new Error(
945
- `Invalid dimensional element name format: "${e}". Expected format: "${h}TableName.ColumnName[.Level]"`
949
+ `Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`
946
950
  );
947
951
  let s, n;
948
952
  for (const m of r.sortedTables)
@@ -950,7 +954,7 @@ function Le(e, r) {
950
954
  const y = t.slice(m.name.length + 1);
951
955
  if (!y)
952
956
  throw new Error(
953
- `Invalid dimensional element name format: "${e}". Expected format: "${h}TableName.ColumnName[.Level]"`
957
+ `Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`
954
958
  );
955
959
  s = m, n = y;
956
960
  break;
@@ -959,17 +963,17 @@ function Le(e, r) {
959
963
  const m = t.indexOf(".");
960
964
  if (m === -1)
961
965
  throw new Error(
962
- `Invalid dimensional element name format: "${e}". Expected format: "${h}TableName.ColumnName[.Level]"`
966
+ `Invalid dimensional element name format: "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`
963
967
  );
964
968
  const y = t.slice(0, m);
965
969
  throw new Error(`Table "${y}" not found in the data model`);
966
970
  }
967
- const a = r.tableColumnMap.get(s.name);
968
- if (!a)
971
+ const o = r.tableColumnMap.get(s.name);
972
+ if (!o)
969
973
  throw new Error(`Table "${s.name}" found but has no columns`);
970
- let i, o;
971
- const u = J.all;
972
- for (const m of a) {
974
+ let i, a;
975
+ const u = W.all;
976
+ for (const m of o) {
973
977
  if (n === m.name)
974
978
  return { table: s, column: m };
975
979
  if (!n.startsWith(m.name + "."))
@@ -977,71 +981,71 @@ function Le(e, r) {
977
981
  const y = n.slice(m.name.length + 1);
978
982
  if (!y)
979
983
  continue;
980
- const F = u.includes(y), d = ne(m.dataType);
981
- if (F) {
982
- if (d)
984
+ const x = u.includes(y), f = oe(m.dataType);
985
+ if (x) {
986
+ if (f)
983
987
  return { table: s, column: m, level: y };
984
- i || (i = m, o = y);
988
+ i || (i = m, a = y);
985
989
  continue;
986
990
  }
987
- d && !i && (i = m, o = y);
991
+ f && !i && (i = m, a = y);
988
992
  }
989
- if (i && o)
990
- throw u.includes(o) ? new Error(
991
- `Invalid date level "${o}" in dimensional element "${e}". Column "${s.name}.${i.name}" is not a datetime column`
993
+ if (i && a)
994
+ throw u.includes(a) ? new Error(
995
+ `Invalid date level "${a}" in dimensional element "${e}". Column "${s.name}.${i.name}" is not a datetime column`
992
996
  ) : new Error(
993
- `Invalid date level "${o}" in dimensional element "${e}". Valid levels are: ${u.join(
997
+ `Invalid date level "${a}" in dimensional element "${e}". Valid levels are: ${u.join(
994
998
  ", "
995
999
  )}`
996
1000
  );
997
- const l = n.indexOf("."), p = l === -1 ? n : n.slice(0, l);
1001
+ const c = n.indexOf("."), p = c === -1 ? n : n.slice(0, c);
998
1002
  throw new Error(`Column "${p}" not found in table "${s.name}"`);
999
1003
  }
1000
- function Rt(e, r) {
1001
- const { table: t, column: s, level: n } = Le(e, r);
1004
+ function Pt(e, r) {
1005
+ const { table: t, column: s, level: n } = Je(e, r);
1002
1006
  if (n) {
1003
- if (!ne(s.dataType))
1007
+ if (!oe(s.dataType))
1004
1008
  throw new Error(
1005
1009
  `Invalid date level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is not a datetime column`
1006
1010
  );
1007
- const a = J.all;
1008
- if (!a.includes(n))
1011
+ const o = W.all;
1012
+ if (!o.includes(n))
1009
1013
  throw new Error(
1010
- `Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${a.join(
1014
+ `Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${o.join(
1011
1015
  ", "
1012
1016
  )}`
1013
1017
  );
1014
- const i = J.dateOnly;
1018
+ const i = W.dateOnly;
1015
1019
  if (s.dataType === "date" && !i.includes(n))
1016
1020
  throw new Error(
1017
1021
  `Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a date column, not a datetime column`
1018
1022
  );
1019
- const o = J.timeOnly;
1020
- if (s.dataType === "time" && !o.includes(n))
1023
+ const a = W.timeOnly;
1024
+ if (s.dataType === "time" && !a.includes(n))
1021
1025
  throw new Error(
1022
1026
  `Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a time column, not a date column`
1023
1027
  );
1024
1028
  }
1025
1029
  return { column: s, level: n };
1026
1030
  }
1027
- function Ve(e) {
1028
- return e.type === z.TextAttribute;
1031
+ function Ke(e) {
1032
+ return e.type === I.TextAttribute;
1029
1033
  }
1030
- function We(e) {
1031
- return e.type === z.NumericAttribute;
1034
+ function Ge(e) {
1035
+ return e.type === I.NumericAttribute;
1032
1036
  }
1033
- function St(e) {
1034
- return e.type === z.DateLevel;
1037
+ function kt(e) {
1038
+ return e.type === I.DateLevel;
1035
1039
  }
1036
- function Ot(e) {
1037
- return Ve(e) || We(e);
1040
+ function Lt(e) {
1041
+ return Ke(e) || Ge(e);
1038
1042
  }
1039
- function Q(e) {
1040
- return e.type === z.TextAttribute ? "text" : e.type === z.NumericAttribute ? "numeric" : e.type === z.DateLevel ? "date/datetime" : "unknown";
1043
+ function G(e) {
1044
+ return e.type === I.TextAttribute ? "text" : e.type === I.NumericAttribute ? "numeric" : e.type === I.DateLevel ? "date/datetime" : "unknown";
1041
1045
  }
1042
- function ce(e, r, t) {
1043
- const { column: s, level: n } = Rt(e, t);
1044
- return Ir({
1046
+ function Q(e, r, t) {
1047
+ const { column: s, level: n } = Pt(e, t);
1048
+ return Vr({
1045
1049
  expression: s.expression,
1046
1050
  dataType: s.dataType,
1047
1051
  granularity: n,
@@ -1050,17 +1054,17 @@ function ce(e, r, t) {
1050
1054
  dataSource: r
1051
1055
  });
1052
1056
  }
1053
- function Tt(e, r, t) {
1054
- const { column: s, level: n } = Le(e, t);
1057
+ function Vt(e, r, t) {
1058
+ const { column: s, level: n } = Je(e, t);
1055
1059
  if (n)
1056
1060
  throw new Error(
1057
- `Invalid DateDimension name format: "${e}". Expected format: "${h}TableName.ColumnName"`
1061
+ `Invalid DateDimension name format: "${e}". Expected format: "${F}TableName.ColumnName"`
1058
1062
  );
1059
- if (!ne(s.dataType))
1063
+ if (!oe(s.dataType))
1060
1064
  throw new Error(
1061
1065
  `Invalid DateDimension name "${e}". Column "${s.name}" is not a datetime column (got ${s.dataType}).`
1062
1066
  );
1063
- return Zr({
1067
+ return tt({
1064
1068
  name: s.name,
1065
1069
  expression: s.expression,
1066
1070
  dataSource: r
@@ -1070,11 +1074,28 @@ function M(e, r) {
1070
1074
  const t = e();
1071
1075
  return t.success ? t.data : (r.push(...t.errors), null);
1072
1076
  }
1073
- const It = (e) => {
1077
+ const _t = (e, r, t) => {
1078
+ if (!r)
1079
+ return { attribute: e };
1080
+ const s = typeof r == "object" ? r.direction : r;
1081
+ return $e(s) ? { attribute: e.sort(Ae(s)) } : {
1082
+ attribute: e,
1083
+ error: h(g({}, t), {
1084
+ message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${s}".`
1085
+ })
1086
+ };
1087
+ }, Ut = (e, r, t, s) => {
1088
+ const n = Q(e.column, r, t);
1089
+ return _t(n, e.sortType, s);
1090
+ }, Wt = (e, r, t, s) => typeof e == "string" ? { attribute: Q(e, r, t) } : It(e) ? Ut(e, r, t, s) : {
1091
+ error: h(g({}, s), {
1092
+ message: 'Invalid dimension item. Expected a string (composeCode) or object with "column" and optional "sortType".'
1093
+ })
1094
+ }, jt = (e) => {
1074
1095
  const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
1075
1096
  if (!r)
1076
1097
  return { success: !0, data: [] };
1077
- if (!Mt(r))
1098
+ if (!Array.isArray(r))
1078
1099
  return {
1079
1100
  success: !1,
1080
1101
  errors: [
@@ -1082,70 +1103,124 @@ const It = (e) => {
1082
1103
  category: "dimensions",
1083
1104
  index: -1,
1084
1105
  input: r,
1085
- message: "Invalid dimensions JSON. Expected an array of strings."
1106
+ message: "Invalid dimensions JSON. Expected an array."
1086
1107
  }
1087
1108
  ]
1088
1109
  };
1089
- const n = [], a = [];
1090
- return r.forEach((i, o) => {
1110
+ const n = [], o = [];
1111
+ return r.forEach((i, a) => {
1091
1112
  const u = {
1092
1113
  category: "dimensions",
1093
- index: o,
1114
+ index: a,
1094
1115
  input: i
1095
1116
  };
1096
1117
  try {
1097
- const l = ce(i, t, s);
1098
- n.push(l);
1099
- } catch (l) {
1100
- const p = l instanceof Error ? l.message : "Unknown error";
1101
- a.push(E(b({}, u), { message: p }));
1118
+ const c = Wt(i, t, s, u);
1119
+ if (c.error) {
1120
+ o.push(c.error);
1121
+ return;
1122
+ }
1123
+ c.attribute && n.push(c.attribute);
1124
+ } catch (c) {
1125
+ const p = c instanceof Error ? c.message : "Unknown error";
1126
+ o.push(h(g({}, u), { message: p }));
1102
1127
  }
1103
- }), a.length > 0 ? { success: !1, errors: a } : { success: !0, data: n };
1128
+ }), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
1104
1129
  };
1105
- function fe(e, r) {
1130
+ function de(e, r) {
1106
1131
  const t = Reflect.get(e, r);
1107
1132
  if (typeof t != "function")
1108
1133
  throw new Error(`Function "${r}" not found or is not a function`);
1109
1134
  return t;
1110
1135
  }
1111
- function zt(e, r) {
1112
- const t = e.replace("measureFactory.", ""), n = fe(zr, t)(...r);
1113
- if (!_e(n))
1136
+ function Jt(e, r) {
1137
+ const t = e.replace("measureFactory.", ""), n = de(_r, t)(...r);
1138
+ if (!fe(n))
1114
1139
  throw new Error(`Function "${e}" did not return a valid Measure`);
1115
1140
  return n;
1116
1141
  }
1117
- function Bt(e, r) {
1118
- const t = e.replace("filterFactory.logic.", ""), n = fe(Br, t)(...r);
1119
- if (!W(n))
1142
+ function Kt(e, r) {
1143
+ const t = e.replace("filterFactory.logic.", ""), n = de(Ur, t)(...r);
1144
+ if (!U(n))
1120
1145
  throw new Error(`Function "${e}" did not return a valid FilterRelations`);
1121
1146
  return n;
1122
1147
  }
1123
- function Pt(e, r) {
1148
+ function Gt(e, r) {
1124
1149
  if (e.startsWith("filterFactory.logic."))
1125
- return Bt(e, r);
1126
- const t = e.replace("filterFactory.", ""), n = fe(Pr, t)(...r);
1127
- if (!K(n) && !W(n))
1150
+ return Kt(e, r);
1151
+ const t = e.replace("filterFactory.", ""), n = de(Wr, t)(...r);
1152
+ if (!K(n) && !U(n))
1128
1153
  throw new Error(`Function "${e}" did not return a valid Filter or FilterRelations`);
1129
1154
  return n;
1130
1155
  }
1131
- function kt(e, r) {
1156
+ function Qt(e, r) {
1132
1157
  const s = e.split(".")[0];
1133
1158
  if (s === "measureFactory")
1134
- return zt(e, r);
1159
+ return Jt(e, r);
1135
1160
  if (s === "filterFactory")
1136
- return Pt(e, r);
1161
+ return Gt(e, r);
1137
1162
  throw new Error(
1138
1163
  `Unsupported factory: "${s}". Supported factories: measureFactory, filterFactory`
1139
1164
  );
1140
1165
  }
1141
- const _t = /\[([a-zA-Z_][a-zA-Z0-9_.-]*)\]/g;
1142
- function Lt(e, r, t = {}) {
1166
+ const Yt = /\[(\w[\w.-]*)\]/g, Qe = /* @__PURE__ */ new Set([
1167
+ // Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
1168
+ "AVG",
1169
+ "COUNT",
1170
+ "DUPCOUNT",
1171
+ "LARGEST",
1172
+ "MAX",
1173
+ "MEDIAN",
1174
+ "MIN",
1175
+ "MODE",
1176
+ "SUM",
1177
+ // Universal – Time-to-date (WTD/MTD/QTD/YTD)
1178
+ "WTDAVG",
1179
+ "WTDSUM",
1180
+ "MTDAVG",
1181
+ "MTDSUM",
1182
+ "QTDAVG",
1183
+ "QTDSUM",
1184
+ "YTDAVG",
1185
+ "YTDSUM",
1186
+ // RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
1187
+ // Elasticube – Aggregative
1188
+ "CORREL",
1189
+ "COVARP",
1190
+ "COVAR",
1191
+ "SKEWP",
1192
+ "SKEW",
1193
+ "SLOPE"
1194
+ ]), Ht = new RegExp(
1195
+ `\\b(${Array.from(Qe).join("|")})\\s*\\(`,
1196
+ "i"
1197
+ );
1198
+ function Zt(e) {
1199
+ return E(e) ? !0 : typeof e == "string" && e.startsWith(F) ? !1 : e && typeof e == "object" && "kind" in e ? e.kind === "measure" : !0;
1200
+ }
1201
+ function Xt(e) {
1202
+ const r = /\b(\w+)\s*\(/g, t = /* @__PURE__ */ new Set();
1203
+ let s;
1204
+ for (; (s = r.exec(e)) !== null; ) {
1205
+ const n = s[1];
1206
+ Qe.has(n.toUpperCase()) || t.add(n);
1207
+ }
1208
+ return Array.from(t);
1209
+ }
1210
+ function vt(e) {
1211
+ return e.length === 1 ? `[${e[0]}]` : e.map((r) => `[${r}]`).join(", ");
1212
+ }
1213
+ function es(e) {
1214
+ return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
1215
+ }
1216
+ const B = (e) => e.startsWith("[") ? e : `[${e}]`, Ee = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
1217
+ function rs(e, r, t = {}) {
1143
1218
  const {
1144
1219
  warnUnusedContext: s = !0,
1145
1220
  errorOnUnusedContext: n = !0,
1146
- allowEmptyFormula: a = !1,
1221
+ allowEmptyFormula: o = !1,
1147
1222
  errorPrefix: i = "customFormula validation"
1148
- } = t, o = {
1223
+ } = t, a = {
1149
1224
  isValid: !0,
1150
1225
  errors: [],
1151
1226
  warnings: [],
@@ -1153,70 +1228,78 @@ function Lt(e, r, t = {}) {
1153
1228
  unusedContextKeys: []
1154
1229
  };
1155
1230
  if (!e || e.trim().length === 0)
1156
- return a || (o.errors.push(`${i}args[1]: Formula cannot be empty`), o.isValid = !1), o;
1157
- const u = /\b\w+\s*\[/gi, l = e.match(u);
1158
- if (l) {
1159
- const f = l[0].replace(/\s*\[.*$/, "");
1160
- o.errors.push(
1231
+ return o || (a.errors.push(`${i}args[1]: Formula cannot be empty`), a.isValid = !1), a;
1232
+ const u = /\b\w+\s*\[/gi, c = e.match(u);
1233
+ if (c) {
1234
+ const f = c[0].replace(/\s*\[.*$/, "");
1235
+ a.errors.push(
1161
1236
  `${i}args[1]: Invalid syntax: '${f}' - operator cannot be used before bracket reference without parentheses`
1162
- ), o.isValid = !1;
1163
- }
1164
- const p = _t, m = /* @__PURE__ */ new Set();
1165
- let y;
1166
- for (; (y = p.exec(e)) !== null; ) {
1167
- const f = y[1];
1168
- m.add(f);
1169
- }
1170
- o.references = Array.from(m);
1171
- const F = Object.keys(r);
1172
- if (o.references.length > 0 && (/\b\w+\s*\(/gi.test(e) || o.references.every((A) => {
1173
- if (!(A in r))
1174
- return !1;
1175
- const D = r[A];
1176
- return x(D) ? !1 : typeof D == "string" && D.startsWith(h) ? !0 : D && typeof D == "object" && "kind" in D ? D.kind !== "measure" : !1;
1177
- }) && (o.errors.push(
1178
- `${i}args[1]: Formulas with bracket references must contain aggregate function calls`
1179
- ), o.isValid = !1)), o.references.length === 0)
1180
- return o.warnings.push(
1237
+ ), a.isValid = !1;
1238
+ }
1239
+ a.references = [
1240
+ ...new Set(
1241
+ [...e.matchAll(new RegExp(Yt.source, "g"))].map((f) => f[1])
1242
+ )
1243
+ ];
1244
+ const p = Object.keys(r);
1245
+ if (a.references.length === 0)
1246
+ return a.warnings.push(
1181
1247
  `${i}args[1]: No bracket references found in formula - ensure this is intentional`
1182
- ), o;
1183
- if (F.length === 0)
1184
- return o.errors.push(
1248
+ ), a;
1249
+ if (p.length === 0)
1250
+ return a.errors.push(
1185
1251
  `${i}args[2]: Context cannot be empty - custom formulas require context definitions`
1186
- ), o.isValid = !1, o;
1187
- const d = [];
1188
- for (const f of o.references)
1189
- F.includes(f) || d.push(f);
1190
- if (d.length > 0 && (o.isValid = !1, d.length === 1 ? o.errors.push(
1191
- `${i}args[1]: Reference [${d[0]}] not found in context. Available keys: ${F.join(", ")}`
1192
- ) : o.errors.push(
1193
- `${i}args[1]: References [${d.join(
1194
- "], ["
1195
- )}] not found in context. Available keys: ${F.join(", ")}`
1196
- )), (s || n) && F.length > 0) {
1197
- const f = F.filter((w) => !o.references.includes(w));
1198
- if (o.unusedContextKeys = f, f.length > 0) {
1199
- const w = `${i}args[2]: Context keys [${f.join(
1200
- ", "
1201
- )}] are defined but not used in formula`;
1202
- n ? (o.errors.push(w), o.isValid = !1) : s && o.warnings.push(w);
1252
+ ), a.isValid = !1, a;
1253
+ const m = new Set(p.map(B)), y = a.references.filter(
1254
+ (f) => !m.has(B(f))
1255
+ );
1256
+ if (y.length > 0) {
1257
+ a.isValid = !1;
1258
+ const f = p.map((d) => `[${Ee(d)}]`).join(", ");
1259
+ y.length === 1 ? a.errors.push(
1260
+ `${i}args[1]: Reference [${y[0]}] not found in context. Available keys: ${f}`
1261
+ ) : a.errors.push(
1262
+ `${i}args[1]: References [${y.join(
1263
+ "], ["
1264
+ )}] not found in context. Available keys: ${f}`
1265
+ );
1266
+ }
1267
+ if (!Ht.test(e)) {
1268
+ const f = a.references.filter((d) => {
1269
+ var $;
1270
+ const w = ($ = r[B(d)]) != null ? $ : r[d];
1271
+ return w !== void 0 && !Zt(w);
1272
+ });
1273
+ f.length > 0 && (a.errors.push(
1274
+ `${i}args[1]: ${es(
1275
+ Xt(e)
1276
+ )}Bracket reference(s) ${vt(
1277
+ f
1278
+ )} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
1279
+ ), a.isValid = !1);
1280
+ }
1281
+ if ((s || n) && p.length > 0) {
1282
+ const f = new Set(a.references.map(B)), d = p.filter((w) => !f.has(B(w)));
1283
+ if (a.unusedContextKeys = d, d.length > 0) {
1284
+ const w = d.map((D) => `[${Ee(D)}]`).join(", "), $ = `${i}args[2]: Context keys ${w} are defined but not used in formula`;
1285
+ n ? (a.errors.push($), a.isValid = !1) : s && a.warnings.push($);
1203
1286
  }
1204
1287
  }
1205
- return o;
1288
+ return a;
1206
1289
  }
1207
- function Vt(e, r, t = {}) {
1208
- const s = Lt(e, r, t);
1290
+ function ts(e, r, t = {}) {
1291
+ const s = rs(e, r, t);
1209
1292
  if (!s.isValid)
1210
1293
  throw new Error(s.errors.join("; "));
1211
1294
  s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
1212
1295
  }
1213
- function Wt(e, r) {
1296
+ function ss(e, r) {
1214
1297
  if (e.length < 3 || e.length > 5)
1215
1298
  throw new Error(
1216
1299
  `${r.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
1217
1300
  );
1218
1301
  const t = e[1], s = e[2];
1219
- Vt(t, s, {
1302
+ ts(t, s, {
1220
1303
  errorPrefix: `${r.pathPrefix}`,
1221
1304
  errorOnUnusedContext: !0,
1222
1305
  // Strict validation: all context keys must be used
@@ -1224,111 +1307,111 @@ function Wt(e, r) {
1224
1307
  // Custom formulas must have content
1225
1308
  });
1226
1309
  const n = {};
1227
- for (const [a, i] of Object.entries(s)) {
1228
- const o = `args[2].${a}`;
1229
- if (x(i))
1230
- n[`${a}`] = C({
1310
+ for (const [o, i] of Object.entries(s)) {
1311
+ const a = `args[2].${o}`;
1312
+ if (E(i))
1313
+ n[`${o}`] = C({
1231
1314
  data: i,
1232
1315
  context: {
1233
1316
  dataSource: r.dataSource,
1234
1317
  schemaIndex: r.schemaIndex,
1235
- pathPrefix: o
1318
+ pathPrefix: a
1236
1319
  }
1237
1320
  });
1238
- else if (typeof i == "string" && i.startsWith(h))
1321
+ else if (typeof i == "string" && i.startsWith(F))
1239
1322
  try {
1240
- n[`${a}`] = ce(
1323
+ n[`${o}`] = Q(
1241
1324
  i,
1242
1325
  r.dataSource,
1243
1326
  r.schemaIndex
1244
1327
  );
1245
1328
  } catch (u) {
1246
- const l = u instanceof Error ? u.message : "Unknown error";
1247
- throw new Error(`${o}: ${l}`);
1329
+ const c = u instanceof Error ? u.message : "Unknown error";
1330
+ throw new Error(`${a}: ${c}`);
1248
1331
  }
1249
1332
  else if (i && typeof i == "object" && "kind" in i)
1250
- n[`${a}`] = i;
1333
+ n[`${o}`] = i;
1251
1334
  else
1252
1335
  throw new Error(
1253
- `${o}: Invalid context value for key '${a}'. Expected a function call or attribute reference (${h}...), but got: ${typeof i}`
1336
+ `${a}: Invalid context value for key '${o}'. Expected a function call or attribute reference (${F}...), but got: ${typeof i}`
1254
1337
  );
1255
1338
  }
1256
1339
  e[2] = n;
1257
1340
  }
1258
- function de(e, r) {
1341
+ function me(e, r) {
1259
1342
  const t = e[0];
1260
1343
  if (!t || typeof t != "object" || !("type" in t))
1261
1344
  throw new Error(`${r.pathPrefix}args[0]: Expected attribute as first argument`);
1262
1345
  return t;
1263
1346
  }
1264
- function qe(e, r) {
1265
- const t = de(e, r);
1266
- if (!Ot(t))
1347
+ function Ce(e, r) {
1348
+ const t = me(e, r);
1349
+ if (!Lt(t))
1267
1350
  throw new Error(
1268
- `${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${Q(
1351
+ `${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${G(
1269
1352
  t
1270
1353
  )} attribute`
1271
1354
  );
1272
1355
  }
1273
- function R(e, r) {
1274
- const t = de(e, r);
1275
- if (!We(t))
1356
+ function T(e, r) {
1357
+ const t = me(e, r);
1358
+ if (!Ge(t))
1276
1359
  throw new Error(
1277
- `${r.pathPrefix}args[0]: Attribute must be numeric type, got ${Q(
1360
+ `${r.pathPrefix}args[0]: Attribute must be numeric type, got ${G(
1278
1361
  t
1279
1362
  )} attribute`
1280
1363
  );
1281
1364
  }
1282
- function S(e, r) {
1283
- const t = de(e, r);
1284
- if (!Ve(t))
1365
+ function N(e, r) {
1366
+ const t = me(e, r);
1367
+ if (!Ke(t))
1285
1368
  throw new Error(
1286
- `${r.pathPrefix}args[0]: Attribute must be string type, got ${Q(
1369
+ `${r.pathPrefix}args[0]: Attribute must be string type, got ${G(
1287
1370
  t
1288
1371
  )} attribute`
1289
1372
  );
1290
1373
  }
1291
- function Jt(e, r) {
1374
+ function ns(e, r) {
1292
1375
  const t = e[0];
1293
1376
  if (!t || typeof t != "object" || !("attribute" in t))
1294
1377
  throw new Error(`${r.pathPrefix}args[0]: Expected filter as first argument`);
1295
1378
  return t;
1296
1379
  }
1297
- function Ut(e, r) {
1298
- const t = Jt(e, r);
1299
- if (!se(t))
1380
+ function is(e, r) {
1381
+ const t = ns(e, r);
1382
+ if (!ne(t))
1300
1383
  throw new Error(
1301
1384
  `${r.pathPrefix}args[0]: exclude filter only accepts members filter, got ${t.__serializable || "unknown"} filter`
1302
1385
  );
1303
1386
  }
1304
- const jt = {
1305
- "measureFactory.customFormula": Wt,
1387
+ const os = {
1388
+ "measureFactory.customFormula": ss,
1306
1389
  // String | Number filters
1307
- "filterFactory.equals": qe,
1308
- "filterFactory.doesntEqual": qe,
1390
+ "filterFactory.equals": Ce,
1391
+ "filterFactory.doesntEqual": Ce,
1309
1392
  // Numeric filters
1310
- "filterFactory.greaterThan": R,
1311
- "filterFactory.greaterThanOrEqual": R,
1312
- "filterFactory.lessThan": R,
1313
- "filterFactory.lessThanOrEqual": R,
1314
- "filterFactory.between": R,
1315
- "filterFactory.betweenNotEqual": R,
1316
- "filterFactory.numeric": R,
1393
+ "filterFactory.greaterThan": T,
1394
+ "filterFactory.greaterThanOrEqual": T,
1395
+ "filterFactory.lessThan": T,
1396
+ "filterFactory.lessThanOrEqual": T,
1397
+ "filterFactory.between": T,
1398
+ "filterFactory.betweenNotEqual": T,
1399
+ "filterFactory.numeric": T,
1317
1400
  // String filters
1318
- "filterFactory.contains": S,
1319
- "filterFactory.doesntContain": S,
1320
- "filterFactory.startsWith": S,
1321
- "filterFactory.doesntStartWith": S,
1322
- "filterFactory.endsWith": S,
1323
- "filterFactory.doesntEndWith": S,
1324
- "filterFactory.like": S,
1401
+ "filterFactory.contains": N,
1402
+ "filterFactory.doesntContain": N,
1403
+ "filterFactory.startsWith": N,
1404
+ "filterFactory.doesntStartWith": N,
1405
+ "filterFactory.endsWith": N,
1406
+ "filterFactory.doesntEndWith": N,
1407
+ "filterFactory.like": N,
1325
1408
  // Exclude filter
1326
- "filterFactory.exclude": Ut
1409
+ "filterFactory.exclude": is
1327
1410
  };
1328
- function Kt(e) {
1329
- return jt[`${e}`];
1411
+ function as(e) {
1412
+ return os[`${e}`];
1330
1413
  }
1331
- const Qt = {
1414
+ const us = {
1332
1415
  // ==================== MEASURE FACTORY FUNCTIONS ====================
1333
1416
  // Basic aggregations
1334
1417
  "measureFactory.sum": [
@@ -1855,18 +1938,18 @@ const Qt = {
1855
1938
  { type: "FilterRelationsNode", required: !0 }
1856
1939
  ]
1857
1940
  };
1858
- function me(e) {
1859
- return Qt[`${e}`];
1941
+ function pe(e) {
1942
+ return us[`${e}`];
1860
1943
  }
1861
- function Yt(e) {
1862
- const r = me(e);
1944
+ function cs(e) {
1945
+ const r = pe(e);
1863
1946
  return r ? r.filter((t) => t.required).length : 0;
1864
1947
  }
1865
- function Ht(e) {
1866
- const r = me(e);
1948
+ function ls(e) {
1949
+ const r = pe(e);
1867
1950
  return r ? r.length : 0;
1868
1951
  }
1869
- function Zt(e) {
1952
+ function fs(e) {
1870
1953
  if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
1871
1954
  return !1;
1872
1955
  const t = Date.parse(e);
@@ -1876,313 +1959,314 @@ function Zt(e) {
1876
1959
  return !isNaN(s.getTime());
1877
1960
  }
1878
1961
  function Z(e, r, t, s) {
1879
- if (e.startsWith(h))
1962
+ if (e.startsWith(F))
1880
1963
  try {
1881
- return ce(e, r, t);
1964
+ return Q(e, r, t);
1882
1965
  } catch (n) {
1883
- const a = n instanceof Error ? n.message : "Unknown error";
1884
- throw new Error(`${s}: ${a}`);
1966
+ const o = n instanceof Error ? n.message : "Unknown error";
1967
+ throw new Error(`${s}: ${o}`);
1885
1968
  }
1886
1969
  throw new Error(
1887
- `${s}: Invalid attribute "${e}". Expected format: "${h}TableName.ColumnName[.Level]"`
1970
+ `${s}: Invalid attribute "${e}". Expected format: "${F}TableName.ColumnName[.Level]"`
1888
1971
  );
1889
1972
  }
1890
- function Gt(e, r, t, s) {
1891
- if (e.startsWith(h))
1973
+ function ds(e, r, t, s) {
1974
+ if (e.startsWith(F))
1892
1975
  try {
1893
- return Tt(e, r, t);
1976
+ return Vt(e, r, t);
1894
1977
  } catch (n) {
1895
- const a = n instanceof Error ? n.message : "Unknown error";
1896
- throw new Error(`${s}: ${a}`);
1978
+ const o = n instanceof Error ? n.message : "Unknown error";
1979
+ throw new Error(`${s}: ${o}`);
1897
1980
  }
1898
1981
  throw new Error(
1899
- `${s}: Invalid date dimension string "${e}". Expected format: "${h}TableName.ColumnName"`
1982
+ `${s}: Invalid date dimension string "${e}". Expected format: "${F}TableName.ColumnName"`
1900
1983
  );
1901
1984
  }
1902
- function Xt(e) {
1903
- const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix: a } = e.context, i = a;
1985
+ function ms(e) {
1986
+ const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix: o } = e.context, i = o;
1904
1987
  if (r === void 0) {
1905
1988
  if (t.required)
1906
1989
  throw new Error(`${i}: Required argument is missing (expected ${t.type})`);
1907
1990
  return;
1908
1991
  }
1909
- switch (t.type) {
1910
- case "string":
1911
- if (typeof r != "string")
1912
- throw new Error(`${i}: Expected string, got ${typeof r}`);
1913
- return r;
1914
- case "number":
1915
- if (typeof r != "number")
1916
- throw new Error(`${i}: Expected number, got ${typeof r}`);
1917
- return r;
1918
- case "boolean":
1919
- if (typeof r != "boolean")
1920
- throw new Error(`${i}: Expected boolean, got ${typeof r}`);
1921
- return r;
1922
- case "string[]":
1923
- if (!Array.isArray(r))
1924
- throw new Error(
1925
- `${i}: Expected array of strings, got ${typeof r}. Example: ["value1", "value2"]`
1926
- );
1927
- if (!r.every((o) => typeof o == "string"))
1928
- throw new Error(
1929
- `${i}: Expected array of strings, but contains non-string values`
1930
- );
1931
- return r;
1932
- case "number[]":
1933
- if (!Array.isArray(r))
1934
- throw new Error(
1935
- `${i}: Expected array of numbers, got ${typeof r}. Example: [10, 20]`
1936
- );
1937
- if (!r.every((o) => typeof o == "number"))
1938
- throw new Error(
1939
- `${i}: Expected array of numbers, but contains non-number values`
1940
- );
1941
- return r;
1942
- case "Attribute":
1943
- if (typeof r != "string")
1944
- throw new Error(
1945
- `${i}: Expected attribute string, got ${typeof r}. Example: "DM.Commerce.Revenue"`
1946
- );
1947
- return Z(r, s, n, i);
1948
- case "Attribute[]":
1949
- if (!Array.isArray(r))
1950
- throw new Error(
1951
- `${i}: Expected array of attributes, got ${typeof r}. Example: ["DM.Commerce.AgeRange"]`
1952
- );
1953
- return r.map((o, u) => {
1954
- if (typeof o != "string")
1955
- throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof o}`);
1956
- return Z(o, s, n, `${i}[${u}]`);
1957
- });
1958
- case "Measure":
1959
- case "BaseMeasure":
1960
- if (!x(r))
1961
- throw new Error(
1962
- `${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`
1963
- );
1964
- return C({
1965
- data: r,
1966
- context: { dataSource: s, schemaIndex: n, pathPrefix: i }
1967
- });
1968
- case "Measure[]":
1969
- if (!Array.isArray(r))
1970
- throw new Error(
1971
- `${i}: Expected array of measure function calls, got ${typeof r}`
1972
- );
1973
- return r.map((o, u) => {
1974
- if (!x(o))
1992
+ if (!(r === null && !t.required))
1993
+ switch (t.type) {
1994
+ case "string":
1995
+ if (typeof r != "string")
1996
+ throw new Error(`${i}: Expected string, got ${typeof r}`);
1997
+ return r;
1998
+ case "number":
1999
+ if (typeof r != "number")
2000
+ throw new Error(`${i}: Expected number, got ${typeof r}`);
2001
+ return r;
2002
+ case "boolean":
2003
+ if (typeof r != "boolean")
2004
+ throw new Error(`${i}: Expected boolean, got ${typeof r}`);
2005
+ return r;
2006
+ case "string[]":
2007
+ if (!Array.isArray(r))
1975
2008
  throw new Error(
1976
- `${i}[${u}]: Expected measure function call, got ${typeof o}`
2009
+ `${i}: Expected array of strings, got ${typeof r}. Example: ["value1", "value2"]`
1977
2010
  );
1978
- return C({
1979
- data: o,
1980
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
2011
+ if (!r.every((a) => typeof a == "string"))
2012
+ throw new Error(
2013
+ `${i}: Expected array of strings, but contains non-string values`
2014
+ );
2015
+ return r;
2016
+ case "number[]":
2017
+ if (!Array.isArray(r))
2018
+ throw new Error(
2019
+ `${i}: Expected array of numbers, got ${typeof r}. Example: [10, 20]`
2020
+ );
2021
+ if (!r.every((a) => typeof a == "number"))
2022
+ throw new Error(
2023
+ `${i}: Expected array of numbers, but contains non-number values`
2024
+ );
2025
+ return r;
2026
+ case "Attribute":
2027
+ if (typeof r != "string")
2028
+ throw new Error(
2029
+ `${i}: Expected attribute string, got ${typeof r}. Example: "DM.Commerce.Revenue"`
2030
+ );
2031
+ return Z(r, s, n, i);
2032
+ case "Attribute[]":
2033
+ if (!Array.isArray(r))
2034
+ throw new Error(
2035
+ `${i}: Expected array of attributes, got ${typeof r}. Example: ["DM.Commerce.AgeRange"]`
2036
+ );
2037
+ return r.map((a, u) => {
2038
+ if (typeof a != "string")
2039
+ throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof a}`);
2040
+ return Z(a, s, n, `${i}[${u}]`);
1981
2041
  });
1982
- });
1983
- case "Filter":
1984
- if (!x(r))
1985
- throw new Error(
1986
- `${i}: Expected filter function call, got ${typeof r}. Example: {"function": "filterFactory.contains", "args": ["DM.Brand.Brand", "Apple"]}`
1987
- );
1988
- return C({
1989
- data: r,
1990
- context: { dataSource: s, schemaIndex: n, pathPrefix: i }
1991
- });
1992
- case "Filter[]":
1993
- if (!Array.isArray(r))
1994
- throw new Error(
1995
- `${i}: Expected array of filter function calls, got ${typeof r}`
1996
- );
1997
- return r.map((o, u) => {
1998
- if (!x(o))
2042
+ case "Measure":
2043
+ case "BaseMeasure":
2044
+ if (!E(r))
1999
2045
  throw new Error(
2000
- `${i}[${u}]: Expected filter function call, got ${typeof o}`
2046
+ `${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`
2001
2047
  );
2002
2048
  return C({
2003
- data: o,
2004
- context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
2049
+ data: r,
2050
+ context: { dataSource: s, schemaIndex: n, pathPrefix: i }
2005
2051
  });
2006
- });
2007
- case "FilterRelationsNode":
2008
- if (Array.isArray(r))
2009
- return r.map((o, u) => {
2010
- if (!x(o))
2052
+ case "Measure[]":
2053
+ if (!Array.isArray(r))
2054
+ throw new Error(
2055
+ `${i}: Expected array of measure function calls, got ${typeof r}`
2056
+ );
2057
+ return r.map((a, u) => {
2058
+ if (!E(a))
2011
2059
  throw new Error(
2012
- `${i}[${u}]: Expected filter function call, got ${typeof o}`
2060
+ `${i}[${u}]: Expected measure function call, got ${typeof a}`
2013
2061
  );
2014
2062
  return C({
2015
- data: o,
2063
+ data: a,
2016
2064
  context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
2017
2065
  });
2018
2066
  });
2019
- if (x(r))
2067
+ case "Filter":
2068
+ if (!E(r))
2069
+ throw new Error(
2070
+ `${i}: Expected filter function call, got ${typeof r}. Example: {"function": "filterFactory.contains", "args": ["DM.Brand.Brand", "Apple"]}`
2071
+ );
2020
2072
  return C({
2021
2073
  data: r,
2022
2074
  context: { dataSource: s, schemaIndex: n, pathPrefix: i }
2023
2075
  });
2024
- throw new Error(
2025
- `${i}: Expected filter function call or array of filters, got ${typeof r}`
2026
- );
2027
- case "DateDimension":
2028
- if (typeof r != "string")
2029
- throw new Error(
2030
- `${i}: Expected date dimension string, got ${typeof r}. Example: "DM.Commerce.Date"`
2031
- );
2032
- return Gt(r, s, n, i);
2033
- case "LevelAttribute": {
2034
- if (typeof r != "string")
2076
+ case "Filter[]":
2077
+ if (!Array.isArray(r))
2078
+ throw new Error(
2079
+ `${i}: Expected array of filter function calls, got ${typeof r}`
2080
+ );
2081
+ return r.map((a, u) => {
2082
+ if (!E(a))
2083
+ throw new Error(
2084
+ `${i}[${u}]: Expected filter function call, got ${typeof a}`
2085
+ );
2086
+ return C({
2087
+ data: a,
2088
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
2089
+ });
2090
+ });
2091
+ case "FilterRelationsNode":
2092
+ if (Array.isArray(r))
2093
+ return r.map((a, u) => {
2094
+ if (!E(a))
2095
+ throw new Error(
2096
+ `${i}[${u}]: Expected filter function call, got ${typeof a}`
2097
+ );
2098
+ return C({
2099
+ data: a,
2100
+ context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
2101
+ });
2102
+ });
2103
+ if (E(r))
2104
+ return C({
2105
+ data: r,
2106
+ context: { dataSource: s, schemaIndex: n, pathPrefix: i }
2107
+ });
2035
2108
  throw new Error(
2036
- `${i}: Expected date attribute string, got ${typeof r}. Example: "DM.Commerce.Date.Years"`
2109
+ `${i}: Expected filter function call or array of filters, got ${typeof r}`
2037
2110
  );
2038
- const o = Z(
2039
- r,
2040
- s,
2041
- n,
2042
- i
2043
- );
2044
- if (!St(o))
2045
- throw new Error(
2046
- `${i}: Attribute must be date/datetime type, got ${Q(
2047
- o
2048
- )} attribute`
2111
+ case "DateDimension":
2112
+ if (typeof r != "string")
2113
+ throw new Error(
2114
+ `${i}: Expected date dimension string, got ${typeof r}. Example: "DM.Commerce.Date"`
2115
+ );
2116
+ return ds(r, s, n, i);
2117
+ case "LevelAttribute": {
2118
+ if (typeof r != "string")
2119
+ throw new Error(
2120
+ `${i}: Expected date attribute string, got ${typeof r}. Example: "DM.Commerce.Date.Years"`
2121
+ );
2122
+ const a = Z(
2123
+ r,
2124
+ s,
2125
+ n,
2126
+ i
2049
2127
  );
2050
- return o;
2051
- }
2052
- case "Measure | number":
2053
- if (typeof r == "number")
2054
- return r;
2055
- if (x(r))
2056
- return C({
2057
- data: r,
2058
- context: { dataSource: s, schemaIndex: n, pathPrefix: i }
2059
- });
2060
- throw new Error(
2061
- `${i}: Expected measure function call or number, got ${typeof r}`
2062
- );
2063
- case "Date | string":
2064
- if (typeof r == "string") {
2065
- if (Zt(r))
2128
+ if (!kt(a))
2129
+ throw new Error(
2130
+ `${i}: Attribute must be date/datetime type, got ${G(
2131
+ a
2132
+ )} attribute`
2133
+ );
2134
+ return a;
2135
+ }
2136
+ case "Measure | number":
2137
+ if (typeof r == "number")
2066
2138
  return r;
2139
+ if (E(r))
2140
+ return C({
2141
+ data: r,
2142
+ context: { dataSource: s, schemaIndex: n, pathPrefix: i }
2143
+ });
2067
2144
  throw new Error(
2068
- `${i}: Expected valid ISO date string or Date object, got invalid date string "${r}"`
2145
+ `${i}: Expected measure function call or number, got ${typeof r}`
2069
2146
  );
2070
- } else {
2071
- if (r instanceof Date)
2147
+ case "Date | string":
2148
+ if (typeof r == "string") {
2149
+ if (fs(r))
2150
+ return r;
2151
+ throw new Error(
2152
+ `${i}: Expected valid ISO date string or Date object, got invalid date string "${r}"`
2153
+ );
2154
+ } else {
2155
+ if (r instanceof Date)
2156
+ return r;
2157
+ throw new Error(
2158
+ `${i}: Expected date string or Date object, got ${typeof r}`
2159
+ );
2160
+ }
2161
+ case "string | number":
2162
+ if (typeof r == "string" || typeof r == "number")
2072
2163
  return r;
2073
- throw new Error(
2074
- `${i}: Expected date string or Date object, got ${typeof r}`
2075
- );
2076
- }
2077
- case "string | number":
2078
- if (typeof r == "string" || typeof r == "number")
2164
+ throw new Error(`${i}: Expected string or number, got ${typeof r}`);
2165
+ case "BaseFilterConfig":
2166
+ case "MembersFilterConfig":
2167
+ case "CustomFormulaContext":
2168
+ case "any":
2169
+ if (r == null && t.required)
2170
+ throw new Error(`${i}: Required argument is null/undefined`);
2079
2171
  return r;
2080
- throw new Error(`${i}: Expected string or number, got ${typeof r}`);
2081
- case "BaseFilterConfig":
2082
- case "MembersFilterConfig":
2083
- case "CustomFormulaContext":
2084
- case "any":
2085
- if (r == null && t.required)
2086
- throw new Error(`${i}: Required argument is null/undefined`);
2087
- return r;
2088
- default:
2089
- return r;
2090
- }
2172
+ default:
2173
+ return r;
2174
+ }
2091
2175
  }
2092
2176
  function C(e) {
2093
- const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function: a, args: i } = r, o = n ? `${n}.` : "", u = me(a);
2177
+ const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function: o, args: i } = r, a = n ? `${n}.` : "", u = pe(o);
2094
2178
  if (!u)
2095
- throw new Error(`${o}function: Unknown function "${a}"`);
2096
- const l = Yt(a), p = Ht(a);
2097
- if (i.length < l)
2179
+ throw new Error(`${a}function: Unknown function "${o}"`);
2180
+ const c = cs(o), p = ls(o);
2181
+ if (i.length < c)
2098
2182
  throw new Error(
2099
- `${o}function: Expected at least ${l} arguments, got ${i.length}`
2183
+ `${a}function: Expected at least ${c} arguments, got ${i.length}`
2100
2184
  );
2101
2185
  if (i.length > p)
2102
2186
  throw new Error(
2103
- `${o}function: Expected at most ${p} arguments, got ${i.length}`
2187
+ `${a}function: Expected at most ${p} arguments, got ${i.length}`
2104
2188
  );
2105
2189
  const m = [], y = [];
2106
- for (let d = 0; d < Math.max(i.length, u.length); d++) {
2107
- const f = u[`${d}`], w = i[`${d}`], T = o ? `${o}args[${d}]` : `args[${d}]`;
2190
+ for (let f = 0; f < Math.max(i.length, u.length); f++) {
2191
+ const d = u[`${f}`], w = i[`${f}`], $ = a ? `${a}args[${f}]` : `args[${f}]`;
2108
2192
  if (w === void 0) {
2109
- f != null && f.required && y.push(`${T}: Missing required argument (expected ${f.type})`);
2193
+ d != null && d.required && y.push(`${$}: Missing required argument (expected ${d.type})`);
2110
2194
  continue;
2111
2195
  }
2112
- if (!f) {
2113
- y.push(`${T}: Unexpected argument`);
2196
+ if (!d) {
2197
+ y.push(`${$}: Unexpected argument`);
2114
2198
  continue;
2115
2199
  }
2116
2200
  try {
2117
- const A = Xt({
2201
+ const D = ms({
2118
2202
  data: w,
2119
2203
  context: {
2120
2204
  dataSource: t,
2121
2205
  schemaIndex: s,
2122
- pathPrefix: T,
2123
- argSchema: f
2206
+ pathPrefix: $,
2207
+ argSchema: d
2124
2208
  }
2125
2209
  });
2126
- m.push(A);
2127
- } catch (A) {
2128
- const D = A instanceof Error ? A.message : "Unknown error";
2129
- y.push(D);
2210
+ m.push(D);
2211
+ } catch (D) {
2212
+ const ve = D instanceof Error ? D.message : "Unknown error";
2213
+ y.push(ve);
2130
2214
  }
2131
2215
  }
2132
2216
  if (y.length > 0) {
2133
- const d = y.join("; ");
2134
- throw new Error(d);
2217
+ const f = y.join("; ");
2218
+ throw new Error(f);
2135
2219
  }
2136
- const F = Kt(a);
2137
- if (F)
2220
+ const x = as(o);
2221
+ if (x)
2138
2222
  try {
2139
- F(m, {
2223
+ x(m, {
2140
2224
  dataSource: t,
2141
2225
  schemaIndex: s,
2142
- pathPrefix: o
2226
+ pathPrefix: a
2143
2227
  });
2144
- } catch (d) {
2145
- const f = d instanceof Error ? d.message : "Unknown validation error";
2146
- throw new Error(f);
2228
+ } catch (f) {
2229
+ const d = f instanceof Error ? f.message : "Unknown validation error";
2230
+ throw new Error(d);
2147
2231
  }
2148
- return kt(a, m);
2232
+ return Qt(o, m);
2149
2233
  }
2150
- function Je(e) {
2234
+ function Ye(e) {
2151
2235
  const { attribute: r, config: t } = e;
2152
- if (se(e) && kr(r)) {
2153
- const { granularity: s } = r, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), a = _r(t), i = Object.keys(a).length === 0 ? void 0 : a;
2154
- return Lr(r, n, i);
2236
+ if (ne(e) && jr(r)) {
2237
+ const { granularity: s } = r, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), o = Jr(t), i = Object.keys(o).length === 0 ? void 0 : o;
2238
+ return Kr(r, n, i);
2155
2239
  }
2156
2240
  return e;
2157
2241
  }
2158
- function vt(e) {
2242
+ function ps(e) {
2159
2243
  let r = [];
2160
2244
  for (const t of e)
2161
- W(t) ? r = ge(t, r) : r = ge([Je(t)], r);
2245
+ U(t) ? r = he(t, r) : r = he([Ye(t)], r);
2162
2246
  return r != null ? r : [];
2163
2247
  }
2164
- const es = (e) => {
2165
- const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
2166
- return r.forEach((i, o) => {
2248
+ const ys = (e) => {
2249
+ const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
2250
+ return r.forEach((i, a) => {
2167
2251
  const u = {
2168
2252
  category: "filters",
2169
- index: o,
2253
+ index: a,
2170
2254
  input: i
2171
2255
  };
2172
2256
  try {
2173
- const l = C({
2257
+ const c = C({
2174
2258
  data: i,
2175
2259
  context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
2176
2260
  });
2177
- !W(l) && !K(l) ? a.push(E(b({}, u), { message: "Invalid filter JSON" })) : n.push(l);
2178
- } catch (l) {
2179
- const p = l instanceof Error ? l.message : "Unknown error";
2180
- a.push(E(b({}, u), { message: p }));
2261
+ !U(c) && !K(c) ? o.push(h(g({}, u), { message: "Invalid filter JSON" })) : n.push(c);
2262
+ } catch (c) {
2263
+ const p = c instanceof Error ? c.message : "Unknown error";
2264
+ o.push(h(g({}, u), { message: p }));
2181
2265
  }
2182
- }), a.length > 0 ? { success: !1, errors: a } : { success: !0, data: vt(n) };
2183
- }, rs = (e) => {
2266
+ }), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: ps(n) };
2267
+ }, gs = (e) => {
2184
2268
  const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
2185
- return r ? le(r) ? es({
2269
+ return r ? je(r) ? ys({
2186
2270
  data: r,
2187
2271
  context: { dataSource: t, schemaIndex: s }
2188
2272
  }) : {
@@ -2196,28 +2280,28 @@ const es = (e) => {
2196
2280
  }
2197
2281
  ]
2198
2282
  } : { success: !0, data: [] };
2199
- }, ts = (e) => {
2200
- const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
2201
- return r.forEach((i, o) => {
2283
+ }, hs = (e) => {
2284
+ const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
2285
+ return r.forEach((i, a) => {
2202
2286
  const u = {
2203
2287
  category: "highlights",
2204
- index: o,
2288
+ index: a,
2205
2289
  input: i
2206
2290
  };
2207
2291
  try {
2208
- const l = C({
2292
+ const c = C({
2209
2293
  data: i,
2210
2294
  context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
2211
2295
  });
2212
- K(l) ? n.push(Je(l)) : a.push(E(b({}, u), { message: "Invalid filter JSON" }));
2213
- } catch (l) {
2214
- const p = l instanceof Error ? l.message : "Unknown error";
2215
- a.push(E(b({}, u), { message: p }));
2296
+ K(c) ? n.push(Ye(c)) : o.push(h(g({}, u), { message: "Invalid filter JSON" }));
2297
+ } catch (c) {
2298
+ const p = c instanceof Error ? c.message : "Unknown error";
2299
+ o.push(h(g({}, u), { message: p }));
2216
2300
  }
2217
- }), a.length > 0 ? { success: !1, errors: a } : { success: !0, data: n };
2218
- }, ss = (e) => {
2301
+ }), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
2302
+ }, bs = (e) => {
2219
2303
  const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
2220
- return r ? le(r) ? ts({
2304
+ return r ? je(r) ? hs({
2221
2305
  data: r,
2222
2306
  context: { dataSource: t, schemaIndex: s }
2223
2307
  }) : {
@@ -2231,125 +2315,178 @@ const es = (e) => {
2231
2315
  }
2232
2316
  ]
2233
2317
  } : { success: !0, data: [] };
2234
- }, ns = (e) => {
2235
- const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], a = [];
2236
- return r.forEach((i, o) => {
2318
+ }, Fs = (e, r, t) => {
2319
+ const { dataSource: s, schemaIndex: n } = r;
2320
+ try {
2321
+ const o = C({
2322
+ data: e,
2323
+ context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
2324
+ });
2325
+ return fe(o) ? { success: !0, data: o } : {
2326
+ success: !1,
2327
+ errors: [h(g({}, t), { message: "Invalid measure JSON" })]
2328
+ };
2329
+ } catch (o) {
2330
+ const i = o instanceof Error ? o.message : "Unknown error";
2331
+ return {
2332
+ success: !1,
2333
+ errors: [h(g({}, t), { message: i })]
2334
+ };
2335
+ }
2336
+ }, ws = (e, r, t) => r ? $e(r) ? { measure: e.sort(Ae(r)) } : {
2337
+ measure: e,
2338
+ error: h(g({}, t), {
2339
+ message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${r}".`
2340
+ })
2341
+ } : { measure: e }, qs = (e, r, t, s) => {
2342
+ const n = C({
2343
+ data: e.column,
2344
+ context: { dataSource: r, schemaIndex: t, pathPrefix: "" }
2345
+ });
2346
+ return fe(n) ? ws(n, e.sortType, s) : { error: h(g({}, s), { message: "Invalid measure JSON" }) };
2347
+ }, Es = (e, r, t, s) => {
2348
+ if (zt(e))
2349
+ return qs(e, r, t, s);
2350
+ if (E(e)) {
2351
+ const n = Fs(
2352
+ e,
2353
+ { dataSource: r, schemaIndex: t },
2354
+ s
2355
+ );
2356
+ return n.success ? { measure: n.data } : { error: n.errors[0] };
2357
+ }
2358
+ return {
2359
+ error: h(g({}, s), {
2360
+ message: 'Invalid measure item. Expected a function call (function/args) or object with "column" and optional "sortType".'
2361
+ })
2362
+ };
2363
+ }, Cs = (e) => {
2364
+ const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
2365
+ if (!r)
2366
+ return { success: !0, data: [] };
2367
+ if (!Array.isArray(r))
2368
+ return {
2369
+ success: !1,
2370
+ errors: [
2371
+ {
2372
+ category: "measures",
2373
+ index: -1,
2374
+ input: r,
2375
+ message: "Invalid measures JSON. Expected an array."
2376
+ }
2377
+ ]
2378
+ };
2379
+ const n = [], o = [];
2380
+ return r.forEach((i, a) => {
2237
2381
  const u = {
2238
2382
  category: "measures",
2239
- index: o,
2383
+ index: a,
2240
2384
  input: i
2241
2385
  };
2242
2386
  try {
2243
- const l = C({
2244
- data: i,
2245
- context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
2246
- });
2247
- _e(l) ? n.push(l) : a.push(E(b({}, u), { message: "Invalid measure JSON" }));
2248
- } catch (l) {
2249
- const p = l instanceof Error ? l.message : "Unknown error";
2250
- a.push(E(b({}, u), { message: p }));
2251
- }
2252
- }), a.length > 0 ? { success: !1, errors: a } : { success: !0, data: n };
2253
- }, is = (e) => {
2254
- const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
2255
- return r ? le(r) ? ns({
2256
- data: r,
2257
- context: { dataSource: t, schemaIndex: s }
2258
- }) : {
2259
- success: !1,
2260
- errors: [
2261
- {
2262
- category: "measures",
2263
- index: -1,
2264
- input: r,
2265
- message: 'Invalid measures JSON. Expected an array of function calls with "function" and "args" properties.'
2387
+ const c = Es(i, t, s, u);
2388
+ if (c.error) {
2389
+ o.push(c.error);
2390
+ return;
2266
2391
  }
2267
- ]
2268
- } : { success: !0, data: [] };
2269
- }, ws = (e) => {
2270
- const { data: r } = e, { dataSource: t, tables: s } = e.context, n = Nt(s), a = [], i = M(
2271
- () => It({
2392
+ c.measure && n.push(c.measure);
2393
+ } catch (c) {
2394
+ const p = c instanceof Error ? c.message : "Unknown error";
2395
+ o.push(h(g({}, u), { message: p }));
2396
+ }
2397
+ }), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
2398
+ }, ks = (e) => {
2399
+ const { data: r } = e, { dataSource: t, tables: s } = e.context, n = Bt(s), o = [], i = M(
2400
+ () => jt({
2272
2401
  data: r.dimensions || [],
2273
2402
  context: { dataSource: t, schemaIndex: n }
2274
2403
  }),
2275
- a
2276
- ), o = M(
2277
- () => is({
2404
+ o
2405
+ ), a = M(
2406
+ () => Cs({
2278
2407
  data: r.measures || [],
2279
2408
  context: { dataSource: t, schemaIndex: n }
2280
2409
  }),
2281
- a
2410
+ o
2282
2411
  ), u = M(
2283
- () => rs({
2412
+ () => gs({
2284
2413
  data: r.filters || [],
2285
2414
  context: { dataSource: t, schemaIndex: n }
2286
2415
  }),
2287
- a
2416
+ o
2288
2417
  );
2289
- let l = null;
2290
- return r.highlights && (l = M(
2291
- () => ss({
2418
+ let c = null;
2419
+ return r.highlights && (c = M(
2420
+ () => bs({
2292
2421
  data: r.highlights || [],
2293
2422
  context: { dataSource: t, schemaIndex: n }
2294
2423
  }),
2295
- a
2296
- )), a.length > 0 ? {
2424
+ o
2425
+ )), o.length > 0 ? {
2297
2426
  success: !1,
2298
- errors: a
2427
+ errors: o
2299
2428
  } : {
2300
2429
  success: !0,
2301
- data: b({
2302
- dataSource: Vr(t),
2430
+ data: g({
2431
+ dataSource: Gr(t),
2303
2432
  dimensions: i || [],
2304
- measures: o || [],
2433
+ measures: a || [],
2305
2434
  filters: u || []
2306
- }, l && { highlights: l })
2435
+ }, c && { highlights: c })
2307
2436
  };
2308
2437
  };
2309
- function as(e) {
2438
+ function $s(e) {
2310
2439
  const r = [], t = [];
2311
2440
  return e.forEach((s, n) => {
2312
- const a = () => typeof s.toJSON == "function" ? s.toJSON() : s;
2441
+ const o = () => typeof s.toJSON == "function" ? s.toJSON() : s;
2313
2442
  if (!s.composeCode) {
2314
2443
  t.push({
2315
2444
  category: "dimensions",
2316
2445
  index: n,
2317
- input: a(),
2446
+ input: o(),
2318
2447
  message: `Dimension at index ${n} (${s.name || "unnamed"}) is missing composeCode`
2319
2448
  });
2320
2449
  return;
2321
2450
  }
2322
- if (!s.composeCode.startsWith(h)) {
2451
+ if (!s.composeCode.startsWith(F)) {
2323
2452
  t.push({
2324
2453
  category: "dimensions",
2325
2454
  index: n,
2326
- input: a(),
2327
- message: `Expected composeCode to start with "${h}" for dimension at index ${n} (${s.name || "unnamed"}). Got: "${s.composeCode}"`
2455
+ input: o(),
2456
+ message: `Expected composeCode to start with "${F}" for dimension at index ${n} (${s.name || "unnamed"}). Got: "${s.composeCode}"`
2328
2457
  });
2329
2458
  return;
2330
2459
  }
2331
- r.push(s.composeCode);
2460
+ const i = s.getSort();
2461
+ if (i !== void 0 && i !== ie.None) {
2462
+ const a = {
2463
+ column: s.composeCode,
2464
+ sortType: xe(i)
2465
+ };
2466
+ r.push(a);
2467
+ } else
2468
+ r.push(s.composeCode);
2332
2469
  }), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
2333
2470
  }
2334
- function Ue(e, r) {
2471
+ function He(e, r) {
2335
2472
  const t = [];
2336
- let s = "", n = 0, a = !1, i = null;
2337
- for (let o = 0; o < e.length; o++) {
2338
- const u = e[o], l = e[o + 1];
2339
- if (a) {
2473
+ let s = "", n = 0, o = !1, i = null;
2474
+ for (let a = 0; a < e.length; a++) {
2475
+ const u = e[a], c = e[a + 1];
2476
+ if (o) {
2340
2477
  if (u !== i) {
2341
2478
  s += u;
2342
2479
  continue;
2343
2480
  }
2344
- if (l === i) {
2345
- s += u + l, o++;
2481
+ if (c === i) {
2482
+ s += u + c, a++;
2346
2483
  continue;
2347
2484
  }
2348
- a = !1, i = null, s += u;
2485
+ o = !1, i = null, s += u;
2349
2486
  continue;
2350
2487
  } else {
2351
2488
  if (u === "'" || u === '"') {
2352
- a = !0, i = u, s += u;
2489
+ o = !0, i = u, s += u;
2353
2490
  continue;
2354
2491
  }
2355
2492
  if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === r && n === 0) {
@@ -2361,14 +2498,14 @@ function Ue(e, r) {
2361
2498
  }
2362
2499
  return s.trim() && t.push(s.trim()), t;
2363
2500
  }
2364
- function os(e, r) {
2501
+ function As(e, r) {
2365
2502
  let t = 0, s = !1, n = null;
2366
- for (let a = 0; a < e.length; a++) {
2367
- const i = e[a], o = e[a + 1];
2503
+ for (let o = 0; o < e.length; o++) {
2504
+ const i = e[o], a = e[o + 1];
2368
2505
  if (s) {
2369
2506
  if (i !== n) continue;
2370
- if (o === n) {
2371
- a++;
2507
+ if (a === n) {
2508
+ o++;
2372
2509
  continue;
2373
2510
  }
2374
2511
  s = !1, n = null;
@@ -2377,15 +2514,15 @@ function os(e, r) {
2377
2514
  s = !0, n = i;
2378
2515
  continue;
2379
2516
  }
2380
- if ("([{".includes(i) && t++, ")]}".includes(i) && t--, i === r && t === 0) return a;
2517
+ if ("([{".includes(i) && t++, ")]}".includes(i) && t--, i === r && t === 0) return o;
2381
2518
  }
2382
2519
  }
2383
2520
  return -1;
2384
2521
  }
2385
- function us(e) {
2522
+ function xs(e) {
2386
2523
  return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
2387
2524
  }
2388
- function V(e) {
2525
+ function _(e) {
2389
2526
  if (!e || typeof e != "string")
2390
2527
  throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
2391
2528
  const r = e.trim();
@@ -2394,16 +2531,16 @@ function V(e) {
2394
2531
  const t = r.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
2395
2532
  if (!t)
2396
2533
  throw new Error(`Invalid composeCode format: expected function call, got "${r}"`);
2397
- const s = t[1], n = t[2], a = je(n);
2534
+ const s = t[1], n = t[2], o = Ze(n);
2398
2535
  return {
2399
2536
  function: s,
2400
- args: a
2537
+ args: o
2401
2538
  };
2402
2539
  }
2403
- function je(e) {
2404
- return e.trim() ? Ue(e, ",").map(Ke) : [];
2540
+ function Ze(e) {
2541
+ return e.trim() ? He(e, ",").map(Xe) : [];
2405
2542
  }
2406
- function Ke(e) {
2543
+ function Xe(e) {
2407
2544
  if (!e)
2408
2545
  throw new Error("Cannot parse empty argument value");
2409
2546
  if (e === "null")
@@ -2424,33 +2561,33 @@ function Ke(e) {
2424
2561
  const t = e.slice(1, -1).trim();
2425
2562
  if (!t)
2426
2563
  return [];
2427
- const s = je(t);
2564
+ const s = Ze(t);
2428
2565
  return s.every((n) => typeof n == "string"), s;
2429
2566
  }
2430
2567
  if (e.startsWith("{") && e.endsWith("}")) {
2431
2568
  const t = e.slice(1, -1).trim();
2432
- return t ? cs(t) : {};
2569
+ return t ? Ms(t) : {};
2433
2570
  }
2434
- return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
2571
+ return e.includes("(") && e.includes(")") ? _(e) : (e.startsWith("DM."), e);
2435
2572
  }
2436
- function ls(e) {
2437
- const r = os(e, ":");
2573
+ function Ds(e) {
2574
+ const r = As(e, ":");
2438
2575
  if (r === -1)
2439
2576
  throw new Error(`Invalid object property: expected "key: value", got "${e}"`);
2440
- const t = us(e.slice(0, r).trim()), s = Ke(e.slice(r + 1).trim());
2577
+ const t = xs(e.slice(0, r).trim()), s = Xe(e.slice(r + 1).trim());
2441
2578
  return [t, s];
2442
2579
  }
2443
- function cs(e) {
2580
+ function Ms(e) {
2444
2581
  if (!e.trim()) return {};
2445
- const r = Ue(e, ",").map(ls).filter(([, t]) => t !== null);
2582
+ const r = He(e, ",").map(Ds).filter(([, t]) => t !== null);
2446
2583
  return Object.fromEntries(r);
2447
2584
  }
2448
- const re = "Unknown error";
2449
- function fs(e) {
2585
+ const te = "Unknown error";
2586
+ function Ss(e) {
2450
2587
  if (!e)
2451
2588
  return { success: !0, data: [] };
2452
2589
  const r = [];
2453
- if (Wr(e)) {
2590
+ if (Qr(e)) {
2454
2591
  if (!e.composeCode)
2455
2592
  return {
2456
2593
  success: !1,
@@ -2464,9 +2601,9 @@ function fs(e) {
2464
2601
  ]
2465
2602
  };
2466
2603
  try {
2467
- return { success: !0, data: [V(e.composeCode)] };
2604
+ return { success: !0, data: [_(e.composeCode)] };
2468
2605
  } catch (s) {
2469
- const n = s instanceof Error ? s.message : re;
2606
+ const n = s instanceof Error ? s.message : te;
2470
2607
  return {
2471
2608
  success: !1,
2472
2609
  errors: [
@@ -2492,10 +2629,10 @@ function fs(e) {
2492
2629
  return;
2493
2630
  }
2494
2631
  try {
2495
- const a = V(s.composeCode);
2496
- t.push(a);
2497
- } catch (a) {
2498
- const i = a instanceof Error ? a.message : re;
2632
+ const o = _(s.composeCode);
2633
+ t.push(o);
2634
+ } catch (o) {
2635
+ const i = o instanceof Error ? o.message : te;
2499
2636
  r.push({
2500
2637
  category: "filters",
2501
2638
  index: n,
@@ -2505,7 +2642,7 @@ function fs(e) {
2505
2642
  }
2506
2643
  }), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
2507
2644
  }
2508
- function ds(e) {
2645
+ function Ts(e) {
2509
2646
  if (!e)
2510
2647
  return { success: !0, data: [] };
2511
2648
  const r = [], t = [];
@@ -2520,10 +2657,10 @@ function ds(e) {
2520
2657
  return;
2521
2658
  }
2522
2659
  try {
2523
- const a = V(s.composeCode);
2524
- r.push(a);
2525
- } catch (a) {
2526
- const i = a instanceof Error ? a.message : re;
2660
+ const o = _(s.composeCode);
2661
+ r.push(o);
2662
+ } catch (o) {
2663
+ const i = o instanceof Error ? o.message : te;
2527
2664
  t.push({
2528
2665
  category: "highlights",
2529
2666
  index: n,
@@ -2533,71 +2670,78 @@ function ds(e) {
2533
2670
  }
2534
2671
  }), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
2535
2672
  }
2536
- function ms(e) {
2673
+ function Ns(e) {
2537
2674
  const r = [], t = [];
2538
2675
  return e.forEach((s, n) => {
2539
- const a = () => typeof s.toJSON == "function" ? s.toJSON() : s;
2676
+ const o = () => typeof s.toJSON == "function" ? s.toJSON() : s;
2540
2677
  if (!s.composeCode) {
2541
2678
  t.push({
2542
2679
  category: "measures",
2543
2680
  index: n,
2544
- input: a(),
2681
+ input: o(),
2545
2682
  message: `Measure at index ${n} (${s.name || "unnamed"}) is missing composeCode`
2546
2683
  });
2547
2684
  return;
2548
2685
  }
2549
2686
  try {
2550
- const i = V(s.composeCode);
2551
- r.push(i);
2687
+ const i = _(s.composeCode), a = s.getSort();
2688
+ if (a !== void 0 && a !== ie.None) {
2689
+ const u = {
2690
+ column: i,
2691
+ sortType: xe(a)
2692
+ };
2693
+ r.push(u);
2694
+ } else
2695
+ r.push(i);
2552
2696
  } catch (i) {
2553
- const o = i instanceof Error ? i.message : "Unknown error";
2697
+ const a = i instanceof Error ? i.message : "Unknown error";
2554
2698
  t.push({
2555
2699
  category: "measures",
2556
2700
  index: n,
2557
- input: a(),
2558
- message: `Failed to parse composeCode for measure at index ${n} (${s.name || "unnamed"}): ${o}. ComposeCode: "${s.composeCode}"`
2701
+ input: o(),
2702
+ message: `Failed to parse composeCode for measure at index ${n} (${s.name || "unnamed"}): ${a}. ComposeCode: "${s.composeCode}"`
2559
2703
  });
2560
2704
  }
2561
2705
  }), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
2562
2706
  }
2563
- function te(e) {
2564
- return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(te) : e !== null && typeof e == "object" ? Object.fromEntries(
2565
- Object.entries(e).map(([r, t]) => [r, te(t)])
2707
+ function se(e) {
2708
+ return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(se) : e !== null && typeof e == "object" ? Object.fromEntries(
2709
+ Object.entries(e).map(([r, t]) => [r, se(t)])
2566
2710
  ) : e;
2567
2711
  }
2568
- function qs(e) {
2712
+ function Ls(e) {
2569
2713
  const r = [], t = M(
2570
- () => as(e.dimensions || []),
2714
+ () => $s(e.dimensions || []),
2571
2715
  r
2572
2716
  ), s = M(
2573
- () => ms(e.measures || []),
2717
+ () => Ns(e.measures || []),
2574
2718
  r
2575
2719
  ), n = M(
2576
- () => fs(e.filters),
2720
+ () => Ss(e.filters),
2577
2721
  r
2578
2722
  );
2579
- let a = null;
2580
- if (e.highlights && e.highlights.length > 0 && (a = M(
2581
- () => ds(e.highlights),
2723
+ let o = null;
2724
+ if (e.highlights && e.highlights.length > 0 && (o = M(
2725
+ () => Ts(e.highlights),
2582
2726
  r
2583
2727
  )), r.length > 0)
2584
2728
  return {
2585
2729
  success: !1,
2586
2730
  errors: r
2587
2731
  };
2588
- const i = b({
2732
+ const i = g({
2589
2733
  dimensions: t || [],
2590
2734
  measures: s || [],
2591
2735
  filters: n || []
2592
- }, a && { highlights: a });
2736
+ }, o && { highlights: o });
2593
2737
  return {
2594
2738
  success: !0,
2595
2739
  // Strip [[delimiters]] from all strings to preserve original names with spaces
2596
- data: te(i)
2740
+ data: se(i)
2597
2741
  };
2598
2742
  }
2599
- function ps(e) {
2600
- const { filters: r, relations: t } = jr(
2743
+ function Rs(e) {
2744
+ const { filters: r, relations: t } = Zr(
2601
2745
  e.filters || []
2602
2746
  );
2603
2747
  return {
@@ -2610,19 +2754,19 @@ function ps(e) {
2610
2754
  // No count/offset/ungroup - these are execution concerns, not translation concerns
2611
2755
  };
2612
2756
  }
2613
- function Es(e, r, t = !1) {
2614
- const s = ps(e), n = Jr(s, r);
2615
- return Ur(n, t);
2757
+ function Vs(e, r, t = !1) {
2758
+ const s = Rs(e), n = Yr(s, r);
2759
+ return Hr(n, t);
2616
2760
  }
2617
2761
  export {
2618
- Fs as CustomSuperJSON,
2619
- xs as EMPTY_EXPANDED_QUERY_MODEL,
2620
- As as EMPTY_SIMPLE_QUERY_MODEL,
2621
- Ds as isByIdDashboardCodeParams,
2622
- Ms as isByIdWidgetCodeParams,
2623
- Ns as isClientSideDashboardCodeParams,
2624
- Rs as isClientSideWidgetCodeParams,
2625
- ws as translateQueryFromJSON,
2626
- qs as translateQueryToJSON,
2627
- Es as translateQueryToJaql
2762
+ Ps as CustomSuperJSON,
2763
+ Ws as EMPTY_EXPANDED_QUERY_MODEL,
2764
+ js as EMPTY_SIMPLE_QUERY_MODEL,
2765
+ Js as isByIdDashboardCodeParams,
2766
+ Ks as isByIdWidgetCodeParams,
2767
+ Gs as isClientSideDashboardCodeParams,
2768
+ Qs as isClientSideWidgetCodeParams,
2769
+ ks as translateQueryFromJSON,
2770
+ Ls as translateQueryToJSON,
2771
+ Vs as translateQueryToJaql
2628
2772
  };