/* Minification failed. Returning unminified contents.
(2,1910-1916): run-time warning JS1010: Expected identifier: return
(2,1922-1928): run-time warning JS1010: Expected identifier: return
(2,3281-3287): run-time warning JS1028: Expected identifier or string: delete
(2,3926-3932): run-time warning JS1028: Expected identifier or string: delete
(2,4201-4206): run-time warning JS1010: Expected identifier: catch
(2,4308-4313): run-time warning JS1010: Expected identifier: catch
(2,4370-4376): run-time warning JS1028: Expected identifier or string: delete
(2,4402-4408): run-time warning JS1010: Expected identifier: delete
(2,4412-4417): run-time warning JS1010: Expected identifier: catch
(2,4457-4463): run-time warning JS1010: Expected identifier: delete
(2,4512-4517): run-time warning JS1010: Expected identifier: catch
(2,5222-5228): run-time warning JS1028: Expected identifier or string: delete
(2,11767-11773): run-time warning JS1010: Expected identifier: delete
(2,11838-11844): run-time warning JS1010: Expected identifier: delete
(8,5027-5030): run-time warning JS1028: Expected identifier or string: for
(8,5043-5048): run-time warning JS1028: Expected identifier or string: class
(15,24009-24014): run-time warning JS1010: Expected identifier: catch
(17,3981-3987): run-time warning JS1010: Expected identifier: return
(17,3993-3999): run-time warning JS1010: Expected identifier: return
(17,46017-46022): run-time warning JS1010: Expected identifier: catch
(17,54949-54954): run-time warning JS1010: Expected identifier: catch
(17,83442-83447): run-time warning JS1010: Expected identifier: catch
(17,97927-97934): run-time warning JS1028: Expected identifier or string: default
(17,101417-101424): run-time warning JS1010: Expected identifier: default
(17,105474-105481): run-time warning JS1010: Expected identifier: default
(17,145957-145964): run-time warning JS1010: Expected identifier: default
(17,208524-208531): run-time warning JS1010: Expected identifier: default
(17,211464-211470): run-time warning JS1010: Expected identifier: delete
(17,243631-243638): run-time warning JS1028: Expected identifier or string: default
(17,273753-273759): run-time warning JS1028: Expected identifier or string: delete
(17,273800-273806): run-time warning JS1010: Expected identifier: delete
(893,927-933): run-time warning JS1010: Expected identifier: return
(893,946-952): run-time warning JS1010: Expected identifier: return
(1296,11-18): run-time warning JS1010: Expected identifier: default
(1372,11-18): run-time warning JS1010: Expected identifier: default
(1914,482-488): run-time warning JS1010: Expected identifier: return
(1914,501-507): run-time warning JS1010: Expected identifier: return
(1988,482-488): run-time warning JS1010: Expected identifier: return
(1988,501-507): run-time warning JS1010: Expected identifier: return
(893,927-933): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(893,946-952): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(1914,482-488): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(1914,501-507): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(1988,482-488): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(1988,501-507): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(2,1910-1916): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(2,1922-1928): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(2,4201-4206): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(2,4308-4313): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(2,4412-4417): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(2,4402-4408): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(2,4457-4463): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(2,4512-4517): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(2,11767-11773): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(2,11838-11844): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(15,24009-24014): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(17,3981-3987): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(17,3993-3999): run-time error JS1137: 'return' is a new reserved word and should not be used as an identifier: return
(17,83442-83447): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(17,145957-145964): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
(17,211464-211470): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(17,46017-46022): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(17,54949-54954): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
(17,101417-101424): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
(17,105474-105481): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
(17,208524-208531): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
(17,273800-273806): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
(1296,11-18): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
(1372,11-18): run-time error JS1137: 'default' is a new reserved word and should not be used as an identifier: default
 */
/*! algoliasearch-lite.umd.js | 4.11.0 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).algoliasearch = t() }(this, (function () { "use strict"; function e(e, t, r) { return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e } function t(e, t) { var r = Object.keys(e); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); t && (n = n.filter((function (t) { return Object.getOwnPropertyDescriptor(e, t).enumerable }))), r.push.apply(r, n) } return r } function r(r) { for (var n = 1; n < arguments.length; n++) { var o = null != arguments[n] ? arguments[n] : {}; n % 2 ? t(Object(o), !0).forEach((function (t) { e(r, t, o[t]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : t(Object(o)).forEach((function (e) { Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(o, e)) })) } return r } function n(e, t) { if (null == e) return {}; var r, n, o = function (e, t) { if (null == e) return {}; var r, n, o = {}, a = Object.keys(e); for (n = 0; n < a.length; n++)r = a[n], t.indexOf(r) >= 0 || (o[r] = e[r]); return o }(e, t); if (Object.getOwnPropertySymbols) { var a = Object.getOwnPropertySymbols(e); for (n = 0; n < a.length; n++)r = a[n], t.indexOf(r) >= 0 || Object.prototype.propertyIsEnumerable.call(e, r) && (o[r] = e[r]) } return o } function o(e, t) { return function (e) { if (Array.isArray(e)) return e }(e) || function (e, t) { if (!(Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e))) return; var r = [], n = !0, o = !1, a = void 0; try { for (var u, i = e[Symbol.iterator](); !(n = (u = i.next()).done) && (r.push(u.value), !t || r.length !== t); n = !0); } catch (e) { o = !0, a = e } finally { try { n || null == i.return || i.return() } finally { if (o) throw a } } return r }(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance") }() } function a(e) { return function (e) { if (Array.isArray(e)) { for (var t = 0, r = new Array(e.length); t < e.length; t++)r[t] = e[t]; return r } }(e) || function (e) { if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) return Array.from(e) }(e) || function () { throw new TypeError("Invalid attempt to spread non-iterable instance") }() } function u(e) { var t, r = "algoliasearch-client-js-".concat(e.key), n = function () { return void 0 === t && (t = e.localStorage || window.localStorage), t }, a = function () { return JSON.parse(n().getItem(r) || "{}") }; return { get: function (e, t) { var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { miss: function () { return Promise.resolve() } }; return Promise.resolve().then((function () { var r = JSON.stringify(e), n = a()[r]; return Promise.all([n || t(), void 0 !== n]) })).then((function (e) { var t = o(e, 2), n = t[0], a = t[1]; return Promise.all([n, a || r.miss(n)]) })).then((function (e) { return o(e, 1)[0] })) }, set: function (e, t) { return Promise.resolve().then((function () { var o = a(); return o[JSON.stringify(e)] = t, n().setItem(r, JSON.stringify(o)), t })) }, delete: function (e) { return Promise.resolve().then((function () { var t = a(); delete t[JSON.stringify(e)], n().setItem(r, JSON.stringify(t)) })) }, clear: function () { return Promise.resolve().then((function () { n().removeItem(r) })) } } } function i(e) { var t = a(e.caches), r = t.shift(); return void 0 === r ? { get: function (e, t) { var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { miss: function () { return Promise.resolve() } }, n = t(); return n.then((function (e) { return Promise.all([e, r.miss(e)]) })).then((function (e) { return o(e, 1)[0] })) }, set: function (e, t) { return Promise.resolve(t) }, delete: function (e) { return Promise.resolve() }, clear: function () { return Promise.resolve() } } : { get: function (e, n) { var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { miss: function () { return Promise.resolve() } }; return r.get(e, n, o).catch((function () { return i({ caches: t }).get(e, n, o) })) }, set: function (e, n) { return r.set(e, n).catch((function () { return i({ caches: t }).set(e, n) })) }, delete: function (e) { return r.delete(e).catch((function () { return i({ caches: t }).delete(e) })) }, clear: function () { return r.clear().catch((function () { return i({ caches: t }).clear() })) } } } function s() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { serializable: !0 }, t = {}; return { get: function (r, n) { var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { miss: function () { return Promise.resolve() } }, a = JSON.stringify(r); if (a in t) return Promise.resolve(e.serializable ? JSON.parse(t[a]) : t[a]); var u = n(), i = o && o.miss || function () { return Promise.resolve() }; return u.then((function (e) { return i(e) })).then((function () { return u })) }, set: function (r, n) { return t[JSON.stringify(r)] = e.serializable ? JSON.stringify(n) : n, Promise.resolve(n) }, delete: function (e) { return delete t[JSON.stringify(e)], Promise.resolve() }, clear: function () { return t = {}, Promise.resolve() } } } function c(e) { for (var t = e.length - 1; t > 0; t--) { var r = Math.floor(Math.random() * (t + 1)), n = e[t]; e[t] = e[r], e[r] = n } return e } function l(e, t) { return t ? (Object.keys(t).forEach((function (r) { e[r] = t[r](e) })), e) : e } function f(e) { for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)r[n - 1] = arguments[n]; var o = 0; return e.replace(/%s/g, (function () { return encodeURIComponent(r[o++]) })) } var h = { WithinQueryParameters: 0, WithinHeaders: 1 }; function d(e, t) { var r = e || {}, n = r.data || {}; return Object.keys(r).forEach((function (e) { -1 === ["timeout", "headers", "queryParameters", "data", "cacheable"].indexOf(e) && (n[e] = r[e]) })), { data: Object.entries(n).length > 0 ? n : void 0, timeout: r.timeout || t, headers: r.headers || {}, queryParameters: r.queryParameters || {}, cacheable: r.cacheable } } var m = { Read: 1, Write: 2, Any: 3 }, p = 1, v = 2, y = 3; function g(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : p; return r(r({}, e), {}, { status: t, lastUpdate: Date.now() }) } function b(e) { return "string" == typeof e ? { protocol: "https", url: e, accept: m.Any } : { protocol: e.protocol || "https", url: e.url, accept: e.accept || m.Any } } var O = "GET", P = "POST"; function q(e, t) { return Promise.all(t.map((function (t) { return e.get(t, (function () { return Promise.resolve(g(t)) })) }))).then((function (e) { var r = e.filter((function (e) { return function (e) { return e.status === p || Date.now() - e.lastUpdate > 12e4 }(e) })), n = e.filter((function (e) { return function (e) { return e.status === y && Date.now() - e.lastUpdate <= 12e4 }(e) })), o = [].concat(a(r), a(n)); return { getTimeout: function (e, t) { return (0 === n.length && 0 === e ? 1 : n.length + 3 + e) * t }, statelessHosts: o.length > 0 ? o.map((function (e) { return b(e) })) : t } })) } function w(e, t, n, o) { var u = [], i = function (e, t) { if (e.method === O || void 0 === e.data && void 0 === t.data) return; var n = Array.isArray(e.data) ? e.data : r(r({}, e.data), t.data); return JSON.stringify(n) }(n, o), s = function (e, t) { var n = r(r({}, e.headers), t.headers), o = {}; return Object.keys(n).forEach((function (e) { var t = n[e]; o[e.toLowerCase()] = t })), o }(e, o), c = n.method, l = n.method !== O ? {} : r(r({}, n.data), o.data), f = r(r(r({ "x-algolia-agent": e.userAgent.value }, e.queryParameters), l), o.queryParameters), h = 0, d = function t(r, a) { var l = r.pop(); if (void 0 === l) throw { name: "RetryError", message: "Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.", transporterStackTrace: A(u) }; var d = { data: i, headers: s, method: c, url: S(l, n.path, f), connectTimeout: a(h, e.timeouts.connect), responseTimeout: a(h, o.timeout) }, m = function (e) { var t = { request: d, response: e, host: l, triesLeft: r.length }; return u.push(t), t }, p = { onSuccess: function (e) { return function (e) { try { return JSON.parse(e.content) } catch (t) { throw function (e, t) { return { name: "DeserializationError", message: e, response: t } }(t.message, e) } }(e) }, onRetry: function (n) { var o = m(n); return n.isTimedOut && h++, Promise.all([e.logger.info("Retryable failure", x(o)), e.hostsCache.set(l, g(l, n.isTimedOut ? y : v))]).then((function () { return t(r, a) })) }, onFail: function (e) { throw m(e), function (e, t) { var r = e.content, n = e.status, o = r; try { o = JSON.parse(r).message } catch (e) { } return function (e, t, r) { return { name: "ApiError", message: e, status: t, transporterStackTrace: r } }(o, n, t) }(e, A(u)) } }; return e.requester.send(d).then((function (e) { return function (e, t) { return function (e) { var t = e.status; return e.isTimedOut || function (e) { var t = e.isTimedOut, r = e.status; return !t && 0 == ~~r }(e) || 2 != ~~(t / 100) && 4 != ~~(t / 100) }(e) ? t.onRetry(e) : 2 == ~~(e.status / 100) ? t.onSuccess(e) : t.onFail(e) }(e, p) })) }; return q(e.hostsCache, t).then((function (e) { return d(a(e.statelessHosts).reverse(), e.getTimeout) })) } function j(e) { var t = { value: "Algolia for JavaScript (".concat(e, ")"), add: function (e) { var r = "; ".concat(e.segment).concat(void 0 !== e.version ? " (".concat(e.version, ")") : ""); return -1 === t.value.indexOf(r) && (t.value = "".concat(t.value).concat(r)), t } }; return t } function S(e, t, r) { var n = T(r), o = "".concat(e.protocol, "://").concat(e.url, "/").concat("/" === t.charAt(0) ? t.substr(1) : t); return n.length && (o += "?".concat(n)), o } function T(e) { return Object.keys(e).map((function (t) { return f("%s=%s", t, (r = e[t], "[object Object]" === Object.prototype.toString.call(r) || "[object Array]" === Object.prototype.toString.call(r) ? JSON.stringify(e[t]) : e[t])); var r })).join("&") } function A(e) { return e.map((function (e) { return x(e) })) } function x(e) { var t = e.request.headers["x-algolia-api-key"] ? { "x-algolia-api-key": "*****" } : {}; return r(r({}, e), {}, { request: r(r({}, e.request), {}, { headers: r(r({}, e.request.headers), t) }) }) } var N = function (e) { var t = e.appId, n = function (e, t, r) { var n = { "x-algolia-api-key": r, "x-algolia-application-id": t }; return { headers: function () { return e === h.WithinHeaders ? n : {} }, queryParameters: function () { return e === h.WithinQueryParameters ? n : {} } } }(void 0 !== e.authMode ? e.authMode : h.WithinHeaders, t, e.apiKey), a = function (e) { var t = e.hostsCache, r = e.logger, n = e.requester, a = e.requestsCache, u = e.responsesCache, i = e.timeouts, s = e.userAgent, c = e.hosts, l = e.queryParameters, f = { hostsCache: t, logger: r, requester: n, requestsCache: a, responsesCache: u, timeouts: i, userAgent: s, headers: e.headers, queryParameters: l, hosts: c.map((function (e) { return b(e) })), read: function (e, t) { var r = d(t, f.timeouts.read), n = function () { return w(f, f.hosts.filter((function (e) { return 0 != (e.accept & m.Read) })), e, r) }; if (!0 !== (void 0 !== r.cacheable ? r.cacheable : e.cacheable)) return n(); var a = { request: e, mappedRequestOptions: r, transporter: { queryParameters: f.queryParameters, headers: f.headers } }; return f.responsesCache.get(a, (function () { return f.requestsCache.get(a, (function () { return f.requestsCache.set(a, n()).then((function (e) { return Promise.all([f.requestsCache.delete(a), e]) }), (function (e) { return Promise.all([f.requestsCache.delete(a), Promise.reject(e)]) })).then((function (e) { var t = o(e, 2); t[0]; return t[1] })) })) }), { miss: function (e) { return f.responsesCache.set(a, e) } }) }, write: function (e, t) { return w(f, f.hosts.filter((function (e) { return 0 != (e.accept & m.Write) })), e, d(t, f.timeouts.write)) } }; return f }(r(r({ hosts: [{ url: "".concat(t, "-dsn.algolia.net"), accept: m.Read }, { url: "".concat(t, ".algolia.net"), accept: m.Write }].concat(c([{ url: "".concat(t, "-1.algolianet.com") }, { url: "".concat(t, "-2.algolianet.com") }, { url: "".concat(t, "-3.algolianet.com") }])) }, e), {}, { headers: r(r(r({}, n.headers()), { "content-type": "application/x-www-form-urlencoded" }), e.headers), queryParameters: r(r({}, n.queryParameters()), e.queryParameters) })); return l({ transporter: a, appId: t, addAlgoliaAgent: function (e, t) { a.userAgent.add({ segment: e, version: t }) }, clearCache: function () { return Promise.all([a.requestsCache.clear(), a.responsesCache.clear()]).then((function () { })) } }, e.methods) }, C = function (e) { return function (t, r) { return t.method === O ? e.transporter.read(t, r) : e.transporter.write(t, r) } }, k = function (e) { return function (t) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n = { transporter: e.transporter, appId: e.appId, indexName: t }; return l(n, r.methods) } }, J = function (e) { return function (t, n) { var o = t.map((function (e) { return r(r({}, e), {}, { params: T(e.params || {}) }) })); return e.transporter.read({ method: P, path: "1/indexes/*/queries", data: { requests: o }, cacheable: !0 }, n) } }, E = function (e) { return function (t, o) { return Promise.all(t.map((function (t) { var a = t.params, u = a.facetName, i = a.facetQuery, s = n(a, ["facetName", "facetQuery"]); return k(e)(t.indexName, { methods: { searchForFacetValues: R } }).searchForFacetValues(u, i, r(r({}, o), s)) }))) } }, I = function (e) { return function (t, r, n) { return e.transporter.read({ method: P, path: f("1/answers/%s/prediction", e.indexName), data: { query: t, queryLanguages: r }, cacheable: !0 }, n) } }, F = function (e) { return function (t, r) { return e.transporter.read({ method: P, path: f("1/indexes/%s/query", e.indexName), data: { query: t }, cacheable: !0 }, r) } }, R = function (e) { return function (t, r, n) { return e.transporter.read({ method: P, path: f("1/indexes/%s/facets/%s/query", e.indexName, t), data: { facetQuery: r }, cacheable: !0 }, n) } }, D = 1, W = 2, H = 3; function Q(e, t, n) { var o, a = { appId: e, apiKey: t, timeouts: { connect: 1, read: 2, write: 30 }, requester: { send: function (e) { return new Promise((function (t) { var r = new XMLHttpRequest; r.open(e.method, e.url, !0), Object.keys(e.headers).forEach((function (t) { return r.setRequestHeader(t, e.headers[t]) })); var n, o = function (e, n) { return setTimeout((function () { r.abort(), t({ status: 0, content: n, isTimedOut: !0 }) }), 1e3 * e) }, a = o(e.connectTimeout, "Connection timeout"); r.onreadystatechange = function () { r.readyState > r.OPENED && void 0 === n && (clearTimeout(a), n = o(e.responseTimeout, "Socket timeout")) }, r.onerror = function () { 0 === r.status && (clearTimeout(a), clearTimeout(n), t({ content: r.responseText || "Network request failed", status: r.status, isTimedOut: !1 })) }, r.onload = function () { clearTimeout(a), clearTimeout(n), t({ content: r.responseText, status: r.status, isTimedOut: !1 }) }, r.send(e.data) })) } }, logger: (o = H, { debug: function (e, t) { return D >= o && console.debug(e, t), Promise.resolve() }, info: function (e, t) { return W >= o && console.info(e, t), Promise.resolve() }, error: function (e, t) { return console.error(e, t), Promise.resolve() } }), responsesCache: s(), requestsCache: s({ serializable: !1 }), hostsCache: i({ caches: [u({ key: "".concat("4.11.0", "-").concat(e) }), s()] }), userAgent: j("4.11.0").add({ segment: "Browser", version: "lite" }), authMode: h.WithinQueryParameters }; return N(r(r(r({}, a), n), {}, { methods: { search: J, searchForFacetValues: E, multipleQueries: J, multipleSearchForFacetValues: E, customRequest: C, initIndex: function (e) { return function (t) { return k(e)(t, { methods: { search: F, searchForFacetValues: R, findAnswers: I } }) } } } })) } return Q.version = "4.11.0", Q }));;/*!
 * autocomplete.js 0.38.1
 * https://github.com/algolia/autocomplete.js
 * Copyright 2021 Algolia, Inc. and other contributors; Licensed MIT
 */
!function (a, b) { "object" == typeof exports && "object" == typeof module ? module.exports = b() : "function" == typeof define && define.amd ? define([], b) : "object" == typeof exports ? exports.autocomplete = b() : a.autocomplete = b() }(this, function () {
    return function (a) { function b(d) { if (c[d]) return c[d].exports; var e = c[d] = { exports: {}, id: d, loaded: !1 }; return a[d].call(e.exports, e, e.exports, b), e.loaded = !0, e.exports } var c = {}; return b.m = a, b.c = c, b.p = "", b(0) }([function (a, b, c) { "use strict"; a.exports = c(1) }, function (a, b, c) { "use strict"; function d(a, b, c, d) { c = f.isArray(c) ? c : [].slice.call(arguments, 2); var j = e(a).each(function (a, f) { var j = e(f), k = new i({ el: j }), l = d || new h({ input: j, eventBus: k, dropdownMenuContainer: b.dropdownMenuContainer, hint: void 0 === b.hint || !!b.hint, minLength: b.minLength, autoselect: b.autoselect, autoselectOnBlur: b.autoselectOnBlur, tabAutocomplete: b.tabAutocomplete, openOnFocus: b.openOnFocus, templates: b.templates, debug: b.debug, clearOnSelected: b.clearOnSelected, cssClasses: b.cssClasses, datasets: c, keyboardShortcuts: b.keyboardShortcuts, appendTo: b.appendTo, autoWidth: b.autoWidth, ariaLabel: b.ariaLabel || f.getAttribute("aria-label") }); j.data(g, l) }); return j.autocomplete = {}, f.each(["open", "close", "getVal", "setVal", "destroy", "getWrapper"], function (a) { j.autocomplete[a] = function () { var b, c = arguments; return j.each(function (d, f) { var h = e(f).data(g); b = h[a].apply(h, c) }), b } }), j } var e = c(2); c(3).element = e; var f = c(4); f.isArray = e.isArray, f.isFunction = e.isFunction, f.isObject = e.isPlainObject, f.bind = e.proxy, f.each = function (a, b) { function c(a, c) { return b(c, a) } e.each(a, c) }, f.map = e.map, f.mixin = e.extend, f.Event = e.Event; var g = "aaAutocomplete", h = c(5), i = c(6); d.sources = h.sources, d.escapeHighlightedString = f.escapeHighlightedString; var j = "autocomplete" in window, k = window.autocomplete; d.noConflict = function () { return j ? window.autocomplete = k : delete window.autocomplete, d }, a.exports = d }, function (a, b) { !function (b, c) { a.exports = function (a) { var b = function () { function b(a) { return null == a ? String(a) : V[W.call(a)] || "object" } function c(a) { return "function" == b(a) } function d(a) { return null != a && a == a.window } function e(a) { return null != a && a.nodeType == a.DOCUMENT_NODE } function f(a) { return "object" == b(a) } function g(a) { return f(a) && !d(a) && Object.getPrototypeOf(a) == Object.prototype } function h(a) { var b = !!a && "length" in a && a.length, c = z.type(a); return "function" != c && !d(a) && ("array" == c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a) } function i(a) { return F.call(a, function (a) { return null != a }) } function j(a) { return a.length > 0 ? z.fn.concat.apply([], a) : a } function k(a) { return a.replace(/::/g, "/").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/_/g, "-").toLowerCase() } function l(a) { return a in J ? J[a] : J[a] = new RegExp("(^|\\s)" + a + "(\\s|$)") } function m(a, b) { return "number" != typeof b || K[k(a)] ? b : b + "px" } function n(a) { var b, c; return I[a] || (b = H.createElement(a), H.body.appendChild(b), c = getComputedStyle(b, "").getPropertyValue("display"), b.parentNode.removeChild(b), "none" == c && (c = "block"), I[a] = c), I[a] } function o(a) { return "children" in a ? G.call(a.children) : z.map(a.childNodes, function (a) { if (1 == a.nodeType) return a }) } function p(a, b) { var c, d = a ? a.length : 0; for (c = 0; c < d; c++)this[c] = a[c]; this.length = d, this.selector = b || "" } function q(a, b, c) { for (y in b) c && (g(b[y]) || $(b[y])) ? (g(b[y]) && !g(a[y]) && (a[y] = {}), $(b[y]) && !$(a[y]) && (a[y] = []), q(a[y], b[y], c)) : b[y] !== x && (a[y] = b[y]) } function r(a, b) { return null == b ? z(a) : z(a).filter(b) } function s(a, b, d, e) { return c(b) ? b.call(a, d, e) : b } function t(a, b, c) { null == c ? a.removeAttribute(b) : a.setAttribute(b, c) } function u(a, b) { var c = a.className || "", d = c && c.baseVal !== x; if (b === x) return d ? c.baseVal : c; d ? c.baseVal = b : a.className = b } function v(a) { try { return a ? "true" == a || "false" != a && ("null" == a ? null : +a + "" == a ? +a : /^[\[\{]/.test(a) ? z.parseJSON(a) : a) : a } catch (b) { return a } } function w(a, b) { b(a); for (var c = 0, d = a.childNodes.length; c < d; c++)w(a.childNodes[c], b) } var x, y, z, A, B, C, D = [], E = D.concat, F = D.filter, G = D.slice, H = a.document, I = {}, J = {}, K = { "column-count": 1, columns: 1, "font-weight": 1, "line-height": 1, opacity: 1, "z-index": 1, zoom: 1 }, L = /^\s*<(\w+|!)[^>]*>/, M = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, N = /^(?:body|html)$/i, O = ["val", "css", "html", "text", "data", "width", "height", "offset"], P = ["after", "prepend", "before", "append"], Q = H.createElement("table"), R = H.createElement("tr"), S = { tr: H.createElement("tbody"), tbody: Q, thead: Q, tfoot: Q, td: R, th: R, "*": H.createElement("div") }, T = /complete|loaded|interactive/, U = /^[\w-]*$/, V = {}, W = V.toString, X = {}, Y = H.createElement("div"), Z = { tabindex: "tabIndex", readonly: "readOnly", for: "htmlFor", class: "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, $ = Array.isArray || function (a) { return a instanceof Array }; return X.matches = function (a, b) { if (!b || !a || 1 !== a.nodeType) return !1; var c = a.matches || a.webkitMatchesSelector || a.mozMatchesSelector || a.oMatchesSelector || a.matchesSelector; if (c) return c.call(a, b); var d, e = a.parentNode, f = !e; return f && (e = Y).appendChild(a), d = ~X.qsa(e, b).indexOf(a), f && Y.removeChild(a), d }, B = function (a) { return a.replace(/-+(.)?/g, function (a, b) { return b ? b.toUpperCase() : "" }) }, C = function (a) { return F.call(a, function (b, c) { return a.indexOf(b) == c }) }, X.fragment = function (a, b, c) { var d, e, f; return M.test(a) && (d = z(H.createElement(RegExp.$1))), d || (a.replace && (a = a.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, "<$1></$2>")), b === x && (b = L.test(a) && RegExp.$1), b in S || (b = "*"), f = S[b], f.innerHTML = "" + a, d = z.each(G.call(f.childNodes), function () { f.removeChild(this) })), g(c) && (e = z(d), z.each(c, function (a, b) { O.indexOf(a) > -1 ? e[a](b) : e.attr(a, b) })), d }, X.Z = function (a, b) { return new p(a, b) }, X.isZ = function (a) { return a instanceof X.Z }, X.init = function (a, b) { var d; if (!a) return X.Z(); if ("string" == typeof a) if (a = a.trim(), "<" == a[0] && L.test(a)) d = X.fragment(a, RegExp.$1, b), a = null; else { if (b !== x) return z(b).find(a); d = X.qsa(H, a) } else { if (c(a)) return z(H).ready(a); if (X.isZ(a)) return a; if ($(a)) d = i(a); else if (f(a)) d = [a], a = null; else if (L.test(a)) d = X.fragment(a.trim(), RegExp.$1, b), a = null; else { if (b !== x) return z(b).find(a); d = X.qsa(H, a) } } return X.Z(d, a) }, z = function (a, b) { return X.init(a, b) }, z.extend = function (a) { var b, c = G.call(arguments, 1); return "boolean" == typeof a && (b = a, a = c.shift()), c.forEach(function (c) { q(a, c, b) }), a }, X.qsa = function (a, b) { var c, d = "#" == b[0], e = !d && "." == b[0], f = d || e ? b.slice(1) : b, g = U.test(f); return a.getElementById && g && d ? (c = a.getElementById(f)) ? [c] : [] : 1 !== a.nodeType && 9 !== a.nodeType && 11 !== a.nodeType ? [] : G.call(g && !d && a.getElementsByClassName ? e ? a.getElementsByClassName(f) : a.getElementsByTagName(b) : a.querySelectorAll(b)) }, z.contains = H.documentElement.contains ? function (a, b) { return a !== b && a.contains(b) } : function (a, b) { for (; b && (b = b.parentNode);)if (b === a) return !0; return !1 }, z.type = b, z.isFunction = c, z.isWindow = d, z.isArray = $, z.isPlainObject = g, z.isEmptyObject = function (a) { var b; for (b in a) return !1; return !0 }, z.isNumeric = function (a) { var b = Number(a), c = typeof a; return null != a && "boolean" != c && ("string" != c || a.length) && !isNaN(b) && isFinite(b) || !1 }, z.inArray = function (a, b, c) { return D.indexOf.call(b, a, c) }, z.camelCase = B, z.trim = function (a) { return null == a ? "" : String.prototype.trim.call(a) }, z.uuid = 0, z.support = {}, z.expr = {}, z.noop = function () { }, z.map = function (a, b) { var c, d, e, f = []; if (h(a)) for (d = 0; d < a.length; d++)null != (c = b(a[d], d)) && f.push(c); else for (e in a) null != (c = b(a[e], e)) && f.push(c); return j(f) }, z.each = function (a, b) { var c, d; if (h(a)) { for (c = 0; c < a.length; c++)if (b.call(a[c], c, a[c]) === !1) return a } else for (d in a) if (b.call(a[d], d, a[d]) === !1) return a; return a }, z.grep = function (a, b) { return F.call(a, b) }, a.JSON && (z.parseJSON = JSON.parse), z.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (a, b) { V["[object " + b + "]"] = b.toLowerCase() }), z.fn = { constructor: X.Z, length: 0, forEach: D.forEach, reduce: D.reduce, push: D.push, sort: D.sort, splice: D.splice, indexOf: D.indexOf, concat: function () { var a, b, c = []; for (a = 0; a < arguments.length; a++)b = arguments[a], c[a] = X.isZ(b) ? b.toArray() : b; return E.apply(X.isZ(this) ? this.toArray() : this, c) }, map: function (a) { return z(z.map(this, function (b, c) { return a.call(b, c, b) })) }, slice: function () { return z(G.apply(this, arguments)) }, ready: function (a) { return T.test(H.readyState) && H.body ? a(z) : H.addEventListener("DOMContentLoaded", function () { a(z) }, !1), this }, get: function (a) { return a === x ? G.call(this) : this[a >= 0 ? a : a + this.length] }, toArray: function () { return this.get() }, size: function () { return this.length }, remove: function () { return this.each(function () { null != this.parentNode && this.parentNode.removeChild(this) }) }, each: function (a) { return D.every.call(this, function (b, c) { return a.call(b, c, b) !== !1 }), this }, filter: function (a) { return c(a) ? this.not(this.not(a)) : z(F.call(this, function (b) { return X.matches(b, a) })) }, add: function (a, b) { return z(C(this.concat(z(a, b)))) }, is: function (a) { return this.length > 0 && X.matches(this[0], a) }, not: function (a) { var b = []; if (c(a) && a.call !== x) this.each(function (c) { a.call(this, c) || b.push(this) }); else { var d = "string" == typeof a ? this.filter(a) : h(a) && c(a.item) ? G.call(a) : z(a); this.forEach(function (a) { d.indexOf(a) < 0 && b.push(a) }) } return z(b) }, has: function (a) { return this.filter(function () { return f(a) ? z.contains(this, a) : z(this).find(a).size() }) }, eq: function (a) { return a === -1 ? this.slice(a) : this.slice(a, +a + 1) }, first: function () { var a = this[0]; return a && !f(a) ? a : z(a) }, last: function () { var a = this[this.length - 1]; return a && !f(a) ? a : z(a) }, find: function (a) { var b = this; return a ? "object" == typeof a ? z(a).filter(function () { var a = this; return D.some.call(b, function (b) { return z.contains(b, a) }) }) : 1 == this.length ? z(X.qsa(this[0], a)) : this.map(function () { return X.qsa(this, a) }) : z() }, closest: function (a, b) { var c = [], d = "object" == typeof a && z(a); return this.each(function (f, g) { for (; g && !(d ? d.indexOf(g) >= 0 : X.matches(g, a));)g = g !== b && !e(g) && g.parentNode; g && c.indexOf(g) < 0 && c.push(g) }), z(c) }, parents: function (a) { for (var b = [], c = this; c.length > 0;)c = z.map(c, function (a) { if ((a = a.parentNode) && !e(a) && b.indexOf(a) < 0) return b.push(a), a }); return r(b, a) }, parent: function (a) { return r(C(this.pluck("parentNode")), a) }, children: function (a) { return r(this.map(function () { return o(this) }), a) }, contents: function () { return this.map(function () { return this.contentDocument || G.call(this.childNodes) }) }, siblings: function (a) { return r(this.map(function (a, b) { return F.call(o(b.parentNode), function (a) { return a !== b }) }), a) }, empty: function () { return this.each(function () { this.innerHTML = "" }) }, pluck: function (a) { return z.map(this, function (b) { return b[a] }) }, show: function () { return this.each(function () { "none" == this.style.display && (this.style.display = ""), "none" == getComputedStyle(this, "").getPropertyValue("display") && (this.style.display = n(this.nodeName)) }) }, replaceWith: function (a) { return this.before(a).remove() }, wrap: function (a) { var b = c(a); if (this[0] && !b) var d = z(a).get(0), e = d.parentNode || this.length > 1; return this.each(function (c) { z(this).wrapAll(b ? a.call(this, c) : e ? d.cloneNode(!0) : d) }) }, wrapAll: function (a) { if (this[0]) { z(this[0]).before(a = z(a)); for (var b; (b = a.children()).length;)a = b.first(); z(a).append(this) } return this }, wrapInner: function (a) { var b = c(a); return this.each(function (c) { var d = z(this), e = d.contents(), f = b ? a.call(this, c) : a; e.length ? e.wrapAll(f) : d.append(f) }) }, unwrap: function () { return this.parent().each(function () { z(this).replaceWith(z(this).children()) }), this }, clone: function () { return this.map(function () { return this.cloneNode(!0) }) }, hide: function () { return this.css("display", "none") }, toggle: function (a) { return this.each(function () { var b = z(this); (a === x ? "none" == b.css("display") : a) ? b.show() : b.hide() }) }, prev: function (a) { return z(this.pluck("previousElementSibling")).filter(a || "*") }, next: function (a) { return z(this.pluck("nextElementSibling")).filter(a || "*") }, html: function (a) { return 0 in arguments ? this.each(function (b) { var c = this.innerHTML; z(this).empty().append(s(this, a, b, c)) }) : 0 in this ? this[0].innerHTML : null }, text: function (a) { return 0 in arguments ? this.each(function (b) { var c = s(this, a, b, this.textContent); this.textContent = null == c ? "" : "" + c }) : 0 in this ? this.pluck("textContent").join("") : null }, attr: function (a, b) { var c; return "string" != typeof a || 1 in arguments ? this.each(function (c) { if (1 === this.nodeType) if (f(a)) for (y in a) t(this, y, a[y]); else t(this, a, s(this, b, c, this.getAttribute(a))) }) : 0 in this && 1 == this[0].nodeType && null != (c = this[0].getAttribute(a)) ? c : x }, removeAttr: function (a) { return this.each(function () { 1 === this.nodeType && a.split(" ").forEach(function (a) { t(this, a) }, this) }) }, prop: function (a, b) { return a = Z[a] || a, 1 in arguments ? this.each(function (c) { this[a] = s(this, b, c, this[a]) }) : this[0] && this[0][a] }, removeProp: function (a) { return a = Z[a] || a, this.each(function () { delete this[a] }) }, data: function (a, b) { var c = "data-" + a.replace(/([A-Z])/g, "-$1").toLowerCase(), d = 1 in arguments ? this.attr(c, b) : this.attr(c); return null !== d ? v(d) : x }, val: function (a) { return 0 in arguments ? (null == a && (a = ""), this.each(function (b) { this.value = s(this, a, b, this.value) })) : this[0] && (this[0].multiple ? z(this[0]).find("option").filter(function () { return this.selected }).pluck("value") : this[0].value) }, offset: function (b) { if (b) return this.each(function (a) { var c = z(this), d = s(this, b, a, c.offset()), e = c.offsetParent().offset(), f = { top: d.top - e.top, left: d.left - e.left }; "static" == c.css("position") && (f.position = "relative"), c.css(f) }); if (!this.length) return null; if (H.documentElement !== this[0] && !z.contains(H.documentElement, this[0])) return { top: 0, left: 0 }; var c = this[0].getBoundingClientRect(); return { left: c.left + a.pageXOffset, top: c.top + a.pageYOffset, width: Math.round(c.width), height: Math.round(c.height) } }, css: function (a, c) { if (arguments.length < 2) { var d = this[0]; if ("string" == typeof a) { if (!d) return; return d.style[B(a)] || getComputedStyle(d, "").getPropertyValue(a) } if ($(a)) { if (!d) return; var e = {}, f = getComputedStyle(d, ""); return z.each(a, function (a, b) { e[b] = d.style[B(b)] || f.getPropertyValue(b) }), e } } var g = ""; if ("string" == b(a)) c || 0 === c ? g = k(a) + ":" + m(a, c) : this.each(function () { this.style.removeProperty(k(a)) }); else for (y in a) a[y] || 0 === a[y] ? g += k(y) + ":" + m(y, a[y]) + ";" : this.each(function () { this.style.removeProperty(k(y)) }); return this.each(function () { this.style.cssText += ";" + g }) }, index: function (a) { return a ? this.indexOf(z(a)[0]) : this.parent().children().indexOf(this[0]) }, hasClass: function (a) { return !!a && D.some.call(this, function (a) { return this.test(u(a)) }, l(a)) }, addClass: function (a) { return a ? this.each(function (b) { if ("className" in this) { A = []; var c = u(this); s(this, a, b, c).split(/\s+/g).forEach(function (a) { z(this).hasClass(a) || A.push(a) }, this), A.length && u(this, c + (c ? " " : "") + A.join(" ")) } }) : this }, removeClass: function (a) { return this.each(function (b) { if ("className" in this) { if (a === x) return u(this, ""); A = u(this), s(this, a, b, A).split(/\s+/g).forEach(function (a) { A = A.replace(l(a), " ") }), u(this, A.trim()) } }) }, toggleClass: function (a, b) { return a ? this.each(function (c) { var d = z(this); s(this, a, c, u(this)).split(/\s+/g).forEach(function (a) { (b === x ? !d.hasClass(a) : b) ? d.addClass(a) : d.removeClass(a) }) }) : this }, scrollTop: function (a) { if (this.length) { var b = "scrollTop" in this[0]; return a === x ? b ? this[0].scrollTop : this[0].pageYOffset : this.each(b ? function () { this.scrollTop = a } : function () { this.scrollTo(this.scrollX, a) }) } }, scrollLeft: function (a) { if (this.length) { var b = "scrollLeft" in this[0]; return a === x ? b ? this[0].scrollLeft : this[0].pageXOffset : this.each(b ? function () { this.scrollLeft = a } : function () { this.scrollTo(a, this.scrollY) }) } }, position: function () { if (this.length) { var a = this[0], b = this.offsetParent(), c = this.offset(), d = N.test(b[0].nodeName) ? { top: 0, left: 0 } : b.offset(); return c.top -= parseFloat(z(a).css("margin-top")) || 0, c.left -= parseFloat(z(a).css("margin-left")) || 0, d.top += parseFloat(z(b[0]).css("border-top-width")) || 0, d.left += parseFloat(z(b[0]).css("border-left-width")) || 0, { top: c.top - d.top, left: c.left - d.left } } }, offsetParent: function () { return this.map(function () { for (var a = this.offsetParent || H.body; a && !N.test(a.nodeName) && "static" == z(a).css("position");)a = a.offsetParent; return a }) } }, z.fn.detach = z.fn.remove, ["width", "height"].forEach(function (a) { var b = a.replace(/./, function (a) { return a[0].toUpperCase() }); z.fn[a] = function (c) { var f, g = this[0]; return c === x ? d(g) ? g["inner" + b] : e(g) ? g.documentElement["scroll" + b] : (f = this.offset()) && f[a] : this.each(function (b) { g = z(this), g.css(a, s(this, c, b, g[a]())) }) } }), P.forEach(function (c, d) { var e = d % 2; z.fn[c] = function () { var c, f, g = z.map(arguments, function (a) { var d = []; return c = b(a), "array" == c ? (a.forEach(function (a) { return a.nodeType !== x ? d.push(a) : z.zepto.isZ(a) ? d = d.concat(a.get()) : void (d = d.concat(X.fragment(a))) }), d) : "object" == c || null == a ? a : X.fragment(a) }), h = this.length > 1; return g.length < 1 ? this : this.each(function (b, c) { f = e ? c : c.parentNode, c = 0 == d ? c.nextSibling : 1 == d ? c.firstChild : 2 == d ? c : null; var i = z.contains(H.documentElement, f); g.forEach(function (b) { if (h) b = b.cloneNode(!0); else if (!f) return z(b).remove(); f.insertBefore(b, c), i && w(b, function (b) { if (!(null == b.nodeName || "SCRIPT" !== b.nodeName.toUpperCase() || b.type && "text/javascript" !== b.type || b.src)) { var c = b.ownerDocument ? b.ownerDocument.defaultView : a; c.eval.call(c, b.innerHTML) } }) }) }) }, z.fn[e ? c + "To" : "insert" + (d ? "Before" : "After")] = function (a) { return z(a)[c](this), this } }), X.Z.prototype = p.prototype = z.fn, X.uniq = C, X.deserializeValue = v, z.zepto = X, z }(); return function (b) { function c(a) { return a._zid || (a._zid = n++) } function d(a, b, d, g) { if (b = e(b), b.ns) var h = f(b.ns); return (r[c(a)] || []).filter(function (a) { return a && (!b.e || a.e == b.e) && (!b.ns || h.test(a.ns)) && (!d || c(a.fn) === c(d)) && (!g || a.sel == g) }) } function e(a) { var b = ("" + a).split("."); return { e: b[0], ns: b.slice(1).sort().join(" ") } } function f(a) { return new RegExp("(?:^| )" + a.replace(" ", " .* ?") + "(?: |$)") } function g(a, b) { return a.del && !t && a.e in u || !!b } function h(a) { return v[a] || t && u[a] || a } function i(a, d, f, i, j, l, n) { var o = c(a), p = r[o] || (r[o] = []); d.split(/\s/).forEach(function (c) { if ("ready" == c) return b(document).ready(f); var d = e(c); d.fn = f, d.sel = j, d.e in v && (f = function (a) { var c = a.relatedTarget; if (!c || c !== this && !b.contains(this, c)) return d.fn.apply(this, arguments) }), d.del = l; var o = l || f; d.proxy = function (b) { if (b = k(b), !b.isImmediatePropagationStopped()) { try { var c = Object.getOwnPropertyDescriptor(b, "data"); c && !c.writable || (b.data = i) } catch (b) { } var d = o.apply(a, b._args == m ? [b] : [b].concat(b._args)); return d === !1 && (b.preventDefault(), b.stopPropagation()), d } }, d.i = p.length, p.push(d), "addEventListener" in a && a.addEventListener(h(d.e), d.proxy, g(d, n)) }) } function j(a, b, e, f, i) { var j = c(a); (b || "").split(/\s/).forEach(function (b) { d(a, b, e, f).forEach(function (b) { delete r[j][b.i], "removeEventListener" in a && a.removeEventListener(h(b.e), b.proxy, g(b, i)) }) }) } function k(a, c) { if (c || !a.isDefaultPrevented) { c || (c = a), b.each(z, function (b, d) { var e = c[b]; a[b] = function () { return this[d] = w, e && e.apply(c, arguments) }, a[d] = x }); try { a.timeStamp || (a.timeStamp = Date.now()) } catch (a) { } (c.defaultPrevented !== m ? c.defaultPrevented : "returnValue" in c ? c.returnValue === !1 : c.getPreventDefault && c.getPreventDefault()) && (a.isDefaultPrevented = w) } return a } function l(a) { var b, c = { originalEvent: a }; for (b in a) y.test(b) || a[b] === m || (c[b] = a[b]); return k(c, a) } var m, n = 1, o = Array.prototype.slice, p = b.isFunction, q = function (a) { return "string" == typeof a }, r = {}, s = {}, t = "onfocusin" in a, u = { focus: "focusin", blur: "focusout" }, v = { mouseenter: "mouseover", mouseleave: "mouseout" }; s.click = s.mousedown = s.mouseup = s.mousemove = "MouseEvents", b.event = { add: i, remove: j }, b.proxy = function (a, d) { var e = 2 in arguments && o.call(arguments, 2); if (p(a)) { var f = function () { return a.apply(d, e ? e.concat(o.call(arguments)) : arguments) }; return f._zid = c(a), f } if (q(d)) return e ? (e.unshift(a[d], a), b.proxy.apply(null, e)) : b.proxy(a[d], a); throw new TypeError("expected function") }, b.fn.bind = function (a, b, c) { return this.on(a, b, c) }, b.fn.unbind = function (a, b) { return this.off(a, b) }, b.fn.one = function (a, b, c, d) { return this.on(a, b, c, d, 1) }; var w = function () { return !0 }, x = function () { return !1 }, y = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/, z = { preventDefault: "isDefaultPrevented", stopImmediatePropagation: "isImmediatePropagationStopped", stopPropagation: "isPropagationStopped" }; b.fn.delegate = function (a, b, c) { return this.on(b, a, c) }, b.fn.undelegate = function (a, b, c) { return this.off(b, a, c) }, b.fn.live = function (a, c) { return b(document.body).delegate(this.selector, a, c), this }, b.fn.die = function (a, c) { return b(document.body).undelegate(this.selector, a, c), this }, b.fn.on = function (a, c, d, e, f) { var g, h, k = this; return a && !q(a) ? (b.each(a, function (a, b) { k.on(a, c, d, b, f) }), k) : (q(c) || p(e) || e === !1 || (e = d, d = c, c = m), e !== m && d !== !1 || (e = d, d = m), e === !1 && (e = x), k.each(function (k, m) { f && (g = function (a) { return j(m, a.type, e), e.apply(this, arguments) }), c && (h = function (a) { var d, f = b(a.target).closest(c, m).get(0); if (f && f !== m) return d = b.extend(l(a), { currentTarget: f, liveFired: m }), (g || e).apply(f, [d].concat(o.call(arguments, 1))) }), i(m, a, e, d, c, h || g) })) }, b.fn.off = function (a, c, d) { var e = this; return a && !q(a) ? (b.each(a, function (a, b) { e.off(a, c, b) }), e) : (q(c) || p(d) || d === !1 || (d = c, c = m), d === !1 && (d = x), e.each(function () { j(this, a, d, c) })) }, b.fn.trigger = function (a, c) { return a = q(a) || b.isPlainObject(a) ? b.Event(a) : k(a), a._args = c, this.each(function () { a.type in u && "function" == typeof this[a.type] ? this[a.type]() : "dispatchEvent" in this ? this.dispatchEvent(a) : b(this).triggerHandler(a, c) }) }, b.fn.triggerHandler = function (a, c) { var e, f; return this.each(function (g, h) { e = l(q(a) ? b.Event(a) : a), e._args = c, e.target = h, b.each(d(h, a.type || a), function (a, b) { if (f = b.proxy(e), e.isImmediatePropagationStopped()) return !1 }) }), f }, "focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function (a) { b.fn[a] = function (b) { return 0 in arguments ? this.bind(a, b) : this.trigger(a) } }), b.Event = function (a, b) { q(a) || (b = a, a = b.type); var c = document.createEvent(s[a] || "Events"), d = !0; if (b) for (var e in b) "bubbles" == e ? d = !!b[e] : c[e] = b[e]; return c.initEvent(a, d, !0), k(c) } }(b), function (a) { var b, c = []; a.fn.remove = function () { return this.each(function () { this.parentNode && ("IMG" === this.tagName && (c.push(this), this.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", b && clearTimeout(b), b = setTimeout(function () { c = [] }, 6e4)), this.parentNode.removeChild(this)) }) } }(b), function (a) { function b(b, d) { var i = b[h], j = i && e[i]; if (void 0 === d) return j || c(b); if (j) { if (d in j) return j[d]; var k = g(d); if (k in j) return j[k] } return f.call(a(b), d) } function c(b, c, f) { var i = b[h] || (b[h] = ++a.uuid), j = e[i] || (e[i] = d(b)); return void 0 !== c && (j[g(c)] = f), j } function d(b) { var c = {}; return a.each(b.attributes || i, function (b, d) { 0 == d.name.indexOf("data-") && (c[g(d.name.replace("data-", ""))] = a.zepto.deserializeValue(d.value)) }), c } var e = {}, f = a.fn.data, g = a.camelCase, h = a.expando = "Zepto" + +new Date, i = []; a.fn.data = function (d, e) { return void 0 === e ? a.isPlainObject(d) ? this.each(function (b, e) { a.each(d, function (a, b) { c(e, a, b) }) }) : 0 in this ? b(this[0], d) : void 0 : this.each(function () { c(this, d, e) }) }, a.data = function (b, c, d) { return a(b).data(c, d) }, a.hasData = function (b) { var c = b[h], d = c && e[c]; return !!d && !a.isEmptyObject(d) }, a.fn.removeData = function (b) { return "string" == typeof b && (b = b.split(/\s+/)), this.each(function () { var c = this[h], d = c && e[c]; d && a.each(b || d, function (a) { delete d[b ? g(this) : a] }) }) }, ["remove", "empty"].forEach(function (b) { var c = a.fn[b]; a.fn[b] = function () { var a = this.find("*"); return "remove" === b && (a = a.add(this)), a.removeData(), c.call(this) } }) }(b), b }(b) }(window) }, function (a, b) { "use strict"; a.exports = { element: null } }, function (a, b, c) { "use strict"; function d(a) { return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") } var e = c(3); a.exports = { isArray: null, isFunction: null, isObject: null, bind: null, each: null, map: null, mixin: null, isMsie: function (a) { if (void 0 === a && (a = navigator.userAgent), /(msie|trident)/i.test(a)) { var b = a.match(/(msie |rv:)(\d+(.\d+)?)/i); if (b) return b[2] } return !1 }, escapeRegExChars: function (a) { return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") }, isNumber: function (a) { return "number" == typeof a }, toStr: function (a) { return void 0 === a || null === a ? "" : a + "" }, cloneDeep: function (a) { var b = this.mixin({}, a), c = this; return this.each(b, function (a, d) { a && (c.isArray(a) ? b[d] = [].concat(a) : c.isObject(a) && (b[d] = c.cloneDeep(a))) }), b }, error: function (a) { throw new Error(a) }, every: function (a, b) { var c = !0; return a ? (this.each(a, function (d, e) { c && (c = b.call(null, d, e, a) && c) }), !!c) : c }, any: function (a, b) { var c = !1; return a ? (this.each(a, function (d, e) { if (b.call(null, d, e, a)) return c = !0, !1 }), c) : c }, getUniqueId: function () { var a = 0; return function () { return a++ } }(), templatify: function (a) { if (this.isFunction(a)) return a; var b = e.element(a); return "SCRIPT" === b.prop("tagName") ? function () { return b.text() } : function () { return String(a) } }, defer: function (a) { setTimeout(a, 0) }, noop: function () { }, formatPrefix: function (a, b) { return b ? "" : a + "-" }, className: function (a, b, c) { return (c ? "" : ".") + a + b }, escapeHighlightedString: function (a, b, c) { b = b || "<em>"; var e = document.createElement("div"); e.appendChild(document.createTextNode(b)), c = c || "</em>"; var f = document.createElement("div"); f.appendChild(document.createTextNode(c)); var g = document.createElement("div"); return g.appendChild(document.createTextNode(a)), g.innerHTML.replace(RegExp(d(e.innerHTML), "g"), b).replace(RegExp(d(f.innerHTML), "g"), c) } } }, function (a, b, c) {
        "use strict"; function d(a) { var b, c; if (a = a || {}, a.input || i.error("missing input"), this.isActivated = !1, this.debug = !!a.debug, this.autoselect = !!a.autoselect, this.autoselectOnBlur = !!a.autoselectOnBlur, this.openOnFocus = !!a.openOnFocus, this.minLength = i.isNumber(a.minLength) ? a.minLength : 1, this.autoWidth = void 0 === a.autoWidth || !!a.autoWidth, this.clearOnSelected = !!a.clearOnSelected, this.tabAutocomplete = void 0 === a.tabAutocomplete || !!a.tabAutocomplete, a.hint = !!a.hint, a.hint && a.appendTo) throw new Error("[autocomplete.js] hint and appendTo options can't be used at the same time"); this.css = a.css = i.mixin({}, o, a.appendTo ? o.appendTo : {}), this.cssClasses = a.cssClasses = i.mixin({}, o.defaultClasses, a.cssClasses || {}), this.cssClasses.prefix = a.cssClasses.formattedPrefix = i.formatPrefix(this.cssClasses.prefix, this.cssClasses.noPrefix), this.listboxId = a.listboxId = [this.cssClasses.root, "listbox", i.getUniqueId()].join("-"); var f = e(a); this.$node = f.wrapper; var g = this.$input = f.input; b = f.menu, c = f.hint, a.dropdownMenuContainer && j.element(a.dropdownMenuContainer).css("position", "relative").append(b.css("top", "0")), g.on("blur.aa", function (a) { var c = document.activeElement; i.isMsie() && (b[0] === c || b[0].contains(c)) && (a.preventDefault(), a.stopImmediatePropagation(), i.defer(function () { g.focus() })) }), b.on("mousedown.aa", function (a) { a.preventDefault() }), this.eventBus = a.eventBus || new k({ el: g }), this.dropdown = new d.Dropdown({ appendTo: a.appendTo, wrapper: this.$node, menu: b, datasets: a.datasets, templates: a.templates, cssClasses: a.cssClasses, minLength: this.minLength }).onSync("suggestionClicked", this._onSuggestionClicked, this).onSync("cursorMoved", this._onCursorMoved, this).onSync("cursorRemoved", this._onCursorRemoved, this).onSync("opened", this._onOpened, this).onSync("closed", this._onClosed, this).onSync("shown", this._onShown, this).onSync("empty", this._onEmpty, this).onSync("redrawn", this._onRedrawn, this).onAsync("datasetRendered", this._onDatasetRendered, this), this.input = new d.Input({ input: g, hint: c }).onSync("focused", this._onFocused, this).onSync("blurred", this._onBlurred, this).onSync("enterKeyed", this._onEnterKeyed, this).onSync("tabKeyed", this._onTabKeyed, this).onSync("escKeyed", this._onEscKeyed, this).onSync("upKeyed", this._onUpKeyed, this).onSync("downKeyed", this._onDownKeyed, this).onSync("leftKeyed", this._onLeftKeyed, this).onSync("rightKeyed", this._onRightKeyed, this).onSync("queryChanged", this._onQueryChanged, this).onSync("whitespaceChanged", this._onWhitespaceChanged, this), this._bindKeyboardShortcuts(a), this._setLanguageDirection() } function e(a) { var b, c, d, e; b = j.element(a.input), c = j.element(n.wrapper.replace("%ROOT%", a.cssClasses.root)).css(a.css.wrapper), a.appendTo || "block" !== b.css("display") || "table" !== b.parent().css("display") || c.css("display", "table-cell"); var g = n.dropdown.replace("%PREFIX%", a.cssClasses.prefix).replace("%DROPDOWN_MENU%", a.cssClasses.dropdownMenu); d = j.element(g).css(a.css.dropdown).attr({ role: "listbox", id: a.listboxId }), a.templates && a.templates.dropdownMenu && d.html(i.templatify(a.templates.dropdownMenu)()), e = b.clone().css(a.css.hint).css(f(b)), e.val("").addClass(i.className(a.cssClasses.prefix, a.cssClasses.hint, !0)).removeAttr("id name placeholder required").prop("readonly", !0).attr({ "aria-hidden": "true", autocomplete: "off", spellcheck: "false", tabindex: -1 }), e.removeData && e.removeData(), b.data(h, { "aria-autocomplete": b.attr("aria-autocomplete"), "aria-expanded": b.attr("aria-expanded"), "aria-owns": b.attr("aria-owns"), autocomplete: b.attr("autocomplete"), dir: b.attr("dir"), role: b.attr("role"), spellcheck: b.attr("spellcheck"), style: b.attr("style"), type: b.attr("type") }), b.addClass(i.className(a.cssClasses.prefix, a.cssClasses.input, !0)).attr({ autocomplete: "off", spellcheck: !1, role: "combobox", "aria-autocomplete": a.datasets && a.datasets[0] && a.datasets[0].displayKey ? "both" : "list", "aria-expanded": "false", "aria-label": a.ariaLabel, "aria-owns": a.listboxId }).css(a.hint ? a.css.input : a.css.inputWithNoHint); try { b.attr("dir") || b.attr("dir", "auto") } catch (a) { } return c = a.appendTo ? c.appendTo(j.element(a.appendTo).eq(0)).eq(0) : b.wrap(c).parent(), c.prepend(a.hint ? e : null).append(d), { wrapper: c, input: b, hint: e, menu: d } } function f(a) { return { backgroundAttachment: a.css("background-attachment"), backgroundClip: a.css("background-clip"), backgroundColor: a.css("background-color"), backgroundImage: a.css("background-image"), backgroundOrigin: a.css("background-origin"), backgroundPosition: a.css("background-position"), backgroundRepeat: a.css("background-repeat"), backgroundSize: a.css("background-size") } } function g(a, b) { var c = a.find(i.className(b.prefix, b.input)); i.each(c.data(h), function (a, b) { void 0 === a ? c.removeAttr(b) : c.attr(b, a) }), c.detach().removeClass(i.className(b.prefix, b.input, !0)).insertAfter(a), c.removeData && c.removeData(h), a.remove() } var h = "aaAttrs", i = c(4), j = c(3), k = c(6), l = c(7), m = c(16), n = c(18), o = c(19); i.mixin(d.prototype, {
            _bindKeyboardShortcuts: function (a) { if (a.keyboardShortcuts) { var b = this.$input, c = []; i.each(a.keyboardShortcuts, function (a) { "string" == typeof a && (a = a.toUpperCase().charCodeAt(0)), c.push(a) }), j.element(document).keydown(function (a) { var d = a.target || a.srcElement, e = d.tagName; if (!d.isContentEditable && "INPUT" !== e && "SELECT" !== e && "TEXTAREA" !== e) { var f = a.which || a.keyCode; c.indexOf(f) !== -1 && (b.focus(), a.stopPropagation(), a.preventDefault()) } }) } }, _onSuggestionClicked: function (a, b) { var c, d = { selectionMethod: "click" }; (c = this.dropdown.getDatumForSuggestion(b)) && this._select(c, d) }, _onCursorMoved: function (a, b) { var c = this.dropdown.getDatumForCursor(), d = this.dropdown.getCurrentCursor().attr("id"); this.input.setActiveDescendant(d), c && (b && this.input.setInputValue(c.value, !0), this.eventBus.trigger("cursorchanged", c.raw, c.datasetName)) }, _onCursorRemoved: function () { this.input.resetInputValue(), this._updateHint(), this.eventBus.trigger("cursorremoved") }, _onDatasetRendered: function () { this._updateHint(), this.eventBus.trigger("updated") }, _onOpened: function () { this._updateHint(), this.input.expand(), this.eventBus.trigger("opened") }, _onEmpty: function () { this.eventBus.trigger("empty") }, _onRedrawn: function () { this.$node.css("top", "0px"), this.$node.css("left", "0px"); var a = this.$input[0].getBoundingClientRect(); this.autoWidth && this.$node.css("width", a.width + "px"); var b = this.$node[0].getBoundingClientRect(), c = a.bottom - b.top; this.$node.css("top", c + "px"); var d = a.left - b.left; this.$node.css("left", d + "px"), this.eventBus.trigger("redrawn") }, _onShown: function () { this.eventBus.trigger("shown"), this.autoselect && this.dropdown.cursorTopSuggestion() }, _onClosed: function () { this.input.clearHint(), this.input.removeActiveDescendant(), this.input.collapse(), this.eventBus.trigger("closed") }, _onFocused: function () { if (this.isActivated = !0, this.openOnFocus) { var a = this.input.getQuery(); a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.empty(), this.dropdown.open() } }, _onBlurred: function () { var a, b; a = this.dropdown.getDatumForCursor(), b = this.dropdown.getDatumForTopSuggestion(); var c = { selectionMethod: "blur" }; this.debug || (this.autoselectOnBlur && a ? this._select(a, c) : this.autoselectOnBlur && b ? this._select(b, c) : (this.isActivated = !1, this.dropdown.empty(), this.dropdown.close())) }, _onEnterKeyed: function (a, b) {
                var c, d
                ; c = this.dropdown.getDatumForCursor(), d = this.dropdown.getDatumForTopSuggestion(); var e = { selectionMethod: "enterKey" }; c ? (this._select(c, e), b.preventDefault()) : this.autoselect && d && (this._select(d, e), b.preventDefault())
            }, _onTabKeyed: function (a, b) { if (!this.tabAutocomplete) return void this.dropdown.close(); var c, d = { selectionMethod: "tabKey" }; (c = this.dropdown.getDatumForCursor()) ? (this._select(c, d), b.preventDefault()) : this._autocomplete(!0) }, _onEscKeyed: function () { this.dropdown.close(), this.input.resetInputValue() }, _onUpKeyed: function () { var a = this.input.getQuery(); this.dropdown.isEmpty && a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.moveCursorUp(), this.dropdown.open() }, _onDownKeyed: function () { var a = this.input.getQuery(); this.dropdown.isEmpty && a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.moveCursorDown(), this.dropdown.open() }, _onLeftKeyed: function () { "rtl" === this.dir && this._autocomplete() }, _onRightKeyed: function () { "ltr" === this.dir && this._autocomplete() }, _onQueryChanged: function (a, b) { this.input.clearHintIfInvalid(), b.length >= this.minLength ? this.dropdown.update(b) : this.dropdown.empty(), this.dropdown.open(), this._setLanguageDirection() }, _onWhitespaceChanged: function () { this._updateHint(), this.dropdown.open() }, _setLanguageDirection: function () { var a = this.input.getLanguageDirection(); this.dir !== a && (this.dir = a, this.$node.css("direction", a), this.dropdown.setLanguageDirection(a)) }, _updateHint: function () { var a, b, c, d, e, f; a = this.dropdown.getDatumForTopSuggestion(), a && this.dropdown.isVisible() && !this.input.hasOverflow() ? (b = this.input.getInputValue(), c = l.normalizeQuery(b), d = i.escapeRegExChars(c), e = new RegExp("^(?:" + d + ")(.+$)", "i"), f = e.exec(a.value), f ? this.input.setHint(b + f[1]) : this.input.clearHint()) : this.input.clearHint() }, _autocomplete: function (a) { var b, c, d, e; b = this.input.getHint(), c = this.input.getQuery(), d = a || this.input.isCursorAtEnd(), b && c !== b && d && (e = this.dropdown.getDatumForTopSuggestion(), e && this.input.setInputValue(e.value), this.eventBus.trigger("autocompleted", e.raw, e.datasetName)) }, _select: function (a, b) { void 0 !== a.value && this.input.setQuery(a.value), this.clearOnSelected ? this.setVal("") : this.input.setInputValue(a.value, !0), this._setLanguageDirection(), this.eventBus.trigger("selected", a.raw, a.datasetName, b).isDefaultPrevented() === !1 && (this.dropdown.close(), i.defer(i.bind(this.dropdown.empty, this.dropdown))) }, open: function () { if (!this.isActivated) { var a = this.input.getInputValue(); a.length >= this.minLength ? this.dropdown.update(a) : this.dropdown.empty() } this.dropdown.open() }, close: function () { this.dropdown.close() }, setVal: function (a) { a = i.toStr(a), this.isActivated ? this.input.setInputValue(a) : (this.input.setQuery(a), this.input.setInputValue(a, !0)), this._setLanguageDirection() }, getVal: function () { return this.input.getQuery() }, destroy: function () { this.input.destroy(), this.dropdown.destroy(), g(this.$node, this.cssClasses), this.$node = null }, getWrapper: function () { return this.dropdown.$container[0] }
        }), d.Dropdown = m, d.Input = l, d.sources = c(20), a.exports = d
    }, function (a, b, c) { "use strict"; function d(a) { a && a.el || e.error("EventBus initialized without el"), this.$el = f.element(a.el) } var e = c(4), f = c(3); e.mixin(d.prototype, { trigger: function (a, b, c, d) { var f = e.Event("autocomplete:" + a); return this.$el.trigger(f, [b, c, d]), f } }), a.exports = d }, function (a, b, c) { "use strict"; function d(a) { var b, c, d, f, g = this; a = a || {}, a.input || i.error("input is missing"), b = i.bind(this._onBlur, this), c = i.bind(this._onFocus, this), d = i.bind(this._onKeydown, this), f = i.bind(this._onInput, this), this.$hint = j.element(a.hint), this.$input = j.element(a.input).on("blur.aa", b).on("focus.aa", c).on("keydown.aa", d), 0 === this.$hint.length && (this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = i.noop), i.isMsie() ? this.$input.on("keydown.aa keypress.aa cut.aa paste.aa", function (a) { h[a.which || a.keyCode] || i.defer(i.bind(g._onInput, g, a)) }) : this.$input.on("input.aa", f), this.query = this.$input.val(), this.$overflowHelper = e(this.$input) } function e(a) { return j.element('<pre aria-hidden="true"></pre>').css({ position: "absolute", visibility: "hidden", whiteSpace: "pre", fontFamily: a.css("font-family"), fontSize: a.css("font-size"), fontStyle: a.css("font-style"), fontVariant: a.css("font-variant"), fontWeight: a.css("font-weight"), wordSpacing: a.css("word-spacing"), letterSpacing: a.css("letter-spacing"), textIndent: a.css("text-indent"), textRendering: a.css("text-rendering"), textTransform: a.css("text-transform") }).insertAfter(a) } function f(a, b) { return d.normalizeQuery(a) === d.normalizeQuery(b) } function g(a) { return a.altKey || a.ctrlKey || a.metaKey || a.shiftKey } var h; h = { 9: "tab", 27: "esc", 37: "left", 39: "right", 13: "enter", 38: "up", 40: "down" }; var i = c(4), j = c(3), k = c(8); d.normalizeQuery = function (a) { return (a || "").replace(/^\s*/g, "").replace(/\s{2,}/g, " ") }, i.mixin(d.prototype, k, { _onBlur: function () { this.resetInputValue(), this.$input.removeAttr("aria-activedescendant"), this.trigger("blurred") }, _onFocus: function () { this.trigger("focused") }, _onKeydown: function (a) { var b = h[a.which || a.keyCode]; this._managePreventDefault(b, a), b && this._shouldTrigger(b, a) && this.trigger(b + "Keyed", a) }, _onInput: function () { this._checkInputValue() }, _managePreventDefault: function (a, b) { var c, d, e; switch (a) { case "tab": d = this.getHint(), e = this.getInputValue(), c = d && d !== e && !g(b); break; case "up": case "down": c = !g(b); break; default: c = !1 }c && b.preventDefault() }, _shouldTrigger: function (a, b) { var c; switch (a) { case "tab": c = !g(b); break; default: c = !0 }return c }, _checkInputValue: function () { var a, b, c; a = this.getInputValue(), b = f(a, this.query), c = !(!b || !this.query) && this.query.length !== a.length, this.query = a, b ? c && this.trigger("whitespaceChanged", this.query) : this.trigger("queryChanged", this.query) }, focus: function () { this.$input.focus() }, blur: function () { this.$input.blur() }, getQuery: function () { return this.query }, setQuery: function (a) { this.query = a }, getInputValue: function () { return this.$input.val() }, setInputValue: function (a, b) { void 0 === a && (a = this.query), this.$input.val(a), b ? this.clearHint() : this._checkInputValue() }, expand: function () { this.$input.attr("aria-expanded", "true") }, collapse: function () { this.$input.attr("aria-expanded", "false") }, setActiveDescendant: function (a) { this.$input.attr("aria-activedescendant", a) }, removeActiveDescendant: function () { this.$input.removeAttr("aria-activedescendant") }, resetInputValue: function () { this.setInputValue(this.query, !0) }, getHint: function () { return this.$hint.val() }, setHint: function (a) { this.$hint.val(a) }, clearHint: function () { this.setHint("") }, clearHintIfInvalid: function () { var a, b, c, d; a = this.getInputValue(), b = this.getHint(), c = a !== b && 0 === b.indexOf(a), (d = "" !== a && c && !this.hasOverflow()) || this.clearHint() }, getLanguageDirection: function () { return (this.$input.css("direction") || "ltr").toLowerCase() }, hasOverflow: function () { var a = this.$input.width() - 2; return this.$overflowHelper.text(this.getInputValue()), this.$overflowHelper.width() >= a }, isCursorAtEnd: function () { var a, b, c; return a = this.$input.val().length, b = this.$input[0].selectionStart, i.isNumber(b) ? b === a : !document.selection || (c = document.selection.createRange(), c.moveStart("character", -a), a === c.text.length) }, destroy: function () { this.$hint.off(".aa"), this.$input.off(".aa"), this.$hint = this.$input = this.$overflowHelper = null } }), a.exports = d }, function (a, b, c) { "use strict"; function d(a, b, c, d) { var e; if (!c) return this; for (b = b.split(l), c = d ? j(c, d) : c, this._callbacks = this._callbacks || {}; e = b.shift();)this._callbacks[e] = this._callbacks[e] || { sync: [], async: [] }, this._callbacks[e][a].push(c); return this } function e(a, b, c) { return d.call(this, "async", a, b, c) } function f(a, b, c) { return d.call(this, "sync", a, b, c) } function g(a) { var b; if (!this._callbacks) return this; for (a = a.split(l); b = a.shift();)delete this._callbacks[b]; return this } function h(a) { var b, c, d, e, f; if (!this._callbacks) return this; for (a = a.split(l), d = [].slice.call(arguments, 1); (b = a.shift()) && (c = this._callbacks[b]);)e = i(c.sync, this, [b].concat(d)), f = i(c.async, this, [b].concat(d)), e() && k(f); return this } function i(a, b, c) { function d() { for (var d, e = 0, f = a.length; !d && e < f; e += 1)d = a[e].apply(b, c) === !1; return !d } return d } function j(a, b) { return a.bind ? a.bind(b) : function () { a.apply(b, [].slice.call(arguments, 0)) } } var k = c(9), l = /\s+/; a.exports = { onSync: f, onAsync: e, off: g, trigger: h } }, function (a, b, c) { "use strict"; function d() { h && i && (h = !1, i.length ? m = i.concat(m) : l = -1, m.length && e()) } function e() { if (!h) { n = !1, h = !0; for (var a = m.length, b = setTimeout(d); a;) { for (i = m, m = []; i && ++l < a;)i[l].run(); l = -1, a = m.length } i = null, l = -1, h = !1, clearTimeout(b) } } function f(a, b) { this.fun = a, this.array = b } function g(a) { var b = new Array(arguments.length - 1); if (arguments.length > 1) for (var c = 1; c < arguments.length; c++)b[c - 1] = arguments[c]; m.push(new f(a, b)), n || h || (n = !0, j()) } for (var h, i, j, k = [c(10), c(12), c(13), c(14), c(15)], l = -1, m = [], n = !1, o = -1, p = k.length; ++o < p;)if (k[o] && k[o].test && k[o].test()) { j = k[o].install(e); break } f.prototype.run = function () { var a = this.fun, b = this.array; switch (b.length) { case 0: return a(); case 1: return a(b[0]); case 2: return a(b[0], b[1]); case 3: return a(b[0], b[1], b[2]); default: return a.apply(null, b) } }, a.exports = g }, function (a, b, c) { (function (a) { "use strict"; b.test = function () { return void 0 !== a && !a.browser }, b.install = function (b) { return function () { a.nextTick(b) } } }).call(b, c(11)) }, function (a, b) { function c() { throw new Error("setTimeout has not been defined") } function d() { throw new Error("clearTimeout has not been defined") } function e(a) { if (k === setTimeout) return setTimeout(a, 0); if ((k === c || !k) && setTimeout) return k = setTimeout, setTimeout(a, 0); try { return k(a, 0) } catch (b) { try { return k.call(null, a, 0) } catch (b) { return k.call(this, a, 0) } } } function f(a) { if (l === clearTimeout) return clearTimeout(a); if ((l === d || !l) && clearTimeout) return l = clearTimeout, clearTimeout(a); try { return l(a) } catch (b) { try { return l.call(null, a) } catch (b) { return l.call(this, a) } } } function g() { p && n && (p = !1, n.length ? o = n.concat(o) : q = -1, o.length && h()) } function h() { if (!p) { var a = e(g); p = !0; for (var b = o.length; b;) { for (n = o, o = []; ++q < b;)n && n[q].run(); q = -1, b = o.length } n = null, p = !1, f(a) } } function i(a, b) { this.fun = a, this.array = b } function j() { } var k, l, m = a.exports = {}; !function () { try { k = "function" == typeof setTimeout ? setTimeout : c } catch (a) { k = c } try { l = "function" == typeof clearTimeout ? clearTimeout : d } catch (a) { l = d } }(); var n, o = [], p = !1, q = -1; m.nextTick = function (a) { var b = new Array(arguments.length - 1); if (arguments.length > 1) for (var c = 1; c < arguments.length; c++)b[c - 1] = arguments[c]; o.push(new i(a, b)), 1 !== o.length || p || e(h) }, i.prototype.run = function () { this.fun.apply(null, this.array) }, m.title = "browser", m.browser = !0, m.env = {}, m.argv = [], m.version = "", m.versions = {}, m.on = j, m.addListener = j, m.once = j, m.off = j, m.removeListener = j, m.removeAllListeners = j, m.emit = j, m.binding = function (a) { throw new Error("process.binding is not supported") }, m.cwd = function () { return "/" }, m.chdir = function (a) { throw new Error("process.chdir is not supported") }, m.umask = function () { return 0 } }, function (a, b) { (function (a) { "use strict"; var c = a.MutationObserver || a.WebKitMutationObserver; b.test = function () { return c }, b.install = function (b) { var d = 0, e = new c(b), f = a.document.createTextNode(""); return e.observe(f, { characterData: !0 }), function () { f.data = d = ++d % 2 } } }).call(b, function () { return this }()) }, function (a, b) { (function (a) { "use strict"; b.test = function () { return !a.setImmediate && void 0 !== a.MessageChannel }, b.install = function (b) { var c = new a.MessageChannel; return c.port1.onmessage = b, function () { c.port2.postMessage(0) } } }).call(b, function () { return this }()) }, function (a, b) { (function (a) { "use strict"; b.test = function () { return "document" in a && "onreadystatechange" in a.document.createElement("script") }, b.install = function (b) { return function () { var c = a.document.createElement("script"); return c.onreadystatechange = function () { b(), c.onreadystatechange = null, c.parentNode.removeChild(c), c = null }, a.document.documentElement.appendChild(c), b } } }).call(b, function () { return this }()) }, function (a, b) { "use strict"; b.test = function () { return !0 }, b.install = function (a) { return function () { setTimeout(a, 0) } } }, function (a, b, c) { "use strict"; function d(a) { var b, c, d, h = this; a = a || {}, a.menu || f.error("menu is required"), f.isArray(a.datasets) || f.isObject(a.datasets) || f.error("1 or more datasets required"), a.datasets || f.error("datasets is required"), this.isOpen = !1, this.isEmpty = !0, this.minLength = a.minLength || 0, this.templates = {}, this.appendTo = a.appendTo || !1, this.css = f.mixin({}, j, a.appendTo ? j.appendTo : {}), this.cssClasses = a.cssClasses = f.mixin({}, j.defaultClasses, a.cssClasses || {}), this.cssClasses.prefix = a.cssClasses.formattedPrefix || f.formatPrefix(this.cssClasses.prefix, this.cssClasses.noPrefix), b = f.bind(this._onSuggestionClick, this), c = f.bind(this._onSuggestionMouseEnter, this), d = f.bind(this._onSuggestionMouseLeave, this); var i = f.className(this.cssClasses.prefix, this.cssClasses.suggestion); this.$menu = g.element(a.menu).on("mouseenter.aa", i, c).on("mouseleave.aa", i, d).on("click.aa", i, b), this.$container = a.appendTo ? a.wrapper : this.$menu, a.templates && a.templates.header && (this.templates.header = f.templatify(a.templates.header), this.$menu.prepend(this.templates.header())), a.templates && a.templates.empty && (this.templates.empty = f.templatify(a.templates.empty), this.$empty = g.element('<div class="' + f.className(this.cssClasses.prefix, this.cssClasses.empty, !0) + '"></div>'), this.$menu.append(this.$empty), this.$empty.hide()), this.datasets = f.map(a.datasets, function (b) { return e(h.$menu, b, a.cssClasses) }), f.each(this.datasets, function (a) { var b = a.getRoot(); b && 0 === b.parent().length && h.$menu.append(b), a.onSync("rendered", h._onRendered, h) }), a.templates && a.templates.footer && (this.templates.footer = f.templatify(a.templates.footer), this.$menu.append(this.templates.footer())); var k = this; g.element(window).resize(function () { k._redraw() }) } function e(a, b, c) { return new d.Dataset(f.mixin({ $menu: a, cssClasses: c }, b)) } var f = c(4), g = c(3), h = c(8), i = c(17), j = c(19); f.mixin(d.prototype, h, { _onSuggestionClick: function (a) { this.trigger("suggestionClicked", g.element(a.currentTarget)) }, _onSuggestionMouseEnter: function (a) { var b = g.element(a.currentTarget); if (!b.hasClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0))) { this._removeCursor(); var c = this; setTimeout(function () { c._setCursor(b, !1) }, 0) } }, _onSuggestionMouseLeave: function (a) { if (a.relatedTarget) { if (g.element(a.relatedTarget).closest("." + f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)).length > 0) return } this._removeCursor(), this.trigger("cursorRemoved") }, _onRendered: function (a, b) { function c(a) { return a.isEmpty() } function d(a) { return a.templates && a.templates.empty } if (this.isEmpty = f.every(this.datasets, c), this.isEmpty) if (b.length >= this.minLength && this.trigger("empty"), this.$empty) if (b.length < this.minLength) this._hide(); else { var e = this.templates.empty({ query: this.datasets[0] && this.datasets[0].query }); this.$empty.html(e), this.$empty.show(), this._show() } else f.any(this.datasets, d) ? b.length < this.minLength ? this._hide() : this._show() : this._hide(); else this.isOpen && (this.$empty && (this.$empty.empty(), this.$empty.hide()), b.length >= this.minLength ? this._show() : this._hide()); this.trigger("datasetRendered") }, _hide: function () { this.$container.hide() }, _show: function () { this.$container.css("display", "block"), this._redraw(), this.trigger("shown") }, _redraw: function () { this.isOpen && this.appendTo && this.trigger("redrawn") }, _getSuggestions: function () { return this.$menu.find(f.className(this.cssClasses.prefix, this.cssClasses.suggestion)) }, _getCursor: function () { return this.$menu.find(f.className(this.cssClasses.prefix, this.cssClasses.cursor)).first() }, _setCursor: function (a, b) { a.first().addClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)).attr("aria-selected", "true"), this.trigger("cursorMoved", b) }, _removeCursor: function () { this._getCursor().removeClass(f.className(this.cssClasses.prefix, this.cssClasses.cursor, !0)).removeAttr("aria-selected") }, _moveCursor: function (a) { var b, c, d, e; if (this.isOpen) { if (c = this._getCursor(), b = this._getSuggestions(), this._removeCursor(), d = b.index(c) + a, (d = (d + 1) % (b.length + 1) - 1) === -1) return void this.trigger("cursorRemoved"); d < -1 && (d = b.length - 1), this._setCursor(e = b.eq(d), !0), this._ensureVisible(e) } }, _ensureVisible: function (a) { var b, c, d, e; b = a.position().top, c = b + a.height() + parseInt(a.css("margin-top"), 10) + parseInt(a.css("margin-bottom"), 10), d = this.$menu.scrollTop(), e = this.$menu.height() + parseInt(this.$menu.css("padding-top"), 10) + parseInt(this.$menu.css("padding-bottom"), 10), b < 0 ? this.$menu.scrollTop(d + b) : e < c && this.$menu.scrollTop(d + (c - e)) }, close: function () { this.isOpen && (this.isOpen = !1, this._removeCursor(), this._hide(), this.trigger("closed")) }, open: function () { this.isOpen || (this.isOpen = !0, this.isEmpty || this._show(), this.trigger("opened")) }, setLanguageDirection: function (a) { this.$menu.css("ltr" === a ? this.css.ltr : this.css.rtl) }, moveCursorUp: function () { this._moveCursor(-1) }, moveCursorDown: function () { this._moveCursor(1) }, getDatumForSuggestion: function (a) { var b = null; return a.length && (b = { raw: i.extractDatum(a), value: i.extractValue(a), datasetName: i.extractDatasetName(a) }), b }, getCurrentCursor: function () { return this._getCursor().first() }, getDatumForCursor: function () { return this.getDatumForSuggestion(this._getCursor().first()) }, getDatumForTopSuggestion: function () { return this.getDatumForSuggestion(this._getSuggestions().first()) }, cursorTopSuggestion: function () { this._setCursor(this._getSuggestions().first(), !1) }, update: function (a) { function b(b) { b.update(a) } f.each(this.datasets, b) }, empty: function () { function a(a) { a.clear() } f.each(this.datasets, a), this.isEmpty = !0 }, isVisible: function () { return this.isOpen && !this.isEmpty }, destroy: function () { function a(a) { a.destroy() } this.$menu.off(".aa"), this.$menu = null, f.each(this.datasets, a) } }), d.Dataset = i, a.exports = d }, function (a, b, c) { "use strict"; function d(a) { a = a || {}, a.templates = a.templates || {}, a.source || k.error("missing source"), a.name && !g(a.name) && k.error("invalid dataset name: " + a.name), this.query = null, this._isEmpty = !0, this.highlight = !!a.highlight, this.name = void 0 === a.name || null === a.name ? k.getUniqueId() : a.name, this.source = a.source, this.displayFn = e(a.display || a.displayKey), this.debounce = a.debounce, this.cache = a.cache !== !1, this.templates = f(a.templates, this.displayFn), this.css = k.mixin({}, n, a.appendTo ? n.appendTo : {}), this.cssClasses = a.cssClasses = k.mixin({}, n.defaultClasses, a.cssClasses || {}), this.cssClasses.prefix = a.cssClasses.formattedPrefix || k.formatPrefix(this.cssClasses.prefix, this.cssClasses.noPrefix); var b = k.className(this.cssClasses.prefix, this.cssClasses.dataset); this.$el = a.$menu && a.$menu.find(b + "-" + this.name).length > 0 ? l.element(a.$menu.find(b + "-" + this.name)[0]) : l.element(m.dataset.replace("%CLASS%", this.name).replace("%PREFIX%", this.cssClasses.prefix).replace("%DATASET%", this.cssClasses.dataset)), this.$menu = a.$menu, this.clearCachedSuggestions() } function e(a) { function b(b) { return b[a] } return a = a || "value", k.isFunction(a) ? a : b } function f(a, b) { function c(a) { return "<p>" + b(a) + "</p>" } return { empty: a.empty && k.templatify(a.empty), header: a.header && k.templatify(a.header), footer: a.footer && k.templatify(a.footer), suggestion: a.suggestion || c } } function g(a) { return /^[_a-zA-Z0-9-]+$/.test(a) } var h = "aaDataset", i = "aaValue", j = "aaDatum", k = c(4), l = c(3), m = c(18), n = c(19), o = c(8); d.extractDatasetName = function (a) { return l.element(a).data(h) }, d.extractValue = function (a) { return l.element(a).data(i) }, d.extractDatum = function (a) { var b = l.element(a).data(j); return "string" == typeof b && (b = JSON.parse(b)), b }, k.mixin(d.prototype, o, { _render: function (a, b) { function c() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !0 }].concat(b), n.templates.empty.apply(this, b) } function d() { function a(a) { var b, c = m.suggestion.replace("%PREFIX%", f.cssClasses.prefix).replace("%SUGGESTION%", f.cssClasses.suggestion); return b = l.element(c).attr({ role: "option", id: ["option", Math.floor(1e8 * Math.random())].join("-") }).append(n.templates.suggestion.apply(this, [a].concat(e))), b.data(h, n.name), b.data(i, n.displayFn(a) || void 0), b.data(j, JSON.stringify(a)), b.children().each(function () { l.element(this).css(f.css.suggestionChild) }), b } var c, d, e = [].slice.call(arguments, 0), f = this, g = m.suggestions.replace("%PREFIX%", this.cssClasses.prefix).replace("%SUGGESTIONS%", this.cssClasses.suggestions); return c = l.element(g).css(this.css.suggestions), d = k.map(b, a), c.append.apply(c, d), c } function e() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !g }].concat(b), n.templates.header.apply(this, b) } function f() { var b = [].slice.call(arguments, 0); return b = [{ query: a, isEmpty: !g }].concat(b), n.templates.footer.apply(this, b) } if (this.$el) { var g, n = this, o = [].slice.call(arguments, 2); if (this.$el.empty(), g = b && b.length, this._isEmpty = !g, !g && this.templates.empty) this.$el.html(c.apply(this, o)).prepend(n.templates.header ? e.apply(this, o) : null).append(n.templates.footer ? f.apply(this, o) : null); else if (g) this.$el.html(d.apply(this, o)).prepend(n.templates.header ? e.apply(this, o) : null).append(n.templates.footer ? f.apply(this, o) : null); else if (b && !Array.isArray(b)) throw new TypeError("suggestions must be an array"); this.$menu && this.$menu.addClass(this.cssClasses.prefix + (g ? "with" : "without") + "-" + this.name).removeClass(this.cssClasses.prefix + (g ? "without" : "with") + "-" + this.name), this.trigger("rendered", a) } }, getRoot: function () { return this.$el }, update: function (a) { function b(b) { if (!this.canceled && a === this.query) { var c = [].slice.call(arguments, 1); this.cacheSuggestions(a, b, c), this._render.apply(this, [a, b].concat(c)) } } if (this.query = a, this.canceled = !1, this.shouldFetchFromCache(a)) b.apply(this, [this.cachedSuggestions].concat(this.cachedRenderExtraArgs)); else { var c = this, d = function () { c.canceled || c.source(a, b.bind(c)) }; if (this.debounce) { var e = function () { c.debounceTimeout = null, d() }; clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e, this.debounce) } else d() } }, cacheSuggestions: function (a, b, c) { this.cachedQuery = a, this.cachedSuggestions = b, this.cachedRenderExtraArgs = c }, shouldFetchFromCache: function (a) { return this.cache && this.cachedQuery === a && this.cachedSuggestions && this.cachedSuggestions.length }, clearCachedSuggestions: function () { delete this.cachedQuery, delete this.cachedSuggestions, delete this.cachedRenderExtraArgs }, cancel: function () { this.canceled = !0 }, clear: function () { this.$el && (this.cancel(), this.$el.empty(), this.trigger("rendered", "")) }, isEmpty: function () { return this._isEmpty }, destroy: function () { this.clearCachedSuggestions(), this.$el = null } }), a.exports = d }, function (a, b) { "use strict"; a.exports = { wrapper: '<span class="%ROOT%"></span>', dropdown: '<span class="%PREFIX%%DROPDOWN_MENU%"></span>', dataset: '<div class="%PREFIX%%DATASET%-%CLASS%"></div>', suggestions: '<span class="%PREFIX%%SUGGESTIONS%"></span>', suggestion: '<div class="%PREFIX%%SUGGESTION%"></div>' } }, function (a, b, c) { "use strict"; var d = c(4), e = { wrapper: { position: "relative", display: "inline-block" }, hint: { position: "absolute", top: "0", left: "0", borderColor: "transparent", boxShadow: "none", opacity: "1" }, input: { position: "relative", verticalAlign: "top", backgroundColor: "transparent" }, inputWithNoHint: { position: "relative", verticalAlign: "top" }, dropdown: { position: "absolute", top: "100%", left: "0", zIndex: "100", display: "none" }, suggestions: { display: "block" }, suggestion: { whiteSpace: "nowrap", cursor: "pointer" }, suggestionChild: { whiteSpace: "normal" }, ltr: { left: "0", right: "auto" }, rtl: { left: "auto", right: "0" }, defaultClasses: { root: "algolia-autocomplete", prefix: "aa", noPrefix: !1, dropdownMenu: "dropdown-menu", input: "input", hint: "hint", suggestions: "suggestions", suggestion: "suggestion", cursor: "cursor", dataset: "dataset", empty: "empty" }, appendTo: { wrapper: { position: "absolute", zIndex: "100", display: "none" }, input: {}, inputWithNoHint: {}, dropdown: { display: "block" } } }; d.isMsie() && d.mixin(e.input, { backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" }), d.isMsie() && d.isMsie() <= 7 && d.mixin(e.input, { marginTop: "-1px" }), a.exports = e }, function (a, b, c) { "use strict"; a.exports = { hits: c(21), popularIn: c(24) } }, function (a, b, c) { "use strict"; var d = c(4), e = c(22), f = c(23), g = function () { function a(a, d) { return window.Promise.resolve().then(function () { return b.length && (e = a.search(b), b = []), e }).then(function (a) { if (a) return c = a.results, c[d] }) } var b = [], c = [], e = window.Promise.resolve(); return function (c, e) { return function (f, g) { a(c.as, b.push({ indexName: c.indexName, query: f, params: e }) - 1).then(function (a) { a && g(a.hits, a) }).catch(function (a) { d.error(a.message) }) } } }(); a.exports = function (a, b) { var c = f(a.as._ua); if (c && c[0] >= 3 && c[1] > 20) { var d = "autocomplete.js " + e; a.as._ua.indexOf(d) === -1 && (a.as._ua += "; " + d) } return g(a, b) } }, function (a, b) { a.exports = "0.38.1" }, function (a, b) { "use strict"; a.exports = function (a) { var b = a.match(/Algolia for JavaScript \((\d+\.)(\d+\.)(\d+)\)/) || a.match(/Algolia for vanilla JavaScript (\d+\.)(\d+\.)(\d+)/); if (b) return [b[1], b[2], b[3]] } }, function (a, b, c) { "use strict"; var d = c(4), e = c(22), f = c(23); a.exports = function (a, b, c, g) { function h(h, i) { a.search(h, b, function (a, h) { if (a) return void d.error(a.message); if (h.hits.length > 0) { var l = h.hits[0], m = d.mixin({ hitsPerPage: 0 }, c); delete m.source, delete m.index; var n = f(k.as._ua); return n && n[0] >= 3 && n[1] > 20 && (b.additionalUA = "autocomplete.js " + e), void k.search(j(l), m, function (a, b) { if (a) return void d.error(a.message); var c = []; if (g.includeAll) { var e = g.allTitle || "All departments"; c.push(d.mixin({ facet: { value: e, count: b.nbHits } }, d.cloneDeep(l))) } d.each(b.facets, function (a, b) { d.each(a, function (a, e) { c.push(d.mixin({ facet: { facet: b, value: e, count: a } }, d.cloneDeep(l))) }) }); for (var f = 1; f < h.hits.length; ++f)c.push(h.hits[f]); i(c, h) }) } i([]) }) } var i = f(a.as._ua); if (i && i[0] >= 3 && i[1] > 20 && (b = b || {}, b.additionalUA = "autocomplete.js " + e), !c.source) return d.error("Missing 'source' key"); var j = d.isFunction(c.source) ? c.source : function (a) { return a[c.source] }; if (!c.index) return d.error("Missing 'index' key"); var k = c.index; return g = g || {}, h } }])
});;/*! InstantSearch.js 4.36.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).instantsearch = t() }(this, function () { "use strict"; function h(e) { return (h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e })(e) } function C(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function r(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } function E(e, t, n) { return t && r(e.prototype, t), n && r(e, n), e } function k(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e } function f() { return (f = Object.assign || function (e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]) } return e }).apply(this, arguments) } function i(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(t); e && (r = r.filter(function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable })), n.push.apply(n, r) } return n } function W(t) { for (var e = 1; e < arguments.length; e++) { var n = null != arguments[e] ? arguments[e] : {}; e % 2 ? i(Object(n), !0).forEach(function (e) { k(t, e, n[e]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : i(Object(n)).forEach(function (e) { Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)) }) } return t } function L(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), t && n(e, t) } function a(e) { return (a = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) { return e.__proto__ || Object.getPrototypeOf(e) })(e) } function n(e, t) { return (n = Object.setPrototypeOf || function (e, t) { return e.__proto__ = t, e })(e, t) } function j(e, t) { if (null == e) return {}; var n, r, i = function (e, t) { if (null == e) return {}; var n, r, i = {}, a = Object.keys(e); for (r = 0; r < a.length; r++)n = a[r], 0 <= t.indexOf(n) || (i[n] = e[n]); return i }(e, t); if (Object.getOwnPropertySymbols) { var a = Object.getOwnPropertySymbols(e); for (r = 0; r < a.length; r++)n = a[r], 0 <= t.indexOf(n) || Object.prototype.propertyIsEnumerable.call(e, n) && (i[n] = e[n]) } return i } function M(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e } function O(r) { var i = function () { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Date.prototype.toString.call(Reflect.construct(Date, [], function () { })), !0 } catch (e) { return !1 } }(); return function () { var e, t = a(r); if (i) { var n = a(this).constructor; e = Reflect.construct(t, arguments, n) } else e = t.apply(this, arguments); return function (e, t) { return !t || "object" != typeof t && "function" != typeof t ? M(e) : t }(this, e) } } function D(e, t) { return function (e) { if (Array.isArray(e)) return e }(e) || function (e, t) { if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e))) return; var n = [], r = !0, i = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (n.push(s.value), !t || n.length !== t); r = !0); } catch (e) { i = !0, a = e } finally { try { r || null == o.return || o.return() } finally { if (i) throw a } } return n }(e, t) || s(e, t) || function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() } function N(e) { return function (e) { if (Array.isArray(e)) return o(e) }(e) || function (e) { if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e) }(e) || s(e) || function () { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() } function s(e, t) { if (e) { if ("string" == typeof e) return o(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? o(e, t) : void 0 } } function o(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, r = new Array(t); n < t; n++)r[n] = e[n]; return r } function c(e) { return "function" == typeof e || Array.isArray(e) || "[object Object]" === Object.prototype.toString.call(e) } function u(e, t) { if (e === t) return e; for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n) && "__proto__" !== n) { var r = t[n], i = e[n]; void 0 !== i && void 0 === r || (c(i) && c(r) ? e[n] = u(i, r) : e[n] = "object" == typeof (a = r) && null !== a ? u(Array.isArray(a) ? [] : {}, a) : a) } var a; return e } var m = function (e) { c(e) || (e = {}); for (var t = 1, n = arguments.length; t < n; t++) { var r = arguments[t]; c(r) && u(e, r) } return e }, p = function () { return Array.prototype.slice.call(arguments).reduceRight(function (t, n) { return Object.keys(Object(n)).forEach(function (e) { void 0 !== n[e] && (void 0 !== t[e] && delete t[e], t[e] = n[e]) }), t }, {}) }; var l = function (n, r) { return n.filter(function (e, t) { return -1 < r.indexOf(e) && n.indexOf(e) === t }) }, g = function (e, t) { if (Array.isArray(e)) for (var n = 0; n < e.length; n++)if (t(e[n])) return e[n] }; var d = function e(t) { if ("number" == typeof t) return t; if ("string" == typeof t) return parseFloat(t); if (Array.isArray(t)) return t.map(e); throw new Error("The value should be a number, a parsable string or an array of those.") }; var v = function (e, t) { if (null === e) return {}; var n, r, i = {}, a = Object.keys(e); for (r = 0; r < a.length; r++)n = a[r], 0 <= t.indexOf(n) || (i[n] = e[n]); return i }; var y = function (e) { return e && 0 < Object.keys(e).length }, t = function (e) { return null !== e && /^[a-zA-Z0-9_-]{1,64}$/.test(e) }, b = { addRefinement: function (e, t, n) { if (b.isRefined(e, t, n)) return e; var r = "" + n, i = e[t] ? e[t].concat(r) : [r], a = {}; return a[t] = i, p({}, a, e) }, removeRefinement: function (e, n, t) { if (void 0 === t) return b.clearRefinement(e, function (e, t) { return n === t }); var r = "" + t; return b.clearRefinement(e, function (e, t) { return n === t && r === e }) }, toggleRefinement: function (e, t, n) { if (void 0 === n) throw new Error("toggleRefinement should be used with a value"); return b.isRefined(e, t, n) ? b.removeRefinement(e, t, n) : b.addRefinement(e, t, n) }, clearRefinement: function (i, a, s) { if (void 0 === a) return y(i) ? {} : i; if ("string" == typeof a) return v(i, [a]); if ("function" == typeof a) { var o = !1, e = Object.keys(i).reduce(function (e, t) { var n = i[t] || [], r = n.filter(function (e) { return !a(e, t, s) }); return r.length !== n.length && (o = !0), e[t] = r, e }, {}); return o ? e : i } }, isRefined: function (e, t, n) { var r = !!e[t] && 0 < e[t].length; if (void 0 === n || !r) return r; var i = "" + n; return -1 !== e[t].indexOf(i) } }, R = b; function S(e, n) { return Array.isArray(e) && Array.isArray(n) ? e.length === n.length && e.every(function (e, t) { return S(n[t], e) }) : e === n } function w(e) { var r = e ? w._parseNumbers(e) : {}; void 0 === r.userToken || t(r.userToken) || console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n  - Format: [a-zA-Z0-9_-]{1,64}"), this.facets = r.facets || [], this.disjunctiveFacets = r.disjunctiveFacets || [], this.hierarchicalFacets = r.hierarchicalFacets || [], this.facetsRefinements = r.facetsRefinements || {}, this.facetsExcludes = r.facetsExcludes || {}, this.disjunctiveFacetsRefinements = r.disjunctiveFacetsRefinements || {}, this.numericRefinements = r.numericRefinements || {}, this.tagRefinements = r.tagRefinements || [], this.hierarchicalFacetsRefinements = r.hierarchicalFacetsRefinements || {}; var i = this; Object.keys(r).forEach(function (e) { var t = -1 !== w.PARAMETERS.indexOf(e), n = void 0 !== r[e]; !t && n && (i[e] = r[e]) }) } w.PARAMETERS = Object.keys(new w), w._parseNumbers = function (i) { if (i instanceof w) return i; var r = {}; if (["aroundPrecision", "aroundRadius", "getRankingInfo", "minWordSizefor2Typos", "minWordSizefor1Typo", "page", "maxValuesPerFacet", "distinct", "minimumAroundRadius", "hitsPerPage", "minProximity"].forEach(function (e) { var t = i[e]; if ("string" == typeof t) { var n = parseFloat(t); r[e] = isNaN(n) ? t : n } }), Array.isArray(i.insideBoundingBox) && (r.insideBoundingBox = i.insideBoundingBox.map(function (e) { return Array.isArray(e) ? e.map(function (e) { return parseFloat(e) }) : e })), i.numericRefinements) { var a = {}; Object.keys(i.numericRefinements).forEach(function (n) { var r = i.numericRefinements[n] || {}; a[n] = {}, Object.keys(r).forEach(function (e) { var t = r[e].map(function (e) { return Array.isArray(e) ? e.map(function (e) { return "string" == typeof e ? parseFloat(e) : e }) : "string" == typeof e ? parseFloat(e) : e }); a[n][e] = t }) }), r.numericRefinements = a } return m({}, i, r) }, w.make = function (e) { var n = new w(e); return (e.hierarchicalFacets || []).forEach(function (e) { if (e.rootPath) { var t = n.getHierarchicalRefinement(e.name); 0 < t.length && 0 !== t[0].indexOf(e.rootPath) && (n = n.clearRefinements(e.name)), 0 === (t = n.getHierarchicalRefinement(e.name)).length && (n = n.toggleHierarchicalFacetRefinement(e.name, e.rootPath)) } }), n }, w.validate = function (e, t) { var n = t || {}; return e.tagFilters && n.tagRefinements && 0 < n.tagRefinements.length ? new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method.") : 0 < e.tagRefinements.length && n.tagFilters ? new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method.") : e.numericFilters && n.numericRefinements && y(n.numericRefinements) ? new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters.") : y(e.numericRefinements) && n.numericFilters ? new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters.") : null }, w.prototype = { constructor: w, clearRefinements: function (e) { var t = { numericRefinements: this._clearNumericRefinements(e), facetsRefinements: R.clearRefinement(this.facetsRefinements, e, "conjunctiveFacet"), facetsExcludes: R.clearRefinement(this.facetsExcludes, e, "exclude"), disjunctiveFacetsRefinements: R.clearRefinement(this.disjunctiveFacetsRefinements, e, "disjunctiveFacet"), hierarchicalFacetsRefinements: R.clearRefinement(this.hierarchicalFacetsRefinements, e, "hierarchicalFacet") }; return t.numericRefinements === this.numericRefinements && t.facetsRefinements === this.facetsRefinements && t.facetsExcludes === this.facetsExcludes && t.disjunctiveFacetsRefinements === this.disjunctiveFacetsRefinements && t.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements ? this : this.setQueryParameters(t) }, clearTags: function () { return void 0 === this.tagFilters && 0 === this.tagRefinements.length ? this : this.setQueryParameters({ tagFilters: void 0, tagRefinements: [] }) }, setIndex: function (e) { return e === this.index ? this : this.setQueryParameters({ index: e }) }, setQuery: function (e) { return e === this.query ? this : this.setQueryParameters({ query: e }) }, setPage: function (e) { return e === this.page ? this : this.setQueryParameters({ page: e }) }, setFacets: function (e) { return this.setQueryParameters({ facets: e }) }, setDisjunctiveFacets: function (e) { return this.setQueryParameters({ disjunctiveFacets: e }) }, setHitsPerPage: function (e) { return this.hitsPerPage === e ? this : this.setQueryParameters({ hitsPerPage: e }) }, setTypoTolerance: function (e) { return this.typoTolerance === e ? this : this.setQueryParameters({ typoTolerance: e }) }, addNumericRefinement: function (e, t, n) { var r = d(n); if (this.isNumericRefined(e, t, r)) return this; var i = m({}, this.numericRefinements); return i[e] = m({}, i[e]), i[e][t] ? (i[e][t] = i[e][t].slice(), i[e][t].push(r)) : i[e][t] = [r], this.setQueryParameters({ numericRefinements: i }) }, getConjunctiveRefinements: function (e) { return this.isConjunctiveFacet(e) && this.facetsRefinements[e] || [] }, getDisjunctiveRefinements: function (e) { return this.isDisjunctiveFacet(e) && this.disjunctiveFacetsRefinements[e] || [] }, getHierarchicalRefinement: function (e) { return this.hierarchicalFacetsRefinements[e] || [] }, getExcludeRefinements: function (e) { return this.isConjunctiveFacet(e) && this.facetsExcludes[e] || [] }, removeNumericRefinement: function (n, r, i) { return void 0 !== i ? this.isNumericRefined(n, r, i) ? this.setQueryParameters({ numericRefinements: this._clearNumericRefinements(function (e, t) { return t === n && e.op === r && S(e.val, d(i)) }) }) : this : void 0 !== r ? this.isNumericRefined(n, r) ? this.setQueryParameters({ numericRefinements: this._clearNumericRefinements(function (e, t) { return t === n && e.op === r }) }) : this : this.isNumericRefined(n) ? this.setQueryParameters({ numericRefinements: this._clearNumericRefinements(function (e, t) { return t === n }) }) : this }, getNumericRefinements: function (e) { return this.numericRefinements[e] || {} }, getNumericRefinement: function (e, t) { return this.numericRefinements[e] && this.numericRefinements[e][t] }, _clearNumericRefinements: function (s) { if (void 0 === s) return y(this.numericRefinements) ? {} : this.numericRefinements; if ("string" == typeof s) return v(this.numericRefinements, [s]); if ("function" == typeof s) { var o = !1, t = this.numericRefinements, e = Object.keys(t).reduce(function (e, r) { var i = t[r], a = {}; return i = i || {}, Object.keys(i).forEach(function (t) { var e = i[t] || [], n = []; e.forEach(function (e) { s({ val: e, op: t }, r, "numeric") || n.push(e) }), n.length !== e.length && (o = !0), a[t] = n }), e[r] = a, e }, {}); return o ? e : this.numericRefinements } }, addFacet: function (e) { return this.isConjunctiveFacet(e) ? this : this.setQueryParameters({ facets: this.facets.concat([e]) }) }, addDisjunctiveFacet: function (e) { return this.isDisjunctiveFacet(e) ? this : this.setQueryParameters({ disjunctiveFacets: this.disjunctiveFacets.concat([e]) }) }, addHierarchicalFacet: function (e) { if (this.isHierarchicalFacet(e.name)) throw new Error("Cannot declare two hierarchical facets with the same name: `" + e.name + "`"); return this.setQueryParameters({ hierarchicalFacets: this.hierarchicalFacets.concat([e]) }) }, addFacetRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return R.isRefined(this.facetsRefinements, e, t) ? this : this.setQueryParameters({ facetsRefinements: R.addRefinement(this.facetsRefinements, e, t) }) }, addExcludeRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return R.isRefined(this.facetsExcludes, e, t) ? this : this.setQueryParameters({ facetsExcludes: R.addRefinement(this.facetsExcludes, e, t) }) }, addDisjunctiveFacetRefinement: function (e, t) { if (!this.isDisjunctiveFacet(e)) throw new Error(e + " is not defined in the disjunctiveFacets attribute of the helper configuration"); return R.isRefined(this.disjunctiveFacetsRefinements, e, t) ? this : this.setQueryParameters({ disjunctiveFacetsRefinements: R.addRefinement(this.disjunctiveFacetsRefinements, e, t) }) }, addTagRefinement: function (e) { if (this.isTagRefined(e)) return this; var t = { tagRefinements: this.tagRefinements.concat(e) }; return this.setQueryParameters(t) }, removeFacet: function (t) { return this.isConjunctiveFacet(t) ? this.clearRefinements(t).setQueryParameters({ facets: this.facets.filter(function (e) { return e !== t }) }) : this }, removeDisjunctiveFacet: function (t) { return this.isDisjunctiveFacet(t) ? this.clearRefinements(t).setQueryParameters({ disjunctiveFacets: this.disjunctiveFacets.filter(function (e) { return e !== t }) }) : this }, removeHierarchicalFacet: function (t) { return this.isHierarchicalFacet(t) ? this.clearRefinements(t).setQueryParameters({ hierarchicalFacets: this.hierarchicalFacets.filter(function (e) { return e.name !== t }) }) : this }, removeFacetRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return R.isRefined(this.facetsRefinements, e, t) ? this.setQueryParameters({ facetsRefinements: R.removeRefinement(this.facetsRefinements, e, t) }) : this }, removeExcludeRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return R.isRefined(this.facetsExcludes, e, t) ? this.setQueryParameters({ facetsExcludes: R.removeRefinement(this.facetsExcludes, e, t) }) : this }, removeDisjunctiveFacetRefinement: function (e, t) { if (!this.isDisjunctiveFacet(e)) throw new Error(e + " is not defined in the disjunctiveFacets attribute of the helper configuration"); return R.isRefined(this.disjunctiveFacetsRefinements, e, t) ? this.setQueryParameters({ disjunctiveFacetsRefinements: R.removeRefinement(this.disjunctiveFacetsRefinements, e, t) }) : this }, removeTagRefinement: function (t) { if (!this.isTagRefined(t)) return this; var e = { tagRefinements: this.tagRefinements.filter(function (e) { return e !== t }) }; return this.setQueryParameters(e) }, toggleRefinement: function (e, t) { return this.toggleFacetRefinement(e, t) }, toggleFacetRefinement: function (e, t) { if (this.isHierarchicalFacet(e)) return this.toggleHierarchicalFacetRefinement(e, t); if (this.isConjunctiveFacet(e)) return this.toggleConjunctiveFacetRefinement(e, t); if (this.isDisjunctiveFacet(e)) return this.toggleDisjunctiveFacetRefinement(e, t); throw new Error("Cannot refine the undeclared facet " + e + "; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets") }, toggleConjunctiveFacetRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return this.setQueryParameters({ facetsRefinements: R.toggleRefinement(this.facetsRefinements, e, t) }) }, toggleExcludeFacetRefinement: function (e, t) { if (!this.isConjunctiveFacet(e)) throw new Error(e + " is not defined in the facets attribute of the helper configuration"); return this.setQueryParameters({ facetsExcludes: R.toggleRefinement(this.facetsExcludes, e, t) }) }, toggleDisjunctiveFacetRefinement: function (e, t) { if (!this.isDisjunctiveFacet(e)) throw new Error(e + " is not defined in the disjunctiveFacets attribute of the helper configuration"); return this.setQueryParameters({ disjunctiveFacetsRefinements: R.toggleRefinement(this.disjunctiveFacetsRefinements, e, t) }) }, toggleHierarchicalFacetRefinement: function (e, t) { if (!this.isHierarchicalFacet(e)) throw new Error(e + " is not defined in the hierarchicalFacets attribute of the helper configuration"); var n = this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)), r = {}; return void 0 !== this.hierarchicalFacetsRefinements[e] && 0 < this.hierarchicalFacetsRefinements[e].length && (this.hierarchicalFacetsRefinements[e][0] === t || 0 === this.hierarchicalFacetsRefinements[e][0].indexOf(t + n)) ? -1 === t.indexOf(n) ? r[e] = [] : r[e] = [t.slice(0, t.lastIndexOf(n))] : r[e] = [t], this.setQueryParameters({ hierarchicalFacetsRefinements: p({}, r, this.hierarchicalFacetsRefinements) }) }, addHierarchicalFacetRefinement: function (e, t) { if (this.isHierarchicalFacetRefined(e)) throw new Error(e + " is already refined."); if (!this.isHierarchicalFacet(e)) throw new Error(e + " is not defined in the hierarchicalFacets attribute of the helper configuration."); var n = {}; return n[e] = [t], this.setQueryParameters({ hierarchicalFacetsRefinements: p({}, n, this.hierarchicalFacetsRefinements) }) }, removeHierarchicalFacetRefinement: function (e) { if (!this.isHierarchicalFacetRefined(e)) return this; var t = {}; return t[e] = [], this.setQueryParameters({ hierarchicalFacetsRefinements: p({}, t, this.hierarchicalFacetsRefinements) }) }, toggleTagRefinement: function (e) { return this.isTagRefined(e) ? this.removeTagRefinement(e) : this.addTagRefinement(e) }, isDisjunctiveFacet: function (e) { return -1 < this.disjunctiveFacets.indexOf(e) }, isHierarchicalFacet: function (e) { return void 0 !== this.getHierarchicalFacetByName(e) }, isConjunctiveFacet: function (e) { return -1 < this.facets.indexOf(e) }, isFacetRefined: function (e, t) { return !!this.isConjunctiveFacet(e) && R.isRefined(this.facetsRefinements, e, t) }, isExcludeRefined: function (e, t) { return !!this.isConjunctiveFacet(e) && R.isRefined(this.facetsExcludes, e, t) }, isDisjunctiveFacetRefined: function (e, t) { return !!this.isDisjunctiveFacet(e) && R.isRefined(this.disjunctiveFacetsRefinements, e, t) }, isHierarchicalFacetRefined: function (e, t) { if (!this.isHierarchicalFacet(e)) return !1; var n = this.getHierarchicalRefinement(e); return t ? -1 !== n.indexOf(t) : 0 < n.length }, isNumericRefined: function (e, t, n) { if (void 0 === n && void 0 === t) return !!this.numericRefinements[e]; var r = this.numericRefinements[e] && void 0 !== this.numericRefinements[e][t]; if (void 0 === n || !r) return r; var i = d(n), a = void 0 !== function (e, t) { return g(e, function (e) { return S(e, t) }) }(this.numericRefinements[e][t], i); return r && a }, isTagRefined: function (e) { return -1 !== this.tagRefinements.indexOf(e) }, getRefinedDisjunctiveFacets: function () { var t = this, e = l(Object.keys(this.numericRefinements).filter(function (e) { return 0 < Object.keys(t.numericRefinements[e]).length }), this.disjunctiveFacets); return Object.keys(this.disjunctiveFacetsRefinements).filter(function (e) { return 0 < t.disjunctiveFacetsRefinements[e].length }).concat(e).concat(this.getRefinedHierarchicalFacets()) }, getRefinedHierarchicalFacets: function () { var t = this; return l(this.hierarchicalFacets.map(function (e) { return e.name }), Object.keys(this.hierarchicalFacetsRefinements).filter(function (e) { return 0 < t.hierarchicalFacetsRefinements[e].length })) }, getUnrefinedDisjunctiveFacets: function () { var t = this.getRefinedDisjunctiveFacets(); return this.disjunctiveFacets.filter(function (e) { return -1 === t.indexOf(e) }) }, managedParameters: ["index", "facets", "disjunctiveFacets", "facetsRefinements", "hierarchicalFacets", "facetsExcludes", "disjunctiveFacetsRefinements", "numericRefinements", "tagRefinements", "hierarchicalFacetsRefinements"], getQueryParams: function () { var n = this.managedParameters, r = {}, i = this; return Object.keys(this).forEach(function (e) { var t = i[e]; -1 === n.indexOf(e) && void 0 !== t && (r[e] = t) }), r }, setQueryParameter: function (e, t) { if (this[e] === t) return this; var n = {}; return n[e] = t, this.setQueryParameters(n) }, setQueryParameters: function (e) { if (!e) return this; var t = w.validate(this, e); if (t) throw t; var n = this, i = w._parseNumbers(e), r = Object.keys(this).reduce(function (e, t) { return e[t] = n[t], e }, {}), a = Object.keys(i).reduce(function (e, t) { var n = void 0 !== e[t], r = void 0 !== i[t]; return n && !r ? v(e, [t]) : (r && (e[t] = i[t]), e) }, r); return new this.constructor(a) }, resetPage: function () { return void 0 === this.page ? this : this.setPage(0) }, _getHierarchicalFacetSortBy: function (e) { return e.sortBy || ["isRefined:desc", "name:asc"] }, _getHierarchicalFacetSeparator: function (e) { return e.separator || " > " }, _getHierarchicalRootPath: function (e) { return e.rootPath || null }, _getHierarchicalShowParentLevel: function (e) { return "boolean" != typeof e.showParentLevel || e.showParentLevel }, getHierarchicalFacetByName: function (t) { return g(this.hierarchicalFacets, function (e) { return e.name === t }) }, getHierarchicalFacetBreadcrumb: function (e) { if (!this.isHierarchicalFacet(e)) return []; var t = this.getHierarchicalRefinement(e)[0]; if (!t) return []; var n = this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)); return t.split(n).map(function (e) { return e.trim() }) }, toString: function () { return JSON.stringify(this, null, 2) } }; var P = w; function x(e, t) { if (e !== t) { var n = void 0 !== e, r = null === e, i = void 0 !== t, a = null === t; if (!a && t < e || r && i || !n) return 1; if (!r && e < t || a && n || !i) return -1 } return 0 } function _(e) { return Array.isArray(e) ? e.filter(Boolean) : [] } function I(e, t) { if (!Array.isArray(e)) return -1; for (var n = 0; n < e.length; n++)if (t(e[n])) return n; return -1 } function F(e, t) { var i = (t || []).map(function (e) { return e.split(":") }); return e.reduce(function (e, t) { var n = t.split(":"), r = g(i, function (e) { return e[0] === n[0] }); return 1 < n.length || !r ? (e[0].push(n[0]), e[1].push(n[1])) : (e[0].push(r[0]), e[1].push(r[1])), e }, [[], []]) } var T = function (e, n, i) { if (!Array.isArray(e)) return []; Array.isArray(i) || (i = []); var t = e.map(function (t, e) { return { criteria: n.map(function (e) { return t[e] }), index: e, value: t } }); return t.sort(function (e, t) { for (var n = -1; ++n < e.criteria.length;) { var r = x(e.criteria[n], t.criteria[n]); if (r) return n >= i.length ? r : "desc" === i[n] ? -r : r } return e.index - t.index }), t.map(function (e) { return e.value }) }, A = function (d) { return function (e, t) { var n = d.hierarchicalFacets[t], r = d.hierarchicalFacetsRefinements[n.name] && d.hierarchicalFacetsRefinements[n.name][0] || "", i = d._getHierarchicalFacetSeparator(n), a = d._getHierarchicalRootPath(n), s = d._getHierarchicalShowParentLevel(n), o = F(d._getHierarchicalFacetSortBy(n)), c = e.every(function (e) { return e.exhaustive }), u = function (o, c, u, l, d) { return function (e, n, t) { var r = e; if (0 < t) { var i = 0; for (r = e; i < t;) { var a = r && Array.isArray(r.data) ? r.data : []; r = g(a, function (e) { return e.isRefined }), i++ } } if (r) { var s = Object.keys(n.data).map(function (e) { return [e, n.data[e]] }).filter(function (e) { return function (e, t, n, r, i, a) { return (!i || 0 === e.indexOf(i) && i !== e) && (!i && -1 === e.indexOf(r) || i && e.split(r).length - i.split(r).length == 1 || -1 === e.indexOf(r) && -1 === n.indexOf(r) || 0 === n.indexOf(e) || 0 === e.indexOf(t + r) && (a || 0 === e.indexOf(n))) }(e[0], r.path || u, d, c, u, l) }); r.data = T(s.map(function (e) { var t = e[0]; return function (e, t, n, r, i) { var a = t.split(n); return { name: a[a.length - 1].trim(), path: t, count: e, isRefined: r === t || 0 === r.indexOf(t + n), exhaustive: i, data: null } }(e[1], t, c, d, n.exhaustive) }), o[0], o[1]) } return e } }(o, i, a, s, r), l = e; return a && (l = e.slice(a.split(i).length)), l.reduce(u, { name: d.hierarchicalFacets[t].name, count: null, isRefined: !0, path: null, exhaustive: c, data: null }) } }; function H(e) { var n = {}; return e.forEach(function (e, t) { n[e] = t }), n } function B(e, t, n) { t && t[n] && (e.stats = t[n]) } function U(l, n) { var c = n[0]; this._rawResults = n; var d = this; Object.keys(c).forEach(function (e) { d[e] = c[e] }), this.processingTimeMS = n.reduce(function (e, t) { return void 0 === t.processingTimeMS ? e : e + t.processingTimeMS }, 0), this.disjunctiveFacets = [], this.hierarchicalFacets = l.hierarchicalFacets.map(function () { return [] }), this.facets = []; var e = l.getRefinedDisjunctiveFacets(), u = H(l.facets), h = H(l.disjunctiveFacets), r = 1, f = c.facets || {}; Object.keys(f).forEach(function (e) { var t = f[e], n = function (e, t) { return g(e, function (e) { return -1 < (e.attributes || []).indexOf(t) }) }(l.hierarchicalFacets, e); if (n) { var r = n.attributes.indexOf(e), i = I(l.hierarchicalFacets, function (e) { return e.name === n.name }); d.hierarchicalFacets[i][r] = { attribute: e, data: t, exhaustive: c.exhaustiveFacetsCount } } else { var a, s = -1 !== l.disjunctiveFacets.indexOf(e), o = -1 !== l.facets.indexOf(e); s && (a = h[e], d.disjunctiveFacets[a] = { name: e, data: t, exhaustive: c.exhaustiveFacetsCount }, B(d.disjunctiveFacets[a], c.facets_stats, e)), o && (a = u[e], d.facets[a] = { name: e, data: t, exhaustive: c.exhaustiveFacetsCount }, B(d.facets[a], c.facets_stats, e)) } }), this.hierarchicalFacets = _(this.hierarchicalFacets), e.forEach(function (e) { var a = n[r], s = a && a.facets ? a.facets : {}, o = l.getHierarchicalFacetByName(e); Object.keys(s).forEach(function (t) { var n, e = s[t]; if (o) { n = I(l.hierarchicalFacets, function (e) { return e.name === o.name }); var r = I(d.hierarchicalFacets[n], function (e) { return e.attribute === t }); if (-1 === r) return; d.hierarchicalFacets[n][r].data = m({}, d.hierarchicalFacets[n][r].data, e) } else { n = h[t]; var i = c.facets && c.facets[t] || {}; d.disjunctiveFacets[n] = { name: t, data: p({}, e, i), exhaustive: a.exhaustiveFacetsCount }, B(d.disjunctiveFacets[n], a.facets_stats, t), l.disjunctiveFacetsRefinements[t] && l.disjunctiveFacetsRefinements[t].forEach(function (e) { !d.disjunctiveFacets[n].data[e] && -1 < l.disjunctiveFacetsRefinements[t].indexOf(e) && (d.disjunctiveFacets[n].data[e] = 0) }) } }), r++ }), l.getRefinedHierarchicalFacets().forEach(function (e) { var s = l.getHierarchicalFacetByName(e), o = l._getHierarchicalFacetSeparator(s), c = l.getHierarchicalRefinement(e); if (!(0 === c.length || c[0].split(o).length < 2)) { var t = n[r], u = t && t.facets ? t.facets : {}; Object.keys(u).forEach(function (t) { var e = u[t], n = I(l.hierarchicalFacets, function (e) { return e.name === s.name }), r = I(d.hierarchicalFacets[n], function (e) { return e.attribute === t }); if (-1 !== r) { var i = {}; if (0 < c.length) { var a = c[0].split(o)[0]; i[a] = d.hierarchicalFacets[n][r].data[a] } d.hierarchicalFacets[n][r].data = p(i, e, d.hierarchicalFacets[n][r].data) } }), r++ } }), Object.keys(l.facetsExcludes).forEach(function (t) { var e = l.facetsExcludes[t], n = u[t]; d.facets[n] = { name: t, data: c.facets[t], exhaustive: c.exhaustiveFacetsCount }, e.forEach(function (e) { d.facets[n] = d.facets[n] || { name: t }, d.facets[n].data = d.facets[n].data || {}, d.facets[n].data[e] = 0 }) }), this.hierarchicalFacets = this.hierarchicalFacets.map(A(l)), this.facets = _(this.facets), this.disjunctiveFacets = _(this.disjunctiveFacets), this._state = l } function q(e, t) { var n = g(e, function (e) { return e.name === t }); return n && n.stats } function Q(e, t, n, r, i) { var a = g(i, function (e) { return e.name === n }), s = a && a.data && a.data[r] ? a.data[r] : 0, o = a && a.exhaustive || !1; return { type: t, attributeName: n, name: r, count: s, exhaustive: o } } U.prototype.getFacetByName = function (t) { function e(e) { return e.name === t } return g(this.facets, e) || g(this.disjunctiveFacets, e) || g(this.hierarchicalFacets, e) }, U.DEFAULT_SORT = ["isRefined:desc", "count:desc", "name:asc"], U.prototype.getFacetValues = function (e, t) { var n = function (t, n) { function e(e) { return e.name === n } if (t._state.isConjunctiveFacet(n)) { var r = g(t.facets, e); return r ? Object.keys(r.data).map(function (e) { return { name: e, count: r.data[e], isRefined: t._state.isFacetRefined(n, e), isExcluded: t._state.isExcludeRefined(n, e) } }) : [] } if (t._state.isDisjunctiveFacet(n)) { var i = g(t.disjunctiveFacets, e); return i ? Object.keys(i.data).map(function (e) { return { name: e, count: i.data[e], isRefined: t._state.isDisjunctiveFacetRefined(n, e) } }) : [] } if (t._state.isHierarchicalFacet(n)) return g(t.hierarchicalFacets, e) }(this, e); if (n) { var r, i = p({}, t, { sortBy: U.DEFAULT_SORT, facetOrdering: !(t && t.sortBy) }), a = this; if (Array.isArray(n)) r = [e]; else r = a._state.getHierarchicalFacetByName(n.name).attributes; return function t(n, e, r, i) { if (i = i || 0, Array.isArray(e)) return n(e, r[i]); if (!e.data || 0 === e.data.length) return e; var a = e.data.map(function (e) { return t(n, e, r, i + 1) }), s = n(a, r[i]); return p({ data: s }, e) }(function (e, t) { if (i.facetOrdering) { var n = function (e, t) { return e.renderingContent && e.renderingContent.facetOrdering && e.renderingContent.facetOrdering.values && e.renderingContent.facetOrdering.values[t] }(a, t); if (Boolean(n)) return function (e, t) { var n = [], r = [], i = (t.order || []).reduce(function (e, t, n) { return e[t] = n, e }, {}); e.forEach(function (e) { var t = e.path || e.name; void 0 !== i[t] ? n[i[t]] = e : r.push(e) }), n = n.filter(function (e) { return e }); var a, s = t.sortRemainingBy; return "hidden" === s ? n : (a = "alpha" === s ? [["path", "name"], ["asc", "asc"]] : [["count"], ["desc"]], n.concat(T(r, a[0], a[1]))) }(e, n) } if (Array.isArray(i.sortBy)) { var r = F(i.sortBy, U.DEFAULT_SORT); return T(e, r[0], r[1]) } if ("function" == typeof i.sortBy) return function (e, t) { return t.sort(e) }(i.sortBy, e); throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function") }, n, r) } }, U.prototype.getFacetStats = function (e) { return this._state.isConjunctiveFacet(e) ? q(this.facets, e) : this._state.isDisjunctiveFacet(e) ? q(this.disjunctiveFacets, e) : void 0 }, U.prototype.getRefinements = function () { var r = this._state, n = this, i = []; return Object.keys(r.facetsRefinements).forEach(function (t) { r.facetsRefinements[t].forEach(function (e) { i.push(Q(r, "facet", t, e, n.facets)) }) }), Object.keys(r.facetsExcludes).forEach(function (t) { r.facetsExcludes[t].forEach(function (e) { i.push(Q(r, "exclude", t, e, n.facets)) }) }), Object.keys(r.disjunctiveFacetsRefinements).forEach(function (t) { r.disjunctiveFacetsRefinements[t].forEach(function (e) { i.push(Q(r, "disjunctive", t, e, n.disjunctiveFacets)) }) }), Object.keys(r.hierarchicalFacetsRefinements).forEach(function (t) { r.hierarchicalFacetsRefinements[t].forEach(function (e) { i.push(function (e, t, n, r) { var i = e.getHierarchicalFacetByName(t), a = e._getHierarchicalFacetSeparator(i), s = n.split(a), o = g(r, function (e) { return e.name === t }), c = s.reduce(function (e, t) { var n = e && g(e.data, function (e) { return e.name === t }); return void 0 !== n ? n : e }, o), u = c && c.count || 0, l = c && c.exhaustive || !1, d = c && c.path || ""; return { type: "hierarchical", attributeName: t, name: d, count: u, exhaustive: l } }(r, t, e, n.hierarchicalFacets)) }) }), Object.keys(r.numericRefinements).forEach(function (n) { var e = r.numericRefinements[n]; Object.keys(e).forEach(function (t) { e[t].forEach(function (e) { i.push({ type: "numeric", attributeName: n, name: e, numericValue: e, operator: t }) }) }) }), r.tagRefinements.forEach(function (e) { i.push({ type: "tag", attributeName: "_tags", name: e }) }), i }; var $ = U; function V() { this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0 } var e = V; function K(e) { return "function" == typeof e } function z(e) { return "object" == typeof e && null !== e } function J(e) { return void 0 === e } V.prototype._events = void 0, V.prototype._maxListeners = void 0, V.defaultMaxListeners = 10, V.prototype.setMaxListeners = function (e) { if (!function (e) { return "number" == typeof e }(e) || e < 0 || isNaN(e)) throw TypeError("n must be a positive number"); return this._maxListeners = e, this }, V.prototype.emit = function (e) { var t, n, r, i, a, s; if (this._events || (this._events = {}), "error" === e && (!this._events.error || z(this._events.error) && !this._events.error.length)) { if ((t = arguments[1]) instanceof Error) throw t; var o = new Error('Uncaught, unspecified "error" event. (' + t + ")"); throw o.context = t, o } if (J(n = this._events[e])) return !1; if (K(n)) switch (arguments.length) { case 1: n.call(this); break; case 2: n.call(this, arguments[1]); break; case 3: n.call(this, arguments[1], arguments[2]); break; default: i = Array.prototype.slice.call(arguments, 1), n.apply(this, i) } else if (z(n)) for (i = Array.prototype.slice.call(arguments, 1), r = (s = n.slice()).length, a = 0; a < r; a++)s[a].apply(this, i); return !0 }, V.prototype.on = V.prototype.addListener = function (e, t) { var n; if (!K(t)) throw TypeError("listener must be a function"); return this._events || (this._events = {}), this._events.newListener && this.emit("newListener", e, K(t.listener) ? t.listener : t), this._events[e] ? z(this._events[e]) ? this._events[e].push(t) : this._events[e] = [this._events[e], t] : this._events[e] = t, z(this._events[e]) && !this._events[e].warned && (n = J(this._maxListeners) ? V.defaultMaxListeners : this._maxListeners) && 0 < n && this._events[e].length > n && (this._events[e].warned = !0, console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[e].length), "function" == typeof console.trace && console.trace()), this }, V.prototype.once = function (e, t) { if (!K(t)) throw TypeError("listener must be a function"); var n = !1; function r() { this.removeListener(e, r), n || (n = !0, t.apply(this, arguments)) } return r.listener = t, this.on(e, r), this }, V.prototype.removeListener = function (e, t) { var n, r, i, a; if (!K(t)) throw TypeError("listener must be a function"); if (!this._events || !this._events[e]) return this; if (i = (n = this._events[e]).length, r = -1, n === t || K(n.listener) && n.listener === t) delete this._events[e], this._events.removeListener && this.emit("removeListener", e, t); else if (z(n)) { for (a = i; 0 < a--;)if (n[a] === t || n[a].listener && n[a].listener === t) { r = a; break } if (r < 0) return this; 1 === n.length ? (n.length = 0, delete this._events[e]) : n.splice(r, 1), this._events.removeListener && this.emit("removeListener", e, t) } return this }, V.prototype.removeAllListeners = function (e) { var t, n; if (!this._events) return this; if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[e] && delete this._events[e], this; if (0 === arguments.length) { for (t in this._events) "removeListener" !== t && this.removeAllListeners(t); return this.removeAllListeners("removeListener"), this._events = {}, this } if (K(n = this._events[e])) this.removeListener(e, n); else if (n) for (; n.length;)this.removeListener(e, n[n.length - 1]); return delete this._events[e], this }, V.prototype.listeners = function (e) { return this._events && this._events[e] ? K(this._events[e]) ? [this._events[e]] : this._events[e].slice() : [] }, V.prototype.listenerCount = function (e) { if (this._events) { var t = this._events[e]; if (K(t)) return 1; if (t) return t.length } return 0 }, V.listenerCount = function (e, t) { return e.listenerCount(t) }; var Y = function (e, t) { e.prototype = Object.create(t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }) }; function X(e, t) { this.main = e, this.fn = t, this.lastResults = null } Y(X, e), X.prototype.detach = function () { this.removeAllListeners(), this.main.detachDerivedHelper(this) }, X.prototype.getModifiedState = function (e) { return this.fn(e) }; var G = X, Z = { _getQueries: function (i, a) { var s = []; return s.push({ indexName: i, params: Z._getHitsSearchParams(a) }), a.getRefinedDisjunctiveFacets().forEach(function (e) { s.push({ indexName: i, params: Z._getDisjunctiveFacetSearchParams(a, e) }) }), a.getRefinedHierarchicalFacets().forEach(function (e) { var t = a.getHierarchicalFacetByName(e), n = a.getHierarchicalRefinement(e), r = a._getHierarchicalFacetSeparator(t); 0 < n.length && 1 < n[0].split(r).length && s.push({ indexName: i, params: Z._getDisjunctiveFacetSearchParams(a, e, !0) }) }), s }, _getHitsSearchParams: function (e) { var t = e.facets.concat(e.disjunctiveFacets).concat(Z._getHitsHierarchicalFacetsAttributes(e)), n = Z._getFacetFilters(e), r = Z._getNumericFilters(e), i = Z._getTagFilters(e), a = { facets: -1 < t.indexOf("*") ? ["*"] : t, tagFilters: i }; return 0 < n.length && (a.facetFilters = n), 0 < r.length && (a.numericFilters = r), m({}, e.getQueryParams(), a) }, _getDisjunctiveFacetSearchParams: function (e, t, n) { var r = Z._getFacetFilters(e, t, n), i = Z._getNumericFilters(e, t), a = { hitsPerPage: 1, page: 0, attributesToRetrieve: [], attributesToHighlight: [], attributesToSnippet: [], tagFilters: Z._getTagFilters(e), analytics: !1, clickAnalytics: !1 }, s = e.getHierarchicalFacetByName(t); return a.facets = s ? Z._getDisjunctiveHierarchicalFacetAttribute(e, s, n) : t, 0 < i.length && (a.numericFilters = i), 0 < r.length && (a.facetFilters = r), m({}, e.getQueryParams(), a) }, _getNumericFilters: function (e, i) { if (e.numericFilters) return e.numericFilters; var a = []; return Object.keys(e.numericRefinements).forEach(function (r) { var t = e.numericRefinements[r] || {}; Object.keys(t).forEach(function (n) { var e = t[n] || []; i !== r && e.forEach(function (e) { if (Array.isArray(e)) { var t = e.map(function (e) { return r + n + e }); a.push(t) } else a.push(r + n + e) }) }) }), a }, _getTagFilters: function (e) { return e.tagFilters ? e.tagFilters : e.tagRefinements.join(",") }, _getFacetFilters: function (o, c, u) { var l = [], e = o.facetsRefinements || {}; Object.keys(e).forEach(function (t) { (e[t] || []).forEach(function (e) { l.push(t + ":" + e) }) }); var n = o.facetsExcludes || {}; Object.keys(n).forEach(function (t) { (n[t] || []).forEach(function (e) { l.push(t + ":-" + e) }) }); var r = o.disjunctiveFacetsRefinements || {}; Object.keys(r).forEach(function (t) { var e = r[t] || []; if (t !== c && e && 0 !== e.length) { var n = []; e.forEach(function (e) { n.push(t + ":" + e) }), l.push(n) } }); var d = o.hierarchicalFacetsRefinements || {}; return Object.keys(d).forEach(function (e) { var t = (d[e] || [])[0]; if (void 0 !== t) { var n, r, i = o.getHierarchicalFacetByName(e), a = o._getHierarchicalFacetSeparator(i), s = o._getHierarchicalRootPath(i); if (c === e) { if (-1 === t.indexOf(a) || !s && !0 === u || s && s.split(a).length === t.split(a).length) return; t = s ? (r = s.split(a).length - 1, s) : (r = t.split(a).length - 2, t.slice(0, t.lastIndexOf(a))), n = i.attributes[r] } else r = t.split(a).length - 1, n = i.attributes[r]; n && l.push([n + ":" + t]) } }), l }, _getHitsHierarchicalFacetsAttributes: function (s) { return s.hierarchicalFacets.reduce(function (e, t) { var n = s.getHierarchicalRefinement(t.name)[0]; if (!n) return e.push(t.attributes[0]), e; var r = s._getHierarchicalFacetSeparator(t), i = n.split(r).length, a = t.attributes.slice(0, i + 1); return e.concat(a) }, []) }, _getDisjunctiveHierarchicalFacetAttribute: function (e, t, n) { var r = e._getHierarchicalFacetSeparator(t); if (!0 === n) { var i = e._getHierarchicalRootPath(t), a = 0; return i && (a = i.split(r).length), [t.attributes[a]] } var s = (e.getHierarchicalRefinement(t.name)[0] || "").split(r).length - 1; return t.attributes.slice(0, 1 + s) }, getSearchForFacetQuery: function (e, t, n, r) { var i = r.isDisjunctiveFacet(e) ? r.clearRefinements(e) : r, a = { facetQuery: t, facetName: e }; return "number" == typeof n && (a.maxFacetHits = n), m({}, Z._getHitsSearchParams(i), a) } }, ee = Z, te = "3.7.0"; function ne(e, t, n) { "function" == typeof e.addAlgoliaAgent && e.addAlgoliaAgent("JS Helper (3.7.0)"), this.setClient(e); var r = n || {}; r.index = t, this.state = P.make(r), this.lastResults = null, this._queryId = 0, this._lastQueryIdReceived = -1, this.derivedHelpers = [], this._currentNbQueries = 0 } function re(e) { if (e < 0) throw new Error("Page requested below 0."); return this._change({ state: this.state.setPage(e), isPageReset: !1 }), this } function ie() { return this.state.page } Y(ne, e), ne.prototype.search = function () { return this._search({ onlyWithDerivedHelpers: !1 }), this }, ne.prototype.searchOnlyWithDerivedHelpers = function () { return this._search({ onlyWithDerivedHelpers: !0 }), this }, ne.prototype.getQuery = function () { var e = this.state; return ee._getHitsSearchParams(e) }, ne.prototype.searchOnce = function (e, t) { var n = e ? this.state.setQueryParameters(e) : this.state, r = ee._getQueries(n.index, n), i = this; if (this._currentNbQueries++, this.emit("searchOnce", { state: n }), !t) return this.client.search(r).then(function (e) { return i._currentNbQueries--, 0 === i._currentNbQueries && i.emit("searchQueueEmpty"), { content: new $(n, e.results), state: n, _originalResponse: e } }, function (e) { throw i._currentNbQueries--, 0 === i._currentNbQueries && i.emit("searchQueueEmpty"), e }); this.client.search(r).then(function (e) { i._currentNbQueries--, 0 === i._currentNbQueries && i.emit("searchQueueEmpty"), t(null, new $(n, e.results), n) }).catch(function (e) { i._currentNbQueries--, 0 === i._currentNbQueries && i.emit("searchQueueEmpty"), t(e, null, n) }) }, ne.prototype.findAnswers = function (e) { var t = this.state, n = this.derivedHelpers[0]; if (!n) return Promise.resolve([]); var r = n.getModifiedState(t), i = m({ attributesForPrediction: e.attributesForPrediction, nbHits: e.nbHits }, { params: v(ee._getHitsSearchParams(r), ["attributesToSnippet", "hitsPerPage", "restrictSearchableAttributes", "snippetEllipsisText"]) }), a = "search for answers was called, but this client does not have a function client.initIndex(index).findAnswers"; if ("function" != typeof this.client.initIndex) throw new Error(a); var s = this.client.initIndex(r.index); if ("function" != typeof s.findAnswers) throw new Error(a); return s.findAnswers(r.query, e.queryLanguages, i) }, ne.prototype.searchForFacetValues = function (t, e, n, r) { var i = "function" == typeof this.client.searchForFacetValues; if (!i && "function" != typeof this.client.initIndex) throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues"); var a = this.state.setQueryParameters(r || {}), s = a.isDisjunctiveFacet(t), o = ee.getSearchForFacetQuery(t, e, n, a); this._currentNbQueries++; var c = this; return this.emit("searchForFacetValues", { state: a, facet: t, query: e }), (i ? this.client.searchForFacetValues([{ indexName: a.index, params: o }]) : this.client.initIndex(a.index).searchForFacetValues(o)).then(function (e) { return c._currentNbQueries--, 0 === c._currentNbQueries && c.emit("searchQueueEmpty"), (e = Array.isArray(e) ? e[0] : e).facetHits.forEach(function (e) { e.isRefined = s ? a.isDisjunctiveFacetRefined(t, e.value) : a.isFacetRefined(t, e.value) }), e }, function (e) { throw c._currentNbQueries--, 0 === c._currentNbQueries && c.emit("searchQueueEmpty"), e }) }, ne.prototype.setQuery = function (e) { return this._change({ state: this.state.resetPage().setQuery(e), isPageReset: !0 }), this }, ne.prototype.clearRefinements = function (e) { return this._change({ state: this.state.resetPage().clearRefinements(e), isPageReset: !0 }), this }, ne.prototype.clearTags = function () { return this._change({ state: this.state.resetPage().clearTags(), isPageReset: !0 }), this }, ne.prototype.addDisjunctiveFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().addDisjunctiveFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.addDisjunctiveRefine = function () { return this.addDisjunctiveFacetRefinement.apply(this, arguments) }, ne.prototype.addHierarchicalFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().addHierarchicalFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.addNumericRefinement = function (e, t, n) { return this._change({ state: this.state.resetPage().addNumericRefinement(e, t, n), isPageReset: !0 }), this }, ne.prototype.addFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().addFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.addRefine = function () { return this.addFacetRefinement.apply(this, arguments) }, ne.prototype.addFacetExclusion = function (e, t) { return this._change({ state: this.state.resetPage().addExcludeRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.addExclude = function () { return this.addFacetExclusion.apply(this, arguments) }, ne.prototype.addTag = function (e) { return this._change({ state: this.state.resetPage().addTagRefinement(e), isPageReset: !0 }), this }, ne.prototype.removeNumericRefinement = function (e, t, n) { return this._change({ state: this.state.resetPage().removeNumericRefinement(e, t, n), isPageReset: !0 }), this }, ne.prototype.removeDisjunctiveFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().removeDisjunctiveFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.removeDisjunctiveRefine = function () { return this.removeDisjunctiveFacetRefinement.apply(this, arguments) }, ne.prototype.removeHierarchicalFacetRefinement = function (e) { return this._change({ state: this.state.resetPage().removeHierarchicalFacetRefinement(e), isPageReset: !0 }), this }, ne.prototype.removeFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().removeFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.removeRefine = function () { return this.removeFacetRefinement.apply(this, arguments) }, ne.prototype.removeFacetExclusion = function (e, t) { return this._change({ state: this.state.resetPage().removeExcludeRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.removeExclude = function () { return this.removeFacetExclusion.apply(this, arguments) }, ne.prototype.removeTag = function (e) { return this._change({ state: this.state.resetPage().removeTagRefinement(e), isPageReset: !0 }), this }, ne.prototype.toggleFacetExclusion = function (e, t) { return this._change({ state: this.state.resetPage().toggleExcludeFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.toggleExclude = function () { return this.toggleFacetExclusion.apply(this, arguments) }, ne.prototype.toggleRefinement = function (e, t) { return this.toggleFacetRefinement(e, t) }, ne.prototype.toggleFacetRefinement = function (e, t) { return this._change({ state: this.state.resetPage().toggleFacetRefinement(e, t), isPageReset: !0 }), this }, ne.prototype.toggleRefine = function () { return this.toggleFacetRefinement.apply(this, arguments) }, ne.prototype.toggleTag = function (e) { return this._change({ state: this.state.resetPage().toggleTagRefinement(e), isPageReset: !0 }), this }, ne.prototype.nextPage = function () { var e = this.state.page || 0; return this.setPage(e + 1) }, ne.prototype.previousPage = function () { var e = this.state.page || 0; return this.setPage(e - 1) }, ne.prototype.setCurrentPage = re, ne.prototype.setPage = re, ne.prototype.setIndex = function (e) { return this._change({ state: this.state.resetPage().setIndex(e), isPageReset: !0 }), this }, ne.prototype.setQueryParameter = function (e, t) { return this._change({ state: this.state.resetPage().setQueryParameter(e, t), isPageReset: !0 }), this }, ne.prototype.setState = function (e) { return this._change({ state: P.make(e), isPageReset: !1 }), this }, ne.prototype.overrideStateWithoutTriggeringChangeEvent = function (e) { return this.state = new P(e), this }, ne.prototype.hasRefinements = function (e) { return !!y(this.state.getNumericRefinements(e)) || (this.state.isConjunctiveFacet(e) ? this.state.isFacetRefined(e) : this.state.isDisjunctiveFacet(e) ? this.state.isDisjunctiveFacetRefined(e) : !!this.state.isHierarchicalFacet(e) && this.state.isHierarchicalFacetRefined(e)) }, ne.prototype.isExcluded = function (e, t) { return this.state.isExcludeRefined(e, t) }, ne.prototype.isDisjunctiveRefined = function (e, t) { return this.state.isDisjunctiveFacetRefined(e, t) }, ne.prototype.hasTag = function (e) { return this.state.isTagRefined(e) }, ne.prototype.isTagRefined = function () { return this.hasTagRefinements.apply(this, arguments) }, ne.prototype.getIndex = function () { return this.state.index }, ne.prototype.getCurrentPage = ie, ne.prototype.getPage = ie, ne.prototype.getTags = function () { return this.state.tagRefinements }, ne.prototype.getRefinements = function (e) { var n = []; if (this.state.isConjunctiveFacet(e)) this.state.getConjunctiveRefinements(e).forEach(function (e) { n.push({ value: e, type: "conjunctive" }) }), this.state.getExcludeRefinements(e).forEach(function (e) { n.push({ value: e, type: "exclude" }) }); else if (this.state.isDisjunctiveFacet(e)) { this.state.getDisjunctiveRefinements(e).forEach(function (e) { n.push({ value: e, type: "disjunctive" }) }) } var r = this.state.getNumericRefinements(e); return Object.keys(r).forEach(function (e) { var t = r[e]; n.push({ value: t, operator: e, type: "numeric" }) }), n }, ne.prototype.getNumericRefinement = function (e, t) { return this.state.getNumericRefinement(e, t) }, ne.prototype.getHierarchicalFacetBreadcrumb = function (e) { return this.state.getHierarchicalFacetBreadcrumb(e) }, ne.prototype._search = function (e) { var r = this.state, i = [], t = []; e.onlyWithDerivedHelpers || (t = ee._getQueries(r.index, r), i.push({ state: r, queriesCount: t.length, helper: this }), this.emit("search", { state: r, results: this.lastResults })); var n = this.derivedHelpers.map(function (e) { var t = e.getModifiedState(r), n = ee._getQueries(t.index, t); return i.push({ state: t, queriesCount: n.length, helper: e }), e.emit("search", { state: t, results: e.lastResults }), n }), a = Array.prototype.concat.apply(t, n), s = this._queryId++; this._currentNbQueries++; try { this.client.search(a).then(this._dispatchAlgoliaResponse.bind(this, i, s)).catch(this._dispatchAlgoliaError.bind(this, s)) } catch (e) { this.emit("error", { error: e }) } }, ne.prototype._dispatchAlgoliaResponse = function (e, t, n) { if (!(t < this._lastQueryIdReceived)) { this._currentNbQueries -= t - this._lastQueryIdReceived, this._lastQueryIdReceived = t, 0 === this._currentNbQueries && this.emit("searchQueueEmpty"); var s = n.results.slice(); e.forEach(function (e) { var t = e.state, n = e.queriesCount, r = e.helper, i = s.splice(0, n), a = r.lastResults = new $(t, i); r.emit("result", { results: a, state: t }) }) } }, ne.prototype._dispatchAlgoliaError = function (e, t) { e < this._lastQueryIdReceived || (this._currentNbQueries -= e - this._lastQueryIdReceived, this._lastQueryIdReceived = e, this.emit("error", { error: t }), 0 === this._currentNbQueries && this.emit("searchQueueEmpty")) }, ne.prototype.containsRefinement = function (e, t, n, r) { return e || 0 !== t.length || 0 !== n.length || 0 !== r.length }, ne.prototype._hasDisjunctiveRefinements = function (e) { return this.state.disjunctiveRefinements[e] && 0 < this.state.disjunctiveRefinements[e].length }, ne.prototype._change = function (e) { var t = e.state, n = e.isPageReset; t !== this.state && (this.state = t, this.emit("change", { state: this.state, results: this.lastResults, isPageReset: n })) }, ne.prototype.clearCache = function () { return this.client.clearCache && this.client.clearCache(), this }, ne.prototype.setClient = function (e) { return this.client === e || ("function" == typeof e.addAlgoliaAgent && e.addAlgoliaAgent("JS Helper (3.7.0)"), this.client = e), this }, ne.prototype.getClient = function () { return this.client }, ne.prototype.derive = function (e) { var t = new G(this, e); return this.derivedHelpers.push(t), t }, ne.prototype.detachDerivedHelper = function (e) { var t = this.derivedHelpers.indexOf(e); if (-1 === t) throw new Error("Derived helper already detached"); this.derivedHelpers.splice(t, 1) }, ne.prototype.hasPendingRequests = function () { return 0 < this._currentNbQueries }; var ae = ne; function se(e, t, n) { return new ae(e, t, n) } se.version = te, se.AlgoliaSearchHelper = ae, se.SearchParameters = P, se.SearchResults = $; var oe = se; function ce(r) { function e() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; null === i && (i = ue.then(function () { i = null, a ? a = !1 : r.apply(void 0, t) })) } var i = null, a = !1; return e.wait = function () { if (null === i) throw new Error("The deferred function should be called before calling `wait()`"); return i }, e.cancel = function () { null !== i && (a = !0) }, e } var ue = Promise.resolve(); function le(e) { var t = "string" == typeof e, n = t ? document.querySelector(e) : e; if (function (e) { return e instanceof HTMLElement || Boolean(e) && 0 < e.nodeType }(n)) return n; var r = "Container must be `string` or `HTMLElement`."; throw t && (r += " Unable to find ".concat(e)), new Error(r) } function de(e) { return 1 === e.button || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey } function he(e) { return e.filter(function (e, t, n) { return n.indexOf(e) === t }) } function fe(e) { var t = e.defaultTemplates, n = e.templates; return W({ templatesConfig: e.templatesConfig }, function (a, e) { var s = 1 < arguments.length && void 0 !== e ? e : {}; return he([].concat(N(Object.keys(a || {})), N(Object.keys(s)))).reduce(function (e, t) { var n = a ? a[t] : void 0, r = s[t], i = void 0 !== r && r !== n; return e.templates[t] = i ? r : n, e.useCustomCompileOptions[t] = i, e }, { templates: {}, useCustomCompileOptions: {} }) }(t, n)) } function me(e, t) { return e(t = { exports: {} }, t.exports), t.exports } var pe = me(function (e, t) { !function (R) { var S = /\S/, t = /\"/g, n = /\n/g, r = /\r/g, i = /\\/g, a = /\u2028/, s = /\u2029/; function w(e) { "}" === e.n.substr(e.n.length - 1) && (e.n = e.n.substring(0, e.n.length - 1)) } function P(e) { return e.trim ? e.trim() : e.replace(/^\s*|\s*$/g, "") } function N(e, t, n) { if (t.charAt(n) != e.charAt(0)) return !1; for (var r = 1, i = e.length; r < i; r++)if (t.charAt(n + r) != e.charAt(r)) return !1; return !0 } R.tags = { "#": 1, "^": 2, "<": 3, $: 4, "/": 5, "!": 6, ">": 7, "=": 8, _v: 9, "{": 10, "&": 11, _t: 12 }, R.scan = function (e, t) { var n, r, i, a, s, o = e.length, c = 0, u = null, l = null, d = "", h = [], f = !1, m = 0, p = 0, g = "{{", v = "}}"; function y() { 0 < d.length && (h.push({ tag: "_t", text: new String(d) }), d = "") } function b(e, t) { if (y(), e && function () { for (var e = !0, t = p; t < h.length; t++)if (!(e = R.tags[h[t].tag] < R.tags._v || "_t" == h[t].tag && null === h[t].text.match(S))) return !1; return e }()) for (var n, r = p; r < h.length; r++)h[r].text && ((n = h[r + 1]) && ">" == n.tag && (n.indent = h[r].text.toString()), h.splice(r, 1)); else t || h.push({ tag: "\n" }); f = !1, p = h.length } for (t && (t = t.split(" "), g = t[0], v = t[1]), m = 0; m < o; m++)0 == c ? N(g, e, m) ? (--m, y(), c = 1) : "\n" == e.charAt(m) ? b(f) : d += e.charAt(m) : 1 == c ? (m += g.length - 1, c = "=" == (u = (l = R.tags[e.charAt(m + 1)]) ? e.charAt(m + 1) : "_v") ? (r = m, void 0, i = "=" + v, a = (n = e).indexOf(i, r), s = P(n.substring(n.indexOf("=", r) + 1, a)).split(" "), g = s[0], v = s[s.length - 1], m = a + i.length - 1, 0) : (l && m++, 2), f = m) : N(v, e, m) ? (h.push({ tag: u, n: P(d), otag: g, ctag: v, i: "/" == u ? f - g.length : m + v.length }), d = "", m += v.length - 1, c = 0, "{" == u && ("}}" == v ? m++ : w(h[h.length - 1]))) : d += e.charAt(m); return b(f, !0), h }; var u = { _t: !0, "\n": !0, $: !0, "/": !0 }; function l(e, t) { for (var n = 0, r = t.length; n < r; n++)if (t[n].o == e.n) return e.tag = "#", !0 } function d(e, t, n) { for (var r = 0, i = n.length; r < i; r++)if (n[r].c == e && n[r].o == t) return !0 } function o(e) { var t = []; for (var n in e.partials) t.push('"' + h(n) + '":{name:"' + h(e.partials[n].name) + '", ' + o(e.partials[n]) + "}"); return "partials: {" + t.join(",") + "}, subs: " + function (e) { var t = []; for (var n in e) t.push('"' + h(n) + '": function(c,p,t,i) {' + e[n] + "}"); return "{ " + t.join(",") + " }" }(e.subs) } R.stringify = function (e, t, n) { return "{code: function (c,p,i) { " + R.wrapMain(e.code) + " }," + o(e) + "}" }; var c = 0; function h(e) { return e.replace(i, "\\\\").replace(t, '\\"').replace(n, "\\n").replace(r, "\\r").replace(a, "\\u2028").replace(s, "\\u2029") } function f(e) { return ~e.indexOf(".") ? "d" : "f" } function m(e, t) { var n = "<" + (t.prefix || "") + e.n + c++; return t.partials[n] = { name: e.n, partials: {} }, t.code += 't.b(t.rp("' + h(n) + '",c,p,"' + (e.indent || "") + '"));', n } function e(e, t) { t.code += "t.b(t.t(t." + f(e.n) + '("' + h(e.n) + '",c,p,0)));' } function p(e) { return "t.b(" + e + ");" } R.generate = function (e, t, n) { c = 0; var r = { code: "", subs: {}, partials: {} }; return R.walk(e, r), n.asString ? this.stringify(r, t, n) : this.makeTemplate(r, t, n) }, R.wrapMain = function (e) { return 'var t=this;t.b(i=i||"");' + e + "return t.fl();" }, R.template = R.Template, R.makeTemplate = function (e, t, n) { var r = this.makePartials(e); return r.code = new Function("c", "p", "i", this.wrapMain(e.code)), new this.template(r, t, this, n) }, R.makePartials = function (e) { var t, n = { subs: {}, partials: e.partials, name: e.name }; for (t in n.partials) n.partials[t] = this.makePartials(n.partials[t]); for (t in e.subs) n.subs[t] = new Function("c", "p", "t", "i", e.subs[t]); return n }, R.codegen = { "#": function (e, t) { t.code += "if(t.s(t." + f(e.n) + '("' + h(e.n) + '",c,p,1),c,p,0,' + e.i + "," + e.end + ',"' + e.otag + " " + e.ctag + '")){t.rs(c,p,function(c,p,t){', R.walk(e.nodes, t), t.code += "});c.pop();}" }, "^": function (e, t) { t.code += "if(!t.s(t." + f(e.n) + '("' + h(e.n) + '",c,p,1),c,p,1,0,0,"")){', R.walk(e.nodes, t), t.code += "};" }, ">": m, "<": function (e, t) { var n = { partials: {}, code: "", subs: {}, inPartial: !0 }; R.walk(e.nodes, n); var r = t.partials[m(e, t)]; r.subs = n.subs, r.partials = n.partials }, $: function (e, t) { var n = { subs: {}, code: "", partials: t.partials, prefix: e.n }; R.walk(e.nodes, n), t.subs[e.n] = n.code, t.inPartial || (t.code += 't.sub("' + h(e.n) + '",c,p,i);') }, "\n": function (e, t) { t.code += p('"\\n"' + (e.last ? "" : " + i")) }, _v: function (e, t) { t.code += "t.b(t.v(t." + f(e.n) + '("' + h(e.n) + '",c,p,0)));' }, _t: function (e, t) { t.code += p('"' + h(e.text) + '"') }, "{": e, "&": e }, R.walk = function (e, t) { for (var n, r = 0, i = e.length; r < i; r++)(n = R.codegen[e[r].tag]) && n(e[r], t); return t }, R.parse = function (e, t, n) { return function e(t, n, r, i) { var a, s = [], o = null, c = null; for (a = r[r.length - 1]; 0 < t.length;) { if (c = t.shift(), a && "<" == a.tag && !(c.tag in u)) throw new Error("Illegal content in < super tag."); if (R.tags[c.tag] <= R.tags.$ || l(c, i)) r.push(c), c.nodes = e(t, c.tag, r, i); else { if ("/" == c.tag) { if (0 === r.length) throw new Error("Closing tag without opener: /" + c.n); if (o = r.pop(), c.n != o.n && !d(c.n, o.n, i)) throw new Error("Nesting error: " + o.n + " vs. " + c.n); return o.end = c.i, s } "\n" == c.tag && (c.last = 0 == t.length || "\n" == t[0].tag) } s.push(c) } if (0 < r.length) throw new Error("missing closing tag: " + r.pop().n); return s }(e, 0, [], (n = n || {}).sectionTags || []) }, R.cache = {}, R.cacheKey = function (e, t) { return [e, !!t.asString, !!t.disableLambda, t.delimiters, !!t.modelGet].join("||") }, R.compile = function (e, t) { t = t || {}; var n = R.cacheKey(e, t), r = this.cache[n]; if (r) { var i = r.partials; for (var a in i) delete i[a].instance; return r } return r = this.generate(this.parse(this.scan(e, t.delimiters), e, t), e, t), this.cache[n] = r } }(t) }), ge = me(function (e, t) { !function (e) { function l(e, t, n) { var r; return t && "object" == typeof t && (void 0 !== t[e] ? r = t[e] : n && t.get && "function" == typeof t.get && (r = t.get(e))), r } e.Template = function (e, t, n, r) { e = e || {}, this.r = e.code || this.r, this.c = n, this.options = r || {}, this.text = t || "", this.partials = e.partials || {}, this.subs = e.subs || {}, this.buf = "" }, e.Template.prototype = { r: function (e, t, n) { return "" }, v: function (e) { return e = o(e), s.test(e) ? e.replace(t, "&amp;").replace(n, "&lt;").replace(r, "&gt;").replace(i, "&#39;").replace(a, "&quot;") : e }, t: o, render: function (e, t, n) { return this.ri([e], t || {}, n) }, ri: function (e, t, n) { return this.r(e, t, n) }, ep: function (e, t) { var n = this.partials[e], r = t[n.name]; if (n.instance && n.base == r) return n.instance; if ("string" == typeof r) { if (!this.c) throw new Error("No compiler available."); r = this.c.compile(r, this.options) } if (!r) return null; if (this.partials[e].base = r, n.subs) { for (key in t.stackText || (t.stackText = {}), n.subs) t.stackText[key] || (t.stackText[key] = void 0 !== this.activeSub && t.stackText[this.activeSub] ? t.stackText[this.activeSub] : this.text); r = function (e, t, n, r, i, a) { function s() { } function o() { } var c; o.prototype = (s.prototype = e).subs; var u = new s; for (c in u.subs = new o, u.subsText = {}, u.buf = "", r = r || {}, u.stackSubs = r, u.subsText = a, t) r[c] || (r[c] = t[c]); for (c in r) u.subs[c] = r[c]; for (c in i = i || {}, u.stackPartials = i, n) i[c] || (i[c] = n[c]); for (c in i) u.partials[c] = i[c]; return u }(r, n.subs, n.partials, this.stackSubs, this.stackPartials, t.stackText) } return this.partials[e].instance = r }, rp: function (e, t, n, r) { var i = this.ep(e, n); return i ? i.ri(t, n, r) : "" }, rs: function (e, t, n) { var r = e[e.length - 1]; if (d(r)) for (var i = 0; i < r.length; i++)e.push(r[i]), n(e, t, this), e.pop(); else n(e, t, this) }, s: function (e, t, n, r, i, a, s) { var o; return (!d(e) || 0 !== e.length) && ("function" == typeof e && (e = this.ms(e, t, n, r, i, a, s)), o = !!e, !r && o && t && t.push("object" == typeof e ? e : t[t.length - 1]), o) }, d: function (e, t, n, r) { var i, a = e.split("."), s = this.f(a[0], t, n, r), o = this.options.modelGet, c = null; if ("." === e && d(t[t.length - 2])) s = t[t.length - 1]; else for (var u = 1; u < a.length; u++)s = void 0 !== (i = l(a[u], s, o)) ? (c = s, i) : ""; return !(r && !s) && (r || "function" != typeof s || (t.push(c), s = this.mv(s, t, n), t.pop()), s) }, f: function (e, t, n, r) { for (var i = !1, a = !1, s = this.options.modelGet, o = t.length - 1; 0 <= o; o--)if (void 0 !== (i = l(e, t[o], s))) { a = !0; break } return a ? (r || "function" != typeof i || (i = this.mv(i, t, n)), i) : !r && "" }, ls: function (e, t, n, r, i) { var a = this.options.delimiters; return this.options.delimiters = i, this.b(this.ct(o(e.call(t, r)), t, n)), this.options.delimiters = a, !1 }, ct: function (e, t, n) { if (this.options.disableLambda) throw new Error("Lambda features disabled."); return this.c.compile(e, this.options).render(t, n) }, b: function (e) { this.buf += e }, fl: function () { var e = this.buf; return this.buf = "", e }, ms: function (e, t, n, r, i, a, s) { var o, c = t[t.length - 1], u = e.call(c); return "function" == typeof u ? !!r || (o = this.activeSub && this.subsText && this.subsText[this.activeSub] ? this.subsText[this.activeSub] : this.text, this.ls(u, c, n, o.substring(i, a), s)) : u }, mv: function (e, t, n) { var r = t[t.length - 1], i = e.call(r); return "function" == typeof i ? this.ct(o(i.call(r)), r, n) : i }, sub: function (e, t, n, r) { var i = this.subs[e]; i && (this.activeSub = e, i(t, n, this, r), this.activeSub = !1) } }; var t = /&/g, n = /</g, r = />/g, i = /\'/g, a = /\"/g, s = /[&<>\"\']/; function o(e) { return String(null == e ? "" : e) } var d = Array.isArray || function (e) { return "[object Array]" === Object.prototype.toString.call(e) } }(t) }); pe.Template = ge.Template, pe.template = pe.Template; var ve = pe; function ye(e) { var t = e.templates, n = e.templateKey, r = e.compileOptions, i = e.helpers, a = e.data, s = e.bindEvent, o = t[n]; if ("string" != typeof o && "function" != typeof o) throw new Error("Template must be 'string' or 'function', was '".concat(h(o), "' (key: ").concat(n, ")")); if ("function" == typeof o) return o(a, s); var c = function (e, t, n) { var r = 0 < arguments.length && void 0 !== e ? e : {}, i = 1 < arguments.length ? t : void 0, a = 2 < arguments.length ? n : void 0; return Object.keys(r).reduce(function (e, n) { return W(W({}, e), {}, k({}, n, function () { var t = this; return function (e) { return r[n].call(a, e, function (e) { return ve.compile(e, i).render(t) }) } })) }, {}) }(i, r, a); return ve.compile(o, r).render(W(W({}, a), {}, { helpers: c })).replace(/[ \n\r\t\f\xA0]+/g, function (e) { return e.replace(/(^|\xA0+)[^\xA0]+/g, "$1 ") }).trim() } function be(e, t) { for (var n, r = 0; r < e.length; r++)if (t(n = e[r], r, e)) return n } function Re(e) { return String(e).replace(/^\\-/, "-") } function Se(i, e, a, s, t) { var o, n = { type: e, attribute: a, name: s }, c = be(4 < arguments.length && void 0 !== t ? t : [], function (e) { return e.name === a }); "hierarchical" === e ? function () { for (var e = i.getHierarchicalFacetByName(a), n = s.split(e.separator), t = function (t) { c = c && c.data && be(Object.keys(c.data).map(function (t) { return function (e) { return t[e] } }(c.data)), function (e) { return e.name === n[t] }) }, r = 0; void 0 !== c && r < n.length; ++r)t(r); o = c && c.count }() : o = c && c.data && c.data[n.name]; var r = c && c.exhaustive; return void 0 !== o && (n.count = o), void 0 !== r && (n.exhaustive = r), n } function we(n, r, e) { var t = 2 < arguments.length && void 0 !== e && e, a = [], i = r.facetsRefinements, s = void 0 === i ? {} : i, o = r.facetsExcludes, c = void 0 === o ? {} : o, u = r.disjunctiveFacetsRefinements, l = void 0 === u ? {} : u, d = r.hierarchicalFacetsRefinements, h = void 0 === d ? {} : d, f = r.numericRefinements, m = void 0 === f ? {} : f, p = r.tagRefinements, g = void 0 === p ? [] : p; return Object.keys(s).forEach(function (t) { s[t].forEach(function (e) { a.push(Se(r, "facet", t, e, n.facets)) }) }), Object.keys(c).forEach(function (t) { c[t].forEach(function (e) { a.push({ type: "exclude", attribute: t, name: e, exclude: !0 }) }) }), Object.keys(l).forEach(function (t) { l[t].forEach(function (e) { a.push(Se(r, "disjunctive", t, Re(e), n.disjunctiveFacets)) }) }), Object.keys(h).forEach(function (t) { h[t].forEach(function (e) { a.push(Se(r, "hierarchical", t, e, n.hierarchicalFacets)) }) }), Object.keys(m).forEach(function (r) { var i = m[r]; Object.keys(i).forEach(function (e) { var t = e, n = i[t]; (Array.isArray(n) ? n : [n]).forEach(function (e) { a.push({ type: "numeric", attribute: r, name: "".concat(e), numericValue: e, operator: t }) }) }) }), g.forEach(function (e) { a.push({ type: "tag", attribute: "_tags", name: e }) }), t && r.query && r.query.trim() && a.push({ attribute: "query", type: "query", name: r.query, query: r.query }), a } function Pe(e) { var t = e.helper, n = e.attributesToClear, r = void 0 === n ? [] : n, i = t.state.setPage(0); return i = r.reduce(function (e, t) { return i.isNumericRefined(t) ? e.removeNumericRefinement(t) : i.isHierarchicalFacet(t) ? e.removeHierarchicalFacetRefinement(t) : i.isDisjunctiveFacet(t) ? e.removeDisjunctiveFacetRefinement(t) : i.isConjunctiveFacet(t) ? e.removeFacetRefinement(t) : e }, i), -1 !== r.indexOf("query") && (i = i.setQuery("")), i } function Ne(e) { return "number" == typeof e && e < 0 && (e = String(e).replace(/^-/, "\\-")), e } function xe(e, t) { if (void 0 === e || "function" != typeof e) throw new Error("The render function is not valid (received type ".concat(function (e) { return Object.prototype.toString.call(e).slice(8, -1) }(e), ").\n\n").concat(t)) } function _e() { } function Ie(e, t) { return e } function Fe(e, t) { return (Array.isArray(t) ? t : t.split(".")).reduce(function (e, t) { return e && e[t] }, e) } function Te(e) { return "number" == typeof e && isFinite(e) } function Ce(e) { if (!function (e) { return "object" === h(e) && null !== e }(e) || "[object Object]" !== function (e) { return null === e ? void 0 === e ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e) }(e)) return !1; if (null === Object.getPrototypeOf(e)) return !0; for (var t = e; null !== Object.getPrototypeOf(t);)t = Object.getPrototypeOf(t); return Object.getPrototypeOf(e) === t } function Ee(e) { var t = e.start, n = void 0 === t ? 0 : t, r = e.end, i = e.step, a = void 0 === i ? 1 : i, s = 0 === a ? 1 : a, o = Math.round((r - n) / s); return N(Array(o)).map(function (e, t) { return n + t * s }) } function ke(e) { return e !== Object(e) } function Le(e, t) { if (e === t) return !0; if (ke(e) || ke(t) || "function" == typeof e || "function" == typeof t) return e === t; if (Object.keys(e).length !== Object.keys(t).length) return !1; for (var n = 0, r = Object.keys(e); n < r.length; n++) { var i = r[n]; if (!(i in t)) return !1; if (!Le(e[i], t[i])) return !1 } return !0 } var je = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, Me = /[&<>"']/g, Oe = RegExp(Me.source); var Ae = { "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" }, He = /&(amp|quot|lt|gt|#39);/g, We = RegExp(He.source); var De = { highlightPreTag: "__ais-highlight__", highlightPostTag: "__/ais-highlight__" }, Be = { highlightPreTag: "<mark>", highlightPostTag: "</mark>" }; function Ue(e) { return function (e) { return e && Oe.test(e) ? e.replace(Me, function (e) { return je[e] }) : e }(e).replace(new RegExp(De.highlightPreTag, "g"), Be.highlightPreTag).replace(new RegExp(De.highlightPostTag, "g"), Be.highlightPostTag) } function qe(n) { return Ce(n) && "string" != typeof n.value ? Object.keys(n).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, qe(n[t]))) }, {}) : Array.isArray(n) ? n.map(qe) : W(W({}, n), {}, { value: Ue(n.value) }) } function Qe(e) { return void 0 === e.__escaped && ((e = e.map(function (e) { var t = f({}, e); return t._highlightResult && (t._highlightResult = qe(t._highlightResult)), t._snippetResult && (t._snippetResult = qe(t._snippetResult)), t })).__escaped = !0), e } function $e(e) { var t = Be.highlightPreTag, n = Be.highlightPostTag; return e.map(function (e) { return e.isHighlighted ? t + e.value + n : e.value }).join("") } function Ve(e) { var n = Be.highlightPostTag, t = Be.highlightPreTag, r = e.split(t), i = r.shift(), a = i ? [{ value: i, isHighlighted: !1 }] : []; return r.forEach(function (e) { var t = e.split(n); a.push({ value: t[0], isHighlighted: !0 }), "" !== t[1] && a.push({ value: t[1], isHighlighted: !1 }) }), a } var Ke = new RegExp(/\w/i); function ze(e, t) { var n, r, i = e[t], a = (null === (n = e[t + 1]) || void 0 === n ? void 0 : n.isHighlighted) || !0, s = (null === (r = e[t - 1]) || void 0 === r ? void 0 : r.isHighlighted) || !0; return Ke.test(function (e) { return e && We.test(e) ? e.replace(He, function (e) { return Ae[e] }) : e }(i.value)) || s !== a ? i.isHighlighted : s } function Je(n) { return n.some(function (e) { return e.isHighlighted }) ? n.map(function (e, t) { return W(W({}, e), {}, { isHighlighted: !ze(n, t) }) }) : n.map(function (e) { return W(W({}, e), {}, { isHighlighted: !1 }) }) } function Ye(e, t) { return e.setQueryParameters({ hierarchicalFacets: t.hierarchicalFacets.reduce(function (e, t) { var n = function (e, t) { if (!Array.isArray(e)) return -1; for (var n = 0; n < e.length; n++)if (t(e[n])) return n; return -1 }(e, function (e) { return e.name === t.name }); if (-1 === n) return e.concat(t); var r = e.slice(); return r.splice(n, 1, t), r }, e.hierarchicalFacets) }) } function Xe() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; return t.reduce(function (e, t) { var n = function (e, t) { return e.setQueryParameters({ hierarchicalFacetsRefinements: W(W({}, e.hierarchicalFacetsRefinements), t.hierarchicalFacetsRefinements) }) }(e, t); return function (e, t) { t.facets, t.disjunctiveFacets, t.facetsRefinements, t.facetsExcludes, t.disjunctiveFacetsRefinements, t.numericRefinements, t.tagRefinements, t.hierarchicalFacets, t.hierarchicalFacetsRefinements, t.ruleContexts; var n = j(t, ["facets", "disjunctiveFacets", "facetsRefinements", "facetsExcludes", "disjunctiveFacetsRefinements", "numericRefinements", "tagRefinements", "hierarchicalFacets", "hierarchicalFacetsRefinements", "ruleContexts"]); return e.setQueryParameters(n) }(function (e, t) { return t.facets.reduce(function (e, t) { return e.addFacet(t) }, e) }(function (e, t) { var n = he([].concat(e.ruleContexts).concat(t.ruleContexts).filter(Boolean)); return 0 < n.length ? e.setQueryParameters({ ruleContexts: n }) : e }(function (e, t) { return t.disjunctiveFacets.reduce(function (e, t) { return e.addDisjunctiveFacet(t) }, e) }(function (e, t) { return e.setQueryParameters({ facetsRefinements: W(W({}, e.facetsRefinements), t.facetsRefinements) }) }(function (e, t) { return e.setQueryParameters({ facetsExcludes: W(W({}, e.facetsExcludes), t.facetsExcludes) }) }(function (e, t) { return e.setQueryParameters({ disjunctiveFacetsRefinements: W(W({}, e.disjunctiveFacetsRefinements), t.disjunctiveFacetsRefinements) }) }(function (e, t) { return e.setQueryParameters({ numericRefinements: W(W({}, e.numericRefinements), t.numericRefinements) }) }(function (e, t) { return t.tagRefinements.reduce(function (e, t) { return e.addTagRefinement(t) }, e) }(Ye(n, t), t), t), t), t), t), t), t), t), t) }) } function Ge(e) { return Array.isArray(e) ? e : [e] } function Ze() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; var r = t.map(function (e) { return function (e) { var t = e.name, n = e.connector; return ["https://www.algolia.com/doc/api-reference/widgets/", t, "/js/", void 0 !== n && n ? "#connector" : ""].join("") }(e) }).join(", "); return function (e) { return [e, "See documentation: ".concat(r)].filter(Boolean).join("\n\n") } } var et = /^(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)$/; function tt(e) { return Array.isArray(e) ? function (e) { var t = D(e, 1)[0], n = D(t = void 0 === t ? [void 0, void 0, void 0, void 0] : t, 4), r = n[0], i = n[1], a = n[2], s = n[3]; if (!(r && i && a && s)) throw new Error('Invalid value for "insideBoundingBox" parameter: ['.concat(e, "]")); return { northEast: { lat: r, lng: i }, southWest: { lat: a, lng: s } } }(e) : function (e) { var t = D(e.split(",").map(parseFloat), 4), n = t[0], r = t[1], i = t[2], a = t[3]; if (!(n && r && i && a)) throw new Error('Invalid value for "insideBoundingBox" parameter: "'.concat(e, '"')); return { northEast: { lat: n, lng: r }, southWest: { lat: i, lng: a } } }(e) } function nt(e, n, r) { return e.map(function (e, t) { return W(W({}, e), {}, { __position: r * n + t + 1 }) }) } function rt(e, t) { return t ? e.map(function (e) { return W(W({}, e), {}, { __queryID: t }) }) : e } function it(e) { var o = e.instantSearchInstance, c = e.helper, u = e.attribute, l = e.widgetType; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; var r = t[0], i = t[1], a = t[2], s = void 0 === a ? "Filter Applied" : a; 1 === t.length && "object" === h(t[0]) ? o.sendEventToInsights(t[0]) : "click" !== r || 2 !== t.length && 3 !== t.length || function (e, t, n) { return e.state.isHierarchicalFacet(t) ? e.state.isHierarchicalFacetRefined(t, n) : e.state.isConjunctiveFacet(t) ? e.state.isFacetRefined(t, n) : e.state.isDisjunctiveFacetRefined(t, n) }(c, u, i) || o.sendEventToInsights({ insightsMethod: "clickedFilters", widgetType: l, eventType: r, payload: { eventName: s, index: c.getIndex(), filters: ["".concat(u, ":").concat(i)] }, attribute: u }) } } function at(e) { return btoa(encodeURIComponent(JSON.stringify(e))) } function st(e) { return JSON.parse(decodeURIComponent(atob(e))) } function ot(e) { var n = e.index, r = e.widgetType, t = (e.methodName, e.args); if (1 === t.length && "object" === h(t[0])) return [t[0]]; var i = t[0], a = t[1], s = t[2]; if (!a) return []; if (("click" === i || "conversion" === i) && !s) return []; var o = Array.isArray(a) ? function (e) { return e.slice() }(a) : [a]; if (0 === o.length) return []; var c = o[0].__queryID, u = function (e, t) { for (var n = 1 < arguments.length && void 0 !== t ? t : 20, r = [], i = 0; i < Math.ceil(e.length / n); i++)r.push(e.slice(i * n, (i + 1) * n)); return r }(o), l = u.map(function (e) { return e.map(function (e) { return e.objectID }) }), d = u.map(function (e) { return e.map(function (e) { return e.__position }) }); return "view" === i ? u.map(function (e, t) { return { insightsMethod: "viewedObjectIDs", widgetType: r, eventType: i, payload: { eventName: s || "Hits Viewed", index: n, objectIDs: l[t] }, hits: e } }) : "click" === i ? u.map(function (e, t) { return { insightsMethod: "clickedObjectIDsAfterSearch", widgetType: r, eventType: i, payload: { eventName: s, index: n, queryID: c, objectIDs: l[t], positions: d[t] }, hits: e } }) : "conversion" === i ? u.map(function (e, t) { return { insightsMethod: "convertedObjectIDsAfterSearch", widgetType: r, eventType: i, payload: { eventName: s, index: n, queryID: c, objectIDs: l[t] }, hits: e } }) : [] } function ct(e) { var r = e.instantSearchInstance, i = e.index, a = e.widgetType; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; ot({ widgetType: a, index: i, methodName: "sendEvent", args: t }).forEach(function (e) { return r.sendEventToInsights(e) }) } } function ut(e) { var i = e.index, a = e.widgetType; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; var r = ot({ widgetType: a, index: i, methodName: "bindEvent", args: t }); return r.length ? "data-insights-event=".concat(at(r)) : "" } } function lt(e, n) { if (!e) return null; var r = e.numericRefinements[n], i = []; return Object.keys(r).filter(function (e) { return Array.isArray(r[e]) && 0 < r[e].length }).forEach(function (t) { r[t].forEach(function (e) { i.push("".concat(n).concat(t).concat(e)) }) }), i } function dt(r, i) { var a = null; return function () { for (var e = arguments.length, n = new Array(e), t = 0; t < e; t++)n[t] = arguments[t]; return new Promise(function (e, t) { a && clearTimeout(a), a = setTimeout(function () { a = null, Promise.resolve(r.apply(void 0, n)).then(e).catch(t) }, i) }) } } function ht(e, t) { var n, r = null === (n = e.getWidgetRenderState) || void 0 === n ? void 0 : n.call(e, t), i = null; if (r && r.widgetParams) { var a = r.widgetParams; a.attribute ? i = a.attribute : Array.isArray(a.attributes) && (i = a.attributes[0]) } if ("string" != typeof i) throw new Error("Could not find the attribute of the widget:\n\n".concat(JSON.stringify(e), "\n\nPlease check whether the widget's getWidgetRenderState returns widgetParams.attribute correctly.")); return i } function ft(e, t) { var n = (1 < arguments.length && void 0 !== t ? t : { fallback: function () { } }).fallback; return "undefined" == typeof window ? n() : e({ window: window }) } var mt = Ze({ name: "index-widget" }); function pt(e) { return "ais.index" === e.$$type } function gt(e, t) { var n = t.state, r = t.isPageReset, i = t._uiState; n !== e.state && (e.state = n, e.emit("change", { state: e.state, results: e.lastResults, isPageReset: r, _uiState: i })) } function vt(e, n, t) { var r = 2 < arguments.length && void 0 !== t ? t : {}; return e.reduce(function (e, t) { return pt(t) ? e : t.getWidgetUiState || t.getWidgetState ? t.getWidgetUiState ? t.getWidgetUiState(e, n) : t.getWidgetState(e, n) : e }, r) } function yt(e, t) { var n = t.initialSearchParameters, r = j(t, ["initialSearchParameters"]); return e.filter(function (e) { return !pt(e) }).reduce(function (e, t) { return t.getWidgetSearchParameters ? t.getWidgetSearchParameters(e, r) : e }, n) } function bt(e) { if (void 0 === e || void 0 === e.indexName) throw new Error(mt("The `indexName` option is required.")); var l = e.indexName, t = e.indexId, d = void 0 === t ? l : t, h = [], f = {}, m = null, p = null, g = null, v = null; return { $$type: "ais.index", $$widgetType: "ais.index", getIndexName: function () { return l }, getIndexId: function () { return d }, getHelper: function () { return g }, getResults: function () { return v && v.lastResults }, getScopedResults: function () { var e = this.getParent(); return function n(e) { return e.filter(pt).reduce(function (e, t) { return e.concat.apply(e, [{ indexId: t.getIndexId(), results: t.getResults(), helper: t.getHelper() }].concat(N(n(t.getWidgets())))) }, []) }(e ? e.getWidgets() : [this]) }, getParent: function () { return p }, createURL: function (e) { return m._createURL(k({}, d, vt(h, { searchParameters: e, helper: g }))) }, getWidgets: function () { return h }, addWidgets: function (e) { var t = this; if (!Array.isArray(e)) throw new Error(mt("The `addWidgets` method expects an array of widgets.")); if (e.some(function (e) { return "function" != typeof e.init && "function" != typeof e.render })) throw new Error(mt("The widget definition expects a `render` and/or an `init` method.")); return h = h.concat(e), m && Boolean(e.length) && (gt(g, { state: yt(h, { uiState: f, initialSearchParameters: g.state }), _uiState: f }), e.forEach(function (e) { e.getRenderState && Rt({ renderState: e.getRenderState(m.renderState[t.getIndexId()] || {}, { uiState: m._initialUiState, helper: t.getHelper(), parent: t, instantSearchInstance: m, state: g.state, renderState: m.renderState, templatesConfig: m.templatesConfig, createURL: t.createURL, scopedResults: [], searchMetadata: { isSearchStalled: m._isSearchStalled } }), instantSearchInstance: m, parent: t }) }), e.forEach(function (e) { e.init && e.init({ helper: g, parent: t, uiState: m._initialUiState, instantSearchInstance: m, state: g.state, renderState: m.renderState, templatesConfig: m.templatesConfig, createURL: t.createURL, scopedResults: [], searchMetadata: { isSearchStalled: m._isSearchStalled } }) }), m.scheduleSearch()), this }, removeWidgets: function (t) { var n = this; if (!Array.isArray(t)) throw new Error(mt("The `removeWidgets` method expects an array of widgets.")); if (t.some(function (e) { return "function" != typeof e.dispose })) throw new Error(mt("The widget definition expects a `dispose` method.")); if (h = h.filter(function (e) { return -1 === t.indexOf(e) }), m && Boolean(t.length)) { var e = t.reduce(function (e, t) { return t.dispose({ helper: g, state: e, parent: n }) || e }, g.state); f = vt(h, { searchParameters: e, helper: g }), g.setState(yt(h, { uiState: f, initialSearchParameters: e })), h.length && m.scheduleSearch() } return this }, init: function (e) { var t, n = this, r = e.instantSearchInstance, i = e.parent, a = e.uiState; if (null === g) { m = r, p = i, f = a[d] || {}; var s = r.mainHelper, o = yt(h, { uiState: f, initialSearchParameters: new oe.SearchParameters({ index: l }) }); (g = oe({}, o.index, o)).search = function () { return r.onStateChange ? (r.onStateChange({ uiState: r.mainIndex.getWidgetUiState({}), setUiState: r.setUiState.bind(r) }), s) : s.search() }, g.searchWithoutTriggeringOnStateChange = function () { return s.search() }, g.searchForFacetValues = function (e, t, n, r) { var i = g.state.setQueryParameters(r); return s.searchForFacetValues(e, t, n, i) }, v = s.derive(function () { return Xe.apply(void 0, N(function (e) { for (var t = e.getParent(), n = [e.getHelper().state]; null !== t;)n = [t.getHelper().state].concat(n), t = t.getParent(); return n }(n))) }); var c = null === (t = r._initialResults) || void 0 === t ? void 0 : t[this.getIndexId()]; if (c) { var u = new oe.SearchResults(new oe.SearchParameters(c.state), c.results); v.lastResults = u, g.lastResults = u } g.on("change", function (e) { e.isPageReset && !function n(e) { var t = e.filter(pt); 0 !== t.length && t.forEach(function (e) { var t = e.getHelper(); gt(t, { state: t.state.resetPage(), isPageReset: !0 }), n(e.getWidgets()) }) }(h) }), v.on("search", function () { r.scheduleStalledRender() }), v.on("result", function (e) { var t = e.results; r.scheduleRender(), g.lastResults = t }), h.forEach(function (e) { e.getRenderState && Rt({ renderState: e.getRenderState(r.renderState[n.getIndexId()] || {}, { uiState: a, helper: g, parent: n, instantSearchInstance: r, state: g.state, renderState: r.renderState, templatesConfig: r.templatesConfig, createURL: n.createURL, scopedResults: [], searchMetadata: { isSearchStalled: r._isSearchStalled } }), instantSearchInstance: r, parent: n }) }), h.forEach(function (e) { e.init && e.init({ uiState: a, helper: g, parent: n, instantSearchInstance: r, state: g.state, renderState: r.renderState, templatesConfig: r.templatesConfig, createURL: n.createURL, scopedResults: [], searchMetadata: { isSearchStalled: r._isSearchStalled } }) }), g.on("change", function (e) { var t = e.state, n = e._uiState; f = vt(h, { searchParameters: t, helper: g }, n || {}), r.onStateChange || r.onInternalStateChange() }), c && r.scheduleRender() } }, render: function (e) { var t = this, n = e.instantSearchInstance; this.getResults() && (h.forEach(function (e) { e.getRenderState && Rt({ renderState: e.getRenderState(n.renderState[t.getIndexId()] || {}, { helper: t.getHelper(), parent: t, instantSearchInstance: n, results: t.getResults(), scopedResults: t.getScopedResults(), state: t.getResults()._state, renderState: n.renderState, templatesConfig: n.templatesConfig, createURL: t.createURL, searchMetadata: { isSearchStalled: n._isSearchStalled } }), instantSearchInstance: n, parent: t }) }), h.forEach(function (e) { e.render && e.render({ helper: g, parent: t, instantSearchInstance: n, results: t.getResults(), scopedResults: t.getScopedResults(), state: t.getResults()._state, renderState: n.renderState, templatesConfig: n.templatesConfig, createURL: t.createURL, searchMetadata: { isSearchStalled: n._isSearchStalled } }) })) }, dispose: function () { var t = this; h.forEach(function (e) { e.dispose && e.dispose({ helper: g, state: g.state, parent: t }) }), p = m = null, g.removeAllListeners(), g = null, v.detach(), v = null }, getWidgetUiState: function (e) { return h.filter(pt).reduce(function (e, t) { return t.getWidgetUiState(e) }, W(W({}, e), {}, k({}, this.getIndexId(), f))) }, getWidgetState: function (e) { return this.getWidgetUiState(e) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return yt(h, { uiState: n, initialSearchParameters: e }) }, refreshUiState: function () { f = vt(h, { searchParameters: this.getHelper().state, helper: this.getHelper() }, f) } } } function Rt(e) { var t = e.renderState, n = e.instantSearchInstance, r = e.parent, i = r ? r.getIndexId() : n.mainIndex.getIndexId(); n.renderState = W(W({}, n.renderState), {}, k({}, i, W(W({}, n.renderState[i]), t))) } function St(a) { return function () { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, t = e.descendantName, n = e.modifierName, r = t ? "-".concat(t) : "", i = n ? "--".concat(n) : ""; return "".concat("ais", "-").concat(a).concat(r).concat(i) } } var wt = St("Highlight"); function Pt(e) { var t = e.attribute, n = e.highlightedTagName, r = void 0 === n ? "mark" : n, i = e.hit, a = e.cssClasses, s = void 0 === a ? {} : a, o = (Fe(i._highlightResult, t) || {}).value, c = void 0 === o ? "" : o, u = wt({ descendantName: "highlighted" }) + (s.highlighted ? " ".concat(s.highlighted) : ""); return c.replace(new RegExp(Be.highlightPreTag, "g"), "<".concat(r, ' class="').concat(u, '">')).replace(new RegExp(Be.highlightPostTag, "g"), "</".concat(r, ">")) } var Nt = St("ReverseHighlight"); function xt(e) { var t = e.attribute, n = e.highlightedTagName, r = void 0 === n ? "mark" : n, i = e.hit, a = e.cssClasses, s = void 0 === a ? {} : a, o = (Fe(i._highlightResult, t) || {}).value, c = void 0 === o ? "" : o, u = Nt({ descendantName: "highlighted" }) + (s.highlighted ? " ".concat(s.highlighted) : ""); return $e(Je(Ve(c))).replace(new RegExp(Be.highlightPreTag, "g"), "<".concat(r, ' class="').concat(u, '">')).replace(new RegExp(Be.highlightPostTag, "g"), "</".concat(r, ">")) } var _t = St("Snippet"); function It(e) { var t = e.attribute, n = e.highlightedTagName, r = void 0 === n ? "mark" : n, i = e.hit, a = e.cssClasses, s = void 0 === a ? {} : a, o = (Fe(i._snippetResult, t) || {}).value, c = void 0 === o ? "" : o, u = _t({ descendantName: "highlighted" }) + (s.highlighted ? " ".concat(s.highlighted) : ""); return c.replace(new RegExp(Be.highlightPreTag, "g"), "<".concat(r, ' class="').concat(u, '">')).replace(new RegExp(Be.highlightPostTag, "g"), "</".concat(r, ">")) } var Ft = St("ReverseSnippet"); function Tt(e) { var t = e.attribute, n = e.highlightedTagName, r = void 0 === n ? "mark" : n, i = e.hit, a = e.cssClasses, s = void 0 === a ? {} : a, o = (Fe(i._snippetResult, t) || {}).value, c = void 0 === o ? "" : o, u = Ft({ descendantName: "highlighted" }) + (s.highlighted ? " ".concat(s.highlighted) : ""); return $e(Je(Ve(c))).replace(new RegExp(Be.highlightPreTag, "g"), "<".concat(r, ' class="').concat(u, '">')).replace(new RegExp(Be.highlightPostTag, "g"), "</".concat(r, ">")) } function Ct(e, t) { return function (e) { var t, n = e.method, r = e.payload; if ("object" !== h(r)) throw new Error("The insights helper expects the payload to be an object."); try { t = at(r) } catch (e) { throw new Error("Could not JSON serialize the payload object.") } return 'data-insights-method="'.concat(n, '" data-insights-payload="').concat(t, '"') }({ method: e, payload: t }) } function Et() { return function (e) { for (var t = "".concat(e, "="), n = document.cookie.split(";"), r = 0; r < n.length; r++) { for (var i = n[r]; " " === i.charAt(0);)i = i.substring(1); if (0 === i.indexOf(t)) return i.substring(t.length, i.length) } }("_ALGOLIA") } function kt(e) { e.configure; return j(e, ["configure"]) } function Lt() { return { stateToRoute: function (n) { return Object.keys(n).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, kt(n[t]))) }, {}) }, routeToState: function (e) { var n = 0 < arguments.length && void 0 !== e ? e : {}; return Object.keys(n).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, kt(n[t]))) }, {}) } } } function jt(e, t) { for (var n = t && t.plainObjects ? Object.create(null) : {}, r = 0; r < e.length; ++r)void 0 !== e[r] && (n[r] = e[r]); return n } function Mt(e, t) { Xt.apply(e, Yt(t) ? t : [t]) } function Ot(e, t, n, r, i, a, s, o, c, u, l, d, h, f) { var m = e; if ("function" == typeof s ? m = s(t, m) : m instanceof Date ? m = u(m) : "comma" === n && Yt(m) && (m = Kt.maybeMap(m, function (e) { return e instanceof Date ? u(e) : e })), null === m) { if (r) return a && !h ? a(t, en.encoder, f, "key", l) : t; m = "" } if (function (e) { return "string" == typeof e || "number" == typeof e || "boolean" == typeof e || "symbol" == typeof e || "bigint" == typeof e }(m) || Kt.isBuffer(m)) return a ? [d(h ? t : a(t, en.encoder, f, "key", l)) + "=" + d(a(m, en.encoder, f, "value", l))] : [d(t) + "=" + d(String(m))]; var p, g = []; if (void 0 === m) return g; if ("comma" === n && Yt(m)) p = [{ value: 0 < m.length ? m.join(",") || null : void 0 }]; else if (Yt(s)) p = s; else { var v = Object.keys(m); p = o ? v.sort(o) : v } for (var y = 0; y < p.length; ++y) { var b = p[y], R = "object" == typeof b && void 0 !== b.value ? b.value : m[b]; if (!i || null !== R) { var S = Yt(m) ? "function" == typeof n ? n(t, b) : t : t + (c ? "." + b : "[" + b + "]"); Mt(g, Ot(R, S, n, r, i, a, s, o, c, u, l, d, h, f)) } } return g } function At(e, t) { return e && "string" == typeof e && t.comma && -1 < e.indexOf(",") ? e.split(",") : e } function Ht(e, t, n, r) { if (e) { var i = n.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, a = /(\[[^[\]]*])/g, s = 0 < n.depth && /(\[[^[\]]*])/.exec(i), o = s ? i.slice(0, s.index) : i, c = []; if (o) { if (!n.plainObjects && tn.call(Object.prototype, o) && !n.allowPrototypes) return; c.push(o) } for (var u = 0; 0 < n.depth && null !== (s = a.exec(i)) && u < n.depth;) { if (u += 1, !n.plainObjects && tn.call(Object.prototype, s[1].slice(1, -1)) && !n.allowPrototypes) return; c.push(s[1]) } return s && c.push("[" + i.slice(s.index) + "]"), function (e, t, n, r) { for (var i = r ? t : At(t, n), a = e.length - 1; 0 <= a; --a) { var s, o = e[a]; if ("[]" === o && n.parseArrays) s = [].concat(i); else { s = n.plainObjects ? Object.create(null) : {}; var c = "[" === o.charAt(0) && "]" === o.charAt(o.length - 1) ? o.slice(1, -1) : o, u = parseInt(c, 10); n.parseArrays || "" !== c ? !isNaN(u) && o !== c && String(u) === c && 0 <= u && n.parseArrays && u <= n.arrayLimit ? (s = [])[u] = i : s[c] = i : s = { 0: i } } i = s } return i }(c, t, n, r) } } function Wt(e) { e && (window.document.title = e) } var Dt = String.prototype.replace, Bt = /%20/g, Ut = "RFC3986", qt = { default: Ut, formatters: { RFC1738: function (e) { return Dt.call(e, Bt, "+") }, RFC3986: function (e) { return String(e) } }, RFC1738: "RFC1738", RFC3986: Ut }, Qt = Object.prototype.hasOwnProperty, $t = Array.isArray, Vt = function () { for (var e = [], t = 0; t < 256; ++t)e.push("%" + ((t < 16 ? "0" : "") + t.toString(16)).toUpperCase()); return e }(), Kt = { arrayToObject: jt, assign: function (e, n) { return Object.keys(n).reduce(function (e, t) { return e[t] = n[t], e }, e) }, combine: function (e, t) { return [].concat(e, t) }, compact: function (e) { for (var t = [{ obj: { o: e }, prop: "o" }], n = [], r = 0; r < t.length; ++r)for (var i = t[r], a = i.obj[i.prop], s = Object.keys(a), o = 0; o < s.length; ++o) { var c = s[o], u = a[c]; "object" == typeof u && null !== u && -1 === n.indexOf(u) && (t.push({ obj: a, prop: c }), n.push(u)) } return function (e) { for (; 1 < e.length;) { var t = e.pop(), n = t.obj[t.prop]; if ($t(n)) { for (var r = [], i = 0; i < n.length; ++i)void 0 !== n[i] && r.push(n[i]); t.obj[t.prop] = r } } }(t), e }, decode: function (e, t, n) { var r = e.replace(/\+/g, " "); if ("iso-8859-1" === n) return r.replace(/%[0-9a-f]{2}/gi, unescape); try { return decodeURIComponent(r) } catch (e) { return r } }, encode: function (e, t, n, r, i) { if (0 === e.length) return e; var a = e; if ("symbol" == typeof e ? a = Symbol.prototype.toString.call(e) : "string" != typeof e && (a = String(e)), "iso-8859-1" === n) return escape(a).replace(/%u[0-9a-f]{4}/gi, function (e) { return "%26%23" + parseInt(e.slice(2), 16) + "%3B" }); for (var s = "", o = 0; o < a.length; ++o) { var c = a.charCodeAt(o); 45 === c || 46 === c || 95 === c || 126 === c || 48 <= c && c <= 57 || 65 <= c && c <= 90 || 97 <= c && c <= 122 || i === qt.RFC1738 && (40 === c || 41 === c) ? s += a.charAt(o) : c < 128 ? s += Vt[c] : c < 2048 ? s += Vt[192 | c >> 6] + Vt[128 | 63 & c] : c < 55296 || 57344 <= c ? s += Vt[224 | c >> 12] + Vt[128 | c >> 6 & 63] + Vt[128 | 63 & c] : (o += 1, c = 65536 + ((1023 & c) << 10 | 1023 & a.charCodeAt(o)), s += Vt[240 | c >> 18] + Vt[128 | c >> 12 & 63] + Vt[128 | c >> 6 & 63] + Vt[128 | 63 & c]) } return s }, isBuffer: function (e) { return !(!e || "object" != typeof e) && !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e)) }, isRegExp: function (e) { return "[object RegExp]" === Object.prototype.toString.call(e) }, maybeMap: function (e, t) { if ($t(e)) { for (var n = [], r = 0; r < e.length; r += 1)n.push(t(e[r])); return n } return t(e) }, merge: function r(i, a, s) { if (!a) return i; if ("object" != typeof a) { if ($t(i)) i.push(a); else { if (!i || "object" != typeof i) return [i, a]; (s && (s.plainObjects || s.allowPrototypes) || !Qt.call(Object.prototype, a)) && (i[a] = !0) } return i } if (!i || "object" != typeof i) return [i].concat(a); var e = i; return $t(i) && !$t(a) && (e = jt(i, s)), $t(i) && $t(a) ? (a.forEach(function (e, t) { if (Qt.call(i, t)) { var n = i[t]; n && "object" == typeof n && e && "object" == typeof e ? i[t] = r(n, e, s) : i.push(e) } else i[t] = e }), i) : Object.keys(a).reduce(function (e, t) { var n = a[t]; return Qt.call(e, t) ? e[t] = r(e[t], n, s) : e[t] = n, e }, e) } }, zt = Object.prototype.hasOwnProperty, Jt = { brackets: function (e) { return e + "[]" }, comma: "comma", indices: function (e, t) { return e + "[" + t + "]" }, repeat: function (e) { return e } }, Yt = Array.isArray, Xt = Array.prototype.push, Gt = Date.prototype.toISOString, Zt = qt.default, en = { addQueryPrefix: !1, allowDots: !1, charset: "utf-8", charsetSentinel: !1, delimiter: "&", encode: !0, encoder: Kt.encode, encodeValuesOnly: !1, format: Zt, formatter: qt.formatters[Zt], indices: !1, serializeDate: function (e) { return Gt.call(e) }, skipNulls: !1, strictNullHandling: !1 }, tn = Object.prototype.hasOwnProperty, nn = Array.isArray, rn = { allowDots: !1, allowPrototypes: !1, arrayLimit: 20, charset: "utf-8", charsetSentinel: !1, comma: !1, decoder: Kt.decode, delimiter: "&", depth: 5, ignoreQueryPrefix: !1, interpretNumericEntities: !1, parameterLimit: 1e3, parseArrays: !0, plainObjects: !1, strictNullHandling: !1 }, an = { formats: qt, parse: function (e, t) { var n = function (e) { if (!e) return rn; if (null !== e.decoder && void 0 !== e.decoder && "function" != typeof e.decoder) throw new TypeError("Decoder has to be a function."); if (void 0 !== e.charset && "utf-8" !== e.charset && "iso-8859-1" !== e.charset) throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); var t = void 0 === e.charset ? rn.charset : e.charset; return { allowDots: void 0 === e.allowDots ? rn.allowDots : !!e.allowDots, allowPrototypes: "boolean" == typeof e.allowPrototypes ? e.allowPrototypes : rn.allowPrototypes, arrayLimit: "number" == typeof e.arrayLimit ? e.arrayLimit : rn.arrayLimit, charset: t, charsetSentinel: "boolean" == typeof e.charsetSentinel ? e.charsetSentinel : rn.charsetSentinel, comma: "boolean" == typeof e.comma ? e.comma : rn.comma, decoder: "function" == typeof e.decoder ? e.decoder : rn.decoder, delimiter: "string" == typeof e.delimiter || Kt.isRegExp(e.delimiter) ? e.delimiter : rn.delimiter, depth: "number" == typeof e.depth || !1 === e.depth ? +e.depth : rn.depth, ignoreQueryPrefix: !0 === e.ignoreQueryPrefix, interpretNumericEntities: "boolean" == typeof e.interpretNumericEntities ? e.interpretNumericEntities : rn.interpretNumericEntities, parameterLimit: "number" == typeof e.parameterLimit ? e.parameterLimit : rn.parameterLimit, parseArrays: !1 !== e.parseArrays, plainObjects: "boolean" == typeof e.plainObjects ? e.plainObjects : rn.plainObjects, strictNullHandling: "boolean" == typeof e.strictNullHandling ? e.strictNullHandling : rn.strictNullHandling } }(t); if ("" === e || null == e) return n.plainObjects ? Object.create(null) : {}; for (var r = "string" == typeof e ? function (e, t) { var n, r = {}, i = t.ignoreQueryPrefix ? e.replace(/^\?/, "") : e, a = t.parameterLimit === 1 / 0 ? void 0 : t.parameterLimit, s = i.split(t.delimiter, a), o = -1, c = t.charset; if (t.charsetSentinel) for (n = 0; n < s.length; ++n)0 === s[n].indexOf("utf8=") && ("utf8=%E2%9C%93" === s[n] ? c = "utf-8" : "utf8=%26%2310003%3B" === s[n] && (c = "iso-8859-1"), o = n, n = s.length); for (n = 0; n < s.length; ++n)if (n !== o) { var u, l, d = s[n], h = d.indexOf("]="), f = -1 === h ? d.indexOf("=") : h + 1; (l = -1 === f ? (u = t.decoder(d, rn.decoder, c, "key"), t.strictNullHandling ? null : "") : (u = t.decoder(d.slice(0, f), rn.decoder, c, "key"), Kt.maybeMap(At(d.slice(f + 1), t), function (e) { return t.decoder(e, rn.decoder, c, "value") }))) && t.interpretNumericEntities && "iso-8859-1" === c && (l = l.replace(/&#(\d+);/g, function (e, t) { return String.fromCharCode(parseInt(t, 10)) })), -1 < d.indexOf("[]=") && (l = nn(l) ? [l] : l), tn.call(r, u) ? r[u] = Kt.combine(r[u], l) : r[u] = l } return r }(e, n) : e, i = n.plainObjects ? Object.create(null) : {}, a = Object.keys(r), s = 0; s < a.length; ++s) { var o = a[s], c = Ht(o, r[o], n, "string" == typeof e); i = Kt.merge(i, c, n) } return Kt.compact(i) }, stringify: function (e, t) { var n, r = e, i = function (e) { if (!e) return en; if (null !== e.encoder && void 0 !== e.encoder && "function" != typeof e.encoder) throw new TypeError("Encoder has to be a function."); var t = e.charset || en.charset; if (void 0 !== e.charset && "utf-8" !== e.charset && "iso-8859-1" !== e.charset) throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); var n = qt.default; if (void 0 !== e.format) { if (!zt.call(qt.formatters, e.format)) throw new TypeError("Unknown format option provided."); n = e.format } var r = qt.formatters[n], i = en.filter; return "function" != typeof e.filter && !Yt(e.filter) || (i = e.filter), { addQueryPrefix: "boolean" == typeof e.addQueryPrefix ? e.addQueryPrefix : en.addQueryPrefix, allowDots: void 0 === e.allowDots ? en.allowDots : !!e.allowDots, charset: t, charsetSentinel: "boolean" == typeof e.charsetSentinel ? e.charsetSentinel : en.charsetSentinel, delimiter: void 0 === e.delimiter ? en.delimiter : e.delimiter, encode: "boolean" == typeof e.encode ? e.encode : en.encode, encoder: "function" == typeof e.encoder ? e.encoder : en.encoder, encodeValuesOnly: "boolean" == typeof e.encodeValuesOnly ? e.encodeValuesOnly : en.encodeValuesOnly, filter: i, format: n, formatter: r, serializeDate: "function" == typeof e.serializeDate ? e.serializeDate : en.serializeDate, skipNulls: "boolean" == typeof e.skipNulls ? e.skipNulls : en.skipNulls, sort: "function" == typeof e.sort ? e.sort : null, strictNullHandling: "boolean" == typeof e.strictNullHandling ? e.strictNullHandling : en.strictNullHandling } }(t); "function" == typeof i.filter ? r = (0, i.filter)("", r) : Yt(i.filter) && (n = i.filter); var a, s = []; if ("object" != typeof r || null === r) return ""; a = t && t.arrayFormat in Jt ? t.arrayFormat : t && "indices" in t ? t.indices ? "indices" : "repeat" : "indices"; var o = Jt[a]; n = n || Object.keys(r), i.sort && n.sort(i.sort); for (var c = 0; c < n.length; ++c) { var u = n[c]; i.skipNulls && null === r[u] || Mt(s, Ot(r[u], u, o, i.strictNullHandling, i.skipNulls, i.encode ? i.encoder : null, i.filter, i.sort, i.allowDots, i.serializeDate, i.format, i.formatter, i.encodeValuesOnly, i.charset)) } var l = s.join(i.delimiter), d = !0 === i.addQueryPrefix ? "?" : ""; return i.charsetSentinel && ("iso-8859-1" === i.charset ? d += "utf8=%26%2310003%3B&" : d += "utf8=%E2%9C%93&"), 0 < l.length ? d + l : "" } }, sn = function () { function c(e) { var t = this, n = e.windowTitle, r = e.writeDelay, i = void 0 === r ? 400 : r, a = e.createURL, s = e.parseURL, o = e.getLocation; C(this, c), k(this, "windowTitle", void 0), k(this, "writeDelay", void 0), k(this, "_createURL", void 0), k(this, "parseURL", void 0), k(this, "getLocation", void 0), k(this, "writeTimer", void 0), k(this, "shouldPushState", !0), this.windowTitle = n, this.writeTimer = void 0, this.writeDelay = i, this._createURL = a, this.parseURL = s, this.getLocation = o, ft(function () { var e = t.windowTitle && t.windowTitle(t.read()); Wt(e) }) } return E(c, [{ key: "read", value: function () { return this.parseURL({ qsModule: an, location: this.getLocation() }) } }, { key: "write", value: function (i) { var a = this; ft(function (e) { var t = e.window, n = a.createURL(i), r = a.windowTitle && a.windowTitle(i); a.writeTimer && clearTimeout(a.writeTimer), a.writeTimer = setTimeout(function () { Wt(r), a.shouldPushState && t.history.pushState(i, r || "", n), a.shouldPushState = !0, a.writeTimer = void 0 }, a.writeDelay) }) } }, { key: "onUpdate", value: function (n) { var r = this; this._onPopState = function (e) { r.writeTimer && (clearTimeout(r.writeTimer), r.writeTimer = void 0), r.shouldPushState = !1; var t = e.state; n(t || r.read()) }, ft(function (e) { e.window.addEventListener("popstate", r._onPopState) }) } }, { key: "createURL", value: function (e) { return this._createURL({ qsModule: an, routeState: e, location: this.getLocation() }) } }, { key: "dispose", value: function () { var n = this; ft(function (e) { var t = e.window; n._onPopState && t.removeEventListener("popstate", n._onPopState) }), this.writeTimer && clearTimeout(this.writeTimer), this.write({}) } }]), c }(); function on() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, t = e.createURL, n = void 0 === t ? function (e) { var t = e.qsModule, n = e.routeState, r = e.location, i = r.protocol, a = r.hostname, s = r.port, o = void 0 === s ? "" : s, c = r.pathname, u = r.hash, l = t.stringify(n), d = "" === o ? "" : ":".concat(o); return l ? "".concat(i, "//").concat(a).concat(d).concat(c, "?").concat(l).concat(u) : "".concat(i, "//").concat(a).concat(d).concat(c).concat(u) } : t, r = e.parseURL, i = void 0 === r ? function (e) { var t = e.qsModule, n = e.location; return t.parse(n.search.slice(1), { arrayLimit: 99 }) } : r, a = e.writeDelay, s = void 0 === a ? 400 : a, o = e.windowTitle, c = e.getLocation; return new sn({ createURL: n, parseURL: i, writeDelay: s, windowTitle: o, getLocation: void 0 === c ? function () { return ft(function (e) { return e.window.location }, { fallback: function () { throw new Error("You need to provide `getLocation` to the `history` router in environments where `window` does not exist.") } }) } : c }) } function cn(e) { var t = 0 < arguments.length && void 0 !== e ? e : {}, n = t.router, a = void 0 === n ? on() : n, r = t.stateMapping, s = void 0 === r ? Lt() : r; return function (e) { var r = e.instantSearchInstance; r._createURL = function (n) { var e = Object.keys(n).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, n[t])) }, r.mainIndex.getWidgetUiState({})), t = s.stateToRoute(e); return a.createURL(t) }; var i = void 0, t = r._initialUiState; return { onStateChange: function (e) { var t = e.uiState, n = s.stateToRoute(t); void 0 !== i && Le(i, n) || (a.write(n), i = n) }, subscribe: function () { r._initialUiState = W(W({}, t), s.routeToState(a.read())), a.onUpdate(function (e) { r.setUiState(s.routeToState(e)) }) }, unsubscribe: function () { a.dispose() } } } } function un() { return ft(function (e) { return -1 < e.window.navigator.userAgent.indexOf("Algolia Crawler") }, { fallback: function () { return !1 } }) } function ln() { return function (e) { var t = e.instantSearchInstance, n = { widgets: [] }, r = document.createElement("meta"), i = document.querySelector("head"); return r.name = "instantsearch:widgets", { onStateChange: function () { }, subscribe: function () { setTimeout(function () { var e = t.client; n.ua = e.transporter && e.transporter.userAgent ? e.transporter.userAgent.value : e._ua, function i(e, a, s) { var t = a.mainIndex, o = { instantSearchInstance: a, parent: t, scopedResults: [], state: t.getHelper().state, helper: t.getHelper(), createURL: t.createURL, uiState: a._initialUiState, renderState: a.renderState, templatesConfig: a.templatesConfig, searchMetadata: { isSearchStalled: a._isSearchStalled } }; e.forEach(function (e) { var t = {}; if (e.getWidgetRenderState) { var n = e.getWidgetRenderState(o); n && n.widgetParams && (t = n.widgetParams) } var r = Object.keys(t).filter(function (e) { return void 0 !== t[e] }); s.widgets.push({ type: e.$$type, widgetType: e.$$widgetType, params: r }), "ais.index" === e.$$type && i(e.getWidgets(), a, s) }) }(t.mainIndex.getWidgets(), t, n), r.content = JSON.stringify(n), i.appendChild(r) }, 0) }, unsubscribe: function () { r.remove() } } } } var dn = Ze({ name: "instantsearch" }); function hn() { return "#" } function fn(d, e) { var h = 1 < arguments.length && void 0 !== e ? e : _e; return xe(d, pn()), function (i) { var e = i || {}, t = e.includedAttributes, a = void 0 === t ? [] : t, n = e.excludedAttributes, s = void 0 === n ? ["query"] : n, r = e.transformItems, o = void 0 === r ? function (e) { return e } : r; if (i && i.includedAttributes && i.excludedAttributes) throw new Error(pn("The options `includedAttributes` and `excludedAttributes` cannot be used together.")); function c() { return l.refine() } function u() { return l.createURL() } var l = { refine: _e, createURL: function () { return "" }, attributesToClear: [] }; return { $$type: "ais.clearRefinements", init: function (e) { var t = e.instantSearchInstance; d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function () { h() }, getRenderState: function (e, t) { return W(W({}, e), {}, { clearRefinements: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.createURL, n = e.scopedResults; l.attributesToClear = n.reduce(function (e, t) { return e.concat(function (e) { var t = e.scopedResult, n = e.includedAttributes, r = e.excludedAttributes, i = e.transformItems, a = -1 !== n.indexOf("query") || -1 === r.indexOf("query"); return { helper: t.helper, items: i(he(we(t.results, t.helper.state, a).map(function (e) { return e.attribute }).filter(function (e) { return 0 === n.length || -1 !== n.indexOf(e) }).filter(function (e) { return "query" === e && a || -1 === r.indexOf(e) }))) } }({ scopedResult: t, includedAttributes: a, excludedAttributes: s, transformItems: o })) }, []), l.refine = function () { l.attributesToClear.forEach(function (e) { var t = e.helper, n = e.items; t.setState(Pe({ helper: t, attributesToClear: n })).search() }) }, l.createURL = function () { return t(Xe.apply(void 0, N(l.attributesToClear.map(function (e) { return Pe({ helper: e.helper, attributesToClear: e.items }) })))) }; var r = l.attributesToClear.some(function (e) { return 0 < e.items.length }); return { canRefine: r, hasRefinements: r, refine: c, createURL: u, widgetParams: i } } } } } var mn = function () { L(R, e); var b = O(R); function R(e) { var n; C(this, R), k(M(n = b.call(this)), "client", void 0), k(M(n), "indexName", void 0), k(M(n), "insightsClient", void 0), k(M(n), "onStateChange", null), k(M(n), "helper", void 0), k(M(n), "mainHelper", void 0), k(M(n), "mainIndex", void 0), k(M(n), "started", void 0), k(M(n), "templatesConfig", void 0), k(M(n), "renderState", {}), k(M(n), "_stalledSearchDelay", void 0), k(M(n), "_searchStalledTimer", void 0), k(M(n), "_isSearchStalled", void 0), k(M(n), "_initialUiState", void 0), k(M(n), "_initialResults", void 0), k(M(n), "_createURL", void 0), k(M(n), "_searchFunction", void 0), k(M(n), "_mainHelperSearch", void 0), k(M(n), "middleware", []), k(M(n), "sendEventToInsights", void 0), k(M(n), "scheduleSearch", ce(function () { n.started && n.mainHelper.search() })), k(M(n), "scheduleRender", ce(function () { n.mainHelper.hasPendingRequests() || (clearTimeout(n._searchStalledTimer), n._searchStalledTimer = null, n._isSearchStalled = !1), n.mainIndex.render({ instantSearchInstance: M(n) }), n.emit("render") })), k(M(n), "onInternalStateChange", ce(function () { var t = n.mainIndex.getWidgetUiState({}); n.middleware.forEach(function (e) { e.instance.onStateChange({ uiState: t }) }) })); var t = e.indexName, r = void 0 === t ? null : t, i = e.numberLocale, a = e.initialUiState, s = void 0 === a ? {} : a, o = e.routing, c = void 0 === o ? null : o, u = e.searchFunction, l = e.stalledSearchDelay, d = void 0 === l ? 200 : l, h = e.searchClient, f = void 0 === h ? null : h, m = e.insightsClient, p = void 0 === m ? null : m, g = e.onStateChange, v = void 0 === g ? null : g; if (null === r) throw new Error(dn("The `indexName` option is required.")); if (null === f) throw new Error(dn("The `searchClient` option is required.")); if ("function" != typeof f.search) throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/"); if ("function" == typeof f.addAlgoliaAgent && f.addAlgoliaAgent("instantsearch.js (".concat("4.36.0", ")")), p && "function" != typeof p) throw new Error(dn("The `insightsClient` option should be a function.")); if (n.client = f, n.insightsClient = p, n.indexName = r, n.helper = null, n.mainHelper = null, n.mainIndex = bt({ indexName: r }), n.onStateChange = v, n.started = !1, n.templatesConfig = { helpers: function (e) { var n = e.numberLocale; return { formatNumber: function (e, t) { return Number(t(e)).toLocaleString(n) }, highlight: function (e, t) { try { return t(Pt(W(W({}, JSON.parse(e)), {}, { hit: this }))) } catch (e) { throw new Error('\nThe highlight helper expects a JSON object of the format:\n{ "attribute": "name", "highlightedTagName": "mark" }') } }, reverseHighlight: function (e, t) { try { return t(xt(W(W({}, JSON.parse(e)), {}, { hit: this }))) } catch (e) { throw new Error('\n  The reverseHighlight helper expects a JSON object of the format:\n  { "attribute": "name", "highlightedTagName": "mark" }') } }, snippet: function (e, t) { try { return t(It(W(W({}, JSON.parse(e)), {}, { hit: this }))) } catch (e) { throw new Error('\nThe snippet helper expects a JSON object of the format:\n{ "attribute": "name", "highlightedTagName": "mark" }') } }, reverseSnippet: function (e, t) { try { return t(Tt(W(W({}, JSON.parse(e)), {}, { hit: this }))) } catch (e) { throw new Error('\n  The reverseSnippet helper expects a JSON object of the format:\n  { "attribute": "name", "highlightedTagName": "mark" }') } }, insights: function (e, t) { try { var n = JSON.parse(e), r = n.method, i = n.payload; return t(Ct(r, W({ objectIDs: [this.objectID] }, i))) } catch (e) { throw new Error('\nThe insights helper expects a JSON object of the format:\n{ "method": "method-name", "payload": { "eventName": "name of the event" } }') } } } }({ numberLocale: i }), compileOptions: {} }, n._stalledSearchDelay = d, n._searchStalledTimer = null, n._isSearchStalled = !1, n._createURL = hn, n._initialUiState = s, n._initialResults = null, u && (n._searchFunction = u), n.sendEventToInsights = _e, c) { var y = "boolean" == typeof c ? void 0 : c; n.use(cn(y)) } return un() && n.use(ln()), n } return E(R, [{ key: "use", value: function () { for (var n = this, e = arguments.length, t = new Array(e), r = 0; r < e; r++)t[r] = arguments[r]; var i = t.map(function (e) { var t = W({ subscribe: _e, unsubscribe: _e, onStateChange: _e }, e({ instantSearchInstance: n })); return n.middleware.push({ creator: e, instance: t }), t }); return this.started && i.forEach(function (e) { e.subscribe() }), this } }, { key: "unuse", value: function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; return this.middleware.filter(function (e) { return t.includes(e.creator) }).forEach(function (e) { return e.instance.unsubscribe() }), this.middleware = this.middleware.filter(function (e) { return !t.includes(e.creator) }), this } }, { key: "EXPERIMENTAL_use", value: function () { return this.use.apply(this, arguments) } }, { key: "addWidget", value: function (e) { return this.addWidgets([e]) } }, { key: "addWidgets", value: function (e) { if (!Array.isArray(e)) throw new Error(dn("The `addWidgets` method expects an array of widgets. Please use `addWidget`.")); if (e.some(function (e) { return "function" != typeof e.init && "function" != typeof e.render })) throw new Error(dn("The widget definition expects a `render` and/or an `init` method.")); return this.mainIndex.addWidgets(e), this } }, { key: "removeWidget", value: function (e) { return this.removeWidgets([e]) } }, { key: "removeWidgets", value: function (e) { if (!Array.isArray(e)) throw new Error(dn("The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.")); if (e.some(function (e) { return "function" != typeof e.dispose })) throw new Error(dn("The widget definition expects a `dispose` method.")); return this.mainIndex.removeWidgets(e), this } }, { key: "start", value: function () { var r = this; if (this.started) throw new Error(dn("The `start` method has already been called once.")); var t = this.mainHelper || oe(this.client, this.indexName); if (t.search = function () { return t.searchOnlyWithDerivedHelpers() }, this._searchFunction) { var i = { search: function () { return new Promise(_e) } }; this._mainHelperSearch = t.search.bind(t), t.search = function () { var n = r.mainIndex.getHelper(), e = oe(i, n.state.index, n.state); return e.once("search", function (e) { var t = e.state; n.overrideStateWithoutTriggeringChangeEvent(t), r._mainHelperSearch() }), e.on("change", function (e) { var t = e.state; n.setState(t) }), r._searchFunction(e), t } } if (t.on("error", function (e) { var t = e.error; r.emit("error", { error: t }) }), this.mainHelper = t, this.middleware.forEach(function (e) { e.instance.subscribe() }), this.mainIndex.init({ instantSearchInstance: this, parent: null, uiState: this._initialUiState }), this._initialResults) { var e = this.scheduleSearch; this.scheduleSearch = ce(_e), ce(function () { r.scheduleSearch = e })() } else this.scheduleSearch(); this.helper = this.mainIndex.getHelper(), this.started = !0 } }, { key: "dispose", value: function () { this.scheduleSearch.cancel(), this.scheduleRender.cancel(), clearTimeout(this._searchStalledTimer), this.removeWidgets(this.mainIndex.getWidgets()), this.mainIndex.dispose(), this.started = !1, this.removeAllListeners(), this.mainHelper.removeAllListeners(), this.mainHelper = null, this.helper = null, this.middleware.forEach(function (e) { e.instance.unsubscribe() }) } }, { key: "scheduleStalledRender", value: function () { var e = this; this._searchStalledTimer || (this._searchStalledTimer = setTimeout(function () { e._isSearchStalled = !0, e.scheduleRender() }, this._stalledSearchDelay)) } }, { key: "setUiState", value: function (e) { if (!this.mainHelper) throw new Error(dn("The `start` method needs to be called before `setUiState`.")); this.mainIndex.refreshUiState(); var r = "function" == typeof e ? e(this.mainIndex.getWidgetUiState({})) : e; !function e(t) { var n = r[t.getIndexId()] || {}; t.getHelper().setState(t.getWidgetSearchParameters(t.getHelper().state, { uiState: n })), t.getWidgets().filter(pt).forEach(e) }(this.mainIndex), this.scheduleSearch(), this.onInternalStateChange() } }, { key: "getUiState", value: function () { return this.started && this.mainIndex.refreshUiState(), this.mainIndex.getWidgetUiState({}) } }, { key: "createURL", value: function (e) { var t = 0 < arguments.length && void 0 !== e ? e : {}; if (!this.started) throw new Error(dn("The `start` method needs to be called before `createURL`.")); return this._createURL(t) } }, { key: "refresh", value: function () { if (!this.mainHelper) throw new Error(dn("The `start` method needs to be called before `refresh`.")); this.mainHelper.clearCache().search() } }]), R }(), pn = Ze({ name: "clear-refinements", connector: !0 }); function gn(r, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(r, vn()), function (s) { if ((s || {}).includedAttributes && (s || {}).excludedAttributes) throw new Error(vn("The options `includedAttributes` and `excludedAttributes` cannot be used together.")); var e = s || {}, o = e.includedAttributes, t = e.excludedAttributes, c = void 0 === t ? ["query"] : t, n = e.transformItems, u = void 0 === n ? function (e) { return e } : n; return { $$type: "ais.currentRefinements", init: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function () { i() }, getRenderState: function (e, t) { return W(W({}, e), {}, { currentRefinements: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.scopedResults, r = e.createURL, i = e.helper; var a = t ? n.reduce(function (e, t) { return e.concat(u(yn({ results: t.results, helper: t.helper, includedAttributes: o, excludedAttributes: c }))) }, []) : u(yn({ results: {}, helper: i, includedAttributes: o, excludedAttributes: c })); return { items: a, canRefine: 0 < a.length, refine: function (e) { return Rn(i, e) }, createURL: function (e) { return r(bn(i.state, e)) }, widgetParams: s } } } } } var vn = Ze({ name: "current-refinements", connector: !0 }); function yn(e) { var t = e.results, n = e.helper, r = e.includedAttributes, i = e.excludedAttributes, a = -1 !== (r || []).indexOf("query") || -1 === (i || []).indexOf("query"), s = r ? function (e) { return -1 !== r.indexOf(e.attribute) } : function (e) { return -1 === i.indexOf(e.attribute) }, o = we(t, n.state, a).map(Sn).filter(s); return o.reduce(function (e, t) { return [].concat(N(e.filter(function (e) { return e.attribute !== t.attribute })), [{ indexName: n.state.index, attribute: t.attribute, label: t.attribute, refinements: o.filter(function (e) { return e.attribute === t.attribute }).sort(function (e, t) { return "numeric" === e.type ? e.value - t.value : 0 }), refine: function (e) { return Rn(n, e) } }]) }, []) } function bn(e, t) { switch (t.type) { case "facet": return e.removeFacetRefinement(t.attribute, String(t.value)); case "disjunctive": return e.removeDisjunctiveFacetRefinement(t.attribute, String(t.value)); case "hierarchical": return e.removeHierarchicalFacetRefinement(t.attribute); case "exclude": return e.removeExcludeRefinement(t.attribute, String(t.value)); case "numeric": return e.removeNumericRefinement(t.attribute, t.operator, String(t.value)); case "tag": return e.removeTagRefinement(String(t.value)); case "query": return e.setQueryParameter("query", ""); default: return e } } function Rn(e, t) { e.setState(bn(e.state, t)).search() } function Sn(e) { var t = "numeric" === e.type ? Number(e.name) : e.name, n = e.operator ? "".concat(function (e) { switch (e) { case ">=": return "≥"; case "<=": return "≤"; default: return e } }(e.operator), " ").concat(e.name) : e.name, r = { attribute: e.attribute, type: e.type, value: t, label: n }; return void 0 !== e.operator && (r.operator = e.operator), void 0 !== e.count && (r.count = e.count), void 0 !== e.exhaustive && (r.exhaustive = e.exhaustive), r } function wn(_, e) { var I = 1 < arguments.length && void 0 !== e ? e : _e; return xe(_, xn()), function (d) { var e = d || {}, c = e.attributes, t = e.separator, u = void 0 === t ? " > " : t, n = e.rootPath, l = void 0 === n ? null : n, r = e.showParentLevel, h = void 0 === r || r, i = e.limit, f = void 0 === i ? 10 : i, a = e.showMore, m = void 0 !== a && a, s = e.showMoreLimit, p = void 0 === s ? 20 : s, o = e.sortBy, g = void 0 === o ? _n : o, v = e.transformItems, y = void 0 === v ? function (e) { return e } : v; if (!c || !Array.isArray(c) || 0 === c.length) throw new Error(xn("The `attributes` option expects an array of strings.")); if (!0 === m && p <= f) throw new Error(xn("The `showMoreLimit` option must be greater than `limit`.")); var b, R, S = D(c, 1)[0], w = function () { }; function P() { w() } var N = !1; function x() { return N ? p : f } return { $$type: "ais.hierarchicalMenu", init: function (e) { var t = e.instantSearchInstance; _(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; w = function (e, t) { return function () { N = !N, t.render(e) } }(e, this), _(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return I(), t.removeHierarchicalFacet(S).setQueryParameter("maxValuesPerFacet", void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { hierarchicalMenu: W(W({}, e.hierarchicalMenu), {}, k({}, S, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.state, r = e.createURL, i = e.instantSearchInstance, a = e.helper, s = [], o = !1; if (b = b || it({ instantSearchInstance: i, helper: a, attribute: S, widgetType: this.$$type }), R = R || function (e) { b("click", e), a.toggleFacetRefinement(S, e).search() }, t) { var c = t.getFacetValues(S, { sortBy: g, facetOrdering: g === _n }), u = c && !Array.isArray(c) && c.data ? c.data : [], l = (n.maxValuesPerFacet || 0) > x() ? u.length <= x() : u.length < x(); o = m && (N || !l), s = y(function a(e) { return e.slice(0, x()).map(function (e) { var t = e.name, n = e.path, r = e.data, i = W(W({}, j(e, ["name", "path", "data"])), {}, { label: t, value: n, data: null }); return Array.isArray(r) && (i.data = a(r)), i }) }(u)) } return { items: s, refine: R, canRefine: 0 < s.length, createURL: function (e) { return r(n.resetPage().toggleFacetRefinement(S, e)) }, sendEvent: b, widgetParams: d, isShowingMore: N, toggleShowMore: P, canToggleShowMore: o } }, getWidgetUiState: function (e, t) { var n = t.searchParameters.getHierarchicalFacetBreadcrumb(S); return n.length ? W(W({}, e), {}, { hierarchicalMenu: W(W({}, e.hierarchicalMenu), {}, k({}, S, n)) }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = n.hierarchicalMenu && n.hierarchicalMenu[S]; if (e.isHierarchicalFacet(S)) e.getHierarchicalFacetByName(S); var i = e.removeHierarchicalFacet(S).addHierarchicalFacet({ name: S, attributes: c, separator: u, rootPath: l, showParentLevel: h }), a = i.maxValuesPerFacet || 0, s = Math.max(a, m ? p : f), o = i.setQueryParameter("maxValuesPerFacet", s); return r ? o.addHierarchicalFacetRefinement(S, r.join(u)) : o.setQueryParameters({ hierarchicalFacetsRefinements: W(W({}, o.hierarchicalFacetsRefinements), {}, k({}, S, [])) }) } } } } function Pn(r, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(r, In()), function (a) { var s, o, e = a || {}, t = e.escapeHTML, c = void 0 === t || t, n = e.transformItems, u = void 0 === n ? function (e) { return e } : n; return { $$type: "ais.hits", init: function (e) { r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (e) { var t = this.getWidgetRenderState(e); t.sendEvent("view", t.hits), r(W(W({}, t), {}, { instantSearchInstance: e.instantSearchInstance }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { hits: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.helper, r = e.instantSearchInstance; if (s = s || ct({ instantSearchInstance: r, index: n.getIndex(), widgetType: this.$$type }), o = o || ut({ index: n.getIndex(), widgetType: this.$$type }), !t) return { hits: [], results: void 0, sendEvent: s, bindEvent: o, widgetParams: a }; c && 0 < t.hits.length && (t.hits = Qe(t.hits)); var i = rt(nt(t.hits, t.page, t.hitsPerPage), t.queryID); return { hits: u(i), results: t, sendEvent: s, bindEvent: o, widgetParams: a } }, dispose: function (e) { var t = e.state; return i(), c ? t.setQueryParameters(Object.keys(De).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, void 0)) }, {})) : t }, getWidgetSearchParameters: function (e) { return c ? e.setQueryParameters(De) : e } } } } function Nn(e) { var t = e.method, n = e.results, r = e.hits, i = e.objectIDs, a = n.index, s = function (n, e) { return e.map(function (t) { var e = be(n, function (e) { return e.objectID === t }); if (void 0 === e) throw new Error('Could not find objectID "'.concat(t, '" passed to `clickedObjectIDsAfterSearch` in the returned hits. This is necessary to infer the absolute position and the query ID.')); return e }) }(r, i), o = function (e) { var t = he(e.map(function (e) { return e.__queryID })); if (1 < t.length) throw new Error("Insights currently allows a single `queryID`. The `objectIDs` provided map to multiple `queryID`s."); var n = t[0]; if ("string" != typeof n) throw new Error("Could not infer `queryID`. Ensure InstantSearch `clickAnalytics: true` was added with the Configure widget.\n\nSee: https://alg.li/lNiZZ7"); return n }(s); switch (t) { case "clickedObjectIDsAfterSearch": return { index: a, queryID: o, objectIDs: i, positions: function (e) { return e.map(function (e) { return e.__position }) }(s) }; case "convertedObjectIDsAfterSearch": return { index: a, queryID: o, objectIDs: i }; default: throw new Error('Unsupported method passed to insights: "'.concat(t, '".')) } } var xn = Ze({ name: "hierarchical-menu", connector: !0 }), _n = ["name:asc"], In = Ze({ name: "hits", connector: !0 }); function Fn(t) { return function (s, e) { return t(function (e, t) { var n = e.results, r = e.hits, i = e.instantSearchInstance; if (n && r && i) { var a = function (o, c, u) { return function (e) { for (var t = arguments.length, n = new Array(1 < t ? t - 1 : 0), r = 1; r < t; r++)n[r - 1] = arguments[r]; var i = n[0]; if (!o) { var a = Ze({ name: "instantsearch" }); throw new Error(a("The `insightsClient` option has not been provided to `instantsearch`.")) } if (!Array.isArray(i.objectIDs)) throw new TypeError("Expected `objectIDs` to be an array."); var s = Nn({ method: e, results: c, hits: u, objectIDs: i.objectIDs }); o(e, W(W({}, s), i)) } }(i.insightsClient, n, r); return s(W(W({}, e), {}, { insights: a }), t) } return s(e, t) }, e) } } var Tn, Cn, En, kn, Ln, jn = {}, Mn = [], On = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i; function An(e, t) { for (var n in t) e[n] = t[n]; return e } function Hn(e) { var t = e.parentNode; t && t.removeChild(e) } function Wn(e, t, n) { var r, i, a, s, o = arguments; if (t = An({}, t), 3 < arguments.length) for (n = [n], r = 3; r < arguments.length; r++)n.push(o[r]); if (null != n && (t.children = n), null != e && null != e.defaultProps) for (i in e.defaultProps) void 0 === t[i] && (t[i] = e.defaultProps[i]); return s = t.key, null != (a = t.ref) && delete t.ref, null != s && delete t.key, Dn(e, t, s, a) } function Dn(e, t, n, r) { var i = { type: e, props: t, key: n, ref: r, __k: null, __p: null, __b: 0, __e: null, l: null, __c: null, constructor: void 0 }; return Tn.vnode && Tn.vnode(i), i } function Bn(e) { return e.children } function Un(e, t) { this.props = e, this.context = t } function qn(e, t) { if (null == t) return e.__p ? qn(e.__p, e.__p.__k.indexOf(e) + 1) : null; for (var n; t < e.__k.length; t++)if (null != (n = e.__k[t]) && null != n.__e) return n.__e; return "function" == typeof e.type ? qn(e) : null } function Qn(e) { var t, n; if (null != (e = e.__p) && null != e.__c) { for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++)if (null != (n = e.__k[t]) && null != n.__e) { e.__e = e.__c.base = n.__e; break } return Qn(e) } } function $n(e) { (!e.__d && (e.__d = !0) && 1 === Cn.push(e) || kn !== Tn.debounceRendering) && (kn = Tn.debounceRendering, (Tn.debounceRendering || En)(Vn)) } function Vn() { var e, t, n, r, i, a, s, o; for (Cn.sort(function (e, t) { return t.__v.__b - e.__v.__b }); e = Cn.pop();)e.__d && (r = n = void 0, a = (i = (t = e).__v).__e, s = t.__P, o = t.u, t.u = !1, s && (n = [], r = Gn(s, i, An({}, i), t.__n, void 0 !== s.ownerSVGElement, null, n, o, null == a ? qn(i) : a), Zn(n, i), r != a && Qn(i))) } function Kn(t, n, e, r, i, a, s, o, c) { var u, l, d, h, f, m, p, g = e && e.__k || Mn, v = g.length; if (o == jn && (o = null != a ? a[0] : v ? qn(e, 0) : null), u = 0, n.__k = zn(n.__k, function (e) { if (null != e) { if (e.__p = n, e.__b = n.__b + 1, null === (d = g[u]) || d && e.key == d.key && e.type === d.type) g[u] = void 0; else for (l = 0; l < v; l++) { if ((d = g[l]) && e.key == d.key && e.type === d.type) { g[l] = void 0; break } d = null } if (h = Gn(t, e, d = d || jn, r, i, a, s, null, o, c), (l = e.ref) && d.ref != l && (p = p || []).push(l, e.__c || h, e), null != h) { if (null == m && (m = h), null != e.l) h = e.l, e.l = null; else if (a == d || h != o || null == h.parentNode) { e: if (null == o || o.parentNode !== t) t.appendChild(h); else { for (f = o, l = 0; (f = f.nextSibling) && l < v; l += 2)if (f == h) break e; t.insertBefore(h, o) } "option" == n.type && (t.value = "") } o = h.nextSibling, "function" == typeof n.type && (n.l = h) } } return u++, e }), n.__e = m, null != a && "function" != typeof n.type) for (u = a.length; u--;)null != a[u] && Hn(a[u]); for (u = v; u--;)null != g[u] && tr(g[u], g[u]); if (p) for (u = 0; u < p.length; u++)er(p[u], p[++u], p[++u]) } function zn(e, t, n) { if (null == n && (n = []), null == e || "boolean" == typeof e) t && n.push(t(null)); else if (Array.isArray(e)) for (var r = 0; r < e.length; r++)zn(e[r], t, n); else n.push(t ? t(function (e) { if (null == e || "boolean" == typeof e) return null; if ("string" == typeof e || "number" == typeof e) return Dn(null, e, null, null); if (null == e.__e && null == e.__c) return e; var t = Dn(e.type, e.props, e.key, null); return t.__e = e.__e, t }(e)) : e); return n } function Jn(e, t, n) { "-" === t[0] ? e.setProperty(t, n) : e[t] = "number" == typeof n && !1 === On.test(t) ? n + "px" : null == n ? "" : n } function Yn(e, t, n, r, i) { var a, s, o, c, u; if ("key" === (t = i ? "className" === t ? "class" : t : "class" === t ? "className" : t) || "children" === t); else if ("style" === t) if (a = e.style, "string" == typeof n) a.cssText = n; else { if ("string" == typeof r && (a.cssText = "", r = null), r) for (s in r) n && s in n || Jn(a, s, ""); if (n) for (o in n) r && n[o] === r[o] || Jn(a, o, n[o]) } else "o" === t[0] && "n" === t[1] ? (c = t !== (t = t.replace(/Capture$/, "")), t = ((u = t.toLowerCase()) in e ? u : t).slice(2), n ? (r || e.addEventListener(t, Xn, c), (e.t || (e.t = {}))[t] = n) : e.removeEventListener(t, Xn, c)) : "list" !== t && "tagName" !== t && "form" !== t && !i && t in e ? e[t] = null == n ? "" : n : "function" != typeof n && "dangerouslySetInnerHTML" !== t && (t !== (t = t.replace(/^xlink:?/, "")) ? null == n || !1 === n ? e.removeAttributeNS("http://www.w3.org/1999/xlink", t.toLowerCase()) : e.setAttributeNS("http://www.w3.org/1999/xlink", t.toLowerCase(), n) : null == n || !1 === n ? e.removeAttribute(t) : e.setAttribute(t, n)) } function Xn(e) { return this.t[e.type](Tn.event ? Tn.event(e) : e) } function Gn(e, t, n, r, i, a, s, o, c, u) { var l, d, h, f, m, p, g, v, y, b, R = t.type; if (void 0 !== t.constructor) return null; (l = Tn.__b) && l(t); try { e: if ("function" == typeof R) { if (v = t.props, y = (l = R.contextType) && r[l.__c], b = l ? y ? y.props.value : l.__p : r, n.__c ? g = (d = t.__c = n.__c).__p = d.__E : ("prototype" in R && R.prototype.render ? t.__c = d = new R(v, b) : (t.__c = d = new Un(v, b), d.constructor = R, d.render = nr), y && y.sub(d), d.props = v, d.state || (d.state = {}), d.context = b, d.__n = r, h = d.__d = !0, d.__h = []), null == d.__s && (d.__s = d.state), null != R.getDerivedStateFromProps && An(d.__s == d.state ? d.__s = An({}, d.__s) : d.__s, R.getDerivedStateFromProps(v, d.__s)), h) null == R.getDerivedStateFromProps && null != d.componentWillMount && d.componentWillMount(), null != d.componentDidMount && s.push(d); else { if (null == R.getDerivedStateFromProps && null == o && null != d.componentWillReceiveProps && d.componentWillReceiveProps(v, b), !o && null != d.shouldComponentUpdate && !1 === d.shouldComponentUpdate(v, d.__s, b)) { for (d.props = v, d.state = d.__s, d.__d = !1, (d.__v = t).__e = null != c ? c !== n.__e ? c : n.__e : null, t.__k = n.__k, l = 0; l < t.__k.length; l++)t.__k[l] && (t.__k[l].__p = t); break e } null != d.componentWillUpdate && d.componentWillUpdate(v, d.__s, b) } for (f = d.props, m = d.state, d.context = b, d.props = v, d.state = d.__s, (l = Tn.__r) && l(t), d.__d = !1, d.__v = t, d.__P = e, l = d.render(d.props, d.state, d.context), t.__k = zn(null != l && l.type == Bn && null == l.key ? l.props.children : l), null != d.getChildContext && (r = An(An({}, r), d.getChildContext())), h || null == d.getSnapshotBeforeUpdate || (p = d.getSnapshotBeforeUpdate(f, m)), Kn(e, t, n, r, i, a, s, c, u), d.base = t.__e; l = d.__h.pop();)d.__s && (d.state = d.__s), l.call(d); h || null == f || null == d.componentDidUpdate || d.componentDidUpdate(f, m, p), g && (d.__E = d.__p = null) } else t.__e = function (e, t, n, r, i, a, s, o) { var c, u, l, d, h = n.props, f = t.props; if (i = "svg" === t.type || i, null == e && null != a) for (c = 0; c < a.length; c++)if (null != (u = a[c]) && (null === t.type ? 3 === u.nodeType : u.localName === t.type)) { e = u, a[c] = null; break } if (null == e) { if (null === t.type) return document.createTextNode(f); e = i ? document.createElementNS("http://www.w3.org/2000/svg", t.type) : document.createElement(t.type), a = null } return null === t.type ? h !== f && (null != a && (a[a.indexOf(e)] = null), e.data = f) : t !== n && (null != a && (a = Mn.slice.call(e.childNodes)), l = (h = n.props || jn).dangerouslySetInnerHTML, d = f.dangerouslySetInnerHTML, o || (d || l) && (d && l && d.__html == l.__html || (e.innerHTML = d && d.__html || "")), function (e, t, n, r, i) { var a; for (a in n) a in t || Yn(e, a, null, n[a], r); for (a in t) i && "function" != typeof t[a] || "value" === a || "checked" === a || n[a] === t[a] || Yn(e, a, t[a], n[a], r) }(e, f, h, i, o), t.__k = t.props.children, d || Kn(e, t, n, r, "foreignObject" !== t.type && i, a, s, jn, o), o || ("value" in f && void 0 !== f.value && f.value !== e.value && (e.value = null == f.value ? "" : f.value), "checked" in f && void 0 !== f.checked && f.checked !== e.checked && (e.checked = f.checked))), e }(n.__e, t, n, r, i, a, s, u); (l = Tn.diffed) && l(t) } catch (e) { Tn.__e(e, t, n) } return t.__e } function Zn(e, t) { for (var n; n = e.pop();)try { n.componentDidMount() } catch (e) { Tn.__e(e, n.__v) } Tn.__c && Tn.__c(t) } function er(e, t, n) { try { "function" == typeof e ? e(t) : e.current = t } catch (e) { Tn.__e(e, n) } } function tr(e, t, n) { var r, i, a; if (Tn.unmount && Tn.unmount(e), (r = e.ref) && er(r, null, t), n || "function" == typeof e.type || (n = null != (i = e.__e)), e.__e = e.l = null, null != (r = e.__c)) { if (r.componentWillUnmount) try { r.componentWillUnmount() } catch (e) { Tn.__e(e, t) } r.base = r.__P = null } if (r = e.__k) for (a = 0; a < r.length; a++)r[a] && tr(r[a], t, n); null != i && Hn(i) } function nr(e, t, n) { return this.constructor(e, n) } function rr(e, t, n) { var r, i, a; Tn.__p && Tn.__p(e, t), i = (r = n === Ln) ? null : n && n.__k || t.__k, e = Wn(Bn, null, [e]), a = [], Gn(t, r ? t.__k = e : (n || t).__k = e, i || jn, jn, void 0 !== t.ownerSVGElement, n && !r ? [n] : i ? null : Mn.slice.call(t.childNodes), a, !1, n || jn, r), Zn(a, e) } Tn = {}, Un.prototype.setState = function (e, t) { var n = this.__s !== this.state && this.__s || (this.__s = An({}, this.state)); "function" == typeof e && !(e = e(n, this.props)) || An(n, e), null != e && this.__v && (this.u = !1, t && this.__h.push(t), $n(this)) }, Un.prototype.forceUpdate = function (e) { this.__v && (e && this.__h.push(e), this.u = !0, $n(this)) }, Un.prototype.render = Bn, Cn = [], En = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, kn = Tn.debounceRendering, Tn.__e = function (e, t, n) { for (var r; t = t.__p;)if ((r = t.__c) && !r.__p) try { if (r.constructor && null != r.constructor.getDerivedStateFromError) r.setState(r.constructor.getDerivedStateFromError(e)); else { if (null == r.componentDidCatch) continue; r.componentDidCatch(e) } return $n(r.__E = r) } catch (t) { e = t } throw e }, Ln = jn; function ir(e, t, n) { for (var r = e; r && !n(r);) { if (r === t) return null; r = r.parentElement } return r } function ar(e) { return function (s) { return Wn("div", { onClick: function (e) { if (s.sendEvent) { var t = ir(e.target, e.currentTarget, function (e) { return e.hasAttribute("data-insights-event") }); if (t) (function (e) { var t = e.getAttribute("data-insights-event"); if ("string" != typeof t) throw new Error("The insights middleware expects `data-insights-event` to be a base64-encoded JSON string."); try { return st(t) } catch (e) { throw new Error("The insights middleware was unable to parse `data-insights-event`.") } })(t).forEach(function (e) { return s.sendEvent(e) }) } var n = ir(e.target, e.currentTarget, function (e) { return function (e) { return e.hasAttribute("data-insights-method") }(e) }); if (n) { var r = function (e) { var t = e.getAttribute("data-insights-method"), n = e.getAttribute("data-insights-payload"); if ("string" != typeof n) throw new Error("The insights helper expects `data-insights-payload` to be a base64-encoded JSON string."); try { return { method: t, payload: st(n) } } catch (e) { throw new Error("The insights helper was unable to parse `data-insights-payload`.") } }(n), i = r.method, a = r.payload; s.insights(i, a) } } }, Wn(e, s)) } } function sr(l, e) { var d = 1 < arguments.length && void 0 !== e ? e : _e; return xe(l, cr()), function (a) { var e = a || {}, t = e.items, n = e.transformItems, s = void 0 === n ? function (e) { return e } : n; if (!Array.isArray(t)) throw new Error(cr("The `items` option expects an array of objects.")); var o = t, r = o.filter(function (e) { return !0 === e.default }); if (0 === r.length) throw new Error(cr("A default value must be specified in `items`.")); if (1 < r.length) throw new Error(cr("More than one default value is specified in `items`.")); var i = r[0], c = function (t) { return function (e) { return e || 0 === e ? t.setQueryParameter("hitsPerPage", e).search() : t.setQueryParameter("hitsPerPage", void 0).search() } }, u = function (e) { var t = e.state, n = e.createURL; return function (e) { return n(t.resetPage().setQueryParameter("hitsPerPage", e || 0 === e ? e : void 0)) } }; return { $$type: "ais.hitsPerPage", init: function (e) { var t = e.state, n = e.instantSearchInstance; o.some(function (e) { return Number(t.hitsPerPage) === Number(e.value) }) || (o = [{ value: "", label: "" }].concat(N(o))), l(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: n }), !0) }, render: function (e) { var t = e.instantSearchInstance; l(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return d(), t.setQueryParameter("hitsPerPage", void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { hitsPerPage: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.state, n = e.results, r = e.createURL, i = e.helper; return { items: s(function (e) { var t = e.hitsPerPage; return o.map(function (e) { return W(W({}, e), {}, { isRefined: Number(e.value) === Number(t) }) }) }(t)), refine: c(i), createURL: u({ state: t, createURL: r }), hasNoResults: !n || 0 === n.nbHits, widgetParams: a } }, getWidgetUiState: function (e, t) { var n = t.searchParameters.hitsPerPage; return void 0 === n || n === i.value ? e : W(W({}, e), {}, { hitsPerPage: n }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return e.setQueryParameters({ hitsPerPage: n.hitsPerPage || i.value }) } } } } var or = Fn(Pn), cr = Ze({ name: "hits-per-page", connector: !0 }), ur = Ze({ name: "infinite-hits", connector: !0 }); function lr(e) { var t = e || {}; t.page; return j(t, ["page"]) } function dr(i, e) { var a = 1 < arguments.length && void 0 !== e ? e : _e; return xe(i, ur()), function (m) { function p(e, t) { var n = e.page, r = void 0 === n ? 0 : n, i = Object.keys(t).map(Number); return 0 === i.length ? r : Math.min.apply(Math, [r].concat(N(i))) } function g(e, t) { var n = e.page, r = void 0 === n ? 0 : n, i = Object.keys(t).map(Number); return 0 === i.length ? r : Math.max.apply(Math, [r].concat(N(i))) } var v, y, b, R, e = m || {}, t = e.escapeHTML, S = void 0 === t || t, n = e.transformItems, w = void 0 === n ? function (e) { return e } : n, r = e.cache, P = void 0 === r ? function () { var r = null, i = null; return { read: function (e) { var t = e.state; return Le(i, lr(t)) ? r : null }, write: function (e) { var t = e.state, n = e.hits; i = lr(t), r = n } } }() : r; return { $$type: "ais.infiniteHits", init: function (e) { i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (e) { var t = e.instantSearchInstance, n = this.getWidgetRenderState(e); b("view", n.currentPageHits), i(W(W({}, n), {}, { instantSearchInstance: t }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { infiniteHits: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t, n = e.results, r = e.helper, i = e.state, a = e.instantSearchInstance, s = [], o = P.read({ state: i }) || {}; if (n) { var c = i.page, u = void 0 === c ? 0 : c; S && 0 < n.hits.length && (n.hits = Qe(n.hits)); var l = rt(nt(n.hits, n.page, n.hitsPerPage), n.queryID), d = w(l); void 0 === o[u] && (o[u] = d, P.write({ state: i, hits: o })), s = d, t = 0 === p(i, o) } else v = function (e) { return function () { e.overrideStateWithoutTriggeringChangeEvent(W(W({}, e.state), {}, { page: p(e.state, P.read({ state: e.state }) || {}) - 1 })).searchWithoutTriggeringOnStateChange() } }(r), y = function (e) { return function () { e.setPage(g(e.state, P.read({ state: e.state }) || {}) + 1).search() } }(r), b = ct({ instantSearchInstance: a, index: r.getIndex(), widgetType: this.$$type }), R = ut({ index: r.getIndex(), widgetType: this.$$type }), t = void 0 === i.page || 0 === p(i, o); var h = function (n) { return Object.keys(n).map(Number).sort(function (e, t) { return e - t }).reduce(function (e, t) { return e.concat(n[t]) }, []) }(o), f = !n || n.nbPages <= g(i, o) + 1; return { hits: h, currentPageHits: s, sendEvent: b, bindEvent: R, results: n, showPrevious: v, showMore: y, isFirstPage: t, isLastPage: f, widgetParams: m } }, dispose: function (e) { var t = e.state; a(); var n = t.setQueryParameter("page", void 0); return S ? n.setQueryParameters(Object.keys(De).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, void 0)) }, {})) : n }, getWidgetUiState: function (e, t) { var n = t.searchParameters.page || 0; return n ? W(W({}, e), {}, { page: n + 1 }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = e; S && (r = e.setQueryParameters(De)); var i = n.page ? n.page - 1 : 0; return r.setQueryParameter("page", i) } } } } function hr(s, e) { var o = 1 < arguments.length && void 0 !== e ? e : _e; return xe(s, pr()), function (u) { var l, d, h, e = u || {}, f = e.attribute, t = e.limit, c = void 0 === t ? 10 : t, n = e.showMore, m = void 0 !== n && n, r = e.showMoreLimit, p = void 0 === r ? 20 : r, i = e.sortBy, g = void 0 === i ? gr : i, a = e.transformItems, v = void 0 === a ? function (e) { return e } : a; if (!f) throw new Error(pr("The `attribute` option is required.")); if (!0 === m && p <= c) throw new Error(pr("The `showMoreLimit` option must be greater than `limit`.")); var y = !1, b = function () { }; function R() { b() } function S() { return y ? p : c } return { $$type: "ais.menu", init: function (e) { var t = e.instantSearchInstance; s(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; s(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return o(), t.removeHierarchicalFacet(f).setQueryParameter("maxValuesPerFacet", void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { menu: W(W({}, e.menu), {}, k({}, f, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.createURL, r = e.instantSearchInstance, i = e.helper, a = [], s = !1; if (l = l || it({ instantSearchInstance: r, helper: i, attribute: f, widgetType: this.$$type }), d = d || function (e) { return n(i.state.resetPage().toggleFacetRefinement(f, e)) }, h = h || function (e) { var t = D(i.getHierarchicalFacetBreadcrumb(f), 1)[0]; l("click", e || t), i.toggleFacetRefinement(f, e || t).search() }, e.results && (b = function (e, t) { return function () { y = !y, t.render(e) } }(e, this)), t) { var o = t.getFacetValues(f, { sortBy: g, facetOrdering: g === gr }), c = o && !Array.isArray(o) && o.data ? o.data : []; s = m && (y || c.length > S()), a = v(c.slice(0, S()).map(function (e) { var t = e.name, n = e.path; return W(W({}, j(e, ["name", "path"])), {}, { label: t, value: n }) })) } return { items: a, createURL: d, refine: h, sendEvent: l, canRefine: 0 < a.length, widgetParams: u, isShowingMore: y, toggleShowMore: R, canToggleShowMore: s } }, getWidgetUiState: function (e, t) { var n = D(t.searchParameters.getHierarchicalFacetBreadcrumb(f), 1)[0]; return n ? W(W({}, e), {}, { menu: W(W({}, e.menu), {}, k({}, f, n)) }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = n.menu && n.menu[f], i = e.removeHierarchicalFacet(f).addHierarchicalFacet({ name: f, attributes: [f] }), a = i.maxValuesPerFacet || 0, s = Math.max(a, m ? p : c), o = i.setQueryParameter("maxValuesPerFacet", s); return r ? o.addHierarchicalFacetRefinement(f, r) : o.setQueryParameters({ hierarchicalFacetsRefinements: W(W({}, o.hierarchicalFacetsRefinements), {}, k({}, f, [])) }) } } } } function fr(i, e) { var a = 1 < arguments.length && void 0 !== e ? e : _e; return xe(i, vr()), function (s) { var e = s || {}, t = e.attribute, u = void 0 === t ? "" : t, n = e.items, o = void 0 === n ? [] : n, r = e.transformItems, c = void 0 === r ? function (e) { return e } : r; if ("" === u) throw new Error(vr("The `attribute` option is required.")); if (!o || 0 === o.length) throw new Error(vr("The `items` option expects an array of objects.")); var l = {}; return { $$type: yr, init: function (e) { var t = e.instantSearchInstance; i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return a(), t.clearRefinements(u) }, getWidgetUiState: function (e, t) { var n = t.searchParameters.getNumericRefinements(u), r = n["="] && n["="][0]; if (r || 0 === r) return W(W({}, e), {}, { numericMenu: W(W({}, e.numericMenu), {}, k({}, u, "".concat(n["="]))) }); var i = n[">="] && n[">="][0] || "", a = n["<="] && n["<="][0] || ""; return "" === i && "" === a ? e : W(W({}, e), {}, { numericMenu: W(W({}, e.numericMenu), {}, k({}, u, "".concat(i, ":").concat(a))) }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = n.numericMenu && n.numericMenu[u], i = e.clearRefinements(u); if (!r) return i.setQueryParameters({ numericRefinements: W(W({}, i.numericRefinements), {}, k({}, u, {})) }); if (-1 === r.indexOf(":")) return i.addNumericRefinement(u, "=", Number(r)); var a = D(r.split(":").map(parseFloat), 2), s = a[0], o = a[1], c = Te(s) ? i.addNumericRefinement(u, ">=", s) : i; return Te(o) ? c.addNumericRefinement(u, "<=", o) : c }, getRenderState: function (e, t) { return W(W({}, e), {}, { numericMenu: W(W({}, e.numericMenu), {}, k({}, u, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.state, r = e.instantSearchInstance, i = e.helper, a = e.createURL; return l.refine || (l.refine = function (e) { var t = Rr(i.state, u, e); l.sendEvent("click", e), i.setState(t).search() }), l.createURL || (l.createURL = function (t) { return function (e) { return a(Rr(t, u, e)) } }), l.sendEvent || (l.sendEvent = function (e) { var c = e.instantSearchInstance, u = e.helper, l = e.attribute; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; if (1 !== t.length) { var r = t[0], i = t[1], a = t[2], s = void 0 === a ? "Filter Applied" : a; if ("click" === r) { var o = lt(Rr(u.state, l, i), l); o && 0 < o.length && c.sendEventToInsights({ insightsMethod: "clickedFilters", widgetType: yr, eventType: r, payload: { eventName: s, index: u.getIndex(), filters: o }, attribute: l }) } } else c.sendEventToInsights(t[0]) } }({ instantSearchInstance: r, helper: i, attribute: u })), { createURL: l.createURL(n), items: c(function (i) { return o.map(function (e) { var t = e.start, n = e.end, r = e.label; return { label: r, value: encodeURI(JSON.stringify({ start: t, end: n })), isRefined: br(i, u, { start: t, end: n, label: r }) } }) }(n)), hasNoResults: !t || 0 === t.nbHits, refine: l.refine, sendEvent: l.sendEvent, widgetParams: s } } } } } var mr = Fn(dr), pr = Ze({ name: "menu", connector: !0 }), gr = ["isRefined", "name:asc"], vr = Ze({ name: "numeric-menu", connector: !0 }), yr = "ais.numericMenu"; function br(e, t, n) { var r = e.getNumericRefinements(t); return void 0 !== n.start && void 0 !== n.end ? n.start === n.end ? Sr(r, "=", n.start) : Sr(r, ">=", n.start) && Sr(r, "<=", n.end) : void 0 !== n.start ? Sr(r, ">=", n.start) : void 0 !== n.end ? Sr(r, "<=", n.end) : void 0 === n.start && void 0 === n.end && Object.keys(r).every(function (e) { return 0 === (r[e] || []).length }) } function Rr(e, t, n) { var r = e, i = JSON.parse(decodeURI(n)), a = r.getNumericRefinements(t); if (void 0 === i.start && void 0 === i.end) return r.removeNumericRefinement(t); if (br(r, t, i) || (r = r.removeNumericRefinement(t)), void 0 !== i.start && void 0 !== i.end) { if (i.start > i.end) throw new Error("option.start should be > to option.end"); if (i.start === i.end) return r = Sr(a, "=", i.start) ? r.removeNumericRefinement(t, "=", i.start) : r.addNumericRefinement(t, "=", i.start) } return void 0 !== i.start && (Sr(a, ">=", i.start) && (r = r.removeNumericRefinement(t, ">=", i.start)), r = r.addNumericRefinement(t, ">=", i.start)), void 0 !== i.end && (Sr(a, "<=", i.end) && (r = r.removeNumericRefinement(t, "<=", i.end)), r = r.addNumericRefinement(t, "<=", i.end)), "number" == typeof r.page && (r.page = 0), r } function Sr(e, t, n) { return void 0 !== e[t] && e[t].includes(n) } function wr(n, e) { var r = 1 < arguments.length && void 0 !== e ? e : _e; return xe(n, Nr()), function (o) { var e = o || {}, c = e.totalPages, t = e.padding, u = new Pr({ currentPage: 0, total: 0, padding: void 0 === t ? 3 : t }), l = {}; return { $$type: "ais.pagination", init: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return r(), t.setQueryParameter("page", void 0) }, getWidgetUiState: function (e, t) { var n = t.searchParameters.page || 0; return n ? W(W({}, e), {}, { page: n + 1 }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = n.page ? n.page - 1 : 0; return e.setQueryParameter("page", r) }, getWidgetRenderState: function (e) { var t = e.results, n = e.helper, r = e.state, i = e.createURL; l.refine || (l.refine = function (e) { n.setPage(e), n.search() }), l.createURL || (l.createURL = function (t) { return function (e) { return i(t.setPage(e)) } }); var a = r.page || 0, s = function (e) { var t = e.nbPages; return void 0 !== c ? Math.min(c, t) : t }(t || { nbPages: 0 }); return u.currentPage = a, u.total = s, { createURL: l.createURL(r), refine: l.refine, canRefine: 1 < s, currentRefinement: a, nbHits: (null == t ? void 0 : t.nbHits) || 0, nbPages: s, pages: t ? u.pages() : [], isFirstPage: u.isFirstPage(), isLastPage: u.isLastPage(), widgetParams: o } }, getRenderState: function (e, t) { return W(W({}, e), {}, { pagination: this.getWidgetRenderState(t) }) } } } } var Pr = function () { function t(e) { C(this, t), k(this, "currentPage", void 0), k(this, "total", void 0), k(this, "padding", void 0), this.currentPage = e.currentPage, this.total = e.total, this.padding = e.padding } return E(t, [{ key: "pages", value: function () { var e = this.total, t = this.currentPage, n = this.padding; if (0 === e) return [0]; var r = this.nbPagesDisplayed(n, e); if (r === e) return Ee({ end: e }); var i = this.calculatePaddingLeft(t, n, e, r); return Ee({ start: t - i, end: t + (r - i) }) } }, { key: "nbPagesDisplayed", value: function (e, t) { return Math.min(2 * e + 1, t) } }, { key: "calculatePaddingLeft", value: function (e, t, n, r) { return e <= t ? e : n - t <= e ? r - (n - e) : t } }, { key: "isLastPage", value: function () { return this.currentPage === this.total - 1 || 0 === this.total } }, { key: "isFirstPage", value: function () { return 0 === this.currentPage } }]), t }(), Nr = Ze({ name: "pagination", connector: !0 }), xr = Ze({ name: "range-input", connector: !0 }, { name: "range-slider", connector: !0 }), _r = "ais.range"; function Ir(e) { var t = e.min, n = e.max, r = e.precision, i = Math.pow(10, r); return { min: t ? Math.floor(t * i) / i : t, max: n ? Math.ceil(n * i) / i : n } } function Fr(r, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(r, xr()), function (o) { var e = o || {}, t = e.attribute, w = void 0 === t ? "" : t, P = e.min, N = e.max, n = e.precision, x = void 0 === n ? 0 : n; if (!w) throw new Error(xr("The `attribute` option is required.")); if (Te(P) && Te(N) && N < P) throw new Error(xr("The `max` option can't be lower than `min`.")); function f(e, t, n, r) { var i, a, s = e.state, o = t.min, c = t.max, u = D(s.getNumericRefinement(w, ">=") || [], 1)[0], l = D(s.getNumericRefinement(w, "<=") || [], 1)[0], d = void 0 === n || "" === n, h = void 0 === r || "" === r, f = Ir({ min: d ? void 0 : parseFloat(n), max: h ? void 0 : parseFloat(r), precision: x }), m = f.min, p = f.max; i = Te(P) || o !== m ? Te(P) && d ? P : m : void 0, a = Te(N) || c !== p ? Te(N) && h ? N : p : void 0; var g = void 0 === i, v = Te(o) && o <= i, y = g || Te(i) && (!Te(o) || v), b = void 0 === a, R = Te(a) && a <= c, S = b || Te(a) && (!Te(c) || R); return (u !== i || l !== a) && y && S ? (s = s.removeNumericRefinement(w), Te(i) && (s = s.addNumericRefinement(w, ">=", i)), Te(a) && (s = s.addNumericRefinement(w, "<=", a)), s.resetPage()) : null } function m(e, t, n, r) { var i = 3 < arguments.length && void 0 !== r ? r : "Filter Applied", a = lt(e, w); a && 0 < a.length && t.sendEventToInsights({ insightsMethod: "clickedFilters", widgetType: _r, eventType: "click", payload: { eventName: i, index: n.getIndex(), filters: a }, attribute: w }) } var c = { from: function (e) { return e.toLocaleString() }, to: function (e) { return function (e) { return Number(Number(e).toFixed(x)) }(e).toLocaleString() } }; function u(i, a, s) { return function () { var e = D(0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [void 0, void 0], 2), t = e[0], n = e[1], r = f(a, s, t, n); r && (m(r, i, a), a.setState(r).search()) } } return { $$type: _r, init: function (e) { r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (e) { r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { range: W(W({}, e.range), {}, k({}, w, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.helper, r = e.instantSearchInstance, i = be(t && t.disjunctiveFacets || [], function (e) { return e.name === w }), a = function (e) { return Ir({ min: Te(P) ? P : Te(e.min) ? e.min : 0, max: Te(N) ? N : Te(e.max) ? e.max : 0, precision: x }) }(i && i.stats || { min: void 0, max: void 0 }), s = function (e) { var t = D(e.getNumericRefinement(w, ">=") || [], 1)[0], n = D(e.getNumericRefinement(w, "<=") || [], 1)[0]; return [Te(t) ? t : -1 / 0, Te(n) ? n : 1 / 0] }(n); return { refine: u(r, n, t ? a : { min: void 0, max: void 0 }), canRefine: a.min !== a.max, format: c, range: a, sendEvent: function (l, d, h) { return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; if (1 !== t.length) { var r = t[0], i = t[1], a = t[2]; if ("click" === r) { var s = D(i, 2), o = s[0], c = s[1], u = f(d, h, o, c); m(u, l, d, a) } } else l.sendEventToInsights(t[0]) } }(r, n, a), widgetParams: W(W({}, o), {}, { precision: x }), start: s } }, dispose: function (e) { var t = e.state; return i(), t.removeDisjunctiveFacet(w).removeNumericRefinement(w) }, getWidgetUiState: function (e, t) { var n = t.searchParameters.getNumericRefinements(w), r = n[">="], i = void 0 === r ? [] : r, a = n["<="], s = void 0 === a ? [] : a; return 0 === i.length && 0 === s.length ? e : W(W({}, e), {}, { range: W(W({}, e.range), {}, k({}, w, "".concat(i, ":").concat(s))) }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = e.addDisjunctiveFacet(w).setQueryParameters({ numericRefinements: W(W({}, e.numericRefinements), {}, k({}, w, {})) }); Te(P) && (r = r.addNumericRefinement(w, ">=", P)), Te(N) && (r = r.addNumericRefinement(w, "<=", N)); var i = n.range && n.range[w]; if (!i || -1 === i.indexOf(":")) return r; var a = D(i.split(":").map(parseFloat), 2), s = a[0], o = a[1]; return Te(s) && (!Te(P) || P < s) && (r = (r = r.removeNumericRefinement(w, ">=")).addNumericRefinement(w, ">=", s)), Te(o) && (!Te(N) || o < N) && (r = (r = r.removeNumericRefinement(w, "<=")).addNumericRefinement(w, "<=", o)), r } } } } function Tr(u, e) { var l = 1 < arguments.length && void 0 !== e ? e : _e; return xe(u, Or()), function (f) { var e = f || {}, m = e.attribute, t = e.operator, d = void 0 === t ? "or" : t, n = e.limit, p = void 0 === n ? 10 : n, r = e.showMore, g = void 0 !== r && r, i = e.showMoreLimit, h = void 0 === i ? 20 : i, a = e.sortBy, v = void 0 === a ? Ar : a, s = e.escapeFacetValues, o = void 0 === s || s, c = e.transformItems, y = void 0 === c ? function (e) { return e } : c; if (!m) throw new Error(Or("The `attribute` option is required.")); if (!/^(and|or)$/.test(d)) throw new Error(Or('The `operator` must one of: `"and"`, `"or"` (got "'.concat(d, '").'))); if (!0 === g && h <= p) throw new Error(Or("`showMoreLimit` should be greater than `limit`.")); function b(e) { var t = e.name; return W(W({}, j(e, ["name"])), {}, { label: t, value: t, highlighted: t }) } var R, S, w, P = [], N = !0, x = !1, _ = function () { }; function I() { _() } function F() { return x ? h : p } function T(n, a) { return function (i) { return function (e) { var r = i.instantSearchInstance; if ("" === e && P) u(W(W({}, a.getWidgetRenderState(W(W({}, i), {}, { results: R }))), {}, { instantSearchInstance: r }), !1); else { var t = { highlightPreTag: o ? De.highlightPreTag : Be.highlightPreTag, highlightPostTag: o ? De.highlightPostTag : Be.highlightPostTag }; n.searchForFacetValues(m, e, Math.min(F(), 100), t).then(function (e) { var t = o ? function (e) { return e.map(function (e) { return W(W({}, e), {}, { highlighted: Ue(e.highlighted) }) }) }(e.facetHits) : e.facetHits, n = y(t.map(function (e) { var t = e.value; return W(W({}, j(e, ["value"])), {}, { value: t, label: t }) })); u(W(W({}, a.getWidgetRenderState(W(W({}, i), {}, { results: R }))), {}, { items: n, canToggleShowMore: !1, canRefine: !0, isFromSearch: !0, instantSearchInstance: r }), !1) }) } } } } var C = function () { return function () { } }; return { $$type: "ais.refinementList", init: function (e) { u(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (e) { u(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { refinementList: W(W({}, e.refinementList), {}, k({}, m, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.state, r = e.createURL, i = e.instantSearchInstance, a = e.helper, s = [], o = []; if (w && S && C || (w = it({ instantSearchInstance: i, helper: a, attribute: m, widgetType: this.$$type }), S = function (e) { w("click", e), a.toggleFacetRefinement(m, e).search() }, C = T(a, this)), t) { var c = t.getFacetValues(m, { sortBy: v, facetOrdering: v === Ar }); o = c && Array.isArray(c) ? c : [], s = y(o.slice(0, F()).map(b)); var u = n.maxValuesPerFacet, l = F(); N = l < u ? o.length <= l : o.length < l, R = t, P = s, e.results && (_ = function (e, t) { return function () { x = !x, t.render(e) } }(e, this)) } var d = C && C(e), h = x && P.length > p || g && !N; return { createURL: function (e) { return r(n.resetPage().toggleFacetRefinement(m, e)) }, items: s, refine: S, searchForItems: d, isFromSearch: !1, canRefine: 0 < s.length, widgetParams: f, isShowingMore: x, canToggleShowMore: h, toggleShowMore: I, sendEvent: w, hasExhaustiveItems: N } }, dispose: function (e) { var t = e.state; l(); var n = t.setQueryParameter("maxValuesPerFacet", void 0); return "and" === d ? n.removeFacet(m) : n.removeDisjunctiveFacet(m) }, getWidgetUiState: function (e, t) { var n = t.searchParameters, r = "or" === d ? n.getDisjunctiveRefinements(m) : n.getConjunctiveRefinements(m); return r.length ? W(W({}, e), {}, { refinementList: W(W({}, e.refinementList), {}, k({}, m, r)) }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = "or" === d, i = n.refinementList && n.refinementList[m], a = e.clearRefinements(m), s = r ? a.addDisjunctiveFacet(m) : a.addFacet(m), o = s.maxValuesPerFacet || 0, c = Math.max(o, g ? h : p), u = s.setQueryParameter("maxValuesPerFacet", c); if (i) return i.reduce(function (e, t) { return r ? e.addDisjunctiveFacetRefinement(m, t) : e.addFacetRefinement(m, t) }, u); var l = r ? "disjunctiveFacetsRefinements" : "facetsRefinements"; return u.setQueryParameters(k({}, l, W(W({}, u[l]), {}, k({}, m, [])))) } } } } function Cr(n, e) { var r = 1 < arguments.length && void 0 !== e ? e : _e; return xe(n, Hr()), function (a) { var s, o = (a || {}).queryHook; var c = function () { }; function u() { c() } return { $$type: "ais.searchBox", init: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return r(), t.setQueryParameter("query", void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { searchBox: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.helper, n = e.searchMetadata, r = e.state; if (!s) { var i = function (e) { e !== r.query && t.setQuery(e).search() }; s = function (e) { o ? o(e, i) : i(e) } } return c = function (e) { return function () { e.setQuery("").search() } }(t), { query: r.query || "", refine: s, clear: u, widgetParams: a, isSearchStalled: n.isSearchStalled } }, getWidgetUiState: function (e, t) { var n = t.searchParameters.query || ""; return "" === n || e && e.query === n ? e : W(W({}, e), {}, { query: n }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return e.setQueryParameter("query", n.query || "") } } } } function Er(i, e) { var n = 1 < arguments.length && void 0 !== e ? e : _e; xe(i, Wr()); var c = {}; return function (a) { var e = a || {}, s = e.items, t = e.transformItems, o = void 0 === t ? function (e) { return e } : t; if (!Array.isArray(s)) throw new Error(Wr("The `items` option expects an array of objects.")); return { $$type: "ais.sortBy", init: function (e) { var t = e.instantSearchInstance, n = this.getWidgetRenderState(e), r = n.currentRefinement; be(s, function (e) { return e.value === r }); i(W(W({}, n), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return n(), c.initialIndex ? t.setIndex(c.initialIndex) : t }, getRenderState: function (e, t) { return W(W({}, e), {}, { sortBy: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.helper, r = e.state, i = e.parent; return !c.initialIndex && i && (c.initialIndex = i.getIndexName()), c.setIndex || (c.setIndex = function (e) { n.setIndex(e).search() }), { currentRefinement: r.index, options: o(s), refine: c.setIndex, hasNoResults: !t || 0 === t.nbHits, widgetParams: a } }, getWidgetUiState: function (e, t) { var n = t.searchParameters.index; return W(W({}, e), {}, { sortBy: n !== c.initialIndex ? n : void 0 }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return e.setQueryParameter("index", n.sortBy || c.initialIndex || e.index) } } } } function kr(n, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(n, Dr()), function (d) { var h, e = d || {}, f = e.attribute, t = e.max, m = void 0 === t ? 5 : t; if (!f) throw new Error(Dr("The `attribute` option is required.")); function p(e) { var t, n = e.getNumericRefinements(f); if (null !== (t = n[">="]) && void 0 !== t && t.length) return n[">="][0] } function r(e, t) { var n = p(e) === Number(t), r = e.resetPage().removeNumericRefinement(f); return n ? r : r.addNumericRefinement(f, "<=", m).addNumericRefinement(f, ">=", Number(t)) } var g = function (e) { return function (e, t) { h("click", t), e.setState(r(e.state, t)).search() }.bind(null, e) }, v = function (e) { var t = e.state, n = e.createURL; return function (e) { return n(r(t, e)) } }; return { $$type: Br, init: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { ratingMenu: W(W({}, e.ratingMenu), {}, k({}, f, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.helper, n = e.results, r = e.state, i = e.instantSearchInstance, a = e.createURL, s = []; if (h = h || function (e) { var o = e.instantSearchInstance, c = e.helper, u = e.getRefinedStar, l = e.attribute; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; if (1 !== t.length) { var r = t[0], i = t[1], a = t[2], s = void 0 === a ? "Filter Applied" : a; if ("click" === r) u() === Number(i) || o.sendEventToInsights({ insightsMethod: "clickedFilters", widgetType: Br, eventType: r, payload: { eventName: s, index: c.getIndex(), filters: ["".concat(l, ">=").concat(i)] }, attribute: l }) } else o.sendEventToInsights(t[0]) } }({ instantSearchInstance: i, helper: t, getRefinedStar: function () { return p(t.state) }, attribute: f }), n) for (var o = n.getFacetValues(f, {}), c = (o.length, function (e) { var r = 0; e.forEach(function (e) { var t = D(e.name.split("."), 2)[1], n = void 0 === t ? "" : t; r = Math.max(r, n.length) }) }(o), p(r)), u = function (n) { var e = c === n, t = o.filter(function (e) { return Number(e.name) >= n && Number(e.name) <= m }).map(function (e) { return e.count }).reduce(function (e, t) { return e + t }, 0); if (c && !e && 0 === t) return "continue"; var r = N(new Array(Math.floor(m / 1))).map(function (e, t) { return 1 * t < n }); s.push({ stars: r, name: String(n), label: String(n), value: String(n), count: t, isRefined: e }) }, l = 1; l < m; l += 1)u(l); return { items: s = s.reverse(), hasNoResults: !n || 0 === n.nbHits, canRefine: 0 < s.length, refine: g(t), sendEvent: h, createURL: v({ state: r, createURL: a }), widgetParams: d } }, dispose: function (e) { var t = e.state; return i(), t.removeNumericRefinement(f) }, getWidgetUiState: function (e, t) { var n = t.searchParameters, r = p(n); return "number" != typeof r ? e : W(W({}, e), {}, { ratingMenu: W(W({}, e.ratingMenu), {}, k({}, f, r)) }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = n.ratingMenu && n.ratingMenu[f], i = e.clearRefinements(f).addDisjunctiveFacet(f); return r ? i.addNumericRefinement(f, "<=", m).addNumericRefinement(f, ">=", r) : i.setQueryParameters({ numericRefinements: W(W({}, i.numericRefinements), {}, k({}, f, {})) }) } } } } function Lr(n, e) { var t = 1 < arguments.length && void 0 !== e ? e : _e; return xe(n, Ur()), function (r) { return { $$type: "ais.stats", init: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function () { t() }, getRenderState: function (e, t) { return W(W({}, e), {}, { stats: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.state; return t ? { hitsPerPage: t.hitsPerPage, nbHits: t.nbHits, nbSortedHits: t.nbSortedHits, areHitsSorted: void 0 !== t.appliedRelevancyStrictness && 0 < t.appliedRelevancyStrictness && t.nbSortedHits !== t.nbHits, nbPages: t.nbPages, page: t.page, processingTimeMS: t.processingTimeMS, query: t.query, widgetParams: r } : { hitsPerPage: n.hitsPerPage, nbHits: 0, nbSortedHits: void 0, areHitsSorted: !1, nbPages: 0, page: n.page || 0, processingTimeMS: -1, query: n.query || "", widgetParams: r } } } } } function jr(i, e) { var a = 1 < arguments.length && void 0 !== e ? e : _e; return xe(i, qr()), function (m) { var e = m || {}, p = e.attribute, t = e.on, n = void 0 === t || t, r = e.off; if (!p) throw new Error(qr("The `attribute` option is required.")); var g, v = void 0 !== r, y = Ge(n).map(Ne), b = v ? Ge(r).map(Ne) : void 0, R = function (n, e) { var r = e.state, i = e.createURL; return function () { r = r.resetPage(); var e = n ? y : b; e && e.forEach(function (e) { r = r.removeDisjunctiveFacetRefinement(p, e) }); var t = n ? b : y; return t && t.forEach(function (e) { r = r.addDisjunctiveFacetRefinement(p, e) }), i(r) } }; return { $$type: Qr, init: function (e) { var t = e.instantSearchInstance; i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; i(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return a(), t.removeDisjunctiveFacet(p) }, getRenderState: function (e, t) { return W(W({}, e), {}, { toggleRefinement: W(W({}, e.toggleRefinement), {}, k({}, p, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.state, n = e.helper, r = e.results, i = e.createURL, a = e.instantSearchInstance, s = r ? y.every(function (e) { return t.isDisjunctiveFacetRefined(p, e) }) : y.every(function (e) { return t.isDisjunctiveFacetRefined(p, e) }), o = { isRefined: s, count: 0 }, c = { isRefined: v && !s, count: 0 }; if (r) { var u = Ge(b || !1), l = r.getFacetValues(p, {}) || [], d = y.map(function (t) { return be(l, function (e) { return e.name === Re(t) }) }).filter(function (e) { return void 0 !== e }), h = v ? u.map(function (t) { return be(l, function (e) { return e.name === Re(t) }) }).filter(function (e) { return void 0 !== e }) : []; o = { isRefined: !!d.length && d.every(function (e) { return e.isRefined }), count: d.reduce(function (e, t) { return e + t.count }, 0) || null }, c = { isRefined: !!h.length && h.every(function (e) { return e.isRefined }), count: h.reduce(function (e, t) { return e + t.count }, 0) || l.reduce(function (e, t) { return e + t.count }, 0) } } g = g || function (e) { var o = e.instantSearchInstance, c = e.helper, u = e.attribute, l = e.on; return function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; if (1 !== t.length) { var r = t[0], i = t[1], a = t[2], s = void 0 === a ? "Filter Applied" : a; "click" === r && void 0 !== l && (i || o.sendEventToInsights({ insightsMethod: "clickedFilters", widgetType: Qr, eventType: r, payload: { eventName: s, index: c.getIndex(), filters: l.map(function (e) { return "".concat(u, ":").concat(e) }) }, attribute: u })) } else o.sendEventToInsights(t[0]) } }({ instantSearchInstance: a, attribute: p, on: y, helper: n }); var f = s ? c : o; return { value: { name: p, isRefined: s, count: r ? f.count : null, onFacetValue: o, offFacetValue: c }, createURL: R(s, { state: t, createURL: i }), sendEvent: g, canRefine: Boolean(r ? f.count : null), refine: function (t) { return function () { var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : { isRefined: !1 }).isRefined; e ? (y.forEach(function (e) { return t.removeDisjunctiveFacetRefinement(p, e) }), v && b.forEach(function (e) { return t.addDisjunctiveFacetRefinement(p, e) })) : (g("click", e), v && b.forEach(function (e) { return t.removeDisjunctiveFacetRefinement(p, e) }), y.forEach(function (e) { return t.addDisjunctiveFacetRefinement(p, e) })), t.search() } }(n), widgetParams: m } }, getWidgetUiState: function (e, t) { var n = t.searchParameters, r = y && y.every(function (e) { return n.isDisjunctiveFacetRefined(p, e) }); return r ? W(W({}, e), {}, { toggle: W(W({}, e.toggle), {}, k({}, p, r)) }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState, r = e.clearRefinements(p).addDisjunctiveFacet(p); return Boolean(n.toggle && n.toggle[p]) ? (y && y.forEach(function (e) { r = r.addDisjunctiveFacetRefinement(p, e) }), r) : v ? (b && b.forEach(function (e) { r = r.addDisjunctiveFacetRefinement(p, e) }), r) : r.setQueryParameters({ disjunctiveFacetsRefinements: W(W({}, e.disjunctiveFacetsRefinements), {}, k({}, p, [])) }) } } } } function Mr(d, e) { var h = 1 < arguments.length && void 0 !== e ? e : _e; xe(d, $r()); var f = {}; return function (s) { var e = s || {}, t = e.attributes, n = e.separator, r = void 0 === n ? " > " : n, i = e.rootPath, a = void 0 === i ? null : i, o = e.transformItems, c = void 0 === o ? function (e) { return e } : o; if (!t || !Array.isArray(t) || 0 === t.length) throw new Error($r("The `attributes` option expects an array of strings.")); var u = D(t, 1)[0]; function l(e, t) { if (!t) { var n = e.getHierarchicalFacetBreadcrumb(u); if (0 < n.length) return e.resetPage().toggleFacetRefinement(u, n[0]) } return e.resetPage().toggleFacetRefinement(u, t) } return { $$type: "ais.breadcrumb", init: function (e) { d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (e) { d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !1) }, dispose: function () { h() }, getRenderState: function (e, t) { return W(W({}, e), {}, { breadcrumb: W(W({}, e.breadcrumb), {}, k({}, u, this.getWidgetRenderState(t))) }) }, getWidgetRenderState: function (e) { var t = e.helper, n = e.createURL, r = e.results, i = e.state; var a = function () { if (!r) return []; var e = D(i.hierarchicalFacets, 1)[0].name, t = r.getFacetValues(e, {}), n = Array.isArray(t.data) ? t.data : []; return c(function (n) { return n.map(function (e, t) { return { label: e.label, value: t + 1 === n.length ? null : n[t + 1].value } }) }(function n(e) { return e.reduce(function (e, t) { return t.isRefined && (e.push({ label: t.name, value: t.path }), Array.isArray(t.data) && (e = e.concat(n(t.data)))), e }, []) }(n))) }(); return f.createURL || (f.createURL = function (e) { return n(l(t.state, e)) }), f.refine || (f.refine = function (e) { t.setState(l(t.state, e)).search() }), { canRefine: 0 < a.length, createURL: f.createURL, items: a, refine: f.refine, widgetParams: s } }, getWidgetSearchParameters: function (e) { if (e.isHierarchicalFacet(u)) { e.getHierarchicalFacetByName(u); return e } return e.addHierarchicalFacet({ name: u, attributes: t, separator: r, rootPath: a }) } } } } var Or = Ze({ name: "refinement-list", connector: !0 }), Ar = ["isRefined", "count:desc", "name:asc"], Hr = Ze({ name: "search-box", connector: !0 }), Wr = Ze({ name: "sort-by", connector: !0 }), Dr = Ze({ name: "rating-menu", connector: !0 }), Br = "ais.ratingMenu", Ur = Ze({ name: "stats", connector: !0 }), qr = Ze({ name: "toggle-refinement", connector: !0 }), Qr = "ais.toggleRefinement", $r = Ze({ name: "breadcrumb", connector: !0 }); var Vr = Ze({ name: "geo-search", connector: !0 }); function Kr(e) { return e.insideBoundingBox || "" } function zr(e, t) { return e.setQueryParameter("insideBoundingBox", t) } function Jr(v, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(v, Vr()), function (s) { function o(e) { return e.aroundLatLng ? function (e) { var t = e.match(et); if (!t) throw new Error('Invalid value for "aroundLatLng" parameter: "'.concat(e, '"')); return { lat: parseFloat(t[1]), lng: parseFloat(t[2]) } }(e.aroundLatLng) : void 0 } function c() { return g.internalToggleRefineOnMapMove() } function u(e, t) { return function () { g.isRefineOnMapMove = !g.isRefineOnMapMove, t(e) } } function l() { return g.isRefineOnMapMove } function d() { return g.internalSetMapMoveSinceLastRefine() } function h(t, n) { return function () { var e = !0 !== g.hasMapMoveSinceLastRefine; g.hasMapMoveSinceLastRefine = !0, e && n(t) } } function f() { return g.hasMapMoveSinceLastRefine } var m, e = s || {}, t = e.enableRefineOnMapMove, n = void 0 === t || t, r = e.transformItems, p = void 0 === r ? function (e) { return e } : r, g = { isRefineOnMapMove: n, hasMapMoveSinceLastRefine: !1, lastRefinePosition: "", lastRefineBoundingBox: "", internalToggleRefineOnMapMove: _e, internalSetMapMoveSinceLastRefine: _e }; return { $$type: Xr, init: function (e) { var t = e.instantSearchInstance; g.internalToggleRefineOnMapMove = u(e, _e), g.internalSetMapMoveSinceLastRefine = h(e, _e), v(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.helper, n = e.instantSearchInstance, r = t.state, i = Boolean(r.aroundLatLng) && Boolean(g.lastRefinePosition) && r.aroundLatLng !== g.lastRefinePosition, a = !r.insideBoundingBox && Boolean(g.lastRefineBoundingBox) && r.insideBoundingBox !== g.lastRefineBoundingBox; (i || a) && (g.hasMapMoveSinceLastRefine = !1), g.lastRefinePosition = r.aroundLatLng || "", g.lastRefineBoundingBox = Kr(r), g.internalToggleRefineOnMapMove = u(e, this.render.bind(this)), g.internalSetMapMoveSinceLastRefine = h(e, this.render.bind(this)); var s = this.getWidgetRenderState(e); m("view", s.items), v(W(W({}, s), {}, { instantSearchInstance: n }), !1) }, getWidgetRenderState: function (e) { var t = e.helper, n = e.results, r = e.instantSearchInstance, i = t.state, a = n ? p(n.hits.filter(function (e) { return e._geoloc })) : []; return m = m || ct({ instantSearchInstance: r, index: t.getIndex(), widgetType: Xr }), { items: a, position: o(i), currentRefinement: function (e) { return e.insideBoundingBox && tt(e.insideBoundingBox) }(i), refine: function (i) { return function (e) { var t = e.northEast, n = e.southWest, r = [t.lat, t.lng, n.lat, n.lng].join(); i.setState(zr(i.state, r).resetPage()).search(), g.hasMapMoveSinceLastRefine = !1, g.lastRefineBoundingBox = r } }(t), sendEvent: m, clearMapRefinement: function (e) { return function () { e.setQueryParameter("insideBoundingBox", void 0).search() } }(t), isRefinedWithMap: function (e) { return function () { return Boolean(e.insideBoundingBox) } }(i), toggleRefineOnMapMove: c, isRefineOnMapMove: l, setMapMoveSinceLastRefine: d, hasMapMoveSinceLastRefine: f, widgetParams: s } }, getRenderState: function (e, t) { return W(W({}, e), {}, { geoSearch: this.getWidgetRenderState(t) }) }, dispose: function (e) { var t = e.state; return i(), t.setQueryParameter("insideBoundingBox", void 0) }, getWidgetUiState: function (e, t) { var n = Kr(t.searchParameters); return !n || e && e.geoSearch && e.geoSearch.boundingBox === n ? e : W(W({}, e), {}, { geoSearch: { boundingBox: n } }) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return n && n.geoSearch ? zr(e, n.geoSearch.boundingBox) : e.setQueryParameter("insideBoundingBox", void 0) } } } } function Yr(r, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; xe(r, Gr()); var a = "https://www.algolia.com/?utm_source=instantsearch.js&utm_medium=website&" + "utm_content=".concat(ft(function (e) { var t; return (null === (t = e.window.location) || void 0 === t ? void 0 : t.hostname) || "" }, { fallback: function () { return "" } }), "&") + "utm_campaign=poweredby"; return function (e) { var t = (e || {}).url, n = void 0 === t ? a : t; return { $$type: "ais.poweredBy", init: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { poweredBy: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function () { return { url: n, widgetParams: e } }, dispose: function () { i() } } } } var Xr = "ais.geoSearch", Gr = Ze({ name: "powered-by", connector: !0 }), Zr = Ze({ name: "configure", connector: !0 }); function ei(e, t) { return e.setQueryParameters(Object.keys(t.searchParameters).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, void 0)) }, {})) } function ti(e, t) { var r = 0 < arguments.length && void 0 !== e ? e : _e, a = 1 < arguments.length && void 0 !== t ? t : _e; return function (i) { if (!i || !Ce(i.searchParameters)) throw new Error(Zr("The `searchParameters` option expects an object.")); var n = {}; return { $$type: "ais.configure", init: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return a(), ei(t, i) }, getRenderState: function (e, t) { var n, r = this.getWidgetRenderState(t); return W(W({}, e), {}, { configure: W(W({}, r), {}, { widgetParams: W(W({}, r.widgetParams), {}, { searchParameters: Xe(new oe.SearchParameters(null === (n = e.configure) || void 0 === n ? void 0 : n.widgetParams.searchParameters), new oe.SearchParameters(r.widgetParams.searchParameters)).getQueryParams() }) }) }) }, getWidgetRenderState: function (e) { var t = e.helper; return n.refine || (n.refine = function (r) { return function (e) { var t = ei(r.state, i), n = Xe(t, new oe.SearchParameters(e)); i.searchParameters = e, r.setState(n).search() } }(t)), { refine: n.refine, widgetParams: i } }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return Xe(e, new oe.SearchParameters(W(W({}, n.configure), i.searchParameters))) }, getWidgetUiState: function (e) { return W(W({}, e), {}, { configure: W(W({}, e.configure), i.searchParameters) }) } } } } var ni = Ze({ name: "configure-related-items", connector: !0 }); function ri(e) { var t = e.attributeName, n = e.attributeValue, r = e.attributeScore; return "".concat(t, ":").concat(n, "<score=").concat(r || 1, ">") } function ii(c, u) { return function (e) { var t = e || {}, a = t.hit, s = t.matchingPatterns, n = t.transformSearchParameters, r = void 0 === n ? function (e) { return e } : n; if (!a) throw new Error(ni("The `hit` option is required.")); if (!s) throw new Error(ni("The `matchingPatterns` option is required.")); var i = Object.keys(s).reduce(function (e, t) { var n = s[t], r = Fe(a, t), i = n.score; return Array.isArray(r) ? [].concat(N(e), [r.map(function (e) { return ri({ attributeName: t, attributeValue: e, attributeScore: i }) })]) : "string" == typeof r ? [].concat(N(e), [ri({ attributeName: t, attributeValue: r, attributeScore: i })]) : e }, []), o = W({}, r(new oe.SearchParameters({ sumOrFiltersScores: !0, facetFilters: ["objectID:-".concat(a.objectID)], optionalFilters: i }))); return W(W({}, ti(c, u)({ searchParameters: o })), {}, { $$type: "ais.configureRelatedItems" }) } } var ai = Ze({ name: "autocomplete", connector: !0 }), si = Ze({ name: "query-rules", connector: !0 }); function oi(e) { var t = this.helper, n = this.initialRuleContexts, r = this.trackedFilters, i = this.transformRuleContexts, a = e.state, s = a.ruleContexts || [], o = function (e) { var i = e.helper, a = e.sharedHelperState, s = e.trackedFilters; return Object.keys(s).reduce(function (e, t) { var n = we(i.lastResults || {}, a, !0).filter(function (e) { return e.attribute === t }).map(function (e) { return e.numericValue || e.name }), r = (0, s[t])(n); return [].concat(N(e), N(n.filter(function (e) { return r.includes(e) }).map(function (e) { return function (e) { return e.replace(/[^a-z0-9-_]+/gi, "_") }("ais-".concat(t, "-").concat(e)) }))) }, []) }({ helper: t, sharedHelperState: a, trackedFilters: r }), c = i([].concat(N(n), N(o))).slice(0, 10); Le(s, c) || t.overrideStateWithoutTriggeringChangeEvent(W(W({}, a), {}, { ruleContexts: c })) } function ci(d, e) { var h = 1 < arguments.length && void 0 !== e ? e : _e; return xe(d, si()), function (i) { var e = i || {}, t = e.trackedFilters, a = void 0 === t ? {} : t, n = e.transformRuleContexts, s = void 0 === n ? function (e) { return e } : n, r = e.transformItems, o = void 0 === r ? function (e) { return e } : r; Object.keys(a).forEach(function (e) { if ("function" != typeof a[e]) throw new Error(si("'The \"".concat(e, '" filter value in the `trackedFilters` option expects a function.'))) }); var c, u = 0 < Object.keys(a).length, l = []; return { $$type: "ais.queryRules", init: function (e) { var t = e.helper, n = e.state, r = e.instantSearchInstance; l = n.ruleContexts || [], c = oi.bind({ helper: t, initialRuleContexts: l, trackedFilters: a, transformRuleContexts: s }), u && ((function (e) { return [e.disjunctiveFacetsRefinements, e.facetsRefinements, e.hierarchicalFacetsRefinements, e.numericRefinements].some(function (e) { return Boolean(e && 0 < Object.keys(e).length) }) }(n) || Boolean(i.transformRuleContexts)) && c({ state: n }), t.on("change", c)), d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: r }), !0) }, render: function (e) { var t = e.instantSearchInstance; d(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, getWidgetRenderState: function (e) { var t = (e.results || {}).userData; return { items: o(void 0 === t ? [] : t), widgetParams: i } }, getRenderState: function (e, t) { return W(W({}, e), {}, { queryRules: this.getWidgetRenderState(t) }) }, dispose: function (e) { var t = e.helper, n = e.state; return h(), u ? (t.removeListener("change", c), n.setQueryParameter("ruleContexts", l)) : n } } } } function ui(e) { function t(e) { return { status: e, transcript: "", isSpeechFinal: !1, errorCode: void 0 } } function n(e) { var t = 0 < arguments.length && void 0 !== e ? e : {}; p = W(W({}, p), t), f() } function r(e) { n(t(0 < arguments.length && void 0 !== e ? e : "initial")) } function i() { n({ status: "waiting" }) } function a(e) { n({ status: "error", errorCode: e.error }) } function s(e) { n({ status: "recognizing", transcript: e.results[0] && e.results[0][0] && e.results[0][0].transcript || "", isSpeechFinal: e.results[0] && e.results[0].isFinal }), l && p.transcript && h(p.transcript) } function o() { p.errorCode || !p.transcript || l || h(p.transcript), "error" !== p.status && n({ status: "finished" }) } function c() { u && (u.stop(), u.removeEventListener("start", i), u.removeEventListener("error", a), u.removeEventListener("result", s), u.removeEventListener("end", o), u = void 0) } var u, l = e.searchAsYouSpeak, d = e.language, h = e.onQueryChange, f = e.onStateChange, m = window.webkitSpeechRecognition || window.SpeechRecognition, p = t("initial"); return { getState: function () { return p }, isBrowserSupported: function () { return Boolean(m) }, isListening: function () { return "askingPermission" === p.status || "waiting" === p.status || "recognizing" === p.status }, startListening: function () { (u = new m) && (r("askingPermission"), u.interimResults = !0, d && (u.lang = d), u.addEventListener("start", i), u.addEventListener("error", a), u.addEventListener("result", s), u.addEventListener("end", o), u.start()) }, stopListening: function () { c(), r("finished") }, dispose: c } } function li(p, e) { var a = 1 < arguments.length && void 0 !== e ? e : _e; return xe(p, di()), function (l) { var e = l.searchAsYouSpeak, d = void 0 !== e && e, h = l.language, f = l.additionalQueryParameters, t = l.createVoiceSearchHelper, m = void 0 === t ? ui : t; return { $$type: "ais.voiceSearch", init: function (e) { var t = e.instantSearchInstance; p(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; p(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { voiceSearch: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = this, n = e.helper, r = e.instantSearchInstance; this._refine || (this._refine = function (e) { if (e !== n.state.query) { var t = h ? [h.split("-")[0]] : void 0; n.setQueryParameter("queryLanguages", t), "function" == typeof f && n.setState(n.state.setQueryParameters(W({ ignorePlurals: !0, removeStopWords: !0, optionalWords: e }, f({ query: e })))), n.setQuery(e).search() } }), this._voiceSearchHelper || (this._voiceSearchHelper = m({ searchAsYouSpeak: d, language: h, onQueryChange: function (e) { return t._refine(e) }, onStateChange: function () { p(W(W({}, t.getWidgetRenderState(e)), {}, { instantSearchInstance: r }), !1) } })); var i = this._voiceSearchHelper, a = i.isBrowserSupported, s = i.isListening, o = i.startListening, c = i.stopListening, u = i.getState; return { isBrowserSupported: a(), isListening: s(), toggleListening: function () { a() && (s() ? c() : o()) }, voiceListeningState: u(), widgetParams: l } }, dispose: function (e) { var t = e.state; this._voiceSearchHelper.dispose(), a(); var n = t; if ("function" == typeof f) { var r = f({ query: "" }), i = r ? Object.keys(r).reduce(function (e, t) { return e[t] = void 0, e }, {}) : {}; n = t.setQueryParameters(W({ queryLanguages: void 0, ignorePlurals: void 0, removeStopWords: void 0, optionalWords: void 0 }, i)) } return n.setQueryParameter("query", void 0) }, getWidgetUiState: function (e, t) { var n = t.searchParameters.query || ""; return n ? W(W({}, e), {}, { query: n }) : e }, getWidgetSearchParameters: function (e, t) { var n = t.uiState; return e.setQueryParameter("query", n.query || "") } } } } var di = Ze({ name: "voice-search", connector: !0 }); function hi(b, e) { var R = 1 < arguments.length && void 0 !== e ? e : _e; return xe(b, pi()), function (e) { var t = e || {}, i = t.queryLanguages, a = t.attributesForPrediction, n = t.nbHits, s = void 0 === n ? 1 : n, r = t.renderDebounceTime, o = void 0 === r ? 100 : r, c = t.searchDebounceTime, u = void 0 === c ? 100 : c, l = t.escapeHTML, d = void 0 === l || l, h = t.extraParameters, f = void 0 === h ? {} : h; if (!i || 0 === i.length) throw new Error(pi("The `queryLanguages` expects an array of strings.")); var m, p = function () { var n = -1, r = -1, i = void 0; return function (e) { var t = ++n; return Promise.resolve(e).then(function (e) { return i && t < r ? i : (r = t, i = e) }) } }(), g = [], v = !1, y = dt(b, o); return { $$type: "ais.answers", init: function (e) { var t = e.state, n = e.instantSearchInstance.client.initIndex(t.index); if (!function (e) { return "function" == typeof e.findAnswers }(n)) throw new Error(pi("`algoliasearch` >= 4.8.0 required.")); m = dt(n.findAnswers, u), b(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: e.instantSearchInstance }), !0) }, render: function (n) { var r = this, e = n.state.query; if (!e) return v = !(g = []), void b(W(W({}, this.getWidgetRenderState(n)), {}, { instantSearchInstance: n.instantSearchInstance }), !1); g = [], v = !0, b(W(W({}, this.getWidgetRenderState(n)), {}, { instantSearchInstance: n.instantSearchInstance }), !1), p(m(e, i, W(W({}, f), {}, { nbHits: s, attributesForPrediction: a }))).then(function (e) { if (e) { d && 0 < e.hits.length && (e.hits = Qe(e.hits)); var t = rt(nt(e.hits, 0, s), e.queryID); g = t, v = !1, y(W(W({}, r.getWidgetRenderState(n)), {}, { instantSearchInstance: n.instantSearchInstance }), !1) } }) }, getRenderState: function (e, t) { return W(W({}, e), {}, { answers: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function () { return { hits: g, isLoading: v, widgetParams: e } }, dispose: function (e) { var t = e.state; return R(), t }, getWidgetSearchParameters: function (e) { return e } } } } function fi(e, t) { var n = 0 < arguments.length && void 0 !== e ? e : _e, r = 1 < arguments.length && void 0 !== t ? t : _e; return function (a) { var s = {}; return { $$type: "ais.relevantSort", init: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance; n(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !1) }, dispose: function (e) { var t = e.state; return r(), t.setQueryParameter("relevancyStrictness", void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { relevantSort: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t = e.results, n = e.helper; s.refine || (s.refine = function (e) { n.setQueryParameter("relevancyStrictness", e).search() }); var r = (t || {}).appliedRelevancyStrictness, i = void 0 !== r; return { isRelevantSorted: void 0 !== r && 0 < r, isVirtualReplica: i, canRefine: i, refine: s.refine, widgetParams: a } }, getWidgetSearchParameters: function (e, t) { var n, r = t.uiState; return e.setQueryParameter("relevancyStrictness", null !== (n = r.relevantSort) && void 0 !== n ? n : e.relevancyStrictness) }, getWidgetUiState: function (e, t) { var n = t.searchParameters; return W(W({}, e), {}, { relevantSort: n.relevancyStrictness || e.relevantSort }) } } } } function mi(d, e) { var s = 1 < arguments.length && void 0 !== e ? e : _e; return xe(d, gi()), function (o) { var e = o.widgets, t = o.maxValuesPerFacet, n = void 0 === t ? 20 : t, r = o.facets, i = void 0 === r ? ["*"] : r, a = o.transformItems, c = void 0 === a ? function (e) { return e } : a, u = o.fallbackWidget; if (!(e && Array.isArray(e) && e.every(function (e) { return "object" === h(e) }))) throw new Error(gi("The `widgets` option expects an array of widgets.")); if (!(Array.isArray(i) && i.length <= 1) || "*" !== i[0] && void 0 !== i[0]) throw new Error(gi('The `facets` option only accepts [] or ["*"], you passed '.concat(JSON.stringify(i)))); var l = new Map; return { $$type: "ais.dynamicWidgets", init: function (n) { e.forEach(function (e) { var t = ht(e, n); l.set(t, { widget: e, isMounted: !1 }) }), d(W(W({}, this.getWidgetRenderState(n)), {}, { instantSearchInstance: n.instantSearchInstance }), !0) }, render: function (e) { var t = e.parent, a = this.getWidgetRenderState(e), s = [], o = []; u && a.attributesToRender.forEach(function (e) { if (!l.has(e)) { var t = u({ attribute: e }); l.set(e, { widget: t, isMounted: !1 }) } }), l.forEach(function (e, t) { var n = e.widget, r = e.isMounted, i = -1 < a.attributesToRender.indexOf(t); !r && i ? (o.push(n), l.set(t, { widget: n, isMounted: !0 })) : r && !i && (s.push(n), l.set(t, { widget: n, isMounted: !1 })) }), t.addWidgets(o), setTimeout(function () { return t.removeWidgets(s) }, 0), d(W(W({}, a), {}, { instantSearchInstance: e.instantSearchInstance }), !1) }, dispose: function (e) { var t = e.parent, n = []; l.forEach(function (e) { var t = e.widget; e.isMounted && n.push(t) }), t.removeWidgets(n), s() }, getWidgetSearchParameters: function (e) { return i.reduce(function (e, t) { return e.addFacet(t) }, e.setQueryParameters({ maxValuesPerFacet: Math.max(n || 0, e.maxValuesPerFacet || 0) })) }, getRenderState: function (e, t) { return W(W({}, e), {}, { dynamicWidgets: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var t, n, r, i, a = e.results; e.state; if (!a) return { attributesToRender: [], widgetParams: o }; var s = c(null !== (t = null === (n = a.renderingContent) || void 0 === n ? void 0 : null === (r = n.facetOrdering) || void 0 === r ? void 0 : null === (i = r.facets) || void 0 === i ? void 0 : i.order) && void 0 !== t ? t : [], { results: a }); if (!Array.isArray(s)) throw new Error(gi("The `transformItems` option expects a function that returns an Array.")); return { attributesToRender: s, widgetParams: o } } } } } var pi = Ze({ name: "answers", connector: !0 }), gi = Ze({ name: "dynamic-widgets", connector: !0 }), vi = Ie(mi), yi = Object.freeze({ __proto__: null, connectDynamicWidgets: mi, EXPERIMENTAL_connectDynamicWidgets: vi, connectClearRefinements: fn, connectCurrentRefinements: gn, connectHierarchicalMenu: wn, connectHits: Pn, connectHitsWithInsights: or, connectHitsPerPage: sr, connectInfiniteHits: dr, connectInfiniteHitsWithInsights: mr, connectMenu: hr, connectNumericMenu: fr, connectPagination: wr, connectRange: Fr, connectRefinementList: Tr, connectSearchBox: Cr, connectSortBy: Er, connectRatingMenu: kr, connectStats: Lr, connectToggleRefinement: jr, connectBreadcrumb: Mr, connectGeoSearch: Jr, connectPoweredBy: Yr, connectConfigure: ti, EXPERIMENTAL_connectConfigureRelatedItems: ii, connectAutocomplete: function (r, e) { var i = 1 < arguments.length && void 0 !== e ? e : _e; return xe(r, ai()), function (o) { var e = (o || {}).escapeHTML, c = void 0 === e || e, u = {}; return { $$type: "ais.autocomplete", init: function (e) { var t = e.instantSearchInstance; r(W(W({}, this.getWidgetRenderState(e)), {}, { instantSearchInstance: t }), !0) }, render: function (e) { var t = e.instantSearchInstance, n = this.getWidgetRenderState(e); n.indices.forEach(function (e) { (0, e.sendEvent)("view", e.hits) }), r(W(W({}, n), {}, { instantSearchInstance: t }), !1) }, getRenderState: function (e, t) { return W(W({}, e), {}, { autocomplete: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function (e) { var n = this, t = e.helper, r = e.state, i = e.scopedResults, a = e.instantSearchInstance; u.refine || (u.refine = function (e) { t.setQuery(e).search() }); var s = i.map(function (e) { e.results.hits = c ? Qe(e.results.hits) : e.results.hits; var t = ct({ instantSearchInstance: a, index: e.results.index, widgetType: n.$$type }); return { indexId: e.indexId, indexName: e.results.index, hits: e.results.hits, results: e.results, sendEvent: t } }); return { currentRefinement: r.query || "", indices: s, refine: u.refine, widgetParams: o } }, getWidgetUiState: function (e, t) { var n = t.searchParameters.query || ""; return "" === n || e && e.query === n ? e : W(W({}, e), {}, { query: n }) }, getWidgetSearchParameters: function (e, t) { var n = { query: t.uiState.query || "" }; return c ? e.setQueryParameters(W(W({}, n), De)) : e.setQueryParameters(n) }, dispose: function (e) { var t = e.state; i(); var n = t.setQueryParameter("query", void 0); return c ? n.setQueryParameters(Object.keys(De).reduce(function (e, t) { return W(W({}, e), {}, k({}, t, void 0)) }, {})) : n } } } }, connectQueryRules: ci, connectVoiceSearch: li, EXPERIMENTAL_connectAnswers: hi, connectRelevantSort: fi }), bi = Ze({ name: "analytics" }), Ri = me(function (e) { function s() { for (var e = [], t = 0; t < arguments.length; t++) { var n = arguments[t]; if (n) { var r = typeof n; if ("string" == r || "number" == r) e.push(n); else if (Array.isArray(n) && n.length) { var i = s.apply(null, n); i && e.push(i) } else if ("object" == r) for (var a in n) o.call(n, a) && n[a] && e.push(a) } } return e.join(" ") } var o; o = {}.hasOwnProperty, e.exports ? (s.default = s, e.exports = s) : window.classNames = s }), Si = function () { L(t, Un); var e = O(t); function t() { return C(this, t), e.apply(this, arguments) } return E(t, [{ key: "shouldComponentUpdate", value: function (e) { return !Le(this.props.data, e.data) || this.props.templateKey !== e.templateKey || !Le(this.props.rootProps, e.rootProps) } }, { key: "render", value: function () { var e = this.props.rootTagName, t = this.props.useCustomCompileOptions[this.props.templateKey] ? this.props.templatesConfig.compileOptions : {}, n = ye({ templates: this.props.templates, templateKey: this.props.templateKey, compileOptions: t, helpers: this.props.templatesConfig.helpers, data: this.props.data, bindEvent: this.props.bindEvent }); return null === n ? null : Wn(e, f({}, this.props.rootProps, { dangerouslySetInnerHTML: { __html: n } })) } }]), t }(); k(Si, "defaultProps", { data: {}, rootTagName: "div", useCustomCompileOptions: {}, templates: {}, templatesConfig: {} }); function wi(e) { var r = e.items, i = e.cssClasses, a = e.templateProps, s = e.createURL, o = e.refine; return Wn("div", { className: Ri(i.root, k({}, i.noRefinementRoot, 0 === r.length)) }, Wn("ul", { className: i.list }, Wn("li", { className: Ri(i.item, k({}, i.selectedItem, 0 === r.length)) }, Wn(Si, f({}, a, { templateKey: "home", rootTagName: "a", rootProps: { className: i.link, href: s(void 0), onClick: function (e) { e.preventDefault(), o(void 0) } } }))), r.map(function (t, e) { var n = e === r.length - 1; return Wn("li", { key: t.label + e, className: Ri(i.item, k({}, i.selectedItem, n)) }, Wn(Si, f({}, a, { templateKey: "separator", rootTagName: "span", rootProps: { className: i.separator, "aria-hidden": !0 } })), n ? t.label : Wn("a", { className: i.link, href: s(t.value), onClick: function (e) { e.preventDefault(), o(t.value) } }, t.label)) }))) } function Pi(e) { var t = e.hasRefinements, n = e.refine, r = e.cssClasses, i = e.templateProps; return Wn("div", { className: r.root }, Wn(Si, f({}, i, { templateKey: "resetLabel", rootTagName: "button", rootProps: { className: Ri(r.button, k({}, r.disabledButton, !t)), onClick: n, disabled: !t }, data: { hasRefinements: t } }))) } function Ni(e) { var t = e.items, n = e.cssClasses; return Wn("div", { className: n.root }, Wn("ul", { className: n.list }, t.map(function (t, e) { return Wn("li", { key: "".concat(t.indexName, "-").concat(t.attribute, "-").concat(e), className: n.item }, Wn("span", { className: n.label }, function (e) { return e.toString().charAt(0).toUpperCase() + e.toString().slice(1) }(t.label), ":"), t.refinements.map(function (e) { return Wn("span", { key: function (e) { var t = e.attribute, n = e.value; return [t, e.type, n, e.operator].map(function (e) { return e }).filter(Boolean).join(":") }(e), className: n.category }, Wn("span", { className: n.categoryLabel }, "query" === e.attribute ? Wn("q", null, e.label) : e.label), Wn("button", { className: n.delete, onClick: function (t) { return function (e) { de(e) || (e.preventDefault(), t()) } }(t.refine.bind(null, e)) }, "✕")) })) }))) } function xi(e, t) { var n = e.items, r = e.widgetParams; if (!t) { var i = r, a = i.container, s = i.cssClasses; rr(Wn(Ni, { cssClasses: s, items: n }), a) } } function _i(e) { var t = e.hits, n = e.isLoading, r = e.cssClasses, i = e.templateProps; return Wn("div", { className: Ri(r.root, k({}, r.emptyRoot, 0 === t.length)) }, Wn(Si, f({}, i, { templateKey: "header", rootProps: { className: r.header }, data: { hits: t, isLoading: n } })), n ? Wn(Si, f({}, i, { templateKey: "loader", rootProps: { className: r.loader } })) : Wn("ul", { className: r.list }, t.map(function (e, t) { return Wn(Si, f({}, i, { templateKey: "item", rootTagName: "li", rootProps: { className: r.item }, key: e.objectID, data: W(W({}, e), {}, { __hitIndex: t }) })) }))) } var Ii = { home: "Home", separator: ">" }, Fi = Ze({ name: "breadcrumb" }), Ti = St("Breadcrumb"), Ci = { resetLabel: "Clear refinements" }, Ei = Ze({ name: "clear-refinements" }), ki = St("ClearRefinements"), Li = Ze({ name: "current-refinements" }), ji = St("CurrentRefinements"), Mi = { header: "", loader: "", item: function (e) { return JSON.stringify(e) } }, Oi = Ze({ name: "answers" }), Ai = St("Answers"), Hi = Ze({ name: "dynamic-widgets" }), Wi = St("DynamicWidgets"); function Di(e) { var t = document.createElement("div"); return t.className = Wi({ descendantName: "widget" }), e.appendChild(t), t } function Bi(e) { var t = e || {}, n = t.container, r = t.widgets, i = t.fallbackWidget, a = j(t, ["container", "widgets", "fallbackWidget"]); if (!n) throw new Error(Hi("The `container` option is required.")); if (!(r && Array.isArray(r) && r.every(function (e) { return "function" == typeof e }))) throw new Error(Hi("The `widgets` option expects an array of callbacks.")); var s = le(n), o = document.createElement("div"); o.className = Wi(); var c = new Map, u = [], l = mi(function (e, t) { var n = e.attributesToRender; t && s.appendChild(o), n.forEach(function (e) { if (c.has(e)) { var t = c.get(e); o.appendChild(t) } }) }, function () { s.removeChild(o) })(W(W({}, a), {}, { widgets: u, fallbackWidget: "function" == typeof i ? function (e) { var t = e.attribute, n = Di(o); return c.set(t, n), i({ attribute: t, container: n }) } : void 0 })); return W(W({}, l), {}, { init: function (i) { r.forEach(function (e) { var t = Di(o), n = e(t), r = ht(n, i); c.set(r, t), u.push(n) }), l.init(i) }, $$widgetType: "ais.dynamicWidgets" }) } function Ui(e) { var t = e.className, n = e.disabled, r = void 0 !== n && n; return Wn("button", { className: t, onClick: e.onClick, disabled: r }, e.children) } function qi(e) { var t = e.classNameLabel, n = e.classNameInput, r = e.checked, i = e.onToggle, a = e.children; return Wn("label", { className: t }, Wn("input", { className: n, type: "checkbox", checked: r, onChange: i }), a) } function Qi(e) { var t = e.cssClasses, n = e.enableRefine, r = e.enableRefineControl, i = e.enableClearMapRefinement, a = e.isRefineOnMapMove, s = e.isRefinedWithMap, o = e.hasMapMoveSinceLastRefine, c = e.onRefineToggle, u = e.onRefineClick, l = e.onClearClick, d = e.templateProps; return Wn(Bn, null, n && Wn("div", null, r && Wn("div", { className: t.control }, a || !o ? Wn(qi, { classNameLabel: Ri(t.label, k({}, t.selectedLabel, a)), classNameInput: t.input, checked: a, onToggle: c }, Wn(Si, f({}, d, { templateKey: "toggle", rootTagName: "span" }))) : Wn(Ui, { className: t.redo, disabled: !o, onClick: u }, Wn(Si, f({}, d, { templateKey: "redo", rootTagName: "span" })))), !r && !a && Wn("div", { className: t.control }, Wn(Ui, { className: Ri(t.redo, k({}, t.disabledRedo, !o)), disabled: !o, onClick: u }, Wn(Si, f({}, d, { templateKey: "redo", rootTagName: "span" })))), i && s && Wn(Ui, { className: t.reset, onClick: l }, Wn(Si, f({}, d, { templateKey: "reset", rootTagName: "span" }))))) } function $i(e) { var t = e.refine, n = e.mapInstance; return t({ northEast: n.getBounds().getNorthEast().toJSON(), southWest: n.getBounds().getSouthWest().toJSON() }) } function Vi(e, t) { e.isUserInteraction = !1, t(), e.isUserInteraction = !0 } function Ki(e, t) { var n = e.items, r = e.position, i = e.currentRefinement, a = e.refine, s = e.clearMapRefinement, o = e.toggleRefineOnMapMove, c = e.isRefineOnMapMove, u = e.setMapMoveSinceLastRefine, l = e.hasMapMoveSinceLastRefine, d = e.isRefinedWithMap, h = e.widgetParams, f = e.instantSearchInstance, m = h.container, p = h.googleReference, g = h.cssClasses, v = h.templates, y = h.initialZoom, b = h.initialPosition, R = h.enableRefine, S = h.enableClearMapRefinement, w = h.enableRefineControl, P = h.mapOptions, N = h.createMarker, x = h.markerOptions, _ = h.renderState; if (t) { _.isUserInteraction = !0, _.isPendingRefine = !1, _.markers = []; var I = document.createElement("div"); I.className = g.root, m.appendChild(I); var F = document.createElement("div"); F.className = g.map, I.appendChild(F); var T = document.createElement("div"); T.className = g.tree, I.appendChild(T), _.mapInstance = new p.maps.Map(F, W({ mapTypeControl: !1, fullscreenControl: !1, streetViewControl: !1, clickableIcons: !1, zoomControlOptions: { position: p.maps.ControlPosition.LEFT_TOP } }, P)); return p.maps.event.addListenerOnce(_.mapInstance, "idle", function () { function e() { _.isUserInteraction && R && (u(), c() && (_.isPendingRefine = !0)) } _.mapInstance.addListener("center_changed", e), _.mapInstance.addListener("zoom_changed", e), _.mapInstance.addListener("dragstart", e), _.mapInstance.addListener("idle", function () { _.isUserInteraction && _.isPendingRefine && (_.isPendingRefine = !1, $i({ mapInstance: _.mapInstance, refine: a })) }) }), void (_.templateProps = fe({ templatesConfig: f.templatesConfig, templates: v })) } var C = n.map(function (e) { return e.objectID }), E = D(function (e, a) { return e.reduce(function (e, t) { var n = D(e, 2), r = n[0], i = n[1]; return a.includes(t.__id) ? [r.concat(t), i] : [r, i.concat(t)] }, [[], []]) }(_.markers, C), 2), k = E[0], L = E[1], j = k.map(function (e) { return e.__id }), M = n.filter(function (e) { return !j.includes(e.objectID) }); L.forEach(function (e) { return e.setMap(null) }), _.markers = k.concat(M.map(function (n) { var r = N({ map: _.mapInstance, item: n }); return Object.keys(x.events).forEach(function (t) { r.addListener(t, function (e) { x.events[t]({ map: _.mapInstance, event: e, item: n, marker: r }) }) }), r })); var O = !l(), A = i ? 0 : null, H = !i && Boolean(_.markers.length) ? function (e, t) { var n = t.reduce(function (e, t) { return e.extend(t.getPosition()) }, new e.maps.LatLngBounds); return { northEast: n.getNorthEast().toJSON(), southWest: n.getSouthWest().toJSON() } }(p, _.markers) : i; H && O ? Vi(_, function () { _.mapInstance.fitBounds(new p.maps.LatLngBounds(H.southWest, H.northEast), A) }) : O && Vi(_, function () { _.mapInstance.setCenter(r || b), _.mapInstance.setZoom(y) }), rr(Wn(Qi, { cssClasses: g, enableRefine: R, enableRefineControl: w, enableClearMapRefinement: S, isRefineOnMapMove: c(), isRefinedWithMap: d(), hasMapMoveSinceLastRefine: l(), onRefineToggle: o, onRefineClick: function () { return $i({ mapInstance: _.mapInstance, refine: a }) }, onClearClick: s, templateProps: _.templateProps }), m.querySelector(".".concat(g.tree))) } var zi = { HTMLMarker: "<p>Your custom HTML Marker</p>", reset: "Clear the map refinement", toggle: "Search as I move the map", redo: "Redo search here" }, Ji = Ze({ name: "geo-search" }), Yi = St("GeoSearch"); function Xi(e) { var t = e.className, n = e.handleClick, r = e.facetValueToRefine, i = e.isRefined, a = e.templateProps, s = e.templateKey, o = e.templateData, c = e.subItems; return Wn("li", { className: t, onClick: function (e) { n({ facetValueToRefine: r, isRefined: i, originalEvent: e }) } }, Wn(Si, f({}, a, { templateKey: s, data: o })), c) } var Gi = { query: "", showSubmit: !0, showReset: !0, showLoadingIndicator: !0, autofocus: !1, searchAsYouType: !0, isSearchStalled: !1, disabled: !1, onChange: _e, onSubmit: _e, onReset: _e, refine: _e }, Zi = function () { L(i, Un); var r = O(i); function i() { var s; C(this, i); for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; return k(M(s = r.call.apply(r, [this].concat(t))), "state", { query: s.props.query, focused: !1 }), k(M(s), "input", {}), k(M(s), "onInput", function (e) { var t = s.props, n = t.searchAsYouType, r = t.refine, i = t.onChange, a = e.target.value; n && r(a), s.setState({ query: a }), i(e) }), k(M(s), "onSubmit", function (e) { var t = s.props, n = t.searchAsYouType, r = t.refine, i = t.onSubmit; return e.preventDefault(), e.stopPropagation(), s.input.current && s.input.current.blur(), n || r(s.state.query), i(e), !1 }), k(M(s), "onReset", function (e) { var t = s.props, n = t.refine, r = t.onReset; s.input.current && s.input.current.focus(), n(""), s.setState({ query: "" }), r(e) }), k(M(s), "onBlur", function () { s.setState({ focused: !1 }) }), k(M(s), "onFocus", function () { s.setState({ focused: !0 }) }), s } return E(i, [{ key: "resetInput", value: function () { this.setState({ query: "" }) } }, { key: "componentWillReceiveProps", value: function (e) { this.state.focused || e.query === this.state.query || this.setState({ query: e.query }) } }, { key: "render", value: function () { var e = this.props, t = e.cssClasses, n = e.placeholder, r = e.autofocus, i = e.showSubmit, a = e.showReset, s = e.showLoadingIndicator, o = e.templates, c = e.isSearchStalled; return Wn("div", { className: t.root }, Wn("form", { action: "", role: "search", className: t.form, noValidate: !0, onSubmit: this.onSubmit, onReset: this.onReset }, Wn("input", { ref: this.input, value: this.state.query, disabled: this.props.disabled, className: t.input, type: "search", placeholder: n, autoFocus: r, autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", maxLength: 512, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus }), Wn(Si, { templateKey: "submit", rootTagName: "button", rootProps: { className: t.submit, type: "submit", title: "Submit the search query.", hidden: !i }, templates: o, data: { cssClasses: t } }), Wn(Si, { templateKey: "reset", rootTagName: "button", rootProps: { className: t.reset, type: "reset", title: "Clear the search query.", hidden: !(a && this.state.query.trim() && !c) }, templates: o, data: { cssClasses: t } }), s && Wn(Si, { templateKey: "loadingIndicator", rootTagName: "span", rootProps: { className: t.loadingIndicator, hidden: !c }, templates: o, data: { cssClasses: t } }))) } }]), i }(); k(Zi, "defaultProps", Gi); function ea(e) { return void 0 !== e.data } var ta = function () { L(u, Un); var n = O(u); function u(e) { var t; return C(this, u), k(M(t = n.call(this, e)), "searchBox", {}), t.handleItemClick = t.handleItemClick.bind(M(t)), t } return E(u, [{ key: "shouldComponentUpdate", value: function (e) { return !Le(this.props.facetValues, e.facetValues) } }, { key: "refine", value: function (e) { this.props.toggleRefinement(e) } }, { key: "_generateFacetItem", value: function (e) { var t, n; if (ea(e) && Array.isArray(e.data) && 0 < e.data.length) { var r = this.props.cssClasses, i = (r.root, j(r, ["root"])); n = Wn(u, f({}, this.props, { cssClasses: i, depth: this.props.depth + 1, facetValues: e.data, showMore: !1, className: this.props.cssClasses.childList })) } var a = this.props.createURL(e.value), s = W(W({}, e), {}, { url: a, attribute: this.props.attribute, cssClasses: this.props.cssClasses, isFromSearch: this.props.isFromSearch }), o = e.value; void 0 !== e.isRefined && (o += "/".concat(e.isRefined)), void 0 !== e.count && (o += "/".concat(e.count)); var c = Ri(this.props.cssClasses.item, (k(t = {}, this.props.cssClasses.selectedItem, e.isRefined), k(t, this.props.cssClasses.disabledItem, !e.count), k(t, this.props.cssClasses.parentItem, ea(e) && Array.isArray(e.data) && 0 < e.data.length), t)); return Wn(Xi, { templateKey: "item", key: o, facetValueToRefine: e.value, handleClick: this.handleItemClick, isRefined: e.isRefined, className: c, subItems: n, templateData: s, templateProps: this.props.templateProps }) } }, { key: "handleItemClick", value: function (e) { var t = e.facetValueToRefine, n = e.isRefined, r = e.originalEvent; if (!de(r) && r.target instanceof HTMLElement && r.target.parentNode instanceof HTMLElement && (!n || !r.target.parentNode.querySelector('input[type="radio"]:checked'))) if ("INPUT" !== r.target.tagName) { for (var i = r.target; i !== r.currentTarget;) { if ("LABEL" === i.tagName && (i.querySelector('input[type="checkbox"]') || i.querySelector('input[type="radio"]'))) return; "A" === i.tagName && i.href && r.preventDefault(), i = i.parentNode } r.stopPropagation(), this.refine(t) } else this.refine(t) } }, { key: "componentWillReceiveProps", value: function (e) { this.searchBox.current && !e.isFromSearch && this.searchBox.current.resetInput() } }, { key: "refineFirstValue", value: function () { var e = this.props.facetValues && this.props.facetValues[0]; if (e) { var t = e.value; this.props.toggleRefinement(t) } } }, { key: "render", value: function () { var t = this, e = Ri(this.props.cssClasses.showMore, k({}, this.props.cssClasses.disabledShowMore, !(!0 === this.props.showMore && this.props.canToggleShowMore))), n = !0 === this.props.showMore && Wn(Si, f({}, this.props.templateProps, { templateKey: "showMoreText", rootTagName: "button", rootProps: { className: e, disabled: !this.props.canToggleShowMore, onClick: this.props.toggleShowMore }, data: { isShowingMore: this.props.isShowingMore } })), r = !0 !== this.props.searchIsAlwaysActive && !(this.props.isFromSearch || !this.props.hasExhaustiveItems), i = this.props.searchFacetValues && Wn("div", { className: this.props.cssClasses.searchBox }, Wn(Zi, { ref: this.searchBox, placeholder: this.props.searchPlaceholder, disabled: r, cssClasses: this.props.cssClasses.searchable, templates: this.props.searchBoxTemplateProps.templates, onChange: function (e) { return t.props.searchFacetValues(e.target.value) }, onReset: function () { return t.props.searchFacetValues("") }, onSubmit: function () { return t.refineFirstValue() }, searchAsYouType: !1 })), a = this.props.facetValues && 0 < this.props.facetValues.length && Wn("ul", { className: this.props.cssClasses.list }, this.props.facetValues.map(this._generateFacetItem, this)), s = this.props.searchFacetValues && this.props.isFromSearch && (!this.props.facetValues || 0 === this.props.facetValues.length) && Wn(Si, f({}, this.props.templateProps, { templateKey: "searchableNoResults", rootProps: { className: this.props.cssClasses.noResults } })); return Wn("div", { className: Ri(this.props.cssClasses.root, k({}, this.props.cssClasses.noRefinementRoot, !this.props.facetValues || 0 === this.props.facetValues.length), this.props.className) }, this.props.children, i, a, s, n) } }]), u }(); k(ta, "defaultProps", { cssClasses: {}, depth: 0 }); function na(e) { var t = e.results, n = e.hits, r = e.bindEvent, i = e.cssClasses, a = e.templateProps; return 0 === t.hits.length ? Wn(Si, f({}, a, { templateKey: "empty", rootProps: { className: Ri(i.root, i.emptyRoot) }, data: t })) : Wn("div", { className: i.root }, Wn("ol", { className: i.list }, n.map(function (e, t) { return Wn(Si, f({}, a, { templateKey: "item", rootTagName: "li", rootProps: { className: i.item }, key: e.objectID, data: W(W({}, e), {}, { __hitIndex: t }), bindEvent: r })) }))) } var ra = { item: '<a class="{{cssClasses.link}}" href="{{url}}"><span class="{{cssClasses.label}}">{{label}}</span><span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>', showMoreText: "\n    {{#isShowingMore}}\n      Show less\n    {{/isShowingMore}}\n    {{^isShowingMore}}\n      Show more\n    {{/isShowingMore}}\n  " }, ia = Ze({ name: "hierarchical-menu" }), aa = St("HierarchicalMenu"); na.defaultProps = { results: { hits: [] }, hits: [] }; var sa = { empty: "No results", item: function (e) { return JSON.stringify(e, null, 2) } }, oa = Ze({ name: "hits" }), ca = St("Hits"), ua = ar(na); function la(e) { var t = e.currentValue, n = e.options, r = e.cssClasses, i = e.setValue; return Wn("select", { className: Ri(r.select), onChange: function (e) { return i(e.target.value) }, value: "".concat(t) }, n.map(function (e) { return Wn("option", { className: Ri(r.option), key: e.label + e.value, value: "".concat(e.value) }, e.label) })) } var da = Ze({ name: "hits-per-page" }), ha = St("HitsPerPage"), fa = { empty: "No results", showPreviousText: "Show previous results", showMoreText: "Show more results", item: function (e) { return JSON.stringify(e, null, 2) } }, ma = Ze({ name: "infinite-hits" }), pa = St("InfiniteHits"), ga = ar(function (e) { var t = e.results, n = e.hits, r = e.bindEvent, i = e.hasShowPrevious, a = e.showPrevious, s = e.showMore, o = e.isFirstPage, c = e.isLastPage, u = e.cssClasses, l = e.templateProps; return 0 === t.hits.length ? Wn(Si, f({}, l, { templateKey: "empty", rootProps: { className: Ri(u.root, u.emptyRoot) }, data: t })) : Wn("div", { className: u.root }, i && Wn(Si, f({}, l, { templateKey: "showPreviousText", rootTagName: "button", rootProps: { className: Ri(u.loadPrevious, k({}, u.disabledLoadPrevious, o)), disabled: o, onClick: a } })), Wn("ol", { className: u.list }, n.map(function (e, t) { return Wn(Si, f({}, l, { templateKey: "item", rootTagName: "li", rootProps: { className: u.item }, key: e.objectID, data: W(W({}, e), {}, { __hitIndex: t }), bindEvent: r })) })), Wn(Si, f({}, l, { templateKey: "showMoreText", rootTagName: "button", rootProps: { className: Ri(u.loadMore, k({}, u.disabledLoadMore, c)), disabled: c, onClick: s } }))) }), va = { item: '<a class="{{cssClasses.link}}" href="{{url}}"><span class="{{cssClasses.label}}">{{label}}</span><span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>', showMoreText: "\n    {{#isShowingMore}}\n      Show less\n    {{/isShowingMore}}\n    {{^isShowingMore}}\n      Show more\n    {{/isShowingMore}}\n  " }, ya = Ze({ name: "menu" }), ba = St("Menu"); function Ra(e) { var t = e.cssClasses, n = e.templateProps, r = e.items, i = e.refine, a = (be(r, function (e) { return e.isRefined }) || { value: "" }).value; return Wn("div", { className: Ri(t.root, k({}, t.noRefinementRoot, 0 === r.length)) }, Wn("select", { className: t.select, value: a, onChange: function (e) { i(e.target.value) } }, Wn(Si, f({}, n, { templateKey: "defaultOption", rootTagName: "option", rootProps: { value: "", className: t.option } })), r.map(function (e) { return Wn(Si, f({}, n, { templateKey: "item", rootTagName: "option", rootProps: { value: e.value, className: t.option }, key: e.value, data: e })) }))) } function Sa(e) { var t = e.cssClasses, n = e.label, r = e.ariaLabel, i = e.url, a = e.isDisabled, s = e.handleClick, o = e.pageNumber; return Wn("li", { className: t.item }, a ? Wn("span", { className: t.link, dangerouslySetInnerHTML: { __html: n } }) : Wn("a", { className: t.link, "aria-label": r, href: i, onClick: function (e) { return s(o, e) }, dangerouslySetInnerHTML: { __html: n } })) } var wa = { item: "{{label}} ({{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}})", defaultOption: "See all" }, Pa = Ze({ name: "menu-select" }), Na = St("MenuSelect"), xa = { item: '<label class="{{cssClasses.label}}">\n  <input type="radio" class="{{cssClasses.radio}}" name="{{attribute}}"{{#isRefined}} checked{{/isRefined}} />\n  <span class="{{cssClasses.labelText}}">{{label}}</span>\n</label>' }, _a = Ze({ name: "numeric-menu" }), Ia = St("NumericMenu"), Fa = function () { L(a, Un); var i = O(a); function a() { var n; C(this, a); for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)t[r] = arguments[r]; return k(M(n = i.call.apply(i, [this].concat(t))), "handleClick", function (e, t) { de(t) || (t.preventDefault(), n.props.setCurrentPage(e)) }), k(M(n), "previousPageLink", function () { return n.pageLink({ ariaLabel: "Previous", additionalClassName: n.props.cssClasses.previousPageItem, isDisabled: n.props.isFirstPage, label: n.props.templates.previous, pageNumber: n.props.currentPage - 1, createURL: n.props.createURL }) }), k(M(n), "nextPageLink", function () { return n.pageLink({ ariaLabel: "Next", additionalClassName: n.props.cssClasses.nextPageItem, isDisabled: n.props.isLastPage, label: n.props.templates.next, pageNumber: n.props.currentPage + 1, createURL: n.props.createURL }) }), k(M(n), "firstPageLink", function () { return n.pageLink({ ariaLabel: "First", additionalClassName: n.props.cssClasses.firstPageItem, isDisabled: n.props.isFirstPage, label: n.props.templates.first, pageNumber: 0, createURL: n.props.createURL }) }), k(M(n), "lastPageLink", function () { return n.pageLink({ ariaLabel: "Last", additionalClassName: n.props.cssClasses.lastPageItem, isDisabled: n.props.isLastPage, label: n.props.templates.last, pageNumber: n.props.nbPages - 1, createURL: n.props.createURL }) }), k(M(n), "pages", function () { return n.props.pages.map(function (e) { return n.pageLink({ ariaLabel: "".concat(e + 1), additionalClassName: n.props.cssClasses.pageItem, isSelected: e === n.props.currentPage, label: "".concat(e + 1), pageNumber: e, createURL: n.props.createURL }) }) }), n } return E(a, [{ key: "pageLink", value: function (e) { var t = e.label, n = e.ariaLabel, r = e.pageNumber, i = e.additionalClassName, a = void 0 === i ? null : i, s = e.isDisabled, o = void 0 !== s && s, c = e.isSelected, u = void 0 !== c && c, l = e.createURL, d = { item: Ri(this.props.cssClasses.item, a), link: this.props.cssClasses.link }; o ? d.item = Ri(d.item, this.props.cssClasses.disabledItem) : u && (d.item = Ri(d.item, this.props.cssClasses.selectedItem)); var h = o ? "#" : l(r); return Wn(Sa, { ariaLabel: n, cssClasses: d, handleClick: this.handleClick, isDisabled: o, key: t + r + n, label: t, pageNumber: r, url: h }) } }, { key: "render", value: function () { return Wn("div", { className: Ri(this.props.cssClasses.root, k({}, this.props.cssClasses.noRefinementRoot, this.props.nbPages <= 1)) }, Wn("ul", { className: this.props.cssClasses.list }, this.props.showFirst && this.firstPageLink(), this.props.showPrevious && this.previousPageLink(), this.pages(), this.props.showNext && this.nextPageLink(), this.props.showLast && this.lastPageLink())) } }]), a }(); k(Fa, "defaultProps", { currentPage: 0, nbPages: 0, pages: [] }); var Ta, Ca, Ea = St("Pagination"), ka = Ze({ name: "pagination" }), La = { previous: "‹", next: "›", first: "«", last: "»" }, ja = [], Ma = Tn.__r; Tn.__r = function (e) { Ma && Ma(e), Ta = 0, (Ca = e.__c).__H && (Ca.__H.t = Qa(Ca.__H.t)) }; var Oa = Tn.diffed; Tn.diffed = function (e) { Oa && Oa(e); var t = e.__c; if (t) { var n = t.__H; n && (n.u = (n.u.some(function (e) { e.ref && (e.ref.current = e.createHandle()) }), []), n.i = Qa(n.i)) } }; var Aa = Tn.unmount; function Ha(e) { Tn.__h && Tn.__h(Ca); var t = Ca.__H || (Ca.__H = { o: [], t: [], i: [], u: [] }); return e >= t.o.length && t.o.push({}), t.o[e] } function Wa(e) { return function (n, e, t) { var r = Ha(Ta++); return r.__c || (r.__c = Ca, r.v = [t ? t(e) : za(void 0, e), function (e) { var t = n(r.v[0], e); r.v[0] !== t && (r.v[0] = t, r.__c.setState({})) }]), r.v }(za, e) } function Da(e) { return function (e, t) { var n = Ha(Ta++); return Ka(n.m, t) ? (n.m = t, n.p = e, n.v = e()) : n.v }(function () { return { current: e } }, []) } Tn.unmount = function (e) { Aa && Aa(e); var t = e.__c; if (t) { var n = t.__H; n && n.o.forEach(function (e) { return e.l && e.l() }) } }; var Ba = function () { }; function Ua() { ja.some(function (e) { e.s = !1, e.__P && (e.__H.t = Qa(e.__H.t)) }), ja = [] } if ("undefined" != typeof window) { var qa = Tn.requestAnimationFrame; Ba = function (e) { (!e.s && (e.s = !0) && 1 === ja.push(e) || qa !== Tn.requestAnimationFrame) && (qa = Tn.requestAnimationFrame, (Tn.requestAnimationFrame || function (e) { function t() { clearTimeout(n), cancelAnimationFrame(r), setTimeout(e) } var n = setTimeout(t, 100), r = requestAnimationFrame(t) })(Ua)) } } function Qa(e) { return e.forEach($a), e.forEach(Va), [] } function $a(e) { e.l && e.l() } function Va(e) { var t = e.v(); "function" == typeof t && (e.l = t) } function Ka(n, e) { return !n || e.some(function (e, t) { return e !== n[t] }) } function za(e, t) { return "function" == typeof t ? t(e) : t } function Ja(t) { var e, n = D(Wa(t.isCollapsed), 2), r = n[0], i = n[1], a = D(Wa(!1), 2), s = a[0], o = a[1], c = Da(null); return function (e, t) { var n = Ha(Ta++); Ka(n.m, t) && (n.v = e, n.m = t, Ca.__H.t.push(n), Ba(Ca)) }(function () { var e = c.current; if (e) return e.appendChild(t.bodyElement), function () { e.removeChild(t.bodyElement) } }, [c, t.bodyElement]), s || t.isCollapsed === r || i(t.isCollapsed), Wn("div", { className: Ri(t.cssClasses.root, (e = {}, k(e, t.cssClasses.noRefinementRoot, t.hidden), k(e, t.cssClasses.collapsibleRoot, t.collapsible), k(e, t.cssClasses.collapsedRoot, r), e)), hidden: t.hidden }, t.templates.header && Wn("div", { className: t.cssClasses.header }, Wn(Si, { templates: t.templates, templateKey: "header", rootTagName: "span", data: t.data }), t.collapsible && Wn("button", { className: t.cssClasses.collapseButton, "aria-expanded": !r, onClick: function (e) { e.preventDefault(), o(!0), i(function (e) { return !e }) } }, Wn(Si, { templates: t.templates, templateKey: "collapseButtonText", rootTagName: "span", data: { collapsed: r } }))), Wn("div", { className: t.cssClasses.body, ref: c }), t.templates.footer && Wn(Si, { templates: t.templates, templateKey: "footer", rootProps: { className: t.cssClasses.footer }, data: t.data })) } function Ya(e) { var t = e.url, n = e.theme, r = e.cssClasses; return Wn("div", { className: r.root }, Wn("a", { href: t, target: "_blank", className: r.link, "aria-label": "Search by Algolia", rel: "noopener noreferrer" }, Wn("svg", { height: "1.2em", className: r.logo, viewBox: "0 0 168 24", style: { width: "auto" } }, Wn("path", { fill: "dark" === n ? "#FFF" : "#5D6494", d: "M6.97 6.68V8.3a4.47 4.47 0 00-2.42-.67 2.2 2.2 0 00-1.38.4c-.34.26-.5.6-.5 1.02 0 .43.16.77.49 1.03.33.25.83.53 1.51.83a7.04 7.04 0 011.9 1.08c.34.24.58.54.73.89.15.34.23.74.23 1.18 0 .95-.33 1.7-1 2.24a4 4 0 01-2.6.81 5.71 5.71 0 01-2.94-.68v-1.71c.84.63 1.81.94 2.92.94.58 0 1.05-.14 1.39-.4.34-.28.5-.65.5-1.13 0-.29-.1-.55-.3-.8a2.2 2.2 0 00-.65-.53 23.03 23.03 0 00-1.64-.78 13.67 13.67 0 01-1.11-.64c-.12-.1-.28-.22-.46-.4a1.72 1.72 0 01-.39-.5 4.46 4.46 0 01-.22-.6c-.07-.23-.1-.48-.1-.75 0-.91.33-1.63 1-2.17a4 4 0 012.57-.8c.97 0 1.8.18 2.47.52zm7.47 5.7v-.3a2.26 2.26 0 00-.5-1.44c-.3-.35-.74-.53-1.32-.53-.53 0-.99.2-1.37.58a2.9 2.9 0 00-.72 1.68h3.91zm1 2.79v1.4c-.6.34-1.38.51-2.36.51a4.02 4.02 0 01-3-1.13 4.04 4.04 0 01-1.11-2.97c0-1.3.34-2.32 1.02-3.06a3.38 3.38 0 012.6-1.1c1.03 0 1.85.32 2.46.96.6.64.9 1.57.9 2.78 0 .33-.03.68-.09 1.04h-5.31c.1.7.4 1.24.89 1.61.49.38 1.1.56 1.85.56.86 0 1.58-.2 2.15-.6zm6.61-1.78h-1.21c-.6 0-1.05.12-1.35.36-.3.23-.46.53-.46.89 0 .37.12.66.36.88.23.2.57.32 1.02.32.5 0 .9-.15 1.2-.43.3-.28.44-.65.44-1.1v-.92zm-4.07-2.55V9.33a4.96 4.96 0 012.5-.55c2.1 0 3.17 1.03 3.17 3.08V17H22.1v-.96c-.42.68-1.15 1.02-2.19 1.02-.76 0-1.38-.22-1.84-.66-.46-.44-.7-1-.7-1.68 0-.78.3-1.38.88-1.81.59-.43 1.4-.65 2.46-.65h1.34v-.46c0-.55-.13-.97-.4-1.25-.26-.29-.7-.43-1.32-.43-.86 0-1.65.24-2.35.72zm9.34-1.93v1.42c.39-1 1.1-1.5 2.12-1.5.15 0 .31.02.5.05v1.53c-.23-.1-.48-.14-.76-.14-.54 0-.99.24-1.34.71a2.8 2.8 0 00-.52 1.71V17h-1.57V8.91h1.57zm5 4.09a3 3 0 00.76 2.01c.47.53 1.14.8 2 .8.64 0 1.24-.18 1.8-.53v1.4c-.53.32-1.2.48-2 .48a3.98 3.98 0 01-4.17-4.18c0-1.16.38-2.15 1.14-2.98a4 4 0 013.1-1.23c.7 0 1.34.15 1.92.44v1.44a3.24 3.24 0 00-1.77-.5A2.65 2.65 0 0032.33 13zm7.92-7.28v4.58c.46-1 1.3-1.5 2.5-1.5.8 0 1.42.24 1.9.73.48.5.72 1.17.72 2.05V17H43.8v-5.1c0-.56-.14-.99-.43-1.29-.28-.3-.65-.45-1.1-.45-.54 0-1 .2-1.42.6-.4.4-.61 1.02-.61 1.85V17h-1.56V5.72h1.56zM55.2 15.74c.6 0 1.1-.25 1.5-.76.4-.5.6-1.16.6-1.95 0-.92-.2-1.62-.6-2.12-.4-.5-.92-.74-1.55-.74-.56 0-1.05.22-1.5.67-.44.45-.66 1.13-.66 2.06 0 .96.22 1.67.64 2.14.43.47.95.7 1.57.7zM53 5.72v4.42a2.74 2.74 0 012.43-1.34c1.03 0 1.86.38 2.51 1.15.65.76.97 1.78.97 3.05 0 1.13-.3 2.1-.92 2.9-.62.81-1.47 1.21-2.54 1.21s-1.9-.45-2.46-1.34V17h-1.58V5.72H53zm9.9 11.1l-3.22-7.9h1.74l1 2.62 1.26 3.42c.1-.32.48-1.46 1.15-3.42l.91-2.63h1.66l-2.92 7.87c-.78 2.07-1.96 3.1-3.56 3.1-.28 0-.53-.02-.73-.07v-1.34c.17.04.35.06.54.06 1.03 0 1.76-.57 2.17-1.7z" }), es, ts, Wn("path", { fill: "dark" === n ? "#FFF" : "#5468FF", d: "M120.92 18.8c-4.38.02-4.38-3.54-4.38-4.1V1.36l2.67-.42v13.25c0 .32 0 2.36 1.71 2.37v2.24zm-10.84-2.18c.82 0 1.43-.04 1.85-.12v-2.72a5.48 5.48 0 00-1.57-.2c-.3 0-.6.02-.9.07-.3.04-.57.12-.81.24-.24.11-.44.28-.58.49a.93.93 0 00-.22.65c0 .63.22 1 .61 1.23.4.24.94.36 1.62.36zm-.23-9.7c.88 0 1.62.11 2.23.33.6.22 1.09.53 1.44.92.36.4.61.92.76 1.48.16.56.23 1.17.23 1.85v6.87a21.69 21.69 0 01-4.68.5c-.69 0-1.32-.07-1.9-.2a4 4 0 01-1.46-.63 3.3 3.3 0 01-.96-1.13 4.3 4.3 0 01-.34-1.8 3.13 3.13 0 011.43-2.63c.45-.3.95-.5 1.54-.62a8.8 8.8 0 013.79.05v-.44c0-.3-.04-.6-.11-.87a1.78 1.78 0 00-1.1-1.22 3.2 3.2 0 00-1.15-.2 9.75 9.75 0 00-2.95.46l-.33-2.19a11.43 11.43 0 013.56-.53zm52.84 9.63c.82 0 1.43-.05 1.85-.13V13.7a5.42 5.42 0 00-1.57-.2c-.3 0-.6.02-.9.07-.3.04-.57.12-.81.24-.24.12-.44.28-.58.5a.93.93 0 00-.22.65c0 .63.22.99.61 1.23.4.24.94.36 1.62.36zm-.23-9.7c.88 0 1.63.11 2.23.33.6.22 1.1.53 1.45.92.35.39.6.92.76 1.48.15.56.23 1.18.23 1.85v6.88c-.41.08-1.03.19-1.87.31-.83.12-1.77.18-2.81.18-.7 0-1.33-.06-1.9-.2a4 4 0 01-1.47-.63c-.4-.3-.72-.67-.95-1.13a4.3 4.3 0 01-.34-1.8c0-.66.13-1.08.38-1.53.26-.45.61-.82 1.05-1.1.44-.3.95-.5 1.53-.62a8.8 8.8 0 013.8.05v-.43c0-.31-.04-.6-.12-.88-.07-.28-.2-.52-.38-.73a1.78 1.78 0 00-.73-.5c-.3-.1-.68-.2-1.14-.2a9.85 9.85 0 00-2.95.47l-.32-2.19a11.63 11.63 0 013.55-.53zm-8.03-1.27a1.62 1.62 0 000-3.24 1.62 1.62 0 100 3.24zm1.35 13.22h-2.7V7.27l2.7-.42V18.8zm-4.72 0c-4.38.02-4.38-3.54-4.38-4.1l-.01-13.34 2.67-.42v13.25c0 .32 0 2.36 1.72 2.37v2.24zm-8.7-5.9a4.7 4.7 0 00-.74-2.79 2.4 2.4 0 00-2.07-1 2.4 2.4 0 00-2.06 1 4.7 4.7 0 00-.74 2.8c0 1.16.25 1.94.74 2.62a2.4 2.4 0 002.07 1.02c.88 0 1.57-.34 2.07-1.02a4.2 4.2 0 00.73-2.63zm2.74 0a6.46 6.46 0 01-1.52 4.23c-.49.53-1.07.94-1.76 1.22-.68.29-1.73.45-2.26.45a6.6 6.6 0 01-2.25-.45 5.1 5.1 0 01-2.88-3.13 7.3 7.3 0 01-.01-4.84 5.13 5.13 0 012.9-3.1 5.67 5.67 0 012.22-.42c.81 0 1.56.14 2.24.42.69.29 1.28.69 1.75 1.22.49.52.87 1.15 1.14 1.89a7 7 0 01.43 2.5zm-20.14 0c0 1.11.25 2.36.74 2.88.5.52 1.13.78 1.91.78a4.07 4.07 0 002.12-.6V9.33c-.19-.04-.99-.2-1.76-.23a2.67 2.67 0 00-2.23 1 4.73 4.73 0 00-.78 2.8zm7.44 5.27c0 1.82-.46 3.16-1.4 4-.94.85-2.37 1.27-4.3 1.27-.7 0-2.17-.13-3.34-.4l.43-2.11c.98.2 2.27.26 2.95.26 1.08 0 1.84-.22 2.3-.66.46-.43.68-1.08.68-1.94v-.44a5.2 5.2 0 01-2.54.6 5.6 5.6 0 01-2.01-.36 4.2 4.2 0 01-2.58-2.71 9.88 9.88 0 01.02-5.35 4.92 4.92 0 012.93-2.96 6.6 6.6 0 012.43-.46 19.64 19.64 0 014.43.66v10.6z" })))) } function Xa(e) { var t = e.cssClasses, n = e.templates, r = e.items; return Wn(Si, { templateKey: "default", templates: n, rootProps: { className: t.root }, data: { items: r } }) } var Ga = Ze({ name: "panel" }), Za = St("Panel"), es = Wn("path", { fill: "#5468FF", d: "M78.99.94h16.6a2.97 2.97 0 012.96 2.96v16.6a2.97 2.97 0 01-2.97 2.96h-16.6a2.97 2.97 0 01-2.96-2.96V3.9A2.96 2.96 0 0179 .94" }), ts = Wn("path", { fill: "#FFF", d: "M89.63 5.97v-.78a.98.98 0 00-.98-.97h-2.28a.98.98 0 00-.97.97V6c0 .09.08.15.17.13a7.13 7.13 0 013.9-.02c.08.02.16-.04.16-.13m-6.25 1L83 6.6a.98.98 0 00-1.38 0l-.46.46a.97.97 0 000 1.38l.38.39c.06.06.15.04.2-.02a7.49 7.49 0 011.63-1.62c.07-.04.08-.14.02-.2m4.16 2.45v3.34c0 .1.1.17.2.12l2.97-1.54c.06-.03.08-.12.05-.18a3.7 3.7 0 00-3.08-1.87c-.07 0-.14.06-.14.13m0 8.05a4.49 4.49 0 110-8.98 4.49 4.49 0 010 8.98m0-10.85a6.37 6.37 0 100 12.74 6.37 6.37 0 000-12.74" }), ns = St("PoweredBy"), rs = Ze({ name: "powered-by" }), is = Ze({ name: "query-rule-context" }), as = { default: function (e) { var t = e.items; return JSON.stringify(t, null, 2) } }, ss = Ze({ name: "query-rule-custom-data" }), os = St("QueryRuleCustomData"), cs = function () { L(a, Un); var i = O(a); function a() { var r; C(this, a); for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; return k(M(r = i.call.apply(i, [this].concat(t))), "state", { min: r.props.values.min, max: r.props.values.max }), k(M(r), "onInput", function (n) { return function (e) { var t = e.currentTarget.value; r.setState(k({}, n, Number(t))) } }), k(M(r), "onSubmit", function (e) { e.preventDefault(), r.props.refine([r.state.min, r.state.max]) }), r } return E(a, [{ key: "componentWillReceiveProps", value: function (e) { this.setState({ min: e.values.min, max: e.values.max }) } }, { key: "render", value: function () { var e = this.state, t = e.min, n = e.max, r = this.props, i = r.min, a = r.max, s = r.step, o = r.cssClasses, c = r.templateProps, u = !(!i || !a) && a <= i, l = Boolean(t || n); return Wn("div", { className: Ri(o.root, k({}, o.noRefinement, !l)) }, Wn("form", { className: o.form, onSubmit: this.onSubmit }, Wn("label", { className: o.label }, Wn("input", { className: Ri(o.input, o.inputMin), type: "number", min: i, max: a, step: s, value: null != t ? t : "", onInput: this.onInput("min"), placeholder: null == i ? void 0 : i.toString(), disabled: u })), Wn(Si, f({}, c, { templateKey: "separatorText", rootTagName: "span", rootProps: { className: o.separator } })), Wn("label", { className: o.label }, Wn("input", { className: Ri(o.input, o.inputMax), type: "number", min: i, max: a, step: s, value: null != n ? n : "", onInput: this.onInput("max"), placeholder: null == a ? void 0 : a.toString(), disabled: u })), Wn(Si, f({}, c, { templateKey: "submitText", rootTagName: "button", rootProps: { type: "submit", className: o.submit, disabled: u } })))) } }]), a }(), us = Ze({ name: "range-input" }), ls = St("RangeInput"), ds = { separatorText: "to", submitText: "Go" }, hs = 40, fs = 35, ms = 27, ps = 36, gs = 37, vs = 34, ys = 33, bs = 39, Rs = 38, Ss = 100; function ws(e, t, n) { return (e - t) / (n - t) * 100 } function Ps(e, t, n) { var r = e / 100; return 0 === e ? t : 100 === e ? n : Math.round((n - t) * r + t) } function Ns(e) { return ["rheostat", "vertical" === e.orientation ? "rheostat-vertical" : "rheostat-horizontal"].concat(e.className.split(" ")).join(" ") } function xs(e) { return Number(e.currentTarget.getAttribute("data-handle-key")) } function _s(e) { e.stopPropagation(), e.preventDefault() } var Is = Wn("div", { className: "rheostat-background" }), Fs = function () { L(r, Un); var n = O(r); function r(e) { var t; return C(this, r), k(M(t = n.call(this, e)), "state", { className: Ns(t.props), handlePos: t.props.values.map(function (e) { return ws(e, t.props.min, t.props.max) }), handleDimensions: 0, mousePos: null, sliderBox: {}, slidingIndex: null, values: t.props.values }), k(M(t), "rheostat", {}), t.getPublicState = t.getPublicState.bind(M(t)), t.getSliderBoundingBox = t.getSliderBoundingBox.bind(M(t)), t.getProgressStyle = t.getProgressStyle.bind(M(t)), t.getMinValue = t.getMinValue.bind(M(t)), t.getMaxValue = t.getMaxValue.bind(M(t)), t.getHandleDimensions = t.getHandleDimensions.bind(M(t)), t.getClosestSnapPoint = t.getClosestSnapPoint.bind(M(t)), t.getSnapPosition = t.getSnapPosition.bind(M(t)), t.getNextPositionForKey = t.getNextPositionForKey.bind(M(t)), t.getNextState = t.getNextState.bind(M(t)), t.handleClick = t.handleClick.bind(M(t)), t.getClosestHandle = t.getClosestHandle.bind(M(t)), t.setStartSlide = t.setStartSlide.bind(M(t)), t.startMouseSlide = t.startMouseSlide.bind(M(t)), t.startTouchSlide = t.startTouchSlide.bind(M(t)), t.handleMouseSlide = t.handleMouseSlide.bind(M(t)), t.handleTouchSlide = t.handleTouchSlide.bind(M(t)), t.handleSlide = t.handleSlide.bind(M(t)), t.endSlide = t.endSlide.bind(M(t)), t.handleKeydown = t.handleKeydown.bind(M(t)), t.validatePosition = t.validatePosition.bind(M(t)), t.validateValues = t.validateValues.bind(M(t)), t.canMove = t.canMove.bind(M(t)), t.fireChangeEvent = t.fireChangeEvent.bind(M(t)), t.slideTo = t.slideTo.bind(M(t)), t.updateNewValues = t.updateNewValues.bind(M(t)), t } return E(r, [{ key: "componentWillReceiveProps", value: function (n) { var e = this.props, t = e.className, r = e.disabled, i = e.min, a = e.max, s = e.orientation, o = this.state, c = o.values, u = o.slidingIndex, l = n.min !== i || n.max !== a, d = c.length !== n.values.length || c.some(function (e, t) { return n.values[t] !== e }), h = n.className !== t || n.orientation !== s, f = n.disabled && !r; h && this.setState({ className: Ns(n) }), (l || d) && this.updateNewValues(n), f && null !== u && this.endSlide() } }, { key: "getPublicState", value: function () { var e = this.props, t = e.min; return { max: e.max, min: t, values: this.state.values } } }, { key: "getSliderBoundingBox", value: function () { var e = this.rheostat.current, t = e.getBoundingClientRect(); return { height: t.height || e.clientHeight, left: t.left, top: t.top, width: t.width || e.clientWidth } } }, { key: "getProgressStyle", value: function (e) { var t = this.state.handlePos, n = t[e]; if (0 === e) return "vertical" === this.props.orientation ? { height: "".concat(n, "%"), top: 0 } : { left: 0, width: "".concat(n, "%") }; var r = t[e - 1], i = n - r; return "vertical" === this.props.orientation ? { height: "".concat(i, "%"), top: "".concat(r, "%") } : { left: "".concat(r, "%"), width: "".concat(i, "%") } } }, { key: "getMinValue", value: function (e) { return this.state.values[e - 1] ? Math.max(this.props.min, this.state.values[e - 1]) : this.props.min } }, { key: "getMaxValue", value: function (e) { return this.state.values[e + 1] ? Math.min(this.props.max, this.state.values[e + 1]) : this.props.max } }, { key: "getHandleDimensions", value: function (e, t) { var n = e.currentTarget || null; return n ? "vertical" === this.props.orientation ? n.clientHeight / t.height * Ss / 2 : n.clientWidth / t.width * Ss / 2 : 0 } }, { key: "getClosestSnapPoint", value: function (n) { return this.props.snapPoints.length ? this.props.snapPoints.reduce(function (e, t) { return Math.abs(e - n) < Math.abs(t - n) ? e : t }) : n } }, { key: "getSnapPosition", value: function (e) { if (!this.props.snap) return e; var t = this.props, n = t.max, r = t.min, i = Ps(e, r, n); return ws(this.getClosestSnapPoint(i), r, n) } }, { key: "getNextPositionForKey", value: function (e, t) { var n, r = this.state, i = r.handlePos, a = r.values, s = this.props, o = s.max, c = s.min, u = s.snapPoints, l = this.props.snap, d = a[e], h = i[e], f = h, m = 1; 100 <= o ? h = Math.round(h) : m = 100 / (o - c); var p = null; l && (p = u.indexOf(this.getClosestSnapPoint(a[e]))); var g = (k(n = {}, gs, function (e) { return -1 * e }), k(n, bs, function (e) { return e }), k(n, Rs, function (e) { return e }), k(n, hs, function (e) { return -1 * e }), k(n, vs, function (e) { return 1 < e ? -e : -10 * e }), k(n, ys, function (e) { return 1 < e ? e : 10 * e }), n); if (Object.prototype.hasOwnProperty.call(g, t)) h += g[t](m), l && p && (f < h ? p < u.length - 1 && (d = u[p + 1]) : 0 < p && (d = u[p - 1])); else if (t === ps) h = 0, l && (d = u[0]); else { if (t !== fs) return null; h = Ss, l && (d = u[u.length - 1]) } return l ? ws(d, c, o) : h } }, { key: "getNextState", value: function (n, e) { var t = this.state.handlePos, r = this.props, i = r.max, a = r.min, s = this.validatePosition(n, e), o = t.map(function (e, t) { return t === n ? s : e }); return { handlePos: o, values: o.map(function (e) { return Ps(e, a, i) }) } } }, { key: "getClosestHandle", value: function (r) { var i = this.state.handlePos; return i.reduce(function (e, t, n) { return Math.abs(i[n] - r) < Math.abs(i[e] - r) ? n : e }, 0) } }, { key: "setStartSlide", value: function (e, t, n) { var r = this.getSliderBoundingBox(); this.setState({ handleDimensions: this.getHandleDimensions(e, r), mousePos: { x: t, y: n }, sliderBox: r, slidingIndex: xs(e) }) } }, { key: "startMouseSlide", value: function (e) { this.setStartSlide(e, e.clientX, e.clientY), document.addEventListener("mousemove", this.handleMouseSlide, !1), document.addEventListener("mouseup", this.endSlide, !1), _s(e) } }, { key: "startTouchSlide", value: function (e) { if (!(1 < e.changedTouches.length)) { var t = e.changedTouches[0]; this.setStartSlide(e, t.clientX, t.clientY), document.addEventListener("touchmove", this.handleTouchSlide, !1), document.addEventListener("touchend", this.endSlide, !1), this.props.onSliderDragStart && this.props.onSliderDragStart(), _s(e) } } }, { key: "handleMouseSlide", value: function (e) { null !== this.state.slidingIndex && (this.handleSlide(e.clientX, e.clientY), _s(e)) } }, { key: "handleTouchSlide", value: function (e) { if (null !== this.state.slidingIndex) if (1 < e.changedTouches.length) this.endSlide(); else { var t = e.changedTouches[0]; this.handleSlide(t.clientX, t.clientY), _s(e) } } }, { key: "handleSlide", value: function (e, t) { var n = this.state, r = n.slidingIndex, i = n.sliderBox, a = "vertical" === this.props.orientation ? (t - i.top) / i.height * Ss : (e - i.left) / i.width * Ss; this.slideTo(r, a), this.canMove(r, a) && (this.setState({ mousePos: { x: e, y: t } }), this.props.onSliderDragMove && this.props.onSliderDragMove()) } }, { key: "endSlide", value: function () { var e = this, t = this.state.slidingIndex; if (this.setState({ slidingIndex: null }), document.removeEventListener("mouseup", this.endSlide, !1), document.removeEventListener("touchend", this.endSlide, !1), document.removeEventListener("touchmove", this.handleTouchSlide, !1), document.removeEventListener("mousemove", this.handleMouseSlide, !1), this.props.onSliderDragEnd && this.props.onSliderDragEnd(), this.props.snap) { var n = this.getSnapPosition(this.state.handlePos[t]); this.slideTo(t, n, function () { return e.fireChangeEvent() }) } else this.fireChangeEvent() } }, { key: "handleClick", value: function (e) { var t = this; if (!e.target.getAttribute("data-handle-key")) { var n = this.getSliderBoundingBox(), r = ("vertical" === this.props.orientation ? (e.clientY - n.top) / n.height : (e.clientX - n.left) / n.width) * Ss, i = this.getClosestHandle(r), a = this.getSnapPosition(r); this.slideTo(i, a, function () { return t.fireChangeEvent() }), this.props.onClick && this.props.onClick() } } }, { key: "handleKeydown", value: function (e) { var t = this, n = xs(e); if (e.keyCode !== ms) { var r = this.getNextPositionForKey(n, e.keyCode); null !== r && (this.canMove(n, r) && (this.slideTo(n, r, function () { return t.fireChangeEvent() }), this.props.onKeyPress && this.props.onKeyPress()), _s(e)) } else e.currentTarget.blur() } }, { key: "validatePosition", value: function (e, t) { var n = this.state, r = n.handlePos, i = n.handleDimensions; return Math.max(Math.min(t, void 0 !== r[e + 1] ? r[e + 1] - i : Ss), void 0 !== r[e - 1] ? r[e - 1] + i : 0) } }, { key: "validateValues", value: function (e, t) { var n = t || this.props, i = n.max, a = n.min; return e.map(function (e, t, n) { var r = Math.max(Math.min(e, i), a); return n.length && r < n[t - 1] ? n[t - 1] : r }) } }, { key: "canMove", value: function (e, t) { var n = this.state, r = n.handlePos, i = n.handleDimensions; return !(t < 0) && (!(Ss < t) && (!((void 0 !== r[e + 1] ? r[e + 1] - i : 1 / 0) < t) && !(t < (void 0 !== r[e - 1] ? r[e - 1] + i : -1 / 0)))) } }, { key: "fireChangeEvent", value: function () { var e = this.props.onChange; e && e(this.getPublicState()) } }, { key: "slideTo", value: function (e, t, n) { var r = this, i = this.getNextState(e, t); this.setState(i, function () { var e = r.props.onValuesUpdated; e && e(r.getPublicState()), n && n() }) } }, { key: "updateNewValues", value: function (e) { var t = this; if (null === this.state.slidingIndex) { var n = e.max, r = e.min, i = e.values, a = this.validateValues(i, e); this.setState({ handlePos: a.map(function (e) { return ws(e, r, n) }), values: a }, function () { return t.fireChangeEvent() }) } } }, { key: "render", value: function () { var r = this, e = this.props, t = e.children, i = e.disabled, a = e.handle, s = e.max, o = e.min, c = e.orientation, u = e.pitComponent, n = e.pitPoints, l = e.progressBar, d = this.state, h = d.className, f = d.handlePos, m = d.values; return Wn("div", { className: h, ref: this.rheostat, onClick: i ? void 0 : this.handleClick, style: { position: "relative" } }, Is, f.map(function (e, t) { var n = "vertical" === c ? { top: "".concat(e, "%"), position: "absolute" } : { left: "".concat(e, "%"), position: "absolute" }; return Wn(a, { "aria-valuemax": r.getMaxValue(t), "aria-valuemin": r.getMinValue(t), "aria-valuenow": m[t], "aria-disabled": i, "data-handle-key": t, className: "rheostat-handle", key: "handle-".concat(t), onClick: _s, onKeyDown: i ? void 0 : r.handleKeydown, onMouseDown: i ? void 0 : r.startMouseSlide, onTouchStart: i ? void 0 : r.startTouchSlide, role: "slider", style: n, tabIndex: 0 }) }), f.map(function (e, t, n) { return 0 === t && 1 < n.length ? null : Wn(l, { className: "rheostat-progress", key: "progress-bar-".concat(t), style: r.getProgressStyle(t) }) }), u && n.map(function (e) { var t = ws(e, o, s), n = "vertical" === c ? { top: "".concat(t, "%"), position: "absolute" } : { left: "".concat(t, "%"), position: "absolute" }; return Wn(u, { key: "pit-".concat(e), style: n }, e) }), t) } }]), r }(); k(Fs, "defaultProps", { className: "", children: null, disabled: !1, handle: function (e) { return Wn("button", f({}, e, { type: "button" })) }, max: Ss, min: 0, onClick: null, onChange: null, onKeyPress: null, onSliderDragEnd: null, onSliderDragMove: null, onSliderDragStart: null, onValuesUpdated: null, orientation: "horizontal", pitComponent: null, pitPoints: [], progressBar: "div", snap: !1, snapPoints: [], values: [0] }); function Ts(e) { var t = e.style, n = e.children, r = Math.round(parseFloat(t.left)), i = [0, 50, 100].includes(r), a = n, s = Math.round(100 * parseInt(a, 10)) / 100; return Wn("div", { style: W(W({}, t), {}, { marginLeft: 100 === r ? "-2px" : 0 }), className: Ri("rheostat-marker", "rheostat-marker-horizontal", { "rheostat-marker-large": i }) }, i && Wn("div", { className: "rheostat-value" }, s)) } function Cs(e) { var t = e.cssClasses, n = e.templates, r = e.isRelevantSorted, i = e.isVirtualReplica, a = e.refine; return i ? Wn("div", { className: t.root }, Wn(Si, { templateKey: "text", templates: n, rootProps: { className: t.text }, data: { isRelevantSorted: r } }), Wn("button", { type: "button", className: t.button, onClick: function () { a(r ? 0 : void 0) } }, Wn(Si, { rootTagName: "span", templateKey: "button", templates: n, data: { isRelevantSorted: r } }))) : null } function Es(e) { var t = e.nbHits, n = e.nbSortedHits, r = e.cssClasses, i = e.templateProps, a = j(e, ["nbHits", "nbSortedHits", "cssClasses", "templateProps"]); return Wn("div", { className: Ri(r.root) }, Wn(Si, f({}, i, { templateKey: "text", rootTagName: "span", rootProps: { className: r.text }, data: W({ hasManySortedResults: n && 1 < n, hasNoSortedResults: 0 === n, hasOneSortedResults: 1 === n, hasManyResults: 1 < t, hasNoResults: 0 === t, hasOneResult: 1 === t, nbHits: t, nbSortedHits: n, cssClasses: r }, a) }))) } function ks(e) { var t = e.currentRefinement, n = e.refine, r = e.cssClasses, i = e.templateProps; return Wn("div", { className: r.root }, Wn("label", { className: r.label }, Wn("input", { className: r.checkbox, type: "checkbox", checked: t.isRefined, onChange: function (e) { return n({ isRefined: !e.target.checked }) } }), Wn(Si, f({}, i, { rootTagName: "span", rootProps: { className: r.labelText }, templateKey: "labelText", data: t })))) } function Ls(e) { var t = e.cssClasses, n = e.isBrowserSupported, r = e.isListening, i = e.toggleListening, a = e.voiceListeningState, s = e.templates, o = a.status, c = a.transcript, u = a.isSpeechFinal, l = a.errorCode; return Wn("div", { className: t.root }, Wn(Si, { templateKey: "buttonText", rootTagName: "button", rootProps: { className: t.button, type: "button", title: "Search by voice".concat(n ? "" : " (not supported on this browser)"), onClick: function (e) { e.currentTarget instanceof HTMLElement && e.currentTarget.blur(), i() }, disabled: !n }, data: { status: o, errorCode: l, isListening: r, transcript: c, isSpeechFinal: u, isBrowserSupported: n }, templates: s }), Wn(Si, { templateKey: "status", rootProps: { className: t.status }, data: { status: o, errorCode: l, isListening: r, transcript: c, isSpeechFinal: u, isBrowserSupported: n }, templates: s })) } var js = function () { L(a, Un); var i = O(a); function a() { var n; C(this, a); for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)t[r] = arguments[r]; return k(M(n = i.call.apply(i, [this].concat(t))), "handleChange", function (e) { var t = e.values; n.isDisabled || n.props.refine(t) }), k(M(n), "createHandleComponent", function (r) { return function (e) { var t = Math.round(100 * parseFloat(e["aria-valuenow"])) / 100, n = "object" === h(r) && r.format ? r.format(t) : t; return Wn("div", f({}, e, { className: Ri(e.className, { "rheostat-handle-lower": 0 === e["data-handle-key"], "rheostat-handle-upper": 1 === e["data-handle-key"] }) }), r && Wn("div", { className: "rheostat-tooltip" }, n)) } }), n } return E(a, [{ key: "isDisabled", get: function () { return this.props.min >= this.props.max } }, { key: "computeDefaultPitPoints", value: function (e) { var t = e.min, n = e.max, r = (n - t) / 34; return [t].concat(N(Ee({ end: 33 }).map(function (e) { return t + r * (e + 1) })), [n]) } }, { key: "computeSnapPoints", value: function (e) { var t = e.min, n = e.max, r = e.step; if (r) return [].concat(N(Ee({ start: t, end: n, step: r })), [n]) } }, { key: "render", value: function () { var e = this.props, t = e.tooltips, n = e.step, r = e.pips, i = e.values, a = e.cssClasses, s = this.isDisabled ? { min: this.props.min, max: this.props.max + .001 } : this.props, o = s.min, c = s.max, u = this.computeSnapPoints({ min: o, max: c, step: n }), l = !1 === r ? [] : this.computeDefaultPitPoints({ min: o, max: c }); return Wn("div", { className: Ri(a.root, k({}, a.disabledRoot, this.isDisabled)) }, Wn(Fs, { handle: this.createHandleComponent(t), onChange: this.handleChange, min: o, max: c, pitComponent: Ts, pitPoints: l, snap: !0, snapPoints: u, values: this.isDisabled ? [o, c] : i, disabled: this.isDisabled })) } }]), a }(), Ms = Ze({ name: "range-slider" }), Os = St("RangeSlider"), As = { item: '{{#count}}<a class="{{cssClasses.link}}" aria-label="{{value}} & up" href="{{url}}">{{/count}}{{^count}}<div class="{{cssClasses.link}}" aria-label="{{value}} & up" disabled>{{/count}}\n  {{#stars}}<svg class="{{cssClasses.starIcon}} {{#.}}{{cssClasses.fullStarIcon}}{{/.}}{{^.}}{{cssClasses.emptyStarIcon}}{{/.}}" aria-hidden="true" width="24" height="24">\n    {{#.}}<use xlink:href="#ais-RatingMenu-starSymbol"></use>{{/.}}{{^.}}<use xlink:href="#ais-RatingMenu-starEmptySymbol"></use>{{/.}}\n  </svg>{{/stars}}\n  <span class="{{cssClasses.label}}">& Up</span>\n  {{#count}}<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>{{/count}}\n{{#count}}</a>{{/count}}{{^count}}</div>{{/count}}' }, Hs = Ze({ name: "rating-menu" }), Ws = St("RatingMenu"), Ds = Wn("path", { d: "M12 .288l2.833 8.718h9.167l-7.417 5.389 2.833 8.718-7.416-5.388-7.417 5.388 2.833-8.718-7.416-5.389h9.167z" }), Bs = Wn("path", { d: "M12 6.76l1.379 4.246h4.465l-3.612 2.625 1.379 4.246-3.611-2.625-3.612 2.625 1.379-4.246-3.612-2.625h4.465l1.38-4.246zm0-6.472l-2.833 8.718h-9.167l7.416 5.389-2.833 8.718 7.417-5.388 7.416 5.388-2.833-8.718 7.417-5.389h-9.167l-2.833-8.718z" }), Us = { reset: '\n<svg class="{{cssClasses.resetIcon}}" viewBox="0 0 20 20" width="10" height="10">\n  <path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"></path>\n</svg>\n  ', submit: '\n<svg class="{{cssClasses.submitIcon}}" width="10" height="10" viewBox="0 0 40 40">\n  <path d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"></path>\n</svg>\n  ', loadingIndicator: '\n<svg class="{{cssClasses.loadingIcon}}" width="16" height="16" viewBox="0 0 38 38" stroke="#444">\n  <g fill="none" fillRule="evenodd">\n    <g transform="translate(1 1)" strokeWidth="2">\n      <circle strokeOpacity=".5" cx="18" cy="18" r="18" />\n      <path d="M36 18c0-9.94-8.06-18-18-18">\n        <animateTransform\n          attributeName="transform"\n          type="rotate"\n          from="0 18 18"\n          to="360 18 18"\n          dur="1s"\n          repeatCount="indefinite"\n        />\n      </path>\n    </g>\n  </g>\n</svg>\n  ' }, qs = { item: '<label class="{{cssClasses.label}}">\n  <input type="checkbox"\n         class="{{cssClasses.checkbox}}"\n         value="{{value}}"\n         {{#isRefined}}checked{{/isRefined}} />\n  <span class="{{cssClasses.labelText}}">{{#isFromSearch}}{{{highlighted}}}{{/isFromSearch}}{{^isFromSearch}}{{highlighted}}{{/isFromSearch}}</span>\n  <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>', showMoreText: "\n    {{#isShowingMore}}\n      Show less\n    {{/isShowingMore}}\n    {{^isShowingMore}}\n      Show more\n    {{/isShowingMore}}\n    ", searchableNoResults: "No results" }, Qs = Ze({ name: "refinement-list" }), $s = St("RefinementList"), Vs = St("SearchBox"), Ks = { text: "", button: function (e) { return e.isRelevantSorted ? "See all results" : "See relevant results" } }, zs = Ze({ name: "relevant-sort" }), Js = St("RelevantSort"), Ys = Ze({ name: "search-box" }), Xs = St("SearchBox"), Gs = Ze({ name: "sort-by" }), Zs = St("SortBy"), eo = Ze({ name: "stats" }), to = St("Stats"), no = { text: "\n    {{#areHitsSorted}}\n      {{#hasNoSortedResults}}No relevant results{{/hasNoSortedResults}}\n      {{#hasOneSortedResults}}1 relevant result{{/hasOneSortedResults}}\n      {{#hasManySortedResults}}{{#helpers.formatNumber}}{{nbSortedHits}}{{/helpers.formatNumber}} relevant results{{/hasManySortedResults}}\n      sorted out of {{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}}\n    {{/areHitsSorted}}\n    {{^areHitsSorted}}\n      {{#hasNoResults}}No results{{/hasNoResults}}\n      {{#hasOneResult}}1 result{{/hasOneResult}}\n      {{#hasManyResults}}{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} results{{/hasManyResults}}\n    {{/areHitsSorted}}\n    found in {{processingTimeMS}}ms" }, ro = { labelText: "{{name}}" }, io = Ze({ name: "toggle-refinement" }), ao = St("ToggleRefinement"), so = { buttonText: function (e) { var t = e.status, n = e.errorCode, r = e.isListening; return '<svg\n       width="16"\n       height="16"\n       viewBox="0 0 24 24"\n       fill="none"\n       stroke="currentColor"\n       stroke-width="2"\n       stroke-linecap="round"\n       stroke-linejoin="round"\n     >\n       '.concat(function (e, t, n) { return "error" === e && "not-allowed" === t ? '<line x1="1" y1="1" x2="23" y2="23"></line>\n            <path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"></path>\n            <path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"></path>\n            <line x1="12" y1="19" x2="12" y2="23"></line>\n            <line x1="8" y1="23" x2="16" y2="23"></line>' : '<path\n            d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"\n            fill="'.concat(n ? "currentColor" : "none", '">\n          </path>\n          <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>\n          <line x1="12" y1="19" x2="12" y2="23"></line>\n          <line x1="8" y1="23" x2="16" y2="23"></line>') }(t, n, r), "\n     </svg>") }, status: "<p>{{transcript}}</p>" }, oo = Ze({ name: "voice-search" }), co = St("VoiceSearch"), uo = Ie(Bi), lo = Object.freeze({ __proto__: null, dynamicWidgets: Bi, EXPERIMENTAL_dynamicWidgets: uo, analytics: function (e) { var t = e || {}, s = t.pushFunction, n = t.delay, r = void 0 === n ? 3e3 : n, i = t.triggerOnUIInteraction, a = void 0 !== i && i, o = t.pushInitialSearch, c = void 0 === o || o, u = t.pushPagination, l = void 0 !== u && u; if (!s) throw new Error(bi("The `pushFunction` option is required.")); function d(e) { if (null !== e) { var t = [], n = function (e) { var t = []; for (var n in e) if (e.hasOwnProperty(n)) { var r = e[n].join("+"); t.push("".concat(encodeURIComponent(n), "=").concat(encodeURIComponent(n), "_").concat(encodeURIComponent(r))) } return t.join("&") }(W(W(W({}, e.state.disjunctiveFacetsRefinements), e.state.facetsRefinements), e.state.hierarchicalFacetsRefinements)), r = function (e) { var t = []; for (var n in e) if (e.hasOwnProperty(n)) { var r = e[n]; if (r.hasOwnProperty(">=") && r.hasOwnProperty("<=")) r[">="] && r[">="][0] === r["<="] && r["<="][0] ? t.push("".concat(n, "=").concat(n, "_").concat(r[">="])) : t.push("".concat(n, "=").concat(n, "_").concat(r[">="], "to").concat(r["<="])); else if (r.hasOwnProperty(">=")) t.push("".concat(n, "=").concat(n, "_from").concat(r[">="])); else if (r.hasOwnProperty("<=")) t.push("".concat(n, "=").concat(n, "_to").concat(r["<="])); else if (r.hasOwnProperty("=")) { var i = []; for (var a in r["="]) r["="].hasOwnProperty(a) && i.push(r["="][a]); t.push("".concat(n, "=").concat(n, "_").concat(i.join("-"))) } } return t.join("&") }(e.state.numericRefinements); "" !== n && t.push(n), "" !== r && t.push(r); var i = t.join("&"), a = "Query: ".concat(e.state.query || "", ", ").concat(i); !0 === l && (a += ", Page: ".concat(e.state.page || 0)), m !== a && (s(i, e.state, e.results), m = a) } } var h, f = null, m = "", p = !0; !0 === c && (p = !1); function g() { d(f) } function v() { d(f) } return { $$type: "ais.analytics", $$widgetType: "ais.analytics", init: function () { !0 === a && (document.addEventListener("click", g), window.addEventListener("beforeunload", v)) }, render: function (e) { var t = e.results, n = e.state; !0 !== p ? (f = { results: t, state: n }, h && clearTimeout(h), h = window.setTimeout(function () { return d(f) }, r)) : p = !1 }, dispose: function () { !0 === a && (document.removeEventListener("click", g), window.removeEventListener("beforeunload", v)) }, getRenderState: function (e, t) { return W(W({}, e), {}, { analytics: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function () { return { widgetParams: e } } } }, breadcrumb: function (e) { var t = e || {}, n = t.container, r = t.attributes, i = t.separator, a = t.rootPath, s = t.transformItems, o = t.templates, c = void 0 === o ? {} : o, u = t.cssClasses, l = void 0 === u ? {} : u; if (!n) throw new Error(Fi("The `container` option is required.")); var d = le(n), h = { root: Ri(Ti(), l.root), noRefinementRoot: Ri(Ti({ modifierName: "noRefinement" }), l.noRefinementRoot), list: Ri(Ti({ descendantName: "list" }), l.list), item: Ri(Ti({ descendantName: "item" }), l.item), selectedItem: Ri(Ti({ descendantName: "item", modifierName: "selected" }), l.selectedItem), separator: Ri(Ti({ descendantName: "separator" }), l.separator), link: Ri(Ti({ descendantName: "link" }), l.link) }, f = function (e) { var o = e.containerNode, c = e.cssClasses, u = e.renderState, l = e.templates; return function (e, t) { var n = e.canRefine, r = e.createURL, i = e.instantSearchInstance, a = e.items, s = e.refine; t ? u.templateProps = fe({ defaultTemplates: Ii, templatesConfig: i.templatesConfig, templates: l }) : rr(Wn(wi, { canRefine: n, cssClasses: c, createURL: r, items: a, refine: s, templateProps: u.templateProps }), o) } }({ containerNode: d, cssClasses: h, renderState: {}, templates: c }); return W(W({}, Mr(f, function () { return rr(null, d) })({ attributes: r, separator: i, rootPath: a, transformItems: s })), {}, { $$widgetType: "ais.breadcrumb" }) }, clearRefinements: function (e) { var t = e || {}, n = t.container, r = t.templates, i = void 0 === r ? {} : r, a = t.includedAttributes, s = t.excludedAttributes, o = t.transformItems, c = t.cssClasses, u = void 0 === c ? {} : c; if (!n) throw new Error(Ei("The `container` option is required.")); var l = le(n), d = { root: Ri(ki(), u.root), button: Ri(ki({ descendantName: "button" }), u.button), disabledButton: Ri(ki({ descendantName: "button", modifierName: "disabled" }), u.disabledButton) }, h = function (e) { var a = e.containerNode, s = e.cssClasses, o = e.renderState, c = e.templates; return function (e, t) { var n = e.refine, r = e.hasRefinements, i = e.instantSearchInstance; t ? o.templateProps = fe({ defaultTemplates: Ci, templatesConfig: i.templatesConfig, templates: c }) : rr(Wn(Pi, { refine: n, cssClasses: s, hasRefinements: r, templateProps: o.templateProps }), a) } }({ containerNode: l, cssClasses: d, renderState: {}, templates: i }); return W(W({}, fn(h, function () { return rr(null, l) })({ includedAttributes: a, excludedAttributes: s, transformItems: o })), {}, { $$widgetType: "ais.clearRefinements" }) }, configure: function (e) { return W(W({}, ti(_e)({ searchParameters: e })), {}, { $$widgetType: "ais.configure" }) }, currentRefinements: function (e) { var t = e || {}, n = t.container, r = t.includedAttributes, i = t.excludedAttributes, a = t.cssClasses, s = void 0 === a ? {} : a, o = t.transformItems; if (!n) throw new Error(Li("The `container` option is required.")); var c = le(n), u = { root: Ri(ji(), s.root), list: Ri(ji({ descendantName: "list" }), s.list), item: Ri(ji({ descendantName: "item" }), s.item), label: Ri(ji({ descendantName: "label" }), s.label), category: Ri(ji({ descendantName: "category" }), s.category), categoryLabel: Ri(ji({ descendantName: "categoryLabel" }), s.categoryLabel), delete: Ri(ji({ descendantName: "delete" }), s.delete) }; return W(W({}, gn(xi, function () { return rr(null, c) })({ container: c, cssClasses: u, includedAttributes: r, excludedAttributes: i, transformItems: o })), {}, { $$widgetType: "ais.currentRefinements" }) }, EXPERIMENTAL_answers: function (e) { var t = e || {}, n = t.container, r = t.attributesForPrediction, i = t.queryLanguages, a = t.nbHits, s = t.searchDebounceTime, o = t.renderDebounceTime, c = t.escapeHTML, u = t.extraParameters, l = t.templates, d = void 0 === l ? {} : l, h = t.cssClasses, f = void 0 === h ? {} : h; if (!n) throw new Error(Oi("The `container` option is required.")); var m = le(n), p = { root: Ri(Ai(), f.root), emptyRoot: Ri(Ai({ modifierName: "empty" }), f.emptyRoot), header: Ri(Ai({ descendantName: "header" }), f.header), loader: Ri(Ai({ descendantName: "loader" }), f.loader), list: Ri(Ai({ descendantName: "list" }), f.list), item: Ri(Ai({ descendantName: "item" }), f.item) }, g = function (e) { var a = e.containerNode, s = e.cssClasses, o = e.renderState, c = e.templates; return function (e, t) { var n = e.hits, r = e.isLoading, i = e.instantSearchInstance; t ? o.templateProps = fe({ defaultTemplates: Mi, templatesConfig: i.templatesConfig, templates: c }) : rr(Wn(_i, { cssClasses: s, hits: n, isLoading: r, templateProps: o.templateProps }), a) } }({ containerNode: m, cssClasses: p, templates: d, renderState: {} }); return W(W({}, hi(g, function () { return rr(null, m) })({ attributesForPrediction: r, queryLanguages: i, nbHits: a, searchDebounceTime: s, renderDebounceTime: o, escapeHTML: c, extraParameters: u })), {}, { $$widgetType: "ais.answers" }) }, EXPERIMENTAL_configureRelatedItems: function (e) { return W(W({}, ii(_e)(e)), {}, { $$widgetType: "ais.configureRelatedItems" }) }, geoSearch: function (e) { var t = e || {}, n = t.initialZoom, r = void 0 === n ? 1 : n, i = t.initialPosition, a = void 0 === i ? { lat: 0, lng: 0 } : i, s = t.templates, o = void 0 === s ? {} : s, c = t.cssClasses, u = void 0 === c ? {} : c, l = t.builtInMarker, d = void 0 === l ? {} : l, h = t.customHTMLMarker, f = t.enableRefine, m = void 0 === f || f, p = t.enableClearMapRefinement, g = void 0 === p || p, v = t.enableRefineControl, y = void 0 === v || v, b = t.container, R = t.googleReference, S = j(t, ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"]); if (!b) throw new Error(Ji("The `container` option is required.")); if (!R) throw new Error(Ji("The `googleReference` option is required.")); var w = le(b), P = { root: Ri(Yi(), u.root), tree: Yi({ descendantName: "tree" }), map: Ri(Yi({ descendantName: "map" }), u.map), control: Ri(Yi({ descendantName: "control" }), u.control), label: Ri(Yi({ descendantName: "label" }), u.label), selectedLabel: Ri(Yi({ descendantName: "label", modifierName: "selected" }), u.selectedLabel), input: Ri(Yi({ descendantName: "input" }), u.input), redo: Ri(Yi({ descendantName: "redo" }), u.redo), disabledRedo: Ri(Yi({ descendantName: "redo", modifierName: "disabled" }), u.disabledRedo), reset: Ri(Yi({ descendantName: "reset" }), u.reset) }, N = W(W({}, zi), o), x = W(W({}, { createOptions: function () { return {} }, events: {} }), d), _ = (Boolean(h) || Boolean(o.HTMLMarker)) && W(W({}, { createOptions: function () { return {} }, events: {} }), h), I = function (d) { return function () { L(l, d.maps.OverlayView); var u = O(l); function l(e) { var t, n = e.__id, r = e.position, i = e.map, a = e.template, s = e.className, o = e.anchor, c = void 0 === o ? { x: 0, y: 0 } : o; return C(this, l), k(M(t = u.call(this)), "__id", void 0), k(M(t), "anchor", void 0), k(M(t), "offset", void 0), k(M(t), "listeners", void 0), k(M(t), "latLng", void 0), k(M(t), "element", void 0), t.__id = n, t.anchor = c, t.listeners = {}, t.latLng = new d.maps.LatLng(r), t.element = document.createElement("div"), t.element.className = s, t.element.style.position = "absolute", t.element.innerHTML = a, t.setMap(i), t } return E(l, [{ key: "onAdd", value: function () { this.getPanes().overlayMouseTarget.appendChild(this.element); var e = this.element.getBoundingClientRect(); this.offset = { x: this.anchor.x + e.width / 2, y: this.anchor.y + e.height }, this.element.style.width = "".concat(e.width, "px") } }, { key: "draw", value: function () { var e = this.getProjection().fromLatLngToDivPixel(this.latLng); this.element.style.left = "".concat(Math.round(e.x - this.offset.x), "px"), this.element.style.top = "".concat(Math.round(e.y - this.offset.y), "px"), this.element.style.zIndex = String(parseInt(this.element.style.top, 10)) } }, { key: "onRemove", value: function () { var t = this; this.element && (this.element.parentNode.removeChild(this.element), Object.keys(this.listeners).forEach(function (e) { t.element.removeEventListener(e, t.listeners[e]) }), delete this.element, delete this.listeners) } }, { key: "addListener", value: function (e, t) { this.listeners[e] = t; var n = this.element; return n.addEventListener(e, t), { remove: function () { return n.removeEventListener(e, t) } } } }, { key: "getPosition", value: function () { return this.latLng } }]), l }() }(R), F = _ ? function (e) { var t = e.item, n = j(e, ["item"]); return new I(W(W(W({}, _.createOptions(t)), n), {}, { __id: t.objectID, position: t._geoloc, className: Ri(Yi({ descendantName: "marker" })), template: ye({ templateKey: "HTMLMarker", templates: N, data: t }) })) } : function (e) { var t = e.item, n = j(e, ["item"]); return new R.maps.Marker(W(W(W({}, x.createOptions(t)), n), {}, { __id: t.objectID, position: t._geoloc })) }, T = _ || x; return W(W({}, Jr(Ki, function () { return rr(null, w) })(W(W({}, S), {}, { renderState: {}, container: w, googleReference: R, initialZoom: r, initialPosition: a, templates: N, cssClasses: P, createMarker: F, markerOptions: T, enableRefine: m, enableClearMapRefinement: g, enableRefineControl: y }))), {}, { $$widgetType: "ais.geoSearch" }) }, hierarchicalMenu: function (e) { var t = e || {}, n = t.container, r = t.attributes, i = t.separator, a = t.rootPath, s = t.showParentLevel, o = t.limit, c = t.showMore, u = void 0 !== c && c, l = t.showMoreLimit, d = t.sortBy, h = t.transformItems, f = t.templates, m = void 0 === f ? {} : f, p = t.cssClasses, g = void 0 === p ? {} : p; if (!n) throw new Error(ia("The `container` option is required.")); var v = le(n), y = function (e) { var u = e.cssClasses, l = e.containerNode, d = e.showMore, h = e.templates, f = e.renderState; return function (e, t) { var n = e.createURL, r = e.items, i = e.refine, a = e.instantSearchInstance, s = e.isShowingMore, o = e.toggleShowMore, c = e.canToggleShowMore; t ? f.templateProps = fe({ defaultTemplates: ra, templatesConfig: a.templatesConfig, templates: h }) : rr(Wn(ta, { createURL: n, cssClasses: u, facetValues: r, templateProps: f.templateProps, toggleRefinement: i, showMore: d, toggleShowMore: o, isShowingMore: s, canToggleShowMore: c }), l) } }({ cssClasses: { root: Ri(aa(), g.root), noRefinementRoot: Ri(aa({ modifierName: "noRefinement" }), g.noRefinementRoot), list: Ri(aa({ descendantName: "list" }), g.list), childList: Ri(aa({ descendantName: "list", modifierName: "child" }), g.childList), item: Ri(aa({ descendantName: "item" }), g.item), selectedItem: Ri(aa({ descendantName: "item", modifierName: "selected" }), g.selectedItem), parentItem: Ri(aa({ descendantName: "item", modifierName: "parent" }), g.parentItem), link: Ri(aa({ descendantName: "link" }), g.link), label: Ri(aa({ descendantName: "label" }), g.label), count: Ri(aa({ descendantName: "count" }), g.count), showMore: Ri(aa({ descendantName: "showMore" }), g.showMore), disabledShowMore: Ri(aa({ descendantName: "showMore", modifierName: "disabled" }), g.disabledShowMore) }, containerNode: v, templates: m, showMore: u, renderState: {} }); return W(W({}, wn(y, function () { return rr(null, v) })({ attributes: r, separator: i, rootPath: a, showParentLevel: s, limit: o, showMore: u, showMoreLimit: l, sortBy: d, transformItems: h })), {}, { $$widgetType: "ais.hierarchicalMenu" }) }, hits: function (e) { var t = e || {}, n = t.container, r = t.escapeHTML, i = t.transformItems, a = t.templates, s = void 0 === a ? {} : a, o = t.cssClasses, c = void 0 === o ? {} : o; if (!n) throw new Error(oa("The `container` option is required.")); var u = le(n), l = { root: Ri(ca(), c.root), emptyRoot: Ri(ca({ modifierName: "empty" }), c.emptyRoot), list: Ri(ca({ descendantName: "list" }), c.list), item: Ri(ca({ descendantName: "item" }), c.item) }, d = function (e) { var o = e.renderState, c = e.cssClasses, u = e.containerNode, l = e.templates; return function (e, t) { var n = e.hits, r = e.results, i = e.instantSearchInstance, a = e.insights, s = e.bindEvent; t ? o.templateProps = fe({ defaultTemplates: sa, templatesConfig: i.templatesConfig, templates: l }) : rr(Wn(ua, { cssClasses: c, hits: n, results: r, templateProps: o.templateProps, insights: a, sendEvent: function (e) { i.sendEventToInsights(e) }, bindEvent: s }), u) } }({ containerNode: u, cssClasses: l, renderState: {}, templates: s }); return W(W({}, Fn(Pn)(d, function () { return rr(null, u) })({ escapeHTML: r, transformItems: i })), {}, { $$widgetType: "ais.hits" }) }, hitsPerPage: function (e) { var t = e || {}, n = t.container, r = t.items, i = t.cssClasses, a = void 0 === i ? {} : i, s = t.transformItems; if (!n) throw new Error(da("The `container` option is required.")); var o = le(n), c = { root: Ri(ha(), a.root), select: Ri(ha({ descendantName: "select" }), a.select), option: Ri(ha({ descendantName: "option" }), a.option) }, u = function (e) { var a = e.containerNode, s = e.cssClasses; return function (e, t) { var n = e.items, r = e.refine; if (!t) { var i = (be(n, function (e) { return e.isRefined }) || {}).value; rr(Wn("div", { className: s.root }, Wn(la, { cssClasses: s, currentValue: i, options: n, setValue: r })), a) } } }({ containerNode: o, cssClasses: c }); return W(W({}, sr(u, function () { return rr(null, o) })({ items: r, transformItems: s })), {}, { $$widgetType: "ais.hitsPerPage" }) }, index: bt, infiniteHits: function (e) { var t = e || {}, n = t.container, r = t.escapeHTML, i = t.transformItems, a = t.templates, s = void 0 === a ? {} : a, o = t.cssClasses, c = void 0 === o ? {} : o, u = t.showPrevious, l = t.cache; if (!n) throw new Error(ma("The `container` option is required.")); var d = le(n), h = { root: Ri(pa(), c.root), emptyRoot: Ri(pa({ modifierName: "empty" }), c.emptyRoot), item: Ri(pa({ descendantName: "item" }), c.item), list: Ri(pa({ descendantName: "list" }), c.list), loadPrevious: Ri(pa({ descendantName: "loadPrevious" }), c.loadPrevious), disabledLoadPrevious: Ri(pa({ descendantName: "loadPrevious", modifierName: "disabled" }), c.disabledLoadPrevious), loadMore: Ri(pa({ descendantName: "loadMore" }), c.loadMore), disabledLoadMore: Ri(pa({ descendantName: "loadMore", modifierName: "disabled" }), c.disabledLoadMore) }, f = function (e) { var d = e.containerNode, h = e.cssClasses, f = e.renderState, m = e.templates, p = e.showPrevious; return function (e, t) { var n = e.hits, r = e.results, i = e.showMore, a = e.showPrevious, s = e.isFirstPage, o = e.isLastPage, c = e.instantSearchInstance, u = e.insights, l = e.bindEvent; t ? f.templateProps = fe({ defaultTemplates: fa, templatesConfig: c.templatesConfig, templates: m }) : rr(Wn(ga, { cssClasses: h, hits: n, results: r, hasShowPrevious: p, showPrevious: a, showMore: i, templateProps: f.templateProps, isFirstPage: s, isLastPage: o, insights: u, sendEvent: function (e) { c.sendEventToInsights(e) }, bindEvent: l }), d) } }({ containerNode: d, cssClasses: h, templates: s, showPrevious: u, renderState: {} }); return W(W({}, Fn(dr)(f, function () { return rr(null, d) })({ escapeHTML: r, transformItems: i, showPrevious: u, cache: l })), {}, { $$widgetType: "ais.infiniteHits" }) }, menu: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.sortBy, a = t.limit, s = t.showMore, o = t.showMoreLimit, c = t.cssClasses, u = void 0 === c ? {} : c, l = t.templates, d = void 0 === l ? {} : l, h = t.transformItems; if (!n) throw new Error(ya("The `container` option is required.")); var f = le(n), m = { root: Ri(ba(), u.root), noRefinementRoot: Ri(ba({ modifierName: "noRefinement" }), u.noRefinementRoot), list: Ri(ba({ descendantName: "list" }), u.list), item: Ri(ba({ descendantName: "item" }), u.item), selectedItem: Ri(ba({ descendantName: "item", modifierName: "selected" }), u.selectedItem), link: Ri(ba({ descendantName: "link" }), u.link), label: Ri(ba({ descendantName: "label" }), u.label), count: Ri(ba({ descendantName: "count" }), u.count), showMore: Ri(ba({ descendantName: "showMore" }), u.showMore), disabledShowMore: Ri(ba({ descendantName: "showMore", modifierName: "disabled" }), u.disabledShowMore) }, p = function (e) { var l = e.containerNode, d = e.cssClasses, h = e.renderState, f = e.templates, m = e.showMore; return function (e, t) { var n = e.refine, r = e.items, i = e.createURL, a = e.instantSearchInstance, s = e.isShowingMore, o = e.toggleShowMore, c = e.canToggleShowMore; if (t) h.templateProps = fe({ defaultTemplates: va, templatesConfig: a.templatesConfig, templates: f }); else { var u = r.map(function (e) { return W(W({}, e), {}, { url: i(e.value) }) }); rr(Wn(ta, { createURL: i, cssClasses: d, facetValues: u, showMore: m, templateProps: h.templateProps, toggleRefinement: n, toggleShowMore: o, isShowingMore: s, canToggleShowMore: c }), l) } } }({ containerNode: f, cssClasses: m, renderState: {}, templates: d, showMore: s }); return W(W({}, hr(p, function () { return rr(null, f) })({ attribute: r, limit: a, showMore: s, showMoreLimit: o, sortBy: i, transformItems: h })), {}, { $$widgetType: "ais.menu" }) }, menuSelect: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.sortBy, a = void 0 === i ? ["name:asc"] : i, s = t.limit, o = void 0 === s ? 10 : s, c = t.cssClasses, u = void 0 === c ? {} : c, l = t.templates, d = void 0 === l ? {} : l, h = t.transformItems; if (!n) throw new Error(Pa("The `container` option is required.")); var f = le(n), m = { root: Ri(Na(), u.root), noRefinementRoot: Ri(Na({ modifierName: "noRefinement" }), u.noRefinementRoot), select: Ri(Na({ descendantName: "select" }), u.select), option: Ri(Na({ descendantName: "option" }), u.option) }, p = function (e) { var a = e.containerNode, s = e.cssClasses, o = e.renderState, c = e.templates; return function (e, t) { var n = e.refine, r = e.items, i = e.instantSearchInstance; t ? o.templateProps = fe({ defaultTemplates: wa, templatesConfig: i.templatesConfig, templates: c }) : rr(Wn(Ra, { cssClasses: s, items: r, refine: n, templateProps: o.templateProps }), a) } }({ containerNode: f, cssClasses: m, renderState: {}, templates: d }); return W(W({}, hr(p, function () { return rr(null, f) })({ attribute: r, limit: o, sortBy: a, transformItems: h })), {}, { $$widgetType: "ais.menuSelect" }) }, numericMenu: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.items, a = t.cssClasses, s = void 0 === a ? {} : a, o = t.templates, c = void 0 === o ? {} : o, u = t.transformItems; if (!n) throw new Error(_a("The `container` option is required.")); var l = le(n), d = { root: Ri(Ia(), s.root), noRefinementRoot: Ri(Ia({ modifierName: "noRefinement" }), s.noRefinementRoot), list: Ri(Ia({ descendantName: "list" }), s.list), item: Ri(Ia({ descendantName: "item" }), s.item), selectedItem: Ri(Ia({ descendantName: "item", modifierName: "selected" }), s.selectedItem), label: Ri(Ia({ descendantName: "label" }), s.label), radio: Ri(Ia({ descendantName: "radio" }), s.radio), labelText: Ri(Ia({ descendantName: "labelText" }), s.labelText) }, h = function (e) { var s = e.containerNode, o = e.attribute, c = e.cssClasses, u = e.renderState, l = e.templates; return function (e, t) { var n = e.createURL, r = e.instantSearchInstance, i = e.refine, a = e.items; t ? u.templateProps = fe({ defaultTemplates: xa, templatesConfig: r.templatesConfig, templates: l }) : rr(Wn(ta, { createURL: n, cssClasses: c, facetValues: a, templateProps: u.templateProps, toggleRefinement: i, attribute: o }), s) } }({ containerNode: l, attribute: r, cssClasses: d, renderState: {}, templates: c }); return W(W({}, fr(h, function () { return rr(null, l) })({ attribute: r, items: i, transformItems: u })), {}, { $$widgetType: "ais.numericMenu" }) }, pagination: function (e) { var t = e || {}, n = t.container, r = t.templates, i = void 0 === r ? {} : r, a = t.cssClasses, s = void 0 === a ? {} : a, o = t.totalPages, c = t.padding, u = t.showFirst, l = void 0 === u || u, d = t.showLast, h = void 0 === d || d, f = t.showPrevious, m = void 0 === f || f, p = t.showNext, g = void 0 === p || p, v = t.scrollTo, y = void 0 === v ? "body" : v; if (!n) throw new Error(ka("The `container` option is required.")); var b = le(n), R = !0 === y ? "body" : y, S = !1 !== R && le(R), w = { root: Ri(Ea(), s.root), noRefinementRoot: Ri(Ea({ modifierName: "noRefinement" }), s.noRefinementRoot), list: Ri(Ea({ descendantName: "list" }), s.list), item: Ri(Ea({ descendantName: "item" }), s.item), firstPageItem: Ri(Ea({ descendantName: "item", modifierName: "firstPage" }), s.firstPageItem), lastPageItem: Ri(Ea({ descendantName: "item", modifierName: "lastPage" }), s.lastPageItem), previousPageItem: Ri(Ea({ descendantName: "item", modifierName: "previousPage" }), s.previousPageItem), nextPageItem: Ri(Ea({ descendantName: "item", modifierName: "nextPage" }), s.nextPageItem), pageItem: Ri(Ea({ descendantName: "item", modifierName: "page" }), s.pageItem), selectedItem: Ri(Ea({ descendantName: "item", modifierName: "selected" }), s.selectedItem), disabledItem: Ri(Ea({ descendantName: "item", modifierName: "disabled" }), s.disabledItem), link: Ri(Ea({ descendantName: "link" }), s.link) }, P = W(W({}, La), i), N = function (e) { var u = e.containerNode, l = e.cssClasses, d = e.templates, h = e.showFirst, f = e.showLast, m = e.showPrevious, p = e.showNext, g = e.scrollToNode; return function (e, t) { var n = e.createURL, r = e.currentRefinement, i = e.nbPages, a = e.pages, s = e.isFirstPage, o = e.isLastPage, c = e.refine; if (!t) { rr(Wn(Fa, { createURL: n, cssClasses: l, currentPage: r, templates: d, nbPages: i, pages: a, isFirstPage: s, isLastPage: o, setCurrentPage: function (e) { c(e), !1 !== g && g.scrollIntoView() }, showFirst: h, showLast: f, showPrevious: m, showNext: p }), u) } } }({ containerNode: b, cssClasses: w, templates: P, showFirst: l, showLast: h, showPrevious: m, showNext: g, scrollToNode: S }); return W(W({}, wr(N, function () { return rr(null, b) })({ totalPages: o, padding: c })), {}, { $$widgetType: "ais.pagination" }) }, panel: function (e) { var t = e || {}, n = t.templates, r = void 0 === n ? {} : n, i = t.hidden, c = void 0 === i ? function () { return !1 } : i, a = t.collapsed, s = t.cssClasses, o = void 0 === s ? {} : s, u = document.createElement("div"), l = Boolean(a), d = "function" == typeof a ? a : function () { return !1 }, h = { root: Ri(Za(), o.root), noRefinementRoot: Ri(Za({ modifierName: "noRefinement" }), o.noRefinementRoot), collapsibleRoot: Ri(Za({ modifierName: "collapsible" }), o.collapsibleRoot), collapsedRoot: Ri(Za({ modifierName: "collapsed" }), o.collapsedRoot), collapseButton: Ri(Za({ descendantName: "collapseButton" }), o.collapseButton), collapseIcon: Ri(Za({ descendantName: "collapseIcon" }), o.collapseIcon), body: Ri(Za({ descendantName: "body" }), o.body), header: Ri(Za({ descendantName: "header" }), o.header), footer: Ri(Za({ descendantName: "footer" }), o.footer) }; return function (t) { return function (e) { if (!e || !e.container) throw new Error(Ga("The `container` option is required in the widget within the panel.")); var i = le(e.container), s = function (e) { var a = e.containerNode, s = e.bodyContainerNode, o = e.cssClasses, c = e.templates; return function (e) { var t = e.options, n = e.hidden, r = e.collapsible, i = e.collapsed; rr(Wn(Ja, { cssClasses: o, hidden: n, collapsible: r, isCollapsed: i, templates: c, data: t, bodyElement: s }), a) } }({ containerNode: i, bodyContainerNode: u, cssClasses: h, templates: W(W({}, { header: "", footer: "", collapseButtonText: function (e) { var t = e.collapsed; return '<svg\n          class="'.concat(h.collapseIcon, '"\n          width="1em"\n          height="1em"\n          viewBox="0 0 500 500"\n        >\n        <path d="').concat(t ? "M100 250l300-150v300z" : "M250 400l150-300H100z", '" fill="currentColor" />\n        </svg>') } }), r) }), o = t(W(W({}, e), {}, { container: u })); return W(W({}, o), {}, { init: function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; var r, i = t[0], a = W(W({}, o.getWidgetRenderState ? o.getWidgetRenderState(i) : {}), i); s({ options: a, hidden: !0, collapsible: l, collapsed: !1 }), "function" == typeof o.init && (r = o.init).call.apply(r, [this].concat(t)) }, render: function () { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)t[n] = arguments[n]; var r, i = t[0], a = W(W({}, o.getWidgetRenderState ? o.getWidgetRenderState(i) : {}), i); s({ options: a, hidden: Boolean(c(a)), collapsible: l, collapsed: Boolean(d(a)) }), "function" == typeof o.render && (r = o.render).call.apply(r, [this].concat(t)) }, dispose: function () { if (rr(null, i), "function" == typeof o.dispose) { for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)n[r] = arguments[r]; return (e = o.dispose).call.apply(e, [this].concat(n)) } } }) } } }, places: function (e) { var t = e || {}, n = t.placesReference, r = t.defaultPosition, o = void 0 === r ? [] : r, i = j(t, ["placesReference", "defaultPosition"]); if ("function" != typeof n) throw new Error("The `placesReference` option requires a valid Places.js reference."); var c = n(i), u = { query: "", initialLatLngViaIP: void 0, isInitialLatLngViaIPSet: !1 }; return { $$type: "ais.places", $$widgetType: "ais.places", init: function (e) { var s = e.helper; c.on("change", function (e) { var t = e.suggestion, n = t.value, r = t.latlng, i = r.lat, a = r.lng; u.query = n, s.setQueryParameter("insideBoundingBox", void 0).setQueryParameter("aroundLatLngViaIP", !1).setQueryParameter("aroundLatLng", "".concat(i, ",").concat(a)).search() }), c.on("clear", function () { u.query = "", s.setQueryParameter("insideBoundingBox", void 0), 1 < o.length ? s.setQueryParameter("aroundLatLngViaIP", !1).setQueryParameter("aroundLatLng", o.join(",")) : s.setQueryParameter("aroundLatLngViaIP", u.initialLatLngViaIP).setQueryParameter("aroundLatLng", void 0), s.search() }) }, getWidgetUiState: function (e, t) { var n = t.searchParameters.aroundLatLng || o.join(","); if (n !== o.join(",") || u.query) return W(W({}, e), {}, { places: { query: u.query, position: n } }); e.places; return j(e, ["places"]) }, getWidgetSearchParameters: function (e, t) { var n = t.uiState.places || {}, r = n.query, i = void 0 === r ? "" : r, a = n.position, s = void 0 === a ? o.join(",") : a; return u.query = i, u.isInitialLatLngViaIPSet || (u.isInitialLatLngViaIPSet = !0, u.initialLatLngViaIP = e.aroundLatLngViaIP), c.setVal(i), c.close(), e.setQueryParameter("insideBoundingBox", void 0).setQueryParameter("aroundLatLngViaIP", !1).setQueryParameter("aroundLatLng", s || void 0) }, getRenderState: function (e, t) { return W(W({}, e), {}, { places: this.getWidgetRenderState(t) }) }, getWidgetRenderState: function () { return { widgetParams: e } } } }, poweredBy: function (e) { var t = e || {}, n = t.container, r = t.cssClasses, i = void 0 === r ? {} : r, a = t.theme, s = void 0 === a ? "light" : a; if (!n) throw new Error(rs("The `container` option is required.")); var o = le(n), c = { root: Ri(ns(), ns({ modifierName: "dark" === s ? "dark" : "light" }), i.root), link: Ri(ns({ descendantName: "link" }), i.link), logo: Ri(ns({ descendantName: "logo" }), i.logo) }, u = function (e) { var a = e.containerNode, s = e.cssClasses; return function (e, t) { var n = e.url, r = e.widgetParams; if (t) { var i = r.theme; rr(Wn(Ya, { cssClasses: s, url: n, theme: void 0 === i ? "light" : i }), a) } else; } }({ containerNode: o, cssClasses: c }); return W(W({}, Yr(u, function () { return rr(null, o) })({ theme: s })), {}, { $$widgetType: "ais.poweredBy" }) }, queryRuleContext: function (e) { var t = 0 < arguments.length && void 0 !== e ? e : {}; if (!t.trackedFilters) throw new Error(is("The `trackedFilters` option is required.")); return W(W({}, ci(_e)(t)), {}, { $$widgetType: "ais.queryRuleContext" }) }, queryRuleCustomData: function (e) { var t = e || {}, n = t.container, r = t.cssClasses, i = void 0 === r ? {} : r, a = t.templates, s = void 0 === a ? {} : a, o = t.transformItems, c = void 0 === o ? function (e) { return e } : o; if (!n) throw new Error(ss("The `container` option is required.")); var u = { root: Ri(os(), i.root) }, l = le(n), d = W(W({}, as), s), h = function (e) { var n = e.containerNode, r = e.cssClasses, i = e.templates; return function (e) { var t = e.items; rr(Wn(Xa, { cssClasses: r, templates: i, items: t }), n) } }({ containerNode: l, cssClasses: u, renderState: {}, templates: d }); return W(W({}, ci(h, function () { rr(null, l) })({ transformItems: c })), {}, { $$widgetType: "ais.queryRuleCustomData" }) }, rangeInput: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.min, a = t.max, s = t.precision, o = void 0 === s ? 0 : s, c = t.cssClasses, u = void 0 === c ? {} : c, l = t.templates, d = void 0 === l ? {} : l; if (!n) throw new Error(us("The `container` option is required.")); var h = le(n), f = { root: Ri(ls(), u.root), noRefinement: Ri(ls({ modifierName: "noRefinement" })), form: Ri(ls({ descendantName: "form" }), u.form), label: Ri(ls({ descendantName: "label" }), u.label), input: Ri(ls({ descendantName: "input" }), u.input), inputMin: Ri(ls({ descendantName: "input", modifierName: "min" }), u.inputMin), inputMax: Ri(ls({ descendantName: "input", modifierName: "max" }), u.inputMax), separator: Ri(ls({ descendantName: "separator" }), u.separator), submit: Ri(ls({ descendantName: "submit" }), u.submit) }, m = function (e) { var f = e.containerNode, m = e.cssClasses, p = e.renderState, g = e.templates; return function (e, t) { var n = e.refine, r = e.range, i = e.start, a = e.widgetParams, s = e.instantSearchInstance; if (t) p.templateProps = fe({ defaultTemplates: ds, templatesConfig: s.templatesConfig, templates: g }); else { var o = r.min, c = r.max, u = D(i, 2), l = u[0], d = u[1], h = 1 / Math.pow(10, a.precision || 0); rr(Wn(cs, { min: o, max: c, step: h, values: { min: l !== -1 / 0 && l !== o ? l : void 0, max: d !== 1 / 0 && d !== c ? d : void 0 }, cssClasses: m, refine: n, templateProps: p.templateProps }), f) } } }({ containerNode: h, cssClasses: f, templates: d, renderState: {} }); return W(W({}, Fr(m, function () { return rr(null, h) })({ attribute: r, min: i, max: a, precision: o })), {}, { $$type: "ais.rangeInput", $$widgetType: "ais.rangeInput" }) }, rangeSlider: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.min, a = t.max, s = t.cssClasses, o = void 0 === s ? {} : s, c = t.step, u = t.pips, l = void 0 === u || u, d = t.precision, h = void 0 === d ? 0 : d, f = t.tooltips, m = void 0 === f || f; if (!n) throw new Error(Ms("The `container` option is required.")); var p = le(n), g = { root: Ri(Os(), o.root), disabledRoot: Ri(Os({ modifierName: "disabled" }), o.disabledRoot) }, v = function (e) { var h = e.containerNode, f = e.cssClasses, m = e.pips, p = e.step, g = e.tooltips; return function (e, t) { var n = e.refine, r = e.range, i = e.start; if (!t) { var a = r.min, s = r.max, o = D(i, 2), c = o[0], u = o[1], l = c === -1 / 0 ? a : c, d = u === 1 / 0 ? s : u; rr(Wn(js, { cssClasses: f, refine: n, min: a, max: s, values: [s < l ? s : l, d < a ? a : d], tooltips: g, step: p, pips: m }), h) } } }({ containerNode: p, step: c, pips: l, tooltips: m, cssClasses: g }); return W(W({}, Fr(v, function () { return rr(null, p) })({ attribute: r, min: i, max: a, precision: h })), {}, { $$type: "ais.rangeSlider", $$widgetType: "ais.rangeSlider" }) }, ratingMenu: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.max, a = void 0 === i ? 5 : i, s = t.cssClasses, o = void 0 === s ? {} : s, c = t.templates, u = void 0 === c ? {} : c; if (!n) throw new Error(Hs("The `container` option is required.")); var l = le(n), d = { root: Ri(Ws(), o.root), noRefinementRoot: Ri(Ws({ modifierName: "noRefinement" }), o.noRefinementRoot), list: Ri(Ws({ descendantName: "list" }), o.list), item: Ri(Ws({ descendantName: "item" }), o.item), selectedItem: Ri(Ws({ descendantName: "item", modifierName: "selected" }), o.selectedItem), disabledItem: Ri(Ws({ descendantName: "item", modifierName: "disabled" }), o.disabledItem), link: Ri(Ws({ descendantName: "link" }), o.link), starIcon: Ri(Ws({ descendantName: "starIcon" }), o.starIcon), fullStarIcon: Ri(Ws({ descendantName: "starIcon", modifierName: "full" }), o.fullStarIcon), emptyStarIcon: Ri(Ws({ descendantName: "starIcon", modifierName: "empty" }), o.emptyStarIcon), label: Ri(Ws({ descendantName: "label" }), o.label), count: Ri(Ws({ descendantName: "count" }), o.count) }, h = function (e) { var s = e.containerNode, o = e.cssClasses, c = e.templates, u = e.renderState; return function (e, t) { var n = e.refine, r = e.items, i = e.createURL, a = e.instantSearchInstance; t ? u.templateProps = fe({ defaultTemplates: As, templatesConfig: a.templatesConfig, templates: c }) : rr(Wn(ta, { createURL: i, cssClasses: o, facetValues: r, templateProps: u.templateProps, toggleRefinement: n }, Wn("svg", { style: "display:none;" }, Wn("symbol", { id: Ws({ descendantName: "starSymbol" }), viewBox: "0 0 24 24" }, Ds), Wn("symbol", { id: Ws({ descendantName: "starEmptySymbol" }), viewBox: "0 0 24 24" }, Bs))), s) } }({ containerNode: l, cssClasses: d, renderState: {}, templates: u }); return W(W({}, kr(h, function () { return rr(null, l) })({ attribute: r, max: a })), {}, { $$widgetType: "ais.ratingMenu" }) }, refinementList: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.operator, a = t.sortBy, s = t.limit, o = t.showMore, c = t.showMoreLimit, u = t.searchable, l = void 0 !== u && u, d = t.searchablePlaceholder, h = void 0 === d ? "Search..." : d, f = t.searchableEscapeFacetValues, m = void 0 === f || f, p = t.searchableIsAlwaysActive, g = void 0 === p || p, v = t.cssClasses, y = void 0 === v ? {} : v, b = t.templates, R = void 0 === b ? {} : b, S = t.transformItems; if (!n) throw new Error(Qs("The `container` option is required.")); var w = !!l && Boolean(m), P = le(n), N = { root: Ri($s(), y.root), noRefinementRoot: Ri($s({ modifierName: "noRefinement" }), y.noRefinementRoot), list: Ri($s({ descendantName: "list" }), y.list), item: Ri($s({ descendantName: "item" }), y.item), selectedItem: Ri($s({ descendantName: "item", modifierName: "selected" }), y.selectedItem), searchBox: Ri($s({ descendantName: "searchBox" }), y.searchBox), label: Ri($s({ descendantName: "label" }), y.label), checkbox: Ri($s({ descendantName: "checkbox" }), y.checkbox), labelText: Ri($s({ descendantName: "labelText" }), y.labelText), count: Ri($s({ descendantName: "count" }), y.count), noResults: Ri($s({ descendantName: "noResults" }), y.noResults), showMore: Ri($s({ descendantName: "showMore" }), y.showMore), disabledShowMore: Ri($s({ descendantName: "showMore", modifierName: "disabled" }), y.disabledShowMore), searchable: { root: Ri(Vs(), y.searchableRoot), form: Ri(Vs({ descendantName: "form" }), y.searchableForm), input: Ri(Vs({ descendantName: "input" }), y.searchableInput), submit: Ri(Vs({ descendantName: "submit" }), y.searchableSubmit), submitIcon: Ri(Vs({ descendantName: "submitIcon" }), y.searchableSubmitIcon), reset: Ri(Vs({ descendantName: "reset" }), y.searchableReset), resetIcon: Ri(Vs({ descendantName: "resetIcon" }), y.searchableResetIcon), loadingIndicator: Ri(Vs({ descendantName: "loadingIndicator" }), y.searchableLoadingIndicator), loadingIcon: Ri(Vs({ descendantName: "loadingIcon" }), y.searchableLoadingIcon) } }, x = function (e) { var h = e.containerNode, f = e.cssClasses, m = e.templates, p = e.searchBoxTemplates, g = e.renderState, v = e.showMore, y = e.searchable, b = e.searchablePlaceholder, R = e.searchableIsAlwaysActive; return function (e, t) { var n = e.refine, r = e.items, i = e.createURL, a = e.searchForItems, s = e.isFromSearch, o = e.instantSearchInstance, c = e.toggleShowMore, u = e.isShowingMore, l = e.hasExhaustiveItems, d = e.canToggleShowMore; if (t) return g.templateProps = fe({ defaultTemplates: qs, templatesConfig: o.templatesConfig, templates: m }), void (g.searchBoxTemplateProps = fe({ defaultTemplates: Us, templatesConfig: o.templatesConfig, templates: p })); rr(Wn(ta, { createURL: i, cssClasses: f, facetValues: r, templateProps: g.templateProps, searchBoxTemplateProps: g.searchBoxTemplateProps, toggleRefinement: n, searchFacetValues: y ? a : void 0, searchPlaceholder: b, searchIsAlwaysActive: R, isFromSearch: s, showMore: v && !s && 0 < r.length, toggleShowMore: c, isShowingMore: u, hasExhaustiveItems: l, canToggleShowMore: d }), h) } }({ containerNode: P, cssClasses: N, templates: R, searchBoxTemplates: { submit: R.searchableSubmit, reset: R.searchableReset, loadingIndicator: R.searchableLoadingIndicator }, renderState: {}, searchable: l, searchablePlaceholder: h, searchableIsAlwaysActive: g, showMore: o }); return W(W({}, Tr(x, function () { return rr(null, P) })({ attribute: r, operator: i, limit: s, showMore: o, showMoreLimit: c, sortBy: a, escapeFacetValues: w, transformItems: S })), {}, { $$widgetType: "ais.refinementList" }) }, relevantSort: function (e) { var t = e.container, n = e.templates, r = void 0 === n ? {} : n, i = e.cssClasses, a = void 0 === i ? {} : i; if (!t) throw new Error(zs("The `container` option is required.")); var s = le(t), o = { root: Ri(Js(), a.root), text: Ri(Js({ descendantName: "text" }), a.text), button: Ri(Js({ descendantName: "button" }), a.button) }, c = W(W({}, Ks), r), u = function (e) { var i = e.containerNode, a = e.cssClasses, s = e.templates; return function (e) { var t = e.isRelevantSorted, n = e.isVirtualReplica, r = e.refine; rr(Wn(Cs, { cssClasses: a, templates: s, isRelevantSorted: t, isVirtualReplica: n, refine: r }), i) } }({ containerNode: s, cssClasses: o, renderState: {}, templates: c }); return W(W({}, fi(u, function () { rr(null, s) })({})), {}, { $$widgetType: "ais.relevantSort" }) }, searchBox: function (e) { var t = e || {}, n = t.container, r = t.placeholder, i = void 0 === r ? "" : r, a = t.cssClasses, s = void 0 === a ? {} : a, o = t.autofocus, c = void 0 !== o && o, u = t.searchAsYouType, l = void 0 === u || u, d = t.showReset, h = void 0 === d || d, f = t.showSubmit, m = void 0 === f || f, p = t.showLoadingIndicator, g = void 0 === p || p, v = t.queryHook, y = t.templates, b = void 0 === y ? {} : y; if (!n) throw new Error(Ys("The `container` option is required.")); var R = le(n), S = { root: Ri(Xs(), s.root), form: Ri(Xs({ descendantName: "form" }), s.form), input: Ri(Xs({ descendantName: "input" }), s.input), submit: Ri(Xs({ descendantName: "submit" }), s.submit), submitIcon: Ri(Xs({ descendantName: "submitIcon" }), s.submitIcon), reset: Ri(Xs({ descendantName: "reset" }), s.reset), resetIcon: Ri(Xs({ descendantName: "resetIcon" }), s.resetIcon), loadingIndicator: Ri(Xs({ descendantName: "loadingIndicator" }), s.loadingIndicator), loadingIcon: Ri(Xs({ descendantName: "loadingIcon" }), s.loadingIcon) }, w = W(W({}, Us), b), P = function (e) { var i = e.containerNode, a = e.cssClasses, s = e.placeholder, o = e.templates, c = e.autofocus, u = e.searchAsYouType, l = e.showReset, d = e.showSubmit, h = e.showLoadingIndicator; return function (e) { var t = e.refine, n = e.query, r = e.isSearchStalled; rr(Wn(Zi, { query: n, placeholder: s, autofocus: c, refine: t, searchAsYouType: u, templates: o, showSubmit: d, showReset: l, showLoadingIndicator: h, isSearchStalled: r, cssClasses: a }), i) } }({ containerNode: R, cssClasses: S, placeholder: i, templates: w, autofocus: c, searchAsYouType: l, showReset: h, showSubmit: m, showLoadingIndicator: g }); return W(W({}, Cr(P, function () { return rr(null, R) })({ queryHook: v })), {}, { $$widgetType: "ais.searchBox" }) }, sortBy: function (e) { var t = e || {}, n = t.container, r = t.items, i = t.cssClasses, a = void 0 === i ? {} : i, s = t.transformItems; if (!n) throw new Error(Gs("The `container` option is required.")); var o = le(n), c = { root: Ri(Zs(), a.root), select: Ri(Zs({ descendantName: "select" }), a.select), option: Ri(Zs({ descendantName: "option" }), a.option) }, u = function (e) { var a = e.containerNode, s = e.cssClasses; return function (e, t) { var n = e.currentRefinement, r = e.options, i = e.refine; t || rr(Wn("div", { className: s.root }, Wn(la, { cssClasses: s, currentValue: n, options: r, setValue: i })), a) } }({ containerNode: o, cssClasses: c }); return W(W({}, Er(u, function () { return rr(null, o) })({ container: o, items: r, transformItems: s })), {}, { $$widgetType: "ais.sortBy" }) }, stats: function (e) { var t = e || {}, n = t.container, r = t.cssClasses, i = void 0 === r ? {} : r, a = t.templates, s = void 0 === a ? {} : a; if (!n) throw new Error(eo("The `container` option is required.")); var o = le(n), c = { root: Ri(to(), i.root), text: Ri(to({ descendantName: "text" }), i.text) }, u = function (e) { var d = e.renderState, h = e.cssClasses, f = e.containerNode, m = e.templates; return function (e, t) { var n = e.hitsPerPage, r = e.nbHits, i = e.nbSortedHits, a = e.areHitsSorted, s = e.nbPages, o = e.page, c = e.processingTimeMS, u = e.query, l = e.instantSearchInstance; t ? d.templateProps = fe({ defaultTemplates: no, templatesConfig: l.templatesConfig, templates: m }) : rr(Wn(Es, { cssClasses: h, hitsPerPage: n, nbHits: r, nbSortedHits: i, areHitsSorted: a, nbPages: s, page: o, processingTimeMS: c, query: u, templateProps: d.templateProps }), f) } }({ containerNode: o, cssClasses: c, templates: s, renderState: {} }); return W(W({}, Lr(u, function () { return rr(null, o) })({})), {}, { $$widgetType: "ais.stats" }) }, toggleRefinement: function (e) { var t = e || {}, n = t.container, r = t.attribute, i = t.cssClasses, a = void 0 === i ? {} : i, s = t.templates, o = void 0 === s ? {} : s, c = t.on, u = void 0 === c || c, l = t.off; if (!n) throw new Error(io("The `container` option is required.")); var d = le(n), h = { root: Ri(ao(), a.root), label: Ri(ao({ descendantName: "label" }), a.label), checkbox: Ri(ao({ descendantName: "checkbox" }), a.checkbox), labelText: Ri(ao({ descendantName: "labelText" }), a.labelText) }, f = function (e) { var a = e.containerNode, s = e.cssClasses, o = e.renderState, c = e.templates; return function (e, t) { var n = e.value, r = e.refine, i = e.instantSearchInstance; t ? o.templateProps = fe({ defaultTemplates: ro, templatesConfig: i.templatesConfig, templates: c }) : rr(Wn(ks, { cssClasses: s, currentRefinement: n, templateProps: o.templateProps, refine: r }), a) } }({ containerNode: d, cssClasses: h, renderState: {}, templates: o }); return W(W({}, jr(f, function () { return rr(null, d) })({ attribute: r, on: u, off: l })), {}, { $$widgetType: "ais.toggleRefinement" }) }, voiceSearch: function (e) { var t = e || {}, n = t.container, r = t.cssClasses, i = void 0 === r ? {} : r, a = t.templates, s = void 0 === a ? {} : a, o = t.searchAsYouSpeak, c = void 0 !== o && o, u = t.language, l = t.additionalQueryParameters, d = t.createVoiceSearchHelper; if (!n) throw new Error(oo("The `container` option is required.")); var h = le(n), f = { root: Ri(co(), i.root), button: Ri(co({ descendantName: "button" }), i.button), status: Ri(co({ descendantName: "status" }), i.status) }, m = W(W({}, so), s), p = function (e) { var a = e.containerNode, s = e.cssClasses, o = e.templates; return function (e) { var t = e.isBrowserSupported, n = e.isListening, r = e.toggleListening, i = e.voiceListeningState; rr(Wn(Ls, { cssClasses: s, templates: o, isBrowserSupported: t, isListening: n, toggleListening: r, voiceListeningState: i }), a) } }({ containerNode: h, cssClasses: f, templates: m }); return W(W({}, li(p, function () { return rr(null, h) })({ container: h, cssClasses: f, templates: m, searchAsYouSpeak: c, language: u, additionalQueryParameters: l, createVoiceSearchHelper: d })), {}, { $$widgetType: "ais.voiceSearch" }) } }), ho = Object.freeze({ __proto__: null, createInsightsMiddleware: function (e) { var t = e || {}, d = t.insightsClient, h = t.insightsInitParams, f = t.onEvent; if (null !== d && !d) throw new Error("The `insightsClient` option is required. To disable, set it to `null`."); var m = Boolean(d), p = null === d ? _e : d; return function (e) { var n = e.instantSearchInstance, t = D(function (e) { if (e.transporter) { var t = e.transporter, n = t.headers, r = t.queryParameters, i = "x-algolia-application-id", a = "x-algolia-api-key"; return [n[i] || r[i], n[a] || r[a]] } return [e.applicationID, e.apiKey] }(n.client), 2), r = t[0], i = t[1], a = void 0, s = void 0; if (Array.isArray(p.queue)) { var o = D(be(p.queue.slice().reverse(), function (e) { return "setUserToken" === D(e, 1)[0] }) || [], 2); a = o[1] } p("getUserToken", null, function (e, t) { s = t }), p("init", W({ appId: r, apiKey: i }, h)); var c, u, l = ti(_e); return { onStateChange: function () { }, subscribe: function () { p("addAlgoliaAgent", "insights-middleware"), c = l({ searchParameters: { clickAnalytics: !0 } }), n.addWidgets([c]); function e(e) { u && n.removeWidgets([u]), u = l({ searchParameters: { userToken: e } }), n.addWidgets([u]) } var t = Et(); m && t && e(t), s ? p("setUserToken", s) : a && p("setUserToken", a), p("onUserTokenChange", e, { immediate: !0 }), n.sendEventToInsights = function (e) { if (f) f(e, d); else if (e.insightsMethod) { Boolean(n.renderState[n.indexName].configure.widgetParams.searchParameters.userToken) && p(e.insightsMethod, e.payload) } } }, unsubscribe: function () { p("onUserTokenChange", void 0), n.removeWidgets([c, u]), u = c = void 0, n.sendEventToInsights = _e } } } }, createRouterMiddleware: cn, isMetadataEnabled: un, createMetadataMiddleware: ln }), fo = Object.freeze({ __proto__: null, history: on }); function mo(e) { e.configure; return j(e, ["configure"]) } var po = Object.freeze({ __proto__: null, simple: Lt, singleIndex: function (t) { return { stateToRoute: function (e) { return mo(e[t] || {}) }, routeToState: function (e) { return k({}, t, mo(0 < arguments.length && void 0 !== e ? e : {})) } } } }); function go(e) { var t = e || {}; t.page; return j(t, ["page"]) } var vo = "ais.infiniteHits"; function yo(e) { return new mn(e) } return yo.version = "4.36.0", yo.connectors = yi, yo.widgets = lo, yo.middlewares = ho, yo.routers = fo, yo.stateMappings = po, yo.createInfiniteHitsSessionStorageCache = function () { return { read: function (e) { var t = e.state, n = ft(function (e) { return e.window.sessionStorage }); if (!n) return null; try { var r = JSON.parse(n.getItem(vo)); return r && Le(r.state, go(t)) ? r.hits : null } catch (e) { if (e instanceof SyntaxError) try { n.removeItem(vo) } catch (e) { } return null } }, write: function (e) { var t = e.state, n = e.hits, r = ft(function (e) { return e.window.sessionStorage }); if (r) try { r.setItem(vo, JSON.stringify({ state: go(t), hits: n })) } catch (e) { } } } }, yo.highlight = Pt, yo.reverseHighlight = xt, yo.snippet = It, yo.reverseSnippet = Tt, yo.insights = Ct, yo });
//# sourceMappingURL=instantsearch.production.min.js.map;"use strict";

// function to remove html coding like &amp; from strings
var decode = function () {
  var parser = $(document.createElement('div'));
  // store in closure for reuse

  return function (encodedStr) {
    return parser.html(encodedStr).text();
  };
}();

// strip unsafe chars from strings
var escapeHTML = function escapeHTML(unsafe_str) {
  return unsafe_str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;').replace(/\'/g, '&#39;').replace(/\//g, '&#x2F;');
};

// Do a double decode as the instantsearch snippet encodes the item description
// Then remove any html
var snippetDescStripHTML = function snippetDescStripHTML(htmlStr, stripNewlines) {
  if (typeof htmlStr === 'undefined') return '';
  var str = decode(decode(htmlStr));
  // Strip any html
  var regex = /<.*?>/g;
  if (str.match(regex)) {
    str = str.replace(regex, '');
  }
  if (stripNewlines) {
    str = str.replace(/\s\s+/gm, ' ');
  }
  return str;
};

// Remove any <> chars from the search query string
var stripHtmlTagStartEnd = function stripHtmlTagStartEnd(htmlStr) {
  if (typeof htmlStr === 'undefined') return '';
  var str = htmlStr;
  var regex = /[<>]/g;
  if (str.match(regex)) {
    str = str.replace(regex, '');
  }
  return str;
};
var sepToIndex = function sepToIndex(specialStr) {
  return specialStr.replace(/&/g, '%26').replace(/#/g, '%23').replace(/\s/g, '%20');
};
//
// Exclude lots listed in private platforms
var setExclusionFacets = function setExclusionFacets(helper) {
  if (typeof helper === 'undefined') return;
  if (typeof saytVM.config.facetExcludes !== 'undefined') {
    for (var i = 0; i < saytVM.config.facetExcludes.length; i++) {
      var state = helper.state;
      var facetName = saytVM.config.facetExcludes[i];
      // Add facet to list if it doesn't already exist
      if (!state.facets.includes(facetName)) {
        state.facets.push(facetName);
      }
      // Update helper state before adding exclusion
      helper.setState(state);
      // Add value in facet to exclude
      switch (facetName) {
        case 'privatePlatformCodes':
          helper.addFacetExclusion(facetName, saytVM.config.platform);
          break;
      }
    }
  }
  return helper;
};
//
// Templates for recent and suggested searches panels
var recentSearches = "<div class=\"search-auto-complete recent-search search-panel\">\n                <div class=\"container\">\n                    <h2>".concat(saytVM.searchbox.recentLabel, "</h2>\n                    <ul class=\"recent-search-select\"></ul>\n                    <div class=\"clear-all\">").concat(saytVM.searchbox.clearAllLabel, "</div>\n                </div>\n            </div>");
//
var suggestedSearches = "<div class=\"search-auto-complete suggested-search search-panel\">\n                <div class=\"container\">\n                    <h2>".concat(saytVM.searchbox.suggestedLabel, "</h2>\n                    <ul class=\"suggested-search-select\"></ul>\n                </div>\n            </div>");
//
var storeIndexUsed = function storeIndexUsed(indexUsed, abTestId, abVariantId) {
  // Add data to dl
  window.dataLayer = window.dataLayer || [];
  window.dataLayer[0].indexUsed = typeof indexUsed !== 'undefined' ? indexUsed : '';
  window.dataLayer[0].abTestId = typeof abTestId !== 'undefined' ? abTestId : 0;
  window.dataLayer[0].abVariantId = typeof abVariantId !== 'undefined' ? abVariantId : 0;
};
var truncateAtWord = function truncateAtWord(str, maxLen) {
  str = str.trim();
  if (str.length <= maxLen) return str;
  return str.substr(0, str.lastIndexOf(' ', maxLen)) + '...';
};
var findParentNode = function findParentNode(element, tag) {
  var node = element;
  while (node.tagName !== tag) {
    if (!node.parentNode) return null;
    node = node.parentNode;
  }
  ;
  return node;
};
var browsingModeShowHideElements = function browsingModeShowHideElements(page) {
  if (page > 0) {
    // hide image and text
    $('.ui.container.category').addClass('browsingMode');
  } else {
    $('.ui.container.category').removeClass('browsingMode');
  }
};;"use strict";

var UNKNOWN_SEARCH_POSITION = 9999;
var INSIGHTS_CLICK_AFTER_SEARCH_METHOD = 'clickedObjectIDsAfterSearch';
var ALGOLIA_INSIGHTS_SRC = 'https://cdn.jsdelivr.net/npm/search-insights@2.2.1';
var ALGOLIA_APP_INSIGHTS_SERVICE_NAME = 'algolia';
var CONVERSION_EVENT_TYPE = 'convertedObjectIDsAfterSearch';
var CONVERSION_WATCHLISTED_AFTER_SEARCH = 'watchlisted_after_search';
var CONVERSION_WATCHLISTED_AFTER_SEARCH_ON_LOT_PAGE = 'watchlisted_after_search_on_lot_page';
var CONVERSION_REGISTERED_AFTER_SEARCH = 'registered_after_search';
var CONVERSION_BID_PLACED_AFTER_SEARCH = 'bid_placed_after_search';
var CONVERSION_BUY_IT_NOW_AFTER_SEARCH = 'buy_it_now_after_search';
var CLICK_EVENT_TYPE = 'click';
var CLICK_ON_SEARCH_RESULT_EVENT = 'click_on_search_page_result';
var CLICK_ON_SEARCH_OVERLAY_EVENT = 'click_on_overlay';
var addSearchInsights = function addSearchInsights() {
  !function (e, a, t, n, s, i, c) {
    e.AlgoliaAnalyticsObject = s, e[s] = e[s] || function () {
      (e[s].queue = e[s].queue || []).push(arguments);
    }, i = a.createElement(t), c = a.getElementsByTagName(t)[0], i.async = 1, i.src = n, c.parentNode.insertBefore(i, c);
  }(window, document, "script", ALGOLIA_INSIGHTS_SRC, "aa");

  // Initialize library
  aa('init', {
    appId: saytVM.config.searchClientId,
    apiKey: saytVM.config.searchClientKey
  });
};
var ensureSearchInsightsIsLoaded = function ensureSearchInsightsIsLoaded(callback) {
  var reloadInsights = function reloadInsights(_callback) {
    setTimeout(function () {
      if (window.AlgoliaAnalytics) {
        _callback();
      } else {
        reloadInsights(_callback);
      }
    }, 50);
  };
  reloadInsights(callback);
};
var insightsEventHandler = function insightsEventHandler(event, aa) {
  var insightsMethod = event.insightsMethod,
    payload = event.payload,
    widgetType = event.widgetType,
    eventType = event.eventType;
  if (insightsMethod !== INSIGHTS_CLICK_AFTER_SEARCH_METHOD) {
    return;
  }
  aa(insightsMethod, payload);
  if (widgetType === 'ais.hits' && event.hits && event.hits[0]) {
    var data = event.hits[0];
    sessionStorage.setItem('algoliaClick', JSON.stringify({
      clientId: saytVM.config.searchClientId,
      key: saytVM.config.searchClientKey,
      auctionRef: data.auctionRef,
      event: payload
    }));
  }
};;"use strict";

// Image
var showImageTemplate = function showImageTemplate(item) {
  var overlay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  var query = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  var queryId = arguments.length > 3 ? arguments[3] : undefined;
  if (typeof item === 'undefined') return "";
  var imageTemplate = saytVM.hitsrendering.hideOffensiveImages && item.isPotentiallyOffensive ? lotOffensiveImageTemplate : lotImageTemplate;
  return "\n        <div id=\"a".concat(item.objectID, "\" class=\"thumb update-history-url-after-back\" data-lot-id=\"").concat(item.objectID, "\" data-auction-ref=\"").concat(item.auctionRef, "\" data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\">\n            <a id=\"").concat(overlay ? "overlayLotImg-".concat(item.objectID) : '', "\" href=\"").concat(lotDetailsUrl(item, queryId), "\" ").concat(overlay && query != '' ? "onClick=\"manualAddRecentAndSubmit('".concat(query, "','Lot image','").concat(item.title, "')\"") : "", " class=\"click-track\" data-click-type=\"image\">").concat(imageTemplate(item), "</a>\n        </div>\n    ");
};
var lotOffensiveImageTemplate = function lotOffensiveImageTemplate(item) {
  var overlay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  var query = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  var queryId = arguments.length > 3 ? arguments[3] : undefined;
  var altText = "".concat(saytVM.hitsrendering.lotLabel, " ").concat(item.lotNumber, " ").concat(saytVM.hitsrendering.imageLabel);
  if (typeof item.imageUrl === 'undefined' || item.imageUrl === '') {
    return "".concat(noImgHolderTemplate(item.objectID, altText));
  } else {
    return "<img id=\"i".concat(item.objectID, "\" alt=\"").concat(altText, "\" src=\"").concat(saytVM.hitsrendering.offensiveImageUrl, "\" onerror=\"ImageNotFound('i").concat(item.objectID, "', 'a").concat(item.objectID, "')\">").concat(noImgHolderTemplate());
  }
};

//
var lotImageTemplate = function lotImageTemplate(item) {
  var lotSearchImageSize = "".concat(saytVM.hitsrendering.imageThumbnailSize);
  var altText = "".concat(saytVM.hitsrendering.lotLabel, " ").concat(item.lotNumber, " ").concat(saytVM.hitsrendering.imageLabel);
  if (typeof item.imageUrl === 'undefined' || item.imageUrl === '') {
    return "".concat(noImgHolderTemplate(item.objectID, altText));
  } else {
    return "<img id=\"i".concat(item.objectID, "\" alt=\"").concat(altText, "\" src=\"").concat(item.imageUrl).concat(lotSearchImageSize, "\" onerror=\"ImageNotFound('i").concat(item.objectID, "', 'a").concat(item.objectID, "')\">").concat(noImgHolderTemplate());
  }
};
//
var noImgHolderTemplate = function noImgHolderTemplate(itemId, altText) {
  return "<span class=\"no-image\"><span>".concat(saytVM.hitsrendering.noImageLabel, "</span>").concat(noImgTemplate(itemId, altText), "</span>");
};
//
var noImgTemplate = function noImgTemplate(itemId, altText) {
  var blankImgSrc = '/content/sr/images/blank-image.png';
  if (typeof itemId !== 'undefined') {
    return "<img id=\"i".concat(itemId, "\" alt=\"").concat(altText, "\" src=\"").concat(blankImgSrc, "\" />");
  } else {
    return "<img src=\"".concat(blankImgSrc, "\" />");
  }
};
//
// Urls
var lotDetailsUrl = function lotDetailsUrl(item, queryId) {
  if (typeof item === 'undefined') return "";
  var url = getLinkUrls(saytVM.hitsrendering.lotDetailsUrl, item.auctioneerRef, item.objectID, item.auctionRef);
  if (queryId) {
    var beginning = url.indexOf("?") > 0 ? "&" : "?";
    return url + beginning + "queryId=" + queryId;
  }
  return url;
};
//
var auctioneerUrl = function auctioneerUrl(item) {
  if (typeof item === 'undefined') return "";
  return getLinkUrls(saytVM.hitsrendering.auctioneerUrl, item.auctioneerRef);
};
//
var getLinkUrls = function getLinkUrls(urlToChange, clientUrl, lotId, auctionRef) {
  if (typeof urlToChange === 'undefined' || urlToChange === '') return "";
  var url = urlToChange;
  if (typeof clientUrl !== 'undefined' || clientUrl !== '') {
    if (url.indexOf('$clienturl$') > 0) {
      url = url.replace('$clienturl$', clientUrl);
    }
  }
  if (typeof lotId !== 'undefined' || lotId !== '') {
    if (url.indexOf('$lotid$') > 0) {
      url = url.replace('$lotid$', lotId);
    }
  }
  if (typeof auctionRef !== 'undefined' || auctionRef !== '') {
    if (url.indexOf('$auctionreference$') > 0) {
      url = url.replace('$auctionreference$', auctionRef);
    }
  }
  return url;
};
//
var auctioneerLink = function auctioneerLink(item) {
  if (typeof item === 'undefined') return "";
  if (typeof saytVM.config.platform === 'undefined' && saytVM.config.platform == 'WL') {
    return "";
  } else {
    return "<div class=\"byline client-url\"><a href=\"".concat(auctioneerUrl(item), "\" class=\"a-wrapped click-track\" data-click-type=\"client\">").concat(item.auctioneerName, "</a></div>");
  }
};
//
var moreDetailsLink = function moreDetailsLink(item) {
  if (typeof item === 'undefined') return "";
  return "<a href=\"".concat(lotDetailsUrl(item), "\" class=\"update-history-url-after-back\" data-lot-id=\"").concat(item.objectID, "\" data-auction-ref=\"").concat(item.auctionRef, "\" data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\" >").concat(saytVM.hitsrendering.moreDetailsLabel, "</a>");
};
//
// Featured lot flag
var featuredLotTemplate = function featuredLotTemplate(item) {
  if (typeof item === 'undefined') return "";
  var saytFeaturedLot = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? saytVM.hitsrendering.featuredLabel : saytVM.hitsrendering.featuredLotLabel;
  if (item.isFeaturedLot) {
    return "<div class=\"featured-lot-text\" id=\"featuredLabel-".concat(item.objectID, "\">\n        ").concat(saytFeaturedLot, "\n        </div>");
  } else {
    return "";
  }
};

// Main

// Lot header
var renderLotHeader = function renderLotHeader(item, queryId) {
  if (typeof item === 'undefined') return "";
  return "\n        <div class=\"lot-header\">\n            <div class=\"number\"><span>".concat(saytVM.hitsrendering.lotLabel, "</span> ").concat(item.lotNumber, "</div>\n            <h3><a href=\"").concat(lotDetailsUrl(item, queryId), "\" class=\"a-wrapped update-history-url-after-back click-track\" data-click-type=\"title\" data-lot-id=\"").concat(item.lotNumber, "\">").concat(decode(item.title), "</a></h3>\n        </div>\n        <div class=\"lot-header-grid-only\">\n            <a name=\"lot-title\" href=\"").concat(lotDetailsUrl(item, queryId), "\" class=\"update-history-url-after-back click-track lot-link\" data-click-type=\"title\" data-lot-id=\"").concat(item.objectID, "\">\n                <span class=\"lot-number\">").concat(item.lotNumber, "</span><span class=\"lot-title\">").concat(decode(item.title), "</span>\n            </a>\n        </div>\n    ");
};

// Lot description
var formatLotDescription = function formatLotDescription(item, makeSubstitute) {
  if (typeof item === 'undefined') return "";
  var substituteTitleWithDescription = typeof makeSubstitute === 'undefined' ? false : makeSubstitute;
  return substituteTitleWithDescription ? "" : snippetDescStripHTML(instantsearch.snippet({
    attribute: 'description',
    hit: item,
    highlightedTagName: 'span'
  }));
};
var renderLotDescription = function renderLotDescription(item) {
  if (typeof item === 'undefined') return "";
  if (item.description.length > 0) return "\n            <div class=\"description\">\n                <p>".concat(decode(item.description), "</p>").concat(moreDetailsLink(item), "\n            </div>\n        ");
};

// Auction type
var renderAuctionType = function renderAuctionType(item) {
  if (typeof item === 'undefined') return "";
  return "\n        <label class=\"link-icon icon-timed auction-type-icon\"><i class=\"icon ".concat(getAuctionTypeClass(item.auctionType), "\"></i><span>").concat(item.auctionType, "</span></label>\n    ");
};
var getAuctionTypeClass = function getAuctionTypeClass(auctionType) {
  if (typeof auctionType === 'undefined') return "";
  switch (auctionType.toLowerCase()) {
    case 'timed':
      return 'clock';
    case 'tender':
      return 'envelope';
    default:
      return 'wifi';
  }
};;"use strict";

var COMMAS_REGEX = /\B(?=(\d{3})+(?!\d))/g;
var AUCTION_TYPE_TENDER = 'tender';
var AUCTION_TYPE_TIMED = 'timed';
var AUCTION_TYPE_LIVE = 'live';
var bidInfo = function bidInfo(item) {
  var hideFromOverlay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  if (typeof item === 'undefined') return "";
  return "\n        ".concat(hideFromOverlay ? "" : LotQuantity(item), "\n        ").concat(LotEstimate(item, hideFromOverlay), "\n    ");
};
var renderLotDates = function renderLotDates(item) {
  if (typeof item === 'undefined') return "";
  switch (item.auctionType.toLowerCase()) {
    case AUCTION_TYPE_TENDER:
      return "<div class=\"date countdown auctionCatalogueData tender\" id=\"countdown-".concat(item.objectID, "\"><span id=\"expiryDateTimeLabel\">").concat(portalScriptResources.TimerHeadingBiddingEnds, "</span> <span id=\"expiryDateTime\"><strong>").concat(LotDate(item), "</strong></span></div>");
    case AUCTION_TYPE_TIMED:
      return "<div class=\"date countdown auctionCatalogueData\"><span id=\"timerHeading-".concat(item.objectID, "\">").concat(portalScriptResources.TimerHeadingBiddingEnds, "</span> <span id=\"timer-").concat(item.objectID, "\"><strong>").concat(LotDate(item), "</strong></span></div>");
    case AUCTION_TYPE_LIVE:
      return "<div class=\"date\"><span>".concat(saytVM.hitsrendering.dateLabel, ":</span> <strong>").concat(LotDate(item), "</strong></div>");
    default:
      return "<div class=\"date\"><span>".concat(saytVM.hitsrendering.dateLabel, ":</span> <strong>").concat(LotDate(item), "</strong></div>");
  }
};
var renderLotDatesNewUiSkin = function renderLotDatesNewUiSkin(item) {
  if (typeof item === 'undefined') return "";
  var lowEstimate = item.hasLowEstimate ? formatEstimate(item.lowEstimate) : null;
  var highEstimate = item.hasHighEstimate ? formatEstimate(item.highEstimate) : null;
  var showEstimatesHtml = "<span class=\"question-icon\">".concat(additionalFeesTemplate(item), "</span>");
  if (highEstimate || lowEstimate) {
    showEstimatesHtml = '';
  }
  switch (item.auctionType.toLowerCase()) {
    case AUCTION_TYPE_TENDER:
      return "<div class=\"date countdown auctionCatalogueData tender\" id=\"countdown-".concat(item.objectID, "\"><span class=\"lot-details-subtitle\" id=\"expiryDateTimeLabel\">").concat(saytVM.hitsrendering.endsLabel, "</span> <span class=\"lot-details-subtitle-text\" id=\"expiryDateTime\"><strong>").concat(LotDate(item), "</strong></span></div>");
    case AUCTION_TYPE_TIMED:
      return "<div class=\"date countdown auctionCatalogueData\">\n            <span class=\"lot-details-subtitle\"  id=\"timerHeading-".concat(item.objectID, "\">").concat(saytVM.hitsrendering.endsLabel, "</span> \n            <span class=\"lot-details-subtitle-text\" id=\"timer-").concat(item.objectID, "\">").concat(LotDate(item), "</span>\n            </div>");
    case AUCTION_TYPE_LIVE:
      return "\n            <div class=\"date\">\n                <span class=\"lot-details-subtitle\" >".concat(saytVM.hitsrendering.dateLabel, "</span> \n                <span class=\"lot-details-subtitle-text\">").concat(LotDate(item), "</span>\n            </div>");
    default:
      return "\n            <div class=\"date\">\n                <span class=\"lot-details-subtitle\" >".concat(saytVM.hitsrendering.dateLabel, ":</span> \n                <span class=\"lot-details-subtitle-text\">").concat(LotDate(item), "</span>\n            </div>");
  }
};
var LotDate = function LotDate(item) {
  // we need to convert to users locale
  // we want to check if the day is the same not including the time
  // item.auctionStartDateTimeUtc is already a number not a string
  var auctionStartDate = getUTCWithOffset(item.auctionStartDateTimeUtc);
  var auctionEndDate = item.auctionEndDateTimeUtc ? getUTCWithOffset(item.auctionEndDateTimeUtc) : null;
  var lotEndDate = item.endDateTimeUtc ? getUTCWithOffset(item.endDateTimeUtc) : null;
  if (item.auctionType.toLowerCase() == 'timed' || item.auctionType.toLowerCase() == 'tender') {
    return lotEndDate.format('DD MMM');
  } else {
    return auctionStartDate.format('DD MMM') + (!auctionEndDate || auctionStartDate.isSame(auctionEndDate, 'day') ? "" : " - " + auctionEndDate.format('DD MMM'));
  }
};
var getUTCWithOffset = function getUTCWithOffset(utcNum) {
  return moment.utc(utcNum).clone().add(_getTMZOffset(), 'minute');
};
var _getTMZOffset = function getTMZOffset() {
  // lazy load 
  var _TMZOffset = new Date().getTimezoneOffset();
  _getTMZOffset = function getTMZOffset() {
    return _TMZOffset;
  }; // replace with improved function
  return _TMZOffset; // first time through
};

var LotEstimate = function LotEstimate(item, hideFromOverlay) {
  // conditionally render, so include markup
  // 
  var lowEstimate = item.hasLowEstimate ? formatEstimate(item.lowEstimate) : null;
  var highEstimate = item.hasHighEstimate ? formatEstimate(item.highEstimate) : null;
  //
  if (!highEstimate && !lowEstimate) return ""; // no estimates don't show anything
  //
  var estimates = lowEstimate ? lowEstimate + (highEstimate ? ' - ' + highEstimate : '') : highEstimate;
  if (saytVM.featureSwitch.isNewUiSkinSearchResultEnabled) {
    return "<li class=\"estimate\">\n                <span class=\"lot-details-subtitle\">".concat(saytVM.hitsrendering.estimateLabel, "</span>\n                <span  class=\"lot-details-subtitle-text\">").concat(estimates, " ").concat(item.currency, "</span>\n                ").concat(hideFromOverlay ? '' : "<label class=\"link-icon additional-fees-toggle color-secondary\" id=\"popup-trigger-".concat(item.objectID, "\" data-url=\"").concat(additionalFeesUrl(item), "\">\n                ").concat(feesPopupTrigger(), "\n                </label>"), "\n                </li>\n                ").concat(hideFromOverlay ? '' : additionalFeesTemplate(item), "   \n            ");
  }
  return "<li class=\"estimate\">\n                <span>".concat(saytVM.hitsrendering.estimateLabel, "</span>\n                <strong>").concat(estimates, " ").concat(item.currency, "</strong>\n            </li> ");
};
var formatEstimate = function formatEstimate(value) {
  // display 2 decimal places if there is decimal value
  // insert commas , do we have any support for this already ???
  var parts = value.toString().split(".");
  var whole = addCommas2Num(parts[0]);
  // there will only be a parts[1] if there is a decimal 
  var decs = parts[1];
  if (!decs) return whole;
  // we have decimals 
  if (decs.length < 2) decs += '0';else if (decs.length > 2) decs = decs.substring(2);
  return whole + "." + decs;
};
var LotQuantity = function LotQuantity(item) {
  // conditionally render so include markup
  if (item.bulkQuantity <= 1) return "";
  if (saytVM.featureSwitch.isNewUiSkinSearchResultEnabled) {
    return "\n                <li class=\"quantity\">\n                    <span class=\"lot-details-subtitle\">".concat(saytVM.hitsrendering.quantityLabel, "</span>\n                    <span class=\"bulk-quantity-value lot-details-subtitle-text \" data-piecemeal-enabled=\"\">").concat(addCommas2Num(item.bulkQuantity.toString()), "</span>\n                </li>\n                    ");
  }
  return "\n        <li class=\"quantity\">\n            <span>".concat(saytVM.hitsrendering.quantityLabel, "</span>\n            <strong class=\"bulk-quantity-value\" data-piecemeal-enabled=\"\">").concat(addCommas2Num(item.bulkQuantity.toString()), "</strong>\n        </li>\n    ");
};
var addCommas2Num = function addCommas2Num(numberAsString) {
  return numberAsString.replace(COMMAS_REGEX, ",");
};
var renderLotLocation = function renderLotLocation(item) {
  if (typeof item === 'undefined') return "";
  if (typeof item.lotLocation === 'undefined') {
    return "";
  } else {
    return "<div class=\"lotlocationDiv\"><span class=\"lotlocation\">".concat(saytVM.hitsrendering.locationLabel, ": <strong>").concat(item.lotLocation, "</strong></span></div>");
  }
};;"use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
// Search query parsing
var searchTermParser = function searchTermParser(query) {
  if (typeof query === 'undefined') return;
  // set space divider (encoded)
  var divider = '%20';
  var multipleSpacesRegEx = new RegExp(/ {2,}/g);
  // remove multiple spaces
  query = query.replace(multipleSpacesRegEx, ' ');
  query = encodeURI(query).toLowerCase();
  // replace any unsupported terms in the query
  query = replaceQuerySyntax(query, divider);
  // decode query
  query = decodeURI(query);
  return query;
};
var parseQueryForOptionalWords = function parseQueryForOptionalWords(query) {
  var inQuotesPattern = new RegExp(/"(.*?)"/g);
  var results = [];
  var splitedQuery = query.split(inQuotesPattern).filter(function (x) {
    return x;
  });
  var matchedWithQuotes = _toConsumableArray(query.matchAll(inQuotesPattern)).map(function (x) {
    return x[1];
  });
  splitedQuery.map(function (x) {
    return {
      item: x,
      hasQuotes: matchedWithQuotes.filter(function (f) {
        return f === x;
      }).length > 0
    };
  }).forEach(function (x) {
    return results.push.apply(results, _toConsumableArray(x.hasQuotes ? ["\"".concat(x.item, "\"")] : x.item.split(' ')));
  });
  return results.filter(function (x) {
    return x;
  });
};
var addOptionalWords = function addOptionalWords(query) {
  if (typeof query === "undefined") return [];
  var OrTerm = "or";
  query = query.toLowerCase();
  var parsedQueryParts = parseQueryForOptionalWords(query);
  var optionalWords = [];
  for (var i = 0; i < parsedQueryParts.length; i++) {
    if (parsedQueryParts[i] === OrTerm && i === 0) {
      optionalWords.push(parsedQueryParts[i + 1]);
    } else if (parsedQueryParts[i] === OrTerm && i > 0) {
      if (i - 1 > -1) {
        optionalWords.push(parsedQueryParts[i - 1]);
      }
      if (i + 1 < parsedQueryParts.length) {
        optionalWords.push(parsedQueryParts[i + 1]);
      }
    }
  }
  return _toConsumableArray(new Set(optionalWords));
};
var replaceQuerySyntax = function replaceQuerySyntax(encodedQuery, separator) {
  if (typeof encodedQuery === 'undefined') return '*'; // query gets all results

  var dict = [{
    syntax: '|',
    type: 'or',
    divAfter: true
  }, {
    syntax: '%7c',
    type: 'or',
    divAfter: true
  }, {
    syntax: 'not',
    type: '-',
    divAfter: false
  }];
  var div = typeof separator === 'undefined' ? '%20' : separator;

  // detect if encoded query has spaces (this signifies if any search syntax has been used)
  if (encodedQuery.indexOf(div) > -1) {
    var convQuery = '';
    var queryArr = encodedQuery.split(div);
    var i = 0;
    while (i < queryArr.length) {
      // make sure there is a value to work with
      if (queryArr[i] != '') {
        var queryItem = '';
        // loop through dictionary to see if we need to replace anything
        for (var d = 0; d < dict.length; d++) {
          // if our array starts with syntax that is in the dictionary
          if (queryArr[i].indexOf(dict[d].syntax) == 0) {
            // replace syntax
            if (queryArr[i] == dict[d].syntax) {
              queryItem = dict[d].type;
              // only if it is not the last term
              if (i != queryArr.length - 1) {
                // add a space afterwards if needed
                if (dict[d].divAfter) {
                  queryItem += div;
                }
                // if a replacement was made, also add next term
                queryItem += queryArr[i + 1];
                // don't forget to increment index
                i++;
              }
            }
            // for cases when the syntax is not followed by a space. E.g. not(query2)
            else {
              var brkSyntax = '(';
              var hasBrk = false;
              // if the 'not' syntax is followed by an opening bracket
              if (queryArr[i].indexOf(brkSyntax) == dict[d].syntax.length) {
                hasBrk = true;
              }
              // then replace the 'not' with a '-'
              if (hasBrk && queryArr[i].length > dict[d].syntax.length) {
                queryItem = dict[d].type + queryArr[i].substring(dict[d].syntax.length);
              }
            }
            // exit loop
            break;
          }
        }

        // build the final query
        var divBefore = i > 0 ? div : '';
        // if a replacement has occured, insert the replacement
        if (queryItem != '') {
          convQuery += divBefore + queryItem;
        }
        // otherwise insert the original item
        else {
          convQuery += divBefore + queryArr[i];
        }
      }
      // don't forget to increment index
      i++;
    }
    return convQuery;
  }

  // if there are no spaces, return query unchanged
  return encodedQuery;
};
var addEndDateTimeFilters = function addEndDateTimeFilters() {
  var currentTimeStampUtc = Math.floor(new Date().getTime() / 1000) * 1000;
  var d = new Date();
  var day = d.getUTCDate();
  var month = d.getUTCMonth();
  var year = d.getUTCFullYear();
  var previousDay = new Date(year, month, day).getTime();
  var previousDayTimeStampUtc = Math.floor(previousDay / 1000) * 1000;
  var endDateFilter = 'endDateTimeUtc >= ' + previousDayTimeStampUtc;
  var auctionDateFilter = 'auctionEndDateTimeUtc >= ' + previousDayTimeStampUtc;
  var filter = [];
  filter.push(endDateFilter);
  filter.push(auctionDateFilter);
  return filter;
};;"use strict";

var routingHelper = function () {
  var getNonFuncParams = function getNonFuncParams(location) {
    return location.search.slice(1).split('&').map(function (item) {
      var nameValue = item.split('=');
      var param;
      switch (nameValue[0].toLowerCase()) {
        case 'bbc':
          param = '&' + item;
          break;
        case 'distancelocation':
          param = '&' + item;
          break;
        case 'postcodelocation':
          param = '&' + item;
          break;
        case 'countrylocation':
          param = '&' + item;
          break;
      }
      return param;
    }).join('');
  };
  var normalizeQueryString = function normalizeQueryString(location) {
    return location.search.slice(1).split('&').map(function (item) {
      var nameValue = item.split('=');
      return nameValue[0].toLowerCase().concat('=', nameValue[1]);
    }).join('&');
  };
  var mapRouteSortBy = function mapRouteSortBy(sortBy) {
    var value = '';

    // Default to master index that uses relevance as the sort when no sort term is defined
    if (typeof sortBy === 'undefined') {
      value = saytVM.config.indexName;
    } else {
      var sortOptions = JSON.parse(saytVM.searchheader.sortOptions);
      // If the sort term is one of our sort options, use that index
      for (var i = 0; i < sortOptions.length; i++) {
        if (sortOptions[i].value.toLowerCase().endsWith(sortBy.toLowerCase())) {
          value = sortOptions[i].value;
          break;
        }
      }
      // Otherwise use a particular index
      if (value.length == 0) {
        switch (sortBy.toLowerCase()) {
          case 'startdate':
            value = "".concat(saytVM.config.indexName, "_auctionDate");
            break;
          default:
            // Always resort to the master index 
            value = saytVM.config.indexName;
            break;
        }
      }
    }
    return value;
  };
  var mapUiSortBy = function mapUiSortBy(sortTerm) {
    var value = '';
    if (typeof sortTerm === 'undefined' || sortTerm.toLowerCase() == saytVM.config.indexName) {
      value = 'Relevance';
    } else {
      var sortOptions = JSON.parse(saytVM.searchheader.sortOptions);
      for (var i = 0; i < sortOptions.length; i++) {
        if (sortTerm == sortOptions[i].value) {
          value = sortOptions[i].value.substring(sortOptions[i].value.lastIndexOf('_') + 1);
          break;
        }
      }
    }
    return value;
  };
  return {
    getNonFuncParams: getNonFuncParams,
    normalizeQueryString: normalizeQueryString,
    mapRouteSortBy: mapRouteSortBy,
    mapUiSortBy: mapUiSortBy
  };
}();;"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var searchRouting = function searchRouting(routingHelper) {
  var searchUrl = 'search-results';
  var searchEndpoints = ['search-results', 'search-filter'];
  var router = instantsearch.routers.history({
    // Update title in browser window
    windowTitle: function windowTitle(_ref) {
      var searchterm = _ref.searchterm;
      var metaTitle = '';
      // if search term is empty insert asterix to indicate all results are being returned
      var query = searchterm ? escapeHTML(searchterm) : '*';
      // as the search term is inputted, update the title
      // check we are on the search pages
      var isSearchResultsPage = false;
      for (var i = 0; i < searchEndpoints.length; i++) {
        if (document.title.indexOf(searchEndpoints[i]) > -1) {
          isSearchResultsPage = true;
        }
      }
      // if enhanced search is enabled and we are on a search page
      if (typeof saytVM !== 'undefined' && isSearchResultsPage) {
        metaTitle = saytVM.config.metaTitle.replace('$SearchTerm$', query);
      }
      // otherwise use the existing title
      else {
        metaTitle = document.title;
      }
      return metaTitle;
    },
    // Create URL reflecting interaction with UI
    createURL: function createURL(_ref2) {
      var qsModule = _ref2.qsModule,
        routeState = _ref2.routeState,
        location = _ref2.location;
      var regExp, urlParts, baseUrl;
      for (var i = 0; i < searchEndpoints.length; i++) {
        // Make sure url before endpoint persists
        regExp = new RegExp("^(.*?)/".concat(searchEndpoints[i]));
        urlParts = location.href.match(regExp);
        if (urlParts) {
          // Once we have a match, set base url and exit loop
          baseUrl = urlParts[1] + '/';
          break;
        }
      }
      // Create encoded string of parameters to display
      var queryString = qsModule.stringify(routeState, {
        addQueryPrefix: true,
        arrayFormat: 'repeat'
      });
      // Get parameters that do not affect the search results
      var nonFuncParams = routingHelper.getNonFuncParams(location);
      return "".concat(baseUrl).concat(searchUrl).concat(queryString).concat(nonFuncParams);
    },
    // For when the page loads (including navigating back and forwards in the browser)
    parseURL: function parseURL(_ref3) {
      var qsModule = _ref3.qsModule,
        location = _ref3.location;
      // format parameters in the URL
      var queryString = routingHelper.normalizeQueryString(location);

      // Parse the location string and assign parameters
      var _qsModule$parse = qsModule.parse(queryString),
        _qsModule$parse$searc = _qsModule$parse.searchterm,
        searchterm = _qsModule$parse$searc === void 0 ? '' : _qsModule$parse$searc,
        page = _qsModule$parse.page,
        sortterm = _qsModule$parse.sortterm,
        pagesize = _qsModule$parse.pagesize,
        categorycode = _qsModule$parse.categorycode,
        brand = _qsModule$parse.brand,
        type = _qsModule$parse.type,
        countrycode = _qsModule$parse.countrycode,
        auctiontype = _qsModule$parse.auctiontype,
        clientid = _qsModule$parse.clientid,
        hasimage = _qsModule$parse.hasimage,
        mastercategorycode = _qsModule$parse.mastercategorycode,
        bbc = _qsModule$parse.bbc,
        publisheddatetimeutc = _qsModule$parse.publisheddatetimeutc,
        lowestimate = _qsModule$parse.lowestimate,
        highestimate = _qsModule$parse.highestimate,
        distancelocation = _qsModule$parse.distancelocation,
        postcodelocation = _qsModule$parse.postcodelocation,
        countrylocation = _qsModule$parse.countrylocation,
        exactmatch = _qsModule$parse.exactmatch;
      return {
        searchterm: decodeURIComponent(searchterm),
        page: page,
        sortterm: sortterm,
        pagesize: pagesize,
        categorycode: categorycode,
        brand: brand,
        type: type,
        countrycode: countrycode,
        auctiontype: auctiontype,
        clientid: clientid,
        hasimage: hasimage,
        mastercategorycode: mastercategorycode,
        bbc: bbc,
        publisheddatetimeutc: publisheddatetimeutc,
        lowestimate: lowestimate,
        highestimate: highestimate,
        distancelocation: distancelocation,
        postcodelocation: postcodelocation,
        countrylocation: countrylocation,
        exactmatch: exactmatch
      };
    },
    // Help performance by delaying the update of the URL in the address bar
    writeDelay: 400
  });
  var stateMapping = {
    // Reflect amy UI changes back to the url parameters
    stateToRoute: function stateToRoute(uiState) {
      var indexName = saytVM.config.indexName;
      var indexUiState = uiState[indexName];
      var query = indexUiState.query,
        page = indexUiState.page,
        sortBy = indexUiState.sortBy,
        hitsPerPage = indexUiState.hitsPerPage,
        refinementList = indexUiState.refinementList,
        menu = indexUiState.menu,
        range = indexUiState.range,
        exactMatch = indexUiState.exactMatch;
      return {
        searchterm: query,
        page: page,
        sortterm: typeof sortBy !== 'undefined' ? routingHelper.mapUiSortBy(sortBy) : undefined,
        pagesize: hitsPerPage,
        categorycode: typeof refinementList !== 'undefined' ? refinementList && refinementList.categoryCode && refinementList.categoryCode.join('~') : undefined,
        brand: typeof refinementList !== 'undefined' ? refinementList && refinementList.makes && refinementList.makes.join('~') : undefined,
        type: typeof refinementList !== 'undefined' ? refinementList && refinementList.items && refinementList.items.join('~') : undefined,
        countrycode: typeof refinementList !== 'undefined' ? refinementList && refinementList.countryName && refinementList.countryName.join('~') : undefined,
        auctiontype: typeof menu !== 'undefined' ? menu && menu.auctionDisplayType : undefined,
        clientid: typeof refinementList !== 'undefined' ? refinementList && refinementList.auctioneerName && refinementList.auctioneerName.join('~') : undefined,
        hasimage: typeof refinementList !== 'undefined' ? refinementList && refinementList.hasImages && refinementList.hasImages.join('~') : undefined,
        mastercategorycode: typeof menu !== 'undefined' ? menu && menu.masterCategoryCode : undefined,
        publisheddatetimeutc: typeof range !== 'undefined' ? range && getPublishedDateTimeFromRangeUTC(range.publishedDateTimeUtc) : undefined,
        lowestimate: typeof range !== 'undefined' ? range && addRemoveColonFromRangeValues(range.lowEstimate) : undefined,
        highestimate: typeof range !== 'undefined' ? range && addRemoveColonFromRangeValues(range.highEstimate) : undefined,
        exactmatch: exactMatch === true ? true : undefined
      };
    },
    // Map the url parameters to the UI
    routeToState: function routeToState(routeState) {
      var indexName = saytVM.config.indexName;
      var searchterm = routeState.searchterm,
        page = routeState.page,
        sortterm = routeState.sortterm,
        pagesize = routeState.pagesize,
        categorycode = routeState.categorycode,
        brand = routeState.brand,
        type = routeState.type,
        countrycode = routeState.countrycode,
        auctiontype = routeState.auctiontype,
        clientid = routeState.clientid,
        hasimage = routeState.hasimage,
        mastercategorycode = routeState.mastercategorycode,
        publisheddatetimeutc = routeState.publisheddatetimeutc,
        lowestimate = routeState.lowestimate,
        highestimate = routeState.highestimate,
        exactmatch = routeState.exactmatch;
      var state = {
        query: searchterm != '' ? searchterm : '',
        page: page !== 1 ? page : undefined,
        sortBy: sortterm == 'Relevance' || sortterm != '' ? routingHelper.mapRouteSortBy(sortterm) : undefined,
        hitsPerPage: pagesize != '' ? pagesize : undefined,
        refinementList: {
          categoryCode: categorycode != '' ? categorycode && categorycode.split('~') : undefined,
          makes: brand != '' ? brand && brand.split('~') : undefined,
          items: type != '' ? type && type.split('~') : undefined,
          countryName: countrycode != '' ? countrycode && countrycode.split('~') : undefined,
          auctioneerName: clientid != '' ? clientid && clientid.split('~') : undefined,
          hasImages: typeof hasimage !== 'undefined' ? hasimage.toLowerCase() && hasimage.toLowerCase().split('~') : undefined
        },
        menu: {
          auctionDisplayType: auctiontype != '' ? auctiontype : undefined,
          masterCategoryCode: mastercategorycode != '' ? mastercategorycode : undefined
        },
        range: {
          publishedDateTimeUtc: typeof publisheddatetimeutc !== 'undefined' ? getPublishedRangeUTC(publisheddatetimeutc) : undefined,
          lowEstimate: typeof lowestimate !== 'undefined' ? addRemoveColonFromRangeValues(lowestimate) : undefined,
          highEstimate: typeof highestimate !== 'undefined' ? addRemoveColonFromRangeValues(highestimate, true) : undefined
        },
        exactMatch: exactmatch && exactmatch.toLowerCase() === 'true' ? true : undefined
      };
      return _defineProperty({}, indexName, state);
    }
  };
  return {
    router: router,
    stateMapping: stateMapping
  };
};;"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var searchRoutingOnLandingPage = function searchRoutingOnLandingPage(routingHelper) {
  var searchUrl = 'search-filter';
  var pageQSParam = 'page';
  var pageSizeQSParam = 'pagesize';
  var queryStringContainsParametersOtherThenPaging = function queryStringContainsParametersOtherThenPaging(qs) {
    var urlParams = new URLSearchParams(qs);
    var keys = urlParams.keys();
    var _iterator = _createForOfIteratorHelper(keys),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var key = _step.value;
        if (key != null && key.toLowerCase() != pageQSParam && key.toLowerCase() != pageSizeQSParam) {
          return true;
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    return false;
  };
  var router = instantsearch.routers.history({
    windowTitle: function windowTitle() {
      return document.title;
    },
    createURL: function createURL(_ref) {
      var qsModule = _ref.qsModule,
        routeState = _ref.routeState,
        location = _ref.location;
      var baseUrl = location.href;
      var regExp = new RegExp(/^(.*?)(\/search-filter|\?.*)/);
      var urlParts = location.href.match(regExp);
      if (urlParts) {
        baseUrl = urlParts[1];
      }
      var queryString = qsModule.stringify(routeState, {
        addQueryPrefix: true,
        arrayFormat: 'repeat'
      });
      var nonFuncParams = routingHelper.getNonFuncParams(location);
      var urlSegments = [baseUrl];
      if (queryString || nonFuncParams) {
        var searchUrlPart = queryStringContainsParametersOtherThenPaging(queryString) ? searchUrl : '';
        var searchUrlPartSeparator = searchUrlPart != '' ? '/' : '';
        urlSegments = [].concat(_toConsumableArray(urlSegments), [searchUrlPartSeparator, searchUrlPart, queryString, nonFuncParams]);
      }
      return urlSegments.join('');
    },
    parseURL: function parseURL(_ref2) {
      var qsModule = _ref2.qsModule,
        location = _ref2.location;
      var queryString = routingHelper.normalizeQueryString(location);
      var parsedQueryString = qsModule.parse(queryString);
      parsedQueryString.mastercategorycode = saytVM.landingPage.masterCategoryCode;
      parsedQueryString.searchterm = decodeURIComponent(parsedQueryString.searchterm || '');
      if (saytVM.landingPage.isSubCategoryPage) {
        parsedQueryString.categorycode = saytVM.landingPage.subCategoryCode;
      }
      if (saytVM.landingPage.hideBrand) {
        parsedQueryString.brand = saytVM.landingPage.brand;
      }
      if (saytVM.landingPage.hideItemType) {
        parsedQueryString.type = saytVM.landingPage.itemType;
      }
      return parsedQueryString;
    },
    writeDelay: 400
  });
  var stateMapping = {
    stateToRoute: function stateToRoute(uiState) {
      var indexName = saytVM.config.indexName;
      var indexUiState = uiState[indexName];
      var query = indexUiState.query,
        page = indexUiState.page,
        sortBy = indexUiState.sortBy,
        hitsPerPage = indexUiState.hitsPerPage,
        refinementList = indexUiState.refinementList,
        menu = indexUiState.menu,
        range = indexUiState.range;
      var refinementListValue = function refinementListValue(key) {
        return refinementList && refinementList[key] && refinementList[key].join('~');
      };
      return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
        searchterm: query,
        page: page,
        sortterm: sortBy && routingHelper.mapUiSortBy(sortBy),
        pagesize: hitsPerPage
      }, !saytVM.landingPage.isSubCategoryPage && {
        categorycode: refinementListValue('categoryCode')
      }), !saytVM.landingPage.hideBrand && {
        brand: refinementListValue('makes')
      }), !saytVM.landingPage.hideItemType && {
        type: refinementListValue('items')
      }), {}, {
        countrycode: refinementListValue('countryName'),
        auctiontype: menu && menu.auctionDisplayType,
        clientid: refinementListValue('auctioneerName'),
        hasimage: refinementListValue('hasImages'),
        publisheddatetimeutc: range && getPublishedDateTimeFromRangeUTC(range.publishedDateTimeUtc),
        lowestimate: range && addRemoveColonFromRangeValues(range.lowEstimate),
        highestimate: range && addRemoveColonFromRangeValues(range.highEstimate)
      });
    },
    routeToState: function routeToState(routeState) {
      var indexName = saytVM.config.indexName;
      var searchterm = routeState.searchterm,
        page = routeState.page,
        sortterm = routeState.sortterm,
        pagesize = routeState.pagesize,
        categorycode = routeState.categorycode,
        brand = routeState.brand,
        type = routeState.type,
        countrycode = routeState.countrycode,
        auctiontype = routeState.auctiontype,
        clientid = routeState.clientid,
        hasimage = routeState.hasimage,
        publisheddatetimeutc = routeState.publisheddatetimeutc,
        lowestimate = routeState.lowestimate,
        highestimate = routeState.highestimate;
      var refinementListValue = function refinementListValue(value) {
        return value && value.split('~');
      };
      var state = {
        query: searchterm || '',
        page: page !== 1 ? page : undefined,
        sortBy: sortterm === 'Relevance' || sortterm && routingHelper.mapRouteSortBy(sortterm),
        hitsPerPage: pagesize,
        refinementList: {
          categoryCode: refinementListValue(categorycode),
          makes: refinementListValue(brand),
          items: refinementListValue(type),
          countryName: refinementListValue(countrycode),
          auctioneerName: refinementListValue(clientid),
          hasImages: refinementListValue(hasimage)
        },
        menu: {
          auctionDisplayType: auctiontype,
          masterCategoryCode: saytVM.landingPage.masterCategoryCode
        },
        range: {
          publishedDateTimeUtc: getPublishedRangeUTC(publisheddatetimeutc),
          lowEstimate: addRemoveColonFromRangeValues(lowestimate),
          highEstimate: addRemoveColonFromRangeValues(highestimate, true)
        }
      };
      return _defineProperty({}, indexName, state);
    }
  };
  return {
    router: router,
    stateMapping: stateMapping
  };
};;"use strict";

var renderSearchbox = function renderSearchbox(renderOptions, isFirstRender) {
  var SEARCHTERMID = 'main-search-term';
  var query = renderOptions.query,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container,
    searchAsYouType = widgetParams.searchAsYouType;

  // Overlay creates the searchbox but ensure query is updated for results page
  if (isFirstRender) {
    var _searchInput = container.querySelector("#".concat(SEARCHBOXID));
    if (_searchInput) {
      // If a search has been already been performed, set the value of the input onload
      if (query.length > 0) {
        _searchInput.value = query;
      }
      // Update search results as the customer types the query
      _searchInput.addEventListener('input', function (event) {
        event.preventDefault();
        if (searchAsYouType && !showOverlayOnSearchResults) {
          refine(event.target.value);
        }
      });
    }
  }
  var searchInput = document.querySelector("#".concat(SEARCHTERMID));
  if (searchInput) {
    searchInput.value = query;
  }
};
var customSearchbox = instantsearch.connectors.connectSearchBox(renderSearchbox);;"use strict";

var renderBreadCrumbsNewUiSkin = function renderBreadCrumbsNewUiSkin(renderOptions, isFirstRender) {
  var query = renderOptions.query,
    widgetParams = renderOptions.widgetParams;
  var searchTerm = displaySearchTerm(query);
  widgetParams.container.innerHTML = "<span>".concat(escapeHTML(searchTerm), "</span>");
};
var renderBreadCrumbsEntry = function renderBreadCrumbsEntry(renderOptions, isFirstRender) {
  if (saytVM.featureSwitch.isLandingPage) {
    return;
  } else if (saytVM.featureSwitch.isNewUiSkinSearchResultEnabled) {
    renderBreadCrumbsNewUiSkin(renderOptions, isFirstRender);
  }
};
var customBreadCrumbs = instantsearch.connectors.connectStats(renderBreadCrumbsEntry);;"use strict";

var renderPageHeader = function renderPageHeader(renderOptions, isFirstRender) {
  var nbHits = renderOptions.nbHits,
    query = renderOptions.query,
    widgetParams = renderOptions.widgetParams;
  var searchTerm = displaySearchTerm(query);
  if (!isFirstRender) {
    var headingTxt = '';
    if (typoTolerance) {
      headingTxt = saytVM.pageheader.listingPageHeadingTypo;
      headingTxt = headingTxt.replace('$SearchTerm$', "<h1>".concat(escapeHTML(searchTerm), "</h1>"));
      headingTxt = headingTxt.replace('$NumberOfResults$', nbHits);
      if (nbHits == 1) {
        headingTxt = headingTxt.replace('have', 'has');
      }
    } else {
      headingTxt = saytVM.pageheader.listingPageHeading;
      headingTxt = headingTxt.replace('$SearchTerm$', "<h1>".concat(escapeHTML(searchTerm), "</h1>"));
      headingTxt = headingTxt.replace('$NumberOfResults$', nbHits > 0 ? nbHits : saytVM.pageheader.noLabel);
    }
    if (nbHits == 1) {
      headingTxt = headingTxt.replace('item(s)', 'item');
    } else {
      headingTxt = headingTxt.replace('item(s)', 'items');
    }
    widgetParams.container.innerHTML = "<span class=\"searchResultsHeading\">".concat(headingTxt, "</span>").concat(instantSearchHelp());
  }
};
var renderPageHeaderNewUiSkin = function renderPageHeaderNewUiSkin(renderOptions, isFirstRender) {
  var nbHits = renderOptions.nbHits,
    query = renderOptions.query,
    widgetParams = renderOptions.widgetParams;
  if (!isFirstRender) {
    var searchTerm = displaySearchTerm(query);
    var nbHitsTxt = "<span class=\"search-results-items search-results-items-mobile\">".concat(nbHits, " ").concat(nbHits == 1 ? 'item' : 'items', "</span>");
    if (widgetParams.container) {
      widgetParams.container.innerHTML = "<span class=\"searchResultsHeading\"><h1>".concat(escapeHTML(searchTerm), "</h1></span>").concat(nbHitsTxt);
    }
  }
};
var customPageHeader = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectStats(renderPageHeaderNewUiSkin) : instantsearch.connectors.connectStats(renderPageHeader);
var displaySearchTerm = function displaySearchTerm(query) {
  var searchTerm = '';
  var div = '=';
  var defaultQuery = '*';
  var params = window.location.search.substr(1).split('&');
  // if the url has parameters, work through these first
  if (params.length > 0) {
    params.map(function (item) {
      // params should have an equals sign
      if (item.indexOf(div) > -1) {
        var nameVal = item.split(div);
        // if we have a master category code parameter, return the category name
        // and ignore the search term if it is present
        // (always make sure the master category code is lowercase)
        switch (nameVal[0].toLowerCase()) {
          case 'mastercategorycode':
            searchTerm = window.categoryNameLookup[nameVal[1]];
            break;
        }
      }
    });
  }
  // otherwise get the search term from the query submitted to algolia
  if (searchTerm.length == 0) {
    searchTerm = query.length > 0 ? query : defaultQuery;
  }
  return searchTerm;
};
var instantSearchHelp = function instantSearchHelp() {
  var showHelp = false,
    helpTxt = '',
    helpUrl = '';
  if (saytVM.searchheader.showHelp) {
    showHelp = saytVM.searchheader.showHelp.toLowerCase() == 'true' ? true : false;
    if (saytVM.searchheader.helpTxt) {
      helpTxt = saytVM.searchheader.helpTxt;
    }
    if (saytVM.searchheader.helpUrl) {
      helpUrl = saytVM.searchheader.helpUrl;
    }
  }
  if (showHelp) {
    return "<h3 class=\"instantSearchHelp\"><a href=\"".concat(helpUrl, "\" target=\"_blank\">").concat(helpTxt, "</a></h3>");
  }
  return '';
};;"use strict";

var DEFAULTPAGESIZE = 60;
// Sort by drop-down and view type switch
var renderSortByViewType = function renderSortByViewType(renderOptions, isFirstRender) {
  var options = renderOptions.options,
    currentRefinement = renderOptions.currentRefinement,
    hasNoResults = renderOptions.hasNoResults,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container;
  if (isFirstRender) {
    container.innerHTML = "\n            <div class=\"pagination-sort-container\">\n                <div class=\"pagination-sort\">\n                    <label for=\"sortBy\" class=\"label\">".concat(saytVM.searchheader.sortLabel, "</label>\n                    <select name=\"sortBy\" id=\"sortBy\">\n                    </select>\n                </div>\n                <ul class=\"display-type\">\n                    ").concat(saytVM.searchheader.infiniteListHeaderViews.split(',').map(function (item) {
      return "<li id=\"".concat(item.toLowerCase(), "_Select\" class=\"").concat(item.toLowerCase(), "\" onclick=\"saytSetInfiniteListView('").concat(item.toLowerCase(), "')\"><span>").concat(item, "</span></li>");
    }).join(''), "\n                </ul>\n            </div>\n        ");
    var _select = container.querySelector('#sortBy');
    _select.addEventListener('change', function (event) {
      refine(event.target.value);
    });
  }
  if (hasNoResults) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
  var select = widgetParams.container.querySelector('#sortBy');
  select.innerHTML = "\n        ".concat(options.map(function (option) {
    return "<option value=\"".concat(option.value, "\" ").concat(option.value === currentRefinement ? 'selected' : '', ">").concat(option.label, "</option>");
  }).join(''), "\n    ");
};
var renderSortByViewTypeNewUiSkin = function renderSortByViewTypeNewUiSkin(renderOptions, isFirstRender) {
  var options = renderOptions.options,
    currentRefinement = renderOptions.currentRefinement,
    hasNoResults = renderOptions.hasNoResults,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container;
  if (isFirstRender) {
    container.innerHTML = " \n            <div class=\"pagination-sort-container\"> \n                <ul class=\"display-type\">\n                    ".concat(saytVM.searchheader.infiniteListHeaderViews.split(',').map(function (item) {
      return "<li id=\"".concat(item.toLowerCase(), "_Select\" class=\"").concat(item.toLowerCase(), "\" onclick=\"saytSetInfiniteListView('").concat(item.toLowerCase(), "')\"><span>").concat(item, "</span></li>");
    }).join(''), "\n                </ul>\n                <div class=\"pagination-sort\">\n                    <select name=\"sortBy\" id=\"sortBy\" class=\"ui dropdown filters-dropdown filters-header\"></select>\n                </div>\n            </div>\n        ");
    var _select2 = container.querySelector('#sortBy');
    _select2.addEventListener('change', function (event) {
      refine(event.target.value);
    });
  }
  if (hasNoResults) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
  var select = widgetParams.container.querySelector('#sortBy');
  select.innerHTML = "\n        ".concat(options.map(function (option) {
    return "<option value=\"".concat(option.value, "\" ").concat(option.value === currentRefinement ? 'selected' : '', ">").concat(option.label, "</option>");
  }).join(''), "\n    ");
};
var customSortByViewType = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectSortBy(renderSortByViewTypeNewUiSkin) : instantsearch.connectors.connectSortBy(renderSortByViewType);

// Sort by drop-down for mobile
var renderSortMobile = function renderSortMobile(renderOptions, isFirstRender) {
  var options = renderOptions.options,
    currentRefinement = renderOptions.currentRefinement,
    hasNoResults = renderOptions.hasNoResults,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container;
  if (isFirstRender) {
    container.innerHTML = "\n                <div>\n                    <label for=\"sortBy\" class=\"label\">".concat(saytVM.searchheader.sortLabel, "</label>\n                    <select name=\"sortBy\" id=\"sortBy\" ").concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'class="ui dropdown filters-dropdown"' : '', ">\n                    </select>\n                </div>\n        ");
    var _select3 = container.querySelector('#sortBy');
    _select3.addEventListener('change', function (event) {
      refine(event.target.value);
    });
  }
  if (hasNoResults) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
  var select = widgetParams.container.querySelector('#sortBy');
  select.innerHTML = "\n        ".concat(options.map(function (option) {
    return "<option value=\"".concat(option.value, "\" ").concat(option.value === currentRefinement ? 'selected' : '', ">").concat(option.label, "</option>");
  }).join(''), "\n    ");
};
var customSortMobile = instantsearch.connectors.connectSortBy(renderSortMobile);

// Display switch
function saytSetInfiniteListView(viewType, dontSetCookie) {
  // Set the view class on the results container. 
  $('.region-main').removeClass('view-type-list').removeClass('view-type-grid').addClass('view-type-' + viewType);
  $('#results').removeClass().addClass(viewType);
  // Hack for Webkits to force a re-draw - re-paint to display grid and list views (in jquery)
  $('#results').hide().show(0);
  if (dontSetCookie) {
    return;
  }
  // Save selected view type as cookie
  SetCookie(saytVM.searchheader.viewTypeCookie, viewType, 365);
}
function esJumpToTop() {
  $('html, body').animate({
    scrollTop: 0
  }, 'fast');
}

// Page size options
var renderPageSize = function renderPageSize(renderOptions, isFirstRender) {
  var items = renderOptions.items,
    hasNoResults = renderOptions.hasNoResults,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var cookieKey = saytVM.searchheader.pageSizeCookie;
  var defaultItem = items.find(function (x) {
    if (x.default) return x;
  });
  var defaultVal = defaultItem ? defaultItem.value : items && items.length > 0 && items[0].value ? items[0].value : DEFAULTPAGESIZE;
  var container = widgetParams.container;
  var saytGetOrSetTheDefaultPageSizeCookie = function saytGetOrSetTheDefaultPageSizeCookie(cookieKey, defaultVal) {
    var isIpadVersionLessThen = function isIpadVersionLessThen(minVersion) {
      var pattern = /iPad.+CPU OS (\d+)_/;
      var userAgent = navigator.userAgent;
      var match = pattern.exec(userAgent);
      if (match == null || match.length !== 2) {
        return false;
      }
      var currentIosVersion = parseInt(match[1]);
      return currentIosVersion < minVersion;
    };
    var pagingVal = GetCookie(cookieKey);
    if (isIpadVersionLessThen(9)) {
      pagingVal = "60";
      SetCookie(cookieKey, pagingVal, '100');
      $(".page-size").hide();
    }
    if (!pagingVal) {
      //Default, PageSize from model will be the config value default unless a cookie was found (on server and passed to model).
      SetCookie(cookieKey, defaultVal, '100');
      pagingVal = defaultVal;
    }
    ;
    return pagingVal;
  };
  if (isFirstRender) {
    var _sizeList = document.createElement('ul');
    _sizeList.setAttribute('id', 'pageSizeOptionContainer_' + widgetParams.position);
    _sizeList.setAttribute('class', 'page-size pageSize');
    _sizeList.setAttribute('data-user-preference-pagesize-cookie-key', cookieKey);
    _sizeList.setAttribute('data-default-page-size', defaultVal);
    _sizeList.setAttribute('data-search-url', document.location);
    container.appendChild(_sizeList);

    // Get the paging size from the cookie
    // Refine search if it is different
    var pagingVal = saytGetOrSetTheDefaultPageSizeCookie(cookieKey, defaultVal);
    if (pagingVal != defaultVal && items.map(function (x) {
      return x.value;
    }).includes(pagingVal)) {
      refine(pagingVal);
    }
  }
  var sizeList = container.querySelector('ul');
  sizeList.innerHTML = "<li>".concat(saytVM.searchheader.pageSizeLabel, "</li>\n                ").concat(items.map(function (item) {
    return "<li><span class=\"pageSizeOption ".concat(item.isRefined ? 'active' : '', "\">").concat(item.label, "</span></li>");
  }).join(''), "\n                ");
  var sizeOptions = container.querySelectorAll('span.pageSizeOption');
  for (var i = 0; i < sizeOptions.length; i++) {
    sizeOptions[i].addEventListener('click', function (event) {
      event.preventDefault();
      // Update user preference cookie
      SetCookie(cookieKey, event.target.innerText, '100');
      esJumpToTop();
      refine(event.target.innerText);
    });
  }
  if (hasNoResults) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
};
var renderPageSizeNewUiSkin = function renderPageSizeNewUiSkin(renderOptions, isFirstRender) {
  var hasNoResults = renderOptions.hasNoResults,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var items = renderOptions.items.filter(function (x) {
    return x.value;
  });
  var cookieKey = saytVM.searchheader.pageSizeCookie;
  var defaultItem = items.find(function (x) {
    if (x.default) return x;
  });
  var defaultVal = defaultItem ? defaultItem.value : items && items.length > 0 && items[0].value ? items[0].value : DEFAULTPAGESIZE;
  var container = widgetParams.container;
  if (widgetParams.position !== 'top') {
    return;
  }
  var saytGetOrSetTheDefaultPageSizeCookie = function saytGetOrSetTheDefaultPageSizeCookie(cookieKey, defaultVal) {
    var isIpadVersionLessThen = function isIpadVersionLessThen(minVersion) {
      var pattern = /iPad.+CPU OS (\d+)_/;
      var userAgent = navigator.userAgent;
      var match = pattern.exec(userAgent);
      if (match == null || match.length !== 2) {
        return false;
      }
      var currentIosVersion = parseInt(match[1]);
      return currentIosVersion < minVersion;
    };
    var pagingVal = GetCookie(cookieKey);
    if (isIpadVersionLessThen(9)) {
      pagingVal = "60";
      SetCookie(cookieKey, pagingVal, '100');
      $(".page-size").hide();
    }
    if (!pagingVal) {
      //Default, PageSize from model will be the config value default unless a cookie was found (on server and passed to model).
      SetCookie(cookieKey, defaultVal, '100');
      pagingVal = defaultVal;
    }
    ;
    return pagingVal;
  };
  if (isFirstRender) {
    if (items.length > 1) {
      var sizeListElement = document.createElement('select');
      sizeListElement.setAttribute('id', 'pageSizeOptionContainer_' + widgetParams.position);
      sizeListElement.setAttribute('class', 'page-size pageSize ui dropdown filters-dropdown filters-header');
      container.appendChild(sizeListElement);

      // Get the paging size from the cookie
      // Refine search if it is different
      var pagingVal = saytGetOrSetTheDefaultPageSizeCookie(cookieKey, defaultVal);
      if (pagingVal != defaultVal && items.map(function (x) {
        return x.value;
      }).includes(pagingVal)) {
        refine(pagingVal);
      }
      var sizeList = container.querySelector('select');
      sizeList.innerHTML = items.map(function (item) {
        return "<option value=\"".concat(item.value, "\" ").concat(item.isRefined ? 'selected' : '', ">").concat(item.label, "</option>");
      }).join('');
      sizeList.addEventListener('change', function (event) {
        event.preventDefault();
        // Update user preference cookie
        SetCookie(cookieKey, event.target.value, '100');
        esJumpToTop();
        refine(event.target.value);
      });
    } else {
      var sizeElement = document.createElement('span');
      sizeElement.setAttribute('class', 'page-size-label');
      sizeElement.innerHTML = items[0].value;
      container.appendChild(sizeElement);
      refine(items[0].value);
    }
    var perPageElement = document.createElement('span');
    perPageElement.setAttribute('class', 'page-size-label');
    perPageElement.setAttribute('id', 'pageSizeLabel');
    container.appendChild(perPageElement);
    var perPage = container.querySelector('#pageSizeLabel');
    perPage.innerHTML = saytVM.searchheader.perPageLabel;
  }
  if (hasNoResults) {
    container.style.display = 'none';
  } else {
    container.style.display = 'flex';
  }
};
var customPageSize = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectHitsPerPage(renderPageSizeNewUiSkin) : instantsearch.connectors.connectHitsPerPage(renderPageSize);

// Pagination controls
var renderPagination = function renderPagination(renderOptions, isFirstRender) {
  var currentRefinement = renderOptions.currentRefinement,
    nbPages = renderOptions.nbPages,
    nbHits = renderOptions.nbHits,
    refine = renderOptions.refine,
    createURL = renderOptions.createURL,
    widgetParams = renderOptions.widgetParams;
  if (widgetParams.position === 'top') {
    return;
  }
  var container = widgetParams.container;
  var cookieKey = saytVM.searchheader.pageSizeCookie;
  var pagingVal = GetCookie(cookieKey) > 0 && JSON.parse(saytVM.searchheader.pageSizeOptions).map(function (x) {
    return x.value;
  }).includes(GetCookie(cookieKey)) ? GetCookie(cookieKey) : DEFAULTPAGESIZE;
  var pagingDomContainer = $("#" + container.id);
  if (nbPages > 0) {
    pagingDomContainer.data('currentPageNumber', currentRefinement + 1);
    pagingDomContainer.data('pages', nbPages);
    pagingDomContainer.data('baseUrl', createURL());
    pagingDomContainer.attr('update', true);
  }
  var observer = new MutationObserver(function () {
    var nextPrev = widgetParams.container.querySelectorAll('a:not(.disabled)');
    for (var i = 0; i < nextPrev.length; i++) {
      nextPrev[i].addEventListener('click', function (event) {
        event.preventDefault();
        refine(event.currentTarget.dataset.value - 1);
        esJumpToTop();
      });
    }
    this.disconnect();
  });
  if (container) {
    observer.observe(container, {
      childList: true
    });
  }
  if (nbHits == 0 || nbHits < pagingVal) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
};
var renderPaginationNewUiSkin = function renderPaginationNewUiSkin(renderOptions, isFirstRender) {
  var currentRefinement = renderOptions.currentRefinement,
    nbPages = renderOptions.nbPages,
    nbHits = renderOptions.nbHits,
    refine = renderOptions.refine,
    createURL = renderOptions.createURL,
    widgetParams = renderOptions.widgetParams;
  if (widgetParams.position === 'top') {
    return;
  }
  var container = widgetParams.container;
  var cookieKey = saytVM.searchheader.pageSizeCookie;
  var pagingVal = GetCookie(cookieKey) > 0 && JSON.parse(saytVM.searchheader.pageSizeOptions).map(function (x) {
    return x.value;
  }).includes(GetCookie(cookieKey)) ? GetCookie(cookieKey) : DEFAULTPAGESIZE;
  var pagingDomContainer = $("#" + container.id);
  if (nbPages > 0) {
    pagingDomContainer.data('currentPageNumber', currentRefinement + 1);
    pagingDomContainer.data('pages', nbPages);
    pagingDomContainer.data('baseUrl', createURL());
    pagingDomContainer.attr('update', true);
  }
  var desktopView = window.matchMedia('(min-width: 1200px)');
  function dropdownInit(e) {
    if (e.matches) {
      $('.ui.dropdown').dropdown();
    }
  }
  dropdownInit(desktopView);
  var observer = new MutationObserver(function () {
    var nextPrev = widgetParams.container.querySelectorAll('a:not(.disabled)');
    for (var i = 0; i < nextPrev.length; i++) {
      nextPrev[i].addEventListener('click', function (event) {
        event.preventDefault();
        refine(event.currentTarget.dataset.value - 1);
        esJumpToTop();
      });
    }
    this.disconnect();
  });
  if (container) {
    observer.observe(container, {
      childList: true
    });
  }
  if (nbHits == 0 || nbHits < pagingVal) {
    container.style.display = 'none';
  } else {
    container.style.display = 'block';
  }
};
var customPagination = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectPagination(renderPaginationNewUiSkin) : instantsearch.connectors.connectPagination(renderPagination);

// Result Pagination controls
var renderResultsInfo = function renderResultsInfo(renderOptions, isFirstRender) {
  // In previous version of search, we don't change of result info - stay it empty.
};
var renderResultsInfoNewUiSkin = function renderResultsInfoNewUiSkin(renderOptions, isFirstRender) {
  var pages = renderOptions.pages,
    currentRefinement = renderOptions.currentRefinement,
    nbPages = renderOptions.nbPages,
    nbHits = renderOptions.nbHits,
    isFirstPage = renderOptions.isFirstPage,
    isLastPage = renderOptions.isLastPage,
    refine = renderOptions.refine,
    createURL = renderOptions.createURL,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container;
  var culture = saytVM.config.culture;
  var numberOfAll = nbHits.toLocaleString(culture);
  var paginationInfo = saytVM.searchheader.foundLabel;
  paginationInfo = paginationInfo.replace('$NumberOfAll$', numberOfAll);
  if (nbHits == 1) {
    paginationInfo = paginationInfo.replace('items', 'item');
  }
  container.innerHTML = paginationInfo;
};
var customResultsInfo = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectPagination(renderResultsInfoNewUiSkin) : instantsearch.connectors.connectPagination(renderResultsInfo);;"use strict";

var additionalFeesTemplate = function additionalFeesTemplate(item) {
  if (typeof item === 'undefined' || saytVM.config.platform == 'BSC') return "";
  if (saytVM.featureSwitch.isNewUiSkinSearchResultEnabled) {
    return " \n                <div class=\"tooltip\">\n                <div class=\"ui custom popup bottom center transition \" id=\"popup-".concat(item.objectID, "\">\n                <div class=\"popup-icon\">\n                </div>\n\n                    </span>\n                    <p><strong>").concat(saytVM.additionalfees.additionalFeesLabel, ":</strong>\n                    </p>\n                    <div class=\"results-loader\" style=\"width: 10%; margin: 0 auto;\">\n                        <div>\n                            <img src=\"/content/bs/images/ajax-loader.gif\" alt=\"Loading...\" width=\"25\" height=\"25\"/>\n                        </div>\n                    </div>\n                <div class=\"popup-main-content hide\">\n                    <table>\n                        <tbody>\n                        ").concat(commissionsTemplate(saytVM.config.platform), " \n        \n                        <tr class=\"vat-rate-row\">\n                            <td>").concat(saytVM.additionalfees.vatOnHammerLabel, ":</td>\n                            <td><span id=\"additionalFeeVatRate\"><span class=\"vat-rate\"></span>%</span></td>\n                        </tr>\n        \n                        </tbody>\n                    </table>\n                    <p>\n                        <i><span class=\"hammer-excess\"></span></i>\n                    </p>\n        \n                    <p class=\"artist-resale-rights\">").concat(saytVM.additionalfees.artistRightsLabel, "</p>\n        \n                    <small name=\"commission-info\">").concat(commissionsUrl(item), "</small>\n                    <small name=\"short-commission-info\" class=\"hide\">").concat(commissionsUrlShort(item), "</small>\n                </div>\n                </div>\n            </div>  \n        ");
  }
  return "\n        <label class=\"link-icon additional-fees-toggle color-secondary\" id=\"popup-trigger-".concat(item.objectID, "\" data-url=\"").concat(additionalFeesUrl(item), "\">\n            ").concat(feesPopupTrigger(), "\n        </label>\n        <div class=\"tooltip\">\n            <div class=\"popup\" id=\"popup-").concat(item.objectID, "\">\n                    \n                <p><strong>").concat(saytVM.additionalfees.additionalFeesLabel, ":</strong>\n                </p>\n                <div class=\"results-loader\" style=\"width: 10%; margin: 0 auto;\">\n                    <div>\n                        <img src=\"/content/bs/images/ajax-loader.gif\" alt=\"Loading...\" width=\"25\" height=\"25\"/>\n                    </div>\n                </div>\n            <div class=\"popup-main-content hide\">\n                <table>\n                    <tbody>\n                    ").concat(commissionsTemplate(saytVM.config.platform), "\n\n                    <tr class=\"vat-rate-row\">\n                        <td>").concat(saytVM.additionalfees.vatOnHammerLabel, ":</td>\n                        <td><span id=\"additionalFeeVatRate\"><span class=\"vat-rate\"></span>%</span></td>\n                    </tr>\n\n                    </tbody>\n                </table>\n                <p>\n                    <i><span class=\"hammer-excess\"></span></i>\n                </p>\n\n                <p class=\"artist-resale-rights\">").concat(saytVM.additionalfees.artistRightsLabel, "</p>\n\n                <small name=\"commission-info\">").concat(commissionsUrl(item), "</small>\n                <small name=\"short-commission-info\" class=\"hide\">").concat(commissionsUrlShort(item), "</small>\n            </div>\n            </div>\n        </div>\n    ");
};
var feesPopupTrigger = function feesPopupTrigger() {
  if (saytVM.featureSwitch.isNewUiSkinSearchResultEnabled) {
    return "<span class=\"material-icons additional-fees-toggle-icon\">help</span>";
  }
  return "<i class=\"icon icon-question-mark\"></i><span>".concat(saytVM.additionalfees.additionalFeesLabel, "</span>");
};
var commissionsTemplate = function commissionsTemplate(platform) {
  if (platform == 'IB' || platform == 'BS') {
    return "\n            <tr name=\"commissions\">\n                <td>".concat(saytVM.additionalfees.commissionsLabel, "*:</td>\n                <td><span id=\"commissionsExVAT\"><span class=\"commissions-ex-vat\"></span>%</span> ex. ").concat(saytVM.additionalfees.vatLabel, "</td>\n            </tr>\n            <tr name=\"alternative-buyers-premium\" class=\"hide\">\n                <td colspan=\"2\"></td>\n            </tr>\n        ");
  } else {
    return "\n            <tr name=\"commissions\">\n                <td>".concat(saytVM.additionalfees.commissionsLabel, "*:</td>\n                <td><span id=\"commissionsWithVAT\"><span class=\"commissions-with-vat\"></span>%</span> inc. ").concat(saytVM.additionalfees.vatLabel, "</td>\n            </tr>\n            <tr name=\"alternative-buyers-premium\" class=\"hide\">\n                <td colspan=\"2\"></td>\n            </tr>\n        ");
  }
};
var additionalFeesUrl = function additionalFeesUrl(item) {
  if (typeof item === 'undefined') return "";
  return getLinkUrls(saytVM.additionalfees.additionalFeesUrl, null, item.objectID, item.auctionRef);
};
var commissionsUrl = function commissionsUrl(item) {
  if (typeof item === 'undefined') return "";
  var timedAuc = "";
  if (item.auctionDisplayType.toLowerCase().indexOf('timed') >= 0) {
    if (item.auctionDisplayType.toLowerCase().indexOf('catalog') == -1) {
      timedAuc += "timed/";
    }
  }
  timedAuc += item.auctioneerRef;
  return getLinkUrls(saytVM.additionalfees.commissionInfoUrl, timedAuc, null, item.auctionRef);
};
var commissionsUrlShort = function commissionsUrlShort(item) {
  if (typeof item === 'undefined') return "";
  var timedAuc = "";
  if (item.auctionDisplayType.toLowerCase().indexOf('timed') >= 0) {
    if (item.auctionDisplayType.toLowerCase().indexOf('catalog') == -1) {
      timedAuc += "timed/";
    }
  }
  timedAuc += item.auctioneerRef;
  return getLinkUrls(saytVM.additionalfees.commissionInfoShortUrl, timedAuc, null, item.auctionRef);
};;"use strict";

var renderSearchResults = function renderSearchResults(renderOptions, isFirstRender) {
  var hits = renderOptions.hits,
    widgetParams = renderOptions.widgetParams,
    sendEvent = renderOptions.sendEvent;
  //
  var container = widgetParams.container;

  // we need queryid and indexname for search analytics
  var queryID = renderOptions.results ? renderOptions.results.queryID : "";
  var indexName = renderOptions.instantSearchInstance.indexName;
  var sideFilterHeader = document.querySelector('#refineResults > h2');
  var sideFilterClearBtn = document.querySelector('#refineResults > #clearFacetsPlaceholder');
  var pageStart = renderOptions.results ? renderOptions.results.page * renderOptions.results.hitsPerPage : 0;
  var hitsPerPage = renderOptions.results ? renderOptions.results.hitsPerPage : 0;
  var nbPages = renderOptions.results ? renderOptions.results.nbPages : 0;
  var page = renderOptions.results ? renderOptions.results.page : 0;
  var rr = renderOptions.results ? renderOptions.results._rawResults[0] : '';
  var params = rr != '' ? rr.params : '';
  var indexUsed = rr != '' ? rr.indexUsed : indexName;
  var abTestId = rr != '' ? rr.abTestID : 0;
  var abVariantId = rr != '' ? rr.abTestVariantID : 0;
  var substituteTitleWithDescription = saytVM.searchResults.substituteTitleWithDescription;
  lastHits = hits;
  if (isFirstRender) {
    // add click handler to search results container
    container.addEventListener('click', function (event) {
      onElementClicked(event, sendEvent);
    });
    trackWatchlistConversion(indexName);
  }
  //
  if (!isFirstRender) {
    //
    storeIndexUsed(indexUsed, abTestId, abVariantId);
    //
    var query = renderOptions.results.query ? renderOptions.results.query : "";
    if (hits.length > 0) {
      // Determine if typo-tolerance has kicked in
      if (typeof hits !== 'undefined') {
        if (typeof hits[0]._rankingInfo !== 'undefined') {
          typoTolerance = hits[0]._rankingInfo.nbTypos > 0;
        }
      }
      // Render items as normal
      widgetParams.container.innerHTML = "\n            ".concat(hits.map(function (item, position) {
        item.title = substituteTitleWithDescription ? truncateAtWord(snippetDescStripHTML(item.description, true), saytVM.searchResults.titleMaxLength) : decode(item.title);
        item.description = formatLotDescription(item, substituteTitleWithDescription);
        return renderSingleLot(item, position, indexName, queryID, pageStart);
      }).join(''), "\n            ");
      sideFilterHeader.style.display = 'inline-block';
      sideFilterClearBtn.style.display = 'block';
    } else {
      widgetParams.container.innerHTML = "\n                ".concat(saytVM.hitsrendering.noHitsMsg, "\n                ").concat(function () {
        if (!saytVM.featureSwitch.isLandingPage) {
          return '<br/><a id="restartSearch" class="button primary">' + saytVM.hitsrendering.startNewSearchLabel + '</a>';
        }
        return '';
      }(), "\n            ");
      sideFilterHeader.style.display = 'none';
      sideFilterClearBtn.style.display = 'none';
      if (!saytVM.featureSwitch.isLandingPage) {
        var restartBtn = widgetParams.container.querySelector('#restartSearch');
        restartBtn.addEventListener('click', function (event) {
          event.preventDefault();
          // Reload page with new search term
          var newQueryUrl = "".concat(window.location.pathname, "?searchTerm=");
          window.location.assign(newQueryUrl);
        });
      }
    }
  }
  setupPopupClickHandlers(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled);
};
var renderSearchResultsNewUiSkin = function renderSearchResultsNewUiSkin(renderOptions, isFirstRender) {
  var hits = renderOptions.hits,
    widgetParams = renderOptions.widgetParams,
    sendEvent = renderOptions.sendEvent;
  //
  var container = widgetParams.container;

  // we need queryid and indexname for search analytics
  var queryID = renderOptions.results ? renderOptions.results.queryID : "";
  var indexName = renderOptions.instantSearchInstance.indexName;
  var sideFilterHeader = document.querySelector('#refineResults > h2');
  var sideFilterClearBtn = document.querySelector('#refineResults > #clearFacetsPlaceholder');
  var pageStart = renderOptions.results ? renderOptions.results.page * renderOptions.results.hitsPerPage : 0;
  var hitsPerPage = renderOptions.results ? renderOptions.results.hitsPerPage : 0;
  var nbPages = renderOptions.results ? renderOptions.results.nbPages : 0;
  var page = renderOptions.results ? renderOptions.results.page : 0;
  var rr = renderOptions.results ? renderOptions.results._rawResults[0] : '';
  var params = rr != '' ? rr.params : '';
  var indexUsed = rr != '' ? rr.indexUsed : indexName;
  var abTestId = rr != '' ? rr.abTestID : 0;
  var abVariantId = rr != '' ? rr.abTestVariantID : 0;
  var substituteTitleWithDescription = saytVM.searchResults.substituteTitleWithDescription;
  lastHits = hits;
  if (isFirstRender) {
    // add click handler to search results container
    container.addEventListener('click', function (event) {
      onElementClicked(event, sendEvent);
    });
    trackWatchlistConversion(indexName);
  }
  //
  if (!isFirstRender) {
    //
    storeIndexUsed(indexUsed, abTestId, abVariantId);
    //
    var query = renderOptions.results.query ? renderOptions.results.query : "";
    if (hits.length > 0) {
      // Determine if typo-tolerance has kicked in
      if (typeof hits !== 'undefined') {
        if (typeof hits[0]._rankingInfo !== 'undefined') {
          typoTolerance = hits[0]._rankingInfo.nbTypos > 0;
        }
      }
      // Render items as normal
      widgetParams.container.innerHTML = "\n            ".concat(hits.map(function (item, position) {
        item.title = substituteTitleWithDescription ? truncateAtWord(snippetDescStripHTML(item.description, true), saytVM.searchResults.titleMaxLength) : decode(item.title);
        item.description = formatLotDescription(item, substituteTitleWithDescription);
        return renderSingleLotNewUiSkin(item, position, indexName, queryID, pageStart);
      }).join(''), "\n            ");
      sideFilterHeader.style.display = 'inline-block';
      sideFilterClearBtn.style.display = 'block';
    } else {
      widgetParams.container.innerHTML = "\n            <div class=\"no-result-content\"> \n                <p>".concat(saytVM.hitsrendering.noHitsMsg, "</p>\n                ").concat(function () {
        if (!saytVM.featureSwitch.isLandingPage) {
          return '<a id="restartSearch" class="ui button primary">' + saytVM.hitsrendering.startNewSearchLabel + '</a>';
        }
        return '';
      }(), "\n            </div>");
      sideFilterHeader.style.display = 'none';
      sideFilterClearBtn.style.display = 'none';
      if (!saytVM.featureSwitch.isLandingPage) {
        var restartBtn = widgetParams.container.querySelector('#restartSearch');
        restartBtn.addEventListener('click', function (event) {
          event.preventDefault();
          // Reload page with new search term
          var newQueryUrl = "".concat(window.location.pathname, "?searchTerm=");
          window.location.assign(newQueryUrl);
        });
      }
    }
  }
  setupPopupClickHandlers(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled);
};
var customSearchResults = saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? instantsearch.connectors.connectHits(renderSearchResultsNewUiSkin) : instantsearch.connectors.connectHits(renderSearchResults);
var lastHits;
var getClickedHitData = function getClickedHitData(event) {
  var node = findParentNode(event.target, 'ARTICLE');
  if (!node) {
    return null;
  }
  return lastHits.find(function (hit) {
    return hit.objectID === node.getAttribute('data-lot-id');
  });
};
var onElementClicked = function onElementClicked(event, sendEvent) {
  var hit = getClickedHitData(event);
  if (!hit) {
    return;
  }
  sendEvent(CLICK_EVENT_TYPE, hit, CLICK_ON_SEARCH_RESULT_EVENT);
};
var trackWatchlistConversion = function trackWatchlistConversion(indexName) {
  if (isUserAuthenticated() && !saytVM.featureSwitch.isLandingPage) {
    $(document).on('click', '.icon-watch-link', function (event) {
      var hit = getClickedHitData(event);
      if (!hit || !isInWishList(hit.objectID)) {
        return;
      }
      aa('getUserToken', null, function (err, userToken) {
        aa(CONVERSION_EVENT_TYPE, {
          userToken: userToken,
          index: indexName,
          eventName: CONVERSION_WATCHLISTED_AFTER_SEARCH,
          queryID: hit.__queryID,
          objectIDs: [hit.objectID]
        });
      });
    });
  }
};
var renderSingleLot = function renderSingleLot(item, position, indexName, queryID, pageStart) {
  if (typeof item === 'undefined') return "";
  return "\n        <article class=\"panel item".concat(item.isFeaturedLot ? " featured" : "", "\"\n            data-auction-ref=\"").concat(item.auctionRef, "\"\n                       data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\"\n                       data-index=\"").concat(typeof indexName === 'undefined' ? '' : indexName, "\" \n                       data-position=\"").concat(typeof position === 'undefined' ? '' : position, "\"\n                       data-queryID=\"").concat(typeof queryID === 'undefined' ? '' : queryID, "\"\n                       data-page-start=\"").concat(typeof pageStart === 'undefined' ? '' : pageStart, "\"\n                       data-lot-id=\"").concat(item.objectID, "\">\n            <div class=\"lot-single\" id=\"lot-").concat(item.objectID, "\" data-position=\"").concat(typeof position === 'undefined' ? '' : position, "\" data-auction-ref=\"").concat(item.auctionRef, "\" data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\" data-bidding-type=\"competitive\" data-bidder-id=\"\" data-customer-id=\"\">\n                ").concat(featuredLotTemplate(item), "  \n                ").concat(showImageTemplate(item, false, '', saytVM.featureSwitch.isLandingPage ? '' : queryID), "\n                <div class=\"main\">\n                    ").concat(renderLotHeader(item, saytVM.featureSwitch.isLandingPage ? '' : queryID), "\n                    ").concat(auctioneerLink(item), "\n                    ").concat(renderLotDescription(item), "\n                    <div class=\"main-buttons\">\n                        ").concat(renderWishListButton(item), "\n                        ").concat(renderAuctionType(item), "\n                    </div>\n                </div>\n                <aside>\n                    <div class=\"lot-details-wrapper\">\n                        <ul class=\"lot-details\">\n                            ").concat(bidInfo(item), "\n                            ").concat(distances(item), "\n                        </ul>\n                        ").concat(additionalFeesTemplate(item), "\n                    </div>\n                    <footer>\n                        <div class=\"buttons\"></div>\n                        ").concat(renderLotDates(item), "\n                        ").concat(renderLotLocation(item), "\n                    </footer>\n                </aside>\n            </div>\n        </article>\n    ");
};
var renderSingleLotNewUiSkin = function renderSingleLotNewUiSkin(item, position, indexName, queryID, pageStart) {
  if (typeof item === 'undefined') return "";
  return "\n        <article class=\"panel item".concat(item.isFeaturedLot ? " featured" : "", "\"\n            data-auction-ref=\"").concat(item.auctionRef, "\"\n                       data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\"\n                       data-index=\"").concat(typeof indexName === 'undefined' ? '' : indexName, "\" \n                       data-position=\"").concat(typeof position === 'undefined' ? '' : position, "\"\n                       data-queryID=\"").concat(typeof queryID === 'undefined' ? '' : queryID, "\"\n                       data-page-start=\"").concat(typeof pageStart === 'undefined' ? '' : pageStart, "\"\n                       data-lot-id=\"").concat(item.objectID, "\">\n            <div class=\"lot-single\" id=\"lot-").concat(item.objectID, "\" data-position=\"").concat(typeof position === 'undefined' ? '' : position, "\" data-auction-ref=\"").concat(item.auctionRef, "\" data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\" data-bidding-type=\"competitive\" data-bidder-id=\"\" data-customer-id=\"\">\n                <div class=\"lot-image\">\n                    ").concat(featuredLotTemplate(item), "  \n                    ").concat(renderWishListButton(item), "\n                    ").concat(showImageTemplate(item, false, '', saytVM.featureSwitch.isLandingPage ? '' : queryID), "\n                </div>\n                <div class=\"main main-container\">\n                    ").concat(renderLotHeader(item, saytVM.featureSwitch.isLandingPage ? '' : queryID), "\n                    ").concat(auctioneerLink(item), "\n                    <div class=\"lot-details-wrapper\">\n                        <ul class=\"lot-details\">\n                            ").concat(bidInfo(item), "\n                            ").concat(distances(item), "\n                        </ul>\n                        ").concat(renderLotDatesNewUiSkin(item), "\n                        ").concat(renderLotLocation(item), "\n                    </div>\n                    ").concat(renderLotDescription(item), "\n                    <div class=\"main-buttons\">\n                        ").concat(renderWishListButton(item), "\n                        ").concat(renderAuctionType(item), "\n                    </div>\n                </div>\n                <aside>                     \n                    <footer> \n                        <div class=\"buttons\"></div>                        \n                    </footer>\n                </aside>\n            </div>\n        </article>\n    ");
};
var isUserAuthenticated = function isUserAuthenticated() {
  return saytVM.wishlist.isUserAuthenticated.toLowerCase() === 'true' ? true : false;
};
var wishListOnClick = function wishListOnClick(lotId, auctionRef, lotTitle, clientName, auctionType, categoryCode, categoryName) {
  if (typeof lotId === 'undefined' || typeof auctionRef === 'undefined') return;

  // Show login box, after user signs in watchlist will be updated 
  var link = "window.showLoginBoxWishList('".concat(lotId, "'); return false");
  var isAuthenticated = isUserAuthenticated();
  // If user is already logged in, go straight to updating watchlist
  if (isAuthenticated) {
    link = "updateWishList('".concat(lotId, "','").concat(auctionRef, "','").concat(lotTitle, "','").concat(clientName, "','").concat(auctionType, "','").concat(categoryCode, "','").concat(categoryName, "'); return false");
  }
  return link;
};
var updateWishList = function updateWishList(lotId, auctionRef, lotTitle, clientName, auctionType, categoryCode, categoryName) {
  if (typeof lotId === 'undefined' || typeof auctionRef === 'undefined') return;

  // When the watchlist btn is clicked, get the auction id as this is not in the Algolia index
  // Then update the customer's watchlist
  WishlistAddRemove(lotId, null, auctionRef, lotTitle, null, clientName, auctionType, null, null, categoryCode, categoryName);
  // Finally update watchlist in model directly
  // so that there is no delay in displaying the icon state
  // this will get overwritten on page load
  var exists = isInWishList(lotId);
  if (!exists) {
    if (saytVM.wishlist.extraLotInfo != '') {
      saytVM.wishlist.extraLotInfo += ',';
    }
    ;
    saytVM.wishlist.extraLotInfo += lotId;
  } else {
    var str = '';
    // Only 1 lot in model
    if (saytVM.wishlist.extraLotInfo == lotId) {
      saytVM.wishlist.extraLotInfo = '';
    }
    // Lot is first in model
    else if (saytVM.wishlist.extraLotInfo.indexOf(lotId) == 0) {
      saytVM.wishlist.extraLotInfo = saytVM.wishlist.extraLotInfo.replace(lotId + ',', '');
    }
    // Remove comma and lot id from model
    else {
      saytVM.wishlist.extraLotInfo = saytVM.wishlist.extraLotInfo.replace(',' + lotId, '');
    }
    ;
  }
};
var isInWishList = function isInWishList(id) {
  if (typeof id === 'undefined') return "";
  var wishList = saytVM.wishlist.extraLotInfo;
  if (wishList) {
    return wishList.indexOf(id) != -1;
  }
};
var renderWishListButton = function renderWishListButton(item) {
  if (typeof item === 'undefined') return "";
  var wishListIcon = saytVM.wishlist.wishListIcon.length > 0 ? saytVM.wishlist.wishListIcon : 'star';
  var defaultIconClass = saytVM.wishlist.wishListIconClass.length > 0 ? saytVM.wishlist.wishListIconClass : 'empty';
  var wishListState = isInWishList(item.objectID) ? '' : defaultIconClass;
  var wishListBtnMessage = isInWishList(item.objectID) ? saytVM.wishlist.watchlistRemoveMessage : saytVM.wishlist.watchlistAddMessage;
  return "\n        <div id=\"wishList".concat(item.objectID, "\" class=\"button link-icon icon-watch-link\" role=\"button\" onclick=\"").concat(wishListOnClick(item.objectID, item.auctionRef, removeSpecialCharactersFromString(item.title), removeSpecialCharactersFromString(item.auctioneerName), item.auctionType, item.categoryCode, item.categoryName), "\" title=\"").concat(wishListBtnMessage, "\">\n            <i class=\"icon ").concat(wishListState, " ").concat(wishListIcon, "\"></i>\n            <span>").concat(wishListBtnMessage, "</span>\n        </div>\n    ");
};
var updateWishListStatesOnPageLoad = function updateWishListStatesOnPageLoad() {
  var wishList = saytVM.wishlist.extraLotInfo;
  if (wishList) {
    var wl = wishList.split(',');
    for (var i = 0; i < wl.length; i++) {
      var item = document.querySelector('wishlist' + i);
      if (item) {
        var icon = item.querySelector('icon');
        if (icon) {
          if (icon.classList.contains('empty')) {
            icon.classList.remove('empty');
          }
        }
        var message = item.querySelector('span');
        if (message) {
          message.innerHTML = saytVM.wishlist.watchlistRemoveMessage;
        }
      }
    }
  }
};
//
var distances = function distances(item) {
  if (typeof item === 'undefined') return "";
  var distHtml = "";
  if (typeof item._rankingInfo !== 'undefined') {
    if (typeof item._rankingInfo.matchedGeoLocation !== 'undefined') {
      distHtml = "<li class=\"distance last-item\">\n                <span>Distance:</span>\n                <strong>".concat(Math.ceil(item._rankingInfo.matchedGeoLocation.distance * 0.000621371), " miles</strong>\n            </li>");
    }
  }
  return distHtml;
};;"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
// Create the render function for the custom published date widget
var renderPublishedDateFrom = function renderPublishedDateFrom(renderOptions, isFirstRender) {
  var start = renderOptions.start,
    range = renderOptions.range,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var _start = _slicedToArray(start, 2),
    min = _start[0],
    max = _start[1];
  if (isFirstRender) {
    var form = document.createElement('form');
    form.addEventListener('submit', function (event) {
      event.preventDefault();
      // Get the unix timestamp from the url paramater as our min value to search against
      var rawMinInputValue = parseFloat(event.target.elements.min.value);
      // Update search results - no max result is set
      // Only lots with a published date greater than the date set in the url parameter are returned
      refine([Number.isFinite(rawMinInputValue) ? rawMinInputValue : undefined,
      //min
      undefined // max
      ]);
    });

    widgetParams.container.appendChild(form);
  }
  // Add hidden fields to our form
  // Min input auto-populated from url parameter
  // Btn to submit form on load
  widgetParams.container.querySelector('form').innerHTML = "\n        <input type=\"number\" name=\"min\" placeholder=\"".concat(range.min, "\" value=\"").concat(Number.isFinite(min) ? min : '', "\" hidden />\n        <input type=\"submit\" hidden />\n    ");
};

// Create the custom published date widget
var customPublishedDateFrom = instantsearch.connectors.connectRange(renderPublishedDateFrom);

// Convert publishedDateTimeUTC url parameter into timestamp and then format as algolia range string
var getPublishedRangeUTC = function getPublishedRangeUTC(dateTime) {
  if (typeof dateTime === 'undefined') return;
  var utcTimeStamp = new Date(dateTime).valueOf().toString();
  // Return UTC timestamp as Algolia range string
  return utcTimeStamp + ':';
};

// Format algolia range string to match publishedDateTimeUtc url parameter
var getPublishedDateTimeFromRangeUTC = function getPublishedDateTimeFromRangeUTC(range) {
  if (typeof range === 'undefined') return;

  // remove colon from end of str
  var timestamp = range.substr(0, range.length - 1);
  // Convert timestamp into date obj
  var d = new Date(parseInt(timestamp));
  // Get values for date and time
  var year = d.getFullYear().toString();
  var month = addPreceedingZero((d.getMonth() + 1).toString()); // Month always starts from 0 not 1
  var day = addPreceedingZero(d.getDate().toString());
  var hr = addPreceedingZero(d.getHours().toString());
  var min = addPreceedingZero(d.getMinutes().toString());
  var sec = addPreceedingZero(d.getSeconds().toString());
  // Return dateTime in required format
  // Example of format: 2019-07-16T04:03:10
  return year.concat('-', month, '-', day, 'T', hr, ':', min, ':', sec);
};
var addPreceedingZero = function addPreceedingZero(dateTime) {
  if (typeof dateTime === 'undefined') return;
  // Add zero to any string that is only 1 char in length
  // Always using double char format for dateTime strings. E.g. '00'
  return dateTime.length == 1 ? '0' + dateTime : dateTime;
};;"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
// Create the render function for the custom low estimates widget
var renderLowEstimates = function renderLowEstimates(renderOptions, isFirstRender) {
  var start = renderOptions.start,
    range = renderOptions.range,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var _start = _slicedToArray(start, 2),
    min = _start[0],
    max = _start[1];
  if (isFirstRender) {
    var _input = document.createElement('input');
    _input.type = 'number';
    _input.name = widgetParams.placeholder.toLowerCase();
    _input.placeholder = widgetParams.placeholder;
    _input.value = Number.isFinite(min) ? min : '';
    _input.addEventListener('input', function (event) {
      event.preventDefault();
      // Get the min value from the input
      var rawMinInputValue = parseFloat(event.target.value);
      // Update search results - no max result is set
      // Only lots with an estimate greater than the price set in the url parameter are returned
      refine([Number.isFinite(rawMinInputValue) ? rawMinInputValue : undefined,
      //min
      undefined // max
      ]);
    });

    widgetParams.container.appendChild(_input);
  }
  var input = widgetParams.container.querySelector('input');
  input.value = Number.isFinite(min) ? min : '';
};

// Create the high estimates widget
var customLowEstimates = instantsearch.connectors.connectRange(renderLowEstimates);

// Create the render function for the custom low estimates widget
var renderHighEstimates = function renderHighEstimates(renderOptions, isFirstRender) {
  var start = renderOptions.start,
    range = renderOptions.range,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var _start2 = _slicedToArray(start, 2),
    min = _start2[0],
    max = _start2[1];
  if (isFirstRender) {
    var _input2 = document.createElement('input');
    _input2.type = 'number';
    _input2.name = widgetParams.placeholder.toLowerCase();
    _input2.placeholder = widgetParams.placeholder;
    _input2.value = Number.isFinite(max) ? max : '';
    _input2.addEventListener('input', function (event) {
      event.preventDefault();
      // Get the max value from the input
      var rawMaxInputValue = parseFloat(event.target.value);
      // Update search results - no min result is set
      // Only lots with an estimate lower than the price set in the url parameter are returned
      refine([undefined,
      //min
      Number.isFinite(rawMaxInputValue) ? rawMaxInputValue : undefined // max
      ]);
    });

    widgetParams.container.appendChild(_input2);
  }
  var input = widgetParams.container.querySelector('input');
  input.value = Number.isFinite(max) ? max : '';
};

// Create the high estimates widget
var customHighEstimates = instantsearch.connectors.connectRange(renderHighEstimates);;"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var exactmatchWidget = function ExactMatchWidget(widgetParams) {
  var rendererWidgetParams = {
    container: widgetParams.container
  };
  var _createExactMatchWidg = createExactMatchWidgetRenderer(rendererWidgetParams),
    render = _createExactMatchWidg.render,
    dispose = _createExactMatchWidg.dispose;
  var createWidget = connectExactMatchWidget(render, dispose);
  var connectorParams = {};
  return _objectSpread(_objectSpread({}, createWidget(connectorParams)), {}, {
    $$widgetType: "ATG.exactmatch-widget"
  });
};
var connectExactMatchWidget = function connectExactmatchWidget(renderFn) {
  var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  return function (widgetParams) {
    var connectorState = {};
    var exactMatchOnParams = {
      queryType: "prefixNone",
      typoTolerance: false
    };
    var exactMatchOffParams = {
      queryType: "prefixLast",
      typoTolerance: "min"
    };
    function refine(helper) {
      return function (isExactMatch) {
        helper.state = helper.state.setQueryParameters(isExactMatch ? exactMatchOnParams : exactMatchOffParams);
        helper.search();
      };
    }
    function isExactMatch(state) {
      var isExactMatch = false;
      if (state.typoTolerance !== undefined && state.queryType !== undefined) {
        isExactMatch = state.typoTolerance === false && state.queryType === "prefixNone";
      }
      return isExactMatch;
    }
    return {
      $$type: "ATG.exactmatch-widget",
      /*
       * Sets up the widget during the InstantSearch initialization.
       * It is called before the first search and is a good place to call the `renderFn` function to set up the initial DOM (a placeholder for example).
       */
      init: function init(initOptions) {
        var instantSearchInstance = initOptions.instantSearchInstance;
        renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(initOptions)), {}, {
          instantSearchInstance: instantSearchInstance
        }), true);
      },
      /*
       * Re-render the widget with the new information from the search, including results.
       * This method is called each time we receive results from Algolia.
       */
      render: function render(renderOptions) {
        var instantSearchInstance = renderOptions.instantSearchInstance;
        renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(renderOptions)), {}, {
          instantSearchInstance: instantSearchInstance
        }), false);
      },
      /*
       * Called when this widget is unmounted.
       * Can be used to remove refinements set by during this widget's initialization and life time.
       */
      dispose: function dispose() {
        unmountFn();
      },
      /*
       * Derive a `uiState` for this widget based on the existing `uiState` and the search parameters applied.
       * This method is required for a widget to be taken in account for routing.
       * This method can be called internally anytime by InstantSearch and to avoid any issues they must be defined as pure functions.
       */
      getWidgetUiState: function getWidgetUiState(uiState, widgetStateOptions) {
        var searchParameters = widgetStateOptions.searchParameters;
        var exactMatch = isExactMatch(searchParameters);
        return _objectSpread(_objectSpread({}, uiState), {}, {
          exactMatch: exactMatch ? exactMatch : undefined
        });
      },
      /*
       * It receives the current UiState and applied search parameters, and is
       * expected to return a new search parameters.
       * This method is required for a widget to be taken in account for routing.
       */
      getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref) {
        var uiState = _ref.uiState;
        return searchParameters.setQueryParameters(uiState.exactMatch ? exactMatchOnParams : exactMatchOffParams);
      },
      /*
       * Returns IndexRenderState of the current index component tree to build the render state of the whole app.
       * This method is required for a widget to be taken in account for routing.
       * This method can be called internally anytime by InstantSearch and to avoid any issues they must be defined as pure functions.
       */
      getRenderState: function getRenderState(renderState, renderOptions) {
        var widgetRenderState = this.getWidgetRenderState(renderOptions);
        return _objectSpread(_objectSpread({}, renderState), {}, {
          exactMatch: _objectSpread({}, widgetRenderState)
        });
      },
      /*
       * Returns the render state of the current widget.
       * The render state will be passed to the `renderFn` function by the `init` and `render` methods.
       * This method can be called internally anytime by InstantSearch and to avoid any issues they must be defined as pure functions.
       */
      getWidgetRenderState: function getWidgetRenderState(renderOptions) {
        var helper = renderOptions.helper,
          state = renderOptions.state;
        if (!connectorState.refine) {
          connectorState.refine = refine(helper);
        }
        return {
          refine: connectorState.refine,
          exactMatch: isExactMatch(state),
          widgetParams: widgetParams
        };
      }
    };
  };
};
var createExactMatchWidgetRenderer = function createExactMatchWidgetRenderer(_ref2) {
  var container = _ref2.container;
  var containerNode = typeof container === 'string' ? document.querySelector(container) : container;
  var root = document.createElement("div");
  return {
    /*
     * The render function passed to the connector
     * This function is called when we need to render the widget.
     * The render appends when:
     * - the widget is added to InstantSearch
     * - we receive new results from Algolia
     */
    render: function render(renderOptions, isFirstRender) {
      var refine = renderOptions.refine,
        exactMatch = renderOptions.exactMatch;
      if (isFirstRender) {
        containerNode.appendChild(root);
        root.innerHTML = "\n                <div class=\"ais-RefinementList\">\n                    <ul class=\"ais-RefinementList-list\">\n                        <li class=\"ais-RefinementList-item\">\n                            <div><a href=\"javascript:void(0);\" class=\"facet-item ".concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? "ui checkbox" : "", "\">\n                            <input type=\"checkbox\" class=\"ais-RefinementList-checkbox\" ").concat(exactMatch ? "checked" : undefined, ">\n                            <label>").concat(saytVM.widgets.exactMatchesOnlyLabel, "</label>\n                            </a></div>\n                        </li>\n                    </ul>\n                </div>\n            ");
        var option = root.querySelector("a.facet-item");
        option.addEventListener("click", function (event) {
          var checkBox;
          // Make sure we are getting the checkbox input and not the parent hyperlink
          switch (event.target.tagName) {
            case "A":
              checkBox = event.target.querySelector('input[type="checkbox"]');
              break;
            case "LABEL":
              checkBox = event.target.parentElement.querySelector('input[type="checkbox"]');
              break;
            case "INPUT":
              checkBox = event.target;
          }
          var checkBoxValue = checkBox.checked;
          checkBox.checked = !checkBoxValue;
          refine(!checkBoxValue);
        });
      }
    },
    dispose: function dispose() {
      containerNode.removeChild(root);
    }
  };
};;"use strict";

function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
var d, pc, c;
//
var renderLocation = function renderLocation(renderOptions, isFirstRender) {
  var refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container,
    distances = widgetParams.distances,
    countries = widgetParams.countries,
    subtitle = widgetParams.subtitle,
    separator = widgetParams.separator,
    postCodePlaceholder = widgetParams.postCodePlaceholder,
    searchParameters = widgetParams.searchParameters;
  _objectDestructuringEmpty(searchParameters);
  if (isFirstRender) {
    var _div = document.createElement('div');
    _div.setAttribute('class', 'customLocationFacet');
    _div.innerHTML = "<div><label>".concat(subtitle, "</label></div>\n        <div class=\"first-row\">\n            <div class=\"field\"><select class=\"").concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'ui dropdown filters-dropdown' : '', "\" id=\"FilteredSearch_distancelocation\" name=\"FilteredSearch_distancelocation\">").concat(setDistanceOptions(distances), "</select></div>\n            <div><label>").concat(separator, "</label></div>\n            <div class=\"field\"><input id=\"FilteredSearch_postCodelocation\" name=\"FilteredSearch_postCodelocation\" value=\"\" type=\"text\" maxlength=\"20\" placeholder=\"").concat(postCodePlaceholder, "\" /></div>\n        </div>\n        <div class=\"second-row\">\n            <div class=\"field\"><select class=\"").concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'ui dropdown filters-dropdown' : '', "\" id=\"FilteredSearch_countrylocation\" name=\"FilteredSearch_countrylocation\">").concat(countries.map(function (item) {
      return "<option value=\"".concat(item.Code, "\">").concat(item.Name, "</option>");
    }).join(''), "</select></div>\n            <div><button id=\"FilteredSearch_submit\" type=\"submit\" class=\"button\" disabled><i class=\"icon-search\"></i></button></div>\n        </div>\n        <div class=\"third-row\">\n            <div class=\"field field-error\">\n                <span></span>\n            </div>\n        </div>\n        <a id=\"FilteredSearch_FilteredSearch_location_Clear\" class=\"button button-remove\" href=\"\"><span class=\"a11y\">Remove filter</span></a>\n        ");
    var distSelect = _div.querySelector('#FilteredSearch_distancelocation');
    var postcodeInput = _div.querySelector('#FilteredSearch_postCodelocation');
    var countrySelect = _div.querySelector('#FilteredSearch_countrylocation');
    var submitBtn = _div.querySelector('#FilteredSearch_submit');
    var clearBtn = _div.querySelector('#FilteredSearch_FilteredSearch_location_Clear');
    distSelect.addEventListener('change', function (event) {
      // Update distance
      d = event.target.value;
      validationHandler();
    });
    postcodeInput.addEventListener('input', function (event) {
      // Update postcode
      pc = event.target.value;
      validationHandler();
    });
    countrySelect.addEventListener('change', function (event) {
      // Update country
      c = event.target.value;
      validationHandler();
    });
    submitBtn.addEventListener('click', function (event) {
      locSearchSubmit();
    });
    window.addEventListener('load', function (event) {
      // Get params from url and refine results
      window.location.search.split('&').map(function (param) {
        var nameValPair = param.split('=');
        // Check if we have already filtered by location and update values if needed
        switch (nameValPair[0].toLowerCase()) {
          case 'distancelocation':
            d = nameValPair[1];
            distSelect.value = d;
            break;
          case 'postcodelocation':
            pc = nameValPair[1];
            postcodeInput.value = decodeURIComponent(pc);
            break;
          case 'countrylocation':
            c = nameValPair[1];
            countrySelect.value = c;
            break;
        }
        return param;
      });
      if (checkInputsAreFilled(d, pc, c)) {
        var longLat = getLongLat(pc, c);
        // Lookup the postcode to get the longitude and latitude values
        if (typeof longLat !== 'undefined') {
          longLat.done(function (result) {
            // Once we have a longitude and latitude, update results
            if (result !== false) {
              toggleError();
              refine({
                aroundLatLng: result.reverse(),
                // Algolia requires latitude first, then longitude
                aroundRadius: d * 1000 // Set radius
              });
            }
            // Show error message if there is no result
            else {
              toggleError(portalScriptResources.IncorrectPostCodeCountry);
            }
          })
          // If there is a problem with the ajax call
          .fail(function (error) {
            toggleError(error);
          });
        }
        // If postcode invalid or the postcode/country combination display error message to use
        else {
          toggleError(portalScriptResources.IncorrectPostCodeCountry);
        }
        container.parentNode.classList.add('filter-group--selected');
        var newloc = constructNewUrl();
        clearBtn.href = newloc;
        clearBtn.style.display = 'block';
      } else {
        container.parentNode.classList.remove('filter-group--selected');
        clearBtn.href = '';
        clearBtn.style.display = 'none';
      }
    });
    container.appendChild(_div);
  }
  ;
  var div = container.querySelector('.customLocationFacet');
  // Get values from form
  d = div.querySelector('#FilteredSearch_distancelocation').value;
  pc = div.querySelector('#FilteredSearch_postCodelocation').value;
  c = div.querySelector('#FilteredSearch_countrylocation').value;
};
var renderLocationNewUiSkin = function renderLocationNewUiSkin(renderOptions, isFirstRender) {
  var refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container,
    distances = widgetParams.distances,
    countries = widgetParams.countries,
    subtitle = widgetParams.subtitle,
    separator = widgetParams.separator,
    postCodePlaceholder = widgetParams.postCodePlaceholder,
    searchParameters = widgetParams.searchParameters;
  _objectDestructuringEmpty(searchParameters);
  if (isFirstRender) {
    var _div2 = document.createElement('div');
    _div2.setAttribute('class', 'customLocationFacet');
    _div2.innerHTML = "\n        <div class=\"second-row\">\n        <div class=\"field\"><select class=\"".concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'ui dropdown filters-dropdown' : '', "\" id=\"FilteredSearch_countrylocation\" name=\"FilteredSearch_countrylocation\">").concat(countries.map(function (item) {
      return "<option value=\"".concat(item.Code, "\">").concat(item.Name, "</option>");
    }).join(''), "</select></div>\n        </div>\n        <div><label>").concat(subtitle, "</label></div>\n        <div class=\"first-row\">\n            <div class=\"field\"><select class=\"").concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'ui dropdown filters-dropdown' : '', "\" id=\"FilteredSearch_distancelocation\" name=\"FilteredSearch_distancelocation\">").concat(setDistanceOptions(distances), "</select></div>\n            <div><label>").concat(separator, "</label></div>\n            <div class=\"field\"><input id=\"FilteredSearch_postCodelocation\" name=\"FilteredSearch_postCodelocation\" value=\"\" type=\"text\" maxlength=\"20\" placeholder=\"").concat(postCodePlaceholder, "\" /></div>\n        </div>\n        <div class=\"third-row\">\n            <div class=\"field field-error\">\n                <span></span>\n            </div>\n        </div>\n        <div><button id=\"FilteredSearch_submit\" type=\"submit\" class=\"button\" disabled>Apply</button></div>\n        <a id=\"FilteredSearch_FilteredSearch_location_Clear\" class=\"button button-remove\" href=\"\"><span class=\"a11y\">Remove filter</span></a>\n        ");
    var distSelect = _div2.querySelector('#FilteredSearch_distancelocation');
    var postcodeInput = _div2.querySelector('#FilteredSearch_postCodelocation');
    var countrySelect = _div2.querySelector('#FilteredSearch_countrylocation');
    var submitBtn = _div2.querySelector('#FilteredSearch_submit');
    var clearBtn = _div2.querySelector('#FilteredSearch_FilteredSearch_location_Clear');
    distSelect.addEventListener('change', function (event) {
      // Update distance
      d = event.target.value;
      validationHandler();
    });
    postcodeInput.addEventListener('input', function (event) {
      // Update postcode
      pc = event.target.value;
      validationHandler();
    });
    countrySelect.addEventListener('change', function (event) {
      // Update country
      c = event.target.value;
      validationHandler();
    });
    submitBtn.addEventListener('click', function (event) {
      locSearchSubmit();
    });
    window.addEventListener('load', function (event) {
      // Get params from url and refine results
      window.location.search.split('&').map(function (param) {
        var nameValPair = param.split('=');
        // Check if we have already filtered by location and update values if needed
        switch (nameValPair[0].toLowerCase()) {
          case 'distancelocation':
            d = nameValPair[1];
            distSelect.value = d;
            break;
          case 'postcodelocation':
            pc = nameValPair[1];
            postcodeInput.value = decodeURIComponent(pc);
            break;
          case 'countrylocation':
            c = nameValPair[1];
            countrySelect.value = c;
            break;
        }
        return param;
      });
      if (checkInputsAreFilled(d, pc, c)) {
        var longLat = getLongLat(pc, c);
        // Lookup the postcode to get the longitude and latitude values
        if (typeof longLat !== 'undefined') {
          longLat.done(function (result) {
            // Once we have a longitude and latitude, update results
            if (result !== false) {
              toggleError();
              refine({
                aroundLatLng: result.reverse(),
                // Algolia requires latitude first, then longitude
                aroundRadius: d * 1000 // Set radius
              });
            }
            // Show error message if there is no result
            else {
              toggleError(portalScriptResources.IncorrectPostCodeCountry);
            }
          })
          // If there is a problem with the ajax call
          .fail(function (error) {
            toggleError(error);
          });
        }
        // If postcode invalid or the postcode/country combination display error message to use
        else {
          toggleError(portalScriptResources.IncorrectPostCodeCountry);
        }
        container.parentNode.classList.add('filter-group--selected');
        var newloc = constructNewUrl();
        clearBtn.href = newloc;
        clearBtn.style.display = 'block';
      } else {
        container.parentNode.classList.remove('filter-group--selected');
        clearBtn.href = '';
        clearBtn.style.display = 'none';
      }
    });
    container.appendChild(_div2);
  }
  ;
  var div = container.querySelector('.customLocationFacet');
  // Get values from form
  d = div.querySelector('#FilteredSearch_distancelocation').value;
  pc = div.querySelector('#FilteredSearch_postCodelocation').value;
  c = div.querySelector('#FilteredSearch_countrylocation').value;
};
var customLocation = instantsearch.connectors.connectConfigure(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? renderLocationNewUiSkin : renderLocation);

// Helper functions
//
var checkInputsAreFilled = function checkInputsAreFilled(d, pc, c) {
  if (typeof d === 'undefined' || typeof pc === 'undefined' || typeof c === 'undefined') return false;
  return d !== '' && pc !== '' && pc.length > 2 && c !== '' && c !== '-';
};
//
var createUrlLocParams = function createUrlLocParams() {
  if (checkInputsAreFilled(d, pc, c)) {
    var newUrl = window.location.pathname;
    //
    var newloc = constructNewUrl();
    // Add location specific parameters
    newloc += '&distancelocation=' + d + '&postcodelocation=' + pc + '&countrylocation=' + c + '&sortterm=distance';
    // Update url
    if (saytVM.featureSwitch.isLandingPage && newUrl.endsWith('search-filter') && !newloc.startsWith('?')) {
      newUrl += '?';
    }
    newUrl += newloc;
    //
    return newUrl;
  }
  return '';
};
//
var getLongLat = function getLongLat() {
  // Use geoCode service to get coordinates
  return $.ajax({
    method: 'GET',
    url: saytVM.geosearch.geoCodeService,
    contentType: 'application/json; charset=utf-8',
    data: {
      countryCode: c,
      postalCode: pc
    },
    dataType: 'json',
    success: function success(response) {
      return response;
    },
    error: function error(_error) {
      return _error;
    }
  });
};
//
var validationHandler = function validationHandler() {
  setTimeout(function () {
    // Check if values have been entered for all inputs
    if (checkInputsAreFilled(d, pc, c)) {
      var checkLatLongIsValid = getLongLat();
      if (typeof checkLatLongIsValid !== 'undefined') {
        checkLatLongIsValid.done(function (result) {
          // Once we have a longitude and latitude, update results
          if (result !== false) {
            toggleError();
            return result;
          }
          // Show error message if there is no result
          else {
            toggleError(portalScriptResources.IncorrectPostCodeCountry);
            return false;
          }
        })
        // If there is a problem with the ajax call
        .fail(function (error) {
          toggleError(error);
          return false;
        });
      }
      // If postcode or the postcode/country combination is invalid, display error message to use
      else {
        toggleError(portalScriptResources.IncorrectPostCodeCountry);
        return false;
      }
    }
    // Otherwise prompt user to enter info
    else {
      toggleError(portalScriptResources.PleaseSetPostCodeAndCountry);
      return false;
    }
  }, 1000);
  return false;
};
//
var toggleError = function toggleError(errMsg) {
  var submitBtn = document.querySelector('.customLocationFacet #FilteredSearch_submit');
  var errContainer = document.querySelector('.customLocationFacet .field.field-error');
  var postcodeInput = document.querySelector('.customLocationFacet #FilteredSearch_postCodelocation');
  if (typeof errMsg === 'undefined') {
    errContainer.innerHTML = '';
    errContainer.style.display = 'none';
    postcodeInput.classList.remove('isInvalid');
    submitBtn.disabled = false;
  } else {
    errContainer.innerHTML = "<span>".concat(errMsg, "</span>");
    errContainer.style.display = 'block';
    postcodeInput.classList.add('isInvalid');
    postcodeInput.focus();
    submitBtn.disabled = true;
  }
};
//
var constructNewUrl = function constructNewUrl() {
  var ignoreParams = ['distancelocation', 'postcodelocation', 'countrylocation', 'sortterm'];
  var i = 0;
  var url = window.location.search.substr(1).split('&').map(function (param) {
    var nameValPair = param.split('=');
    // Check if we have already filtered by location and ignore any location params in url
    if (ignoreParams.indexOf(nameValPair[0].toLowerCase()) == -1) {
      // if this is the first matching param, insert the ? otherwise include the &
      if (i == 0) {
        i++;
        return '?' + param;
      } else {
        i++;
        return '&' + param;
      }
    }
  }).join('');
  return url;
};
//
var locSearchSubmit = function locSearchSubmit() {
  if (!validationHandler()) {
    window.location.replace(createUrlLocParams());
  }
};
//
var setDistanceOptions = function setDistanceOptions(options) {
  if (typeof options === 'undefined') return;
  return options.map(function (item) {
    return "<option value=\"".concat(item.Kilomiters, "\">").concat(item.Name, "</option>");
  }).join('');
};;"use strict";

var SEARCHFORMID = 'main-search-form';
var SEARCHBOXID = 'main-search-term';
var SEARCHBTNID = 'main-search_btn';
var OVERLAYCLASSNAME = 'aa-dropdown-menu';

// Rendering of the overlay
var renderAutocomplete = function renderAutocomplete(renderOptions, isFirstRendering) {
  var indices = renderOptions.indices,
    currentRefinement = renderOptions.currentRefinement,
    refine = renderOptions.refine,
    widgetParams = renderOptions.widgetParams;
  var container = widgetParams.container,
    recentSearches = widgetParams.recentSearches;
  var sendEvent;
  var showSuggestedSearches = saytVM.config.showSuggestedSearches.toLowerCase() == 'true' ? true : false;
  if (showOverlayOnSearchResults) {
    showSuggestedSearches = showOverlayOnSearchResults;
  }
  var searchInputIcon = "";
  if (saytVM.featureSwitch.isNewSkinForEnhanceSearchEnabled) {
    searchInputIcon = "<i id=\"search-input-icon\" class=\"material-icons\">search</i>";
  }
  if (container) {
    if (isFirstRendering) {
      // existing js to populate recent searches in local storage
      var autoAddRecentAndSubmit = function autoAddRecentAndSubmit() {
        // submit handler for search box
        var searchTerm = stripHtmlTagStartEnd(_input.value); // strip html from query
        if (searchTerm.length > 0) {
          ors.storeTerm(); // add term to local storage to display in recent searches drop-down
        }

        _holder.style.display = 'none'; // hide overlay
        var newQueryUrl = generateEncodedUrl(searchTerm); // reload page with new search term

        if (window.dataLayer) {
          window.dataLayer.push({
            event: 'PlacedSearch',
            searchedItem: searchTerm
          });
        }
        window.location.assign(newQueryUrl);
      };
      if (container.querySelector('.algolia-autocomplete')) {
        container.querySelector('.algolia-autocomplete').remove(); // clear any previous overlays
      }

      container.innerHTML = "\n            <div class=\"main-search\">\n            <fieldset class=\"lot-search\">\n            <legend class=\"hide\">".concat(saytVM.searchbox.searchForLotsLabel, "</legend>\n            <form id=\"").concat(SEARCHFORMID, "\" action role=\"search\" class=\"").concat(SEARCHFORMID, "\" novalidate>\n            <span class=\"algolia-autocomplete\" style=\"position: relative; display: inline-block; direction: ltr;\">\n            ").concat(searchInputIcon, "\n            <input id=\"").concat(SEARCHBOXID, "\" class=\"").concat(SEARCHBOXID, " top-nav-search autocomplete-input\" type=\"search\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" maxlength=\"512\" placeholder=\"").concat(saytVM.searchbox.searchInputPlaceholder, "\"  data-gap-ac-url=\"").concat(saytVM.searchbox.autocompleteAction, "\" />         \n            <button id=\"").concat(SEARCHBTNID, "\" class=\"main-search-submit search-button\" type=\"submit\" aria-label=\"search-button\"><i class=\"icon icon-search\"></i></button>\n            <span id=\"algolia-autocomplete-listbox-0\" class=\"").concat(OVERLAYCLASSNAME, "\" role=\"listbox\"><div class=\"aa-dataset-1\"></div></span>\n            </span>\n            </form></fieldset></div>\n        ");
      var _input = container.querySelector("#".concat(SEARCHBOXID));
      var _holder = container.querySelector(".".concat(OVERLAYCLASSNAME));
      _input.addEventListener('focus', function (event) {
        // Show overlay when customer clicks into search box
        event.preventDefault();
        if (typeof recentSearches !== 'undefined' && event.target.value.length == 0 || showSuggestedSearches) {
          _holder.style.display = 'block'; // ensure overlay is visible
        }
      });

      _input.addEventListener('input', function (event) {
        // When a customer types in a search term
        event.preventDefault();
        if (showSuggestedSearches || typeof recentSearches !== 'undefined' && event.target.value.length == 0) {
          refine(event.target.value); // update search results as the customer types the query              
          _holder.style.display = 'block'; // ensure overlay is visible
        } else {
          _holder.style.display = 'none'; // hide overlay
        }
      });

      var _searchForm = container.querySelector("#".concat(SEARCHFORMID));
      var searchBtn = container.querySelector("#".concat(SEARCHBTNID));
      searchBtn.addEventListener('click', function (event) {
        // Update search on button click
        event.preventDefault();
        autoAddRecentAndSubmit();
      });
      _searchForm.addEventListener('submit', function (event) {
        // Update search when form is submitted
        event.preventDefault();
        autoAddRecentAndSubmit();
      });
      window.addEventListener('click', function (event) {
        var hideOverlay;
        var n = event.target;
        while (n != document) {
          // loop through parent items until we reach the root
          if (n == _input || n == _holder) {
            // if current item is search box or overlay don't hide overlay and exit loop
            hideOverlay = false;
            break;
          } else {
            hideOverlay = true; // if no match set flag to hide overlay
          }

          if (n.parentNode) {
            n = n.parentNode; // get parent of current item under eval
          } else {
            break;
          }
        }
        if (hideOverlay) {
          _holder.style.display = 'none'; // Hide overlay
        }
      });

      var ors = new GapRecentlySearched("#".concat(SEARCHFORMID), autoAddRecentAndSubmit);
    }
    var searchForm = container.querySelector("#".concat(SEARCHFORMID));
    searchForm.action = saytVM.overlay.searchResultsURL.replace('$query$', currentRefinement); // update form action as input changes

    var input = container.querySelector("#".concat(SEARCHBOXID));
    var holder = container.querySelector(".".concat(OVERLAYCLASSNAME));
    holder.innerHTML = indices.map(function (index) {
      switch (index.indexId) {
        case saytVM.config.indexName:
          // we need queryid and indexname for search analytics
          var queryID = index.results ? index.results.queryID : "";
          var pageStart = index.results ? index.results.page * index.results.hitsPerPage : 0;
          var hitsPerPage = index.results ? index.results.hitsPerPage : 0;
          var nbPages = index.results ? index.results.nbPages : 0;
          var page = index.results ? index.results.page : 0;
          var rr = index.results ? index.results._rawResults[0] : '';
          var params = rr != '' ? rr.params : '';
          var indexUsed = rr != '' ? rr.index : index.indexName;
          var abTestId = rr != '' ? rr.abTestID : 0;
          var abVariantId = rr != '' ? rr.abTestVariantID : 0;
          sendEvent = index.sendEvent;
          storeIndexUsed(indexUsed, abTestId, abVariantId);
          return renderIndexListItem(index, queryID, pageStart);
          break;
        case 'suggestions':
          if (typeof recentSearches !== 'undefined' && (input.value.length == 0 || !showSuggestedSearches)) {
            return renderRecentSearches(recentSearches, currentRefinement);
          } else {
            return renderIndexSuggestion(index, currentRefinement);
          }
          break;
      }
    }).join('');
    var suggestedResults = container.querySelector('#resultsOverlay');
    if (suggestedResults) {
      suggestedResults.addEventListener('click', function (event) {
        var node = findParentNode(event.target, 'ARTICLE');
        if (!node) {
          return;
        }
        var dataset = node.dataset;
        if (dataset && dataset.lotId) {
          var position = dataset.position ? parseInt(dataset.position) + 1 : UNKNOWN_SEARCH_POSITION;
          var pageStart = dataset.pageStart ? parseInt(dataset.pageStart) : 0;
          position += pageStart;
          sendEvent({
            eventType: CLICK_EVENT_TYPE,
            insightsMethod: INSIGHTS_CLICK_AFTER_SEARCH_METHOD,
            hits: [dataset],
            payload: {
              eventName: CLICK_ON_SEARCH_OVERLAY_EVENT,
              index: dataset.index,
              queryID: dataset.queryid,
              objectIDs: [dataset.lotId],
              positions: [position]
            },
            widgetType: 'ais.hits'
          });
        }
        ;
      });
    }
  }
};
// Create widget
var customAutocomplete = instantsearch.connectors.connectAutocomplete(renderAutocomplete);

// Helpers
var emptyResults = function emptyResults(lbl) {
  return "<div class=\"empty\">".concat(lbl, "</div>");
};
var renderIndexListItem = function renderIndexListItem(index, queryID, pageStart) {
  var or = "<div class=\"aa-primary\">";
  // if there are results to show
  if (index.hits.length > 0) {
    // templates for header and footer
    var title = saytVM.overlay.topLotsLabel;
    if (index.results.query.length > 0) {
      title = title.replace('$SearchTerm$', "<strong>".concat(index.results._state.query, "</strong>"));
    } else {
      title = saytVM.overlay.topResultsLabel;
    }
    var header = "<div class=\"colHeader\"><h3>".concat(title, "</h3></div>");
    var footer = "<div class=\"colFooter\"><a href=\"".concat(generateEncodedUrl(index.results._state.query), "\" class=\"button primary\" ").concat(storeTermInRecentSearches(index.results._state.query) ? "onClick=\"manualAddRecentAndSubmit('".concat(encodeURIComponentExtended(index.results._state.query), "')\"") : "", ">").concat(saytVM.overlay.viewAllItemsLabel.replace('$nbHits$', index.results.nbHits), "</a></div>");

    // template for hits
    or += "".concat(header, "<div id=\"resultsOverlay\">").concat(index.hits.map(function (item, position) {
      var itemTitle = saytVM.searchResults.substituteTitleWithDescription ? truncateAtWord(snippetDescStripHTML(item.description, true), saytVM.searchResults.titleMaxLength) : item._highlightResult ? item._highlightResult.title.value : decode(item.title);
      return "<article class=\"panel item\"\n                           data-auction-ref=\"".concat(item.auctionRef, "\"\n                           data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\"\n                           data-index=\"").concat(index.indexName, "\" \n                           data-position=\"").concat(position, "\"\n                           data-queryID=\"").concat(queryID, "\"\n                           data-page-start=\"").concat(pageStart, "\"\n                           data-lot-id=\"").concat(item.objectID, "\">\n                        <div class=\"lot-single\" id=\"lot-").concat(item.objectID, "\" data-position=\"").concat(position, "\" data-auction-ref=\"").concat(item.auctionRef, "\" data-auction-type=\"").concat(item.auctionType.toLowerCase(), "\" data-bidding-type=\"competitive\" data-bidder-id=\"\" data-customer-id=\"\">\n                        ").concat(showImageTemplate(item, true, index.results._state.query, queryID), "\n                        <div class=\"main\">\n                            <div class=\"lot-header\">\n                                <h3><a id=\"overlayLot-").concat(item.objectID, "\" href=\"").concat(lotDetailsUrl(item, queryID), "\" class=\"a-wrapped update-history-url-after-back click-track\" data-click-type=\"title\" data-lot-id=\"").concat(item.lotNumber, "\"\n                                ").concat(storeTermInRecentSearches(index.results._state.query) ? "onClick=\"manualAddRecentAndSubmit('".concat(encodeURIComponentExtended(index.results._state.query), "','Lot name','").concat(item.title, "')\"") : "", ">").concat(item.title, "</a></h3>\n                            </div>\n                            <div class=\"main-buttons\">\n                                ").concat(renderAuctionType(item), "\n                            </div>\n                        </div>\n                        <aside>\n                            <div class=\"lot-details-wrapper\">\n                                <ul class=\"lot-details\">\n                                    ").concat(bidInfo(item, true), "\n                                </ul>\n                            </div>\n                            <footer>\n                                ").concat(renderLotDates(item), "\n                                ").concat(renderLotLocation(item), "\n                            </footer>\n                        </aside>\n                        </div>\n                        </article>");
    }).join(''), "</div>").concat(footer);
  }
  // Otherwise show appropriate message
  else {
    or += emptyResults(saytVM.overlay.noResultsLabel);
  }
  // don't forget to close tag
  or += "</div>";
  //
  return or;
};
var renderIndexSuggestion = function renderIndexSuggestion(index, currentRefinement) {
  var os = "<aside class=\"aa-".concat(index.indexId, "\">");
  // template for header
  var header = "<div class=\"colHeader\"><h3>".concat(saytVM.overlay.suggestedSearchesLabel, "</h3></div>");
  // if there are results to show
  if (index.hits.length > 0) {
    // template for hits
    os += "".concat(header, "<div><ul>").concat(index.hits.slice(0, 15).map(function (item) {
      var activeItem = typeof currentRefinement !== 'undefined' && item.query == currentRefinement ? true : false;
      return "<li><a id=\"overlaySuggested-".concat(item.query, "\" href=\"").concat(generateEncodedUrl(item.query), "\" ").concat(storeTermInRecentSearches(item.query) ? "onClick=\"manualAddRecentAndSubmit('".concat(encodeURIComponentExtended(item.query), "','Suggested search')\"") : "", " class=\"").concat(activeItem ? 'active' : '', "\">").concat(item._highlightResult ? item._highlightResult.query.value : item.query, "</a></li>");
    }).join(''), "</ul></div>");
  }
  // otherwise show appropriate message
  else {
    os += "".concat(header).concat(emptyResults('<p>No suggestions</p>'));
  }
  // don't forget to close tag
  os += "</aside>";
  //
  return os;
};
var renderRecentSearches = function renderRecentSearches(rsList, currentRefinement) {
  if (typeof rsList === 'undefined') return '';
  var or = "<aside class=\"aa-recentSearches\">";
  // if there are results to show
  if (rsList.length > 0) {
    // template for header
    var header = "<div class=\"colHeader\"><h3>Recent searches</h3></div>";
    // template for hits
    or += "".concat(header, "<div><ul>").concat(rsList.slice(0, 15).map(function (item) {
      var activeItem = typeof currentRefinement !== 'undefined' && item == currentRefinement ? true : false;
      return "<li><a id=\"overlayRecent-".concat(item, "\" href=\"").concat(generateEncodedUrl(item), "\" ").concat(storeTermInRecentSearches(item) ? "onClick=\"manualAddRecentAndSubmit('".concat(encodeURIComponentExtended(item), "','Recent search')\"") : "", " class=\"").concat(activeItem ? 'active' : '', "\">").concat(activeItem ? "<mark>".concat(item, "</mark>") : item, "</a></li>");
    }).join(''), "</ul></div>");
  }
  // otherwise show appropriate message
  else {
    or += emptyResults('<p>No searches</p>');
  }
  // don't forget to close tag
  or += "</aside>";
  //
  return or;
};
function manualAddRecentAndSubmit(query, eventName, selectedItem) {
  var input = document.querySelector("#".concat(SEARCHFORMID, " #").concat(SEARCHBOXID));
  var ors = new GapRecentlySearched("#".concat(SEARCHFORMID));
  var searchedItem = decodeURIComponent(selectedItem || query || '');
  if (window.dataLayer) {
    if (eventName) {
      window.dataLayer.push({
        event: 'ClickedOnSearchOverlay',
        searchedItem: searchedItem,
        searchType: eventName
      });
    }
    window.dataLayer.push({
      event: 'PlacedSearch',
      searchedItem: searchedItem
    });
  }
  if (typeof query != 'undefined') {
    // Strip html from term
    var searchTerm = stripHtmlTagStartEnd(query);
    // Update search input
    input.value = decodeURIComponent(searchTerm);
    // Add term to local storage to display in recent searches drop-down
    ors.storeTerm();
    // Reload page with new search term
    var newQueryUrl = saytVM.overlay.searchResultsURL.replace('$query$', searchTerm);
    window.location.assign(newQueryUrl);
  }
}
var storeTermInRecentSearches = function storeTermInRecentSearches(query) {
  var store = false;
  if (typeof query !== 'undefined') {
    switch (query.length) {
      case 0:
        store = false;
        break;
      case 1:
        if (query == '*' || query == ' ') {
          store = false;
        } else {
          store = true;
        }
        break;
      default:
        store = true;
    }
  }
  return store;
};
function generateEncodedUrl(query) {
  query = encodeURIComponentExtended(query);
  return saytVM.overlay.searchResultsURL.replace('$query$', query);
}
function encodeURIComponentExtended(query) {
  return encodeURIComponent(query).replaceAll("'", '%27');
}
function removeSpecialCharactersFromString(val) {
  return val.replace(/"|'/g, '');
};"use strict";

var suggestionsIndexId = 'suggestions';
var UNKNOWN_USER_TOKEN = '111111111';
var userToken = dataLayer && dataLayer[0] && dataLayer[0].globalId ? dataLayer[0].globalId : UNKNOWN_USER_TOKEN;
addSearchInsights();
var searchClient = algoliasearch(saytVM.config.searchClientId, saytVM.config.searchClientKey, {
  headers: {
    'x-algolia-usertoken': userToken
  }
});
var showOverlayOnSearchResults = false;
if (sessionStorage) {
  if (sessionStorage.showOverlayOnSearchResults) {
    showOverlayOnSearchResults = sessionStorage.showOverlayOnSearchResults.toLowerCase() == 'true' ? true : false;
  }
}
function runOverlay() {
  var RSKEY = 'gap-recent-searches';
  var getRecentSearches = function getRecentSearches(key) {
    if (localStorage.getItem(key)) {
      // get recent searches
      return JSON.parse(localStorage.getItem(key));
    }
  };
  var latestRecentSearch = getRecentSearches(RSKEY) ? getRecentSearches(RSKEY)[0] : '';
  var saytOverlay = instantsearch({
    indexName: saytVM.config.indexName,
    searchClient: searchClient,
    searchFunction: function searchFunction(helper) {
      // when overlay loads, populate top matching lots with most recent search query
      if (latestRecentSearch.length > 0 && helper.state.query.length == 0) {
        helper.setQuery(latestRecentSearch);
      }
      // maintain paging - this always needs to be done first
      var page = helper.getPage();
      // add any facet values to exclude lots from the results
      helper = setExclusionFacets(helper);
      // perform search with new query
      helper.setQuery(helper.state.query).setPage(page).search();
    }
  });
  saytOverlay.addWidgets([instantsearch.widgets.configure({
    hitsPerPage: 6,
    analyticsTags: ['overlay']
  }), instantsearch.widgets.index({
    indexName: "".concat(saytVM.config.indexName, "_").concat(suggestionsIndexId),
    indexId: suggestionsIndexId
  }), customAutocomplete({
    container: document.querySelector('#searchPlaceholder'),
    searchAsYouType: saytVM.config.searchAsYouTypeOn.toLowerCase() == 'true' ? true : false,
    recentSearches: getRecentSearches(RSKEY)
  })]);
  var insightsMiddleware = instantsearch.middlewares.createInsightsMiddleware({
    insightsClient: window.aa,
    onEvent: insightsEventHandler
  });
  saytOverlay.use(insightsMiddleware);
  window.aa('setUserToken', userToken);
  saytOverlay.start();
  saytOverlay.on('error', function (event) {
    // Hide overlay, search box will still function
    var container = document.querySelector('.aa-dropdown-menu');
    container.style.display = 'none';
  });
}
;
function setEnhancedSearchSessions(esActive, showSearchOnOverlay) {
  var enhancedSearchActiveSessionVar = 'esActive';
  var enhancedSearchOverlayOnSearchSessionVar = 'showOverlayOnSearchResults';
  var enhancedSearchActivationCookieName = 'esactivation';
  function isSessionStorageSupported() {
    var storage = window.sessionStorage;
    try {
      storage.setItem('test', 'test');
      storage.removeItem('test');
      return true;
    } catch (e) {
      return false;
    }
  }
  if (isSessionStorageSupported()) {
    sessionStorage.setItem(enhancedSearchActiveSessionVar, esActive);
    sessionStorage.setItem(enhancedSearchOverlayOnSearchSessionVar, showSearchOnOverlay);
  }
};"use strict";

var typoTolerance = false;
var firstLoad = true;
function runSearchResults() {
  var getClearAttributes = function getClearAttributes() {
    var defaultAttributes = ["categoryCode", "hasImages", "makes", "items", "countryName", "auctionDisplayType", "auctioneerName", "lowEstimate", "highEstimate"];
    var removeAttribute = function removeAttribute(attribute) {
      return defaultAttributes.filter(function (a) {
        return a !== attribute;
      });
    };
    if (saytVM.landingPage && saytVM.landingPage.isSubCategoryPage) {
      defaultAttributes = removeAttribute("categoryCode");
    }
    if (saytVM.landingPage && saytVM.landingPage.hideBrand) {
      defaultAttributes = removeAttribute("makes");
    }
    if (saytVM.landingPage && saytVM.landingPage.hideItemType) {
      defaultAttributes = removeAttribute("items");
    }
    return defaultAttributes;
  };
  var saytSearchResults = instantsearch({
    indexName: saytVM.config.indexName,
    searchClient: searchClient,
    routing: saytVM.featureSwitch.isLandingPage ? searchRoutingOnLandingPage(routingHelper) : searchRouting(routingHelper),
    searchFunction: function searchFunction(helper) {
      // maintain paging - this always needs to be done first
      var page = helper.getPage();
      if (firstLoad && (page == null || page == 0)) {
        firstLoad = false;
        var queryPage = new URLSearchParams(window.location.search).get('page');
        if (queryPage != null && queryPage.length > 0 && !isNaN(queryPage)) {
          page = parseInt(queryPage) - 1;
        }
      }

      // check if not the first page and hide some elements
      browsingModeShowHideElements(page);

      // parse the query and add optional words
      var sanitisedQuery = searchTermParser(helper.state.query);
      var optionalWords = addOptionalWords(sanitisedQuery);
      // add any facet values to exclude lots from the results
      helper = setExclusionFacets(helper);
      // perform search with new query
      helper.setQuery(sanitisedQuery)
      // add search terms to optional words array
      .setQueryParameter('optionalWords', optionalWords)
      // add end time filters
      .addNumericRefinement('endDateTimeUtc', '>=', calcTimestampYesterday()).addNumericRefinement('auctionEndDateTimeUtc', '>=', calcTimestampYesterday())
      // reset page and perform new search
      .setPage(page).search();
    }
  });
  var widgets = [instantsearch.widgets.configure({
    getRankingInfo: true,
    analyticsTags: saytVM.featureSwitch.isLandingPage ? ['landing-page'] : ['search']
  }),
  // add search box
  customSearchbox({
    container: document.querySelector('#searchPlaceholder'),
    searchAsYouType: saytVM.config.searchAsYouTypeOn.toLowerCase() == 'true' ? true : false
  }),
  // show search results - must be before other widgets to detect typo-tolerance
  customSearchResults({
    container: document.querySelector('#results')
  }),
  // add breadcrumb
  customBreadCrumbs({
    container: document.querySelector('.primary-breadcrumb .active')
  }),
  // add result info about number of items controls
  customResultsInfo({
    container: document.querySelector('#resultsInfoPlaceholder')
  }),
  // add page header (stats widget)
  customResultsInfo({
    container: document.querySelector('#mobileNbHitsPlaceholder')
  }), customPageHeader({
    container: document.querySelector('#pageHeaderPlaceholder')
  }),
  // add sort and view type controls
  customSortByViewType({
    container: document.querySelector('#sortViewPlaceholder'),
    items: JSON.parse(saytVM.searchheader.sortOptions)
  }),
  // add sort for mobile
  customSortMobile({
    container: document.querySelector('#sortMobilePlaceholder'),
    items: JSON.parse(saytVM.searchheader.sortOptions)
  }),
  // add page size controls in search header (hits per page widget)
  customPageSize({
    container: document.querySelector('#hitsPerPageTopPlaceholder'),
    items: JSON.parse(saytVM.searchheader.pageSizeOptions),
    position: 'top'
  }),
  // add pagination controls in search header
  customPagination({
    container: document.querySelector('#pagingTopPlaceholder'),
    position: 'top'
  }),
  // add page size controls in search footer (hits per page widget)
  customPageSize({
    container: document.querySelector('#hitsPerPageBotPlaceholder'),
    items: JSON.parse(saytVM.searchheader.pageSizeOptions),
    position: 'bot'
  }),
  // add pagination controls in search footer
  customPagination({
    container: document.querySelector('#pagingBotPlaceholder'),
    position: 'bot'
  }),
  // Add clear refinements btn
  instantsearch.widgets.clearRefinements({
    container: '#clearFacetsPlaceholder',
    includedAttributes: getClearAttributes(),
    templates: {
      resetLabel: saytVM.widgets.resetFiltersLabel
    }
  }),
  // Add images only facet
  instantsearch.widgets.refinementList({
    container: '#hasImagePlaceholder',
    attribute: 'hasImages',
    operator: 'or',
    sortBy: ['name:desc'],
    templates: {
      item: facetTemplateCheckbox
    },
    transformItems: function transformItems(items) {
      return items.map(function (item) {
        switch (item.label) {
          case 'true':
            item.label = saytVM.widgets.imagesOnlyLabel;
            break;
          case 'false':
            item.label = saytVM.widgets.withoutImagesLabel;
            break;
        }
        ;
        return item;
      });
    }
  }),
  // Add low estimates facet
  customLowEstimates({
    container: document.querySelector('#lowEstimatePlaceholder'),
    attribute: 'lowEstimate',
    placeholder: saytVM.widgets.minPlaceholder
  }),
  // Add high estimates facet
  customHighEstimates({
    container: document.querySelector('#highEstimatePlaceholder'),
    attribute: 'highEstimate',
    placeholder: saytVM.widgets.maxPlaceholder
  }),
  // Add location facet
  customLocation({
    container: document.querySelector('#locationPlaceholder'),
    distances: JSON.parse(saytVM.geosearch.distancesOptions),
    countries: JSON.parse(saytVM.geosearch.countryOptions),
    subtitle: saytVM.geosearch.withinLabel + ':',
    separator: saytVM.geosearch.ofLabel,
    postCodePlaceholder: saytVM.geosearch.postCodePlaceholder,
    searchParameters: {
      aroundLatLng: '',
      aroundRadius: '',
      minimumAroundRadius: 1000 //1KM
    }
  }),
  // Add category facet
  instantsearch.widgets.panel({
    hidden: function hidden() {
      return saytVM.landingPage && saytVM.landingPage.isSubCategoryPage;
    }
  })(instantsearch.widgets.refinementList)({
    container: '#categoryPlaceholder',
    attribute: 'categoryCode',
    operator: 'or',
    limit: 5,
    showMore: true,
    searchable: false,
    searchablePlaceholder: saytVM.widgets.facetPlaceholderCategory,
    sortBy: ['isRefined', 'count:desc'],
    templates: {
      item: facetTemplateCheckbox,
      showMoreText: saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? showMoreTemplateNewUiSkin : showMoreTemplate
    },
    transformItems: function transformItems(items) {
      return window.categoryNameLookup ? items.map(function (item) {
        var catName = window.categoryNameLookup[item.label];
        if (catName) item.label = catName;
        return item;
      }) : items;
    }
  }),
  // Add master category facet
  instantsearch.widgets.menu({
    container: '#masterCategoryPlaceholder',
    attribute: 'masterCategoryCode'
  }),
  // Add brand facet
  instantsearch.widgets.panel({
    hidden: function hidden() {
      return saytVM.landingPage && saytVM.landingPage.hideBrand;
    }
  })(instantsearch.widgets.refinementList)({
    container: '#brandPlaceholder',
    attribute: 'makes',
    operator: 'or',
    limit: 5,
    showMore: true,
    searchable: true,
    searchablePlaceholder: saytVM.widgets.facetPlaceholderBrand,
    sortBy: ['isRefined', 'count:desc'],
    templates: {
      item: facetTemplateCheckbox,
      showMoreText: saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? showMoreTemplateNewUiSkin : showMoreTemplate
    }
  }),
  // Add item facet
  instantsearch.widgets.panel({
    hidden: function hidden() {
      return saytVM.landingPage && saytVM.landingPage.hideItemType;
    }
  })(instantsearch.widgets.refinementList)({
    container: '#itemTypePlaceholder',
    attribute: 'items',
    operator: 'or',
    limit: 5,
    showMore: true,
    searchable: true,
    searchableIsAlwaysActive: true,
    searchablePlaceholder: saytVM.widgets.facetPlaceholderItemType,
    sortBy: ['isRefined', 'count:desc'],
    templates: {
      item: facetTemplateCheckbox,
      showMoreText: saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? showMoreTemplateNewUiSkin : showMoreTemplate
    },
    transformItems: function transformItems(items) {
      return items.filter(function (i) {
        return i && i.value && !i.value.startsWith("@");
      });
    }
  }),
  // Add country facet
  instantsearch.widgets.refinementList({
    container: '#countryPlaceholder',
    attribute: 'countryName',
    operator: 'or',
    limit: 5,
    showMore: true,
    searchable: false,
    sortBy: ['isRefined', 'count:desc'],
    templates: {
      item: facetTemplateCheckbox,
      showMoreText: saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? showMoreTemplateNewUiSkin : showMoreTemplate
    }
  }),
  // Add auction type facet
  instantsearch.widgets.menu({
    container: '#auctionTypePlaceholder',
    attribute: 'auctionDisplayType',
    limit: 5,
    showMore: false,
    searchable: false,
    sortBy: ['isRefined', 'count:desc'],
    templates: {
      item: facetTemplateCheckbox
    }
  }),
  // Add auctioneer facet
  instantsearch.widgets.refinementList({
    container: '#auctioneerPlaceholder',
    attribute: 'auctioneerName',
    operator: 'or',
    limit: 5,
    showMore: true,
    searchable: true,
    searchablePlaceholder: saytVM.widgets.facetPlaceholderAuctioneer,
    sortBy: ['isRefined', 'name:asc'],
    templates: {
      item: facetTemplateCheckbox,
      showMoreText: saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? showMoreTemplateNewUiSkin : showMoreTemplate
    }
  }),
  // Add published date facet - auction alerts
  customPublishedDateFrom({
    container: document.querySelector('#publishedDatePlaceholder'),
    attribute: 'publishedDateTimeUtc'
  })];
  if (!saytVM.featureSwitch.isLandingPage) {
    widgets.push(exactmatchWidget({
      container: '#exactPhrasePlaceholder'
    }));
  }
  saytSearchResults.addWidgets(widgets);
  var insightsMiddleware = instantsearch.middlewares.createInsightsMiddleware({
    insightsClient: window.aa,
    onEvent: insightsEventHandler
  });
  saytSearchResults.use(insightsMiddleware);
  window.aa('setUserToken', userToken);
  saytSearchResults.start();
  // After the instantsearch has finished the initial render
  saytSearchResults.on('render', function () {
    // Find facets that have no refinements and hide them
    hideFacetNoRefinements();
    // Return user to correct location in the search results
    returnToPrevLoc();
    // Update wishlist states on page load
    updateWishListStatesOnPageLoad();
  });
}
;
//
var facetTemplateCheckbox = "\n<a href=\"javascript:void(0);\" class=\"facet-item ".concat(saytVM.featureSwitch.isNewUiSkinSearchResultEnabled ? 'ui checkbox' : '', "\">\n<input type=\"checkbox\" class=\"{{cssClasses.checkbox}} \" value=\"{{value}}\" {{#isRefined}}checked{{/isRefined}} />\n<label>{{label}}<span class=\"facet-count\">({{count}})</span></label>\n</a>");
var showMoreTemplate = "{{#isShowingMore}}Show less \u25B2{{/isShowingMore}}{{^isShowingMore}}Show more \u25BC{{/isShowingMore}}";
var showMoreTemplateNewUiSkin = "\n{{#isShowingMore}}\nShow less <span class=\"material-icons\">keyboard_arrow_up</span>\n{{/isShowingMore}}{{^isShowingMore}}\nShow more <span class=\"material-icons\">keyboard_arrow_down</span>{{/isShowingMore}}";
//
var returnToPrevLoc = function returnToPrevLoc() {
  // Only return user to previous location, on page load
  // This is so that modifying the facets or pagination 
  // doesn't cause any flickering and unnecessary scrolling
  window.addEventListener('load', function (event) {
    if (window.location.hash !== "" && $(window.location.hash).length > 0) {
      window.scrollTo(0, $(window.location.hash).offset().top);
    }
    ;
  });
};
var addRemoveColonFromRangeValues = function addRemoveColonFromRangeValues(range) {
  var addToStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  if (typeof range === 'undefined') return;
  if (range.indexOf(':') != -1) {
    range = range.replace(':', '');
  } else {
    range = addToStart ? ':' + range : range + ':';
  }
  return range;
};
var hideFacetNoRefinements = function hideFacetNoRefinements() {
  var facets = document.querySelectorAll('.filter-group');
  for (var i = 0; i < facets.length; i++) {
    var facetList = ['ais-RefinementList', 'ais-Menu'];
    var hasPanelWithoutRefinements = facets[i].querySelector('.ais-Panel--noRefinement') != null;
    if (hasPanelWithoutRefinements) {
      facetList = ['ais-Panel'];
    }
    for (var f = 0; f < facetList.length; f++) {
      var facet = facets[i].querySelector('.' + facetList[f]);
      if (facet !== null) {
        if (facet.classList.contains(facetList[f] + '--noRefinement')) {
          facets[i].classList.add('hide');
        } else {
          facets[i].classList.remove('hide');
        }
      }
    }
  }
};
var calcTimestampYesterday = function calcTimestampYesterday() {
  // calculate timestamp for midnight yesterday to filter end times against
  var d = new Date();
  var day = d.getUTCDate();
  var month = d.getUTCMonth();
  var year = d.getUTCFullYear();
  return Date.UTC(year, month, day);
};;