@sbb-esta/lyne-elements-experimental 4.7.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +66 -85
  2. package/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +72 -53
  3. package/autocomplete-grid/autocomplete-grid-button.js +4 -4
  4. package/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +2 -25
  5. package/autocomplete-grid/autocomplete-grid-cell.js +4 -4
  6. package/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +20 -28
  7. package/autocomplete-grid/autocomplete-grid-optgroup.js +4 -4
  8. package/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +2 -41
  9. package/autocomplete-grid/autocomplete-grid-option.js +4 -5
  10. package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +2 -28
  11. package/autocomplete-grid/autocomplete-grid-row.js +4 -4
  12. package/autocomplete-grid/autocomplete-grid.js +4 -4
  13. package/autocomplete-grid-cell.component-Dak9wlBr.js +24 -0
  14. package/autocomplete-grid-option.component-DNRFHOwc.js +37 -0
  15. package/autocomplete-grid-row.component-DBHZQ0GQ.js +27 -0
  16. package/autocomplete-grid.js +10 -15
  17. package/autocomplete-grid.pure.js +7 -0
  18. package/core/datetime/date-helper.js +2 -191
  19. package/core/datetime.js +2 -5
  20. package/core/timetable/access-leg-helper.js +76 -71
  21. package/core/timetable/timetable-helper.js +9 -11
  22. package/core/timetable/timetable-properties.js +0 -1
  23. package/core/timetable.js +3 -7
  24. package/custom-elements.json +457 -368
  25. package/date-helper-CGproP5d.js +185 -0
  26. package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts +2 -1
  27. package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts.map +1 -1
  28. package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +115 -136
  29. package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts +3 -2
  30. package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts.map +1 -1
  31. package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +92 -71
  32. package/development/autocomplete-grid/autocomplete-grid-button.d.ts +0 -3
  33. package/development/autocomplete-grid/autocomplete-grid-button.d.ts.map +1 -1
  34. package/development/autocomplete-grid/autocomplete-grid-button.js +9 -4
  35. package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts +4 -4
  36. package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts.map +1 -1
  37. package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +2 -41
  38. package/development/autocomplete-grid/autocomplete-grid-cell.d.ts +0 -3
  39. package/development/autocomplete-grid/autocomplete-grid-cell.d.ts.map +1 -1
  40. package/development/autocomplete-grid/autocomplete-grid-cell.js +10 -5
  41. package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts +3 -2
  42. package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts.map +1 -1
  43. package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +28 -38
  44. package/development/autocomplete-grid/autocomplete-grid-optgroup.d.ts +0 -3
  45. package/development/autocomplete-grid/autocomplete-grid-optgroup.d.ts.map +1 -1
  46. package/development/autocomplete-grid/autocomplete-grid-optgroup.js +9 -4
  47. package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts +1 -0
  48. package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts.map +1 -1
  49. package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +2 -121
  50. package/development/autocomplete-grid/autocomplete-grid-option.d.ts +0 -3
  51. package/development/autocomplete-grid/autocomplete-grid-option.d.ts.map +1 -1
  52. package/development/autocomplete-grid/autocomplete-grid-option.js +10 -6
  53. package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts +4 -4
  54. package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts.map +1 -1
  55. package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +2 -103
  56. package/development/autocomplete-grid/autocomplete-grid-row.d.ts +0 -3
  57. package/development/autocomplete-grid/autocomplete-grid-row.d.ts.map +1 -1
  58. package/development/autocomplete-grid/autocomplete-grid-row.js +10 -5
  59. package/development/autocomplete-grid/autocomplete-grid.d.ts +0 -3
  60. package/development/autocomplete-grid/autocomplete-grid.d.ts.map +1 -1
  61. package/development/autocomplete-grid/autocomplete-grid.js +9 -4
  62. package/development/autocomplete-grid-cell.component-BBvM4o2H.js +42 -0
  63. package/development/autocomplete-grid-option.component-QzfM5eIE.js +123 -0
  64. package/development/autocomplete-grid-row.component-H8sCTCkT.js +104 -0
  65. package/development/autocomplete-grid.d.ts +1 -9
  66. package/development/autocomplete-grid.d.ts.map +1 -1
  67. package/development/autocomplete-grid.js +17 -14
  68. package/development/autocomplete-grid.pure.d.ts +8 -0
  69. package/development/autocomplete-grid.pure.d.ts.map +1 -0
  70. package/development/autocomplete-grid.pure.js +7 -0
  71. package/development/core/datetime/date-helper.js +2 -285
  72. package/development/core/datetime.d.ts +1 -3
  73. package/development/core/datetime.d.ts.map +1 -1
  74. package/development/core/datetime.js +2 -6
  75. package/development/core/timetable/access-leg-helper.js +104 -82
  76. package/development/core/timetable/timetable-helper.js +16 -17
  77. package/development/core/timetable/timetable-properties.d.ts +30 -30
  78. package/development/core/timetable/timetable-properties.d.ts.map +1 -1
  79. package/development/core/timetable/timetable-properties.js +0 -2
  80. package/development/core/timetable.d.ts +1 -3
  81. package/development/core/timetable.d.ts.map +1 -1
  82. package/development/core/timetable.js +3 -8
  83. package/development/date-helper-8_Y-PuHh.js +520 -0
  84. package/development/differenceInMinutes-DN_1Rk3O.js +110 -0
  85. package/development/format-Bbrn2bgo.js +1848 -0
  86. package/development/isValid-C-HzKv4v.js +178 -0
  87. package/development/journey-summary/journey-summary.component.d.ts +4 -2
  88. package/development/journey-summary/journey-summary.component.d.ts.map +1 -1
  89. package/development/journey-summary/journey-summary.component.js +2 -294
  90. package/development/journey-summary.component-uGhZvA4p.js +385 -0
  91. package/development/journey-summary.d.ts +1 -4
  92. package/development/journey-summary.d.ts.map +1 -1
  93. package/development/journey-summary.js +9 -5
  94. package/development/journey-summary.pure.d.ts +3 -0
  95. package/development/journey-summary.pure.d.ts.map +1 -0
  96. package/development/journey-summary.pure.js +2 -0
  97. package/development/mapper-hWWm7Uke.js +11454 -0
  98. package/development/pearl-chain/pearl-chain.component.d.ts +4 -2
  99. package/development/pearl-chain/pearl-chain.component.d.ts.map +1 -1
  100. package/development/pearl-chain/pearl-chain.component.js +2 -640
  101. package/development/pearl-chain-time/pearl-chain-time.component.d.ts +4 -2
  102. package/development/pearl-chain-time/pearl-chain-time.component.d.ts.map +1 -1
  103. package/development/pearl-chain-time/pearl-chain-time.component.js +2 -312
  104. package/development/pearl-chain-time.component-B8mayTWD.js +415 -0
  105. package/development/pearl-chain-time.d.ts +1 -4
  106. package/development/pearl-chain-time.d.ts.map +1 -1
  107. package/development/pearl-chain-time.js +9 -5
  108. package/development/pearl-chain-time.pure.d.ts +3 -0
  109. package/development/pearl-chain-time.pure.d.ts.map +1 -0
  110. package/development/pearl-chain-time.pure.js +2 -0
  111. package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts +4 -2
  112. package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts.map +1 -1
  113. package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +2 -40
  114. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts +4 -2
  115. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts.map +1 -1
  116. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +2 -399
  117. package/development/pearl-chain-vertical-item.component-BDzbcIaf.js +435 -0
  118. package/development/pearl-chain-vertical-item.d.ts +1 -4
  119. package/development/pearl-chain-vertical-item.d.ts.map +1 -1
  120. package/development/pearl-chain-vertical-item.js +9 -5
  121. package/development/pearl-chain-vertical-item.pure.d.ts +3 -0
  122. package/development/pearl-chain-vertical-item.pure.d.ts.map +1 -0
  123. package/development/pearl-chain-vertical-item.pure.js +2 -0
  124. package/development/pearl-chain-vertical.component-CswE7b3M.js +39 -0
  125. package/development/pearl-chain-vertical.d.ts +1 -4
  126. package/development/pearl-chain-vertical.d.ts.map +1 -1
  127. package/development/pearl-chain-vertical.js +9 -5
  128. package/development/pearl-chain-vertical.pure.d.ts +3 -0
  129. package/development/pearl-chain-vertical.pure.d.ts.map +1 -0
  130. package/development/pearl-chain-vertical.pure.js +2 -0
  131. package/development/pearl-chain.component-wpsTvoSe.js +704 -0
  132. package/development/pearl-chain.d.ts +1 -4
  133. package/development/pearl-chain.d.ts.map +1 -1
  134. package/development/pearl-chain.js +9 -5
  135. package/development/pearl-chain.pure.d.ts +3 -0
  136. package/development/pearl-chain.pure.d.ts.map +1 -0
  137. package/development/pearl-chain.pure.js +2 -0
  138. package/development/seat-reservation/common/mapper/icon-mapper.d.ts +2 -2
  139. package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
  140. package/development/seat-reservation/common/mapper/icon-mapper.js +168 -71
  141. package/development/seat-reservation/common/mapper/mapper.js +2 -131
  142. package/development/seat-reservation/common/mapper.js +2 -9
  143. package/development/seat-reservation/common/svgs.js +2 -46
  144. package/development/seat-reservation/common/translations/i18n.js +1118 -900
  145. package/development/seat-reservation/common/translations.js +1 -4
  146. package/development/seat-reservation/common/types.d.ts +22 -22
  147. package/development/seat-reservation/common/types.d.ts.map +1 -1
  148. package/development/seat-reservation/common/types.js +0 -2
  149. package/development/seat-reservation/common.d.ts +1 -3
  150. package/development/seat-reservation/common.d.ts.map +1 -1
  151. package/development/seat-reservation/common.js +10 -12
  152. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +4 -3
  153. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  154. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +1309 -1231
  155. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +1 -0
  156. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  157. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +2 -867
  158. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts +4 -2
  159. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts.map +1 -1
  160. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +2 -112
  161. package/development/seat-reservation/seat-reservation-area.d.ts +0 -3
  162. package/development/seat-reservation/seat-reservation-area.d.ts.map +1 -1
  163. package/development/seat-reservation/seat-reservation-area.js +10 -5
  164. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
  165. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +39 -36
  166. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts +4 -2
  167. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts.map +1 -1
  168. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +2 -167
  169. package/development/seat-reservation/seat-reservation-graphic.d.ts +0 -3
  170. package/development/seat-reservation/seat-reservation-graphic.d.ts.map +1 -1
  171. package/development/seat-reservation/seat-reservation-graphic.js +10 -5
  172. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +5 -3
  173. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  174. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +2 -718
  175. package/development/seat-reservation/seat-reservation-navigation-coach.d.ts +0 -3
  176. package/development/seat-reservation/seat-reservation-navigation-coach.d.ts.map +1 -1
  177. package/development/seat-reservation/seat-reservation-navigation-coach.js +10 -5
  178. package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts +4 -2
  179. package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +1 -1
  180. package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +2 -136
  181. package/development/seat-reservation/seat-reservation-navigation-services.d.ts +0 -3
  182. package/development/seat-reservation/seat-reservation-navigation-services.d.ts.map +1 -1
  183. package/development/seat-reservation/seat-reservation-navigation-services.js +10 -5
  184. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +2 -1
  185. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
  186. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +2 -607
  187. package/development/seat-reservation/seat-reservation-place-control.d.ts +0 -3
  188. package/development/seat-reservation/seat-reservation-place-control.d.ts.map +1 -1
  189. package/development/seat-reservation/seat-reservation-place-control.js +10 -5
  190. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +4 -2
  191. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
  192. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +2 -34
  193. package/development/seat-reservation/seat-reservation-scoped.d.ts +0 -3
  194. package/development/seat-reservation/seat-reservation-scoped.d.ts.map +1 -1
  195. package/development/seat-reservation/seat-reservation-scoped.js +10 -5
  196. package/development/seat-reservation/seat-reservation.d.ts +0 -3
  197. package/development/seat-reservation/seat-reservation.d.ts.map +1 -1
  198. package/development/seat-reservation/seat-reservation.js +10 -6
  199. package/development/seat-reservation-area.component-ORuli_DC.js +138 -0
  200. package/development/seat-reservation-graphic.component-lZXqHWIz.js +193 -0
  201. package/development/seat-reservation-navigation-coach.component-D2QXTMJJ.js +828 -0
  202. package/development/seat-reservation-navigation-services.component-Bg1adRlU.js +179 -0
  203. package/development/seat-reservation-place-control.component-CwUX-QYO.js +726 -0
  204. package/development/seat-reservation-scoped.component-uLT33P9y.js +31 -0
  205. package/development/seat-reservation.component-MOv5kHDC.js +821 -0
  206. package/development/seat-reservation.d.ts +1 -11
  207. package/development/seat-reservation.d.ts.map +1 -1
  208. package/development/seat-reservation.js +24 -27
  209. package/development/seat-reservation.pure.d.ts +15 -0
  210. package/development/seat-reservation.pure.d.ts.map +1 -0
  211. package/development/seat-reservation.pure.js +15 -0
  212. package/development/svgs-kDpBCto5.js +28 -0
  213. package/development/timetable-duration/timetable-duration.component.d.ts +4 -2
  214. package/development/timetable-duration/timetable-duration.component.d.ts.map +1 -1
  215. package/development/timetable-duration/timetable-duration.component.js +2 -114
  216. package/development/timetable-duration.component-D21SXsQq.js +125 -0
  217. package/development/timetable-duration.d.ts +1 -4
  218. package/development/timetable-duration.d.ts.map +1 -1
  219. package/development/timetable-duration.js +9 -5
  220. package/development/timetable-duration.pure.d.ts +3 -0
  221. package/development/timetable-duration.pure.d.ts.map +1 -0
  222. package/development/timetable-duration.pure.js +2 -0
  223. package/development/timetable-row/timetable-row.component.d.ts +4 -2
  224. package/development/timetable-row/timetable-row.component.d.ts.map +1 -1
  225. package/development/timetable-row/timetable-row.component.js +2 -787
  226. package/development/timetable-row.component-Y5w8vEwP.js +932 -0
  227. package/development/timetable-row.d.ts +1 -4
  228. package/development/timetable-row.d.ts.map +1 -1
  229. package/development/timetable-row.js +9 -12
  230. package/development/timetable-row.pure.d.ts +3 -0
  231. package/development/timetable-row.pure.d.ts.map +1 -0
  232. package/development/timetable-row.pure.js +2 -0
  233. package/development/toDate-Biiv3kyf.js +150 -0
  234. package/differenceInMinutes-Dr9gRqtu.js +27 -0
  235. package/format-CM5exOsN.js +1103 -0
  236. package/index.d.ts +9 -20
  237. package/index.js +9 -20
  238. package/isValid-B9oVW3lA.js +36 -0
  239. package/journey-summary/journey-summary.component.js +2 -193
  240. package/journey-summary.component-Cq_4kaOp.js +264 -0
  241. package/journey-summary.js +6 -4
  242. package/journey-summary.pure.js +2 -0
  243. package/mapper-DkiDDseD.js +11382 -0
  244. package/package.json +47 -2
  245. package/pearl-chain/pearl-chain.component.js +2 -164
  246. package/pearl-chain-time/pearl-chain-time.component.js +2 -156
  247. package/pearl-chain-time.component-DGDW5S1c.js +239 -0
  248. package/pearl-chain-time.js +6 -4
  249. package/pearl-chain-time.pure.js +2 -0
  250. package/pearl-chain-vertical/pearl-chain-vertical.component.js +2 -24
  251. package/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +2 -76
  252. package/pearl-chain-vertical-item.component-G22bWhLU.js +108 -0
  253. package/pearl-chain-vertical-item.js +6 -4
  254. package/pearl-chain-vertical-item.pure.js +2 -0
  255. package/pearl-chain-vertical.component-CXIDT5RD.js +21 -0
  256. package/pearl-chain-vertical.js +6 -4
  257. package/pearl-chain-vertical.pure.js +2 -0
  258. package/pearl-chain.component-DmjkVIva.js +194 -0
  259. package/pearl-chain.js +6 -4
  260. package/pearl-chain.pure.js +2 -0
  261. package/seat-reservation/common/mapper/icon-mapper.js +71 -71
  262. package/seat-reservation/common/mapper/mapper.js +2 -91
  263. package/seat-reservation/common/mapper.js +3 -9
  264. package/seat-reservation/common/svgs.js +2 -243
  265. package/seat-reservation/common/translations/i18n.js +1084 -891
  266. package/seat-reservation/common/translations.js +2 -4
  267. package/seat-reservation/common/types.js +0 -1
  268. package/seat-reservation/common.js +9 -13
  269. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +834 -809
  270. package/seat-reservation/seat-reservation/seat-reservation.component.js +2 -422
  271. package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +2 -50
  272. package/seat-reservation/seat-reservation-area.js +4 -4
  273. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +69 -70
  274. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +2 -73
  275. package/seat-reservation/seat-reservation-graphic.js +4 -4
  276. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +2 -232
  277. package/seat-reservation/seat-reservation-navigation-coach.js +4 -4
  278. package/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +2 -83
  279. package/seat-reservation/seat-reservation-navigation-services.js +4 -4
  280. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +2 -202
  281. package/seat-reservation/seat-reservation-place-control.js +4 -4
  282. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +2 -20
  283. package/seat-reservation/seat-reservation-scoped.js +4 -4
  284. package/seat-reservation/seat-reservation.js +5 -6
  285. package/seat-reservation-area.component-COD6CXhP.js +75 -0
  286. package/seat-reservation-graphic.component-BNfU5tQM.js +102 -0
  287. package/seat-reservation-navigation-coach.component-Bh9ILq60.js +333 -0
  288. package/seat-reservation-navigation-services.component-QL0UnilZ.js +127 -0
  289. package/seat-reservation-place-control.component-BfnZUyHv.js +322 -0
  290. package/seat-reservation-scoped.component-CY04BT_4.js +17 -0
  291. package/seat-reservation.component-zrQHTRl3.js +364 -0
  292. package/seat-reservation.js +17 -29
  293. package/seat-reservation.pure.js +15 -0
  294. package/svgs-D5DhLHxC.js +26 -0
  295. package/timetable-duration/timetable-duration.component.js +2 -56
  296. package/timetable-duration.component-DaYoJUGS.js +65 -0
  297. package/timetable-duration.js +6 -4
  298. package/timetable-duration.pure.js +2 -0
  299. package/timetable-row/timetable-row.component.js +2 -426
  300. package/timetable-row.component-BDMAEsbR.js +559 -0
  301. package/timetable-row.js +6 -11
  302. package/timetable-row.pure.js +2 -0
  303. package/toDate-p-Tpkb7t.js +16 -0
  304. package/development/differenceInMinutes-B0dawX-5.js +0 -26
  305. package/development/format-BMkeaqaF.js +0 -1433
  306. package/development/isValid-BYRch7pV.js +0 -53
  307. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.d.ts +0 -69
  308. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.d.ts.map +0 -1
  309. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.js +0 -559
  310. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.d.ts +0 -123
  311. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.d.ts.map +0 -1
  312. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.js +0 -972
  313. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.d.ts +0 -114
  314. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.d.ts.map +0 -1
  315. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.js +0 -20368
  316. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.d.ts +0 -85
  317. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.d.ts.map +0 -1
  318. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.js +0 -1739
  319. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.d.ts +0 -69
  320. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.d.ts.map +0 -1
  321. package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.js +0 -9783
  322. package/development/toDate-BWb6Z1JD.js +0 -24
  323. package/differenceInMinutes-COvvdYsJ.js +0 -23
  324. package/format-CmKROkbc.js +0 -1186
  325. package/isValid-m3_OsPaB.js +0 -45
  326. package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.js +0 -558
  327. package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.js +0 -970
  328. package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.js +0 -20367
  329. package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.js +0 -1738
  330. package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.js +0 -9782
  331. package/toDate-Bw2KTWeq.js +0 -15
@@ -1,810 +1,835 @@
1
- var ye = (h) => {
2
- throw TypeError(h);
3
- };
4
- var be = (h, d, f) => d.has(h) || ye("Cannot " + f);
5
- var u = (h, d, f) => (be(h, d, "read from private field"), f ? f.call(h) : d.get(h)), g = (h, d, f) => d.has(h) ? ye("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(h) : d.set(h, f), r = (h, d, f, B) => (be(h, d, "write to private field"), B ? B.call(h, f) : d.set(h, f), f);
6
- import { __esDecorate as v, __runInitializers as n } from "tslib";
7
- import { isArrowKeyOrPageKeysPressed as Pe } from "@sbb-esta/lyne-elements/core/a11y.js";
8
- import { forceType as S } from "@sbb-esta/lyne-elements/core/decorators.js";
9
- import { LitElement as Ee, isServer as Re } from "lit";
10
- import { property as C, state as z, eventOptions as Ne } from "lit/decorators.js";
11
- import { mapIconToSvg as Ae, mapPlaceInfosToPlaceSelection as ke, mapPlaceAndCoachToSeatReservationPlaceSelection as De, mapCoachInfosToCoachSelection as Te } from "../common/mapper.js";
12
- var I;
13
- (function(h) {
14
- h.right = "right", h.left = "left";
15
- })(I || (I = {}));
16
- const we = 3, Be = [
17
- "sa-vo",
18
- "sa-rs",
19
- "sa-abteilkinderwagen",
20
- "sa-wr",
21
- "sa-fa",
22
- "sa-bz",
23
- "sa-rz"
24
- ];
25
- let Me = (() => {
26
- var x, p, _, m, y, b, P, A, E, R, N, k, D, T, l;
27
- let h = Ee, d = [], f, B = [], O = [], V, F = [], G = [], L, W = [], H = [], M, K = [], X = [], U, q = [], $ = [], j, Y = [], J = [], Q, Z = [], ee = [], te, se = [], ie = [], ae, ce = [], oe = [], re, ne = [], le = [], he, de = [], ue = [], ge, ve = [], fe = [], Ce, Se = [], Ie = [], xe, pe = [], _e = [], me;
28
- return l = class extends h {
29
- constructor() {
30
- super();
31
- g(this, x);
32
- g(this, p);
33
- g(this, _);
34
- g(this, m);
35
- g(this, y);
36
- g(this, b);
37
- g(this, P);
38
- g(this, A);
39
- g(this, E);
40
- g(this, R);
41
- g(this, N);
42
- g(this, k);
43
- g(this, D);
44
- g(this, T);
45
- r(this, x, (n(this, d), n(this, B, null))), r(this, p, (n(this, O), n(this, F, "NONE"))), r(this, _, (n(this, G), n(this, W, !0))), r(this, m, (n(this, H), n(this, K, !1))), r(this, y, (n(this, X), n(this, q, 16))), r(this, b, (n(this, $), n(this, Y, null))), r(this, P, (n(this, J), n(this, Z, -1))), r(this, A, (n(this, ee), n(this, se, -1))), r(this, E, (n(this, ie), n(this, ce, !1))), r(this, R, (n(this, oe), n(this, ne, -1))), r(this, N, (n(this, le), n(this, de, !1))), r(this, k, (n(this, ue), n(this, ve, -1))), r(this, D, (n(this, fe), n(this, Se, -1))), r(this, T, (n(this, Ie), n(this, pe, -1))), this.coachBorderPadding = (n(this, _e), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachItemDetailsElements = [], this.currScrollDirection = I.right, this.maxCalcCoachesWidth = 0, this.scrollCoachesAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
46
- seats: [],
47
- bicycles: []
48
- }, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
49
- ArrowLeft: "ArrowLeft",
50
- ArrowRight: "ArrowRight",
51
- ArrowUp: "ArrowUp",
52
- ArrowDown: "ArrowDown",
53
- Tab: "Tab",
54
- Enter: "Enter"
55
- }, this.notAreaElements = [
56
- "DRIVER_AREA",
57
- "DRIVER_AREA_NO_VERTICAL_WALL",
58
- "COACH_PASSAGE",
59
- "COACH_WALL_NO_PASSAGE",
60
- "COMPARTMENT_PASSAGE",
61
- "COMPARTMENT_PASSAGE_HIGH",
62
- "COMPARTMENT_PASSAGE_MIDDLE",
63
- "COMPARTMENT_PASSAGE_LOW"
64
- ], this.overHangingElementInformation = [], this._isRunningInitPreselectCoachIndex = !1, this._lastStartScrollPos = -1, this._prepareServiceIconsNavigation = (e) => {
65
- if (!e)
66
- return [];
67
- const t = e?.map(function(s) {
68
- return {
69
- pId: s,
70
- svgName: Ae[s]?.svgName ? Ae[s]?.svgName : ""
71
- };
72
- }).filter((s) => Be.indexOf(s.svgName) !== -1).filter((s, i, a) => a.map((o) => o.svgName).indexOf(s.svgName) === i).map((s) => s.pId).slice(0, we);
73
- return t || [];
74
- }, this.addEventListener("blur", () => this._onLeaveSeatReservationComponent());
75
- }
76
- /** The seat reservations array contains all coaches and places */
77
- get seatReservations() {
78
- return u(this, x);
79
- }
80
- set seatReservations(e) {
81
- r(this, x, e);
82
- }
83
- /** Displays an arrow showing what direction does train drive*/
84
- get travelDirection() {
85
- return u(this, p);
86
- }
87
- set travelDirection(e) {
88
- r(this, p, e);
89
- }
90
- /** The seat reservation navigation can be toggled by this property */
91
- get hasNavigation() {
92
- return u(this, _);
93
- }
94
- set hasNavigation(e) {
95
- r(this, _, e);
96
- }
97
- /** The seat reservation area is aligned vertically */
98
- get alignVertical() {
99
- return u(this, m);
100
- }
101
- set alignVertical(e) {
102
- r(this, m, e);
103
- }
104
- /** The seat reservation area's base grid size */
105
- get baseGridSize() {
106
- return u(this, y);
107
- }
108
- set baseGridSize(e) {
109
- r(this, y, e);
110
- }
111
- /** The seat reservation area's width */
112
- get height() {
113
- return u(this, b);
114
- }
115
- set height(e) {
116
- r(this, b, e);
117
- }
118
- /** Maximal number of possible clickable seats */
119
- get maxSeatReservations() {
120
- return u(this, P);
121
- }
122
- set maxSeatReservations(e) {
123
- r(this, P, e);
124
- }
125
- /** Maximal number of possible clickable bicycle places */
126
- get maxBicycleReservations() {
127
- return u(this, A);
128
- }
129
- set maxBicycleReservations(e) {
130
- r(this, A, e);
131
- }
132
- /** Any click functionality is prevented */
133
- get preventPlaceClick() {
134
- return u(this, E);
135
- }
136
- set preventPlaceClick(e) {
137
- r(this, E, e);
138
- }
139
- get preselectCoachIndex() {
140
- return u(this, R);
141
- }
142
- set preselectCoachIndex(e) {
143
- r(this, R, e);
144
- }
145
- /** The seat reservation title information at place-controls, navigation-coaches and navigation-services can be toggled by this property */
146
- get showTitleInfo() {
147
- return u(this, N);
148
- }
149
- set showTitleInfo(e) {
150
- r(this, N, e);
151
- }
152
- get selectedCoachIndex() {
153
- return u(this, k);
154
- }
155
- set selectedCoachIndex(e) {
156
- r(this, k, e);
157
- }
158
- get focusedCoachIndex() {
159
- return u(this, D);
160
- }
161
- set focusedCoachIndex(e) {
162
- r(this, D, e);
163
- }
164
- get hoveredCoachIndex() {
165
- return u(this, T);
166
- }
167
- set hoveredCoachIndex(e) {
168
- r(this, T, e);
169
- }
170
- willUpdate(e) {
171
- if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initPrepareSeatReservationData(), this._prepareCoachWidthAndGapCalculations(), this._initSeatReservationPlaceSelection(), this.initNavigationSelectionByScrollEvent()), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
172
- const t = this.seatReservations[this.currSelectedDeckIndex] || null;
173
- t?.coachItems.length && (this.baseGridSize = this.height / t.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent());
174
- }
175
- e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && (this._isRunningInitPreselectCoachIndex = !0, setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1));
176
- }
177
- navigateByDirectionBtn(e) {
178
- this.unfocusPlaceElement();
179
- let t = this.currSelectedCoachIndex;
180
- e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex - 1 : 0 : e == "DIRECTION_RIGHT" && t < this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length - 1 && (t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex + 1 : 0), this.scrollToSelectedNavCoach(t);
181
- }
182
- /**
183
- * Data can be prepared once for the entire component
184
- * in order to avoid recurring iteration processes in rendering.
185
- */
186
- _initPrepareSeatReservationData() {
187
- this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this._prepareCoachItemDetailsData();
188
- }
189
- /** Init scroll event handling for coach navigation */
190
- initNavigationSelectionByScrollEvent() {
191
- this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr__navigation-list-coaches");
192
- const e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
193
- if (e && e.coachItems.length > 0) {
194
- const t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, s = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
195
- this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + s}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
196
- }
197
- if (this.navigationScrollArea) {
198
- this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
199
- const t = this.navigationScrollArea.querySelector("ul > li");
200
- if (t) {
201
- const s = t?.getBoundingClientRect();
202
- this.coachNavButtonDim = this.alignVertical ? s.height : s.width;
203
- }
204
- }
205
- if (this.coachScrollArea && e) {
206
- let t = 0;
207
- this.scrollCoachesAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((s) => {
208
- const i = t, a = this.getCalculatedDimension(s.dimension).w, o = this.overHangingElementInformation.find((w) => w.coachId === s.id), c = o?.overhangingPlaces || o?.overhangingGraphicAreas;
209
- return t += a + (c ? 2 * this.gapBetweenCoaches : this.gapBetweenCoaches), {
210
- start: i,
211
- end: t,
212
- width: a
213
- };
214
- }), this.maxCalcCoachesWidth = t - this.gapBetweenCoaches;
215
- }
216
- }
217
- /**
218
- * Scroll event handler managed the end of scrolling inside the coach scroll area.
219
- * Timeout event handling to check if the scrolling has been completed.
220
- * It is required because the Safari browser does not handle scrollend event,
221
- * and we therefore imitate this event -> scrollend.
222
- */
223
- coachAreaScrollend() {
224
- this._scrollTimeout && clearTimeout(this._scrollTimeout), this._scrollTimeout = setTimeout(() => this._handleCoachAreaScrollendEvent(), 150);
225
- }
226
- /**
227
- * If no navigation exists (property setting -> hasNavigation) and a table coach gets the focus,
228
- * the first place in the coach must be automatically preselected to control the place navigation via keyboard
229
- *
230
- * @param focusCoachIndex
231
- */
232
- onFocusTableCoachAndPreselectPlace(e) {
233
- !this.seatReservationWithoutNavigationHasFocus && !this.hasNavigation && (this.seatReservationWithoutNavigationHasFocus = !0, this.currSelectedCoachIndex = e === 0 ? this.getNextAvailableCoachIndex(-1) : this.getPrevAvailableCoachIndex(e), this.preselectPlaceInCoach());
234
- }
235
- /** Will be triggered by focus navigation direction */
236
- onFocusNavDirectionButton() {
237
- this.focusedCoachIndex = -1;
238
- }
239
- /** TAB Key Event handling for Coach Navigation */
240
- onKeyNavigationNavCoachButton(e, t) {
241
- if (e.key === this.keyboardNavigationEvents.Tab) {
242
- this._handleTabKeyNavigation(e, "navigation", t);
243
- return;
244
- }
245
- Pe(e) && this.keyboardSeatmapEventHandling(e);
246
- }
247
- /** General TAB Key Event handling for tab navigation inside the coach navigation area and the seatmap area */
248
- _handleTabKeyNavigation(e, t, s) {
249
- const i = e.key, a = e.shiftKey;
250
- i === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (s == this.currSelectedCoachIndex ? !this.currSelectedPlace || !a || this.coachItemDetailsElements[s].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = s : a && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = s, this._scrollToSelectedNavigationButton(s)) : t == "seatmap" && (e.preventDefault(), a ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
251
- }
252
- /**
253
- * Initialisation of Keyboard Seatmap event handling to navigation between each places inside a selected coach by using [arrow] keys.
254
- * With the [TAB] key the user navigation goes to the next coach navigation element and the currently selected place is automatically reset.
255
- */
256
- keyboardSeatmapEventHandling(e) {
257
- const t = e.key === this.keyboardNavigationEvents.Tab, s = e.shiftKey && t;
258
- if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && s || this.currSelectedCoachIndex === this.coachItemDetailsElements.length - 1 && t)
259
- return;
260
- const i = e.key;
261
- if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (t || s) && (this.hasSeatReservationNativeFocus = !0), t) {
262
- this._handleTabKeyNavigation(e, "seatmap");
263
- return;
264
- }
265
- if (this.currSelectedCoachIndex !== -1 && Pe(e))
266
- switch (e.preventDefault(), i) {
267
- case this.keyboardNavigationEvents.ArrowLeft:
268
- {
269
- const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : i;
270
- this._navigateToPlaceByKeyboard(a);
271
- }
272
- break;
273
- case this.keyboardNavigationEvents.ArrowRight:
274
- {
275
- const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : i;
276
- this._navigateToPlaceByKeyboard(a);
277
- }
278
- break;
279
- case this.keyboardNavigationEvents.ArrowUp:
280
- {
281
- const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : i;
282
- this._navigateToPlaceByKeyboard(a);
283
- }
284
- break;
285
- case this.keyboardNavigationEvents.ArrowDown:
286
- {
287
- const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : i;
288
- this._navigateToPlaceByKeyboard(a);
289
- }
290
- break;
291
- }
292
- }
293
- /**
294
- * Selects a place inside the coach if navigated via keyboard,
295
- * otherwise the coach grid is selected (necessary for ScreenReader)
296
- */
297
- preselectPlaceInCoach() {
298
- if (this.isAutoScrolling) {
299
- if (this._isRunningInitPreselectCoachIndex) {
300
- this._isRunningInitPreselectCoachIndex = !1;
301
- return;
302
- }
303
- if (this.coachItemDetailsElements[this.currSelectedCoachIndex] && this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea) {
304
- this._setFocusToSelectedCoachGrid();
305
- return;
306
- }
307
- if (this.isKeyboardNavigation && this.isAutoScrolling) {
308
- const e = this._getClosestPlaceByKeyDirection();
309
- e ? (this.unfocusPlaceElement(), this.focusPlaceElement(e), this.focusedCoachIndex = -1) : this._setFocusToSelectedCoachGrid();
310
- } else
311
- this.unfocusPlaceElement(), this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid();
312
- }
313
- }
314
- scrollToSelectedNavCoach(e) {
315
- if (this._isValidCoachIndex(e) && e !== this.currSelectedCoachIndex) {
316
- this.hoveredCoachIndex = e, this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
317
- const t = this._getCoachScrollPositionX();
318
- (this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? (this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.coachScrollArea.scrollTo({
319
- top: this.alignVertical ? t : 0,
320
- left: this.alignVertical ? 0 : t,
321
- behavior: "smooth"
322
- })) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
323
- }
324
- }
325
- focusPlaceElement(e) {
326
- if (this.unfocusPlaceElement(), e) {
327
- this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
328
- const t = this._getPlaceHtmlElement();
329
- if (t) {
330
- t.setAttribute("keyfocus", "focus");
331
- const s = setTimeout(() => {
332
- const i = this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number);
333
- this._scrollPlaceIntoNearestViewport(i), clearTimeout(s);
334
- }, 0);
335
- }
336
- }
337
- }
338
- unfocusPlaceElement() {
339
- const e = this._getPlaceHtmlElement();
340
- e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
341
- }
342
- getCalculatedDimension(e, t, s, i) {
343
- return t && !s && (e.h += this.coachBorderOffset * 2), i && (e.h += this.coachBorderOffset), {
344
- w: this.baseGridSize * e.w,
345
- h: this.baseGridSize * e.h
346
- };
347
- }
348
- getCalculatedPosition(e, t, s, i) {
349
- if (s && t) {
350
- const a = i ? s.h : s.h + this.coachBorderOffset;
351
- e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === a && (e.y += this.coachBorderOffset);
352
- }
353
- return {
354
- x: this.baseGridSize * e.x,
355
- y: this.baseGridSize * e.y,
356
- z: e.z
357
- };
358
- }
359
- /**
360
- * detects if a (graphical) element is on the border with its position (upper or lower border).
361
- * @param baseElement
362
- * @param coachDimension
363
- * @protected
364
- */
365
- isElementDirectlyOnBorder(e, t) {
366
- return e.position.y === 0 || e.position.y + e.dimension.h === t.h;
367
- }
368
- /**
369
- * Counts all available seats together depending on the seat type
370
- *
371
- * @param places
372
- * @returns An Object with count of free seats and free bicycle places
373
- */
374
- getAvailableFreePlacesNumFromCoach(e) {
375
- const t = { seats: 0, bicycles: 0 }, s = e?.reduce((i, a) => (a.state !== "FREE" || (a.type === "SEAT" ? i.seats++ : i.bicycles++), i), t);
376
- return s || t;
377
- }
378
- /**
379
- * At the end of a scroll Event from the coach scrollable area,
380
- * the reached coach is marked as selected
381
- */
382
- _handleCoachAreaScrollendEvent() {
383
- const e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
384
- if (this.preventCoachScrollByPlaceClick) {
385
- Math.abs(this._lastStartScrollPos - this.coachScrollArea.scrollLeft) > this.baseGridSize * 2 && (this.selectedCoachIndex = e), this.preventCoachScrollByPlaceClick = !1;
386
- return;
387
- }
388
- this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.hoveredCoachIndex = -1, this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = e), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = e : this.currSelectedCoachIndex = e < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : e, this.isAutoScrolling || this._scrollToSelectedNavigationButton(e), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
389
- }
390
- /**
391
- * Performs an automatic main navigation scroll to the specified selectedNavCoachIndex.
392
- * Calculates the central scroll offset of the nav coach to be selected.
393
- * @param selectedNavCoachIndex
394
- */
395
- _scrollToSelectedNavigationButton(e) {
396
- setTimeout(() => {
397
- if (this.hasNavigation && this.navigationScrollArea) {
398
- const t = this.scrollNavigationAreaDim / 2, i = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
399
- this.navigationScrollArea.scrollTo({
400
- top: this.alignVertical ? i : 0,
401
- left: this.alignVertical ? 0 : i,
402
- behavior: "smooth"
403
- });
404
- }
405
- }, 10);
406
- }
407
- /**
408
- * Sets the new ScrollDirection by the new given target coach index.
409
- */
410
- _setScrollDirectionByCoachIndex() {
411
- this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? I.right : I.left;
412
- }
413
- /**
414
- * Returns the scroll start or end position X from the selected coach.
415
- * In case the user is currently navigating through places by keyboard and goes to previous coach,
416
- * then we return the end position of the coach to get the closest scroll position of the next focus place.
417
- * @returns number
418
- */
419
- _getCoachScrollPositionX() {
420
- const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
421
- return this.isKeyboardNavigation && this.currScrollDirection === I.left && e.width > this.scrollCoachesAreaWidth ? e.end - this.scrollCoachesAreaWidth : e.start;
422
- }
423
- /**
424
- * Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
425
- */
426
- _setFocusToSelectedCoachGrid() {
427
- if (this.isCoachGridFocusable && this.hasSeatReservationNativeFocus) {
428
- this.isCoachGridFocusable = !1;
429
- const e = this.shadowRoot?.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
430
- e && e.focus();
431
- }
432
- }
433
- /**
434
- * Returns whether the current scrolled position can be used to scroll to the selected wagon
435
- * @returns boolean
436
- */
437
- _isScrollableToSelectedCoach() {
438
- const e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, s = this.maxCalcCoachesWidth - t, i = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], a = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
439
- return (e < s || e > i.start) && !a;
440
- }
441
- /**
442
- * Returns the coach index which is currently visible in the scroll area
443
- * @returns number
444
- */
445
- _getCoachIndexByScrollTriggerPosition() {
446
- const t = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachesAreaWidth / 2;
447
- return this.triggerCoachPositionsCollection.findIndex((s) => t >= s.start && t <= s.end);
448
- }
449
- /**
450
- * Get the first place of current selected coach by table cell coordinate 0-0 id.
451
- * @returns Place or null
452
- */
453
- _getFirstPlaceInSelectedCoach() {
454
- let e = null;
455
- const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], s = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", i = this.shadowRoot?.querySelector("#" + s)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
456
- return t && i && (e = t.places?.find((a) => a.number === i) || null), e;
457
- }
458
- _getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
459
- return !this.currSelectedPlace || e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft ? null : e === this.keyboardNavigationEvents.ArrowDown && this.currSelectedPlace.position.y + 2 === t.dimension.h && this.seatReservations[this.currSelectedDeckIndex + 1] ? this.currSelectedDeckIndex + 1 : e === this.keyboardNavigationEvents.ArrowUp && this.currSelectedPlace.position.y === 0 && this.seatReservations[this.currSelectedDeckIndex - 1] ? this.currSelectedDeckIndex - 1 : null;
460
- }
461
- /**
462
- * To get the correct closest place of current pressed key and the current selected place,
463
- * we have to investigate the coordinates of each place to find the closest place of the currSelectedPlaceElementId.
464
- * @param pressedKey
465
- * @returns Place or null
466
- */
467
- _getClosestPlaceByKeyDirection(e) {
468
- const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex];
469
- let s = null, i = t.places, a = null;
470
- if (i)
471
- if (this.currSelectedPlaceElementId) {
472
- if (this.currSelectedPlace) {
473
- const o = { ...this.currSelectedPlace.position };
474
- e && (a = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), a !== null && (i = this.seatReservations[a].coachItems[this.currSelectedCoachIndex].places || [], o.y = a < this.currSelectedDeckIndex ? t.dimension.h : -1));
475
- for (const c of i)
476
- e ? c.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (c.position.y === o.y || c.position.y === o.y - 1) && c.position.x > o.x && (!s || c.position.x < s.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (c.position.x === o.x || c.position.x === o.x + 1) && c.position.y > o.y && (!s || c.position.y < s.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (c.position.y === o.y || c.position.y === o.y + 1) && c.position.x < o.x && (!s || c.position.x > s.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (c.position.x === o.x || c.position.x === o.x - 1) && c.position.y < o.y && (!s || c.position.y > s.position.y)) && (s = c) : (this.currScrollDirection === I.right && c.position.y === o.y && (!s || c.position.x < s.position.x) || this.currScrollDirection === I.left && c.position.y === o.y && (!s || c.position.x > s.position.x)) && (s = c);
477
- a !== null && s && (this.currSelectedDeckIndex = a);
478
- }
479
- } else
480
- return this._getFirstPlaceInSelectedCoach();
481
- return s;
482
- }
483
- // Handling for Tab navigation if a place is selected inside the coach.
484
- // This controls the focused coach from the current selected coach.
485
- _navigateCoachNavigationByKeyboard(e) {
486
- const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, s = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
487
- if (this.hasNavigation) {
488
- const i = this._getPlaceHtmlElement(), a = i ? i.getAttribute("keyfocus") === "focus" : !1;
489
- if (e === "PREV_TAB" && this.selectedCoachIndex === t)
490
- if (a || this.currSelectedPlace !== null) {
491
- this.focusedCoachIndex = t, this.unfocusPlaceElement();
492
- return;
493
- } else t === 0 ? this._refocusCurrentFocusedNavCoach(t) : this.focusedCoachIndex = s;
494
- else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : e === "NEXT_TAB" && s === this.coachItemDetailsElements.length - 1 ? this._refocusCurrentFocusedNavCoach(t) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = s, a ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
495
- this._scrollToSelectedNavigationButton(s);
496
- } else
497
- this.scrollToSelectedNavCoach(s);
498
- }
499
- // Refocused the current focused (visual) nav coach to get the native focus back to the navigation
500
- _refocusCurrentFocusedNavCoach(e) {
501
- this.focusedCoachIndex = -1, setTimeout(() => this.focusedCoachIndex = e, 0);
502
- }
503
- _navigateToPlaceByKeyboard(e) {
504
- if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
505
- const t = this._getClosestPlaceByKeyDirection(e);
506
- if (t)
507
- this.focusPlaceElement(t);
508
- else if (e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft || this.alignVertical && (e === this.keyboardNavigationEvents.ArrowUp || e === this.keyboardNavigationEvents.ArrowDown)) {
509
- const s = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
510
- this.scrollToSelectedNavCoach(s);
511
- }
512
- }
513
- }
514
- getNextAvailableCoachIndex(e) {
515
- const t = e ?? this.currSelectedCoachIndex;
516
- return t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 ? t + 1 : t;
517
- }
518
- getPrevAvailableCoachIndex(e) {
519
- const t = e ?? this.currSelectedCoachIndex;
520
- return t > 0 ? t - 1 : t;
521
- }
522
- updateSelectedSeatReservationPlaces(e) {
523
- const t = e.placeType === "SEAT" ? "seats" : "bicycles", s = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, i = this.selectedSeatReservationPlaces[t];
524
- this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(i, s, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
525
- bubbles: !0,
526
- composed: !0,
527
- detail: this.selectedSeatReservationPlaces
528
- }));
529
- }
530
- _updateSelectedSeatReservationPlaces(e, t, s) {
531
- if (s.state === "SELECTED") {
532
- const i = this._getDeckIndexByPlaceId(s.id), a = this._getSeatReservationPlaceSelection(s, i);
533
- a && e.push(a);
534
- } else
535
- e = e.filter((i) => i.id !== s.id);
536
- if (t > -1 && e.length > t) {
537
- const i = t > 0 ? s : void 0;
538
- e = this._resetAllPlaceSelections(e, i);
539
- }
540
- return e;
541
- }
542
- updateCurrentSelectedPlaceInCoach(e) {
543
- const t = this._getDeckIndexByPlaceId(e.id), s = e.coachIndex;
544
- if (t === null)
545
- return;
546
- const i = this.seatReservations[t].coachItems[s].places?.find((o) => o.number == e.number);
547
- if (!i)
548
- return;
549
- this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = s, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i);
550
- const a = setTimeout(() => {
551
- this._scrollPlaceIntoNearestViewport(e.id), clearTimeout(a);
552
- }, 0);
553
- }
554
- updateCurrentSelectedCoach() {
555
- if (this.currSelectedCoachIndex == this.selectedCoachIndex)
556
- return;
557
- this.focusedCoachIndex != -1 && (this.focusedCoachIndex = this.currSelectedCoachIndex), this.selectedCoachIndex = this.currSelectedCoachIndex;
558
- const e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
559
- e && this.dispatchEvent(new CustomEvent("selectedcoach", {
560
- bubbles: !0,
561
- composed: !0,
562
- detail: e
563
- }));
564
- }
565
- getPlaceElementId(e, t, s) {
566
- return "seat-reservation__place-button-" + e + "-" + t + "-" + s;
567
- }
568
- /**
569
- * In the case of coach layouts with different decks,
570
- * it is necessary to extend the offset with empty coaches
571
- * in order to create a stable vehicle layout.
572
- *
573
- * [ooo]-[ooo]-[ooo]
574
- * [ooo]-[ooo]-[ooo]-[ooo]-[ooo]
575
- */
576
- _initEmptyCoachDeckOffsets() {
577
- const e = Array(this.seatReservations.length - 1).fill(0);
578
- this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((s) => {
579
- for (let i = 0; i < this.seatReservations.length - 1; i++) {
580
- const a = this.seatReservations[i].coachItems[e[i]];
581
- if (s.id != a?.id) {
582
- const o = {
583
- ...s,
584
- places: void 0,
585
- propertyIds: void 0,
586
- graphicElements: void 0,
587
- serviceElements: void 0,
588
- travelClass: []
589
- };
590
- this.seatReservations[i].coachItems.splice(e[i], 0, o);
591
- }
592
- e[i]++;
593
- }
594
- });
595
- }
596
- /**
597
- * Initialization of SeatReservationPlaceSelection Array based on the transferred places
598
- * that have the state SELECTED within the seatReservation object
599
- */
600
- _initSeatReservationPlaceSelection() {
601
- this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((s, i) => {
602
- s.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
603
- const o = this.getPlaceElementId(t, i, a.number), c = ke(a, o, e.deckCoachIndex, i), w = this._getSeatReservationPlaceSelection(c, t);
604
- w && (w.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(w) : this.selectedSeatReservationPlaces.bicycles.push(w));
605
- });
606
- }));
607
- }
608
- /**
609
- * All selected places will be reset or the currentSelectedPlace was given, then we reset all except currentSelectedPlace
610
- * @param reservationPlaceSelections
611
- * @param currSelectedPlace
612
- */
613
- _resetAllPlaceSelections(e, t) {
614
- for (const s of e)
615
- if (!t || t.id !== s.id) {
616
- const i = this.shadowRoot?.getElementById(s.id);
617
- i && i.setAttribute("state", "FREE");
618
- }
619
- return t ? e = e.filter((s) => s.id === t.id) : e = [], e;
620
- }
621
- _getSeatReservationPlaceSelection(e, t) {
622
- if (t === null)
623
- return null;
624
- const s = this.seatReservations[t].coachItems[e.coachIndex], i = s.places?.find((a) => a.number === e.number);
625
- return i ? De(i, s, e.id, e.deckIndex, e.coachIndex) : null;
626
- }
627
- _getSeatReservationSelectedCoach(e) {
628
- if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
629
- return null;
630
- const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], s = this.getAvailableFreePlacesNumFromCoach(t.places);
631
- return Te(e, t, s);
632
- }
633
- _setCurrSelectedPlaceElementId(e) {
634
- this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
635
- }
636
- /**
637
- * Preparation of the used documents font-size which needs
638
- * to be determined in order to correctly calculate CSS values with rem
639
- * */
640
- _determineBaseFontSize() {
641
- if (!Re) {
642
- const t = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
643
- this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${t + "rem"}`);
644
- }
645
- }
646
- /**
647
- * Prepares data for displaying navigation area.
648
- * Calculates the values which are not going to change during use of a component:
649
- * - coach id
650
- * - list of service icons
651
- * - class (first, second, any)
652
- * - whether there is a driver area left or right
653
- * */
654
- _prepareCoachItemDetailsData() {
655
- if (this.seatReservations) {
656
- const e = this.seatReservations[this.seatReservations.length - 1].coachItems;
657
- this.coachItemDetailsElements = [], e.forEach((t, s) => {
658
- const i = [], a = [], o = [];
659
- this.seatReservations.map((c) => c.coachItems[s]).forEach((c) => {
660
- i.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
661
- }), this.coachItemDetailsElements.push({
662
- id: t.id,
663
- travelClass: this._prepareTravelClassNavigation(i),
664
- propertyIds: this._prepareServiceIconsNavigation(a),
665
- isDriverArea: t.places ? t.places.length === 0 : !0,
666
- driverAreaSide: this._prepareDriverAreaSideNavigation(t),
667
- freePlaces: this.getAvailableFreePlacesNumFromCoach(o),
668
- driverAreaElements: this._setDriverAreasElements(t)
669
- });
670
- });
671
- }
672
- }
673
- _prepareTravelClassNavigation(e) {
674
- return e.indexOf("FIRST") !== -1 ? "FIRST" : e.indexOf("SECOND") !== -1 ? "SECOND" : "ANY_CLASS";
675
- }
676
- _prepareDriverAreaSideNavigation(e) {
677
- const t = e.graphicElements?.filter((s) => s.icon === "DRIVER_AREA");
678
- if (t && t.length > 0) {
679
- const s = t.find((a) => a.position.x === 0) || !1, i = t.find((a) => a.position.x > 0) || !1;
680
- return {
681
- left: !!s,
682
- right: !!i
683
- };
684
- }
685
- }
686
- _prepareCoachWidthAndGapCalculations() {
687
- this.seatReservations && this.seatReservations[this.seatReservations.length - 1]?.coachItems?.forEach((t) => {
688
- const s = this._isOverhangingElementsPresent(t.dimension.w, t.places), i = t.graphicElements?.filter((o) => o.icon && !this.notAreaElements.includes(o.icon)), a = this._isOverhangingElementsPresent(t.dimension.w, i);
689
- this.overHangingElementInformation.push({
690
- coachId: t.id,
691
- overhangingPlaces: s,
692
- overhangingGraphicAreas: a
693
- });
694
- });
695
- }
696
- /**
697
- * Returns the current selected place HTML element by currSelectedPlaceElementId.
698
- * @returns HTMLElement or null
699
- */
700
- _getPlaceHtmlElement() {
701
- return this.currSelectedPlaceElementId && this.shadowRoot?.getElementById(this.currSelectedPlaceElementId) || null;
702
- }
703
- /**
704
- * Returns the extracted coach deck index from place id
705
- * @returns number
706
- */
707
- _getDeckIndexByPlaceId(e) {
708
- const t = this.shadowRoot?.querySelector("#" + e)?.getAttribute("data-deck-index");
709
- return t && !isNaN(+t) ? +t : null;
710
- }
711
- _isValidCoachIndex(e) {
712
- return e >= 0 && e <= this.seatReservations[this.seatReservations.length - 1].coachItems.length;
713
- }
714
- /**
715
- * Returns existing coach deck index depending on the selected coach.
716
- * This method is necessary to get an available coach deck index during keyboard navigation, which can vary between coaches with different decks.
717
- * For example, when navigating from a coach with two decks to a coach with one deck.
718
- *
719
- * [ooo]-[ooo]-[ooo]
720
- * [ooo]-[ooo]-[ooo]-[ooo]-[ooo]
721
- *
722
- * @returns number
723
- */
724
- _getExistingCoachDeckIndex() {
725
- if (this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places !== void 0)
726
- return this.currSelectedDeckIndex;
727
- const e = this.seatReservations.findIndex((t) => t.coachItems[this.currSelectedCoachIndex].places !== void 0);
728
- return this.currSelectedDeckIndex >= e ? this.currSelectedDeckIndex : e;
729
- }
730
- /**
731
- * If a selected place is slightly hidden by the overflow scroll content and is still clicked,
732
- * the method tries to scroll the selected place into the nearest viewport, so that it is completely visible.
733
- *
734
- * @param placeId
735
- */
736
- _scrollPlaceIntoNearestViewport(e) {
737
- this.shadowRoot?.getElementById(e)?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
738
- }
739
- /**
740
- * checks if any places or graphical elements (e.g. toilet area, etc.) are overhanging the coach borders
741
- * @param coachItemWidth
742
- * @param elements
743
- */
744
- _isOverhangingElementsPresent(e, t) {
745
- return t?.some((s) => s.position.x === 0 || s.position.x + s.dimension.w >= e) ?? !1;
746
- }
747
- /**
748
- * collect information about the driverAreas for one coach
749
- * @param coachItem
750
- * @private
751
- */
752
- _setDriverAreasElements(e) {
753
- if (e) {
754
- const t = e.graphicElements?.find((i) => i.icon === "DRIVER_AREA"), s = e.type === "LOCOMOTIVE_COACH" ? e.graphicElements?.find((i) => i.icon === "DRIVER_AREA_NO_VERTICAL_WALL") : void 0;
755
- return {
756
- driverArea: t,
757
- driverAreaNoVerticalWall: s
758
- };
759
- }
760
- return {
761
- driverArea: void 0,
762
- driverAreaNoVerticalWall: void 0
763
- };
764
- }
765
- /**
766
- * Is called when the SeatReservation loses focus, what happens when the user tabs out or clicks somewhere else.
767
- * Then we reset the focused elements.
768
- */
769
- _onLeaveSeatReservationComponent() {
770
- this.hasNavigation && (this.focusedCoachIndex = -1), this.unfocusPlaceElement();
771
- }
772
- }, x = new WeakMap(), p = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), A = new WeakMap(), E = new WeakMap(), R = new WeakMap(), N = new WeakMap(), k = new WeakMap(), D = new WeakMap(), T = new WeakMap(), (() => {
773
- const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(h[Symbol.metadata] ?? null) : void 0;
774
- f = [C({ attribute: "seat-reservations", type: Array })], V = [C({ attribute: "travel-direction", type: String })], L = [S(), C({ attribute: "has-navigation", type: Boolean })], M = [S(), C({ attribute: "align-vertical", type: Boolean, reflect: !0, useDefault: !0 })], U = [S(), C({ attribute: "base-grid-size", type: Number })], j = [S(), C({ attribute: "height", type: Number })], Q = [S(), C({ attribute: "max-seat-reservations", type: Number })], te = [S(), C({ attribute: "max-bicycle-reservations", type: Number })], ae = [S(), C({ attribute: "prevent-place-click", type: Boolean })], re = [S(), C({ attribute: "preselect-coach-index", type: Number })], he = [S(), C({ attribute: "show-title-info", type: Boolean })], ge = [z()], Ce = [z()], xe = [z()], me = [Ne({ passive: !0 })], v(l, null, f, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, s) => {
775
- t.seatReservations = s;
776
- } }, metadata: e }, B, O), v(l, null, V, { kind: "accessor", name: "travelDirection", static: !1, private: !1, access: { has: (t) => "travelDirection" in t, get: (t) => t.travelDirection, set: (t, s) => {
777
- t.travelDirection = s;
778
- } }, metadata: e }, F, G), v(l, null, L, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, s) => {
779
- t.hasNavigation = s;
780
- } }, metadata: e }, W, H), v(l, null, M, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, s) => {
781
- t.alignVertical = s;
782
- } }, metadata: e }, K, X), v(l, null, U, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, s) => {
783
- t.baseGridSize = s;
784
- } }, metadata: e }, q, $), v(l, null, j, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, s) => {
785
- t.height = s;
786
- } }, metadata: e }, Y, J), v(l, null, Q, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, s) => {
787
- t.maxSeatReservations = s;
788
- } }, metadata: e }, Z, ee), v(l, null, te, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, s) => {
789
- t.maxBicycleReservations = s;
790
- } }, metadata: e }, se, ie), v(l, null, ae, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, s) => {
791
- t.preventPlaceClick = s;
792
- } }, metadata: e }, ce, oe), v(l, null, re, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, s) => {
793
- t.preselectCoachIndex = s;
794
- } }, metadata: e }, ne, le), v(l, null, he, { kind: "accessor", name: "showTitleInfo", static: !1, private: !1, access: { has: (t) => "showTitleInfo" in t, get: (t) => t.showTitleInfo, set: (t, s) => {
795
- t.showTitleInfo = s;
796
- } }, metadata: e }, de, ue), v(l, null, ge, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, s) => {
797
- t.selectedCoachIndex = s;
798
- } }, metadata: e }, ve, fe), v(l, null, Ce, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, s) => {
799
- t.focusedCoachIndex = s;
800
- } }, metadata: e }, Se, Ie), v(l, null, xe, { kind: "accessor", name: "hoveredCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredCoachIndex" in t, get: (t) => t.hoveredCoachIndex, set: (t, s) => {
801
- t.hoveredCoachIndex = s;
802
- } }, metadata: e }, pe, _e), v(l, null, me, { kind: "method", name: "coachAreaScrollend", static: !1, private: !1, access: { has: (t) => "coachAreaScrollend" in t, get: (t) => t.coachAreaScrollend }, metadata: e }, null, d), e && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
803
- })(), l.events = {
804
- selectedplaces: "selectedplaces",
805
- selectedcoach: "selectedcoach"
806
- }, l;
1
+ import { __esDecorate as e, __runInitializers as t } from "tslib";
2
+ import { SbbElement as n } from "@sbb-esta/lyne-elements/core/base-elements.js";
3
+ import { forceType as r } from "@sbb-esta/lyne-elements/core/decorators.js";
4
+ import { isServer as i } from "lit";
5
+ import { isArrowKeyOrPageKeysPressed as a } from "@sbb-esta/lyne-elements/core/a11y.js";
6
+ import { eventOptions as ee, property as o, state as s } from "lit/decorators.js";
7
+ import { mapCoachInfosToCoachSelection as te, mapIconToSvg as c, mapPlaceAndCoachToSeatReservationPlaceSelection as ne, mapPlaceInfosToPlaceSelection as re } from "../common/mapper.js";
8
+ //#region src/elements-experimental/seat-reservation/seat-reservation/seat-reservation-base-element.ts
9
+ var l;
10
+ (function(e) {
11
+ e.right = "right", e.left = "left";
12
+ })(l ||= {});
13
+ var ie = 3, ae = [
14
+ "sa-vo",
15
+ "sa-rs",
16
+ "sa-abteilkinderwagen",
17
+ "sa-wr",
18
+ "sa-fa",
19
+ "sa-bz",
20
+ "sa-rz"
21
+ ], u = (() => {
22
+ let u = n, d = [], f, p = [], m = [], h, g = [], _ = [], v, y = [], b = [], x, S = [], C = [], w, T = [], E = [], D, O = [], oe = [], k, A = [], j = [], M, N = [], P = [], F, I = [], L = [], R, z = [], B = [], V, H = [], U = [], W, G = [], K = [], q, J = [], Y = [], X, Z = [], Q = [], $;
23
+ return class extends u {
24
+ static {
25
+ let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(u[Symbol.metadata] ?? null) : void 0;
26
+ f = [o({
27
+ attribute: "seat-reservations",
28
+ type: Array
29
+ })], h = [o({
30
+ attribute: "travel-direction",
31
+ type: String
32
+ })], v = [r(), o({
33
+ attribute: "has-navigation",
34
+ type: Boolean
35
+ })], x = [r(), o({
36
+ attribute: "align-vertical",
37
+ type: Boolean,
38
+ reflect: !0,
39
+ useDefault: !0
40
+ })], w = [r(), o({
41
+ attribute: "base-grid-size",
42
+ type: Number
43
+ })], D = [r(), o({
44
+ attribute: "height",
45
+ type: Number
46
+ })], k = [r(), o({
47
+ attribute: "max-seat-reservations",
48
+ type: Number
49
+ })], M = [r(), o({
50
+ attribute: "max-bicycle-reservations",
51
+ type: Number
52
+ })], F = [r(), o({
53
+ attribute: "prevent-place-click",
54
+ type: Boolean
55
+ })], R = [r(), o({
56
+ attribute: "preselect-coach-index",
57
+ type: Number
58
+ })], V = [r(), o({
59
+ attribute: "show-title-info",
60
+ type: Boolean
61
+ })], W = [s()], q = [s()], X = [s()], $ = [ee({ passive: !0 })], e(this, null, f, {
62
+ kind: "accessor",
63
+ name: "seatReservations",
64
+ static: !1,
65
+ private: !1,
66
+ access: {
67
+ has: (e) => "seatReservations" in e,
68
+ get: (e) => e.seatReservations,
69
+ set: (e, t) => {
70
+ e.seatReservations = t;
71
+ }
72
+ },
73
+ metadata: t
74
+ }, p, m), e(this, null, h, {
75
+ kind: "accessor",
76
+ name: "travelDirection",
77
+ static: !1,
78
+ private: !1,
79
+ access: {
80
+ has: (e) => "travelDirection" in e,
81
+ get: (e) => e.travelDirection,
82
+ set: (e, t) => {
83
+ e.travelDirection = t;
84
+ }
85
+ },
86
+ metadata: t
87
+ }, g, _), e(this, null, v, {
88
+ kind: "accessor",
89
+ name: "hasNavigation",
90
+ static: !1,
91
+ private: !1,
92
+ access: {
93
+ has: (e) => "hasNavigation" in e,
94
+ get: (e) => e.hasNavigation,
95
+ set: (e, t) => {
96
+ e.hasNavigation = t;
97
+ }
98
+ },
99
+ metadata: t
100
+ }, y, b), e(this, null, x, {
101
+ kind: "accessor",
102
+ name: "alignVertical",
103
+ static: !1,
104
+ private: !1,
105
+ access: {
106
+ has: (e) => "alignVertical" in e,
107
+ get: (e) => e.alignVertical,
108
+ set: (e, t) => {
109
+ e.alignVertical = t;
110
+ }
111
+ },
112
+ metadata: t
113
+ }, S, C), e(this, null, w, {
114
+ kind: "accessor",
115
+ name: "baseGridSize",
116
+ static: !1,
117
+ private: !1,
118
+ access: {
119
+ has: (e) => "baseGridSize" in e,
120
+ get: (e) => e.baseGridSize,
121
+ set: (e, t) => {
122
+ e.baseGridSize = t;
123
+ }
124
+ },
125
+ metadata: t
126
+ }, T, E), e(this, null, D, {
127
+ kind: "accessor",
128
+ name: "height",
129
+ static: !1,
130
+ private: !1,
131
+ access: {
132
+ has: (e) => "height" in e,
133
+ get: (e) => e.height,
134
+ set: (e, t) => {
135
+ e.height = t;
136
+ }
137
+ },
138
+ metadata: t
139
+ }, O, oe), e(this, null, k, {
140
+ kind: "accessor",
141
+ name: "maxSeatReservations",
142
+ static: !1,
143
+ private: !1,
144
+ access: {
145
+ has: (e) => "maxSeatReservations" in e,
146
+ get: (e) => e.maxSeatReservations,
147
+ set: (e, t) => {
148
+ e.maxSeatReservations = t;
149
+ }
150
+ },
151
+ metadata: t
152
+ }, A, j), e(this, null, M, {
153
+ kind: "accessor",
154
+ name: "maxBicycleReservations",
155
+ static: !1,
156
+ private: !1,
157
+ access: {
158
+ has: (e) => "maxBicycleReservations" in e,
159
+ get: (e) => e.maxBicycleReservations,
160
+ set: (e, t) => {
161
+ e.maxBicycleReservations = t;
162
+ }
163
+ },
164
+ metadata: t
165
+ }, N, P), e(this, null, F, {
166
+ kind: "accessor",
167
+ name: "preventPlaceClick",
168
+ static: !1,
169
+ private: !1,
170
+ access: {
171
+ has: (e) => "preventPlaceClick" in e,
172
+ get: (e) => e.preventPlaceClick,
173
+ set: (e, t) => {
174
+ e.preventPlaceClick = t;
175
+ }
176
+ },
177
+ metadata: t
178
+ }, I, L), e(this, null, R, {
179
+ kind: "accessor",
180
+ name: "preselectCoachIndex",
181
+ static: !1,
182
+ private: !1,
183
+ access: {
184
+ has: (e) => "preselectCoachIndex" in e,
185
+ get: (e) => e.preselectCoachIndex,
186
+ set: (e, t) => {
187
+ e.preselectCoachIndex = t;
188
+ }
189
+ },
190
+ metadata: t
191
+ }, z, B), e(this, null, V, {
192
+ kind: "accessor",
193
+ name: "showTitleInfo",
194
+ static: !1,
195
+ private: !1,
196
+ access: {
197
+ has: (e) => "showTitleInfo" in e,
198
+ get: (e) => e.showTitleInfo,
199
+ set: (e, t) => {
200
+ e.showTitleInfo = t;
201
+ }
202
+ },
203
+ metadata: t
204
+ }, H, U), e(this, null, W, {
205
+ kind: "accessor",
206
+ name: "selectedCoachIndex",
207
+ static: !1,
208
+ private: !1,
209
+ access: {
210
+ has: (e) => "selectedCoachIndex" in e,
211
+ get: (e) => e.selectedCoachIndex,
212
+ set: (e, t) => {
213
+ e.selectedCoachIndex = t;
214
+ }
215
+ },
216
+ metadata: t
217
+ }, G, K), e(this, null, q, {
218
+ kind: "accessor",
219
+ name: "focusedCoachIndex",
220
+ static: !1,
221
+ private: !1,
222
+ access: {
223
+ has: (e) => "focusedCoachIndex" in e,
224
+ get: (e) => e.focusedCoachIndex,
225
+ set: (e, t) => {
226
+ e.focusedCoachIndex = t;
227
+ }
228
+ },
229
+ metadata: t
230
+ }, J, Y), e(this, null, X, {
231
+ kind: "accessor",
232
+ name: "hoveredCoachIndex",
233
+ static: !1,
234
+ private: !1,
235
+ access: {
236
+ has: (e) => "hoveredCoachIndex" in e,
237
+ get: (e) => e.hoveredCoachIndex,
238
+ set: (e, t) => {
239
+ e.hoveredCoachIndex = t;
240
+ }
241
+ },
242
+ metadata: t
243
+ }, Z, Q), e(this, null, $, {
244
+ kind: "method",
245
+ name: "coachAreaScrollend",
246
+ static: !1,
247
+ private: !1,
248
+ access: {
249
+ has: (e) => "coachAreaScrollend" in e,
250
+ get: (e) => e.coachAreaScrollend
251
+ },
252
+ metadata: t
253
+ }, null, d), t && Object.defineProperty(this, Symbol.metadata, {
254
+ enumerable: !0,
255
+ configurable: !0,
256
+ writable: !0,
257
+ value: t
258
+ });
259
+ }
260
+ static {
261
+ this.events = {
262
+ selectedplaces: "selectedplaces",
263
+ selectedcoach: "selectedcoach"
264
+ };
265
+ }
266
+ #e;
267
+ get seatReservations() {
268
+ return this.#e;
269
+ }
270
+ set seatReservations(e) {
271
+ this.#e = e;
272
+ }
273
+ #t;
274
+ get travelDirection() {
275
+ return this.#t;
276
+ }
277
+ set travelDirection(e) {
278
+ this.#t = e;
279
+ }
280
+ #n;
281
+ get hasNavigation() {
282
+ return this.#n;
283
+ }
284
+ set hasNavigation(e) {
285
+ this.#n = e;
286
+ }
287
+ #r;
288
+ get alignVertical() {
289
+ return this.#r;
290
+ }
291
+ set alignVertical(e) {
292
+ this.#r = e;
293
+ }
294
+ #i;
295
+ get baseGridSize() {
296
+ return this.#i;
297
+ }
298
+ set baseGridSize(e) {
299
+ this.#i = e;
300
+ }
301
+ #a;
302
+ get height() {
303
+ return this.#a;
304
+ }
305
+ set height(e) {
306
+ this.#a = e;
307
+ }
308
+ #o;
309
+ get maxSeatReservations() {
310
+ return this.#o;
311
+ }
312
+ set maxSeatReservations(e) {
313
+ this.#o = e;
314
+ }
315
+ #s;
316
+ get maxBicycleReservations() {
317
+ return this.#s;
318
+ }
319
+ set maxBicycleReservations(e) {
320
+ this.#s = e;
321
+ }
322
+ #c;
323
+ get preventPlaceClick() {
324
+ return this.#c;
325
+ }
326
+ set preventPlaceClick(e) {
327
+ this.#c = e;
328
+ }
329
+ #l;
330
+ get preselectCoachIndex() {
331
+ return this.#l;
332
+ }
333
+ set preselectCoachIndex(e) {
334
+ this.#l = e;
335
+ }
336
+ #u;
337
+ get showTitleInfo() {
338
+ return this.#u;
339
+ }
340
+ set showTitleInfo(e) {
341
+ this.#u = e;
342
+ }
343
+ #d;
344
+ get selectedCoachIndex() {
345
+ return this.#d;
346
+ }
347
+ set selectedCoachIndex(e) {
348
+ this.#d = e;
349
+ }
350
+ #f;
351
+ get focusedCoachIndex() {
352
+ return this.#f;
353
+ }
354
+ set focusedCoachIndex(e) {
355
+ this.#f = e;
356
+ }
357
+ #p;
358
+ get hoveredCoachIndex() {
359
+ return this.#p;
360
+ }
361
+ set hoveredCoachIndex(e) {
362
+ this.#p = e;
363
+ }
364
+ constructor() {
365
+ super(), this.#e = (t(this, d), t(this, p, null)), this.#t = (t(this, m), t(this, g, "NONE")), this.#n = (t(this, _), t(this, y, !0)), this.#r = (t(this, b), t(this, S, !1)), this.#i = (t(this, C), t(this, T, 16)), this.#a = (t(this, E), t(this, O, null)), this.#o = (t(this, oe), t(this, A, -1)), this.#s = (t(this, j), t(this, N, -1)), this.#c = (t(this, P), t(this, I, !1)), this.#l = (t(this, L), t(this, z, -1)), this.#u = (t(this, B), t(this, H, !1)), this.#d = (t(this, U), t(this, G, -1)), this.#f = (t(this, K), t(this, J, -1)), this.#p = (t(this, Y), t(this, Z, -1)), this.coachBorderPadding = (t(this, Q), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachItemDetailsElements = [], this.currScrollDirection = l.right, this.maxCalcCoachesWidth = 0, this.scrollCoachesAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
366
+ seats: [],
367
+ bicycles: []
368
+ }, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
369
+ ArrowLeft: "ArrowLeft",
370
+ ArrowRight: "ArrowRight",
371
+ ArrowUp: "ArrowUp",
372
+ ArrowDown: "ArrowDown",
373
+ Tab: "Tab",
374
+ Enter: "Enter"
375
+ }, this.notAreaElements = [
376
+ "DRIVER_AREA",
377
+ "DRIVER_AREA_NO_VERTICAL_WALL",
378
+ "COACH_PASSAGE",
379
+ "COACH_WALL_NO_PASSAGE",
380
+ "COMPARTMENT_PASSAGE",
381
+ "COMPARTMENT_PASSAGE_HIGH",
382
+ "COMPARTMENT_PASSAGE_MIDDLE",
383
+ "COMPARTMENT_PASSAGE_LOW"
384
+ ], this.overHangingElementInformation = [], this._isRunningInitPreselectCoachIndex = !1, this._lastStartScrollPos = -1, this._prepareServiceIconsNavigation = (e) => e && e?.map(function(e) {
385
+ return {
386
+ pId: e,
387
+ svgName: c[e]?.svgName ? c[e]?.svgName : ""
388
+ };
389
+ }).filter((e) => ae.indexOf(e.svgName) !== -1).filter((e, t, n) => n.map((e) => e.svgName).indexOf(e.svgName) === t).map((e) => e.pId).slice(0, ie) || [], this.addEventListener("blur", () => this._onLeaveSeatReservationComponent());
390
+ }
391
+ willUpdate(e) {
392
+ if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initPrepareSeatReservationData(), this._prepareCoachWidthAndGapCalculations(), this._initSeatReservationPlaceSelection(), this.initNavigationSelectionByScrollEvent()), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
393
+ let e = this.seatReservations[this.currSelectedDeckIndex] || null;
394
+ e?.coachItems.length && (this.baseGridSize = this.height / e.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent());
395
+ }
396
+ e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && (this._isRunningInitPreselectCoachIndex = !0, setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1));
397
+ }
398
+ navigateByDirectionBtn(e) {
399
+ this.unfocusPlaceElement();
400
+ let t = this.currSelectedCoachIndex;
401
+ e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex == -1 ? 0 : this.currSelectedCoachIndex - 1 : e == "DIRECTION_RIGHT" && t < this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length - 1 && (t = this.currSelectedCoachIndex == -1 ? 0 : this.currSelectedCoachIndex + 1), this.scrollToSelectedNavCoach(t);
402
+ }
403
+ _initPrepareSeatReservationData() {
404
+ this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this._prepareCoachItemDetailsData();
405
+ }
406
+ initNavigationSelectionByScrollEvent() {
407
+ this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr__navigation-list-coaches");
408
+ let e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
409
+ if (e && e.coachItems.length > 0) {
410
+ let t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, n = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
411
+ this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + n}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
412
+ }
413
+ if (this.navigationScrollArea) {
414
+ this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
415
+ let e = this.navigationScrollArea.querySelector("ul > li");
416
+ if (e) {
417
+ let t = e?.getBoundingClientRect();
418
+ this.coachNavButtonDim = this.alignVertical ? t.height : t.width;
419
+ }
420
+ }
421
+ if (this.coachScrollArea && e) {
422
+ let t = 0;
423
+ this.scrollCoachesAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((e) => {
424
+ let n = t, r = this.getCalculatedDimension(e.dimension).w, i = this.overHangingElementInformation.find((t) => t.coachId === e.id), a = i?.overhangingPlaces || i?.overhangingGraphicAreas;
425
+ return t += r + (a ? 2 * this.gapBetweenCoaches : this.gapBetweenCoaches), {
426
+ start: n,
427
+ end: t,
428
+ width: r
429
+ };
430
+ }), this.maxCalcCoachesWidth = t - this.gapBetweenCoaches;
431
+ }
432
+ }
433
+ coachAreaScrollend() {
434
+ this._scrollTimeout && clearTimeout(this._scrollTimeout), this._scrollTimeout = setTimeout(() => this._handleCoachAreaScrollendEvent(), 150);
435
+ }
436
+ onFocusTableCoachAndPreselectPlace(e) {
437
+ !this.seatReservationWithoutNavigationHasFocus && !this.hasNavigation && (this.seatReservationWithoutNavigationHasFocus = !0, this.currSelectedCoachIndex = e === 0 ? this.getNextAvailableCoachIndex(-1) : this.getPrevAvailableCoachIndex(e), this.preselectPlaceInCoach());
438
+ }
439
+ onFocusNavDirectionButton() {
440
+ this.focusedCoachIndex = -1;
441
+ }
442
+ onKeyNavigationNavCoachButton(e, t) {
443
+ if (e.key === this.keyboardNavigationEvents.Tab) {
444
+ this._handleTabKeyNavigation(e, "navigation", t);
445
+ return;
446
+ }
447
+ a(e) && this.keyboardSeatmapEventHandling(e);
448
+ }
449
+ _handleTabKeyNavigation(e, t, n) {
450
+ let r = e.key, i = e.shiftKey;
451
+ r === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (n == this.currSelectedCoachIndex ? !this.currSelectedPlace || !i || this.coachItemDetailsElements[n].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = n : i && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = n, this._scrollToSelectedNavigationButton(n)) : t == "seatmap" && (e.preventDefault(), i ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
452
+ }
453
+ keyboardSeatmapEventHandling(e) {
454
+ let t = e.key === this.keyboardNavigationEvents.Tab, n = e.shiftKey && t;
455
+ if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && n || this.currSelectedCoachIndex === this.coachItemDetailsElements.length - 1 && t) return;
456
+ let r = e.key;
457
+ if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (t || n) && (this.hasSeatReservationNativeFocus = !0), t) {
458
+ this._handleTabKeyNavigation(e, "seatmap");
459
+ return;
460
+ }
461
+ if (this.currSelectedCoachIndex !== -1 && a(e)) switch (e.preventDefault(), r) {
462
+ case this.keyboardNavigationEvents.ArrowLeft:
463
+ {
464
+ let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : r;
465
+ this._navigateToPlaceByKeyboard(e);
466
+ }
467
+ break;
468
+ case this.keyboardNavigationEvents.ArrowRight:
469
+ {
470
+ let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : r;
471
+ this._navigateToPlaceByKeyboard(e);
472
+ }
473
+ break;
474
+ case this.keyboardNavigationEvents.ArrowUp:
475
+ {
476
+ let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : r;
477
+ this._navigateToPlaceByKeyboard(e);
478
+ }
479
+ break;
480
+ case this.keyboardNavigationEvents.ArrowDown:
481
+ {
482
+ let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : r;
483
+ this._navigateToPlaceByKeyboard(e);
484
+ }
485
+ break;
486
+ default: break;
487
+ }
488
+ }
489
+ preselectPlaceInCoach() {
490
+ if (this.isAutoScrolling) {
491
+ if (this._isRunningInitPreselectCoachIndex) {
492
+ this._isRunningInitPreselectCoachIndex = !1;
493
+ return;
494
+ }
495
+ if (this.coachItemDetailsElements[this.currSelectedCoachIndex] && this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea) {
496
+ this._setFocusToSelectedCoachGrid();
497
+ return;
498
+ }
499
+ if (this.isKeyboardNavigation && this.isAutoScrolling) {
500
+ let e = this._getClosestPlaceByKeyDirection();
501
+ e ? (this.unfocusPlaceElement(), this.focusPlaceElement(e), this.focusedCoachIndex = -1) : this._setFocusToSelectedCoachGrid();
502
+ } else this.unfocusPlaceElement(), this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid();
503
+ }
504
+ }
505
+ scrollToSelectedNavCoach(e) {
506
+ if (this._isValidCoachIndex(e) && e !== this.currSelectedCoachIndex) {
507
+ this.hoveredCoachIndex = e, this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
508
+ let t = this._getCoachScrollPositionX();
509
+ (this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? (this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.coachScrollArea.scrollTo({
510
+ top: this.alignVertical ? t : 0,
511
+ left: this.alignVertical ? 0 : t,
512
+ behavior: "smooth"
513
+ })) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
514
+ }
515
+ }
516
+ focusPlaceElement(e) {
517
+ if (this.unfocusPlaceElement(), e) {
518
+ this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
519
+ let t = this._getPlaceHtmlElement();
520
+ if (t) {
521
+ t.setAttribute("keyfocus", "focus");
522
+ let n = setTimeout(() => {
523
+ let t = this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number);
524
+ this._scrollPlaceIntoNearestViewport(t), clearTimeout(n);
525
+ }, 0);
526
+ }
527
+ }
528
+ }
529
+ unfocusPlaceElement() {
530
+ let e = this._getPlaceHtmlElement();
531
+ e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
532
+ }
533
+ getCalculatedDimension(e, t, n, r) {
534
+ return t && !n && (e.h += this.coachBorderOffset * 2), r && (e.h += this.coachBorderOffset), {
535
+ w: this.baseGridSize * e.w,
536
+ h: this.baseGridSize * e.h
537
+ };
538
+ }
539
+ getCalculatedPosition(e, t, n, r) {
540
+ if (n && t) {
541
+ let i = r ? n.h : n.h + this.coachBorderOffset;
542
+ e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === i && (e.y += this.coachBorderOffset);
543
+ }
544
+ return {
545
+ x: this.baseGridSize * e.x,
546
+ y: this.baseGridSize * e.y,
547
+ z: e.z
548
+ };
549
+ }
550
+ isElementDirectlyOnBorder(e, t) {
551
+ return e.position.y === 0 || e.position.y + e.dimension.h === t.h;
552
+ }
553
+ getAvailableFreePlacesNumFromCoach(e) {
554
+ let t = {
555
+ seats: 0,
556
+ bicycles: 0
557
+ };
558
+ return e?.reduce((e, t) => (t.state === "FREE" && (t.type === "SEAT" ? e.seats++ : e.bicycles++), e), t) || t;
559
+ }
560
+ _handleCoachAreaScrollendEvent() {
561
+ let e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
562
+ if (this.preventCoachScrollByPlaceClick) {
563
+ Math.abs(this._lastStartScrollPos - this.coachScrollArea.scrollLeft) > this.baseGridSize * 2 && (this.selectedCoachIndex = e), this.preventCoachScrollByPlaceClick = !1;
564
+ return;
565
+ }
566
+ this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.hoveredCoachIndex = -1, this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = e), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = e : this.currSelectedCoachIndex = e < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : e, this.isAutoScrolling || this._scrollToSelectedNavigationButton(e), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
567
+ }
568
+ _scrollToSelectedNavigationButton(e) {
569
+ setTimeout(() => {
570
+ if (this.hasNavigation && this.navigationScrollArea) {
571
+ let t = this.scrollNavigationAreaDim / 2, n = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
572
+ this.navigationScrollArea.scrollTo({
573
+ top: this.alignVertical ? n : 0,
574
+ left: this.alignVertical ? 0 : n,
575
+ behavior: "smooth"
576
+ });
577
+ }
578
+ }, 10);
579
+ }
580
+ _setScrollDirectionByCoachIndex() {
581
+ this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? l.right : l.left;
582
+ }
583
+ _getCoachScrollPositionX() {
584
+ let e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
585
+ return this.isKeyboardNavigation && this.currScrollDirection === l.left && e.width > this.scrollCoachesAreaWidth ? e.end - this.scrollCoachesAreaWidth : e.start;
586
+ }
587
+ _setFocusToSelectedCoachGrid() {
588
+ if (this.isCoachGridFocusable && this.hasSeatReservationNativeFocus) {
589
+ this.isCoachGridFocusable = !1;
590
+ let e = this.shadowRoot?.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
591
+ e && e.focus();
592
+ }
593
+ }
594
+ _isScrollableToSelectedCoach() {
595
+ let e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, n = this.maxCalcCoachesWidth - t, r = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], i = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
596
+ return (e < n || e > r.start) && !i;
597
+ }
598
+ _getCoachIndexByScrollTriggerPosition() {
599
+ let e = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachesAreaWidth / 2;
600
+ return this.triggerCoachPositionsCollection.findIndex((t) => e >= t.start && e <= t.end);
601
+ }
602
+ _getFirstPlaceInSelectedCoach() {
603
+ let e = null, t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], n = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", r = this.shadowRoot?.querySelector("#" + n)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
604
+ return t && r && (e = t.places?.find((e) => e.number === r) || null), e;
605
+ }
606
+ _getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
607
+ return !this.currSelectedPlace || e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft ? null : e === this.keyboardNavigationEvents.ArrowDown && this.currSelectedPlace.position.y + 2 === t.dimension.h && this.seatReservations[this.currSelectedDeckIndex + 1] ? this.currSelectedDeckIndex + 1 : e === this.keyboardNavigationEvents.ArrowUp && this.currSelectedPlace.position.y === 0 && this.seatReservations[this.currSelectedDeckIndex - 1] ? this.currSelectedDeckIndex - 1 : null;
608
+ }
609
+ _getClosestPlaceByKeyDirection(e) {
610
+ let t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], n = null, r = t.places, i = null;
611
+ if (r) {
612
+ if (!this.currSelectedPlaceElementId) return this._getFirstPlaceInSelectedCoach();
613
+ if (this.currSelectedPlace) {
614
+ let a = { ...this.currSelectedPlace.position };
615
+ e && (i = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), i !== null && (r = this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places || [], a.y = i < this.currSelectedDeckIndex ? t.dimension.h : -1));
616
+ for (let t of r) e ? t.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (t.position.y === a.y || t.position.y === a.y - 1) && t.position.x > a.x && (!n || t.position.x < n.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (t.position.x === a.x || t.position.x === a.x + 1) && t.position.y > a.y && (!n || t.position.y < n.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (t.position.y === a.y || t.position.y === a.y + 1) && t.position.x < a.x && (!n || t.position.x > n.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (t.position.x === a.x || t.position.x === a.x - 1) && t.position.y < a.y && (!n || t.position.y > n.position.y)) && (n = t) : (this.currScrollDirection === l.right && t.position.y === a.y && (!n || t.position.x < n.position.x) || this.currScrollDirection === l.left && t.position.y === a.y && (!n || t.position.x > n.position.x)) && (n = t);
617
+ i !== null && n && (this.currSelectedDeckIndex = i);
618
+ }
619
+ }
620
+ return n;
621
+ }
622
+ _navigateCoachNavigationByKeyboard(e) {
623
+ let t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, n = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
624
+ if (this.hasNavigation) {
625
+ let r = this._getPlaceHtmlElement(), i = r ? r.getAttribute("keyfocus") === "focus" : !1;
626
+ if (e === "PREV_TAB" && this.selectedCoachIndex === t) if (i || this.currSelectedPlace !== null) {
627
+ this.focusedCoachIndex = t, this.unfocusPlaceElement();
628
+ return;
629
+ } else t === 0 ? this._refocusCurrentFocusedNavCoach(t) : this.focusedCoachIndex = n;
630
+ else n === this.currSelectedCoachIndex ? e === "NEXT_TAB" && n === this.coachItemDetailsElements.length - 1 ? this._refocusCurrentFocusedNavCoach(t) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = n, i ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid())) : this.focusedCoachIndex = n;
631
+ this._scrollToSelectedNavigationButton(n);
632
+ } else this.scrollToSelectedNavCoach(n);
633
+ }
634
+ _refocusCurrentFocusedNavCoach(e) {
635
+ this.focusedCoachIndex = -1, setTimeout(() => this.focusedCoachIndex = e, 0);
636
+ }
637
+ _navigateToPlaceByKeyboard(e) {
638
+ if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
639
+ let t = this._getClosestPlaceByKeyDirection(e);
640
+ if (t) this.focusPlaceElement(t);
641
+ else if (e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft || this.alignVertical && (e === this.keyboardNavigationEvents.ArrowUp || e === this.keyboardNavigationEvents.ArrowDown)) {
642
+ let t = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
643
+ this.scrollToSelectedNavCoach(t);
644
+ }
645
+ }
646
+ }
647
+ getNextAvailableCoachIndex(e) {
648
+ let t = e ?? this.currSelectedCoachIndex;
649
+ return t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 ? t + 1 : t;
650
+ }
651
+ getPrevAvailableCoachIndex(e) {
652
+ let t = e ?? this.currSelectedCoachIndex;
653
+ return t > 0 ? t - 1 : t;
654
+ }
655
+ updateSelectedSeatReservationPlaces(e) {
656
+ let t = e.placeType === "SEAT" ? "seats" : "bicycles", n = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, r = this.selectedSeatReservationPlaces[t];
657
+ this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(r, n, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
658
+ bubbles: !0,
659
+ composed: !0,
660
+ detail: this.selectedSeatReservationPlaces
661
+ }));
662
+ }
663
+ _updateSelectedSeatReservationPlaces(e, t, n) {
664
+ if (n.state === "SELECTED") {
665
+ let t = this._getDeckIndexByPlaceId(n.id), r = this._getSeatReservationPlaceSelection(n, t);
666
+ r && e.push(r);
667
+ } else e = e.filter((e) => e.id !== n.id);
668
+ if (t > -1 && e.length > t) {
669
+ let r = t > 0 ? n : void 0;
670
+ e = this._resetAllPlaceSelections(e, r);
671
+ }
672
+ return e;
673
+ }
674
+ updateCurrentSelectedPlaceInCoach(e) {
675
+ let t = this._getDeckIndexByPlaceId(e.id), n = e.coachIndex;
676
+ if (t === null) return;
677
+ let r = this.seatReservations[t].coachItems[n].places?.find((t) => t.number == e.number);
678
+ if (!r) return;
679
+ this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = n, this.currSelectedPlace = r, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(r);
680
+ let i = setTimeout(() => {
681
+ this._scrollPlaceIntoNearestViewport(e.id), clearTimeout(i);
682
+ }, 0);
683
+ }
684
+ updateCurrentSelectedCoach() {
685
+ if (this.currSelectedCoachIndex == this.selectedCoachIndex) return;
686
+ this.focusedCoachIndex != -1 && (this.focusedCoachIndex = this.currSelectedCoachIndex), this.selectedCoachIndex = this.currSelectedCoachIndex;
687
+ let e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
688
+ e && this.dispatchEvent(new CustomEvent("selectedcoach", {
689
+ bubbles: !0,
690
+ composed: !0,
691
+ detail: e
692
+ }));
693
+ }
694
+ getPlaceElementId(e, t, n) {
695
+ return "seat-reservation__place-button-" + e + "-" + t + "-" + n;
696
+ }
697
+ _initEmptyCoachDeckOffsets() {
698
+ let e = Array(this.seatReservations.length - 1).fill(0);
699
+ this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((t) => {
700
+ for (let n = 0; n < this.seatReservations.length - 1; n++) {
701
+ let r = this.seatReservations[n].coachItems[e[n]];
702
+ if (t.id != r?.id) {
703
+ let r = {
704
+ ...t,
705
+ places: void 0,
706
+ propertyIds: void 0,
707
+ graphicElements: void 0,
708
+ serviceElements: void 0,
709
+ travelClass: []
710
+ };
711
+ this.seatReservations[n].coachItems.splice(e[n], 0, r);
712
+ }
713
+ e[n]++;
714
+ }
715
+ });
716
+ }
717
+ _initSeatReservationPlaceSelection() {
718
+ this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((n, r) => {
719
+ n.places?.filter((e) => e.state === "SELECTED")?.forEach((n) => {
720
+ let i = re(n, this.getPlaceElementId(t, r, n.number), e.deckCoachIndex, r), a = this._getSeatReservationPlaceSelection(i, t);
721
+ a && (a.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(a) : this.selectedSeatReservationPlaces.bicycles.push(a));
722
+ });
723
+ }));
724
+ }
725
+ _resetAllPlaceSelections(e, t) {
726
+ for (let n of e) if (!t || t.id !== n.id) {
727
+ let e = this.shadowRoot?.getElementById(n.id);
728
+ e && e.setAttribute("state", "FREE");
729
+ }
730
+ return e = t ? e.filter((e) => e.id === t.id) : [], e;
731
+ }
732
+ _getSeatReservationPlaceSelection(e, t) {
733
+ if (t === null) return null;
734
+ let n = this.seatReservations[t].coachItems[e.coachIndex], r = n.places?.find((t) => t.number === e.number);
735
+ return r ? ne(r, n, e.id, e.deckIndex, e.coachIndex) : null;
736
+ }
737
+ _getSeatReservationSelectedCoach(e) {
738
+ if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e]) return null;
739
+ let t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e];
740
+ return te(e, t, this.getAvailableFreePlacesNumFromCoach(t.places));
741
+ }
742
+ _setCurrSelectedPlaceElementId(e) {
743
+ this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
744
+ }
745
+ _determineBaseFontSize() {
746
+ if (!i) {
747
+ let e = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
748
+ this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${e + "rem"}`);
749
+ }
750
+ }
751
+ _prepareCoachItemDetailsData() {
752
+ if (this.seatReservations) {
753
+ let e = this.seatReservations[this.seatReservations.length - 1].coachItems;
754
+ this.coachItemDetailsElements = [], e.forEach((e, t) => {
755
+ let n = [], r = [], i = [];
756
+ this.seatReservations.map((e) => e.coachItems[t]).forEach((e) => {
757
+ n.push(...e.travelClass), r.push(...e.propertyIds ? e.propertyIds : []), i.push(...e.places ? e.places : []);
758
+ }), this.coachItemDetailsElements.push({
759
+ id: e.id,
760
+ travelClass: this._prepareTravelClassNavigation(n),
761
+ propertyIds: this._prepareServiceIconsNavigation(r),
762
+ isDriverArea: e.places ? e.places.length === 0 : !0,
763
+ driverAreaSide: this._prepareDriverAreaSideNavigation(e),
764
+ freePlaces: this.getAvailableFreePlacesNumFromCoach(i),
765
+ driverAreaElements: this._setDriverAreasElements(e)
766
+ });
767
+ });
768
+ }
769
+ }
770
+ _prepareTravelClassNavigation(e) {
771
+ return e.indexOf("FIRST") === -1 ? e.indexOf("SECOND") === -1 ? "ANY_CLASS" : "SECOND" : "FIRST";
772
+ }
773
+ _prepareDriverAreaSideNavigation(e) {
774
+ let t = e.graphicElements?.filter((e) => e.icon === "DRIVER_AREA");
775
+ if (t && t.length > 0) {
776
+ let e = t.find((e) => e.position.x === 0) || !1, n = t.find((e) => e.position.x > 0) || !1;
777
+ return {
778
+ left: !!e,
779
+ right: !!n
780
+ };
781
+ }
782
+ }
783
+ _prepareCoachWidthAndGapCalculations() {
784
+ this.seatReservations && this.seatReservations.forEach((e) => {
785
+ e?.coachItems?.forEach((e) => {
786
+ let t = this._isOverhangingElementsPresent(e.dimension.w, e.places), n = e.graphicElements?.filter((e) => e.icon && !this.notAreaElements.includes(e.icon)), r = this._isOverhangingElementsPresent(e.dimension.w, n);
787
+ this.overHangingElementInformation.push({
788
+ coachId: e.id,
789
+ overhangingPlaces: t,
790
+ overhangingGraphicAreas: r
791
+ });
792
+ });
793
+ });
794
+ }
795
+ _getPlaceHtmlElement() {
796
+ return this.currSelectedPlaceElementId && this.shadowRoot?.getElementById(this.currSelectedPlaceElementId) || null;
797
+ }
798
+ _getDeckIndexByPlaceId(e) {
799
+ let t = this.shadowRoot?.querySelector("#" + e)?.getAttribute("data-deck-index");
800
+ return t && !isNaN(+t) ? +t : null;
801
+ }
802
+ _isValidCoachIndex(e) {
803
+ return e >= 0 && e <= this.seatReservations[this.seatReservations.length - 1].coachItems.length;
804
+ }
805
+ _getExistingCoachDeckIndex() {
806
+ if (this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places !== void 0) return this.currSelectedDeckIndex;
807
+ let e = this.seatReservations.findIndex((e) => e.coachItems[this.currSelectedCoachIndex].places !== void 0);
808
+ return this.currSelectedDeckIndex >= e ? this.currSelectedDeckIndex : e;
809
+ }
810
+ _scrollPlaceIntoNearestViewport(e) {
811
+ this.shadowRoot?.getElementById(e)?.scrollIntoView({
812
+ behavior: "smooth",
813
+ block: "nearest",
814
+ inline: "nearest"
815
+ });
816
+ }
817
+ _isOverhangingElementsPresent(e, t) {
818
+ return t?.some((t) => t.position.x === 0 || t.position.x + t.dimension.w >= e) ?? !1;
819
+ }
820
+ _setDriverAreasElements(e) {
821
+ return e ? {
822
+ driverArea: e.graphicElements?.find((e) => e.icon === "DRIVER_AREA"),
823
+ driverAreaNoVerticalWall: e.type === "LOCOMOTIVE_COACH" ? e.graphicElements?.find((e) => e.icon === "DRIVER_AREA_NO_VERTICAL_WALL") : void 0
824
+ } : {
825
+ driverArea: void 0,
826
+ driverAreaNoVerticalWall: void 0
827
+ };
828
+ }
829
+ _onLeaveSeatReservationComponent() {
830
+ this.hasNavigation && (this.focusedCoachIndex = -1), this.unfocusPlaceElement();
831
+ }
832
+ };
807
833
  })();
808
- export {
809
- Me as SeatReservationBaseElement
810
- };
834
+ //#endregion
835
+ export { u as SeatReservationBaseElement };