@trintel/zooy 1.0.1-beta.0 → 1.0.1

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 (284) hide show
  1. package/README.md +284 -339
  2. package/dist/chunks/{16-ChlL35BX.js → 16-BXti8Tu-.js} +6 -6
  3. package/dist/chunks/16-CMCRqVYz.js +1 -0
  4. package/dist/chunks/{20-CZPIOG-A.js → 20-CQLnFcRb.js} +9 -9
  5. package/dist/chunks/20-Df0dXwyx.js +1 -0
  6. package/dist/chunks/button-B1jzfT-Z.js +272 -0
  7. package/dist/chunks/button-C-oX8EmF.js +66 -0
  8. package/dist/chunks/button-skeleton-CK3BHdja.js +21 -0
  9. package/dist/chunks/{button-skeleton-COf2kCDL.js → button-skeleton-DoCp6sBb.js} +10 -9
  10. package/dist/chunks/checkbox-CgFjYxQ_.js +201 -0
  11. package/dist/chunks/checkbox-t3G-H1NN.js +40 -0
  12. package/dist/chunks/{class-map-BfNAkUL_.js → class-map-D6tjF27Y.js} +2 -2
  13. package/dist/chunks/{class-map-DEHG4tmw.js → class-map-FWQBIzSx.js} +1 -1
  14. package/dist/chunks/collection-helpers-Bk68Vaau.js +7 -0
  15. package/dist/chunks/collection-helpers-afBvMQaC.js +1 -0
  16. package/dist/chunks/content-switcher-item-CedjjtvP.js +351 -0
  17. package/dist/chunks/content-switcher-item-c4WBWz31.js +27 -0
  18. package/dist/chunks/defs-C88lSWuJ.js +1 -0
  19. package/dist/chunks/defs-Do0OvCKd.js +1165 -0
  20. package/dist/chunks/dropdown-item-C0SHr4st.js +69 -0
  21. package/dist/chunks/dropdown-item-Dh5IEXDr.js +621 -0
  22. package/dist/chunks/{focus-rQSNiwy7.js → focus-B3iymVyL.js} +1 -1
  23. package/dist/chunks/{focus-B9JYe97T.js → focus-WnKGH_xB.js} +1 -1
  24. package/dist/chunks/{icon-loader-Dk_AU26w.js → icon-loader-CJxyg-lp.js} +1 -1
  25. package/dist/chunks/{icon-loader-o_JYDmJX.js → icon-loader-ChKeNR4s.js} +1 -1
  26. package/dist/chunks/{icon-loader-utils-BEOGXn0q.js → icon-loader-utils-BwViqIXz.js} +23 -23
  27. package/dist/chunks/icon-loader-utils-DK8DViXt.js +5 -0
  28. package/dist/chunks/if-defined-DYWhlnlE.js +5 -0
  29. package/dist/chunks/{if-defined-C0yJsxi2.js → if-defined-eJcDYClo.js} +1 -1
  30. package/dist/chunks/{if-non-empty-DTGflHtA.js → if-non-empty-COTeEFkK.js} +1 -1
  31. package/dist/chunks/if-non-empty-CxMysAQW.js +1 -0
  32. package/dist/chunks/index-0AElqkkj.js +12 -0
  33. package/dist/chunks/{index-B3mXrMt1.js → index-4WNeLsiw.js} +4 -3
  34. package/dist/chunks/{index-BXczHDk-.js → index-4XJJobHw.js} +12 -11
  35. package/dist/chunks/index-7cXLLw89.js +881 -0
  36. package/dist/chunks/index-9fmHblh5.js +121 -0
  37. package/dist/chunks/{index-BwIoRMDI.js → index-B0nToMRj.js} +7 -6
  38. package/dist/chunks/index-B4SxU_Hu.js +87 -0
  39. package/dist/chunks/index-B5DpS-cb.js +2 -0
  40. package/dist/chunks/{index-CzTjJ8lP.js → index-B5GB0rQW.js} +47 -37
  41. package/dist/chunks/index-B8Ze9ISK.js +17 -0
  42. package/dist/chunks/index-BAAA4wkE.js +45 -0
  43. package/dist/chunks/index-BBWp83R-.js +160 -0
  44. package/dist/chunks/index-BBap1uCI.js +1 -0
  45. package/dist/chunks/index-BGGDxbLL.js +368 -0
  46. package/dist/chunks/index-BMquNDkd.js +381 -0
  47. package/dist/chunks/index-BQnyeVHX.js +1 -0
  48. package/dist/chunks/index-BRnzFxjk.js +25 -0
  49. package/dist/chunks/index-BbJQIwkY.js +452 -0
  50. package/dist/chunks/{index-hLI0Bnyb.js → index-Bb_1S0pr.js} +7 -6
  51. package/dist/chunks/index-BeMnerDj.js +111 -0
  52. package/dist/chunks/index-Bff6B9vY.js +254 -0
  53. package/dist/chunks/index-Bi9WliCA.js +683 -0
  54. package/dist/chunks/{index-D0xRAPD5.js → index-Bls8zdHV.js} +6 -5
  55. package/dist/chunks/index-Bo2QmpPO.js +1 -0
  56. package/dist/chunks/index-BseD7Jzt.js +75 -0
  57. package/dist/chunks/index-Bt7v-zqV.js +77 -0
  58. package/dist/chunks/index-Bunat0DP.js +337 -0
  59. package/dist/chunks/index-BvdNKhJw.js +19 -0
  60. package/dist/chunks/index-BwFE4R87.js +30 -0
  61. package/dist/chunks/index-BwRxBdeg.js +158 -0
  62. package/dist/chunks/index-Bymsj9gH.js +1 -0
  63. package/dist/chunks/index-C-pfDP7B.js +1 -0
  64. package/dist/chunks/index-C2oV5vU3.js +4 -0
  65. package/dist/chunks/index-C3n83pM3.js +103 -0
  66. package/dist/chunks/index-C572_UKV.js +22 -0
  67. package/dist/chunks/index-C6bOvXSf.js +129 -0
  68. package/dist/chunks/{index-CByffhPq.js → index-CBICHiFD.js} +147 -134
  69. package/dist/chunks/index-CEy6bu7P.js +79 -0
  70. package/dist/chunks/index-CFqKkC5Z.js +36 -0
  71. package/dist/chunks/index-CIZ3Gnmm.js +8 -0
  72. package/dist/chunks/index-CIiIAqrQ.js +414 -0
  73. package/dist/chunks/index-CJdEJ8pY.js +15 -0
  74. package/dist/chunks/index-CKYRBtLC.js +79 -0
  75. package/dist/chunks/index-CQl4NaPS.js +65 -0
  76. package/dist/chunks/index-CR3DrmQi.js +235 -0
  77. package/dist/chunks/index-CTsGb3mD.js +364 -0
  78. package/dist/chunks/{index-rwBsdvh6.js → index-CV7TVQ4T.js} +9 -8
  79. package/dist/chunks/index-CWlg_Hu2.js +150 -0
  80. package/dist/chunks/{index-Bwix1iwB.js → index-CYIcfuAW.js} +6 -5
  81. package/dist/chunks/{index-WNXgzThF.js → index-CkxGsCJy.js} +181 -181
  82. package/dist/chunks/index-ClE0uX_c.js +27 -0
  83. package/dist/chunks/index-Cnsy7Qk3.js +511 -0
  84. package/dist/chunks/index-CoAT1iC6.js +12 -0
  85. package/dist/chunks/index-Cp3P3KaW.js +45 -0
  86. package/dist/chunks/index-CqQZpHti.js +3 -0
  87. package/dist/chunks/index-CsjJntyD.js +23 -0
  88. package/dist/chunks/{index-BIaF1Dfx.js → index-Ctna95NT.js} +5 -4
  89. package/dist/chunks/index-Cu1u3Mjn.js +150 -0
  90. package/dist/chunks/index-Cv6qE9qP.js +22 -0
  91. package/dist/chunks/index-Cwb1pbm9.js +252 -0
  92. package/dist/chunks/{index-BSgHSOVT.js → index-CzAwJhyQ.js} +4 -3
  93. package/dist/chunks/index-D8LE8G2j.js +81 -0
  94. package/dist/chunks/{index-C_K070Kn.js → index-D9sRIKMQ.js} +9 -8
  95. package/dist/chunks/index-DBsASlZI.js +15 -0
  96. package/dist/chunks/{index-DurPWBYc.js → index-DGw1TVFB.js} +3 -2
  97. package/dist/chunks/index-DIsXKJDH.js +4 -0
  98. package/dist/chunks/{index-CT43RMOu.js → index-DNWjc2SJ.js} +3 -2
  99. package/dist/chunks/index-DSOPjl5x.js +563 -0
  100. package/dist/chunks/index-DUtoSCTU.js +455 -0
  101. package/dist/chunks/index-DWjrCygZ.js +49 -0
  102. package/dist/chunks/index-DYvD9xjl.js +4 -0
  103. package/dist/chunks/index-DZabSr3s.js +36 -0
  104. package/dist/chunks/index-DbAeG1nY.js +1 -0
  105. package/dist/chunks/index-Dc51G1mo.js +26 -0
  106. package/dist/chunks/index-Dd9iSSXa.js +260 -0
  107. package/dist/chunks/{index-C8LyfVmf.js → index-DfFx1Jz3.js} +6 -5
  108. package/dist/chunks/index-Dh4LYLg5.js +1604 -0
  109. package/dist/chunks/index-Dk3tlz8Q.js +15 -0
  110. package/dist/chunks/index-Do1DszoZ.js +1 -0
  111. package/dist/chunks/index-DrDKdYFJ.js +58 -0
  112. package/dist/chunks/index-DyO3Wdy_.js +37 -0
  113. package/dist/chunks/index-DyyLrVDY.js +188 -0
  114. package/dist/chunks/{index-45EApaFs.js → index-GDVDUQtg.js} +14 -13
  115. package/dist/chunks/index-GbWz6fuF.js +243 -0
  116. package/dist/chunks/index-JWULDURW.js +89 -0
  117. package/dist/chunks/index-MgWriQfr.js +35 -0
  118. package/dist/chunks/index-OgL1A9Rm.js +42 -0
  119. package/dist/chunks/{index-DdNZTQw1.js → index-QzojJs5M.js} +3 -2
  120. package/dist/chunks/index-TJL02uup.js +291 -0
  121. package/dist/chunks/index-Z4ar01y-.js +259 -0
  122. package/dist/chunks/{index-BSh7UYcP.js → index-_xRytR0j.js} +3 -3
  123. package/dist/chunks/index-cuMoh7qn.js +1 -0
  124. package/dist/chunks/index-du3RQU31.js +62 -0
  125. package/dist/chunks/{index-DFA4_spk.js → index-hH_m653R.js} +9 -8
  126. package/dist/chunks/index-hn76Yo-L.js +1 -0
  127. package/dist/chunks/index-i4heE-wx.js +71 -0
  128. package/dist/chunks/index-i9jyrFc9.js +19 -0
  129. package/dist/chunks/index-lFqOe0IJ.js +46 -0
  130. package/dist/chunks/index-pS6-humH.js +74 -0
  131. package/dist/chunks/index-pc36PiDY.js +57 -0
  132. package/dist/chunks/index-qgl9W8eF.js +52 -0
  133. package/dist/chunks/{index-BUxB7aWd.js → index-uwN33H1P.js} +9 -8
  134. package/dist/chunks/index-uxZPrL2m.js +406 -0
  135. package/dist/chunks/index-yzFU-E6F.js +22 -0
  136. package/dist/chunks/{loading-icon-DhJR6LyV.js → loading-icon-CPvmJvpZ.js} +2 -2
  137. package/dist/chunks/loading-icon-DdwpAk8-.js +24 -0
  138. package/dist/chunks/main-BGOPab-5.js +4041 -0
  139. package/dist/chunks/main-Bx21zlkN.js +65 -0
  140. package/dist/chunks/{property-pT1z5CCa.js → property-BkjBVRuu.js} +1 -1
  141. package/dist/chunks/property-DAFv3PCb.js +5 -0
  142. package/dist/chunks/register-BCEOkbXG.js +1583 -0
  143. package/dist/chunks/{register-BK21_Wkj.js → register-Bkr1UKav.js} +1 -1
  144. package/dist/chunks/{register-BMNs2hNG.js → register-DTXmg-gw.js} +1 -1
  145. package/dist/chunks/register-D_CXtGy1.js +1 -0
  146. package/dist/chunks/search-DDFN8-Mz.js +30 -0
  147. package/dist/chunks/search-npG8ywjx.js +240 -0
  148. package/dist/chunks/select-CFy3MvH6.js +76 -0
  149. package/dist/chunks/select-DkCpQORs.js +357 -0
  150. package/dist/chunks/settings-Bgpv8zuU.js +62 -0
  151. package/dist/chunks/settings-jvP7vP60.js +66 -0
  152. package/dist/chunks/{state-FnSmMH94.js → state-BdgD82MZ.js} +1 -1
  153. package/dist/chunks/{state-Bpmgn27B.js → state-uF7CZaP5.js} +1 -1
  154. package/dist/chunks/text-input-BUdM-ojg.js +68 -0
  155. package/dist/chunks/text-input-DVdkm07X.js +372 -0
  156. package/dist/chunks/tooltip-content-BXcBmMsV.js +3 -0
  157. package/dist/chunks/tooltip-content-CWRE_NqH.js +135 -0
  158. package/dist/chunks/{unsafe-html-D49sIpJ5.js → unsafe-html-Bg0eM3hS.js} +5 -5
  159. package/dist/chunks/{unsafe-html-C_MKAcuC.js → unsafe-html-CpAqmPyx.js} +1 -1
  160. package/dist/zooy.cjs.js +1 -1
  161. package/dist/zooy.es.js +20 -2
  162. package/package.json +3 -4
  163. package/src/sass/carbon.scss +117 -0
  164. package/src/sass/main.scss +1 -1
  165. package/src/sass/panels.scss +268 -359
  166. package/src/sass/split.scss +1 -0
  167. package/dist/chunks/16-41wFkj7S.js +0 -1
  168. package/dist/chunks/20-gmyNFvDv.js +0 -1
  169. package/dist/chunks/button-DdJepOoE.js +0 -271
  170. package/dist/chunks/button-skeleton-rf3WDPTZ.js +0 -21
  171. package/dist/chunks/button-zHEPxpXa.js +0 -66
  172. package/dist/chunks/checkbox-B5mHvx0J.js +0 -200
  173. package/dist/chunks/checkbox-BRPCg-DN.js +0 -40
  174. package/dist/chunks/collection-helpers-BwUB2CEz.js +0 -8
  175. package/dist/chunks/collection-helpers-CYLIiyii.js +0 -1
  176. package/dist/chunks/content-switcher-item-DeGjVRQY.js +0 -350
  177. package/dist/chunks/content-switcher-item-DucclV1b.js +0 -27
  178. package/dist/chunks/defs-DMmigODC.js +0 -1077
  179. package/dist/chunks/defs-DPD20sPK.js +0 -1
  180. package/dist/chunks/dropdown-item-BgLQ1VLo.js +0 -69
  181. package/dist/chunks/dropdown-item-DPdwOION.js +0 -620
  182. package/dist/chunks/icon-loader-utils-BBjK16O-.js +0 -5
  183. package/dist/chunks/if-defined-BdZRLDJ6.js +0 -5
  184. package/dist/chunks/if-non-empty-CEHK-hqx.js +0 -1
  185. package/dist/chunks/index-16wphaSo.js +0 -4
  186. package/dist/chunks/index-27oFQaOS.js +0 -37
  187. package/dist/chunks/index-5jmZyISW.js +0 -1
  188. package/dist/chunks/index-B1vQ44Hl.js +0 -363
  189. package/dist/chunks/index-B3CDjjXh.js +0 -214
  190. package/dist/chunks/index-B7mGUQhz.js +0 -79
  191. package/dist/chunks/index-BBNaYDog.js +0 -22
  192. package/dist/chunks/index-BBt9OmO5.js +0 -12
  193. package/dist/chunks/index-BJAuRs3y.js +0 -75
  194. package/dist/chunks/index-BJKftWYn.js +0 -89
  195. package/dist/chunks/index-BLjNrhkN.js +0 -4
  196. package/dist/chunks/index-BOTu9u-3.js +0 -86
  197. package/dist/chunks/index-BPVpH8ll.js +0 -160
  198. package/dist/chunks/index-BRuvyoCz.js +0 -15
  199. package/dist/chunks/index-BXIxcS00.js +0 -22
  200. package/dist/chunks/index-BaVyBv2V.js +0 -25
  201. package/dist/chunks/index-BgbqX0uv.js +0 -234
  202. package/dist/chunks/index-BjQlt8g2.js +0 -451
  203. package/dist/chunks/index-BoNLj7PW.js +0 -44
  204. package/dist/chunks/index-BxVW3p3I.js +0 -258
  205. package/dist/chunks/index-ByKyGGzb.js +0 -3
  206. package/dist/chunks/index-ByTSSU1x.js +0 -1
  207. package/dist/chunks/index-CBbsFlsv.js +0 -290
  208. package/dist/chunks/index-CIbRjtWm.js +0 -32
  209. package/dist/chunks/index-CIzeMGQv.js +0 -81
  210. package/dist/chunks/index-CLGxSjLW.js +0 -62
  211. package/dist/chunks/index-CMF5Cawn.js +0 -70
  212. package/dist/chunks/index-CO-A2KY9.js +0 -562
  213. package/dist/chunks/index-CONgwvp0.js +0 -12
  214. package/dist/chunks/index-CUgiXqyk.js +0 -4
  215. package/dist/chunks/index-C_ttE2g9.js +0 -16
  216. package/dist/chunks/index-CcgnA1uu.js +0 -29
  217. package/dist/chunks/index-Cd7aoWrX.js +0 -336
  218. package/dist/chunks/index-Ce-pMzBC.js +0 -19
  219. package/dist/chunks/index-CgYZ66P_.js +0 -187
  220. package/dist/chunks/index-ChcHMeAS.js +0 -35
  221. package/dist/chunks/index-Cixdzvwd.js +0 -682
  222. package/dist/chunks/index-Clq0Fl19.js +0 -15
  223. package/dist/chunks/index-CtxTJnIm.js +0 -58
  224. package/dist/chunks/index-Cv1hWa_y.js +0 -242
  225. package/dist/chunks/index-D25buhRm.js +0 -79
  226. package/dist/chunks/index-D4DqJG5_.js +0 -16
  227. package/dist/chunks/index-D5GGFPcS.js +0 -251
  228. package/dist/chunks/index-D5kiHJpX.js +0 -413
  229. package/dist/chunks/index-DEjRiv5B.js +0 -1
  230. package/dist/chunks/index-DFZsXFsx.js +0 -19
  231. package/dist/chunks/index-DGauWNwV.js +0 -156
  232. package/dist/chunks/index-DIR0jr3f.js +0 -127
  233. package/dist/chunks/index-DNeagy5a.js +0 -65
  234. package/dist/chunks/index-DO0fmDR9.js +0 -2
  235. package/dist/chunks/index-DSitHBEh.js +0 -36
  236. package/dist/chunks/index-DW7ST0tB.js +0 -1
  237. package/dist/chunks/index-DWfFgEXE.js +0 -110
  238. package/dist/chunks/index-DX6WAtmo.js +0 -874
  239. package/dist/chunks/index-DaPfSuLu.js +0 -393
  240. package/dist/chunks/index-DbKlVm7y.js +0 -74
  241. package/dist/chunks/index-Dgi-m1K-.js +0 -1
  242. package/dist/chunks/index-Dh4uigJs.js +0 -454
  243. package/dist/chunks/index-DnYNK1mz.js +0 -8
  244. package/dist/chunks/index-DnierBep.js +0 -510
  245. package/dist/chunks/index-DnpSGM23.js +0 -213
  246. package/dist/chunks/index-DntY4deR.js +0 -41
  247. package/dist/chunks/index-Dp4A8k6C.js +0 -103
  248. package/dist/chunks/index-Dphpk5r2.js +0 -1
  249. package/dist/chunks/index-DrBrgF-v.js +0 -49
  250. package/dist/chunks/index-Dr_cqQ-_.js +0 -77
  251. package/dist/chunks/index-Dt-nBtrQ.js +0 -26
  252. package/dist/chunks/index-DwTj7cFr.js +0 -57
  253. package/dist/chunks/index-DyZVAYLv.js +0 -52
  254. package/dist/chunks/index-Hh597Yu6.js +0 -121
  255. package/dist/chunks/index-LxkAuMAA.js +0 -1
  256. package/dist/chunks/index-OaQhvPR1.js +0 -46
  257. package/dist/chunks/index-UPr2EvBX.js +0 -149
  258. package/dist/chunks/index-WvrCPen2.js +0 -367
  259. package/dist/chunks/index-cTXIVcWI.js +0 -45
  260. package/dist/chunks/index-caLn8cu1.js +0 -1603
  261. package/dist/chunks/index-jBse-XgU.js +0 -35
  262. package/dist/chunks/index-oTjafsfN.js +0 -25
  263. package/dist/chunks/index-qNmuI3RB.js +0 -149
  264. package/dist/chunks/index-qiqzy9MI.js +0 -23
  265. package/dist/chunks/index-siqJUhKa.js +0 -1
  266. package/dist/chunks/index-w-G9CFId.js +0 -1
  267. package/dist/chunks/index-x6SeA7x7.js +0 -405
  268. package/dist/chunks/loading-icon-DJQIjg97.js +0 -23
  269. package/dist/chunks/main-DUusfqrI.js +0 -18
  270. package/dist/chunks/main-Dp7wHHgP.js +0 -2882
  271. package/dist/chunks/property-DCYiZTFF.js +0 -5
  272. package/dist/chunks/register-Cc9zkA5F.js +0 -1
  273. package/dist/chunks/register-JwwMwdRf.js +0 -1273
  274. package/dist/chunks/search-C3raqgOD.js +0 -30
  275. package/dist/chunks/search-CIhxkVjj.js +0 -239
  276. package/dist/chunks/select-item-4aISXm0r.js +0 -76
  277. package/dist/chunks/select-item-DjoxYopL.js +0 -356
  278. package/dist/chunks/settings-BPOpwVkr.js +0 -594
  279. package/dist/chunks/settings-CK2vhfPu.js +0 -78
  280. package/dist/chunks/text-input-BygzMjjc.js +0 -371
  281. package/dist/chunks/text-input-cjcnMXO-.js +0 -68
  282. package/dist/chunks/tooltip-content-BjdZJ_Ui.js +0 -134
  283. package/dist/chunks/tooltip-content-DHyDYyOH.js +0 -3
  284. package/src/sass/carbon-icons.scss +0 -46
@@ -0,0 +1,4041 @@
1
+ const numericString = "0123456789".split("");
2
+ [...numericString];
3
+ const alphaLower = "abcdefghijklmnopqrstuvwxyz".split(""), alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
4
+ [...alphaLower, ...alphaUpper, ...numericString];
5
+ (/* @__PURE__ */ new Map()).set("true", !0).set("false", !1);
6
+ const compose = (...O) => (...w) => O.reduce((D, U) => (F) => D(U(F)))(...w), identity = (O) => O, whatType = (O) => typeof O, isDef = (O) => O !== void 0, isUndefined = (O) => O === void 0, isDefAndNotNull = (O) => O != null, isString = (O) => whatType(O) === "string", isNumber = (O) => whatType(O) === "number" && !Number.isNaN(
7
+ /** @type number */
8
+ O
9
+ ), isObject = (O) => (O && typeof O == "object" && !(O instanceof Array) && !(O instanceof Set) && !(O instanceof Map) && !(O instanceof Date)) === !0, isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((w, D) => [D, ...w], []), toLowerCase = (O) => O.toLowerCase(), toString$1 = (O) => O + "", toNumber = (O) => +O;
10
+ compose(toLowerCase, toString$1);
11
+ const makeRandomString = () => {
12
+ let O = 2147483648;
13
+ return Math.floor(Math.random() * O).toString(36) + Math.abs(Math.floor(Math.random() * O) ^ Date.now()).toString(36);
14
+ }, stripLeadingChar = (O) => (w) => w.startsWith(O) ? w.slice(O.length) : w, join = (O) => (w) => w.join(O);
15
+ compose(join(""), reverse);
16
+ const pathOr = (O, w) => (D) => {
17
+ const U = w.reduce((F, q) => {
18
+ try {
19
+ return F[maybeNumber(q)];
20
+ } catch {
21
+ return;
22
+ }
23
+ }, D);
24
+ return U === void 0 ? O : U;
25
+ }, objToPaths = (O, w = [], D = []) => (Object.entries(O).forEach(([U, F]) => {
26
+ isObject(F) ? objToPaths(F, [...w, U], D) : D.push([[...w, U], F]);
27
+ }), D), randomId = (O) => {
28
+ const w = makeRandomString();
29
+ return O ? w.substr(0, O) : w;
30
+ }, maybeNumber = (O) => {
31
+ if (O === null || whatType(O) === "string" && O.length > 1 && O.startsWith("0") && !O.startsWith("0."))
32
+ return O;
33
+ const w = 1 * O;
34
+ return w > Number.MAX_SAFE_INTEGER || Number.isNaN(w) ? O : w;
35
+ };
36
+ compose(toNumber, join(""), reverse, toString$1);
37
+ class Evt extends EventTarget {
38
+ /**
39
+ * Set this to true to get some debug in the console.
40
+ * @type {boolean}
41
+ * @private
42
+ */
43
+ #t = !1;
44
+ /**
45
+ * True if this is disposed.
46
+ * @type {boolean}
47
+ * @private
48
+ */
49
+ #e = !1;
50
+ /**
51
+ * A map of listener targets to an object of zoo-event functions
52
+ * When adding a listener, immediately also create the un-listen functions
53
+ * and store those in an object keyed with the event.
54
+ * Store these objects against the target in a map
55
+ * @type {Map<!EventTarget, !Object<string, !Function>>}
56
+ * @private
57
+ */
58
+ #s = /* @__PURE__ */ new Map();
59
+ /**
60
+ * A set of components that are currently listening to this component
61
+ * @type {!Set<!EventTarget>}
62
+ * @private
63
+ */
64
+ #r = /* @__PURE__ */ new Set();
65
+ /**
66
+ * A set of interval timers as defined by setInterval.
67
+ * Use this to store the timers created particular to this component.
68
+ * On destruction, these timers will be cleared.
69
+ * @type {Set<any>}
70
+ * @private
71
+ */
72
+ #n = /* @__PURE__ */ new Set();
73
+ //--[ Static ]--
74
+ /**
75
+ * Creates a CustomEvent with the given type and data payload.
76
+ * @param {string} event The event type
77
+ * @param {*} data The data to attach to the event's detail property
78
+ * @return {!CustomEvent} A new CustomEvent instance
79
+ */
80
+ static makeEvent(w, D) {
81
+ return new CustomEvent(w, { detail: D });
82
+ }
83
+ /**
84
+ * Sets debug mode for this component. When enabled, debug messages
85
+ * will be logged to the console.
86
+ * @param {boolean} bool True to enable debug mode, false to disable
87
+ * @throws {Error} If the value is not a boolean
88
+ */
89
+ set debugMode(w) {
90
+ if (typeof w != "boolean")
91
+ throw new Error("This must be a boolean");
92
+ this.#t = w;
93
+ }
94
+ get debugMode() {
95
+ return this.#t;
96
+ }
97
+ /**
98
+ * Returns whether this component has been disposed.
99
+ * @return {boolean} True if disposed, false otherwise
100
+ */
101
+ get disposed() {
102
+ return this.#e;
103
+ }
104
+ /**
105
+ * Returns the map of targets this component is listening to.
106
+ * @return {!Map<!EventTarget, !Object<string, !Function>>} Map of targets to their event handlers
107
+ */
108
+ get listeningTo() {
109
+ return this.#s;
110
+ }
111
+ get isObservedBy() {
112
+ return this.#r;
113
+ }
114
+ get activeIntervals() {
115
+ return this.#n;
116
+ }
117
+ /**
118
+ * Logs debug messages to the console if debug mode is enabled.
119
+ * Automatically prepends the constructor name to the output.
120
+ * @param {...*} s Arguments to log
121
+ */
122
+ debugMe(...w) {
123
+ this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...w]);
124
+ }
125
+ //--[ Listeners and Listening ]--
126
+ /**
127
+ * @param {!EventTarget|!Evt} comp
128
+ */
129
+ isListenedToBy(w) {
130
+ this.#r.add(w);
131
+ }
132
+ /**
133
+ * WARNING! DO not use options={passive: true} here. It disallows us to
134
+ * use preventDefault when we intercept the form, and that leads to a
135
+ * general inability to POST forms.
136
+ *
137
+ * @param {!EventTarget|!Evt|!Node} target
138
+ * @param {string} event
139
+ * @param {!Function} action
140
+ * @param {boolean|!Object} options
141
+ */
142
+ listen(w, D, U, F = !1) {
143
+ w.addEventListener(D, U, F);
144
+ const q = this.listeningTo.get(w) || {};
145
+ q[D] = () => w.removeEventListener(D, U, F), this.listeningTo.set(w, q), isDef(w.isListenedToBy) && w.isListenedToBy(this);
146
+ }
147
+ /**
148
+ * Remove self from all components tt are listening to me.
149
+ */
150
+ stopBeingListenedTo() {
151
+ for (const w of this.isObservedBy)
152
+ w.stopListeningTo(this), this.isObservedBy.delete(w);
153
+ }
154
+ /**
155
+ * Stop listening to all events on target.
156
+ * @param {!EventTarget|!Evt|!Node|undefined} target
157
+ * @param {string=} opt_event
158
+ */
159
+ stopListeningTo(w, D) {
160
+ w && this.listeningTo.has(w) && (isDef(w.isObservedBy) && w.isObservedBy.delete(this), isDef(D) ? (Object.entries(this.listeningTo.get(w)).forEach(([U, F]) => {
161
+ U === D && F();
162
+ }), Object.keys(this.listeningTo.get(w)).length || this.listeningTo.delete(w)) : (Object.values(this.listeningTo.get(w)).forEach((U) => U()), this.listeningTo.delete(w)));
163
+ }
164
+ /**
165
+ * Removes all the event listeners that is managed by this
166
+ * component.
167
+ */
168
+ removeAllListener() {
169
+ for (const w of this.listeningTo.keys())
170
+ this.stopListeningTo(w);
171
+ }
172
+ /**
173
+ * Clears all active intervals created by this component.
174
+ * Called automatically during disposal to prevent memory leaks.
175
+ */
176
+ clearAllIntervals() {
177
+ for (const w of this.activeIntervals)
178
+ clearInterval(w), this.activeIntervals.delete(w);
179
+ }
180
+ /**
181
+ * Executes a function repeatedly at a specified interval.
182
+ * The interval is tracked and will be automatically cleared on disposal.
183
+ * @param {!Function} f The function to execute on each interval
184
+ * @param {number} interval The interval in milliseconds
185
+ */
186
+ doOnBeat(w, D) {
187
+ const U = setInterval(w, D);
188
+ this.activeIntervals.add(U);
189
+ }
190
+ /**
191
+ * Disposes of the component. Calls `exitDocument`, which is expected to
192
+ * remove event handlers and clean up the component. Propagates the call to
193
+ * the component's children, if any. Removes the component's DOM from the
194
+ * document unless it was decorated.
195
+ * @protected
196
+ */
197
+ disposeInternal() {
198
+ this.stopBeingListenedTo(), this.removeAllListener(), this.clearAllIntervals(), this.#e = !0;
199
+ }
200
+ /**
201
+ * Public method to dispose of this component. Calls disposeInternal()
202
+ * to perform cleanup of event listeners, intervals, and observers.
203
+ * After calling this method, the component should not be used.
204
+ */
205
+ dispose() {
206
+ this.disposeInternal();
207
+ }
208
+ }
209
+ class ZooyEventData {
210
+ constructor(w, D) {
211
+ this.value_ = w, this.data_ = D || {};
212
+ }
213
+ getValue() {
214
+ return this.value_;
215
+ }
216
+ getData() {
217
+ return this.data_;
218
+ }
219
+ }
220
+ const UiEventType = {
221
+ /**
222
+ * Dispatched after the content from the template is in the DOM
223
+ * and the in-line scripts from the AJAX call has been eval'd.
224
+ */
225
+ COMP: randomId(),
226
+ COMP_DRAG_START: randomId(),
227
+ COMP_DRAG_MOVE: randomId(),
228
+ COMP_DRAG_END: randomId(),
229
+ PANEL: randomId(),
230
+ VIEW: randomId(),
231
+ SPLIT: randomId(),
232
+ SPLIT_WILL_OPEN: randomId(),
233
+ SPLIT_DID_OPEN: randomId(),
234
+ SPLIT_WILL_CLOSE: randomId(),
235
+ SPLIT_DID_CLOSE: randomId(),
236
+ SPLIT_TRANSITION_END: randomId(),
237
+ READY: randomId(),
238
+ PANEL_MINIMIZE: randomId(),
239
+ FORM_SUBMIT_SUCCESS: randomId()
240
+ };
241
+ var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
242
+ function en_US(O, w) {
243
+ if (w === 0)
244
+ return ["just now", "right now"];
245
+ var D = EN_US[Math.floor(w / 2)];
246
+ return O > 1 && (D += "s"), [O + " " + D + " ago", "in " + O + " " + D];
247
+ }
248
+ var ZH_CN = ["秒", "分钟", "小时", "天", "周", "个月", "年"];
249
+ function zh_CN(O, w) {
250
+ if (w === 0)
251
+ return ["刚刚", "片刻后"];
252
+ var D = ZH_CN[~~(w / 2)];
253
+ return [O + " " + D + "前", O + " " + D + "后"];
254
+ }
255
+ var Locales = {}, register = function(O, w) {
256
+ Locales[O] = w;
257
+ }, getLocale = function(O) {
258
+ return Locales[O] || Locales.en_US;
259
+ }, SEC_ARRAY = [
260
+ 60,
261
+ 60,
262
+ 24,
263
+ 7,
264
+ 365 / 7 / 12,
265
+ 12
266
+ ];
267
+ function toDate(O) {
268
+ return O instanceof Date ? O : !isNaN(O) || /^\d+$/.test(O) ? new Date(parseInt(O)) : (O = (O || "").trim().replace(/\.\d+/, "").replace(/-/, "/").replace(/-/, "/").replace(/(\d)T(\d)/, "$1 $2").replace(/Z/, " UTC").replace(/([+-]\d\d):?(\d\d)/, " $1$2"), new Date(O));
269
+ }
270
+ function formatDiff(O, w) {
271
+ var D = O < 0 ? 1 : 0;
272
+ O = Math.abs(O);
273
+ for (var U = O, F = 0; O >= SEC_ARRAY[F] && F < SEC_ARRAY.length; F++)
274
+ O /= SEC_ARRAY[F];
275
+ return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1), w(O, F, U)[D].replace("%s", O.toString());
276
+ }
277
+ function diffSec(O, w) {
278
+ var D = /* @__PURE__ */ new Date();
279
+ return (+D - +toDate(O)) / 1e3;
280
+ }
281
+ var format = function(O, w, D) {
282
+ var U = diffSec(O);
283
+ return formatDiff(U, getLocale(w));
284
+ };
285
+ register("en_US", en_US);
286
+ register("zh_CN", zh_CN);
287
+ const getInputChecked_ = function(O) {
288
+ return O.checked ? (
289
+ /** @type {?} */
290
+ O.value
291
+ ) : null;
292
+ }, getSelectSingle_ = function(O) {
293
+ const w = (
294
+ /** @type {!HTMLSelectElement} */
295
+ O.selectedIndex
296
+ );
297
+ return w >= 0 ? (
298
+ /** @type {!HTMLSelectElement} */
299
+ O.options[w].value
300
+ ) : null;
301
+ }, getSelectMultiple_ = function(O) {
302
+ const w = [];
303
+ for (let D, U = 0; D = /** @type {!HTMLSelectElement} */
304
+ O.options[U]; U++)
305
+ D.selected && w.push(D.value);
306
+ return w.length ? w : null;
307
+ }, getValue = function(O) {
308
+ const w = (
309
+ /** @type {!HTMLInputElement} */
310
+ O.type
311
+ );
312
+ switch (isString(w) && w.toLowerCase()) {
313
+ case "checkbox":
314
+ case "radio":
315
+ return getInputChecked_(O);
316
+ case "select-one":
317
+ return getSelectSingle_(O);
318
+ case "select-multiple":
319
+ return getSelectMultiple_(O);
320
+ default:
321
+ return O.value !== null && O.value !== void 0 ? O.value : null;
322
+ }
323
+ }, formToJSON = (O) => [...O].reduce((w, D) => (w[D.name] = D.value, w), {}), replaceNode = (O, w) => {
324
+ const D = w.parentNode;
325
+ D && D.replaceChild(O, w);
326
+ }, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O, w) => {
327
+ w.parentNode && w.parentNode.insertBefore(O, w.nextSibling);
328
+ }, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((w, D) => `${w}${D},`, "rgba(") + `${O || 0.5}`, totalWidth = (O) => {
329
+ const w = window.getComputedStyle(O), D = O.offsetWidth, U = parseFloat(w.marginLeft) + parseFloat(w.marginRight), F = parseFloat(w.paddingLeft) + parseFloat(w.paddingRight), q = parseFloat(w.borderLeftWidth) + parseFloat(w.borderRightWidth);
330
+ return D + U - F + q;
331
+ }, totalHeight = (O) => {
332
+ const w = window.getComputedStyle(O), D = O.offsetHeight, U = parseFloat(w.marginTop) + parseFloat(w.marginBottom), F = parseFloat(w.paddingTop) + parseFloat(w.paddingBottom), q = parseFloat(w.borderTopWidth) + parseFloat(w.borderBottomWidth);
333
+ return D + U - F + q;
334
+ }, evalScripts = (comp) => (arr) => {
335
+ arr && Array.from(arr).forEach((s) => {
336
+ (function() {
337
+ eval(s.text);
338
+ }).bind(comp)();
339
+ });
340
+ }, evalModules = (O) => (w) => {
341
+ w && Array.from(w).forEach((D) => {
342
+ (function() {
343
+ const U = document.createElement("script");
344
+ U.type = "module", U.textContent = D.textContent;
345
+ const F = O.getElement(), q = getElDataMap(D).zv_comp_access;
346
+ q && (F.zvComponent = O, F.classList.add(q)), F.appendChild(U);
347
+ }).bind(O)();
348
+ });
349
+ }, splitScripts = (O) => {
350
+ const D = new DOMParser().parseFromString(O, "text/html");
351
+ return {
352
+ html: D.body.firstElementChild,
353
+ scripts: D.querySelectorAll('script:not([type="module"])'),
354
+ modules: D.querySelectorAll('script[type="module"]')
355
+ };
356
+ }, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O, w, D) => {
357
+ D ? O.classList.add(w) : O.classList.remove(w);
358
+ }, toggleClass = (O, w) => {
359
+ const D = !Array.from(O.classList).includes(w);
360
+ return enableClass(O, w, D), D;
361
+ }, getElDataMap = (O) => O ? Object.assign({}, O.dataset || {}) : {}, dtFormatter = {
362
+ year: "numeric",
363
+ month: "short",
364
+ day: "numeric",
365
+ hour: "2-digit",
366
+ minute: "2-digit",
367
+ second: "2-digit"
368
+ }, dFormatter = {
369
+ year: "numeric",
370
+ month: "short",
371
+ day: "numeric"
372
+ }, dtf = new Intl.DateTimeFormat("en", {
373
+ day: "2-digit",
374
+ month: "short",
375
+ year: "2-digit",
376
+ hour: "2-digit",
377
+ minute: "2-digit",
378
+ second: "2-digit",
379
+ // hour12: false
380
+ hourCycle: "h23"
381
+ }), dateToZooyStdTimeString = (O) => {
382
+ const [{ value: w }, , { value: D }, , { value: U }, , { value: F }, , { value: q }, , { value: W }, ,] = dtf.formatToParts(O);
383
+ return `${D} ${w} ${U} ${F}:${q}:${W}`;
384
+ }, parseMomentAgo = (O, w = "both", D = void 0) => {
385
+ let U = O;
386
+ isNumber(U) && U < 9466848e5 ? U = U * 1e3 : D && (U = U + D);
387
+ const F = new Date(U), q = format(F), W = dateToZooyStdTimeString(F);
388
+ switch (w) {
389
+ case "time|ago":
390
+ return `${W}|${q}`;
391
+ case "ago":
392
+ return `${q}`;
393
+ case "datetime":
394
+ case "time":
395
+ return `${W}`;
396
+ case "both":
397
+ case "ago (time)":
398
+ default:
399
+ return `${q} (${W})`;
400
+ }
401
+ }, parseObfuscated = (O) => {
402
+ const D = ((F) => (q) => q < F.length - 4)(O);
403
+ return ((F) => F.split("").map((q, W) => D(W) ? "*" : q).join(""))(O);
404
+ }, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O, w, D) => identity(O)).set("", (O, w, D) => identity(O)).set("class_update_only", (O, w, D) => identity(O)).set("frac_100", (O, w, D) => Math.round(O * 100 * 100) / 100).set("date_and_time", (O, w, D) => new Date(O).toLocaleString(void 0, dtFormatter)).set("date", (O, w, D) => new Date(O).toLocaleString(void 0, dFormatter)).set("moment_ago", (O, w, D) => parseMomentAgo(O, "both", D.zdd_date_tz || void 0)).set("moment_ago_only", (O, w, D) => parseMomentAgo(O, "ago", D.zdd_date_tz || void 0)).set("moment_ago_datetime", (O, w, D) => parseMomentAgo(O, "datetime", D.zdd_date_tz || void 0)).set("pretty-json", (O, w, D) => JSON.stringify(O, null, 4)).set("obfuscated", (O, w, D) => parseObfuscated(O)).set("linear-progress", (O, w, D) => {
405
+ const U = toNumber(D.zpmax), F = w.linProg;
406
+ return U && F && (F.progress = O / U, O = void 0), O;
407
+ }), parseDataPropKvDef = (O) => O.trim().split(",").map((U) => U.trim()).map((U) => {
408
+ const [F, q] = U.split(":").map((W) => W.trim());
409
+ return [F, q];
410
+ }).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O, w) => {
411
+ const D = getElDataMap(O);
412
+ delete O.dataset.zoodatapropkv;
413
+ const U = D.zoodatapropkv || "";
414
+ return parseDataPropKvDef(U).forEach(([q, W]) => {
415
+ O.dataset[q] = pathOr(void 0, W.split("."))(w);
416
+ }), O;
417
+ }, mapDataToEls = (O, w, D = /* @__PURE__ */ new Map(), U = void 0) => {
418
+ if (!w)
419
+ return;
420
+ const F = new Map([...parseMap, ...D]);
421
+ [...O.querySelectorAll("[data-zdd],[data-zdd_class_update],[data-zdd_template_loop_index]")].forEach((q) => {
422
+ const W = getElDataMap(q), Y = W.zdd || "", G = W.zdd_parse_as, Z = W.zdd_render_effect || "", Q = W.zdd_class_update, tt = W.zdd_template_loop_index, J = W.zdd_units || "";
423
+ let X = pathOr(void 0, Y.split("."))(w);
424
+ if (isDefAndNotNull(X) && (X = F.has(G) ? F.get(G)(X, q, W) : X), tt && isNumber(U) && (console.log("loopIndex: ", tt, " opt_loopIndex: ", U), tt === "zero_indexed" ? q.innerHTML = U : tt === "one_indexed" ? q.innerHTML = U + 1 : q.innerHTML = U), Q) {
425
+ const [K, et, st] = Q.split(":"), rt = pathOr(void 0, K.split("."))(w);
426
+ if (isDefAndNotNull(rt))
427
+ switch (et) {
428
+ case "swap": {
429
+ const nt = /\{}/gi, ot = st.replace(nt, ""), ct = st.replace(nt, rt);
430
+ q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(ct);
431
+ break;
432
+ }
433
+ case "remove_on_data":
434
+ q.classList.remove(st);
435
+ break;
436
+ case "choice_map":
437
+ st.split("|").filter((nt) => nt !== "").forEach((nt) => {
438
+ const [ot, ct] = nt.split(">");
439
+ ot === rt + "" ? q.classList.add.apply(q.classList, ct.split(".")) : q.classList.remove.apply(q.classList, ct.split("."));
440
+ });
441
+ break;
442
+ }
443
+ }
444
+ if (G === "templated-array" && isArray(X))
445
+ if (X.length === 0)
446
+ q.classList.add("display__none");
447
+ else {
448
+ q.classList.remove("display__none"), X = X || [];
449
+ const K = q.firstElementChild;
450
+ K.classList.remove("display__none"), q.replaceChildren(...X.map((et, st) => {
451
+ const rt = K.cloneNode(!0), nt = parseDataProps(rt, et);
452
+ return mapDataToEls(nt, et, void 0, st), nt;
453
+ }));
454
+ }
455
+ else if (isDefAndNotNull(X))
456
+ if (Z === "typewriter") {
457
+ let K = 0;
458
+ const et = X + J, st = 5, rt = () => {
459
+ K < et.length && (q.innerHTML += et.charAt(K), K++, setTimeout(rt, st));
460
+ };
461
+ q.innerHTML = "", rt();
462
+ } else
463
+ q.innerHTML = X + J;
464
+ });
465
+ }, domUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
466
+ __proto__: null,
467
+ dateToZooyStdTimeString,
468
+ dtf,
469
+ enableClass,
470
+ evalModules,
471
+ evalScripts,
472
+ formToJSON,
473
+ getElDataMap,
474
+ getPos,
475
+ getValue,
476
+ handleTemplateProm,
477
+ insertSiblingAfter,
478
+ isInPage,
479
+ mapDataToEls,
480
+ parseDataPropKvDef,
481
+ parseMap,
482
+ parseMomentAgo,
483
+ randomColour,
484
+ removeNode,
485
+ replaceNode,
486
+ splitScripts,
487
+ toggleClass,
488
+ totalHeight,
489
+ totalWidth
490
+ }, Symbol.toStringTag, { value: "Module" }));
491
+ class ComponentLibraryRegistry {
492
+ /**
493
+ * Internal storage for registered component libraries.
494
+ * @type {Map<string, {render: Function, cache: Map, config: Object}>}
495
+ * @private
496
+ */
497
+ static #t = /* @__PURE__ */ new Map();
498
+ /**
499
+ * Registers a pluggable component library.
500
+ *
501
+ * @param {string} name - Library identifier (e.g., 'carbon', 'material')
502
+ * @param {Object} library - Library configuration object
503
+ * @param {Function} library.render - Main render function: async function(panel, cache)
504
+ * @param {Function} [library.dispose] - Optional cleanup function: function(element)
505
+ * @param {Object} [library.config] - Optional library-specific configuration
506
+ *
507
+ * @throws {Error} If library doesn't provide a render function
508
+ *
509
+ * @example
510
+ * ComponentLibraryRegistry.register('carbon', {
511
+ * render: async function(panel, cache) {
512
+ * // Scan, load, and attach components
513
+ * },
514
+ * dispose: function(element) {
515
+ * // Optional cleanup logic
516
+ * },
517
+ * config: { version: '2.0' }
518
+ * });
519
+ */
520
+ static register(w, D) {
521
+ if (!D.render)
522
+ throw new Error(`Component library '${w}' must provide a render function`);
523
+ this.#t.set(w, {
524
+ ...D,
525
+ // Preserve all library properties (utils, helpers, etc.)
526
+ dispose: D.dispose || null,
527
+ // Optional disposal function
528
+ cache: /* @__PURE__ */ new Map(),
529
+ // Each library gets its own import cache
530
+ config: D.config || {}
531
+ }), console.debug(`[ComponentLibraryRegistry] Registered: ${w}`);
532
+ }
533
+ /**
534
+ * Gets a registered component library by name.
535
+ *
536
+ * @param {string} name - Library identifier
537
+ * @returns {Object} Library object with render, cache, config
538
+ * @throws {Error} If library is not registered
539
+ */
540
+ static get(w) {
541
+ if (!this.#t.has(w)) {
542
+ const D = Array.from(this.#t.keys()).join(", ");
543
+ throw new Error(
544
+ `Component library '${w}' is not registered. Available: ${D || "none"}`
545
+ );
546
+ }
547
+ return this.#t.get(w);
548
+ }
549
+ /**
550
+ * Checks if a component library is registered.
551
+ *
552
+ * @param {string} name - Library identifier
553
+ * @returns {boolean} True if registered
554
+ */
555
+ static has(w) {
556
+ return this.#t.has(w);
557
+ }
558
+ /**
559
+ * Gets all registered library names.
560
+ *
561
+ * @returns {string[]} Array of registered library names
562
+ */
563
+ static getRegisteredLibraries() {
564
+ return Array.from(this.#t.keys());
565
+ }
566
+ /**
567
+ * Gets cache statistics for all registered component libraries.
568
+ * Useful for debugging and monitoring.
569
+ *
570
+ * @returns {Object} Map of library name → cache stats
571
+ */
572
+ static getCacheStats() {
573
+ const w = {};
574
+ for (const [D, U] of this.#t.entries())
575
+ w[D] = {
576
+ cacheSize: U.cache.size,
577
+ config: U.config
578
+ };
579
+ return w;
580
+ }
581
+ /**
582
+ * Clears import caches for all component libraries.
583
+ * Useful for development/hot-reload scenarios.
584
+ */
585
+ static clearAllCaches() {
586
+ for (const [w, D] of this.#t.entries())
587
+ D.cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
588
+ }
589
+ /**
590
+ * Clears cache for a specific library.
591
+ *
592
+ * @param {string} name - Library identifier
593
+ * @throws {Error} If library is not registered
594
+ */
595
+ static clearCache(w) {
596
+ this.get(w).cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
597
+ }
598
+ /**
599
+ * Unregisters a component library (primarily for testing).
600
+ *
601
+ * @param {string} name - Library identifier
602
+ * @returns {boolean} True if library was unregistered, false if not found
603
+ */
604
+ static unregister(w) {
605
+ return this.#t.delete(w);
606
+ }
607
+ /**
608
+ * Unregisters all component libraries (primarily for testing).
609
+ */
610
+ static unregisterAll() {
611
+ this.#t.clear();
612
+ }
613
+ }
614
+ const ComponentError = {
615
+ /**
616
+ * Error when a method is not supported.
617
+ */
618
+ NOT_SUPPORTED: "Method not supported",
619
+ /**
620
+ * Error when the given element can not be decorated.
621
+ */
622
+ DECORATE_INVALID: "Invalid element to decorate",
623
+ /**
624
+ * Error when the component is already rendered and another render attempt is
625
+ * made.
626
+ */
627
+ ALREADY_RENDERED: "Component already rendered",
628
+ /**
629
+ * Error when an already disposed component is attempted to be rendered.
630
+ */
631
+ ALREADY_DISPOSED: "Component already disposed",
632
+ /**
633
+ * Error when an attempt is made to set the parent of a component in a way
634
+ * that would result in an inconsistent object graph.
635
+ */
636
+ PARENT_UNABLE_TO_BE_SET: "Unable to set parent component",
637
+ /**
638
+ * Error when an attempt is made to add a child component at an out-of-bounds
639
+ * index. We don't support sparse child arrays.
640
+ */
641
+ CHILD_INDEX_OUT_OF_BOUNDS: "Child component index out of bounds",
642
+ /**
643
+ * Error when an attempt is made to remove a child component from a component
644
+ * other than its parent.
645
+ */
646
+ NOT_OUR_CHILD: "Child is not in parent component",
647
+ /**
648
+ * Error when an operation requiring DOM interaction is made when the
649
+ * component is not in the document
650
+ */
651
+ NOT_IN_DOCUMENT: "Operation not supported while component is not in document",
652
+ /**
653
+ * Error when an invalid component state is encountered.
654
+ */
655
+ STATE_INVALID: "Invalid component state"
656
+ };
657
+ class Component extends Evt {
658
+ //--[ Static ]--
659
+ /**
660
+ * Returns the component event type code used for dispatching component events.
661
+ * @return {string} The COMP event type
662
+ */
663
+ static compEventCode() {
664
+ return UiEventType.COMP;
665
+ }
666
+ /**
667
+ * Returns the component ready event type code.
668
+ * @return {string} The READY event type
669
+ */
670
+ static compReadyCode() {
671
+ return UiEventType.READY;
672
+ }
673
+ /**
674
+ * Returns the component error enumeration object.
675
+ * @return {!Object<string, string>} The ComponentError enum
676
+ */
677
+ static compErrors() {
678
+ return ComponentError;
679
+ }
680
+ #t;
681
+ #e;
682
+ #s;
683
+ #r;
684
+ #n;
685
+ #i;
686
+ #o;
687
+ #a;
688
+ constructor() {
689
+ super(), this.#t = () => (
690
+ /** @type {!HTMLElement} */
691
+ document.createElement("div")
692
+ ), this.#e = !1, this.#s = void 0, this.#r = void 0, this.#n = void 0, this.#i = void 0, this.#o = /* @__PURE__ */ new Map(), this.outOfTreeElements = [], this.placeholderDom = void 0, this.#a = () => {
693
+ };
694
+ }
695
+ //--[ Getters and Setters ]--
696
+ /**
697
+ * @param {Element|undefined} e
698
+ */
699
+ set target(w) {
700
+ this.#n = w;
701
+ }
702
+ /**
703
+ * @returns {Element|undefined}
704
+ */
705
+ get target() {
706
+ return this.#n;
707
+ }
708
+ /**
709
+ * Sets the model associated with the UI component.
710
+ * @param {*} m
711
+ */
712
+ set model(w) {
713
+ this.#r = w;
714
+ }
715
+ /**
716
+ * Returns the model associated with the UI component.
717
+ * @return {*}
718
+ */
719
+ get model() {
720
+ return this.#r;
721
+ }
722
+ /**
723
+ * @param {boolean} bool
724
+ */
725
+ set isInDocument(w) {
726
+ this.#e = w;
727
+ }
728
+ /**
729
+ * @return {boolean}
730
+ */
731
+ get isInDocument() {
732
+ return this.#e;
733
+ }
734
+ /**
735
+ * A function that makes a DOM element.
736
+ * @param {!function():(!HTMLElement|!Element|!DocumentFragment)} func
737
+ */
738
+ set domFunc(w) {
739
+ this.#t = w;
740
+ }
741
+ /**
742
+ * @param {!Function} func A callback guaranteed to fire after the panels is
743
+ * ready, and in the document, but before the
744
+ * {@code UiEventType.READY} event is fired.
745
+ */
746
+ set readyFunc(w) {
747
+ this.#a = w;
748
+ }
749
+ //--[ DOM Management ]--
750
+ /**
751
+ * Internal method to set the component's root element. Used primarily during
752
+ * rendering and re-rendering operations.
753
+ * @param {!Node} frag The DOM node to set as this component's element
754
+ * @private
755
+ */
756
+ setElementInternal_(w) {
757
+ this.#s = w;
758
+ }
759
+ /**
760
+ * Gets the component's element.
761
+ * @return {!HTMLElement|undefined} The element
762
+ * for the component.
763
+ */
764
+ getElement() {
765
+ return this.#s;
766
+ }
767
+ /**
768
+ * Creates the initial DOM representation for the component. The default
769
+ * implementation is to set this.element_ = div.
770
+ */
771
+ createDom() {
772
+ this.#s = this.#t();
773
+ }
774
+ /**
775
+ * Asserts that this component can be rendered asynchronously.
776
+ * Throws an error if the component has already been disposed.
777
+ * Used by async rendering methods to validate component state.
778
+ * @throws {Error} If the component is already disposed
779
+ */
780
+ assertCanRenderAsync() {
781
+ if (this.disposed)
782
+ throw new Error(ComponentError.ALREADY_DISPOSED);
783
+ }
784
+ /**
785
+ * Renders the component. If a parent element is supplied, the component's
786
+ * element will be appended to it. If there is no optional parent element and
787
+ * the element doesn't have a parentNode then it will be appended to the
788
+ * document body.
789
+ *
790
+ * If this component has a parent component, and the parent component is
791
+ * not in the document already, then this will not call `enterDocument`
792
+ * on this component.
793
+ *
794
+ * Throws an Error if the component is already rendered.
795
+ *
796
+ * @param {Element=} opt_parentElement Optional parent element to render the
797
+ * component into.
798
+ */
799
+ render(w) {
800
+ this.render_(w);
801
+ }
802
+ /**
803
+ * Renders the component. If a parent element is supplied, the component's
804
+ * element will be appended to it. If there is no optional parent element and
805
+ * the element doesn't have a parentNode then it will be appended to the
806
+ * document body.
807
+ *
808
+ * If this component has a parent component, and the parent component is
809
+ * not in the document already, then this will not call `enterDocument`
810
+ * on this component.
811
+ *
812
+ * Throws an Error if the component is already rendered.
813
+ *
814
+ * @param {Element=} opt_target Optional parent element to render the
815
+ * component into.
816
+ * @private
817
+ */
818
+ render_(w) {
819
+ if (this.disposed)
820
+ throw new Error(ComponentError.ALREADY_DISPOSED);
821
+ if (this.isInDocument)
822
+ throw new Error(ComponentError.ALREADY_RENDERED);
823
+ this.#s || this.createDom();
824
+ const D = (
825
+ /** @type {!Node} */
826
+ this.#s
827
+ );
828
+ w && (this.#n = w), this.placeholderDom && removeNode(this.placeholderDom), this.#n ? isInPage(D) || this.#n.insertBefore(D, null) : isInPage(
829
+ /** @type {!Node} */
830
+ D
831
+ ) || document.body.appendChild(D), (!this.#i || this.#i.isInDocument) && this.enterDocument();
832
+ }
833
+ //--[ Life-cycle ]--
834
+ /**
835
+ * @param {Node} el
836
+ * @param {Node} targetParent
837
+ */
838
+ hoist(w, D = void 0) {
839
+ D || (D = document.querySelector("body")), D.appendChild(w), this.outOfTreeElements.push(w);
840
+ }
841
+ /**
842
+ * Executes the beforeReady callback function if one was set.
843
+ * Called automatically during enterDocument, before the READY event is dispatched.
844
+ * Allows components to perform final setup operations once they're in the DOM.
845
+ */
846
+ executeBeforeReady() {
847
+ this.#a();
848
+ }
849
+ /**
850
+ * Called when the component's element is known to be in the document. Anything
851
+ * using document.getElementById etc. should be done at this stage.
852
+ *
853
+ * If the component contains child components, this call is propagated to its
854
+ * children.
855
+ */
856
+ enterDocument() {
857
+ this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((w) => {
858
+ !w.isInDocument && w.getElement() && w.enterDocument();
859
+ }), this.executeBeforeReady(), this.dispatchCompEvent(UiEventType.READY));
860
+ }
861
+ /**
862
+ * Called by dispose to clean up the elements and listeners created by a
863
+ * component, or by a parent component/application who has removed the
864
+ * component from the document but wants to reuse it later.
865
+ *
866
+ * If the component contains child components, this call is propagated to its
867
+ * children.
868
+ *
869
+ * It should be possible for the component to be rendered again once this
870
+ * method has been called.
871
+ */
872
+ exitDocument() {
873
+ [...this.#o.values()].forEach((w) => {
874
+ w.isInDocument && w.exitDocument();
875
+ }), this.stopBeingListenedTo(), this.removeAllListener(), this.isInDocument = !1, removeNode(this.getElement()), this.placeholderDom && removeNode(this.placeholderDom);
876
+ }
877
+ /**
878
+ * Disposes of the component. Calls `exitDocument`, which is expected to
879
+ * remove event handlers and clean up the component. Propagates the call to
880
+ * the component's children, if any. Removes the component's DOM from the
881
+ * document unless it was decorated.
882
+ * @protected
883
+ */
884
+ disposeInternal() {
885
+ this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((w) => w.disposeInternal()), this.outOfTreeElements.forEach(removeNode), this.#s && removeNode(this.#s), this.placeholderDom && removeNode(this.placeholderDom), this.#o = null, this.#s = void 0, this.#r = null, this.#i = null, super.disposeInternal();
886
+ }
887
+ /**
888
+ * Disposes of the component and performs cleanup. Aborts any pending async
889
+ * operations, asks registered component libraries to cleanup their components,
890
+ * and calls the parent dispose method.
891
+ * After calling this method, the component should not be used.
892
+ */
893
+ dispose() {
894
+ this.abortController && this.abortController.abort();
895
+ const w = this.getElement();
896
+ if (w)
897
+ for (const D of ComponentLibraryRegistry.getRegisteredLibraries())
898
+ try {
899
+ const U = ComponentLibraryRegistry.get(D);
900
+ U.dispose && U.dispose(w);
901
+ } catch (U) {
902
+ console.debug(`[${D}] Cleanup error during component disposal (non-critical):`, U);
903
+ }
904
+ super.dispose();
905
+ }
906
+ //--[ Built in events ]--
907
+ /**
908
+ * Dispatches a {@code UiEventType.COMP} event.
909
+ * A shorthand method to get panels to dispatch uniform events.
910
+ * Views may listen just to this event, and act on the supplied value or
911
+ * data payload.
912
+ * Example:
913
+ * b.listen(a, Component.compEventCode(), e => {
914
+ * console.log('B got', Component.compEventCode(), e);
915
+ * console.log('Value is', e.detail.getValue());
916
+ * console.log('Data is', e.detail.getData());
917
+ * });
918
+ * @param {string|number} value
919
+ * @param {(string|number|?Object)=} opt_data
920
+ * @return {boolean} If anyone called preventDefault on the event object (or
921
+ * if any of the handlers returns false this will also return false.
922
+ */
923
+ dispatchCompEvent(w, D) {
924
+ const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.COMP, U);
925
+ return this.dispatchEvent(F);
926
+ }
927
+ }
928
+ const EV = {
929
+ // Mouse events
930
+ CLICK: "click",
931
+ DBLCLICK: "dblclick",
932
+ MOUSEDOWN: "mousedown",
933
+ MOUSEUP: "mouseup",
934
+ MOUSEMOVE: "mousemove",
935
+ // Touch events
936
+ // Note that other touch events exist, but we should follow the W3C list here.
937
+ // http://www.w3.org/TR/touch-events/#list-of-touchevent-types
938
+ TOUCHSTART: "touchstart",
939
+ TOUCHMOVE: "touchmove",
940
+ TOUCHEND: "touchend",
941
+ // Form events
942
+ SUBMIT: "submit",
943
+ CHANGE: "change",
944
+ INPUT: "input",
945
+ INVALID: "invalid",
946
+ // Drag and drop events
947
+ DRAGSTART: "dragstart",
948
+ DRAGEND: "dragend",
949
+ DRAGOVER: "dragover",
950
+ DRAGENTER: "dragenter",
951
+ DRAGEXIT: "dragexit",
952
+ DRAGLEAVE: "dragleave",
953
+ DROP: "drop",
954
+ // Transitions
955
+ TRANSITIONEND: "transitionend"
956
+ }, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O, w, D, U) => (F) => {
957
+ F.preventDefault();
958
+ const q = normalizeEvent(F), W = (
959
+ /** @type {!HTMLElement} */
960
+ q.currentTarget
961
+ ), [Y, G] = getPos(W), Z = q.clientX - Y, Q = q.clientY - G, tt = O(Y, G, Z, Q, W), J = D(Y, G, Z, Q, W), X = w(Y, G, Z, Q, W);
962
+ let K = freeMoveListener(X, W, Z, Q);
963
+ ["x", "ew"].includes(U) ? K = xMoveOnlyListener(X, W, Z) : ["y", "ns"].includes(U) && (K = yMoveOnlyListener(X, W, Z, Q));
964
+ let et = !1;
965
+ const st = (nt) => {
966
+ et = !0, K(nt);
967
+ }, rt = (nt) => {
968
+ document.removeEventListener(EV.MOUSEMOVE, st, !0), document.removeEventListener(EV.TOUCHMOVE, st, !0), document.removeEventListener(EV.MOUSEUP, rt, !0), document.removeEventListener(EV.TOUCHEND, rt, !0), et && J(nt);
969
+ };
970
+ return document.addEventListener(EV.MOUSEUP, rt, !0), document.addEventListener(EV.TOUCHEND, rt, !0), document.addEventListener(EV.MOUSEMOVE, st, !0), document.addEventListener(EV.TOUCHMOVE, st, !0), tt(F), rt;
971
+ }, freeMoveListener = (O, w, D, U) => (F) => {
972
+ F.preventDefault();
973
+ const q = normalizeEvent(F);
974
+ w.style.left = `${q.clientX - D}px`, w.style.top = `${q.clientY - U}px`, O(q);
975
+ }, xMoveOnlyListener = (O, w, D, U) => (F) => {
976
+ F.preventDefault();
977
+ const q = normalizeEvent(F);
978
+ w.style.left = `${q.clientX - D}px`, O(q);
979
+ }, yMoveOnlyListener = (O, w, D, U) => (F) => {
980
+ F.preventDefault();
981
+ const q = normalizeEvent(F);
982
+ w.style.top = `${q.clientY - U}px`, O(q);
983
+ }, makeEmitter = (O, w) => (D, U, F, q, W) => (Y) => {
984
+ O.dispatchCompEvent(w, {
985
+ component: O,
986
+ browserEvent: Y,
987
+ left: D,
988
+ top: U,
989
+ clientX: Y.clientX,
990
+ clientY: Y.clientY,
991
+ xOrg: F,
992
+ yOrg: q,
993
+ deltaX: Y.clientX - F - D,
994
+ deltaY: Y.clientY - q - U,
995
+ target: W
996
+ });
997
+ };
998
+ class Dragger extends Component {
999
+ #t;
1000
+ #e;
1001
+ #s;
1002
+ #r;
1003
+ /**
1004
+ * @param {string} freedom Restrict the directions in which the
1005
+ * dragger can be moved.
1006
+ */
1007
+ constructor(w = "xy") {
1008
+ super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(w.toLowerCase()) ? w.toLowerCase() : "xy", this.#e = void 0, this.#s = !0, this.#r = (D) => null;
1009
+ }
1010
+ /**
1011
+ * Cancels the current drag operation in progress, if any.
1012
+ * @param {!Event} event The event that triggered the cancel
1013
+ */
1014
+ cancelDrag(w) {
1015
+ this.#r(w);
1016
+ }
1017
+ //--[ Getters and Setters ]--
1018
+ /**
1019
+ * Sets the direction in which the component can be dragged.
1020
+ * Only 'x' or 'y' will lock the movements to those directions.
1021
+ * Anything else will be considered free movement
1022
+ * @param {string} axis
1023
+ */
1024
+ set moveFreedom(w) {
1025
+ this.#t = w, this.#s || (this.lock(), this.unlock());
1026
+ }
1027
+ /**
1028
+ * Get the direction in which this component can move.
1029
+ * @return {string}
1030
+ */
1031
+ get moveFreedom() {
1032
+ return this.#t;
1033
+ }
1034
+ //--[ Override ]--
1035
+ /**
1036
+ * @inheritDoc
1037
+ */
1038
+ executeBeforeReady() {
1039
+ this.unlock(), super.executeBeforeReady();
1040
+ }
1041
+ //--[ Dragger Specific ]--
1042
+ /**
1043
+ * Make the component draggable
1044
+ */
1045
+ unlock() {
1046
+ const w = (D) => (U) => {
1047
+ this.#r = D(U);
1048
+ };
1049
+ if (this.isInDocument && this.#s) {
1050
+ const D = makeEmitter(this, UiEventType.COMP_DRAG_MOVE), U = makeEmitter(this, UiEventType.COMP_DRAG_START), F = makeEmitter(this, UiEventType.COMP_DRAG_END), q = dragStartListener(
1051
+ U,
1052
+ D,
1053
+ F,
1054
+ this.#t
1055
+ );
1056
+ this.#s = !1, this.#e = /** @type {!Node} */
1057
+ this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN, w(q)), this.listen(this.#e, EV.TOUCHSTART, q), this.#e.classList.remove("locked");
1058
+ }
1059
+ }
1060
+ /**
1061
+ * Lock the component in place.
1062
+ * Removes all the listeners added when it was made draggable.
1063
+ */
1064
+ lock() {
1065
+ this.stopListeningTo(this.#e, EV.MOUSEDOWN), this.stopListeningTo(this.#e, EV.TOUCHSTART), this.#s = !0, this.#e.classList.add("locked");
1066
+ }
1067
+ }
1068
+ const splitRe_ = new RegExp(
1069
+ "^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$"
1070
+ ), ComponentIndex = {
1071
+ PATH: 5,
1072
+ QUERY_DATA: 6
1073
+ }, split = (O) => (
1074
+ /** @type {!Array<string|undefined>} */
1075
+ O.match(splitRe_)
1076
+ ), decodeOrEmpty_ = (O, w) => O ? decodeURI(O.replace(/%25/g, "%2525")) : "", getPath = (O) => decodeOrEmpty_(split(O)[ComponentIndex.PATH]), getQueryData = (O) => decodeOrEmpty_(split(O)[ComponentIndex.QUERY_DATA]), objectToUrlParms = (O) => [...Object.entries(O)].map(
1077
+ (w) => `${w[0]}=${w[1]}`
1078
+ ).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((w, D) => {
1079
+ const [U, F] = D.split("=");
1080
+ return isValidValue(U) && isValidValue(F) && w.set(U, F), w;
1081
+ }, /* @__PURE__ */ new Map()), uriUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1082
+ __proto__: null,
1083
+ getPath,
1084
+ getQueryData,
1085
+ objectToUrlParms,
1086
+ queryDataToMap
1087
+ }, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((w) => w.split("=")).reduce((w, D) => w.set(stripLeadingSpace(D[0]), D[1]), /* @__PURE__ */ new Map()).get(O), spinner = (O) => {
1088
+ let w = 0, D;
1089
+ const U = (F) => {
1090
+ const q = F > 0;
1091
+ return q ? w += 1 : w -= 1, q ? w === 1 : w === 0;
1092
+ };
1093
+ return (F) => {
1094
+ D = D || document.getElementById(O), D && U(F) && D.classList.toggle("viz", w > 0);
1095
+ };
1096
+ }, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (w) => {
1097
+ if (w.type === "opaqueredirect" || w.redirected) {
1098
+ const D = stripLeadingSlash(getPath(w.url));
1099
+ O.setIsRedirected(!0, D), console.log("Redirect detected", D);
1100
+ }
1101
+ return checkStatus(w);
1102
+ }, getJson = (O) => O.json(), getText = (O) => O.text().then(
1103
+ (w) => Promise.resolve(w),
1104
+ (w) => Promise.reject(new Error(`Could not get text from response: ${w}`))
1105
+ ), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, w, D = "POST", U = void 0) => {
1106
+ const F = new Headers();
1107
+ F.append("Content-type", "application/json"), F.append("X-Requested-With", "XMLHttpRequest"), O && O !== "" && F.append("Authorization", `Bearer ${O}`);
1108
+ const q = {
1109
+ cache: "no-cache",
1110
+ method: D,
1111
+ headers: F,
1112
+ credentials: "include",
1113
+ body: JSON.stringify(w)
1114
+ };
1115
+ return U && (q.signal = U), q;
1116
+ }, basicPutPostPatchInit = (O, w, D = !1, U = void 0) => {
1117
+ const F = new Headers();
1118
+ if (w && w !== "" && F.append("Authorization", `Bearer ${w}`), F.append("X-Requested-With", "XMLHttpRequest"), D) {
1119
+ const W = getCookieByName("csrftoken");
1120
+ W && D && F.append("X-CSRFToken", W);
1121
+ }
1122
+ const q = {
1123
+ cache: "no-cache",
1124
+ method: O,
1125
+ headers: F,
1126
+ redirect: "follow",
1127
+ // This is anyway the default.
1128
+ credentials: "include"
1129
+ };
1130
+ return U && (q.signal = U), q;
1131
+ }, formPostInit = (O, w, D = void 0) => {
1132
+ const F = basicPutPostPatchInit("POST", O, !1, D);
1133
+ return F.body = new FormData(w.formEl), F;
1134
+ }, basicGetInit = (O, w = void 0) => {
1135
+ const D = new Headers();
1136
+ D.append("Authorization", `Bearer ${O}`), D.append("X-Requested-With", "XMLHttpRequest");
1137
+ const U = {
1138
+ cache: "no-cache",
1139
+ headers: D,
1140
+ credentials: "include"
1141
+ };
1142
+ return w && (U.signal = w), U;
1143
+ }, putPostPatchNobody = (O, w) => {
1144
+ const D = new Request(O);
1145
+ return fetch(D, w).then(checkStatus).then(getText);
1146
+ }, genCatchClause = (O, w = void 0) => (D) => (stopSpin("").then(identity), D.name === "AbortError" ? console.info(O, "ABORTED!") : console.error(O, D), w);
1147
+ class UserManager {
1148
+ /**
1149
+ * @param {!Object=} opt_data
1150
+ */
1151
+ constructor(w) {
1152
+ this.user_ = {}, this.jwt = "", w && this.updateProfileFromJwt(w).then(() => {
1153
+ });
1154
+ }
1155
+ /**
1156
+ * @param {Object} data
1157
+ * @param {boolean=} opt_onlyIfNoneExists
1158
+ * @return {Promise}
1159
+ * @private
1160
+ */
1161
+ updateProfileFromJwt(w, D = !1) {
1162
+ return D && this.jwt !== "" ? Promise.resolve("User Profile Already exists") : w.non_field_errors ? Promise.reject(new Error(`JWT ${w.non_field_errors}`)) : (this.updateToken(w.token), this.updateProfile(w.user), Promise.resolve("User Profile Updated"));
1163
+ }
1164
+ /**
1165
+ * @param {UserLikeType} data
1166
+ */
1167
+ updateProfile(w) {
1168
+ this.user_ = w;
1169
+ }
1170
+ /**
1171
+ * @param {string} t
1172
+ */
1173
+ updateToken(w) {
1174
+ this.jwt = w;
1175
+ }
1176
+ /**
1177
+ * @return {number|undefined}
1178
+ */
1179
+ get id() {
1180
+ return this.user_.id;
1181
+ }
1182
+ /**
1183
+ * @return {string|undefined}
1184
+ */
1185
+ get name() {
1186
+ return this.user_.name;
1187
+ }
1188
+ /**
1189
+ * @return {string|undefined}
1190
+ */
1191
+ get surname() {
1192
+ return this.user_.surname;
1193
+ }
1194
+ /**
1195
+ * @return {string|undefined}
1196
+ */
1197
+ get salutation() {
1198
+ let w = this.name;
1199
+ const D = this.surname;
1200
+ return D && (w = w + " " + D), w;
1201
+ }
1202
+ /**
1203
+ * @param {FormPanel} formPanel
1204
+ * @return {Promise}
1205
+ */
1206
+ formSubmit(w) {
1207
+ const D = new Request(w.uri.toString()), U = w.processSubmitReply.bind(w), F = genCatchClause("Form submit error");
1208
+ return startSpin().then(() => fetch(D, formPostInit(
1209
+ this.jwt,
1210
+ w,
1211
+ w.abortController.signal
1212
+ ))).then(checkStatusTwo(w)).then(stopSpin).then(getTextOrJson).then(U).catch(F);
1213
+ }
1214
+ /**
1215
+ * @param {string} uri
1216
+ * @param {Boolean} useDocumentCookies
1217
+ * @param {AbortSignal|undefined} signal
1218
+ * @return {Promise}
1219
+ */
1220
+ putNoBody(w, D = void 0, U = !1) {
1221
+ const F = genCatchClause("putNobody error"), q = basicPutPostPatchInit(
1222
+ "PUT",
1223
+ this.jwt,
1224
+ U,
1225
+ D
1226
+ );
1227
+ return putPostPatchNobody(w, q).catch(F);
1228
+ }
1229
+ /**
1230
+ * @param {string} uri
1231
+ * @param {AbortSignal|undefined} signal
1232
+ * @return {Promise}
1233
+ */
1234
+ fetch(w, D = void 0) {
1235
+ const U = new Request(w.toString()), F = genCatchClause(`UMan Text GET Fetch: ${w}`);
1236
+ return startSpin().then(() => fetch(U, basicGetInit(this.jwt, D))).then(checkStatus).then(stopSpin).then(getText).catch(F);
1237
+ }
1238
+ /**
1239
+ * Use this if you want to directly get a parsed template that does not go
1240
+ * through panel logic.
1241
+ * @param {string} uri
1242
+ * @param {AbortSignal|undefined} signal
1243
+ * @return {Promise}
1244
+ */
1245
+ fetchAndSplit(w, D = void 0) {
1246
+ const U = genCatchClause(`fetchAndSplit: ${w}`);
1247
+ return this.fetch(w, D).then(handleTemplateProm).catch(U);
1248
+ }
1249
+ /**
1250
+ * @param {string} uri
1251
+ * @param {AbortSignal|undefined} signal
1252
+ * @return {Promise}
1253
+ */
1254
+ async fetchJson(w, D = void 0) {
1255
+ const U = new Request(w.toString()), F = genCatchClause(`fetchJson: ${w}`, {}), q = basicGetInit(this.jwt, D);
1256
+ await startSpin();
1257
+ let W = {};
1258
+ try {
1259
+ W = await (await fetch(U, q)).json();
1260
+ } catch (Y) {
1261
+ return F(Y);
1262
+ }
1263
+ return await stopSpin(), W;
1264
+ }
1265
+ /**
1266
+ * @param {string} uri
1267
+ * @param {Object} payload
1268
+ * @param {AbortSignal|undefined} signal
1269
+ * @return {Promise}
1270
+ */
1271
+ patchJson(w, D, U = void 0) {
1272
+ const F = new Request(w.toString()), q = genCatchClause(`patchJson: ${w}`), W = jsonInit(this.jwt, D, "PATCH", U);
1273
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1274
+ }
1275
+ /**
1276
+ * @param {string} uri
1277
+ * @param {Object} payload
1278
+ * @param {AbortSignal|undefined} signal
1279
+ * @return {Promise}
1280
+ */
1281
+ postJson(w, D, U = void 0) {
1282
+ const F = new Request(w.toString()), q = genCatchClause(`postJson: ${w}`), W = jsonInit(this.jwt, D, "POST", U);
1283
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1284
+ }
1285
+ /**
1286
+ * @param {string} uri
1287
+ * @param {Object} payload
1288
+ * @param {AbortSignal|undefined} signal
1289
+ * @return {Promise}
1290
+ */
1291
+ putJson(w, D, U = void 0) {
1292
+ const F = new Request(w.toString()), q = genCatchClause(`putJson: ${w}`), W = jsonInit(this.jwt, D, "PUT", U);
1293
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1294
+ }
1295
+ /**
1296
+ * @param {string} uri
1297
+ * @param {Object} payload
1298
+ * @param {AbortSignal|undefined} signal
1299
+ * @return {Promise}
1300
+ */
1301
+ delJson(w, D, U = void 0) {
1302
+ const F = new Request(w.toString()), q = genCatchClause(`delJson: ${w}`), W = jsonInit(this.jwt, D, "DELETE", U);
1303
+ return fetch(F, W).then(checkStatus).then(getJson).catch(q);
1304
+ }
1305
+ }
1306
+ class Panel extends Component {
1307
+ /**
1308
+ * Returns the panel event type code used for dispatching panel events.
1309
+ * @return {string} The PANEL event type
1310
+ */
1311
+ static panelEventCode() {
1312
+ return UiEventType.PANEL;
1313
+ }
1314
+ /**
1315
+ * Returns the component ready event type code.
1316
+ * @return {string} The READY event type
1317
+ */
1318
+ static compReadyCode() {
1319
+ return UiEventType.READY;
1320
+ }
1321
+ /**
1322
+ * Creates a new Panel instance.
1323
+ * @param {string=} uri Optional URI for fetching panel content
1324
+ */
1325
+ constructor(w) {
1326
+ super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", w && this.parseUri(w), this.evalScripts = evalScripts(this), this.evalModules = evalModules(this), this.redirected = !1, this.responseObject = { html: null, scripts: null }, this.user_ = void 0, "AbortController" in window ? this.abortController = new AbortController() : this.abortController = {
1327
+ signal: void 0,
1328
+ abort: () => {
1329
+ }
1330
+ }, this.listMap = /* @__PURE__ */ new Map();
1331
+ }
1332
+ //--[ Getters and Setters ]--
1333
+ get uri() {
1334
+ const w = this.qParamMap_.size > 0 ? "?" + objectToUrlParms(Object.fromEntries(this.qParamMap_)) : "";
1335
+ return this.uri_ + w;
1336
+ }
1337
+ /**
1338
+ * @param {!UserManager} user
1339
+ */
1340
+ set user(w) {
1341
+ this.user_ = w;
1342
+ }
1343
+ /**
1344
+ * @return {!UserManager}
1345
+ */
1346
+ get user() {
1347
+ return this.user_ || (this.user_ = new UserManager()), this.user_;
1348
+ }
1349
+ /**
1350
+ * Parses a URI into its path and query parameters. Updates the panel's
1351
+ * internal URI and query parameter map.
1352
+ * @param {string} uri The URI to parse
1353
+ */
1354
+ parseUri(w) {
1355
+ this.uri_ = getPath(w), this.qParamMap_ = queryDataToMap(getQueryData(w));
1356
+ }
1357
+ /**
1358
+ * Adds or updates a query parameter in the panel's query parameter map.
1359
+ * @param {string} k The parameter key
1360
+ * @param {string} v The parameter value
1361
+ */
1362
+ addToQParams(w, D) {
1363
+ this.qParamMap_.set(w, D);
1364
+ }
1365
+ /**
1366
+ * Removes a query parameter from the panel's query parameter map.
1367
+ * @param {string} k The parameter key to remove
1368
+ */
1369
+ removeFromQParams(w) {
1370
+ this.qParamMap_.delete(w);
1371
+ }
1372
+ /**
1373
+ * Clears all query parameters from the panel's query parameter map.
1374
+ */
1375
+ clearQParams() {
1376
+ this.qParamMap_.clear();
1377
+ }
1378
+ //--[ Carbon Component Access ]-----
1379
+ /**
1380
+ * Gets all Carbon components of a specific type in this panel.
1381
+ * Components are scanned and stored during Carbon library initialization.
1382
+ * @param {string} selector - Carbon component selector (e.g., 'cds-table', 'cds-button')
1383
+ * @return {Element[]} Array of matching elements, or empty array if none found
1384
+ * @example
1385
+ * const tables = this.getCarbonComponents('cds-table');
1386
+ * const buttons = this.getCarbonComponents('cds-button');
1387
+ */
1388
+ getCarbonComponents(w) {
1389
+ return this.carbonComponents?.get(w) || [];
1390
+ }
1391
+ /**
1392
+ * Gets a single Carbon component by its ID.
1393
+ * Searches across all Carbon component types stored in this panel.
1394
+ * @param {string} id - The element ID to search for
1395
+ * @return {Element|undefined} The matching element, or undefined if not found
1396
+ * @example
1397
+ * const table = this.getCarbonComponentById('companies-table');
1398
+ */
1399
+ getCarbonComponentById(w) {
1400
+ if (this.carbonComponents)
1401
+ for (const D of this.carbonComponents.values()) {
1402
+ const U = D.find((F) => F.id === w);
1403
+ if (U)
1404
+ return U;
1405
+ }
1406
+ }
1407
+ //--[ Template Render ]-----
1408
+ /**
1409
+ * Temporarily render placeholder DOM
1410
+ * @param {Node!} placeholder
1411
+ */
1412
+ renderPlaceHolder(w) {
1413
+ this.target && (this.placeholderDom = w, this.target.insertBefore(this.placeholderDom, null));
1414
+ }
1415
+ /**
1416
+ * Expects HTML data from a call to the back.
1417
+ * @param {Function=} opt_callback An optional callback to call before
1418
+ * rendering the panel. This is useful for when you only want to attach the
1419
+ * new panel to the view right before you render it - meaning the existing
1420
+ * panel stays in place on the DOM for the duration of the fetch call.
1421
+ * @return {Promise} Returns a promise with this panel as value.
1422
+ */
1423
+ renderWithTemplate(w) {
1424
+ const D = this.user;
1425
+ return D ? D.fetch(this.uri, this.abortController.signal).then((U) => (this.assertCanRenderAsync(), w && w(this), this.onRenderWithTemplateReply(U).catch((F) => {
1426
+ F.message !== Component.compErrors().ALREADY_DISPOSED && console.error("RenderWithTemplate Err:", F);
1427
+ }), this)).catch((U) => {
1428
+ throw console.error("Panel.renderWithTemplate fetch failed:", U), U;
1429
+ }) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithTemplate()"));
1430
+ }
1431
+ /**
1432
+ * @param {string} s
1433
+ * @private
1434
+ * @return {Promise}
1435
+ */
1436
+ onRenderWithTemplateReply(w) {
1437
+ return this.responseObject = splitScripts(w), this.domFunc = () => (
1438
+ /** @type {!Element} */
1439
+ this.responseObject.html
1440
+ ), this.render(), Promise.resolve(this);
1441
+ }
1442
+ /**
1443
+ * Partially replace panel's content.
1444
+ * If an ID query selector (#something) is passed in, then that single node is replaced
1445
+ * in the panel DOM with the single node in the content DOM
1446
+ *
1447
+ * If a class query selector (.some_class) is passed in, all elements in the
1448
+ * panel's dom with that class is replaced with the matching
1449
+ * element ID in the content DOM matching the target DOMs element IDs
1450
+ *
1451
+ * NOTE: For the spot replacement to work, you need both the classname
1452
+ * and a unique element ID on the element you intend to replace.
1453
+ *
1454
+ * NOTE: Top level replacements will clobber child replacements.
1455
+ *
1456
+ * @param content
1457
+ * @param qs
1458
+ */
1459
+ onReplacePartialDom(w, D) {
1460
+ const U = this.getElement();
1461
+ if (isUndefined(U))
1462
+ return;
1463
+ const F = w.html;
1464
+ if (D.startsWith("."))
1465
+ [...U.querySelectorAll(D)].filter((q) => isDefAndNotNull(q.id)).map((q) => [q, F.querySelector(`#${q.id}`)]).filter(([q, W]) => isDefAndNotNull(W)).forEach(([q, W]) => {
1466
+ q.parentNode.replaceChild(W, q), this.parseContent(W);
1467
+ });
1468
+ else if (D.startsWith("#")) {
1469
+ const q = F.querySelector(D), W = U.querySelector(D);
1470
+ W.parentNode.replaceChild(q, W), this.parseContent(q);
1471
+ }
1472
+ this.evalScripts(w.scripts), this.evalModules(w.modules);
1473
+ }
1474
+ //--[ JSON Render ]-----
1475
+ /**
1476
+ * Equivalent to the @code{renderWithTemplate} method in that it is guaranteed
1477
+ * that a reply from the callback is received before @code{render} is called.
1478
+ * @param {function(Object, !Panel)} opt_callback The callback function
1479
+ * that will receive the reply event.
1480
+ */
1481
+ renderWithJSON(w) {
1482
+ return this.user ? this.user.fetchJson(this.uri_, this.abortController.signal).then((U) => {
1483
+ this.assertCanRenderAsync(), w && w(U, this), this.onRenderWithJSON(U).then(identity);
1484
+ }).catch((U) => {
1485
+ throw console.error("Panel.renderWithJSON fetch failed:", U), U;
1486
+ }) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"));
1487
+ }
1488
+ /**
1489
+ * On reply from a GET call to the panel URI
1490
+ * @param {Object} _json The callback function
1491
+ * that will receive the reply event.
1492
+ * @return {Promise}
1493
+ */
1494
+ onRenderWithJSON(w) {
1495
+ return Promise.resolve(this);
1496
+ }
1497
+ /**
1498
+ * @param {Element} _el
1499
+ * @param {Object} _elDataMap
1500
+ * @param {Object} _json
1501
+ */
1502
+ onAsyncJsonReply(w, D, U) {
1503
+ }
1504
+ /**
1505
+ * Called on each async HTML response, after the content is in the DOM
1506
+ * and rendered.
1507
+ * @param {Element} _el
1508
+ * @param {Object} _elDataMap
1509
+ */
1510
+ onAsyncHtmlReply(w, D) {
1511
+ }
1512
+ /**
1513
+ * Hook method called when the view broadcasts data to all its panels.
1514
+ * Override this method to handle broadcasted data in subclasses.
1515
+ * @param {*} _data The data broadcast from the view
1516
+ */
1517
+ onViewDataBroadcast(w) {
1518
+ }
1519
+ //--[ JSON Render ]-----
1520
+ /**
1521
+ * @param {Element} panel
1522
+ */
1523
+ parseContent(w) {
1524
+ if (this.debugMe("Enable interactions. Panel:", w), typeof window.customElements < "u" && ComponentLibraryRegistry.has("carbon")) {
1525
+ const J = ComponentLibraryRegistry.get("carbon");
1526
+ J.render.call(this, w, J.cache).catch((X) => console.error("[Zooy] Carbon initialization failed:", X));
1527
+ }
1528
+ if (ComponentLibraryRegistry.has("mdc")) {
1529
+ const J = ComponentLibraryRegistry.get("mdc");
1530
+ J.render.call(this, w, J.cache);
1531
+ }
1532
+ w.classList.contains("zoo__modal-base") && w.classList.contains("close_on_click") && this.listen(w, EV.CLICK, (J) => {
1533
+ J.target === w && this.dispatchPanelEvent("destroy_me");
1534
+ }), [...w.querySelectorAll(
1535
+ ".zoo__button:not(.external):not(.mdc-data-table__row)"
1536
+ )].forEach((J) => {
1537
+ this.listen(J, EV.CLICK, (X) => {
1538
+ X.stopPropagation();
1539
+ const K = X.currentTarget, et = getElDataMap(K);
1540
+ this.dispatchPanelEvent(et.zv, Object.assign({
1541
+ orgEvt: X,
1542
+ trigger: K,
1543
+ href: K.href || et.href
1544
+ }, et));
1545
+ });
1546
+ }), [...w.querySelectorAll("[href]:not(.external)")].forEach((J) => {
1547
+ this.listen(J, EV.CLICK, (X) => {
1548
+ const K = X.currentTarget;
1549
+ X.preventDefault(), X.stopPropagation();
1550
+ const et = getElDataMap(K), st = et.zv || "href";
1551
+ this.dispatchPanelEvent(st, Object.assign({
1552
+ orgEvt: X,
1553
+ trigger: X.target,
1554
+ href: K.href || et.href
1555
+ }, et));
1556
+ });
1557
+ }), [...w.querySelectorAll("form.intercept_submit")].forEach((J) => {
1558
+ J.noValidate = !0, this.listen(J, EV.SUBMIT, (X) => {
1559
+ X.preventDefault(), X.stopPropagation();
1560
+ const K = getElDataMap(J), et = formToJSON(J.elements);
1561
+ this.dispatchPanelEvent(K.zv, Object.assign({
1562
+ orgEvt: X,
1563
+ trigger: X.target,
1564
+ formData: et,
1565
+ href: K.href
1566
+ }, K));
1567
+ });
1568
+ }), [...w.querySelectorAll(".zoo__toggle_class_driver")].forEach(
1569
+ (J) => {
1570
+ const X = getElDataMap(J), K = X.toggle_class_target_id, et = X.toggle_class, st = w.querySelector(`#${K}`);
1571
+ st && et && J.addEventListener(EV.CLICK, (rt) => {
1572
+ rt.stopPropagation(), st.classList.toggle(et);
1573
+ });
1574
+ }
1575
+ );
1576
+ const D = Array.from(w.querySelectorAll(".folder_drop_zone")), U = Array.from(w.querySelectorAll("[draggable]")), F = (J) => {
1577
+ J.preventDefault(), J.target.classList.add("drag_over");
1578
+ }, q = (J) => {
1579
+ J.preventDefault();
1580
+ }, W = (J) => {
1581
+ J.preventDefault(), J.target.classList.remove("drag_over");
1582
+ }, Y = (J) => {
1583
+ J.preventDefault(), J.target.classList.remove("drag_over");
1584
+ }, G = (J) => {
1585
+ J.preventDefault(), J.target.classList.remove("drag_over");
1586
+ }, Z = (J) => {
1587
+ J.dataTransfer.dropEffect = "move";
1588
+ const X = getElDataMap(J.target);
1589
+ J.dataTransfer.setData("text/plain", JSON.stringify(X)), J.target.classList.add("drag_in_progress");
1590
+ }, Q = (J) => {
1591
+ J.target.classList.remove("drag_in_progress");
1592
+ }, tt = (J) => {
1593
+ G(J), J.stopPropagation();
1594
+ const X = JSON.parse(J.dataTransfer.getData("text/plain")), K = getElDataMap(J.target);
1595
+ return this.dispatchPanelEvent("drop_on", {
1596
+ custom: { on: K, from: X }
1597
+ }), !1;
1598
+ };
1599
+ D.forEach((J) => {
1600
+ this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT, Y), this.listen(J, EV.DRAGLEAVE, W), this.listen(J, EV.DROP, tt);
1601
+ }), U.forEach((J) => {
1602
+ this.listen(J, EV.DRAGSTART, Z), this.listen(J, EV.DRAGEND, Q);
1603
+ }), [...w.querySelectorAll(".zoo_async_json")].forEach((J) => {
1604
+ const X = getElDataMap(J), K = X.href, et = this.onAsyncJsonReply.bind(this, J, X);
1605
+ this.user.fetchJson(K, this.abortController.signal).then(et);
1606
+ const st = X.z_json_reusable;
1607
+ st && (this.jsonCallFuncs = this.jsonCallFuncs || {}, this.jsonCallFuncs[st] = () => {
1608
+ this.user.fetchJson(K, this.abortController.signal).then(et);
1609
+ });
1610
+ const rt = toNumber(X.z_interval);
1611
+ isNumber(rt) && this.doOnBeat(() => {
1612
+ this.user.fetchJson(K, this.abortController.signal).then(et);
1613
+ }, rt * 60 * 1e3);
1614
+ }), [...w.querySelectorAll(".zoo_async_html")].forEach(
1615
+ /**
1616
+ * @param {Element} el
1617
+ */
1618
+ (J) => {
1619
+ const X = getElDataMap(J), K = X.href;
1620
+ this.user.fetchAndSplit(K, this.abortController.signal).then((st) => {
1621
+ J.appendChild(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules), this.onAsyncHtmlReply(J, X);
1622
+ });
1623
+ const et = toNumber(X.z_interval);
1624
+ isNumber(et) && this.doOnBeat(() => {
1625
+ this.user.fetchAndSplit(K, this.abortController.signal).then((st) => {
1626
+ J.replaceChildren(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules);
1627
+ });
1628
+ }, et * 60 * 1e3);
1629
+ }
1630
+ );
1631
+ }
1632
+ /**
1633
+ * @inheritDoc
1634
+ * Called when the panel enters the document. Parses content to enable
1635
+ * Material Design Components, executes scripts and modules, then dispatches
1636
+ * the READY event.
1637
+ */
1638
+ enterDocument() {
1639
+ const w = this.getElement();
1640
+ this.parseContent(w), this.evalScripts(this.responseObject.scripts), this.evalModules(this.responseObject.modules), super.enterDocument();
1641
+ }
1642
+ /**
1643
+ * @inheritDoc
1644
+ * Called when the panel exits the document. Aborts any pending async
1645
+ * operations and performs cleanup.
1646
+ */
1647
+ exitDocument() {
1648
+ this.abortController.abort(), super.exitDocument();
1649
+ }
1650
+ /**
1651
+ * @param {boolean} bool
1652
+ * @param {?string} url
1653
+ */
1654
+ setIsRedirected(w, D) {
1655
+ this.redirected = w, this.redirected && D && (this.uri_ = D);
1656
+ }
1657
+ //--[ Built in events ]--
1658
+ /**
1659
+ * Dispatches a @code{UiEventType.PANEL} event.
1660
+ * A shorthand method to get panels to dispatch uniform events.
1661
+ * Views may listen just to this event, and act on the supplied value or
1662
+ * data payload.
1663
+ * @example
1664
+ * b.listen(a, Panel.panelEventCode(), e => {
1665
+ * console.log('B got', Panel.panelEventCode(), e);
1666
+ * console.log('Value is', e.detail.getValue());
1667
+ * console.log('Data is', e.detail.getData());
1668
+ * });
1669
+ * @param {string|number} value
1670
+ * @param {(string|number|?Object)=} opt_data
1671
+ * @return {boolean} If anyone called preventDefault on the event object
1672
+ * or if any of the handlers returns false this will also return false.
1673
+ */
1674
+ dispatchPanelEvent(w, D) {
1675
+ const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.PANEL, U);
1676
+ return this.debugMe(`PANEL EVENT FIRED:
1677
+ value:${w}
1678
+ data:${D}`), this.dispatchEvent(F);
1679
+ }
1680
+ }
1681
+ class FormPanel extends Panel {
1682
+ /**
1683
+ * @type {?HTMLFormElement}
1684
+ * @private
1685
+ */
1686
+ #t = null;
1687
+ /**
1688
+ * Map of form fields to their error message DOM elements
1689
+ * @type {!Map<HTMLInputElement, Element>}
1690
+ * @private
1691
+ */
1692
+ #e = /* @__PURE__ */ new Map();
1693
+ #s = !0;
1694
+ /**
1695
+ * Creates a new FormPanel instance.
1696
+ * @param {string=} uri Optional URI for fetching form content
1697
+ * @param {boolean} intercept If false, we do not try and intercept the forms
1698
+ */
1699
+ constructor(w, D = !0) {
1700
+ super(w), this.#s = D, this.debugMode = !0, this.onSubmitSucFunc = (U, F) => null;
1701
+ }
1702
+ /**
1703
+ * Gets the form element managed by this panel.
1704
+ * @return {?HTMLFormElement} The form element, or null if not found
1705
+ */
1706
+ get formEl() {
1707
+ return this.#t;
1708
+ }
1709
+ /**
1710
+ * @inheritDoc
1711
+ * Called when the form panel enters the document. Identifies the form element
1712
+ * and sets up submission interception and field error handling.
1713
+ */
1714
+ enterDocument() {
1715
+ super.enterDocument(), this.formIdElementToForm_();
1716
+ }
1717
+ /**
1718
+ * Internal method to identify the form element and set up interception.
1719
+ * @private
1720
+ */
1721
+ formIdElementToForm_() {
1722
+ this.#t = this.getFormFromId(), this.#t && (this.#a(this.#t), this.#r());
1723
+ }
1724
+ /**
1725
+ * @param {string=} string The id of the form we want to sterilise.
1726
+ * @return {?HTMLFormElement}
1727
+ */
1728
+ getFormFromId(w) {
1729
+ let D = null, U = this.getElement().querySelector("form");
1730
+ return w && (U = document.getElementById(
1731
+ /** @type {string} */
1732
+ w
1733
+ ) || U), U && U.tagName.toLowerCase() === "form" && (D = /** @type {HTMLFormElement} */
1734
+ U), D;
1735
+ }
1736
+ //--[ Field Validation Methods ]--
1737
+ /**
1738
+ * Initializes field validation. Sets up event listeners on the form
1739
+ * for change, input, and invalid events.
1740
+ * @private
1741
+ */
1742
+ #r() {
1743
+ this.#t && (this.listen(this.#t, EV.CHANGE, (w) => {
1744
+ this.#o(w);
1745
+ }, { passive: !0 }), this.listen(this.#t, EV.INPUT, (w) => {
1746
+ this.clearAllValidationErrors(), this.#o(w);
1747
+ }), this.listen(this.#t, EV.INVALID, (w) => {
1748
+ w.preventDefault();
1749
+ const D = (
1750
+ /** @type {HTMLInputElement} */
1751
+ w.target
1752
+ );
1753
+ this.#i(D), this.displayFieldError(D);
1754
+ }, { passive: !0 }));
1755
+ }
1756
+ /**
1757
+ * Checks all form fields for validity. Returns true if all fields are valid.
1758
+ * Displays error messages for any invalid fields.
1759
+ * @return {boolean} True if all fields are valid, false otherwise
1760
+ */
1761
+ checkAllFields() {
1762
+ const w = [...this.#t.elements].map((D) => [this.#n(D), D]).filter((D) => !D[0]);
1763
+ return w.forEach((D) => this.displayFieldError(D[1])), w.length === 0;
1764
+ }
1765
+ /**
1766
+ * Clear all existing validation errors
1767
+ */
1768
+ clearAllValidationErrors() {
1769
+ [...this.#t ? this.#t.elements : []].forEach((U) => this.#i(U)), [...this.#t.querySelectorAll(".non-field-errors")].forEach((U) => U.classList.remove("alert-error"));
1770
+ }
1771
+ /**
1772
+ * Format the message dom object and insert it into the DOM
1773
+ * @param {HTMLInputElement} field The field after which the alert will be inserted.
1774
+ * @param {string} msg The message in the alert.
1775
+ * @param {string} _css A CSS class name to add to the alert div.
1776
+ * @private
1777
+ */
1778
+ displayAlert_(w, D, U) {
1779
+ const F = document.getElementById(`${w.id}-helper-text`) || document.createElement("p");
1780
+ F.textContent = D, this.#e.set(w, F);
1781
+ }
1782
+ /**
1783
+ * Check validation for a single field
1784
+ * @param {HTMLInputElement} field
1785
+ * @return {boolean} True if field is valid
1786
+ * @private
1787
+ */
1788
+ #n(w) {
1789
+ this.#i(w);
1790
+ let D = !w.willValidate;
1791
+ return w.willValidate && (D = w.checkValidity()), D;
1792
+ }
1793
+ /**
1794
+ * Clear alert for a single field
1795
+ * @param {HTMLInputElement} field
1796
+ * @private
1797
+ */
1798
+ #i(w) {
1799
+ w.classList.remove("error"), this.#e.has(w) && (this.#e.get(w).textContent = ""), this.#e.delete(w);
1800
+ }
1801
+ /**
1802
+ * Display the given error message on the given form field.
1803
+ * @param {HTMLInputElement} field
1804
+ * @param {string=} opt_msg
1805
+ */
1806
+ displayFieldError(w, D) {
1807
+ const U = D || w.validationMessage;
1808
+ w.classList.add("error"), this.displayAlert_(w, U, "alert-error");
1809
+ }
1810
+ /**
1811
+ * Display the given success message on the given form field.
1812
+ * @param {HTMLInputElement} field
1813
+ * @param {string} message
1814
+ */
1815
+ displayFieldSuccess(w, D) {
1816
+ this.displayAlert_(w, D, "alert-success");
1817
+ }
1818
+ /**
1819
+ * Display the given information message on the given form field.
1820
+ * @param {HTMLInputElement} field
1821
+ * @param {string} message
1822
+ */
1823
+ displayFieldInfo(w, D) {
1824
+ this.displayAlert_(w, D, "alert-info");
1825
+ }
1826
+ /**
1827
+ * Validate field on change event
1828
+ * @param {Event} e
1829
+ * @private
1830
+ */
1831
+ #o(w) {
1832
+ this.#n(
1833
+ /** @type {HTMLInputElement} */
1834
+ w.target
1835
+ );
1836
+ }
1837
+ /**
1838
+ * Given a form id, get the form, and intercept and sterilise its submit.
1839
+ * Forms that passed through here will not be able to be submitted with a
1840
+ * normal submit button anymore, but built in HTML5 Constraint Validation
1841
+ * will still function on the form. This way, we can still have a button with
1842
+ * type="submit", which will trigger the validation, and we can submit
1843
+ * valid forms with xhrio which allows us to add callbacks to them.
1844
+ *
1845
+ * @param {HTMLFormElement} form The form we want to sterilise.
1846
+ * @return {HTMLFormElement}
1847
+ */
1848
+ #a(w) {
1849
+ if (w && this.#s) {
1850
+ w.noValidate = !0;
1851
+ const D = this.user;
1852
+ this.listen(w, EV.SUBMIT, (U) => {
1853
+ U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() && D && D.formSubmit(this);
1854
+ });
1855
+ }
1856
+ return w;
1857
+ }
1858
+ //--[ Round Trip ]--
1859
+ /**
1860
+ * @param {function(!FormPanel, (string|!ServerFormSuccessJsonType)=): (?|null|Promise<?>)} func
1861
+ */
1862
+ onSubmitSuccess(w) {
1863
+ this.onSubmitSucFunc = w;
1864
+ }
1865
+ /**
1866
+ * Given a 'fetch' reply, replace the form.
1867
+ * This simply replaced the form element with what came back from the server
1868
+ * and re-reads the scripts.
1869
+ * @param {string} reply
1870
+ */
1871
+ replaceForm(w) {
1872
+ if (this.responseObject = splitScripts(w), this.responseObject.html) {
1873
+ if (this.redirected) {
1874
+ this.removeAllListener();
1875
+ const D = this.getElement(), U = D.parentNode;
1876
+ this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(), D);
1877
+ } else {
1878
+ const D = (
1879
+ /** @type {!Element} */
1880
+ this.responseObject.html.querySelector("form")
1881
+ );
1882
+ D && replaceNode(D, this.#t);
1883
+ const U = (
1884
+ /** @type {!Element} */
1885
+ this.responseObject.html.querySelector('button[type="submit"]')
1886
+ ), F = (
1887
+ /** @type {!Element} */
1888
+ this.getElement().querySelector('button[type="submit"]')
1889
+ );
1890
+ U && F && replaceNode(U, F);
1891
+ }
1892
+ this.enterDocument();
1893
+ }
1894
+ }
1895
+ /**
1896
+ * Expects HTML data from a call to the back.
1897
+ * @return {Promise} Returns a promise with this panel as value.
1898
+ */
1899
+ refreshFromFromServer() {
1900
+ const w = this.user, D = this.uri;
1901
+ return w ? w.fetch(D, this.abortController.signal).then(
1902
+ (U) => this.replaceForm(U)
1903
+ ) : Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"));
1904
+ }
1905
+ /**
1906
+ * @param {string} reply
1907
+ * @return {Promise}
1908
+ */
1909
+ processSubmitReply(w) {
1910
+ this.clearAllValidationErrors();
1911
+ let D = !1;
1912
+ if (whatType(w) === "object" && w.success)
1913
+ return Promise.resolve(this).then(() => {
1914
+ this.onSubmitSucFunc(this, w), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
1915
+ });
1916
+ if (w === "success" ? (this.debugMe(`
1917
+ 1.REDIRECTED: ${this.redirected}
1918
+ REPLY: ${w}`), D = !0) : w === `redirected_success
1919
+ ` ? (this.debugMe(`
1920
+ 2.REDIRECTED: ${this.redirected}
1921
+ REPLY: ${w}`), D = !0, this.redirected = !1) : (this.debugMe(`
1922
+ 3.REDIRECTED: ${this.redirected}
1923
+ REPLY: Some form HTML`), this.replaceForm(w)), D && this.redirected)
1924
+ return this.debugMe(`
1925
+ 4.REDIRECTED: ${this.redirected}
1926
+ SUCCESS: ${D}`), this.redirected = !1, Promise.resolve(this);
1927
+ if (D)
1928
+ return this.debugMe(`
1929
+ 5.REDIRECTED: ${this.redirected}
1930
+ SUCCESS: ${D}`), Promise.resolve(this).then(() => {
1931
+ this.onSubmitSucFunc(this), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
1932
+ });
1933
+ this.debugMe(`
1934
+ 6.REDIRECTED: ${this.redirected}
1935
+ SUCCESS: ${D}`);
1936
+ }
1937
+ }
1938
+ class Split extends Component {
1939
+ /**
1940
+ * Returns the split event type code used for dispatching split events.
1941
+ * @return {string} The SPLIT event type
1942
+ */
1943
+ static splitEventCode() {
1944
+ return UiEventType.SPLIT;
1945
+ }
1946
+ /**
1947
+ * Creates a new Split component instance. Initializes nest tracking and
1948
+ * callback management.
1949
+ */
1950
+ constructor() {
1951
+ super(), this.dragImage_ = document.createElement("canvas"), this.nestMap_ = /* @__PURE__ */ new Map(), this.nestCallbackMap_ = /* @__PURE__ */ new Map(), this.splitNests_ = /* @__PURE__ */ new Set();
1952
+ }
1953
+ /**
1954
+ * Returns all nest entries (name and config object) that have a valid element.
1955
+ * @return {!Array<!Array<string, !Object>>} Array of [nestName, nestConfig] pairs
1956
+ */
1957
+ get nests() {
1958
+ return [...this.nestMap_.entries()].filter(([w, { nestEl: D }]) => D);
1959
+ }
1960
+ /**
1961
+ * Gets the nest element for a given nest name.
1962
+ * @param {string} nestName The nest name to look up
1963
+ * @return {!Element | undefined} The nest element, or undefined if not found
1964
+ */
1965
+ getNest(w) {
1966
+ return this.nestMap_.get(w)?.nestEl;
1967
+ }
1968
+ /**
1969
+ * Returns the names of all nests that haven't been further split.
1970
+ * @return {!Array<string>} Array of nest names
1971
+ */
1972
+ get nestNames() {
1973
+ return [...this.nestMap_.entries()].filter(([w, D]) => !this.splitNests_.has(D)).map(([w]) => w);
1974
+ }
1975
+ /**
1976
+ * Closes and locks all nests in this split component.
1977
+ * @param {!Function=} callback Callback to execute after each nest closes
1978
+ * @param {boolean=} opt_skipAni If true, skips animation
1979
+ */
1980
+ closeAndLockAll(w = identity, D = !1) {
1981
+ this.nestNames.forEach((U) => this.closeAndLock(U, w, D));
1982
+ }
1983
+ /**
1984
+ * Opens and unlocks all nests in this split component.
1985
+ * @param {!Function=} callback Callback to execute after each nest opens
1986
+ * @param {boolean=} opt_skipAni If true, skips animation
1987
+ */
1988
+ openAndUnlockAll(w = identity, D = !1) {
1989
+ this.nestNames.forEach((U) => this.openAndUnlock(U, w, D));
1990
+ }
1991
+ // ---------------------------------------------------------------------------
1992
+ /**
1993
+ * Lock a dragger. Removes the listeners that make it draggable.
1994
+ * Adds the 'locked' class to the element.
1995
+ * Sets the element's "display" style to none.
1996
+ * Even though all these operations are performed on the the dragger, access
1997
+ * is vai the nest name - for consistency with the rest of the API.
1998
+ * @param {string} nestName Nest name
1999
+ */
2000
+ lock(w) {
2001
+ const { dragEl: D } = this.nestMap_.get(w);
2002
+ D.classList.add("locked");
2003
+ }
2004
+ /**
2005
+ * The reverse of a lock. Removes the classes added by <@code>lock</> and
2006
+ * restores the draggable listeners.
2007
+ * Even though all these operations are performed on the the dragger, access
2008
+ * is vai the nest name - for consistency with the rest of the API.
2009
+ * @param {string} nestName Nest name
2010
+ */
2011
+ unlock(w) {
2012
+ const { dragEl: D } = this.nestMap_.get(w);
2013
+ D.classList.remove("locked");
2014
+ }
2015
+ /**
2016
+ * Resize a nest.
2017
+ * @param {string} nestName Nest name
2018
+ * @param {number} size The required size of the resulting move.
2019
+ * @param {Function?} callback A callback function to call once
2020
+ * the resize completed.
2021
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2022
+ * simply affected directly.
2023
+ */
2024
+ resize(w, D, U = identity, F = !1) {
2025
+ const { sizeNow: q, nestEl: W, canResize: Y } = this.nestMap_.get(w);
2026
+ Y && (F || q === D ? (W.classList.remove("animated"), W.style.flexBasis = `${D}px`, this.nestMap_.get(w).sizeNow = D, U()) : (W.classList.add("animated"), this.nestCallbackMap_.set(w, () => {
2027
+ W.classList.remove("animated"), this.nestMap_.get(w).sizeNow = D, U();
2028
+ }), W.style.flexBasis = `${D}px`));
2029
+ }
2030
+ /**
2031
+ * Close the nest and lock it. See <@code>lock</>
2032
+ * @param {string} nestName Nest name
2033
+ * @param {Function?} callback A callback function to call once
2034
+ * the resize completed.
2035
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2036
+ * simply affected directly.
2037
+ */
2038
+ closeAndLock(w, D = identity, U = !1) {
2039
+ const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
2040
+ if (!W)
2041
+ return;
2042
+ const Y = () => {
2043
+ q.classList.add("locked", "closed"), F.classList.add("closed"), D();
2044
+ };
2045
+ this.resize(w, 0, Y, U);
2046
+ }
2047
+ closeAndUnlock(w, D = identity, U = !1) {
2048
+ const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
2049
+ if (!W)
2050
+ return;
2051
+ const Y = () => {
2052
+ F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"), D();
2053
+ };
2054
+ this.resize(w, 0, Y, U);
2055
+ }
2056
+ /**
2057
+ * Open a closed and locked nest. Simply a convenience method to combine
2058
+ * the unlock and resize steps.
2059
+ * @param {string} nestName Nest name
2060
+ * @param {number?} size The required size of the resulting move.
2061
+ * @param {Function?} callback A callback function to call once
2062
+ * the resize completed.
2063
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2064
+ * simply affected directly.
2065
+ */
2066
+ openAndUnlock(w, D, U, F = !1) {
2067
+ const {
2068
+ nestEl: q,
2069
+ dragEl: W,
2070
+ defSize: Y,
2071
+ lastSize: G,
2072
+ canResize: Z
2073
+ } = this.nestMap_.get(w);
2074
+ if (!Z)
2075
+ return;
2076
+ const Q = D || G || Y;
2077
+ q.classList.remove("closed"), W.classList.remove("closed", "locked", "collapsed"), setTimeout(() => {
2078
+ this.resize(w, Q, U, F);
2079
+ }, 50);
2080
+ }
2081
+ /**
2082
+ * Open a closed and locked nest. Keep the nest locked.
2083
+ * @param {string} nestName Nest name
2084
+ * @param {number?} size The required size of the resulting move.
2085
+ * @param {Function?} callback A callback function to call once
2086
+ * the resize completed.
2087
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2088
+ * simply affected directly.
2089
+ */
2090
+ openAndLock(w, D, U, F = !1) {
2091
+ const {
2092
+ nestEl: q,
2093
+ dragEl: W,
2094
+ defSize: Y,
2095
+ lastSize: G,
2096
+ canResize: Z
2097
+ } = this.nestMap_.get(w);
2098
+ if (!Z)
2099
+ return;
2100
+ const Q = D || G || Y;
2101
+ q.classList.remove("closed"), W.classList.remove("closed", "collapsed"), setTimeout(() => {
2102
+ this.resize(w, Q, U, F);
2103
+ }, 50);
2104
+ }
2105
+ /**
2106
+ * Close nest. Move it out the way, but continue to make it draggable;
2107
+ * to the nest and dragger.
2108
+ * @param {string} nestName Nest name
2109
+ * @param {Function|undefined} callback A callback function to call once
2110
+ * the resize completed.
2111
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2112
+ * simply affected directly.
2113
+ */
2114
+ close(w, D = identity, U = !1) {
2115
+ const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(w);
2116
+ if (!q)
2117
+ return;
2118
+ this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName: w, nestEl: W });
2119
+ const Y = () => {
2120
+ F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName: w, nestEl: W }), D();
2121
+ };
2122
+ this.resize(w, 0, Y, U);
2123
+ }
2124
+ /**
2125
+ * Open the nest ignoring its current locked state.
2126
+ * @param {string} nestName Nest name
2127
+ * @param {Function|undefined} callback A callback function to call once
2128
+ * the resize completed.
2129
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2130
+ * simply affected directly.
2131
+ */
2132
+ open(w, D = identity, U = !1) {
2133
+ const { defSize: F, lastSize: q, dragEl: W, canResize: Y, nestEl: G } = this.nestMap_.get(w);
2134
+ if (!Y)
2135
+ return;
2136
+ this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName: w, nestEl: G }), W.classList.remove("collapsed", "closed");
2137
+ const Z = q || F, Q = () => {
2138
+ this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName: w, nestEl: G }), D();
2139
+ };
2140
+ this.resize(w, Z, Q, U);
2141
+ }
2142
+ /**
2143
+ * Close the nest ignoring its current locked state.
2144
+ * @param {string} nestName Nest name
2145
+ * @param {Function|undefined} callback A callback function to call once
2146
+ * the resize completed.
2147
+ * @param {boolean?} opt_skipAni When true, the resize won't be animated, but
2148
+ * simply affected directly.
2149
+ */
2150
+ toggle(w, D, U = !1) {
2151
+ this.nestMap_.get(w).sizeNow === 0 ? this.open(w, D, U) : this.close(w, D, U);
2152
+ }
2153
+ //----------------------------------------------------------------------------
2154
+ /**
2155
+ * Split an element into parts, each separated by a dragger component.
2156
+ * The split creates 3 new elements inside root element. Thus it is not
2157
+ * truly splitting the reference element, but rather overlaying the
2158
+ * split functionality over the reference element.
2159
+ * A split can be either horizontal - called "EW" (east-west) or
2160
+ * vertical - called "NS" (north-south).
2161
+ * By convention the new elements created are called 'nests', and are named
2162
+ * in order "A", "B" and "C" respectively.
2163
+ * For EW splits the we name from left to right:
2164
+ * A B C
2165
+ * For NS splits we name from top to bottom:
2166
+ * A
2167
+ * B
2168
+ * C
2169
+ * Each newly created nest is a valid root for further splitting.
2170
+ * When a nest is split, the resultant nests names are prepended with the
2171
+ * name of the root nest that was split.
2172
+ * Example: If nest C is split, the resultant nests are named CA, CB, and CC.
2173
+ * When one of these (for example CA) is split further, the pattern continues
2174
+ * with the resulting nests being CAA, CAB, CAC etc.
2175
+ * @param {Element=} opt_el The element to split. If not given, the
2176
+ * components own element is used. Else, the element is checked to be
2177
+ * a member of this split-group, and if so, is split.
2178
+ * @param {?string} orientation Only 'EW' or 'NS'. Defaults to 'EW'
2179
+ * @param {?number} defSizeA Default size of the 'A' nest.
2180
+ * @param {?number} defSizeC Default size of the 'C' nest. The 'B' nest gets the
2181
+ * remainder of the 'A' and 'C' nests, and can not be set directly.
2182
+ * @param {?Array<string>} classArrA Extra class names to be added to this nest
2183
+ * @param {?Array<string>} classArrB Extra class names to be added to this nest
2184
+ * @param {?Array<string>} classArrC Extra class names to be added to this nest
2185
+ * @param {?Array<string>} classArrDragger Extra classes for the dragger element
2186
+ * @param {?Array<string>} classArrGrabber Extra classes for the grabber element
2187
+ */
2188
+ addSplit(w = void 0, D = "EW", U = 100, F = 100, q = [], W = [], Y = [], G = [], Z = []) {
2189
+ const Q = w || this.getElement();
2190
+ if (this.splitNests_.has(Q))
2191
+ return ["Already used!", Q];
2192
+ convertElToSplit(Q, D), this.splitNests_.add(Q);
2193
+ let tt = "";
2194
+ if (w) {
2195
+ const it = [...this.nestMap_.entries()].find(([at, { nestEl: lt }]) => lt === w);
2196
+ if (it)
2197
+ tt = it[0];
2198
+ else
2199
+ return ["Element not managed by this component", w];
2200
+ }
2201
+ const J = `${tt}A`, X = makeOuterNest(U, ["zoo_nest__A", J, ...q]), K = new Dragger(D);
2202
+ K.domFunc = makeDraggerEl([`zoo_drag_${J}`, ...G], Z), K.render(Q), this.nestMap_.set(J, {
2203
+ side: "A",
2204
+ nestEl: X,
2205
+ dragger: K,
2206
+ dragEl: K.getElement(),
2207
+ defSize: U,
2208
+ sizeNow: -1,
2209
+ canResize: !0
2210
+ });
2211
+ const et = `${tt}B`, st = makeInnerNest(["zoo_nest__B", et, ...W]);
2212
+ this.nestMap_.set(et, { nestEl: st, canResize: !1 });
2213
+ const rt = `${tt}C`, nt = new Dragger(D);
2214
+ nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G], Z), nt.render(Q);
2215
+ const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...Y]);
2216
+ this.nestMap_.set(rt, {
2217
+ side: "C",
2218
+ nestEl: ot,
2219
+ dragger: nt,
2220
+ dragEl: nt.getElement(),
2221
+ defSize: F,
2222
+ sizeNow: -1,
2223
+ canResize: !0
2224
+ }), [X, K.getElement(), st, nt.getElement(), ot].forEach((it) => Q.appendChild(it));
2225
+ let ct = 0;
2226
+ const ht = (it, at, lt, gt) => {
2227
+ let ut;
2228
+ const dt = it === "NS" ? "height" : "width", mt = it === "NS" ? "deltaY" : "deltaX";
2229
+ return (pt) => {
2230
+ switch (pt.detail.value_) {
2231
+ case UiEventType.COMP_DRAG_START:
2232
+ ut = at.getBoundingClientRect()[dt], ct = st.getBoundingClientRect()[dt] + ut, this.nestMap_.get(lt).dragEl.classList.remove("collapsed");
2233
+ break;
2234
+ case UiEventType.COMP_DRAG_MOVE: {
2235
+ const ft = Math.min(ct, ut + gt * pt.detail.data_[mt]);
2236
+ this.nestMap_.get(lt).lastSize = ft, at.style.flexBasis = ft + "px";
2237
+ break;
2238
+ }
2239
+ case UiEventType.COMP_DRAG_END:
2240
+ this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(lt));
2241
+ break;
2242
+ }
2243
+ };
2244
+ };
2245
+ this.listen(K, Component.compEventCode(), ht(D, X, J, 1)), this.listen(nt, Component.compEventCode(), ht(D, ot, rt, -1)), this.listen(K.getElement(), EV.DBLCLICK, () => this.toggle(J)), this.listen(nt.getElement(), EV.DBLCLICK, () => this.toggle(rt)), this.listen(K.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(J)), this.listen(nt.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(rt)), this.listen(X, EV.TRANSITIONEND, (it) => {
2246
+ if (it.propertyName === "flex-basis" && it.target === X) {
2247
+ const at = this.nestCallbackMap_.get(J);
2248
+ this.nestCallbackMap_.delete(J), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(J));
2249
+ }
2250
+ }), this.listen(ot, EV.TRANSITIONEND, (it) => {
2251
+ if (it.propertyName === "flex-basis" && it.target === ot) {
2252
+ const at = this.nestCallbackMap_.get(rt);
2253
+ this.nestCallbackMap_.delete(rt), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(rt));
2254
+ }
2255
+ });
2256
+ }
2257
+ //--[ Built in events ]--
2258
+ /**
2259
+ * Dispatches a {@code UiEventType.SPLIT} event.
2260
+ * Views may listen just to this event, and act on the supplied value or
2261
+ * data payload.
2262
+ * @param {string|number} value
2263
+ * @param {(string|number|?Object)=} opt_data
2264
+ * @return {boolean} If anyone called preventDefault on the event object (or
2265
+ * if any of the handlers returns false this will also return false.
2266
+ */
2267
+ dispatchSplitEvent(w, D) {
2268
+ const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.SPLIT, U);
2269
+ return this.dispatchEvent(F);
2270
+ }
2271
+ }
2272
+ const convertElToSplit = (O, w) => (O.classList.add("zoo_split", `zoo_split__${w.toLowerCase()}`), O), makeOuterNest = (O, w = []) => {
2273
+ const D = document.createElement("div");
2274
+ return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "zoo_nest__outer", ...w), D.style.flexBasis = O + "px", D;
2275
+ }, makeInnerNest = (O = []) => {
2276
+ const w = document.createElement("div");
2277
+ return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__inner", ...O), w;
2278
+ }, makeDraggerEl = (O = [], w = []) => () => {
2279
+ const D = document.createElement("div");
2280
+ D.setAttribute("id", randomId(7)), D.classList.add("zoo_dragger", ...O);
2281
+ const U = document.createElement("div");
2282
+ return U.classList.add("zoo_grabber", ...w), D.appendChild(U), D;
2283
+ }, needsToScroll = (O) => {
2284
+ const D = O.getBoundingClientRect().bottom;
2285
+ return (U) => U.getBoundingClientRect().bottom > D;
2286
+ }, treeNodeSelect = (O) => (w) => {
2287
+ const D = O.getElement().querySelector(".zv_tree_container"), U = needsToScroll(D), F = O.getElement().querySelectorAll(".tree-node");
2288
+ let q;
2289
+ [...F].forEach((W) => {
2290
+ enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${w}`), W.id === `tree-node_${w}` && (q = W);
2291
+ }), q && U(q) && q.scrollIntoView(!1);
2292
+ }, toggleTree = (O, w) => {
2293
+ const D = w.getElement().querySelector(".children"), U = (
2294
+ /**@type {boolean} */
2295
+ O.isOn
2296
+ ), F = w.getElement().querySelectorAll(".children"), q = w.getElement().querySelectorAll(".zoo__reveal_icon");
2297
+ [...F].forEach((W) => enableClass(
2298
+ W,
2299
+ "zoo__tree-children__hidden",
2300
+ W !== D && !U
2301
+ )), [...q].forEach((W) => enableClass(
2302
+ W,
2303
+ "zoo__icon_rotated",
2304
+ W !== D && !U
2305
+ ));
2306
+ }, toggleTreeChildren = (O, w) => {
2307
+ const D = w.trigger, U = D.getAttribute("data-child-id"), F = O.getElement().querySelector(`#${U}`);
2308
+ toggleClass(F, "zoo__tree-children__hidden"), toggleClass(D, "zoo__icon_rotated");
2309
+ }, _openTreeFromNodeUp = (O, w) => {
2310
+ const D = w.parentElement;
2311
+ D.classList.contains("children") && (enableClass(D, "zoo__tree-children__hidden", !1), _openTreeFromNodeUp(O, D));
2312
+ }, treeUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2313
+ __proto__: null,
2314
+ _openTreeFromNodeUp,
2315
+ toggleTree,
2316
+ toggleTreeChildren,
2317
+ treeNodeSelect
2318
+ }, Symbol.toStringTag, { value: "Module" })), MdcTreeHandlers = {
2319
+ /**
2320
+ * Toggle the entire tree open or closed.
2321
+ * First level children remain open for better UX.
2322
+ *
2323
+ * @param {Object} eventData - Event data with isOn boolean
2324
+ * @param {Panel} ePanel - The panel containing the tree
2325
+ */
2326
+ toggle_tree: function(O, w) {
2327
+ toggleTree(O, w);
2328
+ },
2329
+ /**
2330
+ * Toggle children visibility for a specific tree node.
2331
+ *
2332
+ * @param {Object} eventData - Event data with trigger element
2333
+ * @param {Panel} ePanel - The panel containing the tree
2334
+ */
2335
+ "tree_toggle-children": function(O, w) {
2336
+ toggleTreeChildren(w, O);
2337
+ }
2338
+ }, SearchHandlers = {
2339
+ /**
2340
+ * Perform search with query string construction.
2341
+ * Builds href with search query and additional query parameters.
2342
+ *
2343
+ * @param {Object} eventData - Event data with href, formData.q, and targetval
2344
+ * @param {Panel} ePanel - The panel to update
2345
+ */
2346
+ search: function(O, w) {
2347
+ let D = `${O.href}`;
2348
+ const U = O.formData.q, F = O.targetval;
2349
+ if (U !== "" && (D = `${D}?q=${U}`), F !== "") {
2350
+ let q = F;
2351
+ F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")), D = U !== "" ? `${D}&${q}` : `${D}?${q}`;
2352
+ }
2353
+ this.user.fetchAndSplit(D, w.abortController.signal).then(
2354
+ (q) => w.onReplacePartialDom(q, O.zvptarget)
2355
+ );
2356
+ },
2357
+ /**
2358
+ * Reset search form and query parameters.
2359
+ * Clears the 'q' field in the closest form and removes 'q' from query params.
2360
+ *
2361
+ * @param {Object} eventData - Event data with trigger element
2362
+ * @param {Panel} ePanel - The panel to update
2363
+ */
2364
+ reset_search: function(O, w) {
2365
+ const D = O.trigger.closest("form");
2366
+ w.removeFromQParams("q"), D.elements.q.value = "", D.dispatchEvent(new Event("submit"));
2367
+ }
2368
+ }, QueryParamHandlers = {
2369
+ /**
2370
+ * Handle pagination by fetching content with query parameters.
2371
+ *
2372
+ * @param {Object} eventData - Event data with href and targetval for pagination
2373
+ * @param {Panel} ePanel - The panel to update
2374
+ */
2375
+ paginate: function(O, w) {
2376
+ const D = `${O.href}?${O.targetval}`;
2377
+ this.user.fetchAndSplit(D, w.abortController.signal).then(
2378
+ (U) => w.onReplacePartialDom(U, O.zvptarget)
2379
+ );
2380
+ },
2381
+ /**
2382
+ * Handle list filtering with query parameters.
2383
+ *
2384
+ * @param {Object} eventData - Event data with href and targetval for filtering
2385
+ * @param {Panel} ePanel - The panel to update
2386
+ */
2387
+ list_filter: function(O, w) {
2388
+ const D = `${O.href}?${O.targetval}`;
2389
+ this.user.fetchAndSplit(D, w.abortController.signal).then(
2390
+ (U) => w.onReplacePartialDom(U, O.zvptarget)
2391
+ );
2392
+ }
2393
+ }, handlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2394
+ __proto__: null,
2395
+ MdcTreeHandlers,
2396
+ QueryParamHandlers,
2397
+ SearchHandlers
2398
+ }, Symbol.toStringTag, { value: "Module" }));
2399
+ class View extends Evt {
2400
+ #t = void 0;
2401
+ #e = void 0;
2402
+ //--[ Static ]--
2403
+ /**
2404
+ * Returns the view event type code used for dispatching view events.
2405
+ * @return {string} The VIEW event type
2406
+ */
2407
+ static viewEventCode() {
2408
+ return UiEventType.VIEW;
2409
+ }
2410
+ /**
2411
+ * Creates a new View instance. Initializes panel management, event handling,
2412
+ * and metadata storage.
2413
+ */
2414
+ constructor() {
2415
+ super(), this.panelMap = /* @__PURE__ */ new Map(), this.user_ = void 0, this.split_ = void 0, this.panelEventMap_ = this.initPanelEventsInternal_(), this.switchViewMap_ = /* @__PURE__ */ new Map(), this.metaData_ = /* @__PURE__ */ new Map();
2416
+ }
2417
+ set recordHistory(w) {
2418
+ this.#e = w;
2419
+ }
2420
+ get recordHistory() {
2421
+ return this.#e;
2422
+ }
2423
+ set registerViewConstructor(w) {
2424
+ this.#t = w;
2425
+ }
2426
+ get registerViewConstructor() {
2427
+ return this.#t;
2428
+ }
2429
+ set split(w) {
2430
+ this.split_ = w, this.listen(this.split_, UiEventType.SPLIT, (D) => {
2431
+ const U = D.detail.getValue(), F = D.detail.getData();
2432
+ switch (U) {
2433
+ case UiEventType.SPLIT_WILL_OPEN:
2434
+ this.onSplitWillOpen(F);
2435
+ break;
2436
+ case UiEventType.SPLIT_WILL_CLOSE:
2437
+ this.onSplitWillClose(F);
2438
+ break;
2439
+ case UiEventType.SPLIT_DID_CLOSE:
2440
+ this.onSplitDidClose(F);
2441
+ break;
2442
+ case UiEventType.SPLIT_DID_OPEN:
2443
+ this.onSplitDidOpen(F);
2444
+ break;
2445
+ case UiEventType.SPLIT_TRANSITION_END:
2446
+ break;
2447
+ }
2448
+ });
2449
+ }
2450
+ get split() {
2451
+ if (!this.split_)
2452
+ throw new Error("No SPLIT component available");
2453
+ return this.split_;
2454
+ }
2455
+ /**
2456
+ * @param {!UserManager} user
2457
+ */
2458
+ set user(w) {
2459
+ this.user_ = w, this.panelMap.forEach((D) => D.user = w);
2460
+ }
2461
+ /**
2462
+ * @return {!UserManager}
2463
+ */
2464
+ get user() {
2465
+ return this.user_ || (this.user_ = new UserManager()), this.user_;
2466
+ }
2467
+ /**
2468
+ * Render each of the panels in this view.
2469
+ */
2470
+ render() {
2471
+ this.initPanelEvents(), this.preRender(), this.configurePanels(), this.displayPanels(), this.postRender();
2472
+ }
2473
+ /**
2474
+ * Placeholder for subclasses to add panel event functions.
2475
+ */
2476
+ initPanelEvents() {
2477
+ }
2478
+ /**
2479
+ * Run before the render.
2480
+ */
2481
+ preRender() {
2482
+ }
2483
+ /**
2484
+ * Placeholder for panel configuration functionality;
2485
+ */
2486
+ configurePanels() {
2487
+ }
2488
+ /**
2489
+ * Placeholder for panel display functionality;
2490
+ */
2491
+ displayPanels() {
2492
+ }
2493
+ /**
2494
+ * Placeholder for post render functionality.
2495
+ */
2496
+ postRender() {
2497
+ }
2498
+ /**
2499
+ * @inheritDoc
2500
+ */
2501
+ dispose() {
2502
+ [...this.panelMap.values()].forEach((w) => w.dispose()), super.dispose();
2503
+ }
2504
+ /**
2505
+ * Add a panel as a child of the view.
2506
+ * @param {string} name The name of the panel - used as a key in the panel map.
2507
+ * @param {!Panel} panel The panel itself.
2508
+ */
2509
+ addPanelToView(w, D) {
2510
+ D.user = this.user, this.removePanelByName(w), this.panelMap.set(w, D), this.listen(D, Panel.panelEventCode(), this.onPanelEvent.bind(this));
2511
+ }
2512
+ /**
2513
+ * Remove a panel from the view by name.
2514
+ * @param {string} name The name of the panel - used as a key in the panel map.
2515
+ */
2516
+ removePanelByName(w) {
2517
+ this.panelMap.has(w) && this.panelMap.get(w).dispose();
2518
+ }
2519
+ /**
2520
+ * @param {Panel} panel
2521
+ */
2522
+ removePanel(w) {
2523
+ const [D, U] = [...this.panelMap.entries()].find(([F, q]) => q === w);
2524
+ D && U && (U.dispose(), this.panelMap.delete(D));
2525
+ }
2526
+ /**
2527
+ * @param {string} name
2528
+ * @return {Panel|undefined}
2529
+ */
2530
+ getPanelByName(w) {
2531
+ return this.panelMap.get(w);
2532
+ }
2533
+ /**
2534
+ * Broadcasts data to all panels in this view. Each panel receives the data
2535
+ * via its onViewDataBroadcast method.
2536
+ * @param {*} data The data to broadcast to all panels
2537
+ */
2538
+ broadcastToPanels(w) {
2539
+ [...this.panelMap.values()].forEach((D) => D.onViewDataBroadcast(w));
2540
+ }
2541
+ /**
2542
+ * Initializes the internal panel event map with default event handlers.
2543
+ * Sets up handlers for panel lifecycle and view coordination.
2544
+ *
2545
+ * Note: This method also registers application-specific handlers (search,
2546
+ * pagination, etc.) for backwards compatibility. These will be removed in
2547
+ * a future version - applications should explicitly register handlers they need.
2548
+ *
2549
+ * @return {!Map<string, !Function>} Map of event names to handler functions
2550
+ * @private
2551
+ */
2552
+ initPanelEventsInternal_() {
2553
+ const w = /* @__PURE__ */ new Map();
2554
+ return w.set("destroy_me", (D, U) => {
2555
+ this.removePanel(U);
2556
+ }), w.set("switch_view", (D, U) => {
2557
+ this.debugMe("switch_view received: eventData", D);
2558
+ const F = D.view;
2559
+ this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(D, U) : this.debugMe("NO VIEW FOUND FOR:", F, this.switchViewMap_);
2560
+ }), Object.entries({
2561
+ ...SearchHandlers,
2562
+ ...QueryParamHandlers
2563
+ }).forEach(([D, U]) => {
2564
+ w.set(D, U.bind(this));
2565
+ }), w;
2566
+ }
2567
+ /**
2568
+ * Maps a panel event name to a handler function. Allows dynamic registration
2569
+ * of custom panel event handlers at runtime.
2570
+ * @param {string} s The event name to map
2571
+ * @param {!Function} func The handler function that receives (eventData, ePanel)
2572
+ */
2573
+ mapPanEv(w, D) {
2574
+ this.panelEventMap_.set(w, D);
2575
+ }
2576
+ /**
2577
+ * A map of string to function where the function receives an object and
2578
+ * a panel.
2579
+ * @param {string} s
2580
+ * @param {function(
2581
+ * {view:string, pk:string, emit:string, href:string}, Panel):?} func
2582
+ */
2583
+ mapSwitchView(w, D) {
2584
+ this.switchViewMap_.set(w, D);
2585
+ }
2586
+ /**
2587
+ * @param {!CustomEvent} e
2588
+ */
2589
+ onPanelEvent(w) {
2590
+ let D = w.detail.getValue();
2591
+ const U = w.detail.getData();
2592
+ D.startsWith("switch_view:") && (U.view = D.split(":")[1], D = "switch_view");
2593
+ const F = (
2594
+ /** @type {Panel} */
2595
+ w.target
2596
+ );
2597
+ this.panelEventMap_.has(D) ? this.panelEventMap_.get(D)(U, F) : this.debugMe(`NO EVENT MATCH - This usually you are missing
2598
+ a "mapPanEv(${D} ..." statement in your panel JS
2599
+ or you have a "event='${D}'" attribute in your panel HTML`, {
2600
+ event: w,
2601
+ eventValue: D,
2602
+ eventData: U,
2603
+ panel: F.constructor.name
2604
+ });
2605
+ }
2606
+ //--[ Split Events ]--
2607
+ /**
2608
+ * Triggered before a split will open.
2609
+ *
2610
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2611
+ */
2612
+ onSplitWillOpen(w) {
2613
+ }
2614
+ /**
2615
+ * Triggered before a split will close.
2616
+ *
2617
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2618
+ */
2619
+ onSplitWillClose(w) {
2620
+ }
2621
+ /**
2622
+ * Triggered after a split closed.
2623
+ *
2624
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2625
+ */
2626
+ onSplitDidClose(w) {
2627
+ }
2628
+ /**
2629
+ * Triggered after a split opened.
2630
+ *
2631
+ * @param {{nestName: !string, nestEl:!HTMLElement}} _data
2632
+ */
2633
+ onSplitDidOpen(w) {
2634
+ }
2635
+ //--[ Built in events ]--
2636
+ /**
2637
+ * Dispatches a {@code UiEventType.VIEW} event.
2638
+ * A shorthand method to get panels to dispatch uniform events.
2639
+ * Views may listen just to this event, and act on the supplied value or
2640
+ * data payload.
2641
+ * Example:
2642
+ * b.listen(a, Component.compEventCode(), e => {
2643
+ * console.log('B got', Component.compEventCode(), e);
2644
+ * console.log('Value is', e.detail.getValue());
2645
+ * console.log('Data is', e.detail.getData());
2646
+ * });
2647
+ * @param {string|number} value
2648
+ * @param {(string|number|?Object)=} opt_data
2649
+ * @return {boolean} If anyone called preventDefault on the event object (or
2650
+ * if any of the handlers returns false this will also return false.
2651
+ */
2652
+ dispatchViewEvent(w, D) {
2653
+ const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.VIEW, U);
2654
+ return this.dispatchEvent(F);
2655
+ }
2656
+ //--[ Meta Data ]--
2657
+ /**
2658
+ * Returns the metadata map associated with this view.
2659
+ * @return {!Map<string, *>} The metadata map
2660
+ */
2661
+ get metaData() {
2662
+ return this.metaData_;
2663
+ }
2664
+ /**
2665
+ * Sets a metadata key-value pair for this view.
2666
+ * @param {string} k The metadata key
2667
+ * @param {*} v The metadata value
2668
+ * @return {!Map<string, *>} The updated metadata map
2669
+ */
2670
+ setMetaData(w, D) {
2671
+ return this.metaData_.set(w, D), this.metaData;
2672
+ }
2673
+ /**
2674
+ * Retrieves a metadata value by key.
2675
+ * @param {string} k The metadata key
2676
+ * @return {*} The metadata value, or undefined if not found
2677
+ */
2678
+ getMetaData(w) {
2679
+ return this.metaData_.get(w);
2680
+ }
2681
+ /**
2682
+ * Checks if a metadata key exists.
2683
+ * @param {string} k The metadata key
2684
+ * @return {boolean} True if the key exists, false otherwise
2685
+ */
2686
+ hasMetaData(w) {
2687
+ return this.metaData_.has(w);
2688
+ }
2689
+ }
2690
+ class Conductor extends Evt {
2691
+ #t = /* @__PURE__ */ new Map();
2692
+ #e = null;
2693
+ /**
2694
+ * @type {!UserManager|undefined}
2695
+ * @private
2696
+ */
2697
+ #s = void 0;
2698
+ #r = void 0;
2699
+ #n = /* @__PURE__ */ new Map();
2700
+ /**
2701
+ * Creates a new Conductor instance. Sets up browser history listening
2702
+ * and initializes view event handling.
2703
+ */
2704
+ constructor() {
2705
+ super(), this.#n = this.#i(), window.addEventListener("popstate", (w) => {
2706
+ w.state !== null && this.navTo(w.state);
2707
+ });
2708
+ }
2709
+ set split(w) {
2710
+ this.#r = w;
2711
+ }
2712
+ get split() {
2713
+ if (!this.#r)
2714
+ throw new Error("No SPLIT component available");
2715
+ return this.#r;
2716
+ }
2717
+ /**
2718
+ * @param {!UserManager} user
2719
+ */
2720
+ set user(w) {
2721
+ this.#s = w, this.#e && (this.#e.user = this.user);
2722
+ }
2723
+ /**
2724
+ * @return {!UserManager}
2725
+ */
2726
+ get user() {
2727
+ return this.#s || (this.#s = new UserManager()), this.#s;
2728
+ }
2729
+ /**
2730
+ * Initializes the internal view event map with default event handlers.
2731
+ * Sets up handlers for common view events like 'switch_view'.
2732
+ * @return {!Map<string, !Function>} Map of event names to handler functions
2733
+ * @private
2734
+ */
2735
+ #i() {
2736
+ return (/* @__PURE__ */ new Map()).set("switch_view", (w, D) => {
2737
+ if (this.#t.has(w.view)) {
2738
+ const U = this.#t.get(w.view)(
2739
+ w.pk || w.recordId,
2740
+ w
2741
+ );
2742
+ this.switchView(U);
2743
+ }
2744
+ });
2745
+ }
2746
+ /**
2747
+ * Maps a view event name to a handler function. Allows dynamic registration
2748
+ * of custom view event handlers at runtime.
2749
+ * @param {string} s The event name to map
2750
+ * @param {!Function} func The handler function that receives (eventData, eView)
2751
+ */
2752
+ mapViewEv(w, D) {
2753
+ this.#n.set(w, D);
2754
+ }
2755
+ /**
2756
+ * Registers a view constructor function that can be used to create instances
2757
+ * of a specific view type.
2758
+ * @param {string} s The view type identifier
2759
+ * @param {!Function} f Constructor function that receives (pk, data) and returns a View
2760
+ */
2761
+ registerViewConstructor(w, D) {
2762
+ this.#t.set(w, D);
2763
+ }
2764
+ /**
2765
+ * @param {!CustomEvent} e Event object.
2766
+ */
2767
+ onViewEvent(w) {
2768
+ const D = w.detail.getValue(), U = w.detail.getData(), F = (
2769
+ /** @type {Panel} */
2770
+ w.target
2771
+ );
2772
+ this.#n.has(D) ? this.#n.get(D)(U, F) : console.warn("Unhandled VIEW Event:", w, D, U, F);
2773
+ }
2774
+ /**
2775
+ * Make the given view active.
2776
+ * @param {!View} view
2777
+ */
2778
+ setActiveView(w) {
2779
+ this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e = w, this.#e.render();
2780
+ }
2781
+ /**
2782
+ * @param {!View} view
2783
+ * @returns {!View}
2784
+ */
2785
+ initView(w) {
2786
+ return w.user = this.user, w.split = this.split, w.recordHistory = this.recordHistory.bind(this), w.registerViewConstructor = this.registerViewConstructor.bind(this), this.listen(w, View.viewEventCode(), this.onViewEvent.bind(this)), w;
2787
+ }
2788
+ //--[ Views Utilities ]--
2789
+ /**
2790
+ * @param {!View} view The view we want active.
2791
+ */
2792
+ switchView(w) {
2793
+ this.setActiveView(this.initView(w));
2794
+ }
2795
+ //--[ History and Navigation ]--
2796
+ /**
2797
+ * Records the given item in browser history. If item.init is true, replaces
2798
+ * the current history state. Otherwise, pushes a new history state unless
2799
+ * item.history is true.
2800
+ * @param {!Object} item The history item containing view state
2801
+ */
2802
+ recordHistory(w) {
2803
+ this.debugMe("HISTORY", w), w.init ? history.replaceState(w, "", document.location.href) : w.history || history.pushState(w, "", null);
2804
+ }
2805
+ /**
2806
+ * Navigates to a specific view based on the history item. Attempts to use
2807
+ * the active view's switchViewMap first, falling back to registered view
2808
+ * constructors if needed.
2809
+ * @param {!Object} item History item containing {view, pk, ...} properties
2810
+ */
2811
+ navTo = (w) => {
2812
+ w.history = !0;
2813
+ const D = w.view, U = this.#e;
2814
+ if (U.switchViewMap_.has(D))
2815
+ this.debugMe("NAV:VIEW:MAP", w), U.switchViewMap_.get(D)(w);
2816
+ else if (this.#t.has(D)) {
2817
+ const F = this.#t.get(D)(w.pk, w);
2818
+ this.debugMe("NAV:NEW:VIEW", w), this.switchView(F);
2819
+ }
2820
+ };
2821
+ }
2822
+ function _isPlaceholder(O) {
2823
+ return O != null && typeof O == "object" && O["@@functional/placeholder"] === !0;
2824
+ }
2825
+ function _curry1(O) {
2826
+ return function w(D) {
2827
+ return arguments.length === 0 || _isPlaceholder(D) ? w : O.apply(this, arguments);
2828
+ };
2829
+ }
2830
+ function _curry2(O) {
2831
+ return function w(D, U) {
2832
+ switch (arguments.length) {
2833
+ case 0:
2834
+ return w;
2835
+ case 1:
2836
+ return _isPlaceholder(D) ? w : _curry1(function(F) {
2837
+ return O(D, F);
2838
+ });
2839
+ default:
2840
+ return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry1(function(F) {
2841
+ return O(F, U);
2842
+ }) : _isPlaceholder(U) ? _curry1(function(F) {
2843
+ return O(D, F);
2844
+ }) : O(D, U);
2845
+ }
2846
+ };
2847
+ }
2848
+ function _concat(O, w) {
2849
+ O = O || [], w = w || [];
2850
+ var D, U = O.length, F = w.length, q = [];
2851
+ for (D = 0; D < U; )
2852
+ q[q.length] = O[D], D += 1;
2853
+ for (D = 0; D < F; )
2854
+ q[q.length] = w[D], D += 1;
2855
+ return q;
2856
+ }
2857
+ function _arity(O, w) {
2858
+ switch (O) {
2859
+ case 0:
2860
+ return function() {
2861
+ return w.apply(this, arguments);
2862
+ };
2863
+ case 1:
2864
+ return function(D) {
2865
+ return w.apply(this, arguments);
2866
+ };
2867
+ case 2:
2868
+ return function(D, U) {
2869
+ return w.apply(this, arguments);
2870
+ };
2871
+ case 3:
2872
+ return function(D, U, F) {
2873
+ return w.apply(this, arguments);
2874
+ };
2875
+ case 4:
2876
+ return function(D, U, F, q) {
2877
+ return w.apply(this, arguments);
2878
+ };
2879
+ case 5:
2880
+ return function(D, U, F, q, W) {
2881
+ return w.apply(this, arguments);
2882
+ };
2883
+ case 6:
2884
+ return function(D, U, F, q, W, Y) {
2885
+ return w.apply(this, arguments);
2886
+ };
2887
+ case 7:
2888
+ return function(D, U, F, q, W, Y, G) {
2889
+ return w.apply(this, arguments);
2890
+ };
2891
+ case 8:
2892
+ return function(D, U, F, q, W, Y, G, Z) {
2893
+ return w.apply(this, arguments);
2894
+ };
2895
+ case 9:
2896
+ return function(D, U, F, q, W, Y, G, Z, Q) {
2897
+ return w.apply(this, arguments);
2898
+ };
2899
+ case 10:
2900
+ return function(D, U, F, q, W, Y, G, Z, Q, tt) {
2901
+ return w.apply(this, arguments);
2902
+ };
2903
+ default:
2904
+ throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
2905
+ }
2906
+ }
2907
+ function _curryN(O, w, D) {
2908
+ return function() {
2909
+ for (var U = [], F = 0, q = O, W = 0, Y = !1; W < w.length || F < arguments.length; ) {
2910
+ var G;
2911
+ W < w.length && (!_isPlaceholder(w[W]) || F >= arguments.length) ? G = w[W] : (G = arguments[F], F += 1), U[W] = G, _isPlaceholder(G) ? Y = !0 : q -= 1, W += 1;
2912
+ }
2913
+ return !Y && q <= 0 ? D.apply(this, U) : _arity(Math.max(0, q), _curryN(O, U, D));
2914
+ };
2915
+ }
2916
+ var curryN = /* @__PURE__ */ _curry2(function O(w, D) {
2917
+ return w === 1 ? _curry1(D) : _arity(w, _curryN(w, [], D));
2918
+ });
2919
+ function _curry3(O) {
2920
+ return function w(D, U, F) {
2921
+ switch (arguments.length) {
2922
+ case 0:
2923
+ return w;
2924
+ case 1:
2925
+ return _isPlaceholder(D) ? w : _curry2(function(q, W) {
2926
+ return O(D, q, W);
2927
+ });
2928
+ case 2:
2929
+ return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry2(function(q, W) {
2930
+ return O(q, U, W);
2931
+ }) : _isPlaceholder(U) ? _curry2(function(q, W) {
2932
+ return O(D, q, W);
2933
+ }) : _curry1(function(q) {
2934
+ return O(D, U, q);
2935
+ });
2936
+ default:
2937
+ return _isPlaceholder(D) && _isPlaceholder(U) && _isPlaceholder(F) ? w : _isPlaceholder(D) && _isPlaceholder(U) ? _curry2(function(q, W) {
2938
+ return O(q, W, F);
2939
+ }) : _isPlaceholder(D) && _isPlaceholder(F) ? _curry2(function(q, W) {
2940
+ return O(q, U, W);
2941
+ }) : _isPlaceholder(U) && _isPlaceholder(F) ? _curry2(function(q, W) {
2942
+ return O(D, q, W);
2943
+ }) : _isPlaceholder(D) ? _curry1(function(q) {
2944
+ return O(q, U, F);
2945
+ }) : _isPlaceholder(U) ? _curry1(function(q) {
2946
+ return O(D, q, F);
2947
+ }) : _isPlaceholder(F) ? _curry1(function(q) {
2948
+ return O(D, U, q);
2949
+ }) : O(D, U, F);
2950
+ }
2951
+ };
2952
+ }
2953
+ const _isArray = Array.isArray || function O(w) {
2954
+ return w != null && w.length >= 0 && Object.prototype.toString.call(w) === "[object Array]";
2955
+ };
2956
+ function _isTransformer(O) {
2957
+ return O != null && typeof O["@@transducer/step"] == "function";
2958
+ }
2959
+ function _dispatchable(O, w, D) {
2960
+ return function() {
2961
+ if (arguments.length === 0)
2962
+ return D();
2963
+ var U = arguments[arguments.length - 1];
2964
+ if (!_isArray(U)) {
2965
+ for (var F = 0; F < O.length; ) {
2966
+ if (typeof U[O[F]] == "function")
2967
+ return U[O[F]].apply(U, Array.prototype.slice.call(arguments, 0, -1));
2968
+ F += 1;
2969
+ }
2970
+ if (_isTransformer(U)) {
2971
+ var q = w.apply(null, Array.prototype.slice.call(arguments, 0, -1));
2972
+ return q(U);
2973
+ }
2974
+ }
2975
+ return D.apply(this, arguments);
2976
+ };
2977
+ }
2978
+ const _xfBase = {
2979
+ init: function() {
2980
+ return this.xf["@@transducer/init"]();
2981
+ },
2982
+ result: function(O) {
2983
+ return this.xf["@@transducer/result"](O);
2984
+ }
2985
+ };
2986
+ function _has(O, w) {
2987
+ return Object.prototype.hasOwnProperty.call(w, O);
2988
+ }
2989
+ var toString = Object.prototype.toString, _isArguments = /* @__PURE__ */ (function() {
2990
+ return toString.call(arguments) === "[object Arguments]" ? function(w) {
2991
+ return toString.call(w) === "[object Arguments]";
2992
+ } : function(w) {
2993
+ return _has("callee", w);
2994
+ };
2995
+ })(), hasEnumBug = !/* @__PURE__ */ {
2996
+ toString: null
2997
+ }.propertyIsEnumerable("toString"), nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], hasArgsEnumBug = /* @__PURE__ */ (function() {
2998
+ return arguments.propertyIsEnumerable("length");
2999
+ })(), contains = function O(w, D) {
3000
+ for (var U = 0; U < w.length; ) {
3001
+ if (w[U] === D)
3002
+ return !0;
3003
+ U += 1;
3004
+ }
3005
+ return !1;
3006
+ }, keys = /* @__PURE__ */ _curry1(typeof Object.keys == "function" && !hasArgsEnumBug ? function O(w) {
3007
+ return Object(w) !== w ? [] : Object.keys(w);
3008
+ } : function O(w) {
3009
+ if (Object(w) !== w)
3010
+ return [];
3011
+ var D, U, F = [], q = hasArgsEnumBug && _isArguments(w);
3012
+ for (D in w)
3013
+ _has(D, w) && (!q || D !== "length") && (F[F.length] = D);
3014
+ if (hasEnumBug)
3015
+ for (U = nonEnumerableProps.length - 1; U >= 0; )
3016
+ D = nonEnumerableProps[U], _has(D, w) && !contains(F, D) && (F[F.length] = D), U -= 1;
3017
+ return F;
3018
+ });
3019
+ function _map(O, w) {
3020
+ for (var D = 0, U = w.length, F = Array(U); D < U; )
3021
+ F[D] = O(w[D]), D += 1;
3022
+ return F;
3023
+ }
3024
+ function _arrayReduce(O, w, D) {
3025
+ for (var U = 0, F = D.length; U < F; )
3026
+ w = O(w, D[U]), U += 1;
3027
+ return w;
3028
+ }
3029
+ var XMap = /* @__PURE__ */ (function() {
3030
+ function O(w, D) {
3031
+ this.xf = D, this.f = w;
3032
+ }
3033
+ return O.prototype["@@transducer/init"] = _xfBase.init, O.prototype["@@transducer/result"] = _xfBase.result, O.prototype["@@transducer/step"] = function(w, D) {
3034
+ return this.xf["@@transducer/step"](w, this.f(D));
3035
+ }, O;
3036
+ })(), _xmap = function O(w) {
3037
+ return function(D) {
3038
+ return new XMap(w, D);
3039
+ };
3040
+ }, map = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], _xmap, function O(w, D) {
3041
+ switch (Object.prototype.toString.call(D)) {
3042
+ case "[object Function]":
3043
+ return curryN(D.length, function() {
3044
+ return w.call(this, D.apply(this, arguments));
3045
+ });
3046
+ case "[object Object]":
3047
+ return _arrayReduce(function(U, F) {
3048
+ return U[F] = w(D[F]), U;
3049
+ }, {}, keys(D));
3050
+ default:
3051
+ return _map(w, D);
3052
+ }
3053
+ }));
3054
+ const _isInteger = Number.isInteger || function O(w) {
3055
+ return w << 0 === w;
3056
+ };
3057
+ function _nth(O, w) {
3058
+ var D = O < 0 ? w.length + O : O;
3059
+ return w[D];
3060
+ }
3061
+ function _prop(O, w) {
3062
+ if (w != null)
3063
+ return _isInteger(O) ? _nth(O, w) : w[O];
3064
+ }
3065
+ function _isString(O) {
3066
+ return Object.prototype.toString.call(O) === "[object String]";
3067
+ }
3068
+ var _isArrayLike = /* @__PURE__ */ _curry1(function O(w) {
3069
+ return _isArray(w) ? !0 : !w || typeof w != "object" || _isString(w) ? !1 : w.length === 0 ? !0 : w.length > 0 ? w.hasOwnProperty(0) && w.hasOwnProperty(w.length - 1) : !1;
3070
+ }), symIterator = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
3071
+ function _createReduce(O, w, D) {
3072
+ return function(F, q, W) {
3073
+ if (_isArrayLike(W))
3074
+ return O(F, q, W);
3075
+ if (W == null)
3076
+ return q;
3077
+ if (typeof W["fantasy-land/reduce"] == "function")
3078
+ return w(F, q, W, "fantasy-land/reduce");
3079
+ if (W[symIterator] != null)
3080
+ return D(F, q, W[symIterator]());
3081
+ if (typeof W.next == "function")
3082
+ return D(F, q, W);
3083
+ if (typeof W.reduce == "function")
3084
+ return w(F, q, W, "reduce");
3085
+ throw new TypeError("reduce: list must be array or iterable");
3086
+ };
3087
+ }
3088
+ var and = /* @__PURE__ */ _curry2(function O(w, D) {
3089
+ return w && D;
3090
+ });
3091
+ function _iterableReduce(O, w, D) {
3092
+ for (var U = D.next(); !U.done; )
3093
+ w = O(w, U.value), U = D.next();
3094
+ return w;
3095
+ }
3096
+ function _methodReduce(O, w, D, U) {
3097
+ return D[U](O, w);
3098
+ }
3099
+ var _reduce = /* @__PURE__ */ _createReduce(_arrayReduce, _methodReduce, _iterableReduce), ap = /* @__PURE__ */ _curry2(function O(w, D) {
3100
+ return typeof D["fantasy-land/ap"] == "function" ? D["fantasy-land/ap"](w) : typeof w.ap == "function" ? w.ap(D) : typeof w == "function" ? function(U) {
3101
+ return w(U)(D(U));
3102
+ } : _reduce(function(U, F) {
3103
+ return _concat(U, map(F, D));
3104
+ }, [], w);
3105
+ });
3106
+ function _assoc(O, w, D) {
3107
+ if (_isInteger(O) && _isArray(D)) {
3108
+ var U = O < 0 ? D.length + O : O, F = [].concat(D);
3109
+ return F[U] = w, F;
3110
+ }
3111
+ var q = {};
3112
+ for (var W in D)
3113
+ q[W] = D[W];
3114
+ return q[O] = w, q;
3115
+ }
3116
+ var isNil = /* @__PURE__ */ _curry1(function O(w) {
3117
+ return w == null;
3118
+ }), assocPath = /* @__PURE__ */ _curry3(function O(w, D, U) {
3119
+ if (w.length === 0)
3120
+ return D;
3121
+ var F = w[0];
3122
+ if (w.length > 1) {
3123
+ var q = _prop(F, U);
3124
+ (isNil(q) || typeof q != "object") && (q = _isInteger(w[1]) ? [] : {}), D = O(Array.prototype.slice.call(w, 1), D, q);
3125
+ }
3126
+ return _assoc(F, D, U);
3127
+ });
3128
+ function _isFunction(O) {
3129
+ var w = Object.prototype.toString.call(O);
3130
+ return w === "[object Function]" || w === "[object AsyncFunction]" || w === "[object GeneratorFunction]" || w === "[object AsyncGeneratorFunction]";
3131
+ }
3132
+ var liftN = /* @__PURE__ */ _curry2(function O(w, D) {
3133
+ var U = curryN(w, D);
3134
+ return curryN(w, function() {
3135
+ return _arrayReduce(ap, map(U, arguments[0]), Array.prototype.slice.call(arguments, 1));
3136
+ });
3137
+ }), lift = /* @__PURE__ */ _curry1(function O(w) {
3138
+ return liftN(w.length, w);
3139
+ }), both = /* @__PURE__ */ _curry2(function O(w, D) {
3140
+ return _isFunction(w) ? function() {
3141
+ return w.apply(this, arguments) && D.apply(this, arguments);
3142
+ } : lift(and)(w, D);
3143
+ }), hasPath = /* @__PURE__ */ _curry2(function O(w, D) {
3144
+ if (w.length === 0 || isNil(D))
3145
+ return !1;
3146
+ for (var U = D, F = 0; F < w.length; )
3147
+ if (!isNil(U) && _has(w[F], U))
3148
+ U = U[w[F]], F += 1;
3149
+ else
3150
+ return !1;
3151
+ return !0;
3152
+ }), has = /* @__PURE__ */ _curry2(function O(w, D) {
3153
+ return hasPath([w], D);
3154
+ });
3155
+ function _path(O, w) {
3156
+ for (var D = w, U = 0; U < O.length; U += 1) {
3157
+ if (D == null)
3158
+ return;
3159
+ var F = O[U];
3160
+ _isInteger(F) ? D = _nth(F, D) : D = D[F];
3161
+ }
3162
+ return D;
3163
+ }
3164
+ var path = /* @__PURE__ */ _curry2(_path);
3165
+ const DEFAULT_FORMATTERS = {
3166
+ /**
3167
+ * Format as JSON (useful for debugging)
3168
+ */
3169
+ json: (O) => JSON.stringify(O, null, 2),
3170
+ /**
3171
+ * Format date as "DD MMM YY HH:mm:ss" (e.g., "10 Nov 25 11:27:49")
3172
+ * Accepts ISO date strings, timestamps, or Date objects.
3173
+ * Returns empty string for null/undefined values.
3174
+ */
3175
+ date: (O) => {
3176
+ if (!O) return "";
3177
+ const w = O instanceof Date ? O : new Date(O);
3178
+ return isNaN(w.getTime()) ? (console.warn("[Binder] Invalid date value:", O), "") : dateToZooyStdTimeString(w);
3179
+ }
3180
+ };
3181
+ class Binder {
3182
+ #t;
3183
+ #e;
3184
+ #s;
3185
+ #r = null;
3186
+ #n;
3187
+ /**
3188
+ * Creates a new Binder instance.
3189
+ *
3190
+ * @param {zooy.Panel} panel
3191
+ * @param {string} url - API endpoint URL
3192
+ * @param {Element} rootEl - Root element to walk for bindings
3193
+ * @param options
3194
+ * @param {Object<string, string|number>} [options.urlParams] - Configuration options
3195
+ * @param {Object<string, Function>} [options.formatters] - Custom formatters
3196
+ * @throws {Error} If url or rootEl is missing/invalid
3197
+ */
3198
+ constructor(w, D, U, F = {}) {
3199
+ if (!D)
3200
+ throw new Error("Binder requires a URL");
3201
+ if (!U || !(U instanceof Element))
3202
+ throw new Error("Binder requires a valid rootEl Element");
3203
+ this.#t = w, this.#e = new URL(D, window.location.origin), this.#s = U, this.#n = { ...DEFAULT_FORMATTERS, ...F.formatters }, F.urlParams && this.#i(F.urlParams);
3204
+ }
3205
+ get url() {
3206
+ return this.#e;
3207
+ }
3208
+ get data() {
3209
+ return this.#r;
3210
+ }
3211
+ get limit() {
3212
+ return parseInt(this.#e.searchParams.get("limit") || "0", 10);
3213
+ }
3214
+ get offset() {
3215
+ return parseInt(this.#e.searchParams.get("offset") || "0", 10);
3216
+ }
3217
+ get isPaginated() {
3218
+ return both(has("count"), has("results"))(this.#r);
3219
+ }
3220
+ #i(w) {
3221
+ return Object.entries(w).forEach(([D, U]) => {
3222
+ if (U == null || U === "") {
3223
+ this.#e.searchParams.delete(D);
3224
+ return;
3225
+ }
3226
+ if (Array.isArray(U)) {
3227
+ this.#e.searchParams.set(D, U.join(","));
3228
+ return;
3229
+ }
3230
+ this.#e.searchParams.set(D, U);
3231
+ }), this.#e;
3232
+ }
3233
+ /**
3234
+ * Fetches data from the configured URL with optional query parameters.
3235
+ * Data is automatically bound to the DOM via setData() after fetch completes.
3236
+ *
3237
+ * @param {Object} [urlParams={}] - Query parameters to append to URL (e.g., {limit: 25, offset: 0, ordering: 'name'})
3238
+ * @return {Promise<void>}
3239
+ * @throws {Error} If fetch fails or response is invalid
3240
+ */
3241
+ async fetchData(w = {}) {
3242
+ const D = await this.#t.user.fetchJson(
3243
+ this.#i(w).toString(),
3244
+ this.#t.abortController.signal
3245
+ );
3246
+ this.setData(D);
3247
+ }
3248
+ /**
3249
+ * Sets data directly without fetching from URL.
3250
+ * This is the convergence point for all data updates (from fetchData() or external sources).
3251
+ *
3252
+ * Behavior:
3253
+ * - Stores full JSON object (not just arrays)
3254
+ * - Calls render() to update the DOM
3255
+ * - render() extracts appropriate slices for each consumer
3256
+ *
3257
+ * @param {Object} data - Full JSON response object
3258
+ */
3259
+ setData(w) {
3260
+ this.#r = w, this.render();
3261
+ }
3262
+ /**
3263
+ * Renders data by walking the rootEl element and processing all bindings.
3264
+ *
3265
+ * Supports two binding patterns:
3266
+ * 1. Simple property binding - Direct zoo-bind attributes on elements (no templates)
3267
+ * 2. Template rendering - Elements with zoo-template duplicate for arrays
3268
+ *
3269
+ * Algorithm:
3270
+ * 1. Process simple bindings (zoo-bind, zoo-bind-attr outside template consumers)
3271
+ * 2. Process template consumers (elements with zoo-template attribute)
3272
+ * - Get template ID and optional zoo-template-bind
3273
+ * - Extract data slice using Ramda's R.path()
3274
+ * - Clear consumer and clone template for each item
3275
+ *
3276
+ * Multiple consumers can exist in the same rootEl, each rendering different slices
3277
+ * of the same JSON response (e.g., results, metadata, alerts).
3278
+ */
3279
+ render() {
3280
+ if (!isDefAndNotNull(this.#r)) {
3281
+ console.warn("[Binder] No data to render");
3282
+ return;
3283
+ }
3284
+ this.#o(this.#s, this.#r, 0), this.#a();
3285
+ }
3286
+ /**
3287
+ * Renders simple property bindings directly to existing elements.
3288
+ * Processes zoo-bind-attr, zoo-bind, and conditional rendering attributes.
3289
+ *
3290
+ * This method is reusable and can be called with different elements and data objects.
3291
+ * Used for both rootEl-level simple bindings and template item rendering.
3292
+ *
3293
+ * @param {Element|DocumentFragment} element - Root element to search for bindings
3294
+ * @param {Object} data - Data object to bind
3295
+ * @param {number} [index=0] - Current index (for $index and $index1 special variables)
3296
+ * @param {Object} [options={}] - Rendering options
3297
+ * @param {boolean} [options.removeOnCondition=false] - Remove elements on failed conditions (vs hiding with display:none)
3298
+ * @param {boolean} [options.removeAttributes=false] - Remove binding attributes after processing (vs keeping for re-render)
3299
+ * @private
3300
+ */
3301
+ #o(w, D, U = 0, F = {}) {
3302
+ const q = F.removeAttributes ?? !1;
3303
+ w.querySelectorAll("[zoo-bind-attr]").forEach((W) => {
3304
+ if (W.closest("[zoo-template]")) return;
3305
+ W.getAttribute("zoo-bind-attr").split(",").forEach((G) => {
3306
+ const [Z, Q] = G.split(":").map((J) => J.trim()), tt = this.#c(D, Q, U);
3307
+ isDefAndNotNull(tt) && W.setAttribute(Z, tt);
3308
+ }), q && W.removeAttribute("zoo-bind-attr");
3309
+ }), w.querySelectorAll("[zoo-bind]").forEach((W) => {
3310
+ if (W.closest("[zoo-template]")) return;
3311
+ const Y = W.getAttribute("zoo-bind"), G = W.getAttribute("zoo-bind-format");
3312
+ let Z = this.#c(D, Y, U);
3313
+ G && this.#n[G] && (Z = this.#n[G](Z, D)), W.textContent = Z ?? "", q && (W.removeAttribute("zoo-bind"), W.removeAttribute("zoo-bind-format"));
3314
+ });
3315
+ }
3316
+ /**
3317
+ * Renders template consumers by duplicating templates for array data.
3318
+ *
3319
+ * @private
3320
+ */
3321
+ #a() {
3322
+ this.#s.querySelectorAll("[zoo-template]").forEach((D) => {
3323
+ const U = D.getAttribute("zoo-template"), F = D.getAttribute("zoo-template-bind");
3324
+ if (!U) {
3325
+ console.warn("[Binder] Consumer missing template ID", D);
3326
+ return;
3327
+ }
3328
+ const q = this.#s.querySelector(`#${U}`);
3329
+ if (!q || q.tagName !== "TEMPLATE") {
3330
+ console.error(`[DataBinder] Template not found or invalid: ${U}`);
3331
+ return;
3332
+ }
3333
+ const W = F ? path(F.split("."), this.#r) : this.#r;
3334
+ if (!W) {
3335
+ console.warn(`[DataBinder] Data slice is undefined. Path: ${F}. Skipping render for this consumer.`);
3336
+ return;
3337
+ }
3338
+ if (!Array.isArray(W)) {
3339
+ console.error(`[DataBinder] Data slice is not an array. Path: ${F}`, W);
3340
+ return;
3341
+ }
3342
+ D.innerHTML = "", W.forEach((Y, G) => {
3343
+ const Z = this.#l(q, Y, G);
3344
+ D.appendChild(Z);
3345
+ });
3346
+ });
3347
+ }
3348
+ /**
3349
+ * Renders a single item from a template.
3350
+ * Uses the unified rendering method with options for template-specific behavior.
3351
+ *
3352
+ * @param {HTMLTemplateElement} template - Template element
3353
+ * @param {Object} item - Data object
3354
+ * @param {number} index - Item index in array
3355
+ * @return {DocumentFragment} Rendered template clone
3356
+ * @private
3357
+ */
3358
+ #l(w, D, U) {
3359
+ const F = w.content.cloneNode(!0);
3360
+ return this.#o(F, D, U, {
3361
+ removeAttributes: !0
3362
+ }), F;
3363
+ }
3364
+ /**
3365
+ * Gets a value from an object using dot notation.
3366
+ *
3367
+ * Special Variables:
3368
+ * - $index: 0-based row number (within current page)
3369
+ * - $index1: 1-based row number (within current page)
3370
+ * - $index__paged: 0-based row number (accounts for pagination offset)
3371
+ * - $index1__paged: 1-based row number (accounts for pagination offset)
3372
+ *
3373
+ * @param {Object} obj - Object to query
3374
+ * @param {string} pathString - Dot-separated path (e.g., "profile.name") or special variable ($index, $index1, $index__paged, $index1__paged)
3375
+ * @param {number} index - Item index in current data array (0-based)
3376
+ * @return {*} The value, or undefined if not found
3377
+ * @private
3378
+ */
3379
+ #c(w, D, U) {
3380
+ const F = {
3381
+ $index: () => U,
3382
+ $index__paged: () => this.offset + U,
3383
+ $index1: () => U + 1,
3384
+ $index1__paged: () => this.offset + U + 1
3385
+ };
3386
+ return F[D] ? F[D]() : path(D.split("."), w);
3387
+ }
3388
+ }
3389
+ const SEMANTIC_ATTRS = new Map(Object.entries({
3390
+ event: "event",
3391
+ endpoint: "endpoint",
3392
+ href: "href",
3393
+ url: "url",
3394
+ target: "target",
3395
+ "record-id": "recordId",
3396
+ "zoo-sort-field": "sortField",
3397
+ "zoo-view": "view"
3398
+ })), getSemanticAttributes = (O) => {
3399
+ let w = {};
3400
+ return Array.from(O.attributes).forEach((D) => {
3401
+ const U = D.name, F = D.value;
3402
+ SEMANTIC_ATTRS.has(U) ? w[SEMANTIC_ATTRS.get(U)] = F : (U.startsWith("data-") || U.startsWith("zoo-")) && (w = assocPath(U.split("-"), F, w));
3403
+ }), w;
3404
+ }, getEventAttribute = (O, w, D = "event") => O.getAttribute(w) || O.getAttribute(D);
3405
+ /**
3406
+ * @license
3407
+ * Copyright 2019 Google LLC
3408
+ * SPDX-License-Identifier: BSD-3-Clause
3409
+ */
3410
+ const t$1 = globalThis, e$2 = t$1.ShadowRoot && (t$1.ShadyCSS === void 0 || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$3 = /* @__PURE__ */ new WeakMap();
3411
+ let n$2 = class {
3412
+ constructor(w, D, U) {
3413
+ if (this._$cssResult$ = !0, U !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
3414
+ this.cssText = w, this.t = D;
3415
+ }
3416
+ get styleSheet() {
3417
+ let w = this.o;
3418
+ const D = this.t;
3419
+ if (e$2 && w === void 0) {
3420
+ const U = D !== void 0 && D.length === 1;
3421
+ U && (w = o$3.get(D)), w === void 0 && ((this.o = w = new CSSStyleSheet()).replaceSync(this.cssText), U && o$3.set(D, w));
3422
+ }
3423
+ return w;
3424
+ }
3425
+ toString() {
3426
+ return this.cssText;
3427
+ }
3428
+ };
3429
+ const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...w) => {
3430
+ const D = O.length === 1 ? O[0] : w.reduce(((U, F, q) => U + ((W) => {
3431
+ if (W._$cssResult$ === !0) return W.cssText;
3432
+ if (typeof W == "number") return W;
3433
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + W + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
3434
+ })(F) + O[q + 1]), O[0]);
3435
+ return new n$2(D, O, s$2);
3436
+ }, S$1 = (O, w) => {
3437
+ if (e$2) O.adoptedStyleSheets = w.map(((D) => D instanceof CSSStyleSheet ? D : D.styleSheet));
3438
+ else for (const D of w) {
3439
+ const U = document.createElement("style"), F = t$1.litNonce;
3440
+ F !== void 0 && U.setAttribute("nonce", F), U.textContent = D.cssText, O.appendChild(U);
3441
+ }
3442
+ }, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((w) => {
3443
+ let D = "";
3444
+ for (const U of w.cssRules) D += U.cssText;
3445
+ return r$2(D);
3446
+ })(O) : O;
3447
+ /**
3448
+ * @license
3449
+ * Copyright 2017 Google LLC
3450
+ * SPDX-License-Identifier: BSD-3-Clause
3451
+ */
3452
+ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$1, getOwnPropertySymbols: o$2, getPrototypeOf: n$1 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (O, w) => O, u$1 = { toAttribute(O, w) {
3453
+ switch (w) {
3454
+ case Boolean:
3455
+ O = O ? l$1 : null;
3456
+ break;
3457
+ case Object:
3458
+ case Array:
3459
+ O = O == null ? O : JSON.stringify(O);
3460
+ }
3461
+ return O;
3462
+ }, fromAttribute(O, w) {
3463
+ let D = O;
3464
+ switch (w) {
3465
+ case Boolean:
3466
+ D = O !== null;
3467
+ break;
3468
+ case Number:
3469
+ D = O === null ? null : Number(O);
3470
+ break;
3471
+ case Object:
3472
+ case Array:
3473
+ try {
3474
+ D = JSON.parse(O);
3475
+ } catch {
3476
+ D = null;
3477
+ }
3478
+ }
3479
+ return D;
3480
+ } }, f$1 = (O, w) => !i$2(O, w), b$1 = { attribute: !0, type: String, converter: u$1, reflect: !1, useDefault: !1, hasChanged: f$1 };
3481
+ Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
3482
+ let y$1 = class extends HTMLElement {
3483
+ static addInitializer(w) {
3484
+ this._$Ei(), (this.l ??= []).push(w);
3485
+ }
3486
+ static get observedAttributes() {
3487
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
3488
+ }
3489
+ static createProperty(w, D = b$1) {
3490
+ if (D.state && (D.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(w) && ((D = Object.create(D)).wrapped = !0), this.elementProperties.set(w, D), !D.noAccessor) {
3491
+ const U = Symbol(), F = this.getPropertyDescriptor(w, U, D);
3492
+ F !== void 0 && e$1(this.prototype, w, F);
3493
+ }
3494
+ }
3495
+ static getPropertyDescriptor(w, D, U) {
3496
+ const { get: F, set: q } = h$1(this.prototype, w) ?? { get() {
3497
+ return this[D];
3498
+ }, set(W) {
3499
+ this[D] = W;
3500
+ } };
3501
+ return { get: F, set(W) {
3502
+ const Y = F?.call(this);
3503
+ q?.call(this, W), this.requestUpdate(w, Y, U);
3504
+ }, configurable: !0, enumerable: !0 };
3505
+ }
3506
+ static getPropertyOptions(w) {
3507
+ return this.elementProperties.get(w) ?? b$1;
3508
+ }
3509
+ static _$Ei() {
3510
+ if (this.hasOwnProperty(d$1("elementProperties"))) return;
3511
+ const w = n$1(this);
3512
+ w.finalize(), w.l !== void 0 && (this.l = [...w.l]), this.elementProperties = new Map(w.elementProperties);
3513
+ }
3514
+ static finalize() {
3515
+ if (this.hasOwnProperty(d$1("finalized"))) return;
3516
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
3517
+ const D = this.properties, U = [...r$1(D), ...o$2(D)];
3518
+ for (const F of U) this.createProperty(F, D[F]);
3519
+ }
3520
+ const w = this[Symbol.metadata];
3521
+ if (w !== null) {
3522
+ const D = litPropertyMetadata.get(w);
3523
+ if (D !== void 0) for (const [U, F] of D) this.elementProperties.set(U, F);
3524
+ }
3525
+ this._$Eh = /* @__PURE__ */ new Map();
3526
+ for (const [D, U] of this.elementProperties) {
3527
+ const F = this._$Eu(D, U);
3528
+ F !== void 0 && this._$Eh.set(F, D);
3529
+ }
3530
+ this.elementStyles = this.finalizeStyles(this.styles);
3531
+ }
3532
+ static finalizeStyles(w) {
3533
+ const D = [];
3534
+ if (Array.isArray(w)) {
3535
+ const U = new Set(w.flat(1 / 0).reverse());
3536
+ for (const F of U) D.unshift(c$2(F));
3537
+ } else w !== void 0 && D.push(c$2(w));
3538
+ return D;
3539
+ }
3540
+ static _$Eu(w, D) {
3541
+ const U = D.attribute;
3542
+ return U === !1 ? void 0 : typeof U == "string" ? U : typeof w == "string" ? w.toLowerCase() : void 0;
3543
+ }
3544
+ constructor() {
3545
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
3546
+ }
3547
+ _$Ev() {
3548
+ this._$ES = new Promise(((w) => this.enableUpdating = w)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((w) => w(this)));
3549
+ }
3550
+ addController(w) {
3551
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(w), this.renderRoot !== void 0 && this.isConnected && w.hostConnected?.();
3552
+ }
3553
+ removeController(w) {
3554
+ this._$EO?.delete(w);
3555
+ }
3556
+ _$E_() {
3557
+ const w = /* @__PURE__ */ new Map(), D = this.constructor.elementProperties;
3558
+ for (const U of D.keys()) this.hasOwnProperty(U) && (w.set(U, this[U]), delete this[U]);
3559
+ w.size > 0 && (this._$Ep = w);
3560
+ }
3561
+ createRenderRoot() {
3562
+ const w = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
3563
+ return S$1(w, this.constructor.elementStyles), w;
3564
+ }
3565
+ connectedCallback() {
3566
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((w) => w.hostConnected?.()));
3567
+ }
3568
+ enableUpdating(w) {
3569
+ }
3570
+ disconnectedCallback() {
3571
+ this._$EO?.forEach(((w) => w.hostDisconnected?.()));
3572
+ }
3573
+ attributeChangedCallback(w, D, U) {
3574
+ this._$AK(w, U);
3575
+ }
3576
+ _$ET(w, D) {
3577
+ const U = this.constructor.elementProperties.get(w), F = this.constructor._$Eu(w, U);
3578
+ if (F !== void 0 && U.reflect === !0) {
3579
+ const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(D, U.type);
3580
+ this._$Em = w, q == null ? this.removeAttribute(F) : this.setAttribute(F, q), this._$Em = null;
3581
+ }
3582
+ }
3583
+ _$AK(w, D) {
3584
+ const U = this.constructor, F = U._$Eh.get(w);
3585
+ if (F !== void 0 && this._$Em !== F) {
3586
+ const q = U.getPropertyOptions(F), W = typeof q.converter == "function" ? { fromAttribute: q.converter } : q.converter?.fromAttribute !== void 0 ? q.converter : u$1;
3587
+ this._$Em = F;
3588
+ const Y = W.fromAttribute(D, q.type);
3589
+ this[F] = Y ?? this._$Ej?.get(F) ?? Y, this._$Em = null;
3590
+ }
3591
+ }
3592
+ requestUpdate(w, D, U) {
3593
+ if (w !== void 0) {
3594
+ const F = this.constructor, q = this[w];
3595
+ if (U ??= F.getPropertyOptions(w), !((U.hasChanged ?? f$1)(q, D) || U.useDefault && U.reflect && q === this._$Ej?.get(w) && !this.hasAttribute(F._$Eu(w, U)))) return;
3596
+ this.C(w, D, U);
3597
+ }
3598
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
3599
+ }
3600
+ C(w, D, { useDefault: U, reflect: F, wrapped: q }, W) {
3601
+ U && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(w) && (this._$Ej.set(w, W ?? D ?? this[w]), q !== !0 || W !== void 0) || (this._$AL.has(w) || (this.hasUpdated || U || (D = void 0), this._$AL.set(w, D)), F === !0 && this._$Em !== w && (this._$Eq ??= /* @__PURE__ */ new Set()).add(w));
3602
+ }
3603
+ async _$EP() {
3604
+ this.isUpdatePending = !0;
3605
+ try {
3606
+ await this._$ES;
3607
+ } catch (D) {
3608
+ Promise.reject(D);
3609
+ }
3610
+ const w = this.scheduleUpdate();
3611
+ return w != null && await w, !this.isUpdatePending;
3612
+ }
3613
+ scheduleUpdate() {
3614
+ return this.performUpdate();
3615
+ }
3616
+ performUpdate() {
3617
+ if (!this.isUpdatePending) return;
3618
+ if (!this.hasUpdated) {
3619
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
3620
+ for (const [F, q] of this._$Ep) this[F] = q;
3621
+ this._$Ep = void 0;
3622
+ }
3623
+ const U = this.constructor.elementProperties;
3624
+ if (U.size > 0) for (const [F, q] of U) {
3625
+ const { wrapped: W } = q, Y = this[F];
3626
+ W !== !0 || this._$AL.has(F) || Y === void 0 || this.C(F, void 0, q, Y);
3627
+ }
3628
+ }
3629
+ let w = !1;
3630
+ const D = this._$AL;
3631
+ try {
3632
+ w = this.shouldUpdate(D), w ? (this.willUpdate(D), this._$EO?.forEach(((U) => U.hostUpdate?.())), this.update(D)) : this._$EM();
3633
+ } catch (U) {
3634
+ throw w = !1, this._$EM(), U;
3635
+ }
3636
+ w && this._$AE(D);
3637
+ }
3638
+ willUpdate(w) {
3639
+ }
3640
+ _$AE(w) {
3641
+ this._$EO?.forEach(((D) => D.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(w)), this.updated(w);
3642
+ }
3643
+ _$EM() {
3644
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
3645
+ }
3646
+ get updateComplete() {
3647
+ return this.getUpdateComplete();
3648
+ }
3649
+ getUpdateComplete() {
3650
+ return this._$ES;
3651
+ }
3652
+ shouldUpdate(w) {
3653
+ return !0;
3654
+ }
3655
+ update(w) {
3656
+ this._$Eq &&= this._$Eq.forEach(((D) => this._$ET(D, this[D]))), this._$EM();
3657
+ }
3658
+ updated(w) {
3659
+ }
3660
+ firstUpdated(w) {
3661
+ }
3662
+ };
3663
+ y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
3664
+ /**
3665
+ * @license
3666
+ * Copyright 2017 Google LLC
3667
+ * SPDX-License-Identifier: BSD-3-Clause
3668
+ */
3669
+ const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (O) => O }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (O) => O === null || typeof O != "object" && typeof O != "function", a = Array.isArray, u = (O) => a(O) || typeof O?.[Symbol.iterator] == "function", d = `[
3670
+ \f\r]`, f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
3671
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (w, ...D) => ({ _$litType$: O, strings: w, values: D }), x = y(1), b = y(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
3672
+ function P(O, w) {
3673
+ if (!a(O) || !O.hasOwnProperty("raw")) throw Error("invalid template strings array");
3674
+ return s$1 !== void 0 ? s$1.createHTML(w) : w;
3675
+ }
3676
+ const V = (O, w) => {
3677
+ const D = O.length - 1, U = [];
3678
+ let F, q = w === 2 ? "<svg>" : w === 3 ? "<math>" : "", W = f;
3679
+ for (let Y = 0; Y < D; Y++) {
3680
+ const G = O[Y];
3681
+ let Z, Q, tt = -1, J = 0;
3682
+ for (; J < G.length && (W.lastIndex = J, Q = W.exec(G), Q !== null); ) J = W.lastIndex, W === f ? Q[1] === "!--" ? W = v : Q[1] !== void 0 ? W = _ : Q[2] !== void 0 ? ($.test(Q[2]) && (F = RegExp("</" + Q[2], "g")), W = m) : Q[3] !== void 0 && (W = m) : W === m ? Q[0] === ">" ? (W = F ?? f, tt = -1) : Q[1] === void 0 ? tt = -2 : (tt = W.lastIndex - Q[2].length, Z = Q[1], W = Q[3] === void 0 ? m : Q[3] === '"' ? g : p) : W === g || W === p ? W = m : W === v || W === _ ? W = f : (W = m, F = void 0);
3683
+ const X = W === m && O[Y + 1].startsWith("/>") ? " " : "";
3684
+ q += W === f ? G + n : tt >= 0 ? (U.push(Z), G.slice(0, tt) + e + G.slice(tt) + h + X) : G + h + (tt === -2 ? Y : X);
3685
+ }
3686
+ return [P(O, q + (O[D] || "<?>") + (w === 2 ? "</svg>" : w === 3 ? "</math>" : "")), U];
3687
+ };
3688
+ class N {
3689
+ constructor({ strings: w, _$litType$: D }, U) {
3690
+ let F;
3691
+ this.parts = [];
3692
+ let q = 0, W = 0;
3693
+ const Y = w.length - 1, G = this.parts, [Z, Q] = V(w, D);
3694
+ if (this.el = N.createElement(Z, U), C.currentNode = this.el.content, D === 2 || D === 3) {
3695
+ const tt = this.el.content.firstChild;
3696
+ tt.replaceWith(...tt.childNodes);
3697
+ }
3698
+ for (; (F = C.nextNode()) !== null && G.length < Y; ) {
3699
+ if (F.nodeType === 1) {
3700
+ if (F.hasAttributes()) for (const tt of F.getAttributeNames()) if (tt.endsWith(e)) {
3701
+ const J = Q[W++], X = F.getAttribute(tt).split(h), K = /([.?@])?(.*)/.exec(J);
3702
+ G.push({ type: 1, index: q, name: K[2], strings: X, ctor: K[1] === "." ? H : K[1] === "?" ? I : K[1] === "@" ? L : k }), F.removeAttribute(tt);
3703
+ } else tt.startsWith(h) && (G.push({ type: 6, index: q }), F.removeAttribute(tt));
3704
+ if ($.test(F.tagName)) {
3705
+ const tt = F.textContent.split(h), J = tt.length - 1;
3706
+ if (J > 0) {
3707
+ F.textContent = i$1 ? i$1.emptyScript : "";
3708
+ for (let X = 0; X < J; X++) F.append(tt[X], l()), C.nextNode(), G.push({ type: 2, index: ++q });
3709
+ F.append(tt[J], l());
3710
+ }
3711
+ }
3712
+ } else if (F.nodeType === 8) if (F.data === o$1) G.push({ type: 2, index: q });
3713
+ else {
3714
+ let tt = -1;
3715
+ for (; (tt = F.data.indexOf(h, tt + 1)) !== -1; ) G.push({ type: 7, index: q }), tt += h.length - 1;
3716
+ }
3717
+ q++;
3718
+ }
3719
+ }
3720
+ static createElement(w, D) {
3721
+ const U = r.createElement("template");
3722
+ return U.innerHTML = w, U;
3723
+ }
3724
+ }
3725
+ function S(O, w, D = O, U) {
3726
+ if (w === T) return w;
3727
+ let F = U !== void 0 ? D._$Co?.[U] : D._$Cl;
3728
+ const q = c(w) ? void 0 : w._$litDirective$;
3729
+ return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O, D, U)), U !== void 0 ? (D._$Co ??= [])[U] = F : D._$Cl = F), F !== void 0 && (w = S(O, F._$AS(O, w.values), F, U)), w;
3730
+ }
3731
+ class M {
3732
+ constructor(w, D) {
3733
+ this._$AV = [], this._$AN = void 0, this._$AD = w, this._$AM = D;
3734
+ }
3735
+ get parentNode() {
3736
+ return this._$AM.parentNode;
3737
+ }
3738
+ get _$AU() {
3739
+ return this._$AM._$AU;
3740
+ }
3741
+ u(w) {
3742
+ const { el: { content: D }, parts: U } = this._$AD, F = (w?.creationScope ?? r).importNode(D, !0);
3743
+ C.currentNode = F;
3744
+ let q = C.nextNode(), W = 0, Y = 0, G = U[0];
3745
+ for (; G !== void 0; ) {
3746
+ if (W === G.index) {
3747
+ let Z;
3748
+ G.type === 2 ? Z = new R(q, q.nextSibling, this, w) : G.type === 1 ? Z = new G.ctor(q, G.name, G.strings, this, w) : G.type === 6 && (Z = new z(q, this, w)), this._$AV.push(Z), G = U[++Y];
3749
+ }
3750
+ W !== G?.index && (q = C.nextNode(), W++);
3751
+ }
3752
+ return C.currentNode = r, F;
3753
+ }
3754
+ p(w) {
3755
+ let D = 0;
3756
+ for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(w, U, D), D += U.strings.length - 2) : U._$AI(w[D])), D++;
3757
+ }
3758
+ }
3759
+ class R {
3760
+ get _$AU() {
3761
+ return this._$AM?._$AU ?? this._$Cv;
3762
+ }
3763
+ constructor(w, D, U, F) {
3764
+ this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = w, this._$AB = D, this._$AM = U, this.options = F, this._$Cv = F?.isConnected ?? !0;
3765
+ }
3766
+ get parentNode() {
3767
+ let w = this._$AA.parentNode;
3768
+ const D = this._$AM;
3769
+ return D !== void 0 && w?.nodeType === 11 && (w = D.parentNode), w;
3770
+ }
3771
+ get startNode() {
3772
+ return this._$AA;
3773
+ }
3774
+ get endNode() {
3775
+ return this._$AB;
3776
+ }
3777
+ _$AI(w, D = this) {
3778
+ w = S(this, w, D), c(w) ? w === E || w == null || w === "" ? (this._$AH !== E && this._$AR(), this._$AH = E) : w !== this._$AH && w !== T && this._(w) : w._$litType$ !== void 0 ? this.$(w) : w.nodeType !== void 0 ? this.T(w) : u(w) ? this.k(w) : this._(w);
3779
+ }
3780
+ O(w) {
3781
+ return this._$AA.parentNode.insertBefore(w, this._$AB);
3782
+ }
3783
+ T(w) {
3784
+ this._$AH !== w && (this._$AR(), this._$AH = this.O(w));
3785
+ }
3786
+ _(w) {
3787
+ this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = w : this.T(r.createTextNode(w)), this._$AH = w;
3788
+ }
3789
+ $(w) {
3790
+ const { values: D, _$litType$: U } = w, F = typeof U == "number" ? this._$AC(w) : (U.el === void 0 && (U.el = N.createElement(P(U.h, U.h[0]), this.options)), U);
3791
+ if (this._$AH?._$AD === F) this._$AH.p(D);
3792
+ else {
3793
+ const q = new M(F, this), W = q.u(this.options);
3794
+ q.p(D), this.T(W), this._$AH = q;
3795
+ }
3796
+ }
3797
+ _$AC(w) {
3798
+ let D = A.get(w.strings);
3799
+ return D === void 0 && A.set(w.strings, D = new N(w)), D;
3800
+ }
3801
+ k(w) {
3802
+ a(this._$AH) || (this._$AH = [], this._$AR());
3803
+ const D = this._$AH;
3804
+ let U, F = 0;
3805
+ for (const q of w) F === D.length ? D.push(U = new R(this.O(l()), this.O(l()), this, this.options)) : U = D[F], U._$AI(q), F++;
3806
+ F < D.length && (this._$AR(U && U._$AB.nextSibling, F), D.length = F);
3807
+ }
3808
+ _$AR(w = this._$AA.nextSibling, D) {
3809
+ for (this._$AP?.(!1, !0, D); w !== this._$AB; ) {
3810
+ const U = w.nextSibling;
3811
+ w.remove(), w = U;
3812
+ }
3813
+ }
3814
+ setConnected(w) {
3815
+ this._$AM === void 0 && (this._$Cv = w, this._$AP?.(w));
3816
+ }
3817
+ }
3818
+ class k {
3819
+ get tagName() {
3820
+ return this.element.tagName;
3821
+ }
3822
+ get _$AU() {
3823
+ return this._$AM._$AU;
3824
+ }
3825
+ constructor(w, D, U, F, q) {
3826
+ this.type = 1, this._$AH = E, this._$AN = void 0, this.element = w, this.name = D, this._$AM = F, this.options = q, U.length > 2 || U[0] !== "" || U[1] !== "" ? (this._$AH = Array(U.length - 1).fill(new String()), this.strings = U) : this._$AH = E;
3827
+ }
3828
+ _$AI(w, D = this, U, F) {
3829
+ const q = this.strings;
3830
+ let W = !1;
3831
+ if (q === void 0) w = S(this, w, D, 0), W = !c(w) || w !== this._$AH && w !== T, W && (this._$AH = w);
3832
+ else {
3833
+ const Y = w;
3834
+ let G, Z;
3835
+ for (w = q[0], G = 0; G < q.length - 1; G++) Z = S(this, Y[U + G], D, G), Z === T && (Z = this._$AH[G]), W ||= !c(Z) || Z !== this._$AH[G], Z === E ? w = E : w !== E && (w += (Z ?? "") + q[G + 1]), this._$AH[G] = Z;
3836
+ }
3837
+ W && !F && this.j(w);
3838
+ }
3839
+ j(w) {
3840
+ w === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, w ?? "");
3841
+ }
3842
+ }
3843
+ class H extends k {
3844
+ constructor() {
3845
+ super(...arguments), this.type = 3;
3846
+ }
3847
+ j(w) {
3848
+ this.element[this.name] = w === E ? void 0 : w;
3849
+ }
3850
+ }
3851
+ class I extends k {
3852
+ constructor() {
3853
+ super(...arguments), this.type = 4;
3854
+ }
3855
+ j(w) {
3856
+ this.element.toggleAttribute(this.name, !!w && w !== E);
3857
+ }
3858
+ }
3859
+ class L extends k {
3860
+ constructor(w, D, U, F, q) {
3861
+ super(w, D, U, F, q), this.type = 5;
3862
+ }
3863
+ _$AI(w, D = this) {
3864
+ if ((w = S(this, w, D, 0) ?? E) === T) return;
3865
+ const U = this._$AH, F = w === E && U !== E || w.capture !== U.capture || w.once !== U.once || w.passive !== U.passive, q = w !== E && (U === E || F);
3866
+ F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this, w), this._$AH = w;
3867
+ }
3868
+ handleEvent(w) {
3869
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, w) : this._$AH.handleEvent(w);
3870
+ }
3871
+ }
3872
+ class z {
3873
+ constructor(w, D, U) {
3874
+ this.element = w, this.type = 6, this._$AN = void 0, this._$AM = D, this.options = U;
3875
+ }
3876
+ get _$AU() {
3877
+ return this._$AM._$AU;
3878
+ }
3879
+ _$AI(w) {
3880
+ S(this, w);
3881
+ }
3882
+ }
3883
+ const j = t.litHtmlPolyfillSupport;
3884
+ j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
3885
+ const B = (O, w, D) => {
3886
+ const U = D?.renderBefore ?? w;
3887
+ let F = U._$litPart$;
3888
+ if (F === void 0) {
3889
+ const q = D?.renderBefore ?? null;
3890
+ U._$litPart$ = F = new R(w.insertBefore(l(), q), q, void 0, D ?? {});
3891
+ }
3892
+ return F._$AI(O), F;
3893
+ };
3894
+ /**
3895
+ * @license
3896
+ * Copyright 2017 Google LLC
3897
+ * SPDX-License-Identifier: BSD-3-Clause
3898
+ */
3899
+ const s = globalThis;
3900
+ class i extends y$1 {
3901
+ constructor() {
3902
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
3903
+ }
3904
+ createRenderRoot() {
3905
+ const w = super.createRenderRoot();
3906
+ return this.renderOptions.renderBefore ??= w.firstChild, w;
3907
+ }
3908
+ update(w) {
3909
+ const D = this.render();
3910
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(w), this._$Do = B(D, this.renderRoot, this.renderOptions);
3911
+ }
3912
+ connectedCallback() {
3913
+ super.connectedCallback(), this._$Do?.setConnected(!0);
3914
+ }
3915
+ disconnectedCallback() {
3916
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
3917
+ }
3918
+ render() {
3919
+ return T;
3920
+ }
3921
+ }
3922
+ i._$litElement$ = !0, i.finalized = !0, s.litElementHydrateSupport?.({ LitElement: i });
3923
+ const o = s.litElementPolyfillSupport;
3924
+ o?.({ LitElement: i });
3925
+ (s.litElementVersions ??= []).push("4.2.1");
3926
+ class ZooTag extends i {
3927
+ static properties = {
3928
+ token: { type: String },
3929
+ prefix: { type: String },
3930
+ postfix: { type: String }
3931
+ };
3932
+ static styles = i$3`
3933
+ :host {
3934
+ display: inline-block;
3935
+ }
3936
+
3937
+ .tag {
3938
+ text-align: center;
3939
+ display: inline-flex;
3940
+ align-items: center;
3941
+ justify-content: center;
3942
+ line-height: initial;
3943
+ width: max-content;
3944
+ padding: .2em 1em;
3945
+ border-radius: 1em;
3946
+ font-size: var(--zoo-theme-chips-font-size, 0.75rem);
3947
+ white-space: nowrap;
3948
+ word-break: break-word;
3949
+ box-sizing: border-box;
3950
+ }
3951
+ `;
3952
+ render() {
3953
+ const w = this.prefix ?? "", D = this.token ?? "default", U = this.postfix ?? "", F = `${w}${D}${U}`;
3954
+ return x`
3955
+ <span
3956
+ class="tag"
3957
+ style="
3958
+ background-color: var(--zoo-tag-${F}-bg, var(--zoo-tag-default-bg, #9e9e9e));
3959
+ color: var(--zoo-tag-${F}-fg, var(--zoo-tag-default-fg, #ffffff));
3960
+ "
3961
+ >
3962
+ <slot></slot>
3963
+ </span>
3964
+ `;
3965
+ }
3966
+ }
3967
+ customElements.get("zoo-tag") || customElements.define("zoo-tag", ZooTag);
3968
+ const zoo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3969
+ __proto__: null,
3970
+ ZooTag,
3971
+ getEventAttribute,
3972
+ getSemanticAttributes
3973
+ }, Symbol.toStringTag, { value: "Module" }));
3974
+ async function registerCarbonLibrary() {
3975
+ const { registerCarbonLibrary: O } = await import("./register-BCEOkbXG.js");
3976
+ return O();
3977
+ }
3978
+ async function registerMdcLibrary() {
3979
+ const { registerMdcLibrary: O } = await import("./register-Bkr1UKav.js");
3980
+ return O();
3981
+ }
3982
+ const zooy = {
3983
+ Evt,
3984
+ Component,
3985
+ Dragger,
3986
+ Panel,
3987
+ FormPanel,
3988
+ Split,
3989
+ UserManager,
3990
+ View,
3991
+ Conductor,
3992
+ DataBinder: Binder,
3993
+ UiEventType,
3994
+ domUtils,
3995
+ uriUtils,
3996
+ registerCarbonLibrary,
3997
+ registerMdcLibrary,
3998
+ ComponentLibraryRegistry,
3999
+ handlers,
4000
+ zoo
4001
+ };
4002
+ export {
4003
+ zoo as A,
4004
+ Binder as B,
4005
+ ComponentLibraryRegistry as C,
4006
+ Dragger as D,
4007
+ E,
4008
+ FormPanel as F,
4009
+ Panel as P,
4010
+ Split as S,
4011
+ T,
4012
+ UserManager as U,
4013
+ View as V,
4014
+ _curry2 as _,
4015
+ i$3 as a,
4016
+ b,
4017
+ isDefAndNotNull as c,
4018
+ getEventAttribute as d,
4019
+ B as e,
4020
+ f$1 as f,
4021
+ getSemanticAttributes as g,
4022
+ hasPath as h,
4023
+ i,
4024
+ getElDataMap as j,
4025
+ treeUtils as k,
4026
+ registerMdcLibrary as l,
4027
+ Evt as m,
4028
+ Component as n,
4029
+ objToPaths as o,
4030
+ path as p,
4031
+ UiEventType as q,
4032
+ registerCarbonLibrary as r,
4033
+ Conductor as s,
4034
+ toLowerCase as t,
4035
+ u$1 as u,
4036
+ domUtils as v,
4037
+ uriUtils as w,
4038
+ x,
4039
+ handlers as y,
4040
+ zooy as z
4041
+ };