@piveau/piveau-hub-ui-modules 4.9.2 → 4.9.4
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.
- package/dist/assets/img/flags/al.png.mjs +5 -0
- package/dist/assets/img/flags/al.png.mjs.map +1 -0
- package/dist/assets/img/flags/alb.png.mjs +5 -0
- package/dist/assets/img/flags/alb.png.mjs.map +1 -0
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/dist/utils/helpers.mjs +105 -103
- package/dist/utils/helpers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/utils/helpers.mjs
CHANGED
|
@@ -1,84 +1,86 @@
|
|
|
1
1
|
import * as j from "../assets/img/bg.png.mjs";
|
|
2
2
|
import * as y from "../assets/img/ec-logo.png.mjs";
|
|
3
3
|
import * as b from "../assets/img/favicon.png.mjs";
|
|
4
|
-
import * as v from "../assets/img/flags/
|
|
5
|
-
import * as O from "../assets/img/flags/
|
|
6
|
-
import * as L from "../assets/img/flags/
|
|
7
|
-
import * as w from "../assets/img/flags/
|
|
8
|
-
import * as T from "../assets/img/flags/
|
|
9
|
-
import * as S from "../assets/img/flags/
|
|
10
|
-
import * as H from "../assets/img/flags/
|
|
11
|
-
import * as M from "../assets/img/flags/
|
|
12
|
-
import * as R from "../assets/img/flags/
|
|
13
|
-
import * as q from "../assets/img/flags/
|
|
14
|
-
import * as z from "../assets/img/flags/
|
|
15
|
-
import * as I from "../assets/img/flags/
|
|
16
|
-
import * as P from "../assets/img/flags/
|
|
17
|
-
import * as U from "../assets/img/flags/
|
|
18
|
-
import * as E from "../assets/img/flags/
|
|
19
|
-
import * as F from "../assets/img/flags/
|
|
20
|
-
import * as K from "../assets/img/flags/
|
|
21
|
-
import * as W from "../assets/img/flags/
|
|
22
|
-
import * as D from "../assets/img/flags/
|
|
23
|
-
import * as N from "../assets/img/flags/
|
|
24
|
-
import * as V from "../assets/img/flags/
|
|
25
|
-
import * as _ from "../assets/img/flags/
|
|
26
|
-
import * as k from "../assets/img/flags/
|
|
27
|
-
import * as x from "../assets/img/flags/
|
|
28
|
-
import * as Y from "../assets/img/flags/
|
|
29
|
-
import * as G from "../assets/img/flags/
|
|
30
|
-
import * as Z from "../assets/img/flags/
|
|
31
|
-
import * as B from "../assets/img/flags/
|
|
32
|
-
import * as J from "../assets/img/flags/
|
|
33
|
-
import * as Q from "../assets/img/flags/
|
|
34
|
-
import * as X from "../assets/img/flags/
|
|
35
|
-
import * as C from "../assets/img/flags/
|
|
36
|
-
import * as A from "../assets/img/flags/
|
|
37
|
-
import * as ss from "../assets/img/flags/
|
|
38
|
-
import * as ts from "../assets/img/flags/
|
|
39
|
-
import * as os from "../assets/img/flags/
|
|
40
|
-
import * as ns from "../assets/img/flags/
|
|
41
|
-
import * as es from "../assets/img/flags/
|
|
42
|
-
import * as rs from "../assets/img/flags/
|
|
43
|
-
import * as is from "../assets/img/
|
|
44
|
-
import * as as from "../assets/img/
|
|
45
|
-
import * as gs from "../assets/img/
|
|
46
|
-
import * as ms from "../
|
|
47
|
-
import * as fs from "../
|
|
48
|
-
import * as ls from "../config/langs/
|
|
49
|
-
import * as cs from "../config/langs/
|
|
50
|
-
import * as ps from "../config/langs/
|
|
51
|
-
import * as us from "../config/langs/
|
|
52
|
-
import * as ds from "../config/langs/
|
|
53
|
-
import * as $s from "../config/langs/
|
|
54
|
-
import * as hs from "../config/langs/
|
|
55
|
-
import * as js from "../config/langs/
|
|
56
|
-
import * as ys from "../config/langs/
|
|
57
|
-
import * as bs from "../config/langs/
|
|
58
|
-
import * as vs from "../config/langs/
|
|
59
|
-
import * as Os from "../config/langs/
|
|
60
|
-
import * as Ls from "../config/langs/
|
|
61
|
-
import * as ws from "../config/langs/
|
|
62
|
-
import * as Ts from "../config/langs/
|
|
63
|
-
import * as Ss from "../config/langs/
|
|
64
|
-
import * as Hs from "../config/langs/
|
|
65
|
-
import * as Ms from "../config/langs/
|
|
66
|
-
import * as Rs from "../config/langs/
|
|
67
|
-
import * as qs from "../config/langs/
|
|
4
|
+
import * as v from "../assets/img/flags/al.png.mjs";
|
|
5
|
+
import * as O from "../assets/img/flags/alb.png.mjs";
|
|
6
|
+
import * as L from "../assets/img/flags/at.png.mjs";
|
|
7
|
+
import * as w from "../assets/img/flags/be.png.mjs";
|
|
8
|
+
import * as T from "../assets/img/flags/bg.png.mjs";
|
|
9
|
+
import * as S from "../assets/img/flags/ch.png.mjs";
|
|
10
|
+
import * as H from "../assets/img/flags/cy.png.mjs";
|
|
11
|
+
import * as M from "../assets/img/flags/cz.png.mjs";
|
|
12
|
+
import * as R from "../assets/img/flags/de.png.mjs";
|
|
13
|
+
import * as q from "../assets/img/flags/dk.png.mjs";
|
|
14
|
+
import * as z from "../assets/img/flags/ee.png.mjs";
|
|
15
|
+
import * as I from "../assets/img/flags/es.png.mjs";
|
|
16
|
+
import * as P from "../assets/img/flags/eu.png.mjs";
|
|
17
|
+
import * as U from "../assets/img/flags/fi.png.mjs";
|
|
18
|
+
import * as E from "../assets/img/flags/fr.png.mjs";
|
|
19
|
+
import * as F from "../assets/img/flags/gb.png.mjs";
|
|
20
|
+
import * as K from "../assets/img/flags/gr.png.mjs";
|
|
21
|
+
import * as W from "../assets/img/flags/hr.png.mjs";
|
|
22
|
+
import * as D from "../assets/img/flags/hu.png.mjs";
|
|
23
|
+
import * as N from "../assets/img/flags/ie.png.mjs";
|
|
24
|
+
import * as V from "../assets/img/flags/io.png.mjs";
|
|
25
|
+
import * as _ from "../assets/img/flags/is.png.mjs";
|
|
26
|
+
import * as k from "../assets/img/flags/it.png.mjs";
|
|
27
|
+
import * as x from "../assets/img/flags/li.png.mjs";
|
|
28
|
+
import * as Y from "../assets/img/flags/lt.png.mjs";
|
|
29
|
+
import * as G from "../assets/img/flags/lu.png.mjs";
|
|
30
|
+
import * as Z from "../assets/img/flags/lv.png.mjs";
|
|
31
|
+
import * as B from "../assets/img/flags/md.png.mjs";
|
|
32
|
+
import * as J from "../assets/img/flags/me.png.mjs";
|
|
33
|
+
import * as Q from "../assets/img/flags/mt.png.mjs";
|
|
34
|
+
import * as X from "../assets/img/flags/nl.png.mjs";
|
|
35
|
+
import * as C from "../assets/img/flags/no.png.mjs";
|
|
36
|
+
import * as A from "../assets/img/flags/pl.png.mjs";
|
|
37
|
+
import * as ss from "../assets/img/flags/pt.png.mjs";
|
|
38
|
+
import * as ts from "../assets/img/flags/ro.png.mjs";
|
|
39
|
+
import * as os from "../assets/img/flags/rs.png.mjs";
|
|
40
|
+
import * as ns from "../assets/img/flags/se.png.mjs";
|
|
41
|
+
import * as es from "../assets/img/flags/si.png.mjs";
|
|
42
|
+
import * as rs from "../assets/img/flags/sk.png.mjs";
|
|
43
|
+
import * as is from "../assets/img/flags/ua.png.mjs";
|
|
44
|
+
import * as as from "../assets/img/flags/world-ocean.png.mjs";
|
|
45
|
+
import * as gs from "../assets/img/img-not-available.png.mjs";
|
|
46
|
+
import * as ms from "../assets/img/logo.png.mjs";
|
|
47
|
+
import * as fs from "../assets/img/profile.png.mjs";
|
|
48
|
+
import * as ls from "../config/langs/bg.json.mjs";
|
|
49
|
+
import * as cs from "../config/langs/cs.json.mjs";
|
|
50
|
+
import * as ps from "../config/langs/da.json.mjs";
|
|
51
|
+
import * as us from "../config/langs/de.json.mjs";
|
|
52
|
+
import * as ds from "../config/langs/el.json.mjs";
|
|
53
|
+
import * as $s from "../config/langs/es.json.mjs";
|
|
54
|
+
import * as hs from "../config/langs/et.json.mjs";
|
|
55
|
+
import * as js from "../config/langs/fi.json.mjs";
|
|
56
|
+
import * as ys from "../config/langs/fr.json.mjs";
|
|
57
|
+
import * as bs from "../config/langs/hr.json.mjs";
|
|
58
|
+
import * as vs from "../config/langs/hu.json.mjs";
|
|
59
|
+
import * as Os from "../config/langs/it.json.mjs";
|
|
60
|
+
import * as Ls from "../config/langs/lt.json.mjs";
|
|
61
|
+
import * as ws from "../config/langs/lv.json.mjs";
|
|
62
|
+
import * as Ts from "../config/langs/nb.json.mjs";
|
|
63
|
+
import * as Ss from "../config/langs/nl.json.mjs";
|
|
64
|
+
import * as Hs from "../config/langs/pl.json.mjs";
|
|
65
|
+
import * as Ms from "../config/langs/pt.json.mjs";
|
|
66
|
+
import * as Rs from "../config/langs/ro.json.mjs";
|
|
67
|
+
import * as qs from "../config/langs/sk.json.mjs";
|
|
68
|
+
import * as zs from "../config/langs/sl.json.mjs";
|
|
69
|
+
import * as Is from "../config/langs/sv.json.mjs";
|
|
68
70
|
import { isNil as u, isObject as $, isString as l, has as c, isArray as h } from "lodash-es";
|
|
69
|
-
import { registerLocale as
|
|
70
|
-
const m = /* @__PURE__ */ Object.assign({ "../assets/img/bg.png": j, "../assets/img/ec-logo.png": y, "../assets/img/favicon.png": b, "../assets/img/flags/
|
|
71
|
-
|
|
72
|
-
const t =
|
|
73
|
-
t &&
|
|
71
|
+
import { registerLocale as Ps, getName as Us } from "i18n-iso-countries";
|
|
72
|
+
const m = /* @__PURE__ */ Object.assign({ "../assets/img/bg.png": j, "../assets/img/ec-logo.png": y, "../assets/img/favicon.png": b, "../assets/img/flags/al.png": v, "../assets/img/flags/alb.png": O, "../assets/img/flags/at.png": L, "../assets/img/flags/be.png": w, "../assets/img/flags/bg.png": T, "../assets/img/flags/ch.png": S, "../assets/img/flags/cy.png": H, "../assets/img/flags/cz.png": M, "../assets/img/flags/de.png": R, "../assets/img/flags/dk.png": q, "../assets/img/flags/ee.png": z, "../assets/img/flags/es.png": I, "../assets/img/flags/eu.png": P, "../assets/img/flags/fi.png": U, "../assets/img/flags/fr.png": E, "../assets/img/flags/gb.png": F, "../assets/img/flags/gr.png": K, "../assets/img/flags/hr.png": W, "../assets/img/flags/hu.png": D, "../assets/img/flags/ie.png": N, "../assets/img/flags/io.png": V, "../assets/img/flags/is.png": _, "../assets/img/flags/it.png": k, "../assets/img/flags/li.png": x, "../assets/img/flags/lt.png": Y, "../assets/img/flags/lu.png": G, "../assets/img/flags/lv.png": Z, "../assets/img/flags/md.png": B, "../assets/img/flags/me.png": J, "../assets/img/flags/mt.png": Q, "../assets/img/flags/nl.png": X, "../assets/img/flags/no.png": C, "../assets/img/flags/pl.png": A, "../assets/img/flags/pt.png": ss, "../assets/img/flags/ro.png": ts, "../assets/img/flags/rs.png": os, "../assets/img/flags/se.png": ns, "../assets/img/flags/si.png": es, "../assets/img/flags/sk.png": rs, "../assets/img/flags/ua.png": is, "../assets/img/flags/world-ocean.png": as, "../assets/img/img-not-available.png": gs, "../assets/img/logo.png": ms, "../assets/img/profile.png": fs }), Es = /* @__PURE__ */ Object.assign({ "../config/langs/bg.json": ls, "../config/langs/cs.json": cs, "../config/langs/da.json": ps, "../config/langs/de.json": us, "../config/langs/el.json": ds, "../config/langs/es.json": $s, "../config/langs/et.json": hs, "../config/langs/fi.json": js, "../config/langs/fr.json": ys, "../config/langs/hr.json": bs, "../config/langs/hu.json": vs, "../config/langs/it.json": Os, "../config/langs/lt.json": Ls, "../config/langs/lv.json": ws, "../config/langs/nb.json": Ts, "../config/langs/nl.json": Ss, "../config/langs/pl.json": Hs, "../config/langs/pt.json": Ms, "../config/langs/ro.json": Rs, "../config/langs/sk.json": qs, "../config/langs/sl.json": zs, "../config/langs/sv.json": Is }), f = "../assets/img", Fs = ["bg", "cs", "da", "de", "el", "es", "et", "fr", "hr", "hu", "it", "lt", "lv", "nl", "nb", "pl", "pt", "ro", "sk", "sl", "fi", "sv"];
|
|
73
|
+
Fs.forEach((s) => {
|
|
74
|
+
const t = Es[`../config/langs/${s}.json`];
|
|
75
|
+
t && Ps(t.default);
|
|
74
76
|
});
|
|
75
|
-
function
|
|
77
|
+
function Ns(s, t) {
|
|
76
78
|
return [...new Set(t.filter(
|
|
77
79
|
// Remove duplicates by creating a Set and remove items where {prop} has no value.
|
|
78
80
|
(o) => Object.prototype.hasOwnProperty.call(o, s) && !!o[s]
|
|
79
81
|
).map((o) => o[s]))];
|
|
80
82
|
}
|
|
81
|
-
function
|
|
83
|
+
function Vs(s = "", t = "") {
|
|
82
84
|
const o = s.startsWith("/") ? s : `/${s}`, n = t.startsWith("/") ? t : `/${t}`;
|
|
83
85
|
let r;
|
|
84
86
|
try {
|
|
@@ -89,7 +91,7 @@ function Ds(s = "", t = "") {
|
|
|
89
91
|
}
|
|
90
92
|
return r.default;
|
|
91
93
|
}
|
|
92
|
-
function
|
|
94
|
+
function _s(s) {
|
|
93
95
|
let t;
|
|
94
96
|
try {
|
|
95
97
|
t = m[`${f}/flags/${s.toLowerCase()}.png`];
|
|
@@ -98,7 +100,7 @@ function Ns(s) {
|
|
|
98
100
|
}
|
|
99
101
|
return t.default;
|
|
100
102
|
}
|
|
101
|
-
function
|
|
103
|
+
function Ks(s, t, o) {
|
|
102
104
|
if (!s || u(s) || !$(s) && !l(s))
|
|
103
105
|
return;
|
|
104
106
|
if (l(s))
|
|
@@ -114,30 +116,30 @@ function Es(s, t, o) {
|
|
|
114
116
|
if (n)
|
|
115
117
|
return n;
|
|
116
118
|
}
|
|
117
|
-
function
|
|
118
|
-
const n =
|
|
119
|
+
function ks(s, t, o) {
|
|
120
|
+
const n = Ks(s, t, o);
|
|
119
121
|
return n ? s[n] : void 0;
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function xs(s, t, o, n) {
|
|
122
124
|
if (s === "country") {
|
|
123
|
-
const e =
|
|
125
|
+
const e = Us(t, o === "no" ? "nb" : o);
|
|
124
126
|
return u(e) ? n : e;
|
|
125
127
|
}
|
|
126
128
|
return $(n) ? c(n, o) ? n[o] : c(n, "en") ? n.en : Object.keys(n).length > 0 ? n[0] : "No title available" : u(n) ? "No title available" : l(n) ? n : n.toString();
|
|
127
129
|
}
|
|
128
|
-
function
|
|
130
|
+
function Ys(s, t, o) {
|
|
129
131
|
if (!s)
|
|
130
132
|
return "";
|
|
131
133
|
const n = s.substring(0, t);
|
|
132
134
|
return o || s.length <= t ? n : `${n}...`;
|
|
133
135
|
}
|
|
134
|
-
function
|
|
136
|
+
function Gs(s) {
|
|
135
137
|
return s.normalize("NFKD").replace("%", "").replace("\\W", "-").replace("-+", "-").toLowerCase();
|
|
136
138
|
}
|
|
137
|
-
function
|
|
139
|
+
function Zs(s) {
|
|
138
140
|
return s.replace(/^(mailto|tel):/, "");
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function Bs(s) {
|
|
141
143
|
try {
|
|
142
144
|
const t = new URL(s);
|
|
143
145
|
return t.protocol === "http:" && (t.protocol = "https:"), t.href;
|
|
@@ -145,7 +147,7 @@ function Gs(s) {
|
|
|
145
147
|
return s;
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
|
-
function
|
|
150
|
+
function Js(s, t) {
|
|
149
151
|
const o = h(t) ? t : [t];
|
|
150
152
|
return (n) => new Proxy({
|
|
151
153
|
// Add preliminary dstProps to object so lodash _.has won't return false
|
|
@@ -158,7 +160,7 @@ function Zs(s, t) {
|
|
|
158
160
|
}
|
|
159
161
|
});
|
|
160
162
|
}
|
|
161
|
-
function
|
|
163
|
+
function Qs(s) {
|
|
162
164
|
const t = Object.keys(s), o = s[t[0]];
|
|
163
165
|
return typeof o == "string" || typeof o == "number";
|
|
164
166
|
}
|
|
@@ -174,7 +176,7 @@ function d(s, t) {
|
|
|
174
176
|
Object.keys(s[o]).includes("source") && (t.includes(s[o].source.name) || t.push(s[o].source.name));
|
|
175
177
|
return t;
|
|
176
178
|
}
|
|
177
|
-
function
|
|
179
|
+
function Xs(s, t, o, n) {
|
|
178
180
|
for (const r in t) {
|
|
179
181
|
const e = t[r], i = s[e];
|
|
180
182
|
if (o.includes(e)) {
|
|
@@ -183,7 +185,7 @@ function Js(s, t, o, n) {
|
|
|
183
185
|
}
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
|
-
function
|
|
188
|
+
function Cs(s) {
|
|
187
189
|
try {
|
|
188
190
|
const t = new URL(s).host, o = new URL(this.$env.api.baseUrl).host;
|
|
189
191
|
return t === o ? `${s}?locale=${this.$route.query.locale}` : s;
|
|
@@ -194,7 +196,7 @@ function Qs(s) {
|
|
|
194
196
|
function g(s) {
|
|
195
197
|
return `${parseInt(s, 10) < 10 ? 0 : ""}${parseInt(s, 10)}`;
|
|
196
198
|
}
|
|
197
|
-
function
|
|
199
|
+
function As(s) {
|
|
198
200
|
let t = s.split("T")[0].substr(1);
|
|
199
201
|
const o = t.split("Y")[0];
|
|
200
202
|
t = t.split("Y")[1];
|
|
@@ -209,7 +211,7 @@ function Xs(s) {
|
|
|
209
211
|
const p = g(e.split("S")[0]);
|
|
210
212
|
return `${i}:${a}:${p} - ${r}.${n}.${o}`;
|
|
211
213
|
}
|
|
212
|
-
function
|
|
214
|
+
function st(s = "en") {
|
|
213
215
|
return function(o, n, r) {
|
|
214
216
|
const e = o.query.locale, i = n.query.locale, a = e ?? i ?? s;
|
|
215
217
|
a !== e ? r({ ...o, query: { ...o.query, locale: a } }) : r();
|
|
@@ -217,22 +219,22 @@ function Cs(s = "en") {
|
|
|
217
219
|
}
|
|
218
220
|
export {
|
|
219
221
|
g as addPrecedingZero,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
Cs as appendCurrentLocaleToURL,
|
|
223
|
+
st as createStickyLocale,
|
|
222
224
|
d as findPropertiesWithSources,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
225
|
+
As as formatDatetime,
|
|
226
|
+
_s as getCountryFlagImg,
|
|
227
|
+
xs as getFacetTranslation,
|
|
228
|
+
Vs as getImg,
|
|
229
|
+
Ks as getRepresentativeLocaleOf,
|
|
230
|
+
ks as getTranslationFor,
|
|
231
|
+
Qs as matchesObjectStructure,
|
|
232
|
+
Js as mirrorPropertyFn,
|
|
233
|
+
Gs as normalize,
|
|
234
|
+
Zs as removeMailtoOrTel,
|
|
235
|
+
Bs as replaceHttp,
|
|
236
|
+
Xs as setTranslation,
|
|
237
|
+
Ys as truncate,
|
|
238
|
+
Ns as unique
|
|
237
239
|
};
|
|
238
240
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","sources":["../../lib/utils/helpers.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable no-restricted-syntax,guard-for-in,no-param-reassign,no-lonely-if */\n/**\n * @created 11.05.2017\n * @description Contains helper functions for general purposes needed in the Application.\n */\n\n/* eslint-disable no-undef */\n/* eslint-disable no-nested-ternary */\nimport {\n has,\n isString,\n isObject,\n isNil,\n isArray,\n} from 'lodash';\nimport { getName, registerLocale } from 'i18n-iso-countries';\n\n// Import all images.\n// eager loading of images is needed for now for better compatibility.\n// See https://vitejs.dev/guide/features.html#glob-import\nconst imageModules = import.meta.globEager('../assets/img/**/*.png');\nconst localeModules = import.meta.globEager('../config/langs/{bg,cs,da,de,el,es,et,fr,hr,hu,it,lt,lv,nl,nb,pl,pt,ro,sk,sl,fi,sv}.json');\nconst RELATIVE_PATH_TO_IMAGES = '../assets/img';\n\n// ga and mt missing, nb for no\nconst languageList = ['bg', 'cs', 'da', 'de', 'el', 'es', 'et', 'fr', 'hr', 'hu', 'it', 'lt', 'lv', 'nl', 'nb', 'pl', 'pt', 'ro', 'sk', 'sl', 'fi', 'sv'];\nlanguageList.forEach( (lang) => {\n const locale = localeModules[`../config/langs/${lang}.json`];\n if (locale) {\n registerLocale(locale.default);\n }\n});\n\n\n/**\n * @description Returns an array that contains unique values\n * of the given properties in the given array.\n * @param { String } prop - The key of {array} which values will be unique.\n * @param { [Object] } array - The array to take keys from.\n * @returns { [*] } A new Array containing unique values of the {arrays} {key} property\n */\nfunction unique(prop, array) {\n // Filter elements in {array} that do not have a {prop} key.\n return [...new Set(array.filter(\n // Remove duplicates by creating a Set and remove items where {prop} has no value.\n item => Object.prototype.hasOwnProperty.call(item, prop) && !!item[prop],\n )\n // Create a new array containing the {prop} values of each given item.\n .map(item => item[prop]))];\n}\n\n\n/**\n * @description Abstract function that returns an image from /assets/img\n * @param { String } image - The path to the image from /assets/img without fileending e.g. \"/flags/eu\"\n * @param { String } defaultFallbackImage - The path to the default fallback image from /assets/img without fileending e.g. \"/flags/eu\"\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getImg(image = '', defaultFallbackImage = '') {\n const maybeImageFrontSlash = image.startsWith('/') ? image : `/${image}`;\n const maybeFallbackImageFrontSlash = defaultFallbackImage.startsWith('/') ? defaultFallbackImage : `/${defaultFallbackImage}`;\n let img;\n\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeImageFrontSlash}.png`];\n if (!img) {\n throw new Error('Image not found');\n }\n } catch (err) {\n if (defaultFallbackImage) img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeFallbackImageFrontSlash}.png`];\n else img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/img-not-available.png`];\n }\n\n return img.default;\n}\n\n\n\n/**\n * @description Returns an image of a flag.\n * @param { String } countryId - The ID (example: 'en', 'de', 'fr') of a country to get the flag from.\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getCountryFlagImg(countryId) {\n let img;\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/${countryId.toLowerCase()}.png`];\n } catch (err) {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/eu.png`];\n }\n return img.default;\n}\n\n\nfunction getRepresentativeLocaleOf(prop, userLocale, fallbacks) {\n if (!prop || isNil(prop) || (!isObject(prop) && !isString(prop))) return undefined;\n // Check if prop is only a string without translations\n if (isString(prop)) return prop;\n // Use language setting of user\n if (has(prop, userLocale)) return userLocale;\n // Iterate over given fallback languages\n if (fallbacks && isArray(fallbacks)) {\n const foundLang = fallbacks.find(lang => lang\n && isString(lang)\n && has(prop, lang.toLowerCase()));\n if (foundLang) return foundLang;\n }\n // Use the first language in the given property if none of the languages is present\n const key = Object.keys(prop)[0];\n if (key) return key;\n // Use default text if prop does not have any items\n return undefined;\n}\n\n/**\n * @description Checks if a translation for the given prop parameter is available and returns it in the following priority order:\n * 1. User set locale\n * 2. Given fallback languages\n * 3. Any available language\n * @param { Object } prop - The object that should contain the translations\n * @param { String } userLocale - The currently set locale.\n * @param { [String] } fallbacks - The fallback languages to check for, when given locale is not available in given prop\n * @returns { String } A translated text.\n */\nfunction getTranslationFor(prop, userLocale, fallbacks) {\n const locale = getRepresentativeLocaleOf(prop, userLocale, fallbacks);\n return locale\n ? prop[locale]\n : undefined;\n}\n\n\n/**\n * @description Returns the translation for a facet item\n * @param { String } fieldId\n * @param { String } facetId\n * @param { String } userLocale\n * @param { String } fallback\n * @returns { String } The translated facet item, if available\n */\nfunction getFacetTranslation(fieldId, facetId, userLocale, fallback) {\n if (fieldId === 'country') {\n const locale = userLocale === 'no' ? 'nb' : userLocale;\n const name = getName(facetId, locale);\n // Translation missing because this.$t('message.catalogFacets.euInstitutions') is not working here\n // return isNil(name)\n // ? (fallback === 'EU institutions' ? this.$t('message.catalogFacets.euInstitutions') : fallback)\n // : name;\n return isNil(name)\n ? fallback\n : name;\n }\n if (isObject(fallback)) {\n return has(fallback, userLocale)\n ? fallback[userLocale]\n : has(fallback, 'en')\n ? fallback.en\n : Object.keys(fallback).length > 0\n ? fallback[0]\n : 'No title available';\n }\n return isNil(fallback)\n ? 'No title available'\n : (isString(fallback)\n ? fallback\n : fallback.toString());\n}\n\n\n/**\n * Truncates a String to a maximum character count of maxChars\n * @param text\n * @param maxChars\n * @param noAppend\n */\nfunction truncate(text, maxChars, noAppend) {\n if (!text) return '';\n const trunc = text.substring(0, maxChars);\n if (noAppend || text.length <= maxChars) return trunc;\n return `${trunc}...`;\n}\n\n/**\n * normalizing the dataset id\n * @param str string to be normalized\n */\nfunction normalize(str) {\n const normalized = str.normalize('NFKD');\n return normalized.replace('%', '').replace('\\\\W', '-').replace('-+', '-').toLowerCase();\n}\n\n/**\n * remove mailto or tel\n * @param str string\n */\nfunction removeMailtoOrTel(str) {\n return str.replace(/^(mailto|tel):/, '');\n}\n\nfunction replaceHttp(str) {\n try {\n const url = new URL(str);\n if (url.protocol === 'http:') {\n url.protocol = 'https:';\n }\n return url.href;\n } catch (ex) {\n // Return original string if it is not a valid URL\n return str;\n }\n}\n\n/**\n * Returns a function that takes an object and returns a modified object\n * where for each dstProp in dstProps holds: object.dstProp === object.srcProp\n *\n * This function aims to help maintain stability against DCAT-AP schema changes\n * by providing alternative keys names for access\n *\n * @example\n * const foo = { foo: 'hello world' };\n * const mirrorFooAsBar = mirrorPropertyFn('foo', 'bar');\n * const mirrored = mirrorFooAsBar(foo);\n * log(mirrored.foo) // -> 'hello world'\n * log(mirrored.bar) // -> 'hello world'\n * @param {String} srcProp\n * @param {String | Array<String>} dstProps\n * @returns {Function}\n */\nfunction mirrorPropertyFn(srcProp, dstProps) {\n const dstPropsArray = isArray(dstProps)\n ? dstProps\n : [dstProps];\n\n // Return function that returns a proxy that does the mirroring when\n // accessing dstProps\n return obj => new Proxy({\n // Add preliminary dstProps to object so lodash _.has won't return false\n ...obj,\n ...dstPropsArray.reduce((acc, prop) => {\n // eslint-disable-next-line no-param-reassign\n acc[prop] = obj[srcProp];\n return acc;\n }, {}),\n }, {\n get(target, prop, receiver) {\n // If accessing dstProp, return srcProp value\n const foundTargetProp = dstPropsArray.includes(srcProp);\n const maybeRedirectedProp = foundTargetProp\n ? srcProp\n : prop;\n return Reflect.get(target, maybeRedirectedProp, receiver);\n },\n });\n}\n\n\n/**\n * @description Function for determining of given data is of type object\n * @param {*} data\n * @returns Boolean determining, if data is object\n */\nfunction matchesObjectStructure(data) {\n const dataKeys = Object.keys(data);\n const firstValue = data[dataKeys[0]];\n\n if (typeof firstValue === 'string' || typeof firstValue === 'number') {\n return true;\n }\n return false;\n}\n\n/**\n* @description Function to search for all properties in inputconfiguration which provide a 'source'-property.\n* Each name provided by a 'source'-property is saved inside the propertyNamesArray and returned as an array of property-names.\n* @param {Array} inputConfigArray Array of inputconfiguration containing information about components to render.\n* @param {Array} propertyNamesArray Array of names retrieved from components with a 'source'-property.\n* @returns {Array} Array with all names retireved (popertyNamesArray)\n*/\nfunction findPropertiesWithSources(inputConfigArray, propertyNamesArray) {\n for (const index in inputConfigArray) {\n // only subcomponents without a 'children'-property contain a 'source'-property\n // if there is a 'children'-property the current component isn't a subcomponent so\n // the function needs be called again on this component to get to the subcomponent\n if (Object.keys(inputConfigArray[index]).includes('children')) {\n findPropertiesWithSources(inputConfigArray[index].children, propertyNamesArray);\n } else if (inputConfigArray[index].type === 'conditional-input') {\n const conditionalInputKeys = Object.keys(inputConfigArray[index].data);\n for (const inputKeyIndex in conditionalInputKeys) {\n findPropertiesWithSources(inputConfigArray[index].data[conditionalInputKeys[inputKeyIndex]], propertyNamesArray);\n }\n } else {\n // not all subcomponents contain a 'source'-property\n if (Object.keys(inputConfigArray[index]).includes('source')) {\n // the 'source'-property provides a name which links to further information in the generalconfig-file\n if (!propertyNamesArray.includes(inputConfigArray[index].source.name)) {\n propertyNamesArray.push(inputConfigArray[index].source.name);\n }\n }\n }\n }\n\n return propertyNamesArray;\n}\n\n/**\n*\n* @param {*} dataset\n* @param {*} properties\n* @param {*} translatableProperties\n*/\nfunction setTranslation(dataset, properties, translatableProperties, languageInformation) {\n for (const propertyIndex in properties) {\n const propertyName = properties[propertyIndex];\n const propertyValue = dataset[propertyName];\n\n if (translatableProperties.includes(propertyName)) {\n const translationSelectoren = Object.keys(languageInformation.translation[languageInformation.locale].message.dataupload[propertyName]);\n\n if (propertyValue !== '') {\n if (translationSelectoren.includes(propertyValue)) {\n dataset[propertyName] = languageInformation.translation[languageInformation.locale].message.dataupload[propertyName][propertyValue];\n }\n }\n }\n }\n}\n\n/**\n* @description Appends current locale to an url\n* @param {String} url url\n*/\nfunction appendCurrentLocaleToURL(url) {\n try {\n const urlHost = new URL(url).host;\n const baseUrlHost = new URL(this.$env.api.baseUrl).host;\n const isOurHostname = urlHost === baseUrlHost;\n if (isOurHostname) {\n return `${url}?locale=${this.$route.query.locale}`;\n }\n return url;\n } catch {\n // when there is no hostname then it should link to our website\n return `${url}?locale=${this.$route.query.locale}`;\n }\n}\n\n/**\n* @description Add preceding zero for numbers < 100 (if not already existing)\n* @param {String} value value\n*/\nfunction addPrecedingZero(value) {\n return `${parseInt(value, 10) < 10 ? 0 : ''}${parseInt(value, 10)}`;\n}\n\n/**\n* @description Formatting temporalResolution property into human-readable format\n* @param {String} datetime datetime in temporalResolution format\n*/\nfunction formatDatetime(datetime) {\n let date = datetime.split('T')[0].substr(1,);\n\n const year = date.split('Y')[0];\n date = date.split('Y')[1];\n\n const month = addPrecedingZero(date.split('M')[0]);\n date = date.split('M')[1];\n\n const day = addPrecedingZero(date.split('D')[0]);\n\n let time = datetime.split('T')[1];\n\n const hour = addPrecedingZero(time.split('H')[0]);\n time = time.split('H')[1];\n\n const minute = addPrecedingZero(time.split('M')[0]);\n time = time.split('M')[1];\n\n const second = addPrecedingZero(time.split('S')[0]);\n\n return `${hour}:${minute}:${second} - ${day}.${month}.${year}`;\n}\n\n/**\n * @description Creates a navigation guard that adds a locale to the query if it is not present.\n */\nfunction createStickyLocale(fallbackLocale: string = 'en') {\n return function stickyLocale(to: any, from: any, next: Function) {\n const toLocale = to.query.locale;\n const fromLocale = from.query.locale;\n\n const newLocale = toLocale ?? fromLocale ?? fallbackLocale;\n\n newLocale !== toLocale \n ? next({ ...to, query: { ...to.query, locale: newLocale } })\n : next();\n };\n}\n\n// Export all functions as default export.\nexport {\n unique,\n getImg,\n getCountryFlagImg,\n getFacetTranslation,\n getRepresentativeLocaleOf,\n getTranslationFor,\n truncate,\n normalize,\n removeMailtoOrTel,\n replaceHttp,\n mirrorPropertyFn,\n matchesObjectStructure,\n findPropertiesWithSources,\n setTranslation,\n appendCurrentLocaleToURL,\n addPrecedingZero,\n formatDatetime,\n createStickyLocale,\n};\n"],"names":["imageModules","localeModules","RELATIVE_PATH_TO_IMAGES","languageList","lang","locale","registerLocale","unique","prop","array","item","getImg","image","defaultFallbackImage","maybeImageFrontSlash","maybeFallbackImageFrontSlash","img","getCountryFlagImg","countryId","getRepresentativeLocaleOf","userLocale","fallbacks","isNil","isObject","isString","has","isArray","foundLang","key","getTranslationFor","getFacetTranslation","fieldId","facetId","fallback","name","getName","truncate","text","maxChars","noAppend","trunc","normalize","str","removeMailtoOrTel","replaceHttp","url","mirrorPropertyFn","srcProp","dstProps","dstPropsArray","obj","acc","target","receiver","maybeRedirectedProp","matchesObjectStructure","data","dataKeys","firstValue","findPropertiesWithSources","inputConfigArray","propertyNamesArray","index","conditionalInputKeys","inputKeyIndex","setTranslation","dataset","properties","translatableProperties","languageInformation","propertyIndex","propertyName","propertyValue","translationSelectoren","appendCurrentLocaleToURL","urlHost","baseUrlHost","addPrecedingZero","value","formatDatetime","datetime","date","year","month","day","time","hour","minute","second","createStickyLocale","fallbackLocale","to","from","next","toLocale","fromLocale","newLocale"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,kgDACAC,ktBACAC,IAA0B,iBAG1BC,KAAe,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI;AACxJA,GAAa,QAAS,CAACC,MAAS;AAC9B,QAAMC,IAASJ,GAAc,mBAAmBG,CAAI,OAAO;AAC3D,EAAIC,KACFC,GAAeD,EAAO,OAAO;AAEjC,CAAC;AAUD,SAASE,GAAOC,GAAMC,GAAO;AAE3B,SAAO,CAAC,GAAG,IAAI,IAAIA,EAAM;AAAA;AAAA,IAEvB,CAAAC,MAAQ,OAAO,UAAU,eAAe,KAAKA,GAAMF,CAAI,KAAK,CAAC,CAACE,EAAKF,CAAI;AAAA,EAAA,EAGtE,IAAI,CAAAE,MAAQA,EAAKF,CAAI,CAAC,CAAC,CAAC;AAC7B;AASA,SAASG,GAAOC,IAAQ,IAAIC,IAAuB,IAAI;AACrD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AOA,EAAK,MAAM,GAAG,EAAE,CAAC;AAExB,QAAME,IAASV,EAAiBQ,EAAK,MAAM,GAAG,EAAE,CAAC,CAAC;AAClD,EAAAA,IAAOA,EAAK,MAAM,GAAG,EAAE,CAAC;AAExB,QAAMG,IAASX,EAAiBQ,EAAK,MAAM,GAAG,EAAE,CAAC,CAAC;AAE3C,SAAA,GAAGC,CAAI,IAAIC,CAAM,IAAIC,CAAM,MAAMJ,CAAG,IAAID,CAAK,IAAID,CAAI;AAC9D;AAKA,SAASO,GAAmBC,IAAyB,MAAM;AACzD,SAAO,SAAsBC,GAASC,GAAWC,GAAgB;AACvD,UAAAC,IAAWH,EAAG,MAAM,QACpBI,IAAaH,EAAK,MAAM,QAExBI,IAAYF,KAAYC,KAAcL;AAE5C,IAAAM,MAAcF,IACRD,EAAK,EAAE,GAAGF,GAAI,OAAO,EAAE,GAAGA,EAAG,OAAO,QAAQK,EAAY,EAAA,CAAC,IACzDH,EAAK;AAAA,EAAA;AAEjB;"}
|
|
1
|
+
{"version":3,"file":"helpers.mjs","sources":["../../lib/utils/helpers.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable no-restricted-syntax,guard-for-in,no-param-reassign,no-lonely-if */\n/**\n * @created 11.05.2017\n * @description Contains helper functions for general purposes needed in the Application.\n */\n\n/* eslint-disable no-undef */\n/* eslint-disable no-nested-ternary */\nimport {\n has,\n isString,\n isObject,\n isNil,\n isArray,\n} from 'lodash';\nimport { getName, registerLocale } from 'i18n-iso-countries';\n\n// Import all images.\n// eager loading of images is needed for now for better compatibility.\n// See https://vitejs.dev/guide/features.html#glob-import\nconst imageModules = import.meta.globEager('../assets/img/**/*.png');\nconst localeModules = import.meta.globEager('../config/langs/{bg,cs,da,de,el,es,et,fr,hr,hu,it,lt,lv,nl,nb,pl,pt,ro,sk,sl,fi,sv}.json');\nconst RELATIVE_PATH_TO_IMAGES = '../assets/img';\n\n// ga and mt missing, nb for no\nconst languageList = ['bg', 'cs', 'da', 'de', 'el', 'es', 'et', 'fr', 'hr', 'hu', 'it', 'lt', 'lv', 'nl', 'nb', 'pl', 'pt', 'ro', 'sk', 'sl', 'fi', 'sv'];\nlanguageList.forEach( (lang) => {\n const locale = localeModules[`../config/langs/${lang}.json`];\n if (locale) {\n registerLocale(locale.default);\n }\n});\n\n/**\n * @description Returns an array that contains unique values\n * of the given properties in the given array.\n * @param { String } prop - The key of {array} which values will be unique.\n * @param { [Object] } array - The array to take keys from.\n * @returns { [*] } A new Array containing unique values of the {arrays} {key} property\n */\nfunction unique(prop, array) {\n // Filter elements in {array} that do not have a {prop} key.\n return [...new Set(array.filter(\n // Remove duplicates by creating a Set and remove items where {prop} has no value.\n item => Object.prototype.hasOwnProperty.call(item, prop) && !!item[prop],\n )\n // Create a new array containing the {prop} values of each given item.\n .map(item => item[prop]))];\n}\n\n/**\n * @description Abstract function that returns an image from /assets/img\n * @param { String } image - The path to the image from /assets/img without fileending e.g. \"/flags/eu\"\n * @param { String } defaultFallbackImage - The path to the default fallback image from /assets/img without fileending e.g. \"/flags/eu\"\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getImg(image = '', defaultFallbackImage = '') {\n const maybeImageFrontSlash = image.startsWith('/') ? image : `/${image}`;\n const maybeFallbackImageFrontSlash = defaultFallbackImage.startsWith('/') ? defaultFallbackImage : `/${defaultFallbackImage}`;\n let img;\n\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeImageFrontSlash}.png`];\n if (!img) {\n throw new Error('Image not found');\n }\n } catch (err) {\n if (defaultFallbackImage) img = imageModules[`${RELATIVE_PATH_TO_IMAGES}${maybeFallbackImageFrontSlash}.png`];\n else img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/img-not-available.png`];\n }\n\n return img.default;\n}\n\n\n\n/**\n * @description Returns an image of a flag.\n * @param { String } countryId - The ID (example: 'en', 'de', 'fr') of a country to get the flag from.\n * @returns { String } An image, represented by its absolute path.\n */\nfunction getCountryFlagImg(countryId) {\n let img;\n try {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/${countryId.toLowerCase()}.png`];\n } catch (err) {\n img = imageModules[`${RELATIVE_PATH_TO_IMAGES}/flags/eu.png`];\n }\n return img.default;\n}\n\n\nfunction getRepresentativeLocaleOf(prop, userLocale, fallbacks) {\n if (!prop || isNil(prop) || (!isObject(prop) && !isString(prop))) return undefined;\n // Check if prop is only a string without translations\n if (isString(prop)) return prop;\n // Use language setting of user\n if (has(prop, userLocale)) return userLocale;\n // Iterate over given fallback languages\n if (fallbacks && isArray(fallbacks)) {\n const foundLang = fallbacks.find(lang => lang\n && isString(lang)\n && has(prop, lang.toLowerCase()));\n if (foundLang) return foundLang;\n }\n // Use the first language in the given property if none of the languages is present\n const key = Object.keys(prop)[0];\n if (key) return key;\n // Use default text if prop does not have any items\n return undefined;\n}\n\n/**\n * @description Checks if a translation for the given prop parameter is available and returns it in the following priority order:\n * 1. User set locale\n * 2. Given fallback languages\n * 3. Any available language\n * @param { Object } prop - The object that should contain the translations\n * @param { String } userLocale - The currently set locale.\n * @param { [String] } fallbacks - The fallback languages to check for, when given locale is not available in given prop\n * @returns { String } A translated text.\n */\nfunction getTranslationFor(prop, userLocale, fallbacks) {\n const locale = getRepresentativeLocaleOf(prop, userLocale, fallbacks);\n return locale\n ? prop[locale]\n : undefined;\n}\n\n\n/**\n * @description Returns the translation for a facet item\n * @param { String } fieldId\n * @param { String } facetId\n * @param { String } userLocale\n * @param { String } fallback\n * @returns { String } The translated facet item, if available\n */\nfunction getFacetTranslation(fieldId, facetId, userLocale, fallback) {\n if (fieldId === 'country') {\n const locale = userLocale === 'no' ? 'nb' : userLocale;\n const name = getName(facetId, locale);\n // Translation missing because this.$t('message.catalogFacets.euInstitutions') is not working here\n // return isNil(name)\n // ? (fallback === 'EU institutions' ? this.$t('message.catalogFacets.euInstitutions') : fallback)\n // : name;\n return isNil(name)\n ? fallback\n : name;\n }\n if (isObject(fallback)) {\n return has(fallback, userLocale)\n ? fallback[userLocale]\n : has(fallback, 'en')\n ? fallback.en\n : Object.keys(fallback).length > 0\n ? fallback[0]\n : 'No title available';\n }\n return isNil(fallback)\n ? 'No title available'\n : (isString(fallback)\n ? fallback\n : fallback.toString());\n}\n\n\n/**\n * Truncates a String to a maximum character count of maxChars\n * @param text\n * @param maxChars\n * @param noAppend\n */\nfunction truncate(text, maxChars, noAppend) {\n if (!text) return '';\n const trunc = text.substring(0, maxChars);\n if (noAppend || text.length <= maxChars) return trunc;\n return `${trunc}...`;\n}\n\n/**\n * normalizing the dataset id\n * @param str string to be normalized\n */\nfunction normalize(str) {\n const normalized = str.normalize('NFKD');\n return normalized.replace('%', '').replace('\\\\W', '-').replace('-+', '-').toLowerCase();\n}\n\n/**\n * remove mailto or tel\n * @param str string\n */\nfunction removeMailtoOrTel(str) {\n return str.replace(/^(mailto|tel):/, '');\n}\n\nfunction replaceHttp(str) {\n try {\n const url = new URL(str);\n if (url.protocol === 'http:') {\n url.protocol = 'https:';\n }\n return url.href;\n } catch (ex) {\n // Return original string if it is not a valid URL\n return str;\n }\n}\n\n/**\n * Returns a function that takes an object and returns a modified object\n * where for each dstProp in dstProps holds: object.dstProp === object.srcProp\n *\n * This function aims to help maintain stability against DCAT-AP schema changes\n * by providing alternative keys names for access\n *\n * @example\n * const foo = { foo: 'hello world' };\n * const mirrorFooAsBar = mirrorPropertyFn('foo', 'bar');\n * const mirrored = mirrorFooAsBar(foo);\n * log(mirrored.foo) // -> 'hello world'\n * log(mirrored.bar) // -> 'hello world'\n * @param {String} srcProp\n * @param {String | Array<String>} dstProps\n * @returns {Function}\n */\nfunction mirrorPropertyFn(srcProp, dstProps) {\n const dstPropsArray = isArray(dstProps)\n ? dstProps\n : [dstProps];\n\n // Return function that returns a proxy that does the mirroring when\n // accessing dstProps\n return obj => new Proxy({\n // Add preliminary dstProps to object so lodash _.has won't return false\n ...obj,\n ...dstPropsArray.reduce((acc, prop) => {\n // eslint-disable-next-line no-param-reassign\n acc[prop] = obj[srcProp];\n return acc;\n }, {}),\n }, {\n get(target, prop, receiver) {\n // If accessing dstProp, return srcProp value\n const foundTargetProp = dstPropsArray.includes(srcProp);\n const maybeRedirectedProp = foundTargetProp\n ? srcProp\n : prop;\n return Reflect.get(target, maybeRedirectedProp, receiver);\n },\n });\n}\n\n\n/**\n * @description Function for determining of given data is of type object\n * @param {*} data\n * @returns Boolean determining, if data is object\n */\nfunction matchesObjectStructure(data) {\n const dataKeys = Object.keys(data);\n const firstValue = data[dataKeys[0]];\n\n if (typeof firstValue === 'string' || typeof firstValue === 'number') {\n return true;\n }\n return false;\n}\n\n/**\n* @description Function to search for all properties in inputconfiguration which provide a 'source'-property.\n* Each name provided by a 'source'-property is saved inside the propertyNamesArray and returned as an array of property-names.\n* @param {Array} inputConfigArray Array of inputconfiguration containing information about components to render.\n* @param {Array} propertyNamesArray Array of names retrieved from components with a 'source'-property.\n* @returns {Array} Array with all names retireved (popertyNamesArray)\n*/\nfunction findPropertiesWithSources(inputConfigArray, propertyNamesArray) {\n for (const index in inputConfigArray) {\n // only subcomponents without a 'children'-property contain a 'source'-property\n // if there is a 'children'-property the current component isn't a subcomponent so\n // the function needs be called again on this component to get to the subcomponent\n if (Object.keys(inputConfigArray[index]).includes('children')) {\n findPropertiesWithSources(inputConfigArray[index].children, propertyNamesArray);\n } else if (inputConfigArray[index].type === 'conditional-input') {\n const conditionalInputKeys = Object.keys(inputConfigArray[index].data);\n for (const inputKeyIndex in conditionalInputKeys) {\n findPropertiesWithSources(inputConfigArray[index].data[conditionalInputKeys[inputKeyIndex]], propertyNamesArray);\n }\n } else {\n // not all subcomponents contain a 'source'-property\n if (Object.keys(inputConfigArray[index]).includes('source')) {\n // the 'source'-property provides a name which links to further information in the generalconfig-file\n if (!propertyNamesArray.includes(inputConfigArray[index].source.name)) {\n propertyNamesArray.push(inputConfigArray[index].source.name);\n }\n }\n }\n }\n\n return propertyNamesArray;\n}\n\n/**\n*\n* @param {*} dataset\n* @param {*} properties\n* @param {*} translatableProperties\n*/\nfunction setTranslation(dataset, properties, translatableProperties, languageInformation) {\n for (const propertyIndex in properties) {\n const propertyName = properties[propertyIndex];\n const propertyValue = dataset[propertyName];\n\n if (translatableProperties.includes(propertyName)) {\n const translationSelectoren = Object.keys(languageInformation.translation[languageInformation.locale].message.dataupload[propertyName]);\n\n if (propertyValue !== '') {\n if (translationSelectoren.includes(propertyValue)) {\n dataset[propertyName] = languageInformation.translation[languageInformation.locale].message.dataupload[propertyName][propertyValue];\n }\n }\n }\n }\n}\n\n/**\n* @description Appends current locale to an url\n* @param {String} url url\n*/\nfunction appendCurrentLocaleToURL(url) {\n try {\n const urlHost = new URL(url).host;\n const baseUrlHost = new URL(this.$env.api.baseUrl).host;\n const isOurHostname = urlHost === baseUrlHost;\n if (isOurHostname) {\n return `${url}?locale=${this.$route.query.locale}`;\n }\n return url;\n } catch {\n // when there is no hostname then it should link to our website\n return `${url}?locale=${this.$route.query.locale}`;\n }\n}\n\n/**\n* @description Add preceding zero for numbers < 100 (if not already existing)\n* @param {String} value value\n*/\nfunction addPrecedingZero(value) {\n return `${parseInt(value, 10) < 10 ? 0 : ''}${parseInt(value, 10)}`;\n}\n\n/**\n* @description Formatting temporalResolution property into human-readable format\n* @param {String} datetime datetime in temporalResolution format\n*/\nfunction formatDatetime(datetime) {\n let date = datetime.split('T')[0].substr(1,);\n\n const year = date.split('Y')[0];\n date = date.split('Y')[1];\n\n const month = addPrecedingZero(date.split('M')[0]);\n date = date.split('M')[1];\n\n const day = addPrecedingZero(date.split('D')[0]);\n\n let time = datetime.split('T')[1];\n\n const hour = addPrecedingZero(time.split('H')[0]);\n time = time.split('H')[1];\n\n const minute = addPrecedingZero(time.split('M')[0]);\n time = time.split('M')[1];\n\n const second = addPrecedingZero(time.split('S')[0]);\n\n return `${hour}:${minute}:${second} - ${day}.${month}.${year}`;\n}\n\n/**\n * @description Creates a navigation guard that adds a locale to the query if it is not present.\n */\nfunction createStickyLocale(fallbackLocale: string = 'en') {\n return function stickyLocale(to: any, from: any, next: Function) {\n const toLocale = to.query.locale;\n const fromLocale = from.query.locale;\n\n const newLocale = toLocale ?? fromLocale ?? fallbackLocale;\n\n newLocale !== toLocale \n ? next({ ...to, query: { ...to.query, locale: newLocale } })\n : next();\n };\n}\n\n// Export all functions as default export.\nexport {\n unique,\n getImg,\n getCountryFlagImg,\n getFacetTranslation,\n getRepresentativeLocaleOf,\n getTranslationFor,\n truncate,\n normalize,\n removeMailtoOrTel,\n replaceHttp,\n mirrorPropertyFn,\n matchesObjectStructure,\n findPropertiesWithSources,\n setTranslation,\n appendCurrentLocaleToURL,\n addPrecedingZero,\n formatDatetime,\n createStickyLocale,\n};\n"],"names":["imageModules","localeModules","RELATIVE_PATH_TO_IMAGES","languageList","lang","locale","registerLocale","unique","prop","array","item","getImg","image","defaultFallbackImage","maybeImageFrontSlash","maybeFallbackImageFrontSlash","img","getCountryFlagImg","countryId","getRepresentativeLocaleOf","userLocale","fallbacks","isNil","isObject","isString","has","isArray","foundLang","key","getTranslationFor","getFacetTranslation","fieldId","facetId","fallback","name","getName","truncate","text","maxChars","noAppend","trunc","normalize","str","removeMailtoOrTel","replaceHttp","url","mirrorPropertyFn","srcProp","dstProps","dstPropsArray","obj","acc","target","receiver","maybeRedirectedProp","matchesObjectStructure","data","dataKeys","firstValue","findPropertiesWithSources","inputConfigArray","propertyNamesArray","index","conditionalInputKeys","inputKeyIndex","setTranslation","dataset","properties","translatableProperties","languageInformation","propertyIndex","propertyName","propertyValue","translationSelectoren","appendCurrentLocaleToURL","urlHost","baseUrlHost","addPrecedingZero","value","formatDatetime","datetime","date","year","month","day","time","hour","minute","second","createStickyLocale","fallbackLocale","to","from","next","toLocale","fromLocale","newLocale"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,ukDACAC,ktBACAC,IAA0B,iBAG1BC,KAAe,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,M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