@sbb-esta/lyne-elements-experimental 1.9.0 → 1.11.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 (52) hide show
  1. package/core/datetime.js +116 -105
  2. package/core/timetable/access-leg-helper.d.ts +2 -1
  3. package/core/timetable/access-leg-helper.d.ts.map +1 -1
  4. package/core/timetable.js +111 -76
  5. package/custom-elements.json +44 -0
  6. package/development/core/datetime.js +53 -51
  7. package/development/core/timetable/access-leg-helper.d.ts +2 -1
  8. package/development/core/timetable/access-leg-helper.d.ts.map +1 -1
  9. package/development/core/timetable.js +57 -22
  10. package/development/differenceInMinutes-Cmyza6nm.js +26 -0
  11. package/development/format-DTy5_IOt.js +1371 -0
  12. package/development/isValid-DO_pHwcW.js +53 -0
  13. package/development/journey-summary.js +4 -17
  14. package/development/pearl-chain/pearl-chain.sample-data.d.ts +1 -0
  15. package/development/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -1
  16. package/development/pearl-chain-time/pearl-chain-time.d.ts +2 -0
  17. package/development/pearl-chain-time/pearl-chain-time.d.ts.map +1 -1
  18. package/development/pearl-chain-time.js +21 -21
  19. package/development/pearl-chain-vertical-item.js +2 -15
  20. package/development/pearl-chain-vertical.js +2 -15
  21. package/development/pearl-chain.js +8 -25
  22. package/development/timetable-duration.js +2 -15
  23. package/development/timetable-row/timetable-row.d.ts +7 -0
  24. package/development/timetable-row/timetable-row.d.ts.map +1 -1
  25. package/development/timetable-row/timetable-row.sample-data.d.ts +2 -0
  26. package/development/timetable-row/timetable-row.sample-data.d.ts.map +1 -1
  27. package/development/timetable-row.js +9 -17
  28. package/development/toDate-B6IBgPYH.js +24 -0
  29. package/differenceInMinutes-BI2zjbtS.js +23 -0
  30. package/{format-fWxoS2xH.js → format-oBQcGL50.js} +343 -344
  31. package/isValid-mroh13Xp.js +45 -0
  32. package/journey-summary.js +2 -2
  33. package/package.json +2 -2
  34. package/pearl-chain/pearl-chain.sample-data.d.ts +1 -0
  35. package/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -1
  36. package/pearl-chain-time/pearl-chain-time.d.ts +2 -0
  37. package/pearl-chain-time/pearl-chain-time.d.ts.map +1 -1
  38. package/pearl-chain-time.js +38 -34
  39. package/pearl-chain.js +57 -59
  40. package/timetable-row/timetable-row.d.ts +7 -0
  41. package/timetable-row/timetable-row.d.ts.map +1 -1
  42. package/timetable-row/timetable-row.sample-data.d.ts +2 -0
  43. package/timetable-row/timetable-row.sample-data.d.ts.map +1 -1
  44. package/timetable-row.js +41 -36
  45. package/toDate-DQg4ZFnf.js +15 -0
  46. package/constants-DSR8hPvP.js +0 -16
  47. package/development/constants-BMGwMkN3.js +0 -30
  48. package/development/differenceInMinutes-DHtPDiUE.js +0 -30
  49. package/development/format-DkbylFCM.js +0 -1373
  50. package/development/isValid-BVccOlli.js +0 -44
  51. package/differenceInMinutes-BhHyuJc4.js +0 -28
  52. package/isValid-DSjxf8eh.js +0 -36
package/core/datetime.js CHANGED
@@ -1,156 +1,167 @@
1
- import { i18nDurationDay as p, i18nDurationHour as g, i18nDurationMinute as N } from "@sbb-esta/lyne-elements/core/i18n.js";
2
- import { t as m, c as M, a as d, b as h } from "../constants-DSR8hPvP.js";
3
- import { d as I, i as $ } from "../isValid-DSjxf8eh.js";
4
- import { b as y, c as U, g as C, a as Y, d as F } from "../differenceInMinutes-BhHyuJc4.js";
5
- function x(t, e) {
6
- const n = m(t);
7
- return isNaN(e) ? M(t, NaN) : (e && n.setDate(n.getDate() + e), n);
8
- }
9
- function H(t, e) {
10
- return y(t, e * d);
11
- }
12
- function S(t, e) {
13
- const n = m(t), s = m(e), r = T(n, s), i = Math.abs(I(n, s));
14
- n.setDate(n.getDate() - r * i);
15
- const a = +(T(n, s) === -r), u = r * (i - a);
16
- return u === 0 ? 0 : u;
17
- }
18
- function T(t, e) {
1
+ import { i18nDurationDay as h, i18nDurationHour as T, i18nDurationMinute as p } from "@sbb-esta/lyne-elements/core/i18n.js";
2
+ import { t as d, c as N, a as m, b as w } from "../toDate-DQg4ZFnf.js";
3
+ import { n as I, d as y, i as U } from "../isValid-mroh13Xp.js";
4
+ import { g as C, a as Y, d as F } from "../differenceInMinutes-BI2zjbtS.js";
5
+ function x(t, e, n) {
6
+ const r = d(t, n == null ? void 0 : n.in);
7
+ return isNaN(e) ? N(t, NaN) : (e && r.setDate(r.getDate() + e), r);
8
+ }
9
+ function z(t, e, n) {
10
+ return N(t, +d(t) + e);
11
+ }
12
+ function H(t, e, n) {
13
+ return z(t, e * m);
14
+ }
15
+ function S(t, e, n) {
16
+ const [r, i] = I(
17
+ n == null ? void 0 : n.in,
18
+ t,
19
+ e
20
+ ), s = M(r, i), u = Math.abs(
21
+ y(r, i)
22
+ );
23
+ r.setDate(r.getDate() - s * u);
24
+ const a = +(M(r, i) === -s), c = s * (u - a);
25
+ return c === 0 ? 0 : c;
26
+ }
27
+ function M(t, e) {
19
28
  const n = t.getFullYear() - e.getFullYear() || t.getMonth() - e.getMonth() || t.getDate() - e.getDate() || t.getHours() - e.getHours() || t.getMinutes() - e.getMinutes() || t.getSeconds() - e.getSeconds() || t.getMilliseconds() - e.getMilliseconds();
20
29
  return n < 0 ? -1 : n > 0 ? 1 : n;
21
30
  }
22
- function z(t, e, n) {
23
- const s = U(t, e) / d;
31
+ function Z(t, e, n) {
32
+ const [r, i] = I(
33
+ n == null ? void 0 : n.in,
34
+ t,
35
+ e
36
+ ), s = (+r - +i) / m;
24
37
  return C(n == null ? void 0 : n.roundingMethod)(s);
25
38
  }
26
- function Z(t, e) {
27
- return x(t, -e);
39
+ function v(t, e, n) {
40
+ return x(t, -e, n);
28
41
  }
29
- function b(t, e) {
30
- const s = W(t);
31
- let r;
32
- if (s.date) {
33
- const o = _(s.date, 2);
34
- r = j(o.restDateString, o.year);
42
+ function O(t, e) {
43
+ const n = () => N(e == null ? void 0 : e.in, NaN), i = k(t);
44
+ let s;
45
+ if (i.date) {
46
+ const o = W(i.date, 2);
47
+ s = j(o.restDateString, o.year);
35
48
  }
36
- if (!r || isNaN(r.getTime()))
37
- return /* @__PURE__ */ new Date(NaN);
38
- const i = r.getTime();
39
- let a = 0, u;
40
- if (s.time && (a = A(s.time), isNaN(a)))
41
- return /* @__PURE__ */ new Date(NaN);
42
- if (s.timezone) {
43
- if (u = E(s.timezone), isNaN(u))
44
- return /* @__PURE__ */ new Date(NaN);
49
+ if (!s || isNaN(+s)) return n();
50
+ const u = +s;
51
+ let a = 0, c;
52
+ if (i.time && (a = A(i.time), isNaN(a)))
53
+ return n();
54
+ if (i.timezone) {
55
+ if (c = E(i.timezone), isNaN(c)) return n();
45
56
  } else {
46
- const o = new Date(i + a), c = /* @__PURE__ */ new Date(0);
47
- return c.setFullYear(
57
+ const o = new Date(u + a), D = d(0, e == null ? void 0 : e.in);
58
+ return D.setFullYear(
48
59
  o.getUTCFullYear(),
49
60
  o.getUTCMonth(),
50
61
  o.getUTCDate()
51
- ), c.setHours(
62
+ ), D.setHours(
52
63
  o.getUTCHours(),
53
64
  o.getUTCMinutes(),
54
65
  o.getUTCSeconds(),
55
66
  o.getUTCMilliseconds()
56
- ), c;
67
+ ), D;
57
68
  }
58
- return new Date(i + a + u);
69
+ return d(u + a + c, e == null ? void 0 : e.in);
59
70
  }
60
- const f = {
71
+ const l = {
61
72
  dateTimeDelimiter: /[T ]/,
62
73
  timeZoneDelimiter: /[Z ]/i,
63
74
  timezone: /([Z+-].*)$/
64
- }, O = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, v = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, k = /^([+-])(\d{2})(?::?(\d{2}))?$/;
65
- function W(t) {
66
- const e = {}, n = t.split(f.dateTimeDelimiter);
67
- let s;
75
+ }, _ = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, b = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, R = /^([+-])(\d{2})(?::?(\d{2}))?$/;
76
+ function k(t) {
77
+ const e = {}, n = t.split(l.dateTimeDelimiter);
78
+ let r;
68
79
  if (n.length > 2)
69
80
  return e;
70
- if (/:/.test(n[0]) ? s = n[0] : (e.date = n[0], s = n[1], f.timeZoneDelimiter.test(e.date) && (e.date = t.split(f.timeZoneDelimiter)[0], s = t.substr(
81
+ if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], l.timeZoneDelimiter.test(e.date) && (e.date = t.split(l.timeZoneDelimiter)[0], r = t.substr(
71
82
  e.date.length,
72
83
  t.length
73
- ))), s) {
74
- const r = f.timezone.exec(s);
75
- r ? (e.time = s.replace(r[1], ""), e.timezone = r[1]) : e.time = s;
84
+ ))), r) {
85
+ const i = l.timezone.exec(r);
86
+ i ? (e.time = r.replace(i[1], ""), e.timezone = i[1]) : e.time = r;
76
87
  }
77
88
  return e;
78
89
  }
79
- function _(t, e) {
90
+ function W(t, e) {
80
91
  const n = new RegExp(
81
92
  "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
82
- ), s = t.match(n);
83
- if (!s) return { year: NaN, restDateString: "" };
84
- const r = s[1] ? parseInt(s[1]) : null, i = s[2] ? parseInt(s[2]) : null;
93
+ ), r = t.match(n);
94
+ if (!r) return { year: NaN, restDateString: "" };
95
+ const i = r[1] ? parseInt(r[1]) : null, s = r[2] ? parseInt(r[2]) : null;
85
96
  return {
86
- year: i === null ? r : i * 100,
87
- restDateString: t.slice((s[1] || s[2]).length)
97
+ year: s === null ? i : s * 100,
98
+ restDateString: t.slice((r[1] || r[2]).length)
88
99
  };
89
100
  }
90
101
  function j(t, e) {
91
102
  if (e === null) return /* @__PURE__ */ new Date(NaN);
92
- const n = t.match(O);
103
+ const n = t.match(_);
93
104
  if (!n) return /* @__PURE__ */ new Date(NaN);
94
- const s = !!n[4], r = l(n[1]), i = l(n[2]) - 1, a = l(n[3]), u = l(n[4]), o = l(n[5]) - 1;
95
- if (s)
96
- return B(e, u, o) ? J(e, u, o) : /* @__PURE__ */ new Date(NaN);
105
+ const r = !!n[4], i = f(n[1]), s = f(n[2]) - 1, u = f(n[3]), a = f(n[4]), c = f(n[5]) - 1;
106
+ if (r)
107
+ return G(e, a, c) ? J(e, a, c) : /* @__PURE__ */ new Date(NaN);
97
108
  {
98
- const c = /* @__PURE__ */ new Date(0);
99
- return !V(e, i, a) || !q(e, r) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, i, Math.max(r, a)), c);
109
+ const o = /* @__PURE__ */ new Date(0);
110
+ return !q(e, s, u) || !B(e, i) ? /* @__PURE__ */ new Date(NaN) : (o.setUTCFullYear(e, s, Math.max(i, u)), o);
100
111
  }
101
112
  }
102
- function l(t) {
113
+ function f(t) {
103
114
  return t ? parseInt(t) : 1;
104
115
  }
105
116
  function A(t) {
106
- const e = t.match(v);
117
+ const e = t.match(b);
107
118
  if (!e) return NaN;
108
- const n = D(e[1]), s = D(e[2]), r = D(e[3]);
109
- return G(n, s, r) ? n * d + s * h + r * 1e3 : NaN;
119
+ const n = g(e[1]), r = g(e[2]), i = g(e[3]);
120
+ return K(n, r, i) ? n * m + r * w + i * 1e3 : NaN;
110
121
  }
111
- function D(t) {
122
+ function g(t) {
112
123
  return t && parseFloat(t.replace(",", ".")) || 0;
113
124
  }
114
125
  function E(t) {
115
126
  if (t === "Z") return 0;
116
- const e = t.match(k);
127
+ const e = t.match(R);
117
128
  if (!e) return 0;
118
- const n = e[1] === "+" ? -1 : 1, s = parseInt(e[2]), r = e[3] && parseInt(e[3]) || 0;
119
- return K(s, r) ? n * (s * d + r * h) : NaN;
129
+ const n = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), i = e[3] && parseInt(e[3]) || 0;
130
+ return P(r, i) ? n * (r * m + i * w) : NaN;
120
131
  }
121
132
  function J(t, e, n) {
122
- const s = /* @__PURE__ */ new Date(0);
123
- s.setUTCFullYear(t, 0, 4);
124
- const r = s.getUTCDay() || 7, i = (e - 1) * 7 + n + 1 - r;
125
- return s.setUTCDate(s.getUTCDate() + i), s;
133
+ const r = /* @__PURE__ */ new Date(0);
134
+ r.setUTCFullYear(t, 0, 4);
135
+ const i = r.getUTCDay() || 7, s = (e - 1) * 7 + n + 1 - i;
136
+ return r.setUTCDate(r.getUTCDate() + s), r;
126
137
  }
127
- const R = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
128
- function w(t) {
138
+ const V = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
139
+ function $(t) {
129
140
  return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
130
141
  }
131
- function V(t, e, n) {
132
- return e >= 0 && e <= 11 && n >= 1 && n <= (R[e] || (w(t) ? 29 : 28));
142
+ function q(t, e, n) {
143
+ return e >= 0 && e <= 11 && n >= 1 && n <= (V[e] || ($(t) ? 29 : 28));
133
144
  }
134
- function q(t, e) {
135
- return e >= 1 && e <= (w(t) ? 366 : 365);
145
+ function B(t, e) {
146
+ return e >= 1 && e <= ($(t) ? 366 : 365);
136
147
  }
137
- function B(t, e, n) {
148
+ function G(t, e, n) {
138
149
  return e >= 1 && e <= 53 && n >= 0 && n <= 6;
139
150
  }
140
- function G(t, e, n) {
151
+ function K(t, e, n) {
141
152
  return t === 24 ? e === 0 && n === 0 : n >= 0 && n < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
142
153
  }
143
- function K(t, e) {
154
+ function P(t, e) {
144
155
  return e >= 0 && e <= 59;
145
156
  }
146
- function P(t, e) {
157
+ function Q(t, e, n) {
147
158
  return H(t, -e);
148
159
  }
149
- function te(t) {
160
+ function ne(t) {
150
161
  if (!t)
151
162
  return;
152
- const e = b(t);
153
- if ($(e)) {
163
+ const e = O(t);
164
+ if (U(e)) {
154
165
  if (t.includes("Z"))
155
166
  return new Date(t.replace("Z", ""));
156
167
  if (t.includes("T")) {
@@ -161,26 +172,26 @@ function te(t) {
161
172
  return new Date(t);
162
173
  }
163
174
  }
164
- const ne = (t, e) => {
165
- const n = [], s = [];
166
- let i = Y(0, t);
167
- const a = S(i, 0);
168
- a > 0 && (n.push(`${a} d`), e && s.push(
169
- `${a} ${a > 1 ? p.multiple.long[e] : p.single.long[e]}`
170
- ), i = Z(i, a));
171
- const u = z(i, 0);
172
- u > 0 && (n.push(`${u} h`), e && s.push(
173
- `${u} ${u > 1 ? g.multiple.long[e] : g.single.long[e]}`
174
- ), i = P(i, u));
175
- const o = F(i, 0);
176
- return o > 0 && (n.push(`${o} min`), e && s.push(
177
- `${o} ${o > 1 ? N.multiple.long[e] : N.single.long[e]}`
175
+ const re = (t, e) => {
176
+ const n = [], r = [];
177
+ let s = Y(0, t);
178
+ const u = S(s, 0);
179
+ u > 0 && (n.push(`${u} d`), e && r.push(
180
+ `${u} ${u > 1 ? h.multiple.long[e] : h.single.long[e]}`
181
+ ), s = v(s, u));
182
+ const a = Z(s, 0);
183
+ a > 0 && (n.push(`${a} h`), e && r.push(
184
+ `${a} ${a > 1 ? T.multiple.long[e] : T.single.long[e]}`
185
+ ), s = Q(s, a));
186
+ const c = F(s, 0);
187
+ return c > 0 && (n.push(`${c} min`), e && r.push(
188
+ `${c} ${c > 1 ? p.multiple.long[e] : p.single.long[e]}`
178
189
  )), {
179
190
  short: n.join(" "),
180
- long: s.join(" ")
191
+ long: r.join(" ")
181
192
  };
182
193
  };
183
194
  export {
184
- ne as durationToTime,
185
- te as removeTimezoneFromISOTimeString
195
+ re as durationToTime,
196
+ ne as removeTimezoneFromISOTimeString
186
197
  };
@@ -10,12 +10,13 @@ interface IAccessAttribute {
10
10
  * @param departureWalk: The walking distance in minutes from the departure point to the first leg.
11
11
  * @param arrivalWalk: The walking distance in minutes from the last leg to the arrival point.
12
12
  * @param currentLanguage: The current language for localization.
13
+ * @param a11yFootpath: Whether the a11y-icon should be shown.
13
14
  * @returns renderDepartureTimeAttribute: A function that renders the element for the departure time attribute.
14
15
  * @returns renderArrivalTimeAttribute: A function that renders the element for the arrival time attribute.
15
16
  * @returns arrivalTimeAttribute: The access attribute for the arrival time.
16
17
  * @returns departureTimeAttribute: The access attribute for the departure time.
17
18
  */
18
- export declare function getDepartureArrivalTimeAttribute(legs: Leg[], departureWalk: number, arrivalWalk: number, currentLanguage: string): {
19
+ export declare function getDepartureArrivalTimeAttribute(legs: Leg[], departureWalk: number, arrivalWalk: number, currentLanguage: string, a11yFootpath?: boolean): {
19
20
  renderDepartureTimeAttribute: () => TemplateResult;
20
21
  renderArrivalTimeAttribute: () => TemplateResult;
21
22
  departureTimeAttribute: IAccessAttribute | null;
@@ -1 +1 @@
1
- {"version":3,"file":"access-leg-helper.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/core/timetable/access-leg-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ1C,OAAO,KAAK,EAAE,GAAG,EAA8B,MAAM,2BAA2B,CAAC;AAEjF,OAAO,iCAAiC,CAAC;AAEzC,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AA2HD;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,GAAG,EAAE,EACX,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB;IACD,4BAA4B,EAAE,MAAM,cAAc,CAAC;IACnD,0BAA0B,EAAE,MAAM,cAAc,CAAC;IACjD,sBAAsB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChD,oBAAoB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC/C,CAyGA"}
1
+ {"version":3,"file":"access-leg-helper.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/core/timetable/access-leg-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ1C,OAAO,KAAK,EAAE,GAAG,EAA8B,MAAM,2BAA2B,CAAC;AAEjF,OAAO,iCAAiC,CAAC;AAEzC,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAuID;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,GAAG,EAAE,EACX,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,OAAO,GACrB;IACD,4BAA4B,EAAE,MAAM,cAAc,CAAC;IACnD,0BAA0B,EAAE,MAAM,cAAc,CAAC;IACjD,sBAAsB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChD,oBAAoB,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC/C,CAiJA"}
package/core/timetable.js CHANGED
@@ -1,56 +1,56 @@
1
- import { i18nWalkingDistanceDeparture as k, i18nWalkingDistanceArrival as y } from "@sbb-esta/lyne-elements/core/i18n.js";
2
- import { html as b, nothing as m } from "lit";
1
+ import { i18nWalkingDistanceDeparture as w, i18nWalkingDistanceArrival as T } from "@sbb-esta/lyne-elements/core/i18n.js";
2
+ import { html as f, nothing as b } from "lit";
3
3
  import "@sbb-esta/lyne-elements/icon.js";
4
- const x = (t) => (t == null ? void 0 : t.__typename) === "PTRideLeg", _ = (t) => (t == null ? void 0 : t.__typename) === "PTConnectionLeg", A = (t) => {
5
- var n, r, u, s, a, o;
6
- const i = ((n = t == null ? void 0 : t.text) == null ? void 0 : n.template) && t.text.template.indexOf("(") + 1, e = (s = (r = t == null ? void 0 : t.text) == null ? void 0 : r.template) == null ? void 0 : s.substring(
7
- i || 0,
8
- (u = t == null ? void 0 : t.text) == null ? void 0 : u.template.indexOf(")")
4
+ const $ = (t) => (t == null ? void 0 : t.__typename) === "PTRideLeg", _ = (t) => (t == null ? void 0 : t.__typename) === "PTConnectionLeg", v = (t) => {
5
+ var r, e, i, u, a, s;
6
+ const l = ((r = t == null ? void 0 : t.text) == null ? void 0 : r.template) && t.text.template.indexOf("(") + 1, n = (u = (e = t == null ? void 0 : t.text) == null ? void 0 : e.template) == null ? void 0 : u.substring(
7
+ l || 0,
8
+ (i = t == null ? void 0 : t.text) == null ? void 0 : i.template.indexOf(")")
9
9
  );
10
10
  return {
11
- duration: e && +e.substring(0, e.length - 1) || 0,
12
- text: ((o = (a = t == null ? void 0 : t.text) == null ? void 0 : a.template) == null ? void 0 : o.split("(")[0]) || ""
11
+ duration: n && +n.substring(0, n.length - 1) || 0,
12
+ text: ((s = (a = t == null ? void 0 : t.text) == null ? void 0 : a.template) == null ? void 0 : s.split("(")[0]) || ""
13
13
  };
14
14
  };
15
- function w(t, i) {
16
- var r, u;
17
- const e = _(t) ? t : null, n = e ? (r = e == null ? void 0 : e.notices) == null ? void 0 : r.filter((s) => i.includes(s.name))[0] : null;
18
- return n ? {
19
- duration: (e == null ? void 0 : e.duration) || 0,
20
- text: ((u = n == null ? void 0 : n.text) == null ? void 0 : u.template) || "",
15
+ function k(t, l) {
16
+ var e, i;
17
+ const n = _(t) ? t : null, r = n ? (e = n == null ? void 0 : n.notices) == null ? void 0 : e.filter((u) => l.includes(u.name))[0] : null;
18
+ return r ? {
19
+ duration: (n == null ? void 0 : n.duration) || 0,
20
+ text: ((i = r == null ? void 0 : r.text) == null ? void 0 : i.template) || "",
21
21
  icon: "walk-small"
22
22
  } : null;
23
23
  }
24
- function R(t, i) {
25
- var r, u, s;
26
- const e = x(t) ? (u = (r = t == null ? void 0 : t.serviceJourney) == null ? void 0 : r.notices) == null ? void 0 : u.filter(
27
- (a) => ["CI"].includes(a.name)
28
- )[0] : null, n = e && A(e);
24
+ function M(t, l, n, r) {
25
+ var u, a, s;
26
+ const e = $(t) ? (a = (u = t == null ? void 0 : t.serviceJourney) == null ? void 0 : u.notices) == null ? void 0 : a.filter(
27
+ (m) => ["CI"].includes(m.name)
28
+ )[0] : null, i = e && v(e);
29
29
  return e ? {
30
- duration: ((n == null ? void 0 : n.duration) || 0) + (i || 0),
31
- text: (n == null ? void 0 : n.text) || "",
32
- icon: `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
30
+ duration: ((i == null ? void 0 : i.duration) || 0) + (l || 0),
31
+ text: n ? w[r] : (i == null ? void 0 : i.text) || "",
32
+ icon: n ? "wheelchair-small" : `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
33
33
  } : null;
34
34
  }
35
- function Y(t, i) {
36
- var r, u, s;
37
- const e = x(t) ? (u = (r = t == null ? void 0 : t.serviceJourney) == null ? void 0 : r.notices) == null ? void 0 : u.filter(
38
- (a) => ["CO"].includes(a.name)
39
- )[0] : null, n = e && A(e);
35
+ function O(t, l, n, r) {
36
+ var u, a, s;
37
+ const e = $(t) ? (a = (u = t == null ? void 0 : t.serviceJourney) == null ? void 0 : u.notices) == null ? void 0 : a.filter(
38
+ (m) => ["CO"].includes(m.name)
39
+ )[0] : null, i = e && v(e);
40
40
  return e ? {
41
- duration: ((n == null ? void 0 : n.duration) || 0) + (i || 0),
42
- text: (n == null ? void 0 : n.text) || "",
43
- icon: `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
41
+ duration: ((i == null ? void 0 : i.duration) || 0) + (l || 0),
42
+ text: n ? T[r] : (i == null ? void 0 : i.text) || "",
43
+ icon: n ? "wheelchair-small" : `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
44
44
  } : null;
45
45
  }
46
- function T(t, i, e, n, r) {
47
- return b`
48
- <span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${r}">
49
- <sbb-icon name=${i}></sbb-icon>
46
+ function C(t, l, n, r, e) {
47
+ return f`
48
+ <span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${l}-${e}">
49
+ <sbb-icon name=${l}></sbb-icon>
50
50
  <time datetime=${t + "M"}>
51
51
  <span class="sbb-screen-reader-only">
52
- ${!n && r ? r === "departure" ? k[e] : y[e] : m}
53
- ${n ? b`<span>${n}</span>` : m}&nbsp;
52
+ ${!r && e ? e === "departure" ? w[n] : T[n] : b}
53
+ ${r ? f`<span>${r}</span>` : b}&nbsp;
54
54
  </span>
55
55
  ${t}
56
56
  <span class="sbb-pearl-chain__time-walktime-prime-symbol" aria-hidden="true">'</span>
@@ -59,65 +59,100 @@ function T(t, i, e, n, r) {
59
59
  </span>
60
60
  `;
61
61
  }
62
- function f(t, i, e) {
63
- return b`
64
- <span class="sbb-pearl-chain__time-walktime sbb-pearl-chain__time-walktime--${e}">
65
- <sbb-icon name="walk-small"></sbb-icon>
62
+ function p(t, l, n, r) {
63
+ return f`
64
+ <span class="sbb-pearl-chain__time-walktime sbb-pearl-chain__time-walktime--${r}-${n}">
65
+ <sbb-icon name=${r}></sbb-icon>
66
66
  <time datetime=${t + "M"}>
67
- <span class="sbb-screen-reader-only">${i}</span>
67
+ <span class="sbb-screen-reader-only">${l}</span>
68
68
  ${t}
69
69
  <span class="sbb-pearl-chain__time-walktime-prime-symbol" aria-hidden="true">'</span>
70
70
  </time>
71
71
  </span>
72
72
  `;
73
73
  }
74
- function E(t, i, e, n) {
75
- const r = t && t.filter((h) => x(h) || _(h))[0], u = ["YM", "YB", "Y", "YT"], s = w(r, u), a = R(r, i), o = i ? {
76
- text: k[n],
77
- duration: i,
78
- icon: "walk-small"
79
- } : null, C = () => s || (o && !a && !s ? o : a || null);
74
+ function I(t, l, n, r, e) {
75
+ const i = t && t.filter((A) => $(A) || _(A))[0], u = ["YM", "YB", "Y", "YT"], a = k(i, u), s = M(
76
+ i,
77
+ l,
78
+ e,
79
+ r
80
+ ), m = l ? {
81
+ text: w[r],
82
+ duration: l,
83
+ icon: e ? "wheelchair-small" : "walk-small"
84
+ } : null, D = () => a || (m && !s && !a ? m : s || null);
80
85
  function L() {
81
- return b`
82
- ${s ? f(s.duration, s.text, "left") : m}
83
- ${o && !a && !s ? f(o.duration, o.text, "left") : m}
84
- ${a ? T(
86
+ return f`
87
+ ${a ? p(
85
88
  a.duration,
86
- a.icon,
87
- n,
88
89
  a.text,
90
+ "left",
91
+ a.icon
92
+ ) : b}
93
+ ${m && !s && !a ? p(
94
+ m.duration,
95
+ m.text,
96
+ "left",
97
+ m.icon
98
+ ) : b}
99
+ ${s ? e ? p(
100
+ s.duration,
101
+ s.text,
102
+ "left",
103
+ s.icon
104
+ ) : C(
105
+ s.duration,
106
+ s.icon,
107
+ r,
108
+ s.text,
89
109
  "departure"
90
- ) : m}
110
+ ) : b}
91
111
  `;
92
112
  }
93
- const $ = t && t[t.length - 1], d = (_($) || x($)) && $, c = d && w(d, u), l = d && Y(d, e), p = e ? {
94
- text: y[n],
95
- duration: e,
96
- icon: "walk-small"
97
- } : null, v = () => c || (p && !l && !c ? p : l || null);
98
- function D() {
99
- return b`
100
- ${c ? f(c.duration, c.text, "right") : m}
101
- ${p && !l && !c ? f(p.duration, p.text, "right") : m}
102
- ${l ? T(
103
- l.duration,
104
- l.icon,
105
- n,
106
- l.text,
113
+ const h = t && t[t.length - 1], x = (_(h) || $(h)) && h, c = x && k(x, u), o = x && O(x, n, e, r), d = n ? {
114
+ text: T[r],
115
+ duration: n,
116
+ icon: e ? "wheelchair-small" : "walk-small"
117
+ } : null, R = () => c || (d && !o && !c ? d : o || null);
118
+ function Y() {
119
+ return f`
120
+ ${c ? p(
121
+ c.duration,
122
+ c.text,
123
+ "right",
124
+ c.icon
125
+ ) : b}
126
+ ${d && !o && !c ? p(
127
+ d.duration,
128
+ d.text,
129
+ "right",
130
+ d.icon
131
+ ) : b}
132
+ ${o ? e ? p(
133
+ o.duration,
134
+ o.text,
135
+ "right",
136
+ o.icon
137
+ ) : C(
138
+ o.duration,
139
+ o.icon,
140
+ r,
141
+ o.text,
107
142
  "arrival"
108
- ) : m}
143
+ ) : b}
109
144
  `;
110
145
  }
111
146
  return {
112
147
  renderDepartureTimeAttribute: L,
113
- renderArrivalTimeAttribute: D,
114
- departureTimeAttribute: C(),
115
- arrivalTimeAttribute: v()
148
+ renderArrivalTimeAttribute: Y,
149
+ departureTimeAttribute: D(),
150
+ arrivalTimeAttribute: R()
116
151
  };
117
152
  }
118
153
  export {
119
- A as extractTimeAndStringFromNoticeText,
120
- E as getDepartureArrivalTimeAttribute,
154
+ v as extractTimeAndStringFromNoticeText,
155
+ I as getDepartureArrivalTimeAttribute,
121
156
  _ as isConnectionLeg,
122
- x as isRideLeg
157
+ $ as isRideLeg
123
158
  };
@@ -312,6 +312,16 @@
312
312
  "description": "Per default, the current location has a pulsating animation. You can\ndisable the animation with this property.",
313
313
  "attribute": "disable-animation"
314
314
  },
315
+ {
316
+ "kind": "field",
317
+ "name": "a11yFootpath",
318
+ "type": {
319
+ "text": "boolean | undefined"
320
+ },
321
+ "privacy": "public",
322
+ "description": "Optional prop to render wheelchair-small instead of walk-small",
323
+ "attribute": "a11y-footpath"
324
+ },
315
325
  {
316
326
  "kind": "field",
317
327
  "name": "now",
@@ -388,6 +398,14 @@
388
398
  "description": "Per default, the current location has a pulsating animation. You can\ndisable the animation with this property.",
389
399
  "fieldName": "disableAnimation"
390
400
  },
401
+ {
402
+ "name": "a11y-footpath",
403
+ "type": {
404
+ "text": "boolean | undefined"
405
+ },
406
+ "description": "Optional prop to render wheelchair-small instead of walk-small",
407
+ "fieldName": "a11yFootpath"
408
+ },
391
409
  {
392
410
  "name": "now",
393
411
  "description": "A configured date which acts as the current date instead of the real current date. Recommended for testing purposes.",
@@ -1073,6 +1091,16 @@
1073
1091
  "description": "The loading state -\nwhen this is true it will be render skeleton with an idling animation",
1074
1092
  "attribute": "loading-trip"
1075
1093
  },
1094
+ {
1095
+ "kind": "field",
1096
+ "name": "a11yFootpath",
1097
+ "type": {
1098
+ "text": "boolean | undefined"
1099
+ },
1100
+ "privacy": "public",
1101
+ "description": "The Footpath attribute for rendering different icons\ntrue: render a11y-icon\nfalse: render walk-icon\ndefault: render walk-icon",
1102
+ "attribute": "a11y-footpath"
1103
+ },
1076
1104
  {
1077
1105
  "kind": "field",
1078
1106
  "name": "loadingPrice",
@@ -1251,6 +1279,14 @@
1251
1279
  "description": "The loading state -\nwhen this is true it will be render skeleton with an idling animation",
1252
1280
  "fieldName": "loadingTrip"
1253
1281
  },
1282
+ {
1283
+ "name": "a11y-footpath",
1284
+ "type": {
1285
+ "text": "boolean | undefined"
1286
+ },
1287
+ "description": "The Footpath attribute for rendering different icons\ntrue: render a11y-icon\nfalse: render walk-icon\ndefault: render walk-icon",
1288
+ "fieldName": "a11yFootpath"
1289
+ },
1254
1290
  {
1255
1291
  "name": "loading-price",
1256
1292
  "type": {
@@ -1487,6 +1523,14 @@
1487
1523
  "text": "string"
1488
1524
  },
1489
1525
  "description": ": The current language for localization."
1526
+ },
1527
+ {
1528
+ "name": "a11yFootpath",
1529
+ "optional": true,
1530
+ "type": {
1531
+ "text": "boolean"
1532
+ },
1533
+ "description": ": Whether the a11y-icon should be shown."
1490
1534
  }
1491
1535
  ]
1492
1536
  },