drizzle-cube 0.4.29 → 0.4.30

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 (381) hide show
  1. package/dist/adapters/anthropic-BIva8k1r.cjs +1 -0
  2. package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
  3. package/dist/adapters/dist-Boc63-1q.cjs +2 -0
  4. package/dist/adapters/dist-De5fzUEM.js +581 -0
  5. package/dist/adapters/express/index.cjs +2 -10
  6. package/dist/adapters/express/index.js +232 -342
  7. package/dist/adapters/fastify/index.cjs +2 -10
  8. package/dist/adapters/fastify/index.js +275 -424
  9. package/dist/adapters/google-CT4kgmBf.js +154 -0
  10. package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
  11. package/dist/adapters/handler-B8vuFQYP.cjs +25 -0
  12. package/dist/adapters/handler-D-2-6uLM.js +2951 -0
  13. package/dist/adapters/hono/index.cjs +2 -10
  14. package/dist/adapters/hono/index.js +307 -402
  15. package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
  16. package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
  17. package/dist/adapters/mcp-transport-CuugoG8t.js +7821 -0
  18. package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
  19. package/dist/adapters/nextjs/index.cjs +1 -9
  20. package/dist/adapters/nextjs/index.js +377 -600
  21. package/dist/adapters/openai-CjBvA6mK.js +4114 -0
  22. package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
  23. package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
  24. package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
  25. package/dist/adapters/types.cjs +0 -1
  26. package/dist/adapters/types.js +0 -1
  27. package/dist/adapters/utils-ChhNGUOF.js +5396 -0
  28. package/dist/adapters/utils-CwJplXR5.cjs +15 -0
  29. package/dist/adapters/utils.cjs +1 -19
  30. package/dist/adapters/utils.js +2 -21333
  31. package/dist/client/charts.js +15 -186
  32. package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
  33. package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
  34. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
  35. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
  36. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
  37. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js.map +1 -0
  38. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
  39. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
  40. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
  41. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
  42. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
  43. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
  44. package/dist/client/chunks/analysis-builder-DF0XntqC.js +6111 -0
  45. package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
  46. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
  47. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
  48. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
  49. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
  50. package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
  51. package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
  52. package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
  53. package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
  54. package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
  55. package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
  56. package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
  57. package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
  58. package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
  59. package/dist/client/chunks/chart-candlestick-C3Rep469.js.map +1 -0
  60. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
  61. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
  62. package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
  63. package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
  64. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
  65. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
  66. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
  67. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
  68. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
  69. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
  70. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
  71. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
  72. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
  73. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
  74. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
  75. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
  76. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
  77. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
  78. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
  79. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
  80. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
  81. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
  82. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
  83. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
  84. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
  85. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
  86. package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
  87. package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
  88. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
  89. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
  90. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
  91. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
  92. package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
  93. package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
  94. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
  95. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
  96. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
  97. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
  98. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
  99. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
  100. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
  101. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
  102. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
  103. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
  104. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
  105. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
  106. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
  107. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
  108. package/dist/client/chunks/chart-data-table-DehW1C1G.js +4088 -0
  109. package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
  110. package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
  111. package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
  112. package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
  113. package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
  114. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
  115. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
  116. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
  117. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
  118. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
  119. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
  120. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
  121. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
  122. package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
  123. package/dist/client/chunks/chart-line-DOIMkP0b.js.map +1 -0
  124. package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
  125. package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
  126. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js +179 -0
  127. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
  128. package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
  129. package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
  130. package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
  131. package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
  132. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
  133. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
  134. package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
  135. package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
  136. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
  137. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
  138. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
  139. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
  140. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
  141. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
  142. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
  143. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
  144. package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
  145. package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
  146. package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
  147. package/dist/client/chunks/charts-loader-AGpph8_I.js.map +1 -0
  148. package/dist/client/chunks/core-D1TOj17W.js +845 -0
  149. package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
  150. package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
  151. package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
  152. package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
  153. package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
  154. package/dist/client/chunks/json-BpTrLZSh.js +38 -0
  155. package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
  156. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
  157. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
  158. package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
  159. package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
  160. package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
  161. package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
  162. package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
  163. package/dist/client/chunks/schema-visualization-ZugB4Io9.js +1073 -0
  164. package/dist/client/chunks/schema-visualization-ZugB4Io9.js.map +1 -0
  165. package/dist/client/chunks/sql-B0chxcEK.js +120 -0
  166. package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
  167. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
  168. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
  169. package/dist/client/chunks/useDebounce-BQjNWndQ.js +1394 -0
  170. package/dist/client/chunks/useDebounce-BQjNWndQ.js.map +1 -0
  171. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
  172. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
  173. package/dist/client/chunks/useExplainAI-c_bHxZe5.js +203 -0
  174. package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +1 -0
  175. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
  176. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
  177. package/dist/client/chunks/utils-A54Ny29G.js +128 -0
  178. package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
  179. package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
  180. package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
  181. package/dist/client/components.js +4 -18
  182. package/dist/client/hooks.js +6 -58
  183. package/dist/client/icons.js +2 -15
  184. package/dist/client/index.js +1061 -1295
  185. package/dist/client/index.js.map +1 -1
  186. package/dist/client/providers.js +3 -9
  187. package/dist/client/styles.css +2 -1
  188. package/dist/client/types.d.ts +1 -0
  189. package/dist/client/utils.js +7 -74
  190. package/dist/client-bundle-stats.html +1 -1
  191. package/dist/server/anthropic-BsNspi1r.js +140 -0
  192. package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
  193. package/dist/server/dist-CMWZC51B.js +581 -0
  194. package/dist/server/dist-DxegvyZF.cjs +2 -0
  195. package/dist/server/google-BXwMolCu.js +154 -0
  196. package/dist/server/google-DzQWXFwF.cjs +2 -0
  197. package/dist/server/index.cjs +109 -129
  198. package/dist/server/index.js +15089 -34394
  199. package/dist/server/openai-BPhmb8mi.js +4114 -0
  200. package/dist/server/openai-CLsoLaue.cjs +1 -0
  201. package/dist/server/openai-D1kZ5sdM.js +153 -0
  202. package/dist/server/openai-DkOKbVLC.cjs +16 -0
  203. package/package.json +5 -5
  204. package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
  205. package/dist/adapters/anthropic-CTu9E801.js +0 -126
  206. package/dist/adapters/google-BAK9pnQf.cjs +0 -2
  207. package/dist/adapters/google-DficVAsJ.js +0 -146
  208. package/dist/adapters/handler-BHguLZOY.js +0 -2713
  209. package/dist/adapters/handler-DOIyiFPg.cjs +0 -39
  210. package/dist/adapters/index-BgCeQBuN.cjs +0 -2
  211. package/dist/adapters/index-C3PskWTr.js +0 -5353
  212. package/dist/adapters/index-C45_meK_.js +0 -719
  213. package/dist/adapters/index-ht4NPca9.cjs +0 -23
  214. package/dist/adapters/mcp-transport-CWGqDQSI.cjs +0 -259
  215. package/dist/adapters/mcp-transport-CyeHMDPl.js +0 -11055
  216. package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
  217. package/dist/adapters/openai-mcE24du8.js +0 -131
  218. package/dist/client/charts.js.map +0 -1
  219. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
  220. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
  221. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
  222. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
  223. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
  224. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
  225. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
  226. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
  227. package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
  228. package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
  229. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
  230. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
  231. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
  232. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
  233. package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
  234. package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
  235. package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
  236. package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
  237. package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
  238. package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
  239. package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
  240. package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
  241. package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
  242. package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
  243. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
  244. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
  245. package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
  246. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
  247. package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
  248. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
  249. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
  250. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
  251. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
  252. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
  253. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
  254. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
  255. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
  256. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
  257. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
  258. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
  259. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
  260. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
  261. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
  262. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
  263. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
  264. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
  265. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
  266. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
  267. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
  268. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
  269. package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
  270. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
  271. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
  272. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
  273. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
  274. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
  275. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
  276. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
  277. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
  278. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
  279. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
  280. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
  281. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
  282. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
  283. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
  284. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
  285. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
  286. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
  287. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
  288. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
  289. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
  290. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
  291. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
  292. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
  293. package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
  294. package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
  295. package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
  296. package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
  297. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
  298. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
  299. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
  300. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
  301. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
  302. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
  303. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
  304. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
  305. package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
  306. package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
  307. package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
  308. package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
  309. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
  310. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
  311. package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
  312. package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
  313. package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
  314. package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
  315. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
  316. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
  317. package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
  318. package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
  319. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
  320. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
  321. package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
  322. package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
  323. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
  324. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
  325. package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
  326. package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
  327. package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
  328. package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
  329. package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
  330. package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
  331. package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
  332. package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
  333. package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
  334. package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
  335. package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
  336. package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
  337. package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
  338. package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
  339. package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
  340. package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
  341. package/dist/client/chunks/index-CApFCBF9.js +0 -81
  342. package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
  343. package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
  344. package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
  345. package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
  346. package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
  347. package/dist/client/chunks/json-C_6Prymp.js +0 -39
  348. package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
  349. package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
  350. package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
  351. package/dist/client/chunks/retention-CzCo8262.js +0 -120
  352. package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
  353. package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
  354. package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
  355. package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
  356. package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
  357. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
  358. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
  359. package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
  360. package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
  361. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
  362. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
  363. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
  364. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
  365. package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
  366. package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
  367. package/dist/client/components.js.map +0 -1
  368. package/dist/client/hooks.js.map +0 -1
  369. package/dist/client/icons.js.map +0 -1
  370. package/dist/client/providers.js.map +0 -1
  371. package/dist/client/utils.js.map +0 -1
  372. package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
  373. package/dist/server/anthropic-CTu9E801.js +0 -126
  374. package/dist/server/google-BAK9pnQf.cjs +0 -2
  375. package/dist/server/google-DficVAsJ.js +0 -146
  376. package/dist/server/index-BgCeQBuN.cjs +0 -2
  377. package/dist/server/index-C3PskWTr.js +0 -5353
  378. package/dist/server/index-C45_meK_.js +0 -719
  379. package/dist/server/index-ht4NPca9.cjs +0 -23
  380. package/dist/server/openai-BvA6eLs8.cjs +0 -1
  381. package/dist/server/openai-mcE24du8.js +0 -131
@@ -0,0 +1,1394 @@
1
+ import { M as e, S as t, V as n, k as r } from "./chart-data-table-DehW1C1G.js";
2
+ import { i, l as a } from "./chart-funnel-BjkpnG5g.js";
3
+ import { n as o } from "./chart-sankey-FChb26UX.js";
4
+ import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
5
+ //#region src/client/shared/types.ts
6
+ var f = {
7
+ equals: {
8
+ label: "equals",
9
+ description: "Exact match",
10
+ requiresValues: !0,
11
+ supportsMultipleValues: !0,
12
+ valueType: "any",
13
+ fieldTypes: [
14
+ "string",
15
+ "number",
16
+ "boolean",
17
+ "time"
18
+ ]
19
+ },
20
+ notEquals: {
21
+ label: "not equals",
22
+ description: "Does not match",
23
+ requiresValues: !0,
24
+ supportsMultipleValues: !0,
25
+ valueType: "any",
26
+ fieldTypes: [
27
+ "string",
28
+ "number",
29
+ "boolean",
30
+ "time"
31
+ ]
32
+ },
33
+ contains: {
34
+ label: "contains",
35
+ description: "Contains text (case insensitive)",
36
+ requiresValues: !0,
37
+ supportsMultipleValues: !1,
38
+ valueType: "string",
39
+ fieldTypes: ["string"]
40
+ },
41
+ notContains: {
42
+ label: "not contains",
43
+ description: "Does not contain text",
44
+ requiresValues: !0,
45
+ supportsMultipleValues: !1,
46
+ valueType: "string",
47
+ fieldTypes: ["string"]
48
+ },
49
+ startsWith: {
50
+ label: "starts with",
51
+ description: "Starts with text",
52
+ requiresValues: !0,
53
+ supportsMultipleValues: !1,
54
+ valueType: "string",
55
+ fieldTypes: ["string"]
56
+ },
57
+ notStartsWith: {
58
+ label: "not starts with",
59
+ description: "Does not start with text",
60
+ requiresValues: !0,
61
+ supportsMultipleValues: !1,
62
+ valueType: "string",
63
+ fieldTypes: ["string"]
64
+ },
65
+ endsWith: {
66
+ label: "ends with",
67
+ description: "Ends with text",
68
+ requiresValues: !0,
69
+ supportsMultipleValues: !1,
70
+ valueType: "string",
71
+ fieldTypes: ["string"]
72
+ },
73
+ notEndsWith: {
74
+ label: "not ends with",
75
+ description: "Does not end with text",
76
+ requiresValues: !0,
77
+ supportsMultipleValues: !1,
78
+ valueType: "string",
79
+ fieldTypes: ["string"]
80
+ },
81
+ like: {
82
+ label: "like",
83
+ description: "SQL LIKE pattern matching (case sensitive)",
84
+ requiresValues: !0,
85
+ supportsMultipleValues: !1,
86
+ valueType: "string",
87
+ fieldTypes: ["string"]
88
+ },
89
+ notLike: {
90
+ label: "not like",
91
+ description: "SQL NOT LIKE pattern matching (case sensitive)",
92
+ requiresValues: !0,
93
+ supportsMultipleValues: !1,
94
+ valueType: "string",
95
+ fieldTypes: ["string"]
96
+ },
97
+ ilike: {
98
+ label: "ilike",
99
+ description: "SQL ILIKE pattern matching (case insensitive)",
100
+ requiresValues: !0,
101
+ supportsMultipleValues: !1,
102
+ valueType: "string",
103
+ fieldTypes: ["string"]
104
+ },
105
+ gt: {
106
+ label: "greater than",
107
+ description: "Greater than value",
108
+ requiresValues: !0,
109
+ supportsMultipleValues: !1,
110
+ valueType: "number",
111
+ fieldTypes: [
112
+ "number",
113
+ "count",
114
+ "sum",
115
+ "avg",
116
+ "min",
117
+ "max"
118
+ ]
119
+ },
120
+ gte: {
121
+ label: "greater than or equal",
122
+ description: "Greater than or equal to value",
123
+ requiresValues: !0,
124
+ supportsMultipleValues: !1,
125
+ valueType: "number",
126
+ fieldTypes: [
127
+ "number",
128
+ "count",
129
+ "sum",
130
+ "avg",
131
+ "min",
132
+ "max"
133
+ ]
134
+ },
135
+ lt: {
136
+ label: "less than",
137
+ description: "Less than value",
138
+ requiresValues: !0,
139
+ supportsMultipleValues: !1,
140
+ valueType: "number",
141
+ fieldTypes: [
142
+ "number",
143
+ "count",
144
+ "sum",
145
+ "avg",
146
+ "min",
147
+ "max"
148
+ ]
149
+ },
150
+ lte: {
151
+ label: "less than or equal",
152
+ description: "Less than or equal to value",
153
+ requiresValues: !0,
154
+ supportsMultipleValues: !1,
155
+ valueType: "number",
156
+ fieldTypes: [
157
+ "number",
158
+ "count",
159
+ "sum",
160
+ "avg",
161
+ "min",
162
+ "max"
163
+ ]
164
+ },
165
+ between: {
166
+ label: "between",
167
+ description: "Between two values (inclusive)",
168
+ requiresValues: !0,
169
+ supportsMultipleValues: !1,
170
+ valueType: "number",
171
+ fieldTypes: [
172
+ "number",
173
+ "count",
174
+ "sum",
175
+ "avg",
176
+ "min",
177
+ "max"
178
+ ]
179
+ },
180
+ notBetween: {
181
+ label: "not between",
182
+ description: "Not between two values",
183
+ requiresValues: !0,
184
+ supportsMultipleValues: !1,
185
+ valueType: "number",
186
+ fieldTypes: [
187
+ "number",
188
+ "count",
189
+ "sum",
190
+ "avg",
191
+ "min",
192
+ "max"
193
+ ]
194
+ },
195
+ in: {
196
+ label: "in",
197
+ description: "Matches any of the provided values",
198
+ requiresValues: !0,
199
+ supportsMultipleValues: !0,
200
+ valueType: "any",
201
+ fieldTypes: [
202
+ "string",
203
+ "number",
204
+ "boolean"
205
+ ]
206
+ },
207
+ notIn: {
208
+ label: "not in",
209
+ description: "Does not match any of the provided values",
210
+ requiresValues: !0,
211
+ supportsMultipleValues: !0,
212
+ valueType: "any",
213
+ fieldTypes: [
214
+ "string",
215
+ "number",
216
+ "boolean"
217
+ ]
218
+ },
219
+ set: {
220
+ label: "is set",
221
+ description: "Is not null/empty",
222
+ requiresValues: !1,
223
+ supportsMultipleValues: !1,
224
+ valueType: "any",
225
+ fieldTypes: [
226
+ "string",
227
+ "number",
228
+ "time",
229
+ "boolean"
230
+ ]
231
+ },
232
+ notSet: {
233
+ label: "is not set",
234
+ description: "Is null/empty",
235
+ requiresValues: !1,
236
+ supportsMultipleValues: !1,
237
+ valueType: "any",
238
+ fieldTypes: [
239
+ "string",
240
+ "number",
241
+ "time",
242
+ "boolean"
243
+ ]
244
+ },
245
+ isEmpty: {
246
+ label: "is empty",
247
+ description: "Is empty string or null",
248
+ requiresValues: !1,
249
+ supportsMultipleValues: !1,
250
+ valueType: "string",
251
+ fieldTypes: ["string"]
252
+ },
253
+ isNotEmpty: {
254
+ label: "is not empty",
255
+ description: "Is not empty string and not null",
256
+ requiresValues: !1,
257
+ supportsMultipleValues: !1,
258
+ valueType: "string",
259
+ fieldTypes: ["string"]
260
+ },
261
+ inDateRange: {
262
+ label: "in date range",
263
+ description: "Between two dates",
264
+ requiresValues: !0,
265
+ supportsMultipleValues: !1,
266
+ valueType: "date",
267
+ fieldTypes: ["time"]
268
+ },
269
+ beforeDate: {
270
+ label: "before date",
271
+ description: "Before specified date",
272
+ requiresValues: !0,
273
+ supportsMultipleValues: !1,
274
+ valueType: "date",
275
+ fieldTypes: ["time"]
276
+ },
277
+ afterDate: {
278
+ label: "after date",
279
+ description: "After specified date",
280
+ requiresValues: !0,
281
+ supportsMultipleValues: !1,
282
+ valueType: "date",
283
+ fieldTypes: ["time"]
284
+ },
285
+ regex: {
286
+ label: "matches regex",
287
+ description: "Matches regular expression pattern",
288
+ requiresValues: !0,
289
+ supportsMultipleValues: !1,
290
+ valueType: "string",
291
+ fieldTypes: ["string"]
292
+ },
293
+ notRegex: {
294
+ label: "not matches regex",
295
+ description: "Does not match regular expression pattern",
296
+ requiresValues: !0,
297
+ supportsMultipleValues: !1,
298
+ valueType: "string",
299
+ fieldTypes: ["string"]
300
+ },
301
+ arrayContains: {
302
+ label: "array contains all",
303
+ description: "Array field contains all specified values (PostgreSQL only)",
304
+ requiresValues: !0,
305
+ supportsMultipleValues: !0,
306
+ valueType: "string",
307
+ fieldTypes: ["string"]
308
+ },
309
+ arrayOverlaps: {
310
+ label: "array contains any",
311
+ description: "Array field contains any of the specified values (PostgreSQL only)",
312
+ requiresValues: !0,
313
+ supportsMultipleValues: !0,
314
+ valueType: "string",
315
+ fieldTypes: ["string"]
316
+ },
317
+ arrayContained: {
318
+ label: "array values in",
319
+ description: "All array field values are within specified values (PostgreSQL only)",
320
+ requiresValues: !0,
321
+ supportsMultipleValues: !0,
322
+ valueType: "string",
323
+ fieldTypes: ["string"]
324
+ }
325
+ }, p = [
326
+ {
327
+ value: "custom",
328
+ label: "Custom"
329
+ },
330
+ {
331
+ value: "today",
332
+ label: "Today"
333
+ },
334
+ {
335
+ value: "yesterday",
336
+ label: "Yesterday"
337
+ },
338
+ {
339
+ value: "this_week",
340
+ label: "This week"
341
+ },
342
+ {
343
+ value: "this_month",
344
+ label: "This month"
345
+ },
346
+ {
347
+ value: "this_quarter",
348
+ label: "This quarter"
349
+ },
350
+ {
351
+ value: "this_year",
352
+ label: "This year"
353
+ },
354
+ {
355
+ value: "last_7_days",
356
+ label: "Last 7 days"
357
+ },
358
+ {
359
+ value: "last_30_days",
360
+ label: "Last 30 days"
361
+ },
362
+ {
363
+ value: "last_n_days",
364
+ label: "Last N days"
365
+ },
366
+ {
367
+ value: "last_week",
368
+ label: "Last week"
369
+ },
370
+ {
371
+ value: "last_n_weeks",
372
+ label: "Last N weeks"
373
+ },
374
+ {
375
+ value: "last_month",
376
+ label: "Last month"
377
+ },
378
+ {
379
+ value: "last_12_months",
380
+ label: "Last 12 months"
381
+ },
382
+ {
383
+ value: "last_n_months",
384
+ label: "Last N months"
385
+ },
386
+ {
387
+ value: "last_quarter",
388
+ label: "Last quarter"
389
+ },
390
+ {
391
+ value: "last_n_quarters",
392
+ label: "Last N quarters"
393
+ },
394
+ {
395
+ value: "last_year",
396
+ label: "Last year"
397
+ },
398
+ {
399
+ value: "last_n_years",
400
+ label: "Last N years"
401
+ }
402
+ ];
403
+ //#endregion
404
+ //#region src/client/shared/utils.ts
405
+ function m(e) {
406
+ return "member" in e && "operator" in e && "values" in e;
407
+ }
408
+ function h(e) {
409
+ return "type" in e && "filters" in e;
410
+ }
411
+ function g(e) {
412
+ let t = (e) => {
413
+ if (m(e)) return e;
414
+ if (h(e)) {
415
+ let n = e.filters.map(t);
416
+ return e.type === "and" ? { and: n } : { or: n };
417
+ }
418
+ return e;
419
+ };
420
+ return e.map(t);
421
+ }
422
+ function _(e) {
423
+ let t = {};
424
+ return e.measures && e.measures.length > 0 && (t.measures = e.measures), e.dimensions && e.dimensions.length > 0 && (t.dimensions = e.dimensions), e.timeDimensions && e.timeDimensions.length > 0 && (t.timeDimensions = e.timeDimensions), e.filters && e.filters.length > 0 && (t.filters = e.filters), e.order && (t.order = e.order), e.limit && (t.limit = e.limit), e.offset && (t.offset = e.offset), e.segments && e.segments.length > 0 && (t.segments = e.segments), t;
425
+ }
426
+ function v(e) {
427
+ let t = _(e);
428
+ return t.filters && t.filters.length > 0 && (t.filters = g(t.filters)), t;
429
+ }
430
+ function y(e) {
431
+ let t = [];
432
+ for (let [n, r] of Object.entries(f)) r.fieldTypes.includes(e) && t.push({
433
+ operator: n,
434
+ label: r.label
435
+ });
436
+ return t;
437
+ }
438
+ function b(e, t) {
439
+ let n = {
440
+ today: "today",
441
+ yesterday: "yesterday",
442
+ this_week: "this week",
443
+ this_month: "this month",
444
+ this_quarter: "this quarter",
445
+ this_year: "this year",
446
+ last_7_days: "last 7 days",
447
+ last_30_days: "last 30 days",
448
+ last_week: "last week",
449
+ last_month: "last month",
450
+ last_quarter: "last quarter",
451
+ last_year: "last year",
452
+ last_12_months: "last 12 months"
453
+ };
454
+ if (e.startsWith("last_n_") && t !== void 0 && t > 0) {
455
+ let n = e.replace("last_n_", ""), r = n.slice(0, -1);
456
+ return t === 1 ? `last ${r}` : `last ${t} ${n}`;
457
+ }
458
+ return n[e] || e;
459
+ }
460
+ function x(e) {
461
+ return e.startsWith("last_n_");
462
+ }
463
+ function S(e) {
464
+ return e.toISOString().split("T")[0];
465
+ }
466
+ //#endregion
467
+ //#region src/client/shared/queryKey.ts
468
+ function C(e) {
469
+ let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
470
+ if (typeof e != "object" || !e) return JSON.stringify(e);
471
+ if (t.has(e)) return "\"[Circular]\"";
472
+ if (t.add(e), Array.isArray(e)) return `[${e.map((e) => n(e)).join(",")}]`;
473
+ let r = e;
474
+ return `{${Object.keys(r).sort().map((e) => `${JSON.stringify(e)}:${n(r[e])}`).join(",")}}`;
475
+ };
476
+ return n(e);
477
+ }
478
+ //#endregion
479
+ //#region src/client/hooks/useDebounceQuery.ts
480
+ function w(e, t) {
481
+ let { isValid: n, skip: r = !1, debounceMs: i = 300 } = t, [a, o] = d(null), [s, f] = d(!1), p = u(null), m = u(""), h = u(r), g = l(() => e ? C(e) : "", [e]);
482
+ return c(() => {
483
+ let t = h.current && !r;
484
+ if (h.current = r, !(g === m.current && !t)) return p.current && clearTimeout(p.current), n && !r ? (f(!0), p.current = setTimeout(() => {
485
+ m.current = g, o(e), f(!1);
486
+ }, i)) : (m.current = g, o(null), f(!1)), () => {
487
+ p.current && clearTimeout(p.current);
488
+ };
489
+ }, [
490
+ g,
491
+ n,
492
+ r,
493
+ i,
494
+ e
495
+ ]), {
496
+ debouncedValue: a,
497
+ isDebouncing: s
498
+ };
499
+ }
500
+ //#endregion
501
+ //#region src/client/hooks/queries/useCubeLoadQuery.ts
502
+ var T = 300;
503
+ function E(e) {
504
+ return e ? [
505
+ "cube",
506
+ "load",
507
+ C(e)
508
+ ] : [
509
+ "cube",
510
+ "load",
511
+ null
512
+ ];
513
+ }
514
+ function D(e) {
515
+ return e ? !!(e.measures && e.measures.length > 0) || !!(e.dimensions && e.dimensions.length > 0) || !!(e.timeDimensions && e.timeDimensions.length > 0) : !1;
516
+ }
517
+ function O(i, a = {}) {
518
+ let { skip: o = !1, debounceMs: f = T, resetResultSetOnChange: p = !0, staleTime: m = 60 * 1e3, keepPreviousData: h = !0 } = a, { cubeApi: g, batchCoordinator: _, enableBatching: y } = r(), b = n(), { features: x } = t(), S = x.manualRefresh ?? !1, [O, k] = d(null), A = D(i), { debouncedValue: j, isDebouncing: M } = w(i, {
519
+ isValid: A,
520
+ skip: o,
521
+ debounceMs: f
522
+ }), N = l(() => j ? v(j) : null, [j]), P = N ? C(N) : null, F = l(() => !S || !P || O === null ? !1 : P !== O, [
523
+ S,
524
+ P,
525
+ O
526
+ ]), I = l(() => !N || o ? !1 : !S || O === null ? !0 : O === P, [
527
+ N,
528
+ o,
529
+ S,
530
+ O,
531
+ P
532
+ ]), L = u(!1), R = e({
533
+ queryKey: E(N),
534
+ queryFn: async () => {
535
+ if (!N) throw Error("No query provided");
536
+ let e = L.current;
537
+ return L.current = !1, e ? g.load(N, { bustCache: !0 }) : y && _ ? _.register(N) : g.load(N);
538
+ },
539
+ enabled: I,
540
+ staleTime: m,
541
+ placeholderData: h ? (e) => e : void 0
542
+ });
543
+ c(() => {
544
+ !S && N && !o && k(P);
545
+ }, [
546
+ S,
547
+ N,
548
+ o,
549
+ P
550
+ ]), c(() => {
551
+ S && I && R.isSuccess && !R.isFetching && N && k(P);
552
+ }, [
553
+ S,
554
+ I,
555
+ R.isSuccess,
556
+ R.isFetching,
557
+ N,
558
+ P
559
+ ]);
560
+ let z = l(() => {
561
+ if (!R.data) return null;
562
+ try {
563
+ return R.data.rawData();
564
+ } catch {
565
+ return null;
566
+ }
567
+ }, [R.data]), B = l(() => {
568
+ if (!R.data?.loadResponse) return;
569
+ let e = R.data.loadResponse;
570
+ return e.results && e.results[0]?.warnings ? e.results[0].warnings : e.warnings;
571
+ }, [R.data]), V = s((e) => {
572
+ N && (k(P), e?.bustCache && (L.current = !0), b.invalidateQueries({ queryKey: E(N) }));
573
+ }, [
574
+ N,
575
+ P,
576
+ b
577
+ ]), H = V;
578
+ return {
579
+ resultSet: l(() => R.data ?? null, [
580
+ R.data,
581
+ M,
582
+ p
583
+ ]),
584
+ rawData: z,
585
+ isLoading: R.isLoading || M,
586
+ isFetching: R.isFetching,
587
+ isDebouncing: M,
588
+ error: R.error,
589
+ debouncedQuery: j,
590
+ isValidQuery: A,
591
+ refetch: H,
592
+ clearCache: () => {
593
+ b.removeQueries({ queryKey: ["cube", "load"] });
594
+ },
595
+ needsRefresh: F,
596
+ executeQuery: V,
597
+ warnings: B
598
+ };
599
+ }
600
+ //#endregion
601
+ //#region src/client/utils/multiQueryUtils.ts
602
+ function k(e) {
603
+ return e.length > 0 && typeof e[0] == "object" && e[0] !== null && "__queryIndex" in e[0];
604
+ }
605
+ function A(e) {
606
+ if (!k(e)) return [];
607
+ let t = /* @__PURE__ */ new Set();
608
+ for (let n of e) {
609
+ let e = n.__queryLabel;
610
+ typeof e == "string" && t.add(e);
611
+ }
612
+ return Array.from(t);
613
+ }
614
+ function j(e) {
615
+ if (!k(e)) return [];
616
+ let t = /* @__PURE__ */ new Set();
617
+ for (let n of e) {
618
+ let e = n.__queryIndex;
619
+ typeof e == "number" && t.add(e);
620
+ }
621
+ return Array.from(t).sort((e, t) => e - t);
622
+ }
623
+ function M(e, t, n) {
624
+ let r = [];
625
+ return e.forEach((e, t) => {
626
+ let i = e.rawData(), a = n?.[t] || `Query ${t + 1}`;
627
+ i.forEach((e) => {
628
+ r.push({
629
+ ...e,
630
+ __queryIndex: t,
631
+ __queryLabel: a
632
+ });
633
+ });
634
+ }), r;
635
+ }
636
+ function N(e, t, n, r) {
637
+ let i = /* @__PURE__ */ new Map();
638
+ return e.forEach((e, r) => {
639
+ let a = e.rawData(), o = t[r].measures || [];
640
+ a.forEach((e) => {
641
+ let t = n.map((t) => String(e[t] ?? "")).join("|");
642
+ if (!i.has(t)) {
643
+ let r = {};
644
+ n.forEach((t) => {
645
+ r[t] = e[t];
646
+ }), i.set(t, r);
647
+ }
648
+ let a = i.get(t);
649
+ o.forEach((t) => {
650
+ t in a || (a[t] = e[t]);
651
+ }), r === 0 && Object.keys(e).forEach((t) => {
652
+ !n.includes(t) && !o.includes(t) && (t in a || (a[t] = e[t]));
653
+ });
654
+ });
655
+ }), Array.from(i.values()).sort((e, t) => {
656
+ let r = String(e[n[0]] ?? ""), i = String(t[n[0]] ?? "");
657
+ return r.localeCompare(i);
658
+ });
659
+ }
660
+ function P(e, t, n, r, i) {
661
+ return e.length === 0 ? [] : e.length === 1 ? e[0].rawData() : n === "merge" && r && r.length > 0 ? N(e, t, r, i) : M(e, t, i);
662
+ }
663
+ function F(e, t) {
664
+ let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
665
+ return e.forEach((e) => {
666
+ e.measures?.forEach((e) => n.add(e)), e.dimensions?.forEach((e) => r.add(e)), e.timeDimensions?.forEach((e) => i.add(e.dimension));
667
+ }), {
668
+ measures: Array.from(n),
669
+ dimensions: Array.from(r),
670
+ timeDimensions: Array.from(i)
671
+ };
672
+ }
673
+ function I(e, t) {
674
+ if (e.measures && e.measures.length > 0) {
675
+ let t = e.measures[0], n = t.split(".");
676
+ return n.length > 1 ? n[n.length - 1] : t;
677
+ }
678
+ return `Query ${t + 1}`;
679
+ }
680
+ function L(e, t) {
681
+ let n = [];
682
+ return e.forEach((e, r) => {
683
+ [...e.dimensions || [], ...e.timeDimensions?.map((e) => e.dimension) || []].includes(t) || n.push(r);
684
+ }), {
685
+ isValid: n.length === 0,
686
+ missingInQueries: n
687
+ };
688
+ }
689
+ //#endregion
690
+ //#region src/client/hooks/queries/useMultiCubeLoadQuery.ts
691
+ var R = 300;
692
+ function z(e) {
693
+ return e ? [
694
+ "cube",
695
+ "multiLoad",
696
+ C(e)
697
+ ] : [
698
+ "cube",
699
+ "multiLoad",
700
+ null
701
+ ];
702
+ }
703
+ function B(e) {
704
+ return !e || !e.queries || e.queries.length < 2 ? !1 : e.queries.filter((e) => e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0).length >= 2;
705
+ }
706
+ function V(t, i = {}) {
707
+ let { skip: a = !1, debounceMs: o = R, resetResultSetOnChange: s = !0, staleTime: c = 60 * 1e3, keepPreviousData: u = !0 } = i, { cubeApi: d, batchCoordinator: f, enableBatching: p } = r(), m = n(), h = B(t), { debouncedValue: g, isDebouncing: _ } = w(t, {
708
+ isValid: h,
709
+ skip: a,
710
+ debounceMs: o
711
+ }), y = l(() => g ? {
712
+ ...g,
713
+ queries: g.queries.map((e) => v(e))
714
+ } : null, [g]), b = e({
715
+ queryKey: z(y),
716
+ queryFn: async () => {
717
+ if (!y) throw Error("No config provided");
718
+ let e;
719
+ e = p && f ? await Promise.all(y.queries.map((e) => f.register(e))) : await d.batchLoad(y.queries);
720
+ let t = e.map((e) => e && "error" in e && e.error ? Error(e.error) : null), n = e.map((e, n) => {
721
+ if (t[n]) return null;
722
+ try {
723
+ return e.rawData();
724
+ } catch {
725
+ return null;
726
+ }
727
+ }), r = e.filter((e, n) => !t[n]), i = y.queries.filter((e, n) => !t[n]);
728
+ return {
729
+ data: r.length > 0 ? P(r, i, y.mergeStrategy, y.mergeKeys, y.queryLabels) : [],
730
+ resultSets: e,
731
+ perQueryData: n,
732
+ errors: t,
733
+ firstError: t.find((e) => e !== null) || null
734
+ };
735
+ },
736
+ enabled: !!y && !a,
737
+ staleTime: c,
738
+ placeholderData: u ? (e) => e : void 0
739
+ });
740
+ return {
741
+ data: b.data?.data ?? null,
742
+ resultSets: b.data?.resultSets ?? null,
743
+ perQueryData: b.data?.perQueryData ?? null,
744
+ isLoading: b.isLoading || _,
745
+ isFetching: b.isFetching,
746
+ isDebouncing: _,
747
+ error: b.data?.firstError ?? b.error,
748
+ errors: b.data?.errors ?? [],
749
+ debouncedConfig: g,
750
+ isValidConfig: h,
751
+ refetch: (e) => {
752
+ y && (e?.bustCache ? (m.removeQueries({ queryKey: z(y) }), m.fetchQuery({
753
+ queryKey: z(y),
754
+ queryFn: async () => {
755
+ let e = await d.batchLoad(y.queries, { bustCache: !0 }), t = e.map((e) => e && "error" in e && e.error ? Error(e.error) : null);
756
+ return {
757
+ data: y.mergeStrategy === "concat" ? e.flatMap((e) => e?.rawData() || []) : e[0]?.rawData() || [],
758
+ resultSets: e,
759
+ perQueryData: y.mergeStrategy === "concat" ? e.map((e) => e?.rawData() || []) : [],
760
+ errors: t,
761
+ firstError: t.find((e) => e !== null) || null
762
+ };
763
+ }
764
+ })) : m.refetchQueries({ queryKey: z(y) }));
765
+ }
766
+ };
767
+ }
768
+ //#endregion
769
+ //#region src/client/hooks/queries/useFunnelQuery.ts
770
+ var H = 300;
771
+ function U(e) {
772
+ if (!e || !e.bindingKey || !e.steps || e.steps.length < 2) return !1;
773
+ if (typeof e.bindingKey.dimension == "string") {
774
+ if (!e.bindingKey.dimension) return !1;
775
+ } else if (Array.isArray(e.bindingKey.dimension) && e.bindingKey.dimension.length === 0) return !1;
776
+ for (let t of e.steps) {
777
+ let e = t.query;
778
+ if (!(e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0 || e.filters && e.filters.length > 0)) return !1;
779
+ }
780
+ return !0;
781
+ }
782
+ function W(o, u = {}) {
783
+ let { skip: f = !1, debounceMs: p = H, onComplete: m, onError: h, prebuiltServerQuery: g } = u, { cubeApi: _ } = r(), v = n(), { features: y } = t(), b = y.manualRefresh ?? !1, [x, S] = d(null), T = U(o), { debouncedValue: E, isDebouncing: D } = w(o, {
784
+ isValid: T,
785
+ skip: f,
786
+ debounceMs: p
787
+ }), O = l(() => {
788
+ if (g) return g;
789
+ if (!E || !T) return null;
790
+ try {
791
+ return i(E.steps.map((e) => e.query), E.bindingKey, E.steps.map((e) => e.name), E.steps.map((e) => e.timeToConvert || null), !0);
792
+ } catch (e) {
793
+ return console.error("Failed to build server funnel query:", e), null;
794
+ }
795
+ }, [
796
+ g,
797
+ E,
798
+ T
799
+ ]), k = l(() => O ? [
800
+ "cube",
801
+ "funnel",
802
+ O.funnel?.steps?.length || 0,
803
+ JSON.stringify(O)
804
+ ] : [
805
+ "cube",
806
+ "funnel",
807
+ null
808
+ ], [O]), A = O ? C(O) : null, j = l(() => !b || !A || x === null ? !1 : A !== x, [
809
+ b,
810
+ A,
811
+ x
812
+ ]), M = l(() => !O || f ? !1 : !b || x === null ? !0 : x === A, [
813
+ O,
814
+ f,
815
+ b,
816
+ x,
817
+ A
818
+ ]);
819
+ c(() => {
820
+ !b && O && !f && S(A);
821
+ }, [
822
+ b,
823
+ O,
824
+ f,
825
+ A
826
+ ]);
827
+ let N = e({
828
+ queryKey: k,
829
+ queryFn: async () => {
830
+ if (!O) throw Error("No server query available");
831
+ let e = performance.now();
832
+ try {
833
+ let t = await _.load(O);
834
+ return {
835
+ rawData: t.rawData(),
836
+ executionTime: performance.now() - e,
837
+ cacheInfo: t.cacheInfo?.()
838
+ };
839
+ } catch (e) {
840
+ let t = e instanceof Error ? e : Error(String(e));
841
+ throw h?.(t, 0), t;
842
+ }
843
+ },
844
+ enabled: M,
845
+ staleTime: 6e4,
846
+ gcTime: 300 * 1e3
847
+ });
848
+ c(() => {
849
+ b && M && N.isSuccess && !N.isFetching && O && S(A);
850
+ }, [
851
+ b,
852
+ M,
853
+ N.isSuccess,
854
+ N.isFetching,
855
+ O,
856
+ A
857
+ ]);
858
+ let P = l(() => g?.funnel?.steps ? g.funnel.steps.map((e) => e.name) : E?.steps?.map((e) => e.name), [g, E]), F = l(() => g?.funnel?.steps ? g.funnel.steps.length : E?.steps?.length || 0, [g, E]), I = l(() => !N.data?.rawData || N.data.rawData.length !== F ? [] : a(N.data.rawData, P), [
859
+ N.data,
860
+ F,
861
+ P
862
+ ]), L = l(() => {
863
+ if (!I.length) return [];
864
+ let e = I[0]?.value || 0;
865
+ return I.map((t, n) => ({
866
+ stepIndex: n,
867
+ stepName: t.name,
868
+ stepId: E?.steps?.[n]?.id || `step-${n}`,
869
+ data: [],
870
+ bindingKeyValues: [],
871
+ bindingKeyTotalCount: 0,
872
+ count: t.value,
873
+ conversionRate: t.conversionRate === null ? null : t.conversionRate / 100,
874
+ cumulativeConversionRate: e > 0 ? t.value / e : 0,
875
+ executionTime: N.data?.executionTime || 0,
876
+ error: null
877
+ }));
878
+ }, [
879
+ I,
880
+ E,
881
+ N.data?.executionTime
882
+ ]), R = l(() => {
883
+ if (!I.length || !E && !g) return null;
884
+ let e = I[0]?.value || 0, t = I[I.length - 1]?.value || 0, n = {
885
+ config: E || {
886
+ id: "prebuilt-funnel",
887
+ name: "Funnel Analysis",
888
+ bindingKey: { dimension: typeof g?.funnel?.bindingKey == "string" ? g.funnel.bindingKey : g?.funnel?.bindingKey?.[0]?.dimension || "" },
889
+ steps: (g?.funnel?.steps || []).map((e, t) => ({
890
+ id: `step-${t}`,
891
+ name: e.name,
892
+ query: { filters: e.filter ? [e.filter] : [] },
893
+ timeToConvert: e.timeToConvert || void 0
894
+ }))
895
+ },
896
+ steps: L,
897
+ summary: {
898
+ totalEntries: e,
899
+ totalCompletions: t,
900
+ overallConversionRate: e > 0 ? t / e : 0,
901
+ totalExecutionTime: N.data?.executionTime || 0
902
+ },
903
+ chartData: I,
904
+ status: N.isError ? "error" : N.isLoading ? "executing" : N.isSuccess ? "success" : "idle",
905
+ error: N.error,
906
+ currentStepIndex: null
907
+ };
908
+ return N.isSuccess && !N.isFetching && m?.(n), n;
909
+ }, [
910
+ E,
911
+ g,
912
+ I,
913
+ L,
914
+ N,
915
+ m
916
+ ]), z = N.isError ? "error" : N.isLoading ? "executing" : N.isSuccess ? "success" : "idle", B = s(async (e) => {
917
+ if (!O) return null;
918
+ S(A);
919
+ try {
920
+ return e?.bustCache ? (v.removeQueries({ queryKey: k }), await v.fetchQuery({
921
+ queryKey: k,
922
+ queryFn: async () => {
923
+ let e = performance.now(), t = await _.load(O, { bustCache: !0 });
924
+ return {
925
+ rawData: t.rawData(),
926
+ executionTime: performance.now() - e,
927
+ cacheInfo: t.cacheInfo?.()
928
+ };
929
+ }
930
+ })) : await N.refetch(), R;
931
+ } catch {
932
+ return R;
933
+ }
934
+ }, [
935
+ O,
936
+ N,
937
+ R,
938
+ v,
939
+ k,
940
+ _,
941
+ A
942
+ ]), V = s(() => {}, []), W = s(() => {
943
+ v.removeQueries({ queryKey: k });
944
+ }, [v, k]);
945
+ return {
946
+ result: R,
947
+ status: z,
948
+ isExecuting: N.isLoading || N.isFetching,
949
+ isDebouncing: D,
950
+ currentStepIndex: null,
951
+ stepLoadingStates: [],
952
+ stepResults: L,
953
+ chartData: I,
954
+ error: N.error,
955
+ execute: B,
956
+ cancel: V,
957
+ reset: W,
958
+ executedQueries: [],
959
+ serverQuery: O,
960
+ cacheInfo: N.data?.cacheInfo ?? null,
961
+ needsRefresh: j
962
+ };
963
+ }
964
+ function G(e) {
965
+ return e ? [
966
+ "cube",
967
+ "funnel",
968
+ JSON.stringify(e)
969
+ ] : [
970
+ "cube",
971
+ "funnel",
972
+ null
973
+ ];
974
+ }
975
+ //#endregion
976
+ //#region src/client/hooks/queries/useFlowQuery.ts
977
+ var K = 300;
978
+ function q(e) {
979
+ if (!e?.flow) return !1;
980
+ let { flow: t } = e;
981
+ return !(!t.bindingKey || !t.timeDimension || !t.eventDimension || !t.startingStep?.filter || t.stepsBefore < 0 || t.stepsBefore > 5 || t.stepsAfter < 0 || t.stepsAfter > 5);
982
+ }
983
+ function J(e) {
984
+ if (e.length === 1) {
985
+ let t = e[0];
986
+ if (t && typeof t == "object" && "nodes" in t && "links" in t) return t;
987
+ }
988
+ if (e.length > 0) {
989
+ let t = e[0];
990
+ if (t && typeof t == "object" && o(t)) return t;
991
+ }
992
+ return null;
993
+ }
994
+ function Y(i, a = {}) {
995
+ let { skip: o = !1, debounceMs: u = K, onComplete: f, onError: p } = a, { cubeApi: m } = r(), h = n(), { features: g } = t(), _ = g.manualRefresh ?? !1, [v, y] = d(null), b = q(i), { debouncedValue: x, isDebouncing: S } = w(i, {
996
+ isValid: b,
997
+ skip: o,
998
+ debounceMs: u
999
+ }), T = l(() => x ? JSON.stringify(x) : null, [x]), E = l(() => i ? JSON.stringify(i) : null, [i]), D = l(() => x ? [
1000
+ "cube",
1001
+ "flow",
1002
+ T
1003
+ ] : [
1004
+ "cube",
1005
+ "flow",
1006
+ null
1007
+ ], [x, T]), O = i ? C(i) : null, k = l(() => !_ || !O || v === null ? !1 : O !== v, [
1008
+ _,
1009
+ O,
1010
+ v
1011
+ ]), A = l(() => !b || !x || o ? !1 : !_ || v === null ? !0 : v === O, [
1012
+ b,
1013
+ x,
1014
+ o,
1015
+ _,
1016
+ v,
1017
+ O
1018
+ ]);
1019
+ c(() => {
1020
+ !_ && i && !o && b && y(O);
1021
+ }, [
1022
+ _,
1023
+ i,
1024
+ o,
1025
+ b,
1026
+ O
1027
+ ]);
1028
+ let j = e({
1029
+ queryKey: D,
1030
+ queryFn: async () => {
1031
+ if (!x) throw Error("No flow query available");
1032
+ let e = performance.now();
1033
+ try {
1034
+ let t = await m.load(x);
1035
+ return {
1036
+ rawData: t.rawData(),
1037
+ executionTime: performance.now() - e,
1038
+ cacheInfo: t.cacheInfo?.(),
1039
+ queryKeyString: E
1040
+ };
1041
+ } catch (e) {
1042
+ let t = e instanceof Error ? e : Error(String(e));
1043
+ throw p?.(t), t;
1044
+ }
1045
+ },
1046
+ enabled: A,
1047
+ staleTime: 6e4,
1048
+ gcTime: 300 * 1e3
1049
+ });
1050
+ c(() => {
1051
+ _ && A && j.isSuccess && !j.isFetching && x && y(O);
1052
+ }, [
1053
+ _,
1054
+ A,
1055
+ j.isSuccess,
1056
+ j.isFetching,
1057
+ x,
1058
+ O
1059
+ ]);
1060
+ let M = E !== null && j.data?.queryKeyString !== void 0 && j.data.queryKeyString !== E, N = l(() => {
1061
+ if (M || !j.data?.rawData) return null;
1062
+ let e = J(j.data.rawData);
1063
+ return e && j.isSuccess && !j.isFetching && f?.(e), e;
1064
+ }, [
1065
+ j.data,
1066
+ j.isSuccess,
1067
+ j.isFetching,
1068
+ f,
1069
+ M
1070
+ ]), P = s((e) => {
1071
+ x && b && (y(O), e?.bustCache ? (h.removeQueries({ queryKey: D }), h.fetchQuery({
1072
+ queryKey: D,
1073
+ queryFn: async () => {
1074
+ let e = performance.now(), t = await m.load(x, { bustCache: !0 });
1075
+ return {
1076
+ rawData: t.rawData(),
1077
+ executionTime: performance.now() - e,
1078
+ cacheInfo: t.cacheInfo?.()
1079
+ };
1080
+ }
1081
+ })) : j.refetch());
1082
+ }, [
1083
+ x,
1084
+ b,
1085
+ j,
1086
+ h,
1087
+ D,
1088
+ m,
1089
+ O
1090
+ ]), F = s(() => {
1091
+ h.removeQueries({ queryKey: D });
1092
+ }, [h, D]);
1093
+ return {
1094
+ data: N,
1095
+ rawData: M ? null : j.data?.rawData ?? null,
1096
+ cacheInfo: j.data?.cacheInfo ?? null,
1097
+ isLoading: j.isLoading || M,
1098
+ isFetching: j.isFetching,
1099
+ isDebouncing: S,
1100
+ isExecuting: j.isLoading || j.isFetching || M,
1101
+ error: j.error,
1102
+ refetch: P,
1103
+ reset: F,
1104
+ serverQuery: x,
1105
+ needsRefresh: k
1106
+ };
1107
+ }
1108
+ function X(e) {
1109
+ return e ? [
1110
+ "cube",
1111
+ "flow",
1112
+ JSON.stringify(e)
1113
+ ] : [
1114
+ "cube",
1115
+ "flow",
1116
+ null
1117
+ ];
1118
+ }
1119
+ //#endregion
1120
+ //#region src/client/hooks/queries/useRetentionQuery.ts
1121
+ var Z = 300;
1122
+ function Q(e) {
1123
+ return !(!e || !e.retention || !e.retention.timeDimension || !e.retention.bindingKey || !e.retention.periods || e.retention.periods < 1);
1124
+ }
1125
+ function ee(e) {
1126
+ if (e) {
1127
+ if (typeof e == "string") return e.split(".").pop();
1128
+ if (Array.isArray(e) && e.length > 0) {
1129
+ let t = e[0];
1130
+ if (t?.dimension) return t.dimension.split(".").pop();
1131
+ }
1132
+ }
1133
+ }
1134
+ function te(e) {
1135
+ if (typeof e == "string") return e;
1136
+ if (e && typeof e == "object" && !Array.isArray(e)) {
1137
+ let t = Object.values(e);
1138
+ if (t.length > 0 && t[0] != null) return String(t[0]);
1139
+ }
1140
+ return null;
1141
+ }
1142
+ function $(e, t, n) {
1143
+ if (!e || !Array.isArray(e) || e.length === 0) return {
1144
+ rows: [],
1145
+ periods: [],
1146
+ granularity: t,
1147
+ bindingKeyLabel: n
1148
+ };
1149
+ let r = e.map((e) => {
1150
+ let t = e;
1151
+ return {
1152
+ period: Number(t.period ?? t.period_number ?? 0),
1153
+ cohortSize: Number(t.cohortSize ?? t.cohort_size ?? 0),
1154
+ retainedUsers: Number(t.retainedUsers ?? t.retained_users ?? 0),
1155
+ retentionRate: Number(t.retentionRate ?? t.retention_rate ?? 0),
1156
+ breakdownValue: te(t.breakdownValues) ?? t.breakdownValue ?? t.breakdown_value ?? null
1157
+ };
1158
+ }), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1159
+ r.forEach((e) => {
1160
+ i.add(e.period), e.breakdownValue && a.add(e.breakdownValue);
1161
+ });
1162
+ let o = Array.from(i).sort((e, t) => e - t), s = a.size > 0 ? Array.from(a).sort() : void 0;
1163
+ return {
1164
+ rows: r,
1165
+ periods: o,
1166
+ breakdownValues: s,
1167
+ summary: ne(r, s),
1168
+ granularity: t,
1169
+ bindingKeyLabel: n
1170
+ };
1171
+ }
1172
+ function ne(e, t) {
1173
+ let n = e.filter((e) => e.period === 1).map((e) => e.retentionRate);
1174
+ return {
1175
+ totalUsers: e.filter((e) => e.period === 0).reduce((e, t) => e + t.cohortSize, 0),
1176
+ avgPeriod1Retention: n.length > 0 ? n.reduce((e, t) => e + t, 0) / n.length : 0,
1177
+ maxPeriod1Retention: n.length > 0 ? Math.max(...n) : 0,
1178
+ minPeriod1Retention: n.length > 0 ? Math.min(...n) : 0,
1179
+ segmentCount: t?.length || 1
1180
+ };
1181
+ }
1182
+ function re(i, a = {}) {
1183
+ let { skip: o = !1, debounceMs: u = Z, onComplete: f, onError: p, getFieldLabel: m } = a, { cubeApi: h } = r(), g = n(), { features: _ } = t(), v = _.manualRefresh ?? !1, [y, b] = d(null), { debouncedValue: x, isDebouncing: S } = w(i, {
1184
+ isValid: Q(i),
1185
+ skip: o,
1186
+ debounceMs: u
1187
+ }), T = l(() => x ? [
1188
+ "cube",
1189
+ "retention",
1190
+ JSON.stringify(x)
1191
+ ] : [
1192
+ "cube",
1193
+ "retention",
1194
+ null
1195
+ ], [x]), E = x ? C(x) : null, D = l(() => !v || !E || y === null ? !1 : E !== y, [
1196
+ v,
1197
+ E,
1198
+ y
1199
+ ]), O = l(() => !x || o ? !1 : !v || y === null ? !0 : y === E, [
1200
+ x,
1201
+ o,
1202
+ v,
1203
+ y,
1204
+ E
1205
+ ]);
1206
+ c(() => {
1207
+ !v && x && !o && b(E);
1208
+ }, [
1209
+ v,
1210
+ x,
1211
+ o,
1212
+ E
1213
+ ]);
1214
+ let k = e({
1215
+ queryKey: T,
1216
+ queryFn: async () => {
1217
+ if (!x) throw Error("No retention query available");
1218
+ let e = performance.now();
1219
+ try {
1220
+ let t = await h.load(x);
1221
+ return {
1222
+ rawData: t.rawData(),
1223
+ executionTime: performance.now() - e,
1224
+ cacheInfo: t.cacheInfo?.()
1225
+ };
1226
+ } catch (e) {
1227
+ let t = e instanceof Error ? e : Error(String(e));
1228
+ throw p?.(t), t;
1229
+ }
1230
+ },
1231
+ enabled: O,
1232
+ staleTime: 6e4,
1233
+ gcTime: 300 * 1e3
1234
+ });
1235
+ c(() => {
1236
+ v && O && k.isSuccess && !k.isFetching && x && b(E);
1237
+ }, [
1238
+ v,
1239
+ O,
1240
+ k.isSuccess,
1241
+ k.isFetching,
1242
+ x,
1243
+ E
1244
+ ]);
1245
+ let A = i?.retention?.granularity, j = l(() => {
1246
+ let e = i?.retention?.bindingKey;
1247
+ if (e) {
1248
+ if (typeof e == "string") return e;
1249
+ if (Array.isArray(e) && e.length > 0) return e[0]?.dimension;
1250
+ }
1251
+ }, [i?.retention?.bindingKey]), M = l(() => {
1252
+ if (j && m) {
1253
+ let e = m(j);
1254
+ if (e && e !== j) return e;
1255
+ }
1256
+ return ee(i?.retention?.bindingKey);
1257
+ }, [
1258
+ j,
1259
+ m,
1260
+ i?.retention?.bindingKey
1261
+ ]), N = l(() => {
1262
+ if (!k.data?.rawData) return null;
1263
+ let e = $(k.data.rawData, A, M);
1264
+ return k.isSuccess && !k.isFetching && f?.(e), e;
1265
+ }, [
1266
+ k.data,
1267
+ k.isSuccess,
1268
+ k.isFetching,
1269
+ f,
1270
+ A,
1271
+ M
1272
+ ]), P = s(async (e) => x ? (e?.bustCache && g.removeQueries({ queryKey: T }), b(E), $((await g.fetchQuery({
1273
+ queryKey: T,
1274
+ queryFn: async () => {
1275
+ let e = await h.load(x);
1276
+ return {
1277
+ rawData: e.rawData(),
1278
+ executionTime: 0,
1279
+ cacheInfo: e.cacheInfo?.()
1280
+ };
1281
+ }
1282
+ })).rawData, A, M)) : null, [
1283
+ x,
1284
+ g,
1285
+ T,
1286
+ h,
1287
+ E,
1288
+ A,
1289
+ M
1290
+ ]), F = s(() => {
1291
+ k.refetch();
1292
+ }, [k]), I = l(() => k.isError ? "error" : k.isLoading ? "loading" : k.isSuccess ? "success" : "idle", [
1293
+ k.isError,
1294
+ k.isLoading,
1295
+ k.isSuccess
1296
+ ]);
1297
+ return {
1298
+ chartData: N,
1299
+ rawData: k.data?.rawData ?? null,
1300
+ status: I,
1301
+ isLoading: k.isLoading,
1302
+ isFetching: k.isFetching,
1303
+ isDebouncing: S,
1304
+ error: k.error,
1305
+ cacheInfo: k.data?.cacheInfo ?? null,
1306
+ execute: P,
1307
+ refetch: F,
1308
+ needsRefresh: D
1309
+ };
1310
+ }
1311
+ //#endregion
1312
+ //#region src/client/hooks/useFilterValues.ts
1313
+ function ie(e, t = !0) {
1314
+ let [n, r] = d(null), i = u(""), { resultSet: a, isLoading: o, error: f } = O(n, {
1315
+ skip: !n || !t || !e,
1316
+ debounceMs: 150,
1317
+ keepPreviousData: !0
1318
+ }), p = l(() => {
1319
+ if (!a || o || f || !e) return [];
1320
+ try {
1321
+ let t = a.tablePivot(), n = /* @__PURE__ */ new Set();
1322
+ return t.forEach((t) => {
1323
+ let r = t[e];
1324
+ r != null && r !== "" && n.add(r);
1325
+ }), Array.from(n);
1326
+ } catch (e) {
1327
+ return console.error("Error extracting values from result set:", e), [];
1328
+ }
1329
+ }, [
1330
+ a,
1331
+ o,
1332
+ f,
1333
+ e
1334
+ ]);
1335
+ c(() => {
1336
+ (!e || !t) && (r(null), i.current = "");
1337
+ }, [e, t]);
1338
+ let m = s(() => {
1339
+ if (e) {
1340
+ i.current = "";
1341
+ try {
1342
+ r({
1343
+ dimensions: [e],
1344
+ limit: 25,
1345
+ order: { [e]: "asc" }
1346
+ });
1347
+ } catch (e) {
1348
+ console.error("Error creating query:", e);
1349
+ }
1350
+ }
1351
+ }, [e]), h = s((t, n = !1) => {
1352
+ if (e && !(!n && t === i.current)) {
1353
+ i.current = t;
1354
+ try {
1355
+ let n = {
1356
+ dimensions: [e],
1357
+ limit: 25,
1358
+ order: { [e]: "asc" }
1359
+ };
1360
+ t && t.trim() && (n.filters = [{
1361
+ member: e,
1362
+ operator: "contains",
1363
+ values: [t.trim()]
1364
+ }]), r(n);
1365
+ } catch (e) {
1366
+ console.error("Error creating search query:", e);
1367
+ }
1368
+ }
1369
+ }, [e]);
1370
+ return {
1371
+ values: p,
1372
+ loading: o,
1373
+ error: f ? f instanceof Error ? f.message : String(f) : null,
1374
+ refetch: m,
1375
+ searchValues: h
1376
+ };
1377
+ }
1378
+ //#endregion
1379
+ //#region src/client/hooks/useDebounce.ts
1380
+ function ae(e, t) {
1381
+ let [n, r] = d(e);
1382
+ return c(() => {
1383
+ let n = setTimeout(() => {
1384
+ r(e);
1385
+ }, t);
1386
+ return () => {
1387
+ clearTimeout(n);
1388
+ };
1389
+ }, [e, t]), n;
1390
+ }
1391
+ //#endregion
1392
+ export { b as C, p as D, x as E, f as O, v as S, y as T, M as _, Y as a, O as b, z as c, F as d, j as f, N as g, P as h, X as i, V as l, k as m, ie as n, G as o, A as p, re as r, W as s, ae as t, I as u, L as v, S as w, C as x, E as y };
1393
+
1394
+ //# sourceMappingURL=useDebounce-BQjNWndQ.js.map