titaned-frontend-library 1.0.10 → 1.0.11
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.
- package/dist/index.cjs +10 -10
- package/dist/index.js +812 -735
- package/package.json +1 -1
- package/src/components/common/Header/MainHeader.tsx +1 -1
- package/src/components/common/dynamicTheme/dynamicTheme.ts +195 -10
package/dist/index.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),b=require("@openedx/paragon");function jr(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const W=jr(_);var _e={exports:{}},pe={};/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
5
|
-
*/var Re,Ve;function tr(){if(Ve)return Re;Ve=1;var t=Object.getOwnPropertySymbols,
|
|
5
|
+
*/var Re,Ve;function tr(){if(Ve)return Re;Ve=1;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function i(p){if(p==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(p)}function v(){try{if(!Object.assign)return!1;var p=new String("abc");if(p[5]="de",Object.getOwnPropertyNames(p)[0]==="5")return!1;for(var j={},m=0;m<10;m++)j["_"+String.fromCharCode(m)]=m;var x=Object.getOwnPropertyNames(j).map(function(a){return j[a]});if(x.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(a){u[a]=a}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Re=v()?Object.assign:function(p,j){for(var m,x=i(p),u,a=1;a<arguments.length;a++){m=Object(arguments[a]);for(var d in m)n.call(m,d)&&(x[d]=m[d]);if(t){u=t(m);for(var l=0;l<u.length;l++)s.call(m,u[l])&&(x[u[l]]=m[u[l]])}}return x},Re}/** @license React v17.0.2
|
|
6
6
|
* react-jsx-runtime.production.min.js
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var We;function Er(){if(We)return pe;We=1,tr();var t=
|
|
12
|
+
*/var We;function Er(){if(We)return pe;We=1,tr();var t=_,n=60103;if(pe.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var s=Symbol.for;n=s("react.element"),pe.Fragment=s("react.fragment")}var i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};function j(m,x,u){var a,d={},l=null,f=null;u!==void 0&&(l=""+u),x.key!==void 0&&(l=""+x.key),x.ref!==void 0&&(f=x.ref);for(a in x)v.call(x,a)&&!p.hasOwnProperty(a)&&(d[a]=x[a]);if(m&&m.defaultProps)for(a in x=m.defaultProps,x)d[a]===void 0&&(d[a]=x[a]);return{$$typeof:n,type:m,key:l,ref:f,props:d,_owner:i.current}}return pe.jsx=j,pe.jsxs=j,pe}var ke={};/** @license React v17.0.2
|
|
13
13
|
* react-jsx-runtime.development.js
|
|
14
14
|
*
|
|
15
15
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var Ke;function Sr(){return Ke||(Ke=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){var
|
|
20
|
-
`+ue+e}}var de=!1,
|
|
21
|
-
`),
|
|
22
|
-
`),
|
|
23
|
-
`+
|
|
19
|
+
*/var Ke;function Sr(){return Ke||(Ke=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){var n=_,s=tr(),i=60103,v=60106;t.Fragment=60107;var p=60108,j=60114,m=60109,x=60110,u=60112,a=60113,d=60120,l=60115,f=60116,o=60121,S=60122,O=60117,y=60129,T=60131;if(typeof Symbol=="function"&&Symbol.for){var E=Symbol.for;i=E("react.element"),v=E("react.portal"),t.Fragment=E("react.fragment"),p=E("react.strict_mode"),j=E("react.profiler"),m=E("react.provider"),x=E("react.context"),u=E("react.forward_ref"),a=E("react.suspense"),d=E("react.suspense_list"),l=E("react.memo"),f=E("react.lazy"),o=E("react.block"),S=E("react.server.block"),O=E("react.fundamental"),E("react.scope"),E("react.opaque.id"),y=E("react.debug_trace_mode"),E("react.offscreen"),T=E("react.legacy_hidden")}var I=typeof Symbol=="function"&&Symbol.iterator,L="@@iterator";function Z(e){if(e===null||typeof e!="object")return null;var c=I&&e[I]||e[L];return typeof c=="function"?c:null}var z=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function N(e){{for(var c=arguments.length,h=new Array(c>1?c-1:0),w=1;w<c;w++)h[w-1]=arguments[w];Q("error",e,h)}}function Q(e,c,h){{var w=z.ReactDebugCurrentFrame,M=w.getStackAddendum();M!==""&&(c+="%s",h=h.concat([M]));var P=h.map(function(R){return""+R});P.unshift("Warning: "+c),Function.prototype.apply.call(console[e],console,P)}}var ee=!1;function q(e){return!!(typeof e=="string"||typeof e=="function"||e===t.Fragment||e===j||e===y||e===p||e===a||e===d||e===T||ee||typeof e=="object"&&e!==null&&(e.$$typeof===f||e.$$typeof===l||e.$$typeof===m||e.$$typeof===x||e.$$typeof===u||e.$$typeof===O||e.$$typeof===o||e[0]===S))}function F(e,c,h){var w=c.displayName||c.name||"";return e.displayName||(w!==""?h+"("+w+")":h)}function K(e){return e.displayName||"Context"}function H(e){if(e==null)return null;if(typeof e.tag=="number"&&N("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case t.Fragment:return"Fragment";case v:return"Portal";case j:return"Profiler";case p:return"StrictMode";case a:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var c=e;return K(c)+".Consumer";case m:var h=e;return K(h._context)+".Provider";case u:return F(e,e.render,"ForwardRef");case l:return H(e.type);case o:return H(e._render);case f:{var w=e,M=w._payload,P=w._init;try{return H(P(M))}catch{return null}}}return null}var V=0,k,Y,J,B,oe,G,ne;function ce(){}ce.__reactDisabledLog=!0;function le(){{if(V===0){k=console.log,Y=console.info,J=console.warn,B=console.error,oe=console.group,G=console.groupCollapsed,ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function Pe(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:s({},e,{value:k}),info:s({},e,{value:Y}),warn:s({},e,{value:J}),error:s({},e,{value:B}),group:s({},e,{value:oe}),groupCollapsed:s({},e,{value:G}),groupEnd:s({},e,{value:ne})})}V<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=z.ReactCurrentDispatcher,ue;function se(e,c,h){{if(ue===void 0)try{throw Error()}catch(M){var w=M.stack.trim().match(/\n( *(at )?)/);ue=w&&w[1]||""}return`
|
|
20
|
+
`+ue+e}}var de=!1,ie;{var ye=typeof WeakMap=="function"?WeakMap:Map;ie=new ye}function ge(e,c){if(!e||de)return"";{var h=ie.get(e);if(h!==void 0)return h}var w;de=!0;var M=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=me.current,me.current=null,le();try{if(c){var R=function(){throw Error()};if(Object.defineProperty(R.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(R,[])}catch(te){w=te}Reflect.construct(e,[],R)}else{try{R.call()}catch(te){w=te}e.call(R.prototype)}}else{try{throw Error()}catch(te){w=te}e()}}catch(te){if(te&&w&&typeof te.stack=="string"){for(var C=te.stack.split(`
|
|
21
|
+
`),U=w.stack.split(`
|
|
22
|
+
`),D=C.length-1,$=U.length-1;D>=1&&$>=0&&C[D]!==U[$];)$--;for(;D>=1&&$>=0;D--,$--)if(C[D]!==U[$]){if(D!==1||$!==1)do if(D--,$--,$<0||C[D]!==U[$]){var re=`
|
|
23
|
+
`+C[D].replace(" at new "," at ");return typeof e=="function"&&ie.set(e,re),re}while(D>=1&&$>=0);break}}}finally{de=!1,me.current=P,Pe(),Error.prepareStackTrace=M}var he=e?e.displayName||e.name:"",qe=he?se(he):"";return typeof e=="function"&&ie.set(e,qe),qe}function ve(e,c,h){return ge(e,!1)}function we(e){var c=e.prototype;return!!(c&&c.isReactComponent)}function ae(e,c,h){if(e==null)return"";if(typeof e=="function")return ge(e,we(e));if(typeof e=="string")return se(e);switch(e){case a:return se("Suspense");case d:return se("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return ve(e.render);case l:return ae(e.type,c,h);case o:return ve(e._render);case f:{var w=e,M=w._payload,P=w._init;try{return ae(P(M),c,h)}catch{}}}return""}var g={},A=z.ReactDebugCurrentFrame;function X(e){if(e){var c=e._owner,h=ae(e.type,e._source,c?c.type:null);A.setExtraStackFrame(h)}else A.setExtraStackFrame(null)}function xe(e,c,h,w,M){{var P=Function.call.bind(Object.prototype.hasOwnProperty);for(var R in e)if(P(e,R)){var C=void 0;try{if(typeof e[R]!="function"){var U=Error((w||"React class")+": "+h+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw U.name="Invariant Violation",U}C=e[R](c,R,w,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){C=D}C&&!(C instanceof Error)&&(X(M),N("%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).",w||"React class",h,R,typeof C),X(null)),C instanceof Error&&!(C.message in g)&&(g[C.message]=!0,X(M),N("Failed %s type: %s",h,C.message),X(null))}}}var Ie=z.ReactCurrentOwner,Ee=Object.prototype.hasOwnProperty,or={key:!0,ref:!0,__self:!0,__source:!0},Me,Ae;function cr(e){if(Ee.call(e,"ref")){var c=Object.getOwnPropertyDescriptor(e,"ref").get;if(c&&c.isReactWarning)return!1}return e.ref!==void 0}function lr(e){if(Ee.call(e,"key")){var c=Object.getOwnPropertyDescriptor(e,"key").get;if(c&&c.isReactWarning)return!1}return e.key!==void 0}function ur(e,c){typeof e.ref=="string"&&Ie.current}function dr(e,c){{var h=function(){Me||(Me=!0,N("%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)",c))};h.isReactWarning=!0,Object.defineProperty(e,"key",{get:h,configurable:!0})}}function fr(e,c){{var h=function(){Ae||(Ae=!0,N("%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)",c))};h.isReactWarning=!0,Object.defineProperty(e,"ref",{get:h,configurable:!0})}}var hr=function(e,c,h,w,M,P,R){var C={$$typeof:i,type:e,key:c,ref:h,props:R,_owner:P};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function pr(e,c,h,w,M){{var P,R={},C=null,U=null;h!==void 0&&(C=""+h),lr(c)&&(C=""+c.key),cr(c)&&(U=c.ref,ur(c,M));for(P in c)Ee.call(c,P)&&!or.hasOwnProperty(P)&&(R[P]=c[P]);if(e&&e.defaultProps){var D=e.defaultProps;for(P in D)R[P]===void 0&&(R[P]=D[P])}if(C||U){var $=typeof e=="function"?e.displayName||e.name||"Unknown":e;C&&dr(R,$),U&&fr(R,$)}return hr(e,C,U,M,w,Ie.current,R)}}var Se=z.ReactCurrentOwner,De=z.ReactDebugCurrentFrame;function fe(e){if(e){var c=e._owner,h=ae(e.type,e._source,c?c.type:null);De.setExtraStackFrame(h)}else De.setExtraStackFrame(null)}var Ce;Ce=!1;function Oe(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function $e(){{if(Se.current){var e=H(Se.current.type);if(e)return`
|
|
24
24
|
|
|
25
|
-
Check the render method of \``+e+"`."}return""}}function mr(e){return""}var
|
|
25
|
+
Check the render method of \``+e+"`."}return""}}function mr(e){return""}var He={};function gr(e){{var c=$e();if(!c){var h=typeof e=="string"?e:e.displayName||e.name;h&&(c=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+l+">.")}return a}}function He(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var l=gr(a);if(Le[l])return;Le[l]=!0;var b="";e&&e._owner&&e._owner!==Se.current&&(b=" It was passed a child from "+M(e._owner.type)+"."),fe(e),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',l,b),fe(null)}}function Fe(e,a){{if(typeof e!="object")return;if(Array.isArray(e))for(var l=0;l<e.length;l++){var b=e[l];Oe(b)&&He(b,a)}else if(Oe(e))e._store&&(e._store.validated=!0);else if(e){var T=Z(e);if(typeof T=="function"&&T!==e.entries)for(var k=T.call(e),S;!(S=k.next()).done;)Oe(S.value)&&He(S.value,a)}}}function vr(e){{var a=e.type;if(a==null||typeof a=="string")return;var l;if(typeof a=="function")l=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===o||a.$$typeof===f))l=a.propTypes;else return;if(l){var b=M(a);xe(l,e.props,"prop",b,e)}else if(a.PropTypes!==void 0&&!Ce){Ce=!0;var T=M(a);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xr(e){{for(var a=Object.keys(e.props),l=0;l<a.length;l++){var b=a[l];if(b!=="children"&&b!=="key"){fe(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),fe(null);break}}e.ref!==null&&(fe(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),fe(null))}}function ze(e,a,l,b,T,k){{var S=F(e);if(!S){var _="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=mr();Y?_+=Y:_+=$e();var P;e===null?P="null":Array.isArray(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(M(e.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,_)}var A=pr(e,a,l,T,k);if(A==null)return A;if(S){var re=a.children;if(re!==void 0)if(b)if(Array.isArray(re)){for(var he=0;he<re.length;he++)Fe(re[he],e);Object.freeze&&Object.freeze(re)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(re,e)}return e===t.Fragment?xr(A):vr(A),A}}function br(e,a,l){return ze(e,a,l,!0)}function wr(e,a,l){return ze(e,a,l,!1)}var yr=wr,jr=br;t.jsx=yr,t.jsxs=jr})()})(ke)),ke}var Ye;function Cr(){return Ye||(Ye=1,process.env.NODE_ENV==="production"?je.exports=Er():je.exports=Sr()),je.exports}var r=Cr();const Or=({contactInfo:t,quickLinks:s,exploreLinks:i,logoUrl:n,copyrights:x})=>{const p=j=>j??"left";return r.jsxs("footer",{className:"footer",children:[r.jsxs("div",{className:"container",children:[r.jsxs("div",{className:`section ${p(t.align)}`,children:[r.jsx("div",{className:"footer-brand-logo",children:r.jsx("img",{src:n,alt:"Logo"})}),r.jsx("p",{children:t.content.shortdesc}),r.jsxs("p",{children:[t.content.location.label,", ",t.content.location.value]}),r.jsxs("p",{children:["📞 ",t.content.phonenumber]})]}),r.jsx("div",{className:`section ${p(s.align)}`,children:r.jsxs("ul",{children:[r.jsx("h3",{children:"Quick Links"}),s.content.map((j,m)=>r.jsx("li",{children:r.jsx("a",{href:j.link,children:j.label})},m))]})}),r.jsx("div",{className:`section ${p(i.align)}`,children:r.jsxs("ul",{children:[r.jsx("h3",{children:"Explore"}),i.content.map((j,m)=>r.jsx("li",{children:r.jsx("a",{href:j.link,children:j.label})},m))]})})]}),r.jsx("div",{className:"copyright",children:r.jsx("p",{children:x})})]})},nr=w.createContext(void 0),Rr=({children:t})=>{const[s,i]=w.useState(!1),n=()=>{i(p=>!p)},x=p=>{i(p)};return r.jsx(nr.Provider,{value:{isCollapsed:s,toggleSidebar:n,setSidebarCollapsed:x},children:t})},Ne=()=>{const t=w.useContext(nr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t},kr=({buttons:t,onNavigate:s,presentPath:i})=>{const{isCollapsed:n,setSidebarCollapsed:x}=Ne(),[p,j]=w.useState(!0),m=w.useRef(null),[g,o]=w.useState(()=>document.dir==="rtl"||document.documentElement.dir==="rtl");return w.useEffect(()=>{const c=()=>{o(document.dir==="rtl"||document.documentElement.dir==="rtl")},d=new MutationObserver(c);return d.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),()=>d.disconnect()},[]),w.useEffect(()=>{const c=t.some(d=>d.path===i);j(c),!c&&!n&&i.includes("/course/")&&!i.includes("/learning/course/")&&x(!0)},[i]),w.useEffect(()=>{const c=d=>{!p&&m.current&&!m.current.contains(d.target)&&i.includes("/course/")&&!i.includes("/learning/course/")&&(n||x(!0))};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[p,n,x]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`sidebar ${n?"collapsed":""}`,ref:m,children:r.jsx("div",{className:"sidebar-buttons",children:t.map(c=>{const d=c.path===i||(i.includes("/course/")||i.includes("/course_rerun/"))&&c.path==="/my-courses"||i.includes("/library/")&&c.path==="/libraries"||i.includes("/taxonomy/")&&c.path==="/taxonomies";return r.jsx(v.OverlayTrigger,{placement:g?"left":"right",overlay:r.jsx(v.Tooltip,{id:`tooltip-${c.path}`,children:c.label}),show:n?void 0:!1,popperConfig:{modifiers:[{name:"preventOverflow",options:{altAxis:!0,boundary:"viewport"}}]},children:r.jsx(v.Button,{variant:"tertiary",className:`sidebar-btn ${d?"pgn-btn-active":"pgn-btn-inactive"}`,onClick:()=>s(c.path),children:r.jsxs("div",{className:"btn-content",children:[r.jsx("span",{className:"icon-container",children:c.icon}),r.jsx("span",{className:"btn-label",children:c.label})]})})},c.path)})})}),!p&&!n&&r.jsx("div",{className:"sidebar-extra-space"})]})},Tr=(t=768)=>{const[s,i]=w.useState(!1);return w.useEffect(()=>{const n=()=>{i(window.innerWidth<=t)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[t]),s},Je=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{d:"M10.09 15.59 11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM21 3H3v6h2V5h14v14H5v-4H3v6h18V3z",fill:"currentColor"})),Ue=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{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",fill:"currentColor"})),Nr=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",fill:"currentColor"})),Pr=t=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},q.createElement("path",{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",fill:"currentColor"})),Ge=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{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",fill:"currentColor"})),Ir=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{d:"M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z",fill:"currentColor"})),Ar=t=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},q.createElement("path",{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",fill:"currentColor"})),Xe=t=>q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},q.createElement("path",{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",fill:"currentColor"})),Mr=({id:t,buttonTitle:s,items:i})=>(console.log("NavDropdownMenu Props:",i),r.jsx(v.DropdownButton,{id:t,title:s,variant:"tertiary",className:"mr-2",children:i.map(n=>r.jsx(v.Dropdown.Item,{href:n.href,as:"a",className:"small",children:n.title},`${n.title}-dropdown-item`))})),Ze=({username:t,authenticatedUserAvatar:s,isMobile:i,menuItems:n})=>{const x=s?r.jsx("img",{className:"d-block w-100 h-100",src:s,alt:t,"data-testid":"avatar-image"}):r.jsx(v.Avatar,{size:"sm",className:"mr-2",alt:"avatar","data-testid":"avatar-icon"}),p=i?x:r.jsxs(r.Fragment,{children:[t," ",x]});return r.jsx(Mr,{buttonTitle:p,id:"user-dropdown-menu",items:n})};var be={},Qe;function Dr(){if(Qe)return be;Qe=1,Object.defineProperty(be,"__esModule",{value:!0}),be.parse=j,be.serialize=o;const t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,s=/^[\u0021-\u003A\u003C-\u007E]*$/,i=/^([.]?[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]*$/,x=Object.prototype.toString,p=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function j(f,y){const u=new p,I=f.length;if(I<2)return u;const G=(y==null?void 0:y.decode)||c;let E=0;do{const D=f.indexOf("=",E);if(D===-1)break;const O=f.indexOf(";",E),X=O===-1?I:O;if(D>X){E=f.lastIndexOf(";",D-1)+1;continue}const $=m(f,E,D),Z=g(f,D,$),H=f.slice($,Z);if(u[H]===void 0){let R=m(f,D+1,X),Q=g(f,X,R);const ee=G(f.slice(R,Q));u[H]=ee}E=X+1}while(E<I);return u}function m(f,y,u){do{const I=f.charCodeAt(y);if(I!==32&&I!==9)return y}while(++y<u);return u}function g(f,y,u){for(;y>u;){const I=f.charCodeAt(--y);if(I!==32&&I!==9)return y+1}return u}function o(f,y,u){const I=(u==null?void 0:u.encode)||encodeURIComponent;if(!t.test(f))throw new TypeError(`argument name is invalid: ${f}`);const G=I(y);if(!s.test(G))throw new TypeError(`argument val is invalid: ${y}`);let E=f+"="+G;if(!u)return E;if(u.maxAge!==void 0){if(!Number.isInteger(u.maxAge))throw new TypeError(`option maxAge is invalid: ${u.maxAge}`);E+="; Max-Age="+u.maxAge}if(u.domain){if(!i.test(u.domain))throw new TypeError(`option domain is invalid: ${u.domain}`);E+="; Domain="+u.domain}if(u.path){if(!n.test(u.path))throw new TypeError(`option path is invalid: ${u.path}`);E+="; Path="+u.path}if(u.expires){if(!d(u.expires)||!Number.isFinite(u.expires.valueOf()))throw new TypeError(`option expires is invalid: ${u.expires}`);E+="; Expires="+u.expires.toUTCString()}if(u.httpOnly&&(E+="; HttpOnly"),u.secure&&(E+="; Secure"),u.partitioned&&(E+="; Partitioned"),u.priority)switch(typeof u.priority=="string"?u.priority.toLowerCase():void 0){case"low":E+="; Priority=Low";break;case"medium":E+="; Priority=Medium";break;case"high":E+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${u.priority}`)}if(u.sameSite)switch(typeof u.sameSite=="string"?u.sameSite.toLowerCase():u.sameSite){case!0:case"strict":E+="; SameSite=Strict";break;case"lax":E+="; SameSite=Lax";break;case"none":E+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${u.sameSite}`)}return E}function c(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function d(f){return x.call(f)==="[object Date]"}return be}var _e=Dr();function $r(){const t=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof t=="boolean"?t:typeof document=="object"&&typeof document.cookie=="string"}function Lr(t){return typeof t=="string"?_e.parse(t):typeof t=="object"&&t!==null?t:{}}function Te(t,s={}){const i=Hr(t);if(!s.doNotParse)try{return JSON.parse(i)}catch{}return t}function Hr(t){return t&&t[0]==="j"&&t[1]===":"?t.substr(2):t}class Fr{constructor(s,i={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const x=this.cookies;this.cookies=_e.parse(document.cookie),this._checkChanges(x)};const n=typeof document>"u"?"":document.cookie;this.cookies=Lr(s||n),this.defaultSetOptions=i,this.HAS_DOCUMENT_COOKIE=$r()}_emitChange(s){for(let i=0;i<this.changeListeners.length;++i)this.changeListeners[i](s)}_checkChanges(s){new Set(Object.keys(s).concat(Object.keys(this.cookies))).forEach(n=>{s[n]!==this.cookies[n]&&this._emitChange({name:n,value:Te(this.cookies[n])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(s,i={}){return i.doNotUpdate||this.update(),Te(this.cookies[s],i)}getAll(s={}){s.doNotUpdate||this.update();const i={};for(let n in this.cookies)i[n]=Te(this.cookies[n],s);return i}set(s,i,n){n?n=Object.assign(Object.assign({},this.defaultSetOptions),n):n=this.defaultSetOptions;const x=typeof i=="string"?i:JSON.stringify(i);this.cookies=Object.assign(Object.assign({},this.cookies),{[s]:x}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=_e.serialize(s,x,n)),this._emitChange({name:s,value:i,options:n})}remove(s,i){const n=i=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),i),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[s],this.HAS_DOCUMENT_COOKIE&&(document.cookie=_e.serialize(s,"",n)),this._emitChange({name:s,value:void 0,options:i})}addChangeListener(s){this.changeListeners.push(s),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(s){const i=this.changeListeners.indexOf(s);i>=0&&this.changeListeners.splice(i,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}class zr{constructor(s){if(!s.host)throw new Error("MeiliSearch host is required");if(!s.apiKey)throw new Error("MeiliSearch apiKey is required");if(!s.indexName)throw new Error("MeiliSearch indexName is required");this.config=s,this.headers={"Content-Type":"application/json",Authorization:`Bearer ${s.apiKey}`,"X-Meilisearch-Client":"Meilisearch JavaScript (v0.41.0)"}}updateHeadersFromClient(s){s&&s.httpRequest&&s.httpRequest.headers&&(this.headers={"Content-Type":s.httpRequest.headers["Content-Type"]||"application/json",Authorization:s.httpRequest.headers.Authorization||`Bearer ${this.config.apiKey}`,"X-Meilisearch-Client":s.httpRequest.headers["X-Meilisearch-Client"]||"Meilisearch JavaScript (v0.41.0)"})}async search(s,i={}){const{limit:n=20,offset:x=0,filter:p=['type = "course_block"'],attributesToHighlight:j=["display_name","description","published"],attributesToCrop:m=["description","published"],sort:g=[]}=i;if(!this.config.indexName)throw new Error("MeiliSearch indexName is required");const o={queries:[{indexUid:this.config.indexName,q:s,filter:[[],...p],attributesToHighlight:j,highlightPreTag:"__meili-highlight__",highlightPostTag:"__/meili-highlight__",attributesToCrop:m,sort:g,offset:x,limit:n},{indexUid:this.config.indexName,facets:["block_type","content.problem_types"],filter:p,limit:0}]},c={...this.headers};try{const d=await fetch(`${this.config.host}/multi-search`,{method:"POST",headers:c,body:JSON.stringify(o)});if(!d.ok)throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);const f=await d.json(),y=f.results[0],u=f.results[1];return{hits:y.hits||[],totalHits:y.estimatedTotalHits||0,facets:u.facetDistribution,processingTimeMs:y.processingTimeMs}}catch(d){throw console.error("MeiliSearch service error:",d),new Error(`Search failed: ${d instanceof Error?d.message:"Unknown error"}`)}}async simpleSearch(s,i={}){const{limit:n=20,offset:x=0,filter:p=['type = "course_block"'],attributesToHighlight:j=["display_name","description","published"],attributesToCrop:m=["description","published"],sort:g=[]}=i,o={queries:[{indexUid:this.config.indexName,q:s,filter:[[],...p],attributesToHighlight:j,highlightPreTag:"__meili-highlight__",highlightPostTag:"__/meili-highlight__",attributesToCrop:m,sort:g,offset:x,limit:n}]},c={...this.headers};try{const d=await fetch(`${this.config.host}/multi-search`,{method:"POST",headers:c,body:JSON.stringify(o)});if(!d.ok)throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);const y=(await d.json()).results[0];return{hits:y.hits||[],totalHits:y.estimatedTotalHits||0,processingTimeMs:y.processingTimeMs}}catch(d){throw console.error("MeiliSearch service error:",d),new Error(`Search failed: ${d instanceof Error?d.message:"Unknown error"}`)}}async checkConnection(){try{return(await fetch(`${this.config.host}/health`,{method:"GET",headers:{Authorization:`Bearer ${this.config.apiKey}`,"X-Meilisearch-Client":"Meilisearch JavaScript (v0.41.0)"}})).ok}catch(s){return console.error("MeiliSearch connection check failed:",s),!1}}}const ir=t=>new zr(t);function sr(t,s){const{contextKey:i,usageKey:n}=t;return i?i.startsWith("course-v1:")?`${s||""}/course/${i}?show=${encodeURIComponent(n||"")}`:i.startsWith("library-v1:")?`${s||""}/library/${i}`:"#":"#"}function qr(t,s,i){const n=sr(t,s);return n==="#"?(console.warn("Could not generate URL for search hit:",t),"#"):(i?i(n):(n.startsWith("http"),window.location.href=n),n)}const Be=({text:t,highlightTag:s="__meili-highlight__"})=>{if(!t)return null;const i="__/meili-highlight__",n=t.split(s),x=[];return n.forEach((p,j)=>{if(j===0)p&&x.push(p);else{const m=p.indexOf(i);if(m!==-1){const g=p.substring(0,m),o=p.substring(m+i.length);g&&x.push(r.jsx("mark",{className:"search-highlight",children:g},`highlight-${j}`)),o&&x.push(o)}else x.push(r.jsx("mark",{className:"search-highlight",children:p},`highlight-${j}`))}}),r.jsx(r.Fragment,{children:x})};function Vr(t){return{html:"text",video:"video",problem:"quiz",vertical:"folder",sequential:"folder",chapter:"folder",about:"info",static_tab:"text",openassessment:"quiz",lti_consumer:"link",pdf:"file",scorm:"file",itembank:"library",library_content:"library"}[t]||"text"}const er=({result:t,onNavigate:s,baseUrl:i})=>{var g,o;const n=c=>{var y;c.preventDefault(),c.stopPropagation();const d={id:t.id,blockType:t.block_type||t.type,contextKey:t.context_key,usageKey:t.usage_key,breadcrumbs:((y=t.breadcrumbs)==null?void 0:y.map(u=>({displayName:u.display_name,usageKey:u.usage_key})))||[]};if(t.url){s?s(t.url):window.location.href=t.url;return}qr(d,i,s)==="#"&&(s?s(`/search-result/${t.id}`):window.location.href=`/search-result/${t.id}`)},x=c=>{var y;c.preventDefault(),c.stopPropagation();const d={id:t.id,blockType:t.block_type||t.type,contextKey:t.context_key,usageKey:t.usage_key,breadcrumbs:((y=t.breadcrumbs)==null?void 0:y.map(u=>({displayName:u.display_name,usageKey:u.usage_key})))||[]},f=sr(d,i);f&&f!=="#"&&window.open(f,"_blank")},p=((g=t._formatted)==null?void 0:g.display_name)||t.display_name,j=((o=t._formatted)==null?void 0:o.description)||t.description,m=t.block_type||t.type;return r.jsx("div",{className:"search-result-item",onClick:n,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&n(c)},children:r.jsxs("div",{className:"search-result-content",children:[r.jsx("div",{className:"search-result-icon",children:r.jsx(v.Icon,{src:Vr(m)})}),r.jsxs("div",{className:"search-result-text",children:[r.jsx("div",{className:"search-result-title",children:r.jsx(Be,{text:p})}),j&&r.jsx("div",{className:"search-result-description",children:r.jsx(Be,{text:j})}),t.breadcrumbs&&t.breadcrumbs.length>0&&r.jsx("div",{className:"search-result-breadcrumbs",children:t.breadcrumbs.map(c=>c.display_name).join(" / ")})]}),r.jsx("div",{className:"search-result-actions",children:r.jsx(v.IconButton,{src:Ir,iconAs:v.Icon,onClick:x,alt:"Open in new window",size:"sm"})})]})})},rr=new Fr,Wr=({logoUrl:t,menuList:s,loginSignupButtons:i,authenticatedUser:n=null,userMenuItems:x,menuAlignment:p,onLanguageChange:j,getBaseUrl:m,meiliSearchConfig:g,headerButtons:o,languageSelectorList:c})=>{const d=Tr(),{toggleSidebar:f,setSidebarCollapsed:y}=Ne(),[u,I]=w.useState(()=>rr.get("openedx-language-preference")||"en"),[G,E]=w.useState(!1),[D,O]=w.useState(!1),[X,$]=w.useState(!1),[Z,H]=w.useState(""),[R,Q]=w.useState([]),[ee,F]=w.useState(!1),[L,V]=w.useState(null),[M,z]=w.useState(0),[C,W]=w.useState(!1),[K,B]=w.useState(5),oe=w.useRef(null),J=w.useRef(null),ne=w.useRef(g?ir(g):null),ce=w.useRef(!1);console.log("languageSelectorList",c),w.useEffect(()=>{g!=null&&g.client&&ne.current&&ne.current.updateHeadersFromClient(g.client)},[g==null?void 0:g.client]),w.useEffect(()=>()=>{J.current&&clearTimeout(J.current)},[]),w.useEffect(()=>{document.body.dir=u==="ar"?"rtl":"ltr"},[u]),w.useEffect(()=>{d&&!ce.current?(y(!0),ce.current=!0):d||(ce.current=!1)},[d,y]),w.useEffect(()=>{if(!D)return;function h(N){oe.current&&!oe.current.contains(N.target)&&O(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[D]);const le=h=>{I(h),rr.set("openedx-language-preference",h,{path:m?m():"/"}),j&&j()},me=p&&{left:"justify-content-start",center:"justify-content-center",right:"justify-content-end"}[p.toLowerCase()]||"justify-content-start",ue=async h=>{if(!h.trim()||!g||!ne.current){Q([]),z(0),$(!1),W(!1);return}F(!0),V(null),$(!1),B(5);try{const N=await ne.current.simpleSearch(h,{limit:20,offset:0});Q(N.hits),z(N.totalHits),$(N.totalHits===0),W(!0)}catch(N){V(N instanceof Error?N.message:"Search failed"),$(!0),Q([]),z(0)}finally{F(!1)}},ie=h=>{H(h),ue(h),d&&G&&E(!1)},de=h=>{H(h),X&&h.trim()===""&&($(!1),W(!1)),J.current&&clearTimeout(J.current),h.trim().length>0?J.current=setTimeout(()=>{ue(h)},500):(Q([]),z(0),$(!1),W(!1))},se=()=>{J.current&&(clearTimeout(J.current),J.current=null),H(""),Q([]),z(0),$(!1),W(!1),V(null),F(!1)},we=()=>{H(""),Q([]),z(0),$(!1),W(!1),V(null),F(!1),B(5),J.current&&(clearTimeout(J.current),J.current=null)},ge=()=>{B(h=>Math.min(h+10,R.length))},ve=h=>{if(c&&c.length>0){const U=c.find(xe=>xe[h]);if(U)return U[h]}return{en:"English",ar:"Arabic",hi:"Hindi"}[h]||h.toUpperCase()},ye=()=>(console.log("renderLanguageOptions - languageSelectorList:",c),console.log("renderLanguageOptions - length:",c==null?void 0:c.length),c&&c.length>0?(console.log("Using custom languageSelectorList"),c.map((h,N)=>{const[U,xe]=Object.entries(h)[0];return r.jsx(v.Dropdown.Item,{onClick:()=>le(U),children:xe},`lang-${U}-${N}`)})):(console.log("Using fallback languages"),r.jsxs(r.Fragment,{children:[r.jsx(v.Dropdown.Item,{onClick:()=>le("en"),children:"English"}),r.jsx(v.Dropdown.Item,{onClick:()=>le("ar"),children:"Arabic"}),r.jsx(v.Dropdown.Item,{onClick:()=>le("hi"),children:"Hindi"})]}))),ae=(o==null?void 0:o.reSync)||(o==null?void 0:o.contextSwitcher)||(o==null?void 0:o.help)||(o==null?void 0:o.notification)||(o==null?void 0:o.translation);return r.jsxs(v.Navbar,{expand:"lg",className:"navbarContainer py-1",children:[r.jsxs("div",{className:"d-flex align-items-center",children:[r.jsx("div",{className:"toggle-sidebar-icon",children:r.jsx(v.IconButton,{src:Nr,iconAs:v.Icon,alt:"Toggle Sidebar",onClick:f,className:"ms-2 ml-2",onMouseDown:h=>h.stopPropagation()})}),r.jsx(v.Navbar.Brand,{href:"/",className:"navbar-brand",children:r.jsx("img",{src:t,alt:"Logo"})})]}),n!==null&&r.jsx(r.Fragment,{children:d?r.jsx("div",{className:"d-flex justify-content-between align-items-center ml-auto",children:r.jsxs("div",{className:"d-flex align-items-center navbar-buttons",children:[g&&r.jsx(v.IconButton,{src:Ar,iconAs:v.Icon,alt:"Search",onClick:()=>E(!0)}),r.jsx("div",{className:"ml-2 usermenu-dropdown-mobile",children:r.jsx(Ze,{username:n==null?void 0:n.username,authenticatedUserAvatar:n==null?void 0:n.avatar,isMobile:d,isAdmin:n==null?void 0:n.administrator,menuItems:x})}),ae&&r.jsx(v.IconButton,{src:Pr,iconAs:v.Icon,alt:"More",onMouseDown:h=>h.stopPropagation(),onClick:()=>O(h=>!h)}),D&&ae&&r.jsxs("div",{className:"more-menu-dropdown",ref:oe,children:[r.jsxs("div",{className:"more-menu-icons-row",children:[(o==null?void 0:o.reSync)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Xe,iconAs:v.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Re-Sync"})}),(o==null?void 0:o.contextSwitcher)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Je,iconAs:v.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Switch to User Mode"})}),(o==null?void 0:o.help)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Ue,iconAs:v.Icon,alt:"Help",tooltipPlacement:"bottom",tooltipContent:"Help"})}),(o==null?void 0:o.notification)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Ge,iconAs:v.Icon,alt:"Notifications",tooltipPlacement:"bottom",tooltipContent:"Notifications"})})]}),(o==null?void 0:o.translation)&&r.jsxs(v.Dropdown,{className:"language-dropdown",children:[r.jsx(v.Dropdown.Toggle,{variant:"tertiary",id:"language-dropdown",children:ve(u)}),r.jsx(v.Dropdown.Menu,{children:ye()})]})]})]})}):r.jsxs(r.Fragment,{children:[g&&r.jsx("div",{className:"d-flex align-items-center justify-content-start flex-grow-1 ml-4",children:r.jsxs("div",{style:{width:"30rem",position:"relative"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",border:"2px solid #ccc",borderRadius:"25px",padding:"8px 16px",background:"#fff",position:"relative"},children:[r.jsx("input",{type:"text",value:Z,onChange:h=>{de(h.target.value)},onKeyDown:h=>{h.key==="Enter"&&ie(Z)},placeholder:"Search",style:{flex:1,border:"none",outline:"none",fontSize:"16px",background:"transparent",padding:"4px"},autoComplete:"off"}),Z&&r.jsx("button",{type:"button",onClick:()=>{se()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",marginRight:"8px"},children:"✕"})]}),ee&&r.jsxs("div",{className:"search-loading-spinner-container",children:[r.jsx("div",{className:"search-loading-spinner"}),r.jsx("span",{children:"Searching..."})]}),X&&!ee&&r.jsx("div",{className:"no-results-message-desktop",children:r.jsx("p",{children:"We didn't find anything matching your search"})}),L&&r.jsx("div",{className:"search-error-message-desktop",children:r.jsxs("p",{children:["Search error: ",L]})}),C&&R.length>0&&r.jsxs("div",{className:"search-results-dropdown",children:[r.jsx("div",{className:"search-results-header",children:r.jsxs("span",{children:[M," result",M!==1?"s":""," found"]})}),r.jsxs("div",{className:"search-results-list",children:[R.slice(0,K).map((h,N)=>r.jsx(er,{result:h,onNavigate:U=>{we(),window.location.href=U},baseUrl:m?m():void 0},h.id||N)),K<R.length&&r.jsx("div",{className:"search-results-more",children:r.jsxs("button",{onClick:ge,style:{background:"none",border:"none",color:"#007bff",cursor:"pointer",padding:"8px 16px",width:"100%",textAlign:"center",fontSize:"14px"},children:["Show ",Math.min(10,R.length-K)," more results"]})})]})]})]})}),r.jsxs("div",{className:"d-flex align-items-center gap-2 ms-auto order-lg-3",children:[(o==null?void 0:o.reSync)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Xe,iconAs:v.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Re-Sync"})}),(o==null?void 0:o.contextSwitcher)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Je,iconAs:v.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Switch to User Mode"})}),(o==null?void 0:o.help)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Ue,iconAs:v.Icon,alt:"Help",tooltipPlacement:"bottom",tooltipContent:"Help"})}),(o==null?void 0:o.notification)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(v.IconButtonWithTooltip,{src:Ge,iconAs:v.Icon,alt:"Notifications",tooltipPlacement:"bottom",tooltipContent:"Notifications"})}),(o==null?void 0:o.translation)&&r.jsxs(v.Dropdown,{className:"language-dropdown",children:[r.jsx(v.Dropdown.Toggle,{variant:"tertiary",id:"language-dropdown",children:ve(u)}),r.jsx(v.Dropdown.Menu,{children:ye()})]}),r.jsx("div",{className:"usermenu-dropdown",children:r.jsx(Ze,{username:n==null?void 0:n.username,authenticatedUserAvatar:n==null?void 0:n.avatar,isMobile:d,isAdmin:n==null?void 0:n.administrator,menuItems:x})})]})]})}),n===null&&r.jsxs(r.Fragment,{children:[r.jsx(v.Navbar.Toggle,{"aria-controls":"main-navbar-nav"}),r.jsx("div",{className:"d-flex align-items-center gap-2 ms-auto order-lg-3",children:i&&r.jsxs(r.Fragment,{children:[r.jsx(v.Button,{variant:"primary",children:"Log In"}),r.jsx(v.Button,{variant:"outline-primary",children:"Sign Up"})]})})]}),r.jsx(v.Navbar.Collapse,{id:"main-navbar-nav",className:"justify-content-between",children:r.jsx(v.Nav,{className:`nav-gap gap-3 flex-grow-1 ${me}`,children:n===null&&s.map(h=>h.subMenu?r.jsx(v.NavDropdown,{title:h.label,id:`nav-dropdown-${h.label}`,children:h.subMenu.map(N=>r.jsx(v.NavDropdown.Item,{onClick:()=>console.log("Selected submenu:",N.label),children:N.label},`sub-${N.label}`))},`menu-${h.label}`):r.jsx(v.Nav.Link,{as:"span",className:"text-uppercase fw-semibold",children:h.label},`menu-${h.label}`))})}),g&&G&&r.jsxs("div",{className:"fixed-search-bar",children:[r.jsxs("div",{className:"fixed-search-bar-inner",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",border:"2px solid #ccc",borderRadius:"25px",padding:"12px 16px",background:"#fff",position:"relative",width:"100%"},children:[r.jsx("input",{type:"text",value:Z,onChange:h=>{de(h.target.value)},onKeyDown:h=>{h.key==="Enter"&&ie(Z)},placeholder:"Search",style:{flex:1,border:"none",outline:"none",fontSize:"18px",background:"transparent",padding:"4px"},autoComplete:"off",autoFocus:!0}),Z&&r.jsx("button",{type:"button",onClick:()=>{se()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",marginRight:"8px",fontSize:"18px"},children:"✕"})]}),r.jsx("button",{className:"close-search-bar",type:"button",onClick:()=>E(!1),"aria-label":"Close Search",children:"×"})]}),ee&&r.jsxs("div",{className:"search-loading-spinner-container",children:[r.jsx("div",{className:"search-loading-spinner"}),r.jsx("span",{children:"Searching..."})]}),X&&!ee&&r.jsx("div",{className:"no-results-message",children:r.jsx("p",{children:"We didn't find anything matching your search"})}),L&&r.jsx("div",{className:"search-error-message",children:r.jsxs("p",{children:["Search error: ",L]})}),C&&R.length>0&&r.jsxs("div",{className:"search-results-mobile",children:[r.jsx("div",{className:"search-results-header",children:r.jsxs("span",{children:[M," result",M!==1?"s":""," found"]})}),r.jsxs("div",{className:"search-results-list",children:[R.slice(0,K).map((h,N)=>r.jsx(er,{result:h,onNavigate:U=>{we(),window.location.href=U},baseUrl:m?m():void 0},h.id||N)),K<R.length&&r.jsx("div",{className:"search-results-more",children:r.jsxs("button",{onClick:ge,style:{background:"none",border:"none",color:"#007bff",cursor:"pointer",padding:"12px 16px",width:"100%",textAlign:"center",fontSize:"16px"},children:["Show ",Math.min(10,R.length-K)," more results"]})})]})]})]})]})},ar=w.createContext(void 0),Kr=({children:t,meiliSearchConfig:s})=>{const[i,n]=w.useState(""),[x,p]=w.useState([]),[j,m]=w.useState(0),[g,o]=w.useState(!1),[c,d]=w.useState(!1),[f,y]=w.useState(null),[u,I]=w.useState(0),[G,E]=w.useState(!1),[D,O]=w.useState(!1),[X,$]=w.useState(null),Z=ir(s),H=async F=>{if(!F.trim()){Q();return}o(!0),d(!1),y(null),I(0);try{const L=await Z.search(F,{limit:20,offset:0}),V=L.hits.map(C=>{var W,K,B;return{id:C.id,title:((W=C._formatted)==null?void 0:W.display_name)||C.display_name,type:C.type,url:C.url,description:((K=C._formatted)==null?void 0:K.description)||C.description,block_type:C.block_type,published:((B=C._formatted)==null?void 0:B.published)||C.published,_formatted:C._formatted}}),M=L.totalHits,z=V.length===20&&M>V.length;p(V),m(M),E(z),$(L.facets||null)}catch(L){console.error("Search error:",L),d(!0),y(L instanceof Error?L.message:"Search failed"),p([]),m(0),E(!1),$(null)}finally{o(!1)}},R=async()=>{if(!(!G||D)){O(!0);try{const F=u+20,L=await Z.simpleSearch(i,{limit:20,offset:F}),V=L.hits.map(C=>{var W,K,B;return{id:C.id,title:((W=C._formatted)==null?void 0:W.display_name)||C.display_name,type:C.type,url:C.url,description:((K=C._formatted)==null?void 0:K.description)||C.description,block_type:C.block_type,published:((B=C._formatted)==null?void 0:B.published)||C.published,_formatted:C._formatted}}),M=L.totalHits,z=V.length===20&&M>x.length+V.length;p(C=>[...C,...V]),m(M),E(z),I(F)}catch(F){console.error("Error fetching next page:",F),d(!0),y(F instanceof Error?F.message:"Failed to load more results")}finally{O(!1)}}},Q=()=>{n(""),p([]),m(0),d(!1),y(null),I(0),E(!1),$(null)},ee={searchKeywords:i,setSearchKeywords:n,searchResults:x,totalHits:j,isLoading:g,hasError:c,errorMessage:f,facets:X,performSearch:H,clearSearch:Q,hasNextPage:G,fetchNextPage:R,isFetchingNextPage:D};return r.jsx(ar.Provider,{value:ee,children:t})},Yr=()=>{const t=w.useContext(ar);if(t===void 0)throw new Error("useSimpleSearch must be used within a SimpleSearchProvider");return t},Jr=t=>{try{if(t.status!==200)throw new Error("Failed to fetch theme config");const s=t.data.theme_colors;if(!s||typeof s!="object")throw new Error("Invalid theme_colors in API response");const i=document.documentElement;for(const n in s)if(Object.prototype.hasOwnProperty.call(s,n)){const x=s[n];i.style.setProperty(`--${n.replace(/_/g,"-")}`,x)}console.log("Theme applied successfully from API:",s)}catch(s){console.error("Error applying theme from API:",s.message);const i={primary:"#2B2399",primary_alt:"#3C32B5",primary_hover:"#E2E1F9",primary_active:"#1F1A7D",primary_light:"#E2E1F9",secondary:"#7A8AFF",secondary_alt:"#5C6EF0",secondary_hover:"#ECEEFF",secondary_active:"#4A5BD1",secondary_light:"#ECEEFF"},n=document.documentElement;for(const x in i)if(Object.prototype.hasOwnProperty.call(i,x)){const p=i[x];n.style.setProperty(`--${x.replace(/_/g,"-")}`,p)}console.log("Fallback theme applied")}};exports.Footer=Or;exports.MainHeader=Wr;exports.Sidebar=kr;exports.SidebarProvider=Rr;exports.SimpleSearchProvider=Kr;exports.dynamicTheme=Jr;exports.useSidebar=Ne;exports.useSimpleSearch=Yr;
|
|
27
|
+
Check the top-level render call using <`+h+">.")}return c}}function Le(e,c){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var h=gr(c);if(He[h])return;He[h]=!0;var w="";e&&e._owner&&e._owner!==Se.current&&(w=" It was passed a child from "+H(e._owner.type)+"."),fe(e),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',h,w),fe(null)}}function Fe(e,c){{if(typeof e!="object")return;if(Array.isArray(e))for(var h=0;h<e.length;h++){var w=e[h];Oe(w)&&Le(w,c)}else if(Oe(e))e._store&&(e._store.validated=!0);else if(e){var M=Z(e);if(typeof M=="function"&&M!==e.entries)for(var P=M.call(e),R;!(R=P.next()).done;)Oe(R.value)&&Le(R.value,c)}}}function vr(e){{var c=e.type;if(c==null||typeof c=="string")return;var h;if(typeof c=="function")h=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===u||c.$$typeof===l))h=c.propTypes;else return;if(h){var w=H(c);xe(h,e.props,"prop",w,e)}else if(c.PropTypes!==void 0&&!Ce){Ce=!0;var M=H(c);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",M||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xr(e){{for(var c=Object.keys(e.props),h=0;h<c.length;h++){var w=c[h];if(w!=="children"&&w!=="key"){fe(e),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",w),fe(null);break}}e.ref!==null&&(fe(e),N("Invalid attribute `ref` supplied to `React.Fragment`."),fe(null))}}function ze(e,c,h,w,M,P){{var R=q(e);if(!R){var C="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var U=mr();U?C+=U:C+=$e();var D;e===null?D="null":Array.isArray(e)?D="array":e!==void 0&&e.$$typeof===i?(D="<"+(H(e.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):D=typeof e,N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,C)}var $=pr(e,c,h,M,P);if($==null)return $;if(R){var re=c.children;if(re!==void 0)if(w)if(Array.isArray(re)){for(var he=0;he<re.length;he++)Fe(re[he],e);Object.freeze&&Object.freeze(re)}else N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(re,e)}return e===t.Fragment?xr($):vr($),$}}function br(e,c,h){return ze(e,c,h,!0)}function yr(e,c,h){return ze(e,c,h,!1)}var wr=yr,_r=br;t.jsx=wr,t.jsxs=_r})()})(ke)),ke}var Ye;function Cr(){return Ye||(Ye=1,process.env.NODE_ENV==="production"?_e.exports=Er():_e.exports=Sr()),_e.exports}var r=Cr();const Or=({contactInfo:t,quickLinks:n,exploreLinks:s,logoUrl:i,copyrights:v})=>{const p=j=>j??"left";return r.jsxs("footer",{className:"footer",children:[r.jsxs("div",{className:"container",children:[r.jsxs("div",{className:`section ${p(t.align)}`,children:[r.jsx("div",{className:"footer-brand-logo",children:r.jsx("img",{src:i,alt:"Logo"})}),r.jsx("p",{children:t.content.shortdesc}),r.jsxs("p",{children:[t.content.location.label,", ",t.content.location.value]}),r.jsxs("p",{children:["📞 ",t.content.phonenumber]})]}),r.jsx("div",{className:`section ${p(n.align)}`,children:r.jsxs("ul",{children:[r.jsx("h3",{children:"Quick Links"}),n.content.map((j,m)=>r.jsx("li",{children:r.jsx("a",{href:j.link,children:j.label})},m))]})}),r.jsx("div",{className:`section ${p(s.align)}`,children:r.jsxs("ul",{children:[r.jsx("h3",{children:"Explore"}),s.content.map((j,m)=>r.jsx("li",{children:r.jsx("a",{href:j.link,children:j.label})},m))]})})]}),r.jsx("div",{className:"copyright",children:r.jsx("p",{children:v})})]})},nr=_.createContext(void 0),Rr=({children:t})=>{const[n,s]=_.useState(!1),i=()=>{s(p=>!p)},v=p=>{s(p)};return r.jsx(nr.Provider,{value:{isCollapsed:n,toggleSidebar:i,setSidebarCollapsed:v},children:t})},Ne=()=>{const t=_.useContext(nr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t},kr=({buttons:t,onNavigate:n,presentPath:s})=>{const{isCollapsed:i,setSidebarCollapsed:v}=Ne(),[p,j]=_.useState(!0),m=_.useRef(null),[x,u]=_.useState(()=>document.dir==="rtl"||document.documentElement.dir==="rtl");return _.useEffect(()=>{const a=()=>{u(document.dir==="rtl"||document.documentElement.dir==="rtl")},d=new MutationObserver(a);return d.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),()=>d.disconnect()},[]),_.useEffect(()=>{const a=t.some(d=>d.path===s);j(a),!a&&!i&&s.includes("/course/")&&!s.includes("/learning/course/")&&v(!0)},[s]),_.useEffect(()=>{const a=d=>{!p&&m.current&&!m.current.contains(d.target)&&s.includes("/course/")&&!s.includes("/learning/course/")&&(i||v(!0))};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[p,i,v]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`sidebar ${i?"collapsed":""}`,ref:m,children:r.jsx("div",{className:"sidebar-buttons",children:t.map(a=>{const d=a.path===s||(s.includes("/course/")||s.includes("/course_rerun/"))&&a.path==="/my-courses"||s.includes("/library/")&&a.path==="/libraries"||s.includes("/taxonomy/")&&a.path==="/taxonomies";return r.jsx(b.OverlayTrigger,{placement:x?"left":"right",overlay:r.jsx(b.Tooltip,{id:`tooltip-${a.path}`,children:a.label}),show:i?void 0:!1,popperConfig:{modifiers:[{name:"preventOverflow",options:{altAxis:!0,boundary:"viewport"}}]},children:r.jsx(b.Button,{variant:"tertiary",className:`sidebar-btn ${d?"pgn-btn-active":"pgn-btn-inactive"}`,onClick:()=>n(a.path),children:r.jsxs("div",{className:"btn-content",children:[r.jsx("span",{className:"icon-container",children:a.icon}),r.jsx("span",{className:"btn-label",children:a.label})]})})},a.path)})})}),!p&&!i&&r.jsx("div",{className:"sidebar-extra-space"})]})},Tr=(t=768)=>{const[n,s]=_.useState(!1);return _.useEffect(()=>{const i=()=>{s(window.innerWidth<=t)};return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[t]),n},Je=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{d:"M10.09 15.59 11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM21 3H3v6h2V5h14v14H5v-4H3v6h18V3z",fill:"currentColor"})),Ue=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{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",fill:"currentColor"})),Nr=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z",fill:"currentColor"})),Pr=t=>W.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},W.createElement("path",{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",fill:"currentColor"})),Ge=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{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",fill:"currentColor"})),Ir=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{d:"M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z",fill:"currentColor"})),Mr=t=>W.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},W.createElement("path",{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",fill:"currentColor"})),Xe=t=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},W.createElement("path",{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",fill:"currentColor"})),Ar=({id:t,buttonTitle:n,items:s})=>(console.log("NavDropdownMenu Props:",s),r.jsx(b.DropdownButton,{id:t,title:n,variant:"tertiary",className:"mr-2",children:s.map(i=>r.jsx(b.Dropdown.Item,{href:i.href,as:"a",className:"small",children:i.title},`${i.title}-dropdown-item`))})),Ze=({username:t,authenticatedUserAvatar:n,isMobile:s,menuItems:i})=>{const v=n?r.jsx("img",{className:"d-block w-100 h-100",src:n,alt:t,"data-testid":"avatar-image"}):r.jsx(b.Avatar,{size:"sm",className:"mr-2",alt:"avatar","data-testid":"avatar-icon"}),p=s?v:r.jsxs(r.Fragment,{children:[t," ",v]});return r.jsx(Ar,{buttonTitle:p,id:"user-dropdown-menu",items:i})};var be={},Qe;function Dr(){if(Qe)return be;Qe=1,Object.defineProperty(be,"__esModule",{value:!0}),be.parse=j,be.serialize=u;const t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\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,i=/^[\u0020-\u003A\u003D-\u007E]*$/,v=Object.prototype.toString,p=(()=>{const l=function(){};return l.prototype=Object.create(null),l})();function j(l,f){const o=new p,S=l.length;if(S<2)return o;const O=(f==null?void 0:f.decode)||a;let y=0;do{const T=l.indexOf("=",y);if(T===-1)break;const E=l.indexOf(";",y),I=E===-1?S:E;if(T>I){y=l.lastIndexOf(";",T-1)+1;continue}const L=m(l,y,T),Z=x(l,T,L),z=l.slice(L,Z);if(o[z]===void 0){let N=m(l,T+1,I),Q=x(l,I,N);const ee=O(l.slice(N,Q));o[z]=ee}y=I+1}while(y<S);return o}function m(l,f,o){do{const S=l.charCodeAt(f);if(S!==32&&S!==9)return f}while(++f<o);return o}function x(l,f,o){for(;f>o;){const S=l.charCodeAt(--f);if(S!==32&&S!==9)return f+1}return o}function u(l,f,o){const S=(o==null?void 0:o.encode)||encodeURIComponent;if(!t.test(l))throw new TypeError(`argument name is invalid: ${l}`);const O=S(f);if(!n.test(O))throw new TypeError(`argument val is invalid: ${f}`);let y=l+"="+O;if(!o)return y;if(o.maxAge!==void 0){if(!Number.isInteger(o.maxAge))throw new TypeError(`option maxAge is invalid: ${o.maxAge}`);y+="; Max-Age="+o.maxAge}if(o.domain){if(!s.test(o.domain))throw new TypeError(`option domain is invalid: ${o.domain}`);y+="; Domain="+o.domain}if(o.path){if(!i.test(o.path))throw new TypeError(`option path is invalid: ${o.path}`);y+="; Path="+o.path}if(o.expires){if(!d(o.expires)||!Number.isFinite(o.expires.valueOf()))throw new TypeError(`option expires is invalid: ${o.expires}`);y+="; Expires="+o.expires.toUTCString()}if(o.httpOnly&&(y+="; HttpOnly"),o.secure&&(y+="; Secure"),o.partitioned&&(y+="; Partitioned"),o.priority)switch(typeof o.priority=="string"?o.priority.toLowerCase():void 0){case"low":y+="; Priority=Low";break;case"medium":y+="; Priority=Medium";break;case"high":y+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${o.priority}`)}if(o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":y+="; SameSite=Strict";break;case"lax":y+="; SameSite=Lax";break;case"none":y+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${o.sameSite}`)}return y}function a(l){if(l.indexOf("%")===-1)return l;try{return decodeURIComponent(l)}catch{return l}}function d(l){return v.call(l)==="[object Date]"}return be}var je=Dr();function $r(){const t=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof t=="boolean"?t:typeof document=="object"&&typeof document.cookie=="string"}function Hr(t){return typeof t=="string"?je.parse(t):typeof t=="object"&&t!==null?t:{}}function Te(t,n={}){const s=Lr(t);if(!n.doNotParse)try{return JSON.parse(s)}catch{}return t}function Lr(t){return t&&t[0]==="j"&&t[1]===":"?t.substr(2):t}class Fr{constructor(n,s={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const v=this.cookies;this.cookies=je.parse(document.cookie),this._checkChanges(v)};const i=typeof document>"u"?"":document.cookie;this.cookies=Hr(n||i),this.defaultSetOptions=s,this.HAS_DOCUMENT_COOKIE=$r()}_emitChange(n){for(let s=0;s<this.changeListeners.length;++s)this.changeListeners[s](n)}_checkChanges(n){new Set(Object.keys(n).concat(Object.keys(this.cookies))).forEach(i=>{n[i]!==this.cookies[i]&&this._emitChange({name:i,value:Te(this.cookies[i])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(n,s={}){return s.doNotUpdate||this.update(),Te(this.cookies[n],s)}getAll(n={}){n.doNotUpdate||this.update();const s={};for(let i in this.cookies)s[i]=Te(this.cookies[i],n);return s}set(n,s,i){i?i=Object.assign(Object.assign({},this.defaultSetOptions),i):i=this.defaultSetOptions;const v=typeof s=="string"?s:JSON.stringify(s);this.cookies=Object.assign(Object.assign({},this.cookies),{[n]:v}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=je.serialize(n,v,i)),this._emitChange({name:n,value:s,options:i})}remove(n,s){const i=s=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),s),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[n],this.HAS_DOCUMENT_COOKIE&&(document.cookie=je.serialize(n,"",i)),this._emitChange({name:n,value:void 0,options:s})}addChangeListener(n){this.changeListeners.push(n),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(n){const s=this.changeListeners.indexOf(n);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())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}class zr{constructor(n){if(!n.host)throw new Error("MeiliSearch host is required");if(!n.apiKey)throw new Error("MeiliSearch apiKey is required");if(!n.indexName)throw new Error("MeiliSearch indexName is required");this.config=n,this.headers={"Content-Type":"application/json",Authorization:`Bearer ${n.apiKey}`,"X-Meilisearch-Client":"Meilisearch JavaScript (v0.41.0)"}}updateHeadersFromClient(n){n&&n.httpRequest&&n.httpRequest.headers&&(this.headers={"Content-Type":n.httpRequest.headers["Content-Type"]||"application/json",Authorization:n.httpRequest.headers.Authorization||`Bearer ${this.config.apiKey}`,"X-Meilisearch-Client":n.httpRequest.headers["X-Meilisearch-Client"]||"Meilisearch JavaScript (v0.41.0)"})}async search(n,s={}){const{limit:i=20,offset:v=0,filter:p=['type = "course_block"'],attributesToHighlight:j=["display_name","description","published"],attributesToCrop:m=["description","published"],sort:x=[]}=s;if(!this.config.indexName)throw new Error("MeiliSearch indexName is required");const u={queries:[{indexUid:this.config.indexName,q:n,filter:[[],...p],attributesToHighlight:j,highlightPreTag:"__meili-highlight__",highlightPostTag:"__/meili-highlight__",attributesToCrop:m,sort:x,offset:v,limit:i},{indexUid:this.config.indexName,facets:["block_type","content.problem_types"],filter:p,limit:0}]},a={...this.headers};try{const d=await fetch(`${this.config.host}/multi-search`,{method:"POST",headers:a,body:JSON.stringify(u)});if(!d.ok)throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);const l=await d.json(),f=l.results[0],o=l.results[1];return{hits:f.hits||[],totalHits:f.estimatedTotalHits||0,facets:o.facetDistribution,processingTimeMs:f.processingTimeMs}}catch(d){throw console.error("MeiliSearch service error:",d),new Error(`Search failed: ${d instanceof Error?d.message:"Unknown error"}`)}}async simpleSearch(n,s={}){const{limit:i=20,offset:v=0,filter:p=['type = "course_block"'],attributesToHighlight:j=["display_name","description","published"],attributesToCrop:m=["description","published"],sort:x=[]}=s,u={queries:[{indexUid:this.config.indexName,q:n,filter:[[],...p],attributesToHighlight:j,highlightPreTag:"__meili-highlight__",highlightPostTag:"__/meili-highlight__",attributesToCrop:m,sort:x,offset:v,limit:i}]},a={...this.headers};try{const d=await fetch(`${this.config.host}/multi-search`,{method:"POST",headers:a,body:JSON.stringify(u)});if(!d.ok)throw new Error(`MeiliSearch API error: ${d.status} ${d.statusText}`);const f=(await d.json()).results[0];return{hits:f.hits||[],totalHits:f.estimatedTotalHits||0,processingTimeMs:f.processingTimeMs}}catch(d){throw console.error("MeiliSearch service error:",d),new Error(`Search failed: ${d instanceof Error?d.message:"Unknown error"}`)}}async checkConnection(){try{return(await fetch(`${this.config.host}/health`,{method:"GET",headers:{Authorization:`Bearer ${this.config.apiKey}`,"X-Meilisearch-Client":"Meilisearch JavaScript (v0.41.0)"}})).ok}catch(n){return console.error("MeiliSearch connection check failed:",n),!1}}}const sr=t=>new zr(t);function ir(t,n){const{contextKey:s,usageKey:i}=t;return s?s.startsWith("course-v1:")?`${n||""}/course/${s}?show=${encodeURIComponent(i||"")}`:s.startsWith("library-v1:")?`${n||""}/library/${s}`:"#":"#"}function qr(t,n,s){const i=ir(t,n);return i==="#"?(console.warn("Could not generate URL for search hit:",t),"#"):(s?s(i):(i.startsWith("http"),window.location.href=i),i)}const Be=({text:t,highlightTag:n="__meili-highlight__"})=>{if(!t)return null;const s="__/meili-highlight__",i=t.split(n),v=[];return i.forEach((p,j)=>{if(j===0)p&&v.push(p);else{const m=p.indexOf(s);if(m!==-1){const x=p.substring(0,m),u=p.substring(m+s.length);x&&v.push(r.jsx("mark",{className:"search-highlight",children:x},`highlight-${j}`)),u&&v.push(u)}else v.push(r.jsx("mark",{className:"search-highlight",children:p},`highlight-${j}`))}}),r.jsx(r.Fragment,{children:v})};function Vr(t){return{html:"text",video:"video",problem:"quiz",vertical:"folder",sequential:"folder",chapter:"folder",about:"info",static_tab:"text",openassessment:"quiz",lti_consumer:"link",pdf:"file",scorm:"file",itembank:"library",library_content:"library"}[t]||"text"}const er=({result:t,onNavigate:n,baseUrl:s})=>{var x,u;const i=a=>{var f;a.preventDefault(),a.stopPropagation();const d={id:t.id,blockType:t.block_type||t.type,contextKey:t.context_key,usageKey:t.usage_key,breadcrumbs:((f=t.breadcrumbs)==null?void 0:f.map(o=>({displayName:o.display_name,usageKey:o.usage_key})))||[]};if(t.url){n?n(t.url):window.location.href=t.url;return}qr(d,s,n)==="#"&&(n?n(`/search-result/${t.id}`):window.location.href=`/search-result/${t.id}`)},v=a=>{var f;a.preventDefault(),a.stopPropagation();const d={id:t.id,blockType:t.block_type||t.type,contextKey:t.context_key,usageKey:t.usage_key,breadcrumbs:((f=t.breadcrumbs)==null?void 0:f.map(o=>({displayName:o.display_name,usageKey:o.usage_key})))||[]},l=ir(d,s);l&&l!=="#"&&window.open(l,"_blank")},p=((x=t._formatted)==null?void 0:x.display_name)||t.display_name,j=((u=t._formatted)==null?void 0:u.description)||t.description,m=t.block_type||t.type;return r.jsx("div",{className:"search-result-item",onClick:i,role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i(a)},children:r.jsxs("div",{className:"search-result-content",children:[r.jsx("div",{className:"search-result-icon",children:r.jsx(b.Icon,{src:Vr(m)})}),r.jsxs("div",{className:"search-result-text",children:[r.jsx("div",{className:"search-result-title",children:r.jsx(Be,{text:p})}),j&&r.jsx("div",{className:"search-result-description",children:r.jsx(Be,{text:j})}),t.breadcrumbs&&t.breadcrumbs.length>0&&r.jsx("div",{className:"search-result-breadcrumbs",children:t.breadcrumbs.map(a=>a.display_name).join(" / ")})]}),r.jsx("div",{className:"search-result-actions",children:r.jsx(b.IconButton,{src:Ir,iconAs:b.Icon,onClick:v,alt:"Open in new window",size:"sm"})})]})})},rr=new Fr,Wr=({logoUrl:t,menuList:n,loginSignupButtons:s,authenticatedUser:i=null,userMenuItems:v,menuAlignment:p,onLanguageChange:j,getBaseUrl:m,meiliSearchConfig:x,headerButtons:u,languageSelectorList:a})=>{const d=Tr(),{toggleSidebar:l,setSidebarCollapsed:f}=Ne(),[o,S]=_.useState(()=>rr.get("openedx-language-preference")||"en"),[O,y]=_.useState(!1),[T,E]=_.useState(!1),[I,L]=_.useState(!1),[Z,z]=_.useState(""),[N,Q]=_.useState([]),[ee,q]=_.useState(!1),[F,K]=_.useState(null),[H,V]=_.useState(0),[k,Y]=_.useState(!1),[J,B]=_.useState(5),oe=_.useRef(null),G=_.useRef(null),ne=_.useRef(x?sr(x):null),ce=_.useRef(!1);console.log("languageSelectorList",a),_.useEffect(()=>{x!=null&&x.client&&ne.current&&ne.current.updateHeadersFromClient(x.client)},[x==null?void 0:x.client]),_.useEffect(()=>()=>{G.current&&clearTimeout(G.current)},[]),_.useEffect(()=>{document.body.dir=o==="ar"?"rtl":"ltr"},[o]),_.useEffect(()=>{d&&!ce.current?(f(!0),ce.current=!0):d||(ce.current=!1)},[d,f]),_.useEffect(()=>{if(!T)return;function g(A){oe.current&&!oe.current.contains(A.target)&&E(!1)}return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[T]);const le=g=>{S(g),rr.set("openedx-language-preference",g,{path:m?m():"/"}),j&&j()},me=p&&{left:"justify-content-start",center:"justify-content-center",right:"justify-content-end"}[p.toLowerCase()]||"justify-content-start",ue=async g=>{if(!g.trim()||!x||!ne.current){Q([]),V(0),L(!1),Y(!1);return}q(!0),K(null),L(!1),B(5);try{const A=await ne.current.simpleSearch(g,{limit:20,offset:0});Q(A.hits),V(A.totalHits),L(A.totalHits===0),Y(!0)}catch(A){K(A instanceof Error?A.message:"Search failed"),L(!0),Q([]),V(0)}finally{q(!1)}},se=g=>{z(g),ue(g),d&&O&&y(!1)},de=g=>{z(g),I&&g.trim()===""&&(L(!1),Y(!1)),G.current&&clearTimeout(G.current),g.trim().length>0?G.current=setTimeout(()=>{ue(g)},500):(Q([]),V(0),L(!1),Y(!1))},ie=()=>{G.current&&(clearTimeout(G.current),G.current=null),z(""),Q([]),V(0),L(!1),Y(!1),K(null),q(!1)},ye=()=>{z(""),Q([]),V(0),L(!1),Y(!1),K(null),q(!1),B(5),G.current&&(clearTimeout(G.current),G.current=null)},ge=()=>{B(g=>Math.min(g+10,N.length))},ve=g=>{if(a&&a.length>0){const X=a.find(xe=>xe[g]);if(X)return X[g]}return{en:"English",ar:"Arabic",hi:"Hindi"}[g]||g.toUpperCase()},we=()=>(console.log("renderLanguageOptions - languageSelectorList:",a),console.log("renderLanguageOptions - length:",a==null?void 0:a.length),a&&a.length>0?(console.log("Using custom languageSelectorList"),a.map((g,A)=>{const[X,xe]=Object.entries(g)[0];return r.jsx(b.Dropdown.Item,{onClick:()=>le(X),children:xe},`lang-${X}-${A}`)})):(console.log("Using fallback languages"),r.jsxs(r.Fragment,{children:[r.jsx(b.Dropdown.Item,{onClick:()=>le("en"),children:"English"}),r.jsx(b.Dropdown.Item,{onClick:()=>le("ar"),children:"Arabic"}),r.jsx(b.Dropdown.Item,{onClick:()=>le("hi"),children:"Hindi"})]}))),ae=(u==null?void 0:u.reSync)||(u==null?void 0:u.contextSwitcher)||(u==null?void 0:u.help)||(u==null?void 0:u.notification)||(u==null?void 0:u.translation);return r.jsxs(b.Navbar,{expand:"lg",className:"navbarContainer py-1",children:[r.jsxs("div",{className:"d-flex align-items-center",children:[r.jsx("div",{className:"toggle-sidebar-icon",children:r.jsx(b.IconButton,{src:Nr,iconAs:b.Icon,alt:"Toggle Sidebar",onClick:l,className:"ms-2 ml-2",onMouseDown:g=>g.stopPropagation()})}),r.jsx(b.Navbar.Brand,{href:"/",className:"navbar-brand",children:r.jsx("img",{src:t,alt:"Logo"})})]}),i!==null&&r.jsx(r.Fragment,{children:d?r.jsx("div",{className:"d-flex justify-content-between align-items-center ml-auto",children:r.jsxs("div",{className:"d-flex align-items-center navbar-buttons",children:[x&&r.jsx(b.IconButton,{src:Mr,iconAs:b.Icon,alt:"Search",onClick:()=>y(!0)}),r.jsx("div",{className:"ml-2 usermenu-dropdown-mobile",children:r.jsx(Ze,{username:i==null?void 0:i.username,authenticatedUserAvatar:i==null?void 0:i.avatar,isMobile:d,isAdmin:i==null?void 0:i.administrator,menuItems:v})}),ae&&r.jsx(b.IconButton,{src:Pr,iconAs:b.Icon,alt:"More",onMouseDown:g=>g.stopPropagation(),onClick:()=>E(g=>!g)}),T&&ae&&r.jsxs("div",{className:"more-menu-dropdown",ref:oe,children:[r.jsxs("div",{className:"more-menu-icons-row",children:[(u==null?void 0:u.reSync)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Xe,iconAs:b.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Re-Sync"})}),(u==null?void 0:u.contextSwitcher)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Je,iconAs:b.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Switch to User Mode"})}),(u==null?void 0:u.help)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Ue,iconAs:b.Icon,alt:"Help",tooltipPlacement:"bottom",tooltipContent:"Help"})}),(u==null?void 0:u.notification)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Ge,iconAs:b.Icon,alt:"Notifications",tooltipPlacement:"bottom",tooltipContent:"Notifications"})})]}),(u==null?void 0:u.translation)&&r.jsxs(b.Dropdown,{className:"language-dropdown",children:[r.jsx(b.Dropdown.Toggle,{variant:"tertiary",id:"language-dropdown",children:ve(o)}),r.jsx(b.Dropdown.Menu,{children:we()})]})]})]})}):r.jsxs(r.Fragment,{children:[x&&r.jsx("div",{className:"d-flex align-items-center justify-content-start flex-grow-1 ml-4",children:r.jsxs("div",{style:{width:"30rem",position:"relative"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",border:"2px solid #ccc",borderRadius:"25px",padding:"8px 16px",background:"#fff",position:"relative"},children:[r.jsx("input",{type:"text",value:Z,onChange:g=>{de(g.target.value)},onKeyDown:g=>{g.key==="Enter"&&se(Z)},placeholder:"Search",style:{flex:1,border:"none",outline:"none",fontSize:"16px",background:"transparent",padding:"4px"},autoComplete:"off"}),Z&&r.jsx("button",{type:"button",onClick:()=>{ie()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",marginRight:"8px"},children:"✕"})]}),ee&&r.jsxs("div",{className:"search-loading-spinner-container",children:[r.jsx("div",{className:"search-loading-spinner"}),r.jsx("span",{children:"Searching..."})]}),I&&!ee&&r.jsx("div",{className:"no-results-message-desktop",children:r.jsx("p",{children:"We didn't find anything matching your search"})}),F&&r.jsx("div",{className:"search-error-message-desktop",children:r.jsxs("p",{children:["Search error: ",F]})}),k&&N.length>0&&r.jsxs("div",{className:"search-results-dropdown",children:[r.jsx("div",{className:"search-results-header",children:r.jsxs("span",{children:[H," result",H!==1?"s":""," found"]})}),r.jsxs("div",{className:"search-results-list",children:[N.slice(0,J).map((g,A)=>r.jsx(er,{result:g,onNavigate:X=>{ye(),window.location.href=X},baseUrl:m?m():void 0},g.id||A)),J<N.length&&r.jsx("div",{className:"search-results-more",children:r.jsxs("button",{onClick:ge,style:{background:"none",border:"none",color:"#007bff",cursor:"pointer",padding:"8px 16px",width:"100%",textAlign:"center",fontSize:"14px"},children:["Show ",Math.min(10,N.length-J)," more results"]})})]})]})]})}),r.jsxs("div",{className:"d-flex align-items-center gap-2 ms-auto order-lg-3",children:[(u==null?void 0:u.reSync)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Xe,iconAs:b.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Re-Sync"})}),(u==null?void 0:u.contextSwitcher)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Je,iconAs:b.Icon,alt:"Sync",tooltipPlacement:"bottom",tooltipContent:"Switch to User Mode"})}),(u==null?void 0:u.help)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Ue,iconAs:b.Icon,alt:"Help",tooltipPlacement:"bottom",tooltipContent:"Help"})}),(u==null?void 0:u.notification)&&r.jsx("div",{className:"icon-curved-square",children:r.jsx(b.IconButtonWithTooltip,{src:Ge,iconAs:b.Icon,alt:"Notifications",tooltipPlacement:"bottom",tooltipContent:"Notifications"})}),(u==null?void 0:u.translation)&&r.jsxs(b.Dropdown,{className:"language-dropdown",children:[r.jsx(b.Dropdown.Toggle,{variant:"tertiary",id:"language-dropdown",children:ve(o)}),r.jsx(b.Dropdown.Menu,{children:we()})]}),r.jsx("div",{className:"usermenu-dropdown",children:r.jsx(Ze,{username:i==null?void 0:i.username,authenticatedUserAvatar:i==null?void 0:i.avatar,isMobile:d,isAdmin:i==null?void 0:i.administrator,menuItems:v})})]})]})}),i===null&&r.jsxs(r.Fragment,{children:[r.jsx(b.Navbar.Toggle,{"aria-controls":"main-navbar-nav"}),r.jsx("div",{className:"d-flex align-items-center gap-2 ms-auto order-lg-3",children:s&&r.jsxs(r.Fragment,{children:[r.jsx(b.Button,{variant:"primary",children:"Log In"}),r.jsx(b.Button,{variant:"outline-primary",children:"Sign Up"})]})})]}),r.jsx(b.Navbar.Collapse,{id:"main-navbar-nav",className:"justify-content-between",children:r.jsx(b.Nav,{className:`nav-gap gap-3 flex-grow-1 ${me}`,children:i===null&&n.map(g=>g.subMenu?r.jsx(b.NavDropdown,{title:g.label,id:`nav-dropdown-${g.label}`,children:g.subMenu.map(A=>r.jsx(b.NavDropdown.Item,{onClick:()=>console.log("Selected submenu:",A.label),children:A.label},`sub-${A.label}`))},`menu-${g.label}`):r.jsx(b.Nav.Link,{as:"span",className:"text-uppercase fw-semibold",children:g.label},`menu-${g.label}`))})}),x&&O&&r.jsxs("div",{className:"fixed-search-bar",children:[r.jsxs("div",{className:"fixed-search-bar-inner",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",border:"2px solid #ccc",borderRadius:"25px",padding:"12px 16px",background:"#fff",position:"relative",width:"100%"},children:[r.jsx("input",{type:"text",value:Z,onChange:g=>{de(g.target.value)},onKeyDown:g=>{g.key==="Enter"&&se(Z)},placeholder:"Search",style:{flex:1,border:"none",outline:"none",fontSize:"18px",background:"transparent",padding:"4px"},autoComplete:"off",autoFocus:!0}),Z&&r.jsx("button",{type:"button",onClick:()=>{ie()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",marginRight:"8px",fontSize:"18px"},children:"✕"})]}),r.jsx("button",{className:"close-search-bar",type:"button",onClick:()=>y(!1),"aria-label":"Close Search",children:"×"})]}),ee&&r.jsxs("div",{className:"search-loading-spinner-container",children:[r.jsx("div",{className:"search-loading-spinner"}),r.jsx("span",{children:"Searching..."})]}),I&&!ee&&r.jsx("div",{className:"no-results-message",children:r.jsx("p",{children:"We didn't find anything matching your search"})}),F&&r.jsx("div",{className:"search-error-message",children:r.jsxs("p",{children:["Search error: ",F]})}),k&&N.length>0&&r.jsxs("div",{className:"search-results-mobile",children:[r.jsx("div",{className:"search-results-header",children:r.jsxs("span",{children:[H," result",H!==1?"s":""," found"]})}),r.jsxs("div",{className:"search-results-list",children:[N.slice(0,J).map((g,A)=>r.jsx(er,{result:g,onNavigate:X=>{ye(),window.location.href=X},baseUrl:m?m():void 0},g.id||A)),J<N.length&&r.jsx("div",{className:"search-results-more",children:r.jsxs("button",{onClick:ge,style:{background:"none",border:"none",color:"#007bff",cursor:"pointer",padding:"12px 16px",width:"100%",textAlign:"center",fontSize:"16px"},children:["Show ",Math.min(10,N.length-J)," more results"]})})]})]})]})]})},ar=_.createContext(void 0),Kr=({children:t,meiliSearchConfig:n})=>{const[s,i]=_.useState(""),[v,p]=_.useState([]),[j,m]=_.useState(0),[x,u]=_.useState(!1),[a,d]=_.useState(!1),[l,f]=_.useState(null),[o,S]=_.useState(0),[O,y]=_.useState(!1),[T,E]=_.useState(!1),[I,L]=_.useState(null),Z=sr(n),z=async q=>{if(!q.trim()){Q();return}u(!0),d(!1),f(null),S(0);try{const F=await Z.search(q,{limit:20,offset:0}),K=F.hits.map(k=>{var Y,J,B;return{id:k.id,title:((Y=k._formatted)==null?void 0:Y.display_name)||k.display_name,type:k.type,url:k.url,description:((J=k._formatted)==null?void 0:J.description)||k.description,block_type:k.block_type,published:((B=k._formatted)==null?void 0:B.published)||k.published,_formatted:k._formatted}}),H=F.totalHits,V=K.length===20&&H>K.length;p(K),m(H),y(V),L(F.facets||null)}catch(F){console.error("Search error:",F),d(!0),f(F instanceof Error?F.message:"Search failed"),p([]),m(0),y(!1),L(null)}finally{u(!1)}},N=async()=>{if(!(!O||T)){E(!0);try{const q=o+20,F=await Z.simpleSearch(s,{limit:20,offset:q}),K=F.hits.map(k=>{var Y,J,B;return{id:k.id,title:((Y=k._formatted)==null?void 0:Y.display_name)||k.display_name,type:k.type,url:k.url,description:((J=k._formatted)==null?void 0:J.description)||k.description,block_type:k.block_type,published:((B=k._formatted)==null?void 0:B.published)||k.published,_formatted:k._formatted}}),H=F.totalHits,V=K.length===20&&H>v.length+K.length;p(k=>[...k,...K]),m(H),y(V),S(q)}catch(q){console.error("Error fetching next page:",q),d(!0),f(q instanceof Error?q.message:"Failed to load more results")}finally{E(!1)}}},Q=()=>{i(""),p([]),m(0),d(!1),f(null),S(0),y(!1),L(null)},ee={searchKeywords:s,setSearchKeywords:i,searchResults:v,totalHits:j,isLoading:x,hasError:a,errorMessage:l,facets:I,performSearch:z,clearSearch:Q,hasNextPage:O,fetchNextPage:N,isFetchingNextPage:T};return r.jsx(ar.Provider,{value:ee,children:t})},Yr=()=>{const t=_.useContext(ar);if(t===void 0)throw new Error("useSimpleSearch must be used within a SimpleSearchProvider");return t},Jr=t=>{try{if(t.status!==200)throw new Error("Failed to fetch theme config");const n=t.data.theme_colors;if(!n||typeof n!="object")throw new Error("Invalid theme_colors in API response");const s=a=>{let d=a.replace("#","");if(d.length===3&&(d=d.split("").map(I=>I+I).join("")),d.length!==6)return{h:0,s:0,l:0};const l=parseInt(d.substring(0,2),16)/255,f=parseInt(d.substring(2,2),16)/255,o=parseInt(d.substring(4,2),16)/255,S=Math.max(l,f,o),O=Math.min(l,f,o);let y=0,T=0;const E=(S+O)/2;if(S!==O){const I=S-O;switch(T=E>.5?I/(2-S-O):I/(S+O),S){case l:y=(f-o)/I+(f<o?6:0);break;case f:y=(o-l)/I+2;break;case o:y=(l-f)/I+4;break}y*=60}return{h:y,s:T*100,l:E*100}},i=(a,d,l)=>{a=a%360,d=Math.max(0,Math.min(100,d))/100,l=Math.max(0,Math.min(100,l))/100;const f=(1-Math.abs(2*l-1))*d,o=f*(1-Math.abs(a/60%2-1)),S=l-f/2;let O=0,y=0,T=0;a<60?(O=f,y=o):a<120?(O=o,y=f):a<180?(O=o,y=f,T=o):a<240?(y=o,T=f):a<300?(O=o,T=f):(O=f,T=o);const E=I=>Math.round((I+S)*255).toString(16).padStart(2,"0");return`#${E(O)}${E(y)}${E(T)}`},v=(a,d)=>{const{h:l,s:f,l:o}=s(a);return i(l,f,o+d)},p=(a,d)=>{const{h:l,s:f,l:o}=s(a);return i(l,f,o-d)},j=(a,d)=>{let l=a.replace("#","");l.length===3&&(l=l.split("").map(y=>y+y).join(""));const f=parseInt(l.substring(0,2),16),o=parseInt(l.substring(2,2),16),S=parseInt(l.substring(4,2),16),O=Math.max(0,Math.min(1,d));return`rgba(${f}, ${o}, ${S}, ${O})`},m=(a,d,l)=>{const f=s(a),o=s(d);let S=f.h,O=o.h;Math.abs(S-O)>180&&(S>O?O+=360:S+=360);const T=(S*l+O*(1-l))%360,E=f.s*l+o.s*(1-l),I=f.l*l+o.l*(1-l);return i(T,E,I)},x={primary:n.primary,primary_alt:p(n.primary,10),primary_hover:v(n.primary,12),primary_active:p(n.primary,18),primary_light:v(n.primary,28),secondary:n.secondary,secondary_alt:p(n.secondary,10),secondary_hover:v(n.secondary,12),secondary_active:p(n.secondary,18),secondary_light:v(n.secondary,28),text_primary:n.text_primary,text_secondary:j(n.text_primary,.8),text_muted:j(n.text_primary,.6),text_light:v(n.text_primary,40),text_white:"#ffffff",bg_surface:n.bg_surface,bg_body:m(n.primary,n.bg_surface,.04),bg_hover:p(n.bg_surface,4),bg_disabled:j(n.bg_surface,.5),border_color:n.border_color,border_color_hover:p(n.border_color,12)},u=document.documentElement;Object.entries(x).forEach(([a,d])=>{u.style.setProperty(`--${a.replace(/_/g,"-")}`,d)}),console.log("Dynamic theme applied:",x)}catch(n){console.error("Error applying theme from API:",n.message);const s={primary:"#2B2399",primary_alt:"#3C32B5",primary_hover:"#E2E1F9",primary_active:"#1F1A7D",primary_light:"#E2E1F9",secondary:"#7A8AFF",secondary_alt:"#5C6EF0",secondary_hover:"#ECEEFF",secondary_active:"#4A5BD1",secondary_light:"#ECEEFF",text_primary:"#121926",text_secondary:"#9e9f9e",text_muted:"#6b7280",text_light:"#364152",text_white:"#ffffff",bg_body:"#f4f7ff",bg_surface:"#ffffff",bg_hover:"#f9fafb",bg_disabled:"#e5e7eb",border_color:"#e5e6e6",border_color_hover:"#d1d5db"},i=document.documentElement;for(const v in s)if(Object.prototype.hasOwnProperty.call(s,v)){const p=s[v];i.style.setProperty(`--${v.replace(/_/g,"-")}`,p)}console.log("Fallback theme applied")}};exports.Footer=Or;exports.MainHeader=Wr;exports.Sidebar=kr;exports.SidebarProvider=Rr;exports.SimpleSearchProvider=Kr;exports.dynamicTheme=Jr;exports.useSidebar=Ne;exports.useSimpleSearch=Yr;
|