@luzmo/analytics-components-kit 1.0.1-alpha.90 → 1.0.1-alpha.94

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 (253) hide show
  1. package/README.md +195 -0
  2. package/angular/README.md +1 -0
  3. package/angular/components/widget-menu.component.ts +25 -0
  4. package/angular/esm/components/widget-menu.component.d.ts +13 -0
  5. package/angular/esm/components/widget-menu.component.js +49 -0
  6. package/angular/esm/index.d.ts +3 -1
  7. package/angular/esm/index.js +4 -1
  8. package/angular/esm/types.d.ts +4 -0
  9. package/angular/index.ts +4 -1
  10. package/angular/types.ts +6 -0
  11. package/components/ai-chat-message-assistant/index.cjs +1 -1
  12. package/components/ai-chat-message-assistant/index.js +1 -0
  13. package/components/ai-chat-messages-container/index.cjs +1 -1
  14. package/components/ai-chat-messages-container/index.js +2 -2
  15. package/components/ai-interaction-textarea/index.cjs +1 -1
  16. package/components/ai-interaction-textarea/index.js +2 -1
  17. package/components/area-chart-options.config-C7sMAHco.cjs +20 -0
  18. package/components/{area-chart-options.config-u8itidsi.js → area-chart-options.config-_J0sG4NF.js} +26 -14
  19. package/components/{bar-chart-options.config-DIirbAJ0.js → bar-chart-options.config-D1mb5TDl.js} +35 -21
  20. package/components/bar-chart-options.config-DcxEkOT5.cjs +20 -0
  21. package/components/box-plot-options.config-SrrbDEYW.cjs +20 -0
  22. package/components/{box-plot-options.config-BWROiguA.js → box-plot-options.config-xu_i6ms7.js} +88 -52
  23. package/components/{bubble-chart-options.config-4QD8VPhU.js → bubble-chart-options.config-BacgXkJ_.js} +18 -9
  24. package/components/bubble-chart-options.config-Ihn6eVQI.cjs +20 -0
  25. package/components/{bullet-chart-options.config-3bH7uekx.js → bullet-chart-options.config-CDPpX1yc.js} +1 -1
  26. package/components/{bullet-chart-options.config-tWb6Fio-.cjs → bullet-chart-options.config-DfS4Bwds.cjs} +1 -1
  27. package/components/calculate-data-item-icon-CEa82-5u.cjs +20 -0
  28. package/components/calculate-data-item-icon-DjlZwMdO.js +147 -0
  29. package/components/{choropleth-map-options.config-CMxx3ORp.js → choropleth-map-options.config-B_W9-rhe.js} +84 -63
  30. package/components/choropleth-map-options.config-ZW8yoZH2.cjs +20 -0
  31. package/components/{circular-gauge-options.config-DhIKn44k.js → circular-gauge-options.config-DAIjz4Rl.js} +36 -23
  32. package/components/circular-gauge-options.config-msZ4mfpN.cjs +20 -0
  33. package/components/color-B6LaL8qz.cjs +20 -0
  34. package/components/{color-B7m0j8lX.js → color-DuJ4-73S.js} +950 -941
  35. package/components/{color-range-utils-BSfqtB3A.js → color-range-utils-Bvo9sm5A.js} +32 -31
  36. package/components/color-range-utils-C5yXW7ZC.cjs +20 -0
  37. package/components/{column-chart-options.config-D5-yR7iq.js → column-chart-options.config-B5SjBVdy.js} +37 -27
  38. package/components/column-chart-options.config-BjDvA7i9.cjs +20 -0
  39. package/components/{conditional-number-options.config-DPYsdML5.js → conditional-number-options.config-BCEpSK9J.js} +40 -24
  40. package/components/conditional-number-options.config-DgzUo0xi.cjs +20 -0
  41. package/components/dataset-icon/index.cjs +1 -1
  42. package/components/dataset-icon/index.js +2 -1
  43. package/components/dataset-selector-list/index.cjs +1 -1
  44. package/components/dataset-selector-list/index.js +35 -32
  45. package/components/dataset-selector-row/index.cjs +9 -9
  46. package/components/dataset-selector-row/index.js +53 -51
  47. package/components/{date-comparison-filter-options.config-QaoWaFUn.cjs → date-comparison-filter-options.config-DAVncmi0.cjs} +1 -1
  48. package/components/{date-comparison-filter-options.config-CSwGyuBg.js → date-comparison-filter-options.config-JA_yYpJa.js} +6 -3
  49. package/components/{date-filter-options.config-n-zhWaYa.cjs → date-filter-options.config-CWPMtA18.cjs} +1 -1
  50. package/components/{date-filter-options.config-BTVyHRkp.js → date-filter-options.config-DBRxlTWy.js} +6 -3
  51. package/components/display-settings/index.cjs +1 -1
  52. package/components/display-settings/index.js +1 -1
  53. package/components/display-settings-binning/index.cjs +5 -5
  54. package/components/display-settings-binning/index.js +30 -29
  55. package/components/display-settings-datetime/index.cjs +29 -29
  56. package/components/display-settings-datetime/index.js +120 -112
  57. package/components/display-settings-grand-totals/index.cjs +4 -4
  58. package/components/display-settings-grand-totals/index.js +24 -23
  59. package/components/display-settings-numeric/index.cjs +48 -48
  60. package/components/display-settings-numeric/index.js +211 -194
  61. package/components/display-settings-period-over-period/index.cjs +16 -16
  62. package/components/display-settings-period-over-period/index.js +97 -91
  63. package/components/{donut-chart-options.config-3ZqX8Cbb.js → donut-chart-options.config-BulUEiaH.js} +37 -21
  64. package/components/donut-chart-options.config-tNpqBZfR.cjs +20 -0
  65. package/components/draggable-data-item/index.cjs +5 -5
  66. package/components/draggable-data-item/index.js +46 -45
  67. package/components/draggable-data-item-level/index.cjs +11 -11
  68. package/components/draggable-data-item-level/index.js +73 -70
  69. package/components/{dropdown-filter-options.config-CGJTtgAX.js → dropdown-filter-options.config-D9dvPypF.js} +10 -7
  70. package/components/{dropdown-filter-options.config-DJvfCTk7.cjs → dropdown-filter-options.config-DS-MORmq.cjs} +1 -1
  71. package/components/droppable-slot/index.cjs +16 -16
  72. package/components/droppable-slot/index.js +223 -208
  73. package/components/edit-item/index.cjs +9 -9
  74. package/components/edit-item/index.js +119 -116
  75. package/components/edit-option/index.cjs +1 -1
  76. package/components/edit-option/index.js +1 -1
  77. package/components/edit-option-action-button-group/index.cjs +8 -8
  78. package/components/edit-option-action-button-group/index.js +53 -52
  79. package/components/{edit-option-base-Bh29-Cak.js → edit-option-base-DIc7iC-b.js} +1 -1
  80. package/components/{edit-option-base-tFr8Qg2B.cjs → edit-option-base-VhTih9T1.cjs} +1 -1
  81. package/components/edit-option-color-palette-picker/index.cjs +1 -1
  82. package/components/edit-option-color-palette-picker/index.js +1 -1
  83. package/components/edit-option-color-picker/index.cjs +1 -1
  84. package/components/edit-option-color-picker/index.js +1 -1
  85. package/components/edit-option-color-range/index.cjs +19 -19
  86. package/components/edit-option-color-range/index.js +117 -106
  87. package/components/edit-option-multi-language-field/index.cjs +3 -3
  88. package/components/edit-option-multi-language-field/index.js +27 -26
  89. package/components/edit-option-number-field/index.cjs +1 -1
  90. package/components/edit-option-number-field/index.js +1 -1
  91. package/components/edit-option-picker/index.cjs +5 -5
  92. package/components/edit-option-picker/index.js +7 -7
  93. package/components/edit-option-position-picker/index.cjs +4 -4
  94. package/components/edit-option-position-picker/index.js +25 -21
  95. package/components/edit-option-positions-number-field/index.cjs +9 -9
  96. package/components/edit-option-positions-number-field/index.js +81 -76
  97. package/components/edit-option-radio-button-group/index.cjs +6 -6
  98. package/components/edit-option-radio-button-group/index.js +22 -21
  99. package/components/edit-option-slider/index.cjs +1 -1
  100. package/components/edit-option-slider/index.js +1 -1
  101. package/components/edit-option-switch/index.cjs +1 -1
  102. package/components/edit-option-switch/index.js +1 -1
  103. package/components/edit-option-text-field/index.cjs +2 -2
  104. package/components/edit-option-text-field/index.js +23 -22
  105. package/components/en-BKBhKBXY.cjs +20 -0
  106. package/components/en-BOTjhwEc.js +1488 -0
  107. package/components/{en-GB-ialeqj_z.js → en-GB-CEHEs8F2.js} +1 -1
  108. package/components/{en-GB-TqvgIw9B.cjs → en-GB-DG6uS3sM.cjs} +1 -1
  109. package/components/{evolution-number-options.config-Bc9eKYnn.cjs → evolution-number-options.config-BgIZY4gQ.cjs} +1 -1
  110. package/components/{evolution-number-options.config-BIPO_4n3.js → evolution-number-options.config-DzkfeoIN.js} +14 -11
  111. package/components/{extrapolate-color-C0n1UDs-.cjs → extrapolate-color-0j_AeYkz.cjs} +1 -1
  112. package/components/{extrapolate-color-v1PimdQr.js → extrapolate-color-CC9CURf6.js} +1 -1
  113. package/components/filter-data-item-picker/index.cjs +7 -7
  114. package/components/filter-data-item-picker/index.js +86 -85
  115. package/components/filter-expression-picker/index.cjs +1 -1
  116. package/components/filter-expression-picker/index.js +1 -1
  117. package/components/filter-item/index.cjs +6 -6
  118. package/components/filter-item/index.js +119 -109
  119. package/components/filter-value-picker/index.cjs +2 -2
  120. package/components/filter-value-picker/index.js +36 -34
  121. package/components/filter-value-picker-datetime/index.cjs +8 -8
  122. package/components/filter-value-picker-datetime/index.js +71 -56
  123. package/components/filter-value-picker-hierarchy/index.cjs +12 -12
  124. package/components/filter-value-picker-hierarchy/index.js +124 -113
  125. package/components/filter-value-picker-numeric/index.cjs +8 -8
  126. package/components/filter-value-picker-numeric/index.js +110 -101
  127. package/components/focusable-B3E_hQmm.cjs +20 -0
  128. package/components/{focusable-BS2pbY7w.js → focusable-DCIFkpiW.js} +26 -24
  129. package/components/{funnel-chart-options.config-CrJy2U7_.js → funnel-chart-options.config-C_VjTOvD.js} +20 -5
  130. package/components/funnel-chart-options.config-D7H7gFcx.cjs +20 -0
  131. package/components/get-css-variable-BEYG097C.js +1446 -0
  132. package/components/get-css-variable-BZxY4IOa.cjs +35 -0
  133. package/components/get-css-variable-DLiZYZEi.cjs +24 -0
  134. package/components/{get-css-variable-CdwF98oh.js → get-css-variable-YlLiVgo8.js} +35 -35
  135. package/components/grid/index.cjs +49 -43
  136. package/components/grid/index.js +1878 -2610
  137. package/components/{heat-map-options.config-CmL87j1j.js → heat-map-options.config-BnLWe8jS.js} +41 -35
  138. package/components/heat-map-options.config-DVH-Bb5-.cjs +20 -0
  139. package/components/heat-table-options.config-B12JEYnp.cjs +20 -0
  140. package/components/{heat-table-options.config-BrCYAgYD.js → heat-table-options.config-CUsDdgUr.js} +88 -60
  141. package/components/helpers-DXQwEH1P.cjs +20 -0
  142. package/components/helpers-v1bPALRP.js +91 -0
  143. package/components/hexbin-map-options.config-DZERRhM8.cjs +20 -0
  144. package/components/{hexbin-map-options.config-BguV1w8q.js → hexbin-map-options.config-F-7uCqxb.js} +38 -20
  145. package/components/{index-BNAmjOkm.cjs → index-BPNsFiyq.cjs} +4 -4
  146. package/components/index-CDi4fe3N.js +1716 -0
  147. package/components/index-CQ9ck-BO.cjs +249 -0
  148. package/components/index-CXn67vdn.cjs +121 -0
  149. package/components/{index-haa7WNrl.js → index-CdIUfo-L.js} +481 -453
  150. package/components/index-Cz9vSXy6.cjs +20 -0
  151. package/components/{index-DdyZ2g5L.js → index-D0GBF6tg.js} +104 -94
  152. package/components/index-Dn0j_pcR.cjs +20 -0
  153. package/components/{index-CqKpf0B8.js → index-Do7O9azB.js} +123 -112
  154. package/components/index-E239Dotg.js +1735 -0
  155. package/components/index.cjs +1 -1
  156. package/components/index.js +20 -18
  157. package/components/item-options-configs.cjs +1 -1
  158. package/components/item-options-configs.js +37 -37
  159. package/components/{line-chart-options.config-BhirTGqD.js → line-chart-options.config-DB3IsXXr.js} +28 -13
  160. package/components/line-chart-options.config-DSugoe0t.cjs +20 -0
  161. package/components/{localize-CcDpq940.js → localize-BX7q0S0M.js} +10 -10
  162. package/components/{localize-C4zNlrwK.cjs → localize-r7ALOUy_.cjs} +1 -1
  163. package/components/{marker-map-options.config-Bx17jmiq.js → marker-map-options.config-DPJ955tt.js} +1 -1
  164. package/components/{marker-map-options.config-CvhCylSC.cjs → marker-map-options.config-_FYZzRwA.cjs} +1 -1
  165. package/components/pivot-table-options.config-BiJXKSFR.cjs +20 -0
  166. package/components/{pivot-table-options.config-CFc7y0IT.js → pivot-table-options.config-DNK_AIG7.js} +24 -15
  167. package/components/pyramid-chart-options.config-C4zbFS26.cjs +20 -0
  168. package/components/{pyramid-chart-options.config-2Waxb11l.js → pyramid-chart-options.config-CcVMatYx.js} +43 -29
  169. package/components/{radar-chart-options.config-CPN5fOl8.js → radar-chart-options.config-CUZn_3Fd.js} +23 -11
  170. package/components/radar-chart-options.config-EqQu6PTh.cjs +20 -0
  171. package/components/{regular-table-options.config-CFKCJQK1.js → regular-table-options.config-BoLZsBry.js} +23 -17
  172. package/components/{regular-table-options.config-YRuoijIk.cjs → regular-table-options.config-DTx3RTnS.cjs} +1 -1
  173. package/components/{route-map-options.config-CyolTJfK.js → route-map-options.config-CN86T7c0.js} +109 -87
  174. package/components/route-map-options.config-D7NJePTu.cjs +20 -0
  175. package/components/{sankey-diagram-options.config-D7OSvSqm.cjs → sankey-diagram-options.config-RFB83YLZ.cjs} +1 -1
  176. package/components/{sankey-diagram-options.config-Ldjk84ro.js → sankey-diagram-options.config-tVLKy_Zn.js} +10 -7
  177. package/components/scatter-plot-options.config-CFfGJXsV.cjs +20 -0
  178. package/components/{scatter-plot-options.config-CfxEfkQ1.js → scatter-plot-options.config-Corlzno1.js} +86 -56
  179. package/components/{search-filter-options.config-Oqco9BKj.cjs → search-filter-options.config-BCaDlYqZ.cjs} +1 -1
  180. package/components/{search-filter-options.config-C0syQmP4.js → search-filter-options.config-BE3JhR-F.js} +6 -3
  181. package/components/{set-locale-hKTMz37h.js → set-locale-Dp3N_gXN.js} +8 -1
  182. package/components/{slicer-filter-options.config-DmOe3440.js → slicer-filter-options.config-3JZZcw5C.js} +18 -9
  183. package/components/slicer-filter-options.config-DNI-XevE.cjs +20 -0
  184. package/components/{slider-filter-options.config-B1M8RcDs.js → slider-filter-options.config-DH4SS8wH.js} +1 -1
  185. package/components/{slider-filter-options.config-k45I-t6G.cjs → slider-filter-options.config-_8Z2zKmU.cjs} +1 -1
  186. package/components/slot-contents-picker/index.cjs +33 -33
  187. package/components/slot-contents-picker/index.js +205 -194
  188. package/components/slot-menu/index.cjs +12 -12
  189. package/components/slot-menu/index.js +184 -171
  190. package/components/slot-menu-list/index.cjs +3 -3
  191. package/components/slot-menu-list/index.js +103 -97
  192. package/components/speedometer-chart-options.config-BX9LTQBH.cjs +20 -0
  193. package/components/{speedometer-chart-options.config-CzOmuEF8.js → speedometer-chart-options.config-SL581yOa.js} +53 -31
  194. package/components/{spike-map-options.config-Cbt1YUw6.js → spike-map-options.config-C5KewecZ.js} +122 -91
  195. package/components/spike-map-options.config-DoBFXPmN.cjs +20 -0
  196. package/components/{sunburst-chart-options.config-Yrxc2i57.cjs → sunburst-chart-options.config-AbNjWS6t.cjs} +1 -1
  197. package/components/{sunburst-chart-options.config-_dyLQxPJ.js → sunburst-chart-options.config-CNauGQJv.js} +20 -9
  198. package/components/{symbol-map-options.config-BORL1NSU.js → symbol-map-options.config-DdDA4aa7.js} +20 -11
  199. package/components/symbol-map-options.config-m-lwLTtu.cjs +20 -0
  200. package/components/treemap-chart-options.config-C0Q9aQ1Z.cjs +20 -0
  201. package/components/{treemap-chart-options.config-B9i9qIm_.js → treemap-chart-options.config-D5AJaF_u.js} +37 -20
  202. package/components/utils.cjs +1 -1
  203. package/components/utils.js +97 -94
  204. package/components/{video-options.config-B0asgYt8.cjs → video-options.config-CGsDTwHc.cjs} +1 -1
  205. package/components/{video-options.config-UX-9MDfS.js → video-options.config-Dk36zJ1B.js} +10 -7
  206. package/components/widget-menu/index.cjs +51 -0
  207. package/components/widget-menu/index.d.ts +8 -0
  208. package/components/widget-menu/index.js +211 -0
  209. package/components/widget-menu/widget-menu.d.ts +77 -0
  210. package/components/{wordcloud-chart-options.config-BKtJT8Va.cjs → wordcloud-chart-options.config-vGfCW8kE.cjs} +1 -1
  211. package/components/{wordcloud-chart-options.config-BoB_KuhA.js → wordcloud-chart-options.config-w2NUIWVA.js} +7 -4
  212. package/custom-elements.json +133 -20
  213. package/index.d.ts +1 -0
  214. package/package.json +6 -1
  215. package/types.d.ts +4 -0
  216. package/components/area-chart-options.config-Bl8bhhOo.cjs +0 -20
  217. package/components/bar-chart-options.config-CePAqM83.cjs +0 -20
  218. package/components/box-plot-options.config-BVNrV2eD.cjs +0 -20
  219. package/components/bubble-chart-options.config-BDgOe3GQ.cjs +0 -20
  220. package/components/calculate-data-item-icon-DMDhKq_m.js +0 -147
  221. package/components/calculate-data-item-icon-DtVGbet3.cjs +0 -20
  222. package/components/choropleth-map-options.config-CWJACFd0.cjs +0 -20
  223. package/components/circular-gauge-options.config-BMxgq3zH.cjs +0 -20
  224. package/components/color-Czp4Im5q.cjs +0 -20
  225. package/components/color-range-utils-DYYR-iwx.cjs +0 -20
  226. package/components/column-chart-options.config-BV9R3ssH.cjs +0 -20
  227. package/components/conditional-number-options.config-Co099Qfm.cjs +0 -20
  228. package/components/donut-chart-options.config-BQyPgnC9.cjs +0 -20
  229. package/components/en-D3ihEGXg.js +0 -1483
  230. package/components/en-DZcn_iz_.cjs +0 -20
  231. package/components/focusable-QLh-LlNt.cjs +0 -20
  232. package/components/funnel-chart-options.config-DrP4AFgk.cjs +0 -20
  233. package/components/get-css-variable-COd1d84B.cjs +0 -24
  234. package/components/heat-map-options.config-CIHnPdYE.cjs +0 -20
  235. package/components/heat-table-options.config-DTlZRc_i.cjs +0 -20
  236. package/components/helpers-9I0oLoUB.cjs +0 -20
  237. package/components/helpers-bR8Ibjqh.js +0 -79
  238. package/components/hexbin-map-options.config-CKnn3VAB.cjs +0 -20
  239. package/components/index-BekTY3Em.cjs +0 -121
  240. package/components/index-CFL6gmIu.cjs +0 -20
  241. package/components/index-DNPULp4A.js +0 -1755
  242. package/components/index-DvkzMbLt.cjs +0 -249
  243. package/components/line-chart-options.config-Cqwou5u6.cjs +0 -20
  244. package/components/pivot-table-options.config-uZDAertf.cjs +0 -20
  245. package/components/pyramid-chart-options.config-DoGfEvzU.cjs +0 -20
  246. package/components/radar-chart-options.config-CtNUMN1l.cjs +0 -20
  247. package/components/route-map-options.config-CVTk5RVL.cjs +0 -20
  248. package/components/scatter-plot-options.config-5gN7pMTm.cjs +0 -20
  249. package/components/slicer-filter-options.config-CrusP6a0.cjs +0 -20
  250. package/components/speedometer-chart-options.config-B4ceg_qI.cjs +0 -20
  251. package/components/spike-map-options.config-BkkDqb4g.cjs +0 -20
  252. package/components/symbol-map-options.config-NpBKm64d.cjs +0 -20
  253. package/components/treemap-chart-options.config-x4J54WSw.cjs +0 -20
@@ -17,10 +17,10 @@
17
17
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
18
  * SOFTWARE.
19
19
  * */
20
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lit"),m=require("lit/decorators.js"),re=require("lit/directives/style-map.js"),Y=require("@luzmo/icons");require("@luzmo/lucero/action-button");require("@luzmo/lucero/action-group");require("@luzmo/lucero/icon");const Xt=require("@luzmo/lucero/utils"),bt=require("../color-Czp4Im5q.cjs"),gi=require("../item-list.cjs"),Ke=require("../index-Vdyb9z2D.cjs"),Z=require("@lit/localize");require("@luzmo/lucero/tooltip");const Xe=require("../set-locale-BRRalqne.cjs"),C=[];for(let s=0;s<256;++s)C.push((s+256).toString(16).slice(1));function fi(s,e=0){return(C[s[e+0]]+C[s[e+1]]+C[s[e+2]]+C[s[e+3]]+"-"+C[s[e+4]]+C[s[e+5]]+"-"+C[s[e+6]]+C[s[e+7]]+"-"+C[s[e+8]]+C[s[e+9]]+"-"+C[s[e+10]]+C[s[e+11]]+C[s[e+12]]+C[s[e+13]]+C[s[e+14]]+C[s[e+15]]).toLowerCase()}let Ye;const yi=new Uint8Array(16);function bi(){if(!Ye){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ye=crypto.getRandomValues.bind(crypto)}return Ye(yi)}const vi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vt={randomUUID:vi};function wi(s,e,t){s=s||{};const i=s.random??s.rng?.()??bi();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,fi(i)}function _e(s,e,t){return vt.randomUUID&&!s?vt.randomUUID():wi(s)}const tt=Math.min,ce=Math.max,Ie=Math.round,De=Math.floor,V=s=>({x:s,y:s}),_i={left:"right",right:"left",bottom:"top",top:"bottom"},Ei={start:"end",end:"start"};function lt(s,e){return typeof s=="function"?s(e):s}function fe(s){return s.split("-")[0]}function $e(s){return s.split("-")[1]}function zi(s){return s==="x"?"y":"x"}function Yt(s){return s==="y"?"height":"width"}const xi=new Set(["top","bottom"]);function ne(s){return xi.has(fe(s))?"y":"x"}function Jt(s){return zi(ne(s))}function ki(s,e,t){t===void 0&&(t=!1);const i=$e(s),r=Jt(s),o=Yt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Te(n)),[n,Te(n)]}function Si(s){const e=Te(s);return[it(s),e,it(e)]}function it(s){return s.replace(/start|end/g,e=>Ei[e])}const wt=["left","right"],_t=["right","left"],Ri=["top","bottom"],Ai=["bottom","top"];function Mi(s,e,t){switch(s){case"top":case"bottom":return t?e?_t:wt:e?wt:_t;case"left":case"right":return e?Ri:Ai;default:return[]}}function Di(s,e,t,i){const r=$e(s);let o=Mi(fe(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(it)))),o}function Te(s){return s.replace(/left|right|bottom|top/g,e=>_i[e])}function Ci(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ii(s){return typeof s!="number"?Ci(s):{top:s,right:s,bottom:s,left:s}}function Le(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Et(s,e,t){let{reference:i,floating:r}=s;const o=ne(e),n=Jt(e),a=Yt(n),h=fe(e),l=o==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,p=i[a]/2-r[a]/2;let f;switch(h){case"top":f={x:d,y:i.y-r.height};break;case"bottom":f={x:d,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:u};break;case"left":f={x:i.x-r.width,y:u};break;default:f={x:i.x,y:i.y}}switch($e(e)){case"start":f[n]-=p*(t&&l?-1:1);break;case"end":f[n]+=p*(t&&l?-1:1);break}return f}const Ti=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),h=await(n.isRTL==null?void 0:n.isRTL(e));let l=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:d,y:u}=Et(l,i,h),p=i,f={},y=0;for(let E=0;E<a.length;E++){const{name:x,fn:z}=a[E],{x:S,y:R,data:A,reset:k}=await z({x:d,y:u,initialPlacement:i,placement:p,strategy:r,middlewareData:f,rects:l,platform:n,elements:{reference:s,floating:e}});d=S??d,u=R??u,f={...f,[x]:{...f[x],...A}},k&&y<=50&&(y++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(l=k.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):k.rects),{x:d,y:u}=Et(l,p,h)),E=-1)}return{x:d,y:u,placement:p,strategy:r,middlewareData:f}};async function Li(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:h}=s,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=lt(e,s),y=Ii(f),x=a[p?u==="floating"?"reference":"floating":u],z=Le(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:h})),S=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(R))?await(o.getScale==null?void 0:o.getScale(R))||{x:1,y:1}:{x:1,y:1},k=Le(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:R,strategy:h}):S);return{top:(z.top-k.top+y.top)/A.y,bottom:(k.bottom-z.bottom+y.bottom)/A.y,left:(z.left-k.left+y.left)/A.x,right:(k.right-z.right+y.right)/A.x}}const Hi=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:h,elements:l}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:E=!0,...x}=lt(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const z=fe(r),S=ne(a),R=fe(a)===a,A=await(h.isRTL==null?void 0:h.isRTL(l.floating)),k=p||(R||!E?[Te(a)]:Si(a)),J=y!=="none";!p&&J&&k.push(...Di(a,E,y,A));const j=[a,...k],ve=await Li(e,x),Me=[];let he=((i=o.flip)==null?void 0:i.overflows)||[];if(d&&Me.push(ve[z]),u){const ie=ki(r,n,A);Me.push(ve[ie[0]],ve[ie[1]])}if(he=[...he,{placement:r,overflows:Me}],!Me.every(ie=>ie<=0)){var gt,ft;const ie=(((gt=o.flip)==null?void 0:gt.index)||0)+1,je=j[ie];if(je&&(!(u==="alignment"?S!==ne(je):!1)||he.every(P=>ne(P.placement)===S?P.overflows[0]>0:!0)))return{data:{index:ie,overflows:he},reset:{placement:je}};let we=(ft=he.filter(se=>se.overflows[0]<=0).sort((se,P)=>se.overflows[1]-P.overflows[1])[0])==null?void 0:ft.placement;if(!we)switch(f){case"bestFit":{var yt;const se=(yt=he.filter(P=>{if(J){const Q=ne(P.placement);return Q===S||Q==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(Q=>Q>0).reduce((Q,pi)=>Q+pi,0)]).sort((P,Q)=>P[1]-Q[1])[0])==null?void 0:yt[0];se&&(we=se);break}case"initialPlacement":we=a;break}if(r!==we)return{reset:{placement:we}}}return{}}}},Ni=new Set(["left","top"]);async function Oi(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=fe(t),a=$e(t),h=ne(t)==="y",l=Ni.has(n)?-1:1,d=o&&h?-1:1,u=lt(e,s);let{mainAxis:p,crossAxis:f,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),h?{x:f*d,y:p*l}:{x:p*l,y:f*d}}const Pi=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,h=await Oi(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+h.x,y:o+h.y,data:{...h,placement:n}}}}};function Be(){return typeof window<"u"}function be(s){return Qt(s)?(s.nodeName||"").toLowerCase():"#document"}function H(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function q(s){var e;return(e=(Qt(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function Qt(s){return Be()?s instanceof Node||s instanceof H(s).Node:!1}function $(s){return Be()?s instanceof Element||s instanceof H(s).Element:!1}function G(s){return Be()?s instanceof HTMLElement||s instanceof H(s).HTMLElement:!1}function zt(s){return!Be()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof H(s).ShadowRoot}const Wi=new Set(["inline","contents"]);function Ae(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=B(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Wi.has(r)}const $i=new Set(["table","td","th"]);function Bi(s){return $i.has(be(s))}const Ui=[":popover-open",":modal"];function Ue(s){return Ui.some(e=>{try{return s.matches(e)}catch{return!1}})}const Fi=["transform","translate","scale","rotate","perspective"],Vi=["transform","translate","scale","rotate","perspective","filter"],Gi=["paint","layout","strict","content"];function dt(s){const e=ht(),t=$(s)?B(s):s;return Fi.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Vi.some(i=>(t.willChange||"").includes(i))||Gi.some(i=>(t.contain||"").includes(i))}function qi(s){let e=ee(s);for(;G(e)&&!ye(e);){if(dt(e))return e;if(Ue(e))return null;e=ee(e)}return null}function ht(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ji=new Set(["html","body","#document"]);function ye(s){return ji.has(be(s))}function B(s){return H(s).getComputedStyle(s)}function Fe(s){return $(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function ee(s){if(be(s)==="html")return s;const e=s.assignedSlot||s.parentNode||zt(s)&&s.host||q(s);return zt(e)?e.host:e}function Zt(s){const e=ee(s);return ye(e)?s.ownerDocument?s.ownerDocument.body:s.body:G(e)&&Ae(e)?e:Zt(e)}function ke(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Zt(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=H(r);if(o){const a=st(n);return e.concat(n,n.visualViewport||[],Ae(r)?r:[],a&&t?ke(a):[])}return e.concat(r,ke(r,[],t))}function st(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ei(s){const e=B(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=G(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ie(t)!==o||Ie(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function ct(s){return $(s)?s:s.contextElement}function ue(s){const e=ct(s);if(!G(e))return V(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=ei(e);let n=(o?Ie(t.width):t.width)/i,a=(o?Ie(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Ki=V(0);function ti(s){const e=H(s);return!ht()||!e.visualViewport?Ki:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Xi(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==H(s)?!1:e}function ae(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=ct(s);let n=V(1);e&&(i?$(i)&&(n=ue(i)):n=ue(s));const a=Xi(o,t,i)?ti(o):V(0);let h=(r.left+a.x)/n.x,l=(r.top+a.y)/n.y,d=r.width/n.x,u=r.height/n.y;if(o){const p=H(o),f=i&&$(i)?H(i):i;let y=p,E=st(y);for(;E&&i&&f!==y;){const x=ue(E),z=E.getBoundingClientRect(),S=B(E),R=z.left+(E.clientLeft+parseFloat(S.paddingLeft))*x.x,A=z.top+(E.clientTop+parseFloat(S.paddingTop))*x.y;h*=x.x,l*=x.y,d*=x.x,u*=x.y,h+=R,l+=A,y=H(E),E=st(y)}}return Le({width:d,height:u,x:h,y:l})}function Ve(s,e){const t=Fe(s).scrollLeft;return e?e.left+t:ae(q(s)).left+t}function ii(s,e){const t=s.getBoundingClientRect(),i=t.left+e.scrollLeft-Ve(s,t),r=t.top+e.scrollTop;return{x:i,y:r}}function Yi(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=q(i),a=e?Ue(e.floating):!1;if(i===n||a&&o)return t;let h={scrollLeft:0,scrollTop:0},l=V(1);const d=V(0),u=G(i);if((u||!u&&!o)&&((be(i)!=="body"||Ae(n))&&(h=Fe(i)),G(i))){const f=ae(i);l=ue(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}const p=n&&!u&&!o?ii(n,h):V(0);return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-h.scrollLeft*l.x+d.x+p.x,y:t.y*l.y-h.scrollTop*l.y+d.y+p.y}}function Ji(s){return Array.from(s.getClientRects())}function Qi(s){const e=q(s),t=Fe(s),i=s.ownerDocument.body,r=ce(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=ce(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ve(s);const a=-t.scrollTop;return B(i).direction==="rtl"&&(n+=ce(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}const xt=25;function Zi(s,e){const t=H(s),i=q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,h=0;if(r){o=r.width,n=r.height;const d=ht();(!d||d&&e==="fixed")&&(a=r.offsetLeft,h=r.offsetTop)}const l=Ve(i);if(l<=0){const d=i.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-u.clientWidth-f);y<=xt&&(o-=y)}else l<=xt&&(o+=l);return{width:o,height:n,x:a,y:h}}const es=new Set(["absolute","fixed"]);function ts(s,e){const t=ae(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=G(s)?ue(s):V(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,h=r*o.x,l=i*o.y;return{width:n,height:a,x:h,y:l}}function kt(s,e,t){let i;if(e==="viewport")i=Zi(s,t);else if(e==="document")i=Qi(q(s));else if($(e))i=ts(e,t);else{const r=ti(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Le(i)}function si(s,e){const t=ee(s);return t===e||!$(t)||ye(t)?!1:B(t).position==="fixed"||si(t,e)}function is(s,e){const t=e.get(s);if(t)return t;let i=ke(s,[],!1).filter(a=>$(a)&&be(a)!=="body"),r=null;const o=B(s).position==="fixed";let n=o?ee(s):s;for(;$(n)&&!ye(n);){const a=B(n),h=dt(n);!h&&a.position==="fixed"&&(r=null),(o?!h&&!r:!h&&a.position==="static"&&!!r&&es.has(r.position)||Ae(n)&&!h&&si(s,n))?i=i.filter(d=>d!==n):r=a,n=ee(n)}return e.set(s,i),i}function ss(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?Ue(e)?[]:is(e,this._c):[].concat(t),i],a=n[0],h=n.reduce((l,d)=>{const u=kt(e,d,r);return l.top=ce(u.top,l.top),l.right=tt(u.right,l.right),l.bottom=tt(u.bottom,l.bottom),l.left=ce(u.left,l.left),l},kt(e,a,r));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function rs(s){const{width:e,height:t}=ei(s);return{width:e,height:t}}function os(s,e,t){const i=G(e),r=q(e),o=t==="fixed",n=ae(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const h=V(0);function l(){h.x=Ve(r)}if(i||!i&&!o)if((be(e)!=="body"||Ae(r))&&(a=Fe(e)),i){const f=ae(e,!0,o,e);h.x=f.x+e.clientLeft,h.y=f.y+e.clientTop}else r&&l();o&&!i&&r&&l();const d=r&&!i&&!o?ii(r,a):V(0),u=n.left+a.scrollLeft-h.x-d.x,p=n.top+a.scrollTop-h.y-d.y;return{x:u,y:p,width:n.width,height:n.height}}function Je(s){return B(s).position==="static"}function St(s,e){if(!G(s)||B(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return q(s)===t&&(t=t.ownerDocument.body),t}function ri(s,e){const t=H(s);if(Ue(s))return t;if(!G(s)){let r=ee(s);for(;r&&!ye(r);){if($(r)&&!Je(r))return r;r=ee(r)}return t}let i=St(s,e);for(;i&&Bi(i)&&Je(i);)i=St(i,e);return i&&ye(i)&&Je(i)&&!dt(i)?t:i||qi(s)||t}const ns=async function(s){const e=this.getOffsetParent||ri,t=this.getDimensions,i=await t(s.floating);return{reference:os(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function as(s){return B(s).direction==="rtl"}const ls={convertOffsetParentRelativeRectToViewportRelativeRect:Yi,getDocumentElement:q,getClippingRect:ss,getOffsetParent:ri,getElementRects:ns,getClientRects:Ji,getDimensions:rs,getScale:ue,isElement:$,isRTL:as};function oi(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function ds(s,e){let t=null,i;const r=q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const l=s.getBoundingClientRect(),{left:d,top:u,width:p,height:f}=l;if(a||e(),!p||!f)return;const y=De(u),E=De(r.clientWidth-(d+p)),x=De(r.clientHeight-(u+f)),z=De(d),R={rootMargin:-y+"px "+-E+"px "+-x+"px "+-z+"px",threshold:ce(0,tt(1,h))||1};let A=!0;function k(J){const j=J[0].intersectionRatio;if(j!==h){if(!A)return n();j?n(!1,j):i=setTimeout(()=>{n(!1,1e-7)},1e3)}j===1&&!oi(l,s.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(k,{...R,root:r.ownerDocument})}catch{t=new IntersectionObserver(k,R)}t.observe(s)}return n(!0),o}function Rt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=i,l=ct(s),d=r||o?[...l?ke(l):[],...ke(e)]:[];d.forEach(z=>{r&&z.addEventListener("scroll",t,{passive:!0}),o&&z.addEventListener("resize",t)});const u=l&&a?ds(l,t):null;let p=-1,f=null;n&&(f=new ResizeObserver(z=>{let[S]=z;S&&S.target===l&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var R;(R=f)==null||R.observe(e)})),t()}),l&&!h&&f.observe(l),f.observe(e));let y,E=h?ae(s):null;h&&x();function x(){const z=ae(s);E&&!oi(E,z)&&t(),E=z,y=requestAnimationFrame(x)}return t(),()=>{var z;d.forEach(S=>{r&&S.removeEventListener("scroll",t),o&&S.removeEventListener("resize",t)}),u?.(),(z=f)==null||z.disconnect(),f=null,h&&cancelAnimationFrame(y)}}const At=Pi,Mt=Hi,Dt=(s,e,t)=>{const i=new Map,r={platform:ls,...t},o={...r.platform,_c:i};return Ti(s,e,{...r,platform:o})},ut=(s,e)=>{let t="The dashboard component encountered an error";typeof e?.dashboardId=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof e?.dashboardSlug=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof e?.container=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
- ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},n=["svg","flexbox","postMessage"];for(const d of n)o[d]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(d),t+=`Your browser does not support: ${d}
22
- `);const a=window.navigator.userAgent,h=a.includes("MSIE"),l=a.includes("Trident/");(h||l)&&(e=!0,t="IE is not supported."),e&&ut(t)},O={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",editorLanguage:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,theme:"",mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null},ni=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],Ct={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},ze=s=>s?s.endsWith("/")?s:`${s}/`:"",X=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",cs=(s,e,t,i)=>{const r=(a,h)=>{const l=a.users.find(y=>y.id===h.id),d=l&&l.userAccessRight?{flagRead:l.userAccessRight.flagRead,flagUse:l.userAccessRight.flagUse,flagModify:l.userAccessRight.flagModify,flagOwn:l.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},p=a.groups.filter(y=>h.userGroups.includes(y.id)||y.public===!0).map(y=>{if(y.groupAccessRight)return y.groupAccessRight});for(const y of p)!d.flagRead&&y.flagRead&&(d.flagRead=y.flagRead),!d.flagUse&&y.flagUse&&(d.flagUse=y.flagUse),!d.flagModify&&y.flagModify&&(d.flagModify=y.flagModify),!d.flagOwn&&y.flagOwn&&(d.flagOwn=y.flagOwn);const f=a.integrations?.length>0?a.integrations.map(y=>{if(y.integrationAccessRight)return y.integrationAccessRight}):[];for(const y of f)!d.flagRead&&y.flagRead&&(d.flagRead=y.flagRead),!d.flagUse&&y.flagUse&&(d.flagUse=y.flagUse),!d.flagModify&&y.flagModify&&(d.flagModify=y.flagModify);return d},o=(a,h)=>{if(a==null)return"";if(typeof a!="object"||Object.keys(a).length===0)return typeof a=="object"&&Object.keys(a).length===0?"":a;let l;return l=h&&a[h]?a[h]:a[Object.keys(a)[0]],l==null&&(l=""),l},n=[];for(const a of s){const h={accessibleBy:[],accessRights:r(a,t),id:a.id,modifiedAt:a.modified_at,name:o(a.name,i.language),slug:null,tags:a.tags.map(f=>f.tag).sort((f,y)=>f.localeCompare(y))},l=a.integrations.find(f=>f.id===e);l?.integrationAccessRight?.slug&&(h.slug=l.integrationAccessRight.slug);const d=a.users.map(f=>({model:"User",id:f.id,name:o(f.name,t.locale_id)})),u=a.groups.map(f=>({model:"Group",id:f.id,name:o(f.name,t.locale_id)||{}})),p=a.integrations.map(f=>({model:"Integration",id:f.id,name:o(f.name,t.locale_id)||{}}));h.accessibleBy=[...d,...u,...p],n.push(h)}return n},us="0.0.0-unknown-luzmo",ms=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),o=l=>r.has(l[0]);if(!s)return"about:blank";const n=s.replaceAll(t,"").trim();if(o(n))return n;const a=n.match(i);if(!a)return n;const h=a[0];return e.test(h)?"about:blank":n},It=s=>JSON.parse(JSON.stringify(s)),ps=s=>s&&typeof s=="object",rt=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=ps(i)?rt(s[t],i):s[t]:s[t]=i}),s),de=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)}),Tt=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:o,loaderBackground:n,loaderSpinnerColor:a,loaderSpinnerBackground:h,loaderFontColor:l,screenMode:d,key:u,token:p,timezoneId:f,itemEmbedding:y,itemDimensions:E,dashboardId:x,dashboardSlug:z,itemId:S,theme:R,mainColor:A,accentColor:k,editMode:J}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),o&&e.push(`qe_version=${o}`),n&&e.push(`ldrbg=${n}`),l&&e.push(`ldrftclr=${l}`),a&&e.push(`ldrspclr=${a}`),h&&e.push(`ldrspbg=${h}`),R&&e.push(`theme=${R}`),A&&e.push(`mainColor=${A}`),k&&e.push(`accentColor=${k}`),d&&d!=="auto"&&e.push("screenMode=&{screenMode}"),f&&e.push("timezoneId="+f),y&&E&&E.width&&e.push("width="+E.width),y&&E&&E.height&&e.push("height="+E.height),J&&e.push("editMode="+J);const j=u&&p?"#"+u+":"+p:"";e.push("version="+(s.libVersion||us));const ve=y?`${t}i/${x||z}/${S}?${encodeURIComponent(e.join("&"))}${j}`:`${t}i/${x||z}?${encodeURIComponent(e.join("&"))}${j}`;return ms(ve)},Lt=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=Ct.initializing[s.params.language]||Ct.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function oe(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function Ce(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function ai(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function gs(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function fs(s){const e=s.params.loaderBackground||O.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const t=s.params.itemDimensions?.width||O.itemDimensions.width,i=s.params.itemDimensions?.height||O.itemDimensions.height,r=t!=="auto",o=i!=="auto";return{background:e,width:r?`${t}px`:"100%",height:`${o?i:"200"}px`,"min-height":o?"":"200px"}}return{background:e}}function ys(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=O,i=Nt(s.borderWidth,s.params.loaderSpinnerColor||e),r=Nt(s.borderWidth,s.params.loaderSpinnerBackground||t),o=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:o,height:o}}function bs(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto",i=o=>`${(o-s.loaderSize-32)/2}px`;return{padding:`${s.params.itemId?i(t?Number.parseInt(`${e}`,10):s.minHeight):"128px"} 16px`}}function Ht(s){const e=s.params.itemDimensions?.height||O.itemDimensions.height,t=s.params.itemDimensions?.width||O.itemDimensions.width;s.params.itemEmbedding&&e!=="auto"?s.iframeHeight=`${e}px`:s.params.itemEmbedding?s.iframeHeight="200px":["editFull","editLimited"].includes(s.params.editMode)?s.iframeHeight="100%":s.iframeHeight="400px",s.iframeWidth=s.params.itemEmbedding&&t!=="auto"?`${t}px`:"100%";const i={height:s.iframeHeight,width:s.iframeWidth};return s.iframeLoaded?i.opacity=1:s.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function Nt(s,e){return`${s}px solid ${e}`}const vs=(s,e)=>{s?.contentWindow&&s.contentWindow.location.replace(e)},Ot=(s,e,t)=>{const i=de();return e?.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="exportDashboard request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},ws=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${ze(s.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{id:s.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(o=>o.json()).then(o=>{!o||!o.rows||o.rows.length===0||!o.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(o.rows[0].user.userGroups=o.rows[0].user.groups.map(n=>n.id),delete o.rows[0].user.groups,t({integrationId:o.rows[0].integration_id,user:o.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${ze(s.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{const a=n.rows.length>0?cs(n.rows,r.integrationId,r.user,s):[];t(a)})}).catch(r=>{i(r)})}catch(r){i(r)}})())}throw new Error("No authKey or authToken found in the luzmo-dashboard component.")},_s=(s,e,t)=>{if(e?.contentWindow){const i=de();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="getData request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Es=(s,e)=>{if(e?.contentWindow){const t=de();return e.contentWindow.postMessage({action:"getFilters",_version:s.libVersion,requestId:t},"*"),new Promise((i,r)=>{s.promises[t]={resolve:i,reject:r},setTimeout(()=>{if(s.promises[t]){const o="getFilters request timed out.";s.promises[t].reject(new Error(o)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Pt=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),zs=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),xs=(s,e,t,i,r)=>e?(e.contentWindow.postMessage({action:"sendExportEmail",type:t||"once",subject:i,message:r,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),ks=(s,e,t,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:t,token:i,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Ss=(s,e,t)=>{if(e&&e.contentWindow){const i=de();return s.params.editMode===t?Promise.reject(new Error("editMode parameter is currently already set to "+t)):t!=="editFull"&&t!=="editLimited"&&t!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Rs=(s,e,t)=>{if(e){const i=de();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="setPreview request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},As=(s,e,t,i)=>{if(e){const r=de();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((o,n)=>{s.promises[r]={resolve:o,reject:n},setTimeout(()=>{if(s.promises[r]){const a="setSelectedData request timed out.";s.promises[r].reject(new Error(a)),delete s.promises[r]}},2e3)})}return Promise.reject()},xe=s=>{if(!s.dimensions){s.params.error=!0,ut("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,o=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&e?.[0]==="fixed")i="fixed",r=s.dimensions.fixed[0],o=s.dimensions.fixed[1];else{const h=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[l]=e;let d=It(l);for(const u of h){const p=e.find(f=>f===u);p?d=It(p):s.dimensions[u]=s.dimensions[d]}}for(const l of e)if(h.includes(l)){const d=ni.find(u=>u.mode===l);t.push({...d,height:s.dimensions[l][1]||50})}if(t.map(l=>l.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((l,d)=>h.indexOf(l.mode)-h.indexOf(d.mode));for(const l of t){const[d,u]=l.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?d<s.params.itemDimensions.width&&(i=l.mode,r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1]):d<s.containerWidth&&(i=l.mode,s.params.itemEmbedding?(r=s.params.itemDimensions?.width&&s.params.itemDimensions?.width!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,u),o=s.params.itemDimensions?.height&&s.params.itemDimensions?.height!=="auto"?Number.parseInt(s.params.itemDimensions.height,10):s.dimensions[i][1],s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1])):(r=Math.max(Math.min(u,s.containerWidth),d),o=l.height))}}else{const{height:l,width:[d,u]}=t.find(p=>p.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(u,s.containerWidth),d),o=l,s.params.itemEmbedding&&(s.params.itemDimensions?.width&&s.params.itemDimensions?.width!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),s.params.itemDimensions?.height&&s.params.itemDimensions?.height!=="auto"&&(o=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[l]=t;i=l.mode,r=l.width[0],o=l.height}}s.currentScreenMode=i;const n={height:o===0?"100%":`${String(o)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(n.height="100%",n.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(n.height=s.params.itemDimensions.height==="auto"?n.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,n.width=s.params.itemDimensions.width==="auto"?n.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(n.height=o===0?"100%":`${String(o)}px`,n.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=n},Wt=s=>{const e=Object.keys(O),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],n=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=rt(s.params,O),(!s.params.dashboardId||typeof s.params.dashboardId!="string")&&(!s.params.dashboardSlug||typeof s.params.dashboardSlug!="string")&&(delete s.params.dashboardId,delete s.params.dashboardSlug);for(const a of i)typeof s.params[a]!="string"&&(delete s.params[a],t.push(`${a} needs to be of type string.`));for(const a of r)typeof s.params[a]!="string"&&s.params[a]!==null&&s.params[a]!==void 0&&(delete s.params[a],t.push(`${a} needs to be of type string or empty.`));if(s.params.screenMode&&!n.includes(s.params.screenMode)){const a=n.map(h=>`"${h}"`).join(", ");t.push(`"screenMode" needs should be one of these types: ${a}`),s.params.screenMode="auto"}s.params.itemId&&(s.params.itemEmbedding=!0);for(const a of o)typeof s.params[a]!="object"&&s.params[a]!==null&&(delete s.params[a],t.push(`${a} needs to be of type object or empty.`));if(typeof s.params.switchScreenModeOnResize!="boolean"&&(t.push("switchScreenModeOnResize needs to be of type boolean."),s.params.switchScreenModeOnResize=!0),s.params.itemDimensions){const a=["width","height"];for(const h of a)!["string","number"].includes(typeof s.params.itemDimensions[h])&&s.params.itemDimensions[h]!==null&&t.push(`itemDimensions ${h} needs to be of type string, number or empty.`)}s.params=rt(s.params,O),s.params.screenMode&&s.params.screenMode!=="auto"&&(s.params.switchScreenModeOnResize=!1),s.params.itemDimensions.width!=="auto"&&(s.params.itemDimensions.width=Number.parseInt(`${s.params.itemDimensions.width}`.replace("px",""),10)||"auto"),s.params.itemDimensions.height!=="auto"&&(s.params.itemDimensions.height=Number.parseInt(`${s.params.itemDimensions.height}`.replace("px",""),10)||"auto"),s.params.itemEmbedding=!!s.params.itemId,(s.params.error||t.length>0)&&ut(t.join(`
23
- `),s.params)},Qe={type:"type",slots:"slots",options:"options",appServer:"app-server",apiHost:"api-host",authKey:"auth-key",authToken:"auth-token",contextId:"context-id",canFilter:"can-filter",filters:"filters",dashboardId:"dashboard-id",itemId:"item-id",dashboardContentsVersion:"dashboard-contents-version",libVersion:"lib-version"},ot="luzmo-embed-container",Ee={},Ms=async(s,e)=>{const t=typeof s=="function"?await s():s,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=t,document.querySelectorAll("head")[0].append(i)},$t=s=>({});async function Ds(s){const e=Ee[s];if(e.inited)return e.lib;if(e.format==="var")return new Promise(t=>{const i=()=>{e.inited||(e.lib=window[s],e.lib.init($t(e.from)),e.inited=!0),t(e.lib)};return Ms(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((t,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(n=>{if(!e.inited){const a=$t(e.from);n.init(a),e.lib=n,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function Cs(s,e){if(!s?.default&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function Is(s,e){return Ds(s).then(t=>t.get(e).then(i=>i()))}async function te(s,e="DashboardApp"){const t=s+e;if(Ee[t])return Ee[t].module;let i=`${X(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${X(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${X(s)}/iq-components/remoteEntry.mjs`;break}}Ee[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await Is(t,`./${e}`),o=Cs(r,!0);return Ee[t].module=o,o}var Ts=Object.defineProperty,g=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Ts(e,t,r),r},le="6.7.0",Ls=class{constructor(){this._dashboardComponents=[]}},nt=new Ls,Hs=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{const e=nt._dashboardComponents.find(t=>s.data.name===t._iframeId);if(e)switch(s.data?.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:s.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=s.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError(),console.error("Dashboard error:",s.data.errorMsg??s.data.error?.msg);break}case"data":{oe(e,s.data.requestId,s.data.data);break}case"filters":{oe(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{oe(e,s.data.requestId,s.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:s.data}}));break}case"export":{s.data.error?Ce(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),oe(e,s.data.requestId,s.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:s.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:s.data}}));break}case"chartsRendered":case"itemsRendered":{s.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:s.data}}));break}case"setEditMode":{s.data.error?Ce(e,s.data.requestId,s.data):(oe(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=ai(e),e.dimensions&&xe(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,xe(e);break}case"setSelectedData":case"setFilters":{s.data.error?Ce(e,s.data.requestId,s.data):oe(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?Ce(e,s.data.requestId,s.data):oe(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},Ns=_.css`
20
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("lit"),p=require("lit/decorators.js"),he=require("lit/directives/style-map.js"),ie=require("@luzmo/icons");require("@luzmo/lucero/action-button");require("@luzmo/lucero/action-group");require("@luzmo/lucero/icon");const Jt=require("@luzmo/lucero/utils"),bt=require("../color-B6LaL8qz.cjs"),yi=require("../item-list.cjs"),Je=require("../index-Vdyb9z2D.cjs"),oe=require("@lit/localize");require("@luzmo/lucero/tooltip");const Qe=require("../set-locale-BRRalqne.cjs"),T=[];for(let s=0;s<256;++s)T.push((s+256).toString(16).slice(1));function bi(s,e=0){return(T[s[e+0]]+T[s[e+1]]+T[s[e+2]]+T[s[e+3]]+"-"+T[s[e+4]]+T[s[e+5]]+"-"+T[s[e+6]]+T[s[e+7]]+"-"+T[s[e+8]]+T[s[e+9]]+"-"+T[s[e+10]]+T[s[e+11]]+T[s[e+12]]+T[s[e+13]]+T[s[e+14]]+T[s[e+15]]).toLowerCase()}let Ze;const vi=new Uint8Array(16);function wi(){if(!Ze){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ze=crypto.getRandomValues.bind(crypto)}return Ze(vi)}const _i=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vt={randomUUID:_i};function ke(s,e,t){var r;if(vt.randomUUID&&!s)return vt.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??wi();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,bi(i)}const rt=Math.min,fe=Math.max,Ne=Math.round,Le=Math.floor,Y=s=>({x:s,y:s}),Ei={left:"right",right:"left",bottom:"top",top:"bottom"},zi={start:"end",end:"start"};function ct(s,e){return typeof s=="function"?s(e):s}function _e(s){return s.split("-")[0]}function Ve(s){return s.split("-")[1]}function xi(s){return s==="x"?"y":"x"}function Qt(s){return s==="y"?"height":"width"}const ki=new Set(["top","bottom"]);function ue(s){return ki.has(_e(s))?"y":"x"}function Zt(s){return xi(ue(s))}function Si(s,e,t){t===void 0&&(t=!1);const i=Ve(s),r=Zt(s),o=Qt(r);let n=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Oe(n)),[n,Oe(n)]}function Ri(s){const e=Oe(s);return[ot(s),e,ot(e)]}function ot(s){return s.replace(/start|end/g,e=>zi[e])}const wt=["left","right"],_t=["right","left"],Ai=["top","bottom"],Mi=["bottom","top"];function Di(s,e,t){switch(s){case"top":case"bottom":return t?e?_t:wt:e?wt:_t;case"left":case"right":return e?Ai:Mi;default:return[]}}function Ci(s,e,t,i){const r=Ve(s);let o=Di(_e(s),t==="start",i);return r&&(o=o.map(n=>n+"-"+r),e&&(o=o.concat(o.map(ot)))),o}function Oe(s){return s.replace(/left|right|bottom|top/g,e=>Ei[e])}function Ti(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ii(s){return typeof s!="number"?Ti(s):{top:s,right:s,bottom:s,left:s}}function Pe(s){const{x:e,y:t,width:i,height:r}=s;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Et(s,e,t){let{reference:i,floating:r}=s;const o=ue(e),n=Zt(e),a=Qt(n),l=_e(e),h=o==="y",d=i.x+i.width/2-r.width/2,c=i.y+i.height/2-r.height/2,u=i[a]/2-r[a]/2;let g;switch(l){case"top":g={x:d,y:i.y-r.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:c};break;case"left":g={x:i.x-r.width,y:c};break;default:g={x:i.x,y:i.y}}switch(Ve(e)){case"start":g[n]-=u*(t&&h?-1:1);break;case"end":g[n]+=u*(t&&h?-1:1);break}return g}const Li=async(s,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let h=await n.getElementRects({reference:s,floating:e,strategy:r}),{x:d,y:c}=Et(h,i,l),u=i,g={},y=0;for(let v=0;v<a.length;v++){const{name:b,fn:w}=a[v],{x,y:S,data:A,reset:R}=await w({x:d,y:c,initialPlacement:i,placement:u,strategy:r,middlewareData:g,rects:h,platform:n,elements:{reference:s,floating:e}});d=x??d,c=S??c,g={...g,[b]:{...g[b],...A}},R&&y<=50&&(y++,typeof R=="object"&&(R.placement&&(u=R.placement),R.rects&&(h=R.rects===!0?await n.getElementRects({reference:s,floating:e,strategy:r}):R.rects),{x:d,y:c}=Et(h,u,l)),v=-1)}return{x:d,y:c,placement:u,strategy:r,middlewareData:g}};async function Hi(s,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:n,elements:a,strategy:l}=s,{boundary:h="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:u=!1,padding:g=0}=ct(e,s),y=Ii(g),b=a[u?c==="floating"?"reference":"floating":c],w=Pe(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(b)))==null||t?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:h,rootBoundary:d,strategy:l})),x=c==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(S))?await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1}:{x:1,y:1},R=Pe(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:S,strategy:l}):x);return{top:(w.top-R.top+y.top)/A.y,bottom:(R.bottom-w.bottom+y.bottom)/A.y,left:(w.left-R.left+y.left)/A.x,right:(R.right-w.right+y.right)/A.x}}const Ni=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:l,elements:h}=e,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...b}=ct(s,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const w=_e(r),x=ue(a),S=_e(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(h.floating)),R=u||(S||!v?[Oe(a)]:Ri(a)),U=y!=="none";!u&&U&&R.push(...Ci(a,v,y,A));const W=[a,...R],se=await Hi(e,b),F=[];let L=((i=o.flip)==null?void 0:i.overflows)||[];if(d&&F.push(se[w]),c){const C=Si(r,n,A);F.push(se[C[0]],se[C[1]])}if(L=[...L,{placement:r,overflows:F}],!F.every(C=>C<=0)){var Ie,H;const C=(((Ie=o.flip)==null?void 0:Ie.index)||0)+1,le=W[C];if(le&&(!(c==="alignment"?x!==ue(le):!1)||L.every(V=>ue(V.placement)===x?V.overflows[0]>0:!0)))return{data:{index:C,overflows:L},reset:{placement:le}};let xe=(H=L.filter(de=>de.overflows[0]<=0).sort((de,V)=>de.overflows[1]-V.overflows[1])[0])==null?void 0:H.placement;if(!xe)switch(g){case"bestFit":{var Z;const de=(Z=L.filter(V=>{if(U){const re=ue(V.placement);return re===x||re==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(re=>re>0).reduce((re,fi)=>re+fi,0)]).sort((V,re)=>V[1]-re[1])[0])==null?void 0:Z[0];de&&(xe=de);break}case"initialPlacement":xe=a;break}if(r!==xe)return{reset:{placement:xe}}}return{}}}},Oi=new Set(["left","top"]);async function Pi(s,e){const{placement:t,platform:i,elements:r}=s,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=_e(t),a=Ve(t),l=ue(t)==="y",h=Oi.has(n)?-1:1,d=o&&l?-1:1,c=ct(e,s);let{mainAxis:u,crossAxis:g,alignmentAxis:y}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof y=="number"&&(g=a==="end"?y*-1:y),l?{x:g*d,y:u*h}:{x:u*h,y:g*d}}const $i=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,i;const{x:r,y:o,placement:n,middlewareData:a}=e,l=await Pi(e,s);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:n}}}}};function Ge(){return typeof window<"u"}function ze(s){return ei(s)?(s.nodeName||"").toLowerCase():"#document"}function P(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function Q(s){var e;return(e=(ei(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function ei(s){return Ge()?s instanceof Node||s instanceof P(s).Node:!1}function q(s){return Ge()?s instanceof Element||s instanceof P(s).Element:!1}function J(s){return Ge()?s instanceof HTMLElement||s instanceof P(s).HTMLElement:!1}function zt(s){return!Ge()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof P(s).ShadowRoot}const Wi=new Set(["inline","contents"]);function Te(s){const{overflow:e,overflowX:t,overflowY:i,display:r}=j(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!Wi.has(r)}const Bi=new Set(["table","td","th"]);function Ui(s){return Bi.has(ze(s))}const Fi=[":popover-open",":modal"];function qe(s){return Fi.some(e=>{try{return s.matches(e)}catch{return!1}})}const Vi=["transform","translate","scale","rotate","perspective"],Gi=["transform","translate","scale","rotate","perspective","filter"],qi=["paint","layout","strict","content"];function ut(s){const e=mt(),t=q(s)?j(s):s;return Vi.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Gi.some(i=>(t.willChange||"").includes(i))||qi.some(i=>(t.contain||"").includes(i))}function ji(s){let e=ne(s);for(;J(e)&&!Ee(e);){if(ut(e))return e;if(qe(e))return null;e=ne(e)}return null}function mt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ki=new Set(["html","body","#document"]);function Ee(s){return Ki.has(ze(s))}function j(s){return P(s).getComputedStyle(s)}function je(s){return q(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function ne(s){if(ze(s)==="html")return s;const e=s.assignedSlot||s.parentNode||zt(s)&&s.host||Q(s);return zt(e)?e.host:e}function ti(s){const e=ne(s);return Ee(e)?s.ownerDocument?s.ownerDocument.body:s.body:J(e)&&Te(e)?e:ti(e)}function Me(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=ti(s),o=r===((i=s.ownerDocument)==null?void 0:i.body),n=P(r);if(o){const a=nt(n);return e.concat(n,n.visualViewport||[],Te(r)?r:[],a&&t?Me(a):[])}return e.concat(r,Me(r,[],t))}function nt(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function ii(s){const e=j(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=J(s),o=r?s.offsetWidth:t,n=r?s.offsetHeight:i,a=Ne(t)!==o||Ne(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function pt(s){return q(s)?s:s.contextElement}function ye(s){const e=pt(s);if(!J(e))return Y(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=ii(e);let n=(o?Ne(t.width):t.width)/i,a=(o?Ne(t.height):t.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const Xi=Y(0);function si(s){const e=P(s);return!mt()||!e.visualViewport?Xi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Yi(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==P(s)?!1:e}function me(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=s.getBoundingClientRect(),o=pt(s);let n=Y(1);e&&(i?q(i)&&(n=ye(i)):n=ye(s));const a=Yi(o,t,i)?si(o):Y(0);let l=(r.left+a.x)/n.x,h=(r.top+a.y)/n.y,d=r.width/n.x,c=r.height/n.y;if(o){const u=P(o),g=i&&q(i)?P(i):i;let y=u,v=nt(y);for(;v&&i&&g!==y;){const b=ye(v),w=v.getBoundingClientRect(),x=j(v),S=w.left+(v.clientLeft+parseFloat(x.paddingLeft))*b.x,A=w.top+(v.clientTop+parseFloat(x.paddingTop))*b.y;l*=b.x,h*=b.y,d*=b.x,c*=b.y,l+=S,h+=A,y=P(v),v=nt(y)}}return Pe({width:d,height:c,x:l,y:h})}function Ke(s,e){const t=je(s).scrollLeft;return e?e.left+t:me(Q(s)).left+t}function ri(s,e){const t=s.getBoundingClientRect(),i=t.left+e.scrollLeft-Ke(s,t),r=t.top+e.scrollTop;return{x:i,y:r}}function Ji(s){let{elements:e,rect:t,offsetParent:i,strategy:r}=s;const o=r==="fixed",n=Q(i),a=e?qe(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},h=Y(1);const d=Y(0),c=J(i);if((c||!c&&!o)&&((ze(i)!=="body"||Te(n))&&(l=je(i)),J(i))){const g=me(i);h=ye(i),d.x=g.x+i.clientLeft,d.y=g.y+i.clientTop}const u=n&&!c&&!o?ri(n,l):Y(0);return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-l.scrollLeft*h.x+d.x+u.x,y:t.y*h.y-l.scrollTop*h.y+d.y+u.y}}function Qi(s){return Array.from(s.getClientRects())}function Zi(s){const e=Q(s),t=je(s),i=s.ownerDocument.body,r=fe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=fe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ke(s);const a=-t.scrollTop;return j(i).direction==="rtl"&&(n+=fe(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}const xt=25;function es(s,e){const t=P(s),i=Q(s),r=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(r){o=r.width,n=r.height;const d=mt();(!d||d&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const h=Ke(i);if(h<=0){const d=i.ownerDocument,c=d.body,u=getComputedStyle(c),g=d.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,y=Math.abs(i.clientWidth-c.clientWidth-g);y<=xt&&(o-=y)}else h<=xt&&(o+=h);return{width:o,height:n,x:a,y:l}}const ts=new Set(["absolute","fixed"]);function is(s,e){const t=me(s,!0,e==="fixed"),i=t.top+s.clientTop,r=t.left+s.clientLeft,o=J(s)?ye(s):Y(1),n=s.clientWidth*o.x,a=s.clientHeight*o.y,l=r*o.x,h=i*o.y;return{width:n,height:a,x:l,y:h}}function kt(s,e,t){let i;if(e==="viewport")i=es(s,t);else if(e==="document")i=Zi(Q(s));else if(q(e))i=is(e,t);else{const r=si(s);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Pe(i)}function oi(s,e){const t=ne(s);return t===e||!q(t)||Ee(t)?!1:j(t).position==="fixed"||oi(t,e)}function ss(s,e){const t=e.get(s);if(t)return t;let i=Me(s,[],!1).filter(a=>q(a)&&ze(a)!=="body"),r=null;const o=j(s).position==="fixed";let n=o?ne(s):s;for(;q(n)&&!Ee(n);){const a=j(n),l=ut(n);!l&&a.position==="fixed"&&(r=null),(o?!l&&!r:!l&&a.position==="static"&&!!r&&ts.has(r.position)||Te(n)&&!l&&oi(s,n))?i=i.filter(d=>d!==n):r=a,n=ne(n)}return e.set(s,i),i}function rs(s){let{element:e,boundary:t,rootBoundary:i,strategy:r}=s;const n=[...t==="clippingAncestors"?qe(e)?[]:ss(e,this._c):[].concat(t),i],a=n[0],l=n.reduce((h,d)=>{const c=kt(e,d,r);return h.top=fe(c.top,h.top),h.right=rt(c.right,h.right),h.bottom=rt(c.bottom,h.bottom),h.left=fe(c.left,h.left),h},kt(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function os(s){const{width:e,height:t}=ii(s);return{width:e,height:t}}function ns(s,e,t){const i=J(e),r=Q(e),o=t==="fixed",n=me(s,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Y(0);function h(){l.x=Ke(r)}if(i||!i&&!o)if((ze(e)!=="body"||Te(r))&&(a=je(e)),i){const g=me(e,!0,o,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else r&&h();o&&!i&&r&&h();const d=r&&!i&&!o?ri(r,a):Y(0),c=n.left+a.scrollLeft-l.x-d.x,u=n.top+a.scrollTop-l.y-d.y;return{x:c,y:u,width:n.width,height:n.height}}function et(s){return j(s).position==="static"}function St(s,e){if(!J(s)||j(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return Q(s)===t&&(t=t.ownerDocument.body),t}function ni(s,e){const t=P(s);if(qe(s))return t;if(!J(s)){let r=ne(s);for(;r&&!Ee(r);){if(q(r)&&!et(r))return r;r=ne(r)}return t}let i=St(s,e);for(;i&&Ui(i)&&et(i);)i=St(i,e);return i&&Ee(i)&&et(i)&&!ut(i)?t:i||ji(s)||t}const as=async function(s){const e=this.getOffsetParent||ni,t=this.getDimensions,i=await t(s.floating);return{reference:ns(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function ls(s){return j(s).direction==="rtl"}const ds={convertOffsetParentRelativeRectToViewportRelativeRect:Ji,getDocumentElement:Q,getClippingRect:rs,getOffsetParent:ni,getElementRects:as,getClientRects:Qi,getDimensions:os,getScale:ye,isElement:q,isRTL:ls};function ai(s,e){return s.x===e.x&&s.y===e.y&&s.width===e.width&&s.height===e.height}function hs(s,e){let t=null,i;const r=Q(s);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const h=s.getBoundingClientRect(),{left:d,top:c,width:u,height:g}=h;if(a||e(),!u||!g)return;const y=Le(c),v=Le(r.clientWidth-(d+u)),b=Le(r.clientHeight-(c+g)),w=Le(d),S={rootMargin:-y+"px "+-v+"px "+-b+"px "+-w+"px",threshold:fe(0,rt(1,l))||1};let A=!0;function R(U){const W=U[0].intersectionRatio;if(W!==l){if(!A)return n();W?n(!1,W):i=setTimeout(()=>{n(!1,1e-7)},1e3)}W===1&&!ai(h,s.getBoundingClientRect())&&n(),A=!1}try{t=new IntersectionObserver(R,{...S,root:r.ownerDocument})}catch{t=new IntersectionObserver(R,S)}t.observe(s)}return n(!0),o}function Rt(s,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,h=pt(s),d=r||o?[...h?Me(h):[],...Me(e)]:[];d.forEach(w=>{r&&w.addEventListener("scroll",t,{passive:!0}),o&&w.addEventListener("resize",t)});const c=h&&a?hs(h,t):null;let u=-1,g=null;n&&(g=new ResizeObserver(w=>{let[x]=w;x&&x.target===h&&g&&(g.unobserve(e),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(e)})),t()}),h&&!l&&g.observe(h),g.observe(e));let y,v=l?me(s):null;l&&b();function b(){const w=me(s);v&&!ai(v,w)&&t(),v=w,y=requestAnimationFrame(b)}return t(),()=>{var w;d.forEach(x=>{r&&x.removeEventListener("scroll",t),o&&x.removeEventListener("resize",t)}),c==null||c(),(w=g)==null||w.disconnect(),g=null,l&&cancelAnimationFrame(y)}}const At=$i,Mt=Ni,Dt=(s,e,t)=>{const i=new Map,r={platform:ds,...t},o={...r.platform,_c:i};return Li(s,e,{...r,platform:o})},gt=(s,e)=>{let t="The dashboard component encountered an error";typeof(e==null?void 0:e.dashboardId)=="string"&&(t+=` for dashboard with id ${e.dashboardId}`),typeof(e==null?void 0:e.dashboardSlug)=="string"&&(t+=` for dashboard with slug ${e.dashboardSlug}`),typeof(e==null?void 0:e.container)=="string"&&(t+=` in container ${e.container}`),s&&(t+=`:
21
+ ${s}`,console.warn(t))},cs=s=>{let e=!1,t="";const r=(document.body||document.documentElement).style,o={svg:!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),flexbox:r.webkitFlexWrap===""||r.flexWrap==="",postMessage:!!window.postMessage},n=["svg","flexbox","postMessage"];for(const d of n)o[d]||(e=!0,s.browserNotSupported=s.browserNotSupported||[],s.browserNotSupported.push(d),t+=`Your browser does not support: ${d}
22
+ `);const a=window.navigator.userAgent,l=a.includes("MSIE"),h=a.includes("Trident/");(l||h)&&(e=!0,t="IE is not supported."),e&&gt(t)},B={appServer:"https://app.luzmo.com/",apiHost:"https://api.luzmo.com/",dashboardId:null,dashboardSlug:null,container:null,key:null,token:null,language:"auto",editorLanguage:"auto",qeVersion:null,editMode:null,screenMode:null,switchScreenModeOnResize:!0,itemId:null,theme:"",mainColor:"",accentColor:"",itemDimensions:{width:"auto",height:"auto"},loaderBackground:"#f9f9f9",loaderFontColor:"#5a5a5a",loaderSpinnerColor:"rgba(255, 165, 0, 0.7)",loaderSpinnerBackground:"rgba(169, 169, 169, 0.14)",timezoneId:null,contextId:null},li=[{mode:"mobile",width:[150,767]},{mode:"tablet",width:[768,1199]},{mode:"desktop",width:[1200,1599]},{mode:"largeScreen",width:[1600,9999]},{mode:"fixed",width:[]}],Ct={initializing:{en:"Initializing...",nl:"Laden...",fr:"Chargement...",de:"Initialisiere...",es:"Inicializando..."}},Re=s=>s?s.endsWith("/")?s:`${s}/`:"",te=s=>s?s.endsWith("/")?s.slice(0,-1):s:"",us=(s,e,t,i)=>{var a;const r=(l,h)=>{var v;const d=l.users.find(b=>b.id===h.id),c=d&&d.userAccessRight?{flagRead:d.userAccessRight.flagRead,flagUse:d.userAccessRight.flagUse,flagModify:d.userAccessRight.flagModify,flagOwn:d.userAccessRight.flagOwn}:{flagRead:!1,flagUse:!1,flagModify:!1,flagOwn:!1},g=l.groups.filter(b=>h.userGroups.includes(b.id)||b.public===!0).map(b=>{if(b.groupAccessRight)return b.groupAccessRight});for(const b of g)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify),!c.flagOwn&&b.flagOwn&&(c.flagOwn=b.flagOwn);const y=((v=l.integrations)==null?void 0:v.length)>0?l.integrations.map(b=>{if(b.integrationAccessRight)return b.integrationAccessRight}):[];for(const b of y)!c.flagRead&&b.flagRead&&(c.flagRead=b.flagRead),!c.flagUse&&b.flagUse&&(c.flagUse=b.flagUse),!c.flagModify&&b.flagModify&&(c.flagModify=b.flagModify);return c},o=(l,h)=>{if(l==null)return"";if(typeof l!="object"||Object.keys(l).length===0)return typeof l=="object"&&Object.keys(l).length===0?"":l;let d;return d=h&&l[h]?l[h]:l[Object.keys(l)[0]],d==null&&(d=""),d},n=[];for(const l of s){const h={accessibleBy:[],accessRights:r(l,t),id:l.id,modifiedAt:l.modified_at,name:o(l.name,i.language),slug:null,tags:l.tags.map(y=>y.tag).sort((y,v)=>y.localeCompare(v))},d=l.integrations.find(y=>y.id===e);(a=d==null?void 0:d.integrationAccessRight)!=null&&a.slug&&(h.slug=d.integrationAccessRight.slug);const c=l.users.map(y=>({model:"User",id:y.id,name:o(y.name,t.locale_id)})),u=l.groups.map(y=>({model:"Group",id:y.id,name:o(y.name,t.locale_id)||{}})),g=l.integrations.map(y=>({model:"Integration",id:y.id,name:o(y.name,t.locale_id)||{}}));h.accessibleBy=[...c,...u,...g],n.push(h)}return n},ms="0.0.0-unknown-luzmo",ps=s=>{const e=/^(%20|\s)*(javascript|data)/im,t=/[^\u0020-\u007E]/gim,i=/^([^:]+):/gm,r=new Set([".","/"]),o=h=>r.has(h[0]);if(!s)return"about:blank";const n=s.replaceAll(t,"").trim();if(o(n))return n;const a=n.match(i);if(!a)return n;const l=a[0];return e.test(l)?"about:blank":n},Tt=s=>JSON.parse(JSON.stringify(s)),gs=s=>s&&typeof s=="object",at=(s,e)=>(Object.entries(e).forEach(([t,i])=>{t in s?s[t]===void 0?s[t]=i:s[t]=gs(i)?at(s[t],i):s[t]:s[t]=i}),s),ge=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,function(s){const e=Math.random()*16|0;return(s=="x"?e:e&3|8).toString(16)}),It=s=>{const e=[],{appServer:t,language:i,editorLanguage:r,qeVersion:o,loaderBackground:n,loaderSpinnerColor:a,loaderSpinnerBackground:l,loaderFontColor:h,screenMode:d,key:c,token:u,timezoneId:g,itemEmbedding:y,itemDimensions:v,dashboardId:b,dashboardSlug:w,itemId:x,theme:S,mainColor:A,accentColor:R,editMode:U}=s.params;i&&i!=="auto"&&e.push(`language=${i}`),r&&r!=="auto"&&e.push(`editorLanguage=${r}`),o&&e.push(`qe_version=${o}`),n&&e.push(`ldrbg=${n}`),h&&e.push(`ldrftclr=${h}`),a&&e.push(`ldrspclr=${a}`),l&&e.push(`ldrspbg=${l}`),S&&e.push(`theme=${S}`),A&&e.push(`mainColor=${A}`),R&&e.push(`accentColor=${R}`),d&&d!=="auto"&&e.push("screenMode=&{screenMode}"),g&&e.push("timezoneId="+g),y&&v&&v.width&&e.push("width="+v.width),y&&v&&v.height&&e.push("height="+v.height),U&&e.push("editMode="+U);const W=c&&u?"#"+c+":"+u:"";e.push("version="+(s.libVersion||ms));const se=y?`${t}i/${b||w}/${x}?${encodeURIComponent(e.join("&"))}${W}`:`${t}i/${b||w}?${encodeURIComponent(e.join("&"))}${W}`;return ps(se)},Lt=s=>{let e;(s.params.error||s.browserNotSupported.length>0)&&(s.params.error=!0,s.browserNotSupported&&(e="Browser is not supported."));const t=Ct.initializing[s.params.language]||Ct.initializing.en;return s.browserNotSupported||s.params.error?{loadingMsg:t,errorMsg:e}:{loadingMsg:t,errorMsg:""}};function ce(s,e,t){s.promises[e]&&(s.promises[e].resolve(t),delete s.promises[e])}function He(s,e,t){s.promises[e]&&(s.promises[e].reject(t),delete s.promises[e])}function di(s){const e={};return s.params.loaderBackground&&!s.iframeLoaded&&(e.background=s.params.loaderBackground),e}function fs(s){var r;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||B.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto";return{display:s.iframeLoaded?"none":"",height:`${t?e:s.minHeight}px`}}function ys(s){var t,i;const e=s.params.loaderBackground||B.loaderBackground;if(s.params.itemEmbedding){s.loaderSize=24,s.borderWidth=4,s.minHeight=200;const r=((t=s.params.itemDimensions)==null?void 0:t.width)||B.itemDimensions.width,o=((i=s.params.itemDimensions)==null?void 0:i.height)||B.itemDimensions.height,n=r!=="auto",a=o!=="auto";return{background:e,width:n?`${r}px`:"100%",height:`${a?o:"200"}px`,"min-height":a?"":"200px"}}return{background:e}}function bs(s){const{loaderSpinnerColor:e,loaderSpinnerBackground:t}=B,i=Nt(s.borderWidth,s.params.loaderSpinnerColor||e),r=Nt(s.borderWidth,s.params.loaderSpinnerBackground||t),o=`${s.loaderSize}px`;return{"border-top":i,"border-right":i,"border-bottom":r,"border-left":r,width:o,height:o}}function vs(s){var o;const e=((o=s.params.itemDimensions)==null?void 0:o.height)||B.itemDimensions.height,t=s.params.itemEmbedding&&e!=="auto",i=n=>`${(n-s.loaderSize-32)/2}px`;return{padding:`${s.params.itemId?i(t?Number.parseInt(`${e}`,10):s.minHeight):"128px"} 16px`}}function Ht(s){var r,o;const e=((r=s.params.itemDimensions)==null?void 0:r.height)||B.itemDimensions.height,t=((o=s.params.itemDimensions)==null?void 0:o.width)||B.itemDimensions.width;s.params.itemEmbedding&&e!=="auto"?s.iframeHeight=`${e}px`:s.params.itemEmbedding?s.iframeHeight="200px":["editFull","editLimited"].includes(s.params.editMode)?s.iframeHeight="100%":s.iframeHeight="400px",s.iframeWidth=s.params.itemEmbedding&&t!=="auto"?`${t}px`:"100%";const i={height:s.iframeHeight,width:s.iframeWidth};return s.iframeLoaded?i.opacity=1:s.error?(i.opacity=1,i.width="100%",i.height="400px"):i.opacity=0,i}function Nt(s,e){return`${s}px solid ${e}`}const ws=(s,e)=>{s!=null&&s.contentWindow&&s.contentWindow.location.replace(e)},Ot=(s,e,t)=>{const i=ge();return e!=null&&e.contentWindow?(e.contentWindow.postMessage({action:"exportDashboard",format:t||"png",_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="exportDashboard request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},12e5)})):Promise.reject(new Error("Cannot retrieve contentWindow."))},_s=async s=>{if(await s.updateComplete,(s.currentAuthKey??s.authKey)&&(s.currentAuthToken??s.authToken)){const e=new Promise((t,i)=>{(()=>{try{window.fetch(`${Re(s.params.apiHost)}0.1.0/authorization`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{id:s.authKey},attributes:["id","integration_id"],include:[{model:"User",attributes:["id","name","locale_id"],include:[{model:"Group"}]}]}})}).then(o=>o.json()).then(o=>{!o||!o.rows||o.rows.length===0||!o.rows[0].user?i("Authorization failed, please check authKey and authToken. If the problem persists, please contact support@luzmo.com."):(o.rows[0].user.userGroups=o.rows[0].user.groups.map(n=>n.id),delete o.rows[0].user.groups,t({integrationId:o.rows[0].integration_id,user:o.rows[0].user}))})}catch(r){i(r)}})()});return new Promise((t,i)=>void(()=>{try{e.then(r=>{window.fetch(`${Re(s.params.apiHost)}0.1.0/securable`,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({action:"get",version:"0.1.0",key:s.currentAuthKey??s.authKey,token:s.currentAuthToken??s.authToken,find:{where:{type:"dashboard",is_variant:!1},attributes:["id","name","modified_at"],order:[["modified_at","desc"]],include:[{model:"Tag",attributes:["tag"]},{model:"User",attributes:["id","name"]},{model:"Group",attributes:["id","name","public"]},{model:"Integration",attributes:["id","name"]}]}})}).then(n=>n.json()).then(n=>{const a=n.rows.length>0?us(n.rows,r.integrationId,r.user,s):[];t(a)})}).catch(r=>{i(r)})}catch(r){i(r)}})())}throw new Error("No authKey or authToken found in the luzmo-dashboard component.")},Es=(s,e,t)=>{if(e!=null&&e.contentWindow){const i=ge();return e.contentWindow.postMessage({action:"getData",id:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="getData request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},zs=(s,e)=>{if(e!=null&&e.contentWindow){const t=ge();return e.contentWindow.postMessage({action:"getFilters",_version:s.libVersion,requestId:t},"*"),new Promise((i,r)=>{s.promises[t]={resolve:i,reject:r},setTimeout(()=>{if(s.promises[t]){const o="getFilters request timed out.";s.promises[t].reject(new Error(o)),delete s.promises[t]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Pt=(s,e,t)=>e?(e.contentWindow.postMessage({action:"refreshData",id:t??null,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),xs=(s,e)=>e?(e.contentWindow.postMessage({action:"reloadDashboard",_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),ks=(s,e,t,i)=>e?(e.contentWindow.postMessage({action:"setAuthorization",key:t,token:i,_version:s.libVersion},"*"),Promise.resolve()):Promise.reject(new Error("Cannot retrieve contentWindow.")),Ss=(s,e,t)=>{if(e&&e.contentWindow){const i=ge();return s.params.editMode===t?Promise.reject(new Error("editMode parameter is currently already set to "+t)):t!=="editFull"&&t!=="editLimited"&&t!=="view"?Promise.reject(new Error("The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'.")):(e.contentWindow.postMessage({action:"setEditMode",editMode:t,_version:s.libVersion,requestId:i},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o}}))}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Rs=(s,e,t,i)=>{if(e){const r=ge();return e.contentWindow.postMessage({action:"setSelectedData",itemId:t,filters:i,_version:s.libVersion,requestId:r},"*"),new Promise((o,n)=>{s.promises[r]={resolve:o,reject:n},setTimeout(()=>{if(s.promises[r]){const a="setSelectedData request timed out.";s.promises[r].reject(new Error(a)),delete s.promises[r]}},2e3)})}return Promise.reject()},As=(s,e,t)=>{if(e){const i=ge();return e.contentWindow.postMessage({action:"setPreview",preview:t,requestId:i,_version:s.libVersion},"*"),new Promise((r,o)=>{s.promises[i]={resolve:r,reject:o},setTimeout(()=>{if(s.promises[i]){const n="setPreview request timed out.";s.promises[i].reject(new Error(n)),delete s.promises[i]}},2e3)})}return Promise.reject(new Error("Cannot retrieve contentWindow."))},Ae=s=>{var l,h,d,c,u,g,y,v;if(!s.dimensions){s.params.error=!0,gt("Got no valid dimensions.",s.params);return}const e=Object.keys(s.dimensions),t=[];let i,r=0,o=0;if(!s.params.switchScreenModeOnResize&&s.currentScreenMode&&(s.params.screenMode=s.currentScreenMode),s.dimensions&&(e==null?void 0:e[0])==="fixed")i="fixed",r=s.dimensions.fixed[0],o=s.dimensions.fixed[1];else{const b=["mobile","tablet","desktop","largeScreen"];if(s.params.itemEmbedding){const[w]=e;let x=Tt(w);for(const S of b){const A=e.find(R=>R===S);A?x=Tt(A):s.dimensions[S]=s.dimensions[x]}}for(const w of e)if(b.includes(w)){const x=li.find(S=>S.mode===w);t.push({...x,height:s.dimensions[w][1]||50})}if(t.map(w=>w.mode).includes(s.params.screenMode)||(s.params.screenMode="auto"),s.params.screenMode==="auto"){t.sort((w,x)=>b.indexOf(w.mode)-b.indexOf(x.mode));for(const w of t){const[x,S]=w.width;s.params.itemEmbedding&&s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"?x<s.params.itemDimensions.width&&(i=w.mode,r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1]):x<s.containerWidth&&(i=w.mode,s.params.itemEmbedding?(r=(l=s.params.itemDimensions)!=null&&l.width&&((h=s.params.itemDimensions)==null?void 0:h.width)!=="auto"?Number.parseInt(s.params.itemDimensions.width,10):Math.min(s.containerWidth,S),o=(d=s.params.itemDimensions)!=null&&d.height&&((c=s.params.itemDimensions)==null?void 0:c.height)!=="auto"?Number.parseInt(s.params.itemDimensions.height,10):s.dimensions[i][1],s.params.itemDimensions&&s.params.itemDimensions.width!=="auto"&&s.params.itemDimensions.height==="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10),o=s.dimensions[i][1])):(r=Math.max(Math.min(S,s.containerWidth),x),o=w.height))}}else{const{height:w,width:[x,S]}=t.find(A=>A.mode===s.params.screenMode);i=s.params.screenMode,r=Math.max(Math.min(S,s.containerWidth),x),o=w,s.params.itemEmbedding&&((u=s.params.itemDimensions)!=null&&u.width&&((g=s.params.itemDimensions)==null?void 0:g.width)!=="auto"&&(r=Number.parseInt(s.params.itemDimensions.width,10)),(y=s.params.itemDimensions)!=null&&y.height&&((v=s.params.itemDimensions)==null?void 0:v.height)!=="auto"&&(o=Number.parseInt(s.params.itemDimensions.height,10)))}if(!i&&t.length>0){const[w]=t;i=w.mode,r=w.width[0],o=w.height}}s.currentScreenMode=i;const n={height:o===0?"100%":`${String(o)}px`,width:r===0?"100%":`${String(r)}px`,opacity:1};["editFull","editLimited"].includes(s.params.editMode)?(n.height="100%",n.width="100%"):s.params.itemEmbedding&&s.params.itemDimensions?(n.height=s.params.itemDimensions.height==="auto"?n.height:`${String(s.params.itemDimensions.height).replace("px","")}px`,n.width=s.params.itemDimensions.width==="auto"?n.width:`${String(s.params.itemDimensions.width).replace("px","")}px`):(n.height=o===0?"100%":`${String(o)}px`,n.width=r===0?"100%":`${String(r)}px`),s.currentScreenMode=i,s.iframeStyle=n},$t=s=>{const e=Object.keys(B),t=[],i=["appServer","language","apiHost"],r=["key","token","screenMode","timezoneId","itemId","container","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground"],o=["itemDimensions"],n=["mobile","tablet","desktop","largeScreen","fixed","auto"];for(const a of e)s.params[a]===null&&delete s.params[a];s.params=at(s.params,B),(!s.params.dashboardId||typeof s.params.dashboardId!="string")&&(!s.params.dashboardSlug||typeof s.params.dashboardSlug!="string")&&(delete s.params.dashboardId,delete s.params.dashboardSlug);for(const a of i)typeof s.params[a]!="string"&&(delete s.params[a],t.push(`${a} needs to be of type string.`));for(const a of r)typeof s.params[a]!="string"&&s.params[a]!==null&&s.params[a]!==void 0&&(delete s.params[a],t.push(`${a} needs to be of type string or empty.`));if(s.params.screenMode&&!n.includes(s.params.screenMode)){const a=n.map(l=>`"${l}"`).join(", ");t.push(`"screenMode" needs should be one of these types: ${a}`),s.params.screenMode="auto"}s.params.itemId&&(s.params.itemEmbedding=!0);for(const a of o)typeof s.params[a]!="object"&&s.params[a]!==null&&(delete s.params[a],t.push(`${a} needs to be of type object or empty.`));if(typeof s.params.switchScreenModeOnResize!="boolean"&&(t.push("switchScreenModeOnResize needs to be of type boolean."),s.params.switchScreenModeOnResize=!0),s.params.itemDimensions){const a=["width","height"];for(const l of a)!["string","number"].includes(typeof s.params.itemDimensions[l])&&s.params.itemDimensions[l]!==null&&t.push(`itemDimensions ${l} needs to be of type string, number or empty.`)}s.params=at(s.params,B),s.params.screenMode&&s.params.screenMode!=="auto"&&(s.params.switchScreenModeOnResize=!1),s.params.itemDimensions.width!=="auto"&&(s.params.itemDimensions.width=Number.parseInt(`${s.params.itemDimensions.width}`.replace("px",""),10)||"auto"),s.params.itemDimensions.height!=="auto"&&(s.params.itemDimensions.height=Number.parseInt(`${s.params.itemDimensions.height}`.replace("px",""),10)||"auto"),s.params.itemEmbedding=!!s.params.itemId,(s.params.error||t.length>0)&&gt(t.join(`
23
+ `),s.params)},tt={type:"type",slots:"slots",options:"options",appServer:"app-server",apiHost:"api-host",authKey:"auth-key",authToken:"auth-token",contextId:"context-id",canFilter:"can-filter",filters:"filters",dashboardId:"dashboard-id",itemId:"item-id",dashboardContentsVersion:"dashboard-contents-version",libVersion:"lib-version"},lt="luzmo-embed-container",Se={},Ms=async(s,e)=>{const t=typeof s=="function"?await s():s,i=document.createElement("script");i.type="text/javascript",i.addEventListener("load",e),i.src=t,document.querySelectorAll("head")[0].append(i)},Wt=s=>({});async function Ds(s){const e=Se[s];if(e.inited)return e.lib;if(e.format==="var")return new Promise(t=>{const i=()=>{e.inited||(e.lib=window[s],e.lib.init(Wt(e.from)),e.inited=!0),t(e.lib)};return Ms(e.url,i)});if(["esm","systemjs"].includes(e.format))return new Promise((t,i)=>{(typeof e.url=="function"?e.url:()=>Promise.resolve(e.url))().then(o=>{import(o).then(n=>{if(!e.inited){const a=Wt(e.from);n.init(a),e.lib=n,e.lib.init(a),e.inited=!0}t(e.lib)}).catch(i)})})}function Cs(s,e){if(!(s!=null&&s.default)&&e){const t=Object.create(null);return t.default=s,t.__esModule=!0,t}return s}async function Ts(s,e){return Ds(s).then(t=>t.get(e).then(i=>i()))}async function ae(s,e="DashboardApp"){const t=s+e;if(Se[t])return Se[t].module;let i=`${te(s)}/remoteEntry.mjs`;if(!s.startsWith("http://localhost"))switch(e){case"DashboardApp":case"VizItemApp":{i=`${te(s)}/dashboard-app/remoteEntry.mjs`;break}case"IQApp":{i=`${te(s)}/iq-components/remoteEntry.mjs`;break}}Se[t]={url:i,format:"esm",from:"vite",module:void 0};const r=await Ts(t,`./${e}`),o=Cs(r,!0);return Se[t].module=o,o}var Is=Object.defineProperty,f=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Is(e,t,r),r},pe="6.4.3",Ls=class{constructor(){this._components=[]}},dt=new Ls,Hs=()=>{typeof window.__luzmoMessageHandler!="function"&&(window.__luzmoMessageHandler=s=>{var t,i;const e=dt._components.find(r=>s.data.name===r._iframeId);if(e)switch((t=s.data)==null?void 0:t.type){case"load":{e.dispatchEvent(new CustomEvent("load",{detail:{data:s.data}})),e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e.dimensions=s.data.dimensions,e._calculateDimAfterDashboardLoaded();break}case"error":{e.dashboardError=!0,e._loadTimeoutHandle&&(clearTimeout(e._loadTimeoutHandle),e._loadTimeoutHandle=void 0),e.iframeLoaded=!0,e._displayError(),console.error("Dashboard error:",s.data.errorMsg??((i=s.data.error)==null?void 0:i.msg));break}case"data":{ce(e,s.data.requestId,s.data.data);break}case"filters":{ce(e,s.data.requestId,s.data.filters);break}case"getAccessibleDashboards":{ce(e,s.data.requestId,s.data.accessibleDashboards);break}case"dashboardAction":{e.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:s.data}}));break}case"export":{s.data.error?He(e,s.data.requestId,s.data):(e.dispatchEvent(new CustomEvent("exported",{detail:{data:s.data}})),ce(e,s.data.requestId,s.data));break}case"changedFilters":{e.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:s.data}}));break}case"customEvent":{e.dispatchEvent(new CustomEvent("customEvent",{detail:{data:s.data}}));break}case"chartsRendered":case"itemsRendered":{s.data.type="itemsRendered",e.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:s.data}}));break}case"setEditMode":{s.data.error?He(e,s.data.requestId,s.data):(ce(e,s.data.requestId,s.data),e.params.editMode=s.data.editMode,e._containerStyle=di(e),e.dimensions&&Ae(e));break}case"calculatedDimensions":{e.dimensions=s.data.dimensions,Ae(e);break}case"setSelectedData":case"setFilters":{s.data.error?He(e,s.data.requestId,s.data):ce(e,s.data.requestId,s.data);break}case"setPreview":{s.data.error?He(e,s.data.requestId,s.data):ce(e,s.data.requestId,s.data);break}}},window.addEventListener("message",window.__luzmoMessageHandler,!1))},Ns=k.css`
24
24
  :host {
25
25
  display: block;
26
26
  height: 100%;
@@ -133,29 +133,29 @@ ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.do
133
133
  position: absolute;
134
134
  transition-duration: 0.3s;
135
135
  }
136
- `,Bt="DashboardApp",v=class extends _.LitElement{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=le+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=de(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{if(this.shadowRoot?.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const s of ni)s.width[0]<=window.innerWidth&&window.innerWidth<=s.width[1]&&(this.currentScreenMode=s.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,xe(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){this._loaderMsg=Lt(this)?.loadingMsg,this._loaderStyles(),nt._dashboardComponents.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){this.params=this._setOptions(),this.isWebComponentViewMode()?te(this.params.appServer,Bt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const s=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=s.cloneNode(!0),s.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",e=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=e.detail.dimensions,xe(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",e))}),this.dashboardReference.addEventListener("itemsRendered",e=>this.dispatchEvent(new CustomEvent("itemsRendered",e))),this.dashboardReference.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.dashboardReference.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.dashboardReference.addEventListener("dashboardAction",e=>this.dispatchEvent(new CustomEvent("dashboardAction",e))),this.dashboardReference.addEventListener("export",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.setAllAttributes()}):(this.containerWidth=this.container?.clientWidth,Wt(this),hs(this),this._setupLoader(),this.params.error||(this._loaderStyles(),Hs(),this._iframeUrl=Tt(this),this.iframe?.setAttribute("src",this._iframeUrl),this.iframeStyle=Ht(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",X(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const r of t)i=i||s.get(r)===void 0&&this[r]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[r]of s.entries())if(r==="appSever")te(s[r],Bt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[r]){const o=this.attributesMap[r]??r,n=typeof this[r]=="object"?JSON.stringify(this[r]):this[r]?.toString()||this[r];this.dashboardReference.setAttribute(o,n)}}}else for(const[r]of s.entries())e.has(r)&&r!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),Wt(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=Tt(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=Ht(this)):e.has(r)&&r==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?X(this.appServer):ze(this.appServer),s.appServer=this.appServer):(this.appServer=ze(O.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?X(this.apiHost):ze(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){vs(this.iframe,this._iframeUrl)}_setupLoader(){const s=Lt(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),xe(this)}_loaderStyles(){this._containerStyle=ai(this),this._loaderStyle=fs(this),this._loadingCircleStyle=ys(this),this._containerLoaderStyle=gs(this),this._lcStyle=bs(this)}static get styles(){return[Ns]}render(){let s;const e=_.html`
136
+ `,Bt="DashboardApp",E=class extends k.LitElement{constructor(){super(),this.language="auto",this.editorLanguage="auto",this.screenMode="auto",this.switchScreenModeOnResize=!0,this.editMode="view",this.embedMode="iframe",this.iframeStyle={},this._containerStyle={},this._loaderStyle={},this._lcStyle={},this._loadingCircleStyle={},this._containerLoaderStyle={},this._loaderMsg="",this._itemEmbedding=!1,this.browserError=!1,this.browserErrorMsg="",this.dashboardError=!1,this.browserNotSupported=[],this.libVersion=pe+"-wc-luzmo",this.isLibraryLoaded=!1,this.currentAuthKey=null,this.currentAuthToken=null,this.isInitCalled=!1,this.attributesMap={dashboardId:"dashboard-id",dashboardSlug:"dashboard-slug",itemId:"item-id",language:"language",editorLanguage:"editorLanguage",qeVersion:"qe-version",screenMode:"screen-mode",switchScreenModeOnResize:"switch-screen-mode-on-resize",authKey:"auth-key",authToken:"auth-token",editMode:"edit-mode",theme:"theme",mainColor:"main-color",accentColor:"accent-color",loaderBackground:"loader-background",loaderFontColor:"loader-font-color",loaderSpinnerColor:"loader-spinner-color",loaderSpinnerBackground:"loader-spinner-background",appServer:"app-server",apiHost:"api-host",itemDimensions:"item-dimensions",timezoneId:"timezone-id"},this.loaderSize=32,this.borderWidth=3,this.minHeight=400,this._containerId=ge(),this._iframeId=`luzmo-dashboard-${this._containerId}`,this.iframeLoaded=!1,this.promises={},this.params=this._setOptions(),this._onResize=()=>{var s;if((s=this.shadowRoot)!=null&&s.querySelector(".dashboard-container")){if(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,this.params.switchScreenModeOnResize&&this.params.screenMode==="auto")for(const e of li)e.width[0]<=window.innerWidth&&window.innerWidth<=e.width[1]&&(this.currentScreenMode=e.mode);this.iframeLoaded?this._calculateDimAfterDashboardLoaded():this.dimensions&&(this.containerWidth=this.luzmoEmbedContainer.offsetWidth,Ae(this))}},this._resizeObserver=new ResizeObserver(s=>{window.requestAnimationFrame(()=>{!Array.isArray(s)||s.length===0||this._onResize()})})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect();for(const s of Object.keys(this.promises))this.promises[s].reject(new Error("Dashboard component was removed"))}firstUpdated(){var s;this._loaderMsg=(s=Lt(this))==null?void 0:s.loadingMsg,this._loaderStyles(),dt._components.push(this),this.luzmoEmbedContainer&&this._resizeObserver.observe(this.luzmoEmbedContainer)}initComponent(){var s,e;this.params=this._setOptions(),this.isWebComponentViewMode()?ae(this.params.appServer,Bt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete;const t=this.renderRoot.querySelector("dashboard-component");this.dashboardReference=t.cloneNode(!0),t.replaceWith(this.dashboardReference),this.dashboardReference.addEventListener("load",i=>{this.containerWidth=this.dashboardReference.offsetWidth,this.dimensions=i.detail.dimensions,Ae(this),window.dispatchEvent(new Event("resize")),this.dispatchEvent(new CustomEvent("load",i))}),this.dashboardReference.addEventListener("itemsRendered",i=>this.dispatchEvent(new CustomEvent("itemsRendered",i))),this.dashboardReference.addEventListener("customEvent",i=>this.dispatchEvent(new CustomEvent("customEvent",i))),this.dashboardReference.addEventListener("changedFilters",i=>this.dispatchEvent(new CustomEvent("changedFilters",i))),this.dashboardReference.addEventListener("dashboardAction",i=>this.dispatchEvent(new CustomEvent("dashboardAction",i))),this.dashboardReference.addEventListener("export",i=>this.dispatchEvent(new CustomEvent("exported",i))),this.setAllAttributes()}):(this.containerWidth=(s=this.container)==null?void 0:s.clientWidth,$t(this),cs(this),this._setupLoader(),this.params.error||(this._loaderStyles(),Hs(),this._iframeUrl=It(this),(e=this.iframe)==null||e.setAttribute("src",this._iframeUrl),this.iframeStyle=Ht(this)))}setAllAttributes(){if(this.dashboardReference){for(const s in this.attributesMap)!["authKey","authToken","apiHost","itemDimensions"].includes(s)&&this.params[s]&&this.dashboardReference.setAttribute(this.attributesMap[s],this.params[s]);this.params.itemDimensions&&this.dashboardReference.setAttribute("item-dimensions",JSON.stringify(this.params.itemDimensions)),this.params.apiHost&&this.dashboardReference.setAttribute("api-host",te(this.params.apiHost)),this.params.key&&this.dashboardReference.setAttribute("auth-key",this.params.key),this.params.token&&this.dashboardReference.setAttribute("auth-token",this.params.token)}}updated(s){var r;const e=new Set(["dashboardId","dashboardSlug","itemId","language","editorLanguage","qeVersion","theme","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","apiHost","timezoneId","itemDimensions"]),t=["dashboardId","dashboardSlug","itemId"];let i=!1;for(const o of t)i=i||s.get(o)===void 0&&this[o]!==void 0;if(i&&!this.isInitCalled){this.initComponent(),this.isInitCalled=!0;return}if(this.isWebComponentViewMode()){if(this.dashboardReference){for(const[o]of s.entries())if(o==="appSever")ae(s[o],Bt).then(async()=>{this.isLibraryLoaded=!0,await this.updateComplete,this.dashboardReference=this.renderRoot.querySelector("dashboard-component"),this.setAllAttributes()});else if(this.attributesMap[o]){const n=this.attributesMap[o]??o,a=typeof this[o]=="object"?JSON.stringify(this[o]):((r=this[o])==null?void 0:r.toString())||this[o];this.dashboardReference.setAttribute(n,a)}}}else for(const[o]of s.entries())e.has(o)&&o!=="editMode"?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout(()=>{console.warn("Failed to load dashboard, appServer is likely down or unreachable.")},15*1e3),this.params=this._setOptions(),$t(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=It(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=Ht(this)):e.has(o)&&o==="editMode"&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}_setOptions(){const s={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(s.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(s.language=this.language),this.editorLanguage&&(s.editorLanguage=this.editorLanguage),this.qeVersion&&(s.qeVersion=this.qeVersion),this.screenMode&&(s.screenMode=this.screenMode),s.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(s.token=this.authToken),this.authKey&&(s.key=this.authKey),this.editMode&&(s.editMode=this.editMode),this.theme&&(s.theme=this.theme),this.mainColor&&(s.mainColor=this.mainColor),this.accentColor&&(s.accentColor=this.accentColor),this.loaderBackground&&(s.loaderBackground=this.loaderBackground),this.loaderFontColor&&(s.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(s.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(s.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(s.timezoneId=this.timezoneId),this.itemDimensions&&(s.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=this.isWebComponentViewMode()?te(this.appServer):Re(this.appServer),s.appServer=this.appServer):(this.appServer=Re(B.appServer),s.appServer=this.appServer),this.apiHost?(this.apiHost=this.isWebComponentViewMode()?te(this.apiHost):Re(this.apiHost),s.apiHost=this.apiHost):(this.apiHost=this.appServer.includes("luzmo.com")?this.appServer.replace("app","api"):this.appServer,s.apiHost=this.apiHost),this.currentAuthKey=this.authKey,this.currentAuthToken=this.authToken,s}_updateIframeUrl(){ws(this.iframe,this._iframeUrl)}_setupLoader(){const s=Lt(this);this._loaderMsg=s.loadingMsg,s.errorMsg&&(this.browserError=!0,this.browserErrorMsg=s.errorMsg,this._displayError())}_displayError(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}_calculateDimAfterDashboardLoaded(){this.dashboardError=!1,this._loaderStyles(),Ae(this)}_loaderStyles(){this._containerStyle=di(this),this._loaderStyle=ys(this),this._loadingCircleStyle=bs(this),this._containerLoaderStyle=fs(this),this._lcStyle=vs(this)}static get styles(){return[Ns]}render(){let s;const e=k.html`
137
137
  <div
138
138
  class="luzmo-container-loader"
139
139
  id="luzmo-container-loader-${this._containerId}"
140
- style=${re.styleMap(this._containerLoaderStyle)}
140
+ style=${he.styleMap(this._containerLoaderStyle)}
141
141
  >
142
142
  <div
143
143
  class="luzmo-loader"
144
144
  id="luzmo-loader-${this._containerId}"
145
- style=${re.styleMap(this._loaderStyle)}
145
+ style=${he.styleMap(this._loaderStyle)}
146
146
  >
147
147
  <div
148
148
  class="luzmo-lc"
149
- style=${re.styleMap(this._lcStyle)}
149
+ style=${he.styleMap(this._lcStyle)}
150
150
  >
151
151
  <div
152
152
  class="luzmo-loading-circle"
153
- style=${re.styleMap(this._loadingCircleStyle)}
153
+ style=${he.styleMap(this._loadingCircleStyle)}
154
154
  ></div>
155
- ${this._itemEmbedding?"":_.html`
155
+ ${this._itemEmbedding?"":k.html`
156
156
  <div
157
157
  class="luzmo-loading-message"
158
- style=${re.styleMap({color:this.loaderFontColor})}
158
+ style=${he.styleMap({color:this.loaderFontColor})}
159
159
  >
160
160
  ${this._loaderMsg}
161
161
  </div>
@@ -163,43 +163,43 @@ ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.do
163
163
  </div>
164
164
  </div>
165
165
  </div>
166
- `;return this.isWebComponentViewMode()?s=this.isLibraryLoaded?_.html`
167
- ${this.dashboardId||this.dashboardSlug?_.html`
166
+ `;return this.isWebComponentViewMode()?s=this.isLibraryLoaded?k.html`
167
+ ${this.dashboardId||this.dashboardSlug?k.html`
168
168
  <dashboard-component dashboard-id="${this.params.dashboardId}" app-server="${this.params.appServer}"
169
169
  api-host="${this.params.apiHost}"></dashboard-component>
170
- `:_.html`
170
+ `:k.html`
171
171
  <div id="luzmo-error-${this._containerId}">
172
172
  <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
173
173
  </div>
174
174
  `}
175
- `:_.html`${e}`:s=_.html`
176
- ${this.dashboardId||this.dashboardSlug?_.html`
175
+ `:k.html`${e}`:s=k.html`
176
+ ${this.dashboardId||this.dashboardSlug?k.html`
177
177
  ${e}
178
178
  <iframe
179
179
  class="luzmo-embed-dashboard ${this.isWebComponentViewMode()?"":"luzmo-embed-dashboard-ede"}"
180
180
  id="${this._iframeId}"
181
181
  name="${this._iframeId}"
182
- style=${re.styleMap(this.iframeStyle)}
182
+ style=${he.styleMap(this.iframeStyle)}
183
183
  src="${this._iframeUrl}"
184
184
  frameborder="0"
185
185
  ></iframe>
186
- `:_.html`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
187
- ${this.browserError?_.html`
186
+ `:k.html`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
187
+ ${this.browserError?k.html`
188
188
  <div id="luzmo-error-${this._containerId}">
189
189
  <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
190
190
  </div>
191
191
  `:""}
192
- `,_.html`
193
- <div class="${ot} ${this.isWebComponentViewMode()?"":`${ot}-ede`}">
192
+ `,k.html`
193
+ <div class="${lt} ${this.isWebComponentViewMode()?"":`${lt}-ede`}">
194
194
  <div
195
195
  class="dashboard-container"
196
- style=${re.styleMap(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
196
+ style=${he.styleMap(Object.assign({},this._containerStyle,{width:this.iframeStyle.width??"100%",height:this.iframeStyle.height??"100%"}))}
197
197
  >
198
198
  ${s}
199
199
  </div>
200
200
  </div>
201
201
 
202
- `}getDashboards(){return new Promise(s=>s(nt._dashboardComponents))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():_s(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():Es(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():As(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():ks(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?Pt(this,this.iframe,s):Pt(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():zs(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?Ot(this,this.iframe,s):Ot(this,this.iframe)}getAccessibleDashboards(){return ws(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():Ss(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):Rs(this,this.iframe,s)}sendExportEmail(s,e,t){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.sendExportEmail(s,e,t):this.isWebComponentViewMode()?Promise.reject():xs(this,this.iframe,s,e,t)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};g([m.query(".dashboard-container")],v.prototype,"container");g([m.query(`.${ot}`)],v.prototype,"luzmoEmbedContainer");g([m.query("iframe")],v.prototype,"iframe");g([m.property()],v.prototype,"dashboardId");g([m.property()],v.prototype,"dashboardSlug");g([m.property()],v.prototype,"itemId");g([m.property()],v.prototype,"language");g([m.property()],v.prototype,"editorLanguage");g([m.property()],v.prototype,"qeVersion");g([m.property()],v.prototype,"screenMode");g([m.property({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],v.prototype,"switchScreenModeOnResize");g([m.property()],v.prototype,"editMode");g([m.property()],v.prototype,"theme");g([m.property()],v.prototype,"mainColor");g([m.property()],v.prototype,"accentColor");g([m.property()],v.prototype,"authToken");g([m.property()],v.prototype,"authKey");g([m.property()],v.prototype,"loaderBackground");g([m.property()],v.prototype,"loaderFontColor");g([m.property()],v.prototype,"loaderSpinnerColor");g([m.property()],v.prototype,"loaderSpinnerBackground");g([m.property()],v.prototype,"appServer");g([m.property()],v.prototype,"timezoneId");g([m.property()],v.prototype,"apiHost");g([m.property({type:Object})],v.prototype,"itemDimensions");g([m.property()],v.prototype,"embedMode");g([m.property({attribute:!1})],v.prototype,"_containerId");g([m.property({attribute:!1})],v.prototype,"_iframeId");g([m.property({attribute:!1})],v.prototype,"params");g([m.property({attribute:!1})],v.prototype,"_iframeUrl");g([m.property({attribute:!1})],v.prototype,"iframeLoaded");g([m.property({attribute:!1})],v.prototype,"promises");g([m.property({attribute:!1})],v.prototype,"iframeStyle");g([m.property({attribute:!1})],v.prototype,"_containerStyle");g([m.property({attribute:!1})],v.prototype,"_loaderStyle");g([m.property({attribute:!1})],v.prototype,"_lcStyle");g([m.property({attribute:!1})],v.prototype,"_loadingCircleStyle");g([m.property({attribute:!1})],v.prototype,"_containerLoaderStyle");g([m.property({attribute:!1})],v.prototype,"_loaderMsg");g([m.property({attribute:!1})],v.prototype,"containerWidth");g([m.property({attribute:!1})],v.prototype,"dimensions");g([m.property({attribute:!1})],v.prototype,"currentScreenMode");g([m.property({attribute:!1})],v.prototype,"_itemEmbedding");g([m.property({attribute:!1})],v.prototype,"browserError");g([m.property({attribute:!1})],v.prototype,"browserErrorMsg");g([m.property({attribute:!1})],v.prototype,"dashboardError");g([m.property({attribute:!1})],v.prototype,"browserNotSupported");g([m.property()],v.prototype,"libVersion");g([m.state()],v.prototype,"isLibraryLoaded");g([m.state()],v.prototype,"dashboardReference");g([m.state()],v.prototype,"currentAuthKey");g([m.state()],v.prototype,"currentAuthToken");g([m.state()],v.prototype,"isInitCalled");var Os=class extends v{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",Os);var Ps="0.1.98",Ut="VizItemApp",me,I=(me=class extends _.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=le+"-wc-luzmo",this.dashboardContentsVersion=Ps,this.libVersion=le+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await te(this.appServer,Ut),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{if(this.postInitCallQueue?.length>0)for(const t of this.postInitCallQueue)t[0].bind(this)(...t[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in Qe){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?X(t):t;this.chartElement.setAttribute(Qe[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){if(this.chartElement)for(const[t]of e.entries()){const i=Qe[t]??t,r=typeof this[t]=="object"?JSON.stringify(this[t]):this[t]?.toString()??this[t];this.chartElement.setAttribute(i,r)}else this.canInitializeVizItem()&&(await te(this.appServer,Ut),this.createAndAppendElement())}render(){return _.html` `}},me.styles=_.css`
202
+ `}getDashboards(){return new Promise(s=>s(dt._components))}getData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getData(s):this.isWebComponentViewMode()?Promise.reject():Es(this,this.iframe,s)}getFilters(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.getFilters():this.isWebComponentViewMode()?Promise.reject():zs(this,this.iframe)}setSelectedData(s,e){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setSelectedData(s,e):this.isWebComponentViewMode()?Promise.reject():Rs(this,this.iframe,s,e)}setAuthorization(s,e){return this.currentAuthKey=s,this.currentAuthToken=e,this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setAuthorization(s,e):this.isWebComponentViewMode()?Promise.reject():ks(this,this.iframe,s,e)}refreshData(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.refreshData(s):this.isWebComponentViewMode()?Promise.reject():s?Pt(this,this.iframe,s):Pt(this,this.iframe)}reloadDashboard(){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.reloadDashboard():this.isWebComponentViewMode()?Promise.reject():xs(this,this.iframe)}exportDashboard(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.exportDashboard(s):this.isWebComponentViewMode()?Promise.reject():s?Ot(this,this.iframe,s):Ot(this,this.iframe)}getAccessibleDashboards(){return _s(this)}addFilters(s,e){return this.dashboardReference.addFilters(s,e)}setEditMode(s){return this.dashboardReference&&s==="view"?(this.editMode="view",this.params.editMode="view",this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.dashboardReference&&["editFull","editLimited"].includes(s)?(this.editMode=s,this.params.editMode=s,this.initComponent(),Promise.resolve({type:"setEditMode",editMode:s})):this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setEditMode(s):this.isWebComponentViewMode()?Promise.reject():Ss(this,this.iframe,s)}setPreview(s){return this.isWebComponentViewMode()&&this.dashboardReference?this.dashboardReference.setPreview(s):As(this,this.iframe,s)}isWebComponentViewMode(){return this.embedMode==="webComponent"&&(this.params.editMode==="view"||this.params.editMode===void 0)}};f([p.query(".dashboard-container")],E.prototype,"container");f([p.query(`.${lt}`)],E.prototype,"luzmoEmbedContainer");f([p.query("iframe")],E.prototype,"iframe");f([p.property()],E.prototype,"dashboardId");f([p.property()],E.prototype,"dashboardSlug");f([p.property()],E.prototype,"itemId");f([p.property()],E.prototype,"language");f([p.property()],E.prototype,"editorLanguage");f([p.property()],E.prototype,"qeVersion");f([p.property()],E.prototype,"screenMode");f([p.property({converter:{fromAttribute:s=>s==="true",toAttribute:String}})],E.prototype,"switchScreenModeOnResize");f([p.property()],E.prototype,"editMode");f([p.property()],E.prototype,"theme");f([p.property()],E.prototype,"mainColor");f([p.property()],E.prototype,"accentColor");f([p.property()],E.prototype,"authToken");f([p.property()],E.prototype,"authKey");f([p.property()],E.prototype,"loaderBackground");f([p.property()],E.prototype,"loaderFontColor");f([p.property()],E.prototype,"loaderSpinnerColor");f([p.property()],E.prototype,"loaderSpinnerBackground");f([p.property()],E.prototype,"appServer");f([p.property()],E.prototype,"timezoneId");f([p.property()],E.prototype,"apiHost");f([p.property({type:Object})],E.prototype,"itemDimensions");f([p.property()],E.prototype,"embedMode");f([p.property({attribute:!1})],E.prototype,"_containerId");f([p.property({attribute:!1})],E.prototype,"_iframeId");f([p.property({attribute:!1})],E.prototype,"params");f([p.property({attribute:!1})],E.prototype,"_iframeUrl");f([p.property({attribute:!1})],E.prototype,"iframeLoaded");f([p.property({attribute:!1})],E.prototype,"promises");f([p.property({attribute:!1})],E.prototype,"iframeStyle");f([p.property({attribute:!1})],E.prototype,"_containerStyle");f([p.property({attribute:!1})],E.prototype,"_loaderStyle");f([p.property({attribute:!1})],E.prototype,"_lcStyle");f([p.property({attribute:!1})],E.prototype,"_loadingCircleStyle");f([p.property({attribute:!1})],E.prototype,"_containerLoaderStyle");f([p.property({attribute:!1})],E.prototype,"_loaderMsg");f([p.property({attribute:!1})],E.prototype,"containerWidth");f([p.property({attribute:!1})],E.prototype,"dimensions");f([p.property({attribute:!1})],E.prototype,"currentScreenMode");f([p.property({attribute:!1})],E.prototype,"_itemEmbedding");f([p.property({attribute:!1})],E.prototype,"browserError");f([p.property({attribute:!1})],E.prototype,"browserErrorMsg");f([p.property({attribute:!1})],E.prototype,"dashboardError");f([p.property({attribute:!1})],E.prototype,"browserNotSupported");f([p.property()],E.prototype,"libVersion");f([p.state()],E.prototype,"isLibraryLoaded");f([p.state()],E.prototype,"dashboardReference");f([p.state()],E.prototype,"currentAuthKey");f([p.state()],E.prototype,"currentAuthToken");f([p.state()],E.prototype,"isInitCalled");var Os=class extends E{};customElements.get("luzmo-embed-dashboard")||customElements.define("luzmo-embed-dashboard",Os);var Ps="0.1.95",Ut="VizItemApp",be,I=(be=class extends k.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.slots=[],this.version=pe+"-wc-luzmo",this.dashboardContentsVersion=Ps,this.libVersion=pe+"-wc-luzmo",this.postInitCallQueue=[]}createRenderRoot(){return this.style.display||(this.style.display="block"),this.style.height||(this.style.height="100%"),this.style.width||(this.style.width="100%"),this}canInitializeVizItem(){return!!(this.type||this.dashboardId&&this.itemId)}getFilters(){return this.chartElement.getFilters()}export(e="png"){return this.chartElement.export(e)}getData(){return this.chartElement.getData()}refreshData(){return this.chartElement.refreshData()}setSelectedData(e){return this.chartElement.setSelectedData(void 0,e)}setAuthorization(e,t){return this.chartElement.setAuthorization(e,t)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e==="selecteddata"&&(this.chartElement?this.setSelectedData(JSON.parse(i??"{}")):this.postInitCallQueue.push([this.setSelectedData,[JSON.parse(i??"{}")]]))}async firstUpdated(e){super.firstUpdated(e),this.canInitializeVizItem()&&(await ae(this.appServer,Ut),this.createAndAppendElement())}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("chart-component"),this.chartElement.setAttribute("embedding-mode","chart"),this.chartElement.style.height="100%",this.chartElement.style.width="100%",this.chartElement.style.display="block",this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.chartElement.addEventListener("rendered",e=>{var t;if(((t=this.postInitCallQueue)==null?void 0:t.length)>0)for(const i of this.postInitCallQueue)i[0].bind(this)(...i[1]);else this.selectedData&&this.setSelectedData(this.selectedData);this.dispatchEvent(new CustomEvent("rendered",e))}),this.chartElement.addEventListener("changedFilters",e=>this.dispatchEvent(new CustomEvent("changedFilters",e))),this.chartElement.addEventListener("exported",e=>this.dispatchEvent(new CustomEvent("exported",e))),this.chartElement.addEventListener("customEvent",e=>this.dispatchEvent(new CustomEvent("customEvent",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in tt){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(tt[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=tt[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else this.canInitializeVizItem()&&(await ae(this.appServer,Ut),this.createAndAppendElement())}render(){return k.html` `}},be.styles=k.css`
203
203
  :host {
204
204
  display: block;
205
205
  width: 100%;
@@ -211,21 +211,27 @@ ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.do
211
211
  height: 1000%;
212
212
  display: block;
213
213
  }
214
- `,me);g([m.property()],I.prototype,"appServer");g([m.property()],I.prototype,"apiHost");g([m.property({type:Array})],I.prototype,"slots");g([m.property({type:Object})],I.prototype,"options");g([m.property()],I.prototype,"type");g([m.property()],I.prototype,"authKey");g([m.property()],I.prototype,"authToken");g([m.property()],I.prototype,"version");g([m.property()],I.prototype,"contextId");g([m.property({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],I.prototype,"canFilter");g([m.property({type:Array})],I.prototype,"filters");g([m.property()],I.prototype,"dashboardId");g([m.property()],I.prototype,"itemId");g([m.property({type:Object})],I.prototype,"selectedData");g([m.property()],I.prototype,"dashboardContentsVersion");g([m.property()],I.prototype,"libVersion");var Ws=class extends I{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",Ws);var Ze={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},at="luzmo-iq-embed-chat",Ft="luzmo-iq-chat-component",pe,N=(pe=class extends _.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=le+"-wc-luzmo",this.libVersion=le+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await te(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement(Ft),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in Ze){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?X(t):t;this.chartElement.setAttribute(Ze[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){if(this.chartElement)for(const[t]of e.entries()){const i=Ze[t]??t,r=typeof this[t]=="object"?JSON.stringify(this[t]):this[t]?.toString()??this[t];this.chartElement.setAttribute(i,r)}else await te(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return _.html``}connectedCallback(){super.connectedCallback();const e=document.querySelector(at);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector(Ft);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},pe.styles=_.css`
214
+ `,be);f([p.property()],I.prototype,"appServer");f([p.property()],I.prototype,"apiHost");f([p.property({type:Array})],I.prototype,"slots");f([p.property({type:Object})],I.prototype,"options");f([p.property()],I.prototype,"type");f([p.property()],I.prototype,"authKey");f([p.property()],I.prototype,"authToken");f([p.property()],I.prototype,"version");f([p.property()],I.prototype,"contextId");f([p.property({converter:s=>{try{return JSON.parse(s)}catch{return s}}})],I.prototype,"canFilter");f([p.property({type:Array})],I.prototype,"filters");f([p.property()],I.prototype,"dashboardId");f([p.property()],I.prototype,"itemId");f([p.property({type:Object})],I.prototype,"selectedData");f([p.property()],I.prototype,"dashboardContentsVersion");f([p.property()],I.prototype,"libVersion");var $s=class extends I{};customElements.get("luzmo-embed-viz-item")||customElements.define("luzmo-embed-viz-item",$s);var it={aiEndpoint:"ai-endpoint",appServer:"app-server",apiHost:"api-host",options:"options",initialSuggestionsDatasetId:"initialSuggestionsDatasetId",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",aydHost:"ayd-host",availableDatasets:"available-datasets"},ht="luzmo-iq-embed-chat",Ft="luzmo-iq-chat-component",ve,$=(ve=class extends k.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=pe+"-wc-luzmo",this.libVersion=pe+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202/",this.aydHost="https://ayd.luzmo.com/",this.availableDatasets=[]}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ae(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement(Ft),this.chartElement.addEventListener("load",e=>this.dispatchEvent(new CustomEvent("load",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in it){const t=this[e];if(t){const i=["appServer","apiHost","aydHost"].includes(e)?te(t):t;this.chartElement.setAttribute(it[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=it[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ae(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return k.html``}connectedCallback(){super.connectedCallback();const e=document.querySelector(ht);if(!e)return;const t=new MutationObserver(()=>{const i=e.querySelector('*[slot="custom-chat-widget-content"]');if(!i)return;const r=e.querySelector(Ft);r&&(r.append(i),t.disconnect())});t.observe(e,{childList:!0,subtree:!0})}},ve.styles=k.css`
215
215
  :host {
216
216
  display: block;
217
217
  width: 100%;
218
218
  height: 100%;
219
219
  }
220
- `,pe);g([m.property()],N.prototype,"appServer");g([m.property()],N.prototype,"apiHost");g([m.property({type:Object})],N.prototype,"options");g([m.property({type:String})],N.prototype,"initialSuggestionsDatasetId");g([m.property()],N.prototype,"aiEndpoint");g([m.property()],N.prototype,"authKey");g([m.property()],N.prototype,"authToken");g([m.property()],N.prototype,"version");g([m.property()],N.prototype,"libVersion");g([m.property()],N.prototype,"remoteEntryServer");g([m.property()],N.prototype,"aydHost");g([m.property({type:Array})],N.prototype,"availableDatasets");customElements.get(at)||customElements.define(at,N);var et={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},Vt="luzmo-iq-embed-answer",ge,U=(ge=class extends _.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=le+"-wc-luzmo",this.libVersion=le+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await te(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in et){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?X(t):t;this.chartElement.setAttribute(et[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){if(this.chartElement)for(const[t]of e.entries()){const i=et[t]??t,r=typeof this[t]=="object"?JSON.stringify(this[t]):this[t]?.toString()??this[t];this.chartElement.setAttribute(i,r)}else await te(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return _.html` `}},ge.styles=_.css`
220
+ `,ve);f([p.property()],$.prototype,"appServer");f([p.property()],$.prototype,"apiHost");f([p.property({type:Object})],$.prototype,"options");f([p.property({type:String})],$.prototype,"initialSuggestionsDatasetId");f([p.property()],$.prototype,"aiEndpoint");f([p.property()],$.prototype,"authKey");f([p.property()],$.prototype,"authToken");f([p.property()],$.prototype,"version");f([p.property()],$.prototype,"libVersion");f([p.property()],$.prototype,"remoteEntryServer");f([p.property()],$.prototype,"aydHost");f([p.property({type:Array})],$.prototype,"availableDatasets");customElements.get(ht)||customElements.define(ht,$);var st={aiEndPoint:"ai-end-point",appServer:"app-server",apiHost:"api-host",options:"options",authKey:"auth-key",authToken:"auth-token",version:"version",libVersion:"lib-version",messages:"messages"},Vt="luzmo-iq-embed-answer",we,K=(we=class extends k.LitElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com",this.apiHost="https://api.luzmo.com",this.version=pe+"-wc-luzmo",this.libVersion=pe+"-wc-luzmo",this.remoteEntryServer="http://localhost:4202"}createRenderRoot(){return this}async firstUpdated(e){super.firstUpdated(e),await ae(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}get calculatedAppServer(){return this.appServer.startsWith("http://localhost")?this.remoteEntryServer:this.appServer}createAndAppendElement(){this.chartElement||(this.chartElement=document.createElement("luzmo-iq-answer-component"),this.chartElement.addEventListener("addQuestion",e=>this.dispatchEvent(new CustomEvent("addQuestion",e))),this.chartElement.addEventListener("addAnswer",e=>this.dispatchEvent(new CustomEvent("addAnswer",e))),this.updateVizItemProperties(),this.renderRoot.append(this.chartElement))}updateVizItemProperties(){if(this.chartElement)for(const e in st){const t=this[e];if(t){const i=["appServer","apiHost"].includes(e)?te(t):t;this.chartElement.setAttribute(st[e],typeof i=="object"?JSON.stringify(i):i)}}}async updated(e){var t;if(this.chartElement)for(const[i]of e.entries()){const r=st[i]??i,o=typeof this[i]=="object"?JSON.stringify(this[i]):((t=this[i])==null?void 0:t.toString())??this[i];this.chartElement.setAttribute(r,o)}else await ae(this.calculatedAppServer,"IQApp"),this.createAndAppendElement()}render(){return k.html` `}},we.styles=k.css`
221
221
  :host {
222
222
  display: block;
223
223
  width: 100%;
224
224
  height: 100%;
225
225
  }
226
- `,ge);g([m.property()],U.prototype,"appServer");g([m.property()],U.prototype,"apiHost");g([m.property({type:Object})],U.prototype,"options");g([m.property()],U.prototype,"aiEndPoint");g([m.property()],U.prototype,"authKey");g([m.property()],U.prototype,"authToken");g([m.property()],U.prototype,"messages");g([m.property()],U.prototype,"version");g([m.property()],U.prototype,"libVersion");g([m.property()],U.prototype,"remoteEntryServer");customElements.get(Vt)||customElements.define(Vt,U);_.LitElement.disableWarning?.("change-in-update");function $s(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class c{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return c.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&c.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(c.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:c.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=c.getScrollElement(e);if(!r)return;const o=e.getBoundingClientRect(),n=r.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,h=o.bottom-Math.min(n.bottom,a),l=o.top-Math.max(n.top,0),d=r.scrollTop;l<0&&i<0?e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:h>0&&i>0&&(e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=h>i?i:h),t.top+=r.scrollTop-d}static updateScrollResize(e,t,i){const r=c.getScrollElement(t),o=r.clientHeight,n=r===c.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,h=a<i,l=a>o-i;h?r.scrollBy({behavior:"smooth",top:a-i}):l&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=c.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=c.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=c.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");c.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class K{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let h=0;for(;i=i||this.collide(e,o,r.skip);){if(h++>this.nodes.length*2)throw new Error("Infinite collide check");let l;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...a};l=this._loading&&c.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&l?c.copyPos(t,e):!i.locked&&l&&r.pack&&(this._packNodes(),t.y=i.y+i.h,c.copyPos(e,t)),n=n||l}else l=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!l)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let h of i){if(h.locked||!h._rect)break;const l=h._rect;let d=Number.MAX_VALUE,u=Number.MAX_VALUE;r.y<l.y?d=(o.y+o.h-l.y)/l.h:r.y+r.h>l.y+l.h&&(d=(l.y+l.h-o.y)/l.h),r.x<l.x?u=(o.x+o.w-l.x)/l.w:r.x+r.w>l.x+l.w&&(u=(l.x+l.w-o.x)/l.w);const p=Math.min(u,d);p>a&&(a=p,n=h)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=c.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=c.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=c.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,h)=>{let l;n.locked||(n.autoPosition=!0,e==="list"&&a&&(l=h[a-1])),this.addNode(n,!1,l)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=c.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??K._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return c.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,c.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||c.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),c.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!c.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=c.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||c.samePos(e,e._orig)||(c.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const h=a%i,l=Math.floor(a/i);if(h+e.w>i)continue;const d={x:h,y:l,w:e.w,h:e.h};t.find(u=>c.isIntercepted(d,u))||((e.x!==h||e.y!==l)&&(e._dirty=!0),e.x=h,e.y=l,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new K({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(h=>h._id===n._id);a&&(c.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new K({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=c.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=c.copyPos({},e,!0);if(c.copyPos(o,t),this.nodeBoundFix(o,r),c.copyPos(t,o),!t.forceCollide&&c.samePos(e,t))return!1;const n=c.copyPos({},e),a=this.collideAll(e,o,t.skip);let h=!0;if(a.length){const l=e._moving&&!t.nested;let d=l?this.directionCollideCoverage(e,t,a):a[0];if(l&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const u=c.areaIntercept(t.rect,d._rect),p=c.area(t.rect),f=c.area(d._rect);u/(p<f?p:f)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?h=!this._fixCollisions(e,o,d,t):(h=!1,i&&delete t.pack)}return h&&!c.samePos(e,o)&&(e._dirty=!0,c.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!c.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t,i){const r=this._layouts?.length||0;let o;r&&(i?i!==this.column&&(o=this._layouts[i]):this.column!==r-1&&(o=this._layouts[r-1]));const n=[];return this.sortNodes(),this.nodes.forEach(a=>{const h=o?.find(d=>d._id===a._id),l={...a,...h||{}};c.removeInternalForSave(l,!e),t&&t(a,l),n.push(l)}),n}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:c.sort(this.nodes,-1);if(t>e&&this._layouts){const a=this._layouts[t]||[],h=this._layouts.length-1;!a.length&&e!==h&&this._layouts[h]?.length&&(e=h,this._layouts[h].forEach(l=>{const d=n.find(u=>u._id===l._id);d&&(!r&&!l.autoPosition&&(d.x=l.x??d.x,d.y=l.y??d.y),d.w=l.w??d.w,(l.x==null||l.y===void 0)&&(d.autoPosition=!0))})),a.forEach(l=>{const d=n.findIndex(u=>u._id===l._id);if(d!==-1){const u=n[d];if(r){u.w=l.w;return}(l.autoPosition||isNaN(l.x)||isNaN(l.y))&&this.findEmptyPosition(l,o),l.autoPosition||(u.x=l.x??u.x,u.y=l.y??u.y,u.w=l.w??u.w,o.push(u)),n.splice(d,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const a=r||i==="none"?1:t/e,h=i==="move"||i==="moveScale",l=i==="scale"||i==="moveScale";n.forEach(d=>{d.x=t===1?0:h?Math.round(d.x*a):Math.min(d.x,t-1),d.w=t===1||e===1?1:l?Math.round(d.w*a)||1:Math.min(d.w,t),o.push(d)}),n=[]}o=c.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(a=>{this.addNode(a,!1),delete a._orig})}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(h=>h.id===o.id):void 0;o._id=a?._id??K._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??K._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}K._idSeq=0;const L={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class w{}const W=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class F{}function He(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s.changedTouches[0],e))}function li(s,e){s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s,e)}function Ne(s){F.touchHandled||(F.touchHandled=!0,He(s,"mousedown"))}function Oe(s){F.touchHandled&&He(s,"mousemove")}function Pe(s){if(!F.touchHandled)return;F.pointerLeaveTimeout&&(window.clearTimeout(F.pointerLeaveTimeout),delete F.pointerLeaveTimeout);const e=!!w.dragElement;He(s,"mouseup"),e||He(s,"click"),F.touchHandled=!1}function We(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Gt(s){w.dragElement&&s.pointerType!=="mouse"&&li(s,"mouseenter")}function qt(s){w.dragElement&&s.pointerType!=="mouse"&&(F.pointerLeaveTimeout=window.setTimeout(()=>{delete F.pointerLeaveTimeout,li(s,"mouseleave")},10))}class Ge{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ge.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),W&&(this.el.addEventListener("touchstart",Ne),this.el.addEventListener("pointerdown",We)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),W&&(this.el.removeEventListener("touchstart",Ne),this.el.removeEventListener("pointerdown",We)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(this.el.addEventListener("touchmove",Oe),this.el.addEventListener("touchend",Pe)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&(this.el.removeEventListener("touchmove",Oe),this.el.removeEventListener("touchend",Pe)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ge.prefix="ui-resizable-";class mt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class Se extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),w.overResizeElement===this&&delete w.overResizeElement),this}_mouseOver(e){w.overResizeElement||w.dragElement||(w.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){w.overResizeElement===this&&(delete w.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ge(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=c.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=c.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=c.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=c.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=c.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Se._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=c.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Se._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,h;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,h=!0);const l=this._constrainSize(r.width,r.height,a,h);return Math.round(r.width)!==Math.round(l.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-l.width),r.width=l.width),Math.round(r.height)!==Math.round(l.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-l.height),r.height=l.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,h=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,l=o.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),u=Math.min(h,Math.max(l,t));return{width:d,height:u}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}Se._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Bs='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Re extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),W&&(e.addEventListener("touchstart",Ne),e.addEventListener("pointerdown",We))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),W&&(t.removeEventListener("touchstart",Ne),t.removeEventListener("pointerdown",We))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!w.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Bs)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete w.dragElement,delete w.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(e.currentTarget.addEventListener("touchmove",Oe),e.currentTarget.addEventListener("touchend",Pe)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),w.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=c.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),w.pauseDrag){const i=Number.isInteger(w.pauseDrag)?w.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,w.dragElement=this;const i=this.el.gridstackNode?.grid;i?w.dropElement=i.el.ddElement.ddDroppable:delete w.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=c.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=c.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Oe,!0),e.currentTarget.removeEventListener("touchend",Pe,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),w.dropElement?.el===this.el.parentElement&&delete w.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=c.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),w.dropElement&&w.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete w.dragElement,delete w.dropElement,delete w.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||w.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!c.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",c.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=c.cloneNode(this.el)),e.parentElement||c.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Re.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",Re.originStyleProp.forEach(r=>t.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Re.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Us extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),W&&(this.el.addEventListener("pointerenter",Gt),this.el.addEventListener("pointerleave",qt)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),W&&(this.el.removeEventListener("pointerenter",Gt),this.el.removeEventListener("pointerleave",qt)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!w.dragElement||!this._canDrop(w.dragElement.el))return;e.preventDefault(),e.stopPropagation(),w.dropElement&&w.dropElement!==this&&w.dropElement._mouseLeave(e,!0),w.dropElement=this;const t=c.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(w.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!w.dragElement||w.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=c.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(w.dragElement)),this.triggerEvent("dropout",i),w.dropElement===this&&(delete w.dropElement,!t)){let r,o=this.el.parentElement;for(;!r&&o;)r=o.ddElement?.ddDroppable,o=o.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=c.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(w.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class pt{static init(e){return e.ddElement||(e.ddElement=new pt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Re(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Se(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Us(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Fs{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let h=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";h==="all"&&(h="n,e,s,w,se,sw,ne,nw");const l=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:h,autoHide:l,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,w.dragElement?w.dragElement.el:o.target,w.dragElement?w.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=c.getElements(e);return r.length?r.map(n=>n.ddElement||(i?pt.init(n):null)).filter(n=>n):[]}}const T=new Fs;class b{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=b.getGridElement(t);return i?(i.gridstack||(i.gridstack=new b(i,c.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
227
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(b.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new b(r,c.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
228
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const n=i.gridstack;return t&&(n.opts={...n.opts,...t}),t.children!==void 0&&n.load(t.children),n}return(!e.classList.contains("grid-stack")||b.addRemoveCB)&&(b.addRemoveCB?i=b.addRemoveCB(e,t,!0,!0):i=c.createDiv(["grid-stack",t.class],e)),b.init(t,i)}static registerEngine(e){b.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=c.createDiv([this.opts.placeholderClass,L.itemClass,this.opts.itemClass]);const e=c.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=c.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const l=r.breakpoints;!r.columnWidth&&!l?.length?delete t.columnOpts:(r.columnMax=r.columnMax||12,l?.length>1&&l.sort((d,u)=>(u.w||0)-(d.w||0)))}const o={...c.cloneDeep(L),column:c.toNumber(e.getAttribute("gs-column"))||L.column,minRow:i||c.toNumber(e.getAttribute("gs-min-row"))||L.minRow,maxRow:i||c.toNumber(e.getAttribute("gs-max-row"))||L.maxRow,staticGrid:c.toBool(e.getAttribute("gs-static"))||L.staticGrid,sizeToContent:c.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||L.draggable.handle},removableOptions:{accept:t.itemClass||L.removableOptions.accept,decline:L.removableOptions.decline}};e.getAttribute("gs-animate")&&(o.animate=c.toBool(e.getAttribute("gs-animate"))),t=c.defaults(t,o),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const a=this.el.closest("."+L.itemClass)?.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==L.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const l=t.cellHeight;delete t.cellHeight,this.cellHeight(l)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=W),this._setStaticClass();const h=t.engineClass||b.engineClass||K;if(this.engine=new h({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:l=>{l.forEach(d=>{const u=d.el;u&&(d._removeDOM?(u&&u.remove(),delete d._removeDOM):this._writePosAttr(u,d))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(l=>this._prepareElement(l)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const l=t.children;delete t.children,l.length&&this.load(l)}this.setAnimation(),t.subGridDynamic&&!w.pauseDrag&&(w.pauseDrag=!0),t.draggable?.pause!==void 0&&(w.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i.el?t=i.el:b.addRemoveCB?t=b.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return c.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=c.createDiv(["grid-stack-item",this.opts.itemClass]),i=c.createDiv(["grid-stack-item-content"],t);return c.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{r.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,b.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):b.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let n,a=this;for(;a&&!n;)n=a.opts?.subGridOpts,a=a.parentGridNode?.grid;t=c.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...n||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let h;t.column==="auto"&&(h=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let l=o.el.querySelector(".grid-stack-item-content"),d,u;if(r&&(this._removeDD(o.el),u={...o,x:0,y:0},c.removeInternalForSave(u),delete u.subGridOpts,o.content&&(u.content=o.content,delete o.content),b.addRemoveCB?d=b.addRemoveCB(this.el,u,!0,!1):(d=c.createDiv(["grid-stack-item"]),d.appendChild(l),l=c.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const f=h?t.column:o.w,y=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:f,h:y}),setTimeout(()=>E.transition=null)}const p=o.subGrid=b.addGrid(l,t);return i?._moving&&(p._isTemp=!0),h&&(p._autoColumn=!0),r&&p.makeWidget(d,u),i&&(i._moving?window.setTimeout(()=>c.simulateMouseEvent(i._event,"mouseenter",p.el),0):p.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),p}removeAsSubGrid(e){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>c.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=b.saveCB,r){const o=this.engine.save(e,i,r);if(o.forEach(n=>{if(e&&n.el&&!n.subGrid&&!i){const a=n.el.querySelector(".grid-stack-item-content");n.content=a?.innerHTML,n.content||delete n.content}else if(!e&&!i&&delete n.content,n.subGrid?.el){const a=n.w||n.subGrid.getColumn(),h=n.subGrid.save(e,t,i,a);n.subGridOpts=t?h:{children:h},delete n.subGrid}delete n.el}),t){const n=c.cloneDeep(this.opts);n.marginBottom===n.marginTop&&n.marginRight===n.marginLeft&&n.marginTop===n.marginRight&&(n.margin=n.marginTop,delete n.marginTop,delete n.marginRight,delete n.marginBottom,delete n.marginLeft),n.rtl===(this.el.style.direction==="rtl")&&(n.rtl="auto"),this._isAutoCellHeight&&(n.cellHeight="auto"),this._autoColumn&&(n.column="auto");const a=n._alwaysShowResizeHandle;return delete n._alwaysShowResizeHandle,a!==void 0?n.alwaysShowResizeHandle=a:delete n.alwaysShowResizeHandle,c.removeInternalAndSame(n,L),n.children=o,n}return o}load(e,t=b.addRemoveCB||!0){e=c.cloneDeep(e);const i=this.getColumn();e.forEach(d=>{d.w=d.w||d.minW||1,d.h=d.h||d.minH||1}),e=c.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(d=>{r=Math.max(r,(d.x||0)+d.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const o=b.addRemoveCB;typeof t=="function"&&(b.addRemoveCB=t);const n=[];this.batchUpdate();const a=!this.engine.nodes.length,h=a&&this.opts.animate;h&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(u=>{if(!u.id)return;c.find(e,u.id)||(b.addRemoveCB&&b.addRemoveCB(this.el,u,!1,!1),n.push(u),this.removeWidget(u.el,!0,!1))}),this.engine._loading=!0;const l=[];return this.engine.nodes=this.engine.nodes.filter(d=>c.find(e,d.id)?(l.push(d),!1):!0),e.forEach(d=>{const u=c.find(l,d.id);if(u){if(c.shouldSizeToContent(u)&&(d.h=u.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||u.w,d.h=d.h||u.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(u),c.samePos(u,d)&&this.engine.nodes.length>1&&(this.moveNode(u,{...d,forceCollide:!0}),c.copyPos(d,u)),this.update(u.el,d),d.subGridOpts?.children){const p=u.el.querySelector(".grid-stack");p&&p.gridstack&&p.gridstack.load(d.subGridOpts.children)}}else t&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?b.addRemoveCB=o:delete b.addRemoveCB,h&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=c.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=c.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&r<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(n=>n.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,n=e.top-r.top,a=i.width/this.getColumn(),h=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(n/h)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=b.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(b.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(n=>r===n.el)),o&&(t&&b.addRemoveCB&&b.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&b.addRemoveCB&&b.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(t.minRow=t.maxRow=t.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(t.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),e.children?.length&&this.load(e.children),this)}update(e,t){return b.getElements(e).forEach(i=>{const r=i?.gridstackNode;if(!r)return;const o={...c.copyPos({},r),...c.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const n=["x","y","w","h"];let a;if(n.some(d=>o[d]!==void 0&&o[d]!==r[d])&&(a={},n.forEach(d=>{a[d]=o[d]!==void 0?o[d]:r[d],delete o[d]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(r.content=o.content,b.renderCB(d,o),r.subGrid?.el&&(d.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete o.content}let h=!1,l=!1;for(const d in o)d[0]!=="_"&&r[d]!==o[d]&&(r[d]=o[d],h=!0,l=l||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(c.sanitizeMinMax(r),a){const d=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),d&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(d,r),delete r._orig}(a||h)&&this._writeAttr(i,r),l&&this.prepareDragDrop(r.el),b.updateCB&&b.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(b.resizeToContentParent)),!n)return;const a=e.clientHeight-n.clientHeight,h=t.h?t.h*r-a:n.clientHeight;let l;if(t.subGrid){l=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const p=t.subGrid.el.getBoundingClientRect(),f=e.getBoundingClientRect();l+=p.top-f.top}else{if(t.subGridOpts?.children?.length)return;{const p=n.firstElementChild;if(!p){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}l=p.getBoundingClientRect().height||h}}if(h===l)return;o+=l-h;let d=Math.ceil(o/r);const u=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;u&&d>u&&(d=u,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){b.resizeToContentCB?b.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return b.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!c.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,h=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(h+1)),o.y=r.y+h-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});const n=r._orig;this.update(i,o),r._orig=n}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=c.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e&&!this.opts.minRow){const o=c.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const n=Math.floor(o.h/i);t<n&&(t=n)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&c.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(L.itemClass,this.opts.itemClass);const r=c.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),c.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=c.toNumber(e.getAttribute("gs-x")),i.y=c.toNumber(e.getAttribute("gs-y")),i.w=c.toNumber(e.getAttribute("gs-w")),i.h=c.toNumber(e.getAttribute("gs-h")),i.autoPosition=c.toBool(e.getAttribute("gs-auto-position")),i.noResize=c.toBool(e.getAttribute("gs-no-resize")),i.noMove=c.toBool(e.getAttribute("gs-no-move")),i.locked=c.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=c.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=c.toNumber(e.getAttribute("gs-max-w")),i.minW=c.toNumber(e.getAttribute("gs-min-w")),i.maxH=c.toNumber(e.getAttribute("gs-max-h")),i.minH=c.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="sizeToContent"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)c.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>c.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{c.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=c.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return c.getElement(e)}static getElements(e=".grid-stack-item"){return c.getElements(e)}static getGridElement(e){return b.getElement(e)}static getGridElements(e){return c.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=c.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=c.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const o=this.el.style;return o.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return T}static setupDragIn(e,t,i,r=document){t?.pause!==void 0&&(w.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?c.getElements(e,r):e).forEach((n,a)=>{T.isDraggable(n)||T.dragIn(n,t),i?.[a]&&(n.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&b._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return T.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return T.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,n)=>{n=n||o;const a=n.gridstackNode;if(!a)return;if(!a.grid?.el){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const p=n.getBoundingClientRect();n.style.left=p.x+(this.dragTransform.xScale-1)*(r.clientX-p.x)/this.dragTransform.xScale+"px",n.style.top=p.y+(this.dragTransform.yScale-1)*(r.clientY-p.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px"}let{top:h,left:l}=n.getBoundingClientRect();const d=this.el.getBoundingClientRect();l-=d.left,h-=d.top;const u={position:{top:h*this.dragTransform.xScale,left:l*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(l/t)),a.y=Math.max(0,Math.round(h/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){T.off(o,"drag");return}a._willFitPos&&(c.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(n,r,u,a,t,e)}else this._dragOrResize(n,r,u,a,t,e)};return T.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let n=!0;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;n=r.matches(a)}if(n&&o&&this.opts.maxRow){const a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};n=this.engine.willItFit(a)}return n}}).on(this.el,"dropover",(r,o,n)=>{let a=n?.gridstackNode||o.gridstackNode;if(a?.grid===this&&!a._temporaryRemoved)return!1;if(a?._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a?.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,n),n=n||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const d=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(d){try{a=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode")}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,n.gridstackNode=a);const h=a.w||Math.round(n.offsetWidth/t)||1,l=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a={...a,w:h,h:l,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=h,a.h=l,a._temporaryRemoved=!0),b._itemRemoving(a.el,!1),T.on(o,"drag",i),i(r,o,n),!1}).on(this.el,"dropout",(r,o,n)=>{const a=n?.gridstackNode||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,n),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,n)=>{const a=n?.gridstackNode||o.gridstackNode;if(a?.grid===this&&!a._isExternal)return!1;const h=!!this.placeholder.parentElement,l=o!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,h&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,h&&d?.grid&&d.grid!==this){const p=d.grid;p.engine.removeNodeFromLayoutCache(d),p.engine.removedNodes.push(d),p._triggerRemoveEvent()._triggerChangeEvent(),p.parentGridNode&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!a||(h&&(this.engine.cleanupNode(a),a.grid=this),delete a.grid?._isTemp,T.off(o,"drag"),n!==o?(n.remove(),o=n):o.remove(),this._removeDD(o),!h))return!1;const u=a.subGrid?.el?.gridstack;return c.copyPos(a,this._readAttr(this.placeholder)),c.removePositioningStyles(o),l&&(a.content||a.subGridOpts||b.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),u&&(u.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},d&&d.grid?d:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!T.isDroppable(e)&&T.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>b._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>b._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||r&&o;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,h;const l=(p,f)=>{this.triggerEvent(p,p.target),a=this.cellWidth(),h=this.getCellHeight(!0),this._onStartMoving(e,p,f,i,a,h)},d=(p,f)=>{this._dragOrResize(e,p,f,i,a,h)},u=p=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const f=i.w!==i._orig.w,y=p.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(i.el=y,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[p.type]&&E._gsEventHandler[p.type](p,y),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else c.removePositioningStyles(y),i._temporaryRemoved?(this._writePosAttr(y,i),this.engine.addNode(i)):this._writePosAttr(y,i),this.triggerEvent(p,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),p.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(f,i))}};T.draggable(e,{start:l,stop:u,drag:d}).resizable(e,{start:l,stop:u,resize:d}),i._initDD=!0}return T.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,n){if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,r.grid?.el)this.dragTransform=c.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const a=this.placeholder.closest(".grid-stack");this.dragTransform=c.getValuesFromTransformedElement(a)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const a=this.getColumn()-r.x,h=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;T.resizable(e,"option","minWidth",o*Math.min(r.minW||1,a)).resizable(e,"option","minHeight",n*Math.min(r.minH||1,h)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,a)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,h)).resizable(e,"option","maxHeightMoveUp",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,n){const a={...r._orig};let h,l=this.opts.marginLeft,d=this.opts.marginRight,u=this.opts.marginTop,p=this.opts.marginBottom;const f=Math.round(n*.1),y=Math.round(o*.1);if(l=Math.min(l,y),d=Math.min(d,y),u=Math.min(u,f),p=Math.min(p,f),t.type==="drag"){if(r._temporaryRemoved)return;const x=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&c.updateScrollPosition(e,i.position,x);const z=i.position.left+(i.position.left>r._lastUiPosition.left?-d:l),S=i.position.top+(i.position.top>r._lastUiPosition.top?-p:u);a.x=Math.round(z/o),a.y=Math.round(S/n);const R=this._extraDragRow;if(this.engine.collide(r,a)){const A=this.getRow();let k=Math.max(0,a.y+r.h-A);this.opts.maxRow&&A+k>this.opts.maxRow&&(k=Math.max(0,this.opts.maxRow-A)),this._extraDragRow=k}else this._extraDragRow=0;if(this._extraDragRow!==R&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(c.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-l)/o),a.h=Math.round((i.size.height-u)/n),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const x=i.position.left+l,z=i.position.top+u;a.x=Math.round(x/o),a.y=Math.round(z/n),h=!0}r._event=t,r._lastTried=a;const E={x:i.position.left+l,y:i.position.top+u,w:(i.size?i.size.width:r.w*o)-l-d,h:(i.size?i.size.height:r.h*n)-u-p};if(this.engine.moveNodeCheck(r,{...a,cellWidth:o,cellHeight:n,rect:E,resizing:h})){r._lastUiPosition=i.position,this.engine.cacheRects(o,n,u,d,p,l),delete r._skipDown,h&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const x=t.target;r._sidebarOrig||this._writePosAttr(x,r),this.triggerEvent(t,x)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,T.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&b._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return $s(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}b.renderCB=(s,e)=>{s&&e?.content&&(s.textContent=e.content)};b.resizeToContentParent=".grid-stack-item-content";b.Utils=c;b.Engine=K;b.GDRev="12.3.2";const Vs=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,Gs={icon:Y.luzmoLockOutline,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},qs={icon:Y.luzmoPencil,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},di={icon:Y.luzmoTable,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},hi={icon:Y.luzmoCog,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},jt={icon:Y.luzmoFilterOutline,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},ci={icon:Y.luzmoClone,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},ui={icon:Y.luzmoTrashOutline,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},Kt=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...ui},filters:{...jt},clone:{...ci},edit:{...qs},"edit-data":{...di},"edit-options":{...hi},"edit-filters":{...jt},lock:{...Gs}}[i];if(typeof i=="object")return i.icon=i.icon??Y.luzmoCircle,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},mi=()=>[{type:"group",actions:[{...di},{...hi},{...ci}]},{type:"group",actions:[{...ui}]}],js=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var Ks=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,qe=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xs(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Ks(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Xt.LuzmoElement{constructor(){super(...arguments),this.placement="right-start",this.actions=mi(),this.language="en"}static get styles(){return[_.unsafeCSS(js)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{t.actions?.forEach(i=>{e!==i&&i.active&&(i.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>({...e,actions:e.actions?.map(t=>(t.type==="toggle"&&(t.active=!1),t))??[]}))}focus(){const e=this.shadowRoot?.querySelectorAll("luzmo-action-button[toggles]");e&&e[0]?.focus()}_generateActionButton(e){const t={Data:Z.msg("Data",{desc:"Grid item action tooltip"}),Options:Z.msg("Options",{desc:"Grid item action tooltip"}),Clone:Z.msg("Clone",{desc:"Grid item action tooltip"}),Delete:Z.msg("Delete",{desc:"Grid item action tooltip"}),Edit:Z.msg("Edit",{desc:"Grid item action tooltip"}),Lock:Z.msg("Lock",{desc:"Grid item action tooltip"}),Filters:Z.msg("Filters",{desc:"Grid item action tooltip"})};return _.html`
226
+ `,we);f([p.property()],K.prototype,"appServer");f([p.property()],K.prototype,"apiHost");f([p.property({type:Object})],K.prototype,"options");f([p.property()],K.prototype,"aiEndPoint");f([p.property()],K.prototype,"authKey");f([p.property()],K.prototype,"authToken");f([p.property()],K.prototype,"messages");f([p.property()],K.prototype,"version");f([p.property()],K.prototype,"libVersion");f([p.property()],K.prototype,"remoteEntryServer");customElements.get(Vt)||customElements.define(Vt,K);var Xt,Yt;(Yt=(Xt=k.LitElement).disableWarning)==null||Yt.call(Xt,"change-in-update");function Ws(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class m{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return m.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(m.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){const n=r.bottom-o,a=r.top,l=this.getScrollElement(e);if(l!==null){const h=l.scrollTop;r.top<0&&i<0?e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=n>i?i:n),t.top+=l.scrollTop-h}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),o=r.clientHeight,n=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,l=a<i,h=a>o-i;l?r.scrollBy({behavior:"smooth",top:a-i}):h&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=m.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=m.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=m.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");m.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class ee{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let l=0;for(;i=i||this.collide(e,o,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let h;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...a};h=this._loading&&m.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&h?m.copyPos(t,e):!i.locked&&h&&r.pack&&(this._packNodes(),t.y=i.y+i.h,m.copyPos(e,t)),n=n||h}else h=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!h)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&m.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i==null?void 0:i._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&m.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let l of i){if(l.locked||!l._rect)break;const h=l._rect;let d=Number.MAX_VALUE,c=Number.MAX_VALUE;r.y<h.y?d=(o.y+o.h-h.y)/h.h:r.y+r.h>h.y+h.h&&(d=(h.y+h.h-o.y)/h.h),r.x<h.x?c=(o.x+o.w-h.x)/h.w:r.x+r.w>h.x+h.w&&(c=(h.x+h.w-o.x)/h.w);const u=Math.min(c,d);u>a&&(a=u,n=l)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=m.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=m.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=m.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,l)=>{let h;n.locked||(n.autoPosition=!0,e==="list"&&a&&(h=l[a-1])),this.addNode(n,!1,h)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=m.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??ee._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return m.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,m.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||m.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),m.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!m.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=m.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||m.samePos(e,e._orig)||(m.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const l=a%i,h=Math.floor(a/i);if(l+e.w>i)continue;const d={x:l,y:h,w:e.w,h:e.h};t.find(c=>m.isIntercepted(d,c))||((e.x!==l||e.y!==h)&&(e._dirty=!0),e.x=l,e.y=h,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new ee({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(l=>l._id===n._id);a&&(m.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ee({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=m.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var h,d;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=m.copyPos({},e,!0);if(m.copyPos(o,t),this.nodeBoundFix(o,r),m.copyPos(t,o),!t.forceCollide&&m.samePos(e,t))return!1;const n=m.copyPos({},e),a=this.collideAll(e,o,t.skip);let l=!0;if(a.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,a):a[0];if(c&&u&&((d=(h=e.grid)==null?void 0:h.opts)!=null&&d.subGridDynamic)&&!e.grid._isTemp){const g=m.areaIntercept(t.rect,u._rect),y=m.area(t.rect),v=m.area(u._rect);g/(y<v?y:v)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?l=!this._fixCollisions(e,o,u,t):(l=!1,i&&delete t.pack)}return l&&!m.samePos(e,o)&&(e._dirty=!0,m.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!m.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var n;const i=(n=this._layouts)==null?void 0:n.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r==null?void 0:r.find(d=>d._id===a._id),h={...a,...l||{}};m.removeInternalForSave(h,!e),t&&t(a,h),o.push(h)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:m.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],h=this._layouts.length-1;!l.length&&e!==h&&((a=this._layouts[h])!=null&&a.length)&&(e=h,this._layouts[h].forEach(d=>{const c=n.find(u=>u._id===d._id);c&&(!r&&!d.autoPosition&&(c.x=d.x??c.x,c.y=d.y??c.y),c.w=d.w??c.w,(d.x==null||d.y===void 0)&&(c.autoPosition=!0))})),l.forEach(d=>{const c=n.findIndex(u=>u._id===d._id);if(c!==-1){const u=n[c];if(r){u.w=d.w;return}(d.autoPosition||isNaN(d.x)||isNaN(d.y))&&this.findEmptyPosition(d,o),d.autoPosition||(u.x=d.x??u.x,u.y=d.y??u.y,u.w=d.w??u.w,o.push(u)),n.splice(c,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const l=r||i==="none"?1:t/e,h=i==="move"||i==="moveScale",d=i==="scale"||i==="moveScale";n.forEach(c=>{c.x=t===1?0:h?Math.round(c.x*l):Math.min(c.x,t-1),c.w=t===1||e===1?1:d?Math.round(c.w*l)||1:Math.min(c.w,t),o.push(c)}),n=[]}o=m.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(l=>l.id===o.id):void 0;o._id=(a==null?void 0:a._id)??ee._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??ee._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r;return((r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(o=>o._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}ee._idSeq=0;const O={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class z{}const G=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class X{}function $e(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),m.simulateMouseEvent(s.changedTouches[0],e))}function hi(s,e){s.cancelable&&s.preventDefault(),m.simulateMouseEvent(s,e)}function We(s){X.touchHandled||(X.touchHandled=!0,$e(s,"mousedown"))}function Be(s){X.touchHandled&&$e(s,"mousemove")}function Ue(s){if(!X.touchHandled)return;X.pointerLeaveTimeout&&(window.clearTimeout(X.pointerLeaveTimeout),delete X.pointerLeaveTimeout);const e=!!z.dragElement;$e(s,"mouseup"),e||$e(s,"click"),X.touchHandled=!1}function Fe(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Gt(s){z.dragElement&&s.pointerType!=="mouse"&&hi(s,"mouseenter")}function qt(s){z.dragElement&&s.pointerType!=="mouse"&&(X.pointerLeaveTimeout=window.setTimeout(()=>{delete X.pointerLeaveTimeout,hi(s,"mouseleave")},10))}class Xe{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Xe.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),G&&(this.el.addEventListener("touchstart",We),this.el.addEventListener("pointerdown",Fe)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),G&&(this.el.removeEventListener("touchstart",We),this.el.removeEventListener("pointerdown",Fe)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(this.el.addEventListener("touchmove",Be),this.el.addEventListener("touchend",Ue)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&(this.el.removeEventListener("touchmove",Be),this.el.removeEventListener("touchend",Ue)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Xe.prefix="ui-resizable-";class ft{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class De extends ft{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),z.overResizeElement===this&&delete z.overResizeElement),this}_mouseOver(e){z.overResizeElement||z.dragElement||(z.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){z.overResizeElement===this&&(delete z.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Xe(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=m.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=m.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=m.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=m.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=m.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=De._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=m.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return De._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,l;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,l=!0);const h=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(h.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-h.width),r.width=h.width),Math.round(r.height)!==Math.round(h.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-h.height),r.height=h.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,l=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,h=o.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),c=Math.min(l,Math.max(h,t));return{width:d,height:c}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}De._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Bs='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Ce extends ft{constructor(e,t={}){var o;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(o=t==null?void 0:t.handle)==null?void 0:o.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),G&&(e.addEventListener("touchstart",We),e.addEventListener("pointerdown",Fe))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),G&&(t.removeEventListener("touchstart",We),t.removeEventListener("pointerdown",Fe))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!z.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Bs)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete z.dragElement,delete z.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),G&&(e.currentTarget.addEventListener("touchmove",Be),e.currentTarget.addEventListener("touchend",Ue)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),z.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=m.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),z.pauseDrag){const r=Number.isInteger(z.pauseDrag)?z.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,z.dragElement=this;const r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?z.dropElement=r.el.ddElement.ddDroppable:delete z.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=m.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const o=m.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(o,this.ui()),this.triggerEvent("dragstart",o),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),G&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Be,!0),e.currentTarget.removeEventListener("touchend",Ue,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=z.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete z.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const r=m.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),z.dropElement&&z.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete z.dragElement,delete z.dropElement,delete z.mouseHandled,e.preventDefault()}_keyEvent(e){var r,o;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((o=(r=z.dropElement)==null?void 0:r.el)==null?void 0:o.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!m.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",m.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=m.cloneNode(this.el)),e.parentElement||m.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Ce.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Ce.originStyleProp.forEach(o=>i.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Ce.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Us extends ft{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),G&&(this.el.addEventListener("pointerenter",Gt),this.el.addEventListener("pointerleave",qt)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),G&&(this.el.removeEventListener("pointerenter",Gt),this.el.removeEventListener("pointerleave",qt)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!z.dragElement||!this._canDrop(z.dragElement.el))return;e.preventDefault(),e.stopPropagation(),z.dropElement&&z.dropElement!==this&&z.dropElement._mouseLeave(e,!0),z.dropElement=this;const t=m.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(z.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!z.dragElement||z.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=m.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(z.dragElement)),this.triggerEvent("dropout",i),z.dropElement===this&&(delete z.dropElement,!t)){let o,n=this.el.parentElement;for(;!o&&n;)o=(r=n.ddElement)==null?void 0:r.ddDroppable,n=n.parentElement;o&&o._mouseEnter(e)}}drop(e){e.preventDefault();const t=m.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(z.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class yt{static init(e){return e.ddElement||(e.ddElement=new yt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Ce(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new De(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Us(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Fs{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let l=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const h=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:l,autoHide:h,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,z.dragElement?z.dragElement.el:o.target,z.dragElement?z.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=m.getElements(e);return r.length?r.map(n=>n.ddElement||(i?yt.init(n):null)).filter(n=>n):[]}}/*!
227
+ * GridStack 12.2.1
228
+ * https://gridstackjs.com/
229
+ *
230
+ * Copyright (c) 2021-2024 Alain Dumesny
231
+ * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
232
+ */const N=new Fs;class _{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=_.getGridElement(t);return i?(i.gridstack||(i.gridstack=new _(i,m.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
233
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(_.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new _(r,m.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
234
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const n=i.gridstack;return t&&(n.opts={...n.opts,...t}),t.children!==void 0&&n.load(t.children),n}return(!e.classList.contains("grid-stack")||_.addRemoveCB)&&(_.addRemoveCB?i=_.addRemoveCB(e,t,!0,!0):i=m.createDiv(["grid-stack",t.class],e)),_.init(t,i)}static registerEngine(e){_.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=m.createDiv([this.opts.placeholderClass,O.itemClass,this.opts.itemClass]);const e=m.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var h;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=m.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const d=r.breakpoints;!r.columnWidth&&!(d!=null&&d.length)?delete t.columnOpts:(r.columnMax=r.columnMax||12,(d==null?void 0:d.length)>1&&d.sort((c,u)=>(u.w||0)-(c.w||0)))}const o={...m.cloneDeep(O),column:m.toNumber(e.getAttribute("gs-column"))||O.column,minRow:i||m.toNumber(e.getAttribute("gs-min-row"))||O.minRow,maxRow:i||m.toNumber(e.getAttribute("gs-max-row"))||O.maxRow,staticGrid:m.toBool(e.getAttribute("gs-static"))||O.staticGrid,sizeToContent:m.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||O.draggable.handle},removableOptions:{accept:t.itemClass||O.removableOptions.accept,decline:O.removableOptions.decline}};e.getAttribute("gs-animate")&&(o.animate=m.toBool(e.getAttribute("gs-animate"))),t=m.defaults(t,o),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const n=this.el.closest("."+O.itemClass),a=n==null?void 0:n.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==O.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const d=t.cellHeight;delete t.cellHeight,this.cellHeight(d)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=G),this._setStaticClass();const l=t.engineClass||_.engineClass||ee;if(this.engine=new l({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:d=>{d.forEach(c=>{const u=c.el;u&&(c._removeDOM?(u&&u.remove(),delete c._removeDOM):this._writePosAttr(u,c))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(d=>this._prepareElement(d)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const d=t.children;delete t.children,d.length&&this.load(d)}this.setAnimation(),t.subGridDynamic&&!z.pauseDrag&&(z.pauseDrag=!0),((h=t.draggable)==null?void 0:h.pause)!==void 0&&(z.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:_.addRemoveCB?t=_.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return m.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=m.createDiv(["grid-stack-item",this.opts.itemClass]),i=m.createDiv(["grid-stack-item-content"],t);return m.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{var o,n;r.isIntersecting&&((o=e.visibleObservable)==null||o.disconnect(),delete e.visibleObservable,_.renderCB(i,e),(n=e.grid)==null||n.prepareDragDrop(e.el))}),window.setTimeout(()=>{var r;return(r=e.visibleObservable)==null?void 0:r.observe(t)})):_.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){var g,y,v;let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),(g=o.subGrid)!=null&&g.el)return o.subGrid;let n,a=this;for(;a&&!n;)n=(y=a.opts)==null?void 0:y.subGridOpts,a=(v=a.parentGridNode)==null?void 0:v.grid;t=m.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...n||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(o.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let h=o.el.querySelector(".grid-stack-item-content"),d,c;if(r&&(this._removeDD(o.el),c={...o,x:0,y:0},m.removeInternalForSave(c),delete c.subGridOpts,o.content&&(c.content=o.content,delete o.content),_.addRemoveCB?d=_.addRemoveCB(this.el,c,!0,!1):(d=m.createDiv(["grid-stack-item"]),d.appendChild(h),h=m.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const b=l?t.column:o.w,w=o.h+i.h,x=o.el.style;x.transition="none",this.update(o.el,{w:b,h:w}),setTimeout(()=>x.transition=null)}const u=o.subGrid=_.addGrid(h,t);return i!=null&&i._moving&&(u._isTemp=!0),l&&(u._autoColumn=!0),r&&u.makeWidget(d,c),i&&(i._moving?window.setTimeout(()=>m.simulateMouseEvent(i._event,"mouseenter",u.el),0):u.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),u}removeAsSubGrid(e){var i;const t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>m.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=_.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{var n;if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a==null?void 0:a.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,(n=o.subGrid)!=null&&n.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=m.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const n=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,n!==void 0?o.alwaysShowResizeHandle=n:delete o.alwaysShowResizeHandle,m.removeInternalAndSame(o,O),o.children=r,o}return r}load(e,t=_.addRemoveCB||!0){e=m.cloneDeep(e);const i=this.getColumn();e.forEach(d=>{d.w=d.w||1,d.h=d.h||1}),e=m.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(d=>{r=Math.max(r,(d.x||0)+d.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const o=_.addRemoveCB;typeof t=="function"&&(_.addRemoveCB=t);const n=[];this.batchUpdate();const a=!this.engine.nodes.length,l=a&&this.opts.animate;l&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(c=>{if(!c.id)return;m.find(e,c.id)||(_.addRemoveCB&&_.addRemoveCB(this.el,c,!1,!1),n.push(c),this.removeWidget(c.el,!0,!1))}),this.engine._loading=!0;const h=[];return this.engine.nodes=this.engine.nodes.filter(d=>m.find(e,d.id)?(h.push(d),!1):!0),e.forEach(d=>{var u;const c=m.find(h,d.id);if(c){if(m.shouldSizeToContent(c)&&(d.h=c.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||c.w,d.h=d.h||c.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(c),m.samePos(c,d)&&this.engine.nodes.length>1&&(this.moveNode(c,{...d,forceCollide:!0}),m.copyPos(d,c)),this.update(c.el,d),(u=d.subGridOpts)!=null&&u.children){const g=c.el.querySelector(".grid-stack");g&&g.gridstack&&g.gridstack.load(d.subGridOpts.children)}}else t&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?_.addRemoveCB=o:delete _.addRemoveCB,l&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=m.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=m.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var o,n;const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((o=e.breakpoints)!=null&&o.length))return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;a<e.breakpoints.length&&r<=e.breakpoints[a].w;)i=e.breakpoints[a++].c||t}if(i!==t){const a=(n=e.breakpoints)==null?void 0:n.find(l=>l.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(t=this._placeholder)==null||delete t.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,n=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(n/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=_.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(_.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(n=>r===n.el)),o&&(t&&_.addRemoveCB&&_.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&_.addRemoveCB&&_.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){var i;const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?t.minRow=t.maxRow=t.row=e.row:(e.minRow!==void 0&&(t.minRow=e.minRow),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),(i=e.children)!=null&&i.length&&this.load(e.children),this)}update(e,t){return _.getElements(e).forEach(i=>{var d;const r=i==null?void 0:i.gridstackNode;if(!r)return;const o={...m.copyPos({},r),...m.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const n=["x","y","w","h"];let a;if(n.some(c=>o[c]!==void 0&&o[c]!==r[c])&&(a={},n.forEach(c=>{a[c]=o[c]!==void 0?o[c]:r[c],delete o[c]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){const c=i.querySelector(".grid-stack-item-content");c&&c.textContent!==o.content&&(r.content=o.content,_.renderCB(c,o),(d=r.subGrid)!=null&&d.el&&(c.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete o.content}let l=!1,h=!1;for(const c in o)c[0]!=="_"&&r[c]!==o[c]&&(r[c]=o[c],l=!0,h=h||!this.opts.staticGrid&&(c==="noResize"||c==="noMove"||c==="locked"));if(m.sanitizeMinMax(r),a){const c=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),c&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(c,r),delete r._orig}(a||l)&&this._writeAttr(i,r),h&&this.prepareDragDrop(r.el),_.updateCB&&_.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var u,g;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(_.resizeToContentParent)),!n)return;const a=e.clientHeight-n.clientHeight,l=t.h?t.h*r-a:n.clientHeight;let h;if(t.subGrid){h=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const y=t.subGrid.el.getBoundingClientRect(),v=e.getBoundingClientRect();h+=y.top-v.top}else{if((g=(u=t.subGridOpts)==null?void 0:u.children)!=null&&g.length)return;{const y=n.firstElementChild;if(!y){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${_.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}h=y.getBoundingClientRect().height||l}}if(l===h)return;o+=h-l;let d=Math.ceil(o/r);const c=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;c&&d>c&&(d=c,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){_.resizeToContentCB?_.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return _.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!m.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(l+1)),o.y=r.y+l-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});const n=r._orig;this.update(i,o),r._orig=n}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=m.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){const t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=m.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const n=Math.floor(o.h/i);t<n&&(t=n)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&m.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(O.itemClass,this.opts.itemClass);const r=m.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),m.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=m.toNumber(e.getAttribute("gs-x")),i.y=m.toNumber(e.getAttribute("gs-y")),i.w=m.toNumber(e.getAttribute("gs-w")),i.h=m.toNumber(e.getAttribute("gs-h")),i.autoPosition=m.toBool(e.getAttribute("gs-auto-position")),i.noResize=m.toBool(e.getAttribute("gs-no-resize")),i.noMove=m.toBool(e.getAttribute("gs-no-move")),i.locked=m.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=m.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=m.toNumber(e.getAttribute("gs-max-w")),i.minW=m.toNumber(e.getAttribute("gs-min-w")),i.maxH=m.toNumber(e.getAttribute("gs-max-h")),i.minH=m.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)m.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>m.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{m.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=m.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return m.getElement(e)}static getElements(e=".grid-stack-item"){return m.getElements(e)}static getGridElement(e){return _.getElement(e)}static getGridElements(e){return m.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=m.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=m.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const o=this.el.style;return o.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return N}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&(z.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?m.getElements(e,r):e).forEach((n,a)=>{N.isDraggable(n)||N.dragIn(n,t),i!=null&&i[a]&&(n.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(_.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;const e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&_._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return N.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return N.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,n)=>{var u;n=n||o;const a=n.gridstackNode;if(!a)return;if(!((u=a.grid)!=null&&u.el)){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const g=n.getBoundingClientRect();n.style.left=g.x+(this.dragTransform.xScale-1)*(r.clientX-g.x)/this.dragTransform.xScale+"px",n.style.top=g.y+(this.dragTransform.yScale-1)*(r.clientY-g.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px"}let{top:l,left:h}=n.getBoundingClientRect();const d=this.el.getBoundingClientRect();h-=d.left,l-=d.top;const c={position:{top:l*this.dragTransform.xScale,left:h*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(h/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){N.off(o,"drag");return}a._willFitPos&&(m.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(n,r,c,a,t,e)}else this._dragOrResize(n,r,c,a,t,e)};return N.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if((o==null?void 0:o.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let n=!0;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;n=r.matches(a)}if(n&&o&&this.opts.maxRow){const a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};n=this.engine.willItFit(a)}return n}}).on(this.el,"dropover",(r,o,n)=>{let a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,n),n=n||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const d=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(d){try{a=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode")}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,n.gridstackNode=a);const l=a.w||Math.round(n.offsetWidth/t)||1,h=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a={...a,w:l,h,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=h,a._temporaryRemoved=!0),_._itemRemoving(a.el,!1),N.on(o,"drag",i),i(r,o,n),!1}).on(this.el,"dropout",(r,o,n)=>{const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,n),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,n)=>{var u,g,y;const a=(n==null?void 0:n.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;const l=!!this.placeholder.parentElement,h=o!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,l&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,l&&(d!=null&&d.grid)&&d.grid!==this){const v=d.grid;v.engine.removeNodeFromLayoutCache(d),v.engine.removedNodes.push(d),v._triggerRemoveEvent()._triggerChangeEvent(),v.parentGridNode&&!v.engine.nodes.length&&v.opts.subGridDynamic&&v.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(u=a.grid)==null||delete u._isTemp,N.off(o,"drag"),n!==o?(n.remove(),o=n):o.remove(),this._removeDD(o),!l))return!1;const c=(y=(g=a.subGrid)==null?void 0:g.el)==null?void 0:y.gridstack;return m.copyPos(a,this._readAttr(this.placeholder)),m.removePositioningStyles(o),h&&(a.content||a.subGridOpts||_.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),c&&(c.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},d&&d.grid?d:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!N.isDroppable(e)&&N.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>_._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>_._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e==null?void 0:e.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||r&&o;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,l;const h=(u,g)=>{this.triggerEvent(u,u.target),a=this.cellWidth(),l=this.getCellHeight(!0),this._onStartMoving(e,u,g,i,a,l)},d=(u,g)=>{this._dragOrResize(e,u,g,i,a,l)},c=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const g=i.w!==i._orig.w,y=u.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(i.el=y,i._isAboutToRemove){const v=e.gridstackNode.grid;v._gsEventHandler[u.type]&&v._gsEventHandler[u.type](u,y),v.engine.nodes.push(i),v.removeWidget(e,!0,!0)}else m.removePositioningStyles(y),i._temporaryRemoved?(m.copyPos(i,i._orig),this._writePosAttr(y,i),this.engine.addNode(i)):this._writePosAttr(y,i),this.triggerEvent(u,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(g,i))}};N.draggable(e,{start:h,stop:c,drag:d}).resizable(e,{start:h,stop:c,resize:d}),i._initDD=!0}return N.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,n){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=m.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=m.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,h=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;N.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",n*Math.min(r.minH||1,h)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,h)).resizable(e,"option","maxHeightMoveUp",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,n){const a={...r._orig};let l,h=this.opts.marginLeft,d=this.opts.marginRight,c=this.opts.marginTop,u=this.opts.marginBottom;const g=Math.round(n*.1),y=Math.round(o*.1);if(h=Math.min(h,y),d=Math.min(d,y),c=Math.min(c,g),u=Math.min(u,g),t.type==="drag"){if(r._temporaryRemoved)return;const b=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&m.updateScrollPosition(e,i.position,b);const w=i.position.left+(i.position.left>r._lastUiPosition.left?-d:h),x=i.position.top+(i.position.top>r._lastUiPosition.top?-u:c);a.x=Math.round(w/o),a.y=Math.round(x/n);const S=this._extraDragRow;if(this.engine.collide(r,a)){const A=this.getRow();let R=Math.max(0,a.y+r.h-A);this.opts.maxRow&&A+R>this.opts.maxRow&&(R=Math.max(0,this.opts.maxRow-A)),this._extraDragRow=R}else this._extraDragRow=0;if(this._extraDragRow!==S&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(m.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-h)/o),a.h=Math.round((i.size.height-c)/n),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const b=i.position.left+h,w=i.position.top+c;a.x=Math.round(b/o),a.y=Math.round(w/n),l=!0}r._event=t,r._lastTried=a;const v={x:i.position.left+h,y:i.position.top+c,w:(i.size?i.size.width:r.w*o)-h-d,h:(i.size?i.size.height:r.h*n)-c-u};if(this.engine.moveNodeCheck(r,{...a,cellWidth:o,cellHeight:n,rect:v,resizing:l})){r._lastUiPosition=i.position,this.engine.cacheRects(o,n,c,d,u,h),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=t.target;r._sidebarOrig||this._writePosAttr(b,r),this.triggerEvent(t,b)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,N.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&_._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Ws(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}_.renderCB=(s,e)=>{s&&(e!=null&&e.content)&&(s.textContent=e.content)};_.resizeToContentParent=".grid-stack-item-content";_.Utils=m;_.Engine=ee;_.GDRev="12.2.1";const Vs=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,Gs={icon:ie.luzmoLockOutline,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},qs={icon:ie.luzmoPencil,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},ci={icon:ie.luzmoTable,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},ui={icon:ie.luzmoCog,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},jt={icon:ie.luzmoFilterOutline,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},mi={icon:ie.luzmoClone,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},pi={icon:ie.luzmoTrashOutline,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},Kt=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...pi},filters:{...jt},clone:{...mi},edit:{...qs},"edit-data":{...ci},"edit-options":{...ui},"edit-filters":{...jt},lock:{...Gs}}[i];if(typeof i=="object")return i.icon=i.icon??ie.luzmoCircle,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},gi=()=>[{type:"group",actions:[{...ci},{...ui},{...mi}]},{type:"group",actions:[{...pi}]}],js=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var Ks=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Ye=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xs(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Ks(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Jt.LuzmoElement{constructor(){super(...arguments),this.placement="right-start",this.actions=gi(),this.language="en"}static get styles(){return[k.unsafeCSS(js)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{var i;(i=t.actions)==null||i.forEach(r=>{e!==r&&r.active&&(r.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>{var t;return{...e,actions:((t=e.actions)==null?void 0:t.map(i=>(i.type==="toggle"&&(i.active=!1),i)))??[]}})}focus(){var t,i;const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("luzmo-action-button[toggles]");e&&((i=e[0])==null||i.focus())}_generateActionButton(e){var i,r,o,n;const t={Data:oe.msg("Data",{desc:"Grid item action tooltip"}),Options:oe.msg("Options",{desc:"Grid item action tooltip"}),Clone:oe.msg("Clone",{desc:"Grid item action tooltip"}),Delete:oe.msg("Delete",{desc:"Grid item action tooltip"}),Edit:oe.msg("Edit",{desc:"Grid item action tooltip"}),Lock:oe.msg("Lock",{desc:"Grid item action tooltip"}),Filters:oe.msg("Filters",{desc:"Grid item action tooltip"})};return k.html`
229
235
  <luzmo-action-button
230
236
  class="${e.action}-button action-button"
231
237
  .label=${e.label}
@@ -234,40 +240,40 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
234
240
  @click=${this._handleActionClick.bind(this,e)}
235
241
  >
236
242
  <luzmo-icon slot="icon" .icon=${e.icon} size="s"></luzmo-icon>
237
- ${e.tooltip?_.html`
243
+ ${e.tooltip?k.html`
238
244
  <luzmo-tooltip
239
245
  self-managed
240
246
  delayed
241
- placement=${this.placement?.includes("right")?"right":this.placement?.includes("left")?"left":this.placement?.includes("bottom")?"bottom":this.placement?.includes("top")?"top":"right"}
247
+ placement=${(i=this.placement)!=null&&i.includes("right")?"right":(r=this.placement)!=null&&r.includes("left")?"left":(o=this.placement)!=null&&o.includes("bottom")?"bottom":(n=this.placement)!=null&&n.includes("top")?"top":"right"}
242
248
  >
243
249
  ${t[e.tooltip]??e.tooltip}
244
250
  </luzmo-tooltip>
245
251
  `:""}
246
252
  </luzmo-action-button>
247
- `}_generateActionGroup(e){const t=e?.actions?.map(i=>this._generateActionButton(i))??[];return t.length>0?_.html`
253
+ `}_generateActionGroup(e){var i;const t=((i=e==null?void 0:e.actions)==null?void 0:i.map(r=>this._generateActionButton(r)))??[];return t.length>0?k.html`
248
254
  <luzmo-action-group ?vertical=${this.isVertical} compact
249
255
  >${t}</luzmo-action-group
250
256
  >
251
- `:_.html``}willUpdate(e){e.has("language")&&this.language!==Xe.getLocale()&&([...Xe.targetLocales].includes(this.language??"en")||this.language==="en")&&Xe.setLocale(this.language)}render(){const e=this.actions.map(t=>this._generateActionGroup(t));return _.html`
257
+ `:k.html``}willUpdate(e){e.has("language")&&this.language!==Qe.getLocale()&&([...Qe.targetLocales].includes(this.language??"en")||this.language==="en")&&Qe.setLocale(this.language)}render(){const e=this.actions.map(t=>this._generateActionGroup(t));return k.html`
252
258
  <div class="action-buttons" tabindex="0">${e}</div>
253
- `}};qe([m.property({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);qe([m.property({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);qe([m.property({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=qe([Z.localized()],exports.LuzmoGridItemActionsMenu);const Ys=':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var Js=Object.defineProperty,D=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Js(e,t,r),r};class M extends Xt.LuzmoElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=e=>_.html`
259
+ `}};Ye([p.property({type:String,reflect:!0})],exports.LuzmoGridItemActionsMenu.prototype,"placement",2);Ye([p.property({type:Array})],exports.LuzmoGridItemActionsMenu.prototype,"actions",2);Ye([p.property({type:String})],exports.LuzmoGridItemActionsMenu.prototype,"language",2);exports.LuzmoGridItemActionsMenu=Ye([oe.localized()],exports.LuzmoGridItemActionsMenu);const Ys=':host{display:block;width:100%}.grid-stack{width:100%;min-height:var(--luzmo-grid-min-height);position:relative;background:var(--luzmo-grid-background, var(--grid-background, var(--luzmo-background-color)))}.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-stack-item-content,.grid-stack[has-active-item] .grid-stack-item:not([active])>.grid-item-actions-popover{opacity:.5}.grid-stack .grid-stack-item[active]>.ui-resizable-handle,.grid-stack .grid-stack-item[active].ui-resizable-autohide>.ui-resizable-handle{display:block}.grid-stack .grid-stack-item.ui-resizable-resizing,.grid-stack .grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{opacity:var(--luzmo-grid-item-resizing-opacity, .8)!important}.grid-item-drag-handle{position:absolute;color:var(--luzmo-grid-item-drag-handle-color, #000);top:var(--luzmo-grid-item-drag-handle-position-top, 0);left:var(--luzmo-grid-item-drag-handle-position-left, 0);right:var(--luzmo-grid-item-drag-handle-position-right, auto);bottom:var(--luzmo-grid-item-drag-handle-position-bottom, auto);padding:var(--luzmo-grid-item-drag-handle-padding, .5rem);z-index:var(--luzmo-grid-item-drag-handle-z-index, 3);cursor:var(--luzmo-grid-item-drag-handle-cursor, move)}.grid-stack[dark-background] .grid-item-drag-handle{color:var(--luzmo-grid-item-drag-handle-color, #fff)}.grid-stack .grid-stack-item .grid-stack-item-content{overflow:hidden;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));background:var(--luzmo-grid-item-background, var(--grid-item-background, transparent));box-shadow:var(--luzmo-grid-item-box-shadow, var(--grid-item-box-shadow, none));border-style:var(--luzmo-grid-item-border-style, none);border-color:var(--luzmo-grid-item-border-color, transparent);-webkit-backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none);backdrop-filter:var(--luzmo-grid-item-backdrop-filter, none)}.grid-stack .grid-stack-item:not(.has-luzmo-viz-item) .grid-stack-item-content{border-style:var(--luzmo-grid-item-border-style, var(--grid-item-border-style, none));border-color:var(--luzmo-grid-item-border-color, var(--grid-item-border-color, transparent));border-width:var(--luzmo-grid-item-border-width, var(--grid-item-border-width, 0));border-top-width:var(--luzmo-grid-item-border-top-width, var(--grid-item-border-top-width, 0));border-right-width:var(--luzmo-grid-item-border-right-width, var(--grid-item-border-right-width, 0));border-bottom-width:var(--luzmo-grid-item-border-bottom-width, var(--grid-item-border-bottom-width, 0));border-left-width:var(--luzmo-grid-item-border-left-width, var(--grid-item-border-left-width, 0))}.grid-stack .grid-stack-placeholder>.placeholder-content{border-radius:var(--grid-item-border-radius, 4px)}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{display:block!important;position:absolute!important;z-index:var(--luzmo-grid-resize-handle-z-index, 100);background:var(--luzmo-grid-resize-handle-background, #fff);border-radius:var(--luzmo-grid-resize-handle-border-radius, 3px);opacity:var(--luzmo-grid-resize-handle-opacity, 0);transition:var(--luzmo-grid-resize-handle-transition, opacity .2s ease);box-shadow:0 0 6px #0000001a,0 0 2px #000000bf}:host .grid-stack[dark-background]>.grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack[dark-background]>.grid-stack-item:hover>.ui-resizable-handle{background:var(--luzmo-grid-resize-handle-background, #333);box-shadow:0 0 6px #ffffff1a,0 0 2px #ffffffbf}:host .grid-stack-item[active]>.ui-resizable-handle,:host .grid-stack-item:hover>.ui-resizable-handle{opacity:var(--luzmo-grid-resize-handle-opacity-hover, 1)}:host .grid-stack-item>.ui-resizable-handle:hover{opacity:var(--luzmo-grid-resize-handle-opacity-active, 1);background:var(--luzmo-grid-resize-handle-background-hover, var(--luzmo-background-color-highlight))}:host .grid-stack-item>.ui-resizable-n,:host .grid-stack-item>.ui-resizable-s{height:var(--luzmo-grid-resize-handle-edge-size, 8px);width:var(--luzmo-grid-resize-handle-side-size, 18px);left:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-n{cursor:n-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-top, 0px))}:host .grid-stack-item>.ui-resizable-s{cursor:s-resize;bottom:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-e,:host .grid-stack-item>.ui-resizable-w{width:var(--luzmo-grid-resize-handle-edge-size, 8px);height:var(--luzmo-grid-resize-handle-side-size, 18px);top:calc(50% - var(--luzmo-grid-resize-handle-side-size, 18px) / 2)}:host .grid-stack-item>.ui-resizable-e{cursor:e-resize;right:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-w{cursor:w-resize;left:calc(var(--luzmo-grid-resize-handle-edge-offset, -4px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-ne,:host .grid-stack-item>.ui-resizable-nw,:host .grid-stack-item>.ui-resizable-se,:host .grid-stack-item>.ui-resizable-sw{transform:none;background-image:none;width:var(--luzmo-grid-resize-handle-corner-size, 12px);height:var(--luzmo-grid-resize-handle-corner-size, 12px)}:host .grid-stack-item>.ui-resizable-ne{cursor:ne-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));right:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-right, 0px))}:host .grid-stack-item>.ui-resizable-nw{cursor:nw-resize;top:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-top, 0px));left:calc(var(--luzmo-grid-resize-handle-edge-offset, -6px) + var(--gs-item-margin-left, 0px))}:host .grid-stack-item>.ui-resizable-se{cursor:se-resize;right:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-right, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-sw{cursor:sw-resize;left:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-left, 0px));bottom:calc(var(--luzmo-grid-resize-handle-corner-offset, -4px) + var(--gs-item-margin-bottom, 0px))}:host .grid-stack-item>.ui-resizable-resizing .ui-resizable-handle{opacity:1!important;background:var(--luzmo-grid-resize-handle-background-active, var(--luzmo-background-color-highlight))}.grid-item-actions-popover{position:absolute;outline:none;border:none;padding:0;margin:0;z-index:2;overflow:visible;background:transparent}luzmo-grid-item-actions-menu{padding:var(--luzmo-grid-item-actions-padding, var(--grid-item-actions-padding))}.dimensions-hint-popover{font-size:var(--luzmo-grid-item-dimensions-hint-font-size, var(--luzmo-font-size-xs, 10px));font-family:var(--luzmo-grid-item-dimensions-hint-font-family, var(--luzmo-font-family, inherit));position:absolute;outline:none;border-width:var(--luzmo-grid-item-dimensions-hint-border-width, var(--luzmo-border-width));border-style:solid;border-color:var(--luzmo-grid-item-dimensions-hint-border-color, var(--luzmo-border-color));border-radius:var(--luzmo-grid-item-dimensions-hint-border-radius, var(--luzmo-border-radius));padding:var(--luzmo-grid-item-dimensions-hint-padding, var(--luzmo-spacing-1) var(--luzmo-spacing-2));margin:0;z-index:3;overflow:visible;background:var(--luzmo-grid-item-dimensions-hint-background, var(--luzmo-background-color));color:var(--luzmo-grid-item-dimensions-hint-color, var(--luzmo-font-color));pointer-events:none}luzmo-grid-item-actions-menu{--grid-item-actions-padding: 0 .75rem}luzmo-grid-item-actions-menu[placement=top-start],luzmo-grid-item-actions-menu[placement=top],luzmo-grid-item-actions-menu[placement=top-end],luzmo-grid-item-actions-menu[placement=bottom-start],luzmo-grid-item-actions-menu[placement=bottom],luzmo-grid-item-actions-menu[placement=bottom-end]{--grid-item-actions-padding: .75rem 0}.grid-stack-item:focus-visible{outline:none}.grid-stack-item:focus-visible .grid-stack-item-content:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color, var(--luzmo-primary));box-sizing:border-box;border-radius:var(--luzmo-grid-item-border-radius, var(--grid-item-border-radius, 4px));z-index:2}';var Js=Object.defineProperty,D=(s,e,t,i)=>{for(var r=void 0,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=n(e,t,r)||r);return r&&Js(e,t,r),r};class M extends Jt.LuzmoElement{constructor(){super(...arguments),this.appServer="https://app.luzmo.com/",this.apiHost="https://api.luzmo.com",this.language="en",this.contentLanguage="en",this.columns=48,this.rowHeight=16,this.viewMode=!1,this.placementItemActionsMenu="right-start",this.items=[],this.renderers={},this._initialized=!1,this.defaultRenderer=e=>k.html`
254
260
  <div class="grid-item-content">
255
261
  <div class="grid-item-type">${e.type}</div>
256
262
  </div>
257
- `,this._hasItemAdded=!1,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");!i||e.relatedTarget?.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{const t=this._focusedItemElement?.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,o={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let n=null;e.shiftKey&&o.canResize?n=o.resize:(e.ctrlKey||e.metaKey)&&o.canShrink?n=o.shrink:o.canMove&&(n=o.move),n&&this._grid.update(this._focusedItemElement,n)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{!this._focusedItemElement||e.relatedTarget?.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{const t=e.detail,i=e.target?.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,this._gridElement?.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(n=>{n!==i&&this._cleanupActiveItem(n)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const o=this.items.find(n=>n.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:o?.type,slots:o?.slots,options:o?.options,filters:o?.filters??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{const t=e.target?.closest(".grid-stack-item")||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const o=this.items.find(h=>h.id===r);if(!o)return;const n={...structuredClone(o),id:_e()},a=this.addGridItem(n);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:n.id,type:n.type,slots:n.slots,options:n.options,filters:n.filters},bubbles:!0,composed:!0}))}}static get styles(){return[_.unsafeCSS(Vs),_.unsafeCSS(Ys)]}async _loadTheme(e){e?.type==="custom"?this._fullTheme=structuredClone(e):e?.id&&Ke.systemThemeIds.includes(e.id)&&this._fullTheme?.id!==e.id?(this._fullTheme=await Ke.getTheme(e.id),this._fullTheme.id=e.id):e?.id&&this._fullTheme?.id!==e.id||!e&&this._fullTheme||(this._fullTheme=await Ke.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&await requestAnimationFrame(()=>{this._initializeGrid()}),this._grid&&this._grid?.margin([(this.theme?.margins?.[0]??16)/2,(this.theme?.margins?.[1]??16)/2].join(" ")),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&this._fullTheme?.margins&&this._grid?.margin([(this._fullTheme?.margins?.[0]??16)/2,(this._fullTheme?.margins?.[1]??16)/2].join(" ")))}updated(e){super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),o=e.has("theme");this.items.forEach(n=>{n.id=n.id??_e()}),this._initialized&&this._grid&&(r||this._hasItemAdded)&&(this._hasItemAdded&&this._gridItemElements.forEach(n=>{n.hasAttribute("orphan")&&n.remove()}),this._hasItemAdded=!1,this._grid?.setAnimation(!1),this._grid?.batchUpdate(),this._grid?.removeAll(!1),this.items.forEach(n=>{const a=[...this._gridItemElements].find(h=>h.getAttribute("luzmo-grid-item-id")===n.id);a&&(this._grid?.makeWidget(a,{x:n?.position?.col??0,y:n?.position?.row??0,w:n?.position?.sizeX??1,h:n?.position?.sizeY??1,id:n.id}),this._grid?.batchUpdate(!1),this._grid?.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),o&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(this._fullTheme?.margins?.[0]??16)/2,marginLeft:(this._fullTheme?.margins?.[1]??16)/2,marginRight:(this._fullTheme?.margins?.[1]??16)/2,marginBottom:(this._fullTheme?.margins?.[0]??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,minRow:1,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=b.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(t=>{const i=t.getAttribute("luzmo-grid-item-id"),r=this.items.find(n=>n.id===i),o={id:i,x:r?.position?.col??0,y:r?.position?.row??0,w:r?.position?.sizeX??1,h:r?.position?.sizeY??1};this._grid?.makeWidget(t,o)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(t,i)=>{const r=i.getAttribute("gs-w")??"",o=i.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(i,r,o)}),this._grid.on("resize",(t,i)=>{const r=i.getAttribute("gs-w")??"",o=i.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(i,r,o)}),this._grid.on("resizestop",(t,i)=>{this._removeDimensionsHint(i)}),this._grid.on("change",(t,i)=>{i.forEach(r=>{if(!r?.id)return;const o=this.items.findIndex(n=>n.id===r.id);o!==-1&&(this.items[o]={...this.items[o],position:{sizeX:r.w??1,sizeY:r.h??1,row:r.y??0,col:r.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const o=document.createElement("div");o.className="dimensions-hint-popover",o.setAttribute("popover","hint"),o.style.display=t.length>0&&i.length>0?"block":"none",o.textContent=`${t} × ${i}`,e.append(o);const n=10-(this.theme?.margins?.[0]??10),a=Rt(e,o,async()=>{const{x:h,y:l}=await Dt(e,o,{placement:"bottom",middleware:[At(n),Mt()]});o.style.left=`${h}px`,o.style.top=`${l}px`});o._cleanup=a,o.matches(":popover-open")||o.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=t.element?.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=Kt(e?.actionsMenu)??Kt(this.defaultItemActionsMenu)??mi();return!gi.itemTypes.find(r=>r.type===e?.type)?.containsData&&!e?.actionsMenu&&!this.defaultItemActionsMenu&&(t=t.map(r=>({...r,actions:r.actions?.filter(o=>o.action!=="edit-data")}))),_.html`
263
+ `,this._hasItemAdded=!1,this._handleMouseout=e=>{if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");if(!i)return;const r=e.relatedTarget;r!=null&&r.closest(".grid-item-actions-popover")||i.hasAttribute("active")||this._removeItemActionsMenuPopover(i)},this._handleKeyDown=e=>{if(!this.viewMode){if(e.key==="Delete"&&this._focusedItemElement)this._handleDeleteItem(new Event("delete"));else if(e.key==="Escape"&&this._focusedItemElement)this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus();else if(e.key==="Enter"&&this._focusedItemElement)e.preventDefault(),e.stopPropagation(),this._activeItemElement&&(this._activeItemElement.removeAttribute("active"),this._gridElement.removeAttribute("has-active-item"),this._removeItemActionsMenuPopover(this._activeItemElement),this._activeItemElement=void 0),this._gridElement.querySelectorAll(".grid-stack-item").forEach(t=>{t!==this._focusedItemElement&&this._removeItemActionsMenuPopover(t)}),this._createItemActionsMenuPopover(this._focusedItemElement),requestAnimationFrame(()=>{var i;const t=(i=this._focusedItemElement)==null?void 0:i.querySelector("luzmo-grid-item-actions-menu");t&&t.focus()});else if(this._focusedItemElement&&this._grid&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();const t=this._focusedItemElement.gridstackNode;if(!t)return;const i=this.columns??48,o={ArrowLeft:{move:{x:t.x-1},resize:{x:t.x-1,w:t.w+1},shrink:{w:t.w-1},canMove:t.x>0,canResize:t.x>0,canShrink:t.w>1},ArrowRight:{move:{x:t.x+1},resize:{w:t.w+1},shrink:{x:t.x+1,w:t.w-1},canMove:t.x<i-t.w,canResize:t.x+t.w<i,canShrink:t.w>1},ArrowUp:{move:{y:t.y-1},resize:{y:t.y-1,h:t.h+1},shrink:{h:t.h-1},canMove:t.y>0,canResize:t.y>0,canShrink:t.h>1},ArrowDown:{move:{y:t.y+1},resize:{h:t.h+1},shrink:{y:t.y+1,h:t.h-1},canMove:!0,canResize:!0,canShrink:t.h>1}}[e.key];let n=null;e.shiftKey&&o.canResize?n=o.resize:(e.ctrlKey||e.metaKey)&&o.canShrink?n=o.shrink:o.canMove&&(n=o.move),n&&this._grid.update(this._focusedItemElement,n)}}},this._handleFocus=e=>{const i=e.target.closest(".grid-stack-item");i&&(this._focusedItemElement&&this._focusedItemElement!==i&&(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement)),this._focusedItemElement=i,i.setAttribute("focused","true"))},this._handleBlur=e=>{if(!this._focusedItemElement)return;const t=e.relatedTarget;t!=null&&t.closest("luzmo-grid-item-actions-menu")||(this._focusedItemElement.removeAttribute("focused"),this._removeItemActionsMenuPopover(this._focusedItemElement),this._focusedItemElement=void 0,this._gridElement.focus())},this._handleDocumentClick=e=>{const t=e.composedPath(),i=this._gridElement.querySelector(".grid-stack-item[active]");if(!i||t.includes(i))return;const r=i.querySelector(".grid-item-actions-popover");r&&t.includes(r)||this._cleanupActiveItem(i)},this._handleAction=e=>{var o,n;const t=e.detail,i=(o=e.target)==null?void 0:o.closest(".grid-stack-item");if(!i)return;const r=i.getAttribute("gs-id");if(t.type==="toggle"&&t.action===this._activeItemActionToggle&&i===this._activeItemElement){this._activeItemElement=void 0,this._activeItemActionToggle=void 0,(n=this._gridElement)==null||n.removeAttribute("has-active-item"),i.removeAttribute("active"),this._cleanupActiveItem(i);return}if(!["delete","clone"].includes(t.action)){this._gridElement.querySelectorAll(".grid-stack-item").forEach(l=>{l!==i&&this._cleanupActiveItem(l)}),t.type==="toggle"&&(this._activeItemElement=i,this._activeItemActionToggle=t.action,this._gridElement.setAttribute("has-active-item","true"),i.setAttribute("active","true"));const a=this.items.find(l=>l.id===r);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,element:i,id:r,type:a==null?void 0:a.type,slots:a==null?void 0:a.slots,options:a==null?void 0:a.options,filters:(a==null?void 0:a.filters)??[]},bubbles:!0,composed:!0,cancelable:!0}))}t.action==="delete"?(this._handleDeleteItem(e),this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:t.action,items:this.items,deletedId:r},bubbles:!0,composed:!0,cancelable:!0}))):t.action==="clone"&&this._handleCloneItem(e)},this._handleDeleteItem=e=>{var i;const t=((i=e.target)==null?void 0:i.closest(".grid-stack-item"))||this._focusedItemElement;t&&this.removeGridItemById(t.getAttribute("gs-id")||"")},this._handleCloneItem=e=>{const i=e.target.closest(".grid-stack-item");if(!i||!this._grid)return;const r=i.getAttribute("gs-id");if(!r)return;const o=this.items.find(l=>l.id===r);if(!o)return;const n={...structuredClone(o),id:ke()},a=this.addGridItem(n);this.dispatchEvent(new CustomEvent("grid-item-action",{detail:{action:"clone",items:this.items,originalElement:i,element:a,id:n.id,type:n.type,slots:n.slots,options:n.options,filters:n.filters},bubbles:!0,composed:!0}))}}static get styles(){return[k.unsafeCSS(Vs),k.unsafeCSS(Ys)]}async _loadTheme(e){var t,i,r,o,n,a,l;(e==null?void 0:e.type)==="custom"?this._fullTheme=structuredClone(e):e!=null&&e.id&&Je.systemThemeIds.includes(e.id)&&((t=this._fullTheme)==null?void 0:t.id)!==e.id?(this._fullTheme=await Je.getTheme(e.id),this._fullTheme.id=e.id):e!=null&&e.id&&((i=this._fullTheme)==null?void 0:i.id)!==e.id||!e&&this._fullTheme||(this._fullTheme=await Je.getTheme("default")),this._initialized&&this._updateThemeProperties(),!this._initialized&&this._gridElement&&await requestAnimationFrame(()=>{this._initializeGrid()}),this._grid&&((l=this._grid)==null||l.margin([(((o=(r=this.theme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this.theme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))),this.requestUpdate()}firstUpdated(){document.addEventListener("click",this._handleDocumentClick),this.addEventListener("keydown",this._handleKeyDown),this._loadTheme(this.theme)}disconnectedCallback(){super.disconnectedCallback(),this._cleanup(),document.removeEventListener("click",this._handleDocumentClick),this.removeEventListener("keydown",this._handleKeyDown)}willUpdate(e){var i,r,o,n,a,l;super.willUpdate(e),e.has("_initialized")&&(this._updateThemeProperties(),this._initialized&&this._grid&&((i=this._fullTheme)!=null&&i.margins)&&((l=this._grid)==null||l.margin([(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[0])??16)/2,(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2].join(" "))))}updated(e){var n,a,l;super.updated(e);const t=e.has("contentLanguage"),i=e.has("viewMode"),r=e.has("items"),o=e.has("theme");this.items.forEach(h=>{h.id=h.id??ke()}),this._initialized&&this._grid&&(r||this._hasItemAdded)&&(this._hasItemAdded&&this._gridItemElements.forEach(h=>{h.hasAttribute("orphan")&&h.remove()}),this._hasItemAdded=!1,(n=this._grid)==null||n.setAnimation(!1),(a=this._grid)==null||a.batchUpdate(),(l=this._grid)==null||l.removeAll(!1),this.items.forEach(h=>{var c,u,g,y,v,b,w;const d=[...this._gridItemElements].find(x=>x.getAttribute("luzmo-grid-item-id")===h.id);d&&((v=this._grid)==null||v.makeWidget(d,{x:((c=h==null?void 0:h.position)==null?void 0:c.col)??0,y:((u=h==null?void 0:h.position)==null?void 0:u.row)??0,w:((g=h==null?void 0:h.position)==null?void 0:g.sizeX)??1,h:((y=h==null?void 0:h.position)==null?void 0:y.sizeY)??1,id:h.id}),(b=this._grid)==null||b.batchUpdate(!1),(w=this._grid)==null||w.setAnimation(!0))})),t&&this._updateLuzmoVizItemsLanguage(),this._initialized&&this._grid&&i&&this.viewMode!==e.get("viewMode")&&(this.viewMode?(this._grid.disable(),this._activeItemElement&&(this._cleanupActiveItem(this._activeItemElement),this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item"))):this._grid.enable()),o&&this._loadTheme(this.theme)}_updateLuzmoVizItemsLanguage(){this._gridItemElements.forEach(e=>{const t=e.querySelector("luzmo-embed-viz-item");t&&(t.options={...t.options,locale:this.contentLanguage})})}_handleMouseover(e){if(this.viewMode)return;const i=e.target.closest(".grid-stack-item");i&&this._createItemActionsMenuPopover(i)}_cleanupActiveItem(e){e.removeAttribute("active"),this._activeItemElement===e&&(this._activeItemElement=void 0,this._gridElement.removeAttribute("has-active-item")),this._removeItemActionsMenuPopover(e)}_cleanup(){for(const e of this._gridItemElements)this._cleanupActiveItem(e);this._grid&&(this._grid.destroy(),this._grid=void 0),this._initialized=!1}_initializeGrid(){var t,i,r,o,n,a,l,h;if(this._initialized||!this._gridElement)return;const e={column:this.columns??48,cellHeight:this.rowHeight??16,marginTop:(((i=(t=this._fullTheme)==null?void 0:t.margins)==null?void 0:i[0])??16)/2,marginLeft:(((o=(r=this._fullTheme)==null?void 0:r.margins)==null?void 0:o[1])??16)/2,marginRight:(((a=(n=this._fullTheme)==null?void 0:n.margins)==null?void 0:a[1])??16)/2,marginBottom:(((h=(l=this._fullTheme)==null?void 0:l.margins)==null?void 0:h[0])??16)/2,animate:!0,auto:!1,float:!1,removable:!1,acceptWidgets:!0,disableDrag:this.viewMode,disableResize:this.viewMode,minRow:1,resizable:{handles:["n","ne","e","se","s","sw","w","nw"].join(", ")},handle:".grid-item-drag-handle"};this._grid=_.init(e,this._gridElement),this._grid.batchUpdate(),this._gridItemElements.forEach(d=>{var y,v,b,w,x;const c=d.getAttribute("luzmo-grid-item-id"),u=this.items.find(S=>S.id===c),g={id:c,x:((y=u==null?void 0:u.position)==null?void 0:y.col)??0,y:((v=u==null?void 0:u.position)==null?void 0:v.row)??0,w:((b=u==null?void 0:u.position)==null?void 0:b.sizeX)??1,h:((w=u==null?void 0:u.position)==null?void 0:w.sizeY)??1};(x=this._grid)==null||x.makeWidget(d,g)}),this._grid.batchUpdate(!1),this._initialized=!0,this._grid.on("resizestart",(d,c)=>{const u=c.getAttribute("gs-w")??"",g=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,g)}),this._grid.on("resize",(d,c)=>{const u=c.getAttribute("gs-w")??"",g=c.getAttribute("gs-h")??"";this._createOrUpdateDimensionsHint(c,u,g)}),this._grid.on("resizestop",(d,c)=>{this._removeDimensionsHint(c)}),this._grid.on("change",(d,c)=>{c.forEach(u=>{if(!(u!=null&&u.id))return;const g=this.items.findIndex(y=>y.id===u.id);g!==-1&&(this.items[g]={...this.items[g],position:{sizeX:u.w??1,sizeY:u.h??1,row:u.y??0,col:u.x??0}})}),this.dispatchEvent(new CustomEvent("grid-changed",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}),this.dispatchEvent(new CustomEvent("grid-ready",{detail:{element:this._gridElement,grid:this._grid,items:this.items},bubbles:!0,composed:!0}))}_createOrUpdateDimensionsHint(e,t,i){var l,h;const r=e.querySelector(".dimensions-hint-popover");if(r){r.style.display=t.length>0&&i.length>0?"block":"none",r.textContent=`${t} × ${i}`;return}const o=document.createElement("div");o.className="dimensions-hint-popover",o.setAttribute("popover","hint"),o.style.display=t.length>0&&i.length>0?"block":"none",o.textContent=`${t} × ${i}`,e.append(o);const n=10-(((h=(l=this.theme)==null?void 0:l.margins)==null?void 0:h[0])??10),a=Rt(e,o,async()=>{const{x:d,y:c}=await Dt(e,o,{placement:"bottom",middleware:[At(n),Mt()]});o.style.left=`${d}px`,o.style.top=`${c}px`});o._cleanup=a,o.matches(":popover-open")||o.showPopover()}_removeDimensionsHint(e){const t=e.querySelector(".dimensions-hint-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}get grid(){return this._grid}get gridItems(){return this.items.map(e=>{var r;const t={item:e,element:this._gridElement.querySelector(`[gs-id="${e.id}"]`)},i=(r=t.element)==null?void 0:r.querySelector("luzmo-embed-viz-item");return i&&(t.luzmoElement=i),t})}registerRenderer(e,t){this.renderers={...this.renderers,[e]:t}}_renderOverlayContent(e){let t=Kt(e==null?void 0:e.actionsMenu)??Kt(this.defaultItemActionsMenu)??gi();const i=yi.itemTypes.find(r=>r.type===(e==null?void 0:e.type));return!(i!=null&&i.containsData)&&!(e!=null&&e.actionsMenu)&&!this.defaultItemActionsMenu&&(t=t.map(r=>{var o;return{...r,actions:(o=r.actions)==null?void 0:o.filter(n=>n.action!=="edit-data")}})),k.html`
258
264
  <div class="grid-item-actions-popover" popover="manual">
259
265
  <luzmo-grid-item-actions-menu
260
266
  .actions=${t}
261
- placement=${e?.placementActionsMenu??this.placementItemActionsMenu??"right-start"}
267
+ placement=${(e==null?void 0:e.placementActionsMenu)??this.placementItemActionsMenu??"right-start"}
262
268
  .language=${this.language}
263
269
  @action=${this._handleAction}
264
270
  >
265
271
  </luzmo-grid-item-actions-menu>
266
272
  </div>
267
- `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const n=document.createDocumentFragment();_.render(this._renderOverlayContent(r?.item),n),t=n.querySelector(".grid-item-actions-popover"),e.append(t)}const o=Rt(i,t,async()=>{const{x:n,y:a}=await Dt(i,t,{placement:r?.item?.placementActionsMenu??this.placementItemActionsMenu??"right-start",middleware:[At(0),Mt({crossAxis:!1})]});t.style.left=`${n}px`,t.style.top=`${a}px`});t._cleanup=o,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const r=new bt.Color(e.color),o={r:Math.round(r.srgb.r*255),g:Math.round(r.srgb.g*255),b:Math.round(r.srgb.b*255)},n=this._fullTheme.margins?.[0]??16,a=Math.min(n/10,2),h=(l,d)=>d>=1?`rgba(${l.r},${l.g},${l.b},1)`:d<=0?`rgba(${l.r},${l.g},${l.b},0)`:`rgba(${l.r},${l.g},${l.b},${d})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${a*2}px ${a*4}px ${h(o,.16)}, 0 ${a*2}px ${a*4}px ${h(o,.23)}`:e.size==="M"?t=`0 ${a*8}px ${a*16}px ${h(o,.19)}, 0 ${a*4}px ${a*4}px ${h(o,.23)}`:e.size==="L"&&(t=`0 ${a*12}px ${a*24}px ${h(o,.25)}, 0 ${a*8}px ${a*8}px ${h(o,.22)}`)}new Map([["--grid-font-family",this._fullTheme?.font?.fontFamily],["--grid-background",this._fullTheme?.background],["--grid-item-box-shadow",t],["--grid-item-background",this._fullTheme?.itemsBackground],["--grid-item-border-color",this._fullTheme?.borders?.["border-color"]],["--grid-item-border-style",this._fullTheme?.borders?.["border-style"]],["--grid-item-border-radius",this._fullTheme?.borders?.["border-radius"]],["--grid-item-border-width",`${this._fullTheme?.borders?.["border-top-width"]}`],["--grid-item-border-top-width",this._fullTheme?.borders?.["border-top-width"]],["--grid-item-border-right-width",this._fullTheme?.borders?.["border-right-width"]],["--grid-item-border-bottom-width",this._fullTheme?.borders?.["border-bottom-width"]],["--grid-item-border-left-width",this._fullTheme?.borders?.["border-left-width"]]]).forEach((r,o)=>{r?this.style.setProperty(o,r):this.style.removeProperty(o)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){!this._initialized&&this._gridElement&&console.warn("Grid is not initialized, wait for grid-ready event");const t={...structuredClone(e),id:_e(),position:structuredClone(e?.position)??{sizeX:1,sizeY:1,col:0,row:0}},i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();_.render(i,r,{host:this}),this._gridElement.append(r);const o=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`);o.setAttribute("orphan","true");const n={x:t.position?.col??0,y:t.position?.row??0,w:t.position?.sizeX??1,h:t.position?.sizeY??1,autoPosition:!0,id:t.id},a=this._grid?.makeWidget(o,n);return a&&(t.position={sizeX:Number.parseInt(a.getAttribute("gs-w")??"1",10),sizeY:Number.parseInt(a.getAttribute("gs-h")??"1",10),col:Number.parseInt(a.getAttribute("gs-x")??"0",10),row:Number.parseInt(a.getAttribute("gs-y")??"0",10)}),this.items.push(t),this._hasItemAdded=!0,this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const h=o.getBoundingClientRect();(h.bottom>window.innerHeight||h.top<0)&&o.scrollIntoView({behavior:"smooth",block:"center"})}),o}removeGridItem(e){this.removeGridItemById(e?.id??"")}removeGridItemById(e){if(!e)return;const t=this.getGridItemById(e)?.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(r=>r.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=this._fullTheme?.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return _.html`
273
+ `}_createItemActionsMenuPopover(e){let t=e.querySelector(".grid-item-actions-popover");const i=e.querySelector(".grid-stack-item-content"),r=this.getGridItemById(e.getAttribute("gs-id")??"");if(!t){const n=document.createDocumentFragment();k.render(this._renderOverlayContent(r==null?void 0:r.item),n),t=n.querySelector(".grid-item-actions-popover"),e.append(t)}const o=Rt(i,t,async()=>{var l;const{x:n,y:a}=await Dt(i,t,{placement:((l=r==null?void 0:r.item)==null?void 0:l.placementActionsMenu)??this.placementItemActionsMenu??"right-start",middleware:[At(0),Mt({crossAxis:!1})]});t.style.left=`${n}px`,t.style.top=`${a}px`});t._cleanup=o,t.matches(":popover-open")||t.showPopover()}_removeItemActionsMenuPopover(e){const t=e.querySelector(".grid-item-actions-popover");t&&(t._cleanup&&(t._cleanup(),delete t._cleanup),t.matches(":popover-open")&&t.hidePopover(),t.remove())}_updateThemeProperties(){var r,o,n,a,l,h,d,c,u,g,y,v,b,w,x,S,A,R,U,W,se;if(!this._fullTheme)return;const e=this._fullTheme.boxShadow;let t="";if(e){const F=new bt.Color(e.color),L={r:Math.round(F.srgb.r*255),g:Math.round(F.srgb.g*255),b:Math.round(F.srgb.b*255)},Ie=((r=this._fullTheme.margins)==null?void 0:r[0])??16,H=Math.min(Ie/10,2),Z=(C,le)=>le>=1?`rgba(${C.r},${C.g},${C.b},1)`:le<=0?`rgba(${C.r},${C.g},${C.b},0)`:`rgba(${C.r},${C.g},${C.b},${le})`;e.size==="none"?t="none":e.size==="S"?t=`0 ${H*2}px ${H*4}px ${Z(L,.16)}, 0 ${H*2}px ${H*4}px ${Z(L,.23)}`:e.size==="M"?t=`0 ${H*8}px ${H*16}px ${Z(L,.19)}, 0 ${H*4}px ${H*4}px ${Z(L,.23)}`:e.size==="L"&&(t=`0 ${H*12}px ${H*24}px ${Z(L,.25)}, 0 ${H*8}px ${H*8}px ${Z(L,.22)}`)}new Map([["--grid-font-family",(n=(o=this._fullTheme)==null?void 0:o.font)==null?void 0:n.fontFamily],["--grid-background",(a=this._fullTheme)==null?void 0:a.background],["--grid-item-box-shadow",t],["--grid-item-background",(l=this._fullTheme)==null?void 0:l.itemsBackground],["--grid-item-border-color",(d=(h=this._fullTheme)==null?void 0:h.borders)==null?void 0:d["border-color"]],["--grid-item-border-style",(u=(c=this._fullTheme)==null?void 0:c.borders)==null?void 0:u["border-style"]],["--grid-item-border-radius",(y=(g=this._fullTheme)==null?void 0:g.borders)==null?void 0:y["border-radius"]],["--grid-item-border-width",`${(b=(v=this._fullTheme)==null?void 0:v.borders)==null?void 0:b["border-top-width"]}`],["--grid-item-border-top-width",(x=(w=this._fullTheme)==null?void 0:w.borders)==null?void 0:x["border-top-width"]],["--grid-item-border-right-width",(A=(S=this._fullTheme)==null?void 0:S.borders)==null?void 0:A["border-right-width"]],["--grid-item-border-bottom-width",(U=(R=this._fullTheme)==null?void 0:R.borders)==null?void 0:U["border-bottom-width"]],["--grid-item-border-left-width",(se=(W=this._fullTheme)==null?void 0:W.borders)==null?void 0:se["border-left-width"]]]).forEach((F,L)=>{F?this.style.setProperty(L,F):this.style.removeProperty(L)})}getGridItemById(e){return this.gridItems.find(t=>t.item.id===e)}addGridItem(e){var l,h,d,c,u;!this._initialized&&this._gridElement&&console.warn("Grid is not initialized, wait for grid-ready event");const t={...structuredClone(e),id:ke(),position:structuredClone(e==null?void 0:e.position)??{sizeX:1,sizeY:1,col:0,row:0}},i=this._renderItem(t,this.items.length),r=document.createDocumentFragment();k.render(i,r,{host:this}),this._gridElement.append(r);const o=this._gridElement.querySelector(`[luzmo-grid-item-id="${t.id}"]`);o.setAttribute("orphan","true");const n={x:((l=t.position)==null?void 0:l.col)??0,y:((h=t.position)==null?void 0:h.row)??0,w:((d=t.position)==null?void 0:d.sizeX)??1,h:((c=t.position)==null?void 0:c.sizeY)??1,autoPosition:!0,id:t.id},a=(u=this._grid)==null?void 0:u.makeWidget(o,n);return a&&(t.position={sizeX:Number.parseInt(a.getAttribute("gs-w")??"1",10),sizeY:Number.parseInt(a.getAttribute("gs-h")??"1",10),col:Number.parseInt(a.getAttribute("gs-x")??"0",10),row:Number.parseInt(a.getAttribute("gs-y")??"0",10)}),this.items.push(t),this._hasItemAdded=!0,this._activeItemElement&&this._cleanupActiveItem(this._activeItemElement),requestAnimationFrame(()=>{const g=o.getBoundingClientRect();(g.bottom>window.innerHeight||g.top<0)&&o.scrollIntoView({behavior:"smooth",block:"center"})}),o}removeGridItem(e){this.removeGridItemById((e==null?void 0:e.id)??"")}removeGridItemById(e){var r;if(!e)return;const t=(r=this.getGridItemById(e))==null?void 0:r.element;t&&this._grid&&(this._grid.removeWidget(t),this._focusedItemElement=void 0);const i=this.items.findIndex(o=>o.id===e);i!==-1&&this.items.splice(i,1),this._removeItemActionsMenuPopover(t),t&&this._activeItemElement===t&&this._cleanupActiveItem(t)}_renderItem(e,t){var o;const i={...e.options,locale:this.contentLanguage};i.theme||(i.theme=(o=this._fullTheme)!=null&&o.id?{id:this._fullTheme.id}:structuredClone(this._fullTheme));const r=!this.viewMode;return k.html`
268
274
  <div
269
275
  class="luzmo-grid-item has-luzmo-viz-item"
270
- luzmo-grid-item-id=${e.id??_e()}
276
+ luzmo-grid-item-id=${e.id??ke()}
271
277
  tabindex="0"
272
278
  role="row"
273
279
  @mouseover=${this._handleMouseover}
@@ -280,11 +286,11 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
280
286
  role="gridcell"
281
287
  aria-label="Grid item ${t+1}"
282
288
  >
283
- ${this._initialized?_.html` ${r?_.html`
289
+ ${this._initialized?k.html` ${r?k.html`
284
290
  <div class="grid-item-drag-handle">
285
- <luzmo-icon .icon=${Y.luzmoArrows} size="s"></luzmo-icon>
291
+ <luzmo-icon .icon=${ie.luzmoArrows} size="s"></luzmo-icon>
286
292
  </div>
287
- `:_.html``}
293
+ `:k.html``}
288
294
  <luzmo-embed-viz-item
289
295
  .appServer=${this.appServer}
290
296
  .apiHost=${this.apiHost}
@@ -297,10 +303,10 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
297
303
  .language=${this.contentLanguage}
298
304
  .contextId=${e.contextId}
299
305
  .canFilter=${e.canFilter??"all"}
300
- ></luzmo-embed-viz-item>`:_.html``}
306
+ ></luzmo-embed-viz-item>`:k.html``}
301
307
  </div>
302
308
  </div>
303
- `}_renderGrid(){const e=this.items.map((i,r)=>(i.id=i.id??_e(),this._renderItem(i,r)));let t=!1;return this._initialized&&(this._fullTheme?.itemsBackground||this._fullTheme?.background)&&(t=new bt.Color(this._fullTheme.itemsBackground??this._fullTheme.background).luminance<.5),_.html`
309
+ `}_renderGrid(){var i,r;const e=this.items.map((o,n)=>(o.id=o.id??ke(),this._renderItem(o,n)));let t=!1;return this._initialized&&((i=this._fullTheme)!=null&&i.itemsBackground||(r=this._fullTheme)!=null&&r.background)&&(t=new bt.Color(this._fullTheme.itemsBackground??this._fullTheme.background).luminance<.5),k.html`
304
310
  <div
305
311
  ?dark-background=${t}
306
312
  class="grid-stack"
@@ -310,4 +316,4 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
310
316
  >
311
317
  ${e}
312
318
  </div>
313
- `}render(){return this._renderGrid()}}D([m.property({type:String,attribute:"app-server",reflect:!0})],M.prototype,"appServer");D([m.property({type:String,attribute:"api-host",reflect:!0})],M.prototype,"apiHost");D([m.property({type:String,attribute:"auth-key",reflect:!0})],M.prototype,"authKey");D([m.property({type:String,attribute:"auth-token",reflect:!0})],M.prototype,"authToken");D([m.property({type:Number,attribute:"cache-time",reflect:!0})],M.prototype,"cacheTime");D([m.property({type:String,reflect:!0})],M.prototype,"language");D([m.property({type:String,attribute:"content-language",reflect:!0})],M.prototype,"contentLanguage");D([m.property({type:Number,reflect:!0})],M.prototype,"columns");D([m.property({type:Number,reflect:!0,attribute:"row-height"})],M.prototype,"rowHeight");D([m.property({type:Boolean,reflect:!0,attribute:"view-mode"})],M.prototype,"viewMode");D([m.property({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],M.prototype,"placementItemActionsMenu");D([m.property({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],M.prototype,"defaultItemActionsMenu");D([m.property({type:Object,reflect:!0})],M.prototype,"theme");D([m.property({type:Array,reflect:!1})],M.prototype,"items");D([m.property({type:Object,reflect:!1})],M.prototype,"renderers");D([m.state()],M.prototype,"_initialized");D([m.query(".grid-stack")],M.prototype,"_gridElement");D([m.queryAll(".luzmo-grid-item")],M.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",M);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=M;
319
+ `}render(){return this._renderGrid()}}D([p.property({type:String,attribute:"app-server",reflect:!0})],M.prototype,"appServer");D([p.property({type:String,attribute:"api-host",reflect:!0})],M.prototype,"apiHost");D([p.property({type:String,attribute:"auth-key",reflect:!0})],M.prototype,"authKey");D([p.property({type:String,attribute:"auth-token",reflect:!0})],M.prototype,"authToken");D([p.property({type:Number,attribute:"cache-time",reflect:!0})],M.prototype,"cacheTime");D([p.property({type:String,reflect:!0})],M.prototype,"language");D([p.property({type:String,attribute:"content-language",reflect:!0})],M.prototype,"contentLanguage");D([p.property({type:Number,reflect:!0})],M.prototype,"columns");D([p.property({type:Number,reflect:!0,attribute:"row-height"})],M.prototype,"rowHeight");D([p.property({type:Boolean,reflect:!0,attribute:"view-mode"})],M.prototype,"viewMode");D([p.property({type:String,reflect:!0,attribute:"placement-item-actions-menu"})],M.prototype,"placementItemActionsMenu");D([p.property({type:Array,reflect:!0,attribute:"default-item-actions-menu"})],M.prototype,"defaultItemActionsMenu");D([p.property({type:Object,reflect:!0})],M.prototype,"theme");D([p.property({type:Array,reflect:!1})],M.prototype,"items");D([p.property({type:Object,reflect:!1})],M.prototype,"renderers");D([p.state()],M.prototype,"_initialized");D([p.query(".grid-stack")],M.prototype,"_gridElement");D([p.queryAll(".luzmo-grid-item")],M.prototype,"_gridItemElements");customElements.get("luzmo-grid")||customElements.define("luzmo-grid",M);customElements.get("luzmo-grid-item-actions-menu")||customElements.define("luzmo-grid-item-actions-menu",exports.LuzmoGridItemActionsMenu);exports.LuzmoGrid=M;