@moduk/frontend 0.2.1-alpha.6 → 0.2.2
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.
|
@@ -1,1294 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (window.NodeList.prototype.forEach)
|
|
3
|
-
return t.forEach(e);
|
|
4
|
-
for (var n = 0; n < t.length; n++)
|
|
5
|
-
e.call(window, t[n], n, t);
|
|
6
|
-
}
|
|
7
|
-
function Y() {
|
|
8
|
-
var t = new Date().getTime();
|
|
9
|
-
return typeof window.performance < "u" && typeof window.performance.now == "function" && (t += window.performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
10
|
-
var n = (t + Math.random() * 16) % 16 | 0;
|
|
11
|
-
return t = Math.floor(t / 16), (e === "x" ? n : n & 3 | 8).toString(16);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function O() {
|
|
15
|
-
for (var t = function(l) {
|
|
16
|
-
var a = {}, i = function(u, s) {
|
|
17
|
-
for (var c in u)
|
|
18
|
-
if (!!Object.prototype.hasOwnProperty.call(u, c)) {
|
|
19
|
-
var f = u[c], p = s ? s + "." + c : c;
|
|
20
|
-
typeof f == "object" ? i(f, p) : a[p] = f;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return i(l), a;
|
|
24
|
-
}, e = {}, n = 0; n < arguments.length; n++) {
|
|
25
|
-
var o = t(arguments[n]);
|
|
26
|
-
for (var r in o)
|
|
27
|
-
Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
|
|
28
|
-
}
|
|
29
|
-
return e;
|
|
30
|
-
}
|
|
31
|
-
function W(t, e) {
|
|
32
|
-
if (!t || typeof t != "object")
|
|
33
|
-
throw new Error('Provide a `configObject` of type "object".');
|
|
34
|
-
if (!e || typeof e != "string")
|
|
35
|
-
throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.');
|
|
36
|
-
var n = {};
|
|
37
|
-
for (var o in t) {
|
|
38
|
-
var r = o.split(".");
|
|
39
|
-
if (Object.prototype.hasOwnProperty.call(t, o) && r[0] === e) {
|
|
40
|
-
r.length > 1 && r.shift();
|
|
41
|
-
var l = r.join(".");
|
|
42
|
-
n[l] = t[o];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
function S(t, e) {
|
|
48
|
-
this.translations = t || {}, this.locale = e && e.locale || document.documentElement.lang || "en";
|
|
49
|
-
}
|
|
50
|
-
S.prototype.t = function(t, e) {
|
|
51
|
-
if (!t)
|
|
52
|
-
throw new Error("i18n: lookup key missing");
|
|
53
|
-
if (e && typeof e.count < "u" && (t = t + "." + this.getPluralSuffix(t, e.count)), t in this.translations) {
|
|
54
|
-
var n = this.translations[t];
|
|
55
|
-
if (n.match(/%{(.\S+)}/)) {
|
|
56
|
-
if (!e)
|
|
57
|
-
throw new Error("i18n: cannot replace placeholders in string if no option data provided");
|
|
58
|
-
return this.replacePlaceholders(n, e);
|
|
59
|
-
} else
|
|
60
|
-
return n;
|
|
61
|
-
} else
|
|
62
|
-
return t;
|
|
63
|
-
};
|
|
64
|
-
S.prototype.replacePlaceholders = function(t, e) {
|
|
65
|
-
var n;
|
|
66
|
-
return this.hasIntlNumberFormatSupport() && (n = new Intl.NumberFormat(this.locale)), t.replace(/%{(.\S+)}/g, function(o, r) {
|
|
67
|
-
if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
68
|
-
var l = e[r];
|
|
69
|
-
return l === !1 ? "" : typeof l == "number" && n ? n.format(l) : l;
|
|
70
|
-
} else
|
|
71
|
-
throw new Error("i18n: no data found to replace " + o + " placeholder in string");
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
S.prototype.hasIntlPluralRulesSupport = function() {
|
|
75
|
-
return Boolean(window.Intl && "PluralRules" in window.Intl && Intl.PluralRules.supportedLocalesOf(this.locale).length);
|
|
76
|
-
};
|
|
77
|
-
S.prototype.hasIntlNumberFormatSupport = function() {
|
|
78
|
-
return Boolean(window.Intl && "NumberFormat" in window.Intl && Intl.NumberFormat.supportedLocalesOf(this.locale).length);
|
|
79
|
-
};
|
|
80
|
-
S.prototype.getPluralSuffix = function(t, e) {
|
|
81
|
-
if (e = Number(e), !isFinite(e))
|
|
82
|
-
return "other";
|
|
83
|
-
var n;
|
|
84
|
-
if (this.hasIntlPluralRulesSupport() ? n = new Intl.PluralRules(this.locale).select(e) : n = this.selectPluralFormUsingFallbackRules(e), t + "." + n in this.translations)
|
|
85
|
-
return n;
|
|
86
|
-
if (t + ".other" in this.translations)
|
|
87
|
-
return console && "warn" in console && console.warn('i18n: Missing plural form ".' + n + '" for "' + this.locale + '" locale. Falling back to ".other".'), "other";
|
|
88
|
-
throw new Error(
|
|
89
|
-
'i18n: Plural form ".other" is required for "' + this.locale + '" locale'
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
S.prototype.selectPluralFormUsingFallbackRules = function(t) {
|
|
93
|
-
t = Math.abs(Math.floor(t));
|
|
94
|
-
var e = this.getPluralRulesForLocale();
|
|
95
|
-
return e ? S.pluralRules[e](t) : "other";
|
|
96
|
-
};
|
|
97
|
-
S.prototype.getPluralRulesForLocale = function() {
|
|
98
|
-
var t = this.locale, e = t.split("-")[0];
|
|
99
|
-
for (var n in S.pluralRulesMap)
|
|
100
|
-
if (Object.prototype.hasOwnProperty.call(S.pluralRulesMap, n)) {
|
|
101
|
-
for (var o = S.pluralRulesMap[n], r = 0; r < o.length; r++)
|
|
102
|
-
if (o[r] === t || o[r] === e)
|
|
103
|
-
return n;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
S.pluralRulesMap = {
|
|
107
|
-
arabic: ["ar"],
|
|
108
|
-
chinese: ["my", "zh", "id", "ja", "jv", "ko", "ms", "th", "vi"],
|
|
109
|
-
french: ["hy", "bn", "fr", "gu", "hi", "fa", "pa", "zu"],
|
|
110
|
-
german: [
|
|
111
|
-
"af",
|
|
112
|
-
"sq",
|
|
113
|
-
"az",
|
|
114
|
-
"eu",
|
|
115
|
-
"bg",
|
|
116
|
-
"ca",
|
|
117
|
-
"da",
|
|
118
|
-
"nl",
|
|
119
|
-
"en",
|
|
120
|
-
"et",
|
|
121
|
-
"fi",
|
|
122
|
-
"ka",
|
|
123
|
-
"de",
|
|
124
|
-
"el",
|
|
125
|
-
"hu",
|
|
126
|
-
"lb",
|
|
127
|
-
"no",
|
|
128
|
-
"so",
|
|
129
|
-
"sw",
|
|
130
|
-
"sv",
|
|
131
|
-
"ta",
|
|
132
|
-
"te",
|
|
133
|
-
"tr",
|
|
134
|
-
"ur"
|
|
135
|
-
],
|
|
136
|
-
irish: ["ga"],
|
|
137
|
-
russian: ["ru", "uk"],
|
|
138
|
-
scottish: ["gd"],
|
|
139
|
-
spanish: ["pt-PT", "it", "es"],
|
|
140
|
-
welsh: ["cy"]
|
|
141
|
-
};
|
|
142
|
-
S.pluralRules = {
|
|
143
|
-
arabic: function(t) {
|
|
144
|
-
return t === 0 ? "zero" : t === 1 ? "one" : t === 2 ? "two" : t % 100 >= 3 && t % 100 <= 10 ? "few" : t % 100 >= 11 && t % 100 <= 99 ? "many" : "other";
|
|
145
|
-
},
|
|
146
|
-
chinese: function() {
|
|
147
|
-
return "other";
|
|
148
|
-
},
|
|
149
|
-
french: function(t) {
|
|
150
|
-
return t === 0 || t === 1 ? "one" : "other";
|
|
151
|
-
},
|
|
152
|
-
german: function(t) {
|
|
153
|
-
return t === 1 ? "one" : "other";
|
|
154
|
-
},
|
|
155
|
-
irish: function(t) {
|
|
156
|
-
return t === 1 ? "one" : t === 2 ? "two" : t >= 3 && t <= 6 ? "few" : t >= 7 && t <= 10 ? "many" : "other";
|
|
157
|
-
},
|
|
158
|
-
russian: function(t) {
|
|
159
|
-
var e = t % 100, n = e % 10;
|
|
160
|
-
return n === 1 && e !== 11 ? "one" : n >= 2 && n <= 4 && !(e >= 12 && e <= 14) ? "few" : n === 0 || n >= 5 && n <= 9 || e >= 11 && e <= 14 ? "many" : "other";
|
|
161
|
-
},
|
|
162
|
-
scottish: function(t) {
|
|
163
|
-
return t === 1 || t === 11 ? "one" : t === 2 || t === 12 ? "two" : t >= 3 && t <= 10 || t >= 13 && t <= 19 ? "few" : "other";
|
|
164
|
-
},
|
|
165
|
-
spanish: function(t) {
|
|
166
|
-
return t === 1 ? "one" : t % 1e6 === 0 && t !== 0 ? "many" : "other";
|
|
167
|
-
},
|
|
168
|
-
welsh: function(t) {
|
|
169
|
-
return t === 0 ? "zero" : t === 1 ? "one" : t === 2 ? "two" : t === 3 ? "few" : t === 6 ? "many" : "other";
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
(function(t) {
|
|
173
|
-
var e = "defineProperty" in Object && function() {
|
|
174
|
-
try {
|
|
175
|
-
var n = {};
|
|
176
|
-
return Object.defineProperty(n, "test", { value: 42 }), !0;
|
|
177
|
-
} catch {
|
|
178
|
-
return !1;
|
|
179
|
-
}
|
|
180
|
-
}();
|
|
181
|
-
e || function(n) {
|
|
182
|
-
var o = Object.prototype.hasOwnProperty("__defineGetter__"), r = "Getters & setters cannot be defined on this javascript engine", l = "A property cannot both have accessors and be writable or have a value";
|
|
183
|
-
Object.defineProperty = function(i, u, s) {
|
|
184
|
-
if (n && (i === window || i === document || i === Element.prototype || i instanceof Element))
|
|
185
|
-
return n(i, u, s);
|
|
186
|
-
if (i === null || !(i instanceof Object || typeof i == "object"))
|
|
187
|
-
throw new TypeError("Object.defineProperty called on non-object");
|
|
188
|
-
if (!(s instanceof Object))
|
|
189
|
-
throw new TypeError("Property description must be an object");
|
|
190
|
-
var c = String(u), f = "value" in s || "writable" in s, p = "get" in s && typeof s.get, d = "set" in s && typeof s.set;
|
|
191
|
-
if (p) {
|
|
192
|
-
if (p !== "function")
|
|
193
|
-
throw new TypeError("Getter must be a function");
|
|
194
|
-
if (!o)
|
|
195
|
-
throw new TypeError(r);
|
|
196
|
-
if (f)
|
|
197
|
-
throw new TypeError(l);
|
|
198
|
-
Object.__defineGetter__.call(i, c, s.get);
|
|
199
|
-
} else
|
|
200
|
-
i[c] = s.value;
|
|
201
|
-
if (d) {
|
|
202
|
-
if (d !== "function")
|
|
203
|
-
throw new TypeError("Setter must be a function");
|
|
204
|
-
if (!o)
|
|
205
|
-
throw new TypeError(r);
|
|
206
|
-
if (f)
|
|
207
|
-
throw new TypeError(l);
|
|
208
|
-
Object.__defineSetter__.call(i, c, s.set);
|
|
209
|
-
}
|
|
210
|
-
return "value" in s && (i[c] = s.value), i;
|
|
211
|
-
};
|
|
212
|
-
}(Object.defineProperty);
|
|
213
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
214
|
-
(function(t) {
|
|
215
|
-
var e = "bind" in Function.prototype;
|
|
216
|
-
e || Object.defineProperty(Function.prototype, "bind", {
|
|
217
|
-
value: function(o) {
|
|
218
|
-
var r = Array, l = Object, a = l.prototype, i = r.prototype, u = function() {
|
|
219
|
-
}, s = a.toString, c = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol", f, p = Function.prototype.toString, d = function($) {
|
|
220
|
-
try {
|
|
221
|
-
return p.call($), !0;
|
|
222
|
-
} catch {
|
|
223
|
-
return !1;
|
|
224
|
-
}
|
|
225
|
-
}, m = "[object Function]", E = "[object GeneratorFunction]";
|
|
226
|
-
f = function($) {
|
|
227
|
-
if (typeof $ != "function")
|
|
228
|
-
return !1;
|
|
229
|
-
if (c)
|
|
230
|
-
return d($);
|
|
231
|
-
var N = s.call($);
|
|
232
|
-
return N === m || N === E;
|
|
233
|
-
};
|
|
234
|
-
var b = i.slice, h = i.concat, g = i.push, v = Math.max, C = this;
|
|
235
|
-
if (!f(C))
|
|
236
|
-
throw new TypeError("Function.prototype.bind called on incompatible " + C);
|
|
237
|
-
for (var B = b.call(arguments, 1), F, U = function() {
|
|
238
|
-
if (this instanceof F) {
|
|
239
|
-
var T = C.apply(
|
|
240
|
-
this,
|
|
241
|
-
h.call(B, b.call(arguments))
|
|
242
|
-
);
|
|
243
|
-
return l(T) === T ? T : this;
|
|
244
|
-
} else
|
|
245
|
-
return C.apply(
|
|
246
|
-
o,
|
|
247
|
-
h.call(B, b.call(arguments))
|
|
248
|
-
);
|
|
249
|
-
}, G = v(0, C.length - B.length), D = [], q = 0; q < G; q++)
|
|
250
|
-
g.call(D, "$" + q);
|
|
251
|
-
return F = Function("binder", "return function (" + D.join(",") + "){ return binder.apply(this, arguments); }")(U), C.prototype && (u.prototype = C.prototype, F.prototype = new u(), u.prototype = null), F;
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
255
|
-
(function(t) {
|
|
256
|
-
var e = "DOMTokenList" in this && function(n) {
|
|
257
|
-
return "classList" in n ? !n.classList.toggle("x", !1) && !n.className : !0;
|
|
258
|
-
}(document.createElement("x"));
|
|
259
|
-
e || function(n) {
|
|
260
|
-
var o = "DOMTokenList" in n && n.DOMTokenList;
|
|
261
|
-
(!o || !!document.createElementNS && !!document.createElementNS("http://www.w3.org/2000/svg", "svg") && !(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList)) && (n.DOMTokenList = function() {
|
|
262
|
-
var r = !0, l = function(i, u, s, c) {
|
|
263
|
-
Object.defineProperty ? Object.defineProperty(i, u, {
|
|
264
|
-
configurable: r === !1 ? !0 : !!c,
|
|
265
|
-
get: s
|
|
266
|
-
}) : i.__defineGetter__(u, s);
|
|
267
|
-
};
|
|
268
|
-
try {
|
|
269
|
-
l({}, "support");
|
|
270
|
-
} catch {
|
|
271
|
-
r = !1;
|
|
272
|
-
}
|
|
273
|
-
var a = function(i, u) {
|
|
274
|
-
var s = this, c = [], f = {}, p = 0, d = 0, m = function(h) {
|
|
275
|
-
l(s, h, function() {
|
|
276
|
-
return b(), c[h];
|
|
277
|
-
}, !1);
|
|
278
|
-
}, E = function() {
|
|
279
|
-
if (p >= d)
|
|
280
|
-
for (; d < p; ++d)
|
|
281
|
-
m(d);
|
|
282
|
-
}, b = function() {
|
|
283
|
-
var h, g, v = arguments, C = /\s+/;
|
|
284
|
-
if (v.length) {
|
|
285
|
-
for (g = 0; g < v.length; ++g)
|
|
286
|
-
if (C.test(v[g]))
|
|
287
|
-
throw h = new SyntaxError('String "' + v[g] + '" contains an invalid character'), h.code = 5, h.name = "InvalidCharacterError", h;
|
|
288
|
-
}
|
|
289
|
-
for (typeof i[u] == "object" ? c = ("" + i[u].baseVal).replace(/^\s+|\s+$/g, "").split(C) : c = ("" + i[u]).replace(/^\s+|\s+$/g, "").split(C), c[0] === "" && (c = []), f = {}, g = 0; g < c.length; ++g)
|
|
290
|
-
f[c[g]] = !0;
|
|
291
|
-
p = c.length, E();
|
|
292
|
-
};
|
|
293
|
-
return b(), l(s, "length", function() {
|
|
294
|
-
return b(), p;
|
|
295
|
-
}), s.toLocaleString = s.toString = function() {
|
|
296
|
-
return b(), c.join(" ");
|
|
297
|
-
}, s.item = function(h) {
|
|
298
|
-
return b(), c[h];
|
|
299
|
-
}, s.contains = function(h) {
|
|
300
|
-
return b(), !!f[h];
|
|
301
|
-
}, s.add = function() {
|
|
302
|
-
b.apply(s, h = arguments);
|
|
303
|
-
for (var h, g, v = 0, C = h.length; v < C; ++v)
|
|
304
|
-
g = h[v], f[g] || (c.push(g), f[g] = !0);
|
|
305
|
-
p !== c.length && (p = c.length >>> 0, typeof i[u] == "object" ? i[u].baseVal = c.join(" ") : i[u] = c.join(" "), E());
|
|
306
|
-
}, s.remove = function() {
|
|
307
|
-
b.apply(s, h = arguments);
|
|
308
|
-
for (var h, g = {}, v = 0, C = []; v < h.length; ++v)
|
|
309
|
-
g[h[v]] = !0, delete f[h[v]];
|
|
310
|
-
for (v = 0; v < c.length; ++v)
|
|
311
|
-
g[c[v]] || C.push(c[v]);
|
|
312
|
-
c = C, p = C.length >>> 0, typeof i[u] == "object" ? i[u].baseVal = c.join(" ") : i[u] = c.join(" "), E();
|
|
313
|
-
}, s.toggle = function(h, g) {
|
|
314
|
-
return b.apply(s, [h]), t !== g ? g ? (s.add(h), !0) : (s.remove(h), !1) : f[h] ? (s.remove(h), !1) : (s.add(h), !0);
|
|
315
|
-
}, s;
|
|
316
|
-
};
|
|
317
|
-
return a;
|
|
318
|
-
}()), function() {
|
|
319
|
-
var r = document.createElement("span");
|
|
320
|
-
"classList" in r && (r.classList.toggle("x", !1), r.classList.contains("x") && (r.classList.constructor.prototype.toggle = function(a) {
|
|
321
|
-
var i = arguments[1];
|
|
322
|
-
if (i === t) {
|
|
323
|
-
var u = !this.contains(a);
|
|
324
|
-
return this[u ? "add" : "remove"](a), u;
|
|
325
|
-
}
|
|
326
|
-
return i = !!i, this[i ? "add" : "remove"](a), i;
|
|
327
|
-
}));
|
|
328
|
-
}(), function() {
|
|
329
|
-
var r = document.createElement("span");
|
|
330
|
-
if ("classList" in r && (r.classList.add("a", "b"), !r.classList.contains("b"))) {
|
|
331
|
-
var l = r.classList.constructor.prototype.add;
|
|
332
|
-
r.classList.constructor.prototype.add = function() {
|
|
333
|
-
for (var a = arguments, i = arguments.length, u = 0; u < i; u++)
|
|
334
|
-
l.call(this, a[u]);
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
}(), function() {
|
|
338
|
-
var r = document.createElement("span");
|
|
339
|
-
if ("classList" in r && (r.classList.add("a"), r.classList.add("b"), r.classList.remove("a", "b"), !!r.classList.contains("b"))) {
|
|
340
|
-
var l = r.classList.constructor.prototype.remove;
|
|
341
|
-
r.classList.constructor.prototype.remove = function() {
|
|
342
|
-
for (var a = arguments, i = arguments.length, u = 0; u < i; u++)
|
|
343
|
-
l.call(this, a[u]);
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}();
|
|
347
|
-
}(this);
|
|
348
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
349
|
-
(function(t) {
|
|
350
|
-
var e = "Document" in this;
|
|
351
|
-
e || typeof WorkerGlobalScope > "u" && typeof importScripts != "function" && (this.HTMLDocument ? this.Document = this.HTMLDocument : (this.Document = this.HTMLDocument = document.constructor = new Function("return function Document() {}")(), this.Document.prototype = document));
|
|
352
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
353
|
-
(function(t) {
|
|
354
|
-
var e = "Element" in this && "HTMLElement" in this;
|
|
355
|
-
e || function() {
|
|
356
|
-
if (window.Element && !window.HTMLElement) {
|
|
357
|
-
window.HTMLElement = window.Element;
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
window.Element = window.HTMLElement = new Function("return function Element() {}")();
|
|
361
|
-
var n = document.appendChild(document.createElement("body")), o = n.appendChild(document.createElement("iframe")), r = o.contentWindow.document, l = Element.prototype = r.appendChild(r.createElement("*")), a = {}, i = function(d, m) {
|
|
362
|
-
var E = d.childNodes || [], b = -1, h, g, v;
|
|
363
|
-
if (d.nodeType === 1 && d.constructor !== Element) {
|
|
364
|
-
d.constructor = Element;
|
|
365
|
-
for (h in a)
|
|
366
|
-
g = a[h], d[h] = g;
|
|
367
|
-
}
|
|
368
|
-
for (; v = m && E[++b]; )
|
|
369
|
-
i(v, m);
|
|
370
|
-
return d;
|
|
371
|
-
}, u = document.getElementsByTagName("*"), s = document.createElement, c, f = 100;
|
|
372
|
-
l.attachEvent("onpropertychange", function(d) {
|
|
373
|
-
for (var m = d.propertyName, E = !a.hasOwnProperty(m), b = l[m], h = a[m], g = -1, v; v = u[++g]; )
|
|
374
|
-
v.nodeType === 1 && (E || v[m] === h) && (v[m] = b);
|
|
375
|
-
a[m] = b;
|
|
376
|
-
}), l.constructor = Element, l.hasAttribute || (l.hasAttribute = function(m) {
|
|
377
|
-
return this.getAttribute(m) !== null;
|
|
378
|
-
});
|
|
379
|
-
function p() {
|
|
380
|
-
return f-- || clearTimeout(c), document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState) ? (i(document, !0), c && document.body.prototype && clearTimeout(c), !!document.body.prototype) : !1;
|
|
381
|
-
}
|
|
382
|
-
p() || (document.onreadystatechange = p, c = setInterval(p, 25)), document.createElement = function(m) {
|
|
383
|
-
var E = s(String(m).toLowerCase());
|
|
384
|
-
return i(E);
|
|
385
|
-
}, document.removeChild(n);
|
|
386
|
-
}();
|
|
387
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
388
|
-
(function(t) {
|
|
389
|
-
var e = "document" in this && "classList" in document.documentElement && "Element" in this && "classList" in Element.prototype && function() {
|
|
390
|
-
var n = document.createElement("span");
|
|
391
|
-
return n.classList.add("a", "b"), n.classList.contains("b");
|
|
392
|
-
}();
|
|
393
|
-
e || function(n) {
|
|
394
|
-
var o = !0, r = function(a, i, u, s) {
|
|
395
|
-
Object.defineProperty ? Object.defineProperty(a, i, {
|
|
396
|
-
configurable: o === !1 ? !0 : !!s,
|
|
397
|
-
get: u
|
|
398
|
-
}) : a.__defineGetter__(i, u);
|
|
399
|
-
};
|
|
400
|
-
try {
|
|
401
|
-
r({}, "support");
|
|
402
|
-
} catch {
|
|
403
|
-
o = !1;
|
|
404
|
-
}
|
|
405
|
-
var l = function(a, i, u) {
|
|
406
|
-
r(a.prototype, i, function() {
|
|
407
|
-
var s, c = this, f = "__defineGetter__DEFINE_PROPERTY" + i;
|
|
408
|
-
if (c[f])
|
|
409
|
-
return s;
|
|
410
|
-
if (c[f] = !0, o === !1) {
|
|
411
|
-
for (var p, d = l.mirror || document.createElement("div"), m = d.childNodes, E = m.length, b = 0; b < E; ++b)
|
|
412
|
-
if (m[b]._R === c) {
|
|
413
|
-
p = m[b];
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
p || (p = d.appendChild(document.createElement("div"))), s = DOMTokenList.call(p, c, u);
|
|
417
|
-
} else
|
|
418
|
-
s = new DOMTokenList(c, u);
|
|
419
|
-
return r(c, i, function() {
|
|
420
|
-
return s;
|
|
421
|
-
}), delete c[f], s;
|
|
422
|
-
}, !0);
|
|
423
|
-
};
|
|
424
|
-
l(n.Element, "classList", "className"), l(n.HTMLElement, "classList", "className"), l(n.HTMLLinkElement, "relList", "rel"), l(n.HTMLAnchorElement, "relList", "rel"), l(n.HTMLAreaElement, "relList", "rel");
|
|
425
|
-
}(this);
|
|
426
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
427
|
-
(function(t) {
|
|
428
|
-
var e = "trim" in String.prototype;
|
|
429
|
-
e || (String.prototype.trim = function() {
|
|
430
|
-
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
431
|
-
});
|
|
432
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
433
|
-
(function(t) {
|
|
434
|
-
var e = function() {
|
|
435
|
-
if (!document.documentElement.dataset)
|
|
436
|
-
return !1;
|
|
437
|
-
var n = document.createElement("div");
|
|
438
|
-
return n.setAttribute("data-a-b", "c"), n.dataset && n.dataset.aB == "c";
|
|
439
|
-
}();
|
|
440
|
-
e || Object.defineProperty(Element.prototype, "dataset", {
|
|
441
|
-
get: function() {
|
|
442
|
-
for (var n = this, o = this.attributes, r = {}, l = 0; l < o.length; l++) {
|
|
443
|
-
var a = o[l];
|
|
444
|
-
if (a && a.name && /^data-\w[.\w-]*$/.test(a.name)) {
|
|
445
|
-
var i = a.name, u = a.value, s = i.substr(5).replace(/-./g, function(c) {
|
|
446
|
-
return c.charAt(1).toUpperCase();
|
|
447
|
-
});
|
|
448
|
-
"__defineGetter__" in Object.prototype && "__defineSetter__" in Object.prototype ? Object.defineProperty(r, s, {
|
|
449
|
-
enumerable: !0,
|
|
450
|
-
get: function() {
|
|
451
|
-
return this.value;
|
|
452
|
-
}.bind({ value: u || "" }),
|
|
453
|
-
set: function(f, p) {
|
|
454
|
-
typeof p < "u" ? this.setAttribute(f, p) : this.removeAttribute(f);
|
|
455
|
-
}.bind(n, i)
|
|
456
|
-
}) : r[s] = u;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return r;
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
463
|
-
function z(t) {
|
|
464
|
-
if (typeof t != "string")
|
|
465
|
-
return t;
|
|
466
|
-
var e = t.trim();
|
|
467
|
-
return e === "true" ? !0 : e === "false" ? !1 : e.length > 0 && isFinite(e) ? Number(e) : t;
|
|
468
|
-
}
|
|
469
|
-
function j(t) {
|
|
470
|
-
var e = {};
|
|
471
|
-
for (var n in t)
|
|
472
|
-
e[n] = z(t[n]);
|
|
473
|
-
return e;
|
|
474
|
-
}
|
|
475
|
-
var K = {
|
|
476
|
-
hideAllSections: "Hide all sections",
|
|
477
|
-
hideSection: "Hide",
|
|
478
|
-
hideSectionAriaLabel: "Hide this section",
|
|
479
|
-
showAllSections: "Show all sections",
|
|
480
|
-
showSection: "Show",
|
|
481
|
-
showSectionAriaLabel: "Show this section"
|
|
482
|
-
};
|
|
483
|
-
function A(t, e) {
|
|
484
|
-
this.$module = t, this.$sections = t.querySelectorAll(".govuk-accordion__section"), this.browserSupportsSessionStorage = X.checkForSessionStorage();
|
|
485
|
-
var n = {
|
|
486
|
-
i18n: K
|
|
487
|
-
};
|
|
488
|
-
this.config = O(
|
|
489
|
-
n,
|
|
490
|
-
e || {},
|
|
491
|
-
j(t.dataset)
|
|
492
|
-
), this.i18n = new S(W(this.config, "i18n")), this.controlsClass = "govuk-accordion__controls", this.showAllClass = "govuk-accordion__show-all", this.showAllTextClass = "govuk-accordion__show-all-text", this.sectionExpandedClass = "govuk-accordion__section--expanded", this.sectionButtonClass = "govuk-accordion__section-button", this.sectionHeaderClass = "govuk-accordion__section-header", this.sectionHeadingClass = "govuk-accordion__section-heading", this.sectionHeadingTextClass = "govuk-accordion__section-heading-text", this.sectionHeadingTextFocusClass = "govuk-accordion__section-heading-text-focus", this.sectionShowHideToggleClass = "govuk-accordion__section-toggle", this.sectionShowHideToggleFocusClass = "govuk-accordion__section-toggle-focus", this.sectionShowHideTextClass = "govuk-accordion__section-toggle-text", this.upChevronIconClass = "govuk-accordion-nav__chevron", this.downChevronIconClass = "govuk-accordion-nav__chevron--down", this.sectionSummaryClass = "govuk-accordion__section-summary", this.sectionSummaryFocusClass = "govuk-accordion__section-summary-focus";
|
|
493
|
-
}
|
|
494
|
-
A.prototype.init = function() {
|
|
495
|
-
if (!!this.$module) {
|
|
496
|
-
this.initControls(), this.initSectionHeaders();
|
|
497
|
-
var t = this.checkIfAllSectionsOpen();
|
|
498
|
-
this.updateShowAllButton(t);
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
A.prototype.initControls = function() {
|
|
502
|
-
this.$showAllButton = document.createElement("button"), this.$showAllButton.setAttribute("type", "button"), this.$showAllButton.setAttribute("class", this.showAllClass), this.$showAllButton.setAttribute("aria-expanded", "false");
|
|
503
|
-
var t = document.createElement("span");
|
|
504
|
-
t.classList.add(this.upChevronIconClass), this.$showAllButton.appendChild(t);
|
|
505
|
-
var e = document.createElement("div");
|
|
506
|
-
e.setAttribute("class", this.controlsClass), e.appendChild(this.$showAllButton), this.$module.insertBefore(e, this.$module.firstChild);
|
|
507
|
-
var n = document.createElement("span");
|
|
508
|
-
n.classList.add(this.showAllTextClass), this.$showAllButton.appendChild(n), this.$showAllButton.addEventListener("click", this.onShowOrHideAllToggle.bind(this));
|
|
509
|
-
};
|
|
510
|
-
A.prototype.initSectionHeaders = function() {
|
|
511
|
-
w(this.$sections, function(t, e) {
|
|
512
|
-
var n = t.querySelector("." + this.sectionHeaderClass);
|
|
513
|
-
this.constructHeaderMarkup(n, e), this.setExpanded(this.isExpanded(t), t), n.addEventListener("click", this.onSectionToggle.bind(this, t)), this.setInitialState(t);
|
|
514
|
-
}.bind(this));
|
|
515
|
-
};
|
|
516
|
-
A.prototype.constructHeaderMarkup = function(t, e) {
|
|
517
|
-
var n = t.querySelector("." + this.sectionButtonClass), o = t.querySelector("." + this.sectionHeadingClass), r = t.querySelector("." + this.sectionSummaryClass), l = document.createElement("button");
|
|
518
|
-
l.setAttribute("type", "button"), l.setAttribute("aria-controls", this.$module.id + "-content-" + (e + 1));
|
|
519
|
-
for (var a = 0; a < n.attributes.length; a++) {
|
|
520
|
-
var i = n.attributes.item(a);
|
|
521
|
-
i.nodeName !== "id" && l.setAttribute(i.nodeName, i.nodeValue);
|
|
522
|
-
}
|
|
523
|
-
var u = document.createElement("span");
|
|
524
|
-
u.classList.add(this.sectionHeadingTextClass), u.id = n.id;
|
|
525
|
-
var s = document.createElement("span");
|
|
526
|
-
s.classList.add(this.sectionHeadingTextFocusClass), u.appendChild(s), s.innerHTML = n.innerHTML;
|
|
527
|
-
var c = document.createElement("span");
|
|
528
|
-
c.classList.add(this.sectionShowHideToggleClass), c.setAttribute("data-nosnippet", "");
|
|
529
|
-
var f = document.createElement("span");
|
|
530
|
-
f.classList.add(this.sectionShowHideToggleFocusClass), c.appendChild(f);
|
|
531
|
-
var p = document.createElement("span"), d = document.createElement("span");
|
|
532
|
-
if (d.classList.add(this.upChevronIconClass), f.appendChild(d), p.classList.add(this.sectionShowHideTextClass), f.appendChild(p), l.appendChild(u), l.appendChild(this.getButtonPunctuationEl()), typeof r < "u" && r !== null) {
|
|
533
|
-
var m = document.createElement("span"), E = document.createElement("span");
|
|
534
|
-
E.classList.add(this.sectionSummaryFocusClass), m.appendChild(E);
|
|
535
|
-
for (var b = 0, h = r.attributes.length; b < h; ++b) {
|
|
536
|
-
var g = r.attributes.item(b).nodeName, v = r.attributes.item(b).nodeValue;
|
|
537
|
-
m.setAttribute(g, v);
|
|
538
|
-
}
|
|
539
|
-
E.innerHTML = r.innerHTML, r.parentNode.replaceChild(m, r), l.appendChild(m), l.appendChild(this.getButtonPunctuationEl());
|
|
540
|
-
}
|
|
541
|
-
l.appendChild(c), o.removeChild(n), o.appendChild(l);
|
|
542
|
-
};
|
|
543
|
-
A.prototype.onSectionToggle = function(t) {
|
|
544
|
-
var e = this.isExpanded(t);
|
|
545
|
-
this.setExpanded(!e, t), this.storeState(t);
|
|
546
|
-
};
|
|
547
|
-
A.prototype.onShowOrHideAllToggle = function() {
|
|
548
|
-
var t = this, e = this.$sections, n = !this.checkIfAllSectionsOpen();
|
|
549
|
-
w(e, function(o) {
|
|
550
|
-
t.setExpanded(n, o), t.storeState(o);
|
|
551
|
-
}), t.updateShowAllButton(n);
|
|
552
|
-
};
|
|
553
|
-
A.prototype.setExpanded = function(t, e) {
|
|
554
|
-
var n = e.querySelector("." + this.upChevronIconClass), o = e.querySelector("." + this.sectionShowHideTextClass), r = e.querySelector("." + this.sectionButtonClass), l = t ? this.i18n.t("hideSection") : this.i18n.t("showSection");
|
|
555
|
-
o.innerText = l, r.setAttribute("aria-expanded", t);
|
|
556
|
-
var a = e.querySelector("." + this.sectionHeadingTextClass), i = [a.innerText.trim()], u = e.querySelector("." + this.sectionSummaryClass);
|
|
557
|
-
u && i.push(u.innerText.trim());
|
|
558
|
-
var s = t ? this.i18n.t("hideSectionAriaLabel") : this.i18n.t("showSectionAriaLabel");
|
|
559
|
-
i.push(s), r.setAttribute("aria-label", i.join(" , ")), t ? (e.classList.add(this.sectionExpandedClass), n.classList.remove(this.downChevronIconClass)) : (e.classList.remove(this.sectionExpandedClass), n.classList.add(this.downChevronIconClass));
|
|
560
|
-
var c = this.checkIfAllSectionsOpen();
|
|
561
|
-
this.updateShowAllButton(c);
|
|
562
|
-
};
|
|
563
|
-
A.prototype.isExpanded = function(t) {
|
|
564
|
-
return t.classList.contains(this.sectionExpandedClass);
|
|
565
|
-
};
|
|
566
|
-
A.prototype.checkIfAllSectionsOpen = function() {
|
|
567
|
-
var t = this.$sections.length, e = this.$module.querySelectorAll("." + this.sectionExpandedClass).length, n = t === e;
|
|
568
|
-
return n;
|
|
569
|
-
};
|
|
570
|
-
A.prototype.updateShowAllButton = function(t) {
|
|
571
|
-
var e = this.$showAllButton.querySelector("." + this.upChevronIconClass), n = this.$showAllButton.querySelector("." + this.showAllTextClass), o = t ? this.i18n.t("hideAllSections") : this.i18n.t("showAllSections");
|
|
572
|
-
this.$showAllButton.setAttribute("aria-expanded", t), n.innerText = o, t ? e.classList.remove(this.downChevronIconClass) : e.classList.add(this.downChevronIconClass);
|
|
573
|
-
};
|
|
574
|
-
var X = {
|
|
575
|
-
checkForSessionStorage: function() {
|
|
576
|
-
var t = "this is the test string", e;
|
|
577
|
-
try {
|
|
578
|
-
return window.sessionStorage.setItem(t, t), e = window.sessionStorage.getItem(t) === t.toString(), window.sessionStorage.removeItem(t), e;
|
|
579
|
-
} catch {
|
|
580
|
-
return !1;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
A.prototype.storeState = function(t) {
|
|
585
|
-
if (this.browserSupportsSessionStorage) {
|
|
586
|
-
var e = t.querySelector("." + this.sectionButtonClass);
|
|
587
|
-
if (e) {
|
|
588
|
-
var n = e.getAttribute("aria-controls"), o = e.getAttribute("aria-expanded");
|
|
589
|
-
n && o && window.sessionStorage.setItem(n, o);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
A.prototype.setInitialState = function(t) {
|
|
594
|
-
if (this.browserSupportsSessionStorage) {
|
|
595
|
-
var e = t.querySelector("." + this.sectionButtonClass);
|
|
596
|
-
if (e) {
|
|
597
|
-
var n = e.getAttribute("aria-controls"), o = n ? window.sessionStorage.getItem(n) : null;
|
|
598
|
-
o !== null && this.setExpanded(o === "true", t);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
A.prototype.getButtonPunctuationEl = function() {
|
|
603
|
-
var t = document.createElement("span");
|
|
604
|
-
return t.classList.add("govuk-visually-hidden", "govuk-accordion__section-heading-divider"), t.innerHTML = ", ", t;
|
|
605
|
-
};
|
|
606
|
-
(function(t) {
|
|
607
|
-
var e = "Window" in this;
|
|
608
|
-
e || typeof WorkerGlobalScope > "u" && typeof importScripts != "function" && function(n) {
|
|
609
|
-
n.constructor ? n.Window = n.constructor : (n.Window = n.constructor = new Function("return function Window() {}")()).prototype = this;
|
|
610
|
-
}(this);
|
|
611
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
612
|
-
(function(t) {
|
|
613
|
-
var e = function(n) {
|
|
614
|
-
if (!("Event" in n))
|
|
615
|
-
return !1;
|
|
616
|
-
if (typeof n.Event == "function")
|
|
617
|
-
return !0;
|
|
618
|
-
try {
|
|
619
|
-
return new Event("click"), !0;
|
|
620
|
-
} catch {
|
|
621
|
-
return !1;
|
|
622
|
-
}
|
|
623
|
-
}(this);
|
|
624
|
-
e || function() {
|
|
625
|
-
var n = {
|
|
626
|
-
click: 1,
|
|
627
|
-
dblclick: 1,
|
|
628
|
-
keyup: 1,
|
|
629
|
-
keypress: 1,
|
|
630
|
-
keydown: 1,
|
|
631
|
-
mousedown: 1,
|
|
632
|
-
mouseup: 1,
|
|
633
|
-
mousemove: 1,
|
|
634
|
-
mouseover: 1,
|
|
635
|
-
mouseenter: 1,
|
|
636
|
-
mouseleave: 1,
|
|
637
|
-
mouseout: 1,
|
|
638
|
-
storage: 1,
|
|
639
|
-
storagecommit: 1,
|
|
640
|
-
textinput: 1
|
|
641
|
-
};
|
|
642
|
-
if (typeof document > "u" || typeof window > "u")
|
|
643
|
-
return;
|
|
644
|
-
function o(l, a) {
|
|
645
|
-
for (var i = -1, u = l.length; ++i < u; )
|
|
646
|
-
if (i in l && l[i] === a)
|
|
647
|
-
return i;
|
|
648
|
-
return -1;
|
|
649
|
-
}
|
|
650
|
-
var r = window.Event && window.Event.prototype || null;
|
|
651
|
-
window.Event = Window.prototype.Event = function(a, i) {
|
|
652
|
-
if (!a)
|
|
653
|
-
throw new Error("Not enough arguments");
|
|
654
|
-
var u;
|
|
655
|
-
if ("createEvent" in document) {
|
|
656
|
-
u = document.createEvent("Event");
|
|
657
|
-
var s = i && i.bubbles !== t ? i.bubbles : !1, c = i && i.cancelable !== t ? i.cancelable : !1;
|
|
658
|
-
return u.initEvent(a, s, c), u;
|
|
659
|
-
}
|
|
660
|
-
return u = document.createEventObject(), u.type = a, u.bubbles = i && i.bubbles !== t ? i.bubbles : !1, u.cancelable = i && i.cancelable !== t ? i.cancelable : !1, u;
|
|
661
|
-
}, r && Object.defineProperty(window.Event, "prototype", {
|
|
662
|
-
configurable: !1,
|
|
663
|
-
enumerable: !1,
|
|
664
|
-
writable: !0,
|
|
665
|
-
value: r
|
|
666
|
-
}), "createEvent" in document || (window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function() {
|
|
667
|
-
var a = this, i = arguments[0], u = arguments[1];
|
|
668
|
-
if (a === window && i in n)
|
|
669
|
-
throw new Error("In IE8 the event: " + i + " is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");
|
|
670
|
-
a._events || (a._events = {}), a._events[i] || (a._events[i] = function(s) {
|
|
671
|
-
var c = a._events[s.type].list, f = c.slice(), p = -1, d = f.length, m;
|
|
672
|
-
for (s.preventDefault = function() {
|
|
673
|
-
s.cancelable !== !1 && (s.returnValue = !1);
|
|
674
|
-
}, s.stopPropagation = function() {
|
|
675
|
-
s.cancelBubble = !0;
|
|
676
|
-
}, s.stopImmediatePropagation = function() {
|
|
677
|
-
s.cancelBubble = !0, s.cancelImmediate = !0;
|
|
678
|
-
}, s.currentTarget = a, s.relatedTarget = s.fromElement || null, s.target = s.target || s.srcElement || a, s.timeStamp = new Date().getTime(), s.clientX && (s.pageX = s.clientX + document.documentElement.scrollLeft, s.pageY = s.clientY + document.documentElement.scrollTop); ++p < d && !s.cancelImmediate; )
|
|
679
|
-
p in f && (m = f[p], o(c, m) !== -1 && typeof m == "function" && m.call(a, s));
|
|
680
|
-
}, a._events[i].list = [], a.attachEvent && a.attachEvent("on" + i, a._events[i])), a._events[i].list.push(u);
|
|
681
|
-
}, window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function() {
|
|
682
|
-
var a = this, i = arguments[0], u = arguments[1], s;
|
|
683
|
-
a._events && a._events[i] && a._events[i].list && (s = o(a._events[i].list, u), s !== -1 && (a._events[i].list.splice(s, 1), a._events[i].list.length || (a.detachEvent && a.detachEvent("on" + i, a._events[i]), delete a._events[i])));
|
|
684
|
-
}, window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function(a) {
|
|
685
|
-
if (!arguments.length)
|
|
686
|
-
throw new Error("Not enough arguments");
|
|
687
|
-
if (!a || typeof a.type != "string")
|
|
688
|
-
throw new Error("DOM Events Exception 0");
|
|
689
|
-
var i = this, u = a.type;
|
|
690
|
-
try {
|
|
691
|
-
if (!a.bubbles) {
|
|
692
|
-
a.cancelBubble = !0;
|
|
693
|
-
var s = function(c) {
|
|
694
|
-
c.cancelBubble = !0, (i || window).detachEvent("on" + u, s);
|
|
695
|
-
};
|
|
696
|
-
this.attachEvent("on" + u, s);
|
|
697
|
-
}
|
|
698
|
-
this.fireEvent("on" + u, a);
|
|
699
|
-
} catch {
|
|
700
|
-
a.target = i;
|
|
701
|
-
do
|
|
702
|
-
a.currentTarget = i, "_events" in i && typeof i._events[u] == "function" && i._events[u].call(i, a), typeof i["on" + u] == "function" && i["on" + u].call(i, a), i = i.nodeType === 9 ? i.parentWindow : i.parentNode;
|
|
703
|
-
while (i && !a.cancelBubble);
|
|
704
|
-
}
|
|
705
|
-
return !0;
|
|
706
|
-
}, document.attachEvent("onreadystatechange", function() {
|
|
707
|
-
document.readyState === "complete" && document.dispatchEvent(new Event("DOMContentLoaded", {
|
|
708
|
-
bubbles: !0
|
|
709
|
-
}));
|
|
710
|
-
}));
|
|
711
|
-
}();
|
|
712
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
713
|
-
var J = 32, Q = 1;
|
|
714
|
-
function H(t, e) {
|
|
715
|
-
if (!t)
|
|
716
|
-
return this;
|
|
717
|
-
this.$module = t, this.debounceFormSubmitTimer = null;
|
|
718
|
-
var n = {
|
|
719
|
-
preventDoubleClick: !1
|
|
720
|
-
};
|
|
721
|
-
this.config = O(
|
|
722
|
-
n,
|
|
723
|
-
e || {},
|
|
724
|
-
j(t.dataset)
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
H.prototype.init = function() {
|
|
728
|
-
!this.$module || (this.$module.addEventListener("keydown", this.handleKeyDown), this.$module.addEventListener("click", this.debounce.bind(this)));
|
|
729
|
-
};
|
|
730
|
-
H.prototype.handleKeyDown = function(t) {
|
|
731
|
-
var e = t.target;
|
|
732
|
-
e.getAttribute("role") === "button" && t.keyCode === J && (t.preventDefault(), e.click());
|
|
733
|
-
};
|
|
734
|
-
H.prototype.debounce = function(t) {
|
|
735
|
-
if (!!this.config.preventDoubleClick) {
|
|
736
|
-
if (this.debounceFormSubmitTimer)
|
|
737
|
-
return t.preventDefault(), !1;
|
|
738
|
-
this.debounceFormSubmitTimer = setTimeout(function() {
|
|
739
|
-
this.debounceFormSubmitTimer = null;
|
|
740
|
-
}.bind(this), Q * 1e3);
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
var Z = 13, V = 32;
|
|
744
|
-
function I(t) {
|
|
745
|
-
this.$module = t;
|
|
746
|
-
}
|
|
747
|
-
I.prototype.init = function() {
|
|
748
|
-
if (!!this.$module) {
|
|
749
|
-
var t = typeof this.$module.open == "boolean";
|
|
750
|
-
t || this.polyfillDetails();
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
I.prototype.polyfillDetails = function() {
|
|
754
|
-
var t = this.$module, e = this.$summary = t.getElementsByTagName("summary").item(0), n = this.$content = t.getElementsByTagName("div").item(0);
|
|
755
|
-
!e || !n || (n.id || (n.id = "details-content-" + Y()), t.setAttribute("role", "group"), e.setAttribute("role", "button"), e.setAttribute("aria-controls", n.id), e.tabIndex = 0, this.$module.hasAttribute("open") ? e.setAttribute("aria-expanded", "true") : (e.setAttribute("aria-expanded", "false"), n.style.display = "none"), this.polyfillHandleInputs(e, this.polyfillSetAttributes.bind(this)));
|
|
756
|
-
};
|
|
757
|
-
I.prototype.polyfillSetAttributes = function() {
|
|
758
|
-
return this.$module.hasAttribute("open") ? (this.$module.removeAttribute("open"), this.$summary.setAttribute("aria-expanded", "false"), this.$content.style.display = "none") : (this.$module.setAttribute("open", "open"), this.$summary.setAttribute("aria-expanded", "true"), this.$content.style.display = ""), !0;
|
|
759
|
-
};
|
|
760
|
-
I.prototype.polyfillHandleInputs = function(t, e) {
|
|
761
|
-
t.addEventListener("keypress", function(n) {
|
|
762
|
-
var o = n.target;
|
|
763
|
-
(n.keyCode === Z || n.keyCode === V) && o.nodeName.toLowerCase() === "summary" && (n.preventDefault(), o.click ? o.click() : e(n));
|
|
764
|
-
}), t.addEventListener("keyup", function(n) {
|
|
765
|
-
var o = n.target;
|
|
766
|
-
n.keyCode === V && o.nodeName.toLowerCase() === "summary" && n.preventDefault();
|
|
767
|
-
}), t.addEventListener("click", e);
|
|
768
|
-
};
|
|
769
|
-
(function(t) {
|
|
770
|
-
var e = "Date" in self && "now" in self.Date && "getTime" in self.Date.prototype;
|
|
771
|
-
e || (Date.now = function() {
|
|
772
|
-
return new Date().getTime();
|
|
773
|
-
});
|
|
774
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
775
|
-
(function(t) {
|
|
776
|
-
var e = "document" in this && "matches" in document.documentElement;
|
|
777
|
-
e || (Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function(o) {
|
|
778
|
-
for (var r = this, l = (r.document || r.ownerDocument).querySelectorAll(o), a = 0; l[a] && l[a] !== r; )
|
|
779
|
-
++a;
|
|
780
|
-
return !!l[a];
|
|
781
|
-
});
|
|
782
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
783
|
-
(function(t) {
|
|
784
|
-
var e = "document" in this && "closest" in document.documentElement;
|
|
785
|
-
e || (Element.prototype.closest = function(o) {
|
|
786
|
-
for (var r = this; r; ) {
|
|
787
|
-
if (r.matches(o))
|
|
788
|
-
return r;
|
|
789
|
-
r = "SVGElement" in window && r instanceof SVGElement ? r.parentNode : r.parentElement;
|
|
790
|
-
}
|
|
791
|
-
return null;
|
|
792
|
-
});
|
|
793
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
794
|
-
function tt(t, e) {
|
|
795
|
-
var n = t.closest("[" + e + "]");
|
|
796
|
-
if (n)
|
|
797
|
-
return n.getAttribute(e);
|
|
798
|
-
}
|
|
799
|
-
var et = {
|
|
800
|
-
charactersUnderLimit: {
|
|
801
|
-
one: "You have %{count} character remaining",
|
|
802
|
-
other: "You have %{count} characters remaining"
|
|
803
|
-
},
|
|
804
|
-
charactersAtLimit: "You have 0 characters remaining",
|
|
805
|
-
charactersOverLimit: {
|
|
806
|
-
one: "You have %{count} character too many",
|
|
807
|
-
other: "You have %{count} characters too many"
|
|
808
|
-
},
|
|
809
|
-
wordsUnderLimit: {
|
|
810
|
-
one: "You have %{count} word remaining",
|
|
811
|
-
other: "You have %{count} words remaining"
|
|
812
|
-
},
|
|
813
|
-
wordsAtLimit: "You have 0 words remaining",
|
|
814
|
-
wordsOverLimit: {
|
|
815
|
-
one: "You have %{count} word too many",
|
|
816
|
-
other: "You have %{count} words too many"
|
|
817
|
-
},
|
|
818
|
-
textareaDescription: {
|
|
819
|
-
other: ""
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
function L(t, e) {
|
|
823
|
-
if (!t)
|
|
824
|
-
return this;
|
|
825
|
-
var n = {
|
|
826
|
-
threshold: 0,
|
|
827
|
-
i18n: et
|
|
828
|
-
}, o = j(t.dataset), r = {};
|
|
829
|
-
if (("maxwords" in o || "maxlength" in o) && (r = {
|
|
830
|
-
maxlength: !1,
|
|
831
|
-
maxwords: !1
|
|
832
|
-
}), this.config = O(
|
|
833
|
-
n,
|
|
834
|
-
e || {},
|
|
835
|
-
r,
|
|
836
|
-
o
|
|
837
|
-
), this.i18n = new S(W(this.config, "i18n"), {
|
|
838
|
-
locale: tt(t, "lang")
|
|
839
|
-
}), this.config.maxwords)
|
|
840
|
-
this.maxLength = this.config.maxwords;
|
|
841
|
-
else if (this.config.maxlength)
|
|
842
|
-
this.maxLength = this.config.maxlength;
|
|
843
|
-
else
|
|
844
|
-
return;
|
|
845
|
-
this.$module = t, this.$textarea = t.querySelector(".govuk-js-character-count"), this.$visibleCountMessage = null, this.$screenReaderCountMessage = null, this.lastInputTimestamp = null;
|
|
846
|
-
}
|
|
847
|
-
L.prototype.init = function() {
|
|
848
|
-
if (!!this.$textarea) {
|
|
849
|
-
var t = this.$textarea, e = document.getElementById(t.id + "-info");
|
|
850
|
-
e.innerText.match(/^\s*$/) && (e.innerText = this.i18n.t("textareaDescription", { count: this.maxLength })), t.insertAdjacentElement("afterend", e);
|
|
851
|
-
var n = document.createElement("div");
|
|
852
|
-
n.className = "govuk-character-count__sr-status govuk-visually-hidden", n.setAttribute("aria-live", "polite"), this.$screenReaderCountMessage = n, e.insertAdjacentElement("afterend", n);
|
|
853
|
-
var o = document.createElement("div");
|
|
854
|
-
o.className = e.className, o.classList.add("govuk-character-count__status"), o.setAttribute("aria-hidden", "true"), this.$visibleCountMessage = o, e.insertAdjacentElement("afterend", o), e.classList.add("govuk-visually-hidden"), t.removeAttribute("maxlength"), this.bindChangeEvents(), "onpageshow" in window ? window.addEventListener("pageshow", this.updateCountMessage.bind(this)) : window.addEventListener("DOMContentLoaded", this.updateCountMessage.bind(this)), this.updateCountMessage();
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
L.prototype.bindChangeEvents = function() {
|
|
858
|
-
var t = this.$textarea;
|
|
859
|
-
t.addEventListener("keyup", this.handleKeyUp.bind(this)), t.addEventListener("focus", this.handleFocus.bind(this)), t.addEventListener("blur", this.handleBlur.bind(this));
|
|
860
|
-
};
|
|
861
|
-
L.prototype.handleKeyUp = function() {
|
|
862
|
-
this.updateVisibleCountMessage(), this.lastInputTimestamp = Date.now();
|
|
863
|
-
};
|
|
864
|
-
L.prototype.handleFocus = function() {
|
|
865
|
-
this.valueChecker = setInterval(function() {
|
|
866
|
-
(!this.lastInputTimestamp || Date.now() - 500 >= this.lastInputTimestamp) && this.updateIfValueChanged();
|
|
867
|
-
}.bind(this), 1e3);
|
|
868
|
-
};
|
|
869
|
-
L.prototype.handleBlur = function() {
|
|
870
|
-
clearInterval(this.valueChecker);
|
|
871
|
-
};
|
|
872
|
-
L.prototype.updateIfValueChanged = function() {
|
|
873
|
-
this.$textarea.oldValue || (this.$textarea.oldValue = ""), this.$textarea.value !== this.$textarea.oldValue && (this.$textarea.oldValue = this.$textarea.value, this.updateCountMessage());
|
|
874
|
-
};
|
|
875
|
-
L.prototype.updateCountMessage = function() {
|
|
876
|
-
this.updateVisibleCountMessage(), this.updateScreenReaderCountMessage();
|
|
877
|
-
};
|
|
878
|
-
L.prototype.updateVisibleCountMessage = function() {
|
|
879
|
-
var t = this.$textarea, e = this.$visibleCountMessage, n = this.maxLength - this.count(t.value);
|
|
880
|
-
this.isOverThreshold() ? e.classList.remove("govuk-character-count__message--disabled") : e.classList.add("govuk-character-count__message--disabled"), n < 0 ? (t.classList.add("govuk-textarea--error"), e.classList.remove("govuk-hint"), e.classList.add("govuk-error-message")) : (t.classList.remove("govuk-textarea--error"), e.classList.remove("govuk-error-message"), e.classList.add("govuk-hint")), e.innerText = this.getCountMessage();
|
|
881
|
-
};
|
|
882
|
-
L.prototype.updateScreenReaderCountMessage = function() {
|
|
883
|
-
var t = this.$screenReaderCountMessage;
|
|
884
|
-
this.isOverThreshold() ? t.removeAttribute("aria-hidden") : t.setAttribute("aria-hidden", !0), t.innerText = this.getCountMessage();
|
|
885
|
-
};
|
|
886
|
-
L.prototype.count = function(t) {
|
|
887
|
-
if (this.config.maxwords) {
|
|
888
|
-
var e = t.match(/\S+/g) || [];
|
|
889
|
-
return e.length;
|
|
890
|
-
} else
|
|
891
|
-
return t.length;
|
|
892
|
-
};
|
|
893
|
-
L.prototype.getCountMessage = function() {
|
|
894
|
-
var t = this.maxLength - this.count(this.$textarea.value), e = this.config.maxwords ? "words" : "characters";
|
|
895
|
-
return this.formatCountMessage(t, e);
|
|
896
|
-
};
|
|
897
|
-
L.prototype.formatCountMessage = function(t, e) {
|
|
898
|
-
if (t === 0)
|
|
899
|
-
return this.i18n.t(e + "AtLimit");
|
|
900
|
-
var n = t < 0 ? "OverLimit" : "UnderLimit";
|
|
901
|
-
return this.i18n.t(e + n, { count: Math.abs(t) });
|
|
902
|
-
};
|
|
903
|
-
L.prototype.isOverThreshold = function() {
|
|
904
|
-
if (!this.config.threshold)
|
|
905
|
-
return !0;
|
|
906
|
-
var t = this.$textarea, e = this.count(t.value), n = this.maxLength, o = n * this.config.threshold / 100;
|
|
907
|
-
return o <= e;
|
|
908
|
-
};
|
|
909
|
-
function x(t) {
|
|
910
|
-
this.$module = t, this.$inputs = t.querySelectorAll('input[type="checkbox"]');
|
|
911
|
-
}
|
|
912
|
-
x.prototype.init = function() {
|
|
913
|
-
var t = this.$module, e = this.$inputs;
|
|
914
|
-
w(e, function(n) {
|
|
915
|
-
var o = n.getAttribute("data-aria-controls");
|
|
916
|
-
!o || !document.getElementById(o) || (n.setAttribute("aria-controls", o), n.removeAttribute("data-aria-controls"));
|
|
917
|
-
}), "onpageshow" in window ? window.addEventListener("pageshow", this.syncAllConditionalReveals.bind(this)) : window.addEventListener("DOMContentLoaded", this.syncAllConditionalReveals.bind(this)), this.syncAllConditionalReveals(), t.addEventListener("click", this.handleClick.bind(this));
|
|
918
|
-
};
|
|
919
|
-
x.prototype.syncAllConditionalReveals = function() {
|
|
920
|
-
w(this.$inputs, this.syncConditionalRevealWithInputState.bind(this));
|
|
921
|
-
};
|
|
922
|
-
x.prototype.syncConditionalRevealWithInputState = function(t) {
|
|
923
|
-
var e = document.getElementById(t.getAttribute("aria-controls"));
|
|
924
|
-
if (e && e.classList.contains("govuk-checkboxes__conditional")) {
|
|
925
|
-
var n = t.checked;
|
|
926
|
-
t.setAttribute("aria-expanded", n), e.classList.toggle("govuk-checkboxes__conditional--hidden", !n);
|
|
927
|
-
}
|
|
928
|
-
};
|
|
929
|
-
x.prototype.unCheckAllInputsExcept = function(t) {
|
|
930
|
-
var e = document.querySelectorAll('input[type="checkbox"][name="' + t.name + '"]');
|
|
931
|
-
w(e, function(n) {
|
|
932
|
-
var o = t.form === n.form;
|
|
933
|
-
o && n !== t && (n.checked = !1, this.syncConditionalRevealWithInputState(n));
|
|
934
|
-
}.bind(this));
|
|
935
|
-
};
|
|
936
|
-
x.prototype.unCheckExclusiveInputs = function(t) {
|
|
937
|
-
var e = document.querySelectorAll(
|
|
938
|
-
'input[data-behaviour="exclusive"][type="checkbox"][name="' + t.name + '"]'
|
|
939
|
-
);
|
|
940
|
-
w(e, function(n) {
|
|
941
|
-
var o = t.form === n.form;
|
|
942
|
-
o && (n.checked = !1, this.syncConditionalRevealWithInputState(n));
|
|
943
|
-
}.bind(this));
|
|
944
|
-
};
|
|
945
|
-
x.prototype.handleClick = function(t) {
|
|
946
|
-
var e = t.target;
|
|
947
|
-
if (e.type === "checkbox") {
|
|
948
|
-
var n = e.getAttribute("aria-controls");
|
|
949
|
-
if (n && this.syncConditionalRevealWithInputState(e), !!e.checked) {
|
|
950
|
-
var o = e.getAttribute("data-behaviour") === "exclusive";
|
|
951
|
-
o ? this.unCheckAllInputsExcept(e) : this.unCheckExclusiveInputs(e);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
};
|
|
955
|
-
function k(t, e) {
|
|
956
|
-
if (!t)
|
|
957
|
-
return this;
|
|
958
|
-
this.$module = t;
|
|
959
|
-
var n = {
|
|
960
|
-
disableAutoFocus: !1
|
|
961
|
-
};
|
|
962
|
-
this.config = O(
|
|
963
|
-
n,
|
|
964
|
-
e || {},
|
|
965
|
-
j(t.dataset)
|
|
966
|
-
);
|
|
967
|
-
}
|
|
968
|
-
k.prototype.init = function() {
|
|
969
|
-
var t = this.$module;
|
|
970
|
-
!t || (this.setFocus(), t.addEventListener("click", this.handleClick.bind(this)));
|
|
971
|
-
};
|
|
972
|
-
k.prototype.setFocus = function() {
|
|
973
|
-
var t = this.$module;
|
|
974
|
-
this.config.disableAutoFocus || (t.setAttribute("tabindex", "-1"), t.addEventListener("blur", function() {
|
|
975
|
-
t.removeAttribute("tabindex");
|
|
976
|
-
}), t.focus());
|
|
977
|
-
};
|
|
978
|
-
k.prototype.handleClick = function(t) {
|
|
979
|
-
var e = t.target;
|
|
980
|
-
this.focusTarget(e) && t.preventDefault();
|
|
981
|
-
};
|
|
982
|
-
k.prototype.focusTarget = function(t) {
|
|
983
|
-
if (t.tagName !== "A" || t.href === !1)
|
|
984
|
-
return !1;
|
|
985
|
-
var e = this.getFragmentFromUrl(t.href), n = document.getElementById(e);
|
|
986
|
-
if (!n)
|
|
987
|
-
return !1;
|
|
988
|
-
var o = this.getAssociatedLegendOrLabel(n);
|
|
989
|
-
return o ? (o.scrollIntoView(), n.focus({ preventScroll: !0 }), !0) : !1;
|
|
990
|
-
};
|
|
991
|
-
k.prototype.getFragmentFromUrl = function(t) {
|
|
992
|
-
return t.indexOf("#") === -1 ? !1 : t.split("#").pop();
|
|
993
|
-
};
|
|
994
|
-
k.prototype.getAssociatedLegendOrLabel = function(t) {
|
|
995
|
-
var e = t.closest("fieldset");
|
|
996
|
-
if (e) {
|
|
997
|
-
var n = e.getElementsByTagName("legend");
|
|
998
|
-
if (n.length) {
|
|
999
|
-
var o = n[0];
|
|
1000
|
-
if (t.type === "checkbox" || t.type === "radio")
|
|
1001
|
-
return o;
|
|
1002
|
-
var r = o.getBoundingClientRect().top, l = t.getBoundingClientRect();
|
|
1003
|
-
if (l.height && window.innerHeight) {
|
|
1004
|
-
var a = l.top + l.height;
|
|
1005
|
-
if (a - r < window.innerHeight / 2)
|
|
1006
|
-
return o;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
return document.querySelector("label[for='" + t.getAttribute("id") + "']") || t.closest("label");
|
|
1011
|
-
};
|
|
1012
|
-
function R(t, e) {
|
|
1013
|
-
this.$module = t;
|
|
1014
|
-
var n = {
|
|
1015
|
-
disableAutoFocus: !1
|
|
1016
|
-
};
|
|
1017
|
-
this.config = O(
|
|
1018
|
-
n,
|
|
1019
|
-
e || {},
|
|
1020
|
-
j(t.dataset)
|
|
1021
|
-
);
|
|
1022
|
-
}
|
|
1023
|
-
R.prototype.init = function() {
|
|
1024
|
-
var t = this.$module;
|
|
1025
|
-
!t || this.setFocus();
|
|
1026
|
-
};
|
|
1027
|
-
R.prototype.setFocus = function() {
|
|
1028
|
-
var t = this.$module;
|
|
1029
|
-
this.config.disableAutoFocus || t.getAttribute("role") === "alert" && (t.getAttribute("tabindex") || (t.setAttribute("tabindex", "-1"), t.addEventListener("blur", function() {
|
|
1030
|
-
t.removeAttribute("tabindex");
|
|
1031
|
-
})), t.focus());
|
|
1032
|
-
};
|
|
1033
|
-
function P(t) {
|
|
1034
|
-
this.$module = t, this.$menuButton = t && t.querySelector(".govuk-js-header-toggle"), this.$menu = this.$menuButton && t.querySelector(
|
|
1035
|
-
"#" + this.$menuButton.getAttribute("aria-controls")
|
|
1036
|
-
), this.menuIsOpen = !1, this.mql = null;
|
|
1037
|
-
}
|
|
1038
|
-
P.prototype.init = function() {
|
|
1039
|
-
!this.$module || !this.$menuButton || !this.$menu || ("matchMedia" in window ? (this.mql = window.matchMedia("(min-width: 48.0625em)"), "addEventListener" in this.mql ? this.mql.addEventListener("change", this.syncState.bind(this)) : this.mql.addListener(this.syncState.bind(this)), this.syncState(), this.$menuButton.addEventListener("click", this.handleMenuButtonClick.bind(this))) : this.$menuButton.setAttribute("hidden", ""));
|
|
1040
|
-
};
|
|
1041
|
-
P.prototype.syncState = function() {
|
|
1042
|
-
this.mql.matches ? (this.$menu.removeAttribute("hidden"), this.$menuButton.setAttribute("hidden", "")) : (this.$menuButton.removeAttribute("hidden"), this.$menuButton.setAttribute("aria-expanded", this.menuIsOpen), this.menuIsOpen ? this.$menu.removeAttribute("hidden") : this.$menu.setAttribute("hidden", ""));
|
|
1043
|
-
};
|
|
1044
|
-
P.prototype.handleMenuButtonClick = function() {
|
|
1045
|
-
this.menuIsOpen = !this.menuIsOpen, this.syncState();
|
|
1046
|
-
};
|
|
1047
|
-
function M(t) {
|
|
1048
|
-
this.$module = t, this.$inputs = t.querySelectorAll('input[type="radio"]');
|
|
1049
|
-
}
|
|
1050
|
-
M.prototype.init = function() {
|
|
1051
|
-
var t = this.$module, e = this.$inputs;
|
|
1052
|
-
w(e, function(n) {
|
|
1053
|
-
var o = n.getAttribute("data-aria-controls");
|
|
1054
|
-
!o || !document.getElementById(o) || (n.setAttribute("aria-controls", o), n.removeAttribute("data-aria-controls"));
|
|
1055
|
-
}), "onpageshow" in window ? window.addEventListener("pageshow", this.syncAllConditionalReveals.bind(this)) : window.addEventListener("DOMContentLoaded", this.syncAllConditionalReveals.bind(this)), this.syncAllConditionalReveals(), t.addEventListener("click", this.handleClick.bind(this));
|
|
1056
|
-
};
|
|
1057
|
-
M.prototype.syncAllConditionalReveals = function() {
|
|
1058
|
-
w(this.$inputs, this.syncConditionalRevealWithInputState.bind(this));
|
|
1059
|
-
};
|
|
1060
|
-
M.prototype.syncConditionalRevealWithInputState = function(t) {
|
|
1061
|
-
var e = document.getElementById(t.getAttribute("aria-controls"));
|
|
1062
|
-
if (e && e.classList.contains("govuk-radios__conditional")) {
|
|
1063
|
-
var n = t.checked;
|
|
1064
|
-
t.setAttribute("aria-expanded", n), e.classList.toggle("govuk-radios__conditional--hidden", !n);
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
M.prototype.handleClick = function(t) {
|
|
1068
|
-
var e = t.target;
|
|
1069
|
-
if (e.type === "radio") {
|
|
1070
|
-
var n = document.querySelectorAll('input[type="radio"][aria-controls]');
|
|
1071
|
-
w(n, function(o) {
|
|
1072
|
-
var r = o.form === e.form, l = o.name === e.name;
|
|
1073
|
-
l && r && this.syncConditionalRevealWithInputState(o);
|
|
1074
|
-
}.bind(this));
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
function _(t) {
|
|
1078
|
-
this.$module = t, this.$linkedElement = null, this.linkedElementListener = !1;
|
|
1079
|
-
}
|
|
1080
|
-
_.prototype.init = function() {
|
|
1081
|
-
!this.$module || (this.$linkedElement = this.getLinkedElement(), this.$linkedElement && this.$module.addEventListener("click", this.focusLinkedElement.bind(this)));
|
|
1082
|
-
};
|
|
1083
|
-
_.prototype.getLinkedElement = function() {
|
|
1084
|
-
var t = this.getFragmentFromUrl();
|
|
1085
|
-
return t ? document.getElementById(t) : !1;
|
|
1086
|
-
};
|
|
1087
|
-
_.prototype.focusLinkedElement = function() {
|
|
1088
|
-
var t = this.$linkedElement;
|
|
1089
|
-
t.getAttribute("tabindex") || (t.setAttribute("tabindex", "-1"), t.classList.add("govuk-skip-link-focused-element"), this.linkedElementListener || (this.$linkedElement.addEventListener("blur", this.removeFocusProperties.bind(this)), this.linkedElementListener = !0)), t.focus();
|
|
1090
|
-
};
|
|
1091
|
-
_.prototype.removeFocusProperties = function() {
|
|
1092
|
-
this.$linkedElement.removeAttribute("tabindex"), this.$linkedElement.classList.remove("govuk-skip-link-focused-element");
|
|
1093
|
-
};
|
|
1094
|
-
_.prototype.getFragmentFromUrl = function() {
|
|
1095
|
-
return this.$module.hash ? this.$module.hash.split("#").pop() : !1;
|
|
1096
|
-
};
|
|
1097
|
-
(function(t) {
|
|
1098
|
-
var e = "document" in this && "nextElementSibling" in document.documentElement;
|
|
1099
|
-
e || Object.defineProperty(Element.prototype, "nextElementSibling", {
|
|
1100
|
-
get: function() {
|
|
1101
|
-
for (var n = this.nextSibling; n && n.nodeType !== 1; )
|
|
1102
|
-
n = n.nextSibling;
|
|
1103
|
-
return n;
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
1107
|
-
(function(t) {
|
|
1108
|
-
var e = "document" in this && "previousElementSibling" in document.documentElement;
|
|
1109
|
-
e || Object.defineProperty(Element.prototype, "previousElementSibling", {
|
|
1110
|
-
get: function() {
|
|
1111
|
-
for (var n = this.previousSibling; n && n.nodeType !== 1; )
|
|
1112
|
-
n = n.previousSibling;
|
|
1113
|
-
return n;
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
}).call(typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || {});
|
|
1117
|
-
function y(t) {
|
|
1118
|
-
this.$module = t, this.$tabs = t.querySelectorAll(".govuk-tabs__tab"), this.keys = { left: 37, right: 39, up: 38, down: 40 }, this.jsHiddenClass = "govuk-tabs__panel--hidden";
|
|
1119
|
-
}
|
|
1120
|
-
y.prototype.init = function() {
|
|
1121
|
-
typeof window.matchMedia == "function" ? this.setupResponsiveChecks() : this.setup();
|
|
1122
|
-
};
|
|
1123
|
-
y.prototype.setupResponsiveChecks = function() {
|
|
1124
|
-
this.mql = window.matchMedia("(min-width: 40.0625em)"), this.mql.addListener(this.checkMode.bind(this)), this.checkMode();
|
|
1125
|
-
};
|
|
1126
|
-
y.prototype.checkMode = function() {
|
|
1127
|
-
this.mql.matches ? this.setup() : this.teardown();
|
|
1128
|
-
};
|
|
1129
|
-
y.prototype.setup = function() {
|
|
1130
|
-
var t = this.$module, e = this.$tabs, n = t.querySelector(".govuk-tabs__list"), o = t.querySelectorAll(".govuk-tabs__list-item");
|
|
1131
|
-
if (!(!e || !n || !o)) {
|
|
1132
|
-
n.setAttribute("role", "tablist"), w(o, function(l) {
|
|
1133
|
-
l.setAttribute("role", "presentation");
|
|
1134
|
-
}), w(e, function(l) {
|
|
1135
|
-
this.setAttributes(l), l.boundTabClick = this.onTabClick.bind(this), l.boundTabKeydown = this.onTabKeydown.bind(this), l.addEventListener("click", l.boundTabClick, !0), l.addEventListener("keydown", l.boundTabKeydown, !0), this.hideTab(l);
|
|
1136
|
-
}.bind(this));
|
|
1137
|
-
var r = this.getTab(window.location.hash) || this.$tabs[0];
|
|
1138
|
-
this.showTab(r), t.boundOnHashChange = this.onHashChange.bind(this), window.addEventListener("hashchange", t.boundOnHashChange, !0);
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
y.prototype.teardown = function() {
|
|
1142
|
-
var t = this.$module, e = this.$tabs, n = t.querySelector(".govuk-tabs__list"), o = t.querySelectorAll(".govuk-tabs__list-item");
|
|
1143
|
-
!e || !n || !o || (n.removeAttribute("role"), w(o, function(r) {
|
|
1144
|
-
r.removeAttribute("role", "presentation");
|
|
1145
|
-
}), w(e, function(r) {
|
|
1146
|
-
r.removeEventListener("click", r.boundTabClick, !0), r.removeEventListener("keydown", r.boundTabKeydown, !0), this.unsetAttributes(r);
|
|
1147
|
-
}.bind(this)), window.removeEventListener("hashchange", t.boundOnHashChange, !0));
|
|
1148
|
-
};
|
|
1149
|
-
y.prototype.onHashChange = function(t) {
|
|
1150
|
-
var e = window.location.hash, n = this.getTab(e);
|
|
1151
|
-
if (!!n) {
|
|
1152
|
-
if (this.changingHash) {
|
|
1153
|
-
this.changingHash = !1;
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
var o = this.getCurrentTab();
|
|
1157
|
-
this.hideTab(o), this.showTab(n), n.focus();
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
y.prototype.hideTab = function(t) {
|
|
1161
|
-
this.unhighlightTab(t), this.hidePanel(t);
|
|
1162
|
-
};
|
|
1163
|
-
y.prototype.showTab = function(t) {
|
|
1164
|
-
this.highlightTab(t), this.showPanel(t);
|
|
1165
|
-
};
|
|
1166
|
-
y.prototype.getTab = function(t) {
|
|
1167
|
-
return this.$module.querySelector('.govuk-tabs__tab[href="' + t + '"]');
|
|
1168
|
-
};
|
|
1169
|
-
y.prototype.setAttributes = function(t) {
|
|
1170
|
-
var e = this.getHref(t).slice(1);
|
|
1171
|
-
t.setAttribute("id", "tab_" + e), t.setAttribute("role", "tab"), t.setAttribute("aria-controls", e), t.setAttribute("aria-selected", "false"), t.setAttribute("tabindex", "-1");
|
|
1172
|
-
var n = this.getPanel(t);
|
|
1173
|
-
n.setAttribute("role", "tabpanel"), n.setAttribute("aria-labelledby", t.id), n.classList.add(this.jsHiddenClass);
|
|
1174
|
-
};
|
|
1175
|
-
y.prototype.unsetAttributes = function(t) {
|
|
1176
|
-
t.removeAttribute("id"), t.removeAttribute("role"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-selected"), t.removeAttribute("tabindex");
|
|
1177
|
-
var e = this.getPanel(t);
|
|
1178
|
-
e.removeAttribute("role"), e.removeAttribute("aria-labelledby"), e.classList.remove(this.jsHiddenClass);
|
|
1179
|
-
};
|
|
1180
|
-
y.prototype.onTabClick = function(t) {
|
|
1181
|
-
if (!t.target.classList.contains("govuk-tabs__tab"))
|
|
1182
|
-
return !1;
|
|
1183
|
-
t.preventDefault();
|
|
1184
|
-
var e = t.target, n = this.getCurrentTab();
|
|
1185
|
-
this.hideTab(n), this.showTab(e), this.createHistoryEntry(e);
|
|
1186
|
-
};
|
|
1187
|
-
y.prototype.createHistoryEntry = function(t) {
|
|
1188
|
-
var e = this.getPanel(t), n = e.id;
|
|
1189
|
-
e.id = "", this.changingHash = !0, window.location.hash = this.getHref(t).slice(1), e.id = n;
|
|
1190
|
-
};
|
|
1191
|
-
y.prototype.onTabKeydown = function(t) {
|
|
1192
|
-
switch (t.keyCode) {
|
|
1193
|
-
case this.keys.left:
|
|
1194
|
-
case this.keys.up:
|
|
1195
|
-
this.activatePreviousTab(), t.preventDefault();
|
|
1196
|
-
break;
|
|
1197
|
-
case this.keys.right:
|
|
1198
|
-
case this.keys.down:
|
|
1199
|
-
this.activateNextTab(), t.preventDefault();
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
y.prototype.activateNextTab = function() {
|
|
1204
|
-
var t = this.getCurrentTab(), e = t.parentNode.nextElementSibling;
|
|
1205
|
-
if (e)
|
|
1206
|
-
var n = e.querySelector(".govuk-tabs__tab");
|
|
1207
|
-
n && (this.hideTab(t), this.showTab(n), n.focus(), this.createHistoryEntry(n));
|
|
1208
|
-
};
|
|
1209
|
-
y.prototype.activatePreviousTab = function() {
|
|
1210
|
-
var t = this.getCurrentTab(), e = t.parentNode.previousElementSibling;
|
|
1211
|
-
if (e)
|
|
1212
|
-
var n = e.querySelector(".govuk-tabs__tab");
|
|
1213
|
-
n && (this.hideTab(t), this.showTab(n), n.focus(), this.createHistoryEntry(n));
|
|
1214
|
-
};
|
|
1215
|
-
y.prototype.getPanel = function(t) {
|
|
1216
|
-
var e = this.$module.querySelector(this.getHref(t));
|
|
1217
|
-
return e;
|
|
1218
|
-
};
|
|
1219
|
-
y.prototype.showPanel = function(t) {
|
|
1220
|
-
var e = this.getPanel(t);
|
|
1221
|
-
e.classList.remove(this.jsHiddenClass);
|
|
1222
|
-
};
|
|
1223
|
-
y.prototype.hidePanel = function(t) {
|
|
1224
|
-
var e = this.getPanel(t);
|
|
1225
|
-
e.classList.add(this.jsHiddenClass);
|
|
1226
|
-
};
|
|
1227
|
-
y.prototype.unhighlightTab = function(t) {
|
|
1228
|
-
t.setAttribute("aria-selected", "false"), t.parentNode.classList.remove("govuk-tabs__list-item--selected"), t.setAttribute("tabindex", "-1");
|
|
1229
|
-
};
|
|
1230
|
-
y.prototype.highlightTab = function(t) {
|
|
1231
|
-
t.setAttribute("aria-selected", "true"), t.parentNode.classList.add("govuk-tabs__list-item--selected"), t.setAttribute("tabindex", "0");
|
|
1232
|
-
};
|
|
1233
|
-
y.prototype.getCurrentTab = function() {
|
|
1234
|
-
return this.$module.querySelector(".govuk-tabs__list-item--selected .govuk-tabs__tab");
|
|
1235
|
-
};
|
|
1236
|
-
y.prototype.getHref = function(t) {
|
|
1237
|
-
var e = t.getAttribute("href"), n = e.slice(e.indexOf("#"), e.length);
|
|
1238
|
-
return n;
|
|
1239
|
-
};
|
|
1240
|
-
function nt(t) {
|
|
1241
|
-
t = typeof t < "u" ? t : {};
|
|
1242
|
-
var e = typeof t.scope < "u" ? t.scope : document, n = e.querySelectorAll('[data-module="govuk-accordion"]');
|
|
1243
|
-
w(n, function(d) {
|
|
1244
|
-
new A(d, t.accordion).init();
|
|
1245
|
-
});
|
|
1246
|
-
var o = e.querySelectorAll('[data-module="govuk-button"]');
|
|
1247
|
-
w(o, function(d) {
|
|
1248
|
-
new H(d, t.button).init();
|
|
1249
|
-
});
|
|
1250
|
-
var r = e.querySelectorAll('[data-module="govuk-character-count"]');
|
|
1251
|
-
w(r, function(d) {
|
|
1252
|
-
new L(d, t.characterCount).init();
|
|
1253
|
-
});
|
|
1254
|
-
var l = e.querySelectorAll('[data-module="govuk-checkboxes"]');
|
|
1255
|
-
w(l, function(d) {
|
|
1256
|
-
new x(d).init();
|
|
1257
|
-
});
|
|
1258
|
-
var a = e.querySelectorAll('[data-module="govuk-details"]');
|
|
1259
|
-
w(a, function(d) {
|
|
1260
|
-
new I(d).init();
|
|
1261
|
-
});
|
|
1262
|
-
var i = e.querySelector('[data-module="govuk-error-summary"]');
|
|
1263
|
-
i && new k(i, t.errorSummary).init();
|
|
1264
|
-
var u = e.querySelector('[data-module="govuk-header"]');
|
|
1265
|
-
u && new P(u).init();
|
|
1266
|
-
var s = e.querySelectorAll('[data-module="govuk-notification-banner"]');
|
|
1267
|
-
w(s, function(d) {
|
|
1268
|
-
new R(d, t.notificationBanner).init();
|
|
1269
|
-
});
|
|
1270
|
-
var c = e.querySelectorAll('[data-module="govuk-radios"]');
|
|
1271
|
-
w(c, function(d) {
|
|
1272
|
-
new M(d).init();
|
|
1273
|
-
});
|
|
1274
|
-
var f = e.querySelector('[data-module="govuk-skip-link"]');
|
|
1275
|
-
new _(f).init();
|
|
1276
|
-
var p = e.querySelectorAll('[data-module="govuk-tabs"]');
|
|
1277
|
-
w(p, function(d) {
|
|
1278
|
-
new y(d).init();
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
export {
|
|
1282
|
-
A as Accordion,
|
|
1283
|
-
H as Button,
|
|
1284
|
-
L as CharacterCount,
|
|
1285
|
-
x as Checkboxes,
|
|
1286
|
-
I as Details,
|
|
1287
|
-
k as ErrorSummary,
|
|
1288
|
-
P as Header,
|
|
1289
|
-
R as NotificationBanner,
|
|
1290
|
-
M as Radios,
|
|
1291
|
-
_ as SkipLink,
|
|
1292
|
-
y as Tabs,
|
|
1293
|
-
nt as initAll
|
|
1294
|
-
};
|
|
1
|
+
export * from 'govuk-frontend';
|