titaned-frontend-library 1.0.1

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/MEILISEARCH_INTEGRATION.md +261 -0
  3. package/README.md +236 -0
  4. package/SEARCH_INTEGRATION_README.md +208 -0
  5. package/dist/App.d.ts +3 -0
  6. package/dist/components/ButtonComponent.scss +3 -0
  7. package/dist/components/Footer.scss +87 -0
  8. package/dist/components/MainHeader.scss +915 -0
  9. package/dist/components/Sidebar.scss +170 -0
  10. package/dist/components/UserMenu.scss +0 -0
  11. package/dist/components/common/Button/ButtonComponent.d.ts +4 -0
  12. package/dist/components/common/Footer/Footer.d.ts +4 -0
  13. package/dist/components/common/Header/MainHeader.d.ts +4 -0
  14. package/dist/components/common/Header/SimpleSearchContext.d.ts +36 -0
  15. package/dist/components/common/NavDropdownMenu/NavDropdownMenu.d.ts +11 -0
  16. package/dist/components/common/SearchHighlight.d.ts +11 -0
  17. package/dist/components/common/SearchResultItem.d.ts +12 -0
  18. package/dist/components/common/Sidebar/Sidebar.d.ts +12 -0
  19. package/dist/components/common/UserMenu/UserMenu.d.ts +15 -0
  20. package/dist/components/common/menu/MenuComponent.d.ts +4 -0
  21. package/dist/contexts/SidebarContext.d.ts +6 -0
  22. package/dist/examples/MeiliSearchUsageExample.d.ts +3 -0
  23. package/dist/hooks/useIsMobileSize.d.ts +2 -0
  24. package/dist/hooks/useSidebar.d.ts +1 -0
  25. package/dist/index.cjs +27 -0
  26. package/dist/index.css +1 -0
  27. package/dist/index.d.ts +8 -0
  28. package/dist/index.js +1867 -0
  29. package/dist/interfaces/components.d.ts +181 -0
  30. package/dist/main.d.ts +0 -0
  31. package/dist/providers/SidebarProvider.d.ts +4 -0
  32. package/dist/services/meiliSearchService.d.ts +47 -0
  33. package/dist/utils/searchNavigation.d.ts +43 -0
  34. package/dist/vite.svg +1 -0
  35. package/eslint.config.js +28 -0
  36. package/index.html +13 -0
  37. package/next.config.ts +35 -0
  38. package/package.json +53 -0
  39. package/public/vite.svg +1 -0
  40. package/src/@edx-frontend-platform-i18n.d.ts +1 -0
  41. package/src/App.css +66 -0
  42. package/src/App.tsx +54 -0
  43. package/src/assets/react.svg +1 -0
  44. package/src/components/common/Button/ButtonComponent.scss +3 -0
  45. package/src/components/common/Button/ButtonComponent.tsx +34 -0
  46. package/src/components/common/Footer/Footer.scss +87 -0
  47. package/src/components/common/Footer/Footer.tsx +53 -0
  48. package/src/components/common/Header/MainHeader.scss +915 -0
  49. package/src/components/common/Header/MainHeader.tsx +701 -0
  50. package/src/components/common/Header/SimpleSearchContext.tsx +194 -0
  51. package/src/components/common/NavDropdownMenu/NavDropdownMenu.tsx +58 -0
  52. package/src/components/common/SearchHighlight.tsx +64 -0
  53. package/src/components/common/SearchResultItem.tsx +162 -0
  54. package/src/components/common/Sidebar/Sidebar.scss +170 -0
  55. package/src/components/common/Sidebar/Sidebar.tsx +137 -0
  56. package/src/components/common/UserMenu/UserMenu.scss +0 -0
  57. package/src/components/common/UserMenu/UserMenu.tsx +73 -0
  58. package/src/components/common/menu/MenuComponent.module.css +12 -0
  59. package/src/components/common/menu/MenuComponent.tsx +37 -0
  60. package/src/contexts/SidebarContext.tsx +9 -0
  61. package/src/declarations.d.ts +10 -0
  62. package/src/examples/MeiliSearchUsageExample.tsx +102 -0
  63. package/src/hooks/useIsMobileSize.ts +19 -0
  64. package/src/hooks/useSidebar.ts +10 -0
  65. package/src/index.css +68 -0
  66. package/src/index.ts +21 -0
  67. package/src/interfaces/components.ts +172 -0
  68. package/src/main.tsx +11 -0
  69. package/src/providers/SidebarProvider.tsx +20 -0
  70. package/src/services/meiliSearchService.ts +233 -0
  71. package/src/styles/global-overrides.scss +1131 -0
  72. package/src/utils/searchNavigation.ts +140 -0
  73. package/src/vite-env.d.ts +1 -0
  74. package/tsconfig.app.json +26 -0
  75. package/tsconfig.json +17 -0
  76. package/tsconfig.node.json +24 -0
  77. package/vite.config.ts +34 -0
package/dist/index.js ADDED
@@ -0,0 +1,1867 @@
1
+ import * as V from "react";
2
+ import lr, { createContext as ur, useState as k, useContext as dr, useRef as Se, useEffect as ie } from "react";
3
+ import { OverlayTrigger as Ir, Button as $e, Tooltip as $r, DropdownButton as Dr, Dropdown as ee, Avatar as Lr, Icon as Z, IconButton as Ce, Navbar as _e, IconButtonWithTooltip as se, Nav as Ue, NavDropdown as Ge } from "@openedx/paragon";
4
+ var Ee = { exports: {} }, ve = {};
5
+ /*
6
+ object-assign
7
+ (c) Sindre Sorhus
8
+ @license MIT
9
+ */
10
+ var Ae, Xe;
11
+ function fr() {
12
+ if (Xe) return Ae;
13
+ Xe = 1;
14
+ var t = Object.getOwnPropertySymbols, a = Object.prototype.hasOwnProperty, s = Object.prototype.propertyIsEnumerable;
15
+ function n(m) {
16
+ if (m == null)
17
+ throw new TypeError("Object.assign cannot be called with null or undefined");
18
+ return Object(m);
19
+ }
20
+ function b() {
21
+ try {
22
+ if (!Object.assign)
23
+ return !1;
24
+ var m = new String("abc");
25
+ if (m[5] = "de", Object.getOwnPropertyNames(m)[0] === "5")
26
+ return !1;
27
+ for (var w = {}, p = 0; p < 10; p++)
28
+ w["_" + String.fromCharCode(p)] = p;
29
+ var g = Object.getOwnPropertyNames(w).map(function(o) {
30
+ return w[o];
31
+ });
32
+ if (g.join("") !== "0123456789")
33
+ return !1;
34
+ var c = {};
35
+ return "abcdefghijklmnopqrst".split("").forEach(function(o) {
36
+ c[o] = o;
37
+ }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
38
+ } catch {
39
+ return !1;
40
+ }
41
+ }
42
+ return Ae = b() ? Object.assign : function(m, w) {
43
+ for (var p, g = n(m), c, o = 1; o < arguments.length; o++) {
44
+ p = Object(arguments[o]);
45
+ for (var d in p)
46
+ a.call(p, d) && (g[d] = p[d]);
47
+ if (t) {
48
+ c = t(p);
49
+ for (var f = 0; f < c.length; f++)
50
+ s.call(p, c[f]) && (g[c[f]] = p[c[f]]);
51
+ }
52
+ }
53
+ return g;
54
+ }, Ae;
55
+ }
56
+ /** @license React v17.0.2
57
+ * react-jsx-runtime.production.min.js
58
+ *
59
+ * Copyright (c) Facebook, Inc. and its affiliates.
60
+ *
61
+ * This source code is licensed under the MIT license found in the
62
+ * LICENSE file in the root directory of this source tree.
63
+ */
64
+ var Ze;
65
+ function Hr() {
66
+ if (Ze) return ve;
67
+ Ze = 1, fr();
68
+ var t = lr, a = 60103;
69
+ if (ve.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
70
+ var s = Symbol.for;
71
+ a = s("react.element"), ve.Fragment = s("react.fragment");
72
+ }
73
+ var n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, b = Object.prototype.hasOwnProperty, m = { key: !0, ref: !0, __self: !0, __source: !0 };
74
+ function w(p, g, c) {
75
+ var o, d = {}, f = null, x = null;
76
+ c !== void 0 && (f = "" + c), g.key !== void 0 && (f = "" + g.key), g.ref !== void 0 && (x = g.ref);
77
+ for (o in g) b.call(g, o) && !m.hasOwnProperty(o) && (d[o] = g[o]);
78
+ if (p && p.defaultProps) for (o in g = p.defaultProps, g) d[o] === void 0 && (d[o] = g[o]);
79
+ return { $$typeof: a, type: p, key: f, ref: x, props: d, _owner: n.current };
80
+ }
81
+ return ve.jsx = w, ve.jsxs = w, ve;
82
+ }
83
+ var Me = {};
84
+ /** @license React v17.0.2
85
+ * react-jsx-runtime.development.js
86
+ *
87
+ * Copyright (c) Facebook, Inc. and its affiliates.
88
+ *
89
+ * This source code is licensed under the MIT license found in the
90
+ * LICENSE file in the root directory of this source tree.
91
+ */
92
+ var Qe;
93
+ function zr() {
94
+ return Qe || (Qe = 1, (function(t) {
95
+ process.env.NODE_ENV !== "production" && (function() {
96
+ var a = lr, s = fr(), n = 60103, b = 60106;
97
+ t.Fragment = 60107;
98
+ var m = 60108, w = 60114, p = 60109, g = 60110, c = 60112, o = 60113, d = 60120, f = 60115, x = 60116, u = 60121, P = 60122, J = 60117, j = 60129, I = 60131;
99
+ if (typeof Symbol == "function" && Symbol.for) {
100
+ var S = Symbol.for;
101
+ n = S("react.element"), b = S("react.portal"), t.Fragment = S("react.fragment"), m = S("react.strict_mode"), w = S("react.profiler"), p = S("react.provider"), g = S("react.context"), c = S("react.forward_ref"), o = S("react.suspense"), d = S("react.suspense_list"), f = S("react.memo"), x = S("react.lazy"), u = S("react.block"), P = S("react.server.block"), J = S("react.fundamental"), S("react.scope"), S("react.opaque.id"), j = S("react.debug_trace_mode"), S("react.offscreen"), I = S("react.legacy_hidden");
102
+ }
103
+ var U = typeof Symbol == "function" && Symbol.iterator, $ = "@@iterator";
104
+ function G(e) {
105
+ if (e === null || typeof e != "object")
106
+ return null;
107
+ var i = U && e[U] || e[$];
108
+ return typeof i == "function" ? i : null;
109
+ }
110
+ var L = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
111
+ function C(e) {
112
+ {
113
+ for (var i = arguments.length, l = new Array(i > 1 ? i - 1 : 0), v = 1; v < i; v++)
114
+ l[v - 1] = arguments[v];
115
+ X("error", e, l);
116
+ }
117
+ }
118
+ function X(e, i, l) {
119
+ {
120
+ var v = L.ReactDebugCurrentFrame, R = v.getStackAddendum();
121
+ R !== "" && (i += "%s", l = l.concat([R]));
122
+ var O = l.map(function(_) {
123
+ return "" + _;
124
+ });
125
+ O.unshift("Warning: " + i), Function.prototype.apply.call(console[e], console, O);
126
+ }
127
+ }
128
+ var re = !1;
129
+ function H(e) {
130
+ return !!(typeof e == "string" || typeof e == "function" || e === t.Fragment || e === w || e === j || e === m || e === o || e === d || e === I || re || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === f || e.$$typeof === p || e.$$typeof === g || e.$$typeof === c || e.$$typeof === J || e.$$typeof === u || e[0] === P));
131
+ }
132
+ function D(e, i, l) {
133
+ var v = i.displayName || i.name || "";
134
+ return e.displayName || (v !== "" ? l + "(" + v + ")" : l);
135
+ }
136
+ function q(e) {
137
+ return e.displayName || "Context";
138
+ }
139
+ function M(e) {
140
+ if (e == null)
141
+ return null;
142
+ if (typeof e.tag == "number" && C("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."), typeof e == "function")
143
+ return e.displayName || e.name || null;
144
+ if (typeof e == "string")
145
+ return e;
146
+ switch (e) {
147
+ case t.Fragment:
148
+ return "Fragment";
149
+ case b:
150
+ return "Portal";
151
+ case w:
152
+ return "Profiler";
153
+ case m:
154
+ return "StrictMode";
155
+ case o:
156
+ return "Suspense";
157
+ case d:
158
+ return "SuspenseList";
159
+ }
160
+ if (typeof e == "object")
161
+ switch (e.$$typeof) {
162
+ case g:
163
+ var i = e;
164
+ return q(i) + ".Consumer";
165
+ case p:
166
+ var l = e;
167
+ return q(l._context) + ".Provider";
168
+ case c:
169
+ return D(e, e.render, "ForwardRef");
170
+ case f:
171
+ return M(e.type);
172
+ case u:
173
+ return M(e._render);
174
+ case x: {
175
+ var v = e, R = v._payload, O = v._init;
176
+ try {
177
+ return M(O(R));
178
+ } catch {
179
+ return null;
180
+ }
181
+ }
182
+ }
183
+ return null;
184
+ }
185
+ var z = 0, E, F, K, Q, ue, Y, ae;
186
+ function oe() {
187
+ }
188
+ oe.__reactDisabledLog = !0;
189
+ function De() {
190
+ {
191
+ if (z === 0) {
192
+ E = console.log, F = console.info, K = console.warn, Q = console.error, ue = console.group, Y = console.groupCollapsed, ae = console.groupEnd;
193
+ var e = {
194
+ configurable: !0,
195
+ enumerable: !0,
196
+ value: oe,
197
+ writable: !0
198
+ };
199
+ Object.defineProperties(console, {
200
+ info: e,
201
+ log: e,
202
+ warn: e,
203
+ error: e,
204
+ group: e,
205
+ groupCollapsed: e,
206
+ groupEnd: e
207
+ });
208
+ }
209
+ z++;
210
+ }
211
+ }
212
+ function Re() {
213
+ {
214
+ if (z--, z === 0) {
215
+ var e = {
216
+ configurable: !0,
217
+ enumerable: !0,
218
+ writable: !0
219
+ };
220
+ Object.defineProperties(console, {
221
+ log: s({}, e, {
222
+ value: E
223
+ }),
224
+ info: s({}, e, {
225
+ value: F
226
+ }),
227
+ warn: s({}, e, {
228
+ value: K
229
+ }),
230
+ error: s({}, e, {
231
+ value: Q
232
+ }),
233
+ group: s({}, e, {
234
+ value: ue
235
+ }),
236
+ groupCollapsed: s({}, e, {
237
+ value: Y
238
+ }),
239
+ groupEnd: s({}, e, {
240
+ value: ae
241
+ })
242
+ });
243
+ }
244
+ z < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
245
+ }
246
+ }
247
+ var de = L.ReactCurrentDispatcher, fe;
248
+ function ce(e, i, l) {
249
+ {
250
+ if (fe === void 0)
251
+ try {
252
+ throw Error();
253
+ } catch (R) {
254
+ var v = R.stack.trim().match(/\n( *(at )?)/);
255
+ fe = v && v[1] || "";
256
+ }
257
+ return `
258
+ ` + fe + e;
259
+ }
260
+ }
261
+ var he = !1, le;
262
+ {
263
+ var ye = typeof WeakMap == "function" ? WeakMap : Map;
264
+ le = new ye();
265
+ }
266
+ function xe(e, i) {
267
+ if (!e || he)
268
+ return "";
269
+ {
270
+ var l = le.get(e);
271
+ if (l !== void 0)
272
+ return l;
273
+ }
274
+ var v;
275
+ he = !0;
276
+ var R = Error.prepareStackTrace;
277
+ Error.prepareStackTrace = void 0;
278
+ var O;
279
+ O = de.current, de.current = null, De();
280
+ try {
281
+ if (i) {
282
+ var _ = function() {
283
+ throw Error();
284
+ };
285
+ if (Object.defineProperty(_.prototype, "props", {
286
+ set: function() {
287
+ throw Error();
288
+ }
289
+ }), typeof Reflect == "object" && Reflect.construct) {
290
+ try {
291
+ Reflect.construct(_, []);
292
+ } catch (ne) {
293
+ v = ne;
294
+ }
295
+ Reflect.construct(e, [], _);
296
+ } else {
297
+ try {
298
+ _.call();
299
+ } catch (ne) {
300
+ v = ne;
301
+ }
302
+ e.call(_.prototype);
303
+ }
304
+ } else {
305
+ try {
306
+ throw Error();
307
+ } catch (ne) {
308
+ v = ne;
309
+ }
310
+ e();
311
+ }
312
+ } catch (ne) {
313
+ if (ne && v && typeof ne.stack == "string") {
314
+ for (var y = ne.stack.split(`
315
+ `), W = v.stack.split(`
316
+ `), T = y.length - 1, A = W.length - 1; T >= 1 && A >= 0 && y[T] !== W[A]; )
317
+ A--;
318
+ for (; T >= 1 && A >= 0; T--, A--)
319
+ if (y[T] !== W[A]) {
320
+ if (T !== 1 || A !== 1)
321
+ do
322
+ if (T--, A--, A < 0 || y[T] !== W[A]) {
323
+ var te = `
324
+ ` + y[T].replace(" at new ", " at ");
325
+ return typeof e == "function" && le.set(e, te), te;
326
+ }
327
+ while (T >= 1 && A >= 0);
328
+ break;
329
+ }
330
+ }
331
+ } finally {
332
+ he = !1, de.current = O, Re(), Error.prepareStackTrace = R;
333
+ }
334
+ var ge = e ? e.displayName || e.name : "", Je = ge ? ce(ge) : "";
335
+ return typeof e == "function" && le.set(e, Je), Je;
336
+ }
337
+ function be(e, i, l) {
338
+ return xe(e, !1);
339
+ }
340
+ function h(e) {
341
+ var i = e.prototype;
342
+ return !!(i && i.isReactComponent);
343
+ }
344
+ function N(e, i, l) {
345
+ if (e == null)
346
+ return "";
347
+ if (typeof e == "function")
348
+ return xe(e, h(e));
349
+ if (typeof e == "string")
350
+ return ce(e);
351
+ switch (e) {
352
+ case o:
353
+ return ce("Suspense");
354
+ case d:
355
+ return ce("SuspenseList");
356
+ }
357
+ if (typeof e == "object")
358
+ switch (e.$$typeof) {
359
+ case c:
360
+ return be(e.render);
361
+ case f:
362
+ return N(e.type, i, l);
363
+ case u:
364
+ return be(e._render);
365
+ case x: {
366
+ var v = e, R = v._payload, O = v._init;
367
+ try {
368
+ return N(O(R), i, l);
369
+ } catch {
370
+ }
371
+ }
372
+ }
373
+ return "";
374
+ }
375
+ var B = {}, pe = L.ReactDebugCurrentFrame;
376
+ function je(e) {
377
+ if (e) {
378
+ var i = e._owner, l = N(e.type, e._source, i ? i.type : null);
379
+ pe.setExtraStackFrame(l);
380
+ } else
381
+ pe.setExtraStackFrame(null);
382
+ }
383
+ function xr(e, i, l, v, R) {
384
+ {
385
+ var O = Function.call.bind(Object.prototype.hasOwnProperty);
386
+ for (var _ in e)
387
+ if (O(e, _)) {
388
+ var y = void 0;
389
+ try {
390
+ if (typeof e[_] != "function") {
391
+ var W = Error((v || "React class") + ": " + l + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
392
+ throw W.name = "Invariant Violation", W;
393
+ }
394
+ y = e[_](i, _, v, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
395
+ } catch (T) {
396
+ y = T;
397
+ }
398
+ y && !(y instanceof Error) && (je(R), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", l, _, typeof y), je(null)), y instanceof Error && !(y.message in B) && (B[y.message] = !0, je(R), C("Failed %s type: %s", l, y.message), je(null));
399
+ }
400
+ }
401
+ }
402
+ var Le = L.ReactCurrentOwner, ke = Object.prototype.hasOwnProperty, br = {
403
+ key: !0,
404
+ ref: !0,
405
+ __self: !0,
406
+ __source: !0
407
+ }, He, ze;
408
+ function wr(e) {
409
+ if (ke.call(e, "ref")) {
410
+ var i = Object.getOwnPropertyDescriptor(e, "ref").get;
411
+ if (i && i.isReactWarning)
412
+ return !1;
413
+ }
414
+ return e.ref !== void 0;
415
+ }
416
+ function yr(e) {
417
+ if (ke.call(e, "key")) {
418
+ var i = Object.getOwnPropertyDescriptor(e, "key").get;
419
+ if (i && i.isReactWarning)
420
+ return !1;
421
+ }
422
+ return e.key !== void 0;
423
+ }
424
+ function jr(e, i) {
425
+ typeof e.ref == "string" && Le.current;
426
+ }
427
+ function _r(e, i) {
428
+ {
429
+ var l = function() {
430
+ He || (He = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
431
+ };
432
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
433
+ get: l,
434
+ configurable: !0
435
+ });
436
+ }
437
+ }
438
+ function Er(e, i) {
439
+ {
440
+ var l = function() {
441
+ ze || (ze = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
442
+ };
443
+ l.isReactWarning = !0, Object.defineProperty(e, "ref", {
444
+ get: l,
445
+ configurable: !0
446
+ });
447
+ }
448
+ }
449
+ var Sr = function(e, i, l, v, R, O, _) {
450
+ var y = {
451
+ // This tag allows us to uniquely identify this as a React Element
452
+ $$typeof: n,
453
+ // Built-in properties that belong on the element
454
+ type: e,
455
+ key: i,
456
+ ref: l,
457
+ props: _,
458
+ // Record the component responsible for creating this element.
459
+ _owner: O
460
+ };
461
+ return y._store = {}, Object.defineProperty(y._store, "validated", {
462
+ configurable: !1,
463
+ enumerable: !1,
464
+ writable: !0,
465
+ value: !1
466
+ }), Object.defineProperty(y, "_self", {
467
+ configurable: !1,
468
+ enumerable: !1,
469
+ writable: !1,
470
+ value: v
471
+ }), Object.defineProperty(y, "_source", {
472
+ configurable: !1,
473
+ enumerable: !1,
474
+ writable: !1,
475
+ value: R
476
+ }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
477
+ };
478
+ function Cr(e, i, l, v, R) {
479
+ {
480
+ var O, _ = {}, y = null, W = null;
481
+ l !== void 0 && (y = "" + l), yr(i) && (y = "" + i.key), wr(i) && (W = i.ref, jr(i, R));
482
+ for (O in i)
483
+ ke.call(i, O) && !br.hasOwnProperty(O) && (_[O] = i[O]);
484
+ if (e && e.defaultProps) {
485
+ var T = e.defaultProps;
486
+ for (O in T)
487
+ _[O] === void 0 && (_[O] = T[O]);
488
+ }
489
+ if (y || W) {
490
+ var A = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
491
+ y && _r(_, A), W && Er(_, A);
492
+ }
493
+ return Sr(e, y, W, R, v, Le.current, _);
494
+ }
495
+ }
496
+ var Ne = L.ReactCurrentOwner, Ve = L.ReactDebugCurrentFrame;
497
+ function me(e) {
498
+ if (e) {
499
+ var i = e._owner, l = N(e.type, e._source, i ? i.type : null);
500
+ Ve.setExtraStackFrame(l);
501
+ } else
502
+ Ve.setExtraStackFrame(null);
503
+ }
504
+ var Te;
505
+ Te = !1;
506
+ function Pe(e) {
507
+ return typeof e == "object" && e !== null && e.$$typeof === n;
508
+ }
509
+ function qe() {
510
+ {
511
+ if (Ne.current) {
512
+ var e = M(Ne.current.type);
513
+ if (e)
514
+ return `
515
+
516
+ Check the render method of \`` + e + "`.";
517
+ }
518
+ return "";
519
+ }
520
+ }
521
+ function Or(e) {
522
+ return "";
523
+ }
524
+ var Fe = {};
525
+ function Rr(e) {
526
+ {
527
+ var i = qe();
528
+ if (!i) {
529
+ var l = typeof e == "string" ? e : e.displayName || e.name;
530
+ l && (i = `
531
+
532
+ Check the top-level render call using <` + l + ">.");
533
+ }
534
+ return i;
535
+ }
536
+ }
537
+ function Ke(e, i) {
538
+ {
539
+ if (!e._store || e._store.validated || e.key != null)
540
+ return;
541
+ e._store.validated = !0;
542
+ var l = Rr(i);
543
+ if (Fe[l])
544
+ return;
545
+ Fe[l] = !0;
546
+ var v = "";
547
+ e && e._owner && e._owner !== Ne.current && (v = " It was passed a child from " + M(e._owner.type) + "."), me(e), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, v), me(null);
548
+ }
549
+ }
550
+ function We(e, i) {
551
+ {
552
+ if (typeof e != "object")
553
+ return;
554
+ if (Array.isArray(e))
555
+ for (var l = 0; l < e.length; l++) {
556
+ var v = e[l];
557
+ Pe(v) && Ke(v, i);
558
+ }
559
+ else if (Pe(e))
560
+ e._store && (e._store.validated = !0);
561
+ else if (e) {
562
+ var R = G(e);
563
+ if (typeof R == "function" && R !== e.entries)
564
+ for (var O = R.call(e), _; !(_ = O.next()).done; )
565
+ Pe(_.value) && Ke(_.value, i);
566
+ }
567
+ }
568
+ }
569
+ function kr(e) {
570
+ {
571
+ var i = e.type;
572
+ if (i == null || typeof i == "string")
573
+ return;
574
+ var l;
575
+ if (typeof i == "function")
576
+ l = i.propTypes;
577
+ else if (typeof i == "object" && (i.$$typeof === c || // Note: Memo only checks outer props here.
578
+ // Inner props are checked in the reconciler.
579
+ i.$$typeof === f))
580
+ l = i.propTypes;
581
+ else
582
+ return;
583
+ if (l) {
584
+ var v = M(i);
585
+ xr(l, e.props, "prop", v, e);
586
+ } else if (i.PropTypes !== void 0 && !Te) {
587
+ Te = !0;
588
+ var R = M(i);
589
+ C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
590
+ }
591
+ typeof i.getDefaultProps == "function" && !i.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
592
+ }
593
+ }
594
+ function Nr(e) {
595
+ {
596
+ for (var i = Object.keys(e.props), l = 0; l < i.length; l++) {
597
+ var v = i[l];
598
+ if (v !== "children" && v !== "key") {
599
+ me(e), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), me(null);
600
+ break;
601
+ }
602
+ }
603
+ e.ref !== null && (me(e), C("Invalid attribute `ref` supplied to `React.Fragment`."), me(null));
604
+ }
605
+ }
606
+ function Ye(e, i, l, v, R, O) {
607
+ {
608
+ var _ = H(e);
609
+ if (!_) {
610
+ var y = "";
611
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
612
+ var W = Or();
613
+ W ? y += W : y += qe();
614
+ var T;
615
+ e === null ? T = "null" : Array.isArray(e) ? T = "array" : e !== void 0 && e.$$typeof === n ? (T = "<" + (M(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, y);
616
+ }
617
+ var A = Cr(e, i, l, R, O);
618
+ if (A == null)
619
+ return A;
620
+ if (_) {
621
+ var te = i.children;
622
+ if (te !== void 0)
623
+ if (v)
624
+ if (Array.isArray(te)) {
625
+ for (var ge = 0; ge < te.length; ge++)
626
+ We(te[ge], e);
627
+ Object.freeze && Object.freeze(te);
628
+ } else
629
+ C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
630
+ else
631
+ We(te, e);
632
+ }
633
+ return e === t.Fragment ? Nr(A) : kr(A), A;
634
+ }
635
+ }
636
+ function Tr(e, i, l) {
637
+ return Ye(e, i, l, !0);
638
+ }
639
+ function Pr(e, i, l) {
640
+ return Ye(e, i, l, !1);
641
+ }
642
+ var Ar = Pr, Mr = Tr;
643
+ t.jsx = Ar, t.jsxs = Mr;
644
+ })();
645
+ })(Me)), Me;
646
+ }
647
+ var Be;
648
+ function Vr() {
649
+ return Be || (Be = 1, process.env.NODE_ENV === "production" ? Ee.exports = Hr() : Ee.exports = zr()), Ee.exports;
650
+ }
651
+ var r = Vr();
652
+ const it = ({ contactInfo: t, quickLinks: a, exploreLinks: s, logoUrl: n, copyrights: b }) => {
653
+ const m = (w) => w ?? "left";
654
+ return /* @__PURE__ */ r.jsxs("footer", { className: "footer", children: [
655
+ /* @__PURE__ */ r.jsxs("div", { className: "container", children: [
656
+ /* @__PURE__ */ r.jsxs("div", { className: `section ${m(t.align)}`, children: [
657
+ /* @__PURE__ */ r.jsx("div", { className: "footer-brand-logo", children: /* @__PURE__ */ r.jsx(
658
+ "img",
659
+ {
660
+ src: n,
661
+ alt: "Logo"
662
+ }
663
+ ) }),
664
+ /* @__PURE__ */ r.jsx("p", { children: t.content.shortdesc }),
665
+ /* @__PURE__ */ r.jsxs("p", { children: [
666
+ t.content.location.label,
667
+ ", ",
668
+ t.content.location.value
669
+ ] }),
670
+ /* @__PURE__ */ r.jsxs("p", { children: [
671
+ "📞 ",
672
+ t.content.phonenumber
673
+ ] })
674
+ ] }),
675
+ /* @__PURE__ */ r.jsx("div", { className: `section ${m(a.align)}`, children: /* @__PURE__ */ r.jsxs("ul", { children: [
676
+ /* @__PURE__ */ r.jsx("h3", { children: "Quick Links" }),
677
+ a.content.map((w, p) => /* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx("a", { href: w.link, children: w.label }) }, p))
678
+ ] }) }),
679
+ /* @__PURE__ */ r.jsx("div", { className: `section ${m(s.align)}`, children: /* @__PURE__ */ r.jsxs("ul", { children: [
680
+ /* @__PURE__ */ r.jsx("h3", { children: "Explore" }),
681
+ s.content.map((w, p) => /* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx("a", { href: w.link, children: w.label }) }, p))
682
+ ] }) })
683
+ ] }),
684
+ /* @__PURE__ */ r.jsx("div", { className: "copyright", children: /* @__PURE__ */ r.jsx("p", { children: b }) })
685
+ ] });
686
+ }, hr = ur(void 0), st = ({ children: t }) => {
687
+ const [a, s] = k(!1), n = () => {
688
+ s((m) => !m);
689
+ }, b = (m) => {
690
+ s(m);
691
+ };
692
+ return /* @__PURE__ */ r.jsx(hr.Provider, { value: { isCollapsed: a, toggleSidebar: n, setSidebarCollapsed: b }, children: t });
693
+ }, pr = () => {
694
+ const t = dr(hr);
695
+ if (t === void 0)
696
+ throw new Error("useSidebar must be used within a SidebarProvider");
697
+ return t;
698
+ }, at = ({ buttons: t, onNavigate: a, presentPath: s }) => {
699
+ const { isCollapsed: n, setSidebarCollapsed: b } = pr(), [m, w] = k(!0), p = Se(null), [g, c] = k(
700
+ () => document.dir === "rtl" || document.documentElement.dir === "rtl"
701
+ );
702
+ return ie(() => {
703
+ const o = () => {
704
+ c(document.dir === "rtl" || document.documentElement.dir === "rtl");
705
+ }, d = new MutationObserver(o);
706
+ return d.observe(document.documentElement, {
707
+ attributes: !0,
708
+ attributeFilter: ["dir"]
709
+ }), () => d.disconnect();
710
+ }, []), ie(() => {
711
+ const o = t.some((d) => d.path === s);
712
+ w(o), !o && !n && s.includes("/course/") && b(!0);
713
+ }, [s]), ie(() => {
714
+ const o = (d) => {
715
+ !m && p.current && !p.current.contains(d.target) && s.includes("/course/") && (n || b(!0));
716
+ };
717
+ return document.addEventListener("mousedown", o), () => {
718
+ document.removeEventListener("mousedown", o);
719
+ };
720
+ }, [m, n, b]), /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
721
+ /* @__PURE__ */ r.jsx(
722
+ "div",
723
+ {
724
+ className: `sidebar ${n ? "collapsed" : ""}`,
725
+ ref: p,
726
+ children: /* @__PURE__ */ r.jsx("div", { className: "sidebar-buttons", children: t.map((o) => {
727
+ const d = o.path === s || (s.includes("/course/") || s.includes("/course_rerun/")) && o.path === "/my-courses" || s.includes("/library/") && o.path === "/libraries" || s.includes("/taxonomy/") && o.path === "/taxonomies";
728
+ return /* @__PURE__ */ r.jsx(
729
+ Ir,
730
+ {
731
+ placement: g ? "left" : "right",
732
+ overlay: /* @__PURE__ */ r.jsx($r, { id: `tooltip-${o.path}`, children: o.label }),
733
+ show: n ? void 0 : !1,
734
+ popperConfig: {
735
+ modifiers: [
736
+ {
737
+ name: "preventOverflow",
738
+ options: {
739
+ altAxis: !0,
740
+ boundary: "viewport"
741
+ }
742
+ }
743
+ ]
744
+ },
745
+ children: /* @__PURE__ */ r.jsx(
746
+ $e,
747
+ {
748
+ variant: "tertiary",
749
+ className: `sidebar-btn ${d ? "pgn-btn-active" : "pgn-btn-inactive"}`,
750
+ onClick: () => a(o.path),
751
+ children: /* @__PURE__ */ r.jsxs("div", { className: "btn-content", children: [
752
+ /* @__PURE__ */ r.jsx("span", { className: "icon-container", children: o.icon }),
753
+ /* @__PURE__ */ r.jsx("span", { className: "btn-label", children: o.label })
754
+ ] })
755
+ }
756
+ )
757
+ },
758
+ o.path
759
+ );
760
+ }) })
761
+ }
762
+ ),
763
+ !m && !n && /* @__PURE__ */ r.jsx("div", { className: "sidebar-extra-space" })
764
+ ] });
765
+ }, qr = (t = 768) => {
766
+ const [a, s] = k(!1);
767
+ return ie(() => {
768
+ const n = () => {
769
+ s(window.innerWidth <= t);
770
+ };
771
+ return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
772
+ }, [t]), a;
773
+ }, er = (t) => /* @__PURE__ */ V.createElement("svg", {
774
+ xmlns: "http://www.w3.org/2000/svg",
775
+ width: 24,
776
+ height: 24,
777
+ viewBox: "0 0 24 24",
778
+ fill: "none",
779
+ ...t
780
+ }, /* @__PURE__ */ V.createElement("path", {
781
+ d: "M10.09 15.59 11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM21 3H3v6h2V5h14v14H5v-4H3v6h18V3z",
782
+ fill: "currentColor"
783
+ })), rr = (t) => /* @__PURE__ */ V.createElement("svg", {
784
+ xmlns: "http://www.w3.org/2000/svg",
785
+ width: 24,
786
+ height: 24,
787
+ viewBox: "0 0 24 24",
788
+ fill: "none",
789
+ ...t
790
+ }, /* @__PURE__ */ V.createElement("path", {
791
+ d: "M21 3H3v18h18V3zm-8.99 15c-.7 0-1.26-.56-1.26-1.26 0-.71.56-1.25 1.26-1.25.71 0 1.25.54 1.25 1.25-.01.69-.54 1.26-1.25 1.26zm3.01-7.4c-.76 1.11-1.48 1.46-1.87 2.17-.16.29-.22.48-.22 1.41h-1.82c0-.49-.08-1.29.31-1.98.49-.87 1.42-1.39 1.96-2.16.57-.81.25-2.33-1.37-2.33-1.06 0-1.58.8-1.8 1.48l-1.65-.7C9.01 7.15 10.22 6 11.99 6c1.48 0 2.49.67 3.01 1.52.44.72.7 2.07.02 3.08z",
792
+ fill: "currentColor"
793
+ })), Fr = (t) => /* @__PURE__ */ V.createElement("svg", {
794
+ xmlns: "http://www.w3.org/2000/svg",
795
+ width: 24,
796
+ height: 24,
797
+ viewBox: "0 0 24 24",
798
+ fill: "none",
799
+ ...t
800
+ }, /* @__PURE__ */ V.createElement("path", {
801
+ d: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",
802
+ fill: "currentColor"
803
+ })), Kr = (t) => /* @__PURE__ */ V.createElement("svg", {
804
+ width: 24,
805
+ height: 24,
806
+ viewBox: "0 0 24 24",
807
+ fill: "none",
808
+ xmlns: "http://www.w3.org/2000/svg",
809
+ ...t
810
+ }, /* @__PURE__ */ V.createElement("path", {
811
+ d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2Zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z",
812
+ fill: "currentColor"
813
+ })), tr = (t) => /* @__PURE__ */ V.createElement("svg", {
814
+ xmlns: "http://www.w3.org/2000/svg",
815
+ width: 24,
816
+ height: 24,
817
+ viewBox: "0 0 24 24",
818
+ fill: "none",
819
+ ...t
820
+ }, /* @__PURE__ */ V.createElement("path", {
821
+ d: "M12 22c1.1 0 2-.9 2-2h-4a2 2 0 0 0 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V2.5h-3v2.18C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z",
822
+ fill: "currentColor"
823
+ })), Wr = (t) => /* @__PURE__ */ V.createElement("svg", {
824
+ xmlns: "http://www.w3.org/2000/svg",
825
+ width: 24,
826
+ height: 24,
827
+ viewBox: "0 0 24 24",
828
+ fill: "none",
829
+ ...t
830
+ }, /* @__PURE__ */ V.createElement("path", {
831
+ d: "M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z",
832
+ fill: "currentColor"
833
+ })), Yr = (t) => /* @__PURE__ */ V.createElement("svg", {
834
+ width: 24,
835
+ height: 24,
836
+ viewBox: "0 0 24 24",
837
+ fill: "none",
838
+ xmlns: "http://www.w3.org/2000/svg",
839
+ ...t
840
+ }, /* @__PURE__ */ V.createElement("path", {
841
+ d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5Zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14Z",
842
+ fill: "currentColor"
843
+ })), nr = (t) => /* @__PURE__ */ V.createElement("svg", {
844
+ xmlns: "http://www.w3.org/2000/svg",
845
+ width: 24,
846
+ height: 24,
847
+ viewBox: "0 0 24 24",
848
+ fill: "none",
849
+ ...t
850
+ }, /* @__PURE__ */ V.createElement("path", {
851
+ d: "M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74A7.93 7.93 0 0 0 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z",
852
+ fill: "currentColor"
853
+ })), Jr = ({
854
+ id: t,
855
+ buttonTitle: a,
856
+ items: s
857
+ }) => (console.log("NavDropdownMenu Props:", s), /* @__PURE__ */ r.jsx(
858
+ Dr,
859
+ {
860
+ id: t,
861
+ title: a,
862
+ variant: "tertiary",
863
+ className: "mr-2",
864
+ children: s.map((n) => /* @__PURE__ */ r.jsx(
865
+ ee.Item,
866
+ {
867
+ href: n.href,
868
+ as: "a",
869
+ className: "small",
870
+ children: n.title
871
+ },
872
+ `${n.title}-dropdown-item`
873
+ ))
874
+ }
875
+ )), ir = ({
876
+ username: t,
877
+ // studioBaseUrl,
878
+ // logoutUrl,
879
+ authenticatedUserAvatar: a,
880
+ isMobile: s,
881
+ // isAdmin,
882
+ menuItems: n
883
+ }) => {
884
+ const b = a ? /* @__PURE__ */ r.jsx(
885
+ "img",
886
+ {
887
+ className: "d-block w-100 h-100",
888
+ src: a,
889
+ alt: t,
890
+ "data-testid": "avatar-image"
891
+ }
892
+ ) : /* @__PURE__ */ r.jsx(
893
+ Lr,
894
+ {
895
+ size: "sm",
896
+ className: "mr-2",
897
+ alt: "avatar",
898
+ "data-testid": "avatar-icon"
899
+ }
900
+ ), m = s ? b : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
901
+ t,
902
+ "   ",
903
+ b
904
+ ] });
905
+ return /* @__PURE__ */ r.jsx(
906
+ Jr,
907
+ {
908
+ buttonTitle: m,
909
+ id: "user-dropdown-menu",
910
+ items: n
911
+ }
912
+ );
913
+ };
914
+ var we = {}, sr;
915
+ function Ur() {
916
+ if (sr) return we;
917
+ sr = 1, Object.defineProperty(we, "__esModule", { value: !0 }), we.parse = w, we.serialize = c;
918
+ const t = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, a = /^[\u0021-\u003A\u003C-\u007E]*$/, s = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, n = /^[\u0020-\u003A\u003D-\u007E]*$/, b = Object.prototype.toString, m = /* @__PURE__ */ (() => {
919
+ const f = function() {
920
+ };
921
+ return f.prototype = /* @__PURE__ */ Object.create(null), f;
922
+ })();
923
+ function w(f, x) {
924
+ const u = new m(), P = f.length;
925
+ if (P < 2)
926
+ return u;
927
+ const J = (x == null ? void 0 : x.decode) || o;
928
+ let j = 0;
929
+ do {
930
+ const I = f.indexOf("=", j);
931
+ if (I === -1)
932
+ break;
933
+ const S = f.indexOf(";", j), U = S === -1 ? P : S;
934
+ if (I > U) {
935
+ j = f.lastIndexOf(";", I - 1) + 1;
936
+ continue;
937
+ }
938
+ const $ = p(f, j, I), G = g(f, I, $), L = f.slice($, G);
939
+ if (u[L] === void 0) {
940
+ let C = p(f, I + 1, U), X = g(f, U, C);
941
+ const re = J(f.slice(C, X));
942
+ u[L] = re;
943
+ }
944
+ j = U + 1;
945
+ } while (j < P);
946
+ return u;
947
+ }
948
+ function p(f, x, u) {
949
+ do {
950
+ const P = f.charCodeAt(x);
951
+ if (P !== 32 && P !== 9)
952
+ return x;
953
+ } while (++x < u);
954
+ return u;
955
+ }
956
+ function g(f, x, u) {
957
+ for (; x > u; ) {
958
+ const P = f.charCodeAt(--x);
959
+ if (P !== 32 && P !== 9)
960
+ return x + 1;
961
+ }
962
+ return u;
963
+ }
964
+ function c(f, x, u) {
965
+ const P = (u == null ? void 0 : u.encode) || encodeURIComponent;
966
+ if (!t.test(f))
967
+ throw new TypeError(`argument name is invalid: ${f}`);
968
+ const J = P(x);
969
+ if (!a.test(J))
970
+ throw new TypeError(`argument val is invalid: ${x}`);
971
+ let j = f + "=" + J;
972
+ if (!u)
973
+ return j;
974
+ if (u.maxAge !== void 0) {
975
+ if (!Number.isInteger(u.maxAge))
976
+ throw new TypeError(`option maxAge is invalid: ${u.maxAge}`);
977
+ j += "; Max-Age=" + u.maxAge;
978
+ }
979
+ if (u.domain) {
980
+ if (!s.test(u.domain))
981
+ throw new TypeError(`option domain is invalid: ${u.domain}`);
982
+ j += "; Domain=" + u.domain;
983
+ }
984
+ if (u.path) {
985
+ if (!n.test(u.path))
986
+ throw new TypeError(`option path is invalid: ${u.path}`);
987
+ j += "; Path=" + u.path;
988
+ }
989
+ if (u.expires) {
990
+ if (!d(u.expires) || !Number.isFinite(u.expires.valueOf()))
991
+ throw new TypeError(`option expires is invalid: ${u.expires}`);
992
+ j += "; Expires=" + u.expires.toUTCString();
993
+ }
994
+ if (u.httpOnly && (j += "; HttpOnly"), u.secure && (j += "; Secure"), u.partitioned && (j += "; Partitioned"), u.priority)
995
+ switch (typeof u.priority == "string" ? u.priority.toLowerCase() : void 0) {
996
+ case "low":
997
+ j += "; Priority=Low";
998
+ break;
999
+ case "medium":
1000
+ j += "; Priority=Medium";
1001
+ break;
1002
+ case "high":
1003
+ j += "; Priority=High";
1004
+ break;
1005
+ default:
1006
+ throw new TypeError(`option priority is invalid: ${u.priority}`);
1007
+ }
1008
+ if (u.sameSite)
1009
+ switch (typeof u.sameSite == "string" ? u.sameSite.toLowerCase() : u.sameSite) {
1010
+ case !0:
1011
+ case "strict":
1012
+ j += "; SameSite=Strict";
1013
+ break;
1014
+ case "lax":
1015
+ j += "; SameSite=Lax";
1016
+ break;
1017
+ case "none":
1018
+ j += "; SameSite=None";
1019
+ break;
1020
+ default:
1021
+ throw new TypeError(`option sameSite is invalid: ${u.sameSite}`);
1022
+ }
1023
+ return j;
1024
+ }
1025
+ function o(f) {
1026
+ if (f.indexOf("%") === -1)
1027
+ return f;
1028
+ try {
1029
+ return decodeURIComponent(f);
1030
+ } catch {
1031
+ return f;
1032
+ }
1033
+ }
1034
+ function d(f) {
1035
+ return b.call(f) === "[object Date]";
1036
+ }
1037
+ return we;
1038
+ }
1039
+ var Oe = Ur();
1040
+ function Gr() {
1041
+ const t = typeof global > "u" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
1042
+ return typeof t == "boolean" ? t : typeof document == "object" && typeof document.cookie == "string";
1043
+ }
1044
+ function Xr(t) {
1045
+ return typeof t == "string" ? Oe.parse(t) : typeof t == "object" && t !== null ? t : {};
1046
+ }
1047
+ function Ie(t, a = {}) {
1048
+ const s = Zr(t);
1049
+ if (!a.doNotParse)
1050
+ try {
1051
+ return JSON.parse(s);
1052
+ } catch {
1053
+ }
1054
+ return t;
1055
+ }
1056
+ function Zr(t) {
1057
+ return t && t[0] === "j" && t[1] === ":" ? t.substr(2) : t;
1058
+ }
1059
+ class Qr {
1060
+ constructor(a, s = {}) {
1061
+ this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.update = () => {
1062
+ if (!this.HAS_DOCUMENT_COOKIE)
1063
+ return;
1064
+ const b = this.cookies;
1065
+ this.cookies = Oe.parse(document.cookie), this._checkChanges(b);
1066
+ };
1067
+ const n = typeof document > "u" ? "" : document.cookie;
1068
+ this.cookies = Xr(a || n), this.defaultSetOptions = s, this.HAS_DOCUMENT_COOKIE = Gr();
1069
+ }
1070
+ _emitChange(a) {
1071
+ for (let s = 0; s < this.changeListeners.length; ++s)
1072
+ this.changeListeners[s](a);
1073
+ }
1074
+ _checkChanges(a) {
1075
+ new Set(Object.keys(a).concat(Object.keys(this.cookies))).forEach((n) => {
1076
+ a[n] !== this.cookies[n] && this._emitChange({
1077
+ name: n,
1078
+ value: Ie(this.cookies[n])
1079
+ });
1080
+ });
1081
+ }
1082
+ _startPolling() {
1083
+ this.pollingInterval = setInterval(this.update, 300);
1084
+ }
1085
+ _stopPolling() {
1086
+ this.pollingInterval && clearInterval(this.pollingInterval);
1087
+ }
1088
+ get(a, s = {}) {
1089
+ return s.doNotUpdate || this.update(), Ie(this.cookies[a], s);
1090
+ }
1091
+ getAll(a = {}) {
1092
+ a.doNotUpdate || this.update();
1093
+ const s = {};
1094
+ for (let n in this.cookies)
1095
+ s[n] = Ie(this.cookies[n], a);
1096
+ return s;
1097
+ }
1098
+ set(a, s, n) {
1099
+ n ? n = Object.assign(Object.assign({}, this.defaultSetOptions), n) : n = this.defaultSetOptions;
1100
+ const b = typeof s == "string" ? s : JSON.stringify(s);
1101
+ this.cookies = Object.assign(Object.assign({}, this.cookies), { [a]: b }), this.HAS_DOCUMENT_COOKIE && (document.cookie = Oe.serialize(a, b, n)), this._emitChange({ name: a, value: s, options: n });
1102
+ }
1103
+ remove(a, s) {
1104
+ const n = s = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), s), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
1105
+ this.cookies = Object.assign({}, this.cookies), delete this.cookies[a], this.HAS_DOCUMENT_COOKIE && (document.cookie = Oe.serialize(a, "", n)), this._emitChange({ name: a, value: void 0, options: s });
1106
+ }
1107
+ addChangeListener(a) {
1108
+ this.changeListeners.push(a), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.addEventListener("change", this.update) : this._startPolling());
1109
+ }
1110
+ removeChangeListener(a) {
1111
+ const s = this.changeListeners.indexOf(a);
1112
+ s >= 0 && this.changeListeners.splice(s, 1), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.removeEventListener("change", this.update) : this._stopPolling());
1113
+ }
1114
+ removeAllChangeListeners() {
1115
+ for (; this.changeListeners.length > 0; )
1116
+ this.removeChangeListener(this.changeListeners[0]);
1117
+ }
1118
+ }
1119
+ class Br {
1120
+ constructor(a) {
1121
+ if (!a.host)
1122
+ throw new Error("MeiliSearch host is required");
1123
+ if (!a.apiKey)
1124
+ throw new Error("MeiliSearch apiKey is required");
1125
+ if (!a.indexName)
1126
+ throw new Error("MeiliSearch indexName is required");
1127
+ this.config = a, this.headers = {
1128
+ "Content-Type": "application/json",
1129
+ Authorization: `Bearer ${a.apiKey}`,
1130
+ "X-Meilisearch-Client": "Meilisearch JavaScript (v0.41.0)"
1131
+ };
1132
+ }
1133
+ /**
1134
+ * Update headers from MeiliSearch client object
1135
+ * This allows you to use the exact headers from your console logs
1136
+ */
1137
+ updateHeadersFromClient(a) {
1138
+ a && a.httpRequest && a.httpRequest.headers && (this.headers = {
1139
+ "Content-Type": a.httpRequest.headers["Content-Type"] || "application/json",
1140
+ Authorization: a.httpRequest.headers.Authorization || `Bearer ${this.config.apiKey}`,
1141
+ "X-Meilisearch-Client": a.httpRequest.headers["X-Meilisearch-Client"] || "Meilisearch JavaScript (v0.41.0)"
1142
+ });
1143
+ }
1144
+ /**
1145
+ * Performs a search using MeiliSearch multi-search API
1146
+ * This matches the exact payload structure from your console logs
1147
+ */
1148
+ async search(a, s = {}) {
1149
+ const {
1150
+ limit: n = 20,
1151
+ offset: b = 0,
1152
+ filter: m = ['type = "course_block"'],
1153
+ attributesToHighlight: w = ["display_name", "description", "published"],
1154
+ attributesToCrop: p = ["description", "published"],
1155
+ sort: g = []
1156
+ } = s;
1157
+ if (!this.config.indexName)
1158
+ throw new Error("MeiliSearch indexName is required");
1159
+ const c = {
1160
+ queries: [
1161
+ {
1162
+ indexUid: this.config.indexName,
1163
+ q: a,
1164
+ filter: [[], ...m],
1165
+ attributesToHighlight: w,
1166
+ highlightPreTag: "__meili-highlight__",
1167
+ highlightPostTag: "__/meili-highlight__",
1168
+ attributesToCrop: p,
1169
+ sort: g,
1170
+ offset: b,
1171
+ limit: n
1172
+ },
1173
+ {
1174
+ indexUid: this.config.indexName,
1175
+ facets: ["block_type", "content.problem_types"],
1176
+ filter: m,
1177
+ limit: 0
1178
+ }
1179
+ ]
1180
+ }, o = { ...this.headers };
1181
+ try {
1182
+ const d = await fetch(`${this.config.host}/multi-search`, {
1183
+ method: "POST",
1184
+ headers: o,
1185
+ body: JSON.stringify(c)
1186
+ });
1187
+ if (!d.ok)
1188
+ throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);
1189
+ const f = await d.json(), x = f.results[0], u = f.results[1];
1190
+ return {
1191
+ hits: x.hits || [],
1192
+ totalHits: x.estimatedTotalHits || 0,
1193
+ facets: u.facetDistribution,
1194
+ processingTimeMs: x.processingTimeMs
1195
+ };
1196
+ } catch (d) {
1197
+ throw console.error("MeiliSearch service error:", d), new Error(`Search failed: ${d instanceof Error ? d.message : "Unknown error"}`);
1198
+ }
1199
+ }
1200
+ /**
1201
+ * Performs a simple search without facets (for basic search functionality)
1202
+ */
1203
+ async simpleSearch(a, s = {}) {
1204
+ const {
1205
+ limit: n = 20,
1206
+ offset: b = 0,
1207
+ filter: m = ['type = "course_block"'],
1208
+ attributesToHighlight: w = ["display_name", "description", "published"],
1209
+ attributesToCrop: p = ["description", "published"],
1210
+ sort: g = []
1211
+ } = s, c = {
1212
+ queries: [
1213
+ {
1214
+ indexUid: this.config.indexName,
1215
+ q: a,
1216
+ filter: [[], ...m],
1217
+ attributesToHighlight: w,
1218
+ highlightPreTag: "__meili-highlight__",
1219
+ highlightPostTag: "__/meili-highlight__",
1220
+ attributesToCrop: p,
1221
+ sort: g,
1222
+ offset: b,
1223
+ limit: n
1224
+ }
1225
+ ]
1226
+ }, o = { ...this.headers };
1227
+ try {
1228
+ const d = await fetch(`${this.config.host}/multi-search`, {
1229
+ method: "POST",
1230
+ headers: o,
1231
+ body: JSON.stringify(c)
1232
+ });
1233
+ if (!d.ok)
1234
+ throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);
1235
+ const x = (await d.json()).results[0];
1236
+ return {
1237
+ hits: x.hits || [],
1238
+ totalHits: x.estimatedTotalHits || 0,
1239
+ processingTimeMs: x.processingTimeMs
1240
+ };
1241
+ } catch (d) {
1242
+ throw console.error("MeiliSearch service error:", d), new Error(`Search failed: ${d instanceof Error ? d.message : "Unknown error"}`);
1243
+ }
1244
+ }
1245
+ /**
1246
+ * Check if the MeiliSearch service is available
1247
+ */
1248
+ async checkConnection() {
1249
+ try {
1250
+ return (await fetch(`${this.config.host}/health`, {
1251
+ method: "GET",
1252
+ headers: {
1253
+ Authorization: `Bearer ${this.config.apiKey}`,
1254
+ "X-Meilisearch-Client": "Meilisearch JavaScript (v0.41.0)"
1255
+ }
1256
+ })).ok;
1257
+ } catch (a) {
1258
+ return console.error("MeiliSearch connection check failed:", a), !1;
1259
+ }
1260
+ }
1261
+ }
1262
+ const mr = (t) => new Br(t);
1263
+ function gr(t, a) {
1264
+ const { contextKey: s, usageKey: n } = t;
1265
+ return s ? s.startsWith("course-v1:") ? `${a || ""}/course/${s}?show=${encodeURIComponent(n || "")}` : s.startsWith("library-v1:") ? `${a || ""}/library/${s}` : "#" : "#";
1266
+ }
1267
+ function et(t, a, s) {
1268
+ const n = gr(t, a);
1269
+ return n === "#" ? (console.warn("Could not generate URL for search hit:", t), "#") : (s ? s(n) : (n.startsWith("http"), window.location.href = n), n);
1270
+ }
1271
+ const ar = ({
1272
+ text: t,
1273
+ highlightTag: a = "__meili-highlight__"
1274
+ }) => {
1275
+ if (!t) return null;
1276
+ const s = "__/meili-highlight__", n = t.split(a), b = [];
1277
+ return n.forEach((m, w) => {
1278
+ if (w === 0)
1279
+ m && b.push(m);
1280
+ else {
1281
+ const p = m.indexOf(s);
1282
+ if (p !== -1) {
1283
+ const g = m.substring(0, p), c = m.substring(p + s.length);
1284
+ g && b.push(
1285
+ /* @__PURE__ */ r.jsx("mark", { className: "search-highlight", children: g }, `highlight-${w}`)
1286
+ ), c && b.push(c);
1287
+ } else
1288
+ b.push(
1289
+ /* @__PURE__ */ r.jsx("mark", { className: "search-highlight", children: m }, `highlight-${w}`)
1290
+ );
1291
+ }
1292
+ }), /* @__PURE__ */ r.jsx(r.Fragment, { children: b });
1293
+ };
1294
+ function rt(t) {
1295
+ return {
1296
+ html: "text",
1297
+ video: "video",
1298
+ problem: "quiz",
1299
+ vertical: "folder",
1300
+ sequential: "folder",
1301
+ chapter: "folder",
1302
+ about: "info",
1303
+ static_tab: "text",
1304
+ openassessment: "quiz",
1305
+ lti_consumer: "link",
1306
+ pdf: "file",
1307
+ scorm: "file",
1308
+ itembank: "library",
1309
+ library_content: "library"
1310
+ }[t] || "text";
1311
+ }
1312
+ const or = ({
1313
+ result: t,
1314
+ onNavigate: a,
1315
+ baseUrl: s
1316
+ }) => {
1317
+ var g, c;
1318
+ const n = (o) => {
1319
+ var x;
1320
+ o.preventDefault(), o.stopPropagation();
1321
+ const d = {
1322
+ id: t.id,
1323
+ blockType: t.block_type || t.type,
1324
+ contextKey: t.context_key,
1325
+ // Use the actual context_key from MeiliSearch
1326
+ usageKey: t.usage_key,
1327
+ // Use the actual usage_key from MeiliSearch
1328
+ breadcrumbs: ((x = t.breadcrumbs) == null ? void 0 : x.map((u) => ({
1329
+ displayName: u.display_name,
1330
+ usageKey: u.usage_key
1331
+ }))) || []
1332
+ };
1333
+ if (t.url) {
1334
+ a ? a(t.url) : window.location.href = t.url;
1335
+ return;
1336
+ }
1337
+ et(d, s, a) === "#" && (a ? a(`/search-result/${t.id}`) : window.location.href = `/search-result/${t.id}`);
1338
+ }, b = (o) => {
1339
+ var x;
1340
+ o.preventDefault(), o.stopPropagation();
1341
+ const d = {
1342
+ id: t.id,
1343
+ blockType: t.block_type || t.type,
1344
+ contextKey: t.context_key,
1345
+ usageKey: t.usage_key,
1346
+ breadcrumbs: ((x = t.breadcrumbs) == null ? void 0 : x.map((u) => ({
1347
+ displayName: u.display_name,
1348
+ usageKey: u.usage_key
1349
+ }))) || []
1350
+ }, f = gr(d, s);
1351
+ f && f !== "#" && window.open(f, "_blank");
1352
+ }, m = ((g = t._formatted) == null ? void 0 : g.display_name) || t.display_name, w = ((c = t._formatted) == null ? void 0 : c.description) || t.description, p = t.block_type || t.type;
1353
+ return /* @__PURE__ */ r.jsx(
1354
+ "div",
1355
+ {
1356
+ className: "search-result-item",
1357
+ onClick: n,
1358
+ role: "button",
1359
+ tabIndex: 0,
1360
+ onKeyDown: (o) => {
1361
+ (o.key === "Enter" || o.key === " ") && n(o);
1362
+ },
1363
+ children: /* @__PURE__ */ r.jsxs("div", { className: "search-result-content", children: [
1364
+ /* @__PURE__ */ r.jsx("div", { className: "search-result-icon", children: /* @__PURE__ */ r.jsx(Z, { src: rt(p) }) }),
1365
+ /* @__PURE__ */ r.jsxs("div", { className: "search-result-text", children: [
1366
+ /* @__PURE__ */ r.jsx("div", { className: "search-result-title", children: /* @__PURE__ */ r.jsx(ar, { text: m }) }),
1367
+ w && /* @__PURE__ */ r.jsx("div", { className: "search-result-description", children: /* @__PURE__ */ r.jsx(ar, { text: w }) }),
1368
+ t.breadcrumbs && t.breadcrumbs.length > 0 && /* @__PURE__ */ r.jsx("div", { className: "search-result-breadcrumbs", children: t.breadcrumbs.map((o) => o.display_name).join(" / ") })
1369
+ ] }),
1370
+ /* @__PURE__ */ r.jsx("div", { className: "search-result-actions", children: /* @__PURE__ */ r.jsx(
1371
+ Ce,
1372
+ {
1373
+ src: Wr,
1374
+ iconAs: Z,
1375
+ onClick: b,
1376
+ alt: "Open in new window",
1377
+ size: "sm"
1378
+ }
1379
+ ) })
1380
+ ] })
1381
+ }
1382
+ );
1383
+ }, cr = new Qr(), ot = ({
1384
+ logoUrl: t,
1385
+ menuList: a,
1386
+ loginSignupButtons: s,
1387
+ authenticatedUser: n = null,
1388
+ userMenuItems: b,
1389
+ menuAlignment: m,
1390
+ onLanguageChange: w,
1391
+ getBaseUrl: p,
1392
+ meiliSearchConfig: g,
1393
+ headerButtons: c,
1394
+ languageSelectorList: o
1395
+ }) => {
1396
+ const d = qr(), { toggleSidebar: f, setSidebarCollapsed: x } = pr(), [u, P] = k(() => cr.get("openedx-language-preference") || "en"), [J, j] = k(!1), [I, S] = k(!1), [U, $] = k(!1), [G, L] = k(""), [C, X] = k([]), [re, H] = k(!1), [D, q] = k(null), [M, z] = k(0), [E, F] = k(!1), [K, Q] = k(5), ue = Se(null), Y = Se(null), ae = Se(g ? mr(g) : null);
1397
+ console.log("languageSelectorList", o), ie(() => {
1398
+ g != null && g.client && ae.current && ae.current.updateHeadersFromClient(g.client);
1399
+ }, [g == null ? void 0 : g.client]), ie(() => () => {
1400
+ Y.current && clearTimeout(Y.current);
1401
+ }, []), ie(() => {
1402
+ document.body.dir = u === "ar" ? "rtl" : "ltr";
1403
+ }, [u]), ie(() => {
1404
+ d && x(!0);
1405
+ }, [d, x]), ie(() => {
1406
+ if (!I) return;
1407
+ function h(N) {
1408
+ ue.current && !ue.current.contains(N.target) && S(!1);
1409
+ }
1410
+ return document.addEventListener("mousedown", h), () => {
1411
+ document.removeEventListener("mousedown", h);
1412
+ };
1413
+ }, [I]);
1414
+ const oe = (h) => {
1415
+ P(h), cr.set("openedx-language-preference", h, {
1416
+ path: p ? p() : "/"
1417
+ // secure: process.env.NODE_ENV === 'production',
1418
+ // sameSite: 'strict'
1419
+ }), w && w();
1420
+ }, Re = m && {
1421
+ left: "justify-content-start",
1422
+ center: "justify-content-center",
1423
+ right: "justify-content-end"
1424
+ }[m.toLowerCase()] || "justify-content-start", de = async (h) => {
1425
+ if (!h.trim() || !g || !ae.current) {
1426
+ X([]), z(0), $(!1), F(!1);
1427
+ return;
1428
+ }
1429
+ H(!0), q(null), $(!1), Q(5);
1430
+ try {
1431
+ const N = await ae.current.simpleSearch(h, {
1432
+ limit: 20,
1433
+ offset: 0
1434
+ });
1435
+ X(N.hits), z(N.totalHits), $(N.totalHits === 0), F(!0);
1436
+ } catch (N) {
1437
+ q(N instanceof Error ? N.message : "Search failed"), $(!0), X([]), z(0);
1438
+ } finally {
1439
+ H(!1);
1440
+ }
1441
+ }, fe = (h) => {
1442
+ L(h), de(h), d && J && j(!1);
1443
+ }, ce = (h) => {
1444
+ L(h), U && h.trim() === "" && ($(!1), F(!1)), Y.current && clearTimeout(Y.current), h.trim().length > 0 ? Y.current = setTimeout(() => {
1445
+ de(h);
1446
+ }, 500) : (X([]), z(0), $(!1), F(!1));
1447
+ }, he = () => {
1448
+ Y.current && (clearTimeout(Y.current), Y.current = null), L(""), X([]), z(0), $(!1), F(!1), q(null), H(!1);
1449
+ }, le = () => {
1450
+ L(""), X([]), z(0), $(!1), F(!1), q(null), H(!1), Q(5), Y.current && (clearTimeout(Y.current), Y.current = null);
1451
+ }, ye = () => {
1452
+ Q((h) => Math.min(h + 10, C.length));
1453
+ }, xe = (h) => {
1454
+ if (o && o.length > 0) {
1455
+ const B = o.find((pe) => pe[h]);
1456
+ if (B)
1457
+ return B[h];
1458
+ }
1459
+ return {
1460
+ en: "English",
1461
+ ar: "Arabic",
1462
+ hi: "Hindi"
1463
+ }[h] || h.toUpperCase();
1464
+ }, be = () => (console.log("renderLanguageOptions - languageSelectorList:", o), console.log("renderLanguageOptions - length:", o == null ? void 0 : o.length), o && o.length > 0 ? (console.log("Using custom languageSelectorList"), o.map((h, N) => {
1465
+ const [B, pe] = Object.entries(h)[0];
1466
+ return /* @__PURE__ */ r.jsx(ee.Item, { onClick: () => oe(B), children: pe }, `lang-${B}-${N}`);
1467
+ })) : (console.log("Using fallback languages"), /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1468
+ /* @__PURE__ */ r.jsx(ee.Item, { onClick: () => oe("en"), children: "English" }),
1469
+ /* @__PURE__ */ r.jsx(ee.Item, { onClick: () => oe("ar"), children: "Arabic" }),
1470
+ /* @__PURE__ */ r.jsx(ee.Item, { onClick: () => oe("hi"), children: "Hindi" })
1471
+ ] })));
1472
+ return /* @__PURE__ */ r.jsxs(_e, { expand: "lg", className: "navbarContainer py-1", children: [
1473
+ /* @__PURE__ */ r.jsxs("div", { className: "d-flex align-items-center", children: [
1474
+ /* @__PURE__ */ r.jsx("div", { className: "toggle-sidebar-icon", children: /* @__PURE__ */ r.jsx(
1475
+ Ce,
1476
+ {
1477
+ src: Fr,
1478
+ iconAs: Z,
1479
+ alt: "Toggle Sidebar",
1480
+ onClick: f,
1481
+ className: "ms-2 ml-2",
1482
+ onMouseDown: (h) => h.stopPropagation()
1483
+ }
1484
+ ) }),
1485
+ /* @__PURE__ */ r.jsx(_e.Brand, { href: "/", className: "navbar-brand", children: /* @__PURE__ */ r.jsx(
1486
+ "img",
1487
+ {
1488
+ src: t,
1489
+ alt: "Logo"
1490
+ }
1491
+ ) })
1492
+ ] }),
1493
+ n !== null && /* @__PURE__ */ r.jsx(r.Fragment, { children: d ? /* @__PURE__ */ r.jsx("div", { className: "d-flex justify-content-between align-items-center ml-auto", children: /* @__PURE__ */ r.jsxs("div", { className: "d-flex align-items-center navbar-buttons", children: [
1494
+ g && /* @__PURE__ */ r.jsx(
1495
+ Ce,
1496
+ {
1497
+ src: Yr,
1498
+ iconAs: Z,
1499
+ alt: "Search",
1500
+ onClick: () => j(!0)
1501
+ }
1502
+ ),
1503
+ /* @__PURE__ */ r.jsx("div", { className: "ml-2 usermenu-dropdown-mobile", children: /* @__PURE__ */ r.jsx(
1504
+ ir,
1505
+ {
1506
+ username: n == null ? void 0 : n.username,
1507
+ authenticatedUserAvatar: n == null ? void 0 : n.avatar,
1508
+ isMobile: d,
1509
+ isAdmin: n == null ? void 0 : n.administrator,
1510
+ menuItems: b
1511
+ }
1512
+ ) }),
1513
+ /* @__PURE__ */ r.jsx(
1514
+ Ce,
1515
+ {
1516
+ src: Kr,
1517
+ iconAs: Z,
1518
+ alt: "More",
1519
+ onMouseDown: (h) => h.stopPropagation(),
1520
+ onClick: () => S((h) => !h)
1521
+ }
1522
+ ),
1523
+ I && /* @__PURE__ */ r.jsxs("div", { className: "more-menu-dropdown", ref: ue, children: [
1524
+ /* @__PURE__ */ r.jsxs("div", { className: "more-menu-icons-row", children: [
1525
+ (c == null ? void 0 : c.reSync) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: nr, iconAs: Z, alt: "Sync", tooltipPlacement: "bottom", tooltipContent: "Re-Sync" }) }),
1526
+ (c == null ? void 0 : c.contextSwitcher) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: er, iconAs: Z, alt: "Sync", tooltipPlacement: "bottom", tooltipContent: "Switch to User Mode" }) }),
1527
+ (c == null ? void 0 : c.help) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: rr, iconAs: Z, alt: "Help", tooltipPlacement: "bottom", tooltipContent: "Help" }) }),
1528
+ (c == null ? void 0 : c.notification) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: tr, iconAs: Z, alt: "Notifications", tooltipPlacement: "bottom", tooltipContent: "Notifications" }) })
1529
+ ] }),
1530
+ (c == null ? void 0 : c.translation) && /* @__PURE__ */ r.jsxs(ee, { className: "language-dropdown", children: [
1531
+ /* @__PURE__ */ r.jsx(ee.Toggle, { variant: "tertiary", id: "language-dropdown", children: xe(u) }),
1532
+ /* @__PURE__ */ r.jsx(ee.Menu, { children: be() })
1533
+ ] })
1534
+ ] })
1535
+ ] }) }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1536
+ g && /* @__PURE__ */ r.jsx("div", { className: "d-flex align-items-center justify-content-start flex-grow-1 ml-4", children: /* @__PURE__ */ r.jsxs("div", { style: { width: "30rem", position: "relative" }, children: [
1537
+ /* @__PURE__ */ r.jsxs("div", { style: {
1538
+ display: "flex",
1539
+ alignItems: "center",
1540
+ border: "2px solid #ccc",
1541
+ borderRadius: "25px",
1542
+ padding: "8px 16px",
1543
+ background: "#fff",
1544
+ position: "relative"
1545
+ }, children: [
1546
+ /* @__PURE__ */ r.jsx(
1547
+ "input",
1548
+ {
1549
+ type: "text",
1550
+ value: G,
1551
+ onChange: (h) => {
1552
+ ce(h.target.value);
1553
+ },
1554
+ onKeyDown: (h) => {
1555
+ h.key === "Enter" && fe(G);
1556
+ },
1557
+ placeholder: "Search",
1558
+ style: {
1559
+ flex: 1,
1560
+ border: "none",
1561
+ outline: "none",
1562
+ fontSize: "16px",
1563
+ background: "transparent",
1564
+ padding: "4px"
1565
+ },
1566
+ autoComplete: "off"
1567
+ }
1568
+ ),
1569
+ G && /* @__PURE__ */ r.jsx(
1570
+ "button",
1571
+ {
1572
+ type: "button",
1573
+ onClick: () => {
1574
+ he();
1575
+ },
1576
+ style: {
1577
+ background: "none",
1578
+ border: "none",
1579
+ cursor: "pointer",
1580
+ padding: "4px",
1581
+ marginRight: "8px"
1582
+ },
1583
+ children: "✕"
1584
+ }
1585
+ )
1586
+ ] }),
1587
+ re && /* @__PURE__ */ r.jsxs("div", { className: "search-loading-spinner-container", children: [
1588
+ /* @__PURE__ */ r.jsx("div", { className: "search-loading-spinner" }),
1589
+ /* @__PURE__ */ r.jsx("span", { children: "Searching..." })
1590
+ ] }),
1591
+ U && !re && /* @__PURE__ */ r.jsx("div", { className: "no-results-message-desktop", children: /* @__PURE__ */ r.jsx("p", { children: "We didn't find anything matching your search" }) }),
1592
+ D && /* @__PURE__ */ r.jsx("div", { className: "search-error-message-desktop", children: /* @__PURE__ */ r.jsxs("p", { children: [
1593
+ "Search error: ",
1594
+ D
1595
+ ] }) }),
1596
+ E && C.length > 0 && /* @__PURE__ */ r.jsxs("div", { className: "search-results-dropdown", children: [
1597
+ /* @__PURE__ */ r.jsx("div", { className: "search-results-header", children: /* @__PURE__ */ r.jsxs("span", { children: [
1598
+ M,
1599
+ " result",
1600
+ M !== 1 ? "s" : "",
1601
+ " found"
1602
+ ] }) }),
1603
+ /* @__PURE__ */ r.jsxs("div", { className: "search-results-list", children: [
1604
+ C.slice(0, K).map((h, N) => /* @__PURE__ */ r.jsx(
1605
+ or,
1606
+ {
1607
+ result: h,
1608
+ onNavigate: (B) => {
1609
+ le(), window.location.href = B;
1610
+ },
1611
+ baseUrl: p ? p() : void 0
1612
+ },
1613
+ h.id || N
1614
+ )),
1615
+ K < C.length && /* @__PURE__ */ r.jsx("div", { className: "search-results-more", children: /* @__PURE__ */ r.jsxs(
1616
+ "button",
1617
+ {
1618
+ onClick: ye,
1619
+ style: {
1620
+ background: "none",
1621
+ border: "none",
1622
+ color: "#007bff",
1623
+ cursor: "pointer",
1624
+ padding: "8px 16px",
1625
+ width: "100%",
1626
+ textAlign: "center",
1627
+ fontSize: "14px"
1628
+ },
1629
+ children: [
1630
+ "Show ",
1631
+ Math.min(10, C.length - K),
1632
+ " more results"
1633
+ ]
1634
+ }
1635
+ ) })
1636
+ ] })
1637
+ ] })
1638
+ ] }) }),
1639
+ /* @__PURE__ */ r.jsxs("div", { className: "d-flex align-items-center gap-2 ms-auto order-lg-3", children: [
1640
+ (c == null ? void 0 : c.reSync) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: nr, iconAs: Z, alt: "Sync", tooltipPlacement: "bottom", tooltipContent: "Re-Sync" }) }),
1641
+ (c == null ? void 0 : c.contextSwitcher) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: er, iconAs: Z, alt: "Sync", tooltipPlacement: "bottom", tooltipContent: "Switch to User Mode" }) }),
1642
+ (c == null ? void 0 : c.help) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: rr, iconAs: Z, alt: "Help", tooltipPlacement: "bottom", tooltipContent: "Help" }) }),
1643
+ (c == null ? void 0 : c.notification) && /* @__PURE__ */ r.jsx("div", { className: "icon-curved-square", children: /* @__PURE__ */ r.jsx(se, { src: tr, iconAs: Z, alt: "Notifications", tooltipPlacement: "bottom", tooltipContent: "Notifications" }) }),
1644
+ (c == null ? void 0 : c.translation) && /* @__PURE__ */ r.jsxs(ee, { className: "language-dropdown", children: [
1645
+ /* @__PURE__ */ r.jsx(ee.Toggle, { variant: "tertiary", id: "language-dropdown", children: xe(u) }),
1646
+ /* @__PURE__ */ r.jsx(ee.Menu, { children: be() })
1647
+ ] }),
1648
+ /* @__PURE__ */ r.jsx("div", { className: "usermenu-dropdown", children: /* @__PURE__ */ r.jsx(
1649
+ ir,
1650
+ {
1651
+ username: n == null ? void 0 : n.username,
1652
+ authenticatedUserAvatar: n == null ? void 0 : n.avatar,
1653
+ isMobile: d,
1654
+ isAdmin: n == null ? void 0 : n.administrator,
1655
+ menuItems: b
1656
+ }
1657
+ ) })
1658
+ ] })
1659
+ ] }) }),
1660
+ n === null && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1661
+ /* @__PURE__ */ r.jsx(_e.Toggle, { "aria-controls": "main-navbar-nav" }),
1662
+ /* @__PURE__ */ r.jsx("div", { className: "d-flex align-items-center gap-2 ms-auto order-lg-3", children: s && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1663
+ /* @__PURE__ */ r.jsx($e, { variant: "primary", children: "Log In" }),
1664
+ /* @__PURE__ */ r.jsx($e, { variant: "outline-primary", children: "Sign Up" })
1665
+ ] }) })
1666
+ ] }),
1667
+ /* @__PURE__ */ r.jsx(_e.Collapse, { id: "main-navbar-nav", className: "justify-content-between", children: /* @__PURE__ */ r.jsx(Ue, { className: `nav-gap gap-3 flex-grow-1 ${Re}`, children: n === null && a.map((h) => h.subMenu ? /* @__PURE__ */ r.jsx(Ge, { title: h.label, id: `nav-dropdown-${h.label}`, children: h.subMenu.map((N) => /* @__PURE__ */ r.jsx(Ge.Item, { onClick: () => console.log("Selected submenu:", N.label), children: N.label }, `sub-${N.label}`)) }, `menu-${h.label}`) : /* @__PURE__ */ r.jsx(Ue.Link, { as: "span", className: "text-uppercase fw-semibold", children: h.label }, `menu-${h.label}`)) }) }),
1668
+ g && J && /* @__PURE__ */ r.jsxs("div", { className: "fixed-search-bar", children: [
1669
+ /* @__PURE__ */ r.jsxs("div", { className: "fixed-search-bar-inner", children: [
1670
+ /* @__PURE__ */ r.jsxs("div", { style: {
1671
+ display: "flex",
1672
+ alignItems: "center",
1673
+ border: "2px solid #ccc",
1674
+ borderRadius: "25px",
1675
+ padding: "12px 16px",
1676
+ background: "#fff",
1677
+ position: "relative",
1678
+ width: "100%"
1679
+ }, children: [
1680
+ /* @__PURE__ */ r.jsx(
1681
+ "input",
1682
+ {
1683
+ type: "text",
1684
+ value: G,
1685
+ onChange: (h) => {
1686
+ ce(h.target.value);
1687
+ },
1688
+ onKeyDown: (h) => {
1689
+ h.key === "Enter" && fe(G);
1690
+ },
1691
+ placeholder: "Search",
1692
+ style: {
1693
+ flex: 1,
1694
+ border: "none",
1695
+ outline: "none",
1696
+ fontSize: "18px",
1697
+ background: "transparent",
1698
+ padding: "4px"
1699
+ },
1700
+ autoComplete: "off",
1701
+ autoFocus: !0
1702
+ }
1703
+ ),
1704
+ G && /* @__PURE__ */ r.jsx(
1705
+ "button",
1706
+ {
1707
+ type: "button",
1708
+ onClick: () => {
1709
+ he();
1710
+ },
1711
+ style: {
1712
+ background: "none",
1713
+ border: "none",
1714
+ cursor: "pointer",
1715
+ padding: "4px",
1716
+ marginRight: "8px",
1717
+ fontSize: "18px"
1718
+ },
1719
+ children: "✕"
1720
+ }
1721
+ )
1722
+ ] }),
1723
+ /* @__PURE__ */ r.jsx("button", { className: "close-search-bar", type: "button", onClick: () => j(!1), "aria-label": "Close Search", children: "×" })
1724
+ ] }),
1725
+ re && /* @__PURE__ */ r.jsxs("div", { className: "search-loading-spinner-container", children: [
1726
+ /* @__PURE__ */ r.jsx("div", { className: "search-loading-spinner" }),
1727
+ /* @__PURE__ */ r.jsx("span", { children: "Searching..." })
1728
+ ] }),
1729
+ U && !re && /* @__PURE__ */ r.jsx("div", { className: "no-results-message", children: /* @__PURE__ */ r.jsx("p", { children: "We didn't find anything matching your search" }) }),
1730
+ D && /* @__PURE__ */ r.jsx("div", { className: "search-error-message", children: /* @__PURE__ */ r.jsxs("p", { children: [
1731
+ "Search error: ",
1732
+ D
1733
+ ] }) }),
1734
+ E && C.length > 0 && /* @__PURE__ */ r.jsxs("div", { className: "search-results-mobile", children: [
1735
+ /* @__PURE__ */ r.jsx("div", { className: "search-results-header", children: /* @__PURE__ */ r.jsxs("span", { children: [
1736
+ M,
1737
+ " result",
1738
+ M !== 1 ? "s" : "",
1739
+ " found"
1740
+ ] }) }),
1741
+ /* @__PURE__ */ r.jsxs("div", { className: "search-results-list", children: [
1742
+ C.slice(0, K).map((h, N) => /* @__PURE__ */ r.jsx(
1743
+ or,
1744
+ {
1745
+ result: h,
1746
+ onNavigate: (B) => {
1747
+ le(), window.location.href = B;
1748
+ },
1749
+ baseUrl: p ? p() : void 0
1750
+ },
1751
+ h.id || N
1752
+ )),
1753
+ K < C.length && /* @__PURE__ */ r.jsx("div", { className: "search-results-more", children: /* @__PURE__ */ r.jsxs(
1754
+ "button",
1755
+ {
1756
+ onClick: ye,
1757
+ style: {
1758
+ background: "none",
1759
+ border: "none",
1760
+ color: "#007bff",
1761
+ cursor: "pointer",
1762
+ padding: "12px 16px",
1763
+ width: "100%",
1764
+ textAlign: "center",
1765
+ fontSize: "16px"
1766
+ },
1767
+ children: [
1768
+ "Show ",
1769
+ Math.min(10, C.length - K),
1770
+ " more results"
1771
+ ]
1772
+ }
1773
+ ) })
1774
+ ] })
1775
+ ] })
1776
+ ] })
1777
+ ] });
1778
+ }, vr = ur(void 0), ct = ({ children: t, meiliSearchConfig: a }) => {
1779
+ const [s, n] = k(""), [b, m] = k([]), [w, p] = k(0), [g, c] = k(!1), [o, d] = k(!1), [f, x] = k(null), [u, P] = k(0), [J, j] = k(!1), [I, S] = k(!1), [U, $] = k(null), G = mr(a), L = async (H) => {
1780
+ if (!H.trim()) {
1781
+ X();
1782
+ return;
1783
+ }
1784
+ c(!0), d(!1), x(null), P(0);
1785
+ try {
1786
+ const D = await G.search(H, {
1787
+ limit: 20,
1788
+ offset: 0
1789
+ }), q = D.hits.map((E) => {
1790
+ var F, K, Q;
1791
+ return {
1792
+ id: E.id,
1793
+ title: ((F = E._formatted) == null ? void 0 : F.display_name) || E.display_name,
1794
+ type: E.type,
1795
+ url: E.url,
1796
+ description: ((K = E._formatted) == null ? void 0 : K.description) || E.description,
1797
+ block_type: E.block_type,
1798
+ published: ((Q = E._formatted) == null ? void 0 : Q.published) || E.published,
1799
+ _formatted: E._formatted
1800
+ };
1801
+ }), M = D.totalHits, z = q.length === 20 && M > q.length;
1802
+ m(q), p(M), j(z), $(D.facets || null);
1803
+ } catch (D) {
1804
+ console.error("Search error:", D), d(!0), x(D instanceof Error ? D.message : "Search failed"), m([]), p(0), j(!1), $(null);
1805
+ } finally {
1806
+ c(!1);
1807
+ }
1808
+ }, C = async () => {
1809
+ if (!(!J || I)) {
1810
+ S(!0);
1811
+ try {
1812
+ const H = u + 20, D = await G.simpleSearch(s, {
1813
+ limit: 20,
1814
+ offset: H
1815
+ }), q = D.hits.map((E) => {
1816
+ var F, K, Q;
1817
+ return {
1818
+ id: E.id,
1819
+ title: ((F = E._formatted) == null ? void 0 : F.display_name) || E.display_name,
1820
+ type: E.type,
1821
+ url: E.url,
1822
+ description: ((K = E._formatted) == null ? void 0 : K.description) || E.description,
1823
+ block_type: E.block_type,
1824
+ published: ((Q = E._formatted) == null ? void 0 : Q.published) || E.published,
1825
+ _formatted: E._formatted
1826
+ };
1827
+ }), M = D.totalHits, z = q.length === 20 && M > b.length + q.length;
1828
+ m((E) => [...E, ...q]), p(M), j(z), P(H);
1829
+ } catch (H) {
1830
+ console.error("Error fetching next page:", H), d(!0), x(H instanceof Error ? H.message : "Failed to load more results");
1831
+ } finally {
1832
+ S(!1);
1833
+ }
1834
+ }
1835
+ }, X = () => {
1836
+ n(""), m([]), p(0), d(!1), x(null), P(0), j(!1), $(null);
1837
+ }, re = {
1838
+ searchKeywords: s,
1839
+ setSearchKeywords: n,
1840
+ searchResults: b,
1841
+ totalHits: w,
1842
+ isLoading: g,
1843
+ hasError: o,
1844
+ errorMessage: f,
1845
+ facets: U,
1846
+ performSearch: L,
1847
+ clearSearch: X,
1848
+ hasNextPage: J,
1849
+ fetchNextPage: C,
1850
+ isFetchingNextPage: I
1851
+ };
1852
+ return /* @__PURE__ */ r.jsx(vr.Provider, { value: re, children: t });
1853
+ }, lt = () => {
1854
+ const t = dr(vr);
1855
+ if (t === void 0)
1856
+ throw new Error("useSimpleSearch must be used within a SimpleSearchProvider");
1857
+ return t;
1858
+ };
1859
+ export {
1860
+ it as Footer,
1861
+ ot as MainHeader,
1862
+ at as Sidebar,
1863
+ st as SidebarProvider,
1864
+ ct as SimpleSearchProvider,
1865
+ pr as useSidebar,
1866
+ lt as useSimpleSearch
1867
+ };