@searchcraft/react-sdk 0.9.7 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4534 @@
1
+ var un = Object.defineProperty;
2
+ var fn = (e, t, r) => t in e ? un(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var h = (e, t, r) => fn(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as me } from "react/jsx-runtime";
5
+ import ge from "react";
6
+ const dn = "searchcraft-javascript-sdk", Le = (
7
+ /* searchcraft-javascript-sdk */
8
+ { allRenderFn: !0, appendChildSlotFix: !1, asyncLoading: !0, asyncQueue: !1, attachStyles: !0, cloneNodeFix: !1, cmpDidLoad: !0, cmpDidRender: !1, cmpDidUnload: !1, cmpDidUpdate: !1, cmpShouldUpdate: !1, cmpWillLoad: !1, cmpWillRender: !1, cmpWillUpdate: !1, connectedCallback: !0, constructableCSS: !0, cssAnnotations: !0, devTools: !1, disconnectedCallback: !0, element: !1, event: !0, experimentalScopedSlotChanges: !1, experimentalSlotFixes: !1, formAssociated: !1, hasRenderFn: !0, hostListener: !1, hostListenerTarget: !1, hostListenerTargetBody: !1, hostListenerTargetDocument: !1, hostListenerTargetParent: !1, hostListenerTargetWindow: !1, hotModuleReplacement: !1, hydrateClientSide: !1, hydrateServerSide: !1, hydratedAttribute: !1, hydratedClass: !0, hydratedSelectorName: "hydrated", invisiblePrehydration: !0, isDebug: !1, isDev: !1, isTesting: !1, lazyLoad: !1, lifecycle: !0, lifecycleDOMEvents: !1, member: !0, method: !1, mode: !1, modernPropertyDecls: !0, observeAttribute: !0, profile: !1, prop: !0, propBoolean: !0, propMutable: !1, propNumber: !0, propString: !0, reflect: !1, scoped: !1, scopedSlotTextContentFix: !1, scriptDataOpts: !1, shadowDelegatesFocus: !1, shadowDom: !1, slot: !0, slotChildNodesFix: !1, slotRelocation: !0, state: !0, style: !1, svg: !0, taskQueue: !0, updatable: !0, vdomAttribute: !0, vdomClass: !0, vdomFunctional: !0, vdomKey: !0, vdomListener: !0, vdomPropOrAttr: !0, vdomRef: !1, vdomRender: !0, vdomStyle: !0, vdomText: !0, vdomXlink: !1, watchCallback: !0 }
9
+ );
10
+ var hn = Object.defineProperty, pn = (e, t) => {
11
+ for (var r in t)
12
+ hn(e, r, { get: t[r], enumerable: !0 });
13
+ }, mn = "http://www.w3.org/2000/svg", gn = "http://www.w3.org/1999/xhtml", vn = (e, t) => {
14
+ var r;
15
+ const s = t.$cmpMeta$;
16
+ Object.entries((r = s.$members$) != null ? r : {}).map(([o, [n]]) => {
17
+ if (n & 31 || n & 32) {
18
+ const c = e[o], u = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), o);
19
+ Object.defineProperty(e, o, {
20
+ get() {
21
+ return u.get.call(this);
22
+ },
23
+ set(l) {
24
+ u.set.call(this, l);
25
+ },
26
+ configurable: !0,
27
+ enumerable: !0
28
+ }), e[o] = t.$instanceValues$.has(o) ? t.$instanceValues$.get(o) : c;
29
+ }
30
+ });
31
+ }, Kt = /* @__PURE__ */ new WeakMap(), bn = (e) => Kt.delete(e), Se = (e) => Kt.get(e), yn = (e, t) => {
32
+ const r = {
33
+ $flags$: 0,
34
+ $hostElement$: e,
35
+ $cmpMeta$: t,
36
+ $instanceValues$: /* @__PURE__ */ new Map()
37
+ };
38
+ r.$onReadyPromise$ = new Promise((a) => r.$onReadyResolve$ = a), e["s-p"] = [], e["s-rc"] = [];
39
+ const s = Kt.set(e, r);
40
+ return vn(e, r), s;
41
+ }, Qr = (e, t) => t in e, yt = (e, t) => (0, console.error)(e, t), St = typeof window < "u" ? window : {}, Oe = St.document || { head: {} }, L = St.HTMLElement || class {
42
+ }, J = {
43
+ $flags$: 0,
44
+ $resourcesUrl$: "",
45
+ jmp: (e) => e(),
46
+ raf: (e) => requestAnimationFrame(e),
47
+ ael: (e, t, r, s) => e.addEventListener(t, r, s),
48
+ rel: (e, t, r, s) => e.removeEventListener(t, r, s),
49
+ ce: (e, t) => new CustomEvent(e, t)
50
+ }, Sn = Le.shadowDom, En = (e) => Promise.resolve(e), Vt = !1, Kr = [], Ss = [], wn = (e, t) => (r) => {
51
+ e.push(r), Vt || (Vt = !0, J.$flags$ & 4 ? Xt(qt) : J.raf(qt));
52
+ }, Xr = (e) => {
53
+ for (let t = 0; t < e.length; t++)
54
+ try {
55
+ e[t](performance.now());
56
+ } catch (r) {
57
+ yt(r);
58
+ }
59
+ e.length = 0;
60
+ }, qt = () => {
61
+ Xr(Kr), Xr(Ss), (Vt = Kr.length > 0) && J.raf(qt);
62
+ }, Xt = (e) => En().then(e), Rn = /* @__PURE__ */ wn(Ss), Zt = (e) => (e = typeof e, e === "object" || e === "function"), Tn = {};
63
+ pn(Tn, {
64
+ err: () => Es,
65
+ map: () => kn,
66
+ ok: () => Yt,
67
+ unwrap: () => Cn,
68
+ unwrapErr: () => Pn
69
+ });
70
+ var Yt = (e) => ({
71
+ isOk: !0,
72
+ isErr: !1,
73
+ value: e
74
+ }), Es = (e) => ({
75
+ isOk: !1,
76
+ isErr: !0,
77
+ value: e
78
+ });
79
+ function kn(e, t) {
80
+ if (e.isOk) {
81
+ const r = t(e.value);
82
+ return r instanceof Promise ? r.then((s) => Yt(s)) : Yt(r);
83
+ }
84
+ if (e.isErr) {
85
+ const r = e.value;
86
+ return Es(r);
87
+ }
88
+ throw "should never get here";
89
+ }
90
+ var Cn = (e) => {
91
+ if (e.isOk)
92
+ return e.value;
93
+ throw e.value;
94
+ }, Pn = (e) => {
95
+ if (e.isErr)
96
+ return e.value;
97
+ throw e.value;
98
+ }, ws = (e) => {
99
+ const t = e.__childNodes || e.childNodes;
100
+ e.tagName && e.tagName.includes("-") && e["s-cr"] && e.tagName !== "SLOT-FB" && Rs(t, e.tagName).forEach((r) => {
101
+ var s;
102
+ r.nodeType === 1 && r.tagName === "SLOT-FB" && ((s = xn(r, r["s-sn"], !1)) != null && s.length ? r.hidden = !0 : r.hidden = !1);
103
+ });
104
+ for (const r of t)
105
+ r.nodeType === 1 && (r.__childNodes || r.childNodes).length && ws(r);
106
+ };
107
+ function Rs(e, t, r) {
108
+ let s = 0, a = [], o;
109
+ for (; s < e.length; s++)
110
+ o = e[s], o["s-sr"] && o["s-hn"] === t && r === void 0 && a.push(o), a = [...a, ...Rs(o.childNodes, t, r)];
111
+ return a;
112
+ }
113
+ var xn = (e, t, r = !0) => {
114
+ const s = [];
115
+ for ((r && e["s-sr"] || !e["s-sr"]) && s.push(e); (e = e.nextSibling) && e["s-sn"] === t; )
116
+ s.push(e);
117
+ return s;
118
+ }, Zr = (e, t) => e.nodeType === 1 ? e.getAttribute("slot") === null && t === "" || e.getAttribute("slot") === t : e["s-sn"] === t ? !0 : t === "", Ke = (e, t = "") => () => {
119
+ }, d = (e, t, ...r) => {
120
+ let s = null, a = null, o = null, n = !1, c = !1;
121
+ const u = [], l = (p) => {
122
+ for (let m = 0; m < p.length; m++)
123
+ s = p[m], Array.isArray(s) ? l(s) : s != null && typeof s != "boolean" && ((n = typeof e != "function" && !Zt(s)) && (s = String(s)), n && c ? u[u.length - 1].$text$ += s : u.push(n ? pt(null, s) : s), c = n);
124
+ };
125
+ if (l(r), t) {
126
+ t.key && (a = t.key), t.name && (o = t.name);
127
+ {
128
+ const p = t.className || t.class;
129
+ p && (t.class = typeof p != "object" ? p : Object.keys(p).filter((m) => p[m]).join(" "));
130
+ }
131
+ }
132
+ if (typeof e == "function")
133
+ return e(
134
+ t === null ? {} : t,
135
+ u,
136
+ An
137
+ );
138
+ const i = pt(e, null);
139
+ return i.$attrs$ = t, u.length > 0 && (i.$children$ = u), i.$key$ = a, i.$name$ = o, i;
140
+ }, pt = (e, t) => {
141
+ const r = {
142
+ $flags$: 0,
143
+ $tag$: e,
144
+ $text$: t,
145
+ $elm$: null,
146
+ $children$: null
147
+ };
148
+ return r.$attrs$ = null, r.$key$ = null, r.$name$ = null, r;
149
+ }, $n = {}, _n = (e) => e && e.$tag$ === $n, An = {
150
+ forEach: (e, t) => e.map(Jr).forEach(t),
151
+ map: (e, t) => e.map(Jr).map(t).map(In)
152
+ }, Jr = (e) => ({
153
+ vattrs: e.$attrs$,
154
+ vchildren: e.$children$,
155
+ vkey: e.$key$,
156
+ vname: e.$name$,
157
+ vtag: e.$tag$,
158
+ vtext: e.$text$
159
+ }), In = (e) => {
160
+ if (typeof e.vtag == "function") {
161
+ const r = { ...e.vattrs };
162
+ return e.vkey && (r.key = e.vkey), e.vname && (r.name = e.vname), d(e.vtag, r, ...e.vchildren || []);
163
+ }
164
+ const t = pt(e.vtag, e.vtext);
165
+ return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname, t;
166
+ }, Ts = (e, t) => e != null && !Zt(e) ? t & 4 ? e === "false" ? !1 : e === "" || !!e : t & 2 ? parseFloat(e) : t & 1 ? String(e) : e : e, Mn = (e) => e, be = (e, t, r) => {
167
+ const s = Mn(e);
168
+ return {
169
+ emit: (a) => ks(s, t, {
170
+ bubbles: !0,
171
+ composed: !0,
172
+ cancelable: !0,
173
+ detail: a
174
+ })
175
+ };
176
+ }, ks = (e, t, r) => {
177
+ const s = J.ce(t, r);
178
+ return e.dispatchEvent(s), s;
179
+ }, ut = /* @__PURE__ */ new WeakMap(), es = (e, t, r, s, a, o) => {
180
+ if (r !== s) {
181
+ let n = Qr(e, t), c = t.toLowerCase();
182
+ if (t === "class") {
183
+ const u = e.classList, l = ts(r);
184
+ let i = ts(s);
185
+ e["s-si"] ? (i.push(e["s-si"]), l.forEach((p) => {
186
+ p.startsWith(e["s-si"]) && i.push(p);
187
+ }), i = [...new Set(i)], u.add(...i), delete e["s-si"]) : (u.remove(...l.filter((p) => p && !i.includes(p))), u.add(...i.filter((p) => p && !l.includes(p))));
188
+ } else if (t === "style") {
189
+ for (const u in r)
190
+ (!s || s[u] == null) && (u.includes("-") ? e.style.removeProperty(u) : e.style[u] = "");
191
+ for (const u in s)
192
+ (!r || s[u] !== r[u]) && (u.includes("-") ? e.style.setProperty(u, s[u]) : e.style[u] = s[u]);
193
+ } else if (t !== "key") if (!e.__lookupSetter__(t) && t[0] === "o" && t[1] === "n") {
194
+ if (t[2] === "-" ? t = t.slice(3) : Qr(St, c) ? t = c.slice(2) : t = c[2] + t.slice(3), r || s) {
195
+ const u = t.endsWith(Cs);
196
+ t = t.replace(Ln, ""), r && J.rel(e, t, r, u), s && J.ael(e, t, s, u);
197
+ }
198
+ } else {
199
+ const u = Zt(s);
200
+ if ((n || u && s !== null) && !a)
201
+ try {
202
+ if (e.tagName.includes("-"))
203
+ e[t] !== s && (e[t] = s);
204
+ else {
205
+ const l = s ?? "";
206
+ t === "list" ? n = !1 : (r == null || e[t] != l) && (typeof e.__lookupSetter__(t) == "function" ? e[t] = l : e.setAttribute(t, l));
207
+ }
208
+ } catch {
209
+ }
210
+ s == null || s === !1 ? (s !== !1 || e.getAttribute(t) === "") && e.removeAttribute(t) : (!n || o & 4 || a) && !u && (s = s === !0 ? "" : s, e.setAttribute(t, s));
211
+ }
212
+ }
213
+ }, On = /\s/, ts = (e) => (typeof e == "object" && "baseVal" in e && (e = e.baseVal), e ? e.split(On) : []), Cs = "Capture", Ln = new RegExp(Cs + "$"), Ps = (e, t, r) => {
214
+ const s = t.$elm$.nodeType === 11 && t.$elm$.host ? t.$elm$.host : t.$elm$, a = e && e.$attrs$ || {}, o = t.$attrs$ || {};
215
+ for (const n of rs(Object.keys(a)))
216
+ n in o || es(s, n, a[n], void 0, r, t.$flags$);
217
+ for (const n of rs(Object.keys(o)))
218
+ es(s, n, a[n], o[n], r, t.$flags$);
219
+ };
220
+ function rs(e) {
221
+ return e.includes("ref") ? (
222
+ // we need to sort these to ensure that `'ref'` is the last attr
223
+ [...e.filter((t) => t !== "ref"), "ref"]
224
+ ) : (
225
+ // no need to sort, return the original array
226
+ e
227
+ );
228
+ }
229
+ var Qt, Jt, mt = !1, gt = !1, er = !1, te = !1, vt = (e, t, r) => {
230
+ var s;
231
+ const a = t.$children$[r];
232
+ let o = 0, n, c, u;
233
+ if (mt || (er = !0, a.$tag$ === "slot" && (a.$flags$ |= a.$children$ ? (
234
+ // slot element has fallback content
235
+ // still create an element that "mocks" the slot element
236
+ 2
237
+ ) : (
238
+ // slot element does not have fallback content
239
+ // create an html comment we'll use to always reference
240
+ // where actual slot content should sit next to
241
+ 1
242
+ ))), a.$text$ !== null)
243
+ n = a.$elm$ = Oe.createTextNode(a.$text$);
244
+ else if (a.$flags$ & 1)
245
+ n = a.$elm$ = Oe.createTextNode("");
246
+ else {
247
+ if (te || (te = a.$tag$ === "svg"), n = a.$elm$ = Oe.createElementNS(
248
+ te ? mn : gn,
249
+ !mt && Le.slotRelocation && a.$flags$ & 2 ? "slot-fb" : a.$tag$
250
+ ), te && a.$tag$ === "foreignObject" && (te = !1), Ps(null, a, te), a.$children$)
251
+ for (o = 0; o < a.$children$.length; ++o)
252
+ c = vt(e, a, o), c && n.appendChild(c);
253
+ a.$tag$ === "svg" ? te = !1 : n.tagName === "foreignObject" && (te = !0);
254
+ }
255
+ return n["s-hn"] = Jt, a.$flags$ & 3 && (n["s-sr"] = !0, n["s-cr"] = Qt, n["s-sn"] = a.$name$ || "", n["s-rf"] = (s = a.$attrs$) == null ? void 0 : s.ref, u = e && e.$children$ && e.$children$[r], u && u.$tag$ === a.$tag$ && e.$elm$ && Xe(e.$elm$, !1)), n;
256
+ }, Xe = (e, t) => {
257
+ J.$flags$ |= 1;
258
+ const r = Array.from(e.__childNodes || e.childNodes);
259
+ e["s-sr"] && Le.experimentalSlotFixes;
260
+ for (let s = r.length - 1; s >= 0; s--) {
261
+ const a = r[s];
262
+ a["s-hn"] !== Jt && a["s-ol"] && (ye(Ze(a).parentNode, a, Ze(a)), a["s-ol"].remove(), a["s-ol"] = void 0, a["s-sh"] = void 0, er = !0), t && Xe(a, t);
263
+ }
264
+ J.$flags$ &= -2;
265
+ }, xs = (e, t, r, s, a, o) => {
266
+ let n = e["s-cr"] && e["s-cr"].parentNode || e, c;
267
+ for (; a <= o; ++a)
268
+ s[a] && (c = vt(null, r, a), c && (s[a].$elm$ = c, ye(n, c, Ze(t))));
269
+ }, $s = (e, t, r) => {
270
+ for (let s = t; s <= r; ++s) {
271
+ const a = e[s];
272
+ if (a) {
273
+ const o = a.$elm$;
274
+ o && (gt = !0, o["s-ol"] ? o["s-ol"].remove() : Xe(o, !0), o.remove());
275
+ }
276
+ }
277
+ }, Fn = (e, t, r, s, a = !1) => {
278
+ let o = 0, n = 0, c = 0, u = 0, l = t.length - 1, i = t[0], p = t[l], m = s.length - 1, b = s[0], v = s[m], x, U;
279
+ for (; o <= l && n <= m; )
280
+ if (i == null)
281
+ i = t[++o];
282
+ else if (p == null)
283
+ p = t[--l];
284
+ else if (b == null)
285
+ b = s[++n];
286
+ else if (v == null)
287
+ v = s[--m];
288
+ else if (ft(i, b, a))
289
+ Ie(i, b, a), i = t[++o], b = s[++n];
290
+ else if (ft(p, v, a))
291
+ Ie(p, v, a), p = t[--l], v = s[--m];
292
+ else if (ft(i, v, a))
293
+ (i.$tag$ === "slot" || v.$tag$ === "slot") && Xe(i.$elm$.parentNode, !1), Ie(i, v, a), ye(e, i.$elm$, p.$elm$.nextSibling), i = t[++o], v = s[--m];
294
+ else if (ft(p, b, a))
295
+ (i.$tag$ === "slot" || v.$tag$ === "slot") && Xe(p.$elm$.parentNode, !1), Ie(p, b, a), ye(e, p.$elm$, i.$elm$), p = t[--l], b = s[++n];
296
+ else {
297
+ for (c = -1, u = o; u <= l; ++u)
298
+ if (t[u] && t[u].$key$ !== null && t[u].$key$ === b.$key$) {
299
+ c = u;
300
+ break;
301
+ }
302
+ c >= 0 ? (U = t[c], U.$tag$ !== b.$tag$ ? x = vt(t && t[n], r, c) : (Ie(U, b, a), t[c] = void 0, x = U.$elm$), b = s[++n]) : (x = vt(t && t[n], r, n), b = s[++n]), x && ye(
303
+ Ze(i.$elm$).parentNode,
304
+ x,
305
+ Ze(i.$elm$)
306
+ );
307
+ }
308
+ o > l ? xs(
309
+ e,
310
+ s[m + 1] == null ? null : s[m + 1].$elm$,
311
+ r,
312
+ s,
313
+ n,
314
+ m
315
+ ) : n > m && $s(t, o, l);
316
+ }, ft = (e, t, r = !1) => e.$tag$ === t.$tag$ ? e.$tag$ === "slot" ? e.$name$ === t.$name$ : r ? (r && !e.$key$ && t.$key$ && (e.$key$ = t.$key$), !0) : e.$key$ === t.$key$ : !1, Ze = (e) => e && e["s-ol"] || e, Ie = (e, t, r = !1) => {
317
+ const s = t.$elm$ = e.$elm$, a = e.$children$, o = t.$children$, n = t.$tag$, c = t.$text$;
318
+ let u;
319
+ c === null ? (te = n === "svg" ? !0 : n === "foreignObject" ? !1 : te, n === "slot" && !mt || Ps(e, t, te), a !== null && o !== null ? Fn(s, a, t, o, r) : o !== null ? (e.$text$ !== null && (s.textContent = ""), xs(s, null, t, o, 0, o.length - 1)) : (
320
+ // don't do this on initial render as it can cause non-hydrated content to be removed
321
+ !r && Le.updatable && a !== null && $s(a, 0, a.length - 1)
322
+ ), te && n === "svg" && (te = !1)) : (u = s["s-cr"]) ? u.parentNode.textContent = c : e.$text$ !== c && (s.data = c);
323
+ }, fe = [], _s = (e) => {
324
+ let t, r, s;
325
+ const a = e.__childNodes || e.childNodes;
326
+ for (const o of a) {
327
+ if (o["s-sr"] && (t = o["s-cr"]) && t.parentNode) {
328
+ r = t.parentNode.__childNodes || t.parentNode.childNodes;
329
+ const n = o["s-sn"];
330
+ for (s = r.length - 1; s >= 0; s--)
331
+ if (t = r[s], !t["s-cn"] && !t["s-nr"] && t["s-hn"] !== o["s-hn"])
332
+ if (Zr(t, n)) {
333
+ let c = fe.find((u) => u.$nodeToRelocate$ === t);
334
+ gt = !0, t["s-sn"] = t["s-sn"] || n, c ? (c.$nodeToRelocate$["s-sh"] = o["s-hn"], c.$slotRefNode$ = o) : (t["s-sh"] = o["s-hn"], fe.push({
335
+ $slotRefNode$: o,
336
+ $nodeToRelocate$: t
337
+ })), t["s-sr"] && fe.map((u) => {
338
+ Zr(u.$nodeToRelocate$, t["s-sn"]) && (c = fe.find((l) => l.$nodeToRelocate$ === t), c && !u.$slotRefNode$ && (u.$slotRefNode$ = c.$slotRefNode$));
339
+ });
340
+ } else fe.some((c) => c.$nodeToRelocate$ === t) || fe.push({
341
+ $nodeToRelocate$: t
342
+ });
343
+ }
344
+ o.nodeType === 1 && _s(o);
345
+ }
346
+ }, ye = (e, t, r) => e == null ? void 0 : e.insertBefore(t, r), Dn = (e, t, r = !1) => {
347
+ var s, a, o, n;
348
+ const c = e.$hostElement$, u = e.$vnode$ || pt(null, null), l = _n(t) ? t : d(null, null, t);
349
+ if (Jt = c.tagName, r && l.$attrs$)
350
+ for (const i of Object.keys(l.$attrs$))
351
+ c.hasAttribute(i) && !["key", "ref", "style", "class"].includes(i) && (l.$attrs$[i] = c[i]);
352
+ l.$tag$ = null, l.$flags$ |= 4, e.$vnode$ = l, l.$elm$ = u.$elm$ = c, mt = Sn, Qt = c["s-cr"], gt = !1, Ie(u, l, r);
353
+ {
354
+ if (J.$flags$ |= 1, er) {
355
+ _s(l.$elm$);
356
+ for (const i of fe) {
357
+ const p = i.$nodeToRelocate$;
358
+ if (!p["s-ol"]) {
359
+ const m = Oe.createTextNode("");
360
+ m["s-nr"] = p, ye(p.parentNode, p["s-ol"] = m, p);
361
+ }
362
+ }
363
+ for (const i of fe) {
364
+ const p = i.$nodeToRelocate$, m = i.$slotRefNode$;
365
+ if (m) {
366
+ const b = m.parentNode;
367
+ let v = m.nextSibling;
368
+ {
369
+ let ee = (s = p["s-ol"]) == null ? void 0 : s.previousSibling;
370
+ for (; ee; ) {
371
+ let M = (a = ee["s-nr"]) != null ? a : null;
372
+ if (M && M["s-sn"] === p["s-sn"] && b === (M.__parentNode || M.parentNode)) {
373
+ for (M = M.nextSibling; M === p || M != null && M["s-sr"]; )
374
+ M = M == null ? void 0 : M.nextSibling;
375
+ if (!M || !M["s-nr"]) {
376
+ v = M;
377
+ break;
378
+ }
379
+ }
380
+ ee = ee.previousSibling;
381
+ }
382
+ }
383
+ const x = p.__parentNode || p.parentNode, U = p.__nextSibling || p.nextSibling;
384
+ (!v && b !== x || U !== v) && p !== v && (!p["s-hn"] && p["s-ol"] && (p["s-hn"] = p["s-ol"].parentNode.nodeName), ye(b, p, v), p.nodeType === 1 && p.tagName !== "SLOT-FB" && (p.hidden = (o = p["s-ih"]) != null ? o : !1)), p && typeof m["s-rf"] == "function" && m["s-rf"](p);
385
+ } else
386
+ p.nodeType === 1 && (r && (p["s-ih"] = (n = p.hidden) != null ? n : !1), p.hidden = !0);
387
+ }
388
+ }
389
+ gt && ws(l.$elm$), J.$flags$ &= -2, fe.length = 0;
390
+ }
391
+ Qt = void 0;
392
+ }, As = (e, t) => {
393
+ if (t && !e.$onRenderResolve$ && t["s-p"]) {
394
+ const r = t["s-p"].push(
395
+ new Promise(
396
+ (s) => e.$onRenderResolve$ = () => {
397
+ t["s-p"].splice(r - 1, 1), s();
398
+ }
399
+ )
400
+ );
401
+ }
402
+ }, tr = (e, t) => {
403
+ if (e.$flags$ |= 16, e.$flags$ & 4) {
404
+ e.$flags$ |= 512;
405
+ return;
406
+ }
407
+ return As(e, e.$ancestorComponent$), Rn(() => Nn(e, t));
408
+ }, Nn = (e, t) => {
409
+ const r = e.$hostElement$, s = Ke("scheduleUpdate", e.$cmpMeta$.$tagName$), a = r;
410
+ if (!a)
411
+ throw new Error(
412
+ `Can't render component <${r.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
413
+ );
414
+ let o;
415
+ return s(), Un(o, () => Hn(e, a, t));
416
+ }, Un = (e, t) => zn(e) ? e.then(t).catch((r) => {
417
+ console.error(r), t();
418
+ }) : t(), zn = (e) => e instanceof Promise || e && e.then && typeof e.then == "function", Hn = async (e, t, r) => {
419
+ var s;
420
+ const a = e.$hostElement$, o = Ke("update", e.$cmpMeta$.$tagName$), n = a["s-rc"], c = Ke("render", e.$cmpMeta$.$tagName$);
421
+ jn(e, t, a, r), n && (n.map((u) => u()), a["s-rc"] = void 0), c(), o();
422
+ {
423
+ const u = (s = a["s-p"]) != null ? s : [], l = () => Bn(e);
424
+ u.length === 0 ? l() : (Promise.all(u).then(l), e.$flags$ |= 4, u.length = 0);
425
+ }
426
+ }, jn = (e, t, r, s) => {
427
+ try {
428
+ t = t.render(), e.$flags$ &= -17, e.$flags$ |= 2, Dn(e, t, s);
429
+ } catch (a) {
430
+ yt(a, e.$hostElement$);
431
+ }
432
+ return null;
433
+ }, Bn = (e) => {
434
+ const t = e.$cmpMeta$.$tagName$, r = e.$hostElement$, s = Ke("postUpdate", t), a = r, o = e.$ancestorComponent$;
435
+ e.$flags$ & 64 ? s() : (e.$flags$ |= 64, Is(r), Gn(a, "componentDidLoad", void 0, r), s(), e.$onReadyResolve$(r), o || Wn()), e.$onRenderResolve$ && (e.$onRenderResolve$(), e.$onRenderResolve$ = void 0), e.$flags$ & 512 && Xt(() => tr(e, !1)), e.$flags$ &= -517;
436
+ }, Wn = (e) => {
437
+ Is(Oe.documentElement), Xt(() => ks(St, "appload", { detail: { namespace: dn } }));
438
+ }, Gn = (e, t, r, s) => {
439
+ if (e && e[t])
440
+ try {
441
+ return e[t](r);
442
+ } catch (a) {
443
+ yt(a, s);
444
+ }
445
+ }, Is = (e) => {
446
+ var t;
447
+ return e.classList.add((t = Le.hydratedSelectorName) != null ? t : "hydrated");
448
+ }, Vn = (e, t) => Se(e).$instanceValues$.get(t), ss = (e, t, r, s) => {
449
+ const a = Se(e), o = e, n = a.$instanceValues$.get(t), c = a.$flags$, u = o;
450
+ r = Ts(r, s.$members$[t][0]);
451
+ const l = Number.isNaN(n) && Number.isNaN(r);
452
+ if (r !== n && !l) {
453
+ a.$instanceValues$.set(t, r);
454
+ {
455
+ if (s.$watchers$ && c & 128) {
456
+ const p = s.$watchers$[t];
457
+ p && p.map((m) => {
458
+ try {
459
+ u[m](r, n, t);
460
+ } catch (b) {
461
+ yt(b, o);
462
+ }
463
+ });
464
+ }
465
+ (c & 18) === 2 && tr(a, !1);
466
+ }
467
+ }
468
+ }, qn = (e, t, r) => {
469
+ var s, a;
470
+ const o = e.prototype;
471
+ if (t.$members$ || t.$watchers$ || e.watchers) {
472
+ e.watchers && !t.$watchers$ && (t.$watchers$ = e.watchers);
473
+ const n = Object.entries((s = t.$members$) != null ? s : {});
474
+ n.map(([c, [u]]) => {
475
+ if (u & 31 || u & 32) {
476
+ const { get: l, set: i } = Object.getOwnPropertyDescriptor(o, c) || {};
477
+ l && (t.$members$[c][0] |= 2048), i && (t.$members$[c][0] |= 4096), Object.defineProperty(o, c, {
478
+ get() {
479
+ return l ? l.apply(this) : Vn(this, c);
480
+ },
481
+ configurable: !0,
482
+ enumerable: !0
483
+ }), Object.defineProperty(o, c, {
484
+ set(p) {
485
+ const m = Se(this);
486
+ if (i) {
487
+ const b = u & 32 ? this[c] : m.$hostElement$[c];
488
+ typeof b > "u" && m.$instanceValues$.get(c) ? p = m.$instanceValues$.get(c) : !m.$instanceValues$.get(c) && b && m.$instanceValues$.set(c, b), i.apply(this, [Ts(p, u)]), p = u & 32 ? this[c] : m.$hostElement$[c], ss(this, c, p, t);
489
+ return;
490
+ }
491
+ {
492
+ ss(this, c, p, t);
493
+ return;
494
+ }
495
+ }
496
+ });
497
+ }
498
+ });
499
+ {
500
+ const c = /* @__PURE__ */ new Map();
501
+ o.attributeChangedCallback = function(u, l, i) {
502
+ J.jmp(() => {
503
+ var p;
504
+ const m = c.get(u);
505
+ if (!(this.hasOwnProperty(m) && Le.lazyLoad)) {
506
+ if (o.hasOwnProperty(m) && typeof this[m] == "number" && // cast type to number to avoid TS compiler issues
507
+ this[m] == i)
508
+ return;
509
+ if (m == null) {
510
+ const v = Se(this), x = v == null ? void 0 : v.$flags$;
511
+ if (x && !(x & 8) && x & 128 && i !== l) {
512
+ const ee = this, M = (p = t.$watchers$) == null ? void 0 : p[u];
513
+ M == null || M.forEach((De) => {
514
+ ee[De] != null && ee[De].call(ee, i, l, u);
515
+ });
516
+ }
517
+ return;
518
+ }
519
+ }
520
+ const b = Object.getOwnPropertyDescriptor(o, m);
521
+ i = i === null && typeof this[m] == "boolean" ? !1 : i, i !== this[m] && (!b.get || b.set) && (this[m] = i);
522
+ });
523
+ }, e.observedAttributes = Array.from(
524
+ /* @__PURE__ */ new Set([
525
+ ...Object.keys((a = t.$watchers$) != null ? a : {}),
526
+ ...n.filter(
527
+ ([u, l]) => l[0] & 15
528
+ /* HasAttribute */
529
+ ).map(([u, l]) => {
530
+ const i = l[1] || u;
531
+ return c.set(i, u), i;
532
+ })
533
+ ])
534
+ );
535
+ }
536
+ }
537
+ return e;
538
+ }, Yn = async (e, t, r, s) => {
539
+ if (!(t.$flags$ & 32)) {
540
+ t.$flags$ |= 32;
541
+ {
542
+ const n = e.localName;
543
+ customElements.whenDefined(n).then(
544
+ () => t.$flags$ |= 128
545
+ /* isWatchReady */
546
+ );
547
+ }
548
+ }
549
+ const a = t.$ancestorComponent$, o = () => tr(t, !0);
550
+ a && a["s-rc"] ? a["s-rc"].push(o) : o();
551
+ }, Qn = (e, t) => {
552
+ }, Kn = (e) => {
553
+ if (!(J.$flags$ & 1)) {
554
+ const t = Se(e), r = t.$cmpMeta$, s = Ke("connectedCallback", r.$tagName$);
555
+ if (t.$flags$ & 1)
556
+ t != null && t.$lazyInstance$ || t != null && t.$onReadyPromise$ && t.$onReadyPromise$.then(() => Qn());
557
+ else {
558
+ t.$flags$ |= 1, // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
559
+ r.$flags$ & 12 && Xn(e);
560
+ {
561
+ let a = e;
562
+ for (; a = a.parentNode || a.host; )
563
+ if (a["s-p"]) {
564
+ As(t, t.$ancestorComponent$ = a);
565
+ break;
566
+ }
567
+ }
568
+ r.$members$ && Object.entries(r.$members$).map(([a, [o]]) => {
569
+ if (o & 31 && e.hasOwnProperty(a)) {
570
+ const n = e[a];
571
+ delete e[a], e[a] = n;
572
+ }
573
+ }), Yn(e, t);
574
+ }
575
+ s();
576
+ }
577
+ }, Xn = (e) => {
578
+ const t = e["s-cr"] = Oe.createComment(
579
+ ""
580
+ );
581
+ t["s-cn"] = !0, ye(e, t, e.firstChild);
582
+ }, Zn = async (e) => {
583
+ J.$flags$ & 1 || Se(e), ut.has(e) && ut.delete(e), e.shadowRoot && ut.has(e.shadowRoot) && ut.delete(e.shadowRoot);
584
+ }, F = (e, t) => {
585
+ const r = {
586
+ $flags$: t[0],
587
+ $tagName$: t[1]
588
+ };
589
+ r.$members$ = t[2], r.$watchers$ = e.$watchers$;
590
+ const s = e.prototype.connectedCallback, a = e.prototype.disconnectedCallback;
591
+ return Object.assign(e.prototype, {
592
+ __hasHostListenerAttached: !1,
593
+ __registerHost() {
594
+ yn(this, r);
595
+ },
596
+ connectedCallback() {
597
+ this.__hasHostListenerAttached || (Se(this), this.__hasHostListenerAttached = !0), Kn(this), s && s.call(this);
598
+ },
599
+ disconnectedCallback() {
600
+ Zn(this), a && a.call(this), J.raf(() => {
601
+ var o;
602
+ const n = Se(this);
603
+ ((o = n == null ? void 0 : n.$vnode$) == null ? void 0 : o.$elm$) instanceof Node && !n.$vnode$.$elm$.isConnected && delete n.$vnode$, this instanceof Node && !this.isConnected && bn(this);
604
+ });
605
+ },
606
+ __attachShadow() {
607
+ this.shadowRoot = this;
608
+ }
609
+ }), e.is = r.$tagName$, qn(e, r);
610
+ }, Ms = (e, t) => t, Jn = Object.defineProperty, eo = (e, t, r) => t in e ? Jn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, A = (e, t, r) => eo(e, typeof t != "symbol" ? t + "" : t, r), Te = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(Te || {});
611
+ class to {
612
+ constructor(t) {
613
+ A(this, "logLevel"), A(this, "logFormatter"), this.logLevel = t.logLevel || 1, this.logFormatter = t.logFormatter || this.defaultFormatter;
614
+ }
615
+ defaultFormatter(t, r) {
616
+ return `[${Te[t]}] ${(/* @__PURE__ */ new Date()).toISOString()}: ${r}`;
617
+ }
618
+ debug(t) {
619
+ this.logLevel <= 0 && console.log(this.logFormatter(0, t));
620
+ }
621
+ info(t) {
622
+ this.logLevel <= 1 && console.info(this.logFormatter(1, t));
623
+ }
624
+ warn(t) {
625
+ this.logLevel <= 2 && console.warn(this.logFormatter(2, t));
626
+ }
627
+ error(t) {
628
+ this.logLevel <= 3 && console.error(this.logFormatter(3, t));
629
+ }
630
+ log(t, r) {
631
+ switch (t) {
632
+ case 0:
633
+ this.debug(r);
634
+ break;
635
+ case 1:
636
+ this.info(r);
637
+ break;
638
+ case 2:
639
+ this.warn(r);
640
+ break;
641
+ case 3:
642
+ this.error(r);
643
+ break;
644
+ }
645
+ }
646
+ }
647
+ function de(e, t, r, s) {
648
+ return new (r || (r = Promise))(function(a, o) {
649
+ function n(l) {
650
+ try {
651
+ u(s.next(l));
652
+ } catch (i) {
653
+ o(i);
654
+ }
655
+ }
656
+ function c(l) {
657
+ try {
658
+ u(s.throw(l));
659
+ } catch (i) {
660
+ o(i);
661
+ }
662
+ }
663
+ function u(l) {
664
+ var i;
665
+ l.done ? a(l.value) : (i = l.value, i instanceof r ? i : new r(function(p) {
666
+ p(i);
667
+ })).then(n, c);
668
+ }
669
+ u((s = s.apply(e, [])).next());
670
+ });
671
+ }
672
+ function he(e, t) {
673
+ var r, s, a, o, n = { label: 0, sent: function() {
674
+ if (1 & a[0]) throw a[1];
675
+ return a[1];
676
+ }, trys: [], ops: [] };
677
+ return o = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
678
+ return this;
679
+ }), o;
680
+ function c(u) {
681
+ return function(l) {
682
+ return function(i) {
683
+ if (r) throw new TypeError("Generator is already executing.");
684
+ for (; o && (o = 0, i[0] && (n = 0)), n; ) try {
685
+ if (r = 1, s && (a = 2 & i[0] ? s.return : i[0] ? s.throw || ((a = s.return) && a.call(s), 0) : s.next) && !(a = a.call(s, i[1])).done) return a;
686
+ switch (s = 0, a && (i = [2 & i[0], a.value]), i[0]) {
687
+ case 0:
688
+ case 1:
689
+ a = i;
690
+ break;
691
+ case 4:
692
+ return n.label++, { value: i[1], done: !1 };
693
+ case 5:
694
+ n.label++, s = i[1], i = [0];
695
+ continue;
696
+ case 7:
697
+ i = n.ops.pop(), n.trys.pop();
698
+ continue;
699
+ default:
700
+ if (a = n.trys, !((a = a.length > 0 && a[a.length - 1]) || i[0] !== 6 && i[0] !== 2)) {
701
+ n = 0;
702
+ continue;
703
+ }
704
+ if (i[0] === 3 && (!a || i[1] > a[0] && i[1] < a[3])) {
705
+ n.label = i[1];
706
+ break;
707
+ }
708
+ if (i[0] === 6 && n.label < a[1]) {
709
+ n.label = a[1], a = i;
710
+ break;
711
+ }
712
+ if (a && n.label < a[2]) {
713
+ n.label = a[2], n.ops.push(i);
714
+ break;
715
+ }
716
+ a[2] && n.ops.pop(), n.trys.pop();
717
+ continue;
718
+ }
719
+ i = t.call(e, n);
720
+ } catch (p) {
721
+ i = [6, p], s = 0;
722
+ } finally {
723
+ r = a = 0;
724
+ }
725
+ if (5 & i[0]) throw i[1];
726
+ return { value: i[0] ? i[1] : void 0, done: !0 };
727
+ }([u, l]);
728
+ };
729
+ }
730
+ }
731
+ var pe = { exclude: [] }, Os = {}, ro = { timeout: "true" }, ae = function(e, t) {
732
+ typeof window < "u" && (Os[e] = t);
733
+ }, so = function() {
734
+ return Object.fromEntries(Object.entries(Os).filter(function(e) {
735
+ var t, r = e[0];
736
+ return !(!((t = pe == null ? void 0 : pe.exclude) === null || t === void 0) && t.includes(r));
737
+ }).map(function(e) {
738
+ return [e[0], (0, e[1])()];
739
+ }));
740
+ };
741
+ function dt(e) {
742
+ return e ^= e >>> 16, e = Math.imul(e, 2246822507), e ^= e >>> 13, e = Math.imul(e, 3266489909), (e ^= e >>> 16) >>> 0;
743
+ }
744
+ var W = new Uint32Array([597399067, 2869860233, 951274213, 2716044179]);
745
+ function re(e, t) {
746
+ return e << t | e >>> 32 - t;
747
+ }
748
+ function rr(e, t) {
749
+ var r;
750
+ if (t === void 0 && (t = 0), t = t ? 0 | t : 0, typeof e == "string" && (r = e, e = new TextEncoder().encode(r).buffer), !(e instanceof ArrayBuffer)) throw new TypeError("Expected key to be ArrayBuffer or string");
751
+ var s = new Uint32Array([t, t, t, t]);
752
+ (function(o, n) {
753
+ for (var c = o.byteLength / 16 | 0, u = new Uint32Array(o, 0, 4 * c), l = 0; l < c; l++) {
754
+ var i = u.subarray(4 * l, 4 * (l + 1));
755
+ i[0] = Math.imul(i[0], W[0]), i[0] = re(i[0], 15), i[0] = Math.imul(i[0], W[1]), n[0] = n[0] ^ i[0], n[0] = re(n[0], 19), n[0] = n[0] + n[1], n[0] = Math.imul(n[0], 5) + 1444728091, i[1] = Math.imul(i[1], W[1]), i[1] = re(i[1], 16), i[1] = Math.imul(i[1], W[2]), n[1] = n[1] ^ i[1], n[1] = re(n[1], 17), n[1] = n[1] + n[2], n[1] = Math.imul(n[1], 5) + 197830471, i[2] = Math.imul(i[2], W[2]), i[2] = re(i[2], 17), i[2] = Math.imul(i[2], W[3]), n[2] = n[2] ^ i[2], n[2] = re(n[2], 15), n[2] = n[2] + n[3], n[2] = Math.imul(n[2], 5) + 2530024501, i[3] = Math.imul(i[3], W[3]), i[3] = re(i[3], 18), i[3] = Math.imul(i[3], W[0]), n[3] = n[3] ^ i[3], n[3] = re(n[3], 13), n[3] = n[3] + n[0], n[3] = Math.imul(n[3], 5) + 850148119;
756
+ }
757
+ })(e, s), function(o, n) {
758
+ var c = o.byteLength / 16 | 0, u = o.byteLength % 16, l = new Uint32Array(4), i = new Uint8Array(o, 16 * c, u);
759
+ switch (u) {
760
+ case 15:
761
+ l[3] = l[3] ^ i[14] << 16;
762
+ case 14:
763
+ l[3] = l[3] ^ i[13] << 8;
764
+ case 13:
765
+ l[3] = l[3] ^ i[12] << 0, l[3] = Math.imul(l[3], W[3]), l[3] = re(l[3], 18), l[3] = Math.imul(l[3], W[0]), n[3] = n[3] ^ l[3];
766
+ case 12:
767
+ l[2] = l[2] ^ i[11] << 24;
768
+ case 11:
769
+ l[2] = l[2] ^ i[10] << 16;
770
+ case 10:
771
+ l[2] = l[2] ^ i[9] << 8;
772
+ case 9:
773
+ l[2] = l[2] ^ i[8] << 0, l[2] = Math.imul(l[2], W[2]), l[2] = re(l[2], 17), l[2] = Math.imul(l[2], W[3]), n[2] = n[2] ^ l[2];
774
+ case 8:
775
+ l[1] = l[1] ^ i[7] << 24;
776
+ case 7:
777
+ l[1] = l[1] ^ i[6] << 16;
778
+ case 6:
779
+ l[1] = l[1] ^ i[5] << 8;
780
+ case 5:
781
+ l[1] = l[1] ^ i[4] << 0, l[1] = Math.imul(l[1], W[1]), l[1] = re(l[1], 16), l[1] = Math.imul(l[1], W[2]), n[1] = n[1] ^ l[1];
782
+ case 4:
783
+ l[0] = l[0] ^ i[3] << 24;
784
+ case 3:
785
+ l[0] = l[0] ^ i[2] << 16;
786
+ case 2:
787
+ l[0] = l[0] ^ i[1] << 8;
788
+ case 1:
789
+ l[0] = l[0] ^ i[0] << 0, l[0] = Math.imul(l[0], W[0]), l[0] = re(l[0], 15), l[0] = Math.imul(l[0], W[1]), n[0] = n[0] ^ l[0];
790
+ }
791
+ }(e, s), function(o, n) {
792
+ n[0] = n[0] ^ o.byteLength, n[1] = n[1] ^ o.byteLength, n[2] = n[2] ^ o.byteLength, n[3] = n[3] ^ o.byteLength, n[0] = n[0] + n[1] | 0, n[0] = n[0] + n[2] | 0, n[0] = n[0] + n[3] | 0, n[1] = n[1] + n[0] | 0, n[2] = n[2] + n[0] | 0, n[3] = n[3] + n[0] | 0, n[0] = dt(n[0]), n[1] = dt(n[1]), n[2] = dt(n[2]), n[3] = dt(n[3]), n[0] = n[0] + n[1] | 0, n[0] = n[0] + n[2] | 0, n[0] = n[0] + n[3] | 0, n[1] = n[1] + n[0] | 0, n[2] = n[2] + n[0] | 0, n[3] = n[3] + n[0] | 0;
793
+ }(e, s);
794
+ var a = new Uint8Array(s.buffer);
795
+ return Array.from(a).map(function(o) {
796
+ return o.toString(16).padStart(2, "0");
797
+ }).join("");
798
+ }
799
+ function ao(e, t) {
800
+ return new Promise(function(r) {
801
+ setTimeout(function() {
802
+ return r(t);
803
+ }, e);
804
+ });
805
+ }
806
+ function no(e, t, r) {
807
+ return Promise.all(e.map(function(s) {
808
+ return Promise.race([s, ao(t, r)]);
809
+ }));
810
+ }
811
+ function oo() {
812
+ return de(this, void 0, void 0, function() {
813
+ var e, t, r, s, a;
814
+ return he(this, function(o) {
815
+ switch (o.label) {
816
+ case 0:
817
+ return o.trys.push([0, 2, , 3]), e = so(), t = Object.keys(e), [4, no(Object.values(e), (pe == null ? void 0 : pe.timeout) || 1e3, ro)];
818
+ case 1:
819
+ return r = o.sent(), s = r.filter(function(n) {
820
+ return n !== void 0;
821
+ }), a = {}, s.forEach(function(n, c) {
822
+ a[t[c]] = n;
823
+ }), [2, Ls(a, pe.exclude || [])];
824
+ case 2:
825
+ throw o.sent();
826
+ case 3:
827
+ return [2];
828
+ }
829
+ });
830
+ });
831
+ }
832
+ function Ls(e, t) {
833
+ var r = {}, s = function(o) {
834
+ if (e.hasOwnProperty(o)) {
835
+ var n = e[o];
836
+ if (typeof n != "object" || Array.isArray(n)) t.includes(o) || (r[o] = n);
837
+ else {
838
+ var c = Ls(n, t.map(function(u) {
839
+ return u.startsWith(o + ".") ? u.slice(o.length + 1) : u;
840
+ }));
841
+ Object.keys(c).length > 0 && (r[o] = c);
842
+ }
843
+ }
844
+ };
845
+ for (var a in e) s(a);
846
+ return r;
847
+ }
848
+ function co(e) {
849
+ return de(this, void 0, void 0, function() {
850
+ var t, r;
851
+ return he(this, function(s) {
852
+ switch (s.label) {
853
+ case 0:
854
+ return s.trys.push([0, 2, , 3]), [4, oo()];
855
+ case 1:
856
+ return t = s.sent(), r = rr(JSON.stringify(t)), [2, r.toString()];
857
+ case 2:
858
+ throw s.sent();
859
+ case 3:
860
+ return [2];
861
+ }
862
+ });
863
+ });
864
+ }
865
+ function io(e) {
866
+ for (var t = 0, r = 0; r < e.length; ++r) t += Math.abs(e[r]);
867
+ return t;
868
+ }
869
+ function Fs(e, t, r) {
870
+ for (var s = [], a = 0; a < e[0].data.length; a++) {
871
+ for (var o = [], n = 0; n < e.length; n++) o.push(e[n].data[a]);
872
+ s.push(lo(o));
873
+ }
874
+ var c = new Uint8ClampedArray(s);
875
+ return new ImageData(c, t, r);
876
+ }
877
+ function lo(e) {
878
+ if (e.length === 0) return 0;
879
+ for (var t = {}, r = 0, s = e; r < s.length; r++)
880
+ t[o = s[r]] = (t[o] || 0) + 1;
881
+ var a = e[0];
882
+ for (var o in t) t[o] > t[a] && (a = parseInt(o, 10));
883
+ return a;
884
+ }
885
+ function Je() {
886
+ if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
887
+ for (var e = navigator.userAgent, t = { Edg: "Edge", OPR: "Opera" }, r = 0, s = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; r < s.length; r++) {
888
+ var a = s[r], o = e.match(a);
889
+ if (o && o.groups) return { name: t[o.groups.name] || o.groups.name, version: o.groups.version };
890
+ }
891
+ return { name: "unknown", version: "unknown" };
892
+ }
893
+ ae("audio", function() {
894
+ return de(this, void 0, void 0, function() {
895
+ return he(this, function(e) {
896
+ return [2, new Promise(function(t, r) {
897
+ try {
898
+ var s = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), a = s.createBufferSource(), o = s.createOscillator();
899
+ o.frequency.value = 1e3;
900
+ var n, c = s.createDynamicsCompressor();
901
+ c.threshold.value = -50, c.knee.value = 40, c.ratio.value = 12, c.attack.value = 0, c.release.value = 0.2, o.connect(c), c.connect(s.destination), o.start(), s.oncomplete = function(u) {
902
+ n = u.renderedBuffer.getChannelData(0), t({ sampleHash: io(n), oscillator: o.type, maxChannels: s.destination.maxChannelCount, channelCountMode: a.channelCountMode });
903
+ }, s.startRendering();
904
+ } catch (u) {
905
+ console.error("Error creating audio fingerprint:", u), r(u);
906
+ }
907
+ })];
908
+ });
909
+ });
910
+ });
911
+ var uo = Je().name !== "SamsungBrowser" ? 1 : 3, as = 280, ns = 20;
912
+ Je().name != "Firefox" && ae("canvas", function() {
913
+ return document.createElement("canvas").getContext("2d"), new Promise(function(e) {
914
+ var t = Array.from({ length: uo }, function() {
915
+ return function() {
916
+ var r = document.createElement("canvas"), s = r.getContext("2d");
917
+ if (!s) return new ImageData(1, 1);
918
+ r.width = as, r.height = ns;
919
+ var a = s.createLinearGradient(0, 0, r.width, r.height);
920
+ a.addColorStop(0, "red"), a.addColorStop(0.16666666666666666, "orange"), a.addColorStop(0.3333333333333333, "yellow"), a.addColorStop(0.5, "green"), a.addColorStop(0.6666666666666666, "blue"), a.addColorStop(0.8333333333333334, "indigo"), a.addColorStop(1, "violet"), s.fillStyle = a, s.fillRect(0, 0, r.width, r.height);
921
+ var o = "Random Text WMwmil10Oo";
922
+ s.font = "23.123px Arial", s.fillStyle = "black", s.fillText(o, -5, 15), s.fillStyle = "rgba(0, 0, 255, 0.5)", s.fillText(o, -3.3, 17.7), s.beginPath(), s.moveTo(0, 0), s.lineTo(2 * r.width / 7, r.height), s.strokeStyle = "white", s.lineWidth = 2, s.stroke();
923
+ var n = s.getImageData(0, 0, r.width, r.height);
924
+ return n;
925
+ }();
926
+ });
927
+ e({ commonImageDataHash: rr(Fs(t, as, ns).data.toString()).toString() });
928
+ });
929
+ });
930
+ var Wt, fo = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], ho = ["monospace", "sans-serif", "serif"];
931
+ function os(e, t) {
932
+ if (!e) throw new Error("Canvas context not supported");
933
+ return e.font = "72px ".concat(t), e.measureText("WwMmLli0Oo").width;
934
+ }
935
+ function po() {
936
+ var e, t = document.createElement("canvas"), r = (e = t.getContext("webgl")) !== null && e !== void 0 ? e : t.getContext("experimental-webgl");
937
+ if (r && "getParameter" in r) try {
938
+ var s = (r.getParameter(r.VENDOR) || "").toString(), a = (r.getParameter(r.RENDERER) || "").toString(), o = { vendor: s, renderer: a, version: (r.getParameter(r.VERSION) || "").toString(), shadingLanguageVersion: (r.getParameter(r.SHADING_LANGUAGE_VERSION) || "").toString() };
939
+ if (!a.length || !s.length) {
940
+ var n = r.getExtension("WEBGL_debug_renderer_info");
941
+ if (n) {
942
+ var c = (r.getParameter(n.UNMASKED_VENDOR_WEBGL) || "").toString(), u = (r.getParameter(n.UNMASKED_RENDERER_WEBGL) || "").toString();
943
+ c && (o.vendorUnmasked = c), u && (o.rendererUnmasked = u);
944
+ }
945
+ }
946
+ return o;
947
+ } catch {
948
+ }
949
+ return "undefined";
950
+ }
951
+ function mo() {
952
+ var e = new Float32Array(1), t = new Uint8Array(e.buffer);
953
+ return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
954
+ }
955
+ function go(e, t) {
956
+ var r = {};
957
+ return t.forEach(function(s) {
958
+ var a = function(o) {
959
+ if (o.length === 0) return null;
960
+ var n = {};
961
+ o.forEach(function(l) {
962
+ var i = String(l);
963
+ n[i] = (n[i] || 0) + 1;
964
+ });
965
+ var c = o[0], u = 1;
966
+ return Object.keys(n).forEach(function(l) {
967
+ n[l] > u && (c = l, u = n[l]);
968
+ }), c;
969
+ }(e.map(function(o) {
970
+ return s in o ? o[s] : void 0;
971
+ }).filter(function(o) {
972
+ return o !== void 0;
973
+ }));
974
+ a && (r[s] = a);
975
+ }), r;
976
+ }
977
+ function vo() {
978
+ var e = [], t = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] };
979
+ return Object.keys(t).forEach(function(r) {
980
+ t[r].forEach(function(s) {
981
+ matchMedia("(".concat(r, ": ").concat(s, ")")).matches && e.push("".concat(r, ": ").concat(s));
982
+ });
983
+ }), e;
984
+ }
985
+ function bo() {
986
+ if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
987
+ for (var e = window.ApplePaySession.supportsVersion, t = 15; t > 0; t--) if (e(t)) return t;
988
+ } catch {
989
+ return 0;
990
+ }
991
+ return 0;
992
+ }
993
+ Je().name != "Firefox" && ae("fonts", function() {
994
+ var e = this;
995
+ return new Promise(function(t, r) {
996
+ try {
997
+ (function(s) {
998
+ var a;
999
+ de(this, void 0, void 0, function() {
1000
+ var o, n, c;
1001
+ return he(this, function(u) {
1002
+ switch (u.label) {
1003
+ case 0:
1004
+ return document.body ? [3, 2] : [4, (l = 50, new Promise(function(p) {
1005
+ return setTimeout(p, l, i);
1006
+ }))];
1007
+ case 1:
1008
+ return u.sent(), [3, 0];
1009
+ case 2:
1010
+ if ((o = document.createElement("iframe")).setAttribute("frameBorder", "0"), (n = o.style).setProperty("position", "fixed"), n.setProperty("display", "block", "important"), n.setProperty("visibility", "visible"), n.setProperty("border", "0"), n.setProperty("opacity", "0"), o.src = "about:blank", document.body.appendChild(o), !(c = o.contentDocument || ((a = o.contentWindow) === null || a === void 0 ? void 0 : a.document))) throw new Error("Iframe document is not accessible");
1011
+ return s({ iframe: c }), setTimeout(function() {
1012
+ document.body.removeChild(o);
1013
+ }, 0), [2];
1014
+ }
1015
+ var l, i;
1016
+ });
1017
+ });
1018
+ })(function(s) {
1019
+ var a = s.iframe;
1020
+ return de(e, void 0, void 0, function() {
1021
+ var o, n, c, u;
1022
+ return he(this, function(l) {
1023
+ return o = a.createElement("canvas"), n = o.getContext("2d"), c = ho.map(function(i) {
1024
+ return os(n, i);
1025
+ }), u = {}, fo.forEach(function(i) {
1026
+ var p = os(n, i);
1027
+ c.includes(p) || (u[i] = p);
1028
+ }), t(u), [2];
1029
+ });
1030
+ });
1031
+ });
1032
+ } catch {
1033
+ r({ error: "unsupported" });
1034
+ }
1035
+ });
1036
+ }), ae("hardware", function() {
1037
+ return new Promise(function(e, t) {
1038
+ var r = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, s = window.performance && window.performance.memory ? window.performance.memory : 0;
1039
+ e({ videocard: po(), architecture: mo(), deviceMemory: r.toString() || "undefined", jsHeapSizeLimit: s.jsHeapSizeLimit || 0 });
1040
+ });
1041
+ }), ae("locales", function() {
1042
+ return new Promise(function(e) {
1043
+ e({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
1044
+ });
1045
+ }), ae("permissions", function() {
1046
+ return de(this, void 0, void 0, function() {
1047
+ var e;
1048
+ return he(this, function(t) {
1049
+ return Wt = (pe == null ? void 0 : pe.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], e = Array.from({ length: (pe == null ? void 0 : pe.retries) || 3 }, function() {
1050
+ return function() {
1051
+ return de(this, void 0, void 0, function() {
1052
+ var r, s, a, o, n;
1053
+ return he(this, function(c) {
1054
+ switch (c.label) {
1055
+ case 0:
1056
+ r = {}, s = 0, a = Wt, c.label = 1;
1057
+ case 1:
1058
+ if (!(s < a.length)) return [3, 6];
1059
+ o = a[s], c.label = 2;
1060
+ case 2:
1061
+ return c.trys.push([2, 4, , 5]), [4, navigator.permissions.query({ name: o })];
1062
+ case 3:
1063
+ return n = c.sent(), r[o] = n.state.toString(), [3, 5];
1064
+ case 4:
1065
+ return c.sent(), [3, 5];
1066
+ case 5:
1067
+ return s++, [3, 1];
1068
+ case 6:
1069
+ return [2, r];
1070
+ }
1071
+ });
1072
+ });
1073
+ }();
1074
+ }), [2, Promise.all(e).then(function(r) {
1075
+ return go(r, Wt);
1076
+ })];
1077
+ });
1078
+ });
1079
+ }), ae("plugins", function() {
1080
+ var e = [];
1081
+ if (navigator.plugins) for (var t = 0; t < navigator.plugins.length; t++) {
1082
+ var r = navigator.plugins[t];
1083
+ e.push([r.name, r.filename, r.description].join("|"));
1084
+ }
1085
+ return new Promise(function(s) {
1086
+ s({ plugins: e });
1087
+ });
1088
+ }), ae("screen", function() {
1089
+ return new Promise(function(e) {
1090
+ e({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: vo() });
1091
+ });
1092
+ }), ae("system", function() {
1093
+ return new Promise(function(e) {
1094
+ var t = Je();
1095
+ e({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, hardwareConcurrency: navigator.hardwareConcurrency, browser: { name: t.name, version: t.version }, applePayVersion: bo() });
1096
+ });
1097
+ });
1098
+ var K, yo = Je().name !== "SamsungBrowser" ? 1 : 3, w = null;
1099
+ ae("webgl", function() {
1100
+ return de(this, void 0, void 0, function() {
1101
+ var e;
1102
+ return he(this, function(t) {
1103
+ typeof document < "u" && ((K = document.createElement("canvas")).width = 200, K.height = 100, w = K.getContext("webgl"));
1104
+ try {
1105
+ if (!w) throw new Error("WebGL not supported");
1106
+ return e = Array.from({ length: yo }, function() {
1107
+ return function() {
1108
+ try {
1109
+ if (!w) throw new Error("WebGL not supported");
1110
+ var r = `
1111
+ attribute vec2 position;
1112
+ void main() {
1113
+ gl_Position = vec4(position, 0.0, 1.0);
1114
+ }
1115
+ `, s = `
1116
+ precision mediump float;
1117
+ void main() {
1118
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
1119
+ }
1120
+ `, a = w.createShader(w.VERTEX_SHADER), o = w.createShader(w.FRAGMENT_SHADER);
1121
+ if (!a || !o) throw new Error("Failed to create shaders");
1122
+ if (w.shaderSource(a, r), w.shaderSource(o, s), w.compileShader(a), !w.getShaderParameter(a, w.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + w.getShaderInfoLog(a));
1123
+ if (w.compileShader(o), !w.getShaderParameter(o, w.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + w.getShaderInfoLog(o));
1124
+ var n = w.createProgram();
1125
+ if (!n) throw new Error("Failed to create shader program");
1126
+ if (w.attachShader(n, a), w.attachShader(n, o), w.linkProgram(n), !w.getProgramParameter(n, w.LINK_STATUS)) throw new Error("Shader program linking failed: " + w.getProgramInfoLog(n));
1127
+ w.useProgram(n);
1128
+ for (var c = 137, u = new Float32Array(4 * c), l = 2 * Math.PI / c, i = 0; i < c; i++) {
1129
+ var p = i * l;
1130
+ u[4 * i] = 0, u[4 * i + 1] = 0, u[4 * i + 2] = Math.cos(p) * (K.width / 2), u[4 * i + 3] = Math.sin(p) * (K.height / 2);
1131
+ }
1132
+ var m = w.createBuffer();
1133
+ w.bindBuffer(w.ARRAY_BUFFER, m), w.bufferData(w.ARRAY_BUFFER, u, w.STATIC_DRAW);
1134
+ var b = w.getAttribLocation(n, "position");
1135
+ w.enableVertexAttribArray(b), w.vertexAttribPointer(b, 2, w.FLOAT, !1, 0, 0), w.viewport(0, 0, K.width, K.height), w.clearColor(0, 0, 0, 1), w.clear(w.COLOR_BUFFER_BIT), w.drawArrays(w.LINES, 0, 2 * c);
1136
+ var v = new Uint8ClampedArray(K.width * K.height * 4);
1137
+ return w.readPixels(0, 0, K.width, K.height, w.RGBA, w.UNSIGNED_BYTE, v), new ImageData(v, K.width, K.height);
1138
+ } catch {
1139
+ return new ImageData(1, 1);
1140
+ } finally {
1141
+ w && (w.bindBuffer(w.ARRAY_BUFFER, null), w.useProgram(null), w.viewport(0, 0, w.drawingBufferWidth, w.drawingBufferHeight), w.clearColor(0, 0, 0, 0));
1142
+ }
1143
+ }();
1144
+ }), [2, { commonImageHash: rr(Fs(e, K.width, K.height).data.toString()).toString() }];
1145
+ } catch {
1146
+ return [2, { webgl: "unsupported" }];
1147
+ }
1148
+ return [2];
1149
+ });
1150
+ });
1151
+ });
1152
+ var Re = function(e, t, r, s) {
1153
+ for (var a = (r - t) / s, o = 0, n = 0; n < s; n++)
1154
+ o += e(t + (n + 0.5) * a);
1155
+ return o * a;
1156
+ };
1157
+ ae("math", function() {
1158
+ return de(void 0, void 0, void 0, function() {
1159
+ return he(this, function(e) {
1160
+ return [2, { acos: Math.acos(0.5), asin: Re(Math.asin, -1, 1, 97), atan: Re(Math.atan, -1, 1, 97), cos: Re(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: Re(Math.sin, -Math.PI, Math.PI, 97), sinh: Re(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: Re(Math.tan, 0, 2 * Math.PI, 97), tanh: Re(Math.tanh, -9 / 7, 7 / 9, 97) }];
1161
+ });
1162
+ });
1163
+ });
1164
+ const So = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1165
+ let bt = (e = 21) => {
1166
+ let t = "", r = crypto.getRandomValues(new Uint8Array(e |= 0));
1167
+ for (; e--; )
1168
+ t += So[r[e] & 63];
1169
+ return t;
1170
+ };
1171
+ class sr {
1172
+ constructor(t) {
1173
+ A(this, "config"), this.config = t;
1174
+ }
1175
+ async getAdsForSearchParams(t) {
1176
+ return [];
1177
+ }
1178
+ async onQuerySubmitted(t) {
1179
+ }
1180
+ async onQueryFetched(t, r) {
1181
+ }
1182
+ async onInputCleared() {
1183
+ }
1184
+ async onAdContainerRendered(t) {
1185
+ }
1186
+ async onAdContainerViewed(t) {
1187
+ }
1188
+ }
1189
+ class Eo extends sr {
1190
+ /**
1191
+ * Gets ads from the adMarketplace API based on the search term.
1192
+ */
1193
+ async getAdsForSearchParams(t) {
1194
+ if (!this.config.admSub)
1195
+ return console.error("No admSub specified in config."), [];
1196
+ const r = `https://demofeed.is.ampfeed.com/is?${new URLSearchParams({
1197
+ partner: "demofeed",
1198
+ sub1: this.config.admSub,
1199
+ qt: t.searchTerm,
1200
+ v: "2.0",
1201
+ rfr: "searchcraft.io",
1202
+ "results-ta": `${this.config.admTextAdQuantity || 0}`,
1203
+ "results-pa": `${this.config.admProductAdQuantity || 0}`
1204
+ }).toString()}`, s = await (await fetch(r, { method: "GET" })).json(), a = s.product_ads.map(
1205
+ (n) => ({
1206
+ id: bt(),
1207
+ adSource: "adMarketplace",
1208
+ admAdType: "adm-product-ad",
1209
+ admAd: n
1210
+ })
1211
+ ), o = s.text_ads.map((n) => ({
1212
+ id: bt(),
1213
+ adSource: "adMarketplace",
1214
+ admAdType: "adm-text-ad",
1215
+ admAd: n
1216
+ }));
1217
+ return a.concat(o);
1218
+ }
1219
+ async onAdContainerViewed(t) {
1220
+ var r;
1221
+ const s = t.adClientResponseItem;
1222
+ (r = s.admAd) != null && r.impression_url && fetch(s.admAd.impression_url);
1223
+ }
1224
+ }
1225
+ class wo extends sr {
1226
+ async getAdsForSearchParams(t) {
1227
+ return [];
1228
+ }
1229
+ }
1230
+ const Ro = 1e3;
1231
+ class To extends sr {
1232
+ constructor(t) {
1233
+ super(t), A(this, "adCallTimeout"), this.addScriptTagToDocument();
1234
+ }
1235
+ async onQuerySubmitted(t) {
1236
+ this.addScriptTagToDocument();
1237
+ }
1238
+ async onQueryFetched(t, r) {
1239
+ var s;
1240
+ if ((((s = r.data.hits) == null ? void 0 : s.length) || 0) === 0) {
1241
+ this.removeScriptTagFromDocument();
1242
+ return;
1243
+ }
1244
+ this.performAdCall(Ro);
1245
+ }
1246
+ async onInputCleared() {
1247
+ this.removeScriptTagFromDocument();
1248
+ }
1249
+ performAdCall(t) {
1250
+ this.adCallTimeout && clearTimeout(this.adCallTimeout), this.adCallTimeout = setTimeout(() => {
1251
+ this.addScriptTagToDocument();
1252
+ try {
1253
+ PostRelease == null || PostRelease.Start({ ptd: [this.config.nativoPlacementId] });
1254
+ } catch (r) {
1255
+ console.error(r);
1256
+ }
1257
+ }, t);
1258
+ }
1259
+ async getAdsForSearchParams(t) {
1260
+ return [];
1261
+ }
1262
+ addScriptTagToDocument() {
1263
+ if (!document.head.querySelector("#nativo-tag")) {
1264
+ const t = document.createElement("script");
1265
+ t.type = "text/javascript", t.src = "https://s.ntv.io/serve/load.js", t.id = "nativo-tag", t.setAttribute("data-ntv-set-no-auto-start", "true"), document.head.appendChild(t);
1266
+ }
1267
+ }
1268
+ removeScriptTagFromDocument() {
1269
+ const t = document.head.querySelector("#nativo-tag");
1270
+ t && document.head.removeChild(t);
1271
+ }
1272
+ }
1273
+ const ko = 500;
1274
+ class Co {
1275
+ constructor(t, r, s) {
1276
+ A(this, "measureRequestTimeout"), A(this, "measureRequestsBatched", []), A(this, "config"), A(this, "sdkInfo"), A(this, "userId"), A(this, "sessionId"), A(this, "sendMeasureEvent", (a, o = {}, n = {}) => {
1277
+ const c = {
1278
+ event_name: a,
1279
+ properties: {
1280
+ searchcraft_index_names: this.config.index,
1281
+ session_id: this.sessionId,
1282
+ ...o
1283
+ },
1284
+ user: {
1285
+ ...this.measureRequestUser,
1286
+ ...n
1287
+ }
1288
+ };
1289
+ this.measureRequestsBatched.push(c), clearTimeout(this.measureRequestTimeout), this.measureRequestTimeout = setTimeout(async () => {
1290
+ const u = JSON.stringify({ items: this.measureRequestsBatched }), l = `${this.baseMeasureUrl}/batch`;
1291
+ try {
1292
+ const i = await fetch(l, {
1293
+ method: "POST",
1294
+ headers: {
1295
+ "Content-Type": "application/json",
1296
+ Authorization: this.config.readKey,
1297
+ "X-Sc-User-Id": this.userId
1298
+ },
1299
+ body: u,
1300
+ keepalive: !0
1301
+ });
1302
+ if (!i.ok)
1303
+ throw new Error(
1304
+ `Failed to send request: ${i.status} ${i.statusText}`
1305
+ );
1306
+ this.measureRequestsBatched = [];
1307
+ return;
1308
+ } catch (i) {
1309
+ throw console.error("Error sending MeasureRequest:", i), i;
1310
+ }
1311
+ }, ko);
1312
+ }), this.config = t, this.sdkInfo = r, this.userId = s, this.sessionId = bt(), this.sendMeasureEvent("sdk_initialized");
1313
+ }
1314
+ /**
1315
+ * Getter for the base url used by the /measure endpoints.
1316
+ */
1317
+ get baseMeasureUrl() {
1318
+ return `${this.config.endpointURL}/measure`;
1319
+ }
1320
+ /**
1321
+ * Getter for the measure request user. Uses config values + navigator values.
1322
+ */
1323
+ get measureRequestUser() {
1324
+ return {
1325
+ user_id: this.userId,
1326
+ locale: navigator.language || "en-US",
1327
+ os: navigator.userAgent.includes("Windows") ? "Windows" : navigator.userAgent.includes("Mac") ? "Mac" : navigator.userAgent.includes("Linux") ? "Linux" : "Unknown",
1328
+ platform: navigator.platform || "Unknown",
1329
+ sdk_name: this.sdkInfo.sdkName,
1330
+ sdk_version: this.sdkInfo.sdkVersion,
1331
+ user_agent: navigator.userAgent || "Unknown"
1332
+ };
1333
+ }
1334
+ }
1335
+ function Po(e) {
1336
+ const t = [];
1337
+ let r = "should";
1338
+ return e.facetPathsForIndexFields && Object.keys(e.facetPathsForIndexFields).forEach((s) => {
1339
+ var a;
1340
+ const o = (a = e.facetPathsForIndexFields) == null ? void 0 : a[s];
1341
+ o && (r = "must", t.push({
1342
+ occur: r,
1343
+ exact: {
1344
+ ctx: o.value
1345
+ }
1346
+ }));
1347
+ }), e.rangeValueForIndexFields && Object.keys(e.rangeValueForIndexFields).forEach((s) => {
1348
+ var a;
1349
+ const o = (a = e.rangeValueForIndexFields) == null ? void 0 : a[s];
1350
+ o && (r = "must", t.push({
1351
+ occur: r,
1352
+ exact: {
1353
+ ctx: o.value
1354
+ }
1355
+ }));
1356
+ }), e.sort === "desc" ? e.order_by = "date_published" : e.order_by = "", t.push({
1357
+ occur: r,
1358
+ // Valid, as 'occur' is a required property in QueryItem
1359
+ [e.mode]: { ctx: e.searchTerm }
1360
+ // Ensure dynamic mode is inside queryType
1361
+ }), t;
1362
+ }
1363
+ const xo = (e) => e.endsWith("/") ? e.slice(0, -1) : e, $o = (e) => {
1364
+ let t = "";
1365
+ if (t = e.trim(), t = t.replace(/[‘’“”]/g, (r) => ({
1366
+ "‘": "'",
1367
+ "’": "'",
1368
+ "“": '"',
1369
+ "”": '"'
1370
+ })[r] || r), (t.match(/"/g) || []).length % 2 !== 0)
1371
+ throw new Error(
1372
+ "The search term contains an uneven number of quote characters."
1373
+ );
1374
+ return t;
1375
+ };
1376
+ class _o {
1377
+ constructor(t, r, s) {
1378
+ A(this, "config"), A(this, "userId"), A(this, "parent"), A(this, "getSearchResponse", async (a) => {
1379
+ var o, n, c, u, l;
1380
+ const i = $o(a.searchTerm);
1381
+ (o = this.parent.measureClient) == null || o.sendMeasureEvent("search_requested", {
1382
+ search_term: i
1383
+ }), this.parent.emitEvent("query_submitted", {
1384
+ name: "query_submitted",
1385
+ data: {
1386
+ searchTerm: i
1387
+ }
1388
+ }), (n = this.parent.adClient) == null || n.onQuerySubmitted(a);
1389
+ try {
1390
+ const p = {
1391
+ query: Po(a),
1392
+ offset: a.offset || 0,
1393
+ // Default to 0 (first page) if not provided
1394
+ limit: a.limit || this.config.searchResultsPerPage || 20
1395
+ // Default to 20 if not provided
1396
+ };
1397
+ a.order_by && (p.order_by = a.order_by, p.sort = a.sort === "desc" || a.sort === "asc" ? a.sort : "asc");
1398
+ const m = {
1399
+ method: "POST",
1400
+ headers: {
1401
+ Authorization: this.config.readKey,
1402
+ "Content-Type": "application/json",
1403
+ "X-Sc-User-Id": this.userId
1404
+ },
1405
+ body: JSON.stringify(p)
1406
+ }, b = await fetch(this.baseSearchUrl, m);
1407
+ if (!b.ok)
1408
+ throw new Error(
1409
+ `Error: ${b.statusText} (Status: ${b.status})`
1410
+ );
1411
+ const v = await b.json();
1412
+ return (c = this.parent.measureClient) == null || c.sendMeasureEvent("search_response_received", {
1413
+ search_term: i,
1414
+ number_of_documents: v.data.count
1415
+ }), this.parent.emitEvent("query_fetched", {
1416
+ name: "query_fetched",
1417
+ data: {
1418
+ searchTerm: i
1419
+ }
1420
+ }), (((u = v.data.hits) == null ? void 0 : u.length) || 0) === 0 && this.parent.emitEvent("no_results_returned", {
1421
+ name: "no_results_returned"
1422
+ }), (l = this.parent.adClient) == null || l.onQueryFetched(a, v), v;
1423
+ } catch (p) {
1424
+ throw console.error("Error parsing response:", p), p;
1425
+ }
1426
+ }), this.parent = t, this.config = r, this.userId = s;
1427
+ }
1428
+ /**
1429
+ * Getter for the base url used by the /search endpoint.
1430
+ */
1431
+ get baseSearchUrl() {
1432
+ return `${this.config.endpointURL}/index/${this.config.index.join(",")}/search`;
1433
+ }
1434
+ }
1435
+ class Ao {
1436
+ constructor(t, r) {
1437
+ if (A(this, "config"), A(this, "measureClient"), A(this, "searchClient"), A(this, "adClient"), A(this, "userId"), A(this, "requestTimeout"), A(this, "subscriptionEvents", {}), A(this, "getItems", (s, a, o) => {
1438
+ const n = async () => {
1439
+ (async () => {
1440
+ var c, u;
1441
+ const l = await ((c = this == null ? void 0 : this.searchClient) == null ? void 0 : c.getSearchResponse(s));
1442
+ if (!l)
1443
+ throw new Error("Search client was not initialized.");
1444
+ const i = (u = l.data.hits || []) == null ? void 0 : u.map((p) => p.doc).filter((p) => !!p).map((p) => ({
1445
+ type: "SearchDocument",
1446
+ id: bt(),
1447
+ document: p
1448
+ }));
1449
+ a(l, i);
1450
+ })(), (async () => {
1451
+ if (this.adClient) {
1452
+ const c = await this.adClient.getAdsForSearchParams(s);
1453
+ o(c);
1454
+ }
1455
+ })();
1456
+ };
1457
+ clearTimeout(this.requestTimeout), this.config.searchDebounceDelay ? this.requestTimeout = setTimeout(
1458
+ n,
1459
+ this.config.searchDebounceDelay
1460
+ ) : n();
1461
+ }), !t.endpointURL || !t.index || !t.readKey)
1462
+ throw new Error(
1463
+ "Endpoint URL, Index value(s), and Read Key must be provided"
1464
+ );
1465
+ this.config = {
1466
+ ...t,
1467
+ // Strips off the trailing '/' from an endpointURL if one is accidentally added
1468
+ endpointURL: xo(t.endpointURL)
1469
+ }, this.userId = "", typeof window < "u" && typeof customElements < "u" && r.sdkName === "@searchcraft/javascript-sdk" && globalThis.__scDefineCustomElements__ && globalThis.__scDefineCustomElements__(), typeof window < "u" && (this.initClients(this.config, r), this.initInputForms(), this.startObservingMutations());
1470
+ }
1471
+ initInputForms() {
1472
+ const t = document.querySelectorAll(
1473
+ "searchcraft-input-form"
1474
+ );
1475
+ setTimeout(() => {
1476
+ t.forEach((r) => {
1477
+ r.core = this;
1478
+ });
1479
+ }, 40);
1480
+ }
1481
+ /**
1482
+ * When changes happen in the DOM, we want to link any input forms found to the instance of the core.
1483
+ */
1484
+ startObservingMutations() {
1485
+ new MutationObserver((t, r) => {
1486
+ let s = !1;
1487
+ for (const a of t)
1488
+ a.type === "childList" && a.addedNodes.forEach((o) => {
1489
+ o.nodeType === 1 && o.className.toLowerCase() === "searchcraft-input-form" && (s = !0);
1490
+ });
1491
+ s && this.initInputForms();
1492
+ }).observe(document.body, { childList: !0, subtree: !0 });
1493
+ }
1494
+ initClients(t, r) {
1495
+ setTimeout(async () => {
1496
+ let s = this.config.userId;
1497
+ switch (s || (s = await co()), this.measureClient = new Co(t, r, s), this.searchClient = new _o(this, t, s), t.adSource) {
1498
+ case "adMarketplace":
1499
+ this.adClient = new Eo(t);
1500
+ break;
1501
+ case "Nativo":
1502
+ this.adClient = new To(t);
1503
+ break;
1504
+ case "Custom":
1505
+ this.adClient = new wo(t);
1506
+ break;
1507
+ }
1508
+ }, 300);
1509
+ }
1510
+ emitEvent(t, r) {
1511
+ var s;
1512
+ (s = this.subscriptionEvents[t]) == null || s.forEach((a) => {
1513
+ a(r);
1514
+ });
1515
+ }
1516
+ subscribe(t, r) {
1517
+ return this.subscriptionEvents[t] || (this.subscriptionEvents[t] = []), this.subscriptionEvents[t].push(
1518
+ r
1519
+ ), () => {
1520
+ this.subscriptionEvents[t] = this.subscriptionEvents[t].filter((s) => s !== r);
1521
+ };
1522
+ }
1523
+ /**
1524
+ * Called when a `<searchcraft-ad>` component is rendered
1525
+ */
1526
+ handleAdContainerRendered(t) {
1527
+ var r;
1528
+ (r = this.adClient) == null || r.onAdContainerRendered(t), this.emitEvent("ad_container_rendered", {
1529
+ name: "ad_container_rendered",
1530
+ data: {
1531
+ adContainerId: t.adContainerId,
1532
+ adSource: t.adSource,
1533
+ searchTerm: t.searchTerm
1534
+ }
1535
+ });
1536
+ }
1537
+ /**
1538
+ * Called when a `<searchcraft-ad>` is viewed
1539
+ */
1540
+ handleAdContainerViewed(t) {
1541
+ var r;
1542
+ (r = this.adClient) == null || r.onAdContainerViewed(t), this.emitEvent("ad_container_viewed", {
1543
+ name: "ad_container_viewed",
1544
+ data: {
1545
+ adContainerId: t.adContainerId,
1546
+ adSource: t.adSource,
1547
+ searchTerm: t.searchTerm
1548
+ }
1549
+ });
1550
+ }
1551
+ /**
1552
+ * Perform various actions when the input is cleared
1553
+ */
1554
+ handleInputCleared() {
1555
+ var t;
1556
+ this.emitEvent("input_cleared", {
1557
+ name: "input_cleared"
1558
+ }), (t = this.adClient) == null || t.onInputCleared();
1559
+ }
1560
+ }
1561
+ var Ds = {}, ar = {};
1562
+ const cs = (e) => {
1563
+ let t;
1564
+ const r = /* @__PURE__ */ new Set(), s = (l, i) => {
1565
+ const p = typeof l == "function" ? l(t) : l;
1566
+ if (!Object.is(p, t)) {
1567
+ const m = t;
1568
+ t = i ?? (typeof p != "object" || p === null) ? p : Object.assign({}, t, p), r.forEach((b) => b(t, m));
1569
+ }
1570
+ }, a = () => t, c = { setState: s, getState: a, getInitialState: () => u, subscribe: (l) => (r.add(l), () => r.delete(l)) }, u = t = e(s, a, c);
1571
+ return c;
1572
+ }, Io = (e) => e ? cs(e) : cs;
1573
+ ar.createStore = Io;
1574
+ var nr = {}, Ns = { exports: {} }, R = {};
1575
+ /**
1576
+ * @license React
1577
+ * react.production.js
1578
+ *
1579
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1580
+ *
1581
+ * This source code is licensed under the MIT license found in the
1582
+ * LICENSE file in the root directory of this source tree.
1583
+ */
1584
+ var or = Symbol.for("react.transitional.element"), Mo = Symbol.for("react.portal"), Oo = Symbol.for("react.fragment"), Lo = Symbol.for("react.strict_mode"), Fo = Symbol.for("react.profiler"), Do = Symbol.for("react.consumer"), No = Symbol.for("react.context"), Uo = Symbol.for("react.forward_ref"), zo = Symbol.for("react.suspense"), Ho = Symbol.for("react.memo"), Us = Symbol.for("react.lazy"), is = Symbol.iterator;
1585
+ function jo(e) {
1586
+ return e === null || typeof e != "object" ? null : (e = is && e[is] || e["@@iterator"], typeof e == "function" ? e : null);
1587
+ }
1588
+ var zs = {
1589
+ isMounted: function() {
1590
+ return !1;
1591
+ },
1592
+ enqueueForceUpdate: function() {
1593
+ },
1594
+ enqueueReplaceState: function() {
1595
+ },
1596
+ enqueueSetState: function() {
1597
+ }
1598
+ }, Hs = Object.assign, js = {};
1599
+ function Fe(e, t, r) {
1600
+ this.props = e, this.context = t, this.refs = js, this.updater = r || zs;
1601
+ }
1602
+ Fe.prototype.isReactComponent = {};
1603
+ Fe.prototype.setState = function(e, t) {
1604
+ if (typeof e != "object" && typeof e != "function" && e != null)
1605
+ throw Error(
1606
+ "takes an object of state variables to update or a function which returns an object of state variables."
1607
+ );
1608
+ this.updater.enqueueSetState(this, e, t, "setState");
1609
+ };
1610
+ Fe.prototype.forceUpdate = function(e) {
1611
+ this.updater.enqueueForceUpdate(this, e, "forceUpdate");
1612
+ };
1613
+ function Bs() {
1614
+ }
1615
+ Bs.prototype = Fe.prototype;
1616
+ function cr(e, t, r) {
1617
+ this.props = e, this.context = t, this.refs = js, this.updater = r || zs;
1618
+ }
1619
+ var ir = cr.prototype = new Bs();
1620
+ ir.constructor = cr;
1621
+ Hs(ir, Fe.prototype);
1622
+ ir.isPureReactComponent = !0;
1623
+ var ls = Array.isArray, I = { H: null, A: null, T: null, S: null }, Ws = Object.prototype.hasOwnProperty;
1624
+ function lr(e, t, r, s, a, o) {
1625
+ return r = o.ref, {
1626
+ $$typeof: or,
1627
+ type: e,
1628
+ key: t,
1629
+ ref: r !== void 0 ? r : null,
1630
+ props: o
1631
+ };
1632
+ }
1633
+ function Bo(e, t) {
1634
+ return lr(
1635
+ e.type,
1636
+ t,
1637
+ void 0,
1638
+ void 0,
1639
+ void 0,
1640
+ e.props
1641
+ );
1642
+ }
1643
+ function ur(e) {
1644
+ return typeof e == "object" && e !== null && e.$$typeof === or;
1645
+ }
1646
+ function Wo(e) {
1647
+ var t = { "=": "=0", ":": "=2" };
1648
+ return "$" + e.replace(/[=:]/g, function(r) {
1649
+ return t[r];
1650
+ });
1651
+ }
1652
+ var us = /\/+/g;
1653
+ function Gt(e, t) {
1654
+ return typeof e == "object" && e !== null && e.key != null ? Wo("" + e.key) : t.toString(36);
1655
+ }
1656
+ function fs() {
1657
+ }
1658
+ function Go(e) {
1659
+ switch (e.status) {
1660
+ case "fulfilled":
1661
+ return e.value;
1662
+ case "rejected":
1663
+ throw e.reason;
1664
+ default:
1665
+ switch (typeof e.status == "string" ? e.then(fs, fs) : (e.status = "pending", e.then(
1666
+ function(t) {
1667
+ e.status === "pending" && (e.status = "fulfilled", e.value = t);
1668
+ },
1669
+ function(t) {
1670
+ e.status === "pending" && (e.status = "rejected", e.reason = t);
1671
+ }
1672
+ )), e.status) {
1673
+ case "fulfilled":
1674
+ return e.value;
1675
+ case "rejected":
1676
+ throw e.reason;
1677
+ }
1678
+ }
1679
+ throw e;
1680
+ }
1681
+ function Me(e, t, r, s, a) {
1682
+ var o = typeof e;
1683
+ (o === "undefined" || o === "boolean") && (e = null);
1684
+ var n = !1;
1685
+ if (e === null) n = !0;
1686
+ else
1687
+ switch (o) {
1688
+ case "bigint":
1689
+ case "string":
1690
+ case "number":
1691
+ n = !0;
1692
+ break;
1693
+ case "object":
1694
+ switch (e.$$typeof) {
1695
+ case or:
1696
+ case Mo:
1697
+ n = !0;
1698
+ break;
1699
+ case Us:
1700
+ return n = e._init, Me(
1701
+ n(e._payload),
1702
+ t,
1703
+ r,
1704
+ s,
1705
+ a
1706
+ );
1707
+ }
1708
+ }
1709
+ if (n)
1710
+ return a = a(e), n = s === "" ? "." + Gt(e, 0) : s, ls(a) ? (r = "", n != null && (r = n.replace(us, "$&/") + "/"), Me(a, t, r, "", function(l) {
1711
+ return l;
1712
+ })) : a != null && (ur(a) && (a = Bo(
1713
+ a,
1714
+ r + (a.key == null || e && e.key === a.key ? "" : ("" + a.key).replace(
1715
+ us,
1716
+ "$&/"
1717
+ ) + "/") + n
1718
+ )), t.push(a)), 1;
1719
+ n = 0;
1720
+ var c = s === "" ? "." : s + ":";
1721
+ if (ls(e))
1722
+ for (var u = 0; u < e.length; u++)
1723
+ s = e[u], o = c + Gt(s, u), n += Me(
1724
+ s,
1725
+ t,
1726
+ r,
1727
+ o,
1728
+ a
1729
+ );
1730
+ else if (u = jo(e), typeof u == "function")
1731
+ for (e = u.call(e), u = 0; !(s = e.next()).done; )
1732
+ s = s.value, o = c + Gt(s, u++), n += Me(
1733
+ s,
1734
+ t,
1735
+ r,
1736
+ o,
1737
+ a
1738
+ );
1739
+ else if (o === "object") {
1740
+ if (typeof e.then == "function")
1741
+ return Me(
1742
+ Go(e),
1743
+ t,
1744
+ r,
1745
+ s,
1746
+ a
1747
+ );
1748
+ throw t = String(e), Error(
1749
+ "Objects are not valid as a React child (found: " + (t === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : t) + "). If you meant to render a collection of children, use an array instead."
1750
+ );
1751
+ }
1752
+ return n;
1753
+ }
1754
+ function ht(e, t, r) {
1755
+ if (e == null) return e;
1756
+ var s = [], a = 0;
1757
+ return Me(e, s, "", "", function(o) {
1758
+ return t.call(r, o, a++);
1759
+ }), s;
1760
+ }
1761
+ function Vo(e) {
1762
+ if (e._status === -1) {
1763
+ var t = e._result;
1764
+ t = t(), t.then(
1765
+ function(r) {
1766
+ (e._status === 0 || e._status === -1) && (e._status = 1, e._result = r);
1767
+ },
1768
+ function(r) {
1769
+ (e._status === 0 || e._status === -1) && (e._status = 2, e._result = r);
1770
+ }
1771
+ ), e._status === -1 && (e._status = 0, e._result = t);
1772
+ }
1773
+ if (e._status === 1) return e._result.default;
1774
+ throw e._result;
1775
+ }
1776
+ var ds = typeof reportError == "function" ? reportError : function(e) {
1777
+ if (typeof window == "object" && typeof window.ErrorEvent == "function") {
1778
+ var t = new window.ErrorEvent("error", {
1779
+ bubbles: !0,
1780
+ cancelable: !0,
1781
+ message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
1782
+ error: e
1783
+ });
1784
+ if (!window.dispatchEvent(t)) return;
1785
+ } else if (typeof process == "object" && typeof process.emit == "function") {
1786
+ process.emit("uncaughtException", e);
1787
+ return;
1788
+ }
1789
+ console.error(e);
1790
+ };
1791
+ function qo() {
1792
+ }
1793
+ R.Children = {
1794
+ map: ht,
1795
+ forEach: function(e, t, r) {
1796
+ ht(
1797
+ e,
1798
+ function() {
1799
+ t.apply(this, arguments);
1800
+ },
1801
+ r
1802
+ );
1803
+ },
1804
+ count: function(e) {
1805
+ var t = 0;
1806
+ return ht(e, function() {
1807
+ t++;
1808
+ }), t;
1809
+ },
1810
+ toArray: function(e) {
1811
+ return ht(e, function(t) {
1812
+ return t;
1813
+ }) || [];
1814
+ },
1815
+ only: function(e) {
1816
+ if (!ur(e))
1817
+ throw Error(
1818
+ "React.Children.only expected to receive a single React element child."
1819
+ );
1820
+ return e;
1821
+ }
1822
+ };
1823
+ R.Component = Fe;
1824
+ R.Fragment = Oo;
1825
+ R.Profiler = Fo;
1826
+ R.PureComponent = cr;
1827
+ R.StrictMode = Lo;
1828
+ R.Suspense = zo;
1829
+ R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = I;
1830
+ R.act = function() {
1831
+ throw Error("act(...) is not supported in production builds of React.");
1832
+ };
1833
+ R.cache = function(e) {
1834
+ return function() {
1835
+ return e.apply(null, arguments);
1836
+ };
1837
+ };
1838
+ R.cloneElement = function(e, t, r) {
1839
+ if (e == null)
1840
+ throw Error(
1841
+ "The argument must be a React element, but you passed " + e + "."
1842
+ );
1843
+ var s = Hs({}, e.props), a = e.key, o = void 0;
1844
+ if (t != null)
1845
+ for (n in t.ref !== void 0 && (o = void 0), t.key !== void 0 && (a = "" + t.key), t)
1846
+ !Ws.call(t, n) || n === "key" || n === "__self" || n === "__source" || n === "ref" && t.ref === void 0 || (s[n] = t[n]);
1847
+ var n = arguments.length - 2;
1848
+ if (n === 1) s.children = r;
1849
+ else if (1 < n) {
1850
+ for (var c = Array(n), u = 0; u < n; u++)
1851
+ c[u] = arguments[u + 2];
1852
+ s.children = c;
1853
+ }
1854
+ return lr(e.type, a, void 0, void 0, o, s);
1855
+ };
1856
+ R.createContext = function(e) {
1857
+ return e = {
1858
+ $$typeof: No,
1859
+ _currentValue: e,
1860
+ _currentValue2: e,
1861
+ _threadCount: 0,
1862
+ Provider: null,
1863
+ Consumer: null
1864
+ }, e.Provider = e, e.Consumer = {
1865
+ $$typeof: Do,
1866
+ _context: e
1867
+ }, e;
1868
+ };
1869
+ R.createElement = function(e, t, r) {
1870
+ var s, a = {}, o = null;
1871
+ if (t != null)
1872
+ for (s in t.key !== void 0 && (o = "" + t.key), t)
1873
+ Ws.call(t, s) && s !== "key" && s !== "__self" && s !== "__source" && (a[s] = t[s]);
1874
+ var n = arguments.length - 2;
1875
+ if (n === 1) a.children = r;
1876
+ else if (1 < n) {
1877
+ for (var c = Array(n), u = 0; u < n; u++)
1878
+ c[u] = arguments[u + 2];
1879
+ a.children = c;
1880
+ }
1881
+ if (e && e.defaultProps)
1882
+ for (s in n = e.defaultProps, n)
1883
+ a[s] === void 0 && (a[s] = n[s]);
1884
+ return lr(e, o, void 0, void 0, null, a);
1885
+ };
1886
+ R.createRef = function() {
1887
+ return { current: null };
1888
+ };
1889
+ R.forwardRef = function(e) {
1890
+ return { $$typeof: Uo, render: e };
1891
+ };
1892
+ R.isValidElement = ur;
1893
+ R.lazy = function(e) {
1894
+ return {
1895
+ $$typeof: Us,
1896
+ _payload: { _status: -1, _result: e },
1897
+ _init: Vo
1898
+ };
1899
+ };
1900
+ R.memo = function(e, t) {
1901
+ return {
1902
+ $$typeof: Ho,
1903
+ type: e,
1904
+ compare: t === void 0 ? null : t
1905
+ };
1906
+ };
1907
+ R.startTransition = function(e) {
1908
+ var t = I.T, r = {};
1909
+ I.T = r;
1910
+ try {
1911
+ var s = e(), a = I.S;
1912
+ a !== null && a(r, s), typeof s == "object" && s !== null && typeof s.then == "function" && s.then(qo, ds);
1913
+ } catch (o) {
1914
+ ds(o);
1915
+ } finally {
1916
+ I.T = t;
1917
+ }
1918
+ };
1919
+ R.unstable_useCacheRefresh = function() {
1920
+ return I.H.useCacheRefresh();
1921
+ };
1922
+ R.use = function(e) {
1923
+ return I.H.use(e);
1924
+ };
1925
+ R.useActionState = function(e, t, r) {
1926
+ return I.H.useActionState(e, t, r);
1927
+ };
1928
+ R.useCallback = function(e, t) {
1929
+ return I.H.useCallback(e, t);
1930
+ };
1931
+ R.useContext = function(e) {
1932
+ return I.H.useContext(e);
1933
+ };
1934
+ R.useDebugValue = function() {
1935
+ };
1936
+ R.useDeferredValue = function(e, t) {
1937
+ return I.H.useDeferredValue(e, t);
1938
+ };
1939
+ R.useEffect = function(e, t) {
1940
+ return I.H.useEffect(e, t);
1941
+ };
1942
+ R.useId = function() {
1943
+ return I.H.useId();
1944
+ };
1945
+ R.useImperativeHandle = function(e, t, r) {
1946
+ return I.H.useImperativeHandle(e, t, r);
1947
+ };
1948
+ R.useInsertionEffect = function(e, t) {
1949
+ return I.H.useInsertionEffect(e, t);
1950
+ };
1951
+ R.useLayoutEffect = function(e, t) {
1952
+ return I.H.useLayoutEffect(e, t);
1953
+ };
1954
+ R.useMemo = function(e, t) {
1955
+ return I.H.useMemo(e, t);
1956
+ };
1957
+ R.useOptimistic = function(e, t) {
1958
+ return I.H.useOptimistic(e, t);
1959
+ };
1960
+ R.useReducer = function(e, t, r) {
1961
+ return I.H.useReducer(e, t, r);
1962
+ };
1963
+ R.useRef = function(e) {
1964
+ return I.H.useRef(e);
1965
+ };
1966
+ R.useState = function(e) {
1967
+ return I.H.useState(e);
1968
+ };
1969
+ R.useSyncExternalStore = function(e, t, r) {
1970
+ return I.H.useSyncExternalStore(
1971
+ e,
1972
+ t,
1973
+ r
1974
+ );
1975
+ };
1976
+ R.useTransition = function() {
1977
+ return I.H.useTransition();
1978
+ };
1979
+ R.version = "19.0.0";
1980
+ Ns.exports = R;
1981
+ var hs = Ns.exports, Yo = ar;
1982
+ const Qo = (e) => e;
1983
+ function Gs(e, t = Qo) {
1984
+ const r = hs.useSyncExternalStore(
1985
+ e.subscribe,
1986
+ () => t(e.getState()),
1987
+ () => t(e.getInitialState())
1988
+ );
1989
+ return hs.useDebugValue(r), r;
1990
+ }
1991
+ const ps = (e) => {
1992
+ const t = Yo.createStore(e), r = (s) => Gs(t, s);
1993
+ return Object.assign(r, t), r;
1994
+ }, Ko = (e) => e ? ps(e) : ps;
1995
+ nr.create = Ko;
1996
+ nr.useStore = Gs;
1997
+ (function(e) {
1998
+ var t = ar, r = nr;
1999
+ Object.keys(t).forEach(function(s) {
2000
+ s !== "default" && !Object.prototype.hasOwnProperty.call(e, s) && Object.defineProperty(e, s, {
2001
+ enumerable: !0,
2002
+ get: function() {
2003
+ return t[s];
2004
+ }
2005
+ });
2006
+ }), Object.keys(r).forEach(function(s) {
2007
+ s !== "default" && !Object.prototype.hasOwnProperty.call(e, s) && Object.defineProperty(e, s, {
2008
+ enumerable: !0,
2009
+ get: function() {
2010
+ return r[s];
2011
+ }
2012
+ });
2013
+ });
2014
+ })(Ds);
2015
+ const Xo = {
2016
+ adClientResponseItems: [],
2017
+ core: void 0,
2018
+ logger: void 0,
2019
+ facetPathsForIndexFields: {},
2020
+ isPopoverVisible: !1,
2021
+ isSearchInProgress: !1,
2022
+ searchTerm: "",
2023
+ rangeValueForIndexFields: {},
2024
+ searchMode: "fuzzy",
2025
+ searchClientResponseItems: [],
2026
+ searchResponseTimeTaken: void 0,
2027
+ searchResponseFacetPrime: void 0,
2028
+ searchResultsCount: 0,
2029
+ searchResultsPerPage: 20,
2030
+ searchResultsPage: 1,
2031
+ sortType: "asc"
2032
+ }, $ = Ds.createStore((e, t) => {
2033
+ const r = {
2034
+ addFacetPathsForIndexField: (a) => e((o) => ({
2035
+ facetPathsForIndexFields: {
2036
+ ...o.facetPathsForIndexFields,
2037
+ [a.fieldName]: a
2038
+ }
2039
+ })),
2040
+ addRangeValueForIndexField: (a) => e((o) => ({
2041
+ rangeValueForIndexFields: {
2042
+ ...o.rangeValueForIndexFields,
2043
+ [a.fieldName]: a
2044
+ }
2045
+ })),
2046
+ getSearchcraftInstance: () => {
2047
+ const { core: a } = t();
2048
+ return a;
2049
+ },
2050
+ initialize: (a, o = !1) => {
2051
+ const n = a, c = o ? new to({ logLevel: Te.DEBUG }) : void 0;
2052
+ e({
2053
+ core: n,
2054
+ logger: c,
2055
+ searchResultsPerPage: n.config.searchResultsPerPage || 20
2056
+ });
2057
+ },
2058
+ removeFacetPathsForIndexField: (a) => e((o) => {
2059
+ const n = o.facetPathsForIndexFields;
2060
+ return delete n[a], {
2061
+ facetPathsForIndexFields: {
2062
+ ...n
2063
+ }
2064
+ };
2065
+ }),
2066
+ removeRangeValueForIndexField: (a) => e((o) => {
2067
+ const n = o.rangeValueForIndexFields;
2068
+ return delete n[a], {
2069
+ rangeValueForIndexFields: {
2070
+ ...n
2071
+ }
2072
+ };
2073
+ }),
2074
+ resetFacetPaths: () => {
2075
+ e({
2076
+ facetPathsForIndexFields: {}
2077
+ });
2078
+ },
2079
+ search: async () => {
2080
+ var c, u;
2081
+ const a = t();
2082
+ if ((c = a.logger) == null || c.log(Te.INFO, `Starting search with search term: "${a.searchTerm}"`), !a.core)
2083
+ throw new Error("Searchcraft instance is not initialized.");
2084
+ if (!a.searchTerm.trim()) {
2085
+ (u = a.logger) == null || u.log(Te.INFO, "No search request was made: search term was empty."), e({
2086
+ searchClientResponseItems: [],
2087
+ searchResultsCount: 0,
2088
+ searchResultsPage: 1,
2089
+ searchTerm: ""
2090
+ });
2091
+ return;
2092
+ }
2093
+ e({ isSearchInProgress: !0 });
2094
+ const o = (l, i) => {
2095
+ var m, b;
2096
+ const p = l.data.facets;
2097
+ e((v) => ({
2098
+ isSearchInProgress: !1,
2099
+ searchClientResponseItems: i,
2100
+ searchResponseTimeTaken: l.data.time_taken || 0,
2101
+ searchResultsPage: (
2102
+ // reset to first page when response count changes
2103
+ l.data.count === v.searchResultsCount ? v.searchResultsPage : 1
2104
+ ),
2105
+ searchResultsCount: l.data.count || 0
2106
+ })), p && e({ searchResponseFacetPrime: p }), (m = a.logger) == null || m.log(Te.DEBUG, `Search results: ${JSON.stringify(i)}`), (b = a.logger) == null || b.log(Te.DEBUG, `Facets from response: ${JSON.stringify(p)}`);
2107
+ }, n = (l) => {
2108
+ e({ adClientResponseItems: l });
2109
+ };
2110
+ a.core.getItems({
2111
+ searchTerm: a.searchTerm,
2112
+ mode: a.searchMode,
2113
+ sort: a.sortType,
2114
+ facetPathsForIndexFields: a.facetPathsForIndexFields,
2115
+ rangeValueForIndexFields: a.rangeValueForIndexFields,
2116
+ offset: a.searchResultsPerPage ? a.searchResultsPerPage * (a.searchResultsPage - 1) : 0,
2117
+ limit: a.searchResultsPerPage
2118
+ }, o, n);
2119
+ },
2120
+ setPopoverVisibility: (a) => {
2121
+ e({
2122
+ isPopoverVisible: a
2123
+ });
2124
+ },
2125
+ setSearchMode: (a) => e({ searchMode: a }),
2126
+ setSortType: (a) => e({ sortType: a }),
2127
+ setSearchTerm: (a) => {
2128
+ const { core: o } = t();
2129
+ a.length === 0 && (o == null || o.handleInputCleared()), e({
2130
+ searchTerm: a,
2131
+ facetPathsForIndexFields: {},
2132
+ ...a.trim().length === 0 && {
2133
+ searchMode: "fuzzy",
2134
+ sortType: "asc"
2135
+ }
2136
+ });
2137
+ },
2138
+ setSearchClientResponseItems: (a) => e({ searchClientResponseItems: a }),
2139
+ setSearchResultsPage: async (a) => {
2140
+ e({ searchResultsPage: a }), await r.search();
2141
+ },
2142
+ setSearchResultsPerPage: async (a) => {
2143
+ e({ searchResultsPerPage: a }), await r.search();
2144
+ }
2145
+ };
2146
+ return {
2147
+ ...Xo,
2148
+ ...r
2149
+ };
2150
+ });
2151
+ var Zo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Vs = { exports: {} };
2152
+ /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
2153
+ (function(e, t) {
2154
+ (function(r, s) {
2155
+ e.exports = s();
2156
+ })(Zo, function() {
2157
+ const {
2158
+ entries: r,
2159
+ setPrototypeOf: s,
2160
+ isFrozen: a,
2161
+ getPrototypeOf: o,
2162
+ getOwnPropertyDescriptor: n
2163
+ } = Object;
2164
+ let {
2165
+ freeze: c,
2166
+ seal: u,
2167
+ create: l
2168
+ } = Object, {
2169
+ apply: i,
2170
+ construct: p
2171
+ } = typeof Reflect < "u" && Reflect;
2172
+ c || (c = function(S) {
2173
+ return S;
2174
+ }), u || (u = function(S) {
2175
+ return S;
2176
+ }), i || (i = function(S, P, C) {
2177
+ return S.apply(P, C);
2178
+ }), p || (p = function(S, P) {
2179
+ return new S(...P);
2180
+ });
2181
+ const m = V(Array.prototype.forEach), b = V(Array.prototype.lastIndexOf), v = V(Array.prototype.pop), x = V(Array.prototype.push), U = V(Array.prototype.splice), ee = V(String.prototype.toLowerCase), M = V(String.prototype.toString), De = V(String.prototype.match), Ne = V(String.prototype.replace), Ra = V(String.prototype.indexOf), Ta = V(String.prototype.trim), se = V(Object.prototype.hasOwnProperty), G = V(RegExp.prototype.test), Ue = ka(TypeError);
2182
+ function V(k) {
2183
+ return function(S) {
2184
+ for (var P = arguments.length, C = new Array(P > 1 ? P - 1 : 0), j = 1; j < P; j++)
2185
+ C[j - 1] = arguments[j];
2186
+ return i(k, S, C);
2187
+ };
2188
+ }
2189
+ function ka(k) {
2190
+ return function() {
2191
+ for (var S = arguments.length, P = new Array(S), C = 0; C < S; C++)
2192
+ P[C] = arguments[C];
2193
+ return p(k, P);
2194
+ };
2195
+ }
2196
+ function T(k, S) {
2197
+ let P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ee;
2198
+ s && s(k, null);
2199
+ let C = S.length;
2200
+ for (; C--; ) {
2201
+ let j = S[C];
2202
+ if (typeof j == "string") {
2203
+ const ie = P(j);
2204
+ ie !== j && (a(S) || (S[C] = ie), j = ie);
2205
+ }
2206
+ k[j] = !0;
2207
+ }
2208
+ return k;
2209
+ }
2210
+ function Ca(k) {
2211
+ for (let S = 0; S < k.length; S++)
2212
+ se(k, S) || (k[S] = null);
2213
+ return k;
2214
+ }
2215
+ function Ee(k) {
2216
+ const S = l(null);
2217
+ for (const [P, C] of r(k))
2218
+ se(k, P) && (Array.isArray(C) ? S[P] = Ca(C) : C && typeof C == "object" && C.constructor === Object ? S[P] = Ee(C) : S[P] = C);
2219
+ return S;
2220
+ }
2221
+ function ze(k, S) {
2222
+ for (; k !== null; ) {
2223
+ const C = n(k, S);
2224
+ if (C) {
2225
+ if (C.get)
2226
+ return V(C.get);
2227
+ if (typeof C.value == "function")
2228
+ return V(C.value);
2229
+ }
2230
+ k = o(k);
2231
+ }
2232
+ function P() {
2233
+ return null;
2234
+ }
2235
+ return P;
2236
+ }
2237
+ const pr = c(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Tt = c(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), kt = c(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Pa = c(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ct = c(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), xa = c(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), mr = c(["#text"]), gr = c(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Pt = c(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), vr = c(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), et = c(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), $a = u(/\{\{[\w\W]*|[\w\W]*\}\}/gm), _a = u(/<%[\w\W]*|[\w\W]*%>/gm), Aa = u(/\$\{[\w\W]*/gm), Ia = u(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ma = u(/^aria-[\-\w]+$/), br = u(
2238
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2239
+ // eslint-disable-line no-useless-escape
2240
+ ), Oa = u(/^(?:\w+script|data):/i), La = u(
2241
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2242
+ // eslint-disable-line no-control-regex
2243
+ ), yr = u(/^html$/i), Fa = u(/^[a-z][.\w]*(-[.\w]+)+$/i);
2244
+ var Sr = /* @__PURE__ */ Object.freeze({
2245
+ __proto__: null,
2246
+ ARIA_ATTR: Ma,
2247
+ ATTR_WHITESPACE: La,
2248
+ CUSTOM_ELEMENT: Fa,
2249
+ DATA_ATTR: Ia,
2250
+ DOCTYPE_NAME: yr,
2251
+ ERB_EXPR: _a,
2252
+ IS_ALLOWED_URI: br,
2253
+ IS_SCRIPT_OR_DATA: Oa,
2254
+ MUSTACHE_EXPR: $a,
2255
+ TMPLIT_EXPR: Aa
2256
+ });
2257
+ const He = {
2258
+ element: 1,
2259
+ attribute: 2,
2260
+ text: 3,
2261
+ cdataSection: 4,
2262
+ entityReference: 5,
2263
+ // Deprecated
2264
+ entityNode: 6,
2265
+ // Deprecated
2266
+ progressingInstruction: 7,
2267
+ comment: 8,
2268
+ document: 9,
2269
+ documentType: 10,
2270
+ documentFragment: 11,
2271
+ notation: 12
2272
+ // Deprecated
2273
+ }, Da = function() {
2274
+ return typeof window > "u" ? null : window;
2275
+ }, Na = function(S, P) {
2276
+ if (typeof S != "object" || typeof S.createPolicy != "function")
2277
+ return null;
2278
+ let C = null;
2279
+ const j = "data-tt-policy-suffix";
2280
+ P && P.hasAttribute(j) && (C = P.getAttribute(j));
2281
+ const ie = "dompurify" + (C ? "#" + C : "");
2282
+ try {
2283
+ return S.createPolicy(ie, {
2284
+ createHTML(ke) {
2285
+ return ke;
2286
+ },
2287
+ createScriptURL(ke) {
2288
+ return ke;
2289
+ }
2290
+ });
2291
+ } catch {
2292
+ return console.warn("TrustedTypes policy " + ie + " could not be created."), null;
2293
+ }
2294
+ }, Er = function() {
2295
+ return {
2296
+ afterSanitizeAttributes: [],
2297
+ afterSanitizeElements: [],
2298
+ afterSanitizeShadowDOM: [],
2299
+ beforeSanitizeAttributes: [],
2300
+ beforeSanitizeElements: [],
2301
+ beforeSanitizeShadowDOM: [],
2302
+ uponSanitizeAttribute: [],
2303
+ uponSanitizeElement: [],
2304
+ uponSanitizeShadowNode: []
2305
+ };
2306
+ };
2307
+ function wr() {
2308
+ let k = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Da();
2309
+ const S = (E) => wr(E);
2310
+ if (S.version = "3.2.4", S.removed = [], !k || !k.document || k.document.nodeType !== He.document || !k.Element)
2311
+ return S.isSupported = !1, S;
2312
+ let {
2313
+ document: P
2314
+ } = k;
2315
+ const C = P, j = C.currentScript, {
2316
+ DocumentFragment: ie,
2317
+ HTMLTemplateElement: ke,
2318
+ Node: xt,
2319
+ Element: Rr,
2320
+ NodeFilter: je,
2321
+ NamedNodeMap: za = k.NamedNodeMap || k.MozNamedAttrMap,
2322
+ HTMLFormElement: Ha,
2323
+ DOMParser: ja,
2324
+ trustedTypes: tt
2325
+ } = k, Be = Rr.prototype, Ba = ze(Be, "cloneNode"), Wa = ze(Be, "remove"), Ga = ze(Be, "nextSibling"), Va = ze(Be, "childNodes"), rt = ze(Be, "parentNode");
2326
+ if (typeof ke == "function") {
2327
+ const E = P.createElement("template");
2328
+ E.content && E.content.ownerDocument && (P = E.content.ownerDocument);
2329
+ }
2330
+ let q, We = "";
2331
+ const {
2332
+ implementation: $t,
2333
+ createNodeIterator: qa,
2334
+ createDocumentFragment: Ya,
2335
+ getElementsByTagName: Qa
2336
+ } = P, {
2337
+ importNode: Ka
2338
+ } = C;
2339
+ let Y = Er();
2340
+ S.isSupported = typeof r == "function" && typeof rt == "function" && $t && $t.createHTMLDocument !== void 0;
2341
+ const {
2342
+ MUSTACHE_EXPR: _t,
2343
+ ERB_EXPR: At,
2344
+ TMPLIT_EXPR: It,
2345
+ DATA_ATTR: Xa,
2346
+ ARIA_ATTR: Za,
2347
+ IS_SCRIPT_OR_DATA: Ja,
2348
+ ATTR_WHITESPACE: Tr,
2349
+ CUSTOM_ELEMENT: en
2350
+ } = Sr;
2351
+ let {
2352
+ IS_ALLOWED_URI: kr
2353
+ } = Sr, D = null;
2354
+ const Cr = T({}, [...pr, ...Tt, ...kt, ...Ct, ...mr]);
2355
+ let z = null;
2356
+ const Pr = T({}, [...gr, ...Pt, ...vr, ...et]);
2357
+ let O = Object.seal(l(null, {
2358
+ tagNameCheck: {
2359
+ writable: !0,
2360
+ configurable: !1,
2361
+ enumerable: !0,
2362
+ value: null
2363
+ },
2364
+ attributeNameCheck: {
2365
+ writable: !0,
2366
+ configurable: !1,
2367
+ enumerable: !0,
2368
+ value: null
2369
+ },
2370
+ allowCustomizedBuiltInElements: {
2371
+ writable: !0,
2372
+ configurable: !1,
2373
+ enumerable: !0,
2374
+ value: !1
2375
+ }
2376
+ })), Ge = null, Mt = null, xr = !0, Ot = !0, $r = !1, _r = !0, Ce = !1, Lt = !0, we = !1, Ft = !1, Dt = !1, Pe = !1, st = !1, at = !1, Ar = !0, Ir = !1;
2377
+ const tn = "user-content-";
2378
+ let Nt = !0, Ve = !1, xe = {}, $e = null;
2379
+ const Mr = T({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2380
+ let Or = null;
2381
+ const Lr = T({}, ["audio", "video", "img", "source", "image", "track"]);
2382
+ let Ut = null;
2383
+ const Fr = T({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), nt = "http://www.w3.org/1998/Math/MathML", ot = "http://www.w3.org/2000/svg", le = "http://www.w3.org/1999/xhtml";
2384
+ let _e = le, zt = !1, Ht = null;
2385
+ const rn = T({}, [nt, ot, le], M);
2386
+ let ct = T({}, ["mi", "mo", "mn", "ms", "mtext"]), it = T({}, ["annotation-xml"]);
2387
+ const sn = T({}, ["title", "style", "font", "a", "script"]);
2388
+ let qe = null;
2389
+ const an = ["application/xhtml+xml", "text/html"], nn = "text/html";
2390
+ let N = null, Ae = null;
2391
+ const on = P.createElement("form"), Dr = function(f) {
2392
+ return f instanceof RegExp || f instanceof Function;
2393
+ }, jt = function() {
2394
+ let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2395
+ if (!(Ae && Ae === f)) {
2396
+ if ((!f || typeof f != "object") && (f = {}), f = Ee(f), qe = // eslint-disable-next-line unicorn/prefer-includes
2397
+ an.indexOf(f.PARSER_MEDIA_TYPE) === -1 ? nn : f.PARSER_MEDIA_TYPE, N = qe === "application/xhtml+xml" ? M : ee, D = se(f, "ALLOWED_TAGS") ? T({}, f.ALLOWED_TAGS, N) : Cr, z = se(f, "ALLOWED_ATTR") ? T({}, f.ALLOWED_ATTR, N) : Pr, Ht = se(f, "ALLOWED_NAMESPACES") ? T({}, f.ALLOWED_NAMESPACES, M) : rn, Ut = se(f, "ADD_URI_SAFE_ATTR") ? T(Ee(Fr), f.ADD_URI_SAFE_ATTR, N) : Fr, Or = se(f, "ADD_DATA_URI_TAGS") ? T(Ee(Lr), f.ADD_DATA_URI_TAGS, N) : Lr, $e = se(f, "FORBID_CONTENTS") ? T({}, f.FORBID_CONTENTS, N) : Mr, Ge = se(f, "FORBID_TAGS") ? T({}, f.FORBID_TAGS, N) : {}, Mt = se(f, "FORBID_ATTR") ? T({}, f.FORBID_ATTR, N) : {}, xe = se(f, "USE_PROFILES") ? f.USE_PROFILES : !1, xr = f.ALLOW_ARIA_ATTR !== !1, Ot = f.ALLOW_DATA_ATTR !== !1, $r = f.ALLOW_UNKNOWN_PROTOCOLS || !1, _r = f.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ce = f.SAFE_FOR_TEMPLATES || !1, Lt = f.SAFE_FOR_XML !== !1, we = f.WHOLE_DOCUMENT || !1, Pe = f.RETURN_DOM || !1, st = f.RETURN_DOM_FRAGMENT || !1, at = f.RETURN_TRUSTED_TYPE || !1, Dt = f.FORCE_BODY || !1, Ar = f.SANITIZE_DOM !== !1, Ir = f.SANITIZE_NAMED_PROPS || !1, Nt = f.KEEP_CONTENT !== !1, Ve = f.IN_PLACE || !1, kr = f.ALLOWED_URI_REGEXP || br, _e = f.NAMESPACE || le, ct = f.MATHML_TEXT_INTEGRATION_POINTS || ct, it = f.HTML_INTEGRATION_POINTS || it, O = f.CUSTOM_ELEMENT_HANDLING || {}, f.CUSTOM_ELEMENT_HANDLING && Dr(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (O.tagNameCheck = f.CUSTOM_ELEMENT_HANDLING.tagNameCheck), f.CUSTOM_ELEMENT_HANDLING && Dr(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (O.attributeNameCheck = f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), f.CUSTOM_ELEMENT_HANDLING && typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (O.allowCustomizedBuiltInElements = f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ce && (Ot = !1), st && (Pe = !0), xe && (D = T({}, mr), z = [], xe.html === !0 && (T(D, pr), T(z, gr)), xe.svg === !0 && (T(D, Tt), T(z, Pt), T(z, et)), xe.svgFilters === !0 && (T(D, kt), T(z, Pt), T(z, et)), xe.mathMl === !0 && (T(D, Ct), T(z, vr), T(z, et))), f.ADD_TAGS && (D === Cr && (D = Ee(D)), T(D, f.ADD_TAGS, N)), f.ADD_ATTR && (z === Pr && (z = Ee(z)), T(z, f.ADD_ATTR, N)), f.ADD_URI_SAFE_ATTR && T(Ut, f.ADD_URI_SAFE_ATTR, N), f.FORBID_CONTENTS && ($e === Mr && ($e = Ee($e)), T($e, f.FORBID_CONTENTS, N)), Nt && (D["#text"] = !0), we && T(D, ["html", "head", "body"]), D.table && (T(D, ["tbody"]), delete Ge.tbody), f.TRUSTED_TYPES_POLICY) {
2398
+ if (typeof f.TRUSTED_TYPES_POLICY.createHTML != "function")
2399
+ throw Ue('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2400
+ if (typeof f.TRUSTED_TYPES_POLICY.createScriptURL != "function")
2401
+ throw Ue('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2402
+ q = f.TRUSTED_TYPES_POLICY, We = q.createHTML("");
2403
+ } else
2404
+ q === void 0 && (q = Na(tt, j)), q !== null && typeof We == "string" && (We = q.createHTML(""));
2405
+ c && c(f), Ae = f;
2406
+ }
2407
+ }, Nr = T({}, [...Tt, ...kt, ...Pa]), Ur = T({}, [...Ct, ...xa]), cn = function(f) {
2408
+ let g = rt(f);
2409
+ (!g || !g.tagName) && (g = {
2410
+ namespaceURI: _e,
2411
+ tagName: "template"
2412
+ });
2413
+ const y = ee(f.tagName), _ = ee(g.tagName);
2414
+ return Ht[f.namespaceURI] ? f.namespaceURI === ot ? g.namespaceURI === le ? y === "svg" : g.namespaceURI === nt ? y === "svg" && (_ === "annotation-xml" || ct[_]) : !!Nr[y] : f.namespaceURI === nt ? g.namespaceURI === le ? y === "math" : g.namespaceURI === ot ? y === "math" && it[_] : !!Ur[y] : f.namespaceURI === le ? g.namespaceURI === ot && !it[_] || g.namespaceURI === nt && !ct[_] ? !1 : !Ur[y] && (sn[y] || !Nr[y]) : !!(qe === "application/xhtml+xml" && Ht[f.namespaceURI]) : !1;
2415
+ }, oe = function(f) {
2416
+ x(S.removed, {
2417
+ element: f
2418
+ });
2419
+ try {
2420
+ rt(f).removeChild(f);
2421
+ } catch {
2422
+ Wa(f);
2423
+ }
2424
+ }, lt = function(f, g) {
2425
+ try {
2426
+ x(S.removed, {
2427
+ attribute: g.getAttributeNode(f),
2428
+ from: g
2429
+ });
2430
+ } catch {
2431
+ x(S.removed, {
2432
+ attribute: null,
2433
+ from: g
2434
+ });
2435
+ }
2436
+ if (g.removeAttribute(f), f === "is")
2437
+ if (Pe || st)
2438
+ try {
2439
+ oe(g);
2440
+ } catch {
2441
+ }
2442
+ else
2443
+ try {
2444
+ g.setAttribute(f, "");
2445
+ } catch {
2446
+ }
2447
+ }, zr = function(f) {
2448
+ let g = null, y = null;
2449
+ if (Dt)
2450
+ f = "<remove></remove>" + f;
2451
+ else {
2452
+ const H = De(f, /^[\r\n\t ]+/);
2453
+ y = H && H[0];
2454
+ }
2455
+ qe === "application/xhtml+xml" && _e === le && (f = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + f + "</body></html>");
2456
+ const _ = q ? q.createHTML(f) : f;
2457
+ if (_e === le)
2458
+ try {
2459
+ g = new ja().parseFromString(_, qe);
2460
+ } catch {
2461
+ }
2462
+ if (!g || !g.documentElement) {
2463
+ g = $t.createDocument(_e, "template", null);
2464
+ try {
2465
+ g.documentElement.innerHTML = zt ? We : _;
2466
+ } catch {
2467
+ }
2468
+ }
2469
+ const B = g.body || g.documentElement;
2470
+ return f && y && B.insertBefore(P.createTextNode(y), B.childNodes[0] || null), _e === le ? Qa.call(g, we ? "html" : "body")[0] : we ? g.documentElement : B;
2471
+ }, Hr = function(f) {
2472
+ return qa.call(
2473
+ f.ownerDocument || f,
2474
+ f,
2475
+ // eslint-disable-next-line no-bitwise
2476
+ je.SHOW_ELEMENT | je.SHOW_COMMENT | je.SHOW_TEXT | je.SHOW_PROCESSING_INSTRUCTION | je.SHOW_CDATA_SECTION,
2477
+ null
2478
+ );
2479
+ }, Bt = function(f) {
2480
+ return f instanceof Ha && (typeof f.nodeName != "string" || typeof f.textContent != "string" || typeof f.removeChild != "function" || !(f.attributes instanceof za) || typeof f.removeAttribute != "function" || typeof f.setAttribute != "function" || typeof f.namespaceURI != "string" || typeof f.insertBefore != "function" || typeof f.hasChildNodes != "function");
2481
+ }, jr = function(f) {
2482
+ return typeof xt == "function" && f instanceof xt;
2483
+ };
2484
+ function ue(E, f, g) {
2485
+ m(E, (y) => {
2486
+ y.call(S, f, g, Ae);
2487
+ });
2488
+ }
2489
+ const Br = function(f) {
2490
+ let g = null;
2491
+ if (ue(Y.beforeSanitizeElements, f, null), Bt(f))
2492
+ return oe(f), !0;
2493
+ const y = N(f.nodeName);
2494
+ if (ue(Y.uponSanitizeElement, f, {
2495
+ tagName: y,
2496
+ allowedTags: D
2497
+ }), f.hasChildNodes() && !jr(f.firstElementChild) && G(/<[/\w]/g, f.innerHTML) && G(/<[/\w]/g, f.textContent) || f.nodeType === He.progressingInstruction || Lt && f.nodeType === He.comment && G(/<[/\w]/g, f.data))
2498
+ return oe(f), !0;
2499
+ if (!D[y] || Ge[y]) {
2500
+ if (!Ge[y] && Gr(y) && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, y) || O.tagNameCheck instanceof Function && O.tagNameCheck(y)))
2501
+ return !1;
2502
+ if (Nt && !$e[y]) {
2503
+ const _ = rt(f) || f.parentNode, B = Va(f) || f.childNodes;
2504
+ if (B && _) {
2505
+ const H = B.length;
2506
+ for (let Z = H - 1; Z >= 0; --Z) {
2507
+ const ce = Ba(B[Z], !0);
2508
+ ce.__removalCount = (f.__removalCount || 0) + 1, _.insertBefore(ce, Ga(f));
2509
+ }
2510
+ }
2511
+ }
2512
+ return oe(f), !0;
2513
+ }
2514
+ return f instanceof Rr && !cn(f) || (y === "noscript" || y === "noembed" || y === "noframes") && G(/<\/no(script|embed|frames)/i, f.innerHTML) ? (oe(f), !0) : (Ce && f.nodeType === He.text && (g = f.textContent, m([_t, At, It], (_) => {
2515
+ g = Ne(g, _, " ");
2516
+ }), f.textContent !== g && (x(S.removed, {
2517
+ element: f.cloneNode()
2518
+ }), f.textContent = g)), ue(Y.afterSanitizeElements, f, null), !1);
2519
+ }, Wr = function(f, g, y) {
2520
+ if (Ar && (g === "id" || g === "name") && (y in P || y in on))
2521
+ return !1;
2522
+ if (!(Ot && !Mt[g] && G(Xa, g))) {
2523
+ if (!(xr && G(Za, g))) {
2524
+ if (!z[g] || Mt[g]) {
2525
+ if (
2526
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2527
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2528
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2529
+ !(Gr(f) && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, f) || O.tagNameCheck instanceof Function && O.tagNameCheck(f)) && (O.attributeNameCheck instanceof RegExp && G(O.attributeNameCheck, g) || O.attributeNameCheck instanceof Function && O.attributeNameCheck(g)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2530
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2531
+ g === "is" && O.allowCustomizedBuiltInElements && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, y) || O.tagNameCheck instanceof Function && O.tagNameCheck(y)))
2532
+ ) return !1;
2533
+ } else if (!Ut[g]) {
2534
+ if (!G(kr, Ne(y, Tr, ""))) {
2535
+ if (!((g === "src" || g === "xlink:href" || g === "href") && f !== "script" && Ra(y, "data:") === 0 && Or[f])) {
2536
+ if (!($r && !G(Ja, Ne(y, Tr, "")))) {
2537
+ if (y)
2538
+ return !1;
2539
+ }
2540
+ }
2541
+ }
2542
+ }
2543
+ }
2544
+ }
2545
+ return !0;
2546
+ }, Gr = function(f) {
2547
+ return f !== "annotation-xml" && De(f, en);
2548
+ }, Vr = function(f) {
2549
+ ue(Y.beforeSanitizeAttributes, f, null);
2550
+ const {
2551
+ attributes: g
2552
+ } = f;
2553
+ if (!g || Bt(f))
2554
+ return;
2555
+ const y = {
2556
+ attrName: "",
2557
+ attrValue: "",
2558
+ keepAttr: !0,
2559
+ allowedAttributes: z,
2560
+ forceKeepAttr: void 0
2561
+ };
2562
+ let _ = g.length;
2563
+ for (; _--; ) {
2564
+ const B = g[_], {
2565
+ name: H,
2566
+ namespaceURI: Z,
2567
+ value: ce
2568
+ } = B, Ye = N(H);
2569
+ let Q = H === "value" ? ce : Ta(ce);
2570
+ if (y.attrName = Ye, y.attrValue = Q, y.keepAttr = !0, y.forceKeepAttr = void 0, ue(Y.uponSanitizeAttribute, f, y), Q = y.attrValue, Ir && (Ye === "id" || Ye === "name") && (lt(H, f), Q = tn + Q), Lt && G(/((--!?|])>)|<\/(style|title)/i, Q)) {
2571
+ lt(H, f);
2572
+ continue;
2573
+ }
2574
+ if (y.forceKeepAttr || (lt(H, f), !y.keepAttr))
2575
+ continue;
2576
+ if (!_r && G(/\/>/i, Q)) {
2577
+ lt(H, f);
2578
+ continue;
2579
+ }
2580
+ Ce && m([_t, At, It], (Yr) => {
2581
+ Q = Ne(Q, Yr, " ");
2582
+ });
2583
+ const qr = N(f.nodeName);
2584
+ if (Wr(qr, Ye, Q)) {
2585
+ if (q && typeof tt == "object" && typeof tt.getAttributeType == "function" && !Z)
2586
+ switch (tt.getAttributeType(qr, Ye)) {
2587
+ case "TrustedHTML": {
2588
+ Q = q.createHTML(Q);
2589
+ break;
2590
+ }
2591
+ case "TrustedScriptURL": {
2592
+ Q = q.createScriptURL(Q);
2593
+ break;
2594
+ }
2595
+ }
2596
+ try {
2597
+ Z ? f.setAttributeNS(Z, H, Q) : f.setAttribute(H, Q), Bt(f) ? oe(f) : v(S.removed);
2598
+ } catch {
2599
+ }
2600
+ }
2601
+ }
2602
+ ue(Y.afterSanitizeAttributes, f, null);
2603
+ }, ln = function E(f) {
2604
+ let g = null;
2605
+ const y = Hr(f);
2606
+ for (ue(Y.beforeSanitizeShadowDOM, f, null); g = y.nextNode(); )
2607
+ ue(Y.uponSanitizeShadowNode, g, null), Br(g), Vr(g), g.content instanceof ie && E(g.content);
2608
+ ue(Y.afterSanitizeShadowDOM, f, null);
2609
+ };
2610
+ return S.sanitize = function(E) {
2611
+ let f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, g = null, y = null, _ = null, B = null;
2612
+ if (zt = !E, zt && (E = "<!-->"), typeof E != "string" && !jr(E))
2613
+ if (typeof E.toString == "function") {
2614
+ if (E = E.toString(), typeof E != "string")
2615
+ throw Ue("dirty is not a string, aborting");
2616
+ } else
2617
+ throw Ue("toString is not a function");
2618
+ if (!S.isSupported)
2619
+ return E;
2620
+ if (Ft || jt(f), S.removed = [], typeof E == "string" && (Ve = !1), Ve) {
2621
+ if (E.nodeName) {
2622
+ const ce = N(E.nodeName);
2623
+ if (!D[ce] || Ge[ce])
2624
+ throw Ue("root node is forbidden and cannot be sanitized in-place");
2625
+ }
2626
+ } else if (E instanceof xt)
2627
+ g = zr("<!---->"), y = g.ownerDocument.importNode(E, !0), y.nodeType === He.element && y.nodeName === "BODY" || y.nodeName === "HTML" ? g = y : g.appendChild(y);
2628
+ else {
2629
+ if (!Pe && !Ce && !we && // eslint-disable-next-line unicorn/prefer-includes
2630
+ E.indexOf("<") === -1)
2631
+ return q && at ? q.createHTML(E) : E;
2632
+ if (g = zr(E), !g)
2633
+ return Pe ? null : at ? We : "";
2634
+ }
2635
+ g && Dt && oe(g.firstChild);
2636
+ const H = Hr(Ve ? E : g);
2637
+ for (; _ = H.nextNode(); )
2638
+ Br(_), Vr(_), _.content instanceof ie && ln(_.content);
2639
+ if (Ve)
2640
+ return E;
2641
+ if (Pe) {
2642
+ if (st)
2643
+ for (B = Ya.call(g.ownerDocument); g.firstChild; )
2644
+ B.appendChild(g.firstChild);
2645
+ else
2646
+ B = g;
2647
+ return (z.shadowroot || z.shadowrootmode) && (B = Ka.call(C, B, !0)), B;
2648
+ }
2649
+ let Z = we ? g.outerHTML : g.innerHTML;
2650
+ return we && D["!doctype"] && g.ownerDocument && g.ownerDocument.doctype && g.ownerDocument.doctype.name && G(yr, g.ownerDocument.doctype.name) && (Z = "<!DOCTYPE " + g.ownerDocument.doctype.name + `>
2651
+ ` + Z), Ce && m([_t, At, It], (ce) => {
2652
+ Z = Ne(Z, ce, " ");
2653
+ }), q && at ? q.createHTML(Z) : Z;
2654
+ }, S.setConfig = function() {
2655
+ let E = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2656
+ jt(E), Ft = !0;
2657
+ }, S.clearConfig = function() {
2658
+ Ae = null, Ft = !1;
2659
+ }, S.isValidAttribute = function(E, f, g) {
2660
+ Ae || jt({});
2661
+ const y = N(E), _ = N(f);
2662
+ return Wr(y, _, g);
2663
+ }, S.addHook = function(E, f) {
2664
+ typeof f == "function" && x(Y[E], f);
2665
+ }, S.removeHook = function(E, f) {
2666
+ if (f !== void 0) {
2667
+ const g = b(Y[E], f);
2668
+ return g === -1 ? void 0 : U(Y[E], g, 1)[0];
2669
+ }
2670
+ return v(Y[E]);
2671
+ }, S.removeHooks = function(E) {
2672
+ Y[E] = [];
2673
+ }, S.removeAllHooks = function() {
2674
+ Y = Er();
2675
+ }, S;
2676
+ }
2677
+ var Ua = wr();
2678
+ return Ua;
2679
+ });
2680
+ })(Vs);
2681
+ const Jo = Vs.exports, fr = (e, ...t) => {
2682
+ let r = e[0];
2683
+ for (let s = 0; s < t.length; s++)
2684
+ r += Jo.sanitize(t[s] ? String(t[s]) : "") + e[s + 1];
2685
+ return r || "";
2686
+ }, ec = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2687
+ let X = (e = 21) => {
2688
+ let t = "", r = crypto.getRandomValues(new Uint8Array(e |= 0));
2689
+ for (; e--; )
2690
+ t += ec[r[e] & 63];
2691
+ return t;
2692
+ };
2693
+ const tc = /* @__PURE__ */ F(class extends L {
2694
+ constructor() {
2695
+ super();
2696
+ h(this, "adSource", "Custom");
2697
+ h(this, "adClientResponseItem");
2698
+ h(this, "adContainerId", X());
2699
+ h(this, "searchTerm");
2700
+ h(this, "isSearchInProgress", !1);
2701
+ h(this, "core");
2702
+ h(this, "intersectionObserver");
2703
+ h(this, "storeUnsubscribe");
2704
+ h(this, "adContainerRenderedTimeout");
2705
+ h(this, "isComponentConnected", !0);
2706
+ this.__registerHost();
2707
+ }
2708
+ get hostElement() {
2709
+ return this;
2710
+ }
2711
+ connectedCallback() {
2712
+ const r = $.getState();
2713
+ this.core = r.core, this.searchTerm = r.searchTerm, this.isSearchInProgress = r.isSearchInProgress, this.storeUnsubscribe = $.subscribe((s) => {
2714
+ this.searchTerm = s.searchTerm, this.isSearchInProgress = s.isSearchInProgress;
2715
+ });
2716
+ }
2717
+ componentDidLoad() {
2718
+ this.hostElement && (this.intersectionObserver = new IntersectionObserver(([r]) => {
2719
+ var s;
2720
+ r != null && r.isIntersecting && !this.isSearchInProgress && ((s = this.core) == null || s.handleAdContainerViewed({
2721
+ adClientResponseItem: this.adClientResponseItem,
2722
+ adContainerId: this.adContainerId,
2723
+ adSource: this.adSource,
2724
+ searchTerm: this.searchTerm || ""
2725
+ }));
2726
+ }, { threshold: 0 }), this.intersectionObserver.observe(this.hostElement));
2727
+ }
2728
+ disconnectedCallback() {
2729
+ var r, s;
2730
+ (r = this.storeUnsubscribe) == null || r.call(this), (s = this.intersectionObserver) == null || s.disconnect(), this.isComponentConnected = !1, clearTimeout(this.adContainerRenderedTimeout);
2731
+ }
2732
+ renderADMAd() {
2733
+ const r = this.adClientResponseItem;
2734
+ if (r.admAd)
2735
+ return d("a", { class: "searchcraft-adm-ad", href: r.admAd.click_url }, r.admAd.image_url && d("div", { class: "searchcraft-adm-ad-image-wrapper" }, d("img", { alt: r.admAd.term || "image", src: r.admAd.image_url, class: "searchcraft-adm-ad-image" })), d("div", { class: "searchcraft-adm-ad-info-wrapper" }, d("p", { class: "searchcraft-adm-ad-title" }, r.admAd.term), r.admAd.price && d("p", { class: "searchcraft-adm-ad-subtitle" }, r.admAd.price)));
2736
+ }
2737
+ renderCustomAd() {
2738
+ var o, n;
2739
+ const r = (n = (o = this.core) == null ? void 0 : o.config) == null ? void 0 : n.customAdTemplate, s = `searchcraft-custom-ad-${this.adContainerId}`;
2740
+ let a = "<p>Custom Ad Placeholder</p>";
2741
+ return r && (a = r({
2742
+ searchTerm: this.searchTerm || "",
2743
+ adContainerId: this.adContainerId
2744
+ }, { html: fr })), d("div", { class: "searchcraft-custom-ad", id: s, "data-searchcraft-ad-container-id": this.adContainerId, innerHTML: a });
2745
+ }
2746
+ renderNativoAd() {
2747
+ var s;
2748
+ const r = ((s = this.core) == null ? void 0 : s.config.nativoAdClassName) || "ntv-item";
2749
+ return d("div", { class: r });
2750
+ }
2751
+ render() {
2752
+ var r, s;
2753
+ if (!this.isSearchInProgress)
2754
+ switch (this.isComponentConnected && (clearTimeout(this.adContainerRenderedTimeout), this.adContainerRenderedTimeout = setTimeout(() => {
2755
+ var a;
2756
+ (a = this.core) == null || a.handleAdContainerRendered({
2757
+ adClientResponseItem: this.adClientResponseItem,
2758
+ adContainerId: this.adContainerId,
2759
+ adSource: this.adSource,
2760
+ searchTerm: this.searchTerm || ""
2761
+ });
2762
+ }, ((s = (r = this.core) == null ? void 0 : r.config) == null ? void 0 : s.adContainerRenderedDebounceDelay) || 500)), this.adSource) {
2763
+ case "adMarketplace":
2764
+ return this.renderADMAd();
2765
+ case "Custom":
2766
+ return this.renderCustomAd();
2767
+ case "Nativo":
2768
+ return this.renderNativoAd();
2769
+ default:
2770
+ return;
2771
+ }
2772
+ }
2773
+ }, [0, "searchcraft-ad", {
2774
+ adSource: [1, "ad-source"],
2775
+ adClientResponseItem: [16],
2776
+ adContainerId: [1, "ad-container-id"],
2777
+ searchTerm: [32],
2778
+ isSearchInProgress: [32]
2779
+ }]);
2780
+ function Et() {
2781
+ if (typeof customElements > "u")
2782
+ return;
2783
+ ["searchcraft-ad"].forEach((t) => {
2784
+ switch (t) {
2785
+ case "searchcraft-ad":
2786
+ customElements.get(t) || customElements.define(t, tc);
2787
+ break;
2788
+ }
2789
+ });
2790
+ }
2791
+ const rc = Et;
2792
+ var qs = { exports: {} };
2793
+ /*!
2794
+ Copyright (c) 2018 Jed Watson.
2795
+ Licensed under the MIT License (MIT), see
2796
+ http://jedwatson.github.io/classnames
2797
+ */
2798
+ (function(e) {
2799
+ (function() {
2800
+ var t = {}.hasOwnProperty;
2801
+ function r() {
2802
+ for (var o = "", n = 0; n < arguments.length; n++) {
2803
+ var c = arguments[n];
2804
+ c && (o = a(o, s(c)));
2805
+ }
2806
+ return o;
2807
+ }
2808
+ function s(o) {
2809
+ if (typeof o == "string" || typeof o == "number")
2810
+ return o;
2811
+ if (typeof o != "object")
2812
+ return "";
2813
+ if (Array.isArray(o))
2814
+ return r.apply(null, o);
2815
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
2816
+ return o.toString();
2817
+ var n = "";
2818
+ for (var c in o)
2819
+ t.call(o, c) && o[c] && (n = a(n, c));
2820
+ return n;
2821
+ }
2822
+ function a(o, n) {
2823
+ return n ? o ? o + " " + n : o + n : o;
2824
+ }
2825
+ e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
2826
+ })();
2827
+ })(qs);
2828
+ const ne = qs.exports, sc = /* @__PURE__ */ F(class extends L {
2829
+ constructor() {
2830
+ super();
2831
+ /**
2832
+ * Controls the visual representation of the button.
2833
+ */
2834
+ h(this, "hierarchy", "primary");
2835
+ /**
2836
+ * Whether the button is disabled.
2837
+ */
2838
+ h(this, "disabled", !1);
2839
+ /**
2840
+ * The icon element.
2841
+ */
2842
+ h(this, "icon");
2843
+ /**
2844
+ * Should the button only display an icon.
2845
+ */
2846
+ h(this, "iconOnly", !1);
2847
+ /**
2848
+ * The position of the icon.
2849
+ */
2850
+ h(this, "iconPosition", "left");
2851
+ /**
2852
+ * The label for the button.
2853
+ */
2854
+ h(this, "label", "Search");
2855
+ /**
2856
+ * The type of the button.
2857
+ */
2858
+ h(this, "type", "button");
2859
+ /**
2860
+ * The event fired when the button is clicked.
2861
+ */
2862
+ h(this, "buttonClick");
2863
+ h(this, "handleButtonClick", () => {
2864
+ this.buttonClick.emit();
2865
+ });
2866
+ this.__registerHost(), this.buttonClick = be(this, "buttonClick");
2867
+ }
2868
+ render() {
2869
+ return d("button", { key: "e54b4566e0286265bc0c8b6bb4e9ef26108575da", "aria-label": this.label, class: ne("searchcraft-button", {
2870
+ "searchcraft-button-primary": this.hierarchy === "primary",
2871
+ "searchcraft-button-tertiary": this.hierarchy === "tertiary",
2872
+ "searchcraft-button-disabled": this.disabled
2873
+ }), disabled: this.disabled, onClick: this.handleButtonClick, type: this.type }, this.iconOnly ? this.icon : d(Ms, null, this.iconPosition === "left" && this.icon, d("span", null, this.label), this.iconPosition === "right" && this.icon));
2874
+ }
2875
+ }, [0, "searchcraft-button", {
2876
+ hierarchy: [1],
2877
+ disabled: [4],
2878
+ icon: [16],
2879
+ iconOnly: [4, "icon-only"],
2880
+ iconPosition: [1, "icon-position"],
2881
+ label: [1],
2882
+ type: [1]
2883
+ }]);
2884
+ function wt() {
2885
+ if (typeof customElements > "u")
2886
+ return;
2887
+ ["searchcraft-button"].forEach((t) => {
2888
+ switch (t) {
2889
+ case "searchcraft-button":
2890
+ customElements.get(t) || customElements.define(t, sc);
2891
+ break;
2892
+ }
2893
+ });
2894
+ }
2895
+ const ac = wt, nc = /* @__PURE__ */ F(class extends L {
2896
+ constructor() {
2897
+ super(), this.__registerHost();
2898
+ }
2899
+ render() {
2900
+ return d("div", { key: "d42f7abf8dfb2620622b8012d868d32f04b2f354", class: "searchcraft-error-message" }, d("slot", { key: "75a7811576ea8afe80a7ae739f5cf2d411f976df" }, "Search term is required."));
2901
+ }
2902
+ }, [4, "searchcraft-error-message"]);
2903
+ function Rt() {
2904
+ if (typeof customElements > "u")
2905
+ return;
2906
+ ["searchcraft-error-message"].forEach((t) => {
2907
+ switch (t) {
2908
+ case "searchcraft-error-message":
2909
+ customElements.get(t) || customElements.define(t, nc);
2910
+ break;
2911
+ }
2912
+ });
2913
+ }
2914
+ const oc = Rt;
2915
+ function Ys(e, t) {
2916
+ const r = { ...e };
2917
+ for (const s in t)
2918
+ t.hasOwnProperty(s) && (t[s] instanceof Object && e[s] instanceof Object ? r[s] = Ys(e[s], t[s]) : r[s] = t[s]);
2919
+ return r;
2920
+ }
2921
+ function cc(e) {
2922
+ return e.filter((t, r, s) => !s.some((a, o) => o !== r && a.includes(t)));
2923
+ }
2924
+ function ms(e) {
2925
+ const t = {}, r = (s) => {
2926
+ var a;
2927
+ t[s.path] = {
2928
+ count: s.count,
2929
+ path: s.path
2930
+ }, (a = s.children) == null || a.forEach((o) => {
2931
+ r(o);
2932
+ });
2933
+ };
2934
+ return r(e), t;
2935
+ }
2936
+ function ic(e) {
2937
+ const t = {
2938
+ count: 0,
2939
+ path: "/",
2940
+ children: {}
2941
+ };
2942
+ return Object.keys(e).forEach((r) => {
2943
+ const s = e[r];
2944
+ if (!s || s.path === "/")
2945
+ return;
2946
+ const a = s.path.substring(1).split("/");
2947
+ let o = t, n = "";
2948
+ a.forEach((c, u) => {
2949
+ const l = `${n}/${c}`;
2950
+ o.children[l] || (o.children[l] = {
2951
+ count: 0,
2952
+ path: l,
2953
+ children: {}
2954
+ }), u === a.length - 1 && (o.children[l].count = s.count), n = l, o = o.children[l];
2955
+ });
2956
+ }), t;
2957
+ }
2958
+ function Qs(e) {
2959
+ const t = {
2960
+ count: e.count,
2961
+ path: e.path,
2962
+ children: []
2963
+ };
2964
+ return Object.keys(e.children).length > 0 && (t.children = Object.values(e.children).map((r) => Qs(r))), t;
2965
+ }
2966
+ function lc(e, t) {
2967
+ const r = Object.keys(e), s = Object.keys(t), a = new Set(s.filter((n) => n.split("/").length > 2).map((n) => n.substring(0, n.lastIndexOf("/"))));
2968
+ return Object.fromEntries(r.filter((n) => !a.has(n.substring(0, n.lastIndexOf("/")))).map((n) => [n, e[n]]));
2969
+ }
2970
+ function uc(e, t, r) {
2971
+ const s = t[e], a = r[e], o = {
2972
+ count: 0,
2973
+ path: "/",
2974
+ children: s
2975
+ }, n = {
2976
+ count: 0,
2977
+ path: "/",
2978
+ children: a
2979
+ }, c = ms(o), u = ms(n), l = lc(c, u), i = Ys(l, u), p = ic(i), m = Qs(p);
2980
+ return {
2981
+ [e]: m.children
2982
+ };
2983
+ }
2984
+ const fc = /* @__PURE__ */ F(class extends L {
2985
+ constructor() {
2986
+ super();
2987
+ /**
2988
+ * The name of the field where facets are applied.
2989
+ */
2990
+ h(this, "fieldName", "");
2991
+ /**
2992
+ * When the facets are updated.
2993
+ */
2994
+ h(this, "facetSelectionUpdated");
2995
+ h(this, "baseFacetRoot");
2996
+ h(this, "facetRoot");
2997
+ h(this, "selectedPaths", {});
2998
+ h(this, "lastTimeTaken");
2999
+ h(this, "hasNewSearchTerm", !1);
3000
+ h(this, "lastSearchTerm");
3001
+ h(this, "lastSearchMode");
3002
+ h(this, "lastSortType");
3003
+ h(this, "unsubscribe");
3004
+ h(this, "searchStore", $.getState());
3005
+ h(this, "formatLabel", (r) => {
3006
+ const s = r.path.replace(/^\//, ""), a = r.count;
3007
+ return `${s.replace(/-/g, " ").replace(/\b\w/g, (o) => o.toUpperCase())} (${a})`;
3008
+ });
3009
+ h(this, "formatSubLabel", (r, s) => {
3010
+ const o = r.path.substring(s.path.length).replace(/^\//, ""), n = r.count;
3011
+ return `${o.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())} (${n})`;
3012
+ });
3013
+ this.__registerHost(), this.facetSelectionUpdated = be(this, "facetSelectionUpdated");
3014
+ }
3015
+ handleStateUpdate(r) {
3016
+ const s = r.searchResponseFacetPrime, a = r.searchResponseTimeTaken;
3017
+ if (this.fieldName) {
3018
+ if ((r.searchTerm !== this.lastSearchTerm || r.searchMode !== this.lastSearchMode || r.sortType !== this.lastSortType) && (this.selectedPaths = {}, this.hasNewSearchTerm = !0), a !== this.lastTimeTaken && s) {
3019
+ this.facetRoot = void 0;
3020
+ const o = s.find((n) => this.fieldName === Object.keys(n)[0]);
3021
+ this.hasNewSearchTerm ? (this.baseFacetRoot = o, this.facetRoot = o, this.hasNewSearchTerm = !1) : this.baseFacetRoot && o && (this.facetRoot = uc(this.fieldName, this.baseFacetRoot, o));
3022
+ }
3023
+ this.lastSearchTerm = r.searchTerm, this.lastSearchMode = r.searchMode, this.lastSortType = r.sortType, this.lastTimeTaken = a;
3024
+ }
3025
+ }
3026
+ connectedCallback() {
3027
+ this.handleStateUpdate(this.searchStore), this.unsubscribe = $.subscribe((r) => {
3028
+ this.handleStateUpdate(r);
3029
+ });
3030
+ }
3031
+ disconnectedCallback() {
3032
+ var r;
3033
+ (r = this.unsubscribe) == null || r.call(this);
3034
+ }
3035
+ handleCheckboxChange(r) {
3036
+ var n;
3037
+ if (!this.selectedPaths[r])
3038
+ this.selectedPaths = {
3039
+ ...this.selectedPaths,
3040
+ [r]: !0
3041
+ };
3042
+ else {
3043
+ const c = Object.keys(this.selectedPaths).filter((u) => !u.includes(r));
3044
+ this.selectedPaths = c.reduce((u, l) => (u[l] = !0, u), {});
3045
+ }
3046
+ const a = Object.keys(this.selectedPaths).filter((c) => this.selectedPaths[c]), o = cc(a);
3047
+ (n = this.facetSelectionUpdated) == null || n.emit({ paths: o });
3048
+ }
3049
+ render() {
3050
+ var s;
3051
+ if (!this.fieldName)
3052
+ return;
3053
+ const r = (s = this.facetRoot) == null ? void 0 : s[this.fieldName];
3054
+ return d("div", { class: "searchcraft-facet-list" }, !r && d("p", { class: "searchcraft-facet-list-message" }, "Enter a search to view facets."), r == null ? void 0 : r.map((a) => {
3055
+ var n;
3056
+ const o = a.children ? (n = a.children) == null ? void 0 : n.some((c) => this.selectedPaths[c.path]) : !1;
3057
+ return d("div", { key: a.path, class: "searchcraft-facet-list-item" }, d("label", { class: "searchcraft-facet-list-checkbox-label" }, d("input", { class: "searchcraft-facet-list-checkbox-input", checked: this.selectedPaths[a.path], onChange: (c) => this.handleCheckboxChange(a.path), type: "checkbox" }), o ? d("div", { class: "searchcraft-facet-list-checkbox-input-dash-icon" }, d("svg", { width: "14", height: "3", viewBox: "0 0 14 3", fill: "none" }, d("title", null, "Checkbox dash"), d("line", { x1: "1.5", y1: "1.5", x2: "12.5", y2: "1.5", stroke: "white", "stroke-width": "3", "stroke-linecap": "round" }))) : d("div", { class: "searchcraft-facet-list-checkbox-input-check-icon" }, d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, d("title", null, "Checkbox check"), d("path", { d: "M13.9999 2L5.74988 10L1.99988 6.36364", stroke: "white", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.formatLabel(a)), a.children && a.children.length > 0 && d(Ms, null, a.children.map((c) => d("label", { key: c.path, class: "searchcraft-facet-list-checkbox-label searchcraft-facet-list-child-checkbox-label", style: {
3058
+ display: this.selectedPaths[a.path] ? "flex" : "none"
3059
+ } }, d("input", { class: "searchcraft-facet-list-checkbox-input searchcraft-facet-list-child-checkbox-input", checked: this.selectedPaths[c.path], onChange: (u) => {
3060
+ this.handleCheckboxChange(c.path);
3061
+ }, type: "checkbox" }), d("div", { class: "searchcraft-facet-list-checkbox-input-check-icon searchcraft-facet-list-child-checkbox-input-check-icon" }, d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, d("title", null, "Checkbox check"), d("path", { d: "M13.9999 2L5.74988 10L1.99988 6.36364", stroke: "white", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.formatSubLabel(c, a)))));
3062
+ }));
3063
+ }
3064
+ }, [0, "searchcraft-facet-list", {
3065
+ fieldName: [1, "field-name"],
3066
+ baseFacetRoot: [32],
3067
+ facetRoot: [32],
3068
+ selectedPaths: [32],
3069
+ lastTimeTaken: [32],
3070
+ hasNewSearchTerm: [32],
3071
+ lastSearchTerm: [32],
3072
+ lastSearchMode: [32],
3073
+ lastSortType: [32],
3074
+ unsubscribe: [32]
3075
+ }]);
3076
+ function Ks() {
3077
+ if (typeof customElements > "u")
3078
+ return;
3079
+ ["searchcraft-facet-list"].forEach((t) => {
3080
+ switch (t) {
3081
+ case "searchcraft-facet-list":
3082
+ customElements.get(t) || customElements.define(t, fc);
3083
+ break;
3084
+ }
3085
+ });
3086
+ }
3087
+ const dc = Ks;
3088
+ function Qe(e, t) {
3089
+ if (e && t)
3090
+ return t.fieldNames.map((r) => {
3091
+ let s = e[r.fieldName];
3092
+ if (s)
3093
+ switch (r.dataType) {
3094
+ case "date": {
3095
+ s = pc(s);
3096
+ break;
3097
+ }
3098
+ case "number": {
3099
+ s = Intl.NumberFormat(r.numberFormatLocale, r.numberFormatOptions).format(s * (r.numberScale || 1));
3100
+ break;
3101
+ }
3102
+ }
3103
+ return s;
3104
+ }).filter((r) => !!r).join(t.delimiter || " ");
3105
+ }
3106
+ function Xs(e) {
3107
+ switch (e) {
3108
+ case "hour":
3109
+ return 36e5;
3110
+ case "day":
3111
+ return 864e5;
3112
+ case "month":
3113
+ return 2592e6;
3114
+ case "year":
3115
+ return 31536e6;
3116
+ default:
3117
+ return 36e5;
3118
+ }
3119
+ }
3120
+ function hc(e) {
3121
+ return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3122
+ }
3123
+ function pc(e) {
3124
+ const t = /* @__PURE__ */ new Date(), r = new Date(e), s = Math.floor((t.getTime() - r.getTime()) / 1e3), a = Math.floor(s / 60), o = Math.floor(a / 60), n = Math.floor(o / 24), c = Math.floor(n / 365);
3125
+ return a < 60 ? `${a}m ago` : o < 24 ? `${o}h ago` : n < 365 ? `${n}d ago` : `${c}y ago`;
3126
+ }
3127
+ const mc = /* @__PURE__ */ F(class extends L {
3128
+ constructor() {
3129
+ super();
3130
+ /**
3131
+ * The maximum value allowed.
3132
+ */
3133
+ h(this, "max", 100);
3134
+ /**
3135
+ * The minimum value allowed.
3136
+ */
3137
+ h(this, "min", 0);
3138
+ /**
3139
+ * The granularity that the value must adhere to.
3140
+ */
3141
+ h(this, "granularity", Xs("month"));
3142
+ /** The type of data allowed. */
3143
+ h(this, "dataType", "number");
3144
+ h(this, "endValue", this.max);
3145
+ h(this, "startValue", this.min);
3146
+ h(this, "lastFocusedHandle", "max");
3147
+ /**
3148
+ * When the range has changed.
3149
+ * */
3150
+ h(this, "rangeChanged");
3151
+ h(this, "emitUpdate", async () => {
3152
+ var r;
3153
+ (r = this.rangeChanged) == null || r.emit({
3154
+ startValue: this.startValue,
3155
+ endValue: this.endValue
3156
+ });
3157
+ });
3158
+ h(this, "handleStartValueChange", (r) => {
3159
+ const s = r.target, a = Number.parseInt(s.value, 10);
3160
+ this.lastFocusedHandle = "min", a <= this.endValue ? (this.startValue = a, this.emitUpdate()) : (this.startValue = this.endValue, s.value = `${this.endValue}`);
3161
+ });
3162
+ h(this, "handleEndValueChange", (r) => {
3163
+ const s = r.target, a = Number.parseInt(s.value, 10);
3164
+ this.lastFocusedHandle = "max", a >= this.startValue ? (this.endValue = a, this.emitUpdate()) : (this.endValue = this.startValue, s.value = `${this.startValue}`);
3165
+ });
3166
+ this.__registerHost(), this.rangeChanged = be(this, "rangeChanged");
3167
+ }
3168
+ componentDidLoad() {
3169
+ this.startValue = this.min, this.endValue = this.max;
3170
+ }
3171
+ render() {
3172
+ const r = this.min, s = this.max, a = (this.startValue - r) / (s - r) * 100, o = (this.endValue - r) / (s - r) * 100, n = this.dataType === "number" ? this.startValue : new Date(this.startValue).getFullYear(), c = this.dataType === "number" ? this.endValue : new Date(this.endValue).getFullYear();
3173
+ return d("div", { key: "ad6c2b473230863408f48eee11527bc088ae4ef7", class: "searchcraft-slider" }, d("div", { key: "9c89eae611cfa3aed547e18fe242e58878e20252", class: "searchcraft-slider-range" }, d("div", { key: "9dfa61b66d26cc257bf878bd233b7ac02a94d7cf", class: "searchcraft-slider-active-range", style: {
3174
+ left: `${a}%`,
3175
+ width: `${o - a}%`
3176
+ } }), d("input", { key: "20ba4345d47a4c553d14cf70abfc1272f3423c41", class: ne("searchcraft-slider-input", "searchcraft-slider-input-min-handle"), max: this.max, min: this.min, onInput: this.handleStartValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === "min" ? "2" : "1" }, type: "range", value: this.startValue }), d("input", { key: "e142cd75420882136d85f076678903ce4f8ef0f7", class: ne("searchcraft-slider-input", "searchcraft-slider-input-max-handle"), max: this.max, min: this.min, onInput: this.handleEndValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === "max" ? "2" : "1" }, type: "range", value: this.endValue })), d("div", { key: "5b370071b7804fd896f87398ef8bc4e9603446d8", class: "searchcraft-slider-label" }, d("span", { key: "e22e25c99fc150590e19c9b939dc9687f14f49dc", class: "searchcraft-slider-start-label" }, n), d("span", { key: "a81fa0d45acdfcbaceb69fe94721fb25cac038a2", class: "searchcraft-slider-end-label" }, c)));
3177
+ }
3178
+ }, [0, "searchcraft-slider", {
3179
+ max: [2],
3180
+ min: [2],
3181
+ granularity: [2],
3182
+ dataType: [1, "data-type"],
3183
+ endValue: [32],
3184
+ startValue: [32],
3185
+ lastFocusedHandle: [32]
3186
+ }]);
3187
+ function Zs() {
3188
+ if (typeof customElements > "u")
3189
+ return;
3190
+ ["searchcraft-slider"].forEach((t) => {
3191
+ switch (t) {
3192
+ case "searchcraft-slider":
3193
+ customElements.get(t) || customElements.define(t, mc);
3194
+ break;
3195
+ }
3196
+ });
3197
+ }
3198
+ const gc = /* @__PURE__ */ F(class extends L {
3199
+ constructor() {
3200
+ super();
3201
+ /**
3202
+ * The label.
3203
+ */
3204
+ h(this, "label", "Toggle");
3205
+ /**
3206
+ * The secondary label displayed below the main label.
3207
+ */
3208
+ h(this, "subLabel");
3209
+ /**
3210
+ * When the toggle element is changed.
3211
+ */
3212
+ h(this, "toggleUpdated");
3213
+ h(this, "isActive", !1);
3214
+ h(this, "unsubscribe");
3215
+ h(this, "lastSearchTerm");
3216
+ h(this, "handleToggle", async () => {
3217
+ var r;
3218
+ this.isActive = !this.isActive, (r = this.toggleUpdated) == null || r.emit(this.isActive);
3219
+ });
3220
+ this.__registerHost(), this.toggleUpdated = be(this, "toggleUpdated");
3221
+ }
3222
+ connectedCallback() {
3223
+ this.unsubscribe = $.subscribe((r) => {
3224
+ r.searchTerm !== this.lastSearchTerm && r.searchTerm.trim().length === 0 && (this.isActive = !1), this.lastSearchTerm = r.searchTerm;
3225
+ });
3226
+ }
3227
+ disconnectedCallback() {
3228
+ var r;
3229
+ (r = this.unsubscribe) == null || r.call(this);
3230
+ }
3231
+ render() {
3232
+ return d("div", { key: "dd0367c381eaedcf675977c181fbdac6499f32e9", class: ne("searchcraft-toggle-button", {
3233
+ "searchcraft-toggle-button-active": this.isActive
3234
+ }) }, d("div", { key: "43b5920cad7c1d44dda3d541481a2eea1f0182b7" }, d("p", { key: "1ac87d2f68ba9e8b84e9e5e4157a4108275d064c", class: "searchcraft-toggle-button-label" }, this.label), this.subLabel && d("p", { key: "e06f9a06088bede5546d8d47e84ece9cae5dfc54", class: "searchcraft-toggle-button-sub-label" }, this.subLabel)), d("button", { key: "96999c99ef38996f871ac9260f4a048561cd7003", class: "searchcraft-toggle-button-background", onClick: this.handleToggle, type: "button" }, d("div", { key: "f93c71f1e06531f06709140033d56aa2fa378d47", class: "searchcraft-toggle-button-handle" })));
3235
+ }
3236
+ }, [0, "searchcraft-toggle-button", {
3237
+ label: [1],
3238
+ subLabel: [1, "sub-label"],
3239
+ isActive: [32],
3240
+ unsubscribe: [32],
3241
+ lastSearchTerm: [32]
3242
+ }]);
3243
+ function Js() {
3244
+ if (typeof customElements > "u")
3245
+ return;
3246
+ ["searchcraft-toggle-button"].forEach((t) => {
3247
+ switch (t) {
3248
+ case "searchcraft-toggle-button":
3249
+ customElements.get(t) || customElements.define(t, gc);
3250
+ break;
3251
+ }
3252
+ });
3253
+ }
3254
+ const ea = /* @__PURE__ */ F(class extends L {
3255
+ constructor() {
3256
+ super();
3257
+ /**
3258
+ * The items to filter.
3259
+ */
3260
+ h(this, "items", []);
3261
+ h(this, "unsubscribe");
3262
+ h(this, "lastSearchTerm");
3263
+ h(this, "searchStore", $.getState());
3264
+ this.__registerHost();
3265
+ }
3266
+ componentDidLoad() {
3267
+ this.unsubscribe = $.subscribe((r) => {
3268
+ this.lastSearchTerm = r.searchTerm || "";
3269
+ });
3270
+ }
3271
+ disconnectedCallback() {
3272
+ var r;
3273
+ (r = this.unsubscribe) == null || r.call(this);
3274
+ }
3275
+ handleDateRangeChanged(r, s, a) {
3276
+ const o = new Date(new Date(s).getFullYear(), 0, 1), n = new Date(new Date(a).getFullYear() + 1, 0, 0);
3277
+ this.searchStore.addRangeValueForIndexField({
3278
+ fieldName: r,
3279
+ value: `${r}:[${o.toISOString()} TO ${n.toISOString()}]`
3280
+ }), this.searchStore.search();
3281
+ }
3282
+ handleNumericRangeChanged(r, s, a) {
3283
+ this.searchStore.addRangeValueForIndexField({
3284
+ fieldName: r,
3285
+ value: `${r}:[${s} TO ${a}]`
3286
+ }), this.searchStore.search();
3287
+ }
3288
+ handleFacetSelectionUpdated(r, s) {
3289
+ s.length > 0 ? this.searchStore.addFacetPathsForIndexField({
3290
+ fieldName: r,
3291
+ value: `${r}: IN [${s.join(" ")}]`
3292
+ }) : this.searchStore.removeFacetPathsForIndexField(r), this.searchStore.search();
3293
+ }
3294
+ handleExactMatchToggleUpdated(r) {
3295
+ this.searchStore.setSearchMode(r ? "exact" : "fuzzy"), this.searchStore.search();
3296
+ }
3297
+ handleMostRecentToggleUpdated(r) {
3298
+ this.searchStore.setSortType(r ? "desc" : "asc"), this.searchStore.search();
3299
+ }
3300
+ /**
3301
+ * Iterate through `items` and render them based on `type`
3302
+ */
3303
+ render() {
3304
+ return d("div", { key: "6d3779476496055a83529c39cd9908a46f404e02", class: "searchcraft-filter-panel" }, this.items.map((r) => {
3305
+ switch (r.type) {
3306
+ case "dateRange": {
3307
+ const s = r, a = new Date(s.options.minDate).getTime(), o = new Date(s.options.maxDate).getTime(), n = Xs(s.options.granularity);
3308
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-slider", { min: a, max: o, granularity: n, dataType: "date", onRangeChanged: (c) => {
3309
+ this.handleDateRangeChanged(s.fieldName, c.detail.startValue, c.detail.endValue);
3310
+ } }));
3311
+ }
3312
+ case "numericRange": {
3313
+ const s = r;
3314
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-slider", { min: s.options.min, max: s.options.max, granularity: s.options.granularity, onRangeChanged: (a) => {
3315
+ this.handleNumericRangeChanged(s.fieldName, a.detail.startValue, a.detail.endValue);
3316
+ } }));
3317
+ }
3318
+ case "facets": {
3319
+ const s = r;
3320
+ return d("div", { class: "searchcraft-filter-panel-section" }, d("p", { class: "searchcraft-filter-panel-label" }, r.label), d("searchcraft-facet-list", { fieldName: s.fieldName, onFacetSelectionUpdated: (a) => {
3321
+ this.handleFacetSelectionUpdated(s.fieldName, a.detail.paths);
3322
+ } }));
3323
+ }
3324
+ case "exactMatchToggle": {
3325
+ const s = r;
3326
+ return d("searchcraft-toggle-button", { label: s.label, subLabel: s.options.subLabel, onToggleUpdated: (a) => {
3327
+ this.handleExactMatchToggleUpdated(a.detail);
3328
+ } });
3329
+ }
3330
+ case "mostRecentToggle": {
3331
+ const s = r;
3332
+ return d("searchcraft-toggle-button", { label: s.label, subLabel: s.options.subLabel, onToggleUpdated: (a) => {
3333
+ this.handleMostRecentToggleUpdated(a.detail);
3334
+ } });
3335
+ }
3336
+ }
3337
+ }));
3338
+ }
3339
+ }, [0, "searchcraft-filter-panel", {
3340
+ items: [16],
3341
+ unsubscribe: [32],
3342
+ lastSearchTerm: [32]
3343
+ }]);
3344
+ function vc() {
3345
+ if (typeof customElements > "u")
3346
+ return;
3347
+ ["searchcraft-filter-panel", "searchcraft-facet-list", "searchcraft-slider", "searchcraft-toggle-button"].forEach((t) => {
3348
+ switch (t) {
3349
+ case "searchcraft-filter-panel":
3350
+ customElements.get(t) || customElements.define(t, ea);
3351
+ break;
3352
+ case "searchcraft-facet-list":
3353
+ customElements.get(t) || Ks();
3354
+ break;
3355
+ case "searchcraft-slider":
3356
+ customElements.get(t) || Zs();
3357
+ break;
3358
+ case "searchcraft-toggle-button":
3359
+ customElements.get(t) || Js();
3360
+ break;
3361
+ }
3362
+ });
3363
+ }
3364
+ const bc = ea, ta = vc, yc = /* @__PURE__ */ F(class extends L {
3365
+ constructor() {
3366
+ super();
3367
+ /**
3368
+ * The classname applied to the label element.
3369
+ */
3370
+ h(this, "inputLabelClassName", "");
3371
+ h(this, "label", "");
3372
+ this.__registerHost();
3373
+ }
3374
+ render() {
3375
+ return d("label", { key: "3622c616d480e57b1dfaa2d61637a30b843cb968", class: ne("searchcraft-input-label", this.inputLabelClassName), htmlFor: "searchcraft-input-id" }, this.label);
3376
+ }
3377
+ }, [0, "searchcraft-input-label", {
3378
+ inputLabelClassName: [1, "input-label-class-name"],
3379
+ label: [1]
3380
+ }]);
3381
+ function dr() {
3382
+ if (typeof customElements > "u")
3383
+ return;
3384
+ ["searchcraft-input-label"].forEach((t) => {
3385
+ switch (t) {
3386
+ case "searchcraft-input-label":
3387
+ customElements.get(t) || customElements.define(t, yc);
3388
+ break;
3389
+ }
3390
+ });
3391
+ }
3392
+ const ra = /* @__PURE__ */ F(class extends L {
3393
+ constructor() {
3394
+ super();
3395
+ /**
3396
+ * Whether or not to automatically submit the search term when the input changes.
3397
+ */
3398
+ h(this, "autoSearch", !0);
3399
+ /**
3400
+ * Where to place the search button.
3401
+ */
3402
+ h(this, "buttonPlacement", "none");
3403
+ /**
3404
+ * The label for the submit button.
3405
+ */
3406
+ h(this, "buttonLabel");
3407
+ /**
3408
+ * The label rendered above the input.
3409
+ */
3410
+ h(this, "inputLabel");
3411
+ /**
3412
+ * The input element's placeholder value.
3413
+ */
3414
+ h(this, "placeholderValue", "Enter Search");
3415
+ /**
3416
+ * When the input becomes focused.
3417
+ */
3418
+ h(this, "inputFocus");
3419
+ /**
3420
+ * When the input becomes unfocused.
3421
+ */
3422
+ h(this, "inputBlur");
3423
+ /**
3424
+ * Event emitted when input initializes.
3425
+ */
3426
+ h(this, "inputInit");
3427
+ h(this, "inputValue", "");
3428
+ h(this, "searchTerm", "");
3429
+ h(this, "error", !1);
3430
+ h(this, "core");
3431
+ h(this, "searchStore", $.getState());
3432
+ h(this, "handleOnInput", (r) => {
3433
+ const s = r.target;
3434
+ this.inputValue = s.value, this.autoSearch && this.performSearch(s.value);
3435
+ });
3436
+ h(this, "performSearch", async (r) => {
3437
+ if (r !== $.getState().searchTerm) {
3438
+ this.searchTerm = r.trim(), this.error = !1, this.searchStore.setSearchTerm(this.searchTerm);
3439
+ try {
3440
+ await this.searchStore.search();
3441
+ } catch (s) {
3442
+ console.log(s), this.error = !0;
3443
+ }
3444
+ }
3445
+ });
3446
+ h(this, "handleClearInput", () => {
3447
+ this.inputValue = "", this.searchTerm = "", this.searchStore.setSearchTerm(""), this.searchStore.setSearchClientResponseItems([]), this.error = !1;
3448
+ });
3449
+ h(this, "handleFormSubmit", async (r) => {
3450
+ r.preventDefault(), await this.performSearch(this.searchTerm);
3451
+ });
3452
+ this.__registerHost(), this.inputFocus = be(this, "inputFocus"), this.inputBlur = be(this, "inputBlur"), this.inputInit = be(this, "inputInit");
3453
+ }
3454
+ init() {
3455
+ var r;
3456
+ this.core && (this.searchStore.initialize(this.core), (r = this.inputInit) == null || r.emit());
3457
+ }
3458
+ connectedCallback() {
3459
+ this.init();
3460
+ }
3461
+ onCoreChange() {
3462
+ this.init();
3463
+ }
3464
+ render() {
3465
+ const r = this.inputValue.length > 0, s = ne("searchcraft-input-form-grid", {
3466
+ "searchcraft-input-form-grid-button-left": this.buttonPlacement === "left",
3467
+ "searchcraft-input-form-grid-button-right": this.buttonPlacement === "right",
3468
+ "searchcraft-input-form-grid-button-none": this.buttonPlacement === "none"
3469
+ }), o = {
3470
+ gap: this.inputLabel || this.error ? "4px 8px" : "0px 8px"
3471
+ };
3472
+ return d("form", { key: "862f8059b6eaae8d7ac9bd3c9de8109dd60fab8f", class: "searchcraft-input-form", onSubmit: this.handleFormSubmit }, d("div", { key: "34ff1c3cff4011c9a5f0af0ff690e3a12ad80907", class: s, style: o }, d("div", { key: "820506482aeea17534c4113e601f3ba2254e7fe6", class: "searchcraft-input-form-button" }, d("searchcraft-button", { key: "377a6d8e9835c40379dbd0842a2f0f53638845e1", onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && d("div", { key: "84d100df3793599fd3f6773d26028e43e41d1ab7", class: "searchcraft-input-form-label" }, d("searchcraft-input-label", { key: "cfa7eca0b2ab3b82dd6c0a5104c19c88881f52b5", label: this.inputLabel })), this.error && d("div", { key: "62d0e29e46ac922469e48aa822239cd645ea9c8d", class: "searchcraft-input-form-error-message" }, d("searchcraft-error-message", { key: "8a989b4a2e1196b01de9082433a69d86f55910fb" }, "Something went wrong.")), d("div", { key: "a3c4cd8ef20f909eec2d9e2f9515a65525fe612e", class: "searchcraft-input-form-input-wrapper" }, d("input", { key: "af23902c7f7a79ced427da3aadaa30736b68c8a7", autoComplete: "off", class: "searchcraft-input-form-input", onFocus: () => {
3473
+ var n;
3474
+ return (n = this.inputFocus) == null ? void 0 : n.emit();
3475
+ }, onBlur: () => {
3476
+ var n;
3477
+ return (n = this.inputBlur) == null ? void 0 : n.emit();
3478
+ }, onInput: (n) => {
3479
+ this.handleOnInput(n);
3480
+ }, placeholder: this.placeholderValue, type: "text", value: this.inputValue }), d("div", { key: "66176081ef8da6bd3065ad0eeb61a397ab0fadfc", class: "searchcraft-input-form-input-icon" }, d("svg", { key: "baac2f051f04a411acba0d5683255e9a37a27833", class: "searchcraft-input-form-input-search-icon", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-labelledby": "searchcraft-title" }, d("title", { key: "24230d00bd0b9466fb414246836c2477630ec254" }, "Search icon"), d("path", { key: "9f1446fd1885cc63c26fa5acfcdbdb775547c5ee", d: "M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), r && d("button", { key: "b9a42b46f7d470f6f1bbba5b95fd4031db9a1ebd", type: "button", class: "searchcraft-input-form-clear-button", onClick: this.handleClearInput }, d("svg", { key: "cda07c19eb77c2d2d343ce8d1cf8c55c484107f2", class: "searchcraft-input-form-clear-button-icon", viewBox: "0 0 22 22", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-labelledby": "icon-title" }, d("title", { key: "43ba26388dc06b6ff3c5441387db9ba621bcc08e" }, "Clear icon"), d("path", { key: "5f33de1e306548f1cf504e4e6c6548d51eba93d3", d: "M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))))));
3481
+ }
3482
+ static get watchers() {
3483
+ return {
3484
+ core: ["onCoreChange"]
3485
+ };
3486
+ }
3487
+ }, [0, "searchcraft-input-form", {
3488
+ autoSearch: [4, "auto-search"],
3489
+ buttonPlacement: [1, "button-placement"],
3490
+ buttonLabel: [1, "button-label"],
3491
+ inputLabel: [1, "input-label"],
3492
+ placeholderValue: [1, "placeholder-value"],
3493
+ core: [16],
3494
+ inputValue: [32],
3495
+ searchTerm: [32],
3496
+ error: [32]
3497
+ }, void 0, {
3498
+ core: ["onCoreChange"]
3499
+ }]);
3500
+ function sa() {
3501
+ if (typeof customElements > "u")
3502
+ return;
3503
+ ["searchcraft-input-form", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-label"].forEach((t) => {
3504
+ switch (t) {
3505
+ case "searchcraft-input-form":
3506
+ customElements.get(t) || customElements.define(t, ra);
3507
+ break;
3508
+ case "searchcraft-button":
3509
+ customElements.get(t) || wt();
3510
+ break;
3511
+ case "searchcraft-error-message":
3512
+ customElements.get(t) || Rt();
3513
+ break;
3514
+ case "searchcraft-input-label":
3515
+ customElements.get(t) || dr();
3516
+ break;
3517
+ }
3518
+ });
3519
+ }
3520
+ const Sc = ra, aa = sa, Ec = dr, na = /* @__PURE__ */ F(class extends L {
3521
+ constructor() {
3522
+ super();
3523
+ // store vars
3524
+ h(this, "searchTerm");
3525
+ h(this, "searchResultsPerPage");
3526
+ h(this, "searchResultsPage");
3527
+ h(this, "searchResultsCount");
3528
+ // local vars
3529
+ h(this, "searchResultsPagesCount", 1);
3530
+ h(this, "searchResultsRangeMin", 1);
3531
+ h(this, "searchResultsRangeMax", 1);
3532
+ // store functions
3533
+ h(this, "setSearchResultsPage", () => {
3534
+ });
3535
+ h(this, "unsubscribe", () => {
3536
+ });
3537
+ this.__registerHost();
3538
+ }
3539
+ componentDidLoad() {
3540
+ this.unsubscribe = $.subscribe((r) => {
3541
+ this.searchTerm = r.searchTerm, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsPage = r.searchResultsPage, this.searchResultsCount = r.searchResultsCount, this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage), this.searchResultsRangeMin = (this.searchResultsPage - 1) * this.searchResultsPerPage + 1, this.searchResultsRangeMax = (this.searchResultsPerPage - 1) * this.searchResultsPerPage + this.searchResultsPerPage, this.setSearchResultsPage = r.setSearchResultsPage;
3542
+ });
3543
+ }
3544
+ disconnectedCallback() {
3545
+ var r;
3546
+ (r = this.unsubscribe) == null || r.call(this);
3547
+ }
3548
+ handleGoToPage(r) {
3549
+ this.setSearchResultsPage(r);
3550
+ }
3551
+ renderOddPaginationItem(r) {
3552
+ return d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3553
+ "searchcraft-pagination-item-active": this.searchResultsPage === r
3554
+ }), onClick: () => this.handleGoToPage(r), type: "button" }, r));
3555
+ }
3556
+ renderEvenPaginationItem(r) {
3557
+ if (!(this.searchResultsPagesCount <= r))
3558
+ return (this.searchResultsPagesCount <= 5 || r < Math.ceil(this.searchResultsPagesCount / 2) ? this.searchResultsPage <= r + 1 : this.searchResultsPage >= r - 1) ? d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3559
+ "searchcraft-pagination-item-active": this.searchResultsPage === r
3560
+ }), onClick: () => this.handleGoToPage(r), type: "button" }, r)) : d("li", null, d("span", { class: "searchcraft-pagination-item" }, "..."));
3561
+ }
3562
+ renderMiddlePaginationItem() {
3563
+ if (!(this.searchResultsPagesCount <= 3))
3564
+ return this.searchResultsPagesCount <= 5 || this.searchResultsPage <= 3 || this.searchResultsPage >= this.searchResultsPagesCount - 2 ? d("li", null, d("button", { class: ne("searchcraft-pagination-item", {
3565
+ "searchcraft-pagination-item-active": this.searchResultsPage === 3 || this.searchResultsPage === this.searchResultsPagesCount - 2
3566
+ }), type: "button", onClick: () => this.handleGoToPage(this.searchResultsPage >= this.searchResultsPagesCount - 2 ? this.searchResultsPagesCount - 2 : 3) }, this.searchResultsPage >= this.searchResultsPagesCount - 2 ? this.searchResultsPagesCount - 2 : 3)) : d("li", null, d("span", { class: "searchcraft-pagination-item searchcraft-pagination-item-active" }, this.searchResultsPage));
3567
+ }
3568
+ render() {
3569
+ if (!(!this.searchTerm || this.searchResultsPagesCount <= 1))
3570
+ return d("div", { class: "searchcraft-pagination" }, d("div", { class: "searchcraft-pagination-control" }, d("searchcraft-button", { disabled: this.searchResultsPage === 1, hierarchy: "tertiary", onButtonClick: () => this.handleGoToPage(Math.max(1, this.searchResultsPage - 1)), label: "Previous", iconPosition: "left", icon: d("svg", { class: "searchcraft-button-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", null, "Previous page icon"), d("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })), iconOnly: !0 })), d("ul", { class: "searchcraft-pagination-list" }, this.renderOddPaginationItem(1), this.renderEvenPaginationItem(2), this.renderMiddlePaginationItem(), this.renderEvenPaginationItem(this.searchResultsPagesCount > 4 ? this.searchResultsPagesCount - 1 : 4), this.renderOddPaginationItem(this.searchResultsPagesCount)), d("div", { class: "searchcraft-pagination-control" }, d("searchcraft-button", { disabled: this.searchResultsPage === this.searchResultsPagesCount, hierarchy: "tertiary", onButtonClick: () => {
3571
+ this.handleGoToPage(Math.min(this.searchResultsPagesCount, this.searchResultsPage + 1));
3572
+ }, label: "Next", iconPosition: "right", icon: d("svg", { class: "searchcraft-button-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", null, "Next page icon"), d("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })), iconOnly: !0 })));
3573
+ }
3574
+ }, [0, "searchcraft-pagination", {
3575
+ searchTerm: [32],
3576
+ searchResultsPerPage: [32],
3577
+ searchResultsPage: [32],
3578
+ searchResultsCount: [32],
3579
+ searchResultsPagesCount: [32],
3580
+ searchResultsRangeMin: [32],
3581
+ searchResultsRangeMax: [32],
3582
+ setSearchResultsPage: [32]
3583
+ }]);
3584
+ function wc() {
3585
+ if (typeof customElements > "u")
3586
+ return;
3587
+ ["searchcraft-pagination", "searchcraft-button"].forEach((t) => {
3588
+ switch (t) {
3589
+ case "searchcraft-pagination":
3590
+ customElements.get(t) || customElements.define(t, na);
3591
+ break;
3592
+ case "searchcraft-button":
3593
+ customElements.get(t) || wt();
3594
+ break;
3595
+ }
3596
+ });
3597
+ }
3598
+ const Rc = na, oa = wc, ca = /* @__PURE__ */ F(class extends L {
3599
+ constructor() {
3600
+ super(), this.__registerHost();
3601
+ }
3602
+ handleOnClick() {
3603
+ $.getState().setPopoverVisibility(!0);
3604
+ }
3605
+ render() {
3606
+ return d("button", { key: "878f61ad9c93a3900e97f459f33cf526e647e583", class: "searchcraft-popover-button", onClick: this.handleOnClick.bind(this), type: "button" }, d("slot", { key: "c248779f08b940fca9800375b8814d6fc49f3715" }));
3607
+ }
3608
+ }, [4, "searchcraft-popover-button"]);
3609
+ function Tc() {
3610
+ if (typeof customElements > "u")
3611
+ return;
3612
+ ["searchcraft-popover-button"].forEach((t) => {
3613
+ switch (t) {
3614
+ case "searchcraft-popover-button":
3615
+ customElements.get(t) || customElements.define(t, ca);
3616
+ break;
3617
+ }
3618
+ });
3619
+ }
3620
+ const kc = ca, ia = Tc, Cc = /* @__PURE__ */ F(class extends L {
3621
+ constructor() {
3622
+ super();
3623
+ h(this, "item");
3624
+ h(this, "popoverResultMappings");
3625
+ /** The document position relative to the search results (For Measure) */
3626
+ h(this, "documentPosition", 0);
3627
+ h(this, "href");
3628
+ h(this, "imageSrc");
3629
+ h(this, "imageAlt");
3630
+ h(this, "titleContent");
3631
+ h(this, "subtitleContent");
3632
+ h(this, "handleLinkClick", () => {
3633
+ var a;
3634
+ const r = $.getState(), s = r.getSearchcraftInstance();
3635
+ if (s) {
3636
+ const o = this.documentPosition, n = r.searchTerm, c = r.searchClientResponseItems.length || 0;
3637
+ (a = s.measureClient) == null || a.sendMeasureEvent("document_clicked", {
3638
+ document_position: o,
3639
+ number_of_documents: c,
3640
+ search_term: n
3641
+ });
3642
+ }
3643
+ });
3644
+ this.__registerHost();
3645
+ }
3646
+ mapValuesFromDocument(r) {
3647
+ var s, a, o, n, c;
3648
+ this.titleContent = Qe(r, (s = this.popoverResultMappings) == null ? void 0 : s.title), this.subtitleContent = Qe(r, (a = this.popoverResultMappings) == null ? void 0 : a.subtitle), this.href = Qe(r, (o = this.popoverResultMappings) == null ? void 0 : o.href), this.imageSrc = Qe(r, (n = this.popoverResultMappings) == null ? void 0 : n.imageSource), this.imageAlt = Qe(r, (c = this.popoverResultMappings) == null ? void 0 : c.imageAlt);
3649
+ }
3650
+ connectedCallback() {
3651
+ this.item && this.mapValuesFromDocument(this.item.document);
3652
+ }
3653
+ disconnectedCallback() {
3654
+ }
3655
+ render() {
3656
+ return d("a", { key: "c4a142be2b9993b8ad83eaaa59bdd9a047e4275e", class: "searchcraft-popover-list-item", href: this.href, onClick: this.handleLinkClick.bind(this) }, this.imageSrc && d("div", { key: "6a620203f4918b051835f557a00eb82c2397c56f", class: "searchcraft-popover-list-item-image-wrapper" }, d("img", { key: "1a07c169119146f4f22e704098c493d67927ce82", alt: this.imageAlt, src: this.imageSrc, class: "searchcraft-popover-list-item-image" })), d("div", { key: "d0b2faa1359c004cb5c38fd615e969a7614706cc", class: "searchcraft-popover-list-item-info-wrapper" }, d("p", { key: "9b8c8ba1d5c62a5251db893f3604803f83f687d2", class: "searchcraft-popover-list-item-title" }, this.titleContent), d("p", { key: "930699a84405d0ea2476eb91bf9ce77fed016bb8", class: "searchcraft-popover-list-item-subtitle" }, this.subtitleContent)));
3657
+ }
3658
+ }, [0, "searchcraft-popover-list-item", {
3659
+ item: [16],
3660
+ popoverResultMappings: [16],
3661
+ documentPosition: [2, "document-position"],
3662
+ href: [32],
3663
+ imageSrc: [32],
3664
+ imageAlt: [32],
3665
+ titleContent: [32],
3666
+ subtitleContent: [32]
3667
+ }]);
3668
+ function hr() {
3669
+ if (typeof customElements > "u")
3670
+ return;
3671
+ ["searchcraft-popover-list-item"].forEach((t) => {
3672
+ switch (t) {
3673
+ case "searchcraft-popover-list-item":
3674
+ customElements.get(t) || customElements.define(t, Cc);
3675
+ break;
3676
+ }
3677
+ });
3678
+ }
3679
+ var ys;
3680
+ const Pc = /* @__PURE__ */ F(class extends L {
3681
+ constructor() {
3682
+ super();
3683
+ /**
3684
+ * The mappings that define how the data in the documents are mapped to the
3685
+ * list-view-item elements.
3686
+ */
3687
+ h(this, "popoverResultMappings");
3688
+ /**
3689
+ * The items to render in the list view.
3690
+ */
3691
+ h(this, "searchClientResponseItems");
3692
+ h(this, "adClientResponseItems");
3693
+ h(this, "searchResultsPage");
3694
+ h(this, "searchResultsPerPage");
3695
+ h(this, "config", (ys = $.getState().core) == null ? void 0 : ys.config);
3696
+ this.__registerHost();
3697
+ }
3698
+ renderWithADMAds() {
3699
+ var r, s;
3700
+ return d("div", { class: "searchcraft-popover-list-view" }, (r = this.adClientResponseItems) == null ? void 0 : r.map((a) => d("searchcraft-ad", { adClientResponseItem: a, adContainerId: X(), adSource: "adMarketplace", key: a.id })), (s = this.searchClientResponseItems) == null ? void 0 : s.map((a, o) => d("searchcraft-popover-list-item", { item: a, key: a.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + o })));
3701
+ }
3702
+ renderWithCustomAds() {
3703
+ var u, l, i, p;
3704
+ const r = [], s = ((u = this.config) == null ? void 0 : u.customAdInterstitialInterval) || 0, a = ((l = this.config) == null ? void 0 : l.customAdInterstitialQuantity) || 1, o = ((i = this.config) == null ? void 0 : i.customAdStartQuantity) || 0, n = ((p = this.config) == null ? void 0 : p.customAdEndQuantity) || 0, c = this.searchClientResponseItems || [];
3705
+ for (let m = 0; m < o; m++)
3706
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
3707
+ c.forEach((m, b) => {
3708
+ if (s && b % s === 0 && b + s < c.length && b >= s)
3709
+ for (let v = 0; v < a; v++)
3710
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m.id}-ad-${v}` }));
3711
+ r.push(d("searchcraft-popover-list-item", { item: m, key: m.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + b }));
3712
+ });
3713
+ for (let m = 0; m < n; m++)
3714
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
3715
+ return d("div", { class: "searchcraft-popover-list-view" }, r);
3716
+ }
3717
+ renderWithNativoAds() {
3718
+ var l, i, p, m, b;
3719
+ const r = [], s = ((l = this.config) == null ? void 0 : l.nativoAdInterstialStartIndex) || 0, a = ((i = this.config) == null ? void 0 : i.nativoAdInterstitialInterval) || 0, o = ((p = this.config) == null ? void 0 : p.nativoAdInterstitialQuantity) || 1, n = ((m = this.config) == null ? void 0 : m.nativoAdStartQuantity) || 0, c = ((b = this.config) == null ? void 0 : b.nativoAdEndQuantity) || 0, u = this.searchClientResponseItems || [];
3720
+ for (let v = 0; v < n; v++)
3721
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
3722
+ u.forEach((v, x) => {
3723
+ if (a && (x + s) % a === 0 && x + a < u.length && x >= a)
3724
+ for (let U = 0; U < o; U++)
3725
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v.id}-ad-${U}` }));
3726
+ r.push(d("searchcraft-popover-list-item", { item: v, key: v.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + x }));
3727
+ });
3728
+ for (let v = 0; v < c; v++)
3729
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
3730
+ return d("div", { class: "searchcraft-popover-list-view" }, r);
3731
+ }
3732
+ renderWithNoAds() {
3733
+ var r;
3734
+ return d("div", { class: "searchcraft-popover-list-view" }, (r = this.searchClientResponseItems) == null ? void 0 : r.map((s, a) => d("searchcraft-popover-list-item", { item: s, key: s.id, popoverResultMappings: this.popoverResultMappings, documentPosition: this.searchResultsPerPage * (this.searchResultsPage - 1) + a })));
3735
+ }
3736
+ render() {
3737
+ var r;
3738
+ switch (((r = this.config) == null ? void 0 : r.adSource) || "None") {
3739
+ case "adMarketplace":
3740
+ return this.renderWithADMAds();
3741
+ case "Custom":
3742
+ return this.renderWithCustomAds();
3743
+ case "Nativo":
3744
+ return this.renderWithNativoAds();
3745
+ default:
3746
+ return this.renderWithNoAds();
3747
+ }
3748
+ }
3749
+ }, [0, "searchcraft-popover-list-view", {
3750
+ popoverResultMappings: [16],
3751
+ searchClientResponseItems: [16],
3752
+ adClientResponseItems: [16],
3753
+ searchResultsPage: [2, "search-results-page"],
3754
+ searchResultsPerPage: [2, "search-results-per-page"]
3755
+ }]);
3756
+ function la() {
3757
+ if (typeof customElements > "u")
3758
+ return;
3759
+ ["searchcraft-popover-list-view", "searchcraft-ad", "searchcraft-popover-list-item"].forEach((t) => {
3760
+ switch (t) {
3761
+ case "searchcraft-popover-list-view":
3762
+ customElements.get(t) || customElements.define(t, Pc);
3763
+ break;
3764
+ case "searchcraft-ad":
3765
+ customElements.get(t) || Et();
3766
+ break;
3767
+ case "searchcraft-popover-list-item":
3768
+ customElements.get(t) || hr();
3769
+ break;
3770
+ }
3771
+ });
3772
+ }
3773
+ const ua = /* @__PURE__ */ F(class extends L {
3774
+ constructor() {
3775
+ super();
3776
+ /**
3777
+ * The type of popover form to render.
3778
+ * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.
3779
+ * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.
3780
+ * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
3781
+ */
3782
+ h(this, "type", "inline");
3783
+ /**
3784
+ * Formats the content rendered for each result.
3785
+ */
3786
+ h(this, "popoverResultMappings");
3787
+ /**
3788
+ * The hotkey that activates the popover.
3789
+ */
3790
+ h(this, "hotkey", "k");
3791
+ /**
3792
+ * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
3793
+ */
3794
+ h(this, "hotkeyModifier", "meta");
3795
+ h(this, "isPopoverVisibleInState", !1);
3796
+ h(this, "unsubscribe");
3797
+ h(this, "searchClientResponseItems", []);
3798
+ h(this, "adClientResponseItems", []);
3799
+ h(this, "searchTerm");
3800
+ h(this, "isFocused", !1);
3801
+ h(this, "breakpointSm", 576);
3802
+ h(this, "breakpointMd", 768);
3803
+ h(this, "breakpointLg", 992);
3804
+ h(this, "searchResultsPage");
3805
+ h(this, "searchResultsPerPage");
3806
+ h(this, "modalElement");
3807
+ h(this, "handleDocumentClick", (r) => {
3808
+ this.hostElement.contains(r.target) || (this.isFocused = !1);
3809
+ });
3810
+ /**
3811
+ * Actions to perform when various keys are pressed within the popover form.
3812
+ */
3813
+ h(this, "handleDocumentKeyDown", (r) => {
3814
+ if (r.key === this.hotkey && this.handleHotkeyPressed(r), !!this.hostElement.contains(document.activeElement))
3815
+ switch (r.key) {
3816
+ case "ArrowDown":
3817
+ case "ArrowUp":
3818
+ r.preventDefault(), this.focusOnNextListItem(r.key);
3819
+ break;
3820
+ case "Escape":
3821
+ $.getState().setPopoverVisibility(!1);
3822
+ break;
3823
+ default:
3824
+ return;
3825
+ }
3826
+ });
3827
+ h(this, "handleInputInit", () => {
3828
+ const r = this.hostElement.querySelector(".searchcraft-input");
3829
+ r == null || r.focus();
3830
+ });
3831
+ this.__registerHost();
3832
+ }
3833
+ get hostElement() {
3834
+ return this;
3835
+ }
3836
+ componentDidLoad() {
3837
+ const r = getComputedStyle(document.documentElement);
3838
+ this.breakpointSm = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-sm").trim()), this.breakpointMd = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-md").trim()), this.breakpointLg = Number.parseFloat(r.getPropertyValue("--sc-breakpoint-lg").trim()), this.isPopoverVisibleInState = $.getState().isPopoverVisible, document.addEventListener("click", this.handleDocumentClick), document.addEventListener("keydown", this.handleDocumentKeyDown), this.unsubscribe = $.subscribe((s) => {
3839
+ this.isPopoverVisibleInState !== s.isPopoverVisible && this.handlePopoverVisibilityChange(s.isPopoverVisible), this.searchClientResponseItems = [...s.searchClientResponseItems], this.adClientResponseItems = [...s.adClientResponseItems], this.searchTerm = s.searchTerm, this.searchResultsPage = s.searchResultsPage, this.searchResultsPerPage = s.searchResultsPerPage;
3840
+ });
3841
+ }
3842
+ disconnectedCallback() {
3843
+ var r;
3844
+ (r = this.unsubscribe) == null || r.call(this), document.removeEventListener("click", this.handleDocumentClick), document.removeEventListener("keydown", this.handleDocumentKeyDown);
3845
+ }
3846
+ /**
3847
+ * Handles when popover visibility is changed in state
3848
+ */
3849
+ handlePopoverVisibilityChange(r) {
3850
+ this.isPopoverVisibleInState = r, document.body.style.overflow = r ? "hidden" : "auto";
3851
+ }
3852
+ /**
3853
+ * When popover is `inline` and the viewport is at the smallest breakpoint,
3854
+ * focusing on the input will open a modal version of the popover form.
3855
+ */
3856
+ handleInputFocus() {
3857
+ this.isFocused = !0, this.type === "inline" && window.visualViewport && window.visualViewport.width < this.breakpointSm && ($.getState().setPopoverVisibility(!0), this.modalElement || (this.modalElement = document.createElement("searchcraft-popover-form"), this.modalElement.popoverResultMappings = this.popoverResultMappings, this.modalElement.setAttribute("type", "fullscreen"), document.body.appendChild(this.modalElement)));
3858
+ }
3859
+ handleModalBackdropClick(r) {
3860
+ $.getState().setPopoverVisibility(!1);
3861
+ }
3862
+ /**
3863
+ * When a hotkey is pressed, tests if the modifiers also match.
3864
+ * If modifiers match, toggles visibility of the popover modal.
3865
+ */
3866
+ handleHotkeyPressed(r) {
3867
+ if (r.ctrlKey && this.hotkeyModifier === "ctrl" || r.altKey && this.hotkeyModifier === "alt" || r.metaKey && this.hotkeyModifier === "meta")
3868
+ if (r.preventDefault(), this.type === "inline" && !this.isPopoverVisibleInState) {
3869
+ const s = this.hostElement.querySelector(".searchcraft-input-form-input");
3870
+ s == null || s.focus();
3871
+ } else
3872
+ $.getState().setPopoverVisibility(!this.isPopoverVisibleInState);
3873
+ }
3874
+ handleCancelButtonClick() {
3875
+ $.getState().setPopoverVisibility(!1);
3876
+ }
3877
+ /**
3878
+ * Moves focus to the next/previous list item in the list view. If you are at the top
3879
+ * of the list view, it moves focus back to the input.
3880
+ *
3881
+ * @param direction
3882
+ */
3883
+ focusOnNextListItem(r) {
3884
+ var o, n;
3885
+ const s = Array.from(document.querySelectorAll("a.searchcraft-popover-form-list-item")).filter((c) => !c.hasAttribute("disabled") && c.offsetParent !== null), a = s.indexOf(document.activeElement);
3886
+ if (r === "ArrowDown")
3887
+ (o = s[(a + 1) % s.length]) == null || o.focus();
3888
+ else if (r === "ArrowUp")
3889
+ if (a >= 1)
3890
+ (n = s[a - 1]) == null || n.focus();
3891
+ else {
3892
+ const c = document.querySelector(".searchcraft-input-form-input");
3893
+ c && (c.focus(), requestAnimationFrame(() => {
3894
+ c.selectionEnd = c.value.length, c.selectionStart = c.value.length;
3895
+ }));
3896
+ }
3897
+ }
3898
+ get hasResultsToShow() {
3899
+ var r, s;
3900
+ return this.searchTerm && ((s = (r = this.searchTerm) == null ? void 0 : r.trim()) == null ? void 0 : s.length) > 0 && this.searchClientResponseItems.length > 0;
3901
+ }
3902
+ renderInlinePopover() {
3903
+ const r = this.hasResultsToShow && this.isFocused, s = ne("searchcraft-popover-form searchcraft-popover-form-inline", {
3904
+ "searchcraft-popover-form-active": r
3905
+ });
3906
+ return d("div", { class: s }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this) }), r && d("div", { class: "searchcraft-popover-form-inline-wrapper-outer" }, d("div", { class: "searchcraft-popover-form-inline-wrapper-inner" }, d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))));
3907
+ }
3908
+ renderModalPopover() {
3909
+ if (this.isPopoverVisibleInState) {
3910
+ const r = ne("searchcraft-popover-form", {
3911
+ "searchcraft-popover-form-active": this.hasResultsToShow
3912
+ });
3913
+ return d("div", { class: "searchcraft-popover-form-modal" }, d("div", { class: "searchcraft-popover-form-modal-backdrop", onClick: this.handleModalBackdropClick }), d("div", { class: "searchcraft-popover-form-modal-inner" }, d("div", { class: r }, d("div", { class: "searchcraft-popover-form-input-wrapper searchcraft-popover-form-modal-input-wrapper" }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), d("button", { type: "button", class: "searchcraft-popover-form-button searchcraft-popover-form-modal-button", onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage }))));
3914
+ }
3915
+ }
3916
+ renderFullscreenPopover() {
3917
+ if (this.isPopoverVisibleInState)
3918
+ return d("div", { class: "searchcraft-popover-form-fullscreen" }, d("div", { class: "searchcraft-popover-form" }, d("div", { class: "searchcraft-popover-form-input-wrapper searchcraft-popover-form-fullscreen-input-wrapper" }, d("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this) }), d("button", { type: "button", class: "searchcraft-popover-form-button searchcraft-popover-form-fullscreen-button", onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), this.hasResultsToShow && d("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage })));
3919
+ }
3920
+ render() {
3921
+ switch (this.type) {
3922
+ case "inline":
3923
+ return this.renderInlinePopover();
3924
+ case "modal":
3925
+ return this.renderModalPopover();
3926
+ case "fullscreen":
3927
+ return this.renderFullscreenPopover();
3928
+ }
3929
+ }
3930
+ }, [0, "searchcraft-popover-form", {
3931
+ type: [1],
3932
+ popoverResultMappings: [16],
3933
+ hotkey: [1],
3934
+ hotkeyModifier: [1, "hotkey-modifier"],
3935
+ isPopoverVisibleInState: [32],
3936
+ unsubscribe: [32],
3937
+ searchClientResponseItems: [32],
3938
+ adClientResponseItems: [32],
3939
+ searchTerm: [32],
3940
+ isFocused: [32],
3941
+ breakpointSm: [32],
3942
+ breakpointMd: [32],
3943
+ breakpointLg: [32],
3944
+ searchResultsPage: [32],
3945
+ searchResultsPerPage: [32],
3946
+ modalElement: [32]
3947
+ }]);
3948
+ function fa() {
3949
+ if (typeof customElements > "u")
3950
+ return;
3951
+ ["searchcraft-popover-form", "searchcraft-ad", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-form", "searchcraft-input-label", "searchcraft-popover-form", "searchcraft-popover-list-item", "searchcraft-popover-list-view"].forEach((t) => {
3952
+ switch (t) {
3953
+ case "searchcraft-popover-form":
3954
+ customElements.get(t) || customElements.define(t, ua);
3955
+ break;
3956
+ case "searchcraft-ad":
3957
+ customElements.get(t) || Et();
3958
+ break;
3959
+ case "searchcraft-button":
3960
+ customElements.get(t) || wt();
3961
+ break;
3962
+ case "searchcraft-error-message":
3963
+ customElements.get(t) || Rt();
3964
+ break;
3965
+ case "searchcraft-input-form":
3966
+ customElements.get(t) || sa();
3967
+ break;
3968
+ case "searchcraft-input-label":
3969
+ customElements.get(t) || dr();
3970
+ break;
3971
+ case "searchcraft-popover-form":
3972
+ customElements.get(t) || fa();
3973
+ break;
3974
+ case "searchcraft-popover-list-item":
3975
+ customElements.get(t) || hr();
3976
+ break;
3977
+ case "searchcraft-popover-list-view":
3978
+ customElements.get(t) || la();
3979
+ break;
3980
+ }
3981
+ });
3982
+ }
3983
+ const xc = ua, da = fa, $c = hr, _c = la, ha = /* @__PURE__ */ F(class extends L {
3984
+ constructor() {
3985
+ super();
3986
+ /**
3987
+ * A callback function responsible for rendering the results info.
3988
+ *
3989
+ * @example
3990
+ * ```ts
3991
+ * resultsInfo.template = html`
3992
+ * ${range[0]}-${range[1]} of ${count} results in ${responseTime}ms
3993
+ * `;
3994
+ * ```
3995
+ */
3996
+ h(this, "template");
3997
+ // store vars
3998
+ h(this, "searchTerm");
3999
+ h(this, "searchResultsPage");
4000
+ h(this, "searchResultsPerPage");
4001
+ h(this, "searchResultsCount");
4002
+ // local vars
4003
+ h(this, "count", 0);
4004
+ h(this, "range", [0, 0]);
4005
+ h(this, "responseTime", "0");
4006
+ h(this, "unsubscribe", () => {
4007
+ });
4008
+ this.__registerHost();
4009
+ }
4010
+ connectedCallback() {
4011
+ this.unsubscribe = $.subscribe((r) => {
4012
+ this.searchTerm = r.searchTerm, this.searchResultsPage = r.searchResultsPage, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsCount = r.searchResultsCount, this.count = this.searchResultsCount, this.range[0] = this.searchResultsPage <= 1 ? 1 : this.searchResultsPerPage * (this.searchResultsPage - 1), this.range[1] = this.searchResultsPerPage * this.searchResultsPage, this.range[1] = this.range[1] > this.searchResultsCount ? this.searchResultsCount : this.range[1], this.responseTime = ((r.searchResponseTimeTaken || 0) * 1e3).toFixed(2);
4013
+ });
4014
+ }
4015
+ disconnectedCallback() {
4016
+ this.unsubscribe && this.unsubscribe();
4017
+ }
4018
+ render() {
4019
+ return !this.searchTerm || this.searchResultsCount === 0 ? null : d("p", { class: "searchcraft-results-info" }, typeof this.template < "u" ? this.template({
4020
+ range: [Number(this.range[0]), Number(this.range[1])],
4021
+ count: this.count,
4022
+ responseTime: this.responseTime
4023
+ }, { html: fr }) : `${hc(this.count)} results found in ${this.responseTime}ms`);
4024
+ }
4025
+ }, [0, "searchcraft-results-info", {
4026
+ template: [16],
4027
+ searchTerm: [32],
4028
+ searchResultsPage: [32],
4029
+ searchResultsPerPage: [32],
4030
+ searchResultsCount: [32],
4031
+ count: [32],
4032
+ range: [32],
4033
+ responseTime: [32]
4034
+ }]);
4035
+ function Ac() {
4036
+ if (typeof customElements > "u")
4037
+ return;
4038
+ ["searchcraft-results-info"].forEach((t) => {
4039
+ switch (t) {
4040
+ case "searchcraft-results-info":
4041
+ customElements.get(t) || customElements.define(t, ha);
4042
+ break;
4043
+ }
4044
+ });
4045
+ }
4046
+ const Ic = ha, pa = Ac, Mc = /* @__PURE__ */ F(class extends L {
4047
+ constructor() {
4048
+ super();
4049
+ h(this, "item");
4050
+ /**
4051
+ * The index.
4052
+ */
4053
+ h(this, "index");
4054
+ /**
4055
+ * The position in the document. Used with the "document_clicked" measure event.
4056
+ */
4057
+ h(this, "documentPosition", 0);
4058
+ /**
4059
+ * A callback function responsible for rendering a result.
4060
+ */
4061
+ h(this, "template");
4062
+ h(this, "templateHtml");
4063
+ this.__registerHost();
4064
+ }
4065
+ connectedCallback() {
4066
+ var r;
4067
+ if (this.item)
4068
+ try {
4069
+ this.templateHtml = (r = this.template) == null ? void 0 : r.call(this, this.item.document, this.index, {
4070
+ html: fr
4071
+ });
4072
+ } catch (s) {
4073
+ console.error(`Invalid search result template: ${s}`);
4074
+ }
4075
+ }
4076
+ render() {
4077
+ if (this.item)
4078
+ return typeof this.template > "u" ? d("div", { class: "searchcraft-search-result searchcraft-search-result-no-template" }, Object.entries(this.item.document).map(([r, s]) => d("p", { key: r }, d("strong", null, r), ": ", s))) : d("div", { class: "searchcraft-search-result", innerHTML: this.templateHtml });
4079
+ }
4080
+ }, [0, "searchcraft-search-result", {
4081
+ item: [16],
4082
+ index: [2],
4083
+ documentPosition: [2, "document-position"],
4084
+ template: [16],
4085
+ templateHtml: [32]
4086
+ }]);
4087
+ function ma() {
4088
+ if (typeof customElements > "u")
4089
+ return;
4090
+ ["searchcraft-search-result"].forEach((t) => {
4091
+ switch (t) {
4092
+ case "searchcraft-search-result":
4093
+ customElements.get(t) || customElements.define(t, Mc);
4094
+ break;
4095
+ }
4096
+ });
4097
+ }
4098
+ const Oc = ma, ga = /* @__PURE__ */ F(class extends L {
4099
+ constructor() {
4100
+ super();
4101
+ /**
4102
+ * A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
4103
+ */
4104
+ h(this, "template");
4105
+ h(this, "searchTerm", "");
4106
+ h(this, "searchClientResponseItems");
4107
+ h(this, "adClientResponseItems", []);
4108
+ h(this, "searchResultsPerPage");
4109
+ h(this, "searchResultsPage");
4110
+ h(this, "isSearchInProgress", !0);
4111
+ h(this, "config");
4112
+ h(this, "unsubscribe", () => {
4113
+ });
4114
+ this.__registerHost();
4115
+ }
4116
+ componentDidLoad() {
4117
+ var s;
4118
+ this.unsubscribe = $.subscribe((a) => this.handleStateChange(a));
4119
+ const r = $.getState();
4120
+ this.handleStateChange(r), this.searchClientResponseItems = r.searchClientResponseItems, this.searchTerm = r.searchTerm, this.config = (s = r.core) == null ? void 0 : s.config;
4121
+ }
4122
+ disconnectedCallback() {
4123
+ var r;
4124
+ (r = this.unsubscribe) == null || r.call(this);
4125
+ }
4126
+ handleStateChange(r) {
4127
+ var s;
4128
+ this.searchClientResponseItems = [...r.searchClientResponseItems], this.adClientResponseItems = [...r.adClientResponseItems], this.searchTerm = r.searchTerm, this.searchResultsPage = r.searchResultsPage, this.searchResultsPerPage = r.searchResultsPerPage, this.config = (s = r.core) == null ? void 0 : s.config, this.isSearchInProgress = r.isSearchInProgress;
4129
+ }
4130
+ renderEmptyState() {
4131
+ return d("div", { class: "searchcraft-search-results-empty-state" }, d("slot", { name: "empty-search" }));
4132
+ }
4133
+ renderNoResultsFoundState() {
4134
+ return d("div", { class: "searchcraft-search-results" }, d("div", { class: "searchcraft-search-results-error-message" }, d("searchcraft-error-message", null, 'No search results found for "', this.searchTerm, '" query.')));
4135
+ }
4136
+ renderWithADMAds() {
4137
+ var r, s;
4138
+ return d("div", { class: "searchcraft-search-results" }, (r = this.adClientResponseItems) == null ? void 0 : r.map((a) => d("searchcraft-ad", { adSource: "adMarketplace", adClientResponseItem: a, adContainerId: X(), key: a.id })), (s = this.searchClientResponseItems) == null ? void 0 : s.map((a, o) => d("searchcraft-search-result", { key: a.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + o, index: o, item: a, template: this.template })));
4139
+ }
4140
+ renderWithCustomAds() {
4141
+ var u, l, i, p;
4142
+ const r = [], s = ((u = this.config) == null ? void 0 : u.customAdInterstitialInterval) || 0, a = ((l = this.config) == null ? void 0 : l.customAdInterstitialQuantity) || 1, o = ((i = this.config) == null ? void 0 : i.customAdStartQuantity) || 0, n = ((p = this.config) == null ? void 0 : p.customAdEndQuantity) || 0, c = this.searchClientResponseItems || [];
4143
+ for (let m = 0; m < o; m++)
4144
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
4145
+ c.forEach((m, b) => {
4146
+ if (s && b % s === 0 && b + s < c.length && b >= s)
4147
+ for (let v = 0; v < a; v++)
4148
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m.id}-ad-${v}` }));
4149
+ r.push(d("searchcraft-search-result", { key: m.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + b, index: b, item: m, template: this.template }));
4150
+ });
4151
+ for (let m = 0; m < n; m++)
4152
+ r.push(d("searchcraft-ad", { adSource: "Custom", adContainerId: X(), key: `${m}-ad` }));
4153
+ return d("div", { class: "searchcraft-search-results" }, r);
4154
+ }
4155
+ renderWithNativoAds() {
4156
+ var l, i, p, m, b;
4157
+ const r = [], s = ((l = this.config) == null ? void 0 : l.nativoAdInterstialStartIndex) || 0, a = ((i = this.config) == null ? void 0 : i.nativoAdInterstitialInterval) || 0, o = ((p = this.config) == null ? void 0 : p.nativoAdInterstitialQuantity) || 1, n = ((m = this.config) == null ? void 0 : m.nativoAdStartQuantity) || 0, c = ((b = this.config) == null ? void 0 : b.nativoAdEndQuantity) || 0, u = this.searchClientResponseItems || [];
4158
+ for (let v = 0; v < n; v++)
4159
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
4160
+ u.forEach((v, x) => {
4161
+ if (a && (x + s) % a === 0 && x + a < u.length && x >= a)
4162
+ for (let U = 0; U < o; U++)
4163
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v.id}-ad-${U}` }));
4164
+ r.push(d("searchcraft-search-result", { key: v.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + x, index: x, item: v, template: this.template }));
4165
+ });
4166
+ for (let v = 0; v < c; v++)
4167
+ r.push(d("searchcraft-ad", { adSource: "Nativo", adContainerId: X(), key: `${v}-ad` }));
4168
+ return d("div", { class: "searchcraft-search-results" }, r);
4169
+ }
4170
+ renderWithNoAds() {
4171
+ var r;
4172
+ return d("div", { class: "searchcraft-search-results" }, (r = this.searchClientResponseItems) == null ? void 0 : r.map((s, a) => d("searchcraft-search-result", { key: s.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + a, index: a, item: s, template: this.template })));
4173
+ }
4174
+ render() {
4175
+ var r;
4176
+ if (this.searchTerm.trim() === "")
4177
+ return this.renderEmptyState();
4178
+ if (this.searchTerm.length > 0 && (this.searchClientResponseItems || []).length === 0 && !this.isSearchInProgress)
4179
+ return this.renderNoResultsFoundState();
4180
+ switch (((r = this.config) == null ? void 0 : r.adSource) || "None") {
4181
+ case "adMarketplace":
4182
+ return this.renderWithADMAds();
4183
+ case "Custom":
4184
+ return this.renderWithCustomAds();
4185
+ case "Nativo":
4186
+ return this.renderWithNativoAds();
4187
+ default:
4188
+ return this.renderWithNoAds();
4189
+ }
4190
+ }
4191
+ }, [4, "searchcraft-search-results", {
4192
+ template: [16],
4193
+ searchTerm: [32],
4194
+ searchClientResponseItems: [32],
4195
+ adClientResponseItems: [32],
4196
+ searchResultsPerPage: [32],
4197
+ searchResultsPage: [32],
4198
+ isSearchInProgress: [32],
4199
+ config: [32]
4200
+ }]);
4201
+ function Lc() {
4202
+ if (typeof customElements > "u")
4203
+ return;
4204
+ ["searchcraft-search-results", "searchcraft-ad", "searchcraft-error-message", "searchcraft-search-result"].forEach((t) => {
4205
+ switch (t) {
4206
+ case "searchcraft-search-results":
4207
+ customElements.get(t) || customElements.define(t, ga);
4208
+ break;
4209
+ case "searchcraft-ad":
4210
+ customElements.get(t) || Et();
4211
+ break;
4212
+ case "searchcraft-error-message":
4213
+ customElements.get(t) || Rt();
4214
+ break;
4215
+ case "searchcraft-search-result":
4216
+ customElements.get(t) || ma();
4217
+ break;
4218
+ }
4219
+ });
4220
+ }
4221
+ const Fc = ga, va = Lc, Dc = /* @__PURE__ */ F(class extends L {
4222
+ constructor() {
4223
+ super();
4224
+ /**
4225
+ * The caption displayed below the select input.
4226
+ */
4227
+ h(this, "caption");
4228
+ /**
4229
+ * Whether the select input is disabled.
4230
+ */
4231
+ h(this, "disabled", !1);
4232
+ /**
4233
+ * The ID for the select input.
4234
+ */
4235
+ h(this, "inputId");
4236
+ /**
4237
+ * The label of the select input.
4238
+ */
4239
+ h(this, "label");
4240
+ /**
4241
+ * The ID for the label of the select input.
4242
+ */
4243
+ h(this, "labelId");
4244
+ /**
4245
+ * The name of the select input.
4246
+ */
4247
+ h(this, "name");
4248
+ /**
4249
+ * The options for the select input.
4250
+ */
4251
+ h(this, "options", []);
4252
+ /**
4253
+ * The event fired when the select is changed.
4254
+ */
4255
+ h(this, "selectChange");
4256
+ h(this, "searchResultsPerPage");
4257
+ h(this, "setSearchResultsPage", () => {
4258
+ });
4259
+ h(this, "setSearchResultsPerPage", () => {
4260
+ });
4261
+ h(this, "handleSelectChange", (r) => {
4262
+ this.selectChange.emit(r.target.value);
4263
+ });
4264
+ this.__registerHost(), this.selectChange = be(this, "selectChange");
4265
+ }
4266
+ handleGoToPage(r) {
4267
+ this.setSearchResultsPage(r);
4268
+ }
4269
+ render() {
4270
+ return d("div", { key: "15ecbf48c824a161cd83bdab99dace8e44f1ab39", class: "searchcraft-select" }, this.label && d("label", { key: "aba433ae9c27c9405099cffcef923c3ad22d7fda", class: "searchcraft-select-label", id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label), d("div", { key: "8df8a2ff05924c9c55cdd6e3827cd927cddab82a", class: "searchcraft-select-input-wrapper" }, d("select", { key: "1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f", "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : void 0, class: "searchcraft-select-input", disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options == "string" ? JSON.parse(this.options) : this.options).map(({ label: r, value: s, selected: a }) => d("option", { key: s, value: s, selected: a }, r))), d("svg", { key: "0ec6892b529f2e70027aadea47208582a65a97b7", class: "searchcraft-select-input-icon", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, d("title", { key: "bced6b62378491d1d1c629b602d7d033d912c761" }, "Select dropdown icon"), d("path", { key: "659f8ebf9129e2e7941da949d29688c41c1472bb", d: "M5 7.5L10 12.5L15 7.5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.caption && d("p", { key: "51217d926f68f79b6c3514f5fd769b56549fdce9", class: "searchcraft-select-caption" }, this.caption));
4271
+ }
4272
+ }, [0, "searchcraft-select", {
4273
+ caption: [1],
4274
+ disabled: [4],
4275
+ inputId: [1, "input-id"],
4276
+ label: [1],
4277
+ labelId: [1, "label-id"],
4278
+ name: [1],
4279
+ options: [1],
4280
+ searchResultsPerPage: [32],
4281
+ setSearchResultsPage: [32],
4282
+ setSearchResultsPerPage: [32]
4283
+ }]);
4284
+ function ba() {
4285
+ if (typeof customElements > "u")
4286
+ return;
4287
+ ["searchcraft-select"].forEach((t) => {
4288
+ switch (t) {
4289
+ case "searchcraft-select":
4290
+ customElements.get(t) || customElements.define(t, Dc);
4291
+ break;
4292
+ }
4293
+ });
4294
+ }
4295
+ const ya = /* @__PURE__ */ F(class extends L {
4296
+ constructor() {
4297
+ super();
4298
+ /**
4299
+ * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
4300
+ * The base value is defined by the `searchResultsPerPage` option in the configuration.
4301
+ */
4302
+ h(this, "increment", 20);
4303
+ // store vars
4304
+ h(this, "searchTerm");
4305
+ h(this, "searchResultsPage");
4306
+ h(this, "searchResultsPerPage");
4307
+ h(this, "searchResultsCount");
4308
+ h(this, "searchResultsPagesCount");
4309
+ // local vars
4310
+ h(this, "initialSearchResultsPerPage");
4311
+ // store functions
4312
+ h(this, "setSearchResultsPerPage", () => {
4313
+ });
4314
+ h(this, "setSearchResultsPage", () => {
4315
+ });
4316
+ h(this, "unsubscribe", () => {
4317
+ });
4318
+ this.__registerHost();
4319
+ }
4320
+ componentDidLoad() {
4321
+ this.unsubscribe = $.subscribe((r) => {
4322
+ this.searchTerm = r.searchTerm, this.searchResultsPerPage = r.searchResultsPerPage, this.searchResultsPage = r.searchResultsPage, this.searchResultsCount = r.searchResultsCount, this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage), this.setSearchResultsPage = r.setSearchResultsPage, this.setSearchResultsPerPage = r.setSearchResultsPerPage;
4323
+ }), this.initialSearchResultsPerPage = $.getState().searchResultsPerPage;
4324
+ }
4325
+ disconnectedCallback() {
4326
+ var r;
4327
+ (r = this.unsubscribe) == null || r.call(this);
4328
+ }
4329
+ render() {
4330
+ if (!(!this.searchTerm || this.searchResultsPagesCount <= 1))
4331
+ return d("div", { class: "searchcraft-search-results-per-page" }, d("div", { class: "searchcraft-search-results-per-page-select" }, d("label", { class: "searchcraft-search-results-per-page-select-label", htmlFor: "searchcraft-search-results-per-page-select-input" }, "Results Per Page"), d("div", { class: "searchcraft-search-results-per-page-select-input" }, d("searchcraft-select", { inputId: "searchcraft-search-results-per-page-select-input", name: "results-per-page", options: [...Array(5)].map((r, s) => {
4332
+ const a = this.initialSearchResultsPerPage + Number(this.increment) * s;
4333
+ return {
4334
+ label: `${a}`,
4335
+ value: a
4336
+ };
4337
+ }), onSelectChange: (r) => {
4338
+ this.setSearchResultsPerPage(Number(r.detail)), this.setSearchResultsPage(1);
4339
+ } }))));
4340
+ }
4341
+ }, [0, "searchcraft-search-results-per-page", {
4342
+ increment: [8],
4343
+ searchTerm: [32],
4344
+ searchResultsPage: [32],
4345
+ searchResultsPerPage: [32],
4346
+ searchResultsCount: [32],
4347
+ searchResultsPagesCount: [32],
4348
+ initialSearchResultsPerPage: [32],
4349
+ setSearchResultsPerPage: [32],
4350
+ setSearchResultsPage: [32]
4351
+ }]);
4352
+ function Nc() {
4353
+ if (typeof customElements > "u")
4354
+ return;
4355
+ ["searchcraft-search-results-per-page", "searchcraft-select"].forEach((t) => {
4356
+ switch (t) {
4357
+ case "searchcraft-search-results-per-page":
4358
+ customElements.get(t) || customElements.define(t, ya);
4359
+ break;
4360
+ case "searchcraft-select":
4361
+ customElements.get(t) || ba();
4362
+ break;
4363
+ }
4364
+ });
4365
+ }
4366
+ const Uc = ya, Sa = Nc, zc = ba, Hc = Zs, jc = `:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var(--sc-color-background-hover, #fafafa);--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, #f7f7f7 );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-secondary-hover, var(--sc-color-background-hover, #e6e6e6) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var(--sc-color-foreground-secondary, #404040);--sc-border-neutral: rgba(0, 0, 0, 0.1);--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var(--sc-color-brand-hover, #2e2e2e);--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var(--sc-color-brand-active, #292929);--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-surface-brand-secondary-hover: var( --sc-color-brand-secondary-hover, var(--sc-color-brand-hover, #ebebeb) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30);--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, #009900 );--sc-color-success-primary-active: hsl(from var(--sc-color-success) h s 20);--sc-surface-success-primary-active: var( --sc-color-success-primary-active, #006600 );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90);--sc-surface-success-secondary: var(--sc-color-success-secondary, #ccffcc);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, #e6ffe6 );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, #b2ffb2 );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30);--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, #e57300 );--sc-color-caution-primary-active: hsl(from var(--sc-color-caution) h s 20);--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, #b25a00 );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90);--sc-surface-caution-secondary: var(--sc-color-caution-secondary, #ffd9b3);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, #ffe5cc );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, #ffcc99 );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30);--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, #e50000 );--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20);--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, #b30000 );--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var(--sc-color-danger-secondary, #ffcccc);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, #ffe7e7 );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, #ffb3b3 );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover: hsl(from var(--sc-color-success) h s 30%);--sc-color-success-primary-active: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary: hsl(from var(--sc-color-success) h s 90%);--sc-color-success-secondary-hover: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover: hsl(from var(--sc-color-caution) h s 30%);--sc-color-caution-primary-active: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary: hsl(from var(--sc-color-caution) h s 90%);--sc-color-caution-secondary-hover: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover: hsl(from var(--sc-color-danger) h s 30%);--sc-color-danger-primary-active: hsl(from var(--sc-color-danger) h s 20%);--sc-color-danger-secondary: hsl(from var(--sc-color-danger) h s 90%);--sc-color-danger-secondary-hover: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-custom-ad{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-adm-ad{all:unset;border:2px solid blue;border-radius:var(--sc-border-radius);cursor:pointer;display:flex;flex-direction:row;gap:8px;padding:var(--sc-popover-list-item-padding-vertical) var(--sc-popover-list-item-padding-horizontal)}.searchcraft-adm-ad:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-adm-ad-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:inherit;margin:0}.searchcraft-adm-ad-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:inherit;margin:0}.searchcraft-adm-ad-image-wrapper{align-items:center;display:flex;flex-shrink:0;height:var(--sc-popover-list-item-image-size);justify-content:center;width:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-image{max-height:var(--sc-popover-list-item-image-size);max-width:var(--sc-popover-list-item-image-size)}.searchcraft-adm-ad-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-search-result{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-brand);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius-sm);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:block}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:block}.searchcraft-facet-list-child-checkbox-label{margin-left:24px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:8px;position:absolute;top:9px;width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:9px;position:absolute;top:3px;width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-disabled);text-align:center}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px;--sc-input-form-padding-left: 44px;--sc-input-form-padding-right: 44px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px var(--sc-input-form-padding-left)}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input-form-input:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:var(--sc-input-form-padding-left)}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:var(--sc-input-form-padding-right)}.searchcraft-input-form-clear-button-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-form-border-radius: var(--sc-border-radius);--sc-popover-list-view-height: 400px;--sc-popover-list-item-image-size: 60px;--sc-popover-list-item-padding-horizontal: 8px;--sc-popover-list-item-padding-vertical: 8px;--sc-popover-modal-max-width: 570px}.searchcraft-popover-form{display:flex;flex:1;flex-direction:column}.searchcraft-popover-form-input-wrapper{background-color:var(--sc-surface-neutral-secondary);display:flex;flex-direction:row;gap:4px;padding:12px}.searchcraft-popover-form-input-wrapper>searchcraft-input-form{flex:1}.searchcraft-popover-form-button{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);border:0;border-radius:var(--sc-popover-form-border-radius);background:none;cursor:pointer;flex-shrink:0;outline:0;padding:0 12px}.searchcraft-popover-form-button:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-popover-form-button:focus{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-popover-form-inline .searchcraft-input-form-input{border-top-left-radius:var(--sc-popover-form-border-radius);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius);border:none;outline:none}.searchcraft-popover-form-inline.searchcraft-popover-form-active .searchcraft-input-form-input{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--sc-popover-form-border-radius);border-top-right-radius:var(--sc-popover-form-border-radius)}.searchcraft-popover-form-inline-wrapper-outer{position:relative}.searchcraft-popover-form-inline-wrapper-inner{height:var(--sc-popover-list-view-height);position:absolute;width:100%;z-index:1000}.searchcraft-popover-form-inline .searchcraft-popover-list-view{background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:var(--sc-popover-form-border-radius);border-bottom-right-radius:var(--sc-popover-form-border-radius);display:flex;flex-direction:column;max-height:var(--sc-popover-list-view-height);overflow:auto}.searchcraft-popover-form-modal{--sc-popover0-form-border-radius: var(--sc-border-radius-lg);align-items:flex-start;background-color:var(--sc-surface-neutral-secondary);display:flex;inset:0;justify-content:center;padding:0;position:fixed;z-index:1000}@media(min-width: 576px){.searchcraft-popover-form-modal{background-color:rgba(0,0,0,0);padding:16px}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{background-color:var(--sc-surface-neutral-secondary);border-bottom-left-radius:0;border-bottom-right-radius:0;display:flex;flex-direction:column;overflow:auto}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{max-height:var(--sc-popover-list-view-height)}}.searchcraft-popover-form-modal .searchcraft-popover-list-view{overflow:scroll}@media(min-width: 576px){.searchcraft-popover-form-modal .searchcraft-popover-list-view{overflow:auto}}.searchcraft-popover-form-modal{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-modal-backdrop{background-color:rgba(0,0,0,.5);display:none;inset:0;position:absolute}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-inner{border-radius:var(--sc-popover-form-border-radius);display:flex;inset:0;margin-top:0px;overflow:hidden;position:absolute;z-index:1002}@media(min-width: 576px){.searchcraft-popover-form-modal-inner{inset:auto;margin-top:100px;max-width:var(--sc-popover-modal-max-width);position:relative;width:100%}}.searchcraft-popover-form-modal-input-wrapper .searchcraft-input-form-input{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px);border:1px solid var(--sc-border-neutral)}.searchcraft-popover-form-modal-button{border-radius:calc(--sc-popover-form-border-radius - 12px);border-radius:calc(var(--sc-popover-form-border-radius) - 12px)}.searchcraft-popover-form-fullscreen{position:fixed;inset:0;z-index:1000;background-color:var(--sc-surface-neutral-secondary)}.searchcraft-popover-form-fullscreen .searchcraft-popover-form{position:absolute;inset:0}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-view{overflow:scroll}.searchcraft-popover-form-fullscreen-input-wrapper .searchcraft-input-form-input{border-radius:var(--sc-popover-form-border-radius);outline-width:1px;outline-color:var(--sc-border-neutral)}.searchcraft-popover-form-fullscreen-button{border-radius:var(--sc-popover-form-border-radius)}.searchcraft-popover-list-item{all:unset;color:var(--sc-content-neutral-secondary);display:flex;flex-direction:row;cursor:pointer;gap:8px;padding-right:var(--sc-popover-list-item-padding-horizontal);padding-left:var(--sc-popover-list-item-padding-horizontal);padding-top:var(--sc-popover-list-item-padding-vertical);padding-bottom:var(--sc-popover-list-item-padding-vertical)}.searchcraft-popover-list-item:focus{background-color:var(--sc-surface-neutral-secondary-active);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item:hover{background-color:var(--sc-surface-neutral-secondary-hover);color:var(--sc-content-neutral-secondary)}.searchcraft-popover-list-item-title{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-subtitle{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);margin:0;color:inherit}.searchcraft-popover-list-item-image-wrapper{width:var(--sc-popover-list-item-image-size);height:var(--sc-popover-list-item-image-size);display:flex;align-items:center;justify-content:center;flex-shrink:0}.searchcraft-popover-list-item-image{max-width:var(--sc-popover-list-item-image-size);max-height:var(--sc-popover-list-item-image-size)}.searchcraft-popover-list-item-info-wrapper{display:flex;flex-direction:column;gap:8px;justify-content:center}.searchcraft-results-info{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:"Source Sans Pro",sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);font-weight:var(--sc-font-normal);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size)}.searchcraft-search-results-per-page-select-input{min-width:120px}/*# sourceMappingURL=hologram.css.map */
4367
+ `, Ea = /* @__PURE__ */ F(class extends L {
4368
+ constructor() {
4369
+ super(), this.__registerHost();
4370
+ }
4371
+ render() {
4372
+ return d("style", { key: "59491f4345817c2917f7158ae92f199281fb511b" }, jc);
4373
+ }
4374
+ }, [0, "searchcraft-theme"]);
4375
+ function Bc() {
4376
+ if (typeof customElements > "u")
4377
+ return;
4378
+ ["searchcraft-theme"].forEach((t) => {
4379
+ switch (t) {
4380
+ case "searchcraft-theme":
4381
+ customElements.get(t) || customElements.define(t, Ea);
4382
+ break;
4383
+ }
4384
+ });
4385
+ }
4386
+ const Wc = Ea, wa = Bc, Gc = Js, Vc = () => {
4387
+ rc(), ac(), oc(), dc(), ta(), aa(), Ec(), oa(), ia(), da(), $c(), _c(), pa(), Oc(), Sa(), va(), zc(), Hc(), wa(), Gc();
4388
+ };
4389
+ globalThis.__scDefineCustomElements__ = Vc;
4390
+ const qc = "@searchcraft/react-sdk", Yc = "Searchcraft Inc.", Qc = "0.10.0", Kc = "Searchcraft React SDK.", Xc = "module", Zc = "Apache-2.0", Jc = ["searchcraft"], ei = { build: "rm -rf dist && vite build --config vite.client.config.ts && vite build --config vite.server.config.ts", docs: "typedoc --options typedoc.json", lint: "biome format lint ./src", test: "vitest --watch=false", "test:watch": "vitest" }, ti = { type: "git", url: "https://bitbucket.org/madebychalk/searchcraft-javascript-sdks/" }, ri = { node: ">=18.0.0", npm: ">=10.0.0" }, si = "dist/client/index.js", ai = "dist/client/index.js", ni = "dist/client/index.d.ts", oi = ["dist/**/*"], ci = { ".": { import: "./dist/client/index.js", types: "./dist/client/index.d.ts" }, "./server": { import: "./dist/server/index.js", types: "./dist/server/index.d.ts" } }, ii = { "@searchcraft/javascript-sdk": "^0.10.0", classnames: "^2.3.2" }, li = { react: ">=18.0.0 <19.1.0", "react-dom": ">=18.0.0 <19.1.0" }, ui = { "@biomejs/biome": "^1.8.1", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.2.1", "@types/node": "^20.11.25", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", jsdom: "^24.0.0", react: "^18.3.1", "react-dom": "^18.3.1", sass: "^1.56.1" }, gs = {
4391
+ name: qc,
4392
+ private: !1,
4393
+ author: Yc,
4394
+ version: Qc,
4395
+ description: Kc,
4396
+ type: Xc,
4397
+ license: Zc,
4398
+ keywords: Jc,
4399
+ scripts: ei,
4400
+ repository: ti,
4401
+ engines: ri,
4402
+ main: si,
4403
+ module: ai,
4404
+ types: ni,
4405
+ files: oi,
4406
+ exports: ci,
4407
+ dependencies: ii,
4408
+ peerDependencies: li,
4409
+ devDependencies: ui
4410
+ };
4411
+ /**
4412
+ * @license
4413
+ * Copyright 2018 Google LLC
4414
+ * SPDX-License-Identifier: BSD-3-Clause
4415
+ */
4416
+ const fi = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), vs = /* @__PURE__ */ new WeakMap(), bs = (e, t, r, s, a) => {
4417
+ const o = a == null ? void 0 : a[t];
4418
+ o === void 0 ? (e[t] = r, r == null && t in HTMLElement.prototype && e.removeAttribute(t)) : r !== s && ((n, c, u) => {
4419
+ let l = vs.get(n);
4420
+ l === void 0 && vs.set(n, l = /* @__PURE__ */ new Map());
4421
+ let i = l.get(c);
4422
+ u !== void 0 ? i === void 0 ? (l.set(c, i = { handleEvent: u }), n.addEventListener(c, i)) : i.handleEvent = u : i !== void 0 && (l.delete(c), n.removeEventListener(c, i));
4423
+ })(e, o, r);
4424
+ }, di = ({ react: e, tagName: t, elementClass: r, events: s, displayName: a }) => {
4425
+ const o = new Set(Object.keys(s ?? {})), n = e.forwardRef((c, u) => {
4426
+ const l = e.useRef(/* @__PURE__ */ new Map()), i = e.useRef(null), p = {}, m = {};
4427
+ for (const [b, v] of Object.entries(c)) fi.has(b) ? p[b === "className" ? "class" : b] = v : o.has(b) || b in r.prototype ? m[b] = v : p[b] = v;
4428
+ return e.useLayoutEffect(() => {
4429
+ if (i.current === null) return;
4430
+ const b = /* @__PURE__ */ new Map();
4431
+ for (const v in m) bs(i.current, v, c[v], l.current.get(v), s), l.current.delete(v), b.set(v, c[v]);
4432
+ for (const [v, x] of l.current) bs(i.current, v, void 0, x, s);
4433
+ l.current = b;
4434
+ }), e.useLayoutEffect(() => {
4435
+ var b;
4436
+ (b = i.current) == null || b.removeAttribute("defer-hydration");
4437
+ }, []), p.suppressHydrationWarning = !0, e.createElement(t, { ...p, ref: e.useCallback((b) => {
4438
+ i.current = b, typeof u == "function" ? u(b) : u !== null && (u.current = b);
4439
+ }, [u]) });
4440
+ });
4441
+ return n.displayName = a ?? r.name, n;
4442
+ }, ve = ({
4443
+ defineCustomElement: e,
4444
+ ...t
4445
+ }) => (typeof e < "u" && e(), di(t)), hi = /* @__PURE__ */ ve({
4446
+ tagName: "searchcraft-filter-panel",
4447
+ elementClass: bc,
4448
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4449
+ react: ge,
4450
+ events: {},
4451
+ defineCustomElement: ta
4452
+ }), pi = /* @__PURE__ */ ve({
4453
+ tagName: "searchcraft-input-form",
4454
+ elementClass: Sc,
4455
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4456
+ react: ge,
4457
+ events: {
4458
+ onInputFocus: "inputFocus",
4459
+ onInputBlur: "inputBlur",
4460
+ onInputInit: "inputInit"
4461
+ },
4462
+ defineCustomElement: aa
4463
+ }), mi = /* @__PURE__ */ ve({
4464
+ tagName: "searchcraft-pagination",
4465
+ elementClass: Rc,
4466
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4467
+ react: ge,
4468
+ events: {},
4469
+ defineCustomElement: oa
4470
+ }), gi = /* @__PURE__ */ ve({
4471
+ tagName: "searchcraft-popover-button",
4472
+ elementClass: kc,
4473
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4474
+ react: ge,
4475
+ events: {},
4476
+ defineCustomElement: ia
4477
+ }), vi = /* @__PURE__ */ ve({
4478
+ tagName: "searchcraft-popover-form",
4479
+ elementClass: xc,
4480
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4481
+ react: ge,
4482
+ events: {},
4483
+ defineCustomElement: da
4484
+ }), bi = /* @__PURE__ */ ve({
4485
+ tagName: "searchcraft-results-info",
4486
+ elementClass: Ic,
4487
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4488
+ react: ge,
4489
+ events: {},
4490
+ defineCustomElement: pa
4491
+ }), yi = /* @__PURE__ */ ve({
4492
+ tagName: "searchcraft-search-results",
4493
+ elementClass: Fc,
4494
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4495
+ react: ge,
4496
+ events: {},
4497
+ defineCustomElement: va
4498
+ }), Si = /* @__PURE__ */ ve({
4499
+ tagName: "searchcraft-search-results-per-page",
4500
+ elementClass: Uc,
4501
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4502
+ react: ge,
4503
+ events: {},
4504
+ defineCustomElement: Sa
4505
+ }), Ei = /* @__PURE__ */ ve({
4506
+ tagName: "searchcraft-theme",
4507
+ elementClass: Wc,
4508
+ // @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
4509
+ react: ge,
4510
+ events: {},
4511
+ defineCustomElement: wa
4512
+ }), Gi = (e) => /* @__PURE__ */ me(hi, { ...e }), Vi = (e) => /* @__PURE__ */ me(pi, { ...e }), qi = (e) => /* @__PURE__ */ me(gi, { ...e }), Yi = (e) => /* @__PURE__ */ me(vi, { ...e }), Qi = (e) => /* @__PURE__ */ me(bi, { ...e }), Ki = (e) => /* @__PURE__ */ me(Ei, { ...e }), Xi = (e) => /* @__PURE__ */ me(mi, { ...e }), Zi = (e) => /* @__PURE__ */ me(Si, { ...e }), Ji = (e) => /* @__PURE__ */ me(yi, { ...e });
4513
+ class el extends Ao {
4514
+ constructor(t) {
4515
+ super(t, {
4516
+ sdkName: gs.name,
4517
+ sdkVersion: gs.version
4518
+ });
4519
+ }
4520
+ }
4521
+ export {
4522
+ el as Searchcraft,
4523
+ Gi as SearchcraftFilterPanel,
4524
+ Vi as SearchcraftInputForm,
4525
+ Xi as SearchcraftPagination,
4526
+ qi as SearchcraftPopoverButton,
4527
+ Yi as SearchcraftPopoverForm,
4528
+ Qi as SearchcraftResultsInfo,
4529
+ Ji as SearchcraftSearchResults,
4530
+ Zi as SearchcraftSearchResultsPerPage,
4531
+ Ki as SearchcraftTheme,
4532
+ Vc as defineCustomElements
4533
+ };
4534
+ //# sourceMappingURL=index.js.map