drizzle-cube 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +4 -4
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +4 -4
- package/dist/adapters/{handler-C1Qs8JMY.cjs → handler-C0nUppAK.cjs} +2 -2
- package/dist/adapters/{handler-CoaNnZyf.js → handler-Odsi9_Rd.js} +4 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +4 -4
- package/dist/adapters/{locale-CTuvUGBs.cjs → locale-Dv6bl_eU.cjs} +2 -2
- package/dist/adapters/{locale-wMBdZ3Ks.js → locale-Dy3LcTwN.js} +4 -2
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +2 -2
- package/dist/adapters/mcp-transport-BCtjU0lC.cjs +40 -0
- package/dist/adapters/mcp-transport-DW_Uks-O.js +579 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +4 -4
- package/dist/adapters/{utils-hC7Z8V39.js → utils-Bd5mzZfk.js} +25 -13
- package/dist/adapters/{utils-CIRA5_JO.cjs → utils-DklqMBHn.cjs} +2 -2
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/{DashboardEditModal-DayTXEH0.js → DashboardEditModal-BiJwVv0b.js} +11 -11
- package/dist/client/chunks/DashboardEditModal-BiJwVv0b.js.map +1 -0
- package/dist/client/chunks/{FieldSearchModal-B7Mr8UNT.js → FieldSearchModal-DdcbCwAi.js} +21 -5
- package/dist/client/chunks/{FieldSearchModal-B7Mr8UNT.js.map → FieldSearchModal-DdcbCwAi.js.map} +1 -1
- package/dist/client/chunks/{RetentionCombinedChart-D3dRmoos.js → RetentionCombinedChart-CivIny9P.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-D3dRmoos.js.map → RetentionCombinedChart-CivIny9P.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-DHPnn0qH.js → RetentionHeatmap-BHCgwZmB.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-DHPnn0qH.js.map → RetentionHeatmap-BHCgwZmB.js.map} +1 -1
- package/dist/client/chunks/{af-ZA-BtTNqvHF.js → af-ZA-BdL6DOWy.js} +3 -1
- package/dist/client/chunks/af-ZA-BdL6DOWy.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-lcGl099d.js → analysis-builder-MoGvbMRe.js} +8 -8
- package/dist/client/chunks/{analysis-builder-lcGl099d.js.map → analysis-builder-MoGvbMRe.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-6BRZcEnu.js → analysis-builder-shared-DmyRh2O3.js} +9 -9
- package/dist/client/chunks/{analysis-builder-shared-6BRZcEnu.js.map → analysis-builder-shared-DmyRh2O3.js.map} +1 -1
- package/dist/client/chunks/{chart-activity-grid-BnY-jaoa.js → chart-activity-grid-Bdb8U_NC.js} +7 -5
- package/dist/client/chunks/chart-activity-grid-Bdb8U_NC.js.map +1 -0
- package/dist/client/chunks/{chart-area-G3OvLLK4.js → chart-area-BZEnT-tf.js} +39 -38
- package/dist/client/chunks/chart-area-BZEnT-tf.js.map +1 -0
- package/dist/client/chunks/{chart-bar-MLIWiLrc.js → chart-bar-CTmdv_v0.js} +53 -52
- package/dist/client/chunks/chart-bar-CTmdv_v0.js.map +1 -0
- package/dist/client/chunks/{chart-box-plot-c2XqKTWq.js → chart-box-plot-CYObdFtp.js} +3 -3
- package/dist/client/chunks/{chart-box-plot-c2XqKTWq.js.map → chart-box-plot-CYObdFtp.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-CAGvnYb1.js → chart-bubble-CjFprySz.js} +3 -3
- package/dist/client/chunks/{chart-bubble-CAGvnYb1.js.map → chart-bubble-CjFprySz.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-oSPk-KQp.js → chart-candlestick-D2HoM3B5.js} +3 -3
- package/dist/client/chunks/{chart-candlestick-oSPk-KQp.js.map → chart-candlestick-D2HoM3B5.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-Dssynumw.js → chart-config-activity-grid-Bom99j9m.js} +2 -2
- package/dist/client/chunks/{chart-config-activity-grid-Dssynumw.js.map → chart-config-activity-grid-Bom99j9m.js.map} +1 -1
- package/dist/client/chunks/{chart-config-area-40fbx2Ah.js → chart-config-area-DtYTKZxS.js} +3 -2
- package/dist/client/chunks/chart-config-area-DtYTKZxS.js.map +1 -0
- package/dist/client/chunks/{chart-config-bar-CUWHwOPN.js → chart-config-bar-7v5JVY2y.js} +3 -2
- package/dist/client/chunks/chart-config-bar-7v5JVY2y.js.map +1 -0
- package/dist/client/chunks/{chart-config-box-plot-D3Y0ien3.js → chart-config-box-plot-BHGv-wqu.js} +2 -2
- package/dist/client/chunks/{chart-config-box-plot-D3Y0ien3.js.map → chart-config-box-plot-BHGv-wqu.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bubble-BXSTKLn-.js → chart-config-bubble-BkHm-mfu.js} +2 -2
- package/dist/client/chunks/{chart-config-bubble-BXSTKLn-.js.map → chart-config-bubble-BkHm-mfu.js.map} +1 -1
- package/dist/client/chunks/{chart-config-candlestick-DEuD2Av0.js → chart-config-candlestick-D1aaHvTe.js} +2 -2
- package/dist/client/chunks/{chart-config-candlestick-DEuD2Av0.js.map → chart-config-candlestick-D1aaHvTe.js.map} +1 -1
- package/dist/client/chunks/{chart-config-data-table-BQXSn4b_.js → chart-config-data-table-B_Hw8w2J.js} +2 -2
- package/dist/client/chunks/{chart-config-data-table-BQXSn4b_.js.map → chart-config-data-table-B_Hw8w2J.js.map} +1 -1
- package/dist/client/chunks/{chart-config-funnel-BzEsHmjR.js → chart-config-funnel-DL8PSGuL.js} +2 -2
- package/dist/client/chunks/{chart-config-funnel-BzEsHmjR.js.map → chart-config-funnel-DL8PSGuL.js.map} +1 -1
- package/dist/client/chunks/{chart-config-gauge-CCva3FfA.js → chart-config-gauge-BVLxuA3f.js} +2 -2
- package/dist/client/chunks/{chart-config-gauge-CCva3FfA.js.map → chart-config-gauge-BVLxuA3f.js.map} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-Db4Z8UUn.js → chart-config-heat-map-CjudGdui.js} +2 -2
- package/dist/client/chunks/{chart-config-heat-map-Db4Z8UUn.js.map → chart-config-heat-map-CjudGdui.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-BfLf3iyi.js → chart-config-kpi-delta-Bf47hGqD.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-delta-BfLf3iyi.js.map → chart-config-kpi-delta-Bf47hGqD.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DWKFc9PX.js → chart-config-kpi-number-QTQRNgOi.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-number-DWKFc9PX.js.map → chart-config-kpi-number-QTQRNgOi.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-Dr4OG6cY.js → chart-config-kpi-text-BRze2eyh.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-text-Dr4OG6cY.js.map → chart-config-kpi-text-BRze2eyh.js.map} +1 -1
- package/dist/client/chunks/{chart-config-line-DGYYdDw9.js → chart-config-line-BFeCqmKH.js} +3 -2
- package/dist/client/chunks/chart-config-line-BFeCqmKH.js.map +1 -0
- package/dist/client/chunks/{chart-config-markdown-C-_g_8te.js → chart-config-markdown-EWYckwXv.js} +2 -2
- package/dist/client/chunks/{chart-config-markdown-C-_g_8te.js.map → chart-config-markdown-EWYckwXv.js.map} +1 -1
- package/dist/client/chunks/{chart-config-measure-profile-sB3n_Azv.js → chart-config-measure-profile-B9nIhqKR.js} +2 -2
- package/dist/client/chunks/{chart-config-measure-profile-sB3n_Azv.js.map → chart-config-measure-profile-B9nIhqKR.js.map} +1 -1
- package/dist/client/chunks/{chart-config-pie-kte7OXa9.js → chart-config-pie-6LHtEyMM.js} +2 -2
- package/dist/client/chunks/{chart-config-pie-kte7OXa9.js.map → chart-config-pie-6LHtEyMM.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radar-C9IxP5tc.js → chart-config-radar-BuLS6Inn.js} +2 -2
- package/dist/client/chunks/{chart-config-radar-C9IxP5tc.js.map → chart-config-radar-BuLS6Inn.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-C3WJ8Uhm.js → chart-config-radial-bar-BP0eMohx.js} +2 -2
- package/dist/client/chunks/{chart-config-radial-bar-C3WJ8Uhm.js.map → chart-config-radial-bar-BP0eMohx.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sankey-DGAThN9i.js → chart-config-sankey-CT8oGIGP.js} +2 -2
- package/dist/client/chunks/{chart-config-sankey-DGAThN9i.js.map → chart-config-sankey-CT8oGIGP.js.map} +1 -1
- package/dist/client/chunks/{chart-config-scatter-BVN_29G5.js → chart-config-scatter-DOSpN07Z.js} +2 -2
- package/dist/client/chunks/{chart-config-scatter-BVN_29G5.js.map → chart-config-scatter-DOSpN07Z.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-utejM2YS.js → chart-config-sunburst-BSUX_YoB.js} +2 -2
- package/dist/client/chunks/{chart-config-sunburst-utejM2YS.js.map → chart-config-sunburst-BSUX_YoB.js.map} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-meeJEDi8.js → chart-config-tree-map-D8GuAgVB.js} +2 -2
- package/dist/client/chunks/{chart-config-tree-map-meeJEDi8.js.map → chart-config-tree-map-D8GuAgVB.js.map} +1 -1
- package/dist/client/chunks/{chart-config-waterfall-CaPeWZMl.js → chart-config-waterfall-BDi7BoJP.js} +2 -2
- package/dist/client/chunks/{chart-config-waterfall-CaPeWZMl.js.map → chart-config-waterfall-BDi7BoJP.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-BRXHT2H-.js → chart-data-table-DT4uBZaq.js} +92 -90
- package/dist/client/chunks/{chart-data-table-BRXHT2H-.js.map → chart-data-table-DT4uBZaq.js.map} +1 -1
- package/dist/client/chunks/{chart-funnel-aQ7G_CqU.js → chart-funnel-B9crR3b3.js} +3 -3
- package/dist/client/chunks/{chart-funnel-aQ7G_CqU.js.map → chart-funnel-B9crR3b3.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-DqbDKr9E.js → chart-gauge-DAMFsicz.js} +3 -3
- package/dist/client/chunks/{chart-gauge-DqbDKr9E.js.map → chart-gauge-DAMFsicz.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map--6QnhUM8.js → chart-heat-map-BxgM_X1G.js} +3 -3
- package/dist/client/chunks/{chart-heat-map--6QnhUM8.js.map → chart-heat-map-BxgM_X1G.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-DOSpRjfs.js → chart-kpi-delta-DJKL02Ut.js} +75 -73
- package/dist/client/chunks/{chart-kpi-delta-DOSpRjfs.js.map → chart-kpi-delta-DJKL02Ut.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-BcMjeKm8.js → chart-kpi-number-CuNEYbRx.js} +66 -65
- package/dist/client/chunks/{chart-kpi-number-BcMjeKm8.js.map → chart-kpi-number-CuNEYbRx.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-BI9isc2i.js → chart-kpi-text-u8FJaZDQ.js} +27 -26
- package/dist/client/chunks/{chart-kpi-text-BI9isc2i.js.map → chart-kpi-text-u8FJaZDQ.js.map} +1 -1
- package/dist/client/chunks/{chart-line-C0IHQteu.js → chart-line-BZhzOjRl.js} +119 -118
- package/dist/client/chunks/chart-line-BZhzOjRl.js.map +1 -0
- package/dist/client/chunks/{chart-markdown-BmgSMqPg.js → chart-markdown-DEtjn8gx.js} +70 -69
- package/dist/client/chunks/chart-markdown-DEtjn8gx.js.map +1 -0
- package/dist/client/chunks/{chart-measure-profile-DEyLW1fd.js → chart-measure-profile-BnpIOS4Q.js} +4 -4
- package/dist/client/chunks/{chart-measure-profile-DEyLW1fd.js.map → chart-measure-profile-BnpIOS4Q.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-DSIekr7p.js → chart-pie-CsdzxmSK.js} +4 -4
- package/dist/client/chunks/{chart-pie-DSIekr7p.js.map → chart-pie-CsdzxmSK.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-SGl62hK8.js → chart-radar-C_9RwMKw.js} +4 -4
- package/dist/client/chunks/{chart-radar-SGl62hK8.js.map → chart-radar-C_9RwMKw.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-C42EykOa.js → chart-radial-bar-CewRelyQ.js} +4 -4
- package/dist/client/chunks/{chart-radial-bar-C42EykOa.js.map → chart-radial-bar-CewRelyQ.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-DguImp0W.js → chart-sankey-ItraHWH1.js} +3 -3
- package/dist/client/chunks/{chart-sankey-DguImp0W.js.map → chart-sankey-ItraHWH1.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-Doeox4OP.js → chart-scatter-k2IJbO2Y.js} +4 -4
- package/dist/client/chunks/{chart-scatter-Doeox4OP.js.map → chart-scatter-k2IJbO2Y.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-F3tgCpL-.js → chart-sunburst-NsFRuqi9.js} +4 -4
- package/dist/client/chunks/{chart-sunburst-F3tgCpL-.js.map → chart-sunburst-NsFRuqi9.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DvuSCIc8.js → chart-tree-map-Cj_ewpwJ.js} +4 -4
- package/dist/client/chunks/{chart-tree-map-DvuSCIc8.js.map → chart-tree-map-Cj_ewpwJ.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-Be5duXlO.js → chart-waterfall-C-MTFcOz.js} +4 -4
- package/dist/client/chunks/{chart-waterfall-Be5duXlO.js.map → chart-waterfall-C-MTFcOz.js.map} +1 -1
- package/dist/client/chunks/{charts-core-XlOwoP_r.js → charts-core-vZA3zPKb.js} +2 -2
- package/dist/client/chunks/{charts-core-XlOwoP_r.js.map → charts-core-vZA3zPKb.js.map} +1 -1
- package/dist/client/chunks/{core-Dk6z6kC0.js → core-Su6tIYhp.js} +5 -3
- package/dist/client/chunks/{core-Dk6z6kC0.js.map → core-Su6tIYhp.js.map} +1 -1
- package/dist/client/chunks/{dist-eZurnOde.js → dist-BTq3NoG3.js} +38 -32
- package/dist/client/chunks/dist-BTq3NoG3.js.map +1 -0
- package/dist/client/chunks/{en-US-5xPTdCXg.js → en-US-D-1JPTPv.js} +1 -1
- package/dist/client/chunks/{en-US-5xPTdCXg.js.map → en-US-D-1JPTPv.js.map} +1 -1
- package/dist/client/chunks/{exceljs.min-DaJsLlWM.js → exceljs.min-Dc1cBQ5l.js} +71 -45
- package/dist/client/chunks/{exceljs.min-DaJsLlWM.js.map → exceljs.min-Dc1cBQ5l.js.map} +1 -1
- package/dist/client/chunks/{javascript-DFvvCuoP.js → javascript-YXkoOgWa.js} +1 -1
- package/dist/client/chunks/{javascript-DFvvCuoP.js.map → javascript-YXkoOgWa.js.map} +1 -1
- package/dist/client/chunks/{json-BBm9TlrA.js → json-O7MKB_4V.js} +1 -1
- package/dist/client/chunks/{json-BBm9TlrA.js.map → json-O7MKB_4V.js.map} +1 -1
- package/dist/client/chunks/{nl-NL-BLDeSy_P.js → nl-NL-BErZMygi.js} +3 -1
- package/dist/client/chunks/nl-NL-BErZMygi.js.map +1 -0
- package/dist/client/chunks/{rolldown-runtime-CCl2IeXn.js → rolldown-runtime-CKnJJeip.js} +1 -1
- package/dist/client/chunks/{schema-visualization-CM5ikSWB.js → schema-visualization-BY9L2nBQ.js} +294 -290
- package/dist/client/chunks/{schema-visualization-CM5ikSWB.js.map → schema-visualization-BY9L2nBQ.js.map} +1 -1
- package/dist/client/chunks/{sql-k0GA6oZ_.js → sql-r2a-9CCK.js} +1 -1
- package/dist/client/chunks/{sql-k0GA6oZ_.js.map → sql-r2a-9CCK.js.map} +1 -1
- package/dist/client/chunks/{syntaxHighlighting-D8J6Yt9j.js → syntaxHighlighting-5zHcjn27.js} +2 -2
- package/dist/client/chunks/{syntaxHighlighting-D8J6Yt9j.js.map → syntaxHighlighting-5zHcjn27.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-NEZQbfxN.js → useDebounce-DGfYXtkm.js} +4 -4
- package/dist/client/chunks/{useDebounce-NEZQbfxN.js.map → useDebounce-DGfYXtkm.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-DivfI0dW.js → useExplainAI-CD0KuKwY.js} +4 -4
- package/dist/client/chunks/{useExplainAI-DivfI0dW.js.map → useExplainAI-CD0KuKwY.js.map} +1 -1
- package/dist/client/chunks/{utils-Ctl_cVNR.js → utils-D2SCtAkZ.js} +2 -2
- package/dist/client/chunks/{utils-Ctl_cVNR.js.map → utils-D2SCtAkZ.js.map} +1 -1
- package/dist/client/chunks/{vendor-BcLQ6iVZ.js → vendor-CfR5hJGc.js} +3 -3
- package/dist/client/chunks/{vendor-BcLQ6iVZ.js.map → vendor-CfR5hJGc.js.map} +1 -1
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +15 -15
- package/dist/client/providers.js +1 -1
- package/dist/client/schema.js +1 -1
- package/dist/client/types.d.ts +1 -0
- package/dist/client/utils.js +6 -6
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +48 -48
- package/dist/server/index.cjs +5 -5
- package/dist/server/index.js +31 -14
- package/package.json +2 -2
- package/dist/adapters/mcp-transport-B_HoB1HQ.js +0 -579
- package/dist/adapters/mcp-transport-bQzyrBPI.cjs +0 -40
- package/dist/client/chunks/DashboardEditModal-DayTXEH0.js.map +0 -1
- package/dist/client/chunks/KpiDelta-C-hZ1x01.js +0 -2
- package/dist/client/chunks/KpiNumber-Beo8CK0a.js +0 -2
- package/dist/client/chunks/KpiText-ytYiRTRO.js +0 -2
- package/dist/client/chunks/SchemaVisualization-DbYZBTyi.js +0 -2
- package/dist/client/chunks/SchemaVisualizationLazy-BGo-1S3q.js +0 -2
- package/dist/client/chunks/af-ZA-BtTNqvHF.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-BnY-jaoa.js.map +0 -1
- package/dist/client/chunks/chart-area-G3OvLLK4.js.map +0 -1
- package/dist/client/chunks/chart-bar-MLIWiLrc.js.map +0 -1
- package/dist/client/chunks/chart-config-area-40fbx2Ah.js.map +0 -1
- package/dist/client/chunks/chart-config-bar-CUWHwOPN.js.map +0 -1
- package/dist/client/chunks/chart-config-line-DGYYdDw9.js.map +0 -1
- package/dist/client/chunks/chart-line-C0IHQteu.js.map +0 -1
- package/dist/client/chunks/chart-markdown-BmgSMqPg.js.map +0 -1
- package/dist/client/chunks/dist-eZurnOde.js.map +0 -1
- package/dist/client/chunks/nl-NL-BLDeSy_P.js.map +0 -1
package/dist/server/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`drizzle-orm`);var d=class{preprocessCalculatedTemplate(e){return e}buildPattern(e,t){switch(e){case`contains`:case`notContains`:return`%${t}%`;case`startsWith`:return`${t}%`;case`endsWith`:return`%${t}`;default:return t}}parseISODuration(e){let t={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},n=e.match(/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!n)throw Error(`Invalid ISO 8601 duration format: ${e}`);return t.years=parseInt(n[1]||`0`,10),t.months=parseInt(n[2]||`0`,10),t.days=parseInt(n[3]||`0`,10),t.hours=parseInt(n[4]||`0`,10),t.minutes=parseInt(n[5]||`0`,10),t.seconds=parseFloat(n[6]||`0`),t}durationToSeconds(e){let t=this.parseISODuration(e);return t.years*365*24*60*60+t.months*30*24*60*60+t.days*24*60*60+t.hours*60*60+t.minutes*60+t.seconds}},f=class extends d{getEngineType(){return`postgres`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];t.years&&n.push(`${t.years} years`),t.months&&n.push(`${t.months} months`),t.days&&n.push(`${t.days} days`),t.hours&&n.push(`${t.hours} hours`),t.minutes&&n.push(`${t.minutes} minutes`),t.seconds&&n.push(`${t.seconds} seconds`);let r=n.join(` `)||`0 seconds`;return u.sql`INTERVAL '${u.sql.raw(r)}'`}buildTimeDifferenceSeconds(e,t){return u.sql`EXTRACT(EPOCH FROM (${e} - ${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(*) FILTER (WHERE ${n})`:u.sql`${u.sql.raw(r)}(${t}) FILTER (WHERE ${n})`}buildDateDiffPeriods(e,t,n){switch(n){case`day`:return u.sql`(${t}::date - ${e}::date)`;case`week`:return u.sql`FLOOR((${t}::date - ${e}::date) / 7)`;case`month`:return u.sql`(EXTRACT(YEAR FROM AGE(${t}::timestamp, ${e}::timestamp)) * 12 + EXTRACT(MONTH FROM AGE(${t}::timestamp, ${e}::timestamp)))::integer`;default:throw Error(`Unsupported date diff unit: ${n}`)}}buildPeriodSeriesSubquery(e){return u.sql`(SELECT generate_series(0, ${e}) as period_number) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('year', ${t}::timestamp)`;case`quarter`:return u.sql`DATE_TRUNC('quarter', ${t}::timestamp)`;case`month`:return u.sql`DATE_TRUNC('month', ${t}::timestamp)`;case`week`:return u.sql`DATE_TRUNC('week', ${t}::timestamp)`;case`day`:return u.sql`DATE_TRUNC('day', ${t}::timestamp)::timestamp`;case`hour`:return u.sql`DATE_TRUNC('hour', ${t}::timestamp)`;case`minute`:return u.sql`DATE_TRUNC('minute', ${t}::timestamp)`;case`second`:return u.sql`DATE_TRUNC('second', ${t}::timestamp)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`${e} ~* ${n}`;case`notRegex`:return u.sql`${e} !~* ${n}`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::timestamp`;case`decimal`:return u.sql`${e}::decimal`;case`integer`:return u.sql`${e}::integer`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!0,supportsPercentileSubqueries:!0,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!0}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){return u.sql`PERCENTILE_CONT(${t/100}) WITHIN GROUP (ORDER BY ${e})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},p=class extends d{getEngineType(){return`mysql`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];return t.years&&n.push(`${t.years} YEAR`),t.months&&n.push(`${t.months} MONTH`),t.days&&n.push(`${t.days} DAY`),t.hours&&n.push(`${t.hours} HOUR`),t.minutes&&n.push(`${t.minutes} MINUTE`),t.seconds&&n.push(`${t.seconds} SECOND`),u.sql`${this.durationToSeconds(e)}`}buildTimeDifferenceSeconds(e,t){return u.sql`TIMESTAMPDIFF(SECOND, ${t}, ${e})`}buildDateAddInterval(e,t){let n=this.parseISODuration(t),r=e;return n.years&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.years} YEAR)`),n.months&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.months} MONTH)`),n.days&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.days} DAY)`),n.hours&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.hours} HOUR)`),n.minutes&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.minutes} MINUTE)`),n.seconds&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.seconds} SECOND)`),r}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){let r=n.toUpperCase();return u.sql`TIMESTAMPDIFF(${u.sql.raw(r)}, ${e}, ${t})`}buildPeriodSeriesSubquery(e){return u.sql`(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`drizzle-orm`);var d=class{preprocessCalculatedTemplate(e){return e}buildPattern(e,t){switch(e){case`contains`:case`notContains`:return`%${t}%`;case`startsWith`:return`${t}%`;case`endsWith`:return`%${t}`;default:return t}}parseISODuration(e){let t={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},n=e.match(/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/);if(!n)throw Error(`Invalid ISO 8601 duration format: ${e}`);return t.years=parseInt(n[1]||`0`,10),t.months=parseInt(n[2]||`0`,10),t.days=parseInt(n[3]||`0`,10),t.hours=parseInt(n[4]||`0`,10),t.minutes=parseInt(n[5]||`0`,10),t.seconds=parseFloat(n[6]||`0`),t}durationToSeconds(e){let t=this.parseISODuration(e);return t.years*365*24*60*60+t.months*30*24*60*60+t.days*24*60*60+t.hours*60*60+t.minutes*60+t.seconds}},f=class extends d{getEngineType(){return`postgres`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];t.years&&n.push(`${t.years} years`),t.months&&n.push(`${t.months} months`),t.days&&n.push(`${t.days} days`),t.hours&&n.push(`${t.hours} hours`),t.minutes&&n.push(`${t.minutes} minutes`),t.seconds&&n.push(`${t.seconds} seconds`);let r=n.join(` `)||`0 seconds`;return u.sql`INTERVAL '${u.sql.raw(r)}'`}buildTimeDifferenceSeconds(e,t){return u.sql`EXTRACT(EPOCH FROM (${e} - ${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(*) FILTER (WHERE ${n})`:u.sql`${u.sql.raw(r)}(${t}) FILTER (WHERE ${n})`}buildDateDiffPeriods(e,t,n){switch(n){case`day`:return u.sql`(${t}::date - ${e}::date)`;case`week`:return u.sql`FLOOR((${t}::date - ${e}::date) / 7)`;case`month`:return u.sql`(EXTRACT(YEAR FROM AGE(${t}::timestamp, ${e}::timestamp)) * 12 + EXTRACT(MONTH FROM AGE(${t}::timestamp, ${e}::timestamp)))::integer`;default:throw Error(`Unsupported date diff unit: ${n}`)}}buildPeriodSeriesSubquery(e){return u.sql`(SELECT generate_series(0, ${e}) as period_number) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('year', ${t}::timestamp)`;case`quarter`:return u.sql`DATE_TRUNC('quarter', ${t}::timestamp)`;case`month`:return u.sql`DATE_TRUNC('month', ${t}::timestamp)`;case`week`:return u.sql`DATE_TRUNC('week', ${t}::timestamp)`;case`day`:return u.sql`DATE_TRUNC('day', ${t}::timestamp)::timestamp`;case`hour`:return u.sql`DATE_TRUNC('hour', ${t}::timestamp)`;case`minute`:return u.sql`DATE_TRUNC('minute', ${t}::timestamp)`;case`second`:return u.sql`DATE_TRUNC('second', ${t}::timestamp)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`${e} ~* ${n}`;case`notRegex`:return u.sql`${e} !~* ${n}`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::timestamp`;case`decimal`:return u.sql`${e}::decimal`;case`integer`:return u.sql`${e}::integer`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!0,supportsPercentileSubqueries:!0,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!0}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){return u.sql`PERCENTILE_CONT(${t/100}) WITHIN GROUP (ORDER BY ${e})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},p=class extends d{getEngineType(){return`mysql`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];return t.years&&n.push(`${t.years} YEAR`),t.months&&n.push(`${t.months} MONTH`),t.days&&n.push(`${t.days} DAY`),t.hours&&n.push(`${t.hours} HOUR`),t.minutes&&n.push(`${t.minutes} MINUTE`),t.seconds&&n.push(`${t.seconds} SECOND`),u.sql`${this.durationToSeconds(e)}`}buildTimeDifferenceSeconds(e,t){return u.sql`TIMESTAMPDIFF(SECOND, ${t}, ${e})`}buildDateAddInterval(e,t){let n=this.parseISODuration(t),r=e;return n.years&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.years} YEAR)`),n.months&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.months} MONTH)`),n.days&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.days} DAY)`),n.hours&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.hours} HOUR)`),n.minutes&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.minutes} MINUTE)`),n.seconds&&(r=u.sql`DATE_ADD(${r}, INTERVAL ${n.seconds} SECOND)`),r}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){let r=n.toUpperCase();return u.sql`TIMESTAMPDIFF(${u.sql.raw(r)}, ${e}, ${t})`}buildPeriodSeriesSubquery(e){return u.sql`(
|
|
2
2
|
WITH RECURSIVE periods(period_number) AS (
|
|
3
3
|
SELECT 0
|
|
4
4
|
UNION ALL
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
13
13
|
)
|
|
14
14
|
SELECT period_number FROM periods
|
|
15
15
|
) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`datetime(${t}, 'unixepoch', 'start of year')`;case`quarter`:{let e=u.sql`datetime(${t}, 'unixepoch')`;return u.sql`datetime(${e}, 'start of year',
|
|
16
|
-
'+' || (((CAST(strftime('%m', ${e}) AS INTEGER) - 1) / 3) * 3) || ' months')`}case`month`:return u.sql`datetime(${t}, 'unixepoch', 'start of month')`;case`week`:return u.sql`date(datetime(${t}, 'unixepoch'), 'weekday 1', '-6 days')`;case`day`:return u.sql`datetime(${t}, 'unixepoch', 'start of day')`;case`hour`:return u.sql`datetime(strftime('%Y-%m-%d %H:00:00', ${u.sql`datetime(${t}, 'unixepoch')`}))`;case`minute`:return u.sql`datetime(strftime('%Y-%m-%d %H:%M:00', ${u.sql`datetime(${t}, 'unixepoch')`}))`;case`second`:return u.sql`datetime(strftime('%Y-%m-%d %H:%M:%S', ${u.sql`datetime(${t}, 'unixepoch')`}))`;default:return u.sql`datetime(${t}, 'unixepoch')`}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`LOWER(${e}) LIKE ${`%${n.toLowerCase()}%`}`;case`notContains`:return u.sql`LOWER(${e}) NOT LIKE ${`%${n.toLowerCase()}%`}`;case`startsWith`:return u.sql`LOWER(${e}) LIKE ${`${n.toLowerCase()}%`}`;case`endsWith`:return u.sql`LOWER(${e}) LIKE ${`%${n.toLowerCase()}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`LOWER(${e}) LIKE ${n.toLowerCase()}`;case`regex`:return u.sql`${e} GLOB ${n}`;case`notRegex`:return u.sql`${e} NOT GLOB ${n}`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`datetime(${e} / 1000, 'unixepoch')`;case`decimal`:return u.sql`CAST(${e} AS REAL)`;case`integer`:return u.sql`CAST(${e} AS INTEGER)`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`IFNULL(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>e.then&&typeof e.then==`object`&&(e.then.queryChunks||e.then._||e.then.sql)?u.sql`WHEN ${e.when} THEN ${u.sql.raw(`(`)}${e.then}${u.sql.raw(`)`)}`:u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:t&&typeof t==`object`&&(t.queryChunks||t._||t.sql)?u.sql`CASE ${n} ELSE ${u.sql.raw(`(`)}${t}${u.sql.raw(`)`)} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`1`:u.sql`0`}preprocessCalculatedTemplate(e){return e.length>1e3?e:e.replace(/(\{[^}]+\})\s*\/\s*/g,(e,t)=>`${t.replace(/\{([^}]+)\}/,`CAST({$1} AS REAL)`)} / `)}convertFilterValue(e){return typeof e==`boolean`?+!!e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>this.convertFilterValue(e)):e}prepareDateValue(e){if(!(e instanceof Date)){if(typeof e==`number`)return e;if(typeof e==`string`)return new Date(e).getTime();throw Error(`prepareDateValue expects a Date object, got ${typeof e}`)}return e.getTime()}isTimestampInteger(){return!0}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!1,supportsVariance:!1,supportsPercentile:!1,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){return null}buildVariance(e,t=!1){return null}buildPercentile(e,t){return null}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},h=class extends p{getEngineType(){return`singlestore`}},g=class extends d{getEngineType(){return`duckdb`}supportsLateralJoins(){return!1}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];t.years&&n.push(`${t.years} years`),t.months&&n.push(`${t.months} months`),t.days&&n.push(`${t.days} days`),t.hours&&n.push(`${t.hours} hours`),t.minutes&&n.push(`${t.minutes} minutes`),t.seconds&&n.push(`${t.seconds} seconds`);let r=n.join(` `)||`0 seconds`;return u.sql`INTERVAL '${u.sql.raw(r)}'`}buildTimeDifferenceSeconds(e,t){return u.sql`(EPOCH(${e}) - EPOCH(${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(*) FILTER (WHERE ${n})`:u.sql`${u.sql.raw(r)}(${t}) FILTER (WHERE ${n})`}buildDateDiffPeriods(e,t,n){return u.sql`DATE_DIFF('${u.sql.raw(n)}', ${e}::timestamp, ${t}::timestamp)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT UNNEST(generate_series(0, ${e})) as period_number) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('year', ${t}::timestamp)`;case`quarter`:return u.sql`DATE_TRUNC('quarter', ${t}::timestamp)`;case`month`:return u.sql`DATE_TRUNC('month', ${t}::timestamp)`;case`week`:return u.sql`DATE_TRUNC('week', ${t}::timestamp)`;case`day`:return u.sql`DATE_TRUNC('day', ${t}::timestamp)::timestamp`;case`hour`:return u.sql`DATE_TRUNC('hour', ${t}::timestamp)`;case`minute`:return u.sql`DATE_TRUNC('minute', ${t}::timestamp)`;case`second`:return u.sql`DATE_TRUNC('second', ${t}::timestamp)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`regexp_matches(${e}, ${n})`;case`notRegex`:return u.sql`NOT regexp_matches(${e}, ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::timestamp`;case`decimal`:return u.sql`${e}::decimal`;case`integer`:return u.sql`${e}::integer`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){return u.sql`QUANTILE_CONT(${e}, ${t/100})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},_=class extends d{getEngineType(){return`databend`}supportsLateralJoins(){return!1}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];if(t.years&&n.push(`${t.years} YEAR`),t.months&&n.push(`${t.months} MONTH`),t.days&&n.push(`${t.days} DAY`),t.hours&&n.push(`${t.hours} HOUR`),t.minutes&&n.push(`${t.minutes} MINUTE`),t.seconds&&n.push(`${t.seconds} SECOND`),n.length===0)return u.sql`INTERVAL 0 SECOND`;if(n.length===1)return u.sql`INTERVAL ${u.sql.raw(n[0])}`;let r=n.map(e=>`INTERVAL ${e}`);return u.sql`(${u.sql.raw(r.join(` + `))})`}buildTimeDifferenceSeconds(e,t){return u.sql`EXTRACT(EPOCH FROM TIMESTAMP_DIFF(${e}, ${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){return u.sql`DATE_DIFF('${u.sql.raw(n)}', ${e}::TIMESTAMP, ${t}::TIMESTAMP)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT number as period_number FROM numbers(${e+1})) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC(YEAR, ${t}::TIMESTAMP)`;case`quarter`:return u.sql`DATE_TRUNC(QUARTER, ${t}::TIMESTAMP)`;case`month`:return u.sql`DATE_TRUNC(MONTH, ${t}::TIMESTAMP)`;case`week`:return u.sql`DATE_TRUNC(WEEK, ${t}::TIMESTAMP)`;case`day`:return u.sql`DATE_TRUNC(DAY, ${t}::TIMESTAMP)::TIMESTAMP`;case`hour`:return u.sql`DATE_TRUNC(HOUR, ${t}::TIMESTAMP)`;case`minute`:return u.sql`DATE_TRUNC(MINUTE, ${t}::TIMESTAMP)`;case`second`:return u.sql`DATE_TRUNC(SECOND, ${t}::TIMESTAMP)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`LOWER(${e}) LIKE LOWER(${`%${n}%`})`;case`notContains`:return u.sql`LOWER(${e}) NOT LIKE LOWER(${`%${n}%`})`;case`startsWith`:return u.sql`LOWER(${e}) LIKE LOWER(${`${n}%`})`;case`endsWith`:return u.sql`LOWER(${e}) LIKE LOWER(${`%${n}`})`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`LOWER(${e}) LIKE LOWER(${n})`;case`regex`:return u.sql`${e} REGEXP ${n}`;case`notRegex`:return u.sql`NOT (${e} REGEXP ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::TIMESTAMP`;case`decimal`:return u.sql`${e}::DECIMAL`;case`integer`:return u.sql`${e}::INTEGER`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!1,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!1,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`COVAR_SAMP`:`COVAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}, ${e}), 0)`}buildPercentile(e,t){throw Error(`Percentile functions are not yet supported for Databend`)}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},v=class extends d{getEngineType(){return`snowflake`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){return u.sql`${this.durationToSeconds(e)}`}buildTimeDifferenceSeconds(e,t){return u.sql`DATEDIFF('SECOND', ${t}, ${e})`}buildDateAddInterval(e,t){let n=this.parseISODuration(t),r=e;return n.years&&(r=u.sql`DATEADD('YEAR', ${n.years}, ${r})`),n.months&&(r=u.sql`DATEADD('MONTH', ${n.months}, ${r})`),n.days&&(r=u.sql`DATEADD('DAY', ${n.days}, ${r})`),n.hours&&(r=u.sql`DATEADD('HOUR', ${n.hours}, ${r})`),n.minutes&&(r=u.sql`DATEADD('MINUTE', ${n.minutes}, ${r})`),n.seconds&&(r=u.sql`DATEADD('SECOND', ${n.seconds}, ${r})`),r}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){let r=n.toUpperCase();return u.sql`DATEDIFF('${u.sql.raw(r)}', ${e}::TIMESTAMP, ${t}::TIMESTAMP)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT ROW_NUMBER() OVER (ORDER BY 1) - 1 AS period_number FROM TABLE(GENERATOR(ROWCOUNT => ${e+1}))) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('YEAR', ${t}::TIMESTAMP)`;case`quarter`:return u.sql`DATE_TRUNC('QUARTER', ${t}::TIMESTAMP)`;case`month`:return u.sql`DATE_TRUNC('MONTH', ${t}::TIMESTAMP)`;case`week`:return u.sql`DATE_TRUNC('WEEK', ${t}::TIMESTAMP)`;case`day`:return u.sql`DATE_TRUNC('DAY', ${t}::TIMESTAMP)::TIMESTAMP`;case`hour`:return u.sql`DATE_TRUNC('HOUR', ${t}::TIMESTAMP)`;case`minute`:return u.sql`DATE_TRUNC('MINUTE', ${t}::TIMESTAMP)`;case`second`:return u.sql`DATE_TRUNC('SECOND', ${t}::TIMESTAMP)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`REGEXP_LIKE(${e}, ${n})`;case`notRegex`:return u.sql`NOT REGEXP_LIKE(${e}, ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::TIMESTAMP`;case`decimal`:return u.sql`${e}::DECIMAL`;case`integer`:return u.sql`${e}::INTEGER`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!0,supportsPercentileSubqueries:!0,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){let n=(t/100).toString();return u.sql`PERCENTILE_CONT(${u.sql.raw(n)}) WITHIN GROUP (ORDER BY ${e})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}};function y(e){switch(e){case`postgres`:return new f;case`mysql`:return new p;case`sqlite`:return new m;case`singlestore`:return new h;case`duckdb`:return new g;case`databend`:return new _;case`snowflake`:return new v;default:throw Error(`Unsupported database engine: ${e}`)}}var b=class{databaseAdapter;constructor(e,t,n){this.db=e,this.schema=t,this.databaseAdapter=y(n||this.getEngineType())}};function x(e,t){let n=[],r=[],i=!1,a,o,s,c=[];for(let t of e){let e=t.match(/Planning Time:\s*([\d.]+)\s*ms/i);if(e){a=parseFloat(e[1]);continue}let l=t.match(/Execution Time:\s*([\d.]+)\s*ms/i);if(l){o=parseFloat(l[1]);continue}let u=S(t);if(u){u.type.includes(`Seq Scan`)&&(i=!0),u.index&&r.push(u.index),n.length===0&&u.estimatedCost!==void 0&&(s=u.estimatedCost);let e=t.search(/\S/);for(;c.length>0&&c[c.length-1].indent>=e;)c.pop();if(c.length===0)n.push(u);else{let e=c[c.length-1].op;e.children||=[],e.children.push(u)}c.push({indent:e,op:u})}}return{operations:n,summary:{database:`postgres`,planningTime:a,executionTime:o,totalCost:s,hasSequentialScans:i,usedIndexes:[...new Set(r)]},raw:e.join(`
|
|
16
|
+
'+' || (((CAST(strftime('%m', ${e}) AS INTEGER) - 1) / 3) * 3) || ' months')`}case`month`:return u.sql`datetime(${t}, 'unixepoch', 'start of month')`;case`week`:return u.sql`date(datetime(${t}, 'unixepoch'), 'weekday 1', '-6 days')`;case`day`:return u.sql`datetime(${t}, 'unixepoch', 'start of day')`;case`hour`:return u.sql`datetime(strftime('%Y-%m-%d %H:00:00', ${u.sql`datetime(${t}, 'unixepoch')`}))`;case`minute`:return u.sql`datetime(strftime('%Y-%m-%d %H:%M:00', ${u.sql`datetime(${t}, 'unixepoch')`}))`;case`second`:return u.sql`datetime(strftime('%Y-%m-%d %H:%M:%S', ${u.sql`datetime(${t}, 'unixepoch')`}))`;default:return u.sql`datetime(${t}, 'unixepoch')`}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`LOWER(${e}) LIKE ${`%${n.toLowerCase()}%`}`;case`notContains`:return u.sql`LOWER(${e}) NOT LIKE ${`%${n.toLowerCase()}%`}`;case`startsWith`:return u.sql`LOWER(${e}) LIKE ${`${n.toLowerCase()}%`}`;case`endsWith`:return u.sql`LOWER(${e}) LIKE ${`%${n.toLowerCase()}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`LOWER(${e}) LIKE ${n.toLowerCase()}`;case`regex`:return u.sql`${e} GLOB ${n}`;case`notRegex`:return u.sql`${e} NOT GLOB ${n}`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`datetime(${e} / 1000, 'unixepoch')`;case`decimal`:return u.sql`CAST(${e} AS REAL)`;case`integer`:return u.sql`CAST(${e} AS INTEGER)`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`IFNULL(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>e.then&&typeof e.then==`object`&&(e.then.queryChunks||e.then._||e.then.sql)?u.sql`WHEN ${e.when} THEN ${u.sql.raw(`(`)}${e.then}${u.sql.raw(`)`)}`:u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:t&&typeof t==`object`&&(t.queryChunks||t._||t.sql)?u.sql`CASE ${n} ELSE ${u.sql.raw(`(`)}${t}${u.sql.raw(`)`)} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`1`:u.sql`0`}preprocessCalculatedTemplate(e){return e.length>1e3?e:e.replace(/(\{[^}]+\})\s*\/\s*/g,(e,t)=>`${t.replace(/\{([^}]+)\}/,`CAST({$1} AS REAL)`)} / `)}convertFilterValue(e){return typeof e==`boolean`?+!!e:e instanceof Date?e.getTime():Array.isArray(e)?e.map(e=>this.convertFilterValue(e)):e}prepareDateValue(e){if(!(e instanceof Date)){if(typeof e==`number`)return e;if(typeof e==`string`)return new Date(e).getTime();throw Error(`prepareDateValue expects a Date object, got ${typeof e}`)}return e.getTime()}isTimestampInteger(){return!0}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!1,supportsVariance:!1,supportsPercentile:!1,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){return null}buildVariance(e,t=!1){return null}buildPercentile(e,t){return null}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},h=class extends p{getEngineType(){return`singlestore`}},g=class extends d{getEngineType(){return`duckdb`}supportsLateralJoins(){return!1}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];t.years&&n.push(`${t.years} years`),t.months&&n.push(`${t.months} months`),t.days&&n.push(`${t.days} days`),t.hours&&n.push(`${t.hours} hours`),t.minutes&&n.push(`${t.minutes} minutes`),t.seconds&&n.push(`${t.seconds} seconds`);let r=n.join(` `)||`0 seconds`;return u.sql`INTERVAL '${u.sql.raw(r)}'`}buildTimeDifferenceSeconds(e,t){return u.sql`(EPOCH(${e}) - EPOCH(${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`COUNT(*) FILTER (WHERE ${n})`:u.sql`${u.sql.raw(r)}(${t}) FILTER (WHERE ${n})`}buildDateDiffPeriods(e,t,n){return u.sql`DATE_DIFF('${u.sql.raw(n)}', ${e}::timestamp, ${t}::timestamp)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT UNNEST(generate_series(0, ${e})) as period_number) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('year', ${t}::timestamp)`;case`quarter`:return u.sql`DATE_TRUNC('quarter', ${t}::timestamp)`;case`month`:return u.sql`DATE_TRUNC('month', ${t}::timestamp)`;case`week`:return u.sql`DATE_TRUNC('week', ${t}::timestamp)`;case`day`:return u.sql`DATE_TRUNC('day', ${t}::timestamp)::timestamp`;case`hour`:return u.sql`DATE_TRUNC('hour', ${t}::timestamp)`;case`minute`:return u.sql`DATE_TRUNC('minute', ${t}::timestamp)`;case`second`:return u.sql`DATE_TRUNC('second', ${t}::timestamp)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`regexp_matches(${e}, ${n})`;case`notRegex`:return u.sql`NOT regexp_matches(${e}, ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::timestamp`;case`decimal`:return u.sql`${e}::decimal`;case`integer`:return u.sql`${e}::integer`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){return u.sql`QUANTILE_CONT(${e}, ${t/100})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},_=class extends d{getEngineType(){return`databend`}supportsLateralJoins(){return!1}buildIntervalFromISO(e){let t=this.parseISODuration(e),n=[];if(t.years&&n.push(`${t.years} YEAR`),t.months&&n.push(`${t.months} MONTH`),t.days&&n.push(`${t.days} DAY`),t.hours&&n.push(`${t.hours} HOUR`),t.minutes&&n.push(`${t.minutes} MINUTE`),t.seconds&&n.push(`${t.seconds} SECOND`),n.length===0)return u.sql`INTERVAL 0 SECOND`;if(n.length===1)return u.sql`INTERVAL ${u.sql.raw(n[0])}`;let r=n.map(e=>`INTERVAL ${e}`);return u.sql`(${u.sql.raw(r.join(` + `))})`}buildTimeDifferenceSeconds(e,t){return u.sql`EXTRACT(EPOCH FROM TIMESTAMP_DIFF(${e}, ${t}))`}buildDateAddInterval(e,t){return u.sql`(${e} + ${this.buildIntervalFromISO(t)})`}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){return u.sql`DATE_DIFF('${u.sql.raw(n)}', ${e}::TIMESTAMP, ${t}::TIMESTAMP)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT number as period_number FROM numbers(${e+1})) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC(YEAR, ${t}::TIMESTAMP)`;case`quarter`:return u.sql`DATE_TRUNC(QUARTER, ${t}::TIMESTAMP)`;case`month`:return u.sql`DATE_TRUNC(MONTH, ${t}::TIMESTAMP)`;case`week`:return u.sql`DATE_TRUNC(WEEK, ${t}::TIMESTAMP)`;case`day`:return u.sql`DATE_TRUNC(DAY, ${t}::TIMESTAMP)::TIMESTAMP`;case`hour`:return u.sql`DATE_TRUNC(HOUR, ${t}::TIMESTAMP)`;case`minute`:return u.sql`DATE_TRUNC(MINUTE, ${t}::TIMESTAMP)`;case`second`:return u.sql`DATE_TRUNC(SECOND, ${t}::TIMESTAMP)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`LOWER(${e}) LIKE LOWER(${`%${n}%`})`;case`notContains`:return u.sql`LOWER(${e}) NOT LIKE LOWER(${`%${n}%`})`;case`startsWith`:return u.sql`LOWER(${e}) LIKE LOWER(${`${n}%`})`;case`endsWith`:return u.sql`LOWER(${e}) LIKE LOWER(${`%${n}`})`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`LOWER(${e}) LIKE LOWER(${n})`;case`regex`:return u.sql`${e} REGEXP ${n}`;case`notRegex`:return u.sql`NOT (${e} REGEXP ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::TIMESTAMP`;case`decimal`:return u.sql`${e}::DECIMAL`;case`integer`:return u.sql`${e}::INTEGER`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!1,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!1,supportsPercentileSubqueries:!1,supportsDerivedTablesInCTE:!1,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`COVAR_SAMP`:`COVAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}, ${e}), 0)`}buildPercentile(e,t){throw Error(`Percentile functions are not yet supported for Databend`)}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}},v=class extends d{getEngineType(){return`snowflake`}supportsLateralJoins(){return!0}buildIntervalFromISO(e){return u.sql`${this.durationToSeconds(e)}`}buildTimeDifferenceSeconds(e,t){return u.sql`DATEDIFF('SECOND', ${t}, ${e})`}buildDateAddInterval(e,t){let n=this.parseISODuration(t),r=e;return n.years&&(r=u.sql`DATEADD('YEAR', ${n.years}, ${r})`),n.months&&(r=u.sql`DATEADD('MONTH', ${n.months}, ${r})`),n.days&&(r=u.sql`DATEADD('DAY', ${n.days}, ${r})`),n.hours&&(r=u.sql`DATEADD('HOUR', ${n.hours}, ${r})`),n.minutes&&(r=u.sql`DATEADD('MINUTE', ${n.minutes}, ${r})`),n.seconds&&(r=u.sql`DATEADD('SECOND', ${n.seconds}, ${r})`),r}buildConditionalAggregation(e,t,n){let r=e.toUpperCase();return e===`count`&&!t?u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN 1 END)`:u.sql`${u.sql.raw(r)}(CASE WHEN ${n} THEN ${t} END)`}buildDateDiffPeriods(e,t,n){let r=n.toUpperCase();return u.sql`DATEDIFF('${u.sql.raw(r)}', ${e}::TIMESTAMP, ${t}::TIMESTAMP)`}buildPeriodSeriesSubquery(e){return u.sql`(SELECT ROW_NUMBER() OVER (ORDER BY 1) - 1 AS period_number FROM TABLE(GENERATOR(ROWCOUNT => ${e+1}))) p`}buildTimeDimension(e,t){switch(e){case`year`:return u.sql`DATE_TRUNC('YEAR', ${t}::TIMESTAMP)`;case`quarter`:return u.sql`DATE_TRUNC('QUARTER', ${t}::TIMESTAMP)`;case`month`:return u.sql`DATE_TRUNC('MONTH', ${t}::TIMESTAMP)`;case`week`:return u.sql`DATE_TRUNC('WEEK', ${t}::TIMESTAMP)`;case`day`:return u.sql`DATE_TRUNC('DAY', ${t}::TIMESTAMP)::TIMESTAMP`;case`hour`:return u.sql`DATE_TRUNC('HOUR', ${t}::TIMESTAMP)`;case`minute`:return u.sql`DATE_TRUNC('MINUTE', ${t}::TIMESTAMP)`;case`second`:return u.sql`DATE_TRUNC('SECOND', ${t}::TIMESTAMP)`;default:return t}}buildStringCondition(e,t,n){switch(t){case`contains`:return u.sql`${e} ILIKE ${`%${n}%`}`;case`notContains`:return u.sql`${e} NOT ILIKE ${`%${n}%`}`;case`startsWith`:return u.sql`${e} ILIKE ${`${n}%`}`;case`endsWith`:return u.sql`${e} ILIKE ${`%${n}`}`;case`like`:return u.sql`${e} LIKE ${n}`;case`notLike`:return u.sql`${e} NOT LIKE ${n}`;case`ilike`:return u.sql`${e} ILIKE ${n}`;case`regex`:return u.sql`REGEXP_LIKE(${e}, ${n})`;case`notRegex`:return u.sql`NOT REGEXP_LIKE(${e}, ${n})`;default:throw Error(`Unsupported string operator: ${t}`)}}castToType(e,t){switch(t){case`timestamp`:return u.sql`${e}::TIMESTAMP`;case`decimal`:return u.sql`${e}::DECIMAL`;case`integer`:return u.sql`${e}::INTEGER`;default:throw Error(`Unsupported cast type: ${t}`)}}buildAvg(e){return u.sql`COALESCE(AVG(${e}), 0)`}buildCaseWhen(e,t){let n=e.map(e=>u.sql`WHEN ${e.when} THEN ${e.then}`).reduce((e,t)=>u.sql`${e} ${t}`);return t===void 0?u.sql`CASE ${n} END`:u.sql`CASE ${n} ELSE ${t} END`}buildBooleanLiteral(e){return e?u.sql`TRUE`:u.sql`FALSE`}convertFilterValue(e){return e}prepareDateValue(e){return e}isTimestampInteger(){return!1}convertTimeDimensionResult(e){return e}getCapabilities(){return{supportsStddev:!0,supportsVariance:!0,supportsPercentile:!0,supportsWindowFunctions:!0,supportsFrameClause:!0,supportsLateralJoins:!0,supportsPercentileSubqueries:!0,supportsDerivedTablesInCTE:!0,supportsLateralSubqueriesInCTE:!1}}buildStddev(e,t=!1){let n=t?`STDDEV_SAMP`:`STDDEV_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildVariance(e,t=!1){let n=t?`VAR_SAMP`:`VAR_POP`;return u.sql`COALESCE(${u.sql.raw(n)}(${e}), 0)`}buildPercentile(e,t){let n=(t/100).toString();return u.sql`PERCENTILE_CONT(${u.sql.raw(n)}) WITHIN GROUP (ORDER BY ${e})`}buildWindowFunction(e,t,n,r,i){let a=n&&n.length>0?u.sql`PARTITION BY ${u.sql.join(n,u.sql`, `)}`:u.sql``,o=r&&r.length>0?u.sql`ORDER BY ${u.sql.join(r.map(e=>e.direction===`desc`?u.sql`${e.field} DESC`:u.sql`${e.field} ASC`),u.sql`, `)}`:u.sql``,s=u.sql``;if(i?.frame){let{type:e,start:t,end:n}=i.frame,r=e.toUpperCase(),a=t===`unbounded`?`UNBOUNDED PRECEDING`:typeof t==`number`?`${t} PRECEDING`:`CURRENT ROW`,o=n===`unbounded`?`UNBOUNDED FOLLOWING`:n===`current`?`CURRENT ROW`:typeof n==`number`?`${n} FOLLOWING`:`CURRENT ROW`;s=u.sql`${u.sql.raw(r)} BETWEEN ${u.sql.raw(a)} AND ${u.sql.raw(o)}`}let c=[];n&&n.length>0&&c.push(a),r&&r.length>0&&c.push(o),i?.frame&&c.push(s);let l=u.sql`OVER (${c.length>0?u.sql.join(c,u.sql` `):u.sql``})`;switch(e){case`lag`:return u.sql`LAG(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`lead`:return u.sql`LEAD(${t}, ${i?.offset??1}${i?.defaultValue===void 0?u.sql``:u.sql`, ${i.defaultValue}`}) ${l}`;case`rank`:return u.sql`RANK() ${l}`;case`denseRank`:return u.sql`DENSE_RANK() ${l}`;case`rowNumber`:return u.sql`ROW_NUMBER() ${l}`;case`ntile`:return u.sql`NTILE(${i?.nTile??4}) ${l}`;case`firstValue`:return u.sql`FIRST_VALUE(${t}) ${l}`;case`lastValue`:return u.sql`LAST_VALUE(${t}) ${l}`;case`movingAvg`:return u.sql`AVG(${t}) ${l}`;case`movingSum`:return u.sql`SUM(${t}) ${l}`;default:throw Error(`Unsupported window function: ${e}`)}}};function y(e){switch(e){case`postgres`:return new f;case`mysql`:return new p;case`sqlite`:return new m;case`singlestore`:return new h;case`duckdb`:return new g;case`databend`:return new _;case`snowflake`:return new v;default:throw Error(`Unsupported database engine: ${e}`)}}var b=class{databaseAdapter;constructor(e,t,n){this.db=e,this.schema=t;let r=n||this.getEngineType();this.databaseAdapter=y(r)}};function x(e,t){let n=[],r=[],i=!1,a,o,s,c=[];for(let t of e){let e=t.match(/Planning Time:\s*([\d.]+)\s*ms/i);if(e){a=parseFloat(e[1]);continue}let l=t.match(/Execution Time:\s*([\d.]+)\s*ms/i);if(l){o=parseFloat(l[1]);continue}let u=S(t);if(u){u.type.includes(`Seq Scan`)&&(i=!0),u.index&&r.push(u.index),n.length===0&&u.estimatedCost!==void 0&&(s=u.estimatedCost);let e=t.search(/\S/);for(;c.length>0&&c[c.length-1].indent>=e;)c.pop();if(c.length===0)n.push(u);else{let e=c[c.length-1].op;e.children||=[],e.children.push(u)}c.push({indent:e,op:u})}}return{operations:n,summary:{database:`postgres`,planningTime:a,executionTime:o,totalCost:s,hasSequentialScans:i,usedIndexes:[...new Set(r)]},raw:e.join(`
|
|
17
17
|
`),sql:t}}function S(e){let t=e.replace(/^[\s->]+/,``).trim();if(!t)return null;let n=t.match(/^([A-Za-z][A-Za-z0-9 ]+?)(?:\s+using\s+(\S+))?(?:\s+on\s+(\S+))?(?:\s+\w+)?(?:\s+\(cost=([\d.]+)\.\.([\d.]+)\s+rows=(\d+)(?:\s+width=\d+)?\))?(?:\s+\(actual time=([\d.]+)\.\.([\d.]+)\s+rows=(\d+)\s+loops=(\d+)\))?/i);if(!n)return t.match(/^Filter:\s*(.+)$/i)||t.match(/^(Hash Cond|Join Filter|Index Cond):\s*(.+)$/i),null;let r=n[1].trim(),i=n[2]||void 0,a=n[3]||void 0,o=n[5]?parseFloat(n[5]):void 0,s=n[6]?parseInt(n[6],10):void 0,c=n[9]?parseInt(n[9],10):void 0,l={type:r,table:a,index:i,estimatedRows:s,estimatedCost:o};c!==void 0&&(l.actualRows=c);let u=e.match(/Filter:\s*(.+?)(?:\)|$)/i);return u&&(l.filter=u[1].trim()),l}function C(e){return Array.isArray(e)?e:e&&typeof e==`object`&&`rows`in e&&Array.isArray(e.rows)?e.rows:[]}var ee=class extends b{async execute(e,t){if(e&&typeof e==`object`&&typeof e.execute==`function`){let n=await e.execute();return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}if(!this.db.execute)throw Error(`PostgreSQL database instance must have an execute method`);let n=await this.db.execute(e),r=C(n);return r.length>0?r.map(e=>this.convertNumericFields(e,t)):n}convertNumericFields(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))t&&t.includes(r)?n[r]=this.coerceToNumber(i):n[r]=i;return n}coerceToNumber(e){if(e==null||typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(e&&typeof e==`object`){if(typeof e.toString==`function`){let t=e.toString();if(/^-?\d+(\.\d+)?$/.test(t))return t.includes(`.`)?parseFloat(t):parseInt(t,10)}if(e.constructor?.name===`Numeric`||e.constructor?.name===`Decimal`||`digits`in e||`sign`in e){let t=e.toString();return parseFloat(t)}return e}if(typeof e==`string`){if(/^-?\d+(\.\d+)?$/.test(e))return e.includes(`.`)?parseFloat(e):parseInt(e,10);if(!isNaN(parseFloat(e))&&isFinite(parseFloat(e)))return parseFloat(e)}return e}getEngineType(){return`postgres`}async explainQuery(e,t,n){let r=n?.analyze?`EXPLAIN ANALYZE`:`EXPLAIN`;if(!this.db.execute)throw Error(`PostgreSQL database instance must have an execute method`);let i=await this.db.execute(u.sql`${u.sql.raw(r)} ${u.sql.raw(e.replace(/\$(\d+)/g,(e,n)=>{let r=t[parseInt(n,10)-1];return r===null?`NULL`:typeof r==`number`?String(r):typeof r==`boolean`?r?`TRUE`:`FALSE`:r instanceof Date?`'${r.toISOString()}'`:`'${String(r).replace(/'/g,`''`)}'`}))}`),a=[];for(let e of C(i))if(e&&typeof e==`object`){let t=e[`QUERY PLAN`]||e[`query plan`]||e.queryplan;typeof t==`string`&&a.push(t)}return x(a,{sql:e,params:t})}async getTableIndexes(e){if(!e||e.length===0)return[];if(!this.db.execute)throw Error(`PostgreSQL database instance must have an execute method`);try{let t=e.map(e=>`'${e.toLowerCase()}'`).join(`,`),n=C(await this.db.execute(u.sql`
|
|
18
18
|
SELECT
|
|
19
19
|
t.relname as table_name,
|
|
@@ -59,7 +59,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
59
59
|
ORDER BY table_name, index_name
|
|
60
60
|
`);return Array.isArray(n)?n.map(e=>({table_name:e.table_name,index_name:e.index_name,columns:typeof e.columns==`string`?e.columns.split(`,`):[],is_unique:!!e.is_unique,is_primary:!!e.is_primary})):[]}catch(e){return console.warn(`Failed to get table indexes:`,e),[]}}};function de(e,t){return new ue(e,t,`duckdb`)}function fe(e,t){let n=[],r=[],i=!1,a,o=[];for(let t of e){if(!t.trim())continue;let e=me(t);if(e){(e.type.includes(`TableScan`)||e.type.includes(`SCAN`))&&(i=!0),e.type.includes(`IndexScan`)&&e.index&&r.push(e.index),n.length===0&&e.estimatedCost!==void 0&&(a=e.estimatedCost);let s=pe(t);for(;o.length>0&&o[o.length-1].indent>=s;)o.pop();if(o.length===0)n.push(e);else{let t=o[o.length-1].op;t.children||=[],t.children.push(e)}o.push({indent:s,op:e})}}return{operations:n,summary:{database:`databend`,planningTime:void 0,executionTime:void 0,totalCost:a,hasSequentialScans:i,usedIndexes:[...new Set(r)]},raw:e.join(`
|
|
61
61
|
`),sql:t}}function pe(e){let t=0;for(let n of e)if(n===` `||n===`│`||n===`├`||n===`└`||n===`─`)t++;else break;return t}function me(e){let t=e.replace(/[┌├└│─┐┤┘]/g,``).replace(/^\s*/,``).trim();if(!t||/^(filters|table|estimated rows|output columns|push downs):/.test(t))return null;let n=t.match(/^([A-Z][A-Za-z_]+(?:\s+[A-Z][A-Za-z_]+)*)(?:\s+(\S+))?/);if(!n)return null;let r=n[1],i=n[2]||void 0,a=t.match(/estimated rows:\s*(\d+)/i);return{type:r,table:i,estimatedRows:a?parseInt(a[1],10):void 0}}var he=class extends b{async execute(e,t){if(e&&typeof e==`object`&&typeof e.execute==`function`)try{let n=await e.execute();return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Databend] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}if(!this.db.execute)throw Error(`Databend database instance must have an execute method`);try{let n=await this.db.execute(e);return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Databend] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}}extractSqlFromQuery(e){try{if(e&&typeof e.toSQL==`function`){let{sql:t,params:n}=e.toSQL();return{sql:t,params:n}}if(e&&typeof e.getSQL==`function`){let t=e.getSQL();if(t&&typeof t.toSQL==`function`){let{sql:e,params:n}=t.toSQL();return{sql:e,params:n}}}return{sql:String(e),params:[]}}catch{return{sql:`[unable to extract SQL]`,params:[]}}}convertNumericFields(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))t&&t.includes(r)?n[r]=this.coerceToNumber(i):n[r]=i;return n}coerceToNumber(e){if(e==null||typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(e&&typeof e==`object`){if(typeof e.toString==`function`){let t=e.toString();if(/^-?\d+(\.\d+)?$/.test(t))return t.includes(`.`)?parseFloat(t):parseInt(t,10)}return e}if(typeof e==`string`){if(/^-?\d+(\.\d+)?$/.test(e))return e.includes(`.`)?parseFloat(e):parseInt(e,10);if(!isNaN(parseFloat(e))&&isFinite(parseFloat(e)))return parseFloat(e)}return e}getEngineType(){return`databend`}async explainQuery(e,t,n){let r=n?.analyze?`EXPLAIN ANALYZE`:`EXPLAIN`;if(!this.db.execute)throw Error(`Databend database instance must have an execute method`);let i=await this.db.execute(u.sql`${u.sql.raw(r)} ${u.sql.raw(e.replace(/\$(\d+)/g,(e,n)=>{let r=t[parseInt(n,10)-1];return r===null?`NULL`:typeof r==`number`?String(r):typeof r==`boolean`?r?`TRUE`:`FALSE`:r instanceof Date?`'${r.toISOString()}'`:`'${String(r).replace(/'/g,`''`)}'`}))}`),a=[];if(Array.isArray(i)){for(let e of i)if(e&&typeof e==`object`){let t=e.explain||e[`QUERY PLAN`]||e.query_plan||e.Plan||Object.values(e)[0];typeof t==`string`&&a.push(t)}}return fe(a,{sql:e,params:t})}async getTableIndexes(e){return!e||e.length,[]}};function ge(e,t){return new he(e,t,`databend`)}function _e(e,t){let n=[],r=[],i=!1,a,o=[];for(let t of e){if(!t.trim())continue;let e=ye(t);if(e){(e.type.includes(`TableScan`)||e.type.includes(`SCAN`))&&(i=!0),n.length===0&&e.estimatedCost!==void 0&&(a=e.estimatedCost);let r=ve(t);for(;o.length>0&&o[o.length-1].indent>=r;)o.pop();if(o.length===0)n.push(e);else{let t=o[o.length-1].op;t.children||=[],t.children.push(e)}o.push({indent:r,op:e})}}return{operations:n,summary:{database:`snowflake`,planningTime:void 0,executionTime:void 0,totalCost:a,hasSequentialScans:i,usedIndexes:[...new Set(r)]},raw:e.join(`
|
|
62
|
-
`),sql:t}}function ve(e){let t=0;for(let n of e)if(n===` `||n===`-`||n===`>`)t++;else break;return t}function ye(e){let t=e.replace(/^[\s\d:]*->/,``).trim();if(!t||/^(GlobalStats|partitions|bytes):/i.test(t)||/^\w+=\d+/.test(t))return null;let n=t.match(/^([A-Z][A-Za-z_]+(?:\s+[A-Z][A-Za-z_]+)*)(?:\s+(\S+))?/);if(!n)return null;let r=n[1],i=n[2]||void 0,a=t.match(/estimated rows:\s*(\d+)/i);return{type:r,table:i,estimatedRows:a?parseInt(a[1],10):void 0}}var be=class extends b{async execute(e,t){if(e&&typeof e==`object`&&typeof e.execute==`function`)try{let n=await e.execute();return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Snowflake] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}if(!this.db.execute)throw Error(`Snowflake database instance must have an execute method`);try{let n=await this.db.execute(e);return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Snowflake] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}}extractSqlFromQuery(e){try{if(e&&typeof e.toSQL==`function`){let{sql:t,params:n}=e.toSQL();return{sql:t,params:n}}if(e&&typeof e.getSQL==`function`){let t=e.getSQL();if(t&&typeof t.toSQL==`function`){let{sql:e,params:n}=t.toSQL();return{sql:e,params:n}}}return{sql:String(e),params:[]}}catch{return{sql:`[unable to extract SQL]`,params:[]}}}convertNumericFields(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))t&&t.includes(r)?n[r]=this.coerceToNumber(i):n[r]=i;return n}coerceToNumber(e){if(e==null||typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(e&&typeof e==`object`){if(typeof e.toString==`function`){let t=e.toString();if(/^-?\d+(\.\d+)?$/.test(t))return t.includes(`.`)?parseFloat(t):parseInt(t,10)}return e}if(typeof e==`string`){if(/^-?\d+(\.\d+)?$/.test(e))return e.includes(`.`)?parseFloat(e):parseInt(e,10);if(!isNaN(parseFloat(e))&&isFinite(parseFloat(e)))return parseFloat(e)}return e}getEngineType(){return`snowflake`}async explainQuery(e,t,n){if(n?.analyze,!this.db.execute)throw Error(`Snowflake database instance must have an execute method`);let r=await this.db.execute(u.sql`${u.sql.raw(`EXPLAIN`)} ${u.sql.raw(e.replace(/\?/g,()=>{let e=t.shift();return e===null?`NULL`:typeof e==`number`?String(e):typeof e==`boolean`?e?`TRUE`:`FALSE`:e instanceof Date?`'${e.toISOString()}'`:`'${String(e).replace(/'/g,`''`)}'`}))}`),i=[];if(Array.isArray(r)){for(let e of r)if(e&&typeof e==`object`){let t=e.content||e[`QUERY PLAN`]||e.plan||Object.values(e)[0];typeof t==`string`&&i.push(t)}}return _e(i,{sql:e,params:t})}async getTableIndexes(e){return[]}};function xe(e,t){return new be(e,t,`snowflake`)}function Se(e,t,n){if(n)switch(n){case`postgres`:return w(e,t);case`mysql`:return D(e,t);case`sqlite`:return ie(e,t);case`singlestore`:return oe(e,t);case`duckdb`:return de(e,t);case`databend`:return ge(e,t);case`snowflake`:return xe(e,t)}if(e.all&&e.run)return ie(e,t);if(e.execute)return w(e,t);throw Error(`Unable to determine database engine type. Please specify engineType parameter.`)}function k(e,t){return typeof e==`string`?t?t.get(e)||(console.warn(`[drizzle-cube] Cannot resolve cube reference '${e}': no cube with that name is registered. Registered cubes: ${Array.from(t.keys()).join(`, `)||`(none)`}. Join will be skipped.`),null):(console.warn(`[drizzle-cube] Cannot resolve string cube reference '${e}': no cube registry provided. Join will be skipped.`),null):typeof e==`function`?e():e}function Ce(e){switch(e){case`belongsTo`:return`hasMany`;case`hasMany`:return`belongsTo`;case`hasOne`:return`hasOne`;case`belongsToMany`:return`belongsToMany`;default:return e}}function we(e,t){if(t)return t;switch(e){case`belongsTo`:return`inner`;case`hasOne`:return`left`;case`hasMany`:return`left`;case`belongsToMany`:return`left`;default:return`left`}}function Te(e){return e&&typeof e==`object`?u.sql`${u.sql`${e}`}`:e}function Ee(e){if(e===`__proto__`||e===`constructor`||e===`prototype`)throw Error(`Unsafe property key: ${e}`);return e}function A(e,t){return Te(typeof e==`function`?e(t):e)}function De(e,t,n){return{...e,cubes:t,currentCube:n}}function Oe(e,t){return{name:e,...t}}function ke(e,t){if(e.relationship!==`belongsToMany`||!e.through)throw Error(`expandBelongsToManyJoin can only be called on belongsToMany relationships with through configuration`);let{table:n,sourceKey:r,targetKey:i,securitySql:a}=e.through,o=[];for(let e of r){let t=e.as||u.eq;o.push(t(e.source,e.target))}let s=[];for(let e of i){let t=e.as||u.eq;s.push(t(e.source,e.target))}let c;if(a){let e=a(t);c=Array.isArray(e)?e:[e]}let l=we(`belongsToMany`,e.sqlJoinType);return{junctionJoins:[{joinType:l,table:n,condition:(0,u.and)(...o)},{joinType:l,table:n,condition:(0,u.and)(...s)}],junctionSecurityConditions:c}}function Ae(e){if(`and`in e)return`and:[${e.and.map(Ae).sort().join(`,`)}]`;if(`or`in e)return`or:[${e.or.map(Ae).sort().join(`,`)}]`;let t=e,n=JSON.stringify(Array.isArray(t.values)?[...t.values].sort():t.values),r=t.dateRange?`:dr:${JSON.stringify(t.dateRange)}`:``;return`${t.member}:${t.operator}:${n}${r}`}function je(e,t){return`timeDim:${e}:${JSON.stringify(t)}`}var Me=class{cache=new Map;stats={hits:0,misses:0};getOrBuild(e,t){let n=this.cache.get(e);if(n!==void 0)return this.stats.hits++,n;let r=t();return r&&this.cache.set(e,r),this.stats.misses++,r}has(e){return this.cache.has(e)}get(e){let t=this.cache.get(e);return t!==void 0&&this.stats.hits++,t}preload(e){for(let{key:t,sql:n}of e)this.cache.has(t)||this.cache.set(t,n)}set(e,t){this.cache.set(e,t)}getStats(){return{...this.stats,cacheSize:this.cache.size}}clear(){this.cache.clear(),this.stats={hits:0,misses:0}}};function Ne(e){let t=[];for(let n of e)`and`in n&&n.and?t.push(...Ne(n.and)):`or`in n&&n.or?t.push(...Ne(n.or)):`member`in n&&t.push(n);return t}function Pe(e,t,n={}){let r=n.keyPrefix??`drizzle-cube:`,i=Fe(e),a=`${r}query:${Ve(JSON.stringify(i))}`;if(n.includeSecurityContext!==!1){let e=Ve(n.securityContextSerializer?n.securityContextSerializer(t):JSON.stringify(Be(t)));a+=`:ctx:${e}`}return a}function Fe(e){return{measures:e.measures?[...e.measures].sort():void 0,dimensions:e.dimensions?[...e.dimensions].sort():void 0,filters:e.filters?j(e.filters):void 0,timeDimensions:e.timeDimensions?ze(e.timeDimensions):void 0,limit:e.limit,offset:e.offset,order:e.order?Be(e.order):void 0,fillMissingDatesValue:e.fillMissingDatesValue,funnel:e.funnel?Ie(e.funnel):void 0,flow:e.flow?Le(e.flow):void 0,retention:e.retention?Re(e.retention):void 0}}function Ie(e){return{bindingKey:e.bindingKey,timeDimension:e.timeDimension,steps:e.steps.map(e=>{let t={name:e.name,filter:e.filter?Array.isArray(e.filter)?j(e.filter):j([e.filter])[0]:void 0,timeToConvert:e.timeToConvert};return`cube`in e&&e.cube&&(t.cube=e.cube),t}),includeTimeMetrics:e.includeTimeMetrics,globalTimeWindow:e.globalTimeWindow}}function Le(e){return{bindingKey:e.bindingKey,timeDimension:e.timeDimension,eventDimension:e.eventDimension,startingStep:{name:e.startingStep.name,filter:e.startingStep.filter?Array.isArray(e.startingStep.filter)?j(e.startingStep.filter):j([e.startingStep.filter])[0]:void 0},stepsBefore:e.stepsBefore,stepsAfter:e.stepsAfter,entityLimit:e.entityLimit,outputMode:e.outputMode,joinStrategy:e.joinStrategy}}function Re(e){return{timeDimension:e.timeDimension,bindingKey:e.bindingKey,dateRange:e.dateRange,granularity:e.granularity,periods:e.periods,retentionType:e.retentionType,cohortFilters:e.cohortFilters?Array.isArray(e.cohortFilters)?j(e.cohortFilters):j([e.cohortFilters])[0]:void 0,activityFilters:e.activityFilters?Array.isArray(e.activityFilters)?j(e.activityFilters):j([e.activityFilters])[0]:void 0,breakdownDimensions:e.breakdownDimensions}}function j(e){return[...e].map(e=>{if(`and`in e&&e.and)return{and:j(e.and)};if(`or`in e&&e.or)return{or:j(e.or)};let t=e;return{...t,values:t.values?[...t.values].sort():t.values}}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))}function ze(e){return[...e].map(e=>({dimension:e.dimension,granularity:e.granularity,dateRange:e.dateRange,fillMissingDates:e.fillMissingDates,compareDateRange:e.compareDateRange?[...e.compareDateRange].sort((e,t)=>{let n=Array.isArray(e)?e.join(`-`):e,r=Array.isArray(t)?t.join(`-`):t;return n.localeCompare(r)}):void 0})).sort((e,t)=>e.dimension.localeCompare(t.dimension))}function Be(e){return typeof e!=`object`||!e?e:Array.isArray(e)?e.map(Be):Object.keys(e).sort().reduce((t,n)=>(t[n]=Be(e[n]),t),{})}function Ve(e){let t=2166136261,n=Math.min(e.length,65536);for(let r=0;r<n;r++)t^=e.charCodeAt(r),t=t*16777619>>>0;return t.toString(16).padStart(8,`0`)}function He(e,t){return`${t??`drizzle-cube:`}*${e}*`}var Ue=class{constructor(e){this.databaseAdapter=e}buildTimeDimensionExpression(e,t,n){let r=A(e,n);return t?this.databaseAdapter.buildTimeDimension(t,r):r instanceof u.SQL?r:u.sql`${r}`}buildDateRangeCondition(e,t){if(!t)return null;if(Array.isArray(t)&&t.length>=2){let n=this.normalizeDate(t[0]),r=this.normalizeDate(t[1]);if(!n||!r)return null;if(typeof t[1]==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(t[1].trim())){let e=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),t=new Date(e);t.setUTCHours(23,59,59,999),r=this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}return(0,u.and)((0,u.gte)(e,n),(0,u.lte)(e,r))}if(typeof t==`string`){let n=this.parseRelativeDateRange(t);if(n){let t,r;return this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?(t=Math.floor(n.start.getTime()/1e3),r=Math.floor(n.end.getTime()/1e3)):(t=n.start.getTime(),r=n.end.getTime()):(t=n.start.toISOString(),r=n.end.toISOString()),(0,u.and)((0,u.gte)(e,t),(0,u.lte)(e,r))}let r=this.normalizeDate(t);if(!r)return null;let i=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),a=new Date(i);a.setUTCHours(0,0,0,0);let o=new Date(i);o.setUTCHours(23,59,59,999);let s,c;return this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?(s=Math.floor(a.getTime()/1e3),c=Math.floor(o.getTime()/1e3)):(s=a.getTime(),c=o.getTime()):(s=a.toISOString(),c=o.toISOString()),(0,u.and)((0,u.gte)(e,s),(0,u.lte)(e,c))}return null}parseRelativeDateRange(e){let t=new Date,n=e.toLowerCase().trim(),r=t.getUTCFullYear(),i=t.getUTCMonth(),a=t.getUTCDate(),o=t.getUTCDay();if(n===`today`){let e=new Date(t);e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`yesterday`){let e=new Date(t);e.setUTCDate(a-1),e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCDate(a-1),n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`this week`){let e=o===0?-6:1-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`this month`)return{start:new Date(Date.UTC(r,i,1,0,0,0,0)),end:new Date(Date.UTC(r,i+1,0,23,59,59,999))};if(n===`this quarter`){let e=Math.floor(i/3);return{start:new Date(Date.UTC(r,e*3,1,0,0,0,0)),end:new Date(Date.UTC(r,e*3+3,0,23,59,59,999))}}if(n===`this year`)return{start:new Date(Date.UTC(r,0,1,0,0,0,0)),end:new Date(Date.UTC(r,11,31,23,59,59,999))};let s=n.match(/^last\s+(\d+)\s+days?$/);if(s){let e=parseInt(s[1],10),n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}let c=n.match(/^last\s+(\d+)\s+weeks?$/);if(c){let e=parseInt(c[1],10)*7,n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last week`){let e=o===0?-13:-6-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last month`)return{start:new Date(Date.UTC(r,i-1,1,0,0,0,0)),end:new Date(Date.UTC(r,i,0,23,59,59,999))};if(n===`last quarter`){let e=Math.floor(i/3),t=e===0?3:e-1,n=e===0?r-1:r;return{start:new Date(Date.UTC(n,t*3,1,0,0,0,0)),end:new Date(Date.UTC(n,t*3+3,0,23,59,59,999))}}if(n===`last year`)return{start:new Date(Date.UTC(r-1,0,1,0,0,0,0)),end:new Date(Date.UTC(r-1,11,31,23,59,59,999))};if(n===`last 12 months`){let e=new Date(Date.UTC(r,i-11,1,0,0,0,0)),n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}let l=n.match(/^last\s+(\d+)\s+months?$/);if(l){let e=parseInt(l[1],10),n=new Date(Date.UTC(r,i-e+1,1,0,0,0,0)),a=new Date(t);return a.setUTCHours(23,59,59,999),{start:n,end:a}}let u=n.match(/^last\s+(\d+)\s+years?$/);if(u){let e=parseInt(u[1],10),n=new Date(Date.UTC(r-e,0,1,0,0,0,0)),i=new Date(t);return i.setUTCHours(23,59,59,999),{start:n,end:i}}return null}normalizeDate(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(e.getTime()/1e3):e.getTime():e.toISOString();if(typeof e==`number`){let t=e<1e10?e*1e3:e,n=new Date(t);return isNaN(n.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t/1e3):t:n.toISOString()}if(typeof e==`string`){if(/^\d{4}-\d{2}-\d{2}$/.test(e.trim())){let t=new Date(e+`T00:00:00Z`);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}let t=new Date(e);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}let t=new Date(e);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}},We=class{constructor(e,t){this.databaseAdapter=e,this.dateTimeBuilder=t}buildFilterCondition(e,t,n,r,i){if(i!==void 0){if(t!==`inDateRange`)throw Error(`dateRange can only be used with 'inDateRange' operator, but got '${t}'. Use explicit date values in the 'values' array for other date operators.`);if(r&&r.type!==`time`)throw Error(`dateRange can only be used on time dimensions, but field '${r.name||`unknown`}' has type '${r.type}'`);return this.dateTimeBuilder.buildDateRangeCondition(e,i)}if(!n||n.length===0)return t===`equals`?this.databaseAdapter.buildBooleanLiteral(!1):null;let a=n.filter(e=>!(e==null||e===``||typeof e==`string`&&e.includes(`\0`))).map(this.databaseAdapter.convertFilterValue);if(a.length===0&&![`set`,`notSet`].includes(t))return t===`equals`?this.databaseAdapter.buildBooleanLiteral(!1):null;let o=a[0];switch(t){case`equals`:return a.length>1?r?.type===`time`?(0,u.inArray)(e,a.map(e=>this.dateTimeBuilder.normalizeDate(e)||e)):(0,u.inArray)(e,a):a.length===1?(0,u.eq)(e,r?.type===`time`&&this.dateTimeBuilder.normalizeDate(o)||o):this.databaseAdapter.buildBooleanLiteral(!1);case`notEquals`:return a.length>1?(0,u.notInArray)(e,a):a.length===1?(0,u.ne)(e,o):null;case`contains`:return this.databaseAdapter.buildStringCondition(e,`contains`,o);case`notContains`:return this.databaseAdapter.buildStringCondition(e,`notContains`,o);case`startsWith`:return this.databaseAdapter.buildStringCondition(e,`startsWith`,o);case`endsWith`:return this.databaseAdapter.buildStringCondition(e,`endsWith`,o);case`gt`:return(0,u.gt)(e,o);case`gte`:return(0,u.gte)(e,o);case`lt`:return(0,u.lt)(e,o);case`lte`:return(0,u.lte)(e,o);case`set`:return(0,u.isNotNull)(e);case`notSet`:return(0,u.isNull)(e);case`inDateRange`:if(a.length>=2){let t=this.dateTimeBuilder.normalizeDate(a[0]),r=this.dateTimeBuilder.normalizeDate(a[1]);if(t&&r){let i=n[1];if(typeof i==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(i.trim())){let e=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),t=new Date(e);t.setUTCHours(23,59,59,999),r=this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}return(0,u.and)((0,u.gte)(e,t),(0,u.lte)(e,r))}}return null;case`beforeDate`:{let t=this.dateTimeBuilder.normalizeDate(o);return t?(0,u.lt)(e,t):null}case`afterDate`:{let t=this.dateTimeBuilder.normalizeDate(o);return t?(0,u.gt)(e,t):null}case`between`:return a.length>=2?(0,u.and)((0,u.gte)(e,a[0]),(0,u.lte)(e,a[1])):null;case`notBetween`:return a.length>=2?(0,u.or)((0,u.lt)(e,a[0]),(0,u.gt)(e,a[1])):null;case`in`:return a.length>0?(0,u.inArray)(e,a):null;case`notIn`:return a.length>0?(0,u.notInArray)(e,a):null;case`like`:return this.databaseAdapter.buildStringCondition(e,`like`,o);case`notLike`:return this.databaseAdapter.buildStringCondition(e,`notLike`,o);case`ilike`:return this.databaseAdapter.buildStringCondition(e,`ilike`,o);case`regex`:return this.databaseAdapter.buildStringCondition(e,`regex`,o);case`notRegex`:return this.databaseAdapter.buildStringCondition(e,`notRegex`,o);case`isEmpty`:return(0,u.or)((0,u.isNull)(e),(0,u.eq)(e,``));case`isNotEmpty`:return(0,u.and)((0,u.isNotNull)(e),(0,u.ne)(e,``));case`arrayContains`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayContains)(e,a):null;case`arrayOverlaps`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayOverlaps)(e,a):null;case`arrayContained`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayContained)(e,a):null;default:return null}}buildLogicalFilter(e,t,n){if(`and`in e&&e.and){let r=e.and.map(e=>this.buildSingleFilter(e,t,n)).filter(e=>e!==null);return r.length>0?r.length===1?r[0]:(0,u.and)(...r):null}if(`or`in e&&e.or){let r=e.or.map(e=>this.buildSingleFilter(e,t,n)).filter(e=>e!==null);return r.length>0?r.length===1?r[0]:(0,u.or)(...r):null}return null}buildSingleFilter(e,t,n){if(`and`in e||`or`in e)return this.buildLogicalFilter(e,t,n);let r=e,[i,a]=r.member.split(`.`),o=t.get(i);if(!o)return null;let s=o.dimensions?.[a];if(!s)return null;let c=s.type===`time`?A(s.sql,n):typeof s.sql==`function`?s.sql(n):s.sql;return this.buildFilterCondition(c,r.operator,r.values,s,r.dateRange)}},M=class{dependencyGraph;cubes;constructor(e){this.cubes=e instanceof Map?e:new Map([[e.name,e]]),this.dependencyGraph=new Map}extractDependencies(e){if(e.length>1e3)return[];let t=e.matchAll(/\{([^}]+)\}/g),n=[];for(let e of t){let t=e[1].trim();if(t.includes(`.`)){let[e,r]=t.split(`.`);n.push({measureName:t,cubeName:e.trim(),fieldName:r.trim()})}else n.push({measureName:t,cubeName:null,fieldName:t})}return n}buildGraph(e){for(let[t,n]of Object.entries(e.measures))if(n.type===`calculated`&&n.calculatedSql){let r=`${e.name}.${t}`,i=this.extractDependencies(n.calculatedSql),a=new Set;for(let t of i){let n=`${t.cubeName||e.name}.${t.fieldName}`;a.add(n)}this.dependencyGraph.set(r,{id:r,dependencies:a,inDegree:0})}this.calculateInDegrees()}buildGraphForMultipleCubes(e){for(let t of e.values())this.buildGraph(t)}calculateInDegrees(){for(let e of this.dependencyGraph.values())e.inDegree=0;for(let e of this.dependencyGraph.values())for(let t of e.dependencies){let e=this.dependencyGraph.get(t);e&&e.inDegree++}}topologicalSort(e){let t=new Map,n=[],r=[];for(let n of e){let e=this.dependencyGraph.get(n);e&&t.set(n,{id:e.id,dependencies:new Set(e.dependencies),inDegree:0})}for(let e of t.values()){let n=0;for(let r of e.dependencies)t.has(r)&&n++;e.inDegree=n}for(let[e,r]of t)r.inDegree===0&&n.push(e);for(;n.length>0;){let e=n.shift();r.push(e);for(let[r,i]of t)i.dependencies.has(e)&&(i.inDegree--,i.inDegree===0&&n.push(r))}if(r.length<t.size){let e=this.detectCycle();throw Error(`Circular dependency detected in calculated measures: ${e?e.join(` -> `):`unknown cycle`}`)}return r}detectCycle(){let e=new Set,t=new Set,n=[];for(let r of this.dependencyGraph.keys())if(!e.has(r)){let i=this.dfs(r,e,t,n);if(i)return i}return null}dfs(e,t,n,r){t.add(e),n.add(e),r.push(e);let i=this.dependencyGraph.get(e);if(!i)return r.pop(),n.delete(e),null;for(let e of i.dependencies)if(!t.has(e)){let i=this.dfs(e,t,n,r);if(i)return i}else if(n.has(e)){let t=r.indexOf(e);return[...r.slice(t),e]}return r.pop(),n.delete(e),null}getAllDependencies(e){let t=new Set,n=new Set,r=e=>{if(n.has(e))return;n.add(e);let i=this.dependencyGraph.get(e);if(i)for(let e of i.dependencies)t.add(e),r(e)};return r(e),t}validateDependencies(e){for(let[t,n]of Object.entries(e.measures))if(n.type===`calculated`&&n.calculatedSql){let r=this.extractDependencies(n.calculatedSql);for(let n of r){let r=n.cubeName||e.name,i=this.cubes.get(r);if(!i)throw Error(`Calculated measure '${e.name}.${t}' references unknown cube '${r}'`);if(!i.measures[n.fieldName])throw Error(`Calculated measure '${e.name}.${t}' references unknown measure '${n.measureName}'`);if(r===e.name&&n.fieldName===t)throw Error(`Calculated measure '${e.name}.${t}' cannot reference itself`)}}}populateDependencies(e){for(let[,t]of Object.entries(e.measures))t.type===`calculated`&&t.calculatedSql&&!t.dependencies&&(t.dependencies=this.extractDependencies(t.calculatedSql).map(e=>e.measureName))}static isCalculatedMeasure(e){return e.type===`calculated`&&!!e.calculatedSql}},Ge={"analysis.modes.query.label":`Query`,"analysis.modes.query.description":`Standard analysis (single or multi-query)`,"analysis.modes.funnel.label":`Funnel`,"analysis.modes.funnel.description":`Sequential conversion analysis`,"analysis.modes.flow.label":`Flow`,"analysis.modes.flow.description":`Bidirectional path analysis with Sankey visualisation`,"analysis.modes.retention.label":`Retention`,"analysis.modes.retention.description":`Cohort-based retention analysis over time periods`,"analysis.ai.title":`AI Query Generator`,"analysis.ai.generating":`Generating...`,"analysis.ai.placeholder":`Describe your query in natural language... (e.g., 'Show total sales by month for the last year')`,"analysis.ai.shortcutHint":`Press Enter to generate, Shift+Enter for new line`,"analysis.ai.successMessage":`Query generated and loaded! Check the results below, then click Accept to keep or Cancel to revert.`,"analysis.ai.button.accept":`Accept`,"analysis.ai.button.cancel":`Cancel`,"analysis.ai.button.close":`Close`,"analysis.ai.button.generate":`Generate`,"analysis.ai.button.generating":`Generating...`,"analysis.sections.metrics":`Metrics`,"analysis.sections.breakdown":`Breakdown`,"analysis.sections.dimensions":`Dimensions`,"analysis.sections.filters":`Filter`,"analysis.sections.limit":`Limit`,"analysis.tabs.query":`Query`,"analysis.tabs.chart":`Chart`,"analysis.tabs.chartTitle":`Chart configuration`,"analysis.tabs.display":`Display`,"analysis.tabs.displayTitle":`Display options`,"analysis.multiQuery.removeQuery":`Remove query`,"analysis.multiQuery.addQuery":`Add new query`,"analysis.multiQuery.addAnother":`Add another query`,"analysis.multiQuery.mergeExplanation":`In merge mode, dimensions are shared from Q1.`,"analysis.multiQuery.switchToSeparate":`Switch to separate series`,"analysis.mergeStrategy.concat":`Separate series`,"analysis.mergeStrategy.merge":`Merge by dimension`,"analysis.mergeStrategy.funnel":`Funnel`,"analysis.placeholders.addMetrics":`Add metrics to generate SQL`,"analysis.placeholders.hoverField":`Hover over a field to see details`,"analysis.placeholders.noData":`No data available`,"common.actions.accept":`Accept`,"common.actions.cancel":`Cancel`,"common.actions.delete":`Delete`,"common.actions.close":`Close`,"common.actions.edit":`Edit`,"common.actions.save":`Save`,"common.actions.copy":`Copy`,"common.actions.duplicate":`Duplicate`,"common.actions.refresh":`Refresh`,"common.actions.confirm":`Confirm`,"common.actions.add":`Add`,"common.actions.clear":`Clear`,"common.actions.select":`Select`,"common.actions.navigate":`Navigate`,"common.actions.share":`Share`,"common.loading":`Loading...`,"common.modal.processing":`Processing...`,"common.modal.dashboardName":`Dashboard Name`,"common.modal.deleteConfirmation":`Are you sure? This action cannot be undone.`,"common.sorting.ascending":`Sorted ascending (click for descending)`,"common.sorting.descending":`Sorted descending (click to remove)`,"common.sorting.none":`Click to sort ascending`,"fieldTypes.count":`Count`,"fieldTypes.countDistinct":`Count Distinct`,"fieldTypes.countDistinctApprox":`Count Distinct (Approx)`,"fieldTypes.sum":`Sum`,"fieldTypes.avg":`Average`,"fieldTypes.min":`Minimum`,"fieldTypes.max":`Maximum`,"fieldTypes.runningTotal":`Running Total`,"fieldTypes.number":`Number`,"fieldTypes.string":`Text`,"fieldTypes.boolean":`Boolean`,"fieldTypes.time":`Time Dimension`,"fieldTypes.geo":`Geographic`,"fieldTypes.dimension":`Dimension`,"fieldPanel.emptyState":`Hover over a field to see details`,"fieldPanel.usageHint":`Press Enter or click to add this field to your query.`,"fieldPanel.labels.type":`Type`,"fieldPanel.labels.cube":`Cube`,"fieldPanel.labels.category":`Category`,"fieldCategory.measure":`Measure`,"fieldCategory.timeDimension":`Time Dimension`,"fieldCategory.dimension":`Dimension`,"fieldSearch.placeholder.metrics":`Search metrics...`,"fieldSearch.placeholder.filter":`Search fields to filter...`,"fieldSearch.placeholder.dimensions":`Search dimensions...`,"fieldSearch.modal.title.metrics":`Select a Metric`,"fieldSearch.modal.title.filter":`Select a Field to Filter`,"fieldSearch.modal.title.dimensions":`Select a Dimension`,"fieldSearch.filter.allCubes":`All Cubes`,"fieldSearch.categories.all":`All`,"fieldSearch.empty.heading":`No fields found`,"fieldSearch.empty.noMatchMetrics":`No metrics match "{searchTerm}"`,"fieldSearch.empty.noMatchDimensions":`No dimensions match "{searchTerm}"`,"fieldSearch.empty.noMetrics":`No metrics available`,"fieldSearch.empty.noDimensions":`No dimensions available`,"fieldSearch.section.recents":`Recents`,"fieldSearch.footer.metricsAvailable":`metrics available`,"fieldSearch.footer.fieldsAvailable":`fields available`,"fieldSearch.footer.dimensionsAvailable":`dimensions available`,"fieldSearch.shortcut.navigate":`Navigate`,"fieldSearch.shortcut.keyEnter":`Enter`,"fieldSearch.shortcut.keyShift":`Shift`,"fieldSearch.shortcut.keyEsc":`Esc`,"fieldSearch.shortcut.plusClick":`+Click`,"fieldSearch.shortcut.select":`Select`,"fieldSearch.shortcut.multiSelect":`Multi-select`,"fieldSearch.shortcut.close":`Close`,"filter.group.condition":`condition`,"filter.group.conditions":`conditions`,"filter.group.addFilter":`Add Filter`,"filter.group.addAndGroup":`Add AND Group`,"filter.group.addOrGroup":`Add OR Group`,"filter.group.removeGroup":`Remove group`,"filter.group.empty":`No conditions in this group`,"filter.group.addFilterLink":`Add a filter`,"filter.modal.title":`Edit Filter`,"filter.modal.fieldLabel":`Field`,"filter.modal.operatorLabel":`Operator`,"filter.modal.valueLabel":`Value`,"filter.modal.selectRange":`Select range`,"filter.modal.noValueRequired":`No value required`,"filter.modal.dateTo":`to`,"filter.modal.min":`Min`,"filter.modal.to":`to`,"filter.modal.max":`Max`,"filter.modal.enterNumber":`Enter number`,"filter.modal.loading":`Loading...`,"filter.modal.selectValue":`Select value...`,"filter.modal.search":`Search...`,"filter.modal.errorPrefix":`Error: `,"filter.modal.noValues":`No values found`,"filter.modal.multiSelectHint":`Hold Shift to select multiple values`,"filter.modal.enterValue":`Enter value...`,"filter.removeButton.title":`Remove filter`,"filter.section.clearAll":`Clear all`,"filter.section.dropHint":`Drop to add filter`,"filter.section.empty":`No filters applied`,"filter.valueDisplay.empty":`(empty)`,"filter.valueDisplay.more":`more`,"filter.operator.equals.label":`equals`,"filter.operator.equals.description":`Exact match`,"filter.operator.notEquals.label":`not equals`,"filter.operator.notEquals.description":`Does not match`,"filter.operator.contains.label":`contains`,"filter.operator.contains.description":`Contains text (case insensitive)`,"filter.operator.notContains.label":`not contains`,"filter.operator.notContains.description":`Does not contain text`,"filter.operator.startsWith.label":`starts with`,"filter.operator.startsWith.description":`Starts with text`,"filter.operator.notStartsWith.label":`not starts with`,"filter.operator.notStartsWith.description":`Does not start with text`,"filter.operator.endsWith.label":`ends with`,"filter.operator.endsWith.description":`Ends with text`,"filter.operator.notEndsWith.label":`not ends with`,"filter.operator.notEndsWith.description":`Does not end with text`,"filter.operator.like.label":`like`,"filter.operator.like.description":`SQL LIKE pattern matching (case sensitive)`,"filter.operator.notLike.label":`not like`,"filter.operator.notLike.description":`SQL NOT LIKE pattern matching (case sensitive)`,"filter.operator.ilike.label":`ilike`,"filter.operator.ilike.description":`SQL ILIKE pattern matching (case insensitive)`,"filter.operator.gt.label":`greater than`,"filter.operator.gt.description":`Greater than value`,"filter.operator.gte.label":`greater than or equal`,"filter.operator.gte.description":`Greater than or equal to value`,"filter.operator.lt.label":`less than`,"filter.operator.lt.description":`Less than value`,"filter.operator.lte.label":`less than or equal`,"filter.operator.lte.description":`Less than or equal to value`,"filter.operator.between.label":`between`,"filter.operator.between.description":`Between two values (inclusive)`,"filter.operator.notBetween.label":`not between`,"filter.operator.notBetween.description":`Not between two values`,"filter.operator.in.label":`in`,"filter.operator.in.description":`Matches any of the provided values`,"filter.operator.notIn.label":`not in`,"filter.operator.notIn.description":`Does not match any of the provided values`,"filter.operator.set.label":`is set`,"filter.operator.set.description":`Is not null/empty`,"filter.operator.notSet.label":`is not set`,"filter.operator.notSet.description":`Is null/empty`,"filter.operator.isEmpty.label":`is empty`,"filter.operator.isEmpty.description":`Is empty string or null`,"filter.operator.isNotEmpty.label":`is not empty`,"filter.operator.isNotEmpty.description":`Is not empty string and not null`,"filter.operator.inDateRange.label":`in date range`,"filter.operator.inDateRange.description":`Between two dates`,"filter.operator.beforeDate.label":`before date`,"filter.operator.beforeDate.description":`Before specified date`,"filter.operator.afterDate.label":`after date`,"filter.operator.afterDate.description":`After specified date`,"filter.operator.regex.label":`matches regex`,"filter.operator.regex.description":`Matches regular expression pattern`,"filter.operator.notRegex.label":`not matches regex`,"filter.operator.notRegex.description":`Does not match regular expression pattern`,"filter.operator.arrayContains.label":`array contains all`,"filter.operator.arrayContains.description":`Array field contains all specified values (PostgreSQL only)`,"filter.operator.arrayOverlaps.label":`array contains any`,"filter.operator.arrayOverlaps.description":`Array field contains any of the specified values (PostgreSQL only)`,"filter.operator.arrayContained.label":`array values in`,"filter.operator.arrayContained.description":`All array field values are within specified values (PostgreSQL only)`,"dateRange.custom":`Custom`,"dateRange.today":`Today`,"dateRange.yesterday":`Yesterday`,"dateRange.thisWeek":`This week`,"dateRange.thisMonth":`This month`,"dateRange.thisQuarter":`This quarter`,"dateRange.thisYear":`This year`,"dateRange.last7Days":`Last 7 days`,"dateRange.last30Days":`Last 30 days`,"dateRange.lastNDays":`Last N days`,"dateRange.lastWeek":`Last week`,"dateRange.lastNWeeks":`Last N weeks`,"dateRange.lastMonth":`Last month`,"dateRange.last12Months":`Last 12 months`,"dateRange.lastNMonths":`Last N months`,"dateRange.lastQuarter":`Last quarter`,"dateRange.lastNQuarters":`Last N quarters`,"dateRange.lastYear":`Last year`,"dateRange.lastNYears":`Last N years`,"timeGranularity.hour":`Hour`,"timeGranularity.day":`Day`,"timeGranularity.week":`Week`,"timeGranularity.month":`Month`,"timeGranularity.quarter":`Quarter`,"timeGranularity.year":`Year`,"query.limit.label":`Limit`,"query.limit.clear":`Clear`,"chart.bar.label":`Bar Chart`,"chart.bar.description":`Compare values across categories`,"chart.bar.useCase":`Best for comparing discrete categories, showing rankings, or displaying changes over time`,"chart.line.label":`Line Chart`,"chart.line.description":`Show trends and changes over time`,"chart.line.useCase":`Best for continuous data, trends, time series, and showing relationships between multiple series`,"chart.area.label":`Area Chart`,"chart.area.description":`Emphasise magnitude of change over time`,"chart.area.useCase":`Best for showing cumulative totals, volume changes, or stacked comparisons over time`,"chart.pie.label":`Pie Chart`,"chart.pie.description":`Show proportions of a whole`,"chart.pie.useCase":`Best for showing percentage distribution or composition of a total (limit to 5-7 slices)`,"chart.scatter.label":`Scatter Plot`,"chart.scatter.description":`Reveal correlations between variables`,"chart.scatter.useCase":`Best for identifying patterns, correlations, outliers, and relationships between two measures`,"chart.bubble.label":`Bubble Chart`,"chart.bubble.description":`Compare three dimensions of data`,"chart.bubble.useCase":`Best for showing relationships between three variables (X, Y, and size), market analysis`,"chart.radar.label":`Radar Chart`,"chart.radar.description":`Compare multiple metrics across categories`,"chart.radar.useCase":`Best for multivariate comparisons, performance metrics, strengths/weaknesses analysis`,"chart.radialBar.label":`Radial Bar Chart`,"chart.radialBar.description":`Circular progress and KPI visualisation`,"chart.radialBar.useCase":`Best for showing progress toward goals, KPIs, or comparing percentages in a compact form`,"chart.treemap.label":`TreeMap`,"chart.treemap.description":`Visualise hierarchical data with nested rectangles`,"chart.treemap.useCase":`Best for showing part-to-whole relationships in hierarchical data, disk usage, budget allocation`,"chart.table.label":`Data Table`,"chart.table.description":`Display detailed tabular data`,"chart.table.useCase":`Best for precise values, detailed analysis, sortable/filterable data exploration`,"chart.activityGrid.label":`Activity Grid`,"chart.activityGrid.description":`GitHub-style activity grid showing temporal patterns across different time scales`,"chart.activityGrid.useCase":`Best for visualising activity patterns over time. Supports hour (3hr blocks × days), day (days × weeks), week (weeks × months), month (months × quarters), and quarter (quarters × years) granularities`,"chart.kpiNumber.label":`KPI Number`,"chart.kpiNumber.description":`Display key performance indicators as large numbers`,"chart.kpiNumber.useCase":`Perfect for showing important metrics like revenue, user count, or other key business metrics in a prominent, easy-to-read format`,"chart.kpiDelta.label":`KPI Delta`,"chart.kpiDelta.description":`Display change between latest and previous values with trend indicators`,"chart.kpiDelta.useCase":`Perfect for showing performance changes over time, such as revenue growth, user acquisition changes, or other metrics where the trend and delta are more important than the absolute value`,"chart.kpiText.label":`KPI Text`,"chart.kpiText.description":`Display key performance indicators as customisable text`,"chart.kpiText.useCase":`Perfect for showing metrics with custom formatting, combining multiple values, or displaying contextual KPI information using templates`,"chart.markdown.label":`Markdown`,"chart.markdown.description":`Display custom markdown content with formatting`,"chart.markdown.useCase":`Perfect for adding documentation, notes, section headers, instructions, or formatted text to dashboards`,"chart.funnel.label":`Funnel Chart`,"chart.funnel.description":`Show conversion through sequential steps`,"chart.funnel.useCase":`Best for visualising user journey funnels, sales pipelines, or multi-step processes`,"chart.sankey.label":`Sankey Chart`,"chart.sankey.description":`Show flow between states or steps`,"chart.sankey.useCase":`Best for visualising user journey flows, path analysis, or state transitions`,"chart.sunburst.label":`Sunburst Chart`,"chart.sunburst.description":`Show hierarchical flow as radial rings`,"chart.sunburst.useCase":`Best for visualising forward paths from a starting event in a compact radial layout`,"chart.heatmap.label":`Heatmap`,"chart.heatmap.description":`Visualise intensity across two dimensions`,"chart.heatmap.useCase":`Best for showing patterns in matrix data like correlations, schedules, or category comparisons`,"chart.retentionHeatmap.label":`Retention Matrix`,"chart.retentionHeatmap.description":`Cohort retention matrix visualisation`,"chart.retentionHeatmap.useCase":`Visualise user retention over time by cohort`,"chart.retentionCombined.label":`Retention Chart`,"chart.retentionCombined.description":`Combined retention visualisation with line chart and heatmap modes`,"chart.retentionCombined.useCase":`Visualise user retention over time with optional breakdown segmentation`,"chart.boxPlot.label":`Box Plot`,"chart.boxPlot.description":`Show statistical distribution (median, IQR, whiskers) across categories`,"chart.boxPlot.useCase":`Best for P&L spread per symbol, trade size distribution, latency distribution across platforms`,"chart.waterfall.label":`Waterfall Chart`,"chart.waterfall.description":`Show cumulative effect of sequential positive and negative values`,"chart.waterfall.useCase":`Best for P&L decomposition, cash flow analysis, budget variance, or any sequential contribution breakdown`,"chart.candlestick.label":`Candlestick Chart`,"chart.candlestick.description":`Financial candlestick chart showing open/close body and high/low wicks`,"chart.candlestick.useCase":`Best for EOD quotes (bid/ask spread per date/symbol), markout distribution bands, or OHLC price data`,"chart.measureProfile.label":`Measure Profile`,"chart.measureProfile.description":`Plot N measures as sequential X-axis points to visualise a profile or shape across intervals`,"chart.measureProfile.useCase":`Best for markout interval analysis (e.g. avgMinus2m → avgAtEvent → avgPlus2h), metric profiles, or any pattern across ordered measures`,"chart.gauge.label":`Gauge Chart`,"chart.gauge.description":`Half-circle arc gauge for a single KPI value versus a maximum target`,"chart.gauge.useCase":`Best for high-water marks vs equity, margin utilisation, or any single value progress toward a goal`,"chart.config.chartType":`Chart Type`,"chart.config.loading":`Loading chart configuration...`,"chart.config.axisConfig":`Chart Configuration`,"chart.config.unassigned":`Unassigned Fields`,"chart.config.unassignedHint":`Drag fields to chart axes above`,"chart.config.noFields":`Add metrics and breakdowns in the Query tab to configure chart axes`,"chart.dropZone.xAxis.label":`X-Axis (Categories)`,"chart.dropZone.xAxis.description":`Dimensions and time dimensions for grouping`,"chart.dropZone.xAxis.empty":`Drop dimensions & time dimensions here`,"chart.dropZone.yAxis.label":`Y-Axis (Values)`,"chart.dropZone.yAxis.description":`Measures for values or dimensions for series`,"chart.dropZone.yAxis.empty":`Drop measures or dimensions here`,"chart.dropZone.series.label":`Series (Split into Multiple Series)`,"chart.dropZone.series.description":`Dimensions to create separate data series`,"chart.dropZone.series.empty":`Drop dimensions here to split data into series`,"chart.dropZone.maxReached":`Maximum items reached`,"chart.dropZone.default.empty":`Drop fields here`,"chart.bar.dropZone.xAxis.empty":`Drop dimensions & time dimensions here`,"chart.bar.dropZone.yAxis.empty":`Drop measures here`,"chart.bar.dropZone.series.empty":`Drop dimensions here to split data into series`,"chart.line.dropZone.xAxis.empty":`Drop time dimensions or dimensions here`,"chart.line.dropZone.yAxis.empty":`Drop measures here`,"chart.line.dropZone.series.empty":`Drop dimensions here for multiple lines`,"chart.area.dropZone.xAxis.empty":`Drop time dimensions or dimensions here`,"chart.area.dropZone.yAxis.empty":`Drop measures here`,"chart.area.dropZone.series.empty":`Drop dimensions here for stacked areas`,"chart.pie.dropZone.xAxis.empty":`Drop a dimension for categories`,"chart.pie.dropZone.yAxis.empty":`Drop a measure for values`,"chart.scatter.dropZone.xAxis.empty":`Drop a field for X-axis`,"chart.scatter.dropZone.yAxis.empty":`Drop a measure for Y-axis`,"chart.scatter.dropZone.series.empty":`Drop a dimension to colour points`,"chart.bubble.dropZone.xAxis.empty":`Drop a field for X-axis position`,"chart.bubble.dropZone.yAxis.empty":`Drop a measure for Y-axis position`,"chart.bubble.dropZone.sizeField.empty":`Drop a measure for bubble size`,"chart.bubble.dropZone.series.empty":`Drop a dimension for bubble labels`,"chart.bubble.dropZone.colorField.empty":`Drop a field for bubble colour (optional)`,"chart.radar.dropZone.xAxis.empty":`Drop dimensions for radar axes`,"chart.radar.dropZone.yAxis.empty":`Drop measures for values`,"chart.radar.dropZone.series.empty":`Drop dimensions for multiple shapes`,"chart.radialBar.dropZone.xAxis.empty":`Drop dimensions for categories`,"chart.radialBar.dropZone.yAxis.empty":`Drop a measure for values`,"chart.treemap.dropZone.xAxis.empty":`Drop dimensions for categories`,"chart.treemap.dropZone.yAxis.empty":`Drop a measure for size`,"chart.treemap.dropZone.series.empty":`Drop a dimension for colour grouping`,"chart.table.dropZone.xAxis.empty":`Drop fields to display as columns (or leave empty for all)`,"chart.activityGrid.dropZone.dateField.empty":`Drop a time dimension (granularity affects grid structure)`,"chart.activityGrid.dropZone.valueField.empty":`Drop a measure for activity intensity`,"chart.kpiNumber.dropZone.yAxis.empty":`Drop a measure here`,"chart.kpiDelta.dropZone.yAxis.empty":`Drop a measure here`,"chart.kpiDelta.dropZone.xAxis.empty":`Drop a dimension for ordering`,"chart.kpiText.dropZone.yAxis.empty":`Drop a measure here`,"chart.funnel.dropZone.xAxis.empty":`Steps defined in funnel config`,"chart.funnel.dropZone.yAxis.empty":`Counts calculated from funnel execution`,"chart.sankey.dropZone.xAxis.empty":`Auto-populated from flow config`,"chart.sankey.dropZone.yAxis.empty":`Calculated from flow execution`,"chart.sunburst.dropZone.xAxis.empty":`Auto-populated from flow config`,"chart.sunburst.dropZone.yAxis.empty":`Calculated from flow execution`,"chart.heatmap.dropZone.xAxis.empty":`Drop one dimension here`,"chart.heatmap.dropZone.yAxis.empty":`Drop one dimension here`,"chart.heatmap.dropZone.valueField.empty":`Drop one measure here`,"chart.boxPlot.dropZone.xAxis.empty":`Drop a dimension here`,"chart.boxPlot.dropZone.yAxis.empty":`Drop 1, 3, or 5 measures here`,"chart.waterfall.dropZone.xAxis.empty":`Drop a dimension here`,"chart.waterfall.dropZone.yAxis.empty":`Drop a measure here`,"chart.candlestick.dropZone.xAxis.empty":`Drop a time or dimension here`,"chart.candlestick.dropZone.yAxis.empty":`Drop 2+ measures here`,"chart.measureProfile.dropZone.yAxis.empty":`Drop 2+ measures here (displayed left → right)`,"chart.measureProfile.dropZone.series.empty":`Drop a dimension here to create multiple lines`,"chart.gauge.dropZone.yAxis.empty":`Drop 1 measure here (optional 2nd for dynamic max)`,"chart.activityGrid.validation.timeDimensionRequired":`Time dimension is required for activity grid`,"chart.activityGrid.validation.measureRequired":`Activity measure is required for intensity mapping`,"chart.kpiDelta.validation.measureRequired":`A measure is required for KPI Delta charts`,"chart.heatmap.validation.xAxisRequired":`X-axis dimension required`,"chart.heatmap.validation.yAxisRequired":`Y-axis dimension required`,"chart.heatmap.validation.valueRequired":`Value measure required`,"chart.option.stacking.label":`Stacking`,"chart.option.stacking.none":`None`,"chart.option.stacking.stacked":`Stacked`,"chart.option.stacking.percent":`Stacked 100%`,"chart.option.stacking.description":`How to stack multiple series`,"chart.option.target.label":`Target Values`,"chart.option.target.description":`Single value or comma-separated values to spread across X-axis`,"chart.option.connectNulls.label":`Connect Nulls`,"chart.option.connectNulls.description":`Draw continuous line through missing data points`,"chart.option.leftYAxisFormat.label":`Left Y-Axis Format`,"chart.option.leftYAxisFormat.description":`Number formatting for left Y-axis`,"chart.option.rightYAxisFormat.label":`Right Y-Axis Format`,"chart.option.rightYAxisFormat.description":`Number formatting for right Y-axis`,"chart.option.xAxisFormat.label":`X-Axis Format`,"chart.option.xAxisFormat.description":`Number formatting for X-axis`,"chart.option.yAxisFormat.label":`Y-Axis Format`,"chart.option.yAxisFormat.description":`Number formatting for Y-axis`,"chart.option.valueFormat.label":`Value Format`,"chart.option.valueFormat.description":`Number formatting for values`,"chart.option.innerRadius.label":`Inner Radius`,"chart.option.innerRadius.description":`Hollow centre size (0% = solid pie, higher = donut style)`,"chart.option.showLabels.label":`Show Cell Values`,"chart.option.showLabels.description":`Display values inside each cell`,"chart.option.cellShape.label":`Cell Shape`,"chart.option.cellShape.rectangle":`Rectangle`,"chart.option.cellShape.circle":`Circle`,"chart.option.funnelStyle.label":`Funnel Style`,"chart.option.funnelStyle.bars":`Bars`,"chart.option.funnelStyle.funnel":`Funnel`,"chart.option.funnelOrientation.label":`Orientation`,"chart.option.funnelOrientation.horizontal":`Horizontal`,"chart.option.funnelOrientation.vertical":`Vertical`,"chart.option.hideSummaryFooter.label":`Hide Summary Footer`,"chart.option.hideSummaryFooter.description":`Hide the summary footer showing steps count and overall conversion`,"chart.option.showConversion.label":`Show Conversion Rate`,"chart.option.showConversion.description":`Display step-to-step conversion percentage`,"chart.option.showAvgTime.label":`Show Avg Time`,"chart.option.showAvgTime.description":`Display average time to convert`,"chart.option.showMedianTime.label":`Show Median Time`,"chart.option.showMedianTime.description":`Display median time to convert`,"chart.option.showP90Time.label":`Show P90 Time`,"chart.option.showP90Time.description":`Display 90th percentile time to convert`,"chart.option.linkOpacity.label":`Link Opacity`,"chart.option.linkOpacity.light":`Light`,"chart.option.linkOpacity.medium":`Medium`,"chart.option.linkOpacity.dark":`Dark`,"chart.option.showNodeLabels.label":`Show Node Labels`,"chart.option.showNodeLabels.description":`Display labels on flow nodes`,"chart.option.prefix.label":`Prefix`,"chart.option.prefix.description":`Text to display before the number`,"chart.option.suffix.label":`Suffix`,"chart.option.suffix.description":`Text to display after the number`,"chart.option.decimals.label":`Decimal Places`,"chart.option.decimals.description":`Number of decimal places to display`,"chart.option.showHistogram.label":`Show Variance Histogram`,"chart.option.showHistogram.description":`Display historical variance chart below the delta`,"chart.option.useLastCompletePeriod.label":`Use Last Complete Period`,"chart.option.useLastCompletePeriod.description":`Exclude current incomplete period from calculation (e.g., partial week/month)`,"chart.option.skipLastPeriod.label":`Skip Last Period`,"chart.option.skipLastPeriod.description":`Always exclude the last period regardless of completeness`,"chart.option.retentionDisplayMode.label":`Display Mode`,"chart.option.retentionDisplayMode.lineChart":`Line Chart`,"chart.option.retentionDisplayMode.heatmapTable":`Heatmap Table`,"chart.option.retentionDisplayMode.combined":`Combined`,"chart.option.showLegend.label":`Show Legend`,"chart.option.showLegend.description":`Show the legend`,"chart.option.showGrid.label":`Show Grid`,"chart.option.showGrid.description":`Show grid lines on the chart`,"chart.option.showTooltip.label":`Show Tooltip`,"chart.option.showTooltip.description":`Show tooltip on hover with detailed stats`,"chart.option.priorPeriodStyle.label":`Prior Period Line Style`,"chart.option.priorPeriodStyle.dashed":`Dashed`,"chart.option.priorPeriodStyle.dotted":`Dotted`,"chart.option.priorPeriodStyle.solid":`Solid`,"chart.option.priorPeriodStyle.description":`Line style for prior period in comparison mode`,"chart.option.priorPeriodOpacity.label":`Prior Period Opacity`,"chart.option.priorPeriodOpacity.description":`Opacity for prior period lines (0.1 to 1)`,"chart.option.showTotal.label":`Show Total Bar`,"chart.option.showTotal.description":`Append a final bar showing the running total`,"chart.option.showConnectorLine.label":`Show Connector Line`,"chart.option.showConnectorLine.description":`Draw a dashed step-line connecting bar tops`,"chart.option.showDataLabels.label":`Show Data Labels`,"chart.option.showDataLabels.description":`Display the value at each data point`,"chart.option.showReferenceLineAtZero.label":`Show Zero Reference Line`,"chart.option.showReferenceLineAtZero.description":`Draw a dashed line at Y = 0`,"chart.option.lineType.label":`Line Interpolation`,"chart.option.lineType.smooth":`Smooth (monotone)`,"chart.option.lineType.linear":`Linear`,"chart.option.lineType.step":`Step`,"chart.option.lineType.description":`How data points are connected`,"chart.option.rangeMode.label":`Chart Mode`,"chart.option.rangeMode.ohlc":`OHLC (open, close, high, low)`,"chart.option.rangeMode.range":`Range (high, low / bid, ask)`,"chart.option.rangeMode.description":`OHLC: 4 measures. Range: 2 measures (high + low).`,"chart.option.bullColor.label":`Bullish Colour`,"chart.option.bullColor.description":`Candle colour when close ≥ open`,"chart.option.bearColor.label":`Bearish Colour`,"chart.option.bearColor.description":`Candle colour when close < open`,"chart.option.showWicks.label":`Show Wicks`,"chart.option.showWicks.description":`Draw high/low wicks above and below the body`,"chart.option.minValue.label":`Minimum Value`,"chart.option.minValue.description":`Lower bound of the gauge arc (default 0)`,"chart.option.maxValue.label":`Maximum Value (static)`,"chart.option.maxValue.description":`Upper bound of the gauge. Leave empty to use yAxis[1] or default 100`,"chart.option.showCentreLabel.label":`Show Centre Label`,"chart.option.showCentreLabel.description":`Display current value and field name in the centre of the gauge`,"chart.option.showPercentage.label":`Show as Percentage`,"chart.option.showPercentage.description":`Display value as % of max instead of raw number`,"chart.option.fitToWidth.label":`Fit to Width`,"chart.option.fitToWidth.description":`Automatically size blocks to fill portlet width and height while maintaining aspect ratio`,"chart.option.fontSize.label":`Font Size`,"chart.option.fontSize.small":`Small`,"chart.option.fontSize.medium":`Medium`,"chart.option.fontSize.large":`Large`,"chart.option.alignment.label":`Text Alignment`,"chart.option.alignment.left":`Left`,"chart.option.alignment.center":`Center`,"chart.option.alignment.right":`Right`,"chart.option.hideHeader.label":`Hide Header`,"chart.option.hideHeader.description":`Hide the portlet header bar (title and action buttons)`,"chart.option.transparentBackground.label":`Transparent Background`,"chart.option.transparentBackground.description":`Remove card background, border, and shadow for seamless integration as section headers`,"chart.option.autoHeight.label":`Auto Height`,"chart.option.autoHeight.description":`In row and mobile layouts, size to markdown content instead of fixed row height`,"chart.option.accentBorder.label":`Accent Border`,"chart.option.accentBorder.none":`None`,"chart.option.accentBorder.left":`Left`,"chart.option.accentBorder.top":`Top`,"chart.option.accentBorder.bottom":`Bottom`,"chart.option.accentBorder.description":`Add an accent-coloured border on one side of the content`,"chart.configText.20_percent":`20%`,"chart.configText.40_percent":`40%`,"chart.configText.60_percent":`60%`,"chart.configText.80_percent":`80%`,"chart.configText.accent_color":`Accent Color`,"chart.configText.activity_measure":`Activity Measure`,"chart.configText.add_2_or_more_measures_they_become_the_x_axis_categories_in_the_order_li":`Add 2 or more measures — they become the X-axis categories in the order listed`,"chart.configText.add_an_accent_colored_border_on_one_side_of_the_content":`Add an accent-colored border on one side of the content`,"chart.configText.all_fields_to_display_as_columns":`All fields to display as columns`,"chart.configText.array_of_value_0_1_fraction_color_bands_shown_as_outer_arc_markers":`Array of {value (0–1 fraction), color} bands shown as outer arc markers`,"chart.configText.axes_categories":`Axes (Categories)`,"chart.configText.bubble_colour":`Bubble Colour`,"chart.configText.bubble_labels":`Bubble Labels`,"chart.configText.bubble_radius":`Bubble Radius`,"chart.configText.categories":`Categories`,"chart.configText.choose_how_to_visualize_retention_data":`Choose how to visualize retention data`,"chart.configText.color_bubbles_by_this_field_optional":`Color bubbles by this field (optional)`,"chart.configText.color_for_negative_changes_decreases":`Color for negative changes (decreases)`,"chart.configText.color_for_positive_changes_increases":`Color for positive changes (increases)`,"chart.configText.color_from_the_dashboard_palette_for_headers_bullets_and_links":`Color from the dashboard palette for headers, bullets, and links`,"chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text":`Color from the dashboard palette for the KPI value text`,"chart.configText.color_groups":`Color Groups`,"chart.configText.columns":`Columns`,"chart.configText.columns_x_axis":`Columns (X-Axis)`,"chart.configText.count_at_each_step_auto_calculated":`Count at each step (auto-calculated)`,"chart.configText.count_of_entities_following_each_path":`Count of entities following each path`,"chart.configText.current_value_to_display_on_the_gauge_e_g_current_equity_margin_used":`Current value to display on the gauge (e.g. current equity, margin used)`,"chart.configText.dimension_for_column_categories":`Dimension for column categories`,"chart.configText.dimension_for_ordering_data_typically_time":`Dimension for ordering data (typically time)`,"chart.configText.dimension_for_pie_slices":`Dimension for pie slices`,"chart.configText.dimension_for_row_categories":`Dimension for row categories`,"chart.configText.dimension_labels_for_each_bar_segment_e_g_symbol_transaction_type":`Dimension labels for each bar segment (e.g. symbol, transaction type)`,"chart.configText.dimension_optional":`Dimension (optional)`,"chart.configText.dimension_to_color_points_by_category":`Dimension to color points by category`,"chart.configText.dimension_to_color_rectangles_by_category":`Dimension to color rectangles by category`,"chart.configText.dimension_to_group_boxes_by_e_g_symbol_platform":`Dimension to group boxes by (e.g. symbol, platform)`,"chart.configText.dimension_to_split_data_into_separate_profile_lines_e_g_symbol_platform":`Dimension to split data into separate profile lines (e.g. symbol, platform)`,"chart.configText.dimensions_for_radar_axes":`Dimensions for radar axes`,"chart.configText.dimensions_for_radial_segments":`Dimensions for radial segments`,"chart.configText.dimensions_for_treemap_rectangles":`Dimensions for treemap rectangles`,"chart.configText.dimensions_to_create_multiple_radar_shapes":`Dimensions to create multiple radar shapes`,"chart.configText.dimensions_to_create_separate_lines":`Dimensions to create separate lines`,"chart.configText.dimensions_to_create_stacked_areas":`Dimensions to create stacked areas`,"chart.configText.display_the_value_above_each_bar_segment":`Display the value above each bar segment`,"chart.configText.display_value_at_each_data_point":`Display value at each data point`,"chart.configText.drop_1_measure_for_auto_mode_3_for_avg_stddev_median_mode_or_5_for_min_q":`Drop 1 measure for auto mode, 3 for avg/stddev/median mode, or 5 for min/q1/median/q3/max mode`,"chart.configText.drop_2_4_measures_in_order_open_close_high_low_ohlc_mode_for_range_mode_":`Drop 2–4 measures in order: open, close, high, low (OHLC mode). For range mode drop 2: high, low.`,"chart.configText.enter_markdown_text_supports_headers_bold_text_italic_text_links_text_ur":`Enter markdown text. Supports headers (#), bold (**text**), italic (*text*), links ([text](url)), lists (- item), and horizontal rules (---).`,"chart.configText.event_dimension_that_categorizes_flow_nodes":`Event dimension that categorizes flow nodes`,"chart.configText.event_type":`Event Type`,"chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont":`Exclude current incomplete period from aggregation (e.g., partial week/month)`,"chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee":`Exclude current incomplete period from delta calculation (e.g., partial week/month)`,"chart.configText.field_to_use_for_bubble_labels_and_identification":`Field to use for bubble labels and identification`,"chart.configText.flow_count":`Flow Count`,"chart.configText.hide_the_statistics_footer_below_the_chart":`Hide the statistics footer below the chart`,"chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style":`Hollow center size (0% = solid pie, higher = donut style)`,"chart.configText.horizontal_alignment_of_the_markdown_content":`Horizontal alignment of the markdown content`,"chart.configText.horizontal_axis_position":`Horizontal axis position`,"chart.configText.how_to_stack_multiple_area_series":`How to stack multiple area series`,"chart.configText.how_to_stack_multiple_bar_series":`How to stack multiple bar series`,"chart.configText.markdown_content":`Markdown Content`,"chart.configText.measure_for_rectangle_sizes":`Measure for rectangle sizes`,"chart.configText.measure_for_slice_sizes":`Measure for slice sizes`,"chart.configText.measure_for_y_position":`Measure for Y position`,"chart.configText.measure_or_dimension_for_x_position":`Measure or dimension for X position`,"chart.configText.measure_that_determines_cell_color":`Measure that determines cell color`,"chart.configText.measure_to_display_as_kpi_number":`Measure to display as KPI number`,"chart.configText.measure_to_display_in_the_kpi_text_template":`Measure to display in the KPI text template`,"chart.configText.measure_to_track_changes_for":`Measure to track changes for`,"chart.configText.measure_used_for_activity_intensity_color_coding":`Measure used for activity intensity (color coding)`,"chart.configText.measures_for_area_values":`Measures for area values`,"chart.configText.measures_for_bar_heights":`Measures for bar heights`,"chart.configText.measures_for_line_values":`Measures for line values`,"chart.configText.measures_for_radar_values":`Measures for radar values`,"chart.configText.measures_for_radial_bar_lengths":`Measures for radial bar lengths`,"chart.configText.measures_x_axis_order":`Measures (X-Axis Order)`,"chart.configText.negative_change_color":`Negative Change Color`,"chart.configText.none_pie":`None (Pie)`,"chart.configText.number_formatting_for_cell_values_and_legend":`Number formatting for cell values and legend`,"chart.configText.number_formatting_for_numeric_values":`Number formatting for numeric values`,"chart.configText.number_formatting_for_size_values":`Number formatting for size values`,"chart.configText.number_formatting_for_the_displayed_value_and_axis_labels":`Number formatting for the displayed value and axis labels`,"chart.configText.number_formatting_for_the_price_axis":`Number formatting for the price axis`,"chart.configText.number_formatting_for_the_value_axis":`Number formatting for the value axis`,"chart.configText.number_formatting_for_the_y_axis":`Number formatting for the Y-axis`,"chart.configText.number_formatting_for_x_axis_labels":`Number formatting for X-axis labels`,"chart.configText.number_formatting_for_y_axis_and_values":`Number formatting for Y-axis and values`,"chart.configText.number_formatting_for_y_axis_labels":`Number formatting for Y-axis labels`,"chart.configText.number_of_decimal_places_to_display_for_numeric_values":`Number of decimal places to display for numeric values`,"chart.configText.ohlc_measures_open_close_high_low":`OHLC Measures (open, close, high, low)`,"chart.configText.opacity_of_flow_links":`Opacity of flow links`,"chart.configText.overall_text_size_for_the_markdown_content":`Overall text size for the markdown content`,"chart.configText.positive_change_color":`Positive Change Color`,"chart.configText.rows_y_axis":`Rows (Y-Axis)`,"chart.configText.series_color_groups":`Series (Color Groups)`,"chart.configText.series_multiple_lines":`Series (Multiple Lines)`,"chart.configText.series_multiple_shapes":`Series (Multiple Shapes)`,"chart.configText.series_split_into_multiple_lines":`Series (Split into Multiple Lines)`,"chart.configText.series_stack_areas":`Series (Stack Areas)`,"chart.configText.show_series_legend_only_visible_with_a_series_dimension":`Show series legend (only visible with a Series dimension)`,"chart.configText.show_the_color_intensity_legend":`Show the color intensity legend`,"chart.configText.show_the_legend_for_breakdown_segments":`Show the legend for breakdown segments`,"chart.configText.single_measure_whose_values_are_summed_cumulatively":`Single measure whose values are summed cumulatively`,"chart.configText.size":`Size`,"chart.configText.size_of_bubbles_based_on_this_measure":`Size of bubbles based on this measure`,"chart.configText.size_of_the_center_hole_0_for_full_circle":`Size of the center hole (0 for full circle)`,"chart.configText.step_count":`Step Count`,"chart.configText.step_name":`Step Name`,"chart.configText.step_names_auto_populated_from_funnel_steps":`Step names (auto-populated from funnel steps)`,"chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided":`Target value to compare against (first value used if multiple provided)`,"chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value":"Template for displaying the text. Use ${value} to insert the measure value.","chart.configText.text_template":`Text Template`,"chart.configText.threshold_bands":`Threshold Bands`,"chart.configText.time_dimension":`Time Dimension`,"chart.configText.time_dimension_or_category_for_each_candle_e_g_date_symbol":`Time dimension or category for each candle (e.g. date, symbol)`,"chart.configText.time_dimensions_or_dimensions_for_x_axis":`Time dimensions or dimensions for X-axis`,"chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout":`Time field that determines grid structure (granularity affects layout)`,"chart.configText.value":`Value`,"chart.configText.value_color":`Value Color`,"chart.configText.value_color_intensity":`Value (Color Intensity)`,"chart.configText.value_measure":`Value Measure`,"chart.configText.values":`Values`,"chart.configText.vertical_axis_position":`Vertical axis position`,"chart.configText.visualization_style":`Visualization style`,"chart.configText.x_axis_groups":`X-Axis (Groups)`,"chart.configText.x_axis_time_categories":`X-Axis (Time/Categories)`,"chart.configText.x_axis_time_category":`X-Axis (Time / Category)`,"chart.configText.y_axis":`Y-Axis`,"chart.configText.y_axis_measures":`Y-Axis (Measures)`,"chart.configText.y_axis_value":`Y-Axis (Value)`,"display.loading":`Loading display options...`,"display.noOptions":`No display options available for this chart type.`,"display.heading":`Display Options`,"results.loading.title":`Executing Query...`,"results.loading.subtitle":`Running your query against the cube API`,"results.error.title":`Query Execution Failed`,"results.error.subtitle":`There was an error executing your query. Please check the query and try again.`,"results.waiting.title":`Preparing Query...`,"results.waiting.subtitle":`Your query will execute shortly`,"results.needsRefresh.title":`Ready to Execute`,"results.needsRefresh.subtitle":`Click refresh to run your query`,"results.needsRefresh.runButton":`Run Query`,"results.empty.query":`Add metrics or breakdowns from the panel on the right to see results`,"results.empty.retention":`Select a cube and configure retention settings to see results`,"results.empty.funnel":`Add funnel steps to see conversion analysis`,"results.empty.flow":`Configure flow analysis to see user journey paths`,"results.empty.title":`No Results Yet`,"results.ai.button":`Analyse with AI`,"results.noData.title":`Query Successful`,"results.noData.subtitle":`No data returned from the query`,"results.chart.noData":`No data to display`,"results.chart.noDataHint":`Run a query to see chart visualisation`,"results.chart.unsupported":`Unsupported chart type`,"results.refreshing":`Refreshing results...`,"results.header.rows":`rows`,"results.header.row":`row`,"results.header.stale":`Results may be outdated`,"results.header.failed":`Query failed`,"results.header.executing":`Executing...`,"results.header.noResults":`No results`,"results.view.chart":`Chart`,"results.view.merged":`Merged`,"results.warning.largeDataset":`Large dataset:`,"results.warning.configChanged":`Query configuration changed. Results may be outdated.`,"results.warning.refreshNow":`Refresh Now`,"results.share.copied":`Copied!`,"results.share.noChart":`(no chart)`,"server.errors.dbNotConfigured":`Database executor not configured`,"server.errors.cubeNotFound":`Cube '{cubeName}' not found`,"server.errors.noCubesInQuery":`No cubes found in query`,"server.errors.dbAdapterRequired":`DatabaseExecutor must have a databaseAdapter property`,"server.errors.rlsRequiresTransactions":`rlsSetup requires a database driver that supports transactions (db.transaction)`,"server.errors.queryExecutionFailed":`Query execution failed: {message}`,"server.errors.queryExecutionUnknown":`Query execution failed: Unknown error`,"server.errors.noCompareDateRange":`No compareDateRange found in query`,"server.errors.compareDateRangeInvalid":`compareDateRange requires at least 2 periods`,"server.errors.funnelValidationFailed":`Funnel validation failed: {errors}`,"server.errors.flowValidationFailed":`Flow validation failed: {errors}`,"server.errors.retentionValidationFailed":`Retention validation failed: {errors}`,"server.errors.cubeRefUnresolved":`{cubeName}.joins.{joinName}: target cube '{targetCube}' is not registered`,"server.errors.unresolvedCubeRefs":`Unresolved cube references:
|
|
62
|
+
`),sql:t}}function ve(e){let t=0;for(let n of e)if(n===` `||n===`-`||n===`>`)t++;else break;return t}function ye(e){let t=e.replace(/^[\s\d:]*->/,``).trim();if(!t||/^(GlobalStats|partitions|bytes):/i.test(t)||/^\w+=\d+/.test(t))return null;let n=t.match(/^([A-Z][A-Za-z_]+(?:\s+[A-Z][A-Za-z_]+)*)(?:\s+(\S+))?/);if(!n)return null;let r=n[1],i=n[2]||void 0,a=t.match(/estimated rows:\s*(\d+)/i);return{type:r,table:i,estimatedRows:a?parseInt(a[1],10):void 0}}var be=class extends b{async execute(e,t){if(e&&typeof e==`object`&&typeof e.execute==`function`)try{let n=await e.execute();return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Snowflake] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}if(!this.db.execute)throw Error(`Snowflake database instance must have an execute method`);try{let n=await this.db.execute(e);return Array.isArray(n)?n.map(e=>this.convertNumericFields(e,t)):n}catch(t){let n=this.extractSqlFromQuery(e);throw console.error(`[Snowflake] Query execution failed:`,{error:t instanceof Error?t.message:String(t),sql:n.sql,params:n.params}),t}}extractSqlFromQuery(e){try{if(e&&typeof e.toSQL==`function`){let{sql:t,params:n}=e.toSQL();return{sql:t,params:n}}if(e&&typeof e.getSQL==`function`){let t=e.getSQL();if(t&&typeof t.toSQL==`function`){let{sql:e,params:n}=t.toSQL();return{sql:e,params:n}}}return{sql:String(e),params:[]}}catch{return{sql:`[unable to extract SQL]`,params:[]}}}convertNumericFields(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))t&&t.includes(r)?n[r]=this.coerceToNumber(i):n[r]=i;return n}coerceToNumber(e){if(e==null||typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(e&&typeof e==`object`){if(typeof e.toString==`function`){let t=e.toString();if(/^-?\d+(\.\d+)?$/.test(t))return t.includes(`.`)?parseFloat(t):parseInt(t,10)}return e}if(typeof e==`string`){if(/^-?\d+(\.\d+)?$/.test(e))return e.includes(`.`)?parseFloat(e):parseInt(e,10);if(!isNaN(parseFloat(e))&&isFinite(parseFloat(e)))return parseFloat(e)}return e}getEngineType(){return`snowflake`}async explainQuery(e,t,n){if(n?.analyze,!this.db.execute)throw Error(`Snowflake database instance must have an execute method`);let r=await this.db.execute(u.sql`${u.sql.raw(`EXPLAIN`)} ${u.sql.raw(e.replace(/\?/g,()=>{let e=t.shift();return e===null?`NULL`:typeof e==`number`?String(e):typeof e==`boolean`?e?`TRUE`:`FALSE`:e instanceof Date?`'${e.toISOString()}'`:`'${String(e).replace(/'/g,`''`)}'`}))}`),i=[];if(Array.isArray(r)){for(let e of r)if(e&&typeof e==`object`){let t=e.content||e[`QUERY PLAN`]||e.plan||Object.values(e)[0];typeof t==`string`&&i.push(t)}}return _e(i,{sql:e,params:t})}async getTableIndexes(e){return[]}};function xe(e,t){return new be(e,t,`snowflake`)}function Se(e,t,n){if(n)switch(n){case`postgres`:return w(e,t);case`mysql`:return D(e,t);case`sqlite`:return ie(e,t);case`singlestore`:return oe(e,t);case`duckdb`:return de(e,t);case`databend`:return ge(e,t);case`snowflake`:return xe(e,t)}if(e.all&&e.run)return ie(e,t);if(e.execute)return w(e,t);throw Error(`Unable to determine database engine type. Please specify engineType parameter.`)}function k(e,t){return typeof e==`string`?t?t.get(e)||(console.warn(`[drizzle-cube] Cannot resolve cube reference '${e}': no cube with that name is registered. Registered cubes: ${Array.from(t.keys()).join(`, `)||`(none)`}. Join will be skipped.`),null):(console.warn(`[drizzle-cube] Cannot resolve string cube reference '${e}': no cube registry provided. Join will be skipped.`),null):typeof e==`function`?e():e}function Ce(e){switch(e){case`belongsTo`:return`hasMany`;case`hasMany`:return`belongsTo`;case`hasOne`:return`hasOne`;case`belongsToMany`:return`belongsToMany`;default:return e}}function we(e,t){if(t)return t;switch(e){case`belongsTo`:return`inner`;case`hasOne`:return`left`;case`hasMany`:return`left`;case`belongsToMany`:return`left`;default:return`left`}}function Te(e){return e&&typeof e==`object`?u.sql`${u.sql`${e}`}`:e}function Ee(e){if(e===`__proto__`||e===`constructor`||e===`prototype`)throw Error(`Unsafe property key: ${e}`);return e}function A(e,t){return Te(typeof e==`function`?e(t):e)}function De(e,t,n){return{...e,cubes:t,currentCube:n}}function Oe(e,t){return{name:e,...t}}function ke(e,t){if(e.relationship!==`belongsToMany`||!e.through)throw Error(`expandBelongsToManyJoin can only be called on belongsToMany relationships with through configuration`);let{table:n,sourceKey:r,targetKey:i,securitySql:a}=e.through,o=[];for(let e of r){let t=e.as||u.eq;o.push(t(e.source,e.target))}let s=[];for(let e of i){let t=e.as||u.eq;s.push(t(e.source,e.target))}let c;if(a){let e=a(t);c=Array.isArray(e)?e:[e]}let l=we(`belongsToMany`,e.sqlJoinType);return{junctionJoins:[{joinType:l,table:n,condition:(0,u.and)(...o)},{joinType:l,table:n,condition:(0,u.and)(...s)}],junctionSecurityConditions:c}}function Ae(e){if(`and`in e)return`and:[${e.and.map(Ae).sort().join(`,`)}]`;if(`or`in e)return`or:[${e.or.map(Ae).sort().join(`,`)}]`;let t=e,n=JSON.stringify(Array.isArray(t.values)?[...t.values].sort():t.values),r=t.dateRange?`:dr:${JSON.stringify(t.dateRange)}`:``;return`${t.member}:${t.operator}:${n}${r}`}function je(e,t){return`timeDim:${e}:${JSON.stringify(t)}`}var Me=class{cache=new Map;stats={hits:0,misses:0};getOrBuild(e,t){let n=this.cache.get(e);if(n!==void 0)return this.stats.hits++,n;let r=t();return r&&this.cache.set(e,r),this.stats.misses++,r}has(e){return this.cache.has(e)}get(e){let t=this.cache.get(e);return t!==void 0&&this.stats.hits++,t}preload(e){for(let{key:t,sql:n}of e)this.cache.has(t)||this.cache.set(t,n)}set(e,t){this.cache.set(e,t)}getStats(){return{...this.stats,cacheSize:this.cache.size}}clear(){this.cache.clear(),this.stats={hits:0,misses:0}}};function Ne(e){let t=[];for(let n of e)`and`in n&&n.and?t.push(...Ne(n.and)):`or`in n&&n.or?t.push(...Ne(n.or)):`member`in n&&t.push(n);return t}function Pe(e,t,n={}){let r=n.keyPrefix??`drizzle-cube:`,i=Fe(e),a=`${r}query:${Ve(JSON.stringify(i))}`;if(n.includeSecurityContext!==!1){let e=Ve(n.securityContextSerializer?n.securityContextSerializer(t):JSON.stringify(Be(t)));a+=`:ctx:${e}`}return a}function Fe(e){return{measures:e.measures?[...e.measures].sort():void 0,dimensions:e.dimensions?[...e.dimensions].sort():void 0,filters:e.filters?j(e.filters):void 0,timeDimensions:e.timeDimensions?ze(e.timeDimensions):void 0,limit:e.limit,offset:e.offset,order:e.order?Be(e.order):void 0,fillMissingDatesValue:e.fillMissingDatesValue,funnel:e.funnel?Ie(e.funnel):void 0,flow:e.flow?Le(e.flow):void 0,retention:e.retention?Re(e.retention):void 0}}function Ie(e){return{bindingKey:e.bindingKey,timeDimension:e.timeDimension,steps:e.steps.map(e=>{let t={name:e.name,filter:e.filter?Array.isArray(e.filter)?j(e.filter):j([e.filter])[0]:void 0,timeToConvert:e.timeToConvert};return`cube`in e&&e.cube&&(t.cube=e.cube),t}),includeTimeMetrics:e.includeTimeMetrics,globalTimeWindow:e.globalTimeWindow}}function Le(e){return{bindingKey:e.bindingKey,timeDimension:e.timeDimension,eventDimension:e.eventDimension,startingStep:{name:e.startingStep.name,filter:e.startingStep.filter?Array.isArray(e.startingStep.filter)?j(e.startingStep.filter):j([e.startingStep.filter])[0]:void 0},stepsBefore:e.stepsBefore,stepsAfter:e.stepsAfter,entityLimit:e.entityLimit,outputMode:e.outputMode,joinStrategy:e.joinStrategy}}function Re(e){return{timeDimension:e.timeDimension,bindingKey:e.bindingKey,dateRange:e.dateRange,granularity:e.granularity,periods:e.periods,retentionType:e.retentionType,cohortFilters:e.cohortFilters?Array.isArray(e.cohortFilters)?j(e.cohortFilters):j([e.cohortFilters])[0]:void 0,activityFilters:e.activityFilters?Array.isArray(e.activityFilters)?j(e.activityFilters):j([e.activityFilters])[0]:void 0,breakdownDimensions:e.breakdownDimensions}}function j(e){return[...e].map(e=>{if(`and`in e&&e.and)return{and:j(e.and)};if(`or`in e&&e.or)return{or:j(e.or)};let t=e;return{...t,values:t.values?[...t.values].sort():t.values}}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))}function ze(e){return[...e].map(e=>({dimension:e.dimension,granularity:e.granularity,dateRange:e.dateRange,fillMissingDates:e.fillMissingDates,compareDateRange:e.compareDateRange?[...e.compareDateRange].sort((e,t)=>{let n=Array.isArray(e)?e.join(`-`):e,r=Array.isArray(t)?t.join(`-`):t;return n.localeCompare(r)}):void 0})).sort((e,t)=>e.dimension.localeCompare(t.dimension))}function Be(e){return typeof e!=`object`||!e?e:Array.isArray(e)?e.map(Be):Object.keys(e).sort().reduce((t,n)=>(t[n]=Be(e[n]),t),{})}function Ve(e){let t=2166136261,n=Math.min(e.length,65536);for(let r=0;r<n;r++)t^=e.charCodeAt(r),t=t*16777619>>>0;return t.toString(16).padStart(8,`0`)}function He(e,t){return`${t??`drizzle-cube:`}*${e}*`}var Ue=class{constructor(e){this.databaseAdapter=e}buildTimeDimensionExpression(e,t,n){let r=A(e,n);return t?this.databaseAdapter.buildTimeDimension(t,r):r instanceof u.SQL?r:u.sql`${r}`}buildDateRangeCondition(e,t){if(!t)return null;if(Array.isArray(t)&&t.length>=2){let n=this.normalizeDate(t[0]),r=this.normalizeDate(t[1]);if(!n||!r)return null;if(typeof t[1]==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(t[1].trim())){let e=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),t=new Date(e);t.setUTCHours(23,59,59,999),r=this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}return(0,u.and)((0,u.gte)(e,n),(0,u.lte)(e,r))}if(typeof t==`string`){let n=this.parseRelativeDateRange(t);if(n){let t,r;return this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?(t=Math.floor(n.start.getTime()/1e3),r=Math.floor(n.end.getTime()/1e3)):(t=n.start.getTime(),r=n.end.getTime()):(t=n.start.toISOString(),r=n.end.toISOString()),(0,u.and)((0,u.gte)(e,t),(0,u.lte)(e,r))}let r=this.normalizeDate(t);if(!r)return null;let i=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),a=new Date(i);a.setUTCHours(0,0,0,0);let o=new Date(i);o.setUTCHours(23,59,59,999);let s,c;return this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?(s=Math.floor(a.getTime()/1e3),c=Math.floor(o.getTime()/1e3)):(s=a.getTime(),c=o.getTime()):(s=a.toISOString(),c=o.toISOString()),(0,u.and)((0,u.gte)(e,s),(0,u.lte)(e,c))}return null}parseRelativeDateRange(e){let t=new Date,n=e.toLowerCase().trim(),r=t.getUTCFullYear(),i=t.getUTCMonth(),a=t.getUTCDate(),o=t.getUTCDay();if(n===`today`){let e=new Date(t);e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`yesterday`){let e=new Date(t);e.setUTCDate(a-1),e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCDate(a-1),n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`this week`){let e=o===0?-6:1-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`this month`)return{start:new Date(Date.UTC(r,i,1,0,0,0,0)),end:new Date(Date.UTC(r,i+1,0,23,59,59,999))};if(n===`this quarter`){let e=Math.floor(i/3);return{start:new Date(Date.UTC(r,e*3,1,0,0,0,0)),end:new Date(Date.UTC(r,e*3+3,0,23,59,59,999))}}if(n===`this year`)return{start:new Date(Date.UTC(r,0,1,0,0,0,0)),end:new Date(Date.UTC(r,11,31,23,59,59,999))};let s=n.match(/^last\s+(\d+)\s+days?$/);if(s){let e=parseInt(s[1],10),n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}let c=n.match(/^last\s+(\d+)\s+weeks?$/);if(c){let e=parseInt(c[1],10)*7,n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last week`){let e=o===0?-13:-6-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last month`)return{start:new Date(Date.UTC(r,i-1,1,0,0,0,0)),end:new Date(Date.UTC(r,i,0,23,59,59,999))};if(n===`last quarter`){let e=Math.floor(i/3),t=e===0?3:e-1,n=e===0?r-1:r;return{start:new Date(Date.UTC(n,t*3,1,0,0,0,0)),end:new Date(Date.UTC(n,t*3+3,0,23,59,59,999))}}if(n===`last year`)return{start:new Date(Date.UTC(r-1,0,1,0,0,0,0)),end:new Date(Date.UTC(r-1,11,31,23,59,59,999))};if(n===`last 12 months`){let e=new Date(Date.UTC(r,i-11,1,0,0,0,0)),n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}let l=n.match(/^last\s+(\d+)\s+months?$/);if(l){let e=parseInt(l[1],10),n=new Date(Date.UTC(r,i-e+1,1,0,0,0,0)),a=new Date(t);return a.setUTCHours(23,59,59,999),{start:n,end:a}}let u=n.match(/^last\s+(\d+)\s+years?$/);if(u){let e=parseInt(u[1],10),n=new Date(Date.UTC(r-e,0,1,0,0,0,0)),i=new Date(t);return i.setUTCHours(23,59,59,999),{start:n,end:i}}return null}normalizeDate(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(e.getTime()/1e3):e.getTime():e.toISOString();if(typeof e==`number`){let t=e<1e10?e*1e3:e,n=new Date(t);return isNaN(n.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t/1e3):t:n.toISOString()}if(typeof e==`string`){if(/^\d{4}-\d{2}-\d{2}$/.test(e.trim())){let t=new Date(e+`T00:00:00Z`);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}let t=new Date(e);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}let t=new Date(e);return isNaN(t.getTime())?null:this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}},We=class{constructor(e,t){this.databaseAdapter=e,this.dateTimeBuilder=t}buildFilterCondition(e,t,n,r,i){if(i!==void 0){if(t!==`inDateRange`)throw Error(`dateRange can only be used with 'inDateRange' operator, but got '${t}'. Use explicit date values in the 'values' array for other date operators.`);if(r&&r.type!==`time`)throw Error(`dateRange can only be used on time dimensions, but field '${r.name||`unknown`}' has type '${r.type}'`);return this.dateTimeBuilder.buildDateRangeCondition(e,i)}if(!n||n.length===0)return t===`equals`?this.databaseAdapter.buildBooleanLiteral(!1):null;let a=n.filter(e=>!(e==null||e===``||typeof e==`string`&&e.includes(`\0`))).map(this.databaseAdapter.convertFilterValue);if(a.length===0&&![`set`,`notSet`].includes(t))return t===`equals`?this.databaseAdapter.buildBooleanLiteral(!1):null;let o=a[0];switch(t){case`equals`:return a.length>1?r?.type===`time`?(0,u.inArray)(e,a.map(e=>this.dateTimeBuilder.normalizeDate(e)||e)):(0,u.inArray)(e,a):a.length===1?(0,u.eq)(e,r?.type===`time`&&this.dateTimeBuilder.normalizeDate(o)||o):this.databaseAdapter.buildBooleanLiteral(!1);case`notEquals`:return a.length>1?(0,u.notInArray)(e,a):a.length===1?(0,u.ne)(e,o):null;case`contains`:return this.databaseAdapter.buildStringCondition(e,`contains`,o);case`notContains`:return this.databaseAdapter.buildStringCondition(e,`notContains`,o);case`startsWith`:return this.databaseAdapter.buildStringCondition(e,`startsWith`,o);case`endsWith`:return this.databaseAdapter.buildStringCondition(e,`endsWith`,o);case`gt`:return(0,u.gt)(e,o);case`gte`:return(0,u.gte)(e,o);case`lt`:return(0,u.lt)(e,o);case`lte`:return(0,u.lte)(e,o);case`set`:return(0,u.isNotNull)(e);case`notSet`:return(0,u.isNull)(e);case`inDateRange`:if(a.length>=2){let t=this.dateTimeBuilder.normalizeDate(a[0]),r=this.dateTimeBuilder.normalizeDate(a[1]);if(t&&r){let i=n[1];if(typeof i==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(i.trim())){let e=typeof r==`number`?new Date(r*(this.databaseAdapter.getEngineType()===`sqlite`?1e3:1)):new Date(r),t=new Date(e);t.setUTCHours(23,59,59,999),r=this.databaseAdapter.isTimestampInteger()?this.databaseAdapter.getEngineType()===`sqlite`?Math.floor(t.getTime()/1e3):t.getTime():t.toISOString()}return(0,u.and)((0,u.gte)(e,t),(0,u.lte)(e,r))}}return null;case`beforeDate`:{let t=this.dateTimeBuilder.normalizeDate(o);return t?(0,u.lt)(e,t):null}case`afterDate`:{let t=this.dateTimeBuilder.normalizeDate(o);return t?(0,u.gt)(e,t):null}case`between`:return a.length>=2?(0,u.and)((0,u.gte)(e,a[0]),(0,u.lte)(e,a[1])):null;case`notBetween`:return a.length>=2?(0,u.or)((0,u.lt)(e,a[0]),(0,u.gt)(e,a[1])):null;case`in`:return a.length>0?(0,u.inArray)(e,a):null;case`notIn`:return a.length>0?(0,u.notInArray)(e,a):null;case`like`:return this.databaseAdapter.buildStringCondition(e,`like`,o);case`notLike`:return this.databaseAdapter.buildStringCondition(e,`notLike`,o);case`ilike`:return this.databaseAdapter.buildStringCondition(e,`ilike`,o);case`regex`:return this.databaseAdapter.buildStringCondition(e,`regex`,o);case`notRegex`:return this.databaseAdapter.buildStringCondition(e,`notRegex`,o);case`isEmpty`:return(0,u.or)((0,u.isNull)(e),(0,u.eq)(e,``));case`isNotEmpty`:return(0,u.and)((0,u.isNotNull)(e),(0,u.ne)(e,``));case`arrayContains`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayContains)(e,a):null;case`arrayOverlaps`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayOverlaps)(e,a):null;case`arrayContained`:return this.databaseAdapter.getEngineType()===`postgres`?(0,u.arrayContained)(e,a):null;default:return null}}buildLogicalFilter(e,t,n){if(`and`in e&&e.and){let r=e.and.map(e=>this.buildSingleFilter(e,t,n)).filter(e=>e!==null);return r.length>0?r.length===1?r[0]:(0,u.and)(...r):null}if(`or`in e&&e.or){let r=e.or.map(e=>this.buildSingleFilter(e,t,n)).filter(e=>e!==null);return r.length>0?r.length===1?r[0]:(0,u.or)(...r):null}return null}buildSingleFilter(e,t,n){if(`and`in e||`or`in e)return this.buildLogicalFilter(e,t,n);let r=e,[i,a]=r.member.split(`.`),o=t.get(i);if(!o)return null;let s=o.dimensions?.[a];if(!s)return null;let c=s.type===`time`?A(s.sql,n):typeof s.sql==`function`?s.sql(n):s.sql;return this.buildFilterCondition(c,r.operator,r.values,s,r.dateRange)}},M=class{dependencyGraph;cubes;constructor(e){this.cubes=e instanceof Map?e:new Map([[e.name,e]]),this.dependencyGraph=new Map}extractDependencies(e){if(e.length>1e3)return[];let t=e.matchAll(/\{([^}]+)\}/g),n=[];for(let e of t){let t=e[1].trim();if(t.includes(`.`)){let[e,r]=t.split(`.`);n.push({measureName:t,cubeName:e.trim(),fieldName:r.trim()})}else n.push({measureName:t,cubeName:null,fieldName:t})}return n}buildGraph(e){for(let[t,n]of Object.entries(e.measures))if(n.type===`calculated`&&n.calculatedSql){let r=`${e.name}.${t}`,i=this.extractDependencies(n.calculatedSql),a=new Set;for(let t of i){let n=`${t.cubeName||e.name}.${t.fieldName}`;a.add(n)}this.dependencyGraph.set(r,{id:r,dependencies:a,inDegree:0})}this.calculateInDegrees()}buildGraphForMultipleCubes(e){for(let t of e.values())this.buildGraph(t)}calculateInDegrees(){for(let e of this.dependencyGraph.values())e.inDegree=0;for(let e of this.dependencyGraph.values())for(let t of e.dependencies){let e=this.dependencyGraph.get(t);e&&e.inDegree++}}topologicalSort(e){let t=new Map,n=[],r=[];for(let n of e){let e=this.dependencyGraph.get(n);e&&t.set(n,{id:e.id,dependencies:new Set(e.dependencies),inDegree:0})}for(let e of t.values()){let n=0;for(let r of e.dependencies)t.has(r)&&n++;e.inDegree=n}for(let[e,r]of t)r.inDegree===0&&n.push(e);for(;n.length>0;){let e=n.shift();r.push(e);for(let[r,i]of t)i.dependencies.has(e)&&(i.inDegree--,i.inDegree===0&&n.push(r))}if(r.length<t.size){let e=this.detectCycle();throw Error(`Circular dependency detected in calculated measures: ${e?e.join(` -> `):`unknown cycle`}`)}return r}detectCycle(){let e=new Set,t=new Set,n=[];for(let r of this.dependencyGraph.keys())if(!e.has(r)){let i=this.dfs(r,e,t,n);if(i)return i}return null}dfs(e,t,n,r){t.add(e),n.add(e),r.push(e);let i=this.dependencyGraph.get(e);if(!i)return r.pop(),n.delete(e),null;for(let e of i.dependencies)if(!t.has(e)){let i=this.dfs(e,t,n,r);if(i)return i}else if(n.has(e)){let t=r.indexOf(e);return[...r.slice(t),e]}return r.pop(),n.delete(e),null}getAllDependencies(e){let t=new Set,n=new Set,r=e=>{if(n.has(e))return;n.add(e);let i=this.dependencyGraph.get(e);if(i)for(let e of i.dependencies)t.add(e),r(e)};return r(e),t}validateDependencies(e){for(let[t,n]of Object.entries(e.measures))if(n.type===`calculated`&&n.calculatedSql){let r=this.extractDependencies(n.calculatedSql);for(let n of r){let r=n.cubeName||e.name,i=this.cubes.get(r);if(!i)throw Error(`Calculated measure '${e.name}.${t}' references unknown cube '${r}'`);if(!i.measures[n.fieldName])throw Error(`Calculated measure '${e.name}.${t}' references unknown measure '${n.measureName}'`);if(r===e.name&&n.fieldName===t)throw Error(`Calculated measure '${e.name}.${t}' cannot reference itself`)}}}populateDependencies(e){for(let[,t]of Object.entries(e.measures))t.type===`calculated`&&t.calculatedSql&&!t.dependencies&&(t.dependencies=this.extractDependencies(t.calculatedSql).map(e=>e.measureName))}static isCalculatedMeasure(e){return e.type===`calculated`&&!!e.calculatedSql}},Ge={"analysis.modes.query.label":`Query`,"analysis.modes.query.description":`Standard analysis (single or multi-query)`,"analysis.modes.funnel.label":`Funnel`,"analysis.modes.funnel.description":`Sequential conversion analysis`,"analysis.modes.flow.label":`Flow`,"analysis.modes.flow.description":`Bidirectional path analysis with Sankey visualisation`,"analysis.modes.retention.label":`Retention`,"analysis.modes.retention.description":`Cohort-based retention analysis over time periods`,"analysis.ai.title":`AI Query Generator`,"analysis.ai.generating":`Generating...`,"analysis.ai.placeholder":`Describe your query in natural language... (e.g., 'Show total sales by month for the last year')`,"analysis.ai.shortcutHint":`Press Enter to generate, Shift+Enter for new line`,"analysis.ai.successMessage":`Query generated and loaded! Check the results below, then click Accept to keep or Cancel to revert.`,"analysis.ai.button.accept":`Accept`,"analysis.ai.button.cancel":`Cancel`,"analysis.ai.button.close":`Close`,"analysis.ai.button.generate":`Generate`,"analysis.ai.button.generating":`Generating...`,"analysis.sections.metrics":`Metrics`,"analysis.sections.breakdown":`Breakdown`,"analysis.sections.dimensions":`Dimensions`,"analysis.sections.filters":`Filter`,"analysis.sections.limit":`Limit`,"analysis.tabs.query":`Query`,"analysis.tabs.chart":`Chart`,"analysis.tabs.chartTitle":`Chart configuration`,"analysis.tabs.display":`Display`,"analysis.tabs.displayTitle":`Display options`,"analysis.multiQuery.removeQuery":`Remove query`,"analysis.multiQuery.addQuery":`Add new query`,"analysis.multiQuery.addAnother":`Add another query`,"analysis.multiQuery.mergeExplanation":`In merge mode, dimensions are shared from Q1.`,"analysis.multiQuery.switchToSeparate":`Switch to separate series`,"analysis.mergeStrategy.concat":`Separate series`,"analysis.mergeStrategy.merge":`Merge by dimension`,"analysis.mergeStrategy.funnel":`Funnel`,"analysis.placeholders.addMetrics":`Add metrics to generate SQL`,"analysis.placeholders.hoverField":`Hover over a field to see details`,"analysis.placeholders.noData":`No data available`,"common.actions.accept":`Accept`,"common.actions.cancel":`Cancel`,"common.actions.delete":`Delete`,"common.actions.close":`Close`,"common.actions.edit":`Edit`,"common.actions.save":`Save`,"common.actions.copy":`Copy`,"common.actions.duplicate":`Duplicate`,"common.actions.refresh":`Refresh`,"common.actions.confirm":`Confirm`,"common.actions.add":`Add`,"common.actions.clear":`Clear`,"common.actions.select":`Select`,"common.actions.navigate":`Navigate`,"common.actions.share":`Share`,"common.loading":`Loading...`,"common.modal.processing":`Processing...`,"common.modal.dashboardName":`Dashboard Name`,"common.modal.deleteConfirmation":`Are you sure? This action cannot be undone.`,"common.sorting.ascending":`Sorted ascending (click for descending)`,"common.sorting.descending":`Sorted descending (click to remove)`,"common.sorting.none":`Click to sort ascending`,"fieldTypes.count":`Count`,"fieldTypes.countDistinct":`Count Distinct`,"fieldTypes.countDistinctApprox":`Count Distinct (Approx)`,"fieldTypes.sum":`Sum`,"fieldTypes.avg":`Average`,"fieldTypes.min":`Minimum`,"fieldTypes.max":`Maximum`,"fieldTypes.runningTotal":`Running Total`,"fieldTypes.number":`Number`,"fieldTypes.string":`Text`,"fieldTypes.boolean":`Boolean`,"fieldTypes.time":`Time Dimension`,"fieldTypes.geo":`Geographic`,"fieldTypes.dimension":`Dimension`,"fieldPanel.emptyState":`Hover over a field to see details`,"fieldPanel.usageHint":`Press Enter or click to add this field to your query.`,"fieldPanel.labels.type":`Type`,"fieldPanel.labels.cube":`Cube`,"fieldPanel.labels.category":`Category`,"fieldCategory.measure":`Measure`,"fieldCategory.timeDimension":`Time Dimension`,"fieldCategory.dimension":`Dimension`,"fieldSearch.placeholder.metrics":`Search metrics...`,"fieldSearch.placeholder.filter":`Search fields to filter...`,"fieldSearch.placeholder.dimensions":`Search dimensions...`,"fieldSearch.modal.title.metrics":`Select a Metric`,"fieldSearch.modal.title.filter":`Select a Field to Filter`,"fieldSearch.modal.title.dimensions":`Select a Dimension`,"fieldSearch.filter.allCubes":`All Cubes`,"fieldSearch.categories.all":`All`,"fieldSearch.empty.heading":`No fields found`,"fieldSearch.empty.noMatchMetrics":`No metrics match "{searchTerm}"`,"fieldSearch.empty.noMatchDimensions":`No dimensions match "{searchTerm}"`,"fieldSearch.empty.noMetrics":`No metrics available`,"fieldSearch.empty.noDimensions":`No dimensions available`,"fieldSearch.section.recents":`Recents`,"fieldSearch.footer.metricsAvailable":`metrics available`,"fieldSearch.footer.fieldsAvailable":`fields available`,"fieldSearch.footer.dimensionsAvailable":`dimensions available`,"fieldSearch.shortcut.navigate":`Navigate`,"fieldSearch.shortcut.keyEnter":`Enter`,"fieldSearch.shortcut.keyShift":`Shift`,"fieldSearch.shortcut.keyEsc":`Esc`,"fieldSearch.shortcut.plusClick":`+Click`,"fieldSearch.shortcut.select":`Select`,"fieldSearch.shortcut.multiSelect":`Multi-select`,"fieldSearch.shortcut.close":`Close`,"filter.group.condition":`condition`,"filter.group.conditions":`conditions`,"filter.group.addFilter":`Add Filter`,"filter.group.addAndGroup":`Add AND Group`,"filter.group.addOrGroup":`Add OR Group`,"filter.group.removeGroup":`Remove group`,"filter.group.empty":`No conditions in this group`,"filter.group.addFilterLink":`Add a filter`,"filter.modal.title":`Edit Filter`,"filter.modal.fieldLabel":`Field`,"filter.modal.operatorLabel":`Operator`,"filter.modal.valueLabel":`Value`,"filter.modal.selectRange":`Select range`,"filter.modal.noValueRequired":`No value required`,"filter.modal.dateTo":`to`,"filter.modal.min":`Min`,"filter.modal.to":`to`,"filter.modal.max":`Max`,"filter.modal.enterNumber":`Enter number`,"filter.modal.loading":`Loading...`,"filter.modal.selectValue":`Select value...`,"filter.modal.search":`Search...`,"filter.modal.errorPrefix":`Error: `,"filter.modal.noValues":`No values found`,"filter.modal.multiSelectHint":`Hold Shift to select multiple values`,"filter.modal.enterValue":`Enter value...`,"filter.removeButton.title":`Remove filter`,"filter.section.clearAll":`Clear all`,"filter.section.dropHint":`Drop to add filter`,"filter.section.empty":`No filters applied`,"filter.valueDisplay.empty":`(empty)`,"filter.valueDisplay.more":`more`,"filter.operator.equals.label":`equals`,"filter.operator.equals.description":`Exact match`,"filter.operator.notEquals.label":`not equals`,"filter.operator.notEquals.description":`Does not match`,"filter.operator.contains.label":`contains`,"filter.operator.contains.description":`Contains text (case insensitive)`,"filter.operator.notContains.label":`not contains`,"filter.operator.notContains.description":`Does not contain text`,"filter.operator.startsWith.label":`starts with`,"filter.operator.startsWith.description":`Starts with text`,"filter.operator.notStartsWith.label":`not starts with`,"filter.operator.notStartsWith.description":`Does not start with text`,"filter.operator.endsWith.label":`ends with`,"filter.operator.endsWith.description":`Ends with text`,"filter.operator.notEndsWith.label":`not ends with`,"filter.operator.notEndsWith.description":`Does not end with text`,"filter.operator.like.label":`like`,"filter.operator.like.description":`SQL LIKE pattern matching (case sensitive)`,"filter.operator.notLike.label":`not like`,"filter.operator.notLike.description":`SQL NOT LIKE pattern matching (case sensitive)`,"filter.operator.ilike.label":`ilike`,"filter.operator.ilike.description":`SQL ILIKE pattern matching (case insensitive)`,"filter.operator.gt.label":`greater than`,"filter.operator.gt.description":`Greater than value`,"filter.operator.gte.label":`greater than or equal`,"filter.operator.gte.description":`Greater than or equal to value`,"filter.operator.lt.label":`less than`,"filter.operator.lt.description":`Less than value`,"filter.operator.lte.label":`less than or equal`,"filter.operator.lte.description":`Less than or equal to value`,"filter.operator.between.label":`between`,"filter.operator.between.description":`Between two values (inclusive)`,"filter.operator.notBetween.label":`not between`,"filter.operator.notBetween.description":`Not between two values`,"filter.operator.in.label":`in`,"filter.operator.in.description":`Matches any of the provided values`,"filter.operator.notIn.label":`not in`,"filter.operator.notIn.description":`Does not match any of the provided values`,"filter.operator.set.label":`is set`,"filter.operator.set.description":`Is not null/empty`,"filter.operator.notSet.label":`is not set`,"filter.operator.notSet.description":`Is null/empty`,"filter.operator.isEmpty.label":`is empty`,"filter.operator.isEmpty.description":`Is empty string or null`,"filter.operator.isNotEmpty.label":`is not empty`,"filter.operator.isNotEmpty.description":`Is not empty string and not null`,"filter.operator.inDateRange.label":`in date range`,"filter.operator.inDateRange.description":`Between two dates`,"filter.operator.beforeDate.label":`before date`,"filter.operator.beforeDate.description":`Before specified date`,"filter.operator.afterDate.label":`after date`,"filter.operator.afterDate.description":`After specified date`,"filter.operator.regex.label":`matches regex`,"filter.operator.regex.description":`Matches regular expression pattern`,"filter.operator.notRegex.label":`not matches regex`,"filter.operator.notRegex.description":`Does not match regular expression pattern`,"filter.operator.arrayContains.label":`array contains all`,"filter.operator.arrayContains.description":`Array field contains all specified values (PostgreSQL only)`,"filter.operator.arrayOverlaps.label":`array contains any`,"filter.operator.arrayOverlaps.description":`Array field contains any of the specified values (PostgreSQL only)`,"filter.operator.arrayContained.label":`array values in`,"filter.operator.arrayContained.description":`All array field values are within specified values (PostgreSQL only)`,"dateRange.custom":`Custom`,"dateRange.today":`Today`,"dateRange.yesterday":`Yesterday`,"dateRange.thisWeek":`This week`,"dateRange.thisMonth":`This month`,"dateRange.thisQuarter":`This quarter`,"dateRange.thisYear":`This year`,"dateRange.last7Days":`Last 7 days`,"dateRange.last30Days":`Last 30 days`,"dateRange.lastNDays":`Last N days`,"dateRange.lastWeek":`Last week`,"dateRange.lastNWeeks":`Last N weeks`,"dateRange.lastMonth":`Last month`,"dateRange.last12Months":`Last 12 months`,"dateRange.lastNMonths":`Last N months`,"dateRange.lastQuarter":`Last quarter`,"dateRange.lastNQuarters":`Last N quarters`,"dateRange.lastYear":`Last year`,"dateRange.lastNYears":`Last N years`,"timeGranularity.hour":`Hour`,"timeGranularity.day":`Day`,"timeGranularity.week":`Week`,"timeGranularity.month":`Month`,"timeGranularity.quarter":`Quarter`,"timeGranularity.year":`Year`,"query.limit.label":`Limit`,"query.limit.clear":`Clear`,"chart.bar.label":`Bar Chart`,"chart.bar.description":`Compare values across categories`,"chart.bar.useCase":`Best for comparing discrete categories, showing rankings, or displaying changes over time`,"chart.line.label":`Line Chart`,"chart.line.description":`Show trends and changes over time`,"chart.line.useCase":`Best for continuous data, trends, time series, and showing relationships between multiple series`,"chart.area.label":`Area Chart`,"chart.area.description":`Emphasise magnitude of change over time`,"chart.area.useCase":`Best for showing cumulative totals, volume changes, or stacked comparisons over time`,"chart.pie.label":`Pie Chart`,"chart.pie.description":`Show proportions of a whole`,"chart.pie.useCase":`Best for showing percentage distribution or composition of a total (limit to 5-7 slices)`,"chart.scatter.label":`Scatter Plot`,"chart.scatter.description":`Reveal correlations between variables`,"chart.scatter.useCase":`Best for identifying patterns, correlations, outliers, and relationships between two measures`,"chart.bubble.label":`Bubble Chart`,"chart.bubble.description":`Compare three dimensions of data`,"chart.bubble.useCase":`Best for showing relationships between three variables (X, Y, and size), market analysis`,"chart.radar.label":`Radar Chart`,"chart.radar.description":`Compare multiple metrics across categories`,"chart.radar.useCase":`Best for multivariate comparisons, performance metrics, strengths/weaknesses analysis`,"chart.radialBar.label":`Radial Bar Chart`,"chart.radialBar.description":`Circular progress and KPI visualisation`,"chart.radialBar.useCase":`Best for showing progress toward goals, KPIs, or comparing percentages in a compact form`,"chart.treemap.label":`TreeMap`,"chart.treemap.description":`Visualise hierarchical data with nested rectangles`,"chart.treemap.useCase":`Best for showing part-to-whole relationships in hierarchical data, disk usage, budget allocation`,"chart.table.label":`Data Table`,"chart.table.description":`Display detailed tabular data`,"chart.table.useCase":`Best for precise values, detailed analysis, sortable/filterable data exploration`,"chart.activityGrid.label":`Activity Grid`,"chart.activityGrid.description":`GitHub-style activity grid showing temporal patterns across different time scales`,"chart.activityGrid.useCase":`Best for visualising activity patterns over time. Supports hour (3hr blocks × days), day (days × weeks), week (weeks × months), month (months × quarters), and quarter (quarters × years) granularities`,"chart.kpiNumber.label":`KPI Number`,"chart.kpiNumber.description":`Display key performance indicators as large numbers`,"chart.kpiNumber.useCase":`Perfect for showing important metrics like revenue, user count, or other key business metrics in a prominent, easy-to-read format`,"chart.kpiDelta.label":`KPI Delta`,"chart.kpiDelta.description":`Display change between latest and previous values with trend indicators`,"chart.kpiDelta.useCase":`Perfect for showing performance changes over time, such as revenue growth, user acquisition changes, or other metrics where the trend and delta are more important than the absolute value`,"chart.kpiText.label":`KPI Text`,"chart.kpiText.description":`Display key performance indicators as customisable text`,"chart.kpiText.useCase":`Perfect for showing metrics with custom formatting, combining multiple values, or displaying contextual KPI information using templates`,"chart.markdown.label":`Markdown`,"chart.markdown.description":`Display custom markdown content with formatting`,"chart.markdown.useCase":`Perfect for adding documentation, notes, section headers, instructions, or formatted text to dashboards`,"chart.funnel.label":`Funnel Chart`,"chart.funnel.description":`Show conversion through sequential steps`,"chart.funnel.useCase":`Best for visualising user journey funnels, sales pipelines, or multi-step processes`,"chart.sankey.label":`Sankey Chart`,"chart.sankey.description":`Show flow between states or steps`,"chart.sankey.useCase":`Best for visualising user journey flows, path analysis, or state transitions`,"chart.sunburst.label":`Sunburst Chart`,"chart.sunburst.description":`Show hierarchical flow as radial rings`,"chart.sunburst.useCase":`Best for visualising forward paths from a starting event in a compact radial layout`,"chart.heatmap.label":`Heatmap`,"chart.heatmap.description":`Visualise intensity across two dimensions`,"chart.heatmap.useCase":`Best for showing patterns in matrix data like correlations, schedules, or category comparisons`,"chart.retentionHeatmap.label":`Retention Matrix`,"chart.retentionHeatmap.description":`Cohort retention matrix visualisation`,"chart.retentionHeatmap.useCase":`Visualise user retention over time by cohort`,"chart.retentionCombined.label":`Retention Chart`,"chart.retentionCombined.description":`Combined retention visualisation with line chart and heatmap modes`,"chart.retentionCombined.useCase":`Visualise user retention over time with optional breakdown segmentation`,"chart.boxPlot.label":`Box Plot`,"chart.boxPlot.description":`Show statistical distribution (median, IQR, whiskers) across categories`,"chart.boxPlot.useCase":`Best for P&L spread per symbol, trade size distribution, latency distribution across platforms`,"chart.waterfall.label":`Waterfall Chart`,"chart.waterfall.description":`Show cumulative effect of sequential positive and negative values`,"chart.waterfall.useCase":`Best for P&L decomposition, cash flow analysis, budget variance, or any sequential contribution breakdown`,"chart.candlestick.label":`Candlestick Chart`,"chart.candlestick.description":`Financial candlestick chart showing open/close body and high/low wicks`,"chart.candlestick.useCase":`Best for EOD quotes (bid/ask spread per date/symbol), markout distribution bands, or OHLC price data`,"chart.measureProfile.label":`Measure Profile`,"chart.measureProfile.description":`Plot N measures as sequential X-axis points to visualise a profile or shape across intervals`,"chart.measureProfile.useCase":`Best for markout interval analysis (e.g. avgMinus2m → avgAtEvent → avgPlus2h), metric profiles, or any pattern across ordered measures`,"chart.gauge.label":`Gauge Chart`,"chart.gauge.description":`Half-circle arc gauge for a single KPI value versus a maximum target`,"chart.gauge.useCase":`Best for high-water marks vs equity, margin utilisation, or any single value progress toward a goal`,"chart.config.chartType":`Chart Type`,"chart.config.loading":`Loading chart configuration...`,"chart.config.axisConfig":`Chart Configuration`,"chart.config.unassigned":`Unassigned Fields`,"chart.config.unassignedHint":`Drag fields to chart axes above`,"chart.config.noFields":`Add metrics and breakdowns in the Query tab to configure chart axes`,"chart.dropZone.xAxis.label":`X-Axis (Categories)`,"chart.dropZone.xAxis.description":`Dimensions and time dimensions for grouping`,"chart.dropZone.xAxis.empty":`Drop dimensions & time dimensions here`,"chart.dropZone.yAxis.label":`Y-Axis (Values)`,"chart.dropZone.yAxis.description":`Measures for values or dimensions for series`,"chart.dropZone.yAxis.empty":`Drop measures or dimensions here`,"chart.dropZone.series.label":`Series (Split into Multiple Series)`,"chart.dropZone.series.description":`Dimensions to create separate data series`,"chart.dropZone.series.empty":`Drop dimensions here to split data into series`,"chart.dropZone.maxReached":`Maximum items reached`,"chart.dropZone.default.empty":`Drop fields here`,"chart.bar.dropZone.xAxis.empty":`Drop dimensions & time dimensions here`,"chart.bar.dropZone.yAxis.empty":`Drop measures here`,"chart.bar.dropZone.series.empty":`Drop dimensions here to split data into series`,"chart.line.dropZone.xAxis.empty":`Drop time dimensions or dimensions here`,"chart.line.dropZone.yAxis.empty":`Drop measures here`,"chart.line.dropZone.series.empty":`Drop dimensions here for multiple lines`,"chart.area.dropZone.xAxis.empty":`Drop time dimensions or dimensions here`,"chart.area.dropZone.yAxis.empty":`Drop measures here`,"chart.area.dropZone.series.empty":`Drop dimensions here for stacked areas`,"chart.pie.dropZone.xAxis.empty":`Drop a dimension for categories`,"chart.pie.dropZone.yAxis.empty":`Drop a measure for values`,"chart.scatter.dropZone.xAxis.empty":`Drop a field for X-axis`,"chart.scatter.dropZone.yAxis.empty":`Drop a measure for Y-axis`,"chart.scatter.dropZone.series.empty":`Drop a dimension to colour points`,"chart.bubble.dropZone.xAxis.empty":`Drop a field for X-axis position`,"chart.bubble.dropZone.yAxis.empty":`Drop a measure for Y-axis position`,"chart.bubble.dropZone.sizeField.empty":`Drop a measure for bubble size`,"chart.bubble.dropZone.series.empty":`Drop a dimension for bubble labels`,"chart.bubble.dropZone.colorField.empty":`Drop a field for bubble colour (optional)`,"chart.radar.dropZone.xAxis.empty":`Drop dimensions for radar axes`,"chart.radar.dropZone.yAxis.empty":`Drop measures for values`,"chart.radar.dropZone.series.empty":`Drop dimensions for multiple shapes`,"chart.radialBar.dropZone.xAxis.empty":`Drop dimensions for categories`,"chart.radialBar.dropZone.yAxis.empty":`Drop a measure for values`,"chart.treemap.dropZone.xAxis.empty":`Drop dimensions for categories`,"chart.treemap.dropZone.yAxis.empty":`Drop a measure for size`,"chart.treemap.dropZone.series.empty":`Drop a dimension for colour grouping`,"chart.table.dropZone.xAxis.empty":`Drop fields to display as columns (or leave empty for all)`,"chart.activityGrid.dropZone.dateField.empty":`Drop a time dimension (granularity affects grid structure)`,"chart.activityGrid.dropZone.valueField.empty":`Drop a measure for activity intensity`,"chart.kpiNumber.dropZone.yAxis.empty":`Drop a measure here`,"chart.kpiDelta.dropZone.yAxis.empty":`Drop a measure here`,"chart.kpiDelta.dropZone.xAxis.empty":`Drop a dimension for ordering`,"chart.kpiText.dropZone.yAxis.empty":`Drop a measure here`,"chart.funnel.dropZone.xAxis.empty":`Steps defined in funnel config`,"chart.funnel.dropZone.yAxis.empty":`Counts calculated from funnel execution`,"chart.sankey.dropZone.xAxis.empty":`Auto-populated from flow config`,"chart.sankey.dropZone.yAxis.empty":`Calculated from flow execution`,"chart.sunburst.dropZone.xAxis.empty":`Auto-populated from flow config`,"chart.sunburst.dropZone.yAxis.empty":`Calculated from flow execution`,"chart.heatmap.dropZone.xAxis.empty":`Drop one dimension here`,"chart.heatmap.dropZone.yAxis.empty":`Drop one dimension here`,"chart.heatmap.dropZone.valueField.empty":`Drop one measure here`,"chart.boxPlot.dropZone.xAxis.empty":`Drop a dimension here`,"chart.boxPlot.dropZone.yAxis.empty":`Drop 1, 3, or 5 measures here`,"chart.waterfall.dropZone.xAxis.empty":`Drop a dimension here`,"chart.waterfall.dropZone.yAxis.empty":`Drop a measure here`,"chart.candlestick.dropZone.xAxis.empty":`Drop a time or dimension here`,"chart.candlestick.dropZone.yAxis.empty":`Drop 2+ measures here`,"chart.measureProfile.dropZone.yAxis.empty":`Drop 2+ measures here (displayed left → right)`,"chart.measureProfile.dropZone.series.empty":`Drop a dimension here to create multiple lines`,"chart.gauge.dropZone.yAxis.empty":`Drop 1 measure here (optional 2nd for dynamic max)`,"chart.activityGrid.validation.timeDimensionRequired":`Time dimension is required for activity grid`,"chart.activityGrid.validation.measureRequired":`Activity measure is required for intensity mapping`,"chart.kpiDelta.validation.measureRequired":`A measure is required for KPI Delta charts`,"chart.heatmap.validation.xAxisRequired":`X-axis dimension required`,"chart.heatmap.validation.yAxisRequired":`Y-axis dimension required`,"chart.heatmap.validation.valueRequired":`Value measure required`,"chart.option.stacking.label":`Stacking`,"chart.option.stacking.none":`None`,"chart.option.stacking.stacked":`Stacked`,"chart.option.stacking.percent":`Stacked 100%`,"chart.option.stacking.description":`How to stack multiple series`,"chart.option.target.label":`Target Values`,"chart.option.target.description":`Single value or comma-separated values to spread across X-axis`,"chart.option.connectNulls.label":`Connect Nulls`,"chart.option.connectNulls.description":`Draw continuous line through missing data points`,"chart.option.showAllXLabels.label":`Show All X Labels`,"chart.option.showAllXLabels.description":`Display every label on the X-axis instead of auto-hiding overlapping labels`,"chart.option.leftYAxisFormat.label":`Left Y-Axis Format`,"chart.option.leftYAxisFormat.description":`Number formatting for left Y-axis`,"chart.option.rightYAxisFormat.label":`Right Y-Axis Format`,"chart.option.rightYAxisFormat.description":`Number formatting for right Y-axis`,"chart.option.xAxisFormat.label":`X-Axis Format`,"chart.option.xAxisFormat.description":`Number formatting for X-axis`,"chart.option.yAxisFormat.label":`Y-Axis Format`,"chart.option.yAxisFormat.description":`Number formatting for Y-axis`,"chart.option.valueFormat.label":`Value Format`,"chart.option.valueFormat.description":`Number formatting for values`,"chart.option.innerRadius.label":`Inner Radius`,"chart.option.innerRadius.description":`Hollow centre size (0% = solid pie, higher = donut style)`,"chart.option.showLabels.label":`Show Cell Values`,"chart.option.showLabels.description":`Display values inside each cell`,"chart.option.cellShape.label":`Cell Shape`,"chart.option.cellShape.rectangle":`Rectangle`,"chart.option.cellShape.circle":`Circle`,"chart.option.funnelStyle.label":`Funnel Style`,"chart.option.funnelStyle.bars":`Bars`,"chart.option.funnelStyle.funnel":`Funnel`,"chart.option.funnelOrientation.label":`Orientation`,"chart.option.funnelOrientation.horizontal":`Horizontal`,"chart.option.funnelOrientation.vertical":`Vertical`,"chart.option.hideSummaryFooter.label":`Hide Summary Footer`,"chart.option.hideSummaryFooter.description":`Hide the summary footer showing steps count and overall conversion`,"chart.option.showConversion.label":`Show Conversion Rate`,"chart.option.showConversion.description":`Display step-to-step conversion percentage`,"chart.option.showAvgTime.label":`Show Avg Time`,"chart.option.showAvgTime.description":`Display average time to convert`,"chart.option.showMedianTime.label":`Show Median Time`,"chart.option.showMedianTime.description":`Display median time to convert`,"chart.option.showP90Time.label":`Show P90 Time`,"chart.option.showP90Time.description":`Display 90th percentile time to convert`,"chart.option.linkOpacity.label":`Link Opacity`,"chart.option.linkOpacity.light":`Light`,"chart.option.linkOpacity.medium":`Medium`,"chart.option.linkOpacity.dark":`Dark`,"chart.option.showNodeLabels.label":`Show Node Labels`,"chart.option.showNodeLabels.description":`Display labels on flow nodes`,"chart.option.prefix.label":`Prefix`,"chart.option.prefix.description":`Text to display before the number`,"chart.option.suffix.label":`Suffix`,"chart.option.suffix.description":`Text to display after the number`,"chart.option.decimals.label":`Decimal Places`,"chart.option.decimals.description":`Number of decimal places to display`,"chart.option.showHistogram.label":`Show Variance Histogram`,"chart.option.showHistogram.description":`Display historical variance chart below the delta`,"chart.option.useLastCompletePeriod.label":`Use Last Complete Period`,"chart.option.useLastCompletePeriod.description":`Exclude current incomplete period from calculation (e.g., partial week/month)`,"chart.option.skipLastPeriod.label":`Skip Last Period`,"chart.option.skipLastPeriod.description":`Always exclude the last period regardless of completeness`,"chart.option.retentionDisplayMode.label":`Display Mode`,"chart.option.retentionDisplayMode.lineChart":`Line Chart`,"chart.option.retentionDisplayMode.heatmapTable":`Heatmap Table`,"chart.option.retentionDisplayMode.combined":`Combined`,"chart.option.showLegend.label":`Show Legend`,"chart.option.showLegend.description":`Show the legend`,"chart.option.showGrid.label":`Show Grid`,"chart.option.showGrid.description":`Show grid lines on the chart`,"chart.option.showTooltip.label":`Show Tooltip`,"chart.option.showTooltip.description":`Show tooltip on hover with detailed stats`,"chart.option.priorPeriodStyle.label":`Prior Period Line Style`,"chart.option.priorPeriodStyle.dashed":`Dashed`,"chart.option.priorPeriodStyle.dotted":`Dotted`,"chart.option.priorPeriodStyle.solid":`Solid`,"chart.option.priorPeriodStyle.description":`Line style for prior period in comparison mode`,"chart.option.priorPeriodOpacity.label":`Prior Period Opacity`,"chart.option.priorPeriodOpacity.description":`Opacity for prior period lines (0.1 to 1)`,"chart.option.showTotal.label":`Show Total Bar`,"chart.option.showTotal.description":`Append a final bar showing the running total`,"chart.option.showConnectorLine.label":`Show Connector Line`,"chart.option.showConnectorLine.description":`Draw a dashed step-line connecting bar tops`,"chart.option.showDataLabels.label":`Show Data Labels`,"chart.option.showDataLabels.description":`Display the value at each data point`,"chart.option.showReferenceLineAtZero.label":`Show Zero Reference Line`,"chart.option.showReferenceLineAtZero.description":`Draw a dashed line at Y = 0`,"chart.option.lineType.label":`Line Interpolation`,"chart.option.lineType.smooth":`Smooth (monotone)`,"chart.option.lineType.linear":`Linear`,"chart.option.lineType.step":`Step`,"chart.option.lineType.description":`How data points are connected`,"chart.option.rangeMode.label":`Chart Mode`,"chart.option.rangeMode.ohlc":`OHLC (open, close, high, low)`,"chart.option.rangeMode.range":`Range (high, low / bid, ask)`,"chart.option.rangeMode.description":`OHLC: 4 measures. Range: 2 measures (high + low).`,"chart.option.bullColor.label":`Bullish Colour`,"chart.option.bullColor.description":`Candle colour when close ≥ open`,"chart.option.bearColor.label":`Bearish Colour`,"chart.option.bearColor.description":`Candle colour when close < open`,"chart.option.showWicks.label":`Show Wicks`,"chart.option.showWicks.description":`Draw high/low wicks above and below the body`,"chart.option.minValue.label":`Minimum Value`,"chart.option.minValue.description":`Lower bound of the gauge arc (default 0)`,"chart.option.maxValue.label":`Maximum Value (static)`,"chart.option.maxValue.description":`Upper bound of the gauge. Leave empty to use yAxis[1] or default 100`,"chart.option.showCentreLabel.label":`Show Centre Label`,"chart.option.showCentreLabel.description":`Display current value and field name in the centre of the gauge`,"chart.option.showPercentage.label":`Show as Percentage`,"chart.option.showPercentage.description":`Display value as % of max instead of raw number`,"chart.option.fitToWidth.label":`Fit to Width`,"chart.option.fitToWidth.description":`Automatically size blocks to fill portlet width and height while maintaining aspect ratio`,"chart.option.fontSize.label":`Font Size`,"chart.option.fontSize.small":`Small`,"chart.option.fontSize.medium":`Medium`,"chart.option.fontSize.large":`Large`,"chart.option.alignment.label":`Text Alignment`,"chart.option.alignment.left":`Left`,"chart.option.alignment.center":`Center`,"chart.option.alignment.right":`Right`,"chart.option.hideHeader.label":`Hide Header`,"chart.option.hideHeader.description":`Hide the portlet header bar (title and action buttons)`,"chart.option.transparentBackground.label":`Transparent Background`,"chart.option.transparentBackground.description":`Remove card background, border, and shadow for seamless integration as section headers`,"chart.option.autoHeight.label":`Auto Height`,"chart.option.autoHeight.description":`In row and mobile layouts, size to markdown content instead of fixed row height`,"chart.option.accentBorder.label":`Accent Border`,"chart.option.accentBorder.none":`None`,"chart.option.accentBorder.left":`Left`,"chart.option.accentBorder.top":`Top`,"chart.option.accentBorder.bottom":`Bottom`,"chart.option.accentBorder.description":`Add an accent-coloured border on one side of the content`,"chart.configText.20_percent":`20%`,"chart.configText.40_percent":`40%`,"chart.configText.60_percent":`60%`,"chart.configText.80_percent":`80%`,"chart.configText.accent_color":`Accent Color`,"chart.configText.activity_measure":`Activity Measure`,"chart.configText.add_2_or_more_measures_they_become_the_x_axis_categories_in_the_order_li":`Add 2 or more measures — they become the X-axis categories in the order listed`,"chart.configText.add_an_accent_colored_border_on_one_side_of_the_content":`Add an accent-colored border on one side of the content`,"chart.configText.all_fields_to_display_as_columns":`All fields to display as columns`,"chart.configText.array_of_value_0_1_fraction_color_bands_shown_as_outer_arc_markers":`Array of {value (0–1 fraction), color} bands shown as outer arc markers`,"chart.configText.axes_categories":`Axes (Categories)`,"chart.configText.bubble_colour":`Bubble Colour`,"chart.configText.bubble_labels":`Bubble Labels`,"chart.configText.bubble_radius":`Bubble Radius`,"chart.configText.categories":`Categories`,"chart.configText.choose_how_to_visualize_retention_data":`Choose how to visualize retention data`,"chart.configText.color_bubbles_by_this_field_optional":`Color bubbles by this field (optional)`,"chart.configText.color_for_negative_changes_decreases":`Color for negative changes (decreases)`,"chart.configText.color_for_positive_changes_increases":`Color for positive changes (increases)`,"chart.configText.color_from_the_dashboard_palette_for_headers_bullets_and_links":`Color from the dashboard palette for headers, bullets, and links`,"chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text":`Color from the dashboard palette for the KPI value text`,"chart.configText.color_groups":`Color Groups`,"chart.configText.columns":`Columns`,"chart.configText.columns_x_axis":`Columns (X-Axis)`,"chart.configText.count_at_each_step_auto_calculated":`Count at each step (auto-calculated)`,"chart.configText.count_of_entities_following_each_path":`Count of entities following each path`,"chart.configText.current_value_to_display_on_the_gauge_e_g_current_equity_margin_used":`Current value to display on the gauge (e.g. current equity, margin used)`,"chart.configText.dimension_for_column_categories":`Dimension for column categories`,"chart.configText.dimension_for_ordering_data_typically_time":`Dimension for ordering data (typically time)`,"chart.configText.dimension_for_pie_slices":`Dimension for pie slices`,"chart.configText.dimension_for_row_categories":`Dimension for row categories`,"chart.configText.dimension_labels_for_each_bar_segment_e_g_symbol_transaction_type":`Dimension labels for each bar segment (e.g. symbol, transaction type)`,"chart.configText.dimension_optional":`Dimension (optional)`,"chart.configText.dimension_to_color_points_by_category":`Dimension to color points by category`,"chart.configText.dimension_to_color_rectangles_by_category":`Dimension to color rectangles by category`,"chart.configText.dimension_to_group_boxes_by_e_g_symbol_platform":`Dimension to group boxes by (e.g. symbol, platform)`,"chart.configText.dimension_to_split_data_into_separate_profile_lines_e_g_symbol_platform":`Dimension to split data into separate profile lines (e.g. symbol, platform)`,"chart.configText.dimensions_for_radar_axes":`Dimensions for radar axes`,"chart.configText.dimensions_for_radial_segments":`Dimensions for radial segments`,"chart.configText.dimensions_for_treemap_rectangles":`Dimensions for treemap rectangles`,"chart.configText.dimensions_to_create_multiple_radar_shapes":`Dimensions to create multiple radar shapes`,"chart.configText.dimensions_to_create_separate_lines":`Dimensions to create separate lines`,"chart.configText.dimensions_to_create_stacked_areas":`Dimensions to create stacked areas`,"chart.configText.display_the_value_above_each_bar_segment":`Display the value above each bar segment`,"chart.configText.display_value_at_each_data_point":`Display value at each data point`,"chart.configText.drop_1_measure_for_auto_mode_3_for_avg_stddev_median_mode_or_5_for_min_q":`Drop 1 measure for auto mode, 3 for avg/stddev/median mode, or 5 for min/q1/median/q3/max mode`,"chart.configText.drop_2_4_measures_in_order_open_close_high_low_ohlc_mode_for_range_mode_":`Drop 2–4 measures in order: open, close, high, low (OHLC mode). For range mode drop 2: high, low.`,"chart.configText.enter_markdown_text_supports_headers_bold_text_italic_text_links_text_ur":`Enter markdown text. Supports headers (#), bold (**text**), italic (*text*), links ([text](url)), lists (- item), and horizontal rules (---).`,"chart.configText.event_dimension_that_categorizes_flow_nodes":`Event dimension that categorizes flow nodes`,"chart.configText.event_type":`Event Type`,"chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont":`Exclude current incomplete period from aggregation (e.g., partial week/month)`,"chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee":`Exclude current incomplete period from delta calculation (e.g., partial week/month)`,"chart.configText.field_to_use_for_bubble_labels_and_identification":`Field to use for bubble labels and identification`,"chart.configText.flow_count":`Flow Count`,"chart.configText.hide_the_statistics_footer_below_the_chart":`Hide the statistics footer below the chart`,"chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style":`Hollow center size (0% = solid pie, higher = donut style)`,"chart.configText.horizontal_alignment_of_the_markdown_content":`Horizontal alignment of the markdown content`,"chart.configText.horizontal_axis_position":`Horizontal axis position`,"chart.configText.how_to_stack_multiple_area_series":`How to stack multiple area series`,"chart.configText.how_to_stack_multiple_bar_series":`How to stack multiple bar series`,"chart.configText.markdown_content":`Markdown Content`,"chart.configText.measure_for_rectangle_sizes":`Measure for rectangle sizes`,"chart.configText.measure_for_slice_sizes":`Measure for slice sizes`,"chart.configText.measure_for_y_position":`Measure for Y position`,"chart.configText.measure_or_dimension_for_x_position":`Measure or dimension for X position`,"chart.configText.measure_that_determines_cell_color":`Measure that determines cell color`,"chart.configText.measure_to_display_as_kpi_number":`Measure to display as KPI number`,"chart.configText.measure_to_display_in_the_kpi_text_template":`Measure to display in the KPI text template`,"chart.configText.measure_to_track_changes_for":`Measure to track changes for`,"chart.configText.measure_used_for_activity_intensity_color_coding":`Measure used for activity intensity (color coding)`,"chart.configText.measures_for_area_values":`Measures for area values`,"chart.configText.measures_for_bar_heights":`Measures for bar heights`,"chart.configText.measures_for_line_values":`Measures for line values`,"chart.configText.measures_for_radar_values":`Measures for radar values`,"chart.configText.measures_for_radial_bar_lengths":`Measures for radial bar lengths`,"chart.configText.measures_x_axis_order":`Measures (X-Axis Order)`,"chart.configText.negative_change_color":`Negative Change Color`,"chart.configText.none_pie":`None (Pie)`,"chart.configText.number_formatting_for_cell_values_and_legend":`Number formatting for cell values and legend`,"chart.configText.number_formatting_for_numeric_values":`Number formatting for numeric values`,"chart.configText.number_formatting_for_size_values":`Number formatting for size values`,"chart.configText.number_formatting_for_the_displayed_value_and_axis_labels":`Number formatting for the displayed value and axis labels`,"chart.configText.number_formatting_for_the_price_axis":`Number formatting for the price axis`,"chart.configText.number_formatting_for_the_value_axis":`Number formatting for the value axis`,"chart.configText.number_formatting_for_the_y_axis":`Number formatting for the Y-axis`,"chart.configText.number_formatting_for_x_axis_labels":`Number formatting for X-axis labels`,"chart.configText.number_formatting_for_y_axis_and_values":`Number formatting for Y-axis and values`,"chart.configText.number_formatting_for_y_axis_labels":`Number formatting for Y-axis labels`,"chart.configText.number_of_decimal_places_to_display_for_numeric_values":`Number of decimal places to display for numeric values`,"chart.configText.ohlc_measures_open_close_high_low":`OHLC Measures (open, close, high, low)`,"chart.configText.opacity_of_flow_links":`Opacity of flow links`,"chart.configText.overall_text_size_for_the_markdown_content":`Overall text size for the markdown content`,"chart.configText.positive_change_color":`Positive Change Color`,"chart.configText.rows_y_axis":`Rows (Y-Axis)`,"chart.configText.series_color_groups":`Series (Color Groups)`,"chart.configText.series_multiple_lines":`Series (Multiple Lines)`,"chart.configText.series_multiple_shapes":`Series (Multiple Shapes)`,"chart.configText.series_split_into_multiple_lines":`Series (Split into Multiple Lines)`,"chart.configText.series_stack_areas":`Series (Stack Areas)`,"chart.configText.show_series_legend_only_visible_with_a_series_dimension":`Show series legend (only visible with a Series dimension)`,"chart.configText.show_the_color_intensity_legend":`Show the color intensity legend`,"chart.configText.show_the_legend_for_breakdown_segments":`Show the legend for breakdown segments`,"chart.configText.single_measure_whose_values_are_summed_cumulatively":`Single measure whose values are summed cumulatively`,"chart.configText.size":`Size`,"chart.configText.size_of_bubbles_based_on_this_measure":`Size of bubbles based on this measure`,"chart.configText.size_of_the_center_hole_0_for_full_circle":`Size of the center hole (0 for full circle)`,"chart.configText.step_count":`Step Count`,"chart.configText.step_name":`Step Name`,"chart.configText.step_names_auto_populated_from_funnel_steps":`Step names (auto-populated from funnel steps)`,"chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided":`Target value to compare against (first value used if multiple provided)`,"chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value":"Template for displaying the text. Use ${value} to insert the measure value.","chart.configText.text_template":`Text Template`,"chart.configText.threshold_bands":`Threshold Bands`,"chart.configText.time_dimension":`Time Dimension`,"chart.configText.time_dimension_or_category_for_each_candle_e_g_date_symbol":`Time dimension or category for each candle (e.g. date, symbol)`,"chart.configText.time_dimensions_or_dimensions_for_x_axis":`Time dimensions or dimensions for X-axis`,"chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout":`Time field that determines grid structure (granularity affects layout)`,"chart.configText.value":`Value`,"chart.configText.value_color":`Value Color`,"chart.configText.value_color_intensity":`Value (Color Intensity)`,"chart.configText.value_measure":`Value Measure`,"chart.configText.values":`Values`,"chart.configText.vertical_axis_position":`Vertical axis position`,"chart.configText.visualization_style":`Visualization style`,"chart.configText.x_axis_groups":`X-Axis (Groups)`,"chart.configText.x_axis_time_categories":`X-Axis (Time/Categories)`,"chart.configText.x_axis_time_category":`X-Axis (Time / Category)`,"chart.configText.y_axis":`Y-Axis`,"chart.configText.y_axis_measures":`Y-Axis (Measures)`,"chart.configText.y_axis_value":`Y-Axis (Value)`,"display.loading":`Loading display options...`,"display.noOptions":`No display options available for this chart type.`,"display.heading":`Display Options`,"results.loading.title":`Executing Query...`,"results.loading.subtitle":`Running your query against the cube API`,"results.error.title":`Query Execution Failed`,"results.error.subtitle":`There was an error executing your query. Please check the query and try again.`,"results.waiting.title":`Preparing Query...`,"results.waiting.subtitle":`Your query will execute shortly`,"results.needsRefresh.title":`Ready to Execute`,"results.needsRefresh.subtitle":`Click refresh to run your query`,"results.needsRefresh.runButton":`Run Query`,"results.empty.query":`Add metrics or breakdowns from the panel on the right to see results`,"results.empty.retention":`Select a cube and configure retention settings to see results`,"results.empty.funnel":`Add funnel steps to see conversion analysis`,"results.empty.flow":`Configure flow analysis to see user journey paths`,"results.empty.title":`No Results Yet`,"results.ai.button":`Analyse with AI`,"results.noData.title":`Query Successful`,"results.noData.subtitle":`No data returned from the query`,"results.chart.noData":`No data to display`,"results.chart.noDataHint":`Run a query to see chart visualisation`,"results.chart.unsupported":`Unsupported chart type`,"results.refreshing":`Refreshing results...`,"results.header.rows":`rows`,"results.header.row":`row`,"results.header.stale":`Results may be outdated`,"results.header.failed":`Query failed`,"results.header.executing":`Executing...`,"results.header.noResults":`No results`,"results.view.chart":`Chart`,"results.view.merged":`Merged`,"results.warning.largeDataset":`Large dataset:`,"results.warning.configChanged":`Query configuration changed. Results may be outdated.`,"results.warning.refreshNow":`Refresh Now`,"results.share.copied":`Copied!`,"results.share.noChart":`(no chart)`,"server.errors.dbNotConfigured":`Database executor not configured`,"server.errors.cubeNotFound":`Cube '{cubeName}' not found`,"server.errors.noCubesInQuery":`No cubes found in query`,"server.errors.dbAdapterRequired":`DatabaseExecutor must have a databaseAdapter property`,"server.errors.rlsRequiresTransactions":`rlsSetup requires a database driver that supports transactions (db.transaction)`,"server.errors.queryExecutionFailed":`Query execution failed: {message}`,"server.errors.queryExecutionUnknown":`Query execution failed: Unknown error`,"server.errors.noCompareDateRange":`No compareDateRange found in query`,"server.errors.compareDateRangeInvalid":`compareDateRange requires at least 2 periods`,"server.errors.funnelValidationFailed":`Funnel validation failed: {errors}`,"server.errors.flowValidationFailed":`Flow validation failed: {errors}`,"server.errors.retentionValidationFailed":`Retention validation failed: {errors}`,"server.errors.cubeRefUnresolved":`{cubeName}.joins.{joinName}: target cube '{targetCube}' is not registered`,"server.errors.unresolvedCubeRefs":`Unresolved cube references:
|
|
63
63
|
{details}`,"server.errors.calculatedMeasureValidation":`Calculated measure validation failed for cube '{cubeName}':
|
|
64
64
|
{details}`,"server.errors.queryValidationFailed":`Query validation failed: {errors}`,"server.errors.queryContainsMultipleModes":`Query contains multiple query modes: {modes}`,"server.errors.primaryCubeNotFound":`Primary cube '{cubeName}' not found`,"server.errors.noJoinPath":`No join path found from '{fromCube}' to '{toCube}'`,"server.errors.cubeNotFoundForMeasure":`Cube '{cubeName}' not found for measure '{measure}'`,"server.errors.cubeNotFoundForDimension":`Cube '{cubeName}' not found for dimension '{dimension}'`,"server.errors.cubeNotFoundForTimeDimension":`Cube '{cubeName}' not found for time dimension '{timeDimension}'`,"server.errors.invalidFunnelConfig":`Query does not contain a valid funnel configuration`,"server.errors.invalidFlowConfig":`Query does not contain a valid flow configuration`,"server.errors.invalidRetentionConfig":`Query does not contain a valid retention configuration`,"server.errors.llmInitFailed":`Failed to initialize LLM provider`,"server.validation.ai.bindingKeyRequired.flow":`flow.bindingKey is required`,"server.validation.ai.bindingKeyRequired.funnel":`funnel.bindingKey is required`,"server.validation.ai.bindingKeyRequired.retention":`retention.bindingKey is required`,"server.validation.ai.cubeNotFoundInFilter":`Cube '{cubeName}' not found in filter`,"server.validation.ai.cubeNotFoundWithAvailable":`Cube '{cubeName}' not found`,"server.validation.ai.cubeNotFoundWithSuggestion":`Cube '{cubeName}' not found`,"server.validation.ai.dimensionNotFoundWithAvailable":`Dimension '{dimensionName}' not found on cube '{cubeName}'`,"server.validation.ai.dimensionNotFoundWithSuggestion":`Dimension '{dimensionName}' not found on cube '{cubeName}'`,"server.validation.ai.dimensionNotTimeType":`Dimension '{dimension}' is not a time type (it's '{type}')`,"server.validation.ai.emptyQuery":`Query must have at least one measure or dimension`,"server.validation.ai.eventDimensionRequired":`flow.eventDimension is required`,"server.validation.ai.filterFieldNotFound":`Filter field '{fieldName}' not found on cube '{cubeName}'`,"server.validation.ai.filterFieldNotFoundWithSuggestion":`Filter field '{fieldName}' not found on cube '{cubeName}'`,"server.validation.ai.funnelRequiresSteps":`funnel requires at least 2 steps`,"server.validation.ai.funnelStepsRequired":`funnel.steps array is required`,"server.validation.ai.granularityNotSpecified":`retention.granularity not specified`,"server.validation.ai.invalidDimensionFormat":`Invalid dimension format: '{dimension}'. Expected 'CubeName.dimensionName'`,"server.validation.ai.invalidFilterMemberFormat":`Invalid filter member format: '{member}'`,"server.validation.ai.invalidMeasureFormat":`Invalid measure format: '{measure}'. Expected 'CubeName.measureName'`,"server.validation.ai.measureNotFoundWithAvailable":`Measure '{measureName}' not found on cube '{cubeName}'`,"server.validation.ai.measureNotFoundWithSuggestion":`Measure '{measureName}' not found on cube '{cubeName}'`,"server.validation.ai.performanceManyDimensions":`Query has {count} dimensions, which may produce many rows`,"server.validation.ai.performanceManyMeasures":`Query has {count} measures, which may impact performance`,"server.validation.ai.periodsNotSpecified":`retention.periods not specified`,"server.validation.ai.retentionTimeDimensionRequired":`retention.timeDimension is required`,"server.validation.ai.stepMissingName":`Step {step} is missing a name`,"server.validation.ai.stepsBothMissing":`Neither stepsBefore nor stepsAfter specified`,"server.validation.ai.suggestAddDimensionFilters":`Consider adding filters or reducing dimensions`,"server.validation.ai.suggestAddStepNames":`Add descriptive names to funnel steps`,"server.validation.ai.suggestSetSteps":`Set stepsBefore and/or stepsAfter to see event sequences`,"server.validation.ai.suggestSpecifyGranularity":`Specify granularity: "day", "week", or "month"`,"server.validation.ai.suggestSpecifyPeriods":`Specify number of periods to analyze`,"server.validation.ai.suggestSplitQueries":`Consider splitting into multiple queries`,"server.validation.ai.suggestUseTimeDimension":`Use a dimension with type "time" for timeDimensions`,"server.validation.ai.timeDimensionRequired.flow":`flow.timeDimension is required`,"server.validation.ai.timeDimensionRequired.funnel":`funnel.timeDimension is required`,"server.validation.chart.barNeedsDimension":`Bar charts need an xAxis dimension for category labels. Add a dimension to the query or use "table" chart type instead.`,"server.validation.chart.barXAxisRequired":`chartConfig.xAxis is required for bar charts. Put a dimension in xAxis so bars have category labels.`,"server.validation.chart.dropZoneRequired":`chartConfig.{key} is required for {chartType} chart ({label}). Accepts: {acceptDesc}.`,"server.validation.chart.seriesDuplicatesXAxis":`chartConfig.series must not contain the same field as xAxis (found: {duplicates}). The series field is only for splitting into grouped/stacked sub-series by a DIFFERENT dimension. Remove the duplicate from series.`,"server.validation.flow.bindingKeyCubeNotFound":`Binding key cube not found: {cubeName}`,"server.validation.flow.bindingKeyDimNotFound":`Binding key dimension not found: {dimName} in cube {cubeName}`,"server.validation.flow.bindingKeyMappingCubeNotFound":`Binding key mapping cube not found: {cubeName}`,"server.validation.flow.eventDimCubeNotFound":`Event dimension cube not found: {cubeName}`,"server.validation.flow.eventDimNotFound":`Event dimension not found: {dimName} in cube {cubeName}`,"server.validation.flow.eventDimRequired":`Event dimension is required for flow analysis`,"server.validation.flow.highStepDepthWarning":`High step depth (4-5) may impact query performance on large datasets`,"server.validation.flow.invalidBindingKeyFormat":`Invalid binding key format: {bindingKey}. Expected 'CubeName.dimensionName'`,"server.validation.flow.invalidEventDimFormat":`Invalid event dimension format: {eventDimension}. Expected 'CubeName.dimensionName'`,"server.validation.flow.invalidJoinStrategy":`Invalid joinStrategy: {joinStrategy}`,"server.validation.flow.invalidTimeDimFormat":`Invalid time dimension format: {timeDimension}. Expected 'CubeName.dimensionName'`,"server.validation.flow.lateralNotSupported":`Lateral joins are not supported on this database`,"server.validation.flow.lateralNotSupportedExec":`Lateral joins with CTE references are not supported on this database`,"server.validation.flow.sqliteNotSupported":`Flow queries are not supported on SQLite. Use PostgreSQL or MySQL for flow analysis.`,"server.validation.flow.startingStepFilterRequired":`Starting step must have at least one filter`,"server.validation.flow.startingStepNameMissing":`Starting step has no name - using default`,"server.validation.flow.startingStepRequired":`Starting step is required for flow analysis`,"server.validation.flow.stepsBeforeRange":`stepsBefore must be between 0 and 5, got: {value}`,"server.validation.flow.stepsAfterRange":`stepsAfter must be between 0 and 5, got: {value}`,"server.validation.flow.timeDimCubeNotFound":`Time dimension cube not found: {cubeName}`,"server.validation.flow.timeDimNotFound":`Time dimension not found: {dimName} in cube {cubeName}`,"server.validation.funnel.bindingKeyCubeNotFound":`Binding key cube not found: {cubeName}`,"server.validation.funnel.bindingKeyDimNotFound":`Binding key dimension not found: {dimName} in cube {cubeName}`,"server.validation.funnel.bindingKeyMappingCubeNotFound":`Binding key mapping cube not found: {cubeName}`,"server.validation.funnel.invalidBindingKeyFormat":`Invalid binding key format: {bindingKey}. Expected 'CubeName.dimensionName'`,"server.validation.funnel.invalidTimeDimFormat":`Invalid time dimension format: {timeDimension}. Expected 'CubeName.dimensionName'`,"server.validation.funnel.minSteps":`Funnel must have at least 2 steps`,"server.validation.funnel.stepCubeNotFound":`Step {step} cube not found: {cube}`,"server.validation.funnel.stepFilterCubeNotFound":`Step {step} filter cube not found: {cubeName}`,"server.validation.funnel.stepFilterIsMeasure":`Step {step} filter '{member}' is a measure. Funnel step filters only support dimensions, not measures.`,"server.validation.funnel.stepFilterMemberNotFound":`Step {step} filter member not found: {field} in cube {cubeName}`,"server.validation.funnel.stepFilterNoJoinPath":`Step {step} filter '{member}' requires a join from '{stepCube}' but no join path was found. Define a join relationship between these cubes.`,"server.validation.funnel.stepMustHaveName":`Step {step} must have a name`,"server.validation.funnel.stepTimeToConvertFormat":`Step {step} timeToConvert must be ISO 8601 duration format: {value}`,"server.validation.funnel.timeDimCubeNotFound":`Time dimension cube not found: {cubeName}`,"server.validation.funnel.timeDimNotFound":`Time dimension not found: {dimName} in cube {cubeName}`,"server.validation.retention.bindingKeyCubeNotFound":`Binding key cube not found: {cubeName}`,"server.validation.retention.bindingKeyDimNotFound":`Binding key dimension not found: {dimName} in cube {cubeName}`,"server.validation.retention.bindingKeyMappingCubeNotFound":`Binding key mapping cube not found: {cubeName}`,"server.validation.retention.breakdownDimCubeNotFound":`Breakdown dimension cube not found: {cubeName}`,"server.validation.retention.breakdownDimNotFound":`Breakdown dimension not found: {dimName} in cube {cubeName}`,"server.validation.retention.cubeNotFound":`Cube not found: {cubeName}`,"server.validation.retention.dateRangeEndRequired":`Date range end is required`,"server.validation.retention.dateRangeInvalidEnd":`Invalid date range end format`,"server.validation.retention.dateRangeInvalidStart":`Invalid date range start format`,"server.validation.retention.dateRangeRequired":`Date range is required`,"server.validation.retention.dateRangeStartBeforeEnd":`Date range start must be before or equal to end`,"server.validation.retention.dateRangeStartRequired":`Date range start is required`,"server.validation.retention.invalidBindingKeyFormat":`Invalid binding key format: {bindingKey}. Expected 'CubeName.dimensionName'`,"server.validation.retention.invalidBreakdownDimFormat":`Invalid breakdown dimension format: {dimension}. Expected 'CubeName.dimensionName'`,"server.validation.retention.invalidGranularity":`Invalid granularity: {granularity}`,"server.validation.retention.invalidRetentionType":`Invalid retention type: {retentionType}`,"server.validation.retention.invalidTimeDimFormat":`Invalid time dimension format: {timeDimension}`,"server.validation.retention.noBindingKeyMapping":`No binding key mapping found for cube: {cubeName}`,"server.validation.retention.periodsMax":`Periods cannot exceed 52 (performance limit)`,"server.validation.retention.periodsMin":`Periods must be at least 1`,"server.validation.retention.timeDimNotFound":`Time dimension not found: {dimName}`,"server.validation.calculatedMeasure.mustHaveCalculatedSql":`Calculated measure '{cubeName}.{fieldName}' must have calculatedSql property`,"server.validation.calculatedMeasure.invalidSyntax":`Invalid calculatedSql syntax in '{cubeName}.{fieldName}': {errors}`,"server.validation.calculatedMeasure.circularDependency":`Circular dependency detected in calculated measures: {cycle}`,"server.validation.query.multipleQueryModes":`Query contains multiple query modes: {modes}`,"server.validation.query.funnelBindingKeyCubeNotFound":`Funnel binding key cube not found: {cubeName}`,"server.validation.query.flowBindingKeyCubeNotFound":`Flow binding key cube not found: {cubeName}`,"server.validation.query.retentionCubeNotFound":`Retention cube not found: {cubeName}`,"server.validation.query.retentionBindingKeyCubeNotFound":`Retention binding key cube not found: {cubeName}`,"server.validation.query.retentionBreakdownCubeNotFound":`Retention breakdown cube not found: {cubeName}`,"server.validation.query.invalidMeasureFormat":`Invalid measure format: {measure}. Expected format: 'CubeName.fieldName'`,"server.validation.query.cubeNotFoundForMeasure":`Cube '{cubeName}' not found (referenced in measure '{measure}')`,"server.validation.query.measureNotFound":`Measure '{fieldName}' not found on cube '{cubeName}'{hint}`,"server.validation.query.invalidDimensionFormat":`Invalid dimension format: {dimension}. Expected format: 'CubeName.fieldName'`,"server.validation.query.cubeNotFoundForDimension":`Cube '{cubeName}' not found (referenced in dimension '{dimension}')`,"server.validation.query.dimensionNotFound":`Dimension '{fieldName}' not found on cube '{cubeName}'{hint}`,"server.validation.query.invalidTimeDimensionFormat":`Invalid timeDimension format: {dimension}. Expected format: 'CubeName.fieldName'`,"server.validation.query.cubeNotFoundForTimeDimension":`Cube '{cubeName}' not found (referenced in timeDimension '{dimension}')`,"server.validation.query.timeDimensionNotFound":`TimeDimension '{fieldName}' not found on cube '{cubeName}' (must be a dimension with time type)`,"server.validation.query.mustReferenceAtLeastOneCube":`Query must reference at least one cube through measures, dimensions, or filters`,"server.validation.query.ungroupedRequiresDimension":`Ungrouped queries require at least one dimension or time dimension`,"server.validation.query.ungroupedIncompatibleFunnel":`Ungrouped queries are incompatible with funnel analysis`,"server.validation.query.ungroupedIncompatibleFlow":`Ungrouped queries are incompatible with flow analysis`,"server.validation.query.ungroupedIncompatibleRetention":`Ungrouped queries are incompatible with retention analysis`,"server.validation.query.ungroupedIncompatibleCompareDateRange":`Ungrouped queries are incompatible with compareDateRange`,"server.validation.query.ungroupedIncompatibleFillMissingDates":`Ungrouped queries are incompatible with fillMissingDates`,"server.validation.query.filterMustHaveMember":`Filter must have a member field`,"server.validation.query.invalidFilterMemberFormat":`Invalid filter member format: {member}. Expected format: 'CubeName.fieldName'`,"server.validation.query.cubeNotFoundForFilter":`Cube '{cubeName}' not found (referenced in filter '{member}')`,"server.validation.query.filterFieldNotFound":`Filter field '{fieldName}' not found on cube '{cubeName}' (must be a dimension or measure){hint}`,"server.errors.funnel.cubeNotFoundForStep":`Cube not found for step: {cube}`,"server.errors.funnel.cubeNotFoundForBindingKey":`Cube not found for binding key: {bindingKey}`,"server.errors.funnel.cannotResolveCubeForStep":`Cannot resolve cube for step - multi-cube funnel requires cube specification in each step`,"server.errors.funnel.bindingKeyDimNotFound":`Binding key dimension not found: {bindingKey}`,"server.errors.funnel.noBindingKeyMapping":`No binding key mapping found for cube: {cubeName}`,"server.errors.funnel.bindingKeyMappingDimNotFound":`Binding key dimension not found: {dimension}`,"server.errors.funnel.timeDimNotFound":`Time dimension not found: {timeDimension}`,"server.errors.funnel.noTimeDimMapping":`No time dimension mapping found for cube: {cubeName}`,"server.errors.funnel.timeDimMappingNotFound":`Time dimension not found: {dimension}`,"server.errors.flow.cannotResolveCube":`Cannot resolve cube for flow query`,"server.errors.flow.cubeNotFound":`Cube not found: {cubeName}`,"server.errors.flow.bindingKeyDimNotFound":`Binding key dimension not found: {bindingKey}`,"server.errors.flow.noBindingKeyMapping":`No binding key mapping found for cube: {cubeName}`,"server.errors.flow.bindingKeyMappingDimNotFound":`Binding key dimension not found: {dimension}`,"server.errors.flow.timeDimNotFound":`Time dimension not found: {timeDimension}`,"server.errors.flow.noTimeDimMapping":`No time dimension mapping found for cube: {cubeName}`,"server.errors.flow.timeDimMappingNotFound":`Time dimension not found: {dimension}`,"server.errors.flow.eventDimNotFound":`Event dimension not found: {eventDimension}`,"server.validation.template.emptyReference":`Empty member reference {} found in template`,"server.validation.template.invalidMemberReference":`Invalid member reference {ref}: must start with letter or underscore, and contain only letters, numbers, underscores, and dots`,"server.validation.template.multipleDots":`Invalid member reference {ref}: only one dot allowed (Cube.measure format)`,"server.validation.template.nestedBraces":`Nested braces are not allowed in member references`,"server.validation.template.substituteTargetCubeNotFound":`Cannot substitute {ref}: cube '{cubeName}' not found`,"server.validation.template.substituteMeasureNotResolved":`Cannot substitute {ref}: measure '{measureName}' not resolved yet. Ensure measures are resolved in dependency order.`,"server.validation.template.unmatchedClosingBrace":`Unmatched closing brace at position {position}`,"server.validation.template.unmatchedOpeningBrace":`Unmatched opening brace in template`,"notebook.aiAssistant":`AI Assistant`,"notebook.saveAsDashboard":`Save as Dashboard`,"notebook.saveAsDashboardTitle":`Save notebook as a dashboard`,"notebook.clearTitle":`Clear notebook and chat`,"notebook.feedbackThanks":`Thanks for your feedback!`,"notebook.feedbackQuestion":`Was this helpful?`,"notebook.feedbackYes":`Yes`,"notebook.feedbackNo":`No`,"notebook.thinking":`Thinking...`,"notebook.emptyState.title":`Data Analysis Assistant`,"notebook.emptyState.description":`Ask me about your data and I'll create visualizations and insights.`,"notebook.emptyState.example1":`"Show me employee productivity trends"`,"notebook.emptyState.example2":`"What are the top departments by headcount?"`,"notebook.emptyState.example3":`"Compare revenue across product categories"`,"notebook.saveAsDashboardPrompt":`Save the current notebook as a dashboard with a professional layout, section headers, and appropriate filters.`,"notebook.chatInput.placeholder":`Ask about your data...`,"notebook.chatInput.stop":`Stop`,"notebook.chatInput.continue":`Continue`,"notebook.chatInput.send":`Send`,"notebook.canvas.emptyTitle":`Your notebook is empty`,"notebook.canvas.emptyDescription":`Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data.`,"notebook.canvas.editVisualization":`Edit Visualization`,"notebook.canvas.update":`Update`,"notebook.collapsed.noBlocks":`No blocks`,"notebook.collapsed.expandNotebook":`Expand notebook`,"notebook.collapsed.expandChat":`Expand AI chat`,"notebook.collapsed.aiChat":`AI Chat`,"notebook.collapsed.markdown":`Markdown`,"schema.loading":`Loading cube schema...`,"schema.error":`Failed to load cube schema`,"schema.noCubes":`No cubes found`,"schema.noCubesHint":`Register some cubes to see the relationship diagram`,"schema.computingLayout":`Computing layout...`,"schema.searchPlaceholder":`Search cubes and fields...`,"schema.autoLayout":`Auto Layout`,"schema.missingDeps.title":`Schema Visualization requires additional packages`,"schema.missingDeps.description":`Install the required dependencies to enable the interactive schema diagram:`,"schema.loadingVisualization":`Loading schema visualization...`,"schema.measures":`Measures ({count})`,"schema.timeDimensions":`Time Dimensions ({count})`,"schema.dimensions":`Dimensions ({count})`,"schema.cubeInfo":`Cube info`,"dataBrowser.selectCube":`Select a cube`,"dataBrowser.selectCubeHint":`Choose a cube from the sidebar to browse its data`,"dataBrowser.loadingData":`Loading data...`,"dataBrowser.noData":`No data`,"dataBrowser.noRows":`No rows returned for this query`,"dataBrowser.toolbar.filters":`Filters`,"dataBrowser.toolbar.columns":`Columns`,"dataBrowser.toolbar.rows":`{count} rows`,"dataBrowser.sidebar.cubes":`Cubes`,"dataBrowser.sidebar.searchPlaceholder":`Search...`,"dataBrowser.sidebar.noCubes":`No cubes found`,"queryAnalysis.summary":`Query Summary`,"queryAnalysis.summary.type":`Type`,"queryAnalysis.summary.cubes":`Cubes`,"queryAnalysis.summary.joins":`Joins`,"queryAnalysis.summary.ctes":`CTEs`,"queryAnalysis.summary.strategy":`Strategy`,"queryAnalysis.primaryCube":`Primary Cube (FROM table)`,"queryAnalysis.primaryCube.showCandidates":`Show candidates ({count})`,"queryAnalysis.primaryCube.reachable":`reachable`,"queryAnalysis.primaryCube.cannotReachAll":`cannot reach all`,"queryAnalysis.joinPaths":`Join Paths`,"queryAnalysis.joinPaths.steps":`{count} step`,"queryAnalysis.joinPaths.stepsPlural":`{count} steps`,"queryAnalysis.joinPaths.noPath":`No path`,"queryAnalysis.joinPaths.selection":`Selection:`,"queryAnalysis.joinPaths.pathCandidates":`Path scoring candidates ({count})`,"queryAnalysis.joinPaths.visitedCubes":`Cubes visited during search ({count})`,"queryAnalysis.preAggregations":`Pre-Aggregation CTEs`,"queryAnalysis.preAggregations.measures":`Measures:`,"queryAnalysis.preAggregations.joinKeys":`Join keys:`,"queryAnalysis.warnings":`Warnings`,"queryAnalysis.cubesInvolved":`Cubes involved:`,"common.actions.copied":`Copied`,"common.actions.copyToClipboard":`Copy to clipboard`,"chart.availability.requiresMeasure":`Requires at least 1 measure`,"chart.availability.requiresTwoMeasures":`Requires at least 2 measures`,"chart.availability.requiresDimension":`Requires at least 1 dimension`,"chart.availability.requiresTwoDimensions":`Requires at least 2 dimensions`,"chart.availability.requiresTimeDimension":`Requires a time dimension`,"chart.availability.scatter":`Requires 2 measures, or 1 measure plus 1 dimension`,"chart.availability.bubble":`Requires at least 2 measures and 1 dimension`,"chart.runtime.noData":`No data available`,"chart.runtime.noDataHint.bar":`No data points to display in bar chart`,"chart.runtime.noDataHint.line":`No data points to display in line chart`,"chart.runtime.noDataHint.area":`No data points to display in area chart`,"chart.runtime.noDataHint.pie":`No data points to display in pie chart`,"chart.runtime.noDataHint.scatter":`No data points to display in scatter chart`,"chart.runtime.noDataHint.radar":`No data points to display in radar chart`,"chart.runtime.noDataHint.radialBar":`No data points to display in radial bar chart`,"chart.runtime.noDataHint.treemap":`No data points to display in treemap chart`,"chart.runtime.noDataHint.bubble":`No data points to display in bubble chart`,"chart.runtime.noDataHint.boxPlot":`No data points to display in box plot chart`,"chart.runtime.noDataHint.waterfall":`No data points to display in waterfall chart`,"chart.runtime.noDataHint.candlestick":`No data points to display in candlestick chart`,"chart.runtime.noDataHint.gauge":`No data points to display in gauge chart`,"chart.runtime.noDataHint.measureProfile":`No data points to display in measure profile chart`,"chart.runtime.noDataHint.activityGrid":`No data points to display in activity grid`,"chart.runtime.noDataHint.heatmap":`Run a query to see heatmap visualization`,"chart.runtime.noDataHint.table":`No data to display in table`,"chart.runtime.noDataHint.kpi":`No data points to display`,"chart.runtime.noDataHint.funnel":`Configure a funnel with at least 2 steps and a binding key`,"chart.runtime.noDataHint.flow":`Configure a flow analysis with a starting step and event dimension`,"chart.runtime.noDataHint.retention":`Configure retention analysis to see results`,"chart.runtime.noValidData":`No valid data`,"chart.runtime.noValidDataHint.bar":`No valid data points for bar chart after transformation`,"chart.runtime.noValidDataHint.line":`No valid data points for line chart after transformation`,"chart.runtime.noValidDataHint.area":`No valid data points for area chart after transformation`,"chart.runtime.noValidDataHint.scatter":`No valid data points for scatter chart after transformation`,"chart.runtime.noValidDataHint.radar":`No valid data points for radar chart after transformation`,"chart.runtime.noValidDataHint.radialBar":`No valid data points for radial bar chart after transformation`,"chart.runtime.noValidDataHint.treemap":`No valid data points for treemap chart after transformation`,"chart.runtime.noValidDataHint.pie":`No data points to display in pie chart`,"chart.runtime.noValidDataHint.pieFiltered":`Filtered out {count} data points (zero or invalid values)`,"chart.runtime.noValidDataHint.boxPlot":`Could not compute box plot statistics from the provided data`,"chart.runtime.noValidDataHint.gauge":`Gauge value is not a valid number`,"chart.runtime.noValidDataHint.kpiText":`All values are null or invalid`,"chart.runtime.configError":`Configuration Error`,"chart.runtime.configErrorHint.axisInvalid":`Invalid or missing chart axis configuration`,"chart.runtime.configErrorHint.axisFields":`Missing required X-axis or Y-axis fields`,"chart.runtime.configErrorHint.pieAxis":`chartConfig.x/y or chartConfig.xAxis/yAxis required for pie chart`,"chart.runtime.configErrorHint.radarNumeric":`No numeric fields found for radar chart values`,"chart.runtime.configErrorHint.radialBarNumeric":`No numeric field found for radial bar chart values`,"chart.runtime.configErrorHint.treemapNumeric":`No numeric field found for treemap chart size`,"chart.runtime.configErrorHint.noMeasure":`No measure field configured`,"chart.runtime.configErrorHint.noMeasures":`No measure fields configured`,"chart.runtime.configErrorHint.bubbleRequired":`Bubble chart requires xAxis, yAxis, series, and sizeField dimensions`,"chart.runtime.configErrorHint.bubbleOptional":`Optional: colorField for bubble coloring`,"chart.runtime.configErrorHint.activityGridRequired":`Activity grid requires a time dimension and a measure`,"chart.runtime.chartError":`{chartType} Error`,"chart.runtime.unknownError":`Unknown rendering error`,"chart.runtime.checkConfig":`Check the data and configuration`,"chart.runtime.unableToRender":`Unable to render retention data`,"chart.runtime.dataFormatIncorrect":`Data format may be incorrect`,"chart.runtime.measuringDimensions":`Measuring chart dimensions...`,"chart.runtime.unableToDisplay":`Unable to display chart`,"chart.runtime.responsiveContainerError":`Failed to create responsive container`,"chart.runtime.noDataToDisplay":`No data to display`,"chart.runtime.table.invalidStructure":`Data structure is invalid`,"chart.runtime.heatmapNoResults":`The query returned no results for the heatmap`,"chart.runtime.heatmapConfigRequired":`Configuration required`,"chart.runtime.heatmapXRequired":`X-axis dimension required. `,"chart.runtime.heatmapYRequired":`Y-axis dimension required. `,"chart.runtime.heatmapValueRequired":`Value measure required.`,"chart.runtime.heatmapTruncated":`Data truncated to {maxRows}x{maxCols} cells (original: {originalRows}x{originalCols}). Add filters to reduce dimensions.`,"chart.runtime.activityGridGranularityTooHigh":`Granularity Too High`,"chart.runtime.activityGridGranularityHint":`Activity grids work best with hour, day, week, month, or quarter granularity`,"chart.runtime.activityGridGranularityAction":`Please choose a lower granularity for your time dimension`,"chart.runtime.activityGridConfigRequired":`Configuration Required`,"chart.runtime.retention.cohort":`Cohort`,"chart.runtime.retention.segment":`Segment`,"chart.runtime.retention.users":`Users`,"chart.runtime.retention.cohortSize":`Cohort Size: {count}`,"chart.runtime.retention.retained":`Retained: {count}`,"chart.runtime.retention.rate":`Rate: {rate}`,"chart.runtime.retention.retentionPercent":`Retention %`,"chart.runtime.retention.periodLabel":`{cohort} - Period {period}`,"chart.runtime.retention.noData":`No data`,"chart.runtime.retention.total":`Total`,"chart.runtime.retention.retention":`Retention`,"chart.runtime.funnel.noData":`No funnel data`,"chart.runtime.funnel.steps":`steps`,"chart.runtime.funnel.overall":`Overall:`,"chart.runtime.funnel.completed":`{completed} / {total} completed`,"chart.runtime.flow.noData":`No flow data`,"chart.runtime.flow.events":`events`,"chart.runtime.flow.eventsAfter":`events (after)`,"chart.runtime.flow.paths":`Paths:`,"chart.runtime.flow.startingEntities":`starting entities`,"chart.runtime.flow.entities":`entities`,"chart.runtime.kpiDelta.insufficientData":`Insufficient Data`,"chart.runtime.kpiDelta.requiresTwoPoints":`Delta calculation requires at least 2 data points`,"chart.runtime.kpiDelta.currentPoints":`Current data points: {count}`,"chart.runtime.kpiDelta.noVariance":`No variance data`,"chart.runtime.kpiNumber.noData":`No data`,"chart.runtime.markdown.noContent":`No content`,"chart.runtime.markdown.addContent":`Add markdown content in the chart configuration`,"chart.runtime.axisFormat.label":`Label`,"chart.runtime.axisFormat.autoLabel":`Auto-generated label`,"chart.runtime.axisFormat.unit":`Unit`,"chart.runtime.axisFormat.custom":`Custom`,"chart.runtime.axisFormat.prefix":`Prefix`,"chart.runtime.axisFormat.prefixExample":`e.g., $`,"chart.runtime.axisFormat.suffix":`Suffix`,"chart.runtime.axisFormat.suffixExample":`e.g., units`,"chart.runtime.axisFormat.abbreviation":`Abbreviation`,"chart.runtime.axisFormat.yes":`Yes`,"chart.runtime.axisFormat.no":`No`,"chart.runtime.axisFormat.decimals":`Decimals`,"chart.runtime.axisFormat.preview":`Preview`,"chart.runtime.axisFormat.leftYAxis":`Left Y-Axis`,"chart.runtime.axisFormat.rightYAxis":`Right Y-Axis`,"chart.runtime.axisFormat.xAxis":`X-Axis`,"chart.runtime.missingDep.title":`Missing Dependency`,"chart.runtime.missingDep.description":`The {chartType} chart requires the {packageName} package.`,"chart.runtime.missingDep.restartHint":`After installing, restart your development server.`,"chart.runtime.unknownChartType":`Unknown chart type`,"chart.runtime.unknownChartTypeHint":`"{chartType}" is not registered`,"chart.runtime.boxPlot.truncated":`Data truncated to {max} groups (original: {total})`,"chart.runtime.candlestick.truncated":`Showing first {max} candles (total: {total})`,"chart.runtime.bar.hiddenPoints":`{count} data point(s) with no values hidden`,"chart.runtime.waterfall.increase":`Increase`,"chart.runtime.waterfall.decrease":`Decrease`,"chart.runtime.waterfall.total":`Total`,"chart.runtime.tooltip.noData":`No data`,"chart.runtime.tooltip.targetValue":`Target Value`,"results.toolbar.refreshing":`Refreshing`,"results.toolbar.refresh":`Refresh`,"results.toolbar.refreshTitle":`Refresh data (Shift+click to bypass cache)`,"results.toolbar.refreshingTitle":`Refreshing...`,"results.toolbar.cacheBustTitle":`Click to refresh and bypass cache`,"results.toolbar.clear":`Clear`,"results.toolbar.clearFunnel":`Clear funnel`,"results.toolbar.clearQuery":`Clear all query data`,"results.toolbar.aiClose":`Close AI assistant`,"results.toolbar.aiOpen":`Analyse with AI`,"results.toolbar.shareTitle":`Share this analysis`,"results.toolbar.shareCopied":`Link copied!`,"results.toolbar.schemaHide":`Hide schema diagram`,"results.toolbar.schemaShow":`Show schema diagram`,"results.toolbar.debugHide":`Hide debug info`,"results.toolbar.debugShow":`Show debug info`,"results.toolbar.chartView":`Chart view`,"results.toolbar.chartDisabled":`Add metrics to enable chart view`,"results.toolbar.tableView":`Table view`,"results.toolbar.mergedTableView":`Merged table view`,"results.view.table":`Table`,"results.warning.filterHint":`Consider adding filters to improve performance.`,"results.debug.query":`Query:`,"results.debug.queryAnalysis":`Query Analysis`,"results.debug.copyMarkdownTitle":`Copy query, analysis, and SQL as markdown`,"results.debug.copyAsMarkdown":`Copy as Markdown`,"results.debug.analysisError":`Analysis unavailable due to error`,"results.debug.analysisEmpty":`Add metrics to see analysis`,"results.debug.cubeQuery":`Cube Query`,"results.debug.cubeQueryExecuted":`Executed Query (with funnel filters)`,"results.debug.funnelFilterHint":`This query includes an IN filter with binding key values from the previous step`,"results.debug.noQuery":`No query`,"results.debug.serverResponse":`Server Response`,"results.debug.noResults":`No results yet`,"results.debug.chartConfig":`Chart Config`,"results.debug.displayConfig":`Display Config`,"results.debug.generatedSql":`Generated SQL`,"results.debug.loadingSql":`Loading SQL...`,"results.debug.executionError":`Execution Error`,"results.confirm.clearFunnel":`Clear Funnel`,"results.confirm.clearQuery":`Clear Query`,"results.confirm.clearFunnelMessage":`Are you sure you want to clear this funnel? This action cannot be undone.`,"results.confirm.clearQueryMessage":`Are you sure you want to clear this query? This action cannot be undone.`,"results.table.noData":`No data to display`,"results.table.noDataHint":`Run a query to see table data`,"results.flow.noData":`No flow data to display`,"results.flow.noDataHint":`Configure flow analysis to see results`,"results.flow.nodes":`Nodes ({count})`,"results.flow.transitions":`Transitions ({count})`,"results.flow.layer":`Layer`,"results.flow.name":`Name`,"results.flow.count":`Count`,"results.flow.from":`From`,"results.flow.to":`To`,"results.debug.funnel.label":`Funnel Query`,"results.debug.funnel.steps":`{count} steps`,"results.debug.funnel.serverQuery":`Funnel Server Query`,"results.debug.funnel.noQuery":`No funnel query configured`,"results.debug.funnel.sqlPlaceholder":`Configure funnel binding key to generate SQL`,"results.debug.funnel.stepsTitle":`Funnel Steps`,"results.debug.flow.label":`Flow Query`,"results.debug.flow.badge":`{before} before, {after} after`,"results.debug.flow.serverQuery":`Flow Server Query`,"results.debug.flow.noQuery":`No flow query configured`,"results.debug.flow.sqlPlaceholder":`Configure flow to generate SQL`,"results.debug.flow.configTitle":`Flow Configuration`,"results.debug.flow.startingStep":`Starting Step:`,"results.debug.flow.eventDimension":`Event Dimension:`,"results.debug.flow.stepsBefore":`Steps Before:`,"results.debug.flow.stepsAfter":`Steps After:`,"results.debug.flow.notSet":`Not set`,"results.debug.flow.responseTitle":`Server Response (Sankey Data)`,"results.debug.retention.label":`Retention Query`,"results.debug.retention.badge":`{segments} segment(s), {users} users`,"results.debug.retention.serverQuery":`Retention Server Query`,"results.debug.retention.configIncomplete":`Configuration Incomplete`,"results.debug.retention.configHint":`Configure the retention analysis settings to generate a query.`,"results.debug.retention.sqlPlaceholder":`Configure retention to generate SQL`,"results.debug.retention.configTitle":`Retention Configuration`,"results.debug.retention.summaryTitle":`Retention Summary`,"results.debug.retention.retentionType":`Retention Type:`,"results.debug.retention.periods":`Periods:`,"results.debug.retention.granularity":`Granularity:`,"results.debug.retention.segments":`Segments:`,"results.debug.retention.avgPeriod1":`Avg Period 1:`,"results.debug.retention.maxPeriod1":`Max Period 1:`,"results.debug.retention.minPeriod1":`Min Period 1:`,"results.debug.standard.sqlPlaceholder":`Add metrics to generate SQL`,"flow.tabs.flow":`Flow`,"flow.tabs.display":`Display`,"flow.tabs.displayUnavailable":`Display options not available`,"flow.tabs.displayTitle":`Display options`,"flow.visualization.title":`Visualization`,"flow.visualization.description":`Choose how to visualize the flow data. This affects how data is aggregated.`,"flow.visualization.sankey":`Sankey`,"flow.visualization.sankeyHint":`Paths can converge`,"flow.visualization.sunburst":`Sunburst`,"flow.visualization.sunburstHint":`Unique paths only`,"flow.startingStep.title":`Starting Step`,"flow.startingStep.description":`Define the anchor event from which paths will be explored in both directions.`,"flow.startingStep.filterLabel":`Filter Conditions`,"flow.depth.title":`Exploration Depth`,"flow.depth.descriptionSankey":`How many steps to explore before and after the starting step.`,"flow.depth.descriptionSunburst":`How many steps to explore after the starting step.`,"flow.depth.stepsBefore":`Steps Before`,"flow.depth.stepsBeforeNA":`(N/A)`,"flow.depth.stepsAfter":`Steps After`,"flow.depth.performanceWarning":`High step depth (4-5) may impact query performance on large datasets.`,"flow.joinStrategy.title":`Join Strategy`,"flow.joinStrategy.description":`Control how before/after steps are fetched. Switch to window if lateral is slower on your DB.`,"flow.joinStrategy.auto":`Auto (prefer lateral if available)`,"flow.joinStrategy.lateral":`Lateral (index seeks)`,"flow.joinStrategy.window":`Window (ROW_NUMBER)`,"retention.tabs.retention":`Retention`,"retention.tabs.display":`Display`,"retention.tabs.displayUnavailable":`Display options not available`,"retention.tabs.displayTitle":`Display options`,"retention.dateRange.title":`Date Range`,"retention.dateRange.description":`Select the date range for cohort entry. Users who first appear within this range will be analyzed.`,"retention.dateRange.label":`Date Range`,"retention.dateRange.selectRange":`Select date range`,"retention.dateRange.customRange":`Custom Range`,"retention.dateRange.applyCustom":`Apply Custom Range`,"retention.cohortFilter.title":`Cohort Filter`,"retention.cohortFilter.description":`Define who enters the cohort. Users whose first event matches these filters within the date range are included.`,"retention.returnFilter.title":`Return Filter`,"retention.returnFilter.description":`Define what counts as a return. Events matching these filters in subsequent periods count as retention.`,"retention.breakdown.title":`Breakdown`,"retention.breakdown.description":`Optionally segment retention by dimensions (e.g., country, plan type).`,"retention.settings.title":`Settings`,"retention.settings.description":`Configure how retention is calculated and displayed.`,"retention.settings.granularityLabel":`Period Granularity`,"retention.settings.periodsLabel":`Number of Periods ({min}-{max})`,"retention.settings.periodsWarning":`High period count may impact query performance.`,"retention.settings.retentionTypeLabel":`Retention Type`,"debug.explainPlan":`Explain Plan`,"debug.explainRunning":`Running...`,"debug.explainIncludeTiming":`Include timing`,"debug.explainRunningAnalyze":`Running EXPLAIN ANALYZE...`,"debug.explainRunningBasic":`Running EXPLAIN...`,"debug.explainError":`Explain Error:`,"debug.sequentialScans":`Sequential Scans Detected`,"debug.indexesUsed":`{count} Index Used`,"debug.indexesUsedPlural":`{count} Indexes Used`,"debug.executionTime":`Execution: {time}ms`,"debug.planningTime":`Planning: {time}ms`,"debug.cost":`Cost: {cost}`,"debug.indexes":`Indexes:`,"debug.executionPlanTitle":`Execution Plan ({database})`,"debug.aiAnalyzing":`Analyzing...`,"debug.aiAnalysis":`AI Analysis`,"debug.aiAnalysisError":`AI Analysis Error:`,"explainAI.title":`AI Performance Analysis`,"explainAI.assessment.good":`Good`,"explainAI.assessment.warning":`Warning`,"explainAI.assessment.critical":`Critical`,"explainAI.summary":`Summary`,"explainAI.queryAnalysis":`Query Analysis`,"explainAI.issuesFound":`Issues Found ({count})`,"explainAI.recommendations":`Recommendations ({count})`,"explainAI.noRecommendations":`No specific recommendations. The query appears to be well-optimized.`,"explainAI.expectedImpact":`Expected impact:`,"explainAI.addToCube":`Add to {cubeName} cube:`,"explainAI.modelLabel":`Model:`,"explainAI.usingUserKey":`(using your API key)`,"explainAI.copied":`Copied!`,"explainAI.copy":`Copy`,"explainAI.type.index":`INDEX`,"explainAI.type.table":`TABLE`,"explainAI.type.cube":`CUBE`,"explainAI.type.general":`TIP`,"errorBoundary.modeError":`Mode Error`,"errorBoundary.modeErrorDescription":`There was a problem with the {mode} mode. This might be due to invalid configuration data.`,"errorBoundary.showDetails":`Show error details`,"errorBoundary.unknownError":`Unknown error`,"errorBoundary.tryAgain":`Try Again`,"errorBoundary.switchToQuery":`Switch to Query Mode`,"funnel.tabs.steps":`Steps`,"funnel.tabs.display":`Display`,"funnel.tabs.displayUnavailable":`Display options not available`,"funnel.tabs.displayTitle":`Display options`,"funnel.steps.title":`Funnel Steps`,"funnel.steps.emptyMessage":`No steps defined. Add at least 2 steps to create a funnel.`,"funnel.steps.addFirst":`Add First Step`,"funnel.steps.addStep":`Add Step`,"funnel.steps.validationHint":`Add at least one more step to create a valid funnel`,"funnel.step.removeTitle":`Remove step`,"funnel.step.editNameTitle":`Click to edit name`,"funnel.step.placeholder":`Step name`,"funnel.step.timeWindow":`Time Window`,"funnel.step.timeWindowHelp":`Max time from previous step to qualify`,"funnel.step.filters":`{count} filter`,"funnel.step.filtersPlural":`{count} filters`,"funnel.step.within":`within {time}`,"funnel.step.noFilters":`No filters configured`,"funnel.config.configuration":`Configuration`,"funnel.config.cube":`Cube`,"funnel.config.cubeHelp":`Select a cube configured for funnel analysis`,"funnel.config.cubePlaceholder":`Select event stream cube`,"funnel.config.bindingKey":`Binding Key`,"funnel.config.bindingKeyHelp":`Entity that connects steps (e.g., user ID, order ID)`,"funnel.config.bindingKeyPlaceholder":`Select binding key`,"funnel.config.selectCubeFirst":`Select cube first`,"funnel.config.timeDimension":`Time Dimension`,"funnel.config.timeDimensionHelp":`Timestamp field for step ordering`,"funnel.config.timeDimensionPlaceholder":`Select time dimension`,"funnel.config.noMatchingFields":`No matching fields found`,"funnel.bindingKey.searchPlaceholder":`Search dimensions...`,"funnel.bindingKey.noMatching":`No matching dimensions found`,"funnel.bindingKey.helpText":`Select a dimension that identifies entities across funnel steps (e.g., user ID, order ID)`,"funnel.bindingKey.clearTitle":`Clear binding key`,"flow.config.configuration":`Configuration`,"flow.config.cube":`Cube`,"flow.config.cubeHelp":`Select a cube configured for flow analysis`,"flow.config.cubePlaceholder":`Select event stream cube`,"flow.config.bindingKey":`Binding Key`,"flow.config.bindingKeyHelp":`Entity that links events together (e.g., user ID)`,"flow.config.bindingKeyPlaceholder":`Select binding key`,"flow.config.selectCubeFirst":`Select cube first`,"flow.config.timeDimension":`Time Dimension`,"flow.config.timeDimensionHelp":`Timestamp field for event ordering`,"flow.config.timeDimensionPlaceholder":`Select time dimension`,"flow.config.eventDimension":`Event Dimension`,"flow.config.eventDimensionHelp":`Dimension that categorizes events (node labels in Sankey)`,"flow.config.eventDimensionPlaceholder":`Select event dimension`,"flow.config.noMatchingFields":`No matching fields found`,"retention.config.configuration":`Configuration`,"retention.config.cube":`Cube`,"retention.config.cubeHelp":`Select the cube containing your user events`,"retention.config.cubePlaceholder":`Select cube`,"retention.config.bindingKey":`Binding Key`,"retention.config.bindingKeyHelp":`Dimension that identifies entities across events (e.g., user ID, customer ID)`,"retention.config.bindingKeyPlaceholder":`Select user identifier`,"retention.config.selectCubeFirst":`Select cube first`,"retention.config.timestamp":`Timestamp`,"retention.config.timestampHelp":`Timestamp field for cohort entry and activity`,"retention.config.timestampPlaceholder":`Select timestamp`,"retention.config.noMatchingFields":`No matching fields found`,"retention.config.searchPlaceholder":`Search...`,"display.showLegend":`Show Legend`,"display.showGrid":`Show Grid`,"display.showTooltip":`Show Tooltip`,"display.stacked":`Stacked`,"display.hideHeader":`Hide Header`,"fieldSearch.aria.closeDialog":`Close dialog`,"fieldSearch.aria.filterByCube":`Filter by cube`,"fieldSearch.aria.cubeCategories":`Cube categories`,"fieldSearch.aria.availableFields":`Available fields`,"chart.dropZone.required":`This field is required`,"common.actions.apply":`Apply`,"common.actions.done":`Done`,"common.actions.update":`Update`,"common.actions.retry":`Retry`,"common.actions.exit":`Exit`,"common.actions.selectAll":`Select All`,"common.saving":`Saving...`,"common.labels.title":`Title`,"dashboardFilter.editFilter":`Edit Filter`,"dashboardFilter.filterLabel":`Filter Label`,"dashboardFilter.enterFilterLabel":`Enter filter label`,"dashboardFilter.universalTimeFilter":`Universal Time Filter`,"dashboardFilter.universalTimeDescription":`This filter applies to all time dimensions in mapped portlets. Users can select the date range when viewing the dashboard.`,"dashboardFilter.field":`Field`,"dashboardFilter.showDashboardFields":`Show dashboard fields only`,"dashboardFilter.showAllFields":`Show all fields`,"dashboardFilter.dashboard":`Dashboard`,"dashboardFilter.all":`All`,"dashboardFilter.clickToSelectField":`Click to select a field`,"dashboardFilter.operator":`Operator`,"dashboardFilter.defaultValue":`Default Value`,"dashboardFilter.deleteFilter":`Delete Filter`,"dashboardFilter.noValueRequired":`No value required`,"dashboardFilter.to":`to`,"dashboardFilter.selectValue":`Select value...`,"dashboardFilter.search":`Search...`,"dashboardFilter.errorPrefix":`Error: `,"dashboardFilter.noValuesFound":`No values found`,"dashboardFilter.enterValue":`Enter value...`,"dashboardFilter.enterNumber":`Enter number`,"dashboardFilter.min":`Min`,"dashboardFilter.max":`Max`,"dashboardFilter.filterLabelRequired":`Filter label is required`,"dashboardFilter.selectFieldRequired":`Please select a field for the filter`,"dashboardFilter.notSet":`(not set)`,"dashboardFilter.clickToConfigure":`Click to configure`,"dashboardFilter.customDate.startDate":`Start Date`,"dashboardFilter.customDate.endDate":`End Date`,"dashboardFilter.customDate.sinceDate":`Since Date`,"dashboardFilter.customDate.fromSelectedToToday":`From selected date to today`,"dashboardFilter.customDate.number":`Number`,"dashboardFilter.customDate.unit":`Unit`,"dashboardFilter.customDate.lastNPreview":`Last {number} {unit}`,"dashboardFilter.editMode.filters":`Filters`,"dashboardFilter.editMode.noFilters":`No filters configured. Click "Add" to create one.`,"dashboardFilter.editMode.dateRange":`Date Range`,"dashboardFilter.editMode.filter":`Filter`,"dashboardFilter.editMode.editFilter":`Edit filter`,"dashboardFilter.editMode.removeFilter":`Remove filter`,"dashboardFilter.filterValue.editValue":`Edit value`,"dashboardFilter.readOnly.filters":`Filters`,"filter.shared.fieldsInQuery":`Fields in Query ({count})`,"filter.shared.allAvailableFields":`All Available Fields ({count})`,"filter.shared.noFieldsMatch":`No fields found matching "{searchTerm}"`,"filter.shared.searchFields":`Search fields...`,"filter.shared.selectField":`Select field...`,"filter.shared.schemaNotLoaded":`Schema not loaded`,"filter.shared.group.addFilter":`Add Filter`,"filter.shared.group.addAndGroup":`Add AND Group`,"filter.shared.group.addOrGroup":`Add OR Group`,"filter.shared.group.addCondition":`Add condition`,"filter.shared.group.noConditions":`No conditions in this group.`,"filter.shared.group.addFilterLink":`Add a filter`,"filter.shared.builder.filters":`Filters ({count})`,"filter.shared.builder.clearAll":`Clear all`,"filter.shared.builder.addFilter":`Add Filter`,"filter.shared.dateRange.title":`Date Ranges ({count})`,"filter.shared.dateRange.clearAll":`Clear all`,"filter.shared.dateRange.addDateRange":`Add Date Range`,"filter.shared.dateRange.allHaveDateRanges":`All time dimensions already have date ranges`,"filter.shared.valueSelector.noValueRequired":`No value required`,"filter.shared.valueSelector.to":`to`,"filter.shared.valueSelector.min":`Min`,"filter.shared.valueSelector.max":`Max`,"filter.shared.valueSelector.enterNumber":`Enter number`,"filter.shared.valueSelector.loadingValues":`Loading values...`,"filter.shared.valueSelector.selectValue":`Select value...`,"filter.shared.valueSelector.searchValues":`Search values...`,"filter.shared.valueSelector.searching":`Searching...`,"filter.shared.valueSelector.errorLoading":`Error loading values: {error}`,"filter.shared.valueSelector.noMatchingValues":`No matching values`,"filter.shared.valueSelector.noValuesAvailable":`No values available`,"filter.shared.valueSelector.enterValue":`Enter {type} value`,"dashboard.noPortlets":`No Portlets`,"dashboard.noPortletsDescription":`Add your first portlet to start visualizing your data`,"dashboard.addText":`Add Text`,"dashboard.addPortlet":`Add Portlet`,"dashboard.finishEditing":`Finish Editing`,"dashboard.edit":`Edit`,"dashboard.grid":`Grid`,"dashboard.rows":`Rows`,"dashboard.desktopRequired":`Desktop view required for editing`,"dashboard.editModeHint":`Drag • Resize • Auto-save`,"dashboard.filterSelectionMode":`Filter Selection Mode - Click portlets to toggle '{filterLabel}'`,"dashboard.filterSelectionEscHint":`• Press ESC to exit`,"dashboard.editPortlet":`Edit Portlet`,"dashboard.addNewPortlet":`Add New Portlet`,"dashboard.updatePortlet":`Update Portlet`,"dashboard.deletePortlet":`Delete Portlet`,"dashboard.deletePortletConfirm":`Are you sure you want to delete`,"dashboard.deletePortletSuffix":`? This action cannot be undone.`,"dashboard.thisPortlet":`this portlet`,"dashboard.editModal.dashboardName":`Dashboard Name`,"dashboard.editModal.enterDashboardName":`Enter dashboard name...`,"dashboard.editModal.descriptionOptional":`Description (optional)`,"dashboard.editModal.enterDescription":`Enter description...`,"portlet.configRequired":`Configuration Required`,"portlet.configRequiredHint":`Please configure this chart`,"portlet.queryError":`Query Error`,"portlet.queryWithFilters":`Query (with filters applied)`,"portlet.chartConfig":`Chart Config`,"portlet.noDataAvailable":`No data available`,"portlet.noDataDrilled":`No data points to display for the current filter`,"portlet.invalidQuery":`Invalid query or no results`,"portlet.unsupportedChartType":`Unsupported chart type`,"portlet.unableToRender":`Unable to render chart`,"portlet.enterTitle":`Enter portlet title...`,"portlet.enterPortletTitle":`Please enter a title for the portlet.`,"portlet.configureQuery":`Please configure a query before saving.`,"portlet.configureFlow":`Please configure the flow analysis (binding key, time dimension, event dimension, and starting step filter).`,"portlet.configureRetention":`Please configure the retention analysis (binding key, time dimension, and date range).`,"portlet.configureFunnel":`Please add at least two funnel steps.`,"portlet.addMetricOrBreakdown":`Please add at least one metric or breakdown to your query.`,"portlet.filterConfig.title":`Configure Dashboard Filters`,"portlet.filterConfig.subtitle":`Choose which dashboard filters apply to "{portletTitle}"`,"portlet.filterConfig.noFilters":`No dashboard filters available`,"portlet.filterConfig.noFiltersHint":`Add filters at the dashboard level first`,"portlet.filterConfig.availableFilters":`Available Filters`,"portlet.filterConfig.selectedCount":`{selected} of {total} selected`,"portlet.filterConfig.applied":`Applied`,"portlet.filterConfig.noValue":`no value`,"portlet.filterConfig.complexFilter":`Complex filter`,"portlet.filterConfig.groupFilter":`{type} group with {count} filter`,"portlet.filterConfig.groupFilterPlural":`{type} group with {count} filters`,"portlet.filterConfig.applyFilters":`Apply Filters`,"textPortlet.editText":`Edit Text`,"textPortlet.addText":`Add Text`,"textPortlet.markdownContent":`Markdown Content`,"textPortlet.markdownHint":`Supports headers (#), bold (**text**), italic (*text*), links ([text](url)), lists (- item), and horizontal rules (---).`,"textPortlet.preview":`Preview`,"debug.title":`Chart Debug Information`,"debug.chartType":`Chart Type`,"debug.fieldAnalysis":`Field Analysis`,"debug.chartConfig":`Chart Config`,"debug.displayConfig":`Display Config`,"debug.queryObject":`Query Object`,"debug.dataSample":`Data Sample (first 3 rows)`,"debug.cacheStatus":`Cache Status`,"debug.cacheHit":`Cache Hit`,"debug.cachedAt":`Cached At:`,"debug.ttl":`TTL:`,"debug.ttlRemaining":`TTL Remaining:`,"debug.freshQuery":`Fresh Query`,"debug.notFromCache":`Result not served from cache`,"debug.escToClose":`Press`,"debug.escKey":`ESC`,"debug.toClose":`to close`,"debug.tooltip":`Debug chart configuration`,"error.unableToRender":`Unable to render chart`,"error.unableToRenderNamed":`Unable to render {title}`,"error.renderDescription":`There was an error rendering this chart component. The error details are shown below.`,"error.errorLabel":`Error:`,"error.typeLabel":`Type:`,"error.portletConfig":`Portlet Configuration`,"error.cubeQuery":`Cube Query`,"error.componentStack":`Component Stack`,"error.tryAgain":`Try Again`,"drill.back":`Back`,"drill.goBackOneLevel":`Go back one level`,"drill.returnToTop":`Return to top level`,"drill.navigateTo":`Navigate to {label}`,"drill.empty":`(empty)`,"analyticsPage.title":`Analytics Page - Coming in Phase 4`,"dataHistogram.average":`Average of {count} values`,"dataHistogram.valuesInRange":`{count} values in this range`,"mcp.status.connecting":`Connecting...`,"mcp.status.loading":`Loading...`,"mcp.status.waiting":`Waiting for query results...`,"mcp.error.connectionLabel":`Connection error:`,"mcp.error.errorLabel":`Error:`,"mcp.error.noTextContent":`No text content in result`,"mcp.error.invalidResultFormat":`Invalid result format: missing data array`,"mcp.error.parseFailed":`Failed to parse result: {message}`,"mcp.error.queryFailed":`Query failed: {message}`,"mcp.footer.rows":`{count} row`,"mcp.footer.rowsPlural":`{count} rows`,"mcp.footer.measures":`{count} measure`,"mcp.footer.measuresPlural":`{count} measures`,"mcp.footer.dimensions":`{count} dimension`,"mcp.footer.dimensionsPlural":`{count} dimensions`},Ke=!1;function N(e,t){let n=Ge[e];return n?t?n.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)}):n:(Ke&&typeof console<`u`&&console.warn(`[drizzle-cube i18n] Missing translation key: "${e}"`),e)}function qe(e,t){let{cube:n,allCubes:r,resolvedMeasures:i}=t,a=Je(e),o=new Map;for(let e of a){let{originalRef:t,cubeName:a,fieldName:s}=e,c=a||n.name;if(!r.get(c))throw Error(N(`server.validation.template.substituteTargetCubeNotFound`,{ref:`{${t}}`,cubeName:c}));let l=`${c}.${s}`,d=i.get(l);if(!d)throw Error(N(`server.validation.template.substituteMeasureNotResolved`,{ref:`{${t}}`,measureName:l}));let f=u.sql`${d()}`;o.set(t,f)}let s=[],c=[],l=0;for(let t of a){let n=`{${t.originalRef}}`,r=e.indexOf(n,l);if(r>=0){s.push(e.substring(l,r));let i=o.get(t.originalRef);i&&c.push(i),l=r+n.length}}if(s.push(e.substring(l)),c.length===0)return u.sql.raw(e);let d=[];for(let e=0;e<s.length;e++)s[e]&&d.push(new u.StringChunk(s[e])),e<c.length&&d.push(c[e]);return u.sql.join(d,u.sql.raw(``))}function Je(e){if(e.length>1e3)return[];let t=e.matchAll(/\{([^}]+)\}/g),n=[];for(let e of t){let t=e[1].trim();if(t.includes(`.`)){let[e,r]=t.split(`.`).map(e=>e.trim());n.push({originalRef:t,cubeName:e,fieldName:r})}else n.push({originalRef:t,cubeName:null,fieldName:t})}return n}function Ye(e){let t=[],n=0;for(let r=0;r<e.length;r++)if(e[r]===`{`)n++;else if(e[r]===`}`&&(n--,n<0)){t.push(N(`server.validation.template.unmatchedClosingBrace`,{position:r}));break}n>0&&t.push(N(`server.validation.template.unmatchedOpeningBrace`)),/\{\s*\}/.test(e)&&t.push(N(`server.validation.template.emptyReference`)),/\{[^}]*\{/.test(e)&&t.push(N(`server.validation.template.nestedBraces`));let r=Je(e);for(let e of r){let n=e.cubeName?`${e.cubeName}.${e.fieldName}`:e.fieldName;/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(n)||t.push(N(`server.validation.template.invalidMemberReference`,{ref:`{${e.originalRef}}`})),n.split(`.`).length>2&&t.push(N(`server.validation.template.multipleDots`,{ref:`{${e.originalRef}}`}))}return{isValid:t.length===0,errors:t}}function Xe(e,t){let n=Je(e),r=new Set;for(let e of n){let n=`${e.cubeName||t}.${e.fieldName}`;r.add(n)}return Array.from(r)}var P=class e{constructor(e){this.databaseAdapter=e}buildResolvedMeasures(t,n,r,i){let a=new Map,o=[],s=[],c=new Set(t),l=new M(n);for(let e of n.values())l.buildGraph(e);let u=[];for(let r of t){let[t,i]=r.split(`.`),a=n.get(t);if(a&&a.measures&&a.measures[i]){let d=a.measures[i];if(e.isPostAggregationWindow(d)){u.push(r);let n=e.getWindowBaseMeasure(d,t);n&&c.add(n);continue}M.isCalculatedMeasure(d)?(s.push(r),Xe(d.calculatedSql,t).forEach(e=>c.add(e)),l.getAllDependencies(r).forEach(e=>{let[t,r]=e.split(`.`),i=n.get(t);if(i&&i.measures[r]){let e=i.measures[r];M.isCalculatedMeasure(e)&&Xe(e.calculatedSql,t).forEach(e=>c.add(e))}})):o.push(r)}}for(let t of c){let[r,i]=t.split(`.`),a=n.get(r);if(a&&a.measures&&a.measures[i]){let n=a.measures[i];if(e.isPostAggregationWindow(n))continue;M.isCalculatedMeasure(n)?s.includes(t)||s.push(t):o.includes(t)||o.push(t)}}for(let e of o){let[t,o]=e.split(`.`),s=n.get(t),c=s.measures[o];if(i){let t=i(e,c,s);a.set(e,()=>t)}else a.set(e,()=>this.buildMeasureExpression(c,r,s))}if(s.length>0){let e=l.topologicalSort(s);for(let t of e){let[e,i]=t.split(`.`),o=n.get(e),s=o.measures[i];a.set(t,()=>this.buildCalculatedMeasure(s,o,n,a,r))}}return a}buildCalculatedMeasure(e,t,n,r,i){if(!e.calculatedSql)throw Error(`Calculated measure '${t.name}.${e.name}' missing calculatedSql property`);return qe(this.databaseAdapter.preprocessCalculatedTemplate(e.calculatedSql),{cube:t,allCubes:n,resolvedMeasures:r,queryContext:i})}buildCTECalculatedMeasure(e,t,n,r,i){if(!e.calculatedSql)throw Error(`Calculated measure '${t.name}.${e.name||`unknown`}' missing calculatedSql property`);let a=new Map,o=Xe(e.calculatedSql,t.name);for(let e of o){let[t,i]=e.split(`.`),o=r.get(t);if(o&&o.measures[i]){let t=o.measures[i];if(n.measures.includes(e)){let r=u.sql`${u.sql.identifier(n.cteAlias)}.${u.sql.identifier(i)}`,o;switch(t.type){case`count`:case`countDistinct`:case`sum`:o=(0,u.sum)(r);break;case`avg`:o=this.databaseAdapter.buildAvg(r);break;case`min`:o=(0,u.min)(r);break;case`max`:o=(0,u.max)(r);break;case`number`:o=(0,u.sum)(r);break;default:o=(0,u.sum)(r)}a.set(e,()=>o)}}}return this.buildCalculatedMeasure(e,t,r,a,i)}buildHavingMeasureExpression(e,t,n,r,i){if(i&&i.preAggregationCTEs){let a=i.preAggregationCTEs.find(t=>t.cube.name===e);if(a&&a.measures.includes(`${e}.${t}`))if(n.type===`calculated`&&n.calculatedSql){let t=i.primaryCube.name===e?i.primaryCube:i.joinCubes?.find(t=>t.cube.name===e)?.cube;if(!t)throw Error(`Cube ${e} not found in query plan`);let o=new Map([[i.primaryCube.name,i.primaryCube]]);if(i.joinCubes)for(let e of i.joinCubes)o.set(e.cube.name,e.cube);return this.buildCTECalculatedMeasure(n,t,a,o,r)}else{let e=u.sql`${u.sql.identifier(a.cteAlias)}.${u.sql.identifier(t)}`;switch(n.type){case`count`:case`countDistinct`:case`sum`:return(0,u.sum)(e);case`avg`:return this.databaseAdapter.buildAvg(e);case`min`:return(0,u.min)(e);case`max`:return(0,u.max)(e);case`number`:return(0,u.sum)(e);default:return(0,u.sum)(e)}}}return this.buildMeasureExpression(n,r)}buildMeasureExpression(t,n,r){if(t.type===`calculated`)throw Error(`Cannot build calculated measure '${t.name}' directly. Use buildCalculatedMeasure instead.`);if(e.isPostAggregationWindow(t))throw Error(`Post-aggregation window measure '${t.name}' should be built via buildPostAggregationWindowExpression, not buildMeasureExpression.`);if(!t.sql)throw Error(`Measure '${t.name}' of type '${t.type}' is missing required 'sql' property. Only calculated measures and post-aggregation window functions can omit 'sql'.`);let i=A(t.sql,n);if(n.ungrouped)return i;if(t.filters&&t.filters.length>0){let e=t.filters.map(e=>{let t=e(n);return t?u.sql`(${t})`:void 0}).filter(Boolean);if(e.length>0){let t=e.length===1?e[0]:(0,u.and)(...e);i=this.databaseAdapter.buildCaseWhen([{when:t,then:i}])}}switch(t.type){case`count`:return(0,u.count)(i);case`countDistinct`:return(0,u.countDistinct)(i);case`sum`:return(0,u.sum)(i);case`avg`:return this.databaseAdapter.buildAvg(i);case`min`:return(0,u.min)(i);case`max`:return(0,u.max)(i);case`number`:return i;case`stddev`:case`stddevSamp`:{let e=t.type===`stddevSamp`||t.statisticalConfig?.useSample,n=this.databaseAdapter.buildStddev(i,e);return n===null?(console.warn(`[drizzle-cube] ${t.type} not supported on ${this.databaseAdapter.getEngineType()}, returning NULL`),u.sql`MAX(NULL)`):n}case`variance`:case`varianceSamp`:{let e=t.type===`varianceSamp`||t.statisticalConfig?.useSample,n=this.databaseAdapter.buildVariance(i,e);return n===null?(console.warn(`[drizzle-cube] ${t.type} not supported on ${this.databaseAdapter.getEngineType()}, returning NULL`),u.sql`MAX(NULL)`):n}case`percentile`:case`median`:case`p95`:case`p99`:{let e;switch(t.type){case`median`:e=50;break;case`p95`:e=95;break;case`p99`:e=99;break;default:e=t.statisticalConfig?.percentile??50}let n=this.databaseAdapter.buildPercentile(i,e);return n===null?(console.warn(`[drizzle-cube] ${t.type} not supported on ${this.databaseAdapter.getEngineType()}, returning NULL`),u.sql`MAX(NULL)`):n}case`lag`:case`lead`:case`rank`:case`denseRank`:case`rowNumber`:case`ntile`:case`firstValue`:case`lastValue`:case`movingAvg`:case`movingSum`:{let e=t.windowConfig||{},a;if(e.partitionBy&&e.partitionBy.length>0&&r){let t=e.partitionBy.map(e=>{let t=e.includes(`.`)?e.split(`.`)[1]:e,i=r.dimensions?.[t];return i?A(i.sql,n):(console.warn(`[drizzle-cube] Window function partition dimension '${e}' not found in cube '${r.name}'`),null)}).filter(e=>e!==null);t.length>0&&(a=t)}let o;if(e.orderBy&&e.orderBy.length>0&&r){let t=e.orderBy.map(e=>{let t=e.field.includes(`.`)?e.field.split(`.`)[1]:e.field,i=r.dimensions?.[t];if(i)return{field:A(i.sql,n),direction:e.direction};let a=r.measures?.[t];return a&&a.sql?{field:A(a.sql,n),direction:e.direction}:(console.warn(`[drizzle-cube] Window function order field '${e.field}' not found in cube '${r.name}'`),null)}).filter(e=>e!==null);t.length>0&&(o=t)}let s=this.databaseAdapter.buildWindowFunction(t.type,[`rank`,`denseRank`,`rowNumber`].includes(t.type)?null:i,a,o,{offset:e.offset,defaultValue:e.defaultValue,nTile:e.nTile,frame:e.frame});return s===null?(console.warn(`[drizzle-cube] ${t.type} not supported on ${this.databaseAdapter.getEngineType()}, returning NULL`),u.sql`NULL`):s}default:return(0,u.count)(i)}}static WINDOW_FUNCTION_TYPES=[`lag`,`lead`,`rank`,`denseRank`,`rowNumber`,`ntile`,`firstValue`,`lastValue`,`movingAvg`,`movingSum`];static isWindowFunction(t){return e.WINDOW_FUNCTION_TYPES.includes(t)}static categorizeMeasures(t,n){let r=[],i=[];for(let a of t){let[t,o]=a.split(`.`),s=n.get(t);if(s?.measures?.[o]){let t=s.measures[o];e.isWindowFunction(t.type)?r.push(a):i.push(a)}}return{windowMeasures:r,aggregateMeasures:i}}static hasWindowFunctions(t,n){let{windowMeasures:r}=e.categorizeMeasures(t,n);return r.length>0}static isPostAggregationWindow(t){return e.isWindowFunction(t.type)&&t.windowConfig?.measure!==void 0}static getWindowBaseMeasure(e,t){if(!e.windowConfig?.measure)return null;let n=e.windowConfig.measure;return n.includes(`.`)?n:`${t}.${n}`}static getDefaultWindowOperation(e){switch(e){case`lag`:case`lead`:return`difference`;default:return`raw`}}static categorizeForPostAggregation(t,n){let r=[],i=[],a=new Set;for(let o of t){let[t,s]=o.split(`.`),c=n.get(t);if(c?.measures?.[s]){let n=c.measures[s];if(e.isPostAggregationWindow(n)){i.push(o);let r=e.getWindowBaseMeasure(n,t);r&&a.add(r)}else e.isWindowFunction(n.type)||r.push(o)}}return{aggregateMeasures:r,postAggWindowMeasures:i,requiredBaseMeasures:a}}static hasPostAggregationWindows(t,n){let{postAggWindowMeasures:r}=e.categorizeForPostAggregation(t,n);return r.length>0}},Ze=class{constructor(e){this.dateTimeBuilder=e}isWindowFunctionType(e){return[`lag`,`lead`,`rank`,`denseRank`,`rowNumber`,`ntile`,`firstValue`,`lastValue`,`movingAvg`,`movingSum`].includes(e)}isAggregateFunctionType(e){return[`count`,`countDistinct`,`sum`,`avg`,`min`,`max`,`stddev`,`stddevSamp`,`variance`,`varianceSamp`,`median`,`p95`,`p99`,`percentile`,`number`].includes(e)}buildGroupByFields(e,t,n,r){if(t.ungrouped)return[];let i=[],a=e instanceof Map?e:new Map([[e.name,e]]),o=t.dimensions&&t.dimensions.length>0||t.timeDimensions&&t.timeDimensions.length>0,s=t.measures&&t.measures.length>0,c=o&&!s,l=!1;for(let e of t.measures||[]){let[t,n]=e.split(`.`),r=a.get(t);if(r&&r.measures&&r.measures[n]){let e=r.measures[n];if(this.isAggregateFunctionType(e.type)||e.type===`calculated`){l=!0;break}if(P.isPostAggregationWindow(e)){let n=P.getWindowBaseMeasure(e,t);if(n){let[e,t]=n.split(`.`),r=a.get(e)?.measures?.[t];if(r&&this.isAggregateFunctionType(r.type)){l=!0;break}}}}}if(!l&&!c)return[];if(t.dimensions)for(let e of t.dimensions){let[t,o]=e.split(`.`),s=a.get(t);if(s&&s.dimensions&&s.dimensions[o]){let e=r?.preAggregationCTEs?.find(e=>e.cube.name===t);if(e){let t=e.joinKeys.find(e=>e.targetColumn===o);if(t&&t.sourceColumnObj)i.push(t.sourceColumnObj);else{let t=u.sql`${u.sql.identifier(e.cteAlias)}.${u.sql.identifier(o)}`;i.push(t)}}else{let e=s.dimensions[o],t=A(e.sql,n);i.push(t)}}}if(t.timeDimensions)for(let e of t.timeDimensions){let[t,o]=e.dimension.split(`.`),s=a.get(t);if(s&&s.dimensions&&s.dimensions[o]){let a=r?.preAggregationCTEs?.find(e=>e.cube.name===t);if(a){let t=a.joinKeys.find(e=>e.targetColumn===o);if(t&&t.sourceColumnObj){let r=this.dateTimeBuilder.buildTimeDimensionExpression(t.sourceColumnObj,e.granularity,n);i.push(r)}else{let e=u.sql`${u.sql.identifier(a.cteAlias)}.${u.sql.identifier(o)}`;i.push(e)}}else{let t=s.dimensions[o],r=this.dateTimeBuilder.buildTimeDimensionExpression(t.sql,e.granularity,n);i.push(r)}}}return i}},Qe=class{dateTimeBuilder;filterBuilder;groupByBuilder;measureBuilder;constructor(e){this.dateTimeBuilder=new Ue(e),this.filterBuilder=new We(e,this.dateTimeBuilder),this.groupByBuilder=new Ze(this.dateTimeBuilder),this.measureBuilder=new P(e)}buildResolvedMeasures(e,t,n,r){return this.measureBuilder.buildResolvedMeasures(e,t,n,r)}buildSelections(e,t,n){let r={},i=e instanceof Map?e:new Map([[e.name,e]]);if(t.dimensions)for(let e of t.dimensions){let[t,a]=e.split(`.`),o=i.get(t);if(o&&o.dimensions&&o.dimensions[a]){let t=o.dimensions[a];r[e]=u.sql`${A(t.sql,n)}`.as(e)}}if(t.measures){let e=this.buildResolvedMeasures(t.measures,i,n);for(let n of t.measures){let t=e.get(n);t&&typeof t==`function`&&(r[n]=u.sql`${t()}`.as(n))}}if(t.timeDimensions)for(let e of t.timeDimensions){let[t,a]=e.dimension.split(`.`),o=i.get(t);if(o&&o.dimensions&&o.dimensions[a]){let t=o.dimensions[a],i=this.buildTimeDimensionExpression(t.sql,e.granularity,n);r[e.dimension]=u.sql`${i}`.as(e.dimension)}}return Object.keys(r).length===0&&(r.count=(0,u.count)()),r}buildCalculatedMeasure(e,t,n,r,i){return this.measureBuilder.buildCalculatedMeasure(e,t,n,r,i)}buildCTECalculatedMeasure(e,t,n,r,i){return this.measureBuilder.buildCTECalculatedMeasure(e,t,n,r,i)}buildHavingMeasureExpression(e,t,n,r,i){return this.measureBuilder.buildHavingMeasureExpression(e,t,n,r,i)}buildMeasureExpression(e,t,n){return this.measureBuilder.buildMeasureExpression(e,t,n)}buildTimeDimensionExpression(e,t,n){return this.dateTimeBuilder.buildTimeDimensionExpression(e,t,n)}buildWhereConditions(e,t,n,r,i){let a=[],o=e instanceof Map?e:new Map([[e.name,e]]),s=new Set;if(t.filters&&t.filters.length>0)for(let e of t.filters){if(i&&`member`in e){let[t]=e.member.split(`.`),n=o.has(t);if(r?.preAggregationCTEs&&r.preAggregationCTEs.some(e=>e.cube.name===t))continue;if(n&&i.has(t)&&!s.has(t)){let e=i.get(t);a.push(...e),s.add(t);continue}else if(s.has(t))continue}let t=this.processFilter(e,o,n,`where`,r);t&&a.push(t)}if(t.timeDimensions)for(let e of t.timeDimensions){let[t,i]=e.dimension.split(`.`),s=o.get(t);if(s&&s.dimensions[i]&&e.dateRange){if(r?.preAggregationCTEs&&r.preAggregationCTEs.some(e=>e.cube.name===t))continue;if(n.filterCache){let t=je(e.dimension,e.dateRange),r=n.filterCache.get(t);if(r){a.push(r);continue}}let o=s.dimensions[i],c=A(o.sql,n),l=this.buildDateRangeCondition(c,e.dateRange);l&&a.push(l)}}return a}buildHavingConditions(e,t,n,r){let i=[],a=e instanceof Map?e:new Map([[e.name,e]]);if(t.filters&&t.filters.length>0)for(let e of t.filters){let t=this.processFilter(e,a,n,`having`,r);t&&i.push(t)}return i}processFilter(e,t,n,r,i){if(`and`in e||`or`in e){let a=e;if(a.and){let e=a.and.map(e=>this.processFilter(e,t,n,r,i)).filter(e=>e!==null);return e.length>0?(0,u.and)(...e):null}if(a.or){let e=a.or.map(e=>this.processFilter(e,t,n,r,i)).filter(e=>e!==null);return e.length>0?(0,u.or)(...e):null}}let a=e,[o,s]=a.member.split(`.`),c=t.get(o);if(!c)return null;let l=c.dimensions[s],d=c.measures[s],f=l||d;if(!f)return null;if(r===`where`&&l){if(i?.preAggregationCTEs&&i.preAggregationCTEs.some(e=>e.cube.name===o))return null;let t=l.type===`time`;if(n.filterCache){let t=Ae(e),r=n.filterCache.get(t);if(r)return r}let r=t?A(l.sql,n):typeof l.sql==`function`?l.sql(n):l.sql;return this.buildFilterCondition(r,a.operator,a.values,f,a.dateRange)}else if(r===`where`&&d)return null;else if(r===`having`&&d){let e=this.buildHavingMeasureExpression(o,s,d,n,i);return this.buildFilterCondition(e,a.operator,a.values,f,a.dateRange)}return null}buildFilterCondition(e,t,n,r,i){return this.filterBuilder.buildFilterCondition(e,t,n,r,i)}buildDateRangeCondition(e,t){return this.dateTimeBuilder.buildDateRangeCondition(e,t)}buildGroupByFields(e,t,n,r){return this.groupByBuilder.buildGroupByFields(e,t,n,r)}buildOrderBy(e,t){let n=[],r=t||[...e.measures||[],...e.dimensions||[],...e.timeDimensions?.map(e=>e.dimension)||[]];if(e.order&&Object.keys(e.order).length>0)for(let[t,i]of Object.entries(e.order)){if(!r.includes(t))throw Error(`Cannot order by '${t}': field is not selected in the query`);let e=i===`desc`?(0,u.desc)(u.sql.identifier(t)):(0,u.asc)(u.sql.identifier(t));n.push(e)}if(e.timeDimensions&&e.timeDimensions.length>0){let t=new Set(Object.keys(e.order||{})),r=[...e.timeDimensions].sort((e,t)=>e.dimension.localeCompare(t.dimension));for(let e of r)t.has(e.dimension)||n.push((0,u.asc)(u.sql.identifier(e.dimension)))}return n}collectNumericFields(e,t){let n=[],r=e instanceof Map?e:new Map([[e.name,e]]);if(t.measures&&n.push(...t.measures),t.dimensions)for(let e of t.dimensions){let[t,i]=e.split(`.`),a=r.get(t);if(a){let t=a.dimensions[i];t&&t.type===`number`&&n.push(e)}}return n}applyLimitAndOffset(e,t){let n=t.limit;t.offset!==void 0&&t.offset>0&&n===void 0&&(n=50);let r=e;if(n!==void 0){if(n<0)throw Error(`Limit must be non-negative`);r=r.limit(n)}if(t.offset!==void 0){if(t.offset<0)throw Error(`Offset must be non-negative`);r=r.offset(t.offset)}return r}buildFilterConditionPublic(e,t,n,r,i){return this.buildFilterCondition(e,t,n,r,i)}buildLogicalFilter(e,t,n){return this.filterBuilder.buildLogicalFilter(e,t,n)}},$e=class{cubes;connectivityCache=new Map;reverseIndex;constructor(e){this.cubes=e,this.reverseIndex=this.buildReverseIndex()}buildReverseIndex(){let e=new Map;for(let[t,n]of this.cubes)if(n.joins)for(let[,r]of Object.entries(n.joins)){if(r.relationship===`belongsToMany`)continue;let n=k(r.targetCube,this.cubes);if(!n)continue;let i=n.name,a=e.get(i);a||(a=[],e.set(i,a)),a.push({definingCube:t,joinDef:r})}return e}findPath(e,t,n=new Set){if(e===t)return[];let r=this.getCacheKey(e,t,n),i=this.getFromCache(r);if(i!==void 0)return i;let a=[{cube:e,path:[]}],o=new Set([e,...n]);for(;a.length>0;){let{cube:e,path:n}=a.shift(),i=this.cubes.get(e);if(i?.joins)for(let[,s]of Object.entries(i.joins)){let i=k(s.targetCube,this.cubes);if(!i)continue;let c=i.name;if(o.has(c))continue;let l=[...n,{fromCube:e,toCube:c,joinDef:s}];if(c===t)return this.setInCache(r,l),l;o.add(c),a.push({cube:c,path:l})}let s=this.reverseIndex.get(e)||[];for(let{definingCube:i,joinDef:c}of s){if(o.has(i))continue;let s=[...n,{fromCube:e,toCube:i,joinDef:c,reversed:!0}];if(i===t)return this.setInCache(r,s),s;o.add(i),a.push({cube:i,path:s})}}return this.setInCache(r,null),null}findPathPreferring(e,t,n,r=new Set){return this.findPathPreferringDetailed(e,t,n,r).selectedPath}findPathPreferringDetailed(e,t,n,r=new Set){let i=this.findAllPaths(e,t,new Set);if(i.length===0){let i=this.findPath(e,t,r),a=i?[{path:i,score:0,usesPreferredJoin:!1,preferredCubesInPath:0,usesProcessed:i.some(e=>r.has(e.toCube)),scoreBreakdown:{preferredJoinBonus:0,preferredCubeBonus:0,lengthPenalty:0}}]:[];return{strategy:`fallbackShortest`,preferredCubes:Array.from(n).sort(),selectedIndex:i?0:-1,candidates:a,selectedPath:i}}let a=i.map(i=>{let a=0,o=i.some((n,r)=>r===0?n.reversed?n.joinDef.preferredFor?.includes(e)??!1:n.joinDef.preferredFor?.includes(t)??!1:!1);o&&(a=10);let s=i.filter(e=>n.has(e.toCube)).length,c=s,l=i.length-1;return{path:i,score:a+c-l,usesPreferredJoin:o,preferredCubesInPath:s,usesProcessed:i.some(e=>r.has(e.toCube)),scoreBreakdown:{preferredJoinBonus:a,preferredCubeBonus:c,lengthPenalty:l}}});return a.sort((e,t)=>t.score===e.score?e.usesProcessed===t.usesProcessed?e.path.length-t.path.length:e.usesProcessed?-1:1:t.score-e.score),{strategy:`preferred`,preferredCubes:Array.from(n).sort(),selectedIndex:a.length>0?0:-1,candidates:a,selectedPath:a[0]?.path??null}}findAllPaths(e,t,n,r=4){if(e===t)return[[]];let i=[],a=[{cube:e,path:[],visited:new Set([e,...n])}];for(;a.length>0;){let{cube:e,path:n,visited:o}=a.shift();if(n.length>=r)continue;let s=this.cubes.get(e);if(s?.joins)for(let[,r]of Object.entries(s.joins)){let s=k(r.targetCube,this.cubes);if(!s)continue;let c=s.name;if(o.has(c))continue;let l=[...n,{fromCube:e,toCube:c,joinDef:r}];if(c===t)i.push(l);else{let e=new Set(o);e.add(c),a.push({cube:c,path:l,visited:e})}}let c=this.reverseIndex.get(e)||[];for(let{definingCube:r,joinDef:s}of c){if(o.has(r))continue;let c=[...n,{fromCube:e,toCube:r,joinDef:s,reversed:!0}];if(r===t)i.push(c);else{let e=new Set(o);e.add(r),a.push({cube:r,path:c,visited:e})}}}return i}canReachAll(e,t){let n=t.filter(t=>t!==e);for(let t of n){let n=this.findForwardOnlyPath(e,t,new Set);if(!n||n.length===0)return!1}return!0}findForwardOnlyPath(e,t,n){if(e===t)return[];let r=[{cube:e,path:[]}],i=new Set([e,...n]);for(;r.length>0;){let{cube:e,path:n}=r.shift(),a=this.cubes.get(e);if(a?.joins)for(let[,o]of Object.entries(a.joins)){let a=k(o.targetCube,this.cubes);if(!a)continue;let s=a.name;if(i.has(s))continue;let c=[...n,{fromCube:e,toCube:s,joinDef:o}];if(s===t)return c;i.add(s),r.push({cube:s,path:c})}}return null}buildJoinCondition(e,t,n){let r=[];for(let i of e.on){let e=t?u.sql`${u.sql.identifier(t)}.${u.sql.identifier(i.source.name)}`:Te(i.source),a=n?u.sql`${u.sql.identifier(n)}.${u.sql.identifier(i.target.name)}`:Te(i.target),o=i.as||u.eq;r.push(o(e,a))}return(0,u.and)(...r)}getReachableCubes(e){let t=new Set([e]),n=[e];for(;n.length>0;){let e=n.shift(),r=this.cubes.get(e);if(r?.joins)for(let[,e]of Object.entries(r.joins)){let r=k(e.targetCube,this.cubes);if(!r)continue;let i=r.name;t.has(i)||(t.add(i),n.push(i))}let i=this.reverseIndex.get(e)||[];for(let{definingCube:e}of i)t.has(e)||(t.add(e),n.push(e))}return t}getCacheKey(e,t,n){return`${e}:${t}:${Array.from(n).sort().join(`,`)}`}getFromCache(e){let t=this.connectivityCache.get(e);if(t)return t.path}setInCache(e,t){this.connectivityCache.set(e,{path:t})}},et=class{resolverCache=new WeakMap;getResolver(e){let t=this.resolverCache.get(e);return t||(t=new $e(e),this.resolverCache.set(e,t)),t}analyzeCubeUsage(e){let t=new Set;if(e.measures)for(let n of e.measures){let[e]=n.split(`.`);t.add(e)}if(e.dimensions)for(let n of e.dimensions){let[e]=n.split(`.`);t.add(e)}if(e.timeDimensions)for(let n of e.timeDimensions){let[e]=n.dimension.split(`.`);t.add(e)}if(e.filters)for(let n of e.filters)this.extractCubeNamesFromFilter(n,t);if(e.order)for(let n of Object.keys(e.order)){let[e]=n.split(`.`);e&&t.add(e)}return t}collectPathHintCubes(e){return this.analyzeCubeUsage(e)}extractCubeNamesFromFilter(e,t){if(`and`in e||`or`in e){let n=e.and||e.or||[];for(let e of n)this.extractCubeNamesFromFilter(e,t);return}if(`member`in e){let[n]=e.member.split(`.`);n&&t.add(n)}}extractMeasuresFromFilters(e,t){let n=[];if(!e.filters)return n;for(let r of e.filters)this.extractMeasuresFromFilter(r,t,n);return n}extractMeasuresFromFilter(e,t,n){if(`and`in e||`or`in e){let r=e.and||e.or||[];for(let e of r)this.extractMeasuresFromFilter(e,t,n);return}if(`member`in e){let r=e.member,[i,a]=r.split(`.`);i===t.name&&t.measures&&t.measures[a]&&n.push(r)}}choosePrimaryCube(e,t,n){return e.length===1?e[0]:n?this.analyzePrimaryCubeSelection(e,t,n).selectedCube:[...e].sort()[0]}analyzePrimaryCube(e,t,n){return this.analyzePrimaryCubeSelection(e,t,n)}analyzeJoinPathForTarget(e,t,n,r){return this.analyzeJoinPath(e,t,n,r)}buildJoinPlanForPrimary(e,t,n,r,i){return this.buildJoinPlan(e,t,n,r,i)}buildPreAggregationCTEs(e,t,n,r,i){return this.planPreAggregationCTEs(e,t,n,r,i)}buildWarnings(e,t){return this.generateWarnings(e,t)}buildJoinPlan(e,t,n,r,i){let a=this.getResolver(e),o=[],s=new Set([t.name]),c=new Set;if(i.measures)for(let e of i.measures){let[t]=e.split(`.`);c.add(t)}let l=this.collectPathHintCubes(i),u=new Set;for(let n of c)n!==t.name&&this.findHasManyJoinDef(t,n,e)&&u.add(n);let d=n.filter(e=>e!==t.name);for(let n of d){if(s.has(n))continue;let i=new Set([...s].filter(e=>!u.has(e))),c=a.findPathPreferring(t.name,n,l,i);if(!c||c.length===0)throw Error(N(`server.errors.noJoinPath`,{fromCube:t.name,toCube:n}));for(let{fromCube:t,toCube:n,joinDef:i,reversed:l}of c){if(s.has(n))continue;let c=e.get(n);if(!c)throw Error(N(`server.errors.cubeNotFound`,{cubeName:n}));let u=l?Ce(i.relationship):i.relationship;if(u===`belongsToMany`&&i.through){let e=ke(i,r.securityContext);o.push({cube:c,alias:`${n.toLowerCase()}_cube`,joinType:e.junctionJoins[1].joinType,joinCondition:e.junctionJoins[1].condition,relationship:`belongsToMany`,junctionTable:{table:i.through.table,alias:`junction_${n.toLowerCase()}`,joinType:e.junctionJoins[0].joinType,joinCondition:e.junctionJoins[0].condition,securitySql:i.through.securitySql,sourceCubeName:t}})}else{let e=a.buildJoinCondition(i,null,null),t=we(u,i.sqlJoinType);o.push({cube:c,alias:`${n.toLowerCase()}_cube`,joinType:t,joinCondition:e,relationship:u})}s.add(n)}}return o}planPreAggregationCTEs(e,t,n,r,i){let a=[];if(!r.measures||r.measures.length===0)return a;let o=this.computeCTEReasons(t,n,r);if(o.size===0)return a;for(let s of n){let n=o.get(s.cube.name);if(!n)continue;let c=s.cube,l=s.alias,u=r.measures.filter(e=>e.startsWith(c.name+`.`)),d=this.extractMeasuresFromFilters(r,c),f=[...new Set([...u,...d])];if(f.length===0)continue;let p=this.analyzeJoinPathToPrimary(e,t,c.name,i,r),m,h;if(p?.hasIntermediateHasMany&&p.intermediateJoins.length>0)m=p.correctJoinKeys,h=p.intermediateJoins;else{let n=(p?.path&&p.path.length>0?(()=>{let t=p.path[p.path.length-1],n=e.get(t.fromCube);return n?{sourceCube:n,joinDef:t.joinDef,reversed:t.reversed}:null})():null)??this.findJoinInfoForCube(e,t,c.name);if(!n)continue;m=n.joinDef.relationship===`belongsToMany`&&n.joinDef.through?n.sourceCube?.name===t.name&&!(`reversed`in n&&n.reversed)?n.joinDef.through.targetKey.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name,sourceColumnObj:e.source,targetColumnObj:e.target})):n.joinDef.through.sourceKey.map(e=>({sourceColumn:e.target.name,targetColumn:e.source.name,sourceColumnObj:e.target,targetColumnObj:e.source})):`reversed`in n&&n.reversed?n.joinDef.on.map(e=>({sourceColumn:e.target.name,targetColumn:e.source.name,sourceColumnObj:e.target,targetColumnObj:e.source})):n.joinDef.on.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name,sourceColumnObj:e.source,targetColumnObj:e.target})),h=void 0}let g=this.findPropagatingFilters(r,c,e),_=new Map([[c.name,c]]),{aggregateMeasures:v,requiredBaseMeasures:y}=P.categorizeForPostAggregation(f,_),b=[...new Set([...v,...Array.from(y).filter(e=>e.startsWith(c.name+`.`))])];if(b.length>0){let t=this.expandCalculatedMeasureDependencies(c,b),i=this.findDownstreamJoinKeys(c,r,e);a.push({cube:c,alias:l,cteAlias:`${c.name.toLowerCase()}_agg`,joinKeys:m,measures:t,propagatingFilters:g.length>0?g:void 0,downstreamJoinKeys:i.length>0?i:void 0,intermediateJoins:h&&h.length>0?h:void 0,cteType:`aggregate`,cteReason:n})}}return a}findJoinInfoToCube(e,t){for(let[,n]of e)if(n.name!==t&&n.joins)for(let[,r]of Object.entries(n.joins)){let i=k(r.targetCube,e);if(i&&i.name===t)return{sourceCube:n,joinDef:r}}return null}analyzeJoinPathToPrimary(e,t,n,r,i){let a=this.getResolver(e),o=this.collectPathHintCubes(i),s=o.size>0?a.findPathPreferring(t.name,n,o,new Set):a.findPath(t.name,n);if(!s||s.length===0)return null;let c=s.map(e=>({fromCube:e.fromCube,toCube:e.toCube,joinDef:e.joinDef,reversed:e.reversed}));if(!c.slice(0,-1).some(e=>(e.reversed?Ce(e.joinDef.relationship):e.joinDef.relationship)===`hasMany`))return{path:c,hasIntermediateHasMany:!1,intermediateJoins:[],correctJoinKeys:[]};let l=[];for(let t=0;t<c.length-1;t++){let n=c[t],i=c[t+1],a=e.get(n.toCube);if(!a)continue;let o=a.sql(r).where,s=i.joinDef.on[0]?.source,u=n.joinDef.on[0]?.target;l.push({cube:a,joinDef:i.joinDef,securityFilter:o,primaryJoinColumn:u,cteJoinColumn:s})}return{path:c,hasIntermediateHasMany:!0,intermediateJoins:l,correctJoinKeys:c[0].joinDef.on.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name,sourceColumnObj:e.source,targetColumnObj:e.target}))}}computeCTEReasons(e,t,n){let r=new Map,i=new Set,a=new Set,o=new Set;if(n.measures)for(let e of n.measures){let[t]=e.split(`.`);o.add(t)}for(let e of t)e.relationship===`hasMany`||e.relationship===`belongsToMany`?i.add(e.cube.name):e.relationship===`belongsTo`&&o.has(e.cube.name)&&a.add(e.cube.name);if(i.size===0&&a.size===0)return r;for(let e of t)o.has(e.cube.name)&&(i.has(e.cube.name)?r.set(e.cube.name,`hasMany`):(a.has(e.cube.name)||i.size>0)&&r.set(e.cube.name,`fanOutPrevention`));return r}findJoinInfoForCube(e,t,n){if(t.joins)for(let[,r]of Object.entries(t.joins)){let i=k(r.targetCube,e);if(i&&i.name===n)return{sourceCube:t,joinDef:r}}let r=e.get(n);if(r?.joins)for(let[,n]of Object.entries(r.joins)){let i=k(n.targetCube,e);if(i&&i.name===t.name)return{sourceCube:r,joinDef:n,reversed:!0}}for(let[,r]of e)if(!(r.name===t.name||r.name===n)&&r.joins)for(let[,t]of Object.entries(r.joins)){let i=k(t.targetCube,e);if(i&&i.name===n)return{sourceCube:r,joinDef:t}}return null}findDownstreamJoinKeys(e,t,n){let r=[],i=new Set;if(t.dimensions)for(let n of t.dimensions){let[t]=n.split(`.`);t!==e.name&&i.add(t)}if(t.timeDimensions)for(let n of t.timeDimensions){let[t]=n.dimension.split(`.`);t!==e.name&&i.add(t)}if(t.filters){for(let e of t.filters)this.extractCubeNamesFromFilter(e,i);i.delete(e.name)}if(e.joins)for(let[,t]of Object.entries(e.joins)){let e=k(t.targetCube,n);if(!e)continue;let a=e.name;if(i.has(a)){let e;e=t.relationship===`belongsToMany`&&t.through?t.through.sourceKey.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name,sourceColumnObj:e.source,targetColumnObj:e.target})):t.on.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name,sourceColumnObj:e.source,targetColumnObj:e.target})),r.push({targetCubeName:a,joinKeys:e})}}return r}expandCalculatedMeasureDependencies(e,t){let n=new Set,r=[...t];for(;r.length>0;){let t=r.pop();if(n.has(t))continue;n.add(t);let[,i]=t.split(`.`);if(!e.measures||!e.measures[i])continue;let a=e.measures[i];if(a.type===`calculated`&&a.calculatedSql){let t=this.extractDependenciesFromTemplate(a.calculatedSql,e.name);for(let e of t)n.has(e)||r.push(e)}}return Array.from(n)}extractDependenciesFromTemplate(e,t){if(e.length>1e3)return[];let n=e.matchAll(/\{([^}]+)\}/g),r=[];for(let e of n){let n=e[1].trim();n.includes(`.`)?r.push(n):r.push(`${t}.${n}`)}return r}findHasManyJoinDef(e,t,n){if(!e.joins)return null;for(let[,r]of Object.entries(e.joins)){let e=k(r.targetCube,n);if(e&&e.name===t&&r.relationship===`hasMany`)return r}return null}findPropagatingFilters(e,t,n){let r=[];if(!e.filters)return r;let i=new Set;if(this.extractFilterCubeNamesToSet(e.filters,i),e.timeDimensions){for(let t of e.timeDimensions)if(t.dateRange){let[e]=t.dimension.split(`.`);e&&i.add(e)}}for(let a of i){if(a===t.name)continue;let i=n.get(a);if(i?.joins)for(let[,o]of Object.entries(i.joins)){let s=k(o.targetCube,n);if(s&&s.name===t.name&&o.relationship===`hasMany`){let t=this.extractFiltersForCube(e.filters,a),n=this.extractTimeDimensionFiltersForCube(e,a),s=[...t,...n];s.length>0&&o.on.length>0&&r.push({sourceCube:i,filters:s,joinConditions:o.on.map(e=>({source:e.source,target:e.target}))})}}}return r}extractFilterCubeNamesToSet(e,t){for(let n of e){if(`and`in n||`or`in n){let e=n.and||n.or||[];this.extractFilterCubeNamesToSet(e,t);continue}if(`member`in n){let[e]=n.member.split(`.`);e&&t.add(e)}}}extractFiltersForCube(e,t){let n=[];for(let r of e){if(`and`in r){let e=this.extractFiltersForCube(r.and||[],t);e.length>0&&n.push({and:e});continue}if(`or`in r){let e=r.or||[];if(this.allFiltersFromCube(e,t)){let r=this.extractFiltersForCube(e,t);r.length>0&&n.push({or:r})}continue}if(`member`in r){let[e]=r.member.split(`.`);e===t&&n.push(r)}}return n}allFiltersFromCube(e,t){for(let n of e){if(`and`in n){if(!this.allFiltersFromCube(n.and||[],t))return!1;continue}if(`or`in n){if(!this.allFiltersFromCube(n.or||[],t))return!1;continue}if(`member`in n){let[e]=n.member.split(`.`);if(e!==t)return!1}}return!0}extractTimeDimensionFiltersForCube(e,t){let n=[];if(!e.timeDimensions)return n;for(let r of e.timeDimensions){let[e]=r.dimension.split(`.`);e===t&&r.dateRange&&n.push({member:r.dimension,operator:`inDateRange`,values:Array.isArray(r.dateRange)?r.dateRange:[r.dateRange]})}return n}analyzePrimaryCubeSelection(e,t,n){if(e.length===1)return{selectedCube:e[0],reason:`single_cube`,explanation:`Only one cube is used in this query`};let r=[],i=(t.dimensions||[]).map(e=>e.split(`.`)[0]),a=new Map;for(let e of i)a.set(e,(a.get(e)||0)+1);let o=this.getResolver(n);for(let t of e){let i=n.get(t),s=a.get(t)||0,c=i?.joins?Object.keys(i.joins).length:0,l=o.canReachAll(t,e);r.push({cubeName:t,dimensionCount:s,joinCount:c,canReachAll:l})}if(t.dimensions&&t.dimensions.length>0){let e=Math.max(...r.map(e=>e.dimensionCount));if(e>0){let t=r.filter(t=>t.dimensionCount===e).sort((e,t)=>e.cubeName.localeCompare(t.cubeName));for(let e of t)if(e.canReachAll)return{selectedCube:e.cubeName,reason:`most_dimensions`,explanation:`Selected because it has ${e.dimensionCount} dimension${e.dimensionCount===1?``:`s`} in the query (defines the analytical grain)`,candidates:r}}}let s=r.filter(e=>e.canReachAll);if(s.length>0){let e=Math.max(...s.map(e=>e.joinCount)),t=s.filter(t=>t.joinCount===e).sort((e,t)=>e.cubeName.localeCompare(t.cubeName))[0];return{selectedCube:t.cubeName,reason:`most_connected`,explanation:`Selected because it has ${t.joinCount} join relationship${t.joinCount===1?``:`s`} and can reach all other cubes`,candidates:r}}return{selectedCube:[...e].sort()[0],reason:`alphabetical_fallback`,explanation:`Selected alphabetically as fallback (no cube could reach all others)`,candidates:r}}analyzeJoinPath(e,t,n,r){let i=this.getResolver(e),a=r?this.collectPathHintCubes(r):new Set,o=a.size>0?i.findPathPreferringDetailed(t,n,a):null,s=o?.selectedPath??i.findPath(t,n),c=[t];if(s)for(let e of s)c.push(e.toCube);if(!s||s.length===0)return{targetCube:n,pathFound:!1,error:`No join path found from '${t}' to '${n}'. Ensure the target cube has a relationship defined (belongsTo, hasOne, hasMany, or belongsToMany).`,visitedCubes:c,selection:this.buildJoinPathSelectionAnalysis(o)};let l=this.convertInternalPathToJoinPathSteps(s);return{targetCube:n,pathFound:!0,path:l,pathLength:l.length,visitedCubes:c,selection:this.buildJoinPathSelectionAnalysis(o)}}convertInternalPathToJoinPathSteps(e){return e.map(e=>{let t=e.reversed?Ce(e.joinDef.relationship):e.joinDef.relationship,n=we(t,e.joinDef.sqlJoinType),r=e.joinDef.on.map(e=>({sourceColumn:e.source.name,targetColumn:e.target.name})),i={fromCube:e.fromCube,toCube:e.toCube,relationship:t,joinType:n,joinColumns:r};if(e.reversed&&(i.reversed=!0),t===`belongsToMany`&&e.joinDef.through){let t=e.joinDef.through;i.junctionTable={tableName:t.table[Symbol.for(`drizzle:Name`)]||`junction_table`,sourceColumns:t.sourceKey.map(e=>e.target.name),targetColumns:t.targetKey.map(e=>e.source.name)}}return i})}buildJoinPathSelectionAnalysis(e){if(!e)return{strategy:`shortest`};let t=e.candidates.map((e,t)=>this.mapPreferredCandidate(e,t+1));return{strategy:e.strategy,preferredCubes:e.preferredCubes,selectedRank:e.selectedIndex>=0?e.selectedIndex+1:void 0,selectedScore:e.selectedIndex>=0?e.candidates[e.selectedIndex]?.score:void 0,candidates:t}}mapPreferredCandidate(e,t){return{rank:t,score:e.score,usesPreferredJoin:e.usesPreferredJoin,preferredCubesInPath:e.preferredCubesInPath,usesProcessed:e.usesProcessed,scoreBreakdown:e.scoreBreakdown,path:this.convertInternalPathToJoinPathSteps(e.path)}}generateWarnings(e,t){let n=[],r=this.checkFanOutNoDimensions(e,t);return r&&n.push(r),n}checkFanOutNoDimensions(e,t){if(!t||t.length===0||!e.measures||e.measures.length===0)return null;let n=new Set;for(let t of e.measures){let[e]=t.split(`.`);n.add(e)}if(n.size<2)return null;let r=e.dimensions&&e.dimensions.length>0,i=e.timeDimensions?.some(e=>e.granularity);return r||i?null:{code:`FAN_OUT_NO_DIMENSIONS`,message:`Query combines measures from multiple cubes with hasMany relationships but has no dimensions. Results are aggregated at the join key level, which may produce unexpected totals.`,severity:`warning`,cubes:[...n].sort(),measures:e.measures,suggestion:`Add a dimension to see per-group breakdowns, or add a time dimension with granularity.`}}};function tt(e,t){if(!t.joins)return e;for(let n of t.joins)switch(n.type||`left`){case`left`:e=e.leftJoin(n.table,n.on);break;case`inner`:e=e.innerJoin(n.table,n.on);break;case`right`:e=e.rightJoin(n.table,n.on);break;case`full`:e=e.fullJoin(n.table,n.on);break}return e}var nt=class{constructor(e){this.queryBuilder=e}buildPreAggregationCTE(e,t,n,r,i){let a=e.cube,o=a.sql(n),s=e.intermediateJoins&&e.intermediateJoins.length>0,c={};if(s&&e.intermediateJoins){let t=e.intermediateJoins[0].primaryJoinColumn;if(t){let e=t.name;c[e]=t}}else for(let t of e.joinKeys)if(t.targetColumnObj){c[t.targetColumn]=t.targetColumnObj;for(let[e,n]of Object.entries(a.dimensions||{}))n.sql===t.targetColumnObj&&e!==t.targetColumn&&(c[e]=u.sql`${t.targetColumnObj}`.as(e))}if(e.downstreamJoinKeys)for(let t of e.downstreamJoinKeys)for(let e of t.joinKeys)e.sourceColumnObj&&(c[e.sourceColumn]=e.sourceColumnObj);let l=a.name,d=new Map([[l,a]]),f=this.queryBuilder.buildResolvedMeasures(e.measures,d,n);for(let t of e.measures){let[,e]=t.split(`.`),n=f.get(t);n&&(c[e]=u.sql`${n()}`.as(e))}if(t.dimensions)for(let e of t.dimensions){let[t,r]=e.split(`.`);if(t===l&&a.dimensions&&a.dimensions[r]){let e=a.dimensions[r];c[r]=u.sql`${this.queryBuilder.buildMeasureExpression({sql:e.sql,type:`number`},n)}`.as(r)}}if(t.timeDimensions)for(let e of t.timeDimensions){let[t,r]=e.dimension.split(`.`);if(t===l&&a.dimensions&&a.dimensions[r]){let t=a.dimensions[r];c[r]=u.sql`${this.queryBuilder.buildTimeDimensionExpression(t.sql,e.granularity,n)}`.as(r)}}if(Object.keys(c).length===0)return null;let p=n.db.select(c).from(o.from);if(p=tt(p,o),s&&e.intermediateJoins){let t=[...e.intermediateJoins].reverse();for(let e of t){let t=e.cube.sql(n),r=[(0,u.eq)(e.cteJoinColumn,e.joinDef.on[0]?.target)];e.securityFilter&&r.push(e.securityFilter),p=p.leftJoin(t.from,(0,u.and)(...r))}}let m=r?{...r,preAggregationCTEs:r.preAggregationCTEs?.filter(e=>e.cube.name!==a.name)}:void 0,h=this.queryBuilder.buildWhereConditions(a,t,n,m,i),g=[];if(t.timeDimensions)for(let e of t.timeDimensions){let[t,r]=e.dimension.split(`.`);if(t===l&&a.dimensions&&a.dimensions[r]&&e.dateRange){let t=a.dimensions[r],i=this.queryBuilder.buildMeasureExpression({sql:t.sql,type:`number`},n),o=this.queryBuilder.buildDateRangeCondition(i,e.dateRange);o&&g.push(o)}}if(t.filters){for(let e of t.filters)if(!(`and`in e)&&!(`or`in e)&&`member`in e&&`operator`in e){let t=e,[r,i]=t.member.split(`.`);if(r===l&&a.dimensions&&a.dimensions[i]){let e=a.dimensions[i];if(t.operator===`inDateRange`){let r=this.queryBuilder.buildMeasureExpression({sql:e.sql,type:`number`},n),i=this.queryBuilder.buildDateRangeCondition(r,t.values);i&&g.push(i)}}}}if(e.propagatingFilters&&e.propagatingFilters.length>0)for(let t of e.propagatingFilters){let e=this.buildPropagatingFilterSubquery(t,n);e&&g.push(e)}let _=[];if(o.where&&_.push(o.where),_.push(...h,...g),_.length>0){let e=_.length===1?_[0]:(0,u.and)(..._);p=p.where(e)}let v=[],y=new Set,b=e=>{let t=e?.name||(typeof e==`string`?e:null);t&&!y.has(t)?(y.add(t),v.push(e)):t||v.push(e)};if(s&&e.intermediateJoins){let t=e.intermediateJoins[0];t.primaryJoinColumn&&b(t.primaryJoinColumn)}else for(let t of e.joinKeys)t.targetColumnObj&&b(t.targetColumnObj);if(e.downstreamJoinKeys)for(let t of e.downstreamJoinKeys)for(let e of t.joinKeys)e.sourceColumnObj&&b(e.sourceColumnObj);if(t.dimensions)for(let e of t.dimensions){let[t,r]=e.split(`.`);if(t===l&&a.dimensions&&a.dimensions[r]){let e=a.dimensions[r],t=A(e.sql,n);v.push(t)}}if(t.timeDimensions)for(let e of t.timeDimensions){let[t,r]=e.dimension.split(`.`);if(t===l&&a.dimensions&&a.dimensions[r]){let t=a.dimensions[r],i=this.queryBuilder.buildTimeDimensionExpression(t.sql,e.granularity,n);v.push(i)}}return v.length>0&&(p=p.groupBy(...v)),n.db.$with(e.cteAlias).as(p)}buildCTEJoinCondition(e,t,n){let r=n.preAggregationCTEs?.find(t=>t.cube.name===e.cube.name);if(!r)throw Error(`CTE info not found for cube ${e.cube.name}`);let i=[];if(r.intermediateJoins&&r.intermediateJoins.length>0){let e=r.intermediateJoins[0],a=this.resolveCTEJoinSourceColumn(r.joinKeys[0],r,n),o=u.sql`${u.sql.identifier(t)}.${u.sql.identifier(e.primaryJoinColumn.name)}`;i.push((0,u.eq)(a,o))}else for(let e of r.joinKeys){let a=this.resolveCTEJoinSourceColumn(e,r,n),o=u.sql`${u.sql.identifier(t)}.${u.sql.identifier(e.targetColumn)}`;i.push((0,u.eq)(a,o))}return i.length===1?i[0]:(0,u.and)(...i)}resolveCTEJoinSourceColumn(e,t,n){if(!e)throw Error(`Missing join key while building CTE join condition for '${t.cube.name}'`);let r=e.sourceColumnObj||u.sql.identifier(e.sourceColumn);if(!e.sourceColumnObj||!n.preAggregationCTEs)return r;for(let r of n.preAggregationCTEs)if(r.cube.name!==t.cube.name){for(let[t,n]of Object.entries(r.cube.dimensions||{}))if(typeof n.sql!=`function`&&n.sql===e.sourceColumnObj)return u.sql`${u.sql.identifier(r.cteAlias)}.${u.sql.identifier(t)}`}return r}buildPropagatingFilterSubquery(e,t){let n=e.sourceCube,r=n.sql(t),i=[];if(r.where&&i.push(r.where),e.preBuiltFilterSQL)i.push(e.preBuiltFilterSQL);else{let r={filters:e.filters},a=new Map([[n.name,n]]),o=this.queryBuilder.buildWhereConditions(a,r,t);i.push(...o)}if(i.length===0)return null;let a=i.length===1?i[0]:(0,u.and)(...i),o=e.joinConditions;if(o.length===1){let{source:e,target:n}=o[0],i=t.db.select({pk:e}).from(r.from);return i=tt(i,r),i=i.where(a),u.sql`${n} IN ${i}`}else{let e=(0,u.and)(...o.map(e=>(0,u.eq)(e.source,e.target)),a),n=t.db.select({one:u.sql`1`}).from(r.from);return n=tt(n,r),n=n.where(e),u.sql`EXISTS ${n}`}}};function rt(e){let t=new Date,n=e.toLowerCase().trim(),r=t.getUTCFullYear(),i=t.getUTCMonth(),a=t.getUTCDate(),o=t.getUTCDay();if(n===`today`){let e=new Date(t);e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`yesterday`){let e=new Date(t);e.setUTCDate(a-1),e.setUTCHours(0,0,0,0);let n=new Date(t);return n.setUTCDate(a-1),n.setUTCHours(23,59,59,999),{start:e,end:n}}if(n===`this week`){let e=o===0?-6:1-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`this month`)return{start:new Date(Date.UTC(r,i,1,0,0,0,0)),end:new Date(Date.UTC(r,i+1,0,23,59,59,999))};if(n===`this quarter`){let e=Math.floor(i/3);return{start:new Date(Date.UTC(r,e*3,1,0,0,0,0)),end:new Date(Date.UTC(r,e*3+3,0,23,59,59,999))}}if(n===`this year`)return{start:new Date(Date.UTC(r,0,1,0,0,0,0)),end:new Date(Date.UTC(r,11,31,23,59,59,999))};let s=n.match(/^last\s+(\d+)\s+days?$/);if(s){let e=parseInt(s[1],10),n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}let c=n.match(/^last\s+(\d+)\s+weeks?$/);if(c){let e=parseInt(c[1],10)*7,n=new Date(t);n.setUTCDate(a-e+1),n.setUTCHours(0,0,0,0);let r=new Date(t);return r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last week`){let e=o===0?-13:-6-o,n=new Date(t);n.setUTCDate(a+e),n.setUTCHours(0,0,0,0);let r=new Date(n);return r.setUTCDate(n.getUTCDate()+6),r.setUTCHours(23,59,59,999),{start:n,end:r}}if(n===`last month`)return{start:new Date(Date.UTC(r,i-1,1,0,0,0,0)),end:new Date(Date.UTC(r,i,0,23,59,59,999))};if(n===`last quarter`){let e=Math.floor(i/3),t=e===0?3:e-1,n=e===0?r-1:r;return{start:new Date(Date.UTC(n,t*3,1,0,0,0,0)),end:new Date(Date.UTC(n,t*3+3,0,23,59,59,999))}}if(n===`last year`)return{start:new Date(Date.UTC(r-1,0,1,0,0,0,0)),end:new Date(Date.UTC(r-1,11,31,23,59,59,999))};if(n===`last 12 months`){let e=new Date(Date.UTC(r,i-11,1,0,0,0,0)),n=new Date(t);return n.setUTCHours(23,59,59,999),{start:e,end:n}}let l=n.match(/^last\s+(\d+)\s+months?$/);if(l){let e=parseInt(l[1],10),n=new Date(Date.UTC(r,i-e+1,1,0,0,0,0)),a=new Date(t);return a.setUTCHours(23,59,59,999),{start:n,end:a}}let u=n.match(/^last\s+(\d+)\s+years?$/);if(u){let e=parseInt(u[1],10),n=new Date(Date.UTC(r-e,0,1,0,0,0,0)),i=new Date(t);return i.setUTCHours(23,59,59,999),{start:n,end:i}}return null}function it(e,t,n){let r=[],i=at(new Date(e),n),a=at(new Date(t),n);for(;i<=a&&r.length<1e4;)r.push(new Date(i)),i=ot(i,n);return r}function at(e,t){let n=new Date(e);switch(t){case`second`:n.setUTCMilliseconds(0);break;case`minute`:n.setUTCSeconds(0,0);break;case`hour`:n.setUTCMinutes(0,0,0);break;case`day`:n.setUTCHours(0,0,0,0);break;case`week`:{let e=n.getUTCDay(),t=e===0?6:e-1;n.setUTCDate(n.getUTCDate()-t),n.setUTCHours(0,0,0,0);break}case`month`:n.setUTCDate(1),n.setUTCHours(0,0,0,0);break;case`quarter`:{let e=Math.floor(n.getUTCMonth()/3)*3;n.setUTCMonth(e,1),n.setUTCHours(0,0,0,0);break}case`year`:n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0);break}return n}function ot(e,t){let n=new Date(e);switch(t){case`second`:n.setUTCSeconds(n.getUTCSeconds()+1);break;case`minute`:n.setUTCMinutes(n.getUTCMinutes()+1);break;case`hour`:n.setUTCHours(n.getUTCHours()+1);break;case`day`:n.setUTCDate(n.getUTCDate()+1);break;case`week`:n.setUTCDate(n.getUTCDate()+7);break;case`month`:n.setUTCMonth(n.getUTCMonth()+1);break;case`quarter`:n.setUTCMonth(n.getUTCMonth()+3);break;case`year`:n.setUTCFullYear(n.getUTCFullYear()+1);break}return n}function st(e){if(e instanceof Date)return e.toISOString();if(typeof e==`string`){let t=new Date(e);if(!isNaN(t.getTime()))return t.toISOString()}return String(e)}function ct(e,t){return t.length===0?`__all__`:t.map(t=>String(e[t]??``)).join(`|||`)}function lt(e,t){let{timeDimensionKey:n,granularity:r,dateRange:i,fillValue:a,measures:o,dimensions:s}=t,c=it(i[0],i[1],r);if(c.length===0)return e;let l=new Map;for(let t of e){let e=ct(t,s),r=st(t[n]);l.has(e)||l.set(e,new Map),l.get(e).set(r,t)}l.size===0&&s.length===0&&l.set(`__all__`,new Map);let u=[];for(let[e,t]of l){let e=t.size>0?t.values().next().value:null;for(let r of c){let i=r.toISOString(),c=t.get(i);if(c)u.push(c);else{let t={[n]:i};if(e)for(let n of s)t[n]=e[n];for(let e of o)t[e]=a;u.push(t)}}}return u}function ut(e){if(!e)return null;if(Array.isArray(e)){if(e.length<2)return null;let t=new Date(e[0]),n=new Date(e[1]);return isNaN(t.getTime())||isNaN(n.getTime())?null:[t,n]}let t=rt(e);if(t)return[t.start,t.end];let n=new Date(e);return isNaN(n.getTime())?null:[n,n]}function dt(e,t,n){if(!t.timeDimensions||t.timeDimensions.length===0)return e;let r=t.timeDimensions.filter(e=>{let n=e.fillMissingDates!==!1,r=!!e.granularity,i=e.dateRange||ft(e.dimension,t.filters);return n&&r&&i});if(r.length===0)return e;let i=t.fillMissingDatesValue===void 0?0:t.fillMissingDatesValue,a=new Set(t.timeDimensions.map(e=>e.dimension)),o=(t.dimensions||[]).filter(e=>!a.has(e)),s=e;for(let e of r){let r=ut(e.dateRange)||pt(e.dimension,t.filters);if(!r)continue;let a={timeDimensionKey:e.dimension,granularity:e.granularity,dateRange:r,fillValue:i,measures:n,dimensions:o};s=lt(s,a)}return s}function ft(e,t){if(!t)return null;for(let n of t){if(`member`in n&&`operator`in n&&n.member===e&&n.operator===`inDateRange`)return n;if(`and`in n&&n.and){let t=ft(e,n.and);if(t)return t}if(`or`in n&&n.or){let t=ft(e,n.or);if(t)return t}}return null}function pt(e,t){let n=ft(e,t);if(!n)return null;if(n.dateRange){let e=ut(n.dateRange);if(e)return e}let r=n.values;if(!r||r.length===0)return null;if(r.length===1&&typeof r[0]==`string`){let e=rt(r[0]);return e?[e.start,e.end]:ut(r)}return r.length>=2?ut(r):null}var mt=class{dateTimeBuilder;constructor(e){this.dateTimeBuilder=new Ue(e)}hasComparison(e){return e.timeDimensions?.some(e=>e.compareDateRange&&e.compareDateRange.length>=2)??!1}getComparisonTimeDimension(e){return e.timeDimensions?.find(e=>e.compareDateRange&&e.compareDateRange.length>=2)}normalizePeriods(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i,a,o;if(typeof r==`string`){let e=this.dateTimeBuilder.parseRelativeDateRange(r);if(e)i=e.start,a=e.end,o=r;else{let e=new Date(r);if(!isNaN(e.getTime()))i=new Date(e),i.setUTCHours(0,0,0,0),a=new Date(e),a.setUTCHours(23,59,59,999),o=r;else continue}}else{if(i=new Date(r[0]),a=new Date(r[1]),isNaN(i.getTime())||isNaN(a.getTime()))continue;/^\d{4}-\d{2}-\d{2}$/.test(r[1])&&a.setUTCHours(23,59,59,999),o=`${r[0]} - ${r[1]}`}t.push({start:i,end:a,label:o,index:n})}return t}createPeriodQuery(e,t){return{...e,timeDimensions:e.timeDimensions?.map(e=>e.compareDateRange?{...e,dateRange:[t.start.toISOString(),t.end.toISOString()],compareDateRange:void 0}:e)}}calculatePeriodDayIndex(e,t,n){let r=typeof e==`string`?new Date(e):e,i=t.getTime(),a=r.getTime();switch(n){case`second`:return Math.floor((a-i)/1e3);case`minute`:return Math.floor((a-i)/(1e3*60));case`hour`:return Math.floor((a-i)/(1e3*60*60));case`day`:return Math.floor((a-i)/(1e3*60*60*24));case`week`:return Math.floor((a-i)/(1e3*60*60*24*7));case`month`:{let e=t.getUTCFullYear(),n=t.getUTCMonth(),i=r.getUTCFullYear(),a=r.getUTCMonth();return(i-e)*12+(a-n)}case`quarter`:{let e=t.getUTCFullYear(),n=Math.floor(t.getUTCMonth()/3),i=r.getUTCFullYear(),a=Math.floor(r.getUTCMonth()/3);return(i-e)*4+(a-n)}case`year`:return r.getUTCFullYear()-t.getUTCFullYear();default:return Math.floor((a-i)/(1e3*60*60*24))}}addPeriodMetadata(e,t,n,r){return e.map(e=>{let i=e[n],a=0;if(i){let e=typeof i==`string`?new Date(i):i instanceof Date?i:null;e&&!isNaN(e.getTime())&&(a=this.calculatePeriodDayIndex(e,t.start,r))}return{...e,__period:t.label,__periodIndex:t.index,__periodDayIndex:a}})}mergeComparisonResults(e,t,n){let r=[],i={measures:{},dimensions:{},segments:{},timeDimensions:{}},a=e.map(e=>e.period);for(let{result:a,period:o}of e){let e=this.addPeriodMetadata(a.data,o,t.dimension,n);r.push(...e),i={measures:{...i.measures,...a.annotation.measures},dimensions:{...i.dimensions,...a.annotation.dimensions},segments:{...i.segments,...a.annotation.segments},timeDimensions:{...i.timeDimensions,...a.annotation.timeDimensions}}}let o={ranges:a.map(e=>[e.start.toISOString().split(`T`)[0],e.end.toISOString().split(`T`)[0]]),labels:a.map(e=>e.label),timeDimension:t.dimension,granularity:n};return{data:r,annotation:{...i,periods:o}}}sortComparisonResults(e,t){return[...e].sort((e,n)=>{let r=e.__periodIndex-n.__periodIndex;if(r!==0)return r;let i=e[t],a=n[t];return typeof i==`string`&&typeof a==`string`?new Date(i).getTime()-new Date(a).getTime():0})}},ht=class{filterBuilder;dateTimeBuilder;constructor(e){this.databaseAdapter=e,this.dateTimeBuilder=new Ue(e),this.filterBuilder=new We(e,this.dateTimeBuilder)}hasFunnel(e){return e.funnel!==void 0&&e.funnel.steps.length>=2}validateConfig(e,t){let n=[];if(e.steps.length<2&&n.push(N(`server.validation.funnel.minSteps`)),typeof e.bindingKey==`string`){let[r,i]=e.bindingKey.split(`.`);if(!r||!i)n.push(N(`server.validation.funnel.invalidBindingKeyFormat`,{bindingKey:e.bindingKey}));else{let e=t.get(r);e?e.dimensions?.[i]||n.push(N(`server.validation.funnel.bindingKeyDimNotFound`,{dimName:i,cubeName:r})):n.push(N(`server.validation.funnel.bindingKeyCubeNotFound`,{cubeName:r}))}}else if(Array.isArray(e.bindingKey))for(let r of e.bindingKey){let e=t.get(r.cube);if(!e)n.push(N(`server.validation.funnel.bindingKeyMappingCubeNotFound`,{cubeName:r.cube}));else{let[,t]=r.dimension.split(`.`);e.dimensions?.[t]||n.push(N(`server.validation.funnel.bindingKeyDimNotFound`,{dimName:t,cubeName:r.cube}))}}if(typeof e.timeDimension==`string`){let[r,i]=e.timeDimension.split(`.`);if(!r||!i)n.push(N(`server.validation.funnel.invalidTimeDimFormat`,{timeDimension:e.timeDimension}));else{let e=t.get(r);e?e.dimensions?.[i]||n.push(N(`server.validation.funnel.timeDimNotFound`,{dimName:i,cubeName:r})):n.push(N(`server.validation.funnel.timeDimCubeNotFound`,{cubeName:r}))}}for(let r=0;r<e.steps.length;r++){let i=e.steps[r];if(i.name||n.push(N(`server.validation.funnel.stepMustHaveName`,{step:r})),`cube`in i&&i.cube&&(t.get(i.cube)||n.push(N(`server.validation.funnel.stepCubeNotFound`,{step:r,cube:i.cube}))),i.filter){let a;`cube`in i&&i.cube?a=i.cube:typeof e.bindingKey==`string`&&([a]=e.bindingKey.split(`.`));let o=a?new $e(t):null,s=Array.isArray(i.filter)?i.filter:[i.filter];for(let e of s)if(`member`in e){let[i,s]=e.member.split(`.`),c=t.get(i);if(!c)n.push(N(`server.validation.funnel.stepFilterCubeNotFound`,{step:r,cubeName:i}));else if(c.dimensions?.[s]||(c.measures?.[s]?n.push(N(`server.validation.funnel.stepFilterIsMeasure`,{step:r,member:`${i}.${s}`})):n.push(N(`server.validation.funnel.stepFilterMemberNotFound`,{step:r,field:s,cubeName:i}))),a&&i!==a&&o){let e=o.findPath(a,i);(!e||e.length===0)&&n.push(N(`server.validation.funnel.stepFilterNoJoinPath`,{step:r,member:`${i}.${s}`,stepCube:a}))}}}i.timeToConvert&&r>0&&(/^P(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$/.test(i.timeToConvert)||n.push(N(`server.validation.funnel.stepTimeToConvertFormat`,{step:r,value:i.timeToConvert})))}return{isValid:n.length===0,errors:n}}buildFunnelQuery(e,t,n){let r=this.resolveSteps(e,t,n),i=[];for(let e=0;e<r.length;e++){let t=e>0?i[e-1]:void 0;i.push(this.buildStepCTE(r[e],n,t))}let a=this.buildFunnelResultsCTE(i,r,e,n),o=this.buildAggregationCTE(a,i,r,e,n),s=[...i,a,o];return n.db.with(...s).select().from(o)}transformResult(e,t){if(!e||e.length===0)return[];let n=e[0],r=[],i=Number(n.step_0_count)||0;for(let e=0;e<t.steps.length;e++){let a=t.steps[e],o=Number(n[`step_${e}_count`])||0,s=e>0&&Number(n[`step_${e-1}_count`])||0,c={step:a.name,stepIndex:e,count:o,conversionRate:e===0?null:s>0?o/s:0,cumulativeConversionRate:i>0?o/i:0};t.includeTimeMetrics&&e>0&&(c.avgSecondsToConvert=n[`step_${e}_avg_seconds`]===null?null:Number(n[`step_${e}_avg_seconds`]),c.minSecondsToConvert=n[`step_${e}_min_seconds`]===null?null:Number(n[`step_${e}_min_seconds`]),c.maxSecondsToConvert=n[`step_${e}_max_seconds`]===null?null:Number(n[`step_${e}_max_seconds`]),n[`step_${e}_median_seconds`]!==void 0&&(c.medianSecondsToConvert=n[`step_${e}_median_seconds`]===null?null:Number(n[`step_${e}_median_seconds`])),n[`step_${e}_p90_seconds`]!==void 0&&(c.p90SecondsToConvert=n[`step_${e}_p90_seconds`]===null?null:Number(n[`step_${e}_p90_seconds`]))),r.push(c)}return r}extractFilterCubeNames(e){let t=new Set;if(!e.filter)return t;let n=Array.isArray(e.filter)?e.filter:[e.filter],r=e=>{if(`and`in e&&e.and)for(let t of e.and)r(t);else if(`or`in e&&e.or)for(let t of e.or)r(t);else if(`type`in e&&`filters`in e){let t=e;for(let e of t.filters||[])r(e)}else if(`member`in e){let[n]=e.member.split(`.`);t.add(n)}};for(let e of n)r(e);return t}resolveSteps(e,t,n){let r=new $e(t);return e.steps.map((i,a)=>{let o=this.resolveCubeForStep(i,e,t),s=this.resolveBindingKey(e,o,n),c=this.resolveTimeDimension(e,o,n),l=this.buildStepFilters(i,o,t,n),u=this.extractFilterCubeNames(i),d=[];for(let e of u)if(e!==o.name){let n=t.get(e);if(n){let t=r.findPath(o.name,e);t&&t.length>0&&d.push({cube:n,joinPath:t})}}return{name:i.name,index:a,cube:o,bindingKeyExpr:s,timeExpr:c,filterConditions:l,timeToConvert:i.timeToConvert,joinedCubes:d}})}resolveCubeForStep(e,t,n){if(`cube`in e&&e.cube){let t=n.get(e.cube);if(!t)throw Error(N(`server.errors.funnel.cubeNotFoundForStep`,{cube:e.cube}));return t}if(typeof t.bindingKey==`string`){let[e]=t.bindingKey.split(`.`),r=n.get(e);if(!r)throw Error(N(`server.errors.funnel.cubeNotFoundForBindingKey`,{bindingKey:t.bindingKey}));return r}throw Error(N(`server.errors.funnel.cannotResolveCubeForStep`))}resolveBindingKey(e,t,n){if(typeof e.bindingKey==`string`){let[,r]=e.bindingKey.split(`.`),i=t.dimensions?.[r];if(!i)throw Error(N(`server.errors.funnel.bindingKeyDimNotFound`,{bindingKey:e.bindingKey}));return A(i.sql,n)}let r=e.bindingKey.find(e=>e.cube===t.name);if(!r)throw Error(N(`server.errors.funnel.noBindingKeyMapping`,{cubeName:t.name}));let[,i]=r.dimension.split(`.`),a=t.dimensions?.[i];if(!a)throw Error(N(`server.errors.funnel.bindingKeyMappingDimNotFound`,{dimension:r.dimension}));return A(a.sql,n)}resolveTimeDimension(e,t,n){if(typeof e.timeDimension==`string`){let[,r]=e.timeDimension.split(`.`),i=t.dimensions?.[r];if(!i)throw Error(N(`server.errors.funnel.timeDimNotFound`,{timeDimension:e.timeDimension}));return A(i.sql,n)}let r=e.timeDimension.find(e=>e.cube===t.name);if(!r)throw Error(N(`server.errors.funnel.noTimeDimMapping`,{cubeName:t.name}));let[,i]=r.dimension.split(`.`),a=t.dimensions?.[i];if(!a)throw Error(N(`server.errors.funnel.timeDimMappingNotFound`,{dimension:r.dimension}));return A(a.sql,n)}buildStepFilters(e,t,n,r){if(!e.filter)return[];let i=Array.isArray(e.filter)?e.filter:[e.filter],a=[];for(let e of i){let i=this.buildFilterCondition(e,t,n,r);i&&a.push(i)}return a}buildFilterCondition(e,t,n,r){let i=`and`in e||`or`in e,a=`type`in e&&`filters`in e&&(e.type===`and`||e.type===`or`);if(i||a){let i=[],o;if(a){let a=e;o=a.type===`and`;for(let e of a.filters||[]){let a=this.buildFilterCondition(e,t,n,r);a&&i.push(a)}}else{let a=e;o=`and`in a&&!!a.and;let s=a.and||a.or||[];for(let e of s){let a=this.buildFilterCondition(e,t,n,r);a&&i.push(a)}}return i.length===0?null:i.length===1?i[0]:o?(0,u.and)(...i):u.sql`(${u.sql.join(i,u.sql` OR `)})`}let o=e,[s,c]=o.member.split(`.`),l=o.dateRange!==void 0;if(o.operator!==`set`&&o.operator!==`notSet`&&!l&&(!o.values||o.values.length===0||o.values[0]===void 0||o.values[0]===``))return null;let d=n.get(s);if(!d)return null;if(s!==t.name){let e=new $e(n).findPath(t.name,s);if(!e||e.length===0)return console.warn(`Funnel filter: Cannot filter by '${String(s).replace(/\n|\r/g,``)}.${String(c).replace(/\n|\r/g,``)}' in step using '${String(t.name).replace(/\n|\r/g,``)}'. No join path found. Filter will be skipped.`),null}let f=d.dimensions?.[c];if(!f)return null;let p=f.type===`time`?A(f.sql,r):typeof f.sql==`function`?f.sql(r):f.sql;return this.filterBuilder.buildFilterCondition(p,o.operator,o.values||[],f,o.dateRange)}buildStepCTE(e,t,n){return e.index===0?this.buildFirstStepCTE(e,t):this.buildSubsequentStepCTE(e,t,n)}buildFirstStepCTE(e,t){let n=`step_${e.index}`,r=e.cube.sql(t),i=[];r.where&&i.push(r.where),i.push(...e.filterConditions);let a=t.db.select({binding_key:u.sql`${e.bindingKeyExpr}`.as(`binding_key`),step_time:u.sql`MIN(${e.timeExpr})`.as(`step_time`)}).from(r.from);if(a=this.addCrossJoinsToQuery(a,e,t,i),i.length>0){let e=i.length===1?i[0]:(0,u.and)(...i);a=a.where(e)}return a=a.groupBy(e.bindingKeyExpr),t.db.$with(n).as(a)}buildSubsequentStepCTE(e,t,n){let r=`step_${e.index}`,i=`step_${e.index-1}`,a=e.cube.sql(t),o=[];a.where&&o.push(a.where),o.push(...e.filterConditions);let s=u.sql`${u.sql.identifier(i)}.step_time`,c=u.sql`${e.timeExpr} > ${s}`;if(e.timeToConvert){let t=this.databaseAdapter.buildDateAddInterval(s,e.timeToConvert);c=u.sql`${c} AND ${e.timeExpr} <= ${t}`}o.push(c);let l=t.db.select({binding_key:u.sql`${e.bindingKeyExpr}`.as(`binding_key`),step_time:u.sql`MIN(${e.timeExpr})`.as(`step_time`)}).from(a.from).innerJoin(n,u.sql`${e.bindingKeyExpr} = ${u.sql.identifier(i)}.binding_key`);if(l=this.addCrossJoinsToQuery(l,e,t,o),o.length>0){let e=o.length===1?o[0]:(0,u.and)(...o);l=l.where(e)}return l=l.groupBy(e.bindingKeyExpr),t.db.$with(r).as(l)}addCrossJoinsToQuery(e,t,n,r){if(t.joinedCubes.length===0)return e;for(let i of t.joinedCubes)for(let t of i.joinPath){let a=t.joinDef,o=[];for(let e of a.on)e.as?o.push(e.as(e.source,e.target)):o.push((0,u.eq)(e.source,e.target));let s=o.length===1?o[0]:(0,u.and)(...o),c=i.cube.sql(n);e=e.leftJoin(c.from,s),c.where&&r.push(c.where)}return e}buildFunnelResultsCTE(e,t,n,r){let i={binding_key:u.sql`s0.binding_key`,step_0_time:u.sql`s0.step_time`};for(let e=1;e<t.length;e++)i[`step_${e}_time`]=u.sql`s${u.sql.raw(String(e))}.step_time`;let a=u.sql`${u.sql.identifier(`step_0`)} s0`;for(let e=1;e<t.length;e++)a=u.sql`${a}
|
|
65
65
|
LEFT JOIN ${u.sql.identifier(`step_${e}`)} s${u.sql.raw(String(e))} ON s0.binding_key = s${u.sql.raw(String(e))}.binding_key`;let o=Object.entries(i).map(([e,t])=>u.sql`${t} AS ${u.sql.identifier(e)}`),s=u.sql`SELECT ${u.sql.join(o,u.sql`, `)} FROM ${a}`;return r.db.$with(`funnel_joined`).as(s)}buildAggregationCTE(e,t,n,r,i){let a={};a.step_0_count=u.sql`COUNT(*)`.as(`step_0_count`);for(let e=1;e<n.length;e++)a[`step_${e}_count`]=u.sql`COUNT(${u.sql.identifier(`step_${e}_time`)})`.as(`step_${e}_count`);if(r.includeTimeMetrics)for(let e=1;e<n.length;e++){let t=u.sql.identifier(`step_${e}_time`),n=u.sql.identifier(`step_${e-1}_time`),r=this.databaseAdapter.buildTimeDifferenceSeconds(u.sql`${t}`,u.sql`${n}`),i=u.sql`${t} IS NOT NULL`;if(a[`step_${e}_avg_seconds`]=this.databaseAdapter.buildConditionalAggregation(`avg`,r,i).as(`step_${e}_avg_seconds`),a[`step_${e}_min_seconds`]=this.databaseAdapter.buildConditionalAggregation(`min`,r,i).as(`step_${e}_min_seconds`),a[`step_${e}_max_seconds`]=this.databaseAdapter.buildConditionalAggregation(`max`,r,i).as(`step_${e}_max_seconds`),this.databaseAdapter.getCapabilities().supportsPercentileSubqueries){let n=this.databaseAdapter.buildPercentile(r,50);n&&(a[`step_${e}_median_seconds`]=u.sql`(SELECT ${n} FROM ${u.sql.identifier(`funnel_joined`)} WHERE ${t} IS NOT NULL)`.as(`step_${e}_median_seconds`));let i=this.databaseAdapter.buildPercentile(r,90);i&&(a[`step_${e}_p90_seconds`]=u.sql`(SELECT ${i} FROM ${u.sql.identifier(`funnel_joined`)} WHERE ${t} IS NOT NULL)`.as(`step_${e}_p90_seconds`))}}let o=i.db.select(a).from(e);return i.db.$with(`funnel_metrics`).as(o)}},gt=class{filterBuilder;dateTimeBuilder;databaseAdapter;constructor(e){this.databaseAdapter=e,this.dateTimeBuilder=new Ue(e),this.filterBuilder=new We(e,this.dateTimeBuilder)}hasFlow(e){return e.flow!==void 0&&e.flow.startingStep!==void 0&&e.flow.eventDimension!==void 0}validateConfig(e,t){let n=[],r=[],i=this.databaseAdapter.getEngineType(),a=this.databaseAdapter.getCapabilities().supportsLateralSubqueriesInCTE;if(i===`sqlite`)return n.push(N(`server.validation.flow.sqliteNotSupported`)),{isValid:!1,errors:n,warnings:r};if(typeof e.bindingKey==`string`){let[r,i]=e.bindingKey.split(`.`);if(!r||!i)n.push(N(`server.validation.flow.invalidBindingKeyFormat`,{bindingKey:e.bindingKey}));else{let e=t.get(r);e?e.dimensions?.[i]||n.push(N(`server.validation.flow.bindingKeyDimNotFound`,{dimName:i,cubeName:r})):n.push(N(`server.validation.flow.bindingKeyCubeNotFound`,{cubeName:r}))}}else if(Array.isArray(e.bindingKey))for(let r of e.bindingKey){let e=t.get(r.cube);if(!e)n.push(N(`server.validation.flow.bindingKeyMappingCubeNotFound`,{cubeName:r.cube}));else{let[,t]=r.dimension.split(`.`);e.dimensions?.[t]||n.push(N(`server.validation.flow.bindingKeyDimNotFound`,{dimName:t,cubeName:r.cube}))}}if(typeof e.timeDimension==`string`){let[r,i]=e.timeDimension.split(`.`);if(!r||!i)n.push(N(`server.validation.flow.invalidTimeDimFormat`,{timeDimension:e.timeDimension}));else{let e=t.get(r);e?e.dimensions?.[i]||n.push(N(`server.validation.flow.timeDimNotFound`,{dimName:i,cubeName:r})):n.push(N(`server.validation.flow.timeDimCubeNotFound`,{cubeName:r}))}}if(e.eventDimension){let[r,i]=e.eventDimension.split(`.`);if(!r||!i)n.push(N(`server.validation.flow.invalidEventDimFormat`,{eventDimension:e.eventDimension}));else{let e=t.get(r);e?e.dimensions?.[i]||n.push(N(`server.validation.flow.eventDimNotFound`,{dimName:i,cubeName:r})):n.push(N(`server.validation.flow.eventDimCubeNotFound`,{cubeName:r}))}}else n.push(N(`server.validation.flow.eventDimRequired`));return e.startingStep?(e.startingStep.filter||n.push(N(`server.validation.flow.startingStepFilterRequired`)),e.startingStep.name||r.push(N(`server.validation.flow.startingStepNameMissing`))):n.push(N(`server.validation.flow.startingStepRequired`)),(e.stepsBefore<0||e.stepsBefore>5)&&n.push(N(`server.validation.flow.stepsBeforeRange`,{value:e.stepsBefore})),(e.stepsAfter<0||e.stepsAfter>5)&&n.push(N(`server.validation.flow.stepsAfterRange`,{value:e.stepsAfter})),(e.stepsBefore>=4||e.stepsAfter>=4)&&r.push(N(`server.validation.flow.highStepDepthWarning`)),e.joinStrategy&&![`auto`,`lateral`,`window`].includes(e.joinStrategy)?n.push(N(`server.validation.flow.invalidJoinStrategy`,{joinStrategy:e.joinStrategy})):e.joinStrategy===`lateral`&&!a&&n.push(N(`server.validation.flow.lateralNotSupported`)),{isValid:n.length===0,errors:n,warnings:r}}buildFlowQuery(e,t,n){if(this.databaseAdapter.getEngineType()===`sqlite`)throw Error(N(`server.validation.flow.sqliteNotSupported`));let r=this.databaseAdapter.getCapabilities().supportsLateralSubqueriesInCTE,i=e.joinStrategy??`auto`,a=i===`lateral`||i===`auto`&&r;if(i===`lateral`&&!r)throw Error(N(`server.validation.flow.lateralNotSupportedExec`));let o={...e,stepsBefore:e.outputMode===`sunburst`?0:e.stepsBefore},s=this.resolveFlowConfig(o,t,n),c=[],l=this.buildStartingEntitiesCTE(o,s,n);c.push(l);let u=a?this.buildBeforeCTEsLateral(o,s,n):this.buildBeforeCTEsWindow(o,s,n);c.push(...u);let d=a?this.buildAfterCTEsLateral(o,s,n):this.buildAfterCTEsWindow(o,s,n);c.push(...d);let f=this.buildNodesAggregationCTE(o,n);c.push(f);let p=this.buildLinksAggregationCTE(o,n);c.push(p);let m=this.buildFinalResultCTE(n);return c.push(m),n.db.with(...c).select().from(m)}transformResult(e){if(!e||e.length===0)return{nodes:[],links:[]};let t=[],n=[];for(let r of e){let e=r.record_type;e===`node`?t.push({id:String(r.id),name:String(r.name),layer:Number(r.layer),value:Number(r.value)}):e===`link`&&n.push({source:String(r.source_id),target:String(r.target_id),value:Number(r.value)})}return t.sort((e,t)=>e.layer-t.layer),{nodes:t,links:n}}resolveFlowConfig(e,t,n){let r=this.resolveCube(e,t);return{cube:r,cubeBase:r.sql(n),bindingKeyExpr:this.resolveBindingKey(e,r,n),timeExpr:this.resolveTimeDimension(e,r,n),eventExpr:this.resolveEventDimension(e,r,n),startingStepFilters:this.buildStartingStepFilters(e,r,n)}}resolveCube(e,t){let n;if(typeof e.bindingKey==`string`)[n]=e.bindingKey.split(`.`);else if(Array.isArray(e.bindingKey)&&e.bindingKey.length>0)n=e.bindingKey[0].cube;else throw Error(N(`server.errors.flow.cannotResolveCube`));let r=t.get(n);if(!r)throw Error(N(`server.errors.flow.cubeNotFound`,{cubeName:n}));return r}resolveBindingKey(e,t,n){if(typeof e.bindingKey==`string`){let[,r]=e.bindingKey.split(`.`),i=t.dimensions?.[r];if(!i)throw Error(N(`server.errors.flow.bindingKeyDimNotFound`,{bindingKey:e.bindingKey}));return A(i.sql,n)}let r=e.bindingKey.find(e=>e.cube===t.name);if(!r)throw Error(N(`server.errors.flow.noBindingKeyMapping`,{cubeName:t.name}));let[,i]=r.dimension.split(`.`),a=t.dimensions?.[i];if(!a)throw Error(N(`server.errors.flow.bindingKeyMappingDimNotFound`,{dimension:r.dimension}));return A(a.sql,n)}resolveTimeDimension(e,t,n){if(typeof e.timeDimension==`string`){let[,r]=e.timeDimension.split(`.`),i=t.dimensions?.[r];if(!i)throw Error(N(`server.errors.flow.timeDimNotFound`,{timeDimension:e.timeDimension}));return A(i.sql,n)}let r=e.timeDimension.find(e=>e.cube===t.name);if(!r)throw Error(N(`server.errors.flow.noTimeDimMapping`,{cubeName:t.name}));let[,i]=r.dimension.split(`.`),a=t.dimensions?.[i];if(!a)throw Error(N(`server.errors.flow.timeDimMappingNotFound`,{dimension:r.dimension}));return A(a.sql,n)}resolveEventDimension(e,t,n){let[,r]=e.eventDimension.split(`.`),i=t.dimensions?.[r];if(!i)throw Error(N(`server.errors.flow.eventDimNotFound`,{eventDimension:e.eventDimension}));return A(i.sql,n)}buildStartingStepFilters(e,t,n){if(!e.startingStep.filter)return[];let r=Array.isArray(e.startingStep.filter)?e.startingStep.filter:[e.startingStep.filter],i=[];for(let e of r){let r=this.buildFilterCondition(e,t,n);r&&i.push(r)}return i}buildFilterCondition(e,t,n){if(`and`in e||`or`in e){let r=e,i=[],a=r.and||r.or||[];for(let e of a){let r=this.buildFilterCondition(e,t,n);r&&i.push(r)}return i.length===0?null:i.length===1?i[0]:`and`in e?(0,u.and)(...i):u.sql`(${u.sql.join(i,u.sql` OR `)})`}if(`type`in e&&`filters`in e){let r=e,i=[];for(let e of r.filters||[]){let r=this.buildFilterCondition(e,t,n);r&&i.push(r)}return i.length===0?null:i.length===1?i[0]:r.type===`and`?(0,u.and)(...i):u.sql`(${u.sql.join(i,u.sql` OR `)})`}let r=e,[,i]=r.member.split(`.`),a=t.dimensions?.[i];if(!a)return null;let o=a.type===`time`?A(a.sql,n):typeof a.sql==`function`?a.sql(n):a.sql;return this.filterBuilder.buildFilterCondition(o,r.operator,r.values||[],a,r.dateRange)}buildStartingEntitiesCTE(e,t,n){let{cubeBase:r,bindingKeyExpr:i,timeExpr:a,eventExpr:o,startingStepFilters:s}=t,c=[];r.where&&c.push(r.where),c.push(...s);let l=n.db.select({binding_key:u.sql`${i}`.as(`binding_key`),start_time:u.sql`MIN(${a})`.as(`start_time`),event_type:u.sql`${o}`.as(`event_type`),event_path:u.sql`${o}`.as(`event_path`)}).from(r.from);if(c.length>0){let e=c.length===1?c[0]:(0,u.and)(...c);l=l.where(e)}return l=l.groupBy(i,o),e.entityLimit&&(l=l.limit(e.entityLimit)),n.db.$with(`starting_entities`).as(l)}buildBeforeCTEsLateral(e,t,n){let{cubeBase:r,bindingKeyExpr:i,timeExpr:a,eventExpr:o}=t,s=[],c=e.outputMode===`sunburst`;for(let t=1;t<=e.stepsBefore;t++){let e=t===1?`starting_entities`:`before_step_${t-1}`,l=t===1?`start_time`:`step_time`,d=`before_step_${t}`,f=[];r.where&&f.push(r.where),f.push(u.sql`${i} = ${u.sql.identifier(e)}.binding_key`,u.sql`${a} < ${u.sql.identifier(e)}.${u.sql.identifier(l)}`);let p=f.length===1?f[0]:(0,u.and)(...f),m=c?u.sql`${o} || ${`→`} || ${u.sql.identifier(e)}.event_path`:u.sql`${o}`,h=n.db.select({binding_key:u.sql`${i}`.as(`binding_key`),step_time:u.sql`${a}`.as(`step_time`),event_type:u.sql`${o}`.as(`event_type`),event_path:m.as(`event_path`)}).from(r.from).where(p).orderBy(u.sql`${a} DESC`).limit(1),g=n.db.$with(d).as(n.db.select({binding_key:u.sql`e.binding_key`.as(`binding_key`),step_time:u.sql`e.step_time`.as(`step_time`),event_type:u.sql`e.event_type`.as(`event_type`),event_path:u.sql`e.event_path`.as(`event_path`)}).from(u.sql`${u.sql.identifier(e)}`).crossJoinLateral(h.as(`e`)));s.push(g)}return s}buildAfterCTEsLateral(e,t,n){let{cubeBase:r,bindingKeyExpr:i,timeExpr:a,eventExpr:o}=t,s=[],c=e.outputMode===`sunburst`;for(let t=1;t<=e.stepsAfter;t++){let e=t===1?`starting_entities`:`after_step_${t-1}`,l=t===1?`start_time`:`step_time`,d=`after_step_${t}`,f=[];r.where&&f.push(r.where),f.push(u.sql`${i} = ${u.sql.identifier(e)}.binding_key`,u.sql`${a} > ${u.sql.identifier(e)}.${u.sql.identifier(l)}`);let p=f.length===1?f[0]:(0,u.and)(...f),m=c?u.sql`${u.sql.identifier(e)}.event_path || ${`→`} || ${o}`:u.sql`${o}`,h=n.db.select({binding_key:u.sql`${i}`.as(`binding_key`),step_time:u.sql`${a}`.as(`step_time`),event_type:u.sql`${o}`.as(`event_type`),event_path:m.as(`event_path`)}).from(r.from).where(p).orderBy(u.sql`${a} ASC`).limit(1),g=n.db.$with(d).as(n.db.select({binding_key:u.sql`e.binding_key`.as(`binding_key`),step_time:u.sql`e.step_time`.as(`step_time`),event_type:u.sql`e.event_type`.as(`event_type`),event_path:u.sql`e.event_path`.as(`event_path`)}).from(u.sql`${u.sql.identifier(e)}`).crossJoinLateral(h.as(`e`)));s.push(g)}return s}buildBeforeCTEsWindow(e,t,n){let{cubeBase:r,bindingKeyExpr:i,timeExpr:a,eventExpr:o}=t,s=[],c=e.outputMode===`sunburst`;for(let t=1;t<=e.stepsBefore;t++){let e=t===1?`starting_entities`:`before_step_${t-1}`,l=t===1?`start_time`:`step_time`,d=`before_step_${t}`,f=[];r.where&&f.push(r.where),f.push(u.sql`${a} < ${u.sql.identifier(e)}.${u.sql.identifier(l)}`);let p=f.length===1?f[0]:(0,u.and)(...f),m=c?u.sql`${o} || ${`→`} || ${u.sql.identifier(e)}.event_path`:u.sql`${o}`,h=n.db.select({binding_key:u.sql`${i}`.as(`binding_key`),step_time:u.sql`${a}`.as(`step_time`),event_type:u.sql`${o}`.as(`event_type`),event_path:m.as(`event_path`),rn:u.sql`ROW_NUMBER() OVER (PARTITION BY ${i} ORDER BY ${a} DESC)`.as(`rn`)}).from(r.from).innerJoin(u.sql`${u.sql.identifier(e)}`,u.sql`${i} = ${u.sql.identifier(e)}.binding_key`).where(p),g=n.db.select({binding_key:u.sql`binding_key`.as(`binding_key`),step_time:u.sql`step_time`.as(`step_time`),event_type:u.sql`event_type`.as(`event_type`),event_path:u.sql`event_path`.as(`event_path`)}).from(h.as(`ranked`)).where(u.sql`rn = 1`);s.push(n.db.$with(d).as(g))}return s}buildAfterCTEsWindow(e,t,n){let{cubeBase:r,bindingKeyExpr:i,timeExpr:a,eventExpr:o}=t,s=[],c=e.outputMode===`sunburst`;for(let t=1;t<=e.stepsAfter;t++){let e=t===1?`starting_entities`:`after_step_${t-1}`,l=t===1?`start_time`:`step_time`,d=`after_step_${t}`,f=[];r.where&&f.push(r.where),f.push(u.sql`${a} > ${u.sql.identifier(e)}.${u.sql.identifier(l)}`);let p=f.length===1?f[0]:(0,u.and)(...f),m=c?u.sql`${u.sql.identifier(e)}.event_path || ${`→`} || ${o}`:u.sql`${o}`,h=n.db.select({binding_key:u.sql`${i}`.as(`binding_key`),step_time:u.sql`${a}`.as(`step_time`),event_type:u.sql`${o}`.as(`event_type`),event_path:m.as(`event_path`),rn:u.sql`ROW_NUMBER() OVER (PARTITION BY ${i} ORDER BY ${a} ASC)`.as(`rn`)}).from(r.from).innerJoin(u.sql`${u.sql.identifier(e)}`,u.sql`${i} = ${u.sql.identifier(e)}.binding_key`).where(p),g=n.db.select({binding_key:u.sql`binding_key`.as(`binding_key`),step_time:u.sql`step_time`.as(`step_time`),event_type:u.sql`event_type`.as(`event_type`),event_path:u.sql`event_path`.as(`event_path`)}).from(h.as(`ranked`)).where(u.sql`rn = 1`);s.push(n.db.$with(d).as(g))}return s}buildNodesAggregationCTE(e,t){let n=[],r=e.outputMode===`sunburst`;for(let t=e.stepsBefore;t>=1;t--){let e=-t,i=`before_step_${t}`;r?n.push(u.sql`
|
|
@@ -318,7 +318,7 @@ type RetentionQuery = {
|
|
|
318
318
|
// 6. Order keys MUST appear in measures or dimensions of the same query
|
|
319
319
|
// 7. Funnel/flow/retention are mutually exclusive with measures/dimensions
|
|
320
320
|
// 8. Always discover cubes first — never guess field names`,Qs={name:`drizzle-cube-mcp-guide`,description:`How to use drizzle-cube MCP tools to generate and run queries`,messages:[{role:`user`,content:{type:`text`,text:[`You are an analyst agent using drizzle-cube MCP.`,``,`Workflow:`,`1) tools/call name=discover {topic|intent} - Find cubes and understand schema`,`2) Construct your query using the schema from discover (see query language reference)`,`3) tools/call name=validate {query} - Optional: fix schema issues`,`4) tools/call name=load {query} - Execute and get results`,``,`CROSS-CUBE JOINS:`,`The "joins" property in discover results shows relationships between cubes.`,`You can include dimensions from ANY related cube in your query — the system auto-joins.`,`Example: If Productivity joins to Employees, query:`,`{ "measures": ["Productivity.totalPullRequests"], "dimensions": ["Employees.name"] }`,``,`Do NOT hallucinate cube/field names — always use discover first.`].join(`
|
|
321
|
-
`)}}]},$s={name:`drizzle-cube-query-language`,description:`CRITICAL: Complete query language reference — types, operators, analysis modes, and rules`,messages:[{role:`user`,content:{type:`text`,text:Zs}}]},ec={name:`drizzle-cube-date-filtering`,description:`CRITICAL: How to correctly filter by date vs group by time period - the #1 source of query mistakes`,messages:[{role:`user`,content:{type:`text`,text:[`# Date Filtering vs Time Grouping`,``,"```",`User wants data over a time period?`,`|- AGGREGATED TOTALS ("total sales last month")`,`| -> filters with inDateRange
|
|
321
|
+
`)}}]},$s={name:`drizzle-cube-query-language`,description:`CRITICAL: Complete query language reference — types, operators, analysis modes, and rules`,messages:[{role:`user`,content:{type:`text`,text:Zs}}]},ec={name:`drizzle-cube-date-filtering`,description:`CRITICAL: How to correctly filter by date vs group by time period - the #1 source of query mistakes`,messages:[{role:`user`,content:{type:`text`,text:[`# Date Filtering vs Time Grouping`,``,"```",`User wants data over a time period?`,`|- AGGREGATED TOTALS — no time breakdown in the output`,`| ("total sales last month", "top 5 customers this quarter")`,`| -> filters with inDateRange, NEVER timeDimensions`,`| Use this whenever the user does NOT want time in the result rows.`,`|`,`|- TIME SERIES — time breakdown in the output`,`| ("daily sales last month", "monthly breakdown for last quarter")`,`| -> timeDimensions with BOTH dateRange AND granularity`,`| ONE entry covers both filtering and grouping — do NOT also add an`,`| inDateRange filter on the same field (it duplicates the WHERE clause).`,"```",``,`## NEVER duplicate date filtering on the same field`,"Do NOT put both a `filters[].inDateRange` and a `timeDimensions[].dateRange` on the same field — the engine will emit the same WHERE clause twice. Pick ONE based on whether the user wants time in the output:","- No time in output → `filters[].inDateRange` ONLY (no timeDimensions)","- Time in output → `timeDimensions[].dateRange + granularity` ONLY (no inDateRange filter on the same field)",``,'Only combine `filters` + `timeDimensions` when the filter is on a DIFFERENT field (e.g., "monthly trend for EU customers" → filter on region + timeDimension on date).',``,`## Aggregated Totals (most common)`,`When: "last 3 months", "over the past year", "in Q1", "since January"`,"```json",`{`,` "measures": ["Sales.totalRevenue"],`,` "dimensions": ["Products.category"],`,` "filters": [{ "member": "Sales.date", "operator": "inDateRange", "values": ["last 3 months"] }]`,`}`,"```",`Result: One row per category with TOTAL revenue.`,``,`## Time Series`,`When: "by month", "per week", "daily trend", "over time"`,"```json",`{`,` "measures": ["Sales.totalRevenue"],`,` "timeDimensions": [{ "dimension": "Sales.date", "dateRange": "last 3 months", "granularity": "month" }]`,`}`,"```",`Result: One row per month.`,``,`## Period-over-Period Comparison`,`Use compareDateRange for side-by-side period analysis:`,"```json",`{`,` "measures": ["Sales.totalRevenue"],`,` "timeDimensions": [{`,` "dimension": "Sales.date",`,` "granularity": "day",`,` "compareDateRange": ["last 30 days", ["2024-01-01", "2024-01-30"]]`,` }]`,`}`,"```",``,`## WRONG: timeDimensions without granularity`,"```json",`// Returns ~90 rows (daily) instead of aggregates!`,`{ "timeDimensions": [{ "dimension": "Sales.date", "dateRange": "last 3 months" }] }`,"```",``,`## Date Range Values`,`- Relative: "last 7 days", "last 3 months", "last year", "this week", "this month", "this quarter", "next week", "next month"`,`- Absolute: ["2024-01-01", "2024-03-31"]`,``,`| User Request | Approach |`,`|---|---|`,`| "total for last 3 months" | filters + inDateRange (no timeDimensions) |`,`| "top 5 last quarter" | filters + inDateRange + order + limit (no timeDimensions) |`,`| "monthly trend" | timeDimensions with dateRange + granularity |`,`| "daily breakdown last week" | timeDimensions with dateRange + granularity |`,`| "compare this month to last" | timeDimensions with compareDateRange + granularity |`,`| "monthly trend for EU customers" | filters on region + timeDimensions with dateRange + granularity |`].join(`
|
|
322
322
|
`)}}]};[`You are an analyst agent connected to a Drizzle Cube semantic layer.`,``,`## Mandatory workflow`,"1. CALL `discover` FIRST. Always. Even if you think you know the schema.",` The discover response contains TWO things you MUST read before writing any query:`," - `cubes`: the available cubes, their measures, dimensions, and join relationships."," - `queryLanguageReference`: the COMPLETE query language reference (TypeScript DSL,",` filter operators, analysis modes, and rules). This is the source of truth — do`,` NOT construct queries from memory or guess syntax.`," - `dateFilteringGuide`: the decision tree for date filtering vs time grouping.",` Read this whenever the user asks about a time period.`,`2. Construct your query using ONLY field names that appear in the discover response,`," in exact `CubeName.fieldName` form (two parts, one dot).","3. Optionally call `validate` to auto-correct schema issues.","4. Call `load` to execute the query and return data.",``,"## The #1 mistake to avoid (read `dateFilteringGuide` for the full rules)",`When the user asks for AGGREGATED TOTALS over a time period ("total sales last 6 months",`,'"top customers this quarter"), you MUST filter with `inDateRange` and you MUST NOT use',"`timeDimensions`. Using `timeDimensions` without a granularity returns daily rows and is",`almost always wrong; using it WITH a granularity returns a time series, not a total.`,``,'Aggregated totals → `filters: [{ member, operator: "inDateRange", values: ["last 6 months"] }]`','Time series → `timeDimensions: [{ dimension, dateRange, granularity: "month" }]`',``,`## Field naming`,"Fields are EXACTLY `CubeName.fieldName`. Copy verbatim from discover.","WRONG: `Sales.Sales.count` (double-prefixed), `Sales` (bare cube), `Sales_count` (underscore).","RIGHT: `Sales.count`, `Customers.region`.",``,`## Cross-cube joins`,"The `joins` property in each discover result lists related cubes. You can include",`dimensions from any related cube in the same query — the system auto-joins them.`,``,"If you skip `discover` and guess, your query will fail or return wrong results. Always discover first."].join(`
|
|
323
323
|
`);function tc(e,t){try{return Js(e,{language:{postgres:`postgresql`,mysql:`mysql`,sqlite:`sqlite`,singlestore:`mysql`,duckdb:`postgresql`,databend:`postgresql`,snowflake:`postgresql`}[t],tabWidth:2,keywordCase:`upper`,indentStyle:`standard`})}catch(t){return console.warn(`SQL formatting failed:`,t),e}}var nc=ec.messages[0]?.content.text??``;async function rc(e,t){return{cubes:Kc(e.getMetadata(),{topic:t.topic,intent:t.intent,limit:t.limit,minScore:t.minScore}),queryLanguageReference:Zs,dateFilteringGuide:nc}}function ic(e){let t=e.split(`.`);return t.length===3&&t[0]===t[1]?`${t[0]}.${t[2]}`:e}function ac(e){let t=e=>{if(Array.isArray(e))return e.map(e=>typeof e==`string`?ic(e):e)};if(Array.isArray(e.measures)&&(e.measures=t(e.measures)),Array.isArray(e.dimensions)&&(e.dimensions=t(e.dimensions)),Array.isArray(e.filters))for(let t of e.filters)typeof t.member==`string`&&(t.member=ic(t.member));if(Array.isArray(e.timeDimensions))for(let t of e.timeDimensions)typeof t.dimension==`string`&&(t.dimension=ic(t.dimension));if(Array.isArray(e.order)){let t={};for(let n of e.order)n&&typeof n==`object`&&Object.assign(t,n);e.order=t}if(e.order&&typeof e.order==`object`&&!Array.isArray(e.order)){let t=new Set([...Array.isArray(e.measures)?e.measures:[],...Array.isArray(e.dimensions)?e.dimensions:[]]),n={};for(let[r,i]of Object.entries(e.order)){let e=ic(r);if(t.has(e)){n[e]=i;continue}if(!r.includes(`.`)&&r.includes(`_`)){let e=ic(r.replace(/_/g,`.`));if(t.has(e)){n[e]=i;continue}let a=[...t].find(e=>{let t=e.split(`.`)[1];return t&&(r.endsWith(`_${t}`)||r.endsWith(`.${t}`))});if(a){n[a]=i;continue}}t.size>0&&!t.has(e)||(n[e]=i)}if(Object.keys(n).length===0&&t.size>0){let t=Array.isArray(e.measures)?e.measures[0]:void 0;t&&(n[t]=`desc`)}e.order=n}return e}async function oc(e,t,n){let r=ac(n.query),i=e.validateQuery(r);if(!i.isValid)throw Error(`Query validation failed: ${i.errors.join(`, `)}`);let a=await e.executeMultiCubeQuery(r,t);return{data:a.data,annotation:a.annotation,query:r}}var sc=class e{cubes=new Map;metadataCache;cacheConfig;rlsSetup;db;schema;engineType;constructor(e){e?.databaseExecutor?(this.db=e.databaseExecutor.db,this.schema=e.databaseExecutor.schema,this.engineType=e.databaseExecutor.getEngineType()):e?.drizzle&&(this.db=e.drizzle,this.schema=e.schema,this.engineType=e.engineType),this.cacheConfig=e?.cache,this.rlsSetup=e?.rlsSetup}setDatabaseExecutor(e){this.db=e.db,this.schema=e.schema,this.engineType=e.getEngineType()}getEngineType(){return this.engineType}setDrizzle(e,t,n){this.db=e,this.schema=t,this.engineType=n}hasExecutor(){return!!this.db}createDbExecutor(){if(!this.db)throw Error(N(`server.errors.dbNotConfigured`));return Se(this.db,this.schema,this.engineType)}createQueryExecutor(e=!1){return new It(this.createDbExecutor(),e?this.cacheConfig:void 0,this.rlsSetup)}formatSqlResult(e){let t=this.getEngineType()??`postgres`;return{sql:tc(e.sql,t),params:e.params}}registerCube(e){this.validateCalculatedMeasures(e),new M(this.cubes).populateDependencies(e),this.cubes.set(e.name,e),this.invalidateMetadataCache()}validateCubeReferences(){let e=[];for(let[t,n]of this.cubes)if(n.joins)for(let[r,i]of Object.entries(n.joins))typeof i.targetCube==`string`&&!this.cubes.has(i.targetCube)&&e.push(N(`server.errors.cubeRefUnresolved`,{cubeName:t,joinName:r,targetCube:i.targetCube}));if(e.length>0)throw Error(N(`server.errors.unresolvedCubeRefs`,{details:e.map(e=>` - ${e}`).join(`
|
|
324
324
|
`)}))}validateCalculatedMeasures(e){let t=[];for(let[n,r]of Object.entries(e.measures))if(r.type===`calculated`){if(!r.calculatedSql){t.push(N(`server.validation.calculatedMeasure.mustHaveCalculatedSql`,{cubeName:e.name,fieldName:n}));continue}let i=Ye(r.calculatedSql);if(!i.isValid){t.push(N(`server.validation.calculatedMeasure.invalidSyntax`,{cubeName:e.name,fieldName:n,errors:i.errors.join(`, `)}));continue}let a=new Map(this.cubes);a.set(e.name,e);let o=new M(a);try{o.validateDependencies(e)}catch(e){t.push(e instanceof Error?e.message:String(e))}}if(t.length===0){let n=new Map(this.cubes);n.set(e.name,e);let r=new M(n);r.buildGraph(e);let i=r.detectCycle();i&&t.push(N(`server.validation.calculatedMeasure.circularDependency`,{cycle:i.join(` -> `)}))}if(t.length>0)throw Error(N(`server.errors.calculatedMeasureValidation`,{cubeName:e.name,details:t.join(`
|
|
@@ -834,7 +834,7 @@ CRITICAL: Return ONLY valid JSON. No markdown, no explanations outside JSON.`;fu
|
|
|
834
834
|
`)}function Ec(e){return e.messages.map(e=>e.content.text).join(`
|
|
835
835
|
|
|
836
836
|
`)}function Dc(e){return[`# Drizzle Cube Analytics Agent`,``,`You are an analytics agent that helps users explore and visualize data.`,`You have access to a semantic layer with cubes (data models) that you can query.`,``,`## Your Workflow`,``,`For EACH insight, follow this cycle — do NOT batch all queries first:`,``,"1. **Discover** available cubes using `discover_cubes` (once at the start)",`2. **For each analysis point**, repeat this cycle:`," a. `execute_query` — get the data"," b. `add_markdown` — explain the results and insight"," c. `add_portlet` — visualize the results",``,`Call all three (query → markdown → portlet) in a single turn before moving on to the next analysis.`,`Do NOT run multiple queries first and add charts later — the user sees results in real-time.`,``,`## Important Guidelines`,``,`- ALWAYS discover cubes first before attempting queries`,"- Field names MUST be EXACTLY `CubeName.fieldName` — two parts separated by a single dot. Examples: `PullRequests.count`, `Teams.name`, `Employees.department`."," WRONG patterns that WILL FAIL: `Teams.Teams.name` (double-prefixed), `PullRequests.PullRequests.count` (double-prefixed), `PullRequests` (bare cube), `Teams_count` (underscore). Use the EXACT field names from discover results — copy them verbatim, do not prefix them again.",`- Order keys MUST be one of the measures or dimensions already listed in that query. You CANNOT order by a field that is not in measures or dimensions — add it to measures first, or remove it from order.`,"- After EVERY `execute_query`, IMMEDIATELY call `add_markdown` and `add_portlet` in the SAME turn — never defer visualizations to a later turn",`- Choose appropriate chart types: bar for categories, line for trends, table for detailed data`,`- If a query fails, explain the error and try an alternative approach`,``,`## Output Format Rules`,``,`### CRITICAL: Always think before acting`,`- EVERY single turn MUST begin with a text message (1-2 sentences) BEFORE any tool calls. This is your #1 rule — never violate it.`,`- This applies to EVERY turn, including turns where you are adding visualizations or explanations to the notebook.`,`- Even when adding multiple charts in sequence, each turn must start with a brief status like "Now I'll chart the productivity breakdown." or "Next, let me show the department comparison."`,`- Example good turn: "Let me see what data is available." → discover_cubes`,`- Example good turn: "I'll add a chart showing the top employees." → add_markdown → add_portlet`,`- Example bad turn: (no text) → add_portlet ← NEVER do this`,``,`### Text vs Notebook`,"- ALL analysis, findings, methodology, and insights MUST go through `add_markdown` tool calls — never in your text responses",`- Your text responses must be 1-2 short sentences (under 50 words) summarizing what you are about to do next — status updates only`,`- Never use markdown formatting (headers, bullets, bold, code blocks) in text responses — plain sentences only`,`- Write text responses as a friendly analyst would — use plain business language the user understands`,`- NEVER mention internal terms like "cube", "query syntax", "field names", "measures", "dimensions", "portlet", "prefix format", or tool names in text responses`,`- Instead of "Let me correct the query syntax and retry" → "Let me fix that and try again"`,`- Instead of "I'll query the PullRequests cube" → "I'll look at the pull request data"`,`- Instead of "Adding a portlet with the results" → "Here's a chart of the results"`,``,`### Notebook content rules`,"- Before each `add_portlet`, ALWAYS call `add_markdown` first to explain WHY you are adding this visualization and what it shows","- Before calling `add_portlet`, verify the query is valid: all fields in `order` must also appear in `measures` or `dimensions`",'- Never put data tables in markdown blocks — use `add_portlet` with chartType "table" instead',"- Think out loud in the notebook: use `add_markdown` to share your reasoning at each step so users can follow along",`- NEVER use emojis in text responses or markdown content — no 📊, 📈, ✅, 🔍, etc. Write in plain, professional language.`,``,`## Chart Selection Guide`,``,`Choose the chart type that best communicates the answer to the user's question. Think about what the data represents and what insight the user needs — do NOT default to the first option in this table. Consider the number of data points, whether values are categorical or temporal, and whether the user is comparing, trending, or summarizing.`,``,`| Intent / Data Shape | Chart Type |`,`|---|---|`,"| Compare discrete categories or rankings | `bar` |","| Trend over time (one or few series) | `line` |","| Trend over time showing volume/magnitude | `area` |","| Part-of-whole breakdown | `pie` (≤7 slices) |","| Correlation between two measures | `scatter` |","| Correlation with size/color third dimension | `bubble` |","| Intensity across two categorical dimensions | `heatmap` |","| Multi-variable comparison across categories | `radar` |","| Distribution/spread of values | `boxPlot` |","| Detailed row-level data or many columns | `table` |","| Single headline number — ONLY when user explicitly asks for a KPI card or single number | `kpiNumber` |","| Headline metric with period-over-period change — ONLY when user asks about change in a single metric | `kpiDelta` |",``,`Analysis-mode-specific chart types (require the corresponding analysis mode):`,``,`| Analysis Mode | Chart Type | Description |`,`|---|---|---|`,"| Funnel | `funnel` | Sequential step conversion bars with conversion rates |","| Flow | `sankey` | Flow diagram showing paths between states/steps |","| Flow | `sunburst` | Radial rings showing forward paths from a starting event |","| Retention | `retentionHeatmap` | Cohort × period retention matrix |","| Retention | `retentionCombined` | Retention with line chart, heatmap, or combined modes |",``,'**Chart selection priorities:** Default to `bar` for categories, `line` for time series, `table` for exploratory data. Use `kpiNumber`/`kpiDelta` only as a last resort — they are appropriate only when the user explicitly asks for a single headline number or KPI card. If the query returns multiple rows or the user asks a general question like "show me revenue", prefer `bar` or `table` over `kpiNumber`.',``,`## Chart Axis Configuration Rules`,``,"**Bar charts MUST have an xAxis.** Put a dimension in `chartConfig.xAxis` so bars have category labels. If your query has no dimensions, add one or use `table` instead.",``,"**Never duplicate xAxis in series.** Putting the same dimension in both `xAxis` and `series` creates a sparse, broken-looking chart. The `series` field is ONLY for splitting bars into grouped/stacked sub-series by a SECOND dimension.",``,`Correct bar chart examples:`,'- Categories only: `xAxis: ["Cube.category"], yAxis: ["Cube.count"]` — no series needed','- Grouped bars: `xAxis: ["Cube.category"], yAxis: ["Cube.count"], series: ["Cube.status"]` — series is a DIFFERENT dimension','- Multiple measures: `xAxis: ["Cube.category"], yAxis: ["Cube.count", "Cube.total"]` — each measure becomes a bar group',``,`Wrong:`,'- `xAxis: [], yAxis: ["Cube.avg1", "Cube.avg2"]` — missing xAxis, bars have no labels','- `xAxis: ["Cube.size"], series: ["Cube.size"]` — same field in both, creates sparse chart',``,"**Dual Y-axis for multi-measure charts.** When a `bar`, `line`, or `area` chart has 2+ measures with different scales (e.g. revenue in thousands vs conversion rate as a percentage), use `chartConfig.yAxisAssignment` to put them on separate axes:","```json",`{`,` "xAxis": ["Sales.month"],`,` "yAxis": ["Sales.revenue", "Sales.conversionRate"],`,` "yAxisAssignment": { "Sales.revenue": "left", "Sales.conversionRate": "right" }`,`}`,"```",`Only use dual axis when measures have genuinely different scales. If both measures share the same unit/scale, keep them on the same (left) axis — omit yAxisAssignment entirely.`,``,`## Analysis Mode Decision Tree`,``,`The default mode is **query** (standard measures/dimensions). Switch to a special mode only when the user's question matches:`,``,`- **Funnel mode** — "What is the conversion rate from step A → B → C?"`," - Requires: an event-stream cube with `capabilities.funnel = true` from `discover_cubes`"," - Execute: `execute_query` with `funnel` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", steps: [{ name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, { name: "Purchase", filter: { member: "Events.eventName", operator: "equals", values: ["purchase"] }}] }`',' - Visualize: `add_portlet` with `chartType: "funnel"` and `query` as JSON string containing `{ "funnel": { ... } }`',``,`- **Flow mode** — "What paths do users take after signup?"`," - Requires: `capabilities.flow = true` from `discover_cubes`"," - Execute: `execute_query` with `flow` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", eventDimension: "Events.eventName", startingStep: { name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, stepsBefore: 0, stepsAfter: 3 }`',' - Visualize: `add_portlet` with `chartType: "sankey"` (or `"sunburst"`) and `query` as JSON string containing `{ "flow": { ... } }`',``,`- **Retention mode** — "What % of users come back after 7 days?"`," - Requires: `capabilities.retention = true` from `discover_cubes`"," - Execute: `execute_query` with `retention` param:",' `{ timeDimension: "Events.timestamp", bindingKey: "Events.userId", dateRange: { start: "2024-01-01", end: "2024-03-31" }, granularity: "week", periods: 8, retentionType: "classic" }`',' - Visualize: `add_portlet` with `chartType: "retentionCombined"` (or `"retentionHeatmap"`) and `query` as JSON string containing `{ "retention": { ... } }`',``,"Before using funnel/flow/retention, check the `capabilities` object returned by `discover_cubes`. If the required capability is `false`, explain to the user that the data model does not support that analysis mode.",``,`Event-stream cubes are marked in the Available Cubes section below with **Event Stream: Yes** and list their binding key and time dimension.`,``,`---`,``,Ec(Qs),``,`---`,``,Ec($s),``,`---`,``,Ec(ec),``,`---`,``,`## Save as Dashboard`,``,"ONLY call `save_as_dashboard` when the user EXPLICITLY asks to save, export, or convert the notebook into a dashboard. NEVER save a dashboard on your own initiative — wait for the user to request it.",``,`### Layout Rules`,`- Dashboard grid is 12 columns wide`,`- KPI cards: w=3, h=3 — place at the top in a row of 4`,`- Overview charts (bar, line, area): w=6, h=4`,`- Wide charts (heatmap, table): w=12, h=5`,`- Section headers (markdown): w=12, h=1`,``,`### Section Headers`,'Use `chartType: "markdown"` portlets as section headers to organize the dashboard:',"```json",`{`,` "id": "header-overview",`,` "title": "Overview",`,` "chartType": "markdown",`,` "displayConfig": {`,` "content": "## Overview",`,` "hideHeader": true,`,` "transparentBackground": true,`,` "autoHeight": true`,` },`,` "w": 12, "h": 1, "x": 0, "y": 0`,`}`,"```",``,`### Dashboard Filters`,"- ALWAYS include a universal date filter with `isUniversalTime: true`",`- Add dimension filters for key fields used across portlets (e.g., department, status, region)`,`- Use human-readable labels (e.g., "Department" not "Employees.departmentName")`,"- Map filters to portlets using `dashboardFilterMapping` — list the filter IDs that apply",`- When promoting a hardcoded filter to a dashboard filter, REMOVE that filter from the portlet query`,``,`### Analysis Types`,'- Standard query portlets: `analysisType: "query"` (default)','- Funnel portlets: `analysisType: "funnel"`, query contains `{ "funnel": {...} }`, chartType `"funnel"`','- Flow portlets: `analysisType: "flow"`, query contains `{ "flow": {...} }`, chartType `"sankey"` or `"sunburst"`','- Retention portlets: `analysisType: "retention"`, query contains `{ "retention": {...} }`, chartType `"retentionHeatmap"` or `"retentionCombined"`',``,`### CRITICAL: Only use portlets from the notebook`,"- ONLY include portlets that you already added to the notebook via `add_portlet` during this conversation",`- Do NOT invent new queries or charts that were not part of the analysis — the dashboard is a direct conversion of the notebook`,`- Reuse the exact same queries, chart types, and chart configs from the notebook portlets`,`- Arrange the existing portlets in a sensible layout (KPIs at top, charts in middle, tables at bottom)`,`- You may add section header markdown portlets to organize the layout, but do not add new data portlets`,``,`---`,``,Tc(e)].join(`
|
|
837
|
-
`)}var Oc={bar:{label:`chart.bar.label`,description:`chart.bar.description`,useCase:`chart.bar.useCase`,clickableElements:{bar:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.dropZone.xAxis.description`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.bar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_bar_heights`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.bar.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.dropZone.series.label`,description:`chart.dropZone.series.description`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.bar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_bar_series`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},line:{label:`chart.line.label`,description:`chart.line.description`,useCase:`chart.line.useCase`,clickableElements:{point:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.line.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_line_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.line.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_multiple_lines`,description:`chart.configText.dimensions_to_create_separate_lines`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.line.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`priorPeriodStyle`,label:`chart.option.priorPeriodStyle.label`,type:`select`,defaultValue:`dashed`,options:[{value:`dashed`,label:`chart.option.priorPeriodStyle.dashed`},{value:`dotted`,label:`chart.option.priorPeriodStyle.dotted`},{value:`solid`,label:`chart.option.priorPeriodStyle.solid`}],description:`chart.option.priorPeriodStyle.description`},{key:`priorPeriodOpacity`,label:`chart.option.priorPeriodOpacity.label`,type:`number`,defaultValue:.5,min:.1,max:1,step:.1,description:`chart.option.priorPeriodOpacity.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},area:{label:`chart.area.label`,description:`chart.area.description`,useCase:`chart.area.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.area.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_area_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.area.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_stack_areas`,description:`chart.configText.dimensions_to_create_stacked_areas`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.area.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_area_series`},{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},pie:{label:`chart.pie.label`,description:`chart.pie.description`,useCase:`chart.pie.useCase`,clickableElements:{slice:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimension_for_pie_slices`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.pie.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measure_for_slice_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.pie.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`select`,description:`chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style`,defaultValue:`0%`,options:[{value:`0%`,label:`chart.configText.none_pie`},{value:`20%`,label:`chart.configText.20_percent`},{value:`40%`,label:`chart.configText.40_percent`},{value:`60%`,label:`chart.configText.60_percent`},{value:`80%`,label:`chart.configText.80_percent`}]},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},scatter:{label:`chart.scatter.label`,description:`chart.scatter.description`,useCase:`chart.scatter.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:e<2&&t<1?{available:!1,reason:`chart.availability.scatter`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.measure_or_dimension_for_x_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.scatter.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.measure_for_y_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.scatter.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_color_groups`,description:`chart.configText.dimension_to_color_points_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.scatter.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.option.yAxisFormat.description`}]},bubble:{label:`chart.bubble.label`,description:`chart.bubble.description`,useCase:`chart.bubble.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<2?{available:!1,reason:`chart.availability.requiresTwoMeasures`}:t<1?{available:!1,reason:`chart.availability.bubble`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.horizontal_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.bubble.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.vertical_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.yAxis.empty`},{key:`sizeField`,label:`chart.configText.bubble_radius`,description:`chart.configText.size_of_bubbles_based_on_this_measure`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.sizeField.empty`},{key:`series`,label:`chart.configText.bubble_labels`,description:`chart.configText.field_to_use_for_bubble_labels_and_identification`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.bubble.dropZone.series.empty`},{key:`colorField`,label:`chart.configText.bubble_colour`,description:`chart.configText.color_bubbles_by_this_field_optional`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`measure`],emptyText:`chart.bubble.dropZone.colorField.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`minBubbleSize`,`maxBubbleSize`,`bubbleOpacity`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_and_values`}]},radar:{label:`chart.radar.label`,description:`chart.radar.description`,useCase:`chart.radar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.axes_categories`,description:`chart.configText.dimensions_for_radar_axes`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radar_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.radar.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_multiple_shapes`,description:`chart.configText.dimensions_to_create_multiple_radar_shapes`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},radialBar:{label:`chart.radialBar.label`,description:`chart.radialBar.description`,useCase:`chart.radialBar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_radial_segments`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radialBar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radial_bar_lengths`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.radialBar.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},treemap:{label:`chart.treemap.label`,description:`chart.treemap.description`,useCase:`chart.treemap.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_treemap_rectangles`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.size`,description:`chart.configText.measure_for_rectangle_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.treemap.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.color_groups`,description:`chart.configText.dimension_to_color_rectangles_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.series.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_size_values`}],clickableElements:{cell:!0}},table:{label:`chart.table.label`,description:`chart.table.description`,useCase:`chart.table.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.columns`,description:`chart.configText.all_fields_to_display_as_columns`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.table.dropZone.xAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_numeric_values`}]},activityGrid:{label:`chart.activityGrid.label`,description:`chart.activityGrid.description`,useCase:`chart.activityGrid.useCase`,isAvailable:({measureCount:e,timeDimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresTimeDimension`}:{available:!0},dropZones:[{key:`dateField`,label:`chart.configText.time_dimension`,description:`chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`],emptyText:`chart.activityGrid.dropZone.dateField.empty`},{key:`valueField`,label:`chart.configText.activity_measure`,description:`chart.configText.measure_used_for_activity_intensity_color_coding`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.activityGrid.dropZone.valueField.empty`}],displayOptions:[`showLabels`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`fitToWidth`,label:`chart.option.fitToWidth.label`,type:`boolean`,defaultValue:!1,description:`chart.option.fitToWidth.description`}],validate:e=>{let{dateField:t,valueField:n}=e;return!t||Array.isArray(t)&&t.length===0?{isValid:!1,message:`chart.activityGrid.validation.timeDimensionRequired`}:!n||Array.isArray(n)&&n.length===0?{isValid:!1,message:`chart.activityGrid.validation.measureRequired`}:{isValid:!0}},clickableElements:{cell:!0}},kpiNumber:{label:`chart.kpiNumber.label`,description:`chart.kpiNumber.description`,useCase:`chart.kpiNumber.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_as_kpi_number`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiNumber.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`target`,label:`chart.runtime.tooltip.targetValue`,type:`string`,placeholder:`e.g., 100`,description:`chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided`},{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`]},kpiDelta:{label:`chart.kpiDelta.label`,description:`chart.kpiDelta.description`,useCase:`chart.kpiDelta.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_track_changes_for`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiDelta.dropZone.yAxis.empty`},{key:`xAxis`,label:`chart.configText.dimension_optional`,description:`chart.configText.dimension_for_ordering_data_typically_time`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.kpiDelta.dropZone.xAxis.empty`}],displayOptionsConfig:[{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:1,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`positiveColorIndex`,label:`chart.configText.positive_change_color`,type:`paletteColor`,defaultValue:2,description:`chart.configText.color_for_positive_changes_increases`},{key:`negativeColorIndex`,label:`chart.configText.negative_change_color`,type:`paletteColor`,defaultValue:3,description:`chart.configText.color_for_negative_changes_decreases`},{key:`showHistogram`,label:`chart.option.showHistogram.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showHistogram.description`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`],validate:e=>!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0?{isValid:!1,message:`chart.kpiDelta.validation.measureRequired`}:{isValid:!0}},kpiText:{label:`chart.kpiText.label`,description:`chart.kpiText.description`,useCase:`chart.kpiText.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_in_the_kpi_text_template`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiText.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`template`,label:`chart.configText.text_template`,type:`string`,placeholder:"e.g., Total Revenue: ${value}",description:`chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.configText.number_of_decimal_places_to_display_for_numeric_values`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`}],displayOptions:[`hideHeader`]},markdown:{label:`chart.markdown.label`,description:`chart.markdown.description`,useCase:`chart.markdown.useCase`,skipQuery:!0,dropZones:[],displayOptionsConfig:[{key:`content`,label:`chart.configText.markdown_content`,type:`string`,placeholder:`# Welcome
|
|
837
|
+
`)}var Oc={bar:{label:`chart.bar.label`,description:`chart.bar.description`,useCase:`chart.bar.useCase`,clickableElements:{bar:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.dropZone.xAxis.description`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.bar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_bar_heights`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.bar.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.dropZone.series.label`,description:`chart.dropZone.series.description`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.bar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`showAllXLabels`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_bar_series`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},line:{label:`chart.line.label`,description:`chart.line.description`,useCase:`chart.line.useCase`,clickableElements:{point:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.line.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_line_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.line.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_multiple_lines`,description:`chart.configText.dimensions_to_create_separate_lines`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.line.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`showAllXLabels`,`hideHeader`],displayOptionsConfig:[{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`priorPeriodStyle`,label:`chart.option.priorPeriodStyle.label`,type:`select`,defaultValue:`dashed`,options:[{value:`dashed`,label:`chart.option.priorPeriodStyle.dashed`},{value:`dotted`,label:`chart.option.priorPeriodStyle.dotted`},{value:`solid`,label:`chart.option.priorPeriodStyle.solid`}],description:`chart.option.priorPeriodStyle.description`},{key:`priorPeriodOpacity`,label:`chart.option.priorPeriodOpacity.label`,type:`number`,defaultValue:.5,min:.1,max:1,step:.1,description:`chart.option.priorPeriodOpacity.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},area:{label:`chart.area.label`,description:`chart.area.description`,useCase:`chart.area.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.area.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_area_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.area.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_stack_areas`,description:`chart.configText.dimensions_to_create_stacked_areas`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.area.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`showAllXLabels`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_area_series`},{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},pie:{label:`chart.pie.label`,description:`chart.pie.description`,useCase:`chart.pie.useCase`,clickableElements:{slice:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimension_for_pie_slices`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.pie.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measure_for_slice_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.pie.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`select`,description:`chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style`,defaultValue:`0%`,options:[{value:`0%`,label:`chart.configText.none_pie`},{value:`20%`,label:`chart.configText.20_percent`},{value:`40%`,label:`chart.configText.40_percent`},{value:`60%`,label:`chart.configText.60_percent`},{value:`80%`,label:`chart.configText.80_percent`}]},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},scatter:{label:`chart.scatter.label`,description:`chart.scatter.description`,useCase:`chart.scatter.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:e<2&&t<1?{available:!1,reason:`chart.availability.scatter`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.measure_or_dimension_for_x_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.scatter.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.measure_for_y_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.scatter.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_color_groups`,description:`chart.configText.dimension_to_color_points_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.scatter.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.option.yAxisFormat.description`}]},bubble:{label:`chart.bubble.label`,description:`chart.bubble.description`,useCase:`chart.bubble.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<2?{available:!1,reason:`chart.availability.requiresTwoMeasures`}:t<1?{available:!1,reason:`chart.availability.bubble`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.horizontal_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.bubble.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.vertical_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.yAxis.empty`},{key:`sizeField`,label:`chart.configText.bubble_radius`,description:`chart.configText.size_of_bubbles_based_on_this_measure`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.sizeField.empty`},{key:`series`,label:`chart.configText.bubble_labels`,description:`chart.configText.field_to_use_for_bubble_labels_and_identification`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.bubble.dropZone.series.empty`},{key:`colorField`,label:`chart.configText.bubble_colour`,description:`chart.configText.color_bubbles_by_this_field_optional`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`measure`],emptyText:`chart.bubble.dropZone.colorField.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`minBubbleSize`,`maxBubbleSize`,`bubbleOpacity`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_and_values`}]},radar:{label:`chart.radar.label`,description:`chart.radar.description`,useCase:`chart.radar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.axes_categories`,description:`chart.configText.dimensions_for_radar_axes`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radar_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.radar.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_multiple_shapes`,description:`chart.configText.dimensions_to_create_multiple_radar_shapes`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},radialBar:{label:`chart.radialBar.label`,description:`chart.radialBar.description`,useCase:`chart.radialBar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_radial_segments`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radialBar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radial_bar_lengths`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.radialBar.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},treemap:{label:`chart.treemap.label`,description:`chart.treemap.description`,useCase:`chart.treemap.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_treemap_rectangles`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.size`,description:`chart.configText.measure_for_rectangle_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.treemap.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.color_groups`,description:`chart.configText.dimension_to_color_rectangles_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.series.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_size_values`}],clickableElements:{cell:!0}},table:{label:`chart.table.label`,description:`chart.table.description`,useCase:`chart.table.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.columns`,description:`chart.configText.all_fields_to_display_as_columns`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.table.dropZone.xAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_numeric_values`}]},activityGrid:{label:`chart.activityGrid.label`,description:`chart.activityGrid.description`,useCase:`chart.activityGrid.useCase`,isAvailable:({measureCount:e,timeDimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresTimeDimension`}:{available:!0},dropZones:[{key:`dateField`,label:`chart.configText.time_dimension`,description:`chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`],emptyText:`chart.activityGrid.dropZone.dateField.empty`},{key:`valueField`,label:`chart.configText.activity_measure`,description:`chart.configText.measure_used_for_activity_intensity_color_coding`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.activityGrid.dropZone.valueField.empty`}],displayOptions:[`showLabels`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`fitToWidth`,label:`chart.option.fitToWidth.label`,type:`boolean`,defaultValue:!1,description:`chart.option.fitToWidth.description`}],validate:e=>{let{dateField:t,valueField:n}=e;return!t||Array.isArray(t)&&t.length===0?{isValid:!1,message:`chart.activityGrid.validation.timeDimensionRequired`}:!n||Array.isArray(n)&&n.length===0?{isValid:!1,message:`chart.activityGrid.validation.measureRequired`}:{isValid:!0}},clickableElements:{cell:!0}},kpiNumber:{label:`chart.kpiNumber.label`,description:`chart.kpiNumber.description`,useCase:`chart.kpiNumber.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_as_kpi_number`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiNumber.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`target`,label:`chart.runtime.tooltip.targetValue`,type:`string`,placeholder:`e.g., 100`,description:`chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided`},{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`]},kpiDelta:{label:`chart.kpiDelta.label`,description:`chart.kpiDelta.description`,useCase:`chart.kpiDelta.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_track_changes_for`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiDelta.dropZone.yAxis.empty`},{key:`xAxis`,label:`chart.configText.dimension_optional`,description:`chart.configText.dimension_for_ordering_data_typically_time`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.kpiDelta.dropZone.xAxis.empty`}],displayOptionsConfig:[{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:1,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`positiveColorIndex`,label:`chart.configText.positive_change_color`,type:`paletteColor`,defaultValue:2,description:`chart.configText.color_for_positive_changes_increases`},{key:`negativeColorIndex`,label:`chart.configText.negative_change_color`,type:`paletteColor`,defaultValue:3,description:`chart.configText.color_for_negative_changes_decreases`},{key:`showHistogram`,label:`chart.option.showHistogram.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showHistogram.description`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`],validate:e=>!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0?{isValid:!1,message:`chart.kpiDelta.validation.measureRequired`}:{isValid:!0}},kpiText:{label:`chart.kpiText.label`,description:`chart.kpiText.description`,useCase:`chart.kpiText.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_in_the_kpi_text_template`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiText.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`template`,label:`chart.configText.text_template`,type:`string`,placeholder:"e.g., Total Revenue: ${value}",description:`chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.configText.number_of_decimal_places_to_display_for_numeric_values`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`}],displayOptions:[`hideHeader`]},markdown:{label:`chart.markdown.label`,description:`chart.markdown.description`,useCase:`chart.markdown.useCase`,skipQuery:!0,dropZones:[],displayOptionsConfig:[{key:`content`,label:`chart.configText.markdown_content`,type:`string`,placeholder:`# Welcome
|
|
838
838
|
|
|
839
839
|
Add your **markdown** content here:
|
|
840
840
|
|