@luzmo/analytics-components-kit 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +6 -3
  2. package/angular/components/add-to-dashboard.ts +20 -6
  3. package/angular/components/data-fields-select.ts +5 -0
  4. package/angular/components/interactive-viz-item.ts +87 -22
  5. package/angular/components/item-grid-item-actions-menu.ts +5 -0
  6. package/angular/components/item-grid.ts +7 -0
  7. package/angular/components/item-option-color-picker.ts +28 -28
  8. package/angular/components/item-option-guidelines.ts +22 -1
  9. package/angular/components/item-option-multi-language-field.ts +7 -7
  10. package/angular/components/item-option-number-field.ts +14 -14
  11. package/angular/components/item-option-positions-number-field.ts +14 -14
  12. package/angular/components/item-option-radio-button-group.ts +7 -7
  13. package/angular/components/item-option-text-field.ts +7 -7
  14. package/angular/components/item-slot-picker-panel.ts +1 -1
  15. package/angular/components/item-slot-picker.ts +7 -7
  16. package/angular/esm/components/add-to-dashboard.d.ts +8 -4
  17. package/angular/esm/components/add-to-dashboard.js +23 -7
  18. package/angular/esm/components/data-fields-select.d.ts +2 -0
  19. package/angular/esm/components/data-fields-select.js +4 -0
  20. package/angular/esm/components/interactive-viz-item.d.ts +30 -9
  21. package/angular/esm/components/interactive-viz-item.js +98 -27
  22. package/angular/esm/components/item-grid-item-actions-menu.d.ts +2 -0
  23. package/angular/esm/components/item-grid-item-actions-menu.js +4 -0
  24. package/angular/esm/components/item-grid.d.ts +3 -1
  25. package/angular/esm/components/item-grid.js +9 -1
  26. package/angular/esm/components/item-option-color-picker.d.ts +10 -10
  27. package/angular/esm/components/item-option-color-picker.js +34 -34
  28. package/angular/esm/components/item-option-guidelines.d.ts +8 -2
  29. package/angular/esm/components/item-option-guidelines.js +26 -2
  30. package/angular/esm/components/item-option-multi-language-field.d.ts +3 -3
  31. package/angular/esm/components/item-option-multi-language-field.js +10 -10
  32. package/angular/esm/components/item-option-number-field.d.ts +5 -5
  33. package/angular/esm/components/item-option-number-field.js +18 -18
  34. package/angular/esm/components/item-option-positions-number-field.d.ts +5 -5
  35. package/angular/esm/components/item-option-positions-number-field.js +18 -18
  36. package/angular/esm/components/item-option-radio-button-group.d.ts +3 -3
  37. package/angular/esm/components/item-option-radio-button-group.js +10 -10
  38. package/angular/esm/components/item-option-text-field.d.ts +3 -3
  39. package/angular/esm/components/item-option-text-field.js +10 -10
  40. package/angular/esm/components/item-slot-picker-panel.d.ts +1 -1
  41. package/angular/esm/components/item-slot-picker-panel.js +1 -1
  42. package/angular/esm/components/item-slot-picker.d.ts +3 -3
  43. package/angular/esm/components/item-slot-picker.js +9 -9
  44. package/angular/package.json +2 -2
  45. package/components/add-to-dashboard/dashboard-actions.d.ts +2 -1
  46. package/components/add-to-dashboard/index.cjs +1 -1
  47. package/components/add-to-dashboard/index.js +1 -1
  48. package/components/{add-to-dashboard-CzIuDtAq.cjs → add-to-dashboard-BtzTZdjN.cjs} +1 -1
  49. package/components/{add-to-dashboard-DGC0_hRB.js → add-to-dashboard-Bu6S3qVz.js} +125 -120
  50. package/components/chart-helpers-BHxQbLBw.cjs +20 -0
  51. package/components/{chart-helpers-Cbl3sRra.js → chart-helpers-BKeMLhov.js} +51 -38
  52. package/components/filters/index.cjs +1 -1
  53. package/components/filters/index.js +1 -1
  54. package/components/{filters-CxIzuI5q.js → filters-DEpmh9Nj.js} +113 -102
  55. package/components/filters-LDXhe1Bp.cjs +187 -0
  56. package/components/index.cjs +1 -1
  57. package/components/index.js +6 -6
  58. package/components/interactive-viz-item/helpers/chart-helpers.d.ts +2 -1
  59. package/components/interactive-viz-item/index.cjs +1 -1
  60. package/components/interactive-viz-item/index.js +3 -3
  61. package/components/interactive-viz-item/interactive-viz-item.d.ts +44 -0
  62. package/components/{interactive-viz-item-BKLOmawA.js → interactive-viz-item-Cc3Ix95e.js} +151 -110
  63. package/components/interactive-viz-item-SF12d97t.cjs +269 -0
  64. package/components/item-grid/item-grid.d.ts +1 -0
  65. package/components/item-slot-picker-panel/index.cjs +1 -1
  66. package/components/item-slot-picker-panel/index.js +1 -1
  67. package/components/item-slot-picker-panel/item-slot-picker-panel.d.ts +19 -1
  68. package/components/item-slot-picker-panel-Cw3UCK03.cjs +84 -0
  69. package/components/{item-slot-picker-panel-fJqEmxeD.js → item-slot-picker-panel-DprM9Rli.js} +64 -33
  70. package/custom-elements.json +3044 -2532
  71. package/grid-core/item-grid-base.d.ts +5 -4
  72. package/package.json +1 -1
  73. package/react/package.json +2 -2
  74. package/standalone/add-to-dashboard.js +1 -1
  75. package/standalone/chunks/{chart-helpers-CR-EUEPf.js → chart-helpers-DZsidiCl.js} +1 -1
  76. package/standalone/chunks/data-broker-DpSrH3IP.js +2 -0
  77. package/standalone/chunks/{display-settings-binning-BeLLxd3i.js → display-settings-binning-DhHlclWH.js} +1 -1
  78. package/standalone/chunks/{display-settings-datetime-BkeiKIVV.js → display-settings-datetime-C8xvOvi4.js} +1 -1
  79. package/standalone/chunks/{display-settings-grand-totals-BuhpQKJ6.js → display-settings-grand-totals-CUpigDcs.js} +1 -1
  80. package/standalone/chunks/{display-settings-numeric-m30IYI7I.js → display-settings-numeric-BLWF54Jx.js} +1 -1
  81. package/standalone/chunks/{display-settings-period-over-period-CqDlOSRn.js → display-settings-period-over-period-COd4tvUw.js} +1 -1
  82. package/standalone/chunks/en-DNsyAwgq.js +2 -0
  83. package/standalone/chunks/en-GB-Di3OzVdL.js +2 -0
  84. package/standalone/chunks/en-US-DNsyAwgq.js +2 -0
  85. package/standalone/chunks/{filters-CxgBXUF1.js → filters-lhg_WVDK.js} +72 -72
  86. package/standalone/chunks/{formula-codemirror-Cq94j3-f.js → formula-codemirror-DZMzLE2I.js} +1 -1
  87. package/standalone/chunks/{item-option-action-button-group-BoyqF9vt.js → item-option-action-button-group-Bl1HR1JK.js} +1 -1
  88. package/standalone/chunks/{item-option-base-CBcDT8MX.js → item-option-base-DF24wTyv.js} +1 -1
  89. package/standalone/chunks/{item-option-color-palette-picker-C9PGAv4V.js → item-option-color-palette-picker-MkIIn56p.js} +1 -1
  90. package/standalone/chunks/{item-option-color-picker-D4fVJlqF.js → item-option-color-picker-CxosMo_p.js} +1 -1
  91. package/standalone/chunks/{item-option-color-range-BlAdTguE.js → item-option-color-range-C7C70r4J.js} +1 -1
  92. package/standalone/chunks/{item-option-guidelines-DMsYsHDu.js → item-option-guidelines-iu8yWRzr.js} +1 -1
  93. package/standalone/chunks/{item-option-multi-language-field-NUbm1drg.js → item-option-multi-language-field-foanqCdr.js} +1 -1
  94. package/standalone/chunks/{item-option-number-field-DRp7kbHL.js → item-option-number-field-ByVD4oq0.js} +1 -1
  95. package/standalone/chunks/{item-option-panel-cXrRclzM.js → item-option-panel-Bya-K7HH.js} +2 -2
  96. package/standalone/chunks/{item-option-picker-Ba09L4Cs.js → item-option-picker-CqNNVIML.js} +1 -1
  97. package/standalone/chunks/{item-option-position-picker-GEGTnhjw.js → item-option-position-picker-BjCFVtDH.js} +1 -1
  98. package/standalone/chunks/{item-option-positions-number-field-n44s1k5v.js → item-option-positions-number-field-BJJtXZL-.js} +1 -1
  99. package/standalone/chunks/{item-option-radio-button-group-3s_b1NvR.js → item-option-radio-button-group-C5bxsD85.js} +1 -1
  100. package/standalone/chunks/{item-option-slider-DtY65Gxk.js → item-option-slider-DUXWz70B.js} +1 -1
  101. package/standalone/chunks/{item-option-switch-4sJaI0mx.js → item-option-switch-BHyJuOkP.js} +1 -1
  102. package/standalone/chunks/{item-option-text-field-Bt6Lj6kh.js → item-option-text-field-rBZY9OX4.js} +1 -1
  103. package/standalone/chunks/{item-slot-picker-panel-BOSVFBIy.js → item-slot-picker-panel-BM82vSXi.js} +74 -72
  104. package/standalone/chunks/load-data-fields-for-datasets-DS9O1oyy.js +25 -0
  105. package/standalone/chunks/localize-DLl7tgQp.js +2 -0
  106. package/standalone/interactive-viz-item.js +54 -53
  107. package/standalone/manifest.json +31 -31
  108. package/types.d.ts +1 -1
  109. package/components/chart-helpers-fMnqHRzC.cjs +0 -20
  110. package/components/filters-BPbPFOu5.cjs +0 -187
  111. package/components/interactive-viz-item-ojdH1uk0.cjs +0 -268
  112. package/components/item-slot-picker-panel-BhhN54IM.cjs +0 -82
  113. package/standalone/chunks/data-broker-DXDyIrj_.js +0 -2
  114. package/standalone/chunks/en-63f7j4v7.js +0 -2
  115. package/standalone/chunks/en-GB-QAmXQf8W.js +0 -2
  116. package/standalone/chunks/en-US-63f7j4v7.js +0 -2
  117. package/standalone/chunks/load-data-fields-for-datasets-CDlut-6S.js +0 -25
  118. package/standalone/chunks/localize-DXRmGRe-.js +0 -2
@@ -106,6 +106,7 @@ export declare class ItemGridBase extends LuzmoElement {
106
106
  private _gridElement;
107
107
  private _gridItemElements;
108
108
  private _grid?;
109
+ /** Renders an item whose type has no renderer registered with `registerRenderer`. */
109
110
  defaultRenderer: GridItemRenderer;
110
111
  private _activeItemElement?;
111
112
  private _activeItemActionToggle?;
@@ -159,6 +160,7 @@ export declare class ItemGridBase extends LuzmoElement {
159
160
  * Get the GridStack instance
160
161
  */
161
162
  get grid(): GridStack | undefined;
163
+ /** The grid items paired with their rendered grid elements. */
162
164
  get gridItems(): {
163
165
  item: GridItemData;
164
166
  element: HTMLElement;
@@ -200,11 +202,10 @@ export declare class ItemGridBase extends LuzmoElement {
200
202
  * Programmatically trigger a toggle action on a grid item.
201
203
  * Toggles the state (active→inactive, inactive→active) unless `active` is explicitly set.
202
204
  * Waits for any pending render to complete before checking for the element.
205
+ * Resolves to the new active state (true if activated, false if deactivated), or undefined if the item is not found.
203
206
  * @param itemId - The ID of the grid item
204
207
  * @param action - The action name to trigger
205
- * @param options - Optional configuration
206
- * @param options.active - Force active state (true/false). If omitted, toggles the current state.
207
- * @returns The new active state (true if activated, false if deactivated), or undefined if item not found
208
+ * @param options - Optional configuration. Set `active` to force the active state (true/false); if omitted, toggles the current state.
208
209
  */
209
210
  triggerItemAction(itemId: string, action: string, options?: {
210
211
  active?: boolean;
@@ -215,7 +216,7 @@ export declare class ItemGridBase extends LuzmoElement {
215
216
  private _triggerControlledItemAction;
216
217
  /**
217
218
  * Deactivate all active items and dispatch deactivation events.
218
- * @returns The number of items that were deactivated
219
+ * Returns the number of items that were deactivated.
219
220
  */
220
221
  deactivateItems(): number;
221
222
  private _renderGrid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luzmo/analytics-components-kit",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cumulio-internal/analytics-components-kit.git"
@@ -29,9 +29,9 @@
29
29
  "peerDependencies": {
30
30
  "@lit/react": "^1.0.6",
31
31
  "react": "^18.0.0 || ^19.0.0",
32
- "@luzmo/analytics-components-kit": "^1.3.0"
32
+ "@luzmo/analytics-components-kit": "^1.4.0"
33
33
  },
34
- "version": "1.3.0",
34
+ "version": "1.4.0",
35
35
  "repository": {
36
36
  "type": "git",
37
37
  "url": "git+https://github.com/cumulio-internal/analytics-components-kit.git"
@@ -19,7 +19,7 @@
19
19
  *
20
20
  */
21
21
 
22
- import{i as e,n as t,r as n,t as r}from"./chunks/localized-mixin-BWJj88bd.js";import{t as i}from"./chunks/localized-decorator-DosMCCQo.js";import{t as a}from"./chunks/luzmoAngleDown-PNrItYzK.js";import{t as o}from"./chunks/luzmoAngleLeft-ebJO7ROy.js";import{t as s}from"./chunks/luzmoArrowsHorizontal-TohKbcQD.js";import{t as c}from"./chunks/luzmoPlus-Dyrrz0v8.js";import{d as l,f as u,o as d,p as f}from"./chunks/chart-helpers-CR-EUEPf.js";import{t as p}from"./chunks/data-broker-DXDyIrj_.js";import{t as m}from"./chunks/localize-DXRmGRe-.js";import{html as h,ifDefined as g,nothing as _,property as v,query as y,state as b,unsafeCSS as x}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/checkbox.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/divider.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/notice.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/overlay.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/popover.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/progress-circle.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/search.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/tooltip.js";var S={icon:[32,32,`m9.3 7.3-9 9a1 1 0 0 0 0 1.4l9 9c1 1 2.3-.5 1.4-1.4L3.4 18H31c1.3 0 1.3-2 0-2H3.4l7.3-7.3c1-1-.5-2.3-1.4-1.4Z`],name:`arrow-left`},C={icon:[32,32,`m22.7 7.3 9 9c.4.4.4 1 0 1.4l-9 9c-1 1-2.4-.5-1.4-1.4l7.3-7.3H1c-1.3 0-1.3-2 0-2h27.6l-7.3-7.3c-1-1 .5-2.3 1.4-1.4z`],name:`arrow-right`},w={icon:[14,32,`m3.7 8.2 8 7a1 1 0 0 1 0 1.6l-8 7c-1 .8-2.3-.7-1.4-1.6L9.5 16 2.3 9.8c-1-1 .4-2.4 1.4-1.6z`],name:`angle-right`},T={icon:[32,32,`M13.1 2.05.53 26.55C-.797 29.136.63 32 4.43 32H27.6c3.8 0 5.23-2.865 3.9-5.45L18.9 2.05c-1.423-2.745-4.437-2.686-5.8 0zm4 .9 12.6 24.5c.72 1.43.04 2.55-2.1 2.55H4.43c-2.14 0-2.82-1.12-2.1-2.55L14.9 2.95c.614-1.268 1.586-1.268 2.2 0zM15 11v10c0 1.3 2 1.3 2 0V11c0-1.305-2-1.305-2 0zm-.5 14.5c0 1.961 3 1.961 3 0s-3-1.961-3 0z`],name:`alert-outline`},E={icon:[32,32,`m14 26c-1.4 0-1.4 2 0 2h4c1.4 0 1.4-2 0-2zM10 2C7.8 2 6 3.8 6 6v22c0 2.2 1.8 4 4 4h12c2.2 0 4-1.8 4-4V6C26 3.8 24.2 2 22 2Zm0 2h12c1.1 0 2 0.9 2 2v22c0 1.1-0.9 2-2 2H10C8.9 30 8 29.1 8 28V6C8 4.9 8.9 4 10 4Z`],name:`mobile`},D={icon:[32,32,`m12 26c-1.4 0-1.4 2 0 2h8c1.4 0 1.4-2 0-2zM6 0C3.8 0 2 1.8 2 4v24c0 2.2 1.8 4 4 4h20c2.2 0 4-1.8 4-4V4C30 1.8 28.2 0 26 0Zm0 2h20c1.1 0 2 0.9 2 2v24c0 1.1-0.9 2-2 2H6C4.9 30 4 29.1 4 28V4C4 2.9 4.9 2 6 2Z`],name:`tablet`},ee={icon:[40,32,`M7 2C5.4 2 4 3.4 4 5v19c0 1.6 1.4 3 3 3h26c1.6 0 3-1.4 3-3V5C36 3.4 34.6 2 33 2Zm0 2h26c0.6 0 1 0.4 1 1v19c0 0.6-0.4 1-1 1H7C6.4 25 6 24.6 6 24V5C6 4.4 6.4 4 7 4ZM1 25a1 1 0 0 0-1 1v1c0 2.7 2.3 5 5 5h30c2.7 0 5-2.3 5-5v-1a1 1 0 0 0-1-1zm1 2h36c0 1.7-1.3 3-3 3H5C3.3 30 2 28.7 2 27Z`],name:`laptop`},te={icon:[40,32,`m18.2 22-2.2 8.8 1.9 0.5L19.8 24h0.4l1.8 7.2 1.9-0.5L21.8 22ZM11 30a1 1 0 0 0-1 1 1 1 0 0 0 1 1h18a1 1 0 0 0 1-1 1 1 0 0 0-1-1zM3 0C1.4 0 0 1.4 0 3v18c0 1.6 1.4 3 3 3h34c1.6 0 3-1.4 3-3V3C40 1.4 38.6 0 37 0Zm0 2h34c0.6 0 1 0.4 1 1v18c0 0.6-0.4 1-1 1H3C2.4 22 2 21.6 2 21V3C2 2.4 2.4 2 3 2Z`],name:`desktop`},ne={icon:[32,32,`M24 0C22 0 20 0.8 18.5 2.2A0.9 0.9 0 0 0 18.5 2.2 0.9 0.9 0 0 0 18.4 2.3C18.4 2.3 18.4 2.3 18.3 2.3A0.9 0.9 0 0 0 18.2 2.5 0.9 0.9 0 0 0 18.2 2.5L13.2 7.5A0.9 0.9 0 0 0 13.2 7.5 0.9 0.9 0 0 0 13.1 7.6C13.1 7.6 13.1 7.6 13.1 7.6L13 7.7A0.9 0.9 0 0 0 12.8 8.1 0.9 0.9 0 0 0 12.8 8.1C11.7 9.5 11 11.2 11 13 11 16.4 13.2 19.5 16.5 20.6A0.9 0.9 0 0 0 17.6 20 0.9 0.9 0 0 0 17 18.9C14.5 18 12.8 15.7 12.8 13 12.8 11.5 13.4 10 14.4 8.9L19.6 3.6A0.9 0.9 0 0 0 19.7 3.6C20.8 2.5 22.4 1.8 24 1.8 27.4 1.8 30.2 4.6 30.2 8 30.2 9.6 29.5 11.2 28.4 12.3A0.9 0.9 0 0 0 28.4 12.4L23.4 17.4A0.9 0.9 0 0 0 23.4 18.6 0.9 0.9 0 0 0 24.6 18.6L29.5 13.8A0.9 0.9 0 0 0 29.7 13.7C29.7 13.6 29.7 13.6 29.7 13.6A0.9 0.9 0 0 0 29.8 13.5 0.9 0.9 0 0 0 29.8 13.4C31.2 12 32 10 32 8 32 3.6 28.4 0 24 0zM15.2 11.4A0.9 0.9 0 0 0 14.4 12 0.9 0.9 0 0 0 15 13.1C17.5 14 19.2 16.3 19.2 19 19.2 20.5 18.6 22 17.6 23.1L12.4 28.4A0.9 0.9 0 0 0 12.3 28.4C11.2 29.5 9.6 30.2 8 30.2 4.6 30.2 1.8 27.4 1.8 24 1.8 22.4 2.5 20.8 3.6 19.7A0.9 0.9 0 0 0 3.6 19.6L8.6 14.6A0.9 0.9 0 0 0 8.6 13.4 0.9 0.9 0 0 0 7.4 13.4L2.5 18.2A0.9 0.9 0 0 0 2.3 18.3C2.3 18.4 2.3 18.4 2.3 18.4A0.9 0.9 0 0 0 2.2 18.5 0.9 0.9 0 0 0 2.2 18.6C0.8 20 0 22 0 24 0 28.4 3.6 32 8 32 10 32 12 31.2 13.5 29.8 13.5 29.8 13.5 29.8 13.5 29.8A0.9 0.9 0 0 0 13.6 29.7C13.6 29.7 13.6 29.7 13.7 29.7A0.9 0.9 0 0 0 13.8 29.5 0.9 0.9 0 0 0 13.8 29.5L18.8 24.5 18.8 24.5A0.9 0.9 0 0 0 18.9 24.4C18.9 24.4 18.9 24.4 18.9 24.4L19 24.3A0.9 0.9 0 0 0 19.2 23.9C19.2 23.9 19.2 23.9 19.2 23.9 20.3 22.5 21 20.8 21 19 21 15.6 18.8 12.5 15.5 11.4A0.9 0.9 0 0 0 15.2 11.4z`],name:`link`},re={icon:[32,32,`M16 0a16 16 0 1 0 0 32 16 16 0 0 0 0-32Zm0 2a14 14 0 0 1 14 14 14 14 0 0 1-14 14A14 14 0 0 1 2 16 14 14 0 0 1 16 2Zm5.2 8.4-6.3 9-4.2-4.1c-1-1-2.3.5-1.4 1.4l5 5a1 1 0 0 0 1.5-.1l7-10c.8-1.1-.9-2.2-1.6-1.2z`],name:`check-circle-outline`},O=`:host{align-items:flex-end;gap:var(--luzmo-spacing-2);font-family:var(--luzmo-font-family);flex-direction:column;display:inline-flex}.trigger-spinner{--luzmo-progress-circle-size:var(--luzmo-icon-size-xs)}.trigger-chevron{margin-inline-start:var(--luzmo-spacing-1)}.picker{gap:var(--luzmo-spacing-3);width:var(--luzmo-add-to-dashboard-picker-width,var(--add-to-dashboard-picker-width));max-width:90vw;padding:var(--luzmo-spacing-2);color:var(--luzmo-font-color);font-size:var(--luzmo-font-size-s);flex-direction:column;display:flex}luzmo-search{width:100%}.list{max-height:var(--luzmo-add-to-dashboard-list-max-height,var(--add-to-dashboard-list-max-height));flex-direction:column;display:flex;overflow-y:auto}.menu{--luzmo-menu-max-height:none;flex:none;width:100%;overflow:visible}.create-row{--luzmo-menu-item-label-icon-color-default:var(--luzmo-primary)}.thumbnail{object-fit:cover;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);width:2.75rem;height:2rem}.drill-in{color:var(--luzmo-font-color-extra-dimmed)}.header{align-items:center;gap:var(--luzmo-spacing-2);display:flex}.header-title{font-weight:var(--luzmo-font-weight-bold);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.empty{align-items:center;gap:var(--luzmo-spacing-3);padding:var(--luzmo-spacing-4);text-align:center;flex-direction:column;display:flex}.loading{padding:var(--luzmo-spacing-3);justify-content:center;display:flex}.screen-modes{gap:var(--luzmo-spacing-2);flex-direction:column;display:flex}.screen-mode{align-items:center;gap:var(--luzmo-spacing-2);display:flex}.screen-mode-size{color:var(--luzmo-font-color-extra-dimmed)}.footer{justify-content:flex-end;display:flex}.status{justify-content:flex-end;width:0;min-width:100%;display:flex}.status:empty{display:none}.alert{flex:none;inline-size:max-content}.alert-body{align-items:center;gap:var(--luzmo-spacing-3);block-size:1lh;min-inline-size:0;display:flex}.alert-text{min-inline-size:0;font-weight:var(--luzmo-font-weight-semibold);white-space:pre;display:flex}.alert[variant=negative] .alert-text{white-space:normal}.alert-name{min-inline-size:0;font-weight:var(--luzmo-font-weight-bold);text-overflow:ellipsis;white-space:nowrap;unicode-bidi:plaintext;overflow:hidden}.alert-open{flex:none}:host{--add-to-dashboard-picker-width:18rem;--add-to-dashboard-list-max-height:16rem}`,k=`0.1.107`,A=`0.1.0`,j=[`id`,`name`,`contents`,`modified_at`,`is_variant`,`original_id`],M=/* @__PURE__ */ new Set([`designer`,`owner`]),N=`flag_dashboard_variants`,P=[`desktop`,`tablet`,`mobile`];async function F(e,t,n){let r=[],i=t,a=0;for(let t of e){let e=n-r.length,o=await t(i,Math.max(e,1));e>0&&r.push(...o.rows.slice(0,e)),i=Math.max(0,i-o.count),a+=o.count}return{rows:r,total:a}}async function I(e){let t=await e.fetchApi(`/user`,{action:`get`,version:A,find:{where:{id:`me`},attributes:[`id`,`flags`]}});return{id:t.rows?.[0]?.id??``,flags:t.rows?.[0]?.flags??[]}}async function L(e,t){return(await e.fetchApi(`/authorization`,{action:`get`,version:A,find:{where:{id:t}}})).rows?.[0]}async function R(e,t,n){let r={...t,where:{...t.where,type:`dashboard`}},i=await e.fetchApi(`/securable`,{action:`get`,version:A,find:r},{signal:n});return{rows:i.rows??[],count:i.count??i.rows?.length??0}}function z(e){let t={modifyIds:/* @__PURE__ */ new Set,useOnlyIds:/* @__PURE__ */ new Set};for(let n of e?.access?.dashboards??[])n.rights?.Modify?t.modifyIds.add(n.id):n.rights?.Use&&t.useOnlyIds.add(n.id);return t}function B(){return{version:k,syncScreenModes:!0,views:P.map(e=>({screenModus:e,options:{theme:{id:`default`}},filterGroups:[],items:[]})),timezone:{type:`fixed`,id:`UTC`}}}function V(e){return e?{search:{match_types:[`name`,`description`],keyphrase:e,securable_types:[`dashboard`]}}:{}}function H(e,t){return{include:[{model:`User`,as:`allUsers`,attributes:[],required:!0,where:{id:e,...Object.fromEntries(Object.entries(t).map(([e,t])=>[`securableAccessRight.${e}`,t]))}}]}}async function U(e){let t=new p({apiUrl:e.apiUrl,authKey:e.authKey,authToken:e.authToken,skipNetworkListeners:!0}),[r,i]=await Promise.all([I(t),L(t,e.authKey)]),a=z(i),o=i?.type!==`embed`||M.has(i.role??``),s=!!r.id&&r.flags.includes(N),c=[...a.modifyIds,...s?a.useOnlyIds:[]],l=c.length>0?{id:{notIn:c}}:{},u=(t,n=!1)=>{let r=[...new Set((t.contents?.views??[]).map(e=>e.screenModus))];return{id:t.id,name:m(t.name??{},e.language),syncScreenModes:t.contents?.syncScreenModes!==!1,screenModes:r.length>0?r:[`desktop`],...n?{requiresVariant:n}:{}}},d,f=(e,n)=>async(r,i)=>{if(c.length===0)return{count:0,rows:[]};let o=r>0&&d?.search===e?d.rows:void 0;return o||(o=(await R(t,{where:{is_variant:!1,archived_at:null,id:{in:c}},attributes:j,...V(e)},n)).rows.map(e=>u(e,!a.modifyIds.has(e.id))).sort((e,t)=>e.name.localeCompare(t.name)),d={search:e,rows:o}),{count:o.length,rows:o.slice(r,r+i)}},h=(e,n,i,a)=>async(o,s)=>{let c=await R(t,{where:{is_variant:!1,archived_at:null,...l},attributes:j,...H(r.id,i),...V(e),limit:s,offset:o,order:[[`modified_at`,`desc`]]},n);return{count:c.count,rows:c.rows.map(e=>u(e,a))}},g=async(e,n,r,i)=>{await t.fetchApi(`/securable`,{action:`update`,version:A,id:e,properties:{append_item:{item:n,...r?.length?{screenModes:r}:{}}}},{signal:i})},_=async(e,n,r)=>{try{await g(e.id,n,r)}catch(n){throw await t.fetchApi(`/securable`,{action:`delete`,version:A,id:e.id}).catch(()=>void 0),n}},v=async(e,n)=>await t.fetchApi(`/securable`,{action:`create`,version:A,properties:{...e,type:`dashboard`},associations:n});return{async list(e,t){return r.id?await F([f(e.search,t.signal),...s?[h(e.search,t.signal,{flagUse:!0,flagModify:!1},!0)]:[],h(e.search,t.signal,{flagModify:!0},!1)],e.offset,e.limit):{rows:[],total:0}},async add(e,t,n,r){await g(e.id,t,n.screenModes,r.signal)},...o?{async create(t,n){let r=await v({name:n.name?{[e.language]:n.name}:{},contents:B()});return await _(r,t,void 0),u(r)}}:{},...s?{async listVariants(e,n){return(await R(t,{where:{is_variant:!0,original_id:e.id,archived_at:null},attributes:j,...H(r.id,{flagModify:!0}),order:[[`modified_at`,`desc`]]},n.signal)).rows.map(e=>u(e))}}:{},...s&&o?{async addToVariant(r,i,a){let o=(await R(t,{where:{id:r.id},attributes:[`id`,`name`,`contents`]})).rows[0];if(!o?.contents)throw Error(n(`The dashboard was not found.`,{desc:`Adding the chart to a variant failed because the original dashboard could not be loaded`}));let s=o.name??{},c=await v({name:a.name?{...s,[e.language]:a.name}:s,contents:o.contents},[{role:`original`,id:r.id}]);return await _(c,i,a.screenModes),u({...c,contents:c.contents??o.contents})}}:{}}}function W(e){let{theme:t,...n}=e.options??{};return{...d(e),options:n}}function G(e,t){let n=new Set(e),r=e.length+1;for(;n.has(t(r));)r+=1;return r}var K=20,q=300,J=8,Y=48,X=`__luzmo-new-dashboard`,Z=`__luzmo-new-variant`,Q=/* @__PURE__ */ new Map,ie=0,$=class extends r(u(f,{validSizes:Object.values(l)})){constructor(...e){super(...e),this.chart=null,this.dashboardActions=null,this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.placement=`bottom-end`,this.disabled=!1,this._open=!1,this._actions=null,this._step=`list`,this._rows=[],this._hasMore=!1,this._loading=!1,this._listFailed=!1,this._original=null,this._variants=[],this._variantsLoading=!1,this._variantsFailed=!1,this._pending=null,this._screenModes=[],this._saving=!1,this._status=null,this._triggerId=`add-to-dashboard-trigger-${++ie}`,this._search=``,this._actionsGeneration=0,this._reloadOnUpdate=!1}static get styles(){let e=super.styles??[];return[...Array.isArray(e)?e:[e],x(O)]}get _hasSource(){return!!this.dashboardActions||!!(this.authKey&&this.authToken)}connectedCallback(){super.connectedCallback(),this._status&&this._startFittingAlert()}disconnectedCallback(){super.disconnectedCallback(),this._handleClosed(),this._actionsGeneration+=1,this._saveAbort?.abort(),this._stopFittingAlert()}willUpdate(e){super.willUpdate(e),(e.has(`dashboardActions`)||e.has(`authKey`)||e.has(`authToken`)||e.has(`apiUrl`)||e.has(`language`))&&(this._actions=null,this._actionsGeneration+=1,this._open&&(this._listAbort?.abort(),this._variantsAbort?.abort(),this._step=`list`,this._original=null,this._pending=null,this._rows=[],this._open=this._hasSource,this._reloadOnUpdate=this._hasSource)),e.has(`disabled`)&&this.disabled&&(this._open=!1),e.has(`chart`)&&!this.chart&&this._handleClosed()}updated(e){super.updated(e),this._reloadOnUpdate&&(this._reloadOnUpdate=!1,this._loadList()),e.has(`_step`)&&this._open&&this._focusStep(),e.has(`_status`)&&(this._status?this._startFittingAlert():this._stopFittingAlert())}get _alertContainer(){let e=this.getRootNode();return this.parentElement??(e instanceof ShadowRoot?e.host:null)}_startFittingAlert(){this._fitAlert();let e=this._alertContainer;!this._alertResizeObserver&&e&&(this._alertResizeObserver=new ResizeObserver(()=>this._fitAlert()),this._alertResizeObserver.observe(this),this._alertResizeObserver.observe(e))}_stopFittingAlert(){this._alertResizeObserver?.disconnect(),this._alertResizeObserver=void 0}_fitAlert(){let e=this._noticeElement,t=this._alertContainer;if(!e||!t)return;let n=this.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(t).paddingInlineStart)||0,a=(this.isLTR?n.right-r.left:r.right-n.left)-i;e.style.setProperty(`--luzmo-notice-max-inline-size`,`${Math.max(0,a)}px`)}async _resolveActions(){if(this.dashboardActions)return this.dashboardActions;let e={apiUrl:this.apiUrl,authKey:this.authKey,authToken:this.authToken,language:this.language},t=JSON.stringify(e),n=Q.get(t);return n||(Q.clear(),n=U(e),Q.set(t,n),n.catch(()=>Q.delete(t))),await n}_dispatch(e,t){let n=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(n)}_displayName(e){return e.name.trim()||n(`Untitled dashboard`,{desc:`Fallback name of a dashboard without a name`})}_variantName(t,r){let i=this._displayName(t);return n(e`${i} (variant ${r})`,{desc:`Name of a new dashboard variant`})}_screenModeChoices(){return[{name:`mobile`,label:n(`Smartphone`,{desc:`Screen mode name`}),size:`< 768px`,icon:E},{name:`tablet`,label:n(`Tablet`,{desc:`Screen mode name`}),size:`≥ 768px`,icon:D},{name:`desktop`,label:n(`Desktop`,{desc:`Screen mode name`}),size:`≥ 1200px`,icon:ee},{name:`largeScreen`,label:n(`Large screen`,{desc:`Screen mode name`}),size:`≥ 1600px`,icon:te},{name:`fixed`,label:n(`Fixed width`,{desc:`Screen mode name`}),icon:s}]}async _handleOpened(e){e.target===e.currentTarget&&(this._open=!0,this._step=`list`,this._search=``,this._original=null,this._pending=null,this._rows=[],await this.updateComplete,this._searchElement?.focus(),await this._loadList())}async _loadList(){let e=this._actionsGeneration;this._loading=!0,this._listFailed=!1;try{let t=this._actions??await this._resolveActions();if(e!==this._actionsGeneration)return;this._actions=t}catch(t){if(!this.isConnected||e!==this._actionsGeneration)return;console.error(`Failed to resolve the add to dashboard actions:`,t),this._loading=!1,this._listFailed=!0;return}this.isConnected&&this._open&&await this._loadPage(!1)}_handleClosed(e){e&&e.target!==e.currentTarget||(this._open=!1,clearTimeout(this._searchTimer),this._listAbort?.abort(),this._variantsAbort?.abort())}async _loadPage(e){let t=this._actions;if(!t)return;this._listAbort?.abort();let n=new AbortController;this._listAbort=n,this._loading=!0,this._listFailed=!1,e||(this._rows=[]);try{let e=await t.list({search:this._search,offset:this._rows.length,limit:K},{signal:n.signal});if(n.signal.aborted)return;this._rows=[...this._rows,...e.rows],this._hasMore=e.total===void 0?e.rows.length===K:this._rows.length<e.total}catch(e){if(n.signal.aborted)return;console.error(`Failed to load dashboards:`,e),this._listFailed=!0}finally{n.signal.aborted||(this._loading=!1)}}_handleSearchInput(e){this._search=String(e.target?.value??``),clearTimeout(this._searchTimer),this._searchTimer=setTimeout(()=>void this._loadPage(!1),q)}_handleListScroll(e){let t=e.target;this._hasMore&&!this._loading&&t.scrollHeight-t.scrollTop-t.clientHeight<=Y&&this._loadPage(!0)}_menuValue(e){return e.stopPropagation(),e.target.value??``}_handleListChange(e){let t=this._menuValue(e);if(t===X){this._actions?.create&&this._save({kind:`create`});return}let n=this._rows.find(e=>e.id===t);n&&(n.requiresVariant?(this._original=n,this._step=`variants`,this._loadVariants()):this._selectTarget({kind:`add`,dashboard:n,isVariant:!1},n))}_handleVariantChange(e){let t=this._menuValue(e),n=this._original;if(!n)return;if(t===Z){if(!this._actions?.addToVariant)return;let e=this._variants.map(e=>this._displayName(e)),t=this._variantName(n,G(e,e=>this._variantName(n,e)));this._selectTarget({kind:`variant`,original:n,name:t},n);return}let r=this._variants.find(e=>e.id===t);r&&this._selectTarget({kind:`add`,dashboard:r,isVariant:!0},r)}_selectTarget(e,t){t.syncScreenModes!==!1||!t.screenModes?.length?this._save(e):(this._pending=e,this._screenModes=[...t.screenModes??[]],this._step=`screenModes`)}async _loadVariants(){let e=this._actions,t=this._original;if(this._variantsAbort?.abort(),this._variants=[],this._variantsLoading=!1,this._variantsFailed=!1,!e?.listVariants||!t)return;let n=new AbortController;this._variantsAbort=n,this._variantsLoading=!0;try{let r=await e.listVariants(t,{signal:n.signal});n.signal.aborted||(this._variants=r)}catch(e){n.signal.aborted||(console.error(`Failed to load dashboard variants:`,e),this._variantsFailed=!0)}finally{n.signal.aborted||(this._variantsLoading=!1)}}_handleBack(){this._step===`screenModes`&&this._original?this._step=`variants`:(this._step=`list`,this._original=null),this._pending=null}_toggleScreenMode(e){this._screenModes=this._screenModes.includes(e)?this._screenModes.filter(t=>t!==e):[...this._screenModes,e]}_handleConfirmScreenModes(){this._pending&&this._screenModes.length>0&&this._save(this._pending,{screenModes:[...this._screenModes]})}async _save(e,t={}){let n=this._actions;if(!n||!this.chart||this._saving)return;this._open=!1,this._saving=!0,this._setStatus(null),this._saveAbort=new AbortController;let r=W(this.chart),i={signal:this._saveAbort.signal};try{let a;if(e.kind===`create`&&n.create)a=await n.create(r,t,i);else if(e.kind===`variant`&&n.addToVariant)a=await n.addToVariant(e.original,r,{...t,name:e.name},i);else if(e.kind===`add`)a=await n.add(e.dashboard,r,t,i)||e.dashboard;else return;if(i.signal.aborted)return;this._setStatus({kind:`success`,dashboard:a,isVariant:e.kind===`variant`||e.kind===`add`&&e.isVariant,openDashboard:n.openDashboard?.bind(n)}),this._dispatch(`luzmo-chart-added`,{dashboard:a})}catch(e){if(i.signal.aborted)return;console.error(`Failed to add the chart to a dashboard:`,e),this._setStatus({kind:`error`,message:e instanceof Error&&e.message?e.message:void 0}),this._dispatch(`luzmo-chart-add-failed`,{error:e})}finally{this._saving=!1}await this.updateComplete,this.isConnected&&this._isFocusLost()&&this._focusTrigger()}_setStatus(e){this._status=e}_focusTrigger(){this._triggerElement?.focus()}_isFocusLost(){return!document.activeElement||document.activeElement===document.body}async _handleNoticeClose(e){e.stopPropagation();let t=e.currentTarget.matches(`:focus-within`);this._setStatus(null),await this.updateComplete,t&&this._isFocusLost()&&this._focusTrigger()}async _focusStep(){let e=this._step===`list`?this._searchElement:this._backElement;await e?.updateComplete,e?.focus()}_renderRow(e){return h`
22
+ import{i as e,n as t,r as n,t as r}from"./chunks/localized-mixin-BWJj88bd.js";import{t as i}from"./chunks/localized-decorator-DosMCCQo.js";import{t as a}from"./chunks/luzmoAngleDown-PNrItYzK.js";import{t as o}from"./chunks/luzmoAngleLeft-ebJO7ROy.js";import{t as s}from"./chunks/luzmoArrowsHorizontal-TohKbcQD.js";import{t as c}from"./chunks/luzmoPlus-Dyrrz0v8.js";import{S as l,b as u,s as d,x as f}from"./chunks/chart-helpers-DZsidiCl.js";import{t as p}from"./chunks/data-broker-DpSrH3IP.js";import{t as m}from"./chunks/localize-DLl7tgQp.js";import{html as h,ifDefined as g,nothing as _,property as v,query as y,state as b,unsafeCSS as x}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/checkbox.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/divider.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/notice.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/overlay.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/popover.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/progress-circle.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/search.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/tooltip.js";var S={icon:[32,32,`m9.3 7.3-9 9a1 1 0 0 0 0 1.4l9 9c1 1 2.3-.5 1.4-1.4L3.4 18H31c1.3 0 1.3-2 0-2H3.4l7.3-7.3c1-1-.5-2.3-1.4-1.4Z`],name:`arrow-left`},C={icon:[32,32,`m22.7 7.3 9 9c.4.4.4 1 0 1.4l-9 9c-1 1-2.4-.5-1.4-1.4l7.3-7.3H1c-1.3 0-1.3-2 0-2h27.6l-7.3-7.3c-1-1 .5-2.3 1.4-1.4z`],name:`arrow-right`},w={icon:[14,32,`m3.7 8.2 8 7a1 1 0 0 1 0 1.6l-8 7c-1 .8-2.3-.7-1.4-1.6L9.5 16 2.3 9.8c-1-1 .4-2.4 1.4-1.6z`],name:`angle-right`},T={icon:[32,32,`M13.1 2.05.53 26.55C-.797 29.136.63 32 4.43 32H27.6c3.8 0 5.23-2.865 3.9-5.45L18.9 2.05c-1.423-2.745-4.437-2.686-5.8 0zm4 .9 12.6 24.5c.72 1.43.04 2.55-2.1 2.55H4.43c-2.14 0-2.82-1.12-2.1-2.55L14.9 2.95c.614-1.268 1.586-1.268 2.2 0zM15 11v10c0 1.3 2 1.3 2 0V11c0-1.305-2-1.305-2 0zm-.5 14.5c0 1.961 3 1.961 3 0s-3-1.961-3 0z`],name:`alert-outline`},E={icon:[32,32,`m14 26c-1.4 0-1.4 2 0 2h4c1.4 0 1.4-2 0-2zM10 2C7.8 2 6 3.8 6 6v22c0 2.2 1.8 4 4 4h12c2.2 0 4-1.8 4-4V6C26 3.8 24.2 2 22 2Zm0 2h12c1.1 0 2 0.9 2 2v22c0 1.1-0.9 2-2 2H10C8.9 30 8 29.1 8 28V6C8 4.9 8.9 4 10 4Z`],name:`mobile`},D={icon:[32,32,`m12 26c-1.4 0-1.4 2 0 2h8c1.4 0 1.4-2 0-2zM6 0C3.8 0 2 1.8 2 4v24c0 2.2 1.8 4 4 4h20c2.2 0 4-1.8 4-4V4C30 1.8 28.2 0 26 0Zm0 2h20c1.1 0 2 0.9 2 2v24c0 1.1-0.9 2-2 2H6C4.9 30 4 29.1 4 28V4C4 2.9 4.9 2 6 2Z`],name:`tablet`},ee={icon:[40,32,`M7 2C5.4 2 4 3.4 4 5v19c0 1.6 1.4 3 3 3h26c1.6 0 3-1.4 3-3V5C36 3.4 34.6 2 33 2Zm0 2h26c0.6 0 1 0.4 1 1v19c0 0.6-0.4 1-1 1H7C6.4 25 6 24.6 6 24V5C6 4.4 6.4 4 7 4ZM1 25a1 1 0 0 0-1 1v1c0 2.7 2.3 5 5 5h30c2.7 0 5-2.3 5-5v-1a1 1 0 0 0-1-1zm1 2h36c0 1.7-1.3 3-3 3H5C3.3 30 2 28.7 2 27Z`],name:`laptop`},te={icon:[40,32,`m18.2 22-2.2 8.8 1.9 0.5L19.8 24h0.4l1.8 7.2 1.9-0.5L21.8 22ZM11 30a1 1 0 0 0-1 1 1 1 0 0 0 1 1h18a1 1 0 0 0 1-1 1 1 0 0 0-1-1zM3 0C1.4 0 0 1.4 0 3v18c0 1.6 1.4 3 3 3h34c1.6 0 3-1.4 3-3V3C40 1.4 38.6 0 37 0Zm0 2h34c0.6 0 1 0.4 1 1v18c0 0.6-0.4 1-1 1H3C2.4 22 2 21.6 2 21V3C2 2.4 2.4 2 3 2Z`],name:`desktop`},ne={icon:[32,32,`M24 0C22 0 20 0.8 18.5 2.2A0.9 0.9 0 0 0 18.5 2.2 0.9 0.9 0 0 0 18.4 2.3C18.4 2.3 18.4 2.3 18.3 2.3A0.9 0.9 0 0 0 18.2 2.5 0.9 0.9 0 0 0 18.2 2.5L13.2 7.5A0.9 0.9 0 0 0 13.2 7.5 0.9 0.9 0 0 0 13.1 7.6C13.1 7.6 13.1 7.6 13.1 7.6L13 7.7A0.9 0.9 0 0 0 12.8 8.1 0.9 0.9 0 0 0 12.8 8.1C11.7 9.5 11 11.2 11 13 11 16.4 13.2 19.5 16.5 20.6A0.9 0.9 0 0 0 17.6 20 0.9 0.9 0 0 0 17 18.9C14.5 18 12.8 15.7 12.8 13 12.8 11.5 13.4 10 14.4 8.9L19.6 3.6A0.9 0.9 0 0 0 19.7 3.6C20.8 2.5 22.4 1.8 24 1.8 27.4 1.8 30.2 4.6 30.2 8 30.2 9.6 29.5 11.2 28.4 12.3A0.9 0.9 0 0 0 28.4 12.4L23.4 17.4A0.9 0.9 0 0 0 23.4 18.6 0.9 0.9 0 0 0 24.6 18.6L29.5 13.8A0.9 0.9 0 0 0 29.7 13.7C29.7 13.6 29.7 13.6 29.7 13.6A0.9 0.9 0 0 0 29.8 13.5 0.9 0.9 0 0 0 29.8 13.4C31.2 12 32 10 32 8 32 3.6 28.4 0 24 0zM15.2 11.4A0.9 0.9 0 0 0 14.4 12 0.9 0.9 0 0 0 15 13.1C17.5 14 19.2 16.3 19.2 19 19.2 20.5 18.6 22 17.6 23.1L12.4 28.4A0.9 0.9 0 0 0 12.3 28.4C11.2 29.5 9.6 30.2 8 30.2 4.6 30.2 1.8 27.4 1.8 24 1.8 22.4 2.5 20.8 3.6 19.7A0.9 0.9 0 0 0 3.6 19.6L8.6 14.6A0.9 0.9 0 0 0 8.6 13.4 0.9 0.9 0 0 0 7.4 13.4L2.5 18.2A0.9 0.9 0 0 0 2.3 18.3C2.3 18.4 2.3 18.4 2.3 18.4A0.9 0.9 0 0 0 2.2 18.5 0.9 0.9 0 0 0 2.2 18.6C0.8 20 0 22 0 24 0 28.4 3.6 32 8 32 10 32 12 31.2 13.5 29.8 13.5 29.8 13.5 29.8 13.5 29.8A0.9 0.9 0 0 0 13.6 29.7C13.6 29.7 13.6 29.7 13.7 29.7A0.9 0.9 0 0 0 13.8 29.5 0.9 0.9 0 0 0 13.8 29.5L18.8 24.5 18.8 24.5A0.9 0.9 0 0 0 18.9 24.4C18.9 24.4 18.9 24.4 18.9 24.4L19 24.3A0.9 0.9 0 0 0 19.2 23.9C19.2 23.9 19.2 23.9 19.2 23.9 20.3 22.5 21 20.8 21 19 21 15.6 18.8 12.5 15.5 11.4A0.9 0.9 0 0 0 15.2 11.4z`],name:`link`},re={icon:[32,32,`M16 0a16 16 0 1 0 0 32 16 16 0 0 0 0-32Zm0 2a14 14 0 0 1 14 14 14 14 0 0 1-14 14A14 14 0 0 1 2 16 14 14 0 0 1 16 2Zm5.2 8.4-6.3 9-4.2-4.1c-1-1-2.3.5-1.4 1.4l5 5a1 1 0 0 0 1.5-.1l7-10c.8-1.1-.9-2.2-1.6-1.2z`],name:`check-circle-outline`},O=`:host{align-items:flex-end;gap:var(--luzmo-spacing-2);font-family:var(--luzmo-font-family);flex-direction:column;display:inline-flex}.trigger-spinner{--luzmo-progress-circle-size:var(--luzmo-icon-size-xs)}.trigger-chevron{margin-inline-start:var(--luzmo-spacing-1)}.picker{gap:var(--luzmo-spacing-3);width:var(--luzmo-add-to-dashboard-picker-width,var(--add-to-dashboard-picker-width));max-width:90vw;padding:var(--luzmo-spacing-2);color:var(--luzmo-font-color);font-size:var(--luzmo-font-size-s);flex-direction:column;display:flex}luzmo-search{width:100%}.list{max-height:var(--luzmo-add-to-dashboard-list-max-height,var(--add-to-dashboard-list-max-height));flex-direction:column;display:flex;overflow-y:auto}.menu{--luzmo-menu-max-height:none;flex:none;width:100%;overflow:visible}.create-row{--luzmo-menu-item-label-icon-color-default:var(--luzmo-primary)}.thumbnail{object-fit:cover;border:var(--luzmo-border-width) solid var(--luzmo-border-color);border-radius:var(--luzmo-border-radius);width:2.75rem;height:2rem}.drill-in{color:var(--luzmo-font-color-extra-dimmed)}.header{align-items:center;gap:var(--luzmo-spacing-2);display:flex}.header-title{font-weight:var(--luzmo-font-weight-bold);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.empty{align-items:center;gap:var(--luzmo-spacing-3);padding:var(--luzmo-spacing-4);text-align:center;flex-direction:column;display:flex}.loading{padding:var(--luzmo-spacing-3);justify-content:center;display:flex}.screen-modes{gap:var(--luzmo-spacing-2);flex-direction:column;display:flex}.screen-mode{align-items:center;gap:var(--luzmo-spacing-2);display:flex}.screen-mode-size{color:var(--luzmo-font-color-extra-dimmed)}.footer{justify-content:flex-end;display:flex}.status{justify-content:flex-end;width:0;min-width:100%;display:flex}.status:empty{display:none}.alert{flex:none;inline-size:max-content}.alert-body{align-items:center;gap:var(--luzmo-spacing-3);block-size:1lh;min-inline-size:0;display:flex}.alert-text{min-inline-size:0;font-weight:var(--luzmo-font-weight-semibold);white-space:pre;display:flex}.alert[variant=negative] .alert-text{white-space:normal}.alert-name{min-inline-size:0;font-weight:var(--luzmo-font-weight-bold);text-overflow:ellipsis;white-space:nowrap;unicode-bidi:plaintext;overflow:hidden}.alert-open{flex:none}:host{--add-to-dashboard-picker-width:18rem;--add-to-dashboard-list-max-height:16rem}`,k=`0.1.107`,A=`0.1.0`,j=[`id`,`name`,`contents`,`modified_at`,`is_variant`,`original_id`],M=/* @__PURE__ */ new Set([`designer`,`owner`]),N=`flag_dashboard_variants`,P=[`desktop`,`tablet`,`mobile`];async function F(e,t,n){let r=[],i=t,a=0;for(let t of e){let e=n-r.length,o=await t(i,Math.max(e,1));e>0&&r.push(...o.rows.slice(0,e)),i=Math.max(0,i-o.count),a+=o.count}return{rows:r,total:a}}async function I(e,t){let n=(await e.fetchApi(`/user`,{action:`get`,version:A,find:{where:{id:`me`},attributes:[`id`,`flags`],...t?{include:[{model:`Organization`,attributes:[`id`]}]}:{}}})).rows?.[0];return{id:n?.id??``,flags:n?.flags??[],organizations:n?.organizations}}async function L(e,t){return(await e.fetchApi(`/authorization`,{action:`get`,version:A,find:{where:{id:t}}})).rows?.[0]}async function R(e,t,n){let r={...t,where:{...t.where,type:`dashboard`}},i=await e.fetchApi(`/securable`,{action:`get`,version:A,find:r},{signal:n});return{rows:i.rows??[],count:i.count??i.rows?.length??0}}function z(e){let t={modifyIds:/* @__PURE__ */ new Set,useOnlyIds:/* @__PURE__ */ new Set};for(let n of e?.access?.dashboards??[])n.rights?.Modify?t.modifyIds.add(n.id):n.rights?.Use&&t.useOnlyIds.add(n.id);return t}function B(){return{version:k,syncScreenModes:!0,views:P.map(e=>({screenModus:e,options:{theme:{id:`default`}},filterGroups:[],items:[]})),timezone:{type:`fixed`,id:`UTC`}}}function V(e){return e?{search:{match_types:[`name`,`description`],keyphrase:e,securable_types:[`dashboard`]}}:{}}function H(e,t){return{include:[{model:`User`,as:`allUsers`,attributes:[],required:!0,where:{id:e,...Object.fromEntries(Object.entries(t).map(([e,t])=>[`securableAccessRight.${e}`,t]))}}]}}async function U(e){let t=new p({apiUrl:e.apiUrl,authKey:e.authKey,authToken:e.authToken,skipNetworkListeners:!0}),r=await L(t,e.authKey),i=r?.type===`embed`,a=await I(t,!i),o=z(r),s=i?M.has(r.role??``):a.organizations?.[0]?.organizationRole?.flagEditor!==!1,c=!!a.id&&a.flags.includes(N),l=[...o.modifyIds,...c?o.useOnlyIds:[]],u=l.length>0?{id:{notIn:l}}:{},d=(t,n=!1)=>{let r=[...new Set((t.contents?.views??[]).map(e=>e.screenModus))];return{id:t.id,name:m(t.name??{},e.language),syncScreenModes:t.contents?.syncScreenModes!==!1,screenModes:r.length>0?r:[`desktop`],...n?{requiresVariant:n}:{}}},f,h=(e,n)=>async(r,i)=>{if(l.length===0)return{count:0,rows:[]};let a=r>0&&f?.search===e?f.rows:void 0;return a||(a=(await R(t,{where:{is_variant:!1,archived_at:null,id:{in:l}},attributes:j,...V(e)},n)).rows.map(e=>d(e,!o.modifyIds.has(e.id))).sort((e,t)=>e.name.localeCompare(t.name)),f={search:e,rows:a}),{count:a.length,rows:a.slice(r,r+i)}},g=(e,n,r,i)=>async(o,s)=>{let c=await R(t,{where:{is_variant:!1,archived_at:null,...u},attributes:j,...H(a.id,r),...V(e),limit:s,offset:o,order:[[`modified_at`,`desc`]]},n);return{count:c.count,rows:c.rows.map(e=>d(e,i))}},_=async(e,n,r,i)=>{await t.fetchApi(`/securable`,{action:`update`,version:A,id:e,properties:{append_item:{item:n,...r?.length?{screenModes:r}:{}}}},{signal:i})},v=async(e,n,r)=>{try{await _(e.id,n,r)}catch(n){throw await t.fetchApi(`/securable`,{action:`delete`,version:A,id:e.id}).catch(()=>void 0),n}},y=async(e,n)=>await t.fetchApi(`/securable`,{action:`create`,version:A,properties:{...e,type:`dashboard`},associations:n});return{async list(e,t){return a.id?await F([h(e.search,t.signal),...c?[g(e.search,t.signal,{flagUse:!0,flagModify:!1},!0)]:[],g(e.search,t.signal,{flagModify:!0},!1)],e.offset,e.limit):{rows:[],total:0}},async add(e,t,n,r){await _(e.id,t,n.screenModes,r.signal)},...s?{async create(t,n){let r=await y({name:n.name?{[e.language]:n.name}:{},contents:B()});return await v(r,t,void 0),d(r)}}:{},...c?{async listVariants(e,n){return(await R(t,{where:{is_variant:!0,original_id:e.id,archived_at:null},attributes:j,...H(a.id,{flagModify:!0}),order:[[`modified_at`,`desc`]]},n.signal)).rows.map(e=>d(e))}}:{},...c&&s?{async addToVariant(r,i,a){let o=(await R(t,{where:{id:r.id},attributes:[`id`,`name`,`contents`]})).rows[0];if(!o?.contents)throw Error(n(`The dashboard was not found.`,{desc:`Adding the chart to a variant failed because the original dashboard could not be loaded`}));let s=o.name??{},c=await y({name:a.name?{...s,[e.language]:a.name}:s,contents:o.contents},[{role:`original`,id:r.id}]);return await v(c,i,a.screenModes),d({...c,contents:c.contents??o.contents})}}:{}}}function W(e){let{theme:t,...n}=e.options??{};return{...d(e),options:n}}function G(e,t){let n=new Set(e),r=e.length+1;for(;n.has(t(r));)r+=1;return r}var K=20,q=300,J=8,Y=48,X=`__luzmo-new-dashboard`,Z=`__luzmo-new-variant`,Q=/* @__PURE__ */ new Map,ie=0,$=class extends r(f(l,{validSizes:Object.values(u)})){constructor(...e){super(...e),this.chart=null,this.dashboardActions=null,this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.placement=`bottom-end`,this.disabled=!1,this._open=!1,this._actions=null,this._step=`list`,this._rows=[],this._hasMore=!1,this._loading=!1,this._listFailed=!1,this._original=null,this._variants=[],this._variantsLoading=!1,this._variantsFailed=!1,this._pending=null,this._screenModes=[],this._saving=!1,this._status=null,this._triggerId=`add-to-dashboard-trigger-${++ie}`,this._search=``,this._actionsGeneration=0,this._reloadOnUpdate=!1}static get styles(){let e=super.styles??[];return[...Array.isArray(e)?e:[e],x(O)]}get _hasSource(){return!!this.dashboardActions||!!(this.authKey&&this.authToken)}connectedCallback(){super.connectedCallback(),this._status&&this._startFittingAlert()}disconnectedCallback(){super.disconnectedCallback(),this._handleClosed(),this._actionsGeneration+=1,this._saveAbort?.abort(),this._stopFittingAlert()}willUpdate(e){super.willUpdate(e),(e.has(`dashboardActions`)||e.has(`authKey`)||e.has(`authToken`)||e.has(`apiUrl`)||e.has(`language`))&&(this._actions=null,this._actionsGeneration+=1,this._open&&(this._listAbort?.abort(),this._variantsAbort?.abort(),this._step=`list`,this._original=null,this._pending=null,this._rows=[],this._open=this._hasSource,this._reloadOnUpdate=this._hasSource)),e.has(`disabled`)&&this.disabled&&(this._open=!1),e.has(`chart`)&&!this.chart&&this._handleClosed()}updated(e){super.updated(e),this._reloadOnUpdate&&(this._reloadOnUpdate=!1,this._loadList()),e.has(`_step`)&&this._open&&this._focusStep(),e.has(`_status`)&&(this._status?this._startFittingAlert():this._stopFittingAlert())}get _alertContainer(){let e=this.getRootNode();return this.parentElement??(e instanceof ShadowRoot?e.host:null)}_startFittingAlert(){this._fitAlert();let e=this._alertContainer;!this._alertResizeObserver&&e&&(this._alertResizeObserver=new ResizeObserver(()=>this._fitAlert()),this._alertResizeObserver.observe(this),this._alertResizeObserver.observe(e))}_stopFittingAlert(){this._alertResizeObserver?.disconnect(),this._alertResizeObserver=void 0}_fitAlert(){let e=this._noticeElement,t=this._alertContainer;if(!e||!t)return;let n=this.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(t).paddingInlineStart)||0,a=(this.isLTR?n.right-r.left:r.right-n.left)-i;e.style.setProperty(`--luzmo-notice-max-inline-size`,`${Math.max(0,a)}px`)}async _resolveActions(){if(this.dashboardActions)return this.dashboardActions;let e={apiUrl:this.apiUrl,authKey:this.authKey,authToken:this.authToken,language:this.language},t=JSON.stringify(e),n=Q.get(t);return n||(Q.clear(),n=U(e),Q.set(t,n),n.catch(()=>Q.delete(t))),await n}_dispatch(e,t){let n=new CustomEvent(e,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(n)}_displayName(e){return e.name.trim()||n(`Untitled dashboard`,{desc:`Fallback name of a dashboard without a name`})}_variantName(t,r){let i=this._displayName(t);return n(e`${i} (variant ${r})`,{desc:`Name of a new dashboard variant`})}_screenModeChoices(){return[{name:`mobile`,label:n(`Smartphone`,{desc:`Screen mode name`}),size:`< 768px`,icon:E},{name:`tablet`,label:n(`Tablet`,{desc:`Screen mode name`}),size:`≥ 768px`,icon:D},{name:`desktop`,label:n(`Desktop`,{desc:`Screen mode name`}),size:`≥ 1200px`,icon:ee},{name:`largeScreen`,label:n(`Large screen`,{desc:`Screen mode name`}),size:`≥ 1600px`,icon:te},{name:`fixed`,label:n(`Fixed width`,{desc:`Screen mode name`}),icon:s}]}async _handleOpened(e){e.target===e.currentTarget&&(this._open=!0,this._step=`list`,this._search=``,this._original=null,this._pending=null,this._rows=[],await this.updateComplete,this._searchElement?.focus(),await this._loadList())}async _loadList(){let e=this._actionsGeneration;this._loading=!0,this._listFailed=!1;try{let t=this._actions??await this._resolveActions();if(e!==this._actionsGeneration)return;this._actions=t}catch(t){if(!this.isConnected||e!==this._actionsGeneration)return;console.error(`Failed to resolve the add to dashboard actions:`,t),this._loading=!1,this._listFailed=!0;return}this.isConnected&&this._open&&await this._loadPage(!1)}_handleClosed(e){e&&e.target!==e.currentTarget||(this._open=!1,clearTimeout(this._searchTimer),this._listAbort?.abort(),this._variantsAbort?.abort())}async _loadPage(e){let t=this._actions;if(!t)return;this._listAbort?.abort();let n=new AbortController;this._listAbort=n,this._loading=!0,this._listFailed=!1,e||(this._rows=[]);try{let e=await t.list({search:this._search,offset:this._rows.length,limit:K},{signal:n.signal});if(n.signal.aborted)return;this._rows=[...this._rows,...e.rows],this._hasMore=e.total===void 0?e.rows.length===K:this._rows.length<e.total}catch(e){if(n.signal.aborted)return;console.error(`Failed to load dashboards:`,e),this._listFailed=!0}finally{n.signal.aborted||(this._loading=!1)}}_handleSearchInput(e){this._search=String(e.target?.value??``),clearTimeout(this._searchTimer),this._searchTimer=setTimeout(()=>void this._loadPage(!1),q)}_handleListScroll(e){let t=e.target;this._hasMore&&!this._loading&&t.scrollHeight-t.scrollTop-t.clientHeight<=Y&&this._loadPage(!0)}_menuValue(e){return e.stopPropagation(),e.target.value??``}_handleListChange(e){let t=this._menuValue(e);if(t===X){this._actions?.create&&this._save({kind:`create`});return}let n=this._rows.find(e=>e.id===t);n&&(n.requiresVariant?(this._original=n,this._step=`variants`,this._loadVariants()):this._selectTarget({kind:`add`,dashboard:n,isVariant:!1},n))}_handleVariantChange(e){let t=this._menuValue(e),n=this._original;if(!n)return;if(t===Z){if(!this._actions?.addToVariant)return;let e=this._variants.map(e=>this._displayName(e)),t=this._variantName(n,G(e,e=>this._variantName(n,e)));this._selectTarget({kind:`variant`,original:n,name:t},n);return}let r=this._variants.find(e=>e.id===t);r&&this._selectTarget({kind:`add`,dashboard:r,isVariant:!0},r)}_selectTarget(e,t){t.syncScreenModes!==!1||!t.screenModes?.length?this._save(e):(this._pending=e,this._screenModes=[...t.screenModes??[]],this._step=`screenModes`)}async _loadVariants(){let e=this._actions,t=this._original;if(this._variantsAbort?.abort(),this._variants=[],this._variantsLoading=!1,this._variantsFailed=!1,!e?.listVariants||!t)return;let n=new AbortController;this._variantsAbort=n,this._variantsLoading=!0;try{let r=await e.listVariants(t,{signal:n.signal});n.signal.aborted||(this._variants=r)}catch(e){n.signal.aborted||(console.error(`Failed to load dashboard variants:`,e),this._variantsFailed=!0)}finally{n.signal.aborted||(this._variantsLoading=!1)}}_handleBack(){this._step===`screenModes`&&this._original?this._step=`variants`:(this._step=`list`,this._original=null),this._pending=null}_toggleScreenMode(e){this._screenModes=this._screenModes.includes(e)?this._screenModes.filter(t=>t!==e):[...this._screenModes,e]}_handleConfirmScreenModes(){this._pending&&this._screenModes.length>0&&this._save(this._pending,{screenModes:[...this._screenModes]})}async _save(e,t={}){let n=this._actions;if(!n||!this.chart||this._saving)return;this._open=!1,this._saving=!0,this._setStatus(null),this._saveAbort=new AbortController;let r=W(this.chart),i={signal:this._saveAbort.signal};try{let a;if(e.kind===`create`&&n.create)a=await n.create(r,t,i);else if(e.kind===`variant`&&n.addToVariant)a=await n.addToVariant(e.original,r,{...t,name:e.name},i);else if(e.kind===`add`)a=await n.add(e.dashboard,r,t,i)||e.dashboard;else return;if(i.signal.aborted)return;this._setStatus({kind:`success`,dashboard:a,isVariant:e.kind===`variant`||e.kind===`add`&&e.isVariant,openDashboard:n.openDashboard?.bind(n)}),this._dispatch(`luzmo-chart-added`,{dashboard:a})}catch(e){if(i.signal.aborted)return;console.error(`Failed to add the chart to a dashboard:`,e),this._setStatus({kind:`error`,message:e instanceof Error&&e.message?e.message:void 0}),this._dispatch(`luzmo-chart-add-failed`,{error:e})}finally{this._saving=!1}await this.updateComplete,this.isConnected&&this._isFocusLost()&&this._focusTrigger()}_setStatus(e){this._status=e}_focusTrigger(){this._triggerElement?.focus()}_isFocusLost(){return!document.activeElement||document.activeElement===document.body}async _handleNoticeClose(e){e.stopPropagation();let t=e.currentTarget.matches(`:focus-within`);this._setStatus(null),await this.updateComplete,t&&this._isFocusLost()&&this._focusTrigger()}async _focusStep(){let e=this._step===`list`?this._searchElement:this._backElement;await e?.updateComplete,e?.focus()}_renderRow(e){return h`
23
23
  <luzmo-menu-item value=${e.id} no-wrap ?disabled=${this._saving}>
24
24
  ${e.thumbnailUrl?h`<img slot="icon" class="thumbnail" alt="" src=${e.thumbnailUrl} />`:_}
25
25
  ${this._displayName(e)}
@@ -1,4 +1,4 @@
1
1
 
2
2
  import{n as e}from"./localized-mixin-BWJj88bd.js";import{LitElement as t,property as n}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";var r=/* @__PURE__ */ new Set;new MutationObserver(()=>{let e=document.documentElement.dir===`rtl`?document.documentElement.dir:`ltr`;r.forEach(t=>{t.setAttribute(`dir`,e)})}).observe(document.documentElement,{attributes:!0,attributeFilter:[`dir`]});var i=e=>e.startManagingContentDirection!==void 0||e.tagName===`LUZMO-THEME`,a=(e=document)=>{let t=e.activeElement;for(;t?.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;let n=t?[t]:[];for(;t;){let e=t.assignedSlot||t.parentElement||t.getRootNode()?.host;e&&n.push(e),t=e}return n};function o(e){class t extends e{get isLTR(){return this.dir===`ltr`}hasVisibleFocusInTree(){let e=a(this.getRootNode())[0];if(!e)return!1;try{return e.matches(`:focus-visible`)||e.matches(`.focus-visible`)}catch{return e.matches(`.focus-visible`)}}connectedCallback(){if(super.connectedCallback(),!this.hasAttribute(`dir`)){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!i(e);)e=e.assignedSlot||e.parentNode||e.host;if(this.dir=e.dir===`rtl`?e.dir:this.dir||`ltr`,e===document.documentElement)r.add(this);else{let{localName:t}=e;t.search(`-`)>-1&&!customElements.get(t)?
3
3
  /* c8 ignore next 8 */
4
- customElements.whenDefined(t).then(()=>{typeof e.startManagingContentDirection==`function`&&e.startManagingContentDirection(this)}):typeof e.startManagingContentDirection==`function`&&e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?r.delete(this):typeof this._dirParent.stopManagingContentDirection==`function`&&this._dirParent.stopManagingContentDirection(this),this.removeAttribute(`dir`))}}return t}var s=class extends o(t){},c=!0;try{document.body.querySelector(`:focus-visible`)}catch{c=!1}var l=e=>{if(e.shadowRoot==null||Object.hasOwn(e.dataset,`jsFocusVisible`))return()=>{};if(self.applyFocusVisiblePolyfill)self.applyFocusVisiblePolyfill(e.shadowRoot),e.manageAutoFocus&&e.manageAutoFocus();else{let t=()=>{self.applyFocusVisiblePolyfill&&e.shadowRoot&&self.applyFocusVisiblePolyfill(e.shadowRoot),e.manageAutoFocus&&e.manageAutoFocus()};return self.addEventListener(`focus-visible-polyfill-ready`,t,{once:!0}),()=>{self.removeEventListener(`focus-visible-polyfill-ready`,t)}}return()=>{}},u=e=>{let t=Symbol(`endPolyfillCoordination`);class n extends e{constructor(...e){super(...e),this[t]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),c||requestAnimationFrame(()=>{this[t]??(this[t]=l(this))})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),c||requestAnimationFrame(()=>{this[t]!=null&&(this[t](),this[t]=null)})}}return n};function d(){return new Promise(e=>requestAnimationFrame(()=>e()))}var f=class extends u(s){constructor(...e){super(...e),this.disabled=!1,this.autofocus=!1,this._tabIndex=0,this.manipulatingTabindex=!1,this.autofocusReady=Promise.resolve()}get tabIndex(){if(this.focusElement===this){let e=this.hasAttribute(`tabindex`)?Number(this.getAttribute(`tabindex`)):NaN;return Number.isNaN(e)?-1:e}let e=Number.parseFloat(this.hasAttribute(`tabindex`)&&this.getAttribute(`tabindex`)||`0`);return this.disabled||e<0?-1:this.focusElement?this._tabIndex:e}set tabIndex(e){if(this.manipulatingTabindex)this.manipulatingTabindex=!1;else if(this.focusElement===this){if(this.disabled)this._tabIndex=e;else if(e!==this._tabIndex){this._tabIndex=e;let t=``+e;this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,t)}}else if(e===-1?this.addEventListener(`pointerdown`,this.onPointerdownManagementOfTabIndex):(this.manipulatingTabindex=!0,this.removeEventListener(`pointerdown`,this.onPointerdownManagementOfTabIndex)),e===-1||this.disabled){if(this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,`-1`),this.removeAttribute(`focusable`),this.selfManageFocusElement)return;e===-1?this.focusElement?.removeAttribute(`tabindex`):(this._tabIndex=e,this.manageFocusElementTabindex(e))}else this.setAttribute(`focusable`,``),this.hasAttribute(`tabindex`)?this.removeAttribute(`tabindex`):this.manipulatingTabindex=!1,this._tabIndex=e,this.manageFocusElementTabindex(e)}onPointerdownManagementOfTabIndex(){this.tabIndex===-1&&setTimeout(()=>{this.tabIndex=0,this.focus({preventScroll:!0}),this.tabIndex=-1})}async manageFocusElementTabindex(e){this.focusElement||await this.updateComplete,e===null?this.focusElement.removeAttribute(`tabindex`):this.focusElement!==this&&(this.focusElement.tabIndex=e)}get focusElement(){throw Error(`Must implement focusElement getter!`)}get selfManageFocusElement(){return!1}focus(e){!this.disabled&&this.focusElement&&(this.focusElement===this?Reflect.apply(HTMLElement.prototype.focus,this,[e]):this.focusElement.focus(e))}blur(){let e=this.focusElement||this;e===this?HTMLElement.prototype.blur.apply(this):e.blur()}click(){if(this.disabled)return;let e=this.focusElement||this;e===this?HTMLElement.prototype.click.apply(this):e.click()}manageAutoFocus(){this.autofocus&&(this.dispatchEvent(new KeyboardEvent(`keydown`,{code:`Tab`})),this.focusElement.focus())}firstUpdated(e){super.firstUpdated(e),this.hasAttribute(`tabindex`)&&this.getAttribute(`tabindex`)===`-1`||this.setAttribute(`focusable`,``)}update(e){e.has(`disabled`)&&this.handleDisabledChanged(this.disabled,e.get(`disabled`)),super.update(e)}updated(e){super.updated(e),e.has(`disabled`)&&this.disabled&&this.blur()}async handleDisabledChanged(e,t){let n=()=>this.focusElement!==this&&this.focusElement.disabled!==void 0;e?(this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,`-1`),await this.updateComplete,n()?this.focusElement.disabled=!0:this.setAttribute(`aria-disabled`,`true`)):t&&(this.manipulatingTabindex=!0,this.focusElement===this?this.setAttribute(`tabindex`,``+this._tabIndex):this.removeAttribute(`tabindex`),await this.updateComplete,n()?this.focusElement.disabled=!1:this.removeAttribute(`aria-disabled`))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.autofocusReady,e}connectedCallback(){super.connectedCallback(),this.autofocus&&(this.autofocusReady=(async()=>{await d(),await d()})(),this.updateComplete.then(()=>this.manageAutoFocus()))}};e([n({type:Boolean,reflect:!0})],f.prototype,`disabled`,void 0),e([n({type:Boolean})],f.prototype,`autofocus`,void 0),e([n({type:Number})],f.prototype,`tabIndex`,null);var p={xxs:`xxs`,xs:`xs`,s:`s`,m:`m`,l:`l`,xl:`xl`,xxl:`xxl`};function m(t,{validSizes:r=[`s`,`m`,`l`,`xl`],noDefaultSize:i,defaultSize:a=`m`}={}){class o extends t{constructor(...e){super(...e),this._size=a}get size(){return this._size||a}set size(e){let t=i?null:a,n=e&&e.toLocaleLowerCase(),o=r.includes(n)?n:t;if(o&&this.setAttribute(`size`,o),this._size===o)return;let s=this._size;this._size=o,this.requestUpdate(`size`,s)}update(e){!this.hasAttribute(`size`)&&!i&&this.setAttribute(`size`,this.size),super.update(e)}}return e([n({type:String})],o.prototype,`size`,null),o}var h=/* @__PURE__ */ function(e){return e.Top=`top`,e.Bottom=`bottom`,e}({}),g=/* @__PURE__ */ function(e){return e.Asc=`asc`,e.Desc=`desc`,e}({}),_=/* @__PURE__ */ function(e){return e.Measure=`measure`,e.Category=`category`,e}({}),v=5,y=Array.isArray;function b(e){return typeof e==`string`}function x(e){let t={...e};return!t.datasetId&&t.set&&(t.datasetId=t.set),!t.set&&t.datasetId&&(t.set=t.datasetId),!t.columnId&&t.column&&(t.columnId=t.column),!t.column&&t.columnId&&(t.column=t.columnId),!t.formulaId&&t.formula&&(t.formulaId=t.formula),!t.formula&&t.formulaId&&(t.formula=t.formulaId),t}function S(e){return y(e)?e:Object.entries(e).map(([e,t])=>({name:e,content:y(t)?t:[]}))}function C(e){let t=/* @__PURE__ */ new Set;for(let n of e)for(let e of n.content){let n=e.datasetId??e.set;b(n)&&t.add(n)}return[...t]}function w(e){let t=S(e.slots??[]),n=e.options??{},r=n.interactivity;return{type:e.type,options:{...n,interactivity:{...r,scheduledExport:!1}},slots:t.map(e=>({...e,content:y(e.content)?e.content.map(e=>x(e)):[]})),filters:e.filters,inlineData:e.inlineData}}function T(e,t){return{...e,options:{...e.options,theme:{...e.options.theme,...t}}}}function E(e){let t=e.find(e=>e.name===`measure`||e.name===`measures`);if(t&&t.content.length>1)return!0;let n=e.find(e=>e.name===`legend`);return n?n.content.length>0:!1}function D(e){let t=[],n=e.options;switch(e.type){case`area-chart`:case`bar-chart`:case`column-chart`:if(e.inlineData||t.push({type:`rankingPicker`,mutationType:`rankAndSort`,ranking:n.ranking??{active:!1,number:5,direction:h.Top},sort:n.sort??{direction:g.Desc,by:_.Measure},importance:100}),E(e.slots)){let r=e.type===`area-chart`,i=r?[{key:`stacked`,label:`Stacked`},{key:`unstacked`,label:`Unstacked`},{key:`100`,label:`100%`},{key:`stream`,label:`Stream`}]:[{key:`grouped`,label:`Grouped`},{key:`stacked`,label:`Stacked`},{key:`100`,label:`100%`}],a=r?`stacked`:`grouped`;t.push({type:`optionDropdown`,mutationType:`mode`,values:i,currentValue:n.mode??a,importance:90})}break;case`donut-chart`:{let e=n.display??{};t.push({type:`optionDropdown`,mutationType:`donutLabelDisplay`,values:[{key:`withLegend`,label:`With legend`},{key:`withLabels`,label:`With labels`}],currentValue:e.categoryLabels===!0?`withLabels`:`withLegend`,importance:90});break}case`bubble-chart`:{let e=n.display??{};t.push({type:`optionDropdown`,mutationType:`bubbleValues`,values:[{key:`none`,label:`No values`},{key:`absolute`,label:`Absolute`},{key:`percentage`,label:`Percentage`}],currentValue:e.bubbleValues??e.values??`none`,importance:100});break}}return t.sort((e,t)=>t.importance-e.importance)}function O(e,t,n){let r=e.options;switch(t){case`mode`:return{...e,options:{...r,mode:n}};case`donutLabelDisplay`:{let t={...r.display??{}};return n===`withLabels`?(t.legend=!1,t.categoryLabels=!0):(t.legend=!0,t.categoryLabels=!1),{...e,options:{...r,display:t}}}case`bubbleValues`:{let t={...r.display??{}};return t.bubbleLabels=t.bubbleLabels!==!1,t.bubbleValues=n,{...e,options:{...r,display:t}}}default:return e}}function k(e,t){switch(t.type){case`slots`:return{...e,slots:t.slotsContents};case`options`:return{...e,options:t.options};case`filters`:return{...e,filters:t.filters};case`chartAction`:return O(e,t.actionType,t.key);case`rankAndSort`:return{...e,options:{...e.options,ranking:t.ranking,sort:t.sort}};case`fullReplace`:return t.chart;default:return e}}export{T as a,h as c,p as d,m as f,C as i,_ as l,D as n,w as o,s as p,S as r,v as s,k as t,g as u};
4
+ customElements.whenDefined(t).then(()=>{typeof e.startManagingContentDirection==`function`&&e.startManagingContentDirection(this)}):typeof e.startManagingContentDirection==`function`&&e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?r.delete(this):typeof this._dirParent.stopManagingContentDirection==`function`&&this._dirParent.stopManagingContentDirection(this),this.removeAttribute(`dir`))}}return t}var s=class extends o(t){},c=!0;try{document.body.querySelector(`:focus-visible`)}catch{c=!1}var l=e=>{if(e.shadowRoot==null||Object.hasOwn(e.dataset,`jsFocusVisible`))return()=>{};if(self.applyFocusVisiblePolyfill)self.applyFocusVisiblePolyfill(e.shadowRoot),e.manageAutoFocus&&e.manageAutoFocus();else{let t=()=>{self.applyFocusVisiblePolyfill&&e.shadowRoot&&self.applyFocusVisiblePolyfill(e.shadowRoot),e.manageAutoFocus&&e.manageAutoFocus()};return self.addEventListener(`focus-visible-polyfill-ready`,t,{once:!0}),()=>{self.removeEventListener(`focus-visible-polyfill-ready`,t)}}return()=>{}},u=e=>{let t=Symbol(`endPolyfillCoordination`);class n extends e{constructor(...e){super(...e),this[t]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),c||requestAnimationFrame(()=>{this[t]??(this[t]=l(this))})}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),c||requestAnimationFrame(()=>{this[t]!=null&&(this[t](),this[t]=null)})}}return n};function d(){return new Promise(e=>requestAnimationFrame(()=>e()))}var f=class extends u(s){constructor(...e){super(...e),this.disabled=!1,this.autofocus=!1,this._tabIndex=0,this.manipulatingTabindex=!1,this.autofocusReady=Promise.resolve()}get tabIndex(){if(this.focusElement===this){let e=this.hasAttribute(`tabindex`)?Number(this.getAttribute(`tabindex`)):NaN;return Number.isNaN(e)?-1:e}let e=Number.parseFloat(this.hasAttribute(`tabindex`)&&this.getAttribute(`tabindex`)||`0`);return this.disabled||e<0?-1:this.focusElement?this._tabIndex:e}set tabIndex(e){if(this.manipulatingTabindex)this.manipulatingTabindex=!1;else if(this.focusElement===this){if(this.disabled)this._tabIndex=e;else if(e!==this._tabIndex){this._tabIndex=e;let t=``+e;this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,t)}}else if(e===-1?this.addEventListener(`pointerdown`,this.onPointerdownManagementOfTabIndex):(this.manipulatingTabindex=!0,this.removeEventListener(`pointerdown`,this.onPointerdownManagementOfTabIndex)),e===-1||this.disabled){if(this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,`-1`),this.removeAttribute(`focusable`),this.selfManageFocusElement)return;e===-1?this.focusElement?.removeAttribute(`tabindex`):(this._tabIndex=e,this.manageFocusElementTabindex(e))}else this.setAttribute(`focusable`,``),this.hasAttribute(`tabindex`)?this.removeAttribute(`tabindex`):this.manipulatingTabindex=!1,this._tabIndex=e,this.manageFocusElementTabindex(e)}onPointerdownManagementOfTabIndex(){this.tabIndex===-1&&setTimeout(()=>{this.tabIndex=0,this.focus({preventScroll:!0}),this.tabIndex=-1})}async manageFocusElementTabindex(e){this.focusElement||await this.updateComplete,e===null?this.focusElement.removeAttribute(`tabindex`):this.focusElement!==this&&(this.focusElement.tabIndex=e)}get focusElement(){throw Error(`Must implement focusElement getter!`)}get selfManageFocusElement(){return!1}focus(e){!this.disabled&&this.focusElement&&(this.focusElement===this?Reflect.apply(HTMLElement.prototype.focus,this,[e]):this.focusElement.focus(e))}blur(){let e=this.focusElement||this;e===this?HTMLElement.prototype.blur.apply(this):e.blur()}click(){if(this.disabled)return;let e=this.focusElement||this;e===this?HTMLElement.prototype.click.apply(this):e.click()}manageAutoFocus(){this.autofocus&&(this.dispatchEvent(new KeyboardEvent(`keydown`,{code:`Tab`})),this.focusElement.focus())}firstUpdated(e){super.firstUpdated(e),this.hasAttribute(`tabindex`)&&this.getAttribute(`tabindex`)===`-1`||this.setAttribute(`focusable`,``)}update(e){e.has(`disabled`)&&this.handleDisabledChanged(this.disabled,e.get(`disabled`)),super.update(e)}updated(e){super.updated(e),e.has(`disabled`)&&this.disabled&&this.blur()}async handleDisabledChanged(e,t){let n=()=>this.focusElement!==this&&this.focusElement.disabled!==void 0;e?(this.manipulatingTabindex=!0,this.setAttribute(`tabindex`,`-1`),await this.updateComplete,n()?this.focusElement.disabled=!0:this.setAttribute(`aria-disabled`,`true`)):t&&(this.manipulatingTabindex=!0,this.focusElement===this?this.setAttribute(`tabindex`,``+this._tabIndex):this.removeAttribute(`tabindex`),await this.updateComplete,n()?this.focusElement.disabled=!1:this.removeAttribute(`aria-disabled`))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.autofocusReady,e}connectedCallback(){super.connectedCallback(),this.autofocus&&(this.autofocusReady=(async()=>{await d(),await d()})(),this.updateComplete.then(()=>this.manageAutoFocus()))}};e([n({type:Boolean,reflect:!0})],f.prototype,`disabled`,void 0),e([n({type:Boolean})],f.prototype,`autofocus`,void 0),e([n({type:Number})],f.prototype,`tabIndex`,null);var p={xxs:`xxs`,xs:`xs`,s:`s`,m:`m`,l:`l`,xl:`xl`,xxl:`xxl`};function m(t,{validSizes:r=[`s`,`m`,`l`,`xl`],noDefaultSize:i,defaultSize:a=`m`}={}){class o extends t{constructor(...e){super(...e),this._size=a}get size(){return this._size||a}set size(e){let t=i?null:a,n=e&&e.toLocaleLowerCase(),o=r.includes(n)?n:t;if(o&&this.setAttribute(`size`,o),this._size===o)return;let s=this._size;this._size=o,this.requestUpdate(`size`,s)}update(e){!this.hasAttribute(`size`)&&!i&&this.setAttribute(`size`,this.size),super.update(e)}}return e([n({type:String})],o.prototype,`size`,null),o}function h(e){return e==null}function g(e){return typeof e==`string`||e instanceof String}function _(e){return!Number.isNaN(e)&&Number.isFinite(e)}function v(e){return typeof e==`boolean`}function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e){return typeof e==`object`&&!!e&&Object.keys(e).length===0}var x=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function S(e){return typeof e==`string`&&x.test(e)}function C(e){let t=[],n=[];for(let r of e)S(r)?t.push(r):n.push(r);return{valid:t,invalid:n}}var w=/* @__PURE__ */ function(e){return e.Top=`top`,e.Bottom=`bottom`,e}({}),T=/* @__PURE__ */ function(e){return e.Asc=`asc`,e.Desc=`desc`,e}({}),E=/* @__PURE__ */ function(e){return e.Measure=`measure`,e.Category=`category`,e}({}),D=5,O=Array.isArray;function k(e){return typeof e==`string`}function A(e){let t={...e};return!t.datasetId&&t.set&&(t.datasetId=t.set),!t.set&&t.datasetId&&(t.set=t.datasetId),!t.columnId&&t.column&&(t.columnId=t.column),!t.column&&t.columnId&&(t.column=t.columnId),!t.formulaId&&t.formula&&S(t.formula)&&(t.formulaId=t.formula),!t.formula&&t.formulaId&&(t.formula=t.formulaId),t}function j(e){return O(e)?e:Object.entries(e).map(([e,t])=>({name:e,content:O(t)?t:[]}))}function M(e){let t=/* @__PURE__ */ new Set;for(let n of e)for(let e of n.content){let n=e.datasetId??e.set;k(n)&&t.add(n)}return[...t]}function N(e){let t=j(e.slots??[]),n=e.options??{},r=n.interactivity;return{type:e.type,options:{...n,interactivity:{...r,scheduledExport:!1}},slots:t.map(e=>({...e,content:O(e.content)?e.content.map(e=>A(e)):[]})),filters:e.filters,inlineData:e.inlineData}}function P(e,t){if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];n[e]=y(t)&&y(r)?{...t,...r}:r}return n}function F(e,t){return{...e,options:{...e.options,theme:{...e.options.theme,...t}}}}function I(e){let t=e.find(e=>e.name===`measure`||e.name===`measures`);if(t&&t.content.length>1)return!0;let n=e.find(e=>e.name===`legend`);return n?n.content.length>0:!1}function L(e){let t=[],n=e.options;switch(e.type){case`area-chart`:case`bar-chart`:case`column-chart`:if(e.inlineData||t.push({type:`rankingPicker`,mutationType:`rankAndSort`,ranking:n.ranking??{active:!1,number:5,direction:w.Top},sort:n.sort??{direction:T.Desc,by:E.Measure},importance:100}),I(e.slots)){let r=e.type===`area-chart`,i=r?[{key:`stacked`,label:`Stacked`},{key:`unstacked`,label:`Unstacked`},{key:`100`,label:`100%`},{key:`stream`,label:`Stream`}]:[{key:`grouped`,label:`Grouped`},{key:`stacked`,label:`Stacked`},{key:`100`,label:`100%`}],a=r?`stacked`:`grouped`;t.push({type:`optionDropdown`,mutationType:`mode`,values:i,currentValue:n.mode??a,importance:90})}break;case`donut-chart`:{let e=n.display??{};t.push({type:`optionDropdown`,mutationType:`donutLabelDisplay`,values:[{key:`withLegend`,label:`With legend`},{key:`withLabels`,label:`With labels`}],currentValue:e.categoryLabels===!0?`withLabels`:`withLegend`,importance:90});break}case`bubble-chart`:{let e=n.display??{};t.push({type:`optionDropdown`,mutationType:`bubbleValues`,values:[{key:`none`,label:`No values`},{key:`absolute`,label:`Absolute`},{key:`percentage`,label:`Percentage`}],currentValue:e.bubbleValues??e.values??`none`,importance:100});break}}return t.sort((e,t)=>t.importance-e.importance)}function R(e,t,n){let r=e.options;switch(t){case`mode`:return{...e,options:{...r,mode:n}};case`donutLabelDisplay`:{let t={...r.display??{}};return n===`withLabels`?(t.legend=!1,t.categoryLabels=!0):(t.legend=!0,t.categoryLabels=!1),{...e,options:{...r,display:t}}}case`bubbleValues`:{let t={...r.display??{}};return t.bubbleLabels=t.bubbleLabels!==!1,t.bubbleValues=n,{...e,options:{...r,display:t}}}default:return e}}function z(e,t){switch(t.type){case`slots`:return{...e,slots:t.slotsContents};case`options`:return{...e,options:t.options};case`filters`:return{...e,filters:t.filters};case`chartAction`:return R(e,t.actionType,t.key);case`rankAndSort`:return{...e,options:{...e.options,ranking:t.ranking,sort:t.sort}};case`fullReplace`:return t.chart;default:return e}}export{s as S,g as _,P as a,p as b,D as c,T as d,v as f,y as g,_ as h,M as i,w as l,b as m,L as n,F as o,h as p,j as r,N as s,z as t,E as u,S as v,m as x,C as y};
@@ -0,0 +1,2 @@
1
+
2
+ import{v as e,y as t}from"./chart-helpers-DZsidiCl.js";var n=class{constructor(){this.listeners=/* @__PURE__ */ new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},r=new class extends n{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},i={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},a=new class{#e=i;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function o(e){setTimeout(e,0)}var s=typeof window>`u`||`Deno`in globalThis;function c(){}function l(e,t){return typeof e==`function`?e(t):e}function u(e){return typeof e==`number`&&e>=0&&e!==1/0}function d(e,t){return Math.max(e+(t||0)-Date.now(),0)}function f(e,t){return typeof e==`function`?e(t):e}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==g(o,t.options))return!1}else if(!v(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function h(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(_(t.options.mutationKey)!==_(a))return!1}else if(!v(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function g(e,t){return(t?.queryKeyHashFn||_)(e)}function _(e){return JSON.stringify(e,(e,t)=>S(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function v(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>v(e[n],t[n])):!1}var y=Object.prototype.hasOwnProperty;function b(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=x(e)&&x(t);if(!r&&!(S(e)&&S(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:y.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=b(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function x(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function S(e){if(!C(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!C(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function C(e){return Object.prototype.toString.call(e)===`[object Object]`}function w(e){return new Promise(t=>{a.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:b(e,t)}function E(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function D(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=/* @__PURE__ */ Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(/* @__PURE__ */ Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function A(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var j=/* @__PURE__ */ (()=>{let e=()=>s;return{isServer(){return e()},setIsServer(t){e=t}}})();function M(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var N=o;function P(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=N,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var F=P(),I=new class extends n{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function L(e){return Math.min(1e3*2**e,3e4)}function R(e){return(e??`online`)!==`online`||I.isOnline()}var z=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t=!1,n=0,i,a=M(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new z(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>r.isFocused()&&(e.networkMode===`always`||I.isOnline())&&e.canRun(),d=()=>R(e.networkMode)&&e.canRun(),f=e=>{o()||(i?.(),a.resolve(e))},p=e=>{o()||(i?.(),a.reject(e))},m=()=>new Promise(t=>{i=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{i=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(j.isServer()?0:3),a=e.retryDelay??L,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!c?p(r):(n++,e.onFail?.(n,r),w(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()}))})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(i?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var V=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),u(this.gcTime)&&(this.#e=a.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(a.clearTimeout(this.#e),this.#e=void 0)}};function H(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{A(e,()=>t.signal,()=>n=!0)},u=k(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?D:E;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?W:U,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:U(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function U(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function W(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var G=class extends V{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=J(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=J(this.options);e.data!==void 0&&(this.setState(q(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(c).catch(c):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>p(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>f(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!d(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=k(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?H(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=B({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof z&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof z){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...K(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...q(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),F.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function K(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:R(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function q(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function J(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Y=class extends V{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||X(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=B({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(/* @__PURE__ */ Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),F.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function X(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Z=class extends n{constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Set,this.#t=/* @__PURE__ */ new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Y({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Q(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Q(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Q(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Q(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>h(t,e))}findAll(e={}){return this.getAll().filter(t=>h(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(c))))}};function Q(e){return e.options.scope?.id}var ee=class extends n{constructor(e={}){super(),this.config=e,this.#e=/* @__PURE__ */ new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??g(r,t),a=this.get(i);return a||(a=new G({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>m(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>m(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},te=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ee,this.#t=e.mutationCache||new Z,this.#n=e.defaultOptions||{},this.#r=/* @__PURE__ */ new Map,this.#i=/* @__PURE__ */ new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=r.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=I.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(f(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=l(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(c).catch(c)}invalidateQueries(e,t={}){return F.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(c)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(c)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(f(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(c).catch(c)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(c).catch(c)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return I.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(_(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{v(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(_(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{v(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=g(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===O&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},$=class n{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||`https://api.luzmo.com`,this.apiVersion=e.apiVersion||`0.1.0`,this.authKey=e.authKey||``,this.authToken=e.authToken||``,this.queryClient=new te({defaultOptions:{queries:{staleTime:e.staleTime||3e5,gcTime:e.gcTime||6e5,retry:e.retry||3,retryDelay:e.retryDelay||(e=>Math.min(1e3*2**e,3e4))}}}),e.skipNetworkListeners||this.initNetworkListeners()}_normalizeUrl(e){try{let t=new URL(e);return t.origin+t.pathname.replace(/\/$/,``)}catch{return e}}configure(e={}){let t=e.apiUrl===void 0?void 0:this._normalizeUrl(e.apiUrl),n=this._normalizeUrl(this.apiUrl),r=e.authKey!==void 0&&e.authKey!==``&&e.authKey!==this.authKey||e.authToken!==void 0&&e.authToken!==``&&e.authToken!==this.authToken||t!==void 0&&t!==n;if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl!==void 0&&(this.apiUrl=e.apiUrl),e.authKey!==void 0&&(this.authKey=e.authKey),e.authToken!==void 0&&(this.authToken=e.authToken),r&&(this.queryClient.clear(),this.availableDatasets=[]),e.staleTime||e.gcTime||e.retry){let t={};e.staleTime&&(t.staleTime=e.staleTime),e.gcTime&&(t.gcTime=e.gcTime),e.retry&&(t.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...t}})}}clearLocalCache(){this.queryClient.clear(),this.availableDatasets=[]}initNetworkListeners(){typeof window<`u`&&window.addEventListener(`online`,()=>{console.warn(`Network connection restored, refreshing data...`),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":`application/json`,...e}}async fetchApi(e,t,n={}){let r=`${this.apiUrl}/${this.apiVersion}${e}`,i={method:n.method||`POST`,headers:this.getHeaders(n.headers),mode:`cors`,...n};t!==void 0&&(t.key=this.authKey,t.token=this.authToken,i.body=JSON.stringify(t));try{let t=await fetch(r,i);if(!t.ok){let n=await t.json().catch(()=>null);throw t.status===401||t.status===403?Error(`Authentication failed. Please check your API token.`):t.status===404?Error(`Resource not found: ${e}`):t.status===429?Error(`Rate limit exceeded. Please try again later.`):Error(n?.message||`API request failed with status ${t.status}`)}return await t.json()}catch(t){throw console.error(`API request to ${e} failed:`,t),t instanceof Error&&(t.endpoint=e,t.timestamp=(/* @__PURE__ */ new Date()).toISOString()),t}}async fetchAllDatasets(e={}){let t=e.offset||0,n=e.limit||50,r=[`datasets`,t,n];return await this.queryClient.fetchQuery({queryKey:r,queryFn:async()=>{let e={action:`get`,version:this.apiVersion,find:{where:{type:`dataset`},attributes:[`id`,`name`,`description`],limit:n,offset:t}},r=await this.fetchApi(`/securable`,e);return{data:r?.rows??[],pagination:{offset:t,limit:n,total:r?.count??0,pages:Math.ceil((r?.count??0)/n)}}}})}async searchDatasets(e,t){if(!e)return{data:[]};let n=[`datasets`,`search`,e,t];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{let n={action:`get`,version:this.apiVersion,find:{where:{type:`dataset`}}};e?.length>0&&(n.find.search={match_types:[`name`],keyphrase:e}),t?.offset&&(n.find.offset=t?.offset),t?.limit&&(n.find.limit=t?.limit);let r=await this.fetchApi(`/securable`,n),i={data:r?.rows??[]};return t?.limit&&(i.pagination={offset:t?.offset??0,limit:t?.limit,total:r?.count??0,pages:Math.ceil((r?.count??0)/t?.limit)}),i}})}async fetchDatasetNames(e){if(!e||e.length===0)throw Error(`At least one dataset ID is required`);let{valid:n,invalid:r}=t(e);if(r.length>0&&console.warn(`[DataBroker] Invalid dataset IDs provided (not valid UUIDs): ${r.join(`, `)}. These will be skipped.`),n.length===0)throw Error(`No valid dataset IDs provided. Dataset IDs must be valid UUIDs.`);let i=[`dataset-names`,n,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{let e={action:`get`,version:this.apiVersion,find:{where:{type:`dataset`,id:{in:n}},attributes:[`name`,`id`,`description`]}};return(await this.fetchApi(`/securable`,e))?.rows??[]}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw Error(`At least one dataset ID is required`);let{valid:n,invalid:r}=t(e);if(r.length>0&&console.warn(`[DataBroker] Invalid dataset IDs provided (not valid UUIDs): ${r.join(`, `)}. These will be skipped.`),n.length===0)throw Error(`No valid dataset IDs provided. Dataset IDs must be valid UUIDs.`);let i=[`datasets`,n,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{let e={action:`get`,version:this.apiVersion,find:{where:{type:`dataset`,id:{in:n}},attributes:[`name`,`id`,`description`],include:[{model:`Column`,attributes:[`id`,`name`,`description`,`type`,`subtype`,`format`,`hidden`,`lowestLevel`,`expression`,`duration_levels`,`duration_format`],separate:!0,order:[[`order`,`asc`]],include:[{model:`Column`,attributes:[`id`,`securable_id`,`hierarchy_enabled`,`currency_id`],as:`Joins`},{model:`HierarchyLevel`,attributes:[`id`,`level`,`name`],as:`HierarchyLevels`},{model:`Currency`,attributes:[`id`,`name`,`symbol`],as:`Currency`}]},{model:`Formula`,attributes:[`id`,`name`,`description`,`type`,`subtype`,`format`,`hidden`,`lowestLevel`,`expression`,`duration_levels`,`duration_format`],include:[{model:`Currency`,attributes:[`id`,`name`,`symbol`],as:`Currency`}]}]}};return(await this.fetchApi(`/securable`,e))?.rows??[]}})}async fetchData(e){if(!e)throw Error(`Query is required`);let t=[`data`,e];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>{let t={action:`get`,version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi(`/data`,t);return{data:n?.data||[],performance:n?.performance||{}}}})}getCachedData(e){let t=[`data`,e],n=this.queryClient.getQueryState(t),r=this.queryClient.getDefaultOptions().queries?.staleTime;if(n?.data&&!n.isInvalidated&&typeof r==`number`&&!(r!==1/0&&Date.now()-n.dataUpdatedAt>r))return n.data}async validate(e,t){if(!t?.expression)return{valid:!1};let n={action:`validate`,version:this.apiVersion,properties:t},r=await this.fetchApi(`/${e}`,n);return{valid:!!r?.valid,reason:r?.reason??r?.error,explanation:r?.explanation,type:r?.type}}async fetchTheme(e){if(!e)throw Error(`Theme ID is required`);let t=[`theme`,e];return await this.queryClient.fetchQuery({queryKey:t,queryFn:async()=>(await this.fetchApi(`/theme`,{action:`get`,version:this.apiVersion,find:{where:{id:e}}}))?.rows?.[0]})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:[`dataset`,e]}),this.queryClient.invalidateQueries({queryKey:[`columns`,e]})):this.queryClient.invalidateQueries({queryKey:[`datasets`]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return n.instance?Object.keys(e).length>0&&n.instance.configure(e):n.instance=new n(e),n.instance}async fetchDatasetsRecursive(n){if(!n||n.length===0)throw Error(`At least one dataset ID is required`);let{valid:r,invalid:i}=t(n);if(i.length>0&&console.warn(`[DataBroker] Invalid dataset IDs provided (not valid UUIDs): ${i.join(`, `)}. These will be skipped.`),r.length===0)throw Error(`No valid dataset IDs provided. Dataset IDs must be valid UUIDs.`);let a=[...new Set(r)],o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Map,c=t=>{t&&e(t)&&!o.has(t)&&!a.includes(t)&&a.push(t)};for(;a.length>0;){let e=[];for(;a.length>0&&e.length<50;){let t=a.shift();o.has(t)||e.push(t)}if(e.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(e)).forEach(e=>{let t=this.postProcessDatasetMetadata(e);o.add(t.id),this.queryClient.setQueryData([`dataset`,t.id],t),(t.outgoingJoins??[]).map(e=>e.securable_id).filter(e=>!!e&&e!==t.id).forEach(e=>{c(e)}),s.set(t.id,t),this.availableDatasets.some(e=>e.id===t.id)||this.availableDatasets.push({id:t.id,name:t.name,columns:t.columns})})}catch(e){console.error(`Error fetching datasets recursively:`,e)}}return[...s.values()]}postProcessDatasetMetadata(e){let t=[],n=(e.columns??[]).map(e=>{let n=e.joins??(Array.isArray(e.joins)?e.joins:[]);Array.isArray(n)&&n.length>0&&t.push(...n);let{joins:r,...i}=e;return{...i,joins:n}});return{...e,columns:n,formulas:e.formulas??[],outgoingJoins:t,dateLoaded:/* @__PURE__ */ new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){let t=this.queryClient.getQueryData([`dataset`,e]);return t?(t.outgoingJoins??[]).map(e=>e.securable_id).filter(t=>!!t&&t!==e):[]}},ne=$.getInstance();export{ne as n,$ as t};
@@ -1,5 +1,5 @@
1
1
 
2
- import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{n as i,t as a}from"./luzmoCheckbox-BksyONqE.js";import{d as o,f as s,p as c}from"./chart-helpers-CR-EUEPf.js";import{html as l,property as u,query as d,state as f,unsafeCSS as p}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";var m=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-binning-gap,var(--display-settings-binning-gap));display:flex}:host,:host([size=s]){--display-settings-binning-gap:var(--luzmo-spacing-3)}:host([size=l]){--display-settings-binning-gap:var(--luzmo-spacing-4)}:host([size=xl]){--display-settings-binning-gap:var(--luzmo-spacing-5)}`,h=class extends n(s(c,{validSizes:Object.values(o)})){constructor(...e){super(...e),this.slotContent={},this._enabled=!1,this._binWidth=10}static get styles(){return[p(m)]}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._enabled=this.slotContent?.bins?.enabled??!1,this._binWidth=this.slotContent?.bins?.number??10)}toggleBinning(){this._enabled=!this._enabled,this.sendEvent()}setBinning(){this._binWidth=this.binWidthElement.value,this.sendEvent()}sendEvent(){let e={enabled:!!this._enabled,number:this._binWidth??10};this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this.slotContent,bins:e}}}))}renderBinWidth(){return l`<div class="setting">
2
+ import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{n as i,t as a}from"./luzmoCheckbox-BksyONqE.js";import{S as o,b as s,x as c}from"./chart-helpers-DZsidiCl.js";import{html as l,property as u,query as d,state as f,unsafeCSS as p}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";var m=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-binning-gap,var(--display-settings-binning-gap));display:flex}:host,:host([size=s]){--display-settings-binning-gap:var(--luzmo-spacing-3)}:host([size=l]){--display-settings-binning-gap:var(--luzmo-spacing-4)}:host([size=xl]){--display-settings-binning-gap:var(--luzmo-spacing-5)}`,h=class extends n(c(o,{validSizes:Object.values(s)})){constructor(...e){super(...e),this.slotContent={},this._enabled=!1,this._binWidth=10}static get styles(){return[p(m)]}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._enabled=this.slotContent?.bins?.enabled??!1,this._binWidth=this.slotContent?.bins?.number??10)}toggleBinning(){this._enabled=!this._enabled,this.sendEvent()}setBinning(){this._binWidth=this.binWidthElement.value,this.sendEvent()}sendEvent(){let e={enabled:!!this._enabled,number:this._binWidth??10};this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this.slotContent,bins:e}}}))}renderBinWidth(){return l`<div class="setting">
3
3
  <luzmo-field-label .size=${this.size} for="bin-width"
4
4
  >${t(`Bin width`,{desc:`The width of each bin in the histogram`})}</luzmo-field-label
5
5
  >
@@ -1,5 +1,5 @@
1
1
 
2
- import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{i,o as a,s as o}from"./load-data-fields-for-datasets-CDlut-6S.js";import{n as s,t as c}from"./luzmoCheckbox-BksyONqE.js";import{d as l,f as u,p as d}from"./chart-helpers-CR-EUEPf.js";import{t as f}from"./task-BlhDPTQS.js";import{g as p,m}from"./item-slot-picker-panel-BOSVFBIy.js";import{html as h,property as g,query as _,unsafeCSS as v}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/progress-circle.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";var y={"~":()=>t(`Auto`,{desc:`Automatic setting of the option`}),"/":()=>`/`,"-":()=>`-`,".":()=>`.`},b=`:host{font-family:var(--luzmo-display-settings-datetime-font-family,var(--luzmo-font-family))}:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-datetime-gap,var(--display-settings-datetime-gap));display:flex}:host{--display-settings-datetime-example-font-size:var(--luzmo-font-size-s);--display-settings-datetime-example-color:var(--luzmo-font-color);--display-settings-datetime-example-label-font-weight:bold;--display-settings-datetime-example-label-color:var(--luzmo-primary);--display-settings-datetime-example-language-color:var(--luzmo-primary);--display-settings-datetime-gap:var(--luzmo-spacing-3);--display-settings-datetime-example-height:var(--luzmo-component-height)}:host([size=s]){--display-settings-datetime-gap:var(--luzmo-spacing-3);--display-settings-datetime-example-height:var(--luzmo-component-height-s);--display-settings-datetime-example-font-size:var(--luzmo-font-size-s)}:host([size=l]){--display-settings-datetime-gap:var(--luzmo-spacing-4);--display-settings-datetime-example-height:var(--luzmo-component-height-l);--display-settings-datetime-example-font-size:var(--luzmo-font-size)}:host([size=xl]){--display-settings-datetime-gap:var(--luzmo-spacing-5);--display-settings-datetime-example-height:var(--luzmo-component-height-xl);--display-settings-datetime-example-font-size:var(--luzmo-font-size-l)}`,x=class extends n(u(d,{validSizes:Object.values(l)})){constructor(...e){super(...e),this._loadLocaleFormatsConfig=new f(this,{task:async([e])=>{if(e&&e!==this._contentLanguageLoaded){let t=/* #__PURE__ */ Object.assign({"../../utils/formatter/formats/cs.ts":()=>import(`./cs-DLnr3a23.js`),"../../utils/formatter/formats/da.ts":()=>import(`./da-BJgbo0uE.js`),"../../utils/formatter/formats/de.ts":()=>import(`./de-DPgYMyja.js`),"../../utils/formatter/formats/en-GB.ts":()=>import(`./en-GB-QAmXQf8W.js`),"../../utils/formatter/formats/en-US.ts":()=>import(`./en-US-63f7j4v7.js`),"../../utils/formatter/formats/en.ts":()=>import(`./en-63f7j4v7.js`),"../../utils/formatter/formats/es.ts":()=>import(`./es-Dp1UuDDz.js`),"../../utils/formatter/formats/fi.ts":()=>import(`./fi-CLQ6vC7V.js`),"../../utils/formatter/formats/fr.ts":()=>import(`./fr-D8xrUEX4.js`),"../../utils/formatter/formats/he.ts":()=>import(`./he-DHPb0VBo.js`),"../../utils/formatter/formats/hu.ts":()=>import(`./hu-BpaYooip.js`),"../../utils/formatter/formats/it.ts":()=>import(`./it-DWTvD2Xn.js`),"../../utils/formatter/formats/ja.ts":()=>import(`./ja-CtDlXHD1.js`),"../../utils/formatter/formats/ko.ts":()=>import(`./ko-CekuHU50.js`),"../../utils/formatter/formats/mk.ts":()=>import(`./mk-Dq3YK4jD.js`),"../../utils/formatter/formats/nl.ts":()=>import(`./nl-7csxtU-I.js`),"../../utils/formatter/formats/no.ts":()=>import(`./no-DJNRx8au.js`),"../../utils/formatter/formats/pl.ts":()=>import(`./pl-zDnuk9Gd.js`),"../../utils/formatter/formats/pt.ts":()=>import(`./pt-BEVAH5AJ.js`),"../../utils/formatter/formats/ru.ts":()=>import(`./ru-Ceji1Fqk.js`),"../../utils/formatter/formats/sv.ts":()=>import(`./sv-CgssnOqA.js`),"../../utils/formatter/formats/tr.ts":()=>import(`./tr-i3G2sFi4.js`),"../../utils/formatter/formats/zh-CN.ts":()=>import(`./zh-CN-NVnv57dz.js`),"../../utils/formatter/formats/zh-TW.ts":()=>import(`./zh-TW-NVnv57dz.js`)});if(t[`../../utils/formatter/formats/${e}.ts`]){let n=await t[`../../utils/formatter/formats/${e}.ts`]();this._localeFormats=n?.default??{}}return this._contentLanguageLoaded=e,this._localeFormats}},args:()=>[this.contentLanguage]}),this.contentLanguage=`en`,this.size=`m`,this.slotContent={},this._dateLevel=5,this._displayAs=`default`,this._weekStart=`monday`,this._weekDayAndMonthInYearFormat=`long`,this._dateFormat=`auto`,this._dateSeparator=`~`,this._sendEvent=()=>{this._calculateSlotContent(),this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:this._currentSlotContent}}))}}static get styles(){return[v(b)]}_parseSlotContent(){this._dateLevel=this.slotContent?.level??this.slotContent?.lowestLevel??5,this._displayAs=this.slotContent?.datetimeDisplayMode??`default`,this._displayAs===`weekday_number`&&(this._displayAs=`day_in_week`,this._weekDayAndMonthInYearFormat=`number`),this._displayAs===`weekday_name`&&(this._displayAs=`day_in_week`),this._displayAs===`month_number`&&(this._displayAs=`month_in_year`,this._weekDayAndMonthInYearFormat=`number`),this._displayAs===`month_name`&&(this._displayAs=`month_in_year`),this._parseSavedFormat()}_parseSavedFormat(){let e=this.slotContent?.format??`%d-%m-%Y`,t=e.match(/[./-]/);if(this._dateSeparator=e.includes(`~`)?`~`:t?.[0]??`~`,e.includes(`%amd`))this._dateFormat=`auto`;else{let t=e.indexOf(`%d`),n=e.indexOf(`%m`);t!==-1&&n!==-1&&(this._dateFormat=t<n?`ddmm`:`mmdd`)}this._24hFormat=e.includes(`%H`),this._monthName=/%B|%b/.test(e),this._weekDay=/%a|%A/.test(e),this._monthName&&(this._monthNameFormat=e.includes(`%b`)?`short`:`long`),this._weekDay&&(this._weekDayAndMonthInYearFormat=e.includes(`%a`)?`short`:`long`);let n=this._dateLevel===5&&this.slotContent?.weekDayNameFormat||this._dateLevel===3&&this.slotContent?.monthNameFormat;n&&(this._weekDayAndMonthInYearFormat=n)}_calculateFormat(){let e,t=this._localeFormats?.smartDateFormats??p;this._monthName?(e=t.filter(e=>e.monthType===`name`&&e.longText===(this._monthNameFormat===`long`)&&e.weekday===this._weekDay),e.length>0?this._format=e[0].key:(this._weekDayAndMonthInYearFormat=`short`,this._weekDay=!0,this._format=`%a %e %B %Y`)):(e=this._dateLevel&&this._dateLevel===4?t.filter(e=>e.monthType===`number`&&e.mmdd===(this._weekFormat===`mmdd`||this._weekFormat!==`ddmm`&&null)&&e.separator===this._dateSeparator):t.filter(e=>e.monthType===`number`&&e.mmdd===(this._dateFormat===`mmdd`||this._dateFormat!==`ddmm`&&null)&&e.separator===this._dateSeparator),this._dateFormat===`auto`&&this._dateLevel&&this._dateLevel!==4?this._format=`%amd`+this._dateSeparator+`%Y`:e.length>0?this._format=e[0].key:(this._dateFormat=`ddmm`,this._dateSeparator=`/`,this._format=`%d/%m/%Y`)),this._dateLevel&&this._dateLevel>5&&(this._format+=this._24hFormat?` %H:%M:%S.%L`:` %I:%M:%S.%L %p`)}_setWeekStartsOn(){this._weekStart=this._weekStartElement.value,this._sendEvent(),this.requestUpdate()}_setDisplayAs(){this._displayAs=this._displayAsElement.value,this._sendEvent(),this.requestUpdate()}_setWeekdayAndMonthInYearFormat(){this._weekDayAndMonthInYearFormat=this._weekDayAndMonthInYearFormatElement.selected?.[0]??`long`,this._sendEvent(),this.requestUpdate()}_setMonthNameFormat(){this._monthNameFormat=this._monthNameFormatElement.selected?.[0],this._sendEvent(),this.requestUpdate()}_setMonthName(){this._monthName=this._monthNameElement.selected,this._sendEvent(),this.requestUpdate()}_setWeekFormat(){this._weekFormat=this._weekFormatElement.selected?.[0],this._sendEvent(),this.requestUpdate()}_setDateFormat(){this._dateFormat=this._dateFormatElement.value,this._sendEvent(),this.requestUpdate()}_setDateSeparator(){this._dateSeparator=this._dateSeparatorElement.value,this._sendEvent(),this.requestUpdate()}_set24hFormat(){this._24hFormat=this._format24hElement.selected,this._sendEvent(),this.requestUpdate()}_setWeekday(){this._weekDay=this._weekDayElement.selected,this._sendEvent(),this.requestUpdate()}_calculateSlotContent(){this._currentSlotContent={...this.slotContent},this._calculateFormat(),this._currentSlotContent.format=this._format,this._displayAs==="default"?delete this._currentSlotContent.datetimeDisplayMode:(this._currentSlotContent.datetimeDisplayMode=this._displayAs,this._displayAs===`week_in_year`?this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`week_number`:`week_name`:this._displayAs===`month_in_year`?this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`month_number`:`month_name`:this._displayAs===`day_in_week`&&(this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`weekday_number`:`weekday_name`,this._currentSlotContent.weekStart=this._weekStart),this._weekDayAndMonthInYearFormat&&(this._dateLevel===3?this._currentSlotContent.monthNameFormat=this._weekDayAndMonthInYearFormat:this._dateLevel===5&&(this._currentSlotContent.weekDayNameFormat=this._weekDayAndMonthInYearFormat)))}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._parseSlotContent(),this._calculateSlotContent())}_renderDisplaySettings(){let e=i?.[`level${this._dateLevel??0}`]?.map(e=>h`<luzmo-menu-item value=${e.key}>
2
+ import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{i,o as a,s as o}from"./load-data-fields-for-datasets-DS9O1oyy.js";import{n as s,t as c}from"./luzmoCheckbox-BksyONqE.js";import{S as l,b as u,x as d}from"./chart-helpers-DZsidiCl.js";import{t as f}from"./task-BlhDPTQS.js";import{g as p,m}from"./item-slot-picker-panel-BM82vSXi.js";import{html as h,property as g,query as _,unsafeCSS as v}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/progress-circle.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";var y={"~":()=>t(`Auto`,{desc:`Automatic setting of the option`}),"/":()=>`/`,"-":()=>`-`,".":()=>`.`},b=`:host{font-family:var(--luzmo-display-settings-datetime-font-family,var(--luzmo-font-family))}:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-datetime-gap,var(--display-settings-datetime-gap));display:flex}:host{--display-settings-datetime-example-font-size:var(--luzmo-font-size-s);--display-settings-datetime-example-color:var(--luzmo-font-color);--display-settings-datetime-example-label-font-weight:bold;--display-settings-datetime-example-label-color:var(--luzmo-primary);--display-settings-datetime-example-language-color:var(--luzmo-primary);--display-settings-datetime-gap:var(--luzmo-spacing-3);--display-settings-datetime-example-height:var(--luzmo-component-height)}:host([size=s]){--display-settings-datetime-gap:var(--luzmo-spacing-3);--display-settings-datetime-example-height:var(--luzmo-component-height-s);--display-settings-datetime-example-font-size:var(--luzmo-font-size-s)}:host([size=l]){--display-settings-datetime-gap:var(--luzmo-spacing-4);--display-settings-datetime-example-height:var(--luzmo-component-height-l);--display-settings-datetime-example-font-size:var(--luzmo-font-size)}:host([size=xl]){--display-settings-datetime-gap:var(--luzmo-spacing-5);--display-settings-datetime-example-height:var(--luzmo-component-height-xl);--display-settings-datetime-example-font-size:var(--luzmo-font-size-l)}`,x=class extends n(d(l,{validSizes:Object.values(u)})){constructor(...e){super(...e),this._loadLocaleFormatsConfig=new f(this,{task:async([e])=>{if(e&&e!==this._contentLanguageLoaded){let t=/* #__PURE__ */ Object.assign({"../../utils/formatter/formats/cs.ts":()=>import(`./cs-DLnr3a23.js`),"../../utils/formatter/formats/da.ts":()=>import(`./da-BJgbo0uE.js`),"../../utils/formatter/formats/de.ts":()=>import(`./de-DPgYMyja.js`),"../../utils/formatter/formats/en-GB.ts":()=>import(`./en-GB-Di3OzVdL.js`),"../../utils/formatter/formats/en-US.ts":()=>import(`./en-US-DNsyAwgq.js`),"../../utils/formatter/formats/en.ts":()=>import(`./en-DNsyAwgq.js`),"../../utils/formatter/formats/es.ts":()=>import(`./es-Dp1UuDDz.js`),"../../utils/formatter/formats/fi.ts":()=>import(`./fi-CLQ6vC7V.js`),"../../utils/formatter/formats/fr.ts":()=>import(`./fr-D8xrUEX4.js`),"../../utils/formatter/formats/he.ts":()=>import(`./he-DHPb0VBo.js`),"../../utils/formatter/formats/hu.ts":()=>import(`./hu-BpaYooip.js`),"../../utils/formatter/formats/it.ts":()=>import(`./it-DWTvD2Xn.js`),"../../utils/formatter/formats/ja.ts":()=>import(`./ja-CtDlXHD1.js`),"../../utils/formatter/formats/ko.ts":()=>import(`./ko-CekuHU50.js`),"../../utils/formatter/formats/mk.ts":()=>import(`./mk-Dq3YK4jD.js`),"../../utils/formatter/formats/nl.ts":()=>import(`./nl-7csxtU-I.js`),"../../utils/formatter/formats/no.ts":()=>import(`./no-DJNRx8au.js`),"../../utils/formatter/formats/pl.ts":()=>import(`./pl-zDnuk9Gd.js`),"../../utils/formatter/formats/pt.ts":()=>import(`./pt-BEVAH5AJ.js`),"../../utils/formatter/formats/ru.ts":()=>import(`./ru-Ceji1Fqk.js`),"../../utils/formatter/formats/sv.ts":()=>import(`./sv-CgssnOqA.js`),"../../utils/formatter/formats/tr.ts":()=>import(`./tr-i3G2sFi4.js`),"../../utils/formatter/formats/zh-CN.ts":()=>import(`./zh-CN-NVnv57dz.js`),"../../utils/formatter/formats/zh-TW.ts":()=>import(`./zh-TW-NVnv57dz.js`)});if(t[`../../utils/formatter/formats/${e}.ts`]){let n=await t[`../../utils/formatter/formats/${e}.ts`]();this._localeFormats=n?.default??{}}return this._contentLanguageLoaded=e,this._localeFormats}},args:()=>[this.contentLanguage]}),this.contentLanguage=`en`,this.size=`m`,this.slotContent={},this._dateLevel=5,this._displayAs=`default`,this._weekStart=`monday`,this._weekDayAndMonthInYearFormat=`long`,this._dateFormat=`auto`,this._dateSeparator=`~`,this._sendEvent=()=>{this._calculateSlotContent(),this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:this._currentSlotContent}}))}}static get styles(){return[v(b)]}_parseSlotContent(){this._dateLevel=this.slotContent?.level??this.slotContent?.lowestLevel??5,this._displayAs=this.slotContent?.datetimeDisplayMode??`default`,this._displayAs===`weekday_number`&&(this._displayAs=`day_in_week`,this._weekDayAndMonthInYearFormat=`number`),this._displayAs===`weekday_name`&&(this._displayAs=`day_in_week`),this._displayAs===`month_number`&&(this._displayAs=`month_in_year`,this._weekDayAndMonthInYearFormat=`number`),this._displayAs===`month_name`&&(this._displayAs=`month_in_year`),this._parseSavedFormat()}_parseSavedFormat(){let e=this.slotContent?.format??`%d-%m-%Y`,t=e.match(/[./-]/);if(this._dateSeparator=e.includes(`~`)?`~`:t?.[0]??`~`,e.includes(`%amd`))this._dateFormat=`auto`;else{let t=e.indexOf(`%d`),n=e.indexOf(`%m`);t!==-1&&n!==-1&&(this._dateFormat=t<n?`ddmm`:`mmdd`)}this._24hFormat=e.includes(`%H`),this._monthName=/%B|%b/.test(e),this._weekDay=/%a|%A/.test(e),this._monthName&&(this._monthNameFormat=e.includes(`%b`)?`short`:`long`),this._weekDay&&(this._weekDayAndMonthInYearFormat=e.includes(`%a`)?`short`:`long`);let n=this._dateLevel===5&&this.slotContent?.weekDayNameFormat||this._dateLevel===3&&this.slotContent?.monthNameFormat;n&&(this._weekDayAndMonthInYearFormat=n)}_calculateFormat(){let e,t=this._localeFormats?.smartDateFormats??p;this._monthName?(e=t.filter(e=>e.monthType===`name`&&e.longText===(this._monthNameFormat===`long`)&&e.weekday===this._weekDay),e.length>0?this._format=e[0].key:(this._weekDayAndMonthInYearFormat=`short`,this._weekDay=!0,this._format=`%a %e %B %Y`)):(e=this._dateLevel&&this._dateLevel===4?t.filter(e=>e.monthType===`number`&&e.mmdd===(this._weekFormat===`mmdd`||this._weekFormat!==`ddmm`&&null)&&e.separator===this._dateSeparator):t.filter(e=>e.monthType===`number`&&e.mmdd===(this._dateFormat===`mmdd`||this._dateFormat!==`ddmm`&&null)&&e.separator===this._dateSeparator),this._dateFormat===`auto`&&this._dateLevel&&this._dateLevel!==4?this._format=`%amd`+this._dateSeparator+`%Y`:e.length>0?this._format=e[0].key:(this._dateFormat=`ddmm`,this._dateSeparator=`/`,this._format=`%d/%m/%Y`)),this._dateLevel&&this._dateLevel>5&&(this._format+=this._24hFormat?` %H:%M:%S.%L`:` %I:%M:%S.%L %p`)}_setWeekStartsOn(){this._weekStart=this._weekStartElement.value,this._sendEvent(),this.requestUpdate()}_setDisplayAs(){this._displayAs=this._displayAsElement.value,this._sendEvent(),this.requestUpdate()}_setWeekdayAndMonthInYearFormat(){this._weekDayAndMonthInYearFormat=this._weekDayAndMonthInYearFormatElement.selected?.[0]??`long`,this._sendEvent(),this.requestUpdate()}_setMonthNameFormat(){this._monthNameFormat=this._monthNameFormatElement.selected?.[0],this._sendEvent(),this.requestUpdate()}_setMonthName(){this._monthName=this._monthNameElement.selected,this._sendEvent(),this.requestUpdate()}_setWeekFormat(){this._weekFormat=this._weekFormatElement.selected?.[0],this._sendEvent(),this.requestUpdate()}_setDateFormat(){this._dateFormat=this._dateFormatElement.value,this._sendEvent(),this.requestUpdate()}_setDateSeparator(){this._dateSeparator=this._dateSeparatorElement.value,this._sendEvent(),this.requestUpdate()}_set24hFormat(){this._24hFormat=this._format24hElement.selected,this._sendEvent(),this.requestUpdate()}_setWeekday(){this._weekDay=this._weekDayElement.selected,this._sendEvent(),this.requestUpdate()}_calculateSlotContent(){this._currentSlotContent={...this.slotContent},this._calculateFormat(),this._currentSlotContent.format=this._format,this._displayAs==="default"?delete this._currentSlotContent.datetimeDisplayMode:(this._currentSlotContent.datetimeDisplayMode=this._displayAs,this._displayAs===`week_in_year`?this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`week_number`:`week_name`:this._displayAs===`month_in_year`?this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`month_number`:`month_name`:this._displayAs===`day_in_week`&&(this._currentSlotContent.datetimeDisplayMode=this._weekDayAndMonthInYearFormat===`number`?`weekday_number`:`weekday_name`,this._currentSlotContent.weekStart=this._weekStart),this._weekDayAndMonthInYearFormat&&(this._dateLevel===3?this._currentSlotContent.monthNameFormat=this._weekDayAndMonthInYearFormat:this._dateLevel===5&&(this._currentSlotContent.weekDayNameFormat=this._weekDayAndMonthInYearFormat)))}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._parseSlotContent(),this._calculateSlotContent())}_renderDisplaySettings(){let e=i?.[`level${this._dateLevel??0}`]?.map(e=>h`<luzmo-menu-item value=${e.key}>
3
3
  ${e.i18n()}
4
4
  </luzmo-menu-item>`);return h`<div class="setting">
5
5
  <luzmo-field-label .size=${this.size} for="display-as"
@@ -1,5 +1,5 @@
1
1
 
2
- import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{n as i,t as a}from"./luzmoCheckbox-BksyONqE.js";import{d as o,f as s,p as c}from"./chart-helpers-CR-EUEPf.js";import{html as l,ifDefined as u,property as d,state as f,unsafeCSS as p}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";var m=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-grand-totals-gap,var(--display-settings-grand-totals-gap));display:flex}:host,:host([size=s]){--display-settings-grand-totals-gap:var(--luzmo-spacing-3)}:host([size=l]){--display-settings-grand-totals-gap:var(--luzmo-spacing-4)}:host([size=xl]){--display-settings-grand-totals-gap:var(--luzmo-spacing-5)}`,h=class extends n(s(c,{validSizes:Object.values(o)})){constructor(...e){super(...e),this.slotContent={}}static get styles(){return[p(m)]}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._enabled=this.slotContent?.grandTotals?.enabled??!1)}toggleGrandTotals(){this._enabled=!this._enabled,this.sendEvent()}sendEvent(){let e={enabled:!!this._enabled};this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this.slotContent,grandTotals:e}}}))}render(){return l`<div class="settings-container">
2
+ import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{n as i,t as a}from"./luzmoCheckbox-BksyONqE.js";import{S as o,b as s,x as c}from"./chart-helpers-DZsidiCl.js";import{html as l,ifDefined as u,property as d,state as f,unsafeCSS as p}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";var m=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-grand-totals-gap,var(--display-settings-grand-totals-gap));display:flex}:host,:host([size=s]){--display-settings-grand-totals-gap:var(--luzmo-spacing-3)}:host([size=l]){--display-settings-grand-totals-gap:var(--luzmo-spacing-4)}:host([size=xl]){--display-settings-grand-totals-gap:var(--luzmo-spacing-5)}`,h=class extends n(c(o,{validSizes:Object.values(s)})){constructor(...e){super(...e),this.slotContent={}}static get styles(){return[p(m)]}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._enabled=this.slotContent?.grandTotals?.enabled??!1)}toggleGrandTotals(){this._enabled=!this._enabled,this.sendEvent()}sendEvent(){let e={enabled:!!this._enabled};this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this.slotContent,grandTotals:e}}}))}render(){return l`<div class="settings-container">
3
3
  <div class="settings-row">
4
4
  <div class="setting">
5
5
  <luzmo-field-label .size=${this.size} for="grand-totals"
@@ -1,5 +1,5 @@
1
1
 
2
- import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{t as i}from"./luzmoAngleDown-PNrItYzK.js";import{n as a,u as o}from"./load-data-fields-for-datasets-CDlut-6S.js";import{t as s}from"./luzmo-icon-markup-ByaNI6dg.js";import{d as c,f as l,p as u}from"./chart-helpers-CR-EUEPf.js";import{t as d}from"./localize-DXRmGRe-.js";import{v as f}from"./item-slot-picker-panel-BOSVFBIy.js";import{html as p,nothing as m,property as h,query as g,state as _,unsafeCSS as v}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import{removeSlottableRequest as y}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/overlay.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/popover.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/tooltip.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";var b=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-numeric-gap,var(--display-settings-numeric-gap));display:flex}.duration-angle-down-icon{margin-inline-start:var(--luzmo-numeric-duration-levels-dropdown-icon-margin-inline-start,var(--numeric-duration-levels-dropdown-icon-margin-inline-start))}.dataset-header{white-space:nowrap;text-overflow:ellipsis;text-transform:uppercase;max-width:100%;color:var(--luzmo-font-color);white-space:nowrap;cursor:default;margin:.5rem 1rem;font-weight:600;overflow:hidden}.no-weight-label{margin-left:1rem}.with-secondary-icon{clip-path:polygon(0 0,60% 0,65% 60%,100% 65%,100% 100%,0 100%)}.secondary-icon{width:auto;font-size:.75em;line-height:1;position:absolute;bottom:45%;left:60%}.data-icon-type{text-align:center;width:1.5rem;display:inline-block;position:relative}:host{--display-settings-numeric-gap:var(--luzmo-spacing-3);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-2)}:host([size=s]){--display-settings-numeric-gap:var(--luzmo-spacing-3);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-1)}:host([size=l]){--display-settings-numeric-gap:var(--luzmo-spacing-4);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-3)}:host([size=xl]){--display-settings-numeric-gap:var(--luzmo-spacing-5);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-4)}`,x={sum:()=>t(`Sum`,{desc:`Aggregation label`}),cumulativesum:()=>t(`Cumulative sum`,{desc:`Aggregation label`}),average:()=>t(`Average`,{desc:`Aggregation label`}),median:()=>t(`Median`,{desc:`Aggregation label`}),count:()=>t(`Count rows`,{desc:`Aggregation label`}),distinctcount:()=>t(`Count distinct`,{desc:`Aggregation label`}),min:()=>t(`Minimum`,{desc:`Aggregation label`}),max:()=>t(`Maximum`,{desc:`Aggregation label`}),stddev:()=>t(`Standard deviation`,{desc:`Aggregation label`}),rate:()=>t(`Rate`,{desc:`Aggregation label`})},S={general:`123`,percentage:`%`,scientific:`SI`},C={time:()=>t(`Time`,{desc:`Time format option`}),short:()=>t(`Short`,{desc:`Short format option`}),long:()=>t(`Long`,{desc:`Long format option`})},w={Auto:{auto:!0,label:()=>t(`Auto`,{desc:`Automatic setting of the option`})},"1,000.00":{auto:!1,label:()=>`1,000.00`,thousandSeparator:`,`,decimalSeparator:`.`,hiddenFor:`scientific`},"1.000,00":{auto:!1,label:()=>`1.000,00`,thousandSeparator:`.`,decimalSeparator:`,`,hiddenFor:`scientific`},"1000.00":{auto:!1,label:()=>`1000.00`,decimalSeparator:`.`},"1000,00":{auto:!1,label:()=>`1000,00`,decimalSeparator:`,`}},T={levels:[{level:1,label:`years`},{level:2,label:`quarters`},{level:3,label:`months`},{level:4,label:`weeks`},{level:5,label:`days`},{level:6,label:`hours`},{level:7,label:`minutes`},{level:8,label:`seconds`},{level:9,label:`milliseconds`}]},E=class extends n(l(u,{validSizes:Object.values(c)})){constructor(...e){super(...e),this.slotContent={},this.measureColumns=[],this._durationLevels=[],this._renderDurationLevelMenu=!1,this._handleSlottableRequest=e=>{this._renderDurationLevelMenu=e.data!==y},this._sendEvent=()=>{let e={...this.slotContent,format:this._format,aggregationFunc:this._aggregationFunc};this._aggregationWeightColumn?e.aggregationWeight={...this._aggregationWeightColumn}:delete e.aggregationWeight,this._displayMode===`duration`?(e.duration=e.duration??{},e.duration.format=this._durationFormat,e.duration.levels=this._durationLevels):delete e.duration,this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:e}}))}}static get styles(){return[v(b)]}_parseSavedNumericFormatSettings(){if(this._displayMode=this.slotContent?.subtype===`duration`?`duration`:`numeric`,this._durationFormat=this.slotContent?.duration?.format??`short`,this._durationLevels=this.slotContent?.duration?.levels??[1],this._displayMode===`duration`)this._precision=2,this._commaDecimals=!1,this._thousandSeparator=!1;else{this._format=this.slotContent?.format??`.0f`;let e=f(this._format??`.0f`);this._isAuto=e.typeFormat?.includes(`a`)??!1,this._displayAs=[`%`,`a%`,`y`,`ay`].includes(e.typeFormat)?`percentage`:[`s`,`as`,`w`,`aw`].includes(e.typeFormat)?`scientific`:`general`,this._precision=e.precision?Number.parseInt(e.precision.replace(`.`,``),10):+(this._displayAs===`scientific`),this._commaDecimals=[`z`,`az`,`y`,`ay`,`w`,`aw`].includes(e.typeFormat),this._thousandSeparator=e.comma===`,`,this._isAuto?this._numericFormatGroup=`Auto`:this._commaDecimals&&this._thousandSeparator?this._numericFormatGroup=`1.000,00`:!this._commaDecimals&&this._thousandSeparator?this._numericFormatGroup=`1,000.00`:this._commaDecimals&&!this._thousandSeparator?this._numericFormatGroup=`1000,00`:!this._commaDecimals&&!this._thousandSeparator&&(this._numericFormatGroup=`1000.00`)}}_setNumericDisplayAs(){this._displayAs=this._displayAsElement?.selected?.[0]??`general`,this._displayAs===`scientific`&&(this._precision=Math.max(this._precision??0,1),this._thousandSeparator=!1),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_setNumericSeparators(e){let t=w[e?.detail??`Auto`];this._thousandSeparator=[`,`,`.`].includes(t?.thousandSeparator??``),this._commaDecimals=t?.decimalSeparator===`,`,this._isAuto=t?.auto,this._setNumericFormat(),this._sendEvent()}_setPrecision(){Number.isNaN(this._precisionElement.value)&&(this._precisionElement.value=+(this._displayAs===`scientific`)),this._precision=this._precisionElement.value,this._setNumericFormat(),this._sendEvent()}_setNumericFormat(){let e=`f`,t=this.slotContent.subtype===`duration`?this._durationLevels&&this._durationLevels?.length===1?`numeric`:`duration`:`numeric`;if(this._maxDurationLevel=Math.min(...this._durationLevels),t===`duration`)(![`time`,`short`,`long`].includes(this._durationFormat??``)||this._maxDurationLevel<6&&this._durationFormat===`time`)&&(this._durationFormat=`short`);else{let t=this._displayAs??`general`;t===`general`&&this._commaDecimals?e=`z`:t===`percentage`&&this._commaDecimals?e=`y`:t===`scientific`&&this._commaDecimals?e=`w`:t===`percentage`?e=`%`:t===`scientific`&&(e=`s`),this._format=(this._thousandSeparator||this._isAuto?`,`:``)+`.`+this._precision+(this._isAuto?`a`:``)+e}}_setAggregationFunc(){let e=this._aggregationElement.value,t=this._aggregationFunc,n=this.slotContent.format;if(e!==(t===`weightedaverage`?`average`:t)){if(this._aggregationFunc=e===`average`&&this._aggregationWeightColumn?.column?`weightedaverage`:e,t===`rate`){let e=f(n),t=[`%`,`y`,`a%`,`ay`].includes(e.typeFormat);this.slotContent.subtype===`currency`&&t&&this._setNumericDisplayAs()}this._sendEvent(),(this._aggregationFunc===`rate`||t===`rate`)&&this.requestUpdate()}}_setAggregationWeight(){let e=this._aggregationWeightElement.value,t=this._aggregationFunc;if(e===`none`)this._aggregationWeightColumn=void 0,this._aggregationFunc===`weightedaverage`&&(this._aggregationFunc=`average`);else{let t,n;for(let r of this.measureColumns??[]){let i=r.columns?.find(t=>t.id===e);if(i){t=i,n=r.datasetId;break}}t&&(this._aggregationWeightColumn={column:t.id,set:n,columnSubType:t.subtype}),this._aggregationFunc===`average`&&(this._aggregationFunc=`weightedaverage`)}this._sendEvent(),this.requestUpdate(),(t===`weightedaverage`&&this._aggregationFunc===`average`||t===`average`&&this._aggregationFunc===`weightedaverage`)&&this.requestUpdate()}_setDurationLevels(){let e=this._durationLevels,t=this._durationLevelsElement.value.split(`,`).filter(e=>e!==``).map(e=>Number.parseInt(e,10));this._durationLevels=(t?.length??0)>=1?t:e,this._maxDurationLevel=Math.min(...this._durationLevels),this._fillTimeDurationLevels(),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_setDurationFormat(){this._durationFormat=this._durationFormatElement?.selected?.[0],this._fillTimeDurationLevels(),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_fillTimeDurationLevels(){if(this._durationFormat===`time`){let e=this._durationLevels.sort().at(-1);if([7,8,9].includes(e)){for(let t of{lev7:[6],lev8:[6,7],lev9:[6,7,8]}[`lev`+e])this._durationLevels.includes(t)||this._durationLevels.push(t);this._durationLevels=[...this._durationLevels].sort()}}}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._parseSavedNumericFormatSettings(),this._aggregationFunc=this.slotContent?.aggregationFunc??(this.slotContent?.type===`numeric`?`sum`:`count`),this._aggregationWeightColumn=this.slotContent?.aggregationWeight,this._isFormula=this.slotContent?.formula||this.slotContent?.formulaId)}_renderDurationLevelsSettings(){let e=T.levels.map(e=>{let t=!1;return this._durationFormat===`time`&&e.level>=6&&this._durationLevels.includes(e.level)&&e.level!==Math.max(...this._durationLevels)&&(t=!0),this._durationLevels.length===1&&this._durationLevels.includes(e.level)&&(t=!0),p`<luzmo-menu-item
2
+ import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{t as i}from"./luzmoAngleDown-PNrItYzK.js";import{n as a,u as o}from"./load-data-fields-for-datasets-DS9O1oyy.js";import{t as s}from"./luzmo-icon-markup-ByaNI6dg.js";import{S as c,b as l,x as u}from"./chart-helpers-DZsidiCl.js";import{t as d}from"./localize-DLl7tgQp.js";import{v as f}from"./item-slot-picker-panel-BM82vSXi.js";import{html as p,nothing as m,property as h,query as g,state as _,unsafeCSS as v}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import{removeSlottableRequest as y}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/overlay.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/popover.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/tooltip.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";var b=`:host .settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-numeric-gap,var(--display-settings-numeric-gap));display:flex}.duration-angle-down-icon{margin-inline-start:var(--luzmo-numeric-duration-levels-dropdown-icon-margin-inline-start,var(--numeric-duration-levels-dropdown-icon-margin-inline-start))}.dataset-header{white-space:nowrap;text-overflow:ellipsis;text-transform:uppercase;max-width:100%;color:var(--luzmo-font-color);white-space:nowrap;cursor:default;margin:.5rem 1rem;font-weight:600;overflow:hidden}.no-weight-label{margin-left:1rem}.with-secondary-icon{clip-path:polygon(0 0,60% 0,65% 60%,100% 65%,100% 100%,0 100%)}.secondary-icon{width:auto;font-size:.75em;line-height:1;position:absolute;bottom:45%;left:60%}.data-icon-type{text-align:center;width:1.5rem;display:inline-block;position:relative}:host{--display-settings-numeric-gap:var(--luzmo-spacing-3);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-2)}:host([size=s]){--display-settings-numeric-gap:var(--luzmo-spacing-3);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-1)}:host([size=l]){--display-settings-numeric-gap:var(--luzmo-spacing-4);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-3)}:host([size=xl]){--display-settings-numeric-gap:var(--luzmo-spacing-5);--numeric-duration-levels-dropdown-icon-margin-inline-start:var(--luzmo-spacing-4)}`,x={sum:()=>t(`Sum`,{desc:`Aggregation label`}),cumulativesum:()=>t(`Cumulative sum`,{desc:`Aggregation label`}),average:()=>t(`Average`,{desc:`Aggregation label`}),median:()=>t(`Median`,{desc:`Aggregation label`}),count:()=>t(`Count rows`,{desc:`Aggregation label`}),distinctcount:()=>t(`Count distinct`,{desc:`Aggregation label`}),min:()=>t(`Minimum`,{desc:`Aggregation label`}),max:()=>t(`Maximum`,{desc:`Aggregation label`}),stddev:()=>t(`Standard deviation`,{desc:`Aggregation label`}),rate:()=>t(`Rate`,{desc:`Aggregation label`})},S={general:`123`,percentage:`%`,scientific:`SI`},C={time:()=>t(`Time`,{desc:`Time format option`}),short:()=>t(`Short`,{desc:`Short format option`}),long:()=>t(`Long`,{desc:`Long format option`})},w={Auto:{auto:!0,label:()=>t(`Auto`,{desc:`Automatic setting of the option`})},"1,000.00":{auto:!1,label:()=>`1,000.00`,thousandSeparator:`,`,decimalSeparator:`.`,hiddenFor:`scientific`},"1.000,00":{auto:!1,label:()=>`1.000,00`,thousandSeparator:`.`,decimalSeparator:`,`,hiddenFor:`scientific`},"1000.00":{auto:!1,label:()=>`1000.00`,decimalSeparator:`.`},"1000,00":{auto:!1,label:()=>`1000,00`,decimalSeparator:`,`}},T={levels:[{level:1,label:`years`},{level:2,label:`quarters`},{level:3,label:`months`},{level:4,label:`weeks`},{level:5,label:`days`},{level:6,label:`hours`},{level:7,label:`minutes`},{level:8,label:`seconds`},{level:9,label:`milliseconds`}]},E=class extends n(u(c,{validSizes:Object.values(l)})){constructor(...e){super(...e),this.slotContent={},this.measureColumns=[],this._durationLevels=[],this._renderDurationLevelMenu=!1,this._handleSlottableRequest=e=>{this._renderDurationLevelMenu=e.data!==y},this._sendEvent=()=>{let e={...this.slotContent,format:this._format,aggregationFunc:this._aggregationFunc};this._aggregationWeightColumn?e.aggregationWeight={...this._aggregationWeightColumn}:delete e.aggregationWeight,this._displayMode===`duration`?(e.duration=e.duration??{},e.duration.format=this._durationFormat,e.duration.levels=this._durationLevels):delete e.duration,this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:e}}))}}static get styles(){return[v(b)]}_parseSavedNumericFormatSettings(){if(this._displayMode=this.slotContent?.subtype===`duration`?`duration`:`numeric`,this._durationFormat=this.slotContent?.duration?.format??`short`,this._durationLevels=this.slotContent?.duration?.levels??[1],this._displayMode===`duration`)this._precision=2,this._commaDecimals=!1,this._thousandSeparator=!1;else{this._format=this.slotContent?.format??`.0f`;let e=f(this._format??`.0f`);this._isAuto=e.typeFormat?.includes(`a`)??!1,this._displayAs=[`%`,`a%`,`y`,`ay`].includes(e.typeFormat)?`percentage`:[`s`,`as`,`w`,`aw`].includes(e.typeFormat)?`scientific`:`general`,this._precision=e.precision?Number.parseInt(e.precision.replace(`.`,``),10):+(this._displayAs===`scientific`),this._commaDecimals=[`z`,`az`,`y`,`ay`,`w`,`aw`].includes(e.typeFormat),this._thousandSeparator=e.comma===`,`,this._isAuto?this._numericFormatGroup=`Auto`:this._commaDecimals&&this._thousandSeparator?this._numericFormatGroup=`1.000,00`:!this._commaDecimals&&this._thousandSeparator?this._numericFormatGroup=`1,000.00`:this._commaDecimals&&!this._thousandSeparator?this._numericFormatGroup=`1000,00`:!this._commaDecimals&&!this._thousandSeparator&&(this._numericFormatGroup=`1000.00`)}}_setNumericDisplayAs(){this._displayAs=this._displayAsElement?.selected?.[0]??`general`,this._displayAs===`scientific`&&(this._precision=Math.max(this._precision??0,1),this._thousandSeparator=!1),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_setNumericSeparators(e){let t=w[e?.detail??`Auto`];this._thousandSeparator=[`,`,`.`].includes(t?.thousandSeparator??``),this._commaDecimals=t?.decimalSeparator===`,`,this._isAuto=t?.auto,this._setNumericFormat(),this._sendEvent()}_setPrecision(){Number.isNaN(this._precisionElement.value)&&(this._precisionElement.value=+(this._displayAs===`scientific`)),this._precision=this._precisionElement.value,this._setNumericFormat(),this._sendEvent()}_setNumericFormat(){let e=`f`,t=this.slotContent.subtype===`duration`?this._durationLevels&&this._durationLevels?.length===1?`numeric`:`duration`:`numeric`;if(this._maxDurationLevel=Math.min(...this._durationLevels),t===`duration`)(![`time`,`short`,`long`].includes(this._durationFormat??``)||this._maxDurationLevel<6&&this._durationFormat===`time`)&&(this._durationFormat=`short`);else{let t=this._displayAs??`general`;t===`general`&&this._commaDecimals?e=`z`:t===`percentage`&&this._commaDecimals?e=`y`:t===`scientific`&&this._commaDecimals?e=`w`:t===`percentage`?e=`%`:t===`scientific`&&(e=`s`),this._format=(this._thousandSeparator||this._isAuto?`,`:``)+`.`+this._precision+(this._isAuto?`a`:``)+e}}_setAggregationFunc(){let e=this._aggregationElement.value,t=this._aggregationFunc,n=this.slotContent.format;if(e!==(t===`weightedaverage`?`average`:t)){if(this._aggregationFunc=e===`average`&&this._aggregationWeightColumn?.column?`weightedaverage`:e,t===`rate`){let e=f(n),t=[`%`,`y`,`a%`,`ay`].includes(e.typeFormat);this.slotContent.subtype===`currency`&&t&&this._setNumericDisplayAs()}this._sendEvent(),(this._aggregationFunc===`rate`||t===`rate`)&&this.requestUpdate()}}_setAggregationWeight(){let e=this._aggregationWeightElement.value,t=this._aggregationFunc;if(e===`none`)this._aggregationWeightColumn=void 0,this._aggregationFunc===`weightedaverage`&&(this._aggregationFunc=`average`);else{let t,n;for(let r of this.measureColumns??[]){let i=r.columns?.find(t=>t.id===e);if(i){t=i,n=r.datasetId;break}}t&&(this._aggregationWeightColumn={column:t.id,set:n,columnSubType:t.subtype}),this._aggregationFunc===`average`&&(this._aggregationFunc=`weightedaverage`)}this._sendEvent(),this.requestUpdate(),(t===`weightedaverage`&&this._aggregationFunc===`average`||t===`average`&&this._aggregationFunc===`weightedaverage`)&&this.requestUpdate()}_setDurationLevels(){let e=this._durationLevels,t=this._durationLevelsElement.value.split(`,`).filter(e=>e!==``).map(e=>Number.parseInt(e,10));this._durationLevels=(t?.length??0)>=1?t:e,this._maxDurationLevel=Math.min(...this._durationLevels),this._fillTimeDurationLevels(),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_setDurationFormat(){this._durationFormat=this._durationFormatElement?.selected?.[0],this._fillTimeDurationLevels(),this._setNumericFormat(),this._sendEvent(),this.requestUpdate()}_fillTimeDurationLevels(){if(this._durationFormat===`time`){let e=this._durationLevels.sort().at(-1);if([7,8,9].includes(e)){for(let t of{lev7:[6],lev8:[6,7],lev9:[6,7,8]}[`lev`+e])this._durationLevels.includes(t)||this._durationLevels.push(t);this._durationLevels=[...this._durationLevels].sort()}}}willUpdate(e){super.willUpdate(e),e.has(`slotContent`)&&(this._parseSavedNumericFormatSettings(),this._aggregationFunc=this.slotContent?.aggregationFunc??(this.slotContent?.type===`numeric`?`sum`:`count`),this._aggregationWeightColumn=this.slotContent?.aggregationWeight,this._isFormula=this.slotContent?.formula||this.slotContent?.formulaId)}_renderDurationLevelsSettings(){let e=T.levels.map(e=>{let t=!1;return this._durationFormat===`time`&&e.level>=6&&this._durationLevels.includes(e.level)&&e.level!==Math.max(...this._durationLevels)&&(t=!0),this._durationLevels.length===1&&this._durationLevels.includes(e.level)&&(t=!0),p`<luzmo-menu-item
3
3
  value=${e.level}
4
4
  ?selected=${this._durationLevels.includes(e.level)}
5
5
  ?disabled=${t}
@@ -1,5 +1,5 @@
1
1
 
2
- import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{d as i,f as a,p as o}from"./chart-helpers-CR-EUEPf.js";import{t as s}from"./localize-DXRmGRe-.js";import{p as c,v as l}from"./item-slot-picker-panel-BOSVFBIy.js";import{html as u,property as d,query as f,state as p,unsafeCSS as m}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/checkbox.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/accordion.js";var h={none:()=>t(`None`),past:()=>t(`Past value`,{desc:`Period option`}),absoluteChange:()=>t(`Absolute change`,{desc:`Period option`}),percentageChange:()=>t(`% change`,{desc:`Period option`})},g=[{key:`periods`,i18n:()=>t(`Periods`,{desc:`Period option`})},{key:`years`,i18n:()=>t(`Years`,{desc:`Period option`})},{key:`quarters`,i18n:()=>t(`Quarters`,{desc:`Period option`})},{key:`months`,i18n:()=>t(`Months`,{desc:`Period option`})},{key:`weeks`,i18n:()=>t(`Weeks`,{desc:`Period option`})},{key:`days`,i18n:()=>t(`Days`,{desc:`Period option`})},{key:`hours`,i18n:()=>t(`Hours`,{desc:`Period option`})},{key:`minutes`,i18n:()=>t(`Minutes`,{desc:`Period option`})},{key:`seconds`,i18n:()=>t(`Seconds`,{desc:`Period option`})}],_=/* @__PURE__ */ function(e){return e.Relative=`relative`,e.UserDefined=`user-defined`,e}({}),v=[{key:`relative`,i18n:()=>t(`Relative`,{desc:`Range type option`})},{key:`user-defined`,i18n:()=>t(`User-defined`,{desc:`Range type option`})}],y=`:host{font-family:var(--luzmo-display-settings-period-over-period-font-family,var(--luzmo-font-family));font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));color:var(--luzmo-display-settings-period-over-period-color,var(--luzmo-font-color))}:host .settings-container{flex-direction:column;gap:0;display:flex}:host .settings-container:first-of-type{margin-right:var(--luzmo-spacing-4)}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-period-over-period-gap,var(--display-settings-period-over-period-gap));display:flex}:host .wrap{flex-wrap:wrap}:host .setting.period-number-setting{align-items:center;display:flex}:host .dynamic-settings-container{max-width:var(--luzmo-display-setting-period-over-period-dynamic-max-width,var(--display-setting-period-over-period-dynamic-max-width))}:host luzmo-accordion{--luzmo-accordion-item-content-area-top-to-content:0;--luzmo-accordion-item-content-padding-left:var(--luzmo-spacing-1);--luzmo-accordion-item-header-bottom-margin:0;--luzmo-accordion-item-content-area-bottom-to-content:var(--luzmo-spacing-2);--accordion-item-header-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));--accordion-item-content-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}:host .label-container{align-items:center;gap:var(--luzmo-spacing-2);display:flex}:host .academy-link{color:var(--luzmo-link-color);font-size:var(--luzmo-font-size-s);margin-left:var(--luzmo-spacing-2);text-decoration:none}:host .academy-link:hover{color:var(--luzmo-link-color-hover)}:host(:focus){--luzmo-menu-item-label-icon-color-focus:var(--luzmo-menu-item-label-icon-color-focus,var(--luzmo-font-color))}luzmo-menu-item{--luzmo-menu-item-tooltip-font-size:var(--luzmo-display-settings-tooltip-font-size)}luzmo-checkbox{--checkbox-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}luzmo-picker{--picker-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}luzmo-number-field{--text-field-placeholder-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));--stepper-button-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}:host{--display-settings-period-over-period-gap:var(--luzmo-spacing-3);--display-settings-period-over-period-font-size:var(--luzmo-font-size);--display-setting-period-over-period-dynamic-max-width:22rem}:host([size=xs]){--display-settings-period-over-period-gap:var(--luzmo-spacing-2);--display-settings-period-over-period-font-size:var(--luzmo-font-size-xs);--display-setting-period-over-period-dynamic-max-width:17rem}:host([size=s]){--display-settings-period-over-period-gap:var(--luzmo-spacing-3);--display-settings-period-over-period-font-size:var(--luzmo-font-size-s);--display-setting-period-over-period-dynamic-max-width:19rem}:host([size=l]){--display-settings-period-over-period-gap:var(--luzmo-spacing-4);--display-settings-period-over-period-font-size:var(--luzmo-font-size-l);--display-setting-period-over-period-dynamic-max-width:26rem}:host([size=xl]){--display-settings-period-over-period-gap:var(--luzmo-spacing-5);--display-settings-period-over-period-font-size:var(--luzmo-font-size-xl);--display-setting-period-over-period-dynamic-max-width:30rem}`,b=class extends n(a(o,{validSizes:Object.values(i)})){constructor(...e){super(...e),this.slotContent={},this.allowPeriodsWithoutDatetimeColumn=!1,this.hidePastValue=!1,this.linkedDatasetDatetimeColumns=[],this.needsOffsetDatetimeColumn=()=>this.periodOverPeriodUiType===c.NoDatetimeColumnButComparisonFilters||this.periodOverPeriodUiType===c.NoDatetimeColumnAndNoComparisonFilters}static get styles(){return[m(y)]}willUpdate(e){if(super.willUpdate(e),e.has(`slotContent`)){this._periodComparison=this.slotContent?.periodOverPeriod?.type,this._numberPeriods=this.slotContent?.periodOverPeriod?.quantity;let e=this.slotContent?.periodOverPeriod?.level;this._periodLevel=typeof e==`number`&&e>=0&&e<g.length?g[e].key:this.slotContent?.periodOverPeriod?.level||`periods`,this._incompletePeriods=this.slotContent?.periodOverPeriod?.periodToDate,this._offsetDateColumn=this.slotContent?.periodOverPeriod?.offsetDateColumn,this._minLevel=this.slotContent?.periodOverPeriod?.minLevel??this.slotContent?.periodOverPeriod?.offsetDateColumn?.lowestLevel??this.slotContent?.lowestLevel??(this.slotContent?.subtype===`date`?5:9),this._rangeType=this.slotContent?.periodOverPeriod?.rangeType}this._periodComparison=this._periodComparison??`none`,this._numberPeriods=this._numberPeriods??1,this._periodLevel=this._periodLevel??`periods`,this._incompletePeriods=this._incompletePeriods??!1,this._minLevel=this._minLevel??9,this._rangeType=this._rangeType??_.Relative,this._offsetDateColumn=this._offsetDateColumn||void 0}setPeriodComparison(){let e={...this.slotContent};this.setInitialOffsetDateColumn(e),this._periodComparison=this._periodComparisonElement.value;let t=l(this.slotContent?.format),n=[`%`,`y`,`a%`,`ay`].includes(t.typeFormat),r=t.typeFormat.includes(`a`),i=r?`a`:``,a=t.comma===`,`||r?`,`:``,o=t.precision?Number.parseInt(t.precision.replace(`.`,``),10):0,s=[`z`,`az`,`y`,`ay`,`w`,`aw`].includes(t.typeFormat);this._periodComparison===`percentageChange`&&n&&(e.format=`${a}.${o}${i}${s?`z`:`f`}`),this.sendEvent(e)}setNumberOfPeriods(){this._numberPeriods=Number.parseInt(this._numberPeriodsElement.value,10);let e={...this.slotContent};this.sendEvent(e)}setPeriodLevel(){this._periodLevel=this._periodLevelElement.value;let e={...this.slotContent};this.sendEvent(e)}setOffsetDateColumn(){this._offsetDateColumn=this.linkedDatasetDatetimeColumns.find(e=>e.id===this._offsetDateColumnElement.value);let e={...this.slotContent};this.sendEvent(e)}setIncompletePeriods(){this._incompletePeriods=this._incompletePeriodsElement.checked;let e={...this.slotContent};this.sendEvent(e)}setRangeType(e){this._rangeType=e;let t={...this.slotContent};this.setInitialOffsetDateColumn(t),this.sendEvent(t)}sendEvent(e){let t={...e},n=g.findIndex(e=>e.key===this._periodLevel);t.periodOverPeriod={...e.periodOverPeriod,type:this._periodComparison,level:Math.max(n,0),quantity:this._numberPeriods,periodToDate:this._incompletePeriods,minLevel:this._minLevel,rangeType:this._rangeType,offsetDateColumn:this._offsetDateColumn},this._periodComparison===`none`&&delete t.periodOverPeriod,this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:t}}))}incompletePeriodsSetting(){return u`
2
+ import{n as e,r as t,t as n}from"./localized-mixin-BWJj88bd.js";import{t as r}from"./localized-decorator-DosMCCQo.js";import{S as i,b as a,x as o}from"./chart-helpers-DZsidiCl.js";import{t as s}from"./localize-DLl7tgQp.js";import{p as c,v as l}from"./item-slot-picker-panel-BM82vSXi.js";import{html as u,property as d,query as f,state as p,unsafeCSS as m}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/checkbox.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/menu.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/action-group.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/number-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/picker.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.6.1/standalone/accordion.js";var h={none:()=>t(`None`),past:()=>t(`Past value`,{desc:`Period option`}),absoluteChange:()=>t(`Absolute change`,{desc:`Period option`}),percentageChange:()=>t(`% change`,{desc:`Period option`})},g=[{key:`periods`,i18n:()=>t(`Periods`,{desc:`Period option`})},{key:`years`,i18n:()=>t(`Years`,{desc:`Period option`})},{key:`quarters`,i18n:()=>t(`Quarters`,{desc:`Period option`})},{key:`months`,i18n:()=>t(`Months`,{desc:`Period option`})},{key:`weeks`,i18n:()=>t(`Weeks`,{desc:`Period option`})},{key:`days`,i18n:()=>t(`Days`,{desc:`Period option`})},{key:`hours`,i18n:()=>t(`Hours`,{desc:`Period option`})},{key:`minutes`,i18n:()=>t(`Minutes`,{desc:`Period option`})},{key:`seconds`,i18n:()=>t(`Seconds`,{desc:`Period option`})}],_=/* @__PURE__ */ function(e){return e.Relative=`relative`,e.UserDefined=`user-defined`,e}({}),v=[{key:`relative`,i18n:()=>t(`Relative`,{desc:`Range type option`})},{key:`user-defined`,i18n:()=>t(`User-defined`,{desc:`Range type option`})}],y=`:host{font-family:var(--luzmo-display-settings-period-over-period-font-family,var(--luzmo-font-family));font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));color:var(--luzmo-display-settings-period-over-period-color,var(--luzmo-font-color))}:host .settings-container{flex-direction:column;gap:0;display:flex}:host .settings-container:first-of-type{margin-right:var(--luzmo-spacing-4)}:host .settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-period-over-period-gap,var(--display-settings-period-over-period-gap));display:flex}:host .wrap{flex-wrap:wrap}:host .setting.period-number-setting{align-items:center;display:flex}:host .dynamic-settings-container{max-width:var(--luzmo-display-setting-period-over-period-dynamic-max-width,var(--display-setting-period-over-period-dynamic-max-width))}:host luzmo-accordion{--luzmo-accordion-item-content-area-top-to-content:0;--luzmo-accordion-item-content-padding-left:var(--luzmo-spacing-1);--luzmo-accordion-item-header-bottom-margin:0;--luzmo-accordion-item-content-area-bottom-to-content:var(--luzmo-spacing-2);--accordion-item-header-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));--accordion-item-content-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}:host .label-container{align-items:center;gap:var(--luzmo-spacing-2);display:flex}:host .academy-link{color:var(--luzmo-link-color);font-size:var(--luzmo-font-size-s);margin-left:var(--luzmo-spacing-2);text-decoration:none}:host .academy-link:hover{color:var(--luzmo-link-color-hover)}:host(:focus){--luzmo-menu-item-label-icon-color-focus:var(--luzmo-menu-item-label-icon-color-focus,var(--luzmo-font-color))}luzmo-menu-item{--luzmo-menu-item-tooltip-font-size:var(--luzmo-display-settings-tooltip-font-size)}luzmo-checkbox{--checkbox-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}luzmo-picker{--picker-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}luzmo-number-field{--text-field-placeholder-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size));--stepper-button-font-size:var(--luzmo-display-settings-period-over-period-font-size,var(--display-settings-period-over-period-font-size))}:host{--display-settings-period-over-period-gap:var(--luzmo-spacing-3);--display-settings-period-over-period-font-size:var(--luzmo-font-size);--display-setting-period-over-period-dynamic-max-width:22rem}:host([size=xs]){--display-settings-period-over-period-gap:var(--luzmo-spacing-2);--display-settings-period-over-period-font-size:var(--luzmo-font-size-xs);--display-setting-period-over-period-dynamic-max-width:17rem}:host([size=s]){--display-settings-period-over-period-gap:var(--luzmo-spacing-3);--display-settings-period-over-period-font-size:var(--luzmo-font-size-s);--display-setting-period-over-period-dynamic-max-width:19rem}:host([size=l]){--display-settings-period-over-period-gap:var(--luzmo-spacing-4);--display-settings-period-over-period-font-size:var(--luzmo-font-size-l);--display-setting-period-over-period-dynamic-max-width:26rem}:host([size=xl]){--display-settings-period-over-period-gap:var(--luzmo-spacing-5);--display-settings-period-over-period-font-size:var(--luzmo-font-size-xl);--display-setting-period-over-period-dynamic-max-width:30rem}`,b=class extends n(o(i,{validSizes:Object.values(a)})){constructor(...e){super(...e),this.slotContent={},this.allowPeriodsWithoutDatetimeColumn=!1,this.hidePastValue=!1,this.linkedDatasetDatetimeColumns=[],this.needsOffsetDatetimeColumn=()=>this.periodOverPeriodUiType===c.NoDatetimeColumnButComparisonFilters||this.periodOverPeriodUiType===c.NoDatetimeColumnAndNoComparisonFilters}static get styles(){return[m(y)]}willUpdate(e){if(super.willUpdate(e),e.has(`slotContent`)){this._periodComparison=this.slotContent?.periodOverPeriod?.type,this._numberPeriods=this.slotContent?.periodOverPeriod?.quantity;let e=this.slotContent?.periodOverPeriod?.level;this._periodLevel=typeof e==`number`&&e>=0&&e<g.length?g[e].key:this.slotContent?.periodOverPeriod?.level||`periods`,this._incompletePeriods=this.slotContent?.periodOverPeriod?.periodToDate,this._offsetDateColumn=this.slotContent?.periodOverPeriod?.offsetDateColumn,this._minLevel=this.slotContent?.periodOverPeriod?.minLevel??this.slotContent?.periodOverPeriod?.offsetDateColumn?.lowestLevel??this.slotContent?.lowestLevel??(this.slotContent?.subtype===`date`?5:9),this._rangeType=this.slotContent?.periodOverPeriod?.rangeType}this._periodComparison=this._periodComparison??`none`,this._numberPeriods=this._numberPeriods??1,this._periodLevel=this._periodLevel??`periods`,this._incompletePeriods=this._incompletePeriods??!1,this._minLevel=this._minLevel??9,this._rangeType=this._rangeType??_.Relative,this._offsetDateColumn=this._offsetDateColumn||void 0}setPeriodComparison(){let e={...this.slotContent};this.setInitialOffsetDateColumn(e),this._periodComparison=this._periodComparisonElement.value;let t=l(this.slotContent?.format),n=[`%`,`y`,`a%`,`ay`].includes(t.typeFormat),r=t.typeFormat.includes(`a`),i=r?`a`:``,a=t.comma===`,`||r?`,`:``,o=t.precision?Number.parseInt(t.precision.replace(`.`,``),10):0,s=[`z`,`az`,`y`,`ay`,`w`,`aw`].includes(t.typeFormat);this._periodComparison===`percentageChange`&&n&&(e.format=`${a}.${o}${i}${s?`z`:`f`}`),this.sendEvent(e)}setNumberOfPeriods(){this._numberPeriods=Number.parseInt(this._numberPeriodsElement.value,10);let e={...this.slotContent};this.sendEvent(e)}setPeriodLevel(){this._periodLevel=this._periodLevelElement.value;let e={...this.slotContent};this.sendEvent(e)}setOffsetDateColumn(){this._offsetDateColumn=this.linkedDatasetDatetimeColumns.find(e=>e.id===this._offsetDateColumnElement.value);let e={...this.slotContent};this.sendEvent(e)}setIncompletePeriods(){this._incompletePeriods=this._incompletePeriodsElement.checked;let e={...this.slotContent};this.sendEvent(e)}setRangeType(e){this._rangeType=e;let t={...this.slotContent};this.setInitialOffsetDateColumn(t),this.sendEvent(t)}sendEvent(e){let t={...e},n=g.findIndex(e=>e.key===this._periodLevel);t.periodOverPeriod={...e.periodOverPeriod,type:this._periodComparison,level:Math.max(n,0),quantity:this._numberPeriods,periodToDate:this._incompletePeriods,minLevel:this._minLevel,rangeType:this._rangeType,offsetDateColumn:this._offsetDateColumn},this._periodComparison===`none`&&delete t.periodOverPeriod,this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:t}}))}incompletePeriodsSetting(){return u`
3
3
  <div class="settings-row">
4
4
  <div class="setting">
5
5
  <luzmo-checkbox
@@ -0,0 +1,2 @@
1
+
2
+ export{_ as default}from"./item-slot-picker-panel-BM82vSXi.js";
@@ -0,0 +1,2 @@
1
+
2
+ import{_ as e}from"./item-slot-picker-panel-BM82vSXi.js";var t={...e,currency:[`£`,``],date:`%d/%m/%Y`};export{t as default};
@@ -0,0 +1,2 @@
1
+
2
+ export{_ as default}from"./item-slot-picker-panel-BM82vSXi.js";