-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPIKE] Configure Babel to add core-js polyfills #4557
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4557
December 11, 2023 16:58
Inactive
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 363b5f1 |
colinrotherham
force-pushed
the
babel-polyfills-corejs
branch
from
December 14, 2023 19:40
7833cc3
to
c5acf29
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4557
December 14, 2023 19:40
Inactive
colinrotherham
force-pushed
the
babel-polyfills-corejs
branch
from
January 8, 2024 17:41
c5acf29
to
0c6f09f
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4557
January 8, 2024 17:42
Inactive
This option is no longer `@babel/preset-env` specific since v7.13.0
Opera Mobile has relaunched for Android using Chromium but the compatibility data still thinks lots of features are unsupported: ``` The es-shims polyfill added the following polyfills: Array.prototype.every { "opera_mobile":"73" } Array.prototype.indexOf { "opera_mobile":"73" } Array.prototype.keys { "opera_mobile":"73" } Date.now { "opera_mobile":"73" } Function.prototype.name { "opera_mobile":"73" } Object.entries { "opera_mobile":"73" } String.prototype.split { "opera_mobile":"73" } String.prototype.trim { "opera_mobile":"73" } ``` See related issues: browserslist/browserslist#766 babel/babel#15711
See core-js on GitHub: https://github.com/zloirock/core-js
Although this polyfill is required for feature complete Error support, we don’t use the `.cause` property yet ``` The es-shims polyfill added the following polyfills: es.error.cause { "android":"61", "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } ```
Although this polyfill is required for bug-free `new URL('http://x', undefined)` in Safari versions < 14 with an `undefined` base, we don’t use it: ``` The corejs3 polyfill added the following polyfills: web.url { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } web.url-search-params { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } ```
Although these polyfills are required to iterate DOM collections, we always use `Array.from()` so don’t need them: ``` The corejs3 polyfill added the following polyfills: es.array.iterator { "chrome":"61", "opera":"48", "samsung":"8.2" } web.dom-collections.iterator { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1", "samsung":"8.2" } ```
For example, polyfills to fix unhandled empty space characters in ES5 `''.trim()` that would be removed in ES2015
colinrotherham
force-pushed
the
babel-polyfills-corejs
branch
from
February 19, 2024 20:05
0c6f09f
to
363b5f1
Compare
govuk-design-system-ci
temporarily deployed
to
govuk-frontend-pr-4557
February 19, 2024 20:05
Inactive
JavaScript changes to GitHub releasediff --git a/dist/govuk-frontend-5.1.0.min.js b/dist/govuk-frontend-5.1.0.min.js
index f4274f5bd..f5a3cb6db 100644
--- a/dist/govuk-frontend-5.1.0.min.js
+++ b/dist/govuk-frontend-5.1.0.min.js
@@ -1,12 +1,1028 @@
+var t = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {},
+ fails$k = function(t) {
+ try {
+ return !!t()
+ } catch (e) {
+ return !0
+ }
+ },
+ e = !fails$k((function() {
+ var t = function() {}.bind();
+ return "function" != typeof t || t.hasOwnProperty("prototype")
+ })),
+ n = e,
+ i = Function.prototype,
+ r = i.call,
+ o = n && i.bind.bind(r, r),
+ s = n ? o : function(t) {
+ return function() {
+ return r.apply(t, arguments)
+ }
+ },
+ a = s,
+ c = a({}.toString),
+ u = a("".slice),
+ classofRaw$2 = function(t) {
+ return u(c(t), 8, -1)
+ },
+ l = fails$k,
+ h = classofRaw$2,
+ d = Object,
+ f = s("".split),
+ p = l((function() {
+ return !d("z").propertyIsEnumerable(0)
+ })) ? function(t) {
+ return "String" === h(t) ? f(t, "") : d(t)
+ } : d,
+ isNullOrUndefined$5 = function(t) {
+ return null == t
+ },
+ m = isNullOrUndefined$5,
+ g = TypeError,
+ requireObjectCoercible$7 = function(t) {
+ if (m(t)) throw new g("Can't call method on " + t);
+ return t
+ },
+ v = p,
+ b = requireObjectCoercible$7,
+ toIndexedObject$5 = function(t) {
+ return v(b(t))
+ },
+ check = function(t) {
+ return t && t.Math === Math && t
+ },
+ y = check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) || check("object" == typeof self && self) || check("object" == typeof t && t) || check("object" == typeof t && t) || function() {
+ return this
+ }() || Function("return this")(),
+ w = {
+ exports: {}
+ },
+ E = y,
+ C = Object.defineProperty,
+ defineGlobalProperty$3 = function(t, e) {
+ try {
+ C(E, t, {
+ value: e,
+ configurable: !0,
+ writable: !0
+ })
+ } catch (n) {
+ E[t] = e
+ }
+ return e
+ },
+ k = y,
+ S = defineGlobalProperty$3,
+ x = "__core-js_shared__",
+ $ = w.exports = k[x] || S(x, {});
+($.versions || ($.versions = [])).push({
+ version: "3.36.0",
+ mode: "global",
+ copyright: "© 2014-2024 Denis Pushkarev (zloirock.ru)",
+ license: "https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE",
+ source: "https://github.com/zloirock/core-js"
+});
+var A, T, L = w.exports,
+ I = L,
+ shared$4 = function(t, e) {
+ return I[t] || (I[t] = e || {})
+ },
+ O = requireObjectCoercible$7,
+ R = Object,
+ toObject$4 = function(t) {
+ return R(O(t))
+ },
+ M = toObject$4,
+ _ = s({}.hasOwnProperty),
+ P = Object.hasOwn || function(t, e) {
+ return _(M(t), e)
+ },
+ H = s,
+ j = 0,
+ B = Math.random(),
+ N = H(1..toString),
+ uid$2 = function(t) {
+ return "Symbol(" + (void 0 === t ? "" : t) + ")_" + N(++j + B, 36)
+ },
+ U = y,
+ q = "undefined" != typeof navigator && String(navigator.userAgent) || "",
+ K = U.process,
+ D = U.Deno,
+ V = K && K.versions || D && D.version,
+ G = V && V.v8;
+G && (T = (A = G.split("."))[0] > 0 && A[0] < 4 ? 1 : +(A[0] + A[1])), !T && q && (!(A = q.match(/Edge\/(\d+)/)) || A[1] >= 74) && (A = q.match(/Chrome\/(\d+)/)) && (T = +A[1]);
+var z = T,
+ W = fails$k,
+ Y = y.String,
+ Q = !!Object.getOwnPropertySymbols && !W((function() {
+ var t = Symbol("symbol detection");
+ return !Y(t) || !(Object(t) instanceof Symbol) || !Symbol.sham && z && z < 41
+ })),
+ X = Q && !Symbol.sham && "symbol" == typeof Symbol.iterator,
+ J = shared$4,
+ Z = P,
+ tt = uid$2,
+ et = Q,
+ nt = X,
+ it = y.Symbol,
+ rt = J("wks"),
+ ot = nt ? it.for || it : it && it.withoutSetter || tt,
+ wellKnownSymbol$f = function(t) {
+ return Z(rt, t) || (rt[t] = et && Z(it, t) ? it[t] : ot("Symbol." + t)), rt[t]
+ },
+ st = "object" == typeof document && document.all,
+ at = void 0 === st && void 0 !== st ? function(t) {
+ return "function" == typeof t || t === st
+ } : function(t) {
+ return "function" == typeof t
+ },
+ ct = at,
+ isObject$9 = function(t) {
+ return "object" == typeof t ? null !== t : ct(t)
+ },
+ ut = isObject$9,
+ lt = String,
+ ht = TypeError,
+ anObject$c = function(t) {
+ if (ut(t)) return t;
+ throw new ht(lt(t) + " is not an object")
+ },
+ dt = {},
+ ft = !fails$k((function() {
+ return 7 !== Object.defineProperty({}, 1, {
+ get: function() {
+ return 7
+ }
+ })[1]
+ })),
+ pt = ft && fails$k((function() {
+ return 42 !== Object.defineProperty((function() {}), "prototype", {
+ value: 42,
+ writable: !1
+ }).prototype
+ })),
+ mt = {},
+ gt = isObject$9,
+ vt = y.document,
+ bt = gt(vt) && gt(vt.createElement),
+ documentCreateElement$2 = function(t) {
+ return bt ? vt.createElement(t) : {}
+ },
+ yt = documentCreateElement$2,
+ wt = !ft && !fails$k((function() {
+ return 7 !== Object.defineProperty(yt("div"), "a", {
+ get: function() {
+ return 7
+ }
+ }).a
+ })),
+ Et = e,
+ Ct = Function.prototype.call,
+ kt = Et ? Ct.bind(Ct) : function() {
+ return Ct.apply(Ct, arguments)
+ },
+ St = y,
+ xt = at,
+ getBuiltIn$3 = function(t, e) {
+ return arguments.length < 2 ? (n = St[t], xt(n) ? n : void 0) : St[t] && St[t][e];
+ var n
+ },
+ $t = s({}.isPrototypeOf),
+ At = getBuiltIn$3,
+ Tt = at,
+ Lt = $t,
+ It = Object,
+ Ot = X ? function(t) {
+ return "symbol" == typeof t
+ } : function(t) {
+ var e = At("Symbol");
+ return Tt(e) && Lt(e.prototype, It(t))
+ },
+ Rt = String,
+ tryToString$2 = function(t) {
+ try {
+ return Rt(t)
+ } catch (e) {
+ return "Object"
+ }
+ },
+ Mt = at,
+ _t = tryToString$2,
+ Pt = TypeError,
+ aCallable$4 = function(t) {
+ if (Mt(t)) return t;
+ throw new Pt(_t(t) + " is not a function")
+ },
+ Ft = aCallable$4,
+ Ht = isNullOrUndefined$5,
+ getMethod$4 = function(t, e) {
+ var n = t[e];
+ return Ht(n) ? void 0 : Ft(n)
+ },
+ jt = kt,
+ Bt = at,
+ Nt = isObject$9,
+ Ut = TypeError,
+ qt = kt,
+ Kt = isObject$9,
+ Dt = Ot,
+ Vt = getMethod$4,
+ ordinaryToPrimitive = function(t, e) {
+ var n, i;
+ if ("string" === e && Bt(n = t.toString) && !Nt(i = jt(n, t))) return i;
+ if (Bt(n = t.valueOf) && !Nt(i = jt(n, t))) return i;
+ if ("string" !== e && Bt(n = t.toString) && !Nt(i = jt(n, t))) return i;
+ throw new Ut("Can't convert object to primitive value")
+ },
+ Gt = TypeError,
+ zt = wellKnownSymbol$f("toPrimitive"),
+ toPrimitive = function(t, e) {
+ if (!Kt(t) || Dt(t)) return t;
+ var n, i = Vt(t, zt);
+ if (i) {
+ if (void 0 === e && (e = "default"), n = qt(i, t, e), !Kt(n) || Dt(n)) return n;
+ throw new Gt("Can't convert object to primitive value")
+ }
+ return void 0 === e && (e = "number"), ordinaryToPrimitive(t, e)
+ },
+ Wt = Ot,
+ toPropertyKey$2 = function(t) {
+ var e = toPrimitive(t, "string");
+ return Wt(e) ? e : e + ""
+ },
+ Yt = ft,
+ Qt = wt,
+ Xt = pt,
+ Jt = anObject$c,
+ Zt = toPropertyKey$2,
+ te = TypeError,
+ ee = Object.defineProperty,
+ ne = Object.getOwnPropertyDescriptor,
+ ie = "enumerable",
+ re = "configurable",
+ oe = "writable";
+mt.f = Yt ? Xt ? function(t, e, n) {
+ if (Jt(t), e = Zt(e), Jt(n), "function" == typeof t && "prototype" === e && "value" in n && oe in n && !n[oe]) {
+ var i = ne(t, e);
+ i && i[oe] && (t[e] = n.value, n = {
+ configurable: re in n ? n[re] : i[re],
+ enumerable: ie in n ? n[ie] : i[ie],
+ writable: !1
+ })
+ }
+ return ee(t, e, n)
+} : ee : function(t, e, n) {
+ if (Jt(t), e = Zt(e), Jt(n), Qt) try {
+ return ee(t, e, n)
+ } catch (i) {}
+ if ("get" in n || "set" in n) throw new te("Accessors not supported");
+ return "value" in n && (t[e] = n.value), t
+};
+var se = Math.ceil,
+ ae = Math.floor,
+ ce = Math.trunc || function(t) {
+ var e = +t;
+ return (e > 0 ? ae : se)(e)
+ },
+ toIntegerOrInfinity$4 = function(t) {
+ var e = +t;
+ return e != e || 0 === e ? 0 : ce(e)
+ },
+ ue = toIntegerOrInfinity$4,
+ le = Math.max,
+ he = Math.min,
+ de = toIntegerOrInfinity$4,
+ fe = Math.min,
+ toLength$3 = function(t) {
+ var e = de(t);
+ return e > 0 ? fe(e, 9007199254740991) : 0
+ },
+ pe = toLength$3,
+ lengthOfArrayLike$2 = function(t) {
+ return pe(t.length)
+ },
+ me = toIndexedObject$5,
+ toAbsoluteIndex = function(t, e) {
+ var n = ue(t);
+ return n < 0 ? le(n + e, 0) : he(n, e)
+ },
+ ge = lengthOfArrayLike$2,
+ createMethod$2 = function(t) {
+ return function(e, n, i) {
+ var r = me(e),
+ o = ge(r);
+ if (0 === o) return !t && -1;
+ var s, a = toAbsoluteIndex(i, o);
+ if (t && n != n) {
+ for (; o > a;)
+ if ((s = r[a++]) != s) return !0
+ } else
+ for (; o > a; a++)
+ if ((t || a in r) && r[a] === n) return t || a || 0;
+ return !t && -1
+ }
+ },
+ ve = {
+ includes: createMethod$2(!0),
+ indexOf: createMethod$2(!1)
+ },
+ be = {},
+ ye = P,
+ we = toIndexedObject$5,
+ Ee = ve.indexOf,
+ Ce = be,
+ ke = s([].push),
+ objectKeysInternal = function(t, e) {
+ var n, i = we(t),
+ r = 0,
+ o = [];
+ for (n in i) !ye(Ce, n) && ye(i, n) && ke(o, n);
+ for (; e.length > r;) ye(i, n = e[r++]) && (~Ee(o, n) || ke(o, n));
+ return o
+ },
+ Se = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"],
+ xe = objectKeysInternal,
+ $e = Se,
+ Ae = Object.keys || function(t) {
+ return xe(t, $e)
+ },
+ Te = ft,
+ Le = pt,
+ Ie = mt,
+ Oe = anObject$c,
+ Re = toIndexedObject$5,
+ Me = Ae;
+dt.f = Te && !Le ? Object.defineProperties : function(t, e) {
+ Oe(t);
+ for (var n, i = Re(e), r = Me(e), o = r.length, s = 0; o > s;) Ie.f(t, n = r[s++], i[n]);
+ return t
+};
+var _e, Pe = getBuiltIn$3("document", "documentElement"),
+ Fe = uid$2,
+ He = shared$4("keys"),
+ sharedKey$3 = function(t) {
+ return He[t] || (He[t] = Fe(t))
+ },
+ je = anObject$c,
+ Be = dt,
+ Ne = Se,
+ Ue = be,
+ qe = Pe,
+ Ke = documentCreateElement$2,
+ De = "prototype",
+ Ve = "script",
+ Ge = sharedKey$3("IE_PROTO"),
+ EmptyConstructor = function() {},
+ scriptTag = function(t) {
+ return "<" + Ve + ">" + t + "</" + Ve + ">"
+ },
+ NullProtoObjectViaActiveX = function(t) {
+ t.write(scriptTag("")), t.close();
+ var e = t.parentWindow.Object;
+ return t = null, e
+ },
+ NullProtoObject = function() {
+ try {
+ _e = new ActiveXObject("htmlfile")
+ } catch (r) {}
+ var t, e, n;
+ NullProtoObject = "undefined" != typeof document ? document.domain && _e ? NullProtoObjectViaActiveX(_e) : (e = Ke("iframe"), n = "java" + Ve + ":", e.style.display = "none", qe.appendChild(e), e.src = String(n), (t = e.contentWindow.document).open(), t.write(scriptTag("document.F=Object")), t.close(), t.F) : NullProtoObjectViaActiveX(_e);
+ for (var i = Ne.length; i--;) delete NullProtoObject[De][Ne[i]];
+ return NullProtoObject()
+ };
+Ue[Ge] = !0;
+var ze = Object.create || function(t, e) {
+ var n;
+ return null !== t ? (EmptyConstructor[De] = je(t), n = new EmptyConstructor, EmptyConstructor[De] = null, n[Ge] = t) : n = NullProtoObject(), void 0 === e ? n : Be.f(n, e)
+ },
+ We = wellKnownSymbol$f,
+ Ye = ze,
+ Qe = mt.f,
+ Xe = We("unscopables"),
+ Je = Array.prototype;
+void 0 === Je[Xe] && Qe(Je, Xe, {
+ configurable: !0,
+ value: Ye(null)
+});
+var Ze, tn, en, addToUnscopables$2 = function(t) {
+ Je[Xe][t] = !0
+ },
+ nn = {},
+ rn = at,
+ on = y.WeakMap,
+ sn = rn(on) && /native code/.test(String(on)),
+ createPropertyDescriptor$4 = function(t, e) {
+ return {
+ enumerable: !(1 & t),
+ configurable: !(2 & t),
+ writable: !(4 & t),
+ value: e
+ }
+ },
+ an = mt,
+ cn = createPropertyDescriptor$4,
+ un = ft ? function(t, e, n) {
+ return an.f(t, e, cn(1, n))
+ } : function(t, e, n) {
+ return t[e] = n, t
+ },
+ ln = sn,
+ hn = y,
+ dn = isObject$9,
+ fn = un,
+ pn = P,
+ mn = L,
+ gn = sharedKey$3,
+ vn = be,
+ bn = "Object already initialized",
+ yn = hn.TypeError,
+ wn = hn.WeakMap;
+if (ln || mn.state) {
+ var En = mn.state || (mn.state = new wn);
+ En.get = En.get, En.has = En.has, En.set = En.set, Ze = function(t, e) {
+ if (En.has(t)) throw new yn(bn);
+ return e.facade = t, En.set(t, e), e
+ }, tn = function(t) {
+ return En.get(t) || {}
+ }, en = function(t) {
+ return En.has(t)
+ }
+} else {
+ var Cn = gn("state");
+ vn[Cn] = !0, Ze = function(t, e) {
+ if (pn(t, Cn)) throw new yn(bn);
+ return e.facade = t, fn(t, Cn, e), e
+ }, tn = function(t) {
+ return pn(t, Cn) ? t[Cn] : {}
+ }, en = function(t) {
+ return pn(t, Cn)
+ }
+}
+var kn = {
+ set: Ze,
+ get: tn,
+ has: en,
+ enforce: function(t) {
+ return en(t) ? tn(t) : Ze(t, {})
+ },
+ getterFor: function(t) {
+ return function(e) {
+ var n;
+ if (!dn(e) || (n = tn(e)).type !== t) throw new yn("Incompatible receiver, " + t + " required");
+ return n
+ }
+ }
+ },
+ Sn = {},
+ xn = {},
+ $n = {}.propertyIsEnumerable,
+ An = Object.getOwnPropertyDescriptor,
+ Tn = An && !$n.call({
+ 1: 2
+ }, 1);
+xn.f = Tn ? function(t) {
+ var e = An(this, t);
+ return !!e && e.enumerable
+} : $n;
+var Ln = ft,
+ In = kt,
+ On = xn,
+ Rn = createPropertyDescriptor$4,
+ Mn = toIndexedObject$5,
+ _n = toPropertyKey$2,
+ Pn = P,
+ Fn = wt,
+ Hn = Object.getOwnPropertyDescriptor;
+Sn.f = Ln ? Hn : function(t, e) {
+ if (t = Mn(t), e = _n(e), Fn) try {
+ return Hn(t, e)
+ } catch (n) {}
+ if (Pn(t, e)) return Rn(!In(On.f, t, e), t[e])
+};
+var jn = {
+ exports: {}
+ },
+ Bn = ft,
+ Nn = P,
+ Un = Function.prototype,
+ qn = Bn && Object.getOwnPropertyDescriptor,
+ Kn = Nn(Un, "name"),
+ Dn = {
+ EXISTS: Kn,
+ PROPER: Kn && "something" === function() {}.name,
+ CONFIGURABLE: Kn && (!Bn || Bn && qn(Un, "name").configurable)
+ },
+ Vn = at,
+ Gn = L,
+ zn = s(Function.toString);
+Vn(Gn.inspectSource) || (Gn.inspectSource = function(t) {
+ return zn(t)
+});
+var Wn = Gn.inspectSource,
+ Yn = s,
+ Qn = fails$k,
+ Xn = at,
+ Jn = P,
+ Zn = ft,
+ ti = Dn.CONFIGURABLE,
+ ei = Wn,
+ ni = kn.enforce,
+ ii = kn.get,
+ ri = String,
+ oi = Object.defineProperty,
+ si = Yn("".slice),
+ ai = Yn("".replace),
+ ci = Yn([].join),
+ ui = Zn && !Qn((function() {
+ return 8 !== oi((function() {}), "length", {
+ value: 8
+ }).length
+ })),
+ li = String(String).split("String"),
+ hi = jn.exports = function(t, e, n) {
+ "Symbol(" === si(ri(e), 0, 7) && (e = "[" + ai(ri(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), n && n.getter && (e = "get " + e), n && n.setter && (e = "set " + e), (!Jn(t, "name") || ti && t.name !== e) && (Zn ? oi(t, "name", {
+ value: e,
+ configurable: !0
+ }) : t.name = e), ui && n && Jn(n, "arity") && t.length !== n.arity && oi(t, "length", {
+ value: n.arity
+ });
+ try {
+ n && Jn(n, "constructor") && n.constructor ? Zn && oi(t, "prototype", {
+ writable: !1
+ }) : t.prototype && (t.prototype = void 0)
+ } catch (r) {}
+ var i = ni(t);
+ return Jn(i, "source") || (i.source = ci(li, "string" == typeof e ? e : "")), t
+ };
+Function.prototype.toString = hi((function() {
+ return Xn(this) && ii(this).source || ei(this)
+}), "toString");
+var di = jn.exports,
+ fi = at,
+ pi = mt,
+ mi = di,
+ gi = defineGlobalProperty$3,
+ defineBuiltIn$9 = function(t, e, n, i) {
+ i || (i = {});
+ var r = i.enumerable,
+ o = void 0 !== i.name ? i.name : e;
+ if (fi(n) && mi(n, o, i), i.global) r ? t[e] = n : gi(e, n);
+ else {
+ try {
+ i.unsafe ? t[e] && (r = !0) : delete t[e]
+ } catch (s) {}
+ r ? t[e] = n : pi.f(t, e, {
+ value: n,
+ enumerable: !1,
+ configurable: !i.nonConfigurable,
+ writable: !i.nonWritable
+ })
+ }
+ return t
+ },
+ vi = {},
+ bi = objectKeysInternal,
+ yi = Se.concat("length", "prototype");
+vi.f = Object.getOwnPropertyNames || function(t) {
+ return bi(t, yi)
+};
+var wi = {};
+wi.f = Object.getOwnPropertySymbols;
+var Ei, Ci, ki, Si = getBuiltIn$3,
+ xi = vi,
+ $i = wi,
+ Ai = anObject$c,
+ Ti = s([].concat),
+ Li = Si("Reflect", "ownKeys") || function(t) {
+ var e = xi.f(Ai(t)),
+ n = $i.f;
+ return n ? Ti(e, n(t)) : e
+ },
+ Ii = P,
+ Oi = Li,
+ Ri = Sn,
+ Mi = mt,
+ _i = fails$k,
+ Pi = at,
+ Fi = /#|\.prototype\./,
+ isForced$1 = function(t, e) {
+ var n = ji[Hi(t)];
+ return n === Ni || n !== Bi && (Pi(e) ? _i(e) : !!e)
+ },
+ Hi = isForced$1.normalize = function(t) {
+ return String(t).replace(Fi, ".").toLowerCase()
+ },
+ ji = isForced$1.data = {},
+ Bi = isForced$1.NATIVE = "N",
+ Ni = isForced$1.POLYFILL = "P",
+ Ui = isForced$1,
+ qi = y,
+ Ki = Sn.f,
+ Di = un,
+ Vi = defineBuiltIn$9,
+ Gi = defineGlobalProperty$3,
+ copyConstructorProperties = function(t, e, n) {
+ for (var i = Oi(e), r = Mi.f, o = Ri.f, s = 0; s < i.length; s++) {
+ var a = i[s];
+ Ii(t, a) || n && Ii(n, a) || r(t, a, o(e, a))
+ }
+ },
+ zi = Ui,
+ _export = function(t, e) {
+ var n, i, r, o, s, a = t.target,
+ c = t.global,
+ u = t.stat;
+ if (n = c ? qi : u ? qi[a] || Gi(a, {}) : qi[a] && qi[a].prototype)
+ for (i in e) {
+ if (o = e[i], r = t.dontCallGetSet ? (s = Ki(n, i)) && s.value : n[i], !zi(c ? i : a + (u ? "." : "#") + i, t.forced) && void 0 !== r) {
+ if (typeof o == typeof r) continue;
+ copyConstructorProperties(o, r)
+ }(t.sham || r && r.sham) && Di(o, "sham", !0), Vi(n, i, o, t)
+ }
+ },
+ Wi = !fails$k((function() {
+ function F() {}
+ return F.prototype.constructor = null, Object.getPrototypeOf(new F) !== F.prototype
+ })),
+ Yi = P,
+ Qi = at,
+ Xi = toObject$4,
+ Ji = Wi,
+ Zi = sharedKey$3("IE_PROTO"),
+ tr = Object,
+ er = tr.prototype,
+ nr = Ji ? tr.getPrototypeOf : function(t) {
+ var e = Xi(t);
+ if (Yi(e, Zi)) return e[Zi];
+ var n = e.constructor;
+ return Qi(n) && e instanceof n ? n.prototype : e instanceof tr ? er : null
+ },
+ ir = fails$k,
+ rr = at,
+ or = isObject$9,
+ sr = nr,
+ ar = defineBuiltIn$9,
+ cr = wellKnownSymbol$f("iterator"),
+ ur = !1;
+[].keys && ("next" in (ki = [].keys()) ? (Ci = sr(sr(ki))) !== Object.prototype && (Ei = Ci) : ur = !0);
+var lr = !or(Ei) || ir((function() {
+ var t = {};
+ return Ei[cr].call(t) !== t
+}));
+lr && (Ei = {}), rr(Ei[cr]) || ar(Ei, cr, (function() {
+ return this
+}));
+var hr = {
+ IteratorPrototype: Ei,
+ BUGGY_SAFARI_ITERATORS: ur
+ },
+ dr = mt.f,
+ fr = P,
+ pr = wellKnownSymbol$f("toStringTag"),
+ setToStringTag$4 = function(t, e, n) {
+ t && !n && (t = t.prototype), t && !fr(t, pr) && dr(t, pr, {
+ configurable: !0,
+ value: e
+ })
+ },
+ mr = hr.IteratorPrototype,
+ gr = ze,
+ vr = createPropertyDescriptor$4,
+ br = setToStringTag$4,
+ yr = nn,
+ returnThis$1 = function() {
+ return this
+ },
+ iteratorCreateConstructor = function(t, e, n, i) {
+ var r = e + " Iterator";
+ return t.prototype = gr(mr, {
+ next: vr(+!i, n)
+ }), br(t, r, !1), yr[r] = returnThis$1, t
+ },
+ wr = s,
+ Er = aCallable$4,
+ Cr = isObject$9,
+ isPossiblePrototype = function(t) {
+ return Cr(t) || null === t
+ },
+ kr = String,
+ Sr = TypeError,
+ uncurryThisAccessor = function(t, e, n) {
+ try {
+ return wr(Er(Object.getOwnPropertyDescriptor(t, e)[n]))
+ } catch (i) {}
+ },
+ xr = anObject$c,
+ aPossiblePrototype = function(t) {
+ if (isPossiblePrototype(t)) return t;
+ throw new Sr("Can't set " + kr(t) + " as a prototype")
+ },
+ $r = Object.setPrototypeOf || ("__proto__" in {} ? function() {
+ var t, e = !1,
+ n = {};
+ try {
+ (t = uncurryThisAccessor(Object.prototype, "__proto__", "set"))(n, []), e = n instanceof Array
+ } catch (i) {}
+ return function(n, i) {
+ return xr(n), aPossiblePrototype(i), e ? t(n, i) : n.__proto__ = i, n
+ }
+ }() : void 0),
+ Ar = _export,
+ Tr = kt,
+ Lr = at,
+ Ir = iteratorCreateConstructor,
+ Or = nr,
+ Rr = $r,
+ Mr = setToStringTag$4,
+ _r = un,
+ Pr = defineBuiltIn$9,
+ Fr = nn,
+ Hr = Dn.PROPER,
+ jr = Dn.CONFIGURABLE,
+ Br = hr.IteratorPrototype,
+ Nr = hr.BUGGY_SAFARI_ITERATORS,
+ Ur = wellKnownSymbol$f("iterator"),
+ qr = "keys",
+ Kr = "values",
+ Dr = "entries",
+ returnThis = function() {
+ return this
+ },
+ createIterResultObject$2 = function(t, e) {
+ return {
+ value: t,
+ done: e
+ }
+ },
+ Vr = toIndexedObject$5,
+ Gr = addToUnscopables$2,
+ zr = nn,
+ Wr = kn,
+ Yr = mt.f,
+ defineIterator = function(t, e, n, i, r, o, s) {
+ Ir(n, e, i);
+ var a, c, u, getIterationMethod = function(t) {
+ if (t === r && p) return p;
+ if (!Nr && t && t in d) return d[t];
+ switch (t) {
+ case qr:
+ case Kr:
+ case Dr:
+ return function() {
+ return new n(this, t)
+ }
+ }
+ return function() {
+ return new n(this)
+ }
+ },
+ l = e + " Iterator",
+ h = !1,
+ d = t.prototype,
+ f = d[Ur] || d["@@iterator"] || r && d[r],
+ p = !Nr && f || getIterationMethod(r),
+ m = "Array" === e && d.entries || f;
+ if (m && (a = Or(m.call(new t))) !== Object.prototype && a.next && (Or(a) !== Br && (Rr ? Rr(a, Br) : Lr(a[Ur]) || Pr(a, Ur, returnThis)), Mr(a, l, !0)), Hr && r === Kr && f && f.name !== Kr && (jr ? _r(d, "name", Kr) : (h = !0, p = function() {
+ return Tr(f, this)
+ })), r)
+ if (c = {
+ values: getIterationMethod(Kr),
+ keys: o ? p : getIterationMethod(qr),
+ entries: getIterationMethod(Dr)
+ }, s)
+ for (u in c)(Nr || h || !(u in d)) && Pr(d, u, c[u]);
+ else Ar({
+ target: e,
+ proto: !0,
+ forced: Nr || h
+ }, c);
+ return d[Ur] !== p && Pr(d, Ur, p, {
+ name: r
+ }), Fr[e] = p, c
+ },
+ Qr = createIterResultObject$2,
+ Xr = ft,
+ Jr = "Array Iterator",
+ Zr = Wr.set,
+ to = Wr.getterFor(Jr),
+ eo = defineIterator(Array, "Array", (function(t, e) {
+ Zr(this, {
+ type: Jr,
+ target: Vr(t),
+ index: 0,
+ kind: e
+ })
+ }), (function() {
+ var t = to(this),
+ e = t.target,
+ n = t.index++;
+ if (!e || n >= e.length) return t.target = void 0, Qr(void 0, !0);
+ switch (t.kind) {
+ case "keys":
+ return Qr(n, !1);
+ case "values":
+ return Qr(e[n], !1)
+ }
+ return Qr([n, e[n]], !1)
+ }), "values"),
+ no = zr.Arguments = zr.Array;
+if (Gr("keys"), Gr("values"), Gr("entries"), Xr && "values" !== no.name) try {
+ Yr(no, "name", {
+ value: "values"
+ })
+} catch (vl) {}
+var io = documentCreateElement$2("span").classList,
+ ro = io && io.constructor && io.constructor.prototype,
+ oo = ro === Object.prototype ? void 0 : ro,
+ so = y,
+ ao = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+ },
+ co = oo,
+ uo = eo,
+ lo = un,
+ ho = setToStringTag$4,
+ fo = wellKnownSymbol$f("iterator"),
+ po = uo.values,
+ handlePrototype = function(t, e) {
+ if (t) {
+ if (t[fo] !== po) try {
+ lo(t, fo, po)
+ } catch (vl) {
+ t[fo] = po
+ }
+ if (ho(t, e, !0), ao[e])
+ for (var n in uo)
+ if (t[n] !== uo[n]) try {
+ lo(t, n, uo[n])
+ } catch (vl) {
+ t[n] = uo[n]
+ }
+ }
+ };
+for (var mo in ao) handlePrototype(so[mo] && so[mo].prototype, mo);
+handlePrototype(co, "DOMTokenList");
const version = "5.1.0";
+var go = ve.includes,
+ vo = addToUnscopables$2;
+_export({
+ target: "Array",
+ proto: !0,
+ forced: fails$k((function() {
+ return !Array(1).includes()
+ }))
+}, {
+ includes: function(t) {
+ return go(this, t, arguments.length > 1 ? arguments[1] : void 0)
+ }
+}), vo("includes");
+var bo = classofRaw$2,
+ yo = ft,
+ wo = Array.isArray || function(t) {
+ return "Array" === bo(t)
+ },
+ Eo = TypeError,
+ Co = Object.getOwnPropertyDescriptor,
+ ko = yo && ! function() {
+ if (void 0 !== this) return !0;
+ try {
+ Object.defineProperty([], "length", {
+ writable: !1
+ }).length = 1
+ } catch (vl) {
+ return vl instanceof TypeError
+ }
+ }(),
+ So = TypeError,
+ xo = toObject$4,
+ $o = lengthOfArrayLike$2,
+ Ao = ko ? function(t, e) {
+ if (wo(t) && !Co(t, "length").writable) throw new Eo("Cannot set read only .length");
+ return t.length = e
+ } : function(t, e) {
+ return t.length = e
+ },
+ doesNotExceedSafeInteger = function(t) {
+ if (t > 9007199254740991) throw So("Maximum allowed index exceeded");
+ return t
+ };
+_export({
+ target: "Array",
+ proto: !0,
+ arity: 1,
+ forced: fails$k((function() {
+ return 4294967297 !== [].push.call({
+ length: 4294967296
+ }, 1)
+ })) || ! function() {
+ try {
+ Object.defineProperty([], "length", {
+ writable: !1
+ }).push()
+ } catch (vl) {
+ return vl instanceof TypeError
+ }
+ }()
+}, {
+ push: function(t) {
+ var e = xo(this),
+ n = $o(e),
+ i = arguments.length;
+ doesNotExceedSafeInteger(n + i);
+ for (var r = 0; r < i; r++) e[n] = arguments[r], n++;
+ return Ao(e, n), n
+ }
+});
+var To = isObject$9,
+ Lo = classofRaw$2,
+ Io = wellKnownSymbol$f("match"),
+ isRegExp = function(t) {
+ var e;
+ return To(t) && (void 0 !== (e = t[Io]) ? !!e : "RegExp" === Lo(t))
+ },
+ Oo = TypeError,
+ Ro = {};
+Ro[wellKnownSymbol$f("toStringTag")] = "z";
+var Mo = "[object z]" === String(Ro),
+ _o = at,
+ Po = classofRaw$2,
+ Fo = wellKnownSymbol$f("toStringTag"),
+ Ho = Object,
+ jo = "Arguments" === Po(function() {
+ return arguments
+ }()),
+ Bo = Mo ? Po : function(t) {
+ var e, n, i;
+ return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof(n = function(t, e) {
+ try {
+ return t[e]
+ } catch (vl) {}
+ }(e = Ho(t), Fo)) ? n : jo ? Po(e) : "Object" === (i = Po(e)) && _o(e.callee) ? "Arguments" : i
+ },
+ No = Bo,
+ Uo = String,
+ toString$8 = function(t) {
+ if ("Symbol" === No(t)) throw new TypeError("Cannot convert a Symbol value to a string");
+ return Uo(t)
+ },
+ qo = wellKnownSymbol$f("match"),
+ Ko = _export,
+ notARegExp = function(t) {
+ if (isRegExp(t)) throw new Oo("The method doesn't accept regular expressions");
+ return t
+ },
+ Do = requireObjectCoercible$7,
+ Vo = toString$8,
+ correctIsRegExpLogic = function(t) {
+ var e = /./;
+ try {
+ "/./" [t](e)
+ } catch (n) {
+ try {
+ return e[qo] = !1, "/./" [t](e)
+ } catch (i) {}
+ }
+ return !1
+ },
+ Go = s("".indexOf);
function mergeConfigs(...t) {
function flattenObject(t) {
const e = {};
return function flattenLoop(t, n) {
- for (const [i, s] of Object.entries(t)) {
+ for (const [i, r] of Object.entries(t)) {
const t = n ? `${n}.${i}` : i;
- s && "object" == typeof s ? flattenLoop(s, t) : e[t] = s
+ r && "object" == typeof r ? flattenLoop(r, t) : e[t] = r
}
}(t), e
}
@@ -20,11 +1036,11 @@ function mergeConfigs(...t) {
function extractConfigByNamespace(t, e) {
const n = {};
- for (const [i, s] of Object.entries(t)) {
+ for (const [i, r] of Object.entries(t)) {
const t = i.split(".");
if (t[0] === e) {
t.length > 1 && t.shift();
- n[t.join(".")] = s
+ n[t.join(".")] = r
}
}
return n
@@ -62,6 +1078,73 @@ function setFocus(t, e = {}) {
function isSupported(t = document.body) {
return !!t && t.classList.contains("govuk-frontend-supported")
}
+Ko({
+ target: "String",
+ proto: !0,
+ forced: !correctIsRegExpLogic("includes")
+}, {
+ includes: function(t) {
+ return !!~Go(Vo(Do(this)), Vo(notARegExp(t)), arguments.length > 1 ? arguments[1] : void 0)
+ }
+});
+var zo = anObject$c,
+ regexpFlags$1 = function() {
+ var t = zo(this),
+ e = "";
+ return t.hasIndices && (e += "d"), t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.dotAll && (e += "s"), t.unicode && (e += "u"), t.unicodeSets && (e += "v"), t.sticky && (e += "y"), e
+ },
+ Wo = kt,
+ Yo = P,
+ Qo = $t,
+ Xo = regexpFlags$1,
+ Jo = RegExp.prototype,
+ Zo = Dn.PROPER,
+ ts = defineBuiltIn$9,
+ es = anObject$c,
+ ns = toString$8,
+ is = fails$k,
+ getRegExpFlags = function(t) {
+ var e = t.flags;
+ return void 0 !== e || "flags" in Jo || Yo(t, "flags") || !Qo(Jo, t) ? e : Wo(Xo, t)
+ },
+ rs = "toString",
+ os = RegExp.prototype,
+ ss = os[rs],
+ as = is((function() {
+ return "/a/b" !== ss.call({
+ source: "a",
+ flags: "b"
+ })
+ })),
+ cs = Zo && ss.name !== rs;
+(as || cs) && ts(os, rs, (function() {
+ var t = es(this);
+ return "/" + ns(t.source) + "/" + ns(getRegExpFlags(t))
+}), {
+ unsafe: !0
+});
+var us = "\t\n\v\f\r \u2028\u2029\ufeff",
+ ls = requireObjectCoercible$7,
+ hs = toString$8,
+ ds = us,
+ fs = s("".replace),
+ ps = RegExp("^[" + ds + "]+"),
+ ms = RegExp("(^|[^" + ds + "])[" + ds + "]+$"),
+ createMethod$1 = function(t) {
+ return function(e) {
+ var n = hs(ls(e));
+ return 1 & t && (n = fs(n, ps, "")), 2 & t && (n = fs(n, ms, "$1")), n
+ }
+ },
+ gs = {
+ start: createMethod$1(1),
+ end: createMethod$1(2),
+ trim: createMethod$1(3)
+ },
+ vs = Dn.PROPER,
+ bs = fails$k,
+ ys = us,
+ ws = gs.trim;
function normaliseString(t) {
if ("string" != typeof t) return t;
@@ -74,6 +1157,19 @@ function normaliseDataset(t) {
for (const [n, i] of Object.entries(t)) e[n] = normaliseString(i);
return e
}
+_export({
+ target: "String",
+ proto: !0,
+ forced: function(t) {
+ return bs((function() {
+ return !!ys[t]() || "�" !== "�" [t]() || vs && ys[t].name !== t
+ }))
+ }("trim")
+}, {
+ trim: function() {
+ return ws(this)
+ }
+});
class GOVUKFrontendError extends Error {
constructor(...t) {
super(...t), this.name = "GOVUKFrontendError"
@@ -97,10 +1193,10 @@ class ElementError extends GOVUKFrontendError {
const {
componentName: n,
identifier: i,
- element: s,
+ element: r,
expectedType: o
} = t;
- e = `${n}: ${i}`, e += s ? ` is not of type ${null!=o?o:"HTMLElement"}` : " not found"
+ e = `${n}: ${i}`, e += r ? ` is not of type ${null!=o?o:"HTMLElement"}` : " not found"
}
super(e), this.name = "ElementError"
}
@@ -113,6 +1209,298 @@ class GOVUKFrontendComponent {
if (!isSupported()) throw new SupportError
}
}
+var Es, Cs, ks = fails$k,
+ Ss = y.RegExp,
+ xs = ks((function() {
+ var t = Ss("a", "y");
+ return t.lastIndex = 2, null !== t.exec("abcd")
+ })),
+ $s = xs || ks((function() {
+ return !Ss("a", "y").sticky
+ })),
+ As = {
+ BROKEN_CARET: xs || ks((function() {
+ var t = Ss("^r", "gy");
+ return t.lastIndex = 2, null !== t.exec("str")
+ })),
+ MISSED_STICKY: $s,
+ UNSUPPORTED_Y: xs
+ },
+ Ts = fails$k,
+ Ls = y.RegExp,
+ Is = Ts((function() {
+ var t = Ls(".", "s");
+ return !(t.dotAll && t.test("\n") && "s" === t.flags)
+ })),
+ Os = fails$k,
+ Rs = y.RegExp,
+ Ms = Os((function() {
+ var t = Rs("(?<a>b)", "g");
+ return "b" !== t.exec("b").groups.a || "bc" !== "b".replace(t, "$<a>c")
+ })),
+ _s = kt,
+ Ps = s,
+ Fs = toString$8,
+ Hs = regexpFlags$1,
+ js = As,
+ Bs = ze,
+ Ns = kn.get,
+ Us = Is,
+ qs = Ms,
+ Ks = shared$4("native-string-replace", String.prototype.replace),
+ Ds = RegExp.prototype.exec,
+ Vs = Ds,
+ Gs = Ps("".charAt),
+ zs = Ps("".indexOf),
+ Ws = Ps("".replace),
+ Ys = Ps("".slice),
+ Qs = (Cs = /b*/g, _s(Ds, Es = /a/, "a"), _s(Ds, Cs, "a"), 0 !== Es.lastIndex || 0 !== Cs.lastIndex),
+ Xs = js.BROKEN_CARET,
+ Js = void 0 !== /()??/.exec("")[1];
+(Qs || Js || Xs || Us || qs) && (Vs = function(t) {
+ var e, n, i, r, o, s, a, c = this,
+ u = Ns(c),
+ l = Fs(t),
+ h = u.raw;
+ if (h) return h.lastIndex = c.lastIndex, e = _s(Vs, h, l), c.lastIndex = h.lastIndex, e;
+ var d = u.groups,
+ f = Xs && c.sticky,
+ p = _s(Hs, c),
+ m = c.source,
+ g = 0,
+ v = l;
+ if (f && (p = Ws(p, "y", ""), -1 === zs(p, "g") && (p += "g"), v = Ys(l, c.lastIndex), c.lastIndex > 0 && (!c.multiline || c.multiline && "\n" !== Gs(l, c.lastIndex - 1)) && (m = "(?: " + m + ")", v = " " + v, g++), n = new RegExp("^(?:" + m + ")", p)), Js && (n = new RegExp("^" + m + "$(?!\\s)", p)), Qs && (i = c.lastIndex), r = _s(Ds, f ? n : c, v), f ? r ? (r.input = Ys(r.input, g), r[0] = Ys(r[0], g), r.index = c.lastIndex, c.lastIndex += r[0].length) : c.lastIndex = 0 : Qs && r && (c.lastIndex = c.global ? r.index + r[0].length : i), Js && r && r.length > 1 && _s(Ks, r[0], n, (function() {
+ for (o = 1; o < arguments.length - 2; o++) void 0 === arguments[o] && (r[o] = void 0)
+ })), r && d)
+ for (r.groups = s = Bs(null), o = 0; o < d.length; o++) s[(a = d[o])[0]] = r[a[1]];
+ return r
+});
+var Zs = Vs;
+_export({
+ target: "RegExp",
+ proto: !0,
+ forced: /./.exec !== Zs
+}, {
+ exec: Zs
+});
+var ta = kt,
+ ea = defineBuiltIn$9,
+ na = Zs,
+ ia = fails$k,
+ ra = wellKnownSymbol$f,
+ oa = un,
+ sa = ra("species"),
+ aa = RegExp.prototype,
+ fixRegexpWellKnownSymbolLogic = function(t, e, n, i) {
+ var r = ra(t),
+ o = !ia((function() {
+ var e = {};
+ return e[r] = function() {
+ return 7
+ }, 7 !== "" [t](e)
+ })),
+ s = o && !ia((function() {
+ var e = !1,
+ n = /a/;
+ return "split" === t && ((n = {}).constructor = {}, n.constructor[sa] = function() {
+ return n
+ }, n.flags = "", n[r] = /./ [r]), n.exec = function() {
+ return e = !0, null
+ }, n[r](""), !e
+ }));
+ if (!o || !s || n) {
+ var a = /./ [r],
+ c = e(r, "" [t], (function(t, e, n, i, r) {
+ var s = e.exec;
+ return s === na || s === aa.exec ? o && !r ? {
+ done: !0,
+ value: ta(a, e, n, i)
+ } : {
+ done: !0,
+ value: ta(t, n, e, i)
+ } : {
+ done: !1
+ }
+ }));
+ ea(String.prototype, t, c[0]), ea(aa, r, c[1])
+ }
+ i && oa(aa[r], "sham", !0)
+ },
+ ca = s,
+ ua = toIntegerOrInfinity$4,
+ la = toString$8,
+ ha = requireObjectCoercible$7,
+ da = ca("".charAt),
+ fa = ca("".charCodeAt),
+ pa = ca("".slice),
+ createMethod = function(t) {
+ return function(e, n) {
+ var i, r, o = la(ha(e)),
+ s = ua(n),
+ a = o.length;
+ return s < 0 || s >= a ? t ? "" : void 0 : (i = fa(o, s)) < 55296 || i > 56319 || s + 1 === a || (r = fa(o, s + 1)) < 56320 || r > 57343 ? t ? da(o, s) : i : t ? pa(o, s, s + 2) : r - 56320 + (i - 55296 << 10) + 65536
+ }
+ },
+ ma = {
+ codeAt: createMethod(!1),
+ charAt: createMethod(!0)
+ }.charAt,
+ advanceStringIndex$2 = function(t, e, n) {
+ return e + (n ? ma(t, e).length : 1)
+ },
+ ga = kt,
+ va = anObject$c,
+ ba = at,
+ ya = classofRaw$2,
+ wa = Zs,
+ Ea = TypeError,
+ regexpExecAbstract = function(t, e) {
+ var n = t.exec;
+ if (ba(n)) {
+ var i = ga(n, t, e);
+ return null !== i && va(i), i
+ }
+ if ("RegExp" === ya(t)) return ga(wa, t, e);
+ throw new Ea("RegExp#exec called on incompatible receiver")
+ },
+ Ca = kt,
+ ka = anObject$c,
+ Sa = isNullOrUndefined$5,
+ xa = toLength$3,
+ $a = toString$8,
+ Aa = requireObjectCoercible$7,
+ Ta = getMethod$4,
+ La = advanceStringIndex$2,
+ Ia = regexpExecAbstract;
+fixRegexpWellKnownSymbolLogic("match", (function(t, e, n) {
+ return [function(e) {
+ var n = Aa(this),
+ i = Sa(e) ? void 0 : Ta(e, t);
+ return i ? Ca(i, e, n) : new RegExp(e)[t]($a(n))
+ }, function(t) {
+ var i = ka(this),
+ r = $a(t),
+ o = n(e, i, r);
+ if (o.done) return o.value;
+ if (!i.global) return Ia(i, r);
+ var s = i.unicode;
+ i.lastIndex = 0;
+ for (var a, c = [], u = 0; null !== (a = Ia(i, r));) {
+ var l = $a(a[0]);
+ c[u] = l, "" === l && (i.lastIndex = La(r, xa(i.lastIndex), s)), u++
+ }
+ return 0 === u ? null : c
+ }]
+}));
+var Oa = e,
+ Ra = Function.prototype,
+ Ma = Ra.apply,
+ _a = Ra.call,
+ Pa = "object" == typeof Reflect && Reflect.apply || (Oa ? _a.bind(Ma) : function() {
+ return _a.apply(Ma, arguments)
+ }),
+ Fa = s,
+ Ha = toObject$4,
+ ja = Math.floor,
+ Ba = Fa("".charAt),
+ Na = Fa("".replace),
+ Ua = Fa("".slice),
+ qa = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
+ Ka = /\$([$&'`]|\d{1,2})/g,
+ Da = Pa,
+ Va = kt,
+ Ga = s,
+ za = fixRegexpWellKnownSymbolLogic,
+ Wa = fails$k,
+ Ya = anObject$c,
+ Qa = at,
+ Xa = isNullOrUndefined$5,
+ Ja = toIntegerOrInfinity$4,
+ Za = toLength$3,
+ tc = toString$8,
+ ec = requireObjectCoercible$7,
+ nc = advanceStringIndex$2,
+ ic = getMethod$4,
+ getSubstitution = function(t, e, n, i, r, o) {
+ var s = n + t.length,
+ a = i.length,
+ c = Ka;
+ return void 0 !== r && (r = Ha(r), c = qa), Na(o, c, (function(o, c) {
+ var u;
+ switch (Ba(c, 0)) {
+ case "$":
+ return "$";
+ case "&":
+ return t;
+ case "`":
+ return Ua(e, 0, n);
+ case "'":
+ return Ua(e, s);
+ case "<":
+ u = r[Ua(c, 1, -1)];
+ break;
+ default:
+ var l = +c;
+ if (0 === l) return o;
+ if (l > a) {
+ var h = ja(l / 10);
+ return 0 === h ? o : h <= a ? void 0 === i[h - 1] ? Ba(c, 1) : i[h - 1] + Ba(c, 1) : o
+ }
+ u = i[l - 1]
+ }
+ return void 0 === u ? "" : u
+ }))
+ },
+ rc = regexpExecAbstract,
+ oc = wellKnownSymbol$f("replace"),
+ sc = Math.max,
+ ac = Math.min,
+ cc = Ga([].concat),
+ uc = Ga([].push),
+ lc = Ga("".indexOf),
+ hc = Ga("".slice),
+ dc = "$0" === "a".replace(/./, "$0"),
+ fc = !!/./ [oc] && "" === /./ [oc]("a", "$0");
+za("replace", (function(t, e, n) {
+ var i = fc ? "$" : "$0";
+ return [function(t, n) {
+ var i = ec(this),
+ r = Xa(t) ? void 0 : ic(t, oc);
+ return r ? Va(r, t, i, n) : Va(e, tc(i), t, n)
+ }, function(t, r) {
+ var o = Ya(this),
+ s = tc(t);
+ if ("string" == typeof r && -1 === lc(r, i) && -1 === lc(r, "$<")) {
+ var a = n(e, o, s, r);
+ if (a.done) return a.value
+ }
+ var c = Qa(r);
+ c || (r = tc(r));
+ var u, l = o.global;
+ l && (u = o.unicode, o.lastIndex = 0);
+ for (var h, d = []; null !== (h = rc(o, s)) && (uc(d, h), l);) {
+ "" === tc(h[0]) && (o.lastIndex = nc(s, Za(o.lastIndex), u))
+ }
+ for (var f, p = "", m = 0, g = 0; g < d.length; g++) {
+ for (var v, b = tc((h = d[g])[0]), y = sc(ac(Ja(h.index), s.length), 0), w = [], E = 1; E < h.length; E++) uc(w, void 0 === (f = h[E]) ? f : String(f));
+ var C = h.groups;
+ if (c) {
+ var k = cc([b], w, y, s);
+ void 0 !== C && uc(k, C), v = tc(Da(r, void 0, k))
+ } else v = getSubstitution(b, s, y, w, C, r);
+ y >= m && (p += hc(s, m, y) + v, m = y + b.length)
+ }
+ return p + hc(s, m)
+ }]
+}), !!Wa((function() {
+ var t = /./;
+ return t.exec = function() {
+ var t = [];
+ return t.groups = {
+ a: "7"
+ }, t
+ }, "7" !== "".replace(t, "$<a>")
+})) || !dc || fc);
class I18n {
constructor(t = {}, e = {}) {
var n;
@@ -190,21 +1578,21 @@ I18n.pluralRulesMap = {
welsh: t => 0 === t ? "zero" : 1 === t ? "one" : 2 === t ? "two" : 3 === t ? "few" : 6 === t ? "many" : "other"
};
class Accordion extends GOVUKFrontendComponent {
- constructor(e, n = {}) {
- if (super(), this.$module = void 0, this.config = void 0, this.i18n = void 0, this.controlsClass = "govuk-accordion__controls", this.showAllClass = "govuk-accordion__show-all", this.showAllTextClass = "govuk-accordion__show-all-text", this.sectionClass = "govuk-accordion__section", 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.sectionHeadingDividerClass = "govuk-accordion__section-heading-divider", 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", this.sectionContentClass = "govuk-accordion__section-content", this.$sections = void 0, this.browserSupportsSessionStorage = !1, this.$showAllButton = null, this.$showAllIcon = null, this.$showAllText = null, !(e instanceof HTMLElement)) throw new ElementError({
+ constructor(t, e = {}) {
+ if (super(), this.$module = void 0, this.config = void 0, this.i18n = void 0, this.controlsClass = "govuk-accordion__controls", this.showAllClass = "govuk-accordion__show-all", this.showAllTextClass = "govuk-accordion__show-all-text", this.sectionClass = "govuk-accordion__section", 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.sectionHeadingDividerClass = "govuk-accordion__section-heading-divider", 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", this.sectionContentClass = "govuk-accordion__section-content", this.$sections = void 0, this.browserSupportsSessionStorage = !1, this.$showAllButton = null, this.$showAllIcon = null, this.$showAllText = null, !(t instanceof HTMLElement)) throw new ElementError({
componentName: "Accordion",
- element: e,
+ element: t,
identifier: "Root element (`$module`)"
});
- this.$module = e, this.config = mergeConfigs(Accordion.defaults, n, normaliseDataset(e.dataset)), this.i18n = new I18n(extractConfigByNamespace(this.config, "i18n"));
- const i = this.$module.querySelectorAll(`.${this.sectionClass}`);
- if (!i.length) throw new ElementError({
+ this.$module = t, this.config = mergeConfigs(Accordion.defaults, e, normaliseDataset(t.dataset)), this.i18n = new I18n(extractConfigByNamespace(this.config, "i18n"));
+ const n = this.$module.querySelectorAll(`.${this.sectionClass}`);
+ if (!n.length) throw new ElementError({
componentName: "Accordion",
identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
});
- this.$sections = i, this.browserSupportsSessionStorage = t.checkForSessionStorage(), this.initControls(), this.initSectionHeaders();
- const s = this.checkIfAllSectionsOpen();
- this.updateShowAllButton(s)
+ this.$sections = n, this.browserSupportsSessionStorage = pc.checkForSessionStorage(), this.initControls(), this.initSectionHeaders();
+ const i = this.checkIfAllSectionsOpen();
+ this.updateShowAllButton(i)
}
initControls() {
this.$showAllButton = document.createElement("button"), this.$showAllButton.setAttribute("type", "button"), this.$showAllButton.setAttribute("class", this.showAllClass), this.$showAllButton.setAttribute("aria-expanded", "false"), this.$showAllIcon = document.createElement("span"), this.$showAllIcon.classList.add(this.upChevronIconClass), this.$showAllButton.appendChild(this.$showAllIcon);
@@ -224,7 +1612,7 @@ class Accordion extends GOVUKFrontendComponent {
constructHeaderMarkup(t, e) {
const n = t.querySelector(`.${this.sectionButtonClass}`),
i = t.querySelector(`.${this.sectionHeadingClass}`),
- s = t.querySelector(`.${this.sectionSummaryClass}`);
+ r = t.querySelector(`.${this.sectionSummaryClass}`);
if (!i) throw new ElementError({
componentName: "Accordion",
identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
@@ -236,24 +1624,24 @@ class Accordion extends GOVUKFrontendComponent {
const o = document.createElement("button");
o.setAttribute("type", "button"), o.setAttribute("aria-controls", `${this.$module.id}-content-${e+1}`);
for (const d of Array.from(n.attributes)) "id" !== d.nodeName && o.setAttribute(d.nodeName, `${d.nodeValue}`);
- const r = document.createElement("span");
- r.classList.add(this.sectionHeadingTextClass), r.id = n.id;
+ const s = document.createElement("span");
+ s.classList.add(this.sectionHeadingTextClass), s.id = n.id;
const a = document.createElement("span");
- a.classList.add(this.sectionHeadingTextFocusClass), r.appendChild(a), a.innerHTML = n.innerHTML;
- const l = document.createElement("span");
- l.classList.add(this.sectionShowHideToggleClass), l.setAttribute("data-nosnippet", "");
+ a.classList.add(this.sectionHeadingTextFocusClass), s.appendChild(a), a.innerHTML = n.innerHTML;
const c = document.createElement("span");
- c.classList.add(this.sectionShowHideToggleFocusClass), l.appendChild(c);
- const h = document.createElement("span"),
- u = document.createElement("span");
- if (u.classList.add(this.upChevronIconClass), c.appendChild(u), h.classList.add(this.sectionShowHideTextClass), c.appendChild(h), o.appendChild(r), o.appendChild(this.getButtonPunctuationEl()), null != s && s.parentNode) {
+ c.classList.add(this.sectionShowHideToggleClass), c.setAttribute("data-nosnippet", "");
+ const u = document.createElement("span");
+ u.classList.add(this.sectionShowHideToggleFocusClass), c.appendChild(u);
+ const l = document.createElement("span"),
+ h = document.createElement("span");
+ if (h.classList.add(this.upChevronIconClass), u.appendChild(h), l.classList.add(this.sectionShowHideTextClass), u.appendChild(l), o.appendChild(s), o.appendChild(this.getButtonPunctuationEl()), null != r && r.parentNode) {
const t = document.createElement("span"),
e = document.createElement("span");
e.classList.add(this.sectionSummaryFocusClass), t.appendChild(e);
- for (const n of Array.from(s.attributes)) t.setAttribute(n.nodeName, `${n.nodeValue}`);
- e.innerHTML = s.innerHTML, s.parentNode.replaceChild(t, s), o.appendChild(t), o.appendChild(this.getButtonPunctuationEl())
+ for (const n of Array.from(r.attributes)) t.setAttribute(n.nodeName, `${n.nodeValue}`);
+ e.innerHTML = r.innerHTML, r.parentNode.replaceChild(t, r), o.appendChild(t), o.appendChild(this.getButtonPunctuationEl())
}
- o.appendChild(l), i.removeChild(n), i.appendChild(o)
+ o.appendChild(c), i.removeChild(n), i.appendChild(o)
}
onBeforeMatch(t) {
const e = t.target;
@@ -274,24 +1662,24 @@ class Accordion extends GOVUKFrontendComponent {
setExpanded(t, e) {
const n = e.querySelector(`.${this.upChevronIconClass}`),
i = e.querySelector(`.${this.sectionShowHideTextClass}`),
- s = e.querySelector(`.${this.sectionButtonClass}`),
+ r = e.querySelector(`.${this.sectionButtonClass}`),
o = e.querySelector(`.${this.sectionContentClass}`);
if (!o) throw new ElementError({
componentName: "Accordion",
identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
});
- if (!n || !i || !s) return;
- const r = t ? this.i18n.t("hideSection") : this.i18n.t("showSection");
- i.textContent = r, s.setAttribute("aria-expanded", `${t}`);
+ if (!n || !i || !r) return;
+ const s = t ? this.i18n.t("hideSection") : this.i18n.t("showSection");
+ i.textContent = s, r.setAttribute("aria-expanded", `${t}`);
const a = [],
- l = e.querySelector(`.${this.sectionHeadingTextClass}`);
- l && a.push(`${l.textContent}`.trim());
- const c = e.querySelector(`.${this.sectionSummaryClass}`);
+ c = e.querySelector(`.${this.sectionHeadingTextClass}`);
c && a.push(`${c.textContent}`.trim());
- const h = t ? this.i18n.t("hideSectionAriaLabel") : this.i18n.t("showSectionAriaLabel");
- a.push(h), s.setAttribute("aria-label", a.join(" , ")), t ? (o.removeAttribute("hidden"), e.classList.add(this.sectionExpandedClass), n.classList.remove(this.downChevronIconClass)) : (o.setAttribute("hidden", "until-found"), e.classList.remove(this.sectionExpandedClass), n.classList.add(this.downChevronIconClass));
- const u = this.checkIfAllSectionsOpen();
- this.updateShowAllButton(u)
+ const u = e.querySelector(`.${this.sectionSummaryClass}`);
+ u && a.push(`${u.textContent}`.trim());
+ const l = t ? this.i18n.t("hideSectionAriaLabel") : this.i18n.t("showSectionAriaLabel");
+ a.push(l), r.setAttribute("aria-label", a.join(" , ")), t ? (o.removeAttribute("hidden"), e.classList.add(this.sectionExpandedClass), n.classList.remove(this.downChevronIconClass)) : (o.setAttribute("hidden", "until-found"), e.classList.remove(this.sectionExpandedClass), n.classList.add(this.downChevronIconClass));
+ const h = this.checkIfAllSectionsOpen();
+ this.updateShowAllButton(h)
}
isExpanded(t) {
return t.classList.contains(this.sectionExpandedClass)
@@ -338,7 +1726,7 @@ Accordion.moduleName = "govuk-accordion", Accordion.defaults = Object.freeze({
},
rememberExpanded: !0
});
-const t = {
+const pc = {
checkForSessionStorage: function() {
const t = "this is the test string";
let e;
@@ -384,50 +1772,50 @@ class CharacterCount extends GOVUKFrontendComponent {
element: t,
identifier: "Root element (`$module`)"
});
- const s = t.querySelector(".govuk-js-character-count");
- if (!(s instanceof HTMLTextAreaElement || s instanceof HTMLInputElement)) throw new ElementError({
+ const r = t.querySelector(".govuk-js-character-count");
+ if (!(r instanceof HTMLTextAreaElement || r instanceof HTMLInputElement)) throw new ElementError({
componentName: "Character count",
- element: s,
+ element: r,
expectedType: "HTMLTextareaElement or HTMLInputElement",
identifier: "Form field (`.govuk-js-character-count`)"
});
const o = normaliseDataset(t.dataset);
- let r = {};
- ("maxwords" in o || "maxlength" in o) && (r = {
+ let s = {};
+ ("maxwords" in o || "maxlength" in o) && (s = {
maxlength: void 0,
maxwords: void 0
- }), this.config = mergeConfigs(CharacterCount.defaults, e, r, o);
+ }), this.config = mergeConfigs(CharacterCount.defaults, e, s, o);
const a = function(t, e) {
const n = [];
- for (const [i, s] of Object.entries(t)) {
+ for (const [i, r] of Object.entries(t)) {
const t = [];
for (const {
required: n,
errorMessage: i
}
- of s) n.every((t => !!e[t])) || t.push(i);
- "anyOf" !== i || s.length - t.length >= 1 || n.push(...t)
+ of r) n.every((t => !!e[t])) || t.push(i);
+ "anyOf" !== i || r.length - t.length >= 1 || n.push(...t)
}
return n
}(CharacterCount.schema, this.config);
if (a[0]) throw new ConfigError(`Character count: ${a[0]}`);
this.i18n = new I18n(extractConfigByNamespace(this.config, "i18n"), {
locale: closestAttributeValue(t, "lang")
- }), this.maxLength = null != (n = null != (i = this.config.maxwords) ? i : this.config.maxlength) ? n : 1 / 0, this.$module = t, this.$textarea = s;
- const l = `${this.$textarea.id}-info`,
- c = document.getElementById(l);
- if (!c) throw new ElementError({
+ }), this.maxLength = null != (n = null != (i = this.config.maxwords) ? i : this.config.maxlength) ? n : 1 / 0, this.$module = t, this.$textarea = r;
+ const c = `${this.$textarea.id}-info`,
+ u = document.getElementById(c);
+ if (!u) throw new ElementError({
componentName: "Character count",
- element: c,
- identifier: `Count message (\`id="${l}"\`)`
+ element: u,
+ identifier: `Count message (\`id="${c}"\`)`
});
- `${c.textContent}`.match(/^\s*$/) && (c.textContent = this.i18n.t("textareaDescription", {
+ `${u.textContent}`.match(/^\s*$/) && (u.textContent = this.i18n.t("textareaDescription", {
count: this.maxLength
- })), this.$textarea.insertAdjacentElement("afterend", c);
+ })), this.$textarea.insertAdjacentElement("afterend", u);
+ const l = document.createElement("div");
+ l.className = "govuk-character-count__sr-status govuk-visually-hidden", l.setAttribute("aria-live", "polite"), this.$screenReaderCountMessage = l, u.insertAdjacentElement("afterend", l);
const h = document.createElement("div");
- h.className = "govuk-character-count__sr-status govuk-visually-hidden", h.setAttribute("aria-live", "polite"), this.$screenReaderCountMessage = h, c.insertAdjacentElement("afterend", h);
- const u = document.createElement("div");
- u.className = c.className, u.classList.add("govuk-character-count__status"), u.setAttribute("aria-hidden", "true"), this.$visibleCountMessage = u, c.insertAdjacentElement("afterend", u), c.classList.add("govuk-visually-hidden"), this.$textarea.removeAttribute("maxlength"), this.bindChangeEvents(), window.addEventListener("pageshow", (() => this.updateCountMessage())), this.updateCountMessage()
+ h.className = u.className, h.classList.add("govuk-character-count__status"), h.setAttribute("aria-hidden", "true"), this.$visibleCountMessage = h, u.insertAdjacentElement("afterend", h), u.classList.add("govuk-visually-hidden"), this.$textarea.removeAttribute("maxlength"), this.bindChangeEvents(), window.addEventListener("pageshow", (() => this.updateCountMessage())), this.updateCountMessage()
}
bindChangeEvents() {
this.$textarea.addEventListener("keyup", (() => this.handleKeyUp())), this.$textarea.addEventListener("focus", (() => this.handleFocus())), this.$textarea.addEventListener("blur", (() => this.handleBlur()))
@@ -601,9 +1989,9 @@ class ErrorSummary extends GOVUKFrontendComponent {
const n = e[0];
if (t instanceof HTMLInputElement && ("checkbox" === t.type || "radio" === t.type)) return n;
const i = n.getBoundingClientRect().top,
- s = t.getBoundingClientRect();
- if (s.height && window.innerHeight) {
- if (s.top + s.height - i < window.innerHeight / 2) return n
+ r = t.getBoundingClientRect();
+ if (r.height && window.innerHeight) {
+ if (r.top + r.height - i < window.innerHeight / 2) return n
}
}
}
@@ -776,14 +2164,439 @@ class Radios extends GOVUKFrontendComponent {
if (!(e instanceof HTMLInputElement) || "radio" !== e.type) return;
const n = document.querySelectorAll('input[type="radio"][aria-controls]'),
i = e.form,
- s = e.name;
+ r = e.name;
n.forEach((t => {
const e = t.form === i;
- t.name === s && e && this.syncConditionalRevealWithInputState(t)
+ t.name === r && e && this.syncConditionalRevealWithInputState(t)
}))
}
}
Radios.moduleName = "govuk-radios";
+var mc = y,
+ gc = ft,
+ vc = Object.getOwnPropertyDescriptor,
+ bc = fails$k,
+ yc = ft,
+ wc = wellKnownSymbol$f("iterator"),
+ Ec = !bc((function() {
+ var t = new URL("b?a=1&b=2&c=3", "http://a"),
+ e = t.searchParams,
+ n = new URLSearchParams("a=1&a=2&b=3"),
+ i = "";
+ return t.pathname = "c%20d", e.forEach((function(t, n) {
+ e.delete("b"), i += n + t
+ })), n.delete("a", 2), n.delete("b", void 0), !e.size && !yc || !e.sort || "http://a/c%20d?a=1&c=3" !== t.href || "3" !== e.get("c") || "a=1" !== String(new URLSearchParams("?a=1")) || !e[wc] || "a" !== new URL("https://a@b").username || "b" !== new URLSearchParams(new URLSearchParams("a=b")).get("a") || "xn--e1aybc" !== new URL("http://тест").host || "#%D0%B1" !== new URL("http://a#б").hash || "a1c3" !== i || "x" !== new URL("http://x", void 0).host
+ })),
+ Cc = di,
+ kc = mt,
+ defineBuiltInAccessor$2 = function(t, e, n) {
+ return n.get && Cc(n.get, e, {
+ getter: !0
+ }), n.set && Cc(n.set, e, {
+ setter: !0
+ }), kc.f(t, e, n)
+ },
+ Sc = defineBuiltIn$9,
+ xc = $t,
+ $c = TypeError,
+ Ac = classofRaw$2,
+ Tc = s,
+ uncurryThis$5 = function(t) {
+ if ("Function" === Ac(t)) return Tc(t)
+ },
+ Lc = aCallable$4,
+ Ic = e,
+ Oc = uncurryThis$5(uncurryThis$5.bind),
+ Rc = Bo,
+ Mc = getMethod$4,
+ _c = isNullOrUndefined$5,
+ Pc = nn,
+ Fc = wellKnownSymbol$f("iterator"),
+ getIteratorMethod$2 = function(t) {
+ if (!_c(t)) return Mc(t, Fc) || Mc(t, "@@iterator") || Pc[Rc(t)]
+ },
+ Hc = kt,
+ jc = aCallable$4,
+ Bc = anObject$c,
+ Nc = tryToString$2,
+ Uc = getIteratorMethod$2,
+ qc = TypeError,
+ Kc = TypeError,
+ validateArgumentsLength$3 = function(t, e) {
+ if (t < e) throw new Kc("Not enough arguments");
+ return t
+ },
+ Dc = s([].slice),
+ Vc = Math.floor,
+ sort = function(t, e) {
+ var n = t.length;
+ if (n < 8)
+ for (var i, r, o = 1; o < n;) {
+ for (r = o, i = t[o]; r && e(t[r - 1], i) > 0;) t[r] = t[--r];
+ r !== o++ && (t[r] = i)
+ } else
+ for (var s = Vc(n / 2), a = sort(Dc(t, 0, s), e), c = sort(Dc(t, s), e), u = a.length, l = c.length, h = 0, d = 0; h < u || d < l;) t[h + d] = h < u && d < l ? e(a[h], c[d]) <= 0 ? a[h++] : c[d++] : h < u ? a[h++] : c[d++];
+ return t
+ },
+ Gc = _export,
+ zc = y,
+ safeGetBuiltIn = function(t) {
+ if (!gc) return mc[t];
+ var e = vc(mc, t);
+ return e && e.value
+ },
+ Wc = kt,
+ Yc = s,
+ Qc = ft,
+ Xc = Ec,
+ Jc = defineBuiltIn$9,
+ Zc = defineBuiltInAccessor$2,
+ defineBuiltIns = function(t, e, n) {
+ for (var i in e) Sc(t, i, e[i], n);
+ return t
+ },
+ tu = setToStringTag$4,
+ eu = iteratorCreateConstructor,
+ nu = kn,
+ anInstance = function(t, e) {
+ if (xc(e, t)) return t;
+ throw new $c("Incorrect invocation")
+ },
+ iu = at,
+ ru = P,
+ bind = function(t, e) {
+ return Lc(t), void 0 === e ? t : Ic ? Oc(t, e) : function() {
+ return t.apply(e, arguments)
+ }
+ },
+ ou = Bo,
+ su = anObject$c,
+ au = isObject$9,
+ cu = toString$8,
+ uu = ze,
+ lu = createPropertyDescriptor$4,
+ getIterator = function(t, e) {
+ var n = arguments.length < 2 ? Uc(t) : e;
+ if (jc(n)) return Bc(Hc(n, t));
+ throw new qc(Nc(t) + " is not iterable")
+ },
+ hu = getIteratorMethod$2,
+ du = createIterResultObject$2,
+ fu = validateArgumentsLength$3,
+ pu = sort,
+ mu = wellKnownSymbol$f("iterator"),
+ gu = "URLSearchParams",
+ vu = gu + "Iterator",
+ bu = nu.set,
+ yu = nu.getterFor(gu),
+ wu = nu.getterFor(vu),
+ Eu = safeGetBuiltIn("fetch"),
+ Cu = safeGetBuiltIn("Request"),
+ ku = safeGetBuiltIn("Headers"),
+ Su = Cu && Cu.prototype,
+ xu = ku && ku.prototype,
+ $u = zc.RegExp,
+ Au = zc.TypeError,
+ Tu = zc.decodeURIComponent,
+ Lu = zc.encodeURIComponent,
+ Iu = Yc("".charAt),
+ Ou = Yc([].join),
+ Ru = Yc([].push),
+ Mu = Yc("".replace),
+ _u = Yc([].shift),
+ Pu = Yc([].splice),
+ Fu = Yc("".split),
+ Hu = Yc("".slice),
+ ju = /\+/g,
+ Bu = Array(4),
+ percentSequence = function(t) {
+ return Bu[t - 1] || (Bu[t - 1] = $u("((?:%[\\da-f]{2}){" + t + "})", "gi"))
+ },
+ percentDecode = function(t) {
+ try {
+ return Tu(t)
+ } catch (vl) {
+ return t
+ }
+ },
+ deserialize = function(t) {
+ var e = Mu(t, ju, " "),
+ n = 4;
+ try {
+ return Tu(e)
+ } catch (vl) {
+ for (; n;) e = Mu(e, percentSequence(n--), percentDecode);
+ return e
+ }
+ },
+ Nu = /[!'()~]|%20/g,
+ Uu = {
+ "!": "%21",
+ "'": "%27",
+ "(": "%28",
+ ")": "%29",
+ "~": "%7E",
+ "%20": "+"
+ },
+ replacer = function(t) {
+ return Uu[t]
+ },
+ serialize = function(t) {
+ return Mu(Lu(t), Nu, replacer)
+ },
+ qu = eu((function(t, e) {
+ bu(this, {
+ type: vu,
+ target: yu(t).entries,
+ index: 0,
+ kind: e
+ })
+ }), gu, (function() {
+ var t = wu(this),
+ e = t.target,
+ n = t.index++;
+ if (!e || n >= e.length) return t.target = void 0, du(void 0, !0);
+ var i = e[n];
+ switch (t.kind) {
+ case "keys":
+ return du(i.key, !1);
+ case "values":
+ return du(i.value, !1)
+ }
+ return du([i.key, i.value], !1)
+ }), !0),
+ URLSearchParamsState = function(t) {
+ this.entries = [], this.url = null, void 0 !== t && (au(t) ? this.parseObject(t) : this.parseQuery("string" == typeof t ? "?" === Iu(t, 0) ? Hu(t, 1) : t : cu(t)))
+ };
+URLSearchParamsState.prototype = {
+ type: gu,
+ bindURL: function(t) {
+ this.url = t, this.update()
+ },
+ parseObject: function(t) {
+ var e, n, i, r, o, s, a, c = this.entries,
+ u = hu(t);
+ if (u)
+ for (n = (e = getIterator(t, u)).next; !(i = Wc(n, e)).done;) {
+ if (o = (r = getIterator(su(i.value))).next, (s = Wc(o, r)).done || (a = Wc(o, r)).done || !Wc(o, r).done) throw new Au("Expected sequence with length 2");
+ Ru(c, {
+ key: cu(s.value),
+ value: cu(a.value)
+ })
+ } else
+ for (var l in t) ru(t, l) && Ru(c, {
+ key: l,
+ value: cu(t[l])
+ })
+ },
+ parseQuery: function(t) {
+ if (t)
+ for (var e, n, i = this.entries, r = Fu(t, "&"), o = 0; o < r.length;)(e = r[o++]).length && (n = Fu(e, "="), Ru(i, {
+ key: deserialize(_u(n)),
+ value: deserialize(Ou(n, "="))
+ }))
+ },
+ serialize: function() {
+ for (var t, e = this.entries, n = [], i = 0; i < e.length;) t = e[i++], Ru(n, serialize(t.key) + "=" + serialize(t.value));
+ return Ou(n, "&")
+ },
+ update: function() {
+ this.entries.length = 0, this.parseQuery(this.url.query)
+ },
+ updateURL: function() {
+ this.url && this.url.update()
+ }
+};
+var URLSearchParamsConstructor = function() {
+ anInstance(this, Ku);
+ var t = bu(this, new URLSearchParamsState(arguments.length > 0 ? arguments[0] : void 0));
+ Qc || (this.size = t.entries.length)
+ },
+ Ku = URLSearchParamsConstructor.prototype;
+if (defineBuiltIns(Ku, {
+ append: function(t, e) {
+ var n = yu(this);
+ fu(arguments.length, 2), Ru(n.entries, {
+ key: cu(t),
+ value: cu(e)
+ }), Qc || this.length++, n.updateURL()
+ },
+ delete: function(t) {
+ for (var e = yu(this), n = fu(arguments.length, 1), i = e.entries, r = cu(t), o = n < 2 ? void 0 : arguments[1], s = void 0 === o ? o : cu(o), a = 0; a < i.length;) {
+ var c = i[a];
+ if (c.key !== r || void 0 !== s && c.value !== s) a++;
+ else if (Pu(i, a, 1), void 0 !== s) break
+ }
+ Qc || (this.size = i.length), e.updateURL()
+ },
+ get: function(t) {
+ var e = yu(this).entries;
+ fu(arguments.length, 1);
+ for (var n = cu(t), i = 0; i < e.length; i++)
+ if (e[i].key === n) return e[i].value;
+ return null
+ },
+ getAll: function(t) {
+ var e = yu(this).entries;
+ fu(arguments.length, 1);
+ for (var n = cu(t), i = [], r = 0; r < e.length; r++) e[r].key === n && Ru(i, e[r].value);
+ return i
+ },
+ has: function(t) {
+ for (var e = yu(this).entries, n = fu(arguments.length, 1), i = cu(t), r = n < 2 ? void 0 : arguments[1], o = void 0 === r ? r : cu(r), s = 0; s < e.length;) {
+ var a = e[s++];
+ if (a.key === i && (void 0 === o || a.value === o)) return !0
+ }
+ return !1
+ },
+ set: function(t, e) {
+ var n = yu(this);
+ fu(arguments.length, 1);
+ for (var i, r = n.entries, o = !1, s = cu(t), a = cu(e), c = 0; c < r.length; c++)(i = r[c]).key === s && (o ? Pu(r, c--, 1) : (o = !0, i.value = a));
+ o || Ru(r, {
+ key: s,
+ value: a
+ }), Qc || (this.size = r.length), n.updateURL()
+ },
+ sort: function() {
+ var t = yu(this);
+ pu(t.entries, (function(t, e) {
+ return t.key > e.key ? 1 : -1
+ })), t.updateURL()
+ },
+ forEach: function(t) {
+ for (var e, n = yu(this).entries, i = bind(t, arguments.length > 1 ? arguments[1] : void 0), r = 0; r < n.length;) i((e = n[r++]).value, e.key, this)
+ },
+ keys: function() {
+ return new qu(this, "keys")
+ },
+ values: function() {
+ return new qu(this, "values")
+ },
+ entries: function() {
+ return new qu(this, "entries")
+ }
+ }, {
+ enumerable: !0
+ }), Jc(Ku, mu, Ku.entries, {
+ name: "entries"
+ }), Jc(Ku, "toString", (function() {
+ return yu(this).serialize()
+ }), {
+ enumerable: !0
+ }), Qc && Zc(Ku, "size", {
+ get: function() {
+ return yu(this).entries.length
+ },
+ configurable: !0,
+ enumerable: !0
+ }), tu(URLSearchParamsConstructor, gu), Gc({
+ global: !0,
+ constructor: !0,
+ forced: !Xc
+ }, {
+ URLSearchParams: URLSearchParamsConstructor
+ }), !Xc && iu(ku)) {
+ var Du = Yc(xu.has),
+ Vu = Yc(xu.set),
+ wrapRequestOptions = function(t) {
+ if (au(t)) {
+ var e, n = t.body;
+ if (ou(n) === gu) return e = t.headers ? new ku(t.headers) : new ku, Du(e, "content-type") || Vu(e, "content-type", "application/x-www-form-urlencoded;charset=UTF-8"), uu(t, {
+ body: lu(0, cu(n)),
+ headers: lu(0, e)
+ })
+ }
+ return t
+ };
+ if (iu(Eu) && Gc({
+ global: !0,
+ enumerable: !0,
+ dontCallGetSet: !0,
+ forced: !0
+ }, {
+ fetch: function(t) {
+ return Eu(t, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {})
+ }
+ }), iu(Cu)) {
+ var RequestConstructor = function(t) {
+ return anInstance(this, Su), new Cu(t, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {})
+ };
+ Su.constructor = RequestConstructor, RequestConstructor.prototype = Su, Gc({
+ global: !0,
+ constructor: !0,
+ dontCallGetSet: !0,
+ forced: !0
+ }, {
+ Request: RequestConstructor
+ })
+ }
+}
+var Gu = defineBuiltIn$9,
+ zu = s,
+ Wu = toString$8,
+ Yu = validateArgumentsLength$3,
+ Qu = URLSearchParams,
+ Xu = Qu.prototype,
+ Ju = zu(Xu.append),
+ Zu = zu(Xu.delete),
+ tl = zu(Xu.forEach),
+ el = zu([].push),
+ nl = new Qu("a=1&a=2&b=3");
+nl.delete("a", 1), nl.delete("b", void 0), nl + "" != "a=2" && Gu(Xu, "delete", (function(t) {
+ var e = arguments.length,
+ n = e < 2 ? void 0 : arguments[1];
+ if (e && void 0 === n) return Zu(this, t);
+ var i = [];
+ tl(this, (function(t, e) {
+ el(i, {
+ key: e,
+ value: t
+ })
+ })), Yu(e, 1);
+ for (var r, o = Wu(t), s = Wu(n), a = 0, c = 0, u = !1, l = i.length; a < l;) r = i[a++], u || r.key === o ? (u = !0, Zu(this, r.key)) : c++;
+ for (; c < l;)(r = i[c++]).key === o && r.value === s || Ju(this, r.key, r.value)
+}), {
+ enumerable: !0,
+ unsafe: !0
+});
+var il = defineBuiltIn$9,
+ rl = s,
+ ol = toString$8,
+ sl = validateArgumentsLength$3,
+ al = URLSearchParams,
+ cl = al.prototype,
+ ul = rl(cl.getAll),
+ ll = rl(cl.has),
+ hl = new al("a=1");
+!hl.has("a", 2) && hl.has("a", void 0) || il(cl, "has", (function(t) {
+ var e = arguments.length,
+ n = e < 2 ? void 0 : arguments[1];
+ if (e && void 0 === n) return ll(this, t);
+ var i = ul(this, t);
+ sl(e, 1);
+ for (var r = ol(n), o = 0; o < i.length;)
+ if (i[o++] === r) return !0;
+ return !1
+}), {
+ enumerable: !0,
+ unsafe: !0
+});
+var dl = ft,
+ fl = s,
+ pl = defineBuiltInAccessor$2,
+ ml = URLSearchParams.prototype,
+ gl = fl(ml.forEach);
+dl && !("size" in ml) && pl(ml, "size", {
+ get: function() {
+ var t = 0;
+ return gl(this, (function() {
+ t++
+ })), t
+ },
+ configurable: !0,
+ enumerable: !0
+});
class SkipLink extends GOVUKFrontendComponent {
constructor(t) {
var e;
@@ -796,27 +2609,27 @@ class SkipLink extends GOVUKFrontendComponent {
this.$module = t;
const n = this.$module.hash,
i = null != (e = this.$module.getAttribute("href")) ? e : "";
- let s;
+ let r;
try {
- s = new window.URL(this.$module.href)
- } catch (a) {
+ r = new window.URL(this.$module.href)
+ } catch (vl) {
throw new ElementError(`Skip link: Target link (\`href="${i}"\`) is invalid`)
}
- if (s.origin !== window.location.origin || s.pathname !== window.location.pathname) return;
+ if (r.origin !== window.location.origin || r.pathname !== window.location.pathname) return;
const o = getFragmentFromUrl(n);
if (!o) throw new ElementError(`Skip link: Target link (\`href="${i}"\`) has no hash fragment`);
- const r = document.getElementById(o);
- if (!r) throw new ElementError({
+ const s = document.getElementById(o);
+ if (!s) throw new ElementError({
componentName: "Skip link",
- element: r,
+ element: s,
identifier: `Target content (\`id="${o}"\`)`
});
- this.$module.addEventListener("click", (() => setFocus(r, {
+ this.$module.addEventListener("click", (() => setFocus(s, {
onBeforeFocus() {
- r.classList.add("govuk-skip-link-focused-element")
+ s.classList.add("govuk-skip-link-focused-element")
},
onBlur() {
- r.classList.remove("govuk-skip-link-focused-element")
+ s.classList.remove("govuk-skip-link-focused-element")
}
})))
}
@@ -992,8 +2805,8 @@ function initAll(t) {
i.querySelectorAll(`[data-module="${t.moduleName}"]`).forEach((n => {
try {
"defaults" in t ? new t(n, e) : new t(n)
- } catch (i) {
- console.log(i)
+ } catch (vl) {
+ console.log(vl)
}
}))
}))
Action run for 363b5f1 |
Stylesheets changes to GitHub releasediff --git a/dist/govuk-frontend-5.1.0.min.css b/dist/govuk-frontend-5.1.0.min.css
index 1719cc124..ed4ef4d66 100644
--- a/dist/govuk-frontend-5.1.0.min.css
+++ b/dist/govuk-frontend-5.1.0.min.css
@@ -2476,6 +2476,7 @@
}
.govuk-checkboxes__input {
+ z-index: 1;
width: 44px;
height: 44px;
margin: 0;
@@ -4815,6 +4816,7 @@ only screen and (min-resolution:2dppx) {
}
.govuk-radios__input {
+ z-index: 1;
width: 44px;
height: 44px;
margin: 0;
Action run for 363b5f1 |
Closing for housekeeping reasons, as this spike seems unlikely to be resolved at this time. The related issue remains open for comments. #3948 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the Babel polyfill provider core-js via:
https://www.npmjs.com/package/babel-plugin-polyfill-corejs3
This is part of a two spike series:
Findings
Lots more polyfills are added by core-js when compared to ES shims in #4301
We also have lots more unwanted bug fixes:
Array.prototype.from
polyfill because the type being iterated is unknownArray.prototype.includes
polyfill to avoid bugsError.prototype.cause
polyfill to avoid bugsURL
constructor polyfill to avoid bugsIncluding an overwhelming amount of polyfills to patch various browser APIs in already-supported features:
For example, Safari 12.1 updated
''.trim()
to include revised empty space characters:paulmillr/es6-shim#354 (comment)
Similarly, versions below Firefox 102 handled
[].includes()
with sparse arrays incorrectly:https://bugzilla.mozilla.org/show_bug.cgi?id=1767541
Global polyfills
This PR uses
core-js
rather thancore-js-pure
since lots of polyfills are missed due to:usage-pure
has incorrect optimization logic babel/babel-polyfills#166Remaining issues
es6-module
but Babel disagrees@rollup/plugin-commonjs
adds ES module wrappers to polyfills@rollup/plugin-babel
adds helpers to avoid ES module wrappersdist/govuk/node_modules
notdist/govuk/vendor
Automatic polyfills
When Babel was added we chose "transforms only" without polyfills (see decision record)
This PR ensures early investigations aren't lost for:
Decision record implications
Since Babel with "transforms only" silently skips polyfills, we noted that care must be taken:
This spike PR ensures:
i.e. Support for both polyfills and protection from missed polyfills all-in-one