@astermind/chatbot-template 2.2.11 → 2.2.19

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.
@@ -1,4 +1,4 @@
1
- var AsterMindChatbot=function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r={exports:{}},a={},o=Symbol.for("react.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function w(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}function k(){}function S(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=w.prototype;var x=S.prototype=new k;x.constructor=S,v(x,w.prototype),x.isPureReactComponent=!0;var C=Array.isArray,_=Object.prototype.hasOwnProperty,E={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,n){var r,a={},i=null,l=null;if(null!=t)for(r in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)_.call(t,r)&&!M.hasOwnProperty(r)&&(a[r]=t[r]);var s=arguments.length-2;if(1===s)a.children=n;else if(1<s){for(var u=Array(s),c=0;c<s;c++)u[c]=arguments[c+2];a.children=u}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===a[r]&&(a[r]=s[r]);return{$$typeof:o,type:e,key:i,ref:l,props:a,_owner:E.current}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var R=/\/+/g;function L(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function A(e,t,n,r,a){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case o:case i:s=!0}}if(s)return a=a(s=e),e=""===r?"."+L(s,0):r,C(a)?(n="",null!=e&&(n=e.replace(R,"$&/")+"/"),A(a,t,n,"",function(e){return e})):null!=a&&(P(a)&&(a=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(R,"$&/")+"/")+e)),t.push(a)),1;if(s=0,r=""===r?".":r+":",C(e))for(var u=0;u<e.length;u++){var c=r+L(l=e[u],u);s+=A(l,t,n,c,a)}else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=g&&e[g]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),u=0;!(l=e.next()).done;)s+=A(l=l.value,t,n,c=r+L(l,u++),a);else if("object"===l)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function T(e,t,n){if(null==e)return e;var r=[],a=0;return A(e,r,"","",function(e){return t.call(n,e,a++)}),r}function z(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var D={current:null},I={transition:null},O={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:I,ReactCurrentOwner:E};function F(){throw Error("act(...) is not supported in production builds of React.")}a.Children={map:T,forEach:function(e,t,n){T(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return T(e,function(){t++}),t},toArray:function(e){return T(e,function(e){return e})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},a.Component=w,a.Fragment=l,a.Profiler=u,a.PureComponent=S,a.StrictMode=s,a.Suspense=p,a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,a.act=F,a.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=v({},e.props),a=e.key,i=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,l=E.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(u in t)_.call(t,u)&&!M.hasOwnProperty(u)&&(r[u]=void 0===t[u]&&void 0!==s?s[u]:t[u])}var u=arguments.length-2;if(1===u)r.children=n;else if(1<u){s=Array(u);for(var c=0;c<u;c++)s[c]=arguments[c+2];r.children=s}return{$$typeof:o,type:e.type,key:a,ref:i,props:r,_owner:l}},a.createContext=function(e){return(e={$$typeof:d,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:c,_context:e},e.Consumer=e},a.createElement=N,a.createFactory=function(e){var t=N.bind(null,e);return t.type=e,t},a.createRef=function(){return{current:null}},a.forwardRef=function(e){return{$$typeof:f,render:e}},a.isValidElement=P,a.lazy=function(e){return{$$typeof:m,_payload:{_status:-1,_result:e},_init:z}},a.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},a.startTransition=function(e){var t=I.transition;I.transition={};try{e()}finally{I.transition=t}},a.unstable_act=F,a.useCallback=function(e,t){return D.current.useCallback(e,t)},a.useContext=function(e){return D.current.useContext(e)},a.useDebugValue=function(){},a.useDeferredValue=function(e){return D.current.useDeferredValue(e)},a.useEffect=function(e,t){return D.current.useEffect(e,t)},a.useId=function(){return D.current.useId()},a.useImperativeHandle=function(e,t,n){return D.current.useImperativeHandle(e,t,n)},a.useInsertionEffect=function(e,t){return D.current.useInsertionEffect(e,t)},a.useLayoutEffect=function(e,t){return D.current.useLayoutEffect(e,t)},a.useMemo=function(e,t){return D.current.useMemo(e,t)},a.useReducer=function(e,t,n){return D.current.useReducer(e,t,n)},a.useRef=function(e){return D.current.useRef(e)},a.useState=function(e){return D.current.useState(e)},a.useSyncExternalStore=function(e,t,n){return D.current.useSyncExternalStore(e,t,n)},a.useTransition=function(){return D.current.useTransition()},a.version="18.3.1",r.exports=a;var j=r.exports,U=n(j),$={exports:{}},B={},V={exports:{}},W={};
1
+ var AsterMindChatbot=function(e,t){"use strict";var n="undefined"!=typeof document?document.currentScript:null;function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a={exports:{}},o={},i=Symbol.for("react.element"),s=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function k(e,t,n){this.props=e,this.context=t,this.refs=w,this.updater=n||v}function S(){}function x(e,t,n){this.props=e,this.context=t,this.refs=w,this.updater=n||v}k.prototype.isReactComponent={},k.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},k.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=k.prototype;var C=x.prototype=new S;C.constructor=x,b(C,k.prototype),C.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,M={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function A(e,t,n){var r,a={},o=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)_.call(t,r)&&!R.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(1===l)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===a[r]&&(a[r]=l[r]);return{$$typeof:i,type:e,key:o,ref:s,props:a,_owner:M.current}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var L=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,t,n,r,a){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var l=!1;if(null===e)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case i:case s:l=!0}}if(l)return a=a(l=e),e=""===r?"."+T(l,0):r,E(a)?(n="",null!=e&&(n=e.replace(L,"$&/")+"/"),N(a,t,n,"",function(e){return e})):null!=a&&(P(a)&&(a=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||l&&l.key===a.key?"":(""+a.key).replace(L,"$&/")+"/")+e)),t.push(a)),1;if(l=0,r=""===r?".":r+":",E(e))for(var c=0;c<e.length;c++){var u=r+T(o=e[c],c);l+=N(o,t,n,u,a)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=y&&e[y]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(o=e.next()).done;)l+=N(o=o.value,t,n,u=r+T(o,c++),a);else if("object"===o)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function D(e,t,n){if(null==e)return e;var r=[],a=0;return N(e,r,"","",function(e){return t.call(n,e,a++)}),r}function I(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var z={current:null},F={transition:null},O={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:F,ReactCurrentOwner:M};function $(){throw Error("act(...) is not supported in production builds of React.")}o.Children={map:D,forEach:function(e,t,n){D(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return D(e,function(){t++}),t},toArray:function(e){return D(e,function(e){return e})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},o.Component=k,o.Fragment=l,o.Profiler=u,o.PureComponent=x,o.StrictMode=c,o.Suspense=p,o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,o.act=$,o.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=b({},e.props),a=e.key,o=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,s=M.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)_.call(t,c)&&!R.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:i,type:e.type,key:a,ref:o,props:r,_owner:s}},o.createContext=function(e){return(e={$$typeof:f,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:d,_context:e},e.Consumer=e},o.createElement=A,o.createFactory=function(e){var t=A.bind(null,e);return t.type=e,t},o.createRef=function(){return{current:null}},o.forwardRef=function(e){return{$$typeof:h,render:e}},o.isValidElement=P,o.lazy=function(e){return{$$typeof:g,_payload:{_status:-1,_result:e},_init:I}},o.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},o.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},o.unstable_act=$,o.useCallback=function(e,t){return z.current.useCallback(e,t)},o.useContext=function(e){return z.current.useContext(e)},o.useDebugValue=function(){},o.useDeferredValue=function(e){return z.current.useDeferredValue(e)},o.useEffect=function(e,t){return z.current.useEffect(e,t)},o.useId=function(){return z.current.useId()},o.useImperativeHandle=function(e,t,n){return z.current.useImperativeHandle(e,t,n)},o.useInsertionEffect=function(e,t){return z.current.useInsertionEffect(e,t)},o.useLayoutEffect=function(e,t){return z.current.useLayoutEffect(e,t)},o.useMemo=function(e,t){return z.current.useMemo(e,t)},o.useReducer=function(e,t,n){return z.current.useReducer(e,t,n)},o.useRef=function(e){return z.current.useRef(e)},o.useState=function(e){return z.current.useState(e)},o.useSyncExternalStore=function(e,t,n){return z.current.useSyncExternalStore(e,t,n)},o.useTransition=function(){return z.current.useTransition()},o.version="18.3.1",a.exports=o;var j=a.exports,U=r(j),B={exports:{}},V={},W={exports:{}},H={};
2
2
  /**
3
3
  * @license React
4
4
  * scheduler.production.min.js
@@ -8,7 +8,7 @@ var AsterMindChatbot=function(e){"use strict";var t="undefined"!=typeof document
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
- !function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var l=2*(r+1)-1,s=e[l],u=l+1,c=e[u];if(0>a(s,n))u<o&&0>a(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else{if(!(u<o&&0>a(c,n)))break e;e[r]=c,e[u]=n,r=u}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var s=[],u=[],c=1,d=null,f=3,p=!1,h=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var a=n(u);null!==a;){if(null===a.callback)r(u);else{if(!(a.startTime<=e))break;r(u),a.sortIndex=a.expirationTime,t(s,a)}a=n(u)}}function w(e){if(m=!1,b(e),!h)if(null!==n(s))h=!0,A(k);else{var t=n(u);null!==t&&T(w,t.startTime-e)}}function k(t,a){h=!1,m&&(m=!1,y(_),_=-1),p=!0;var o=f;try{for(b(a),d=n(s);null!==d&&(!(d.expirationTime>a)||t&&!N());){var i=d.callback;if("function"==typeof i){d.callback=null,f=d.priorityLevel;var l=i(d.expirationTime<=a);a=e.unstable_now(),"function"==typeof l?d.callback=l:d===n(s)&&r(s),b(a)}else r(s);d=n(s)}if(null!==d)var c=!0;else{var g=n(u);null!==g&&T(w,g.startTime-a),c=!1}return c}finally{d=null,f=o,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,C=null,_=-1,E=5,M=-1;function N(){return!(e.unstable_now()-M<E)}function P(){if(null!==C){var t=e.unstable_now();M=t;var n=!0;try{n=C(!0,t)}finally{n?S():(x=!1,C=null)}}else x=!1}if("function"==typeof v)S=function(){v(P)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,L=R.port2;R.port1.onmessage=P,S=function(){L.postMessage(null)}}else S=function(){g(P,0)};function A(e){C=e,x||(x=!0,S())}function T(t,n){_=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){h||p||(h=!0,A(k))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(s)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,a,o){var i=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:c++,callback:a,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>i?(r.sortIndex=o,t(u,r),null===n(s)&&r===n(u)&&(m?(y(_),_=-1):m=!0,T(w,o-i))):(r.sortIndex=l,t(s,r),h||p||(h=!0,A(k))),r},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(W),V.exports=W;var H=V.exports,K=j,Q=H;
11
+ !function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>a(l,n))c<o&&0>a(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var a=n(c);null!==a;){if(null===a.callback)r(c);else{if(!(a.startTime<=e))break;r(c),a.sortIndex=a.expirationTime,t(l,a)}a=n(c)}}function w(e){if(m=!1,b(e),!p)if(null!==n(l))p=!0,T(k);else{var t=n(c);null!==t&&N(w,t.startTime-e)}}function k(t,a){p=!1,m&&(m=!1,y(E),E=-1),h=!0;var o=f;try{for(b(a),d=n(l);null!==d&&(!(d.expirationTime>a)||t&&!R());){var i=d.callback;if("function"==typeof i){d.callback=null,f=d.priorityLevel;var s=i(d.expirationTime<=a);a=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(a)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&N(w,g.startTime-a),u=!1}return u}finally{d=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,C=null,E=-1,_=5,M=-1;function R(){return!(e.unstable_now()-M<_)}function A(){if(null!==C){var t=e.unstable_now();M=t;var n=!0;try{n=C(!0,t)}finally{n?S():(x=!1,C=null)}}else x=!1}if("function"==typeof v)S=function(){v(A)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,L=P.port2;P.port1.onmessage=A,S=function(){L.postMessage(null)}}else S=function(){g(A,0)};function T(e){C=e,x||(x=!0,S())}function N(t,n){E=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){p||h||(p=!0,T(k))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,a,o){var i=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return r={id:u++,callback:a,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(y(E),E=-1):m=!0,N(w,o-i))):(r.sortIndex=s,t(l,r),p||h||(p=!0,T(k))),r},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(H),W.exports=H;var K=W.exports,q=j,G=K;
12
12
  /**
13
13
  * @license React
14
14
  * react-dom.production.min.js
@@ -17,5 +17,5 @@ var AsterMindChatbot=function(e){"use strict";var t="undefined"!=typeof document
17
17
  *
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
- */function G(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var q=new Set,Y={};function X(e,t){J(e,t),J(e+"Capture",t)}function J(e,t){for(Y[e]=t,e=0;e<t.length;e++)q.add(t[e])}var Z=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ee=Object.prototype.hasOwnProperty,te=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ne={},re={};function ae(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oe[e]=new ae(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oe[t]=new ae(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){oe[e]=new ae(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oe[e]=new ae(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oe[e]=new ae(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){oe[e]=new ae(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){oe[e]=new ae(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){oe[e]=new ae(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){oe[e]=new ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var ie=/[\-:]([a-z])/g;function le(e){return e[1].toUpperCase()}function se(e,t,n,r){var a=oe.hasOwnProperty(t)?oe[t]:null;(null!==a?0!==a.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!ee.call(re,e)||!ee.call(ne,e)&&(te.test(e)?re[e]=!0:(ne[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ie,le);oe[t]=new ae(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ie,le);oe[t]=new ae(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ie,le);oe[t]=new ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){oe[e]=new ae(e,1,!1,e.toLowerCase(),null,!1,!1)}),oe.xlinkHref=new ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){oe[e]=new ae(e,1,!1,e.toLowerCase(),null,!0,!0)});var ue=K.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ce=Symbol.for("react.element"),de=Symbol.for("react.portal"),fe=Symbol.for("react.fragment"),pe=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),me=Symbol.for("react.provider"),ge=Symbol.for("react.context"),ye=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),be=Symbol.for("react.suspense_list"),we=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),Se=Symbol.for("react.offscreen"),xe=Symbol.iterator;function Ce(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=xe&&e[xe]||e["@@iterator"])?e:null}var _e,Ee=Object.assign;function Me(e){if(void 0===_e)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||""}return"\n"+_e+e}var Ne=!1;function Pe(e,t){if(!e||Ne)return"";Ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,l=o.length-1;1<=i&&0<=l&&a[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==o[l]){if(1!==i||1!==l)do{if(i--,0>--l||a[i]!==o[l]){var s="\n"+a[i].replace(" at new "," at ");return e.displayName&&s.includes("<anonymous>")&&(s=s.replace("<anonymous>",e.displayName)),s}}while(1<=i&&0<=l);break}}}finally{Ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Me(e):""}function Re(e){switch(e.tag){case 5:return Me(e.type);case 16:return Me("Lazy");case 13:return Me("Suspense");case 19:return Me("SuspenseList");case 0:case 2:case 15:return e=Pe(e.type,!1);case 11:return e=Pe(e.type.render,!1);case 1:return e=Pe(e.type,!0);default:return""}}function Le(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case fe:return"Fragment";case de:return"Portal";case he:return"Profiler";case pe:return"StrictMode";case ve:return"Suspense";case be:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ge:return(e.displayName||"Context")+".Consumer";case me:return(e._context.displayName||"Context")+".Provider";case ye:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case we:return null!==(t=e.displayName||null)?t:Le(e.type)||"Memo";case ke:t=e._payload,e=e._init;try{return Le(e(t))}catch(e){}}return null}function Ae(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Le(t);case 8:return t===pe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function Te(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function ze(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function De(e){e._valueTracker||(e._valueTracker=function(e){var t=ze(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Ie(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ze(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Oe(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Fe(e,t){var n=t.checked;return Ee({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function je(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=Te(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ue(e,t){null!=(t=t.checked)&&se(e,"checked",t,!1)}function $e(e,t){Ue(e,t);var n=Te(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ve(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ve(e,t.type,Te(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Be(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function Ve(e,t,n){"number"===t&&Oe(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var We=Array.isArray;function He(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Te(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function Ke(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(G(91));return Ee({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Qe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(G(92));if(We(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Te(n)}}function Ge(e,t){var n=Te(t.value),r=Te(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function qe(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Ye(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Xe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Ye(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Je,Ze,et=(Ze=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Je=Je||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return Ze(e,t)})}:Ze);function tt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var nt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rt=["Webkit","ms","Moz","O"];function at(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||nt.hasOwnProperty(e)&&nt[e]?(""+t).trim():t+"px"}function ot(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=at(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(nt).forEach(function(e){rt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nt[t]=nt[e]})});var it=Ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lt(e,t){if(t){if(it[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(G(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(G(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(G(62))}}function st(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ut=null;function ct(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var dt=null,ft=null,pt=null;function ht(e){if(e=so(e)){if("function"!=typeof dt)throw Error(G(280));var t=e.stateNode;t&&(t=co(t),dt(e.stateNode,e.type,t))}}function mt(e){ft?pt?pt.push(e):pt=[e]:ft=e}function gt(){if(ft){var e=ft,t=pt;if(pt=ft=null,ht(e),t)for(e=0;e<t.length;e++)ht(t[e])}}function yt(e,t){return e(t)}function vt(){}var bt=!1;function wt(e,t,n){if(bt)return e(t,n);bt=!0;try{return yt(e,t,n)}finally{bt=!1,(null!==ft||null!==pt)&&(vt(),gt())}}function kt(e,t){var n=e.stateNode;if(null===n)return null;var r=co(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(G(231,t,typeof n));return n}var St=!1;if(Z)try{var xt={};Object.defineProperty(xt,"passive",{get:function(){St=!0}}),window.addEventListener("test",xt,xt),window.removeEventListener("test",xt,xt)}catch(Ze){St=!1}function Ct(e,t,n,r,a,o,i,l,s){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(e){this.onError(e)}}var _t=!1,Et=null,Mt=!1,Nt=null,Pt={onError:function(e){_t=!0,Et=e}};function Rt(e,t,n,r,a,o,i,l,s){_t=!1,Et=null,Ct.apply(Pt,arguments)}function Lt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function At(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Tt(e){if(Lt(e)!==e)throw Error(G(188))}function zt(e){return e=function(e){var t=e.alternate;if(!t){if(null===(t=Lt(e)))throw Error(G(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Tt(a),e;if(o===r)return Tt(a),t;o=o.sibling}throw Error(G(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,l=a.child;l;){if(l===n){i=!0,n=a,r=o;break}if(l===r){i=!0,r=a,n=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===n){i=!0,n=o,r=a;break}if(l===r){i=!0,r=o,n=a;break}l=l.sibling}if(!i)throw Error(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(3!==n.tag)throw Error(G(188));return n.stateNode.current===n?e:t}(e),null!==e?Dt(e):null}function Dt(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Dt(e);if(null!==t)return t;e=e.sibling}return null}var It=Q.unstable_scheduleCallback,Ot=Q.unstable_cancelCallback,Ft=Q.unstable_shouldYield,jt=Q.unstable_requestPaint,Ut=Q.unstable_now,$t=Q.unstable_getCurrentPriorityLevel,Bt=Q.unstable_ImmediatePriority,Vt=Q.unstable_UserBlockingPriority,Wt=Q.unstable_NormalPriority,Ht=Q.unstable_LowPriority,Kt=Q.unstable_IdlePriority,Qt=null,Gt=null;var qt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Yt(e)/Xt|0)|0},Yt=Math.log,Xt=Math.LN2;var Jt=64,Zt=4194304;function en(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tn(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=268435455&n;if(0!==i){var l=i&~a;0!==l?r=en(l):0!==(o&=i)&&(r=en(o))}else 0!==(i=n&~a)?r=en(i):0!==o&&(r=en(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(o=t&-t)||16===a&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-qt(t)),r|=e[n],t&=~a;return r}function nn(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function rn(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function an(){var e=Jt;return!(4194240&(Jt<<=1))&&(Jt=64),e}function on(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ln(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-qt(t)]=n}function sn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-qt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var un=0;function cn(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var dn,fn,pn,hn,mn,gn=!1,yn=[],vn=null,bn=null,wn=null,kn=new Map,Sn=new Map,xn=[],Cn="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _n(e,t){switch(e){case"focusin":case"focusout":vn=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":wn=null;break;case"pointerover":case"pointerout":kn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sn.delete(t.pointerId)}}function En(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=so(t))&&fn(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Mn(e){var t=lo(e.target);if(null!==t){var n=Lt(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=At(n)))return e.blockedOn=t,void mn(e.priority,function(){pn(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Nn(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=jn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=so(n))&&fn(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);ut=r,n.target.dispatchEvent(r),ut=null,t.shift()}return!0}function Pn(e,t,n){Nn(e)&&n.delete(t)}function Rn(){gn=!1,null!==vn&&Nn(vn)&&(vn=null),null!==bn&&Nn(bn)&&(bn=null),null!==wn&&Nn(wn)&&(wn=null),kn.forEach(Pn),Sn.forEach(Pn)}function Ln(e,t){e.blockedOn===t&&(e.blockedOn=null,gn||(gn=!0,Q.unstable_scheduleCallback(Q.unstable_NormalPriority,Rn)))}function An(e){function t(t){return Ln(t,e)}if(0<yn.length){Ln(yn[0],e);for(var n=1;n<yn.length;n++){var r=yn[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==vn&&Ln(vn,e),null!==bn&&Ln(bn,e),null!==wn&&Ln(wn,e),kn.forEach(t),Sn.forEach(t),n=0;n<xn.length;n++)(r=xn[n]).blockedOn===e&&(r.blockedOn=null);for(;0<xn.length&&null===(n=xn[0]).blockedOn;)Mn(n),null===n.blockedOn&&xn.shift()}var Tn=ue.ReactCurrentBatchConfig,zn=!0;function Dn(e,t,n,r){var a=un,o=Tn.transition;Tn.transition=null;try{un=1,On(e,t,n,r)}finally{un=a,Tn.transition=o}}function In(e,t,n,r){var a=un,o=Tn.transition;Tn.transition=null;try{un=4,On(e,t,n,r)}finally{un=a,Tn.transition=o}}function On(e,t,n,r){if(zn){var a=jn(e,t,n,r);if(null===a)Ta(e,t,r,Fn,n),_n(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return vn=En(vn,e,t,n,r,a),!0;case"dragenter":return bn=En(bn,e,t,n,r,a),!0;case"mouseover":return wn=En(wn,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return kn.set(o,En(kn.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Sn.set(o,En(Sn.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(_n(e,r),4&t&&-1<Cn.indexOf(e)){for(;null!==a;){var o=so(a);if(null!==o&&dn(o),null===(o=jn(e,t,n,r))&&Ta(e,t,r,Fn,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else Ta(e,t,r,null,n)}}var Fn=null;function jn(e,t,n,r){if(Fn=null,null!==(e=lo(e=ct(r))))if(null===(t=Lt(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=At(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Fn=e,null}function Un(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($t()){case Bt:return 1;case Vt:return 4;case Wt:case Ht:return 16;case Kt:return 536870912;default:return 16}default:return 16}}var $n=null,Bn=null,Vn=null;function Wn(){if(Vn)return Vn;var e,t,n=Bn,r=n.length,a="value"in $n?$n.value:$n.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return Vn=a.slice(e,1<t?1-t:void 0)}function Hn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Kn(){return!0}function Qn(){return!1}function Gn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?Kn:Qn,this.isPropagationStopped=Qn,this}return Ee(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Kn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Kn)},persist:function(){},isPersistent:Kn}),t}var qn,Yn,Xn,Jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zn=Gn(Jn),er=Ee({},Jn,{view:0,detail:0}),tr=Gn(er),nr=Ee({},er,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hr,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Xn&&(Xn&&"mousemove"===e.type?(qn=e.screenX-Xn.screenX,Yn=e.screenY-Xn.screenY):Yn=qn=0,Xn=e),qn)},movementY:function(e){return"movementY"in e?e.movementY:Yn}}),rr=Gn(nr),ar=Gn(Ee({},nr,{dataTransfer:0})),or=Gn(Ee({},er,{relatedTarget:0})),ir=Gn(Ee({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0})),lr=Ee({},Jn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sr=Gn(lr),ur=Gn(Ee({},Jn,{data:0})),cr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},fr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=fr[e])&&!!t[e]}function hr(){return pr}var mr=Ee({},er,{key:function(e){if(e.key){var t=cr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Hn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?dr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hr,charCode:function(e){return"keypress"===e.type?Hn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Hn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),gr=Gn(mr),yr=Gn(Ee({},nr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),vr=Gn(Ee({},er,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hr})),br=Gn(Ee({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0})),wr=Ee({},nr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),kr=Gn(wr),Sr=[9,13,27,32],xr=Z&&"CompositionEvent"in window,Cr=null;Z&&"documentMode"in document&&(Cr=document.documentMode);var _r=Z&&"TextEvent"in window&&!Cr,Er=Z&&(!xr||Cr&&8<Cr&&11>=Cr),Mr=String.fromCharCode(32),Nr=!1;function Pr(e,t){switch(e){case"keyup":return-1!==Sr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Lr=!1;var Ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Ar[e.type]:"textarea"===t}function zr(e,t,n,r){mt(r),0<(t=Da(t,"onChange")).length&&(n=new Zn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Dr=null,Ir=null;function Or(e){Ma(e,0)}function Fr(e){if(Ie(uo(e)))return e}function jr(e,t){if("change"===e)return t}var Ur=!1;if(Z){var $r;if(Z){var Br="oninput"in document;if(!Br){var Vr=document.createElement("div");Vr.setAttribute("oninput","return;"),Br="function"==typeof Vr.oninput}$r=Br}else $r=!1;Ur=$r&&(!document.documentMode||9<document.documentMode)}function Wr(){Dr&&(Dr.detachEvent("onpropertychange",Hr),Ir=Dr=null)}function Hr(e){if("value"===e.propertyName&&Fr(Ir)){var t=[];zr(t,Ir,e,ct(e)),wt(Or,t)}}function Kr(e,t,n){"focusin"===e?(Wr(),Ir=n,(Dr=t).attachEvent("onpropertychange",Hr)):"focusout"===e&&Wr()}function Qr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Fr(Ir)}function Gr(e,t){if("click"===e)return Fr(t)}function qr(e,t){if("input"===e||"change"===e)return Fr(t)}var Yr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Xr(e,t){if(Yr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ee.call(t,a)||!Yr(e[a],t[a]))return!1}return!0}function Jr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zr(e,t){var n,r=Jr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Jr(r)}}function ea(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ea(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ta(){for(var e=window,t=Oe();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Oe((e=t.contentWindow).document)}return t}function na(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function ra(e){var t=ta(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ea(n.ownerDocument.documentElement,n)){if(null!==r&&na(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=void 0===r.end?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=Zr(n,o);var i=Zr(n,r);a&&i&&(1!==e.rangeCount||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var aa=Z&&"documentMode"in document&&11>=document.documentMode,oa=null,ia=null,la=null,sa=!1;function ua(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;sa||null==oa||oa!==Oe(r)||("selectionStart"in(r=oa)&&na(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},la&&Xr(la,r)||(la=r,0<(r=Da(ia,"onSelect")).length&&(t=new Zn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=oa)))}function ca(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var da={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},fa={},pa={};function ha(e){if(fa[e])return fa[e];if(!da[e])return e;var t,n=da[e];for(t in n)if(n.hasOwnProperty(t)&&t in pa)return fa[e]=n[t];return e}Z&&(pa=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);var ma=ha("animationend"),ga=ha("animationiteration"),ya=ha("animationstart"),va=ha("transitionend"),ba=new Map,wa="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ka(e,t){ba.set(e,t),X(t,[e])}for(var Sa=0;Sa<wa.length;Sa++){var xa=wa[Sa];ka(xa.toLowerCase(),"on"+(xa[0].toUpperCase()+xa.slice(1)))}ka(ma,"onAnimationEnd"),ka(ga,"onAnimationIteration"),ka(ya,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(va,"onTransitionEnd"),J("onMouseEnter",["mouseout","mouseover"]),J("onMouseLeave",["mouseout","mouseover"]),J("onPointerEnter",["pointerout","pointerover"]),J("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ca="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_a=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ca));function Ea(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,i,l,s){if(Rt.apply(this,arguments),_t){if(!_t)throw Error(G(198));var u=Et;_t=!1,Et=null,Mt||(Mt=!0,Nt=u)}}(r,t,void 0,e),e.currentTarget=null}function Ma(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],s=l.instance,u=l.currentTarget;if(l=l.listener,s!==o&&a.isPropagationStopped())break e;Ea(a,l,u),o=s}else for(i=0;i<r.length;i++){if(s=(l=r[i]).instance,u=l.currentTarget,l=l.listener,s!==o&&a.isPropagationStopped())break e;Ea(a,l,u),o=s}}}if(Mt)throw e=Nt,Mt=!1,Nt=null,e}function Na(e,t){var n=t[ao];void 0===n&&(n=t[ao]=new Set);var r=e+"__bubble";n.has(r)||(Aa(t,e,2,!1),n.add(r))}function Pa(e,t,n){var r=0;t&&(r|=4),Aa(n,e,r,t)}var Ra="_reactListening"+Math.random().toString(36).slice(2);function La(e){if(!e[Ra]){e[Ra]=!0,q.forEach(function(t){"selectionchange"!==t&&(_a.has(t)||Pa(t,!1,e),Pa(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Ra]||(t[Ra]=!0,Pa("selectionchange",!1,t))}}function Aa(e,t,n,r){switch(Un(t)){case 1:var a=Dn;break;case 4:a=In;break;default:a=On}n=a.bind(null,t,n,e),a=void 0,!St||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Ta(e,t,n,r,a){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var l=r.stateNode.containerInfo;if(l===a||8===l.nodeType&&l.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var s=i.tag;if((3===s||4===s)&&((s=i.stateNode.containerInfo)===a||8===s.nodeType&&s.parentNode===a))return;i=i.return}for(;null!==l;){if(null===(i=lo(l)))return;if(5===(s=i.tag)||6===s){r=o=i;continue e}l=l.parentNode}}r=r.return}wt(function(){var r=o,a=ct(n),i=[];e:{var l=ba.get(e);if(void 0!==l){var s=Zn,u=e;switch(e){case"keypress":if(0===Hn(n))break e;case"keydown":case"keyup":s=gr;break;case"focusin":u="focus",s=or;break;case"focusout":u="blur",s=or;break;case"beforeblur":case"afterblur":s=or;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":s=rr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":s=ar;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":s=vr;break;case ma:case ga:case ya:s=ir;break;case va:s=br;break;case"scroll":s=tr;break;case"wheel":s=kr;break;case"copy":case"cut":case"paste":s=sr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":s=yr}var c=!!(4&t),d=!c&&"scroll"===e,f=c?null!==l?l+"Capture":null:l;c=[];for(var p,h=r;null!==h;){var m=(p=h).stateNode;if(5===p.tag&&null!==m&&(p=m,null!==f&&(null!=(m=kt(h,f))&&c.push(za(h,m,p)))),d)break;h=h.return}0<c.length&&(l=new s(l,u,null,n,a),i.push({event:l,listeners:c}))}}if(!(7&t)){if(s="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||n===ut||!(u=n.relatedTarget||n.fromElement)||!lo(u)&&!u[ro])&&(s||l)&&(l=a.window===a?a:(l=a.ownerDocument)?l.defaultView||l.parentWindow:window,s?(s=r,null!==(u=(u=n.relatedTarget||n.toElement)?lo(u):null)&&(u!==(d=Lt(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(s=null,u=r),s!==u)){if(c=rr,m="onMouseLeave",f="onMouseEnter",h="mouse","pointerout"!==e&&"pointerover"!==e||(c=yr,m="onPointerLeave",f="onPointerEnter",h="pointer"),d=null==s?l:uo(s),p=null==u?l:uo(u),(l=new c(m,h+"leave",s,n,a)).target=d,l.relatedTarget=p,m=null,lo(a)===r&&((c=new c(f,h+"enter",u,n,a)).target=p,c.relatedTarget=d,m=c),d=m,s&&u)e:{for(f=u,h=0,p=c=s;p;p=Ia(p))h++;for(p=0,m=f;m;m=Ia(m))p++;for(;0<h-p;)c=Ia(c),h--;for(;0<p-h;)f=Ia(f),p--;for(;h--;){if(c===f||null!==f&&c===f.alternate)break e;c=Ia(c),f=Ia(f)}c=null}else c=null;null!==s&&Oa(i,l,s,c,!1),null!==u&&null!==d&&Oa(i,d,u,c,!0)}if("select"===(s=(l=r?uo(r):window).nodeName&&l.nodeName.toLowerCase())||"input"===s&&"file"===l.type)var g=jr;else if(Tr(l))if(Ur)g=qr;else{g=Qr;var y=Kr}else(s=l.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(g=Gr);switch(g&&(g=g(e,r))?zr(i,g,n,a):(y&&y(e,l,r),"focusout"===e&&(y=l._wrapperState)&&y.controlled&&"number"===l.type&&Ve(l,"number",l.value)),y=r?uo(r):window,e){case"focusin":(Tr(y)||"true"===y.contentEditable)&&(oa=y,ia=r,la=null);break;case"focusout":la=ia=oa=null;break;case"mousedown":sa=!0;break;case"contextmenu":case"mouseup":case"dragend":sa=!1,ua(i,n,a);break;case"selectionchange":if(aa)break;case"keydown":case"keyup":ua(i,n,a)}var v;if(xr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Lr?Pr(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Er&&"ko"!==n.locale&&(Lr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Lr&&(v=Wn()):(Bn="value"in($n=a)?$n.value:$n.textContent,Lr=!0)),0<(y=Da(r,b)).length&&(b=new ur(b,e,null,n,a),i.push({event:b,listeners:y}),v?b.data=v:null!==(v=Rr(n))&&(b.data=v))),(v=_r?function(e,t){switch(e){case"compositionend":return Rr(t);case"keypress":return 32!==t.which?null:(Nr=!0,Mr);case"textInput":return(e=t.data)===Mr&&Nr?null:e;default:return null}}(e,n):function(e,t){if(Lr)return"compositionend"===e||!xr&&Pr(e,t)?(e=Wn(),Vn=Bn=$n=null,Lr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Er&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Da(r,"onBeforeInput")).length&&(a=new ur("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Ma(i,t)})}function za(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Da(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=kt(e,n))&&r.unshift(za(e,o,a)),null!=(o=kt(e,t))&&r.push(za(e,o,a))),e=e.return}return r}function Ia(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Oa(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var l=n,s=l.alternate,u=l.stateNode;if(null!==s&&s===r)break;5===l.tag&&null!==u&&(l=u,a?null!=(s=kt(n,o))&&i.unshift(za(n,s,l)):a||null!=(s=kt(n,o))&&i.push(za(n,s,l))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var Fa=/\r\n?/g,ja=/\u0000|\uFFFD/g;function Ua(e){return("string"==typeof e?e:""+e).replace(Fa,"\n").replace(ja,"")}function $a(e,t,n){if(t=Ua(t),Ua(e)!==t&&n)throw Error(G(425))}function Ba(){}var Va=null,Wa=null;function Ha(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Ka="function"==typeof setTimeout?setTimeout:void 0,Qa="function"==typeof clearTimeout?clearTimeout:void 0,Ga="function"==typeof Promise?Promise:void 0,qa="function"==typeof queueMicrotask?queueMicrotask:void 0!==Ga?function(e){return Ga.resolve(null).then(e).catch(Ya)}:Ka;function Ya(e){setTimeout(function(){throw e})}function Xa(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)){if(0===r)return e.removeChild(a),void An(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=a}while(n);An(t)}function Ja(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function Za(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var eo=Math.random().toString(36).slice(2),to="__reactFiber$"+eo,no="__reactProps$"+eo,ro="__reactContainer$"+eo,ao="__reactEvents$"+eo,oo="__reactListeners$"+eo,io="__reactHandles$"+eo;function lo(e){var t=e[to];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ro]||n[to]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Za(e);null!==e;){if(n=e[to])return n;e=Za(e)}return t}n=(e=n).parentNode}return null}function so(e){return!(e=e[to]||e[ro])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function uo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(G(33))}function co(e){return e[no]||null}var fo=[],po=-1;function ho(e){return{current:e}}function mo(e){0>po||(e.current=fo[po],fo[po]=null,po--)}function go(e,t){po++,fo[po]=e.current,e.current=t}var yo={},vo=ho(yo),bo=ho(!1),wo=yo;function ko(e,t){var n=e.type.contextTypes;if(!n)return yo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function So(e){return null!=(e=e.childContextTypes)}function xo(){mo(bo),mo(vo)}function Co(e,t,n){if(vo.current!==yo)throw Error(G(168));go(vo,t),go(bo,n)}function _o(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(G(108,Ae(e)||"Unknown",a));return Ee({},n,r)}function Eo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||yo,wo=vo.current,go(vo,e),go(bo,bo.current),!0}function Mo(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=_o(e,t,wo),r.__reactInternalMemoizedMergedChildContext=e,mo(bo),mo(vo),go(vo,e)):mo(bo),go(bo,n)}var No=null,Po=!1,Ro=!1;function Lo(e){null===No?No=[e]:No.push(e)}function Ao(){if(!Ro&&null!==No){Ro=!0;var e=0,t=un;try{var n=No;for(un=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}No=null,Po=!1}catch(t){throw null!==No&&(No=No.slice(e+1)),It(Bt,Ao),t}finally{un=t,Ro=!1}}return null}var To=[],zo=0,Do=null,Io=0,Oo=[],Fo=0,jo=null,Uo=1,$o="";function Bo(e,t){To[zo++]=Io,To[zo++]=Do,Do=e,Io=t}function Vo(e,t,n){Oo[Fo++]=Uo,Oo[Fo++]=$o,Oo[Fo++]=jo,jo=e;var r=Uo;e=$o;var a=32-qt(r)-1;r&=~(1<<a),n+=1;var o=32-qt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Uo=1<<32-qt(t)+a|n<<a|r,$o=o+e}else Uo=1<<o|n<<a|r,$o=e}function Wo(e){null!==e.return&&(Bo(e,1),Vo(e,1,0))}function Ho(e){for(;e===Do;)Do=To[--zo],To[zo]=null,Io=To[--zo],To[zo]=null;for(;e===jo;)jo=Oo[--Fo],Oo[Fo]=null,$o=Oo[--Fo],Oo[Fo]=null,Uo=Oo[--Fo],Oo[Fo]=null}var Ko=null,Qo=null,Go=!1,qo=null;function Yo(e,t){var n=wc(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Xo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,Ko=e,Qo=Ja(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Ko=e,Qo=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==jo?{id:Uo,overflow:$o}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=wc(18,null,null,0)).stateNode=t,n.return=e,e.child=n,Ko=e,Qo=null,!0);default:return!1}}function Jo(e){return!(!(1&e.mode)||128&e.flags)}function Zo(e){if(Go){var t=Qo;if(t){var n=t;if(!Xo(e,t)){if(Jo(e))throw Error(G(418));t=Ja(n.nextSibling);var r=Ko;t&&Xo(e,t)?Yo(r,n):(e.flags=-4097&e.flags|2,Go=!1,Ko=e)}}else{if(Jo(e))throw Error(G(418));e.flags=-4097&e.flags|2,Go=!1,Ko=e}}}function ei(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Ko=e}function ti(e){if(e!==Ko)return!1;if(!Go)return ei(e),Go=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Ha(e.type,e.memoizedProps)),t&&(t=Qo)){if(Jo(e))throw ni(),Error(G(418));for(;t;)Yo(e,t),t=Ja(t.nextSibling)}if(ei(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Qo=Ja(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Qo=null}}else Qo=Ko?Ja(e.stateNode.nextSibling):null;return!0}function ni(){for(var e=Qo;e;)e=Ja(e.nextSibling)}function ri(){Qo=Ko=null,Go=!1}function ai(e){null===qo?qo=[e]:qo.push(e)}var oi=ue.ReactCurrentBatchConfig;function ii(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(G(309));var r=n.stateNode}if(!r)throw Error(G(147,e));var a=r,o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(G(284));if(!n._owner)throw Error(G(290,e))}return e}function li(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function si(e){return(0,e._init)(e._payload)}function ui(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=Sc(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Ec(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function s(e,t,n,r){var o=n.type;return o===fe?c(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===ke&&si(o)===t.type)?((r=a(t,n.props)).ref=ii(e,t,n),r.return=e,r):((r=xc(n.type,n.key,n.props,null,e.mode,r)).ref=ii(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Mc(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function c(e,t,n,r,o){return null===t||7!==t.tag?((t=Cc(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Ec(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ce:return(n=xc(t.type,t.key,t.props,null,e.mode,n)).ref=ii(e,null,t),n.return=e,n;case de:return(t=Mc(t,e.mode,n)).return=e,t;case ke:return d(e,(0,t._init)(t._payload),n)}if(We(t)||Ce(t))return(t=Cc(t,e.mode,n,null)).return=e,t;li(e,t)}return null}function f(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case ce:return n.key===a?s(e,t,n,r):null;case de:return n.key===a?u(e,t,n,r):null;case ke:return f(e,t,(a=n._init)(n._payload),r)}if(We(n)||Ce(n))return null!==a?null:c(e,t,n,r,null);li(e,n)}return null}function p(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case ce:return s(t,e=e.get(null===r.key?n:r.key)||null,r,a);case de:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a);case ke:return p(e,t,n,(0,r._init)(r._payload),a)}if(We(r)||Ce(r))return c(t,e=e.get(n)||null,r,a,null);li(t,r)}return null}function h(a,i,l,s){for(var u=null,c=null,h=i,m=i=0,g=null;null!==h&&m<l.length;m++){h.index>m?(g=h,h=null):g=h.sibling;var y=f(a,h,l[m],s);if(null===y){null===h&&(h=g);break}e&&h&&null===y.alternate&&t(a,h),i=o(y,i,m),null===c?u=y:c.sibling=y,c=y,h=g}if(m===l.length)return n(a,h),Go&&Bo(a,m),u;if(null===h){for(;m<l.length;m++)null!==(h=d(a,l[m],s))&&(i=o(h,i,m),null===c?u=h:c.sibling=h,c=h);return Go&&Bo(a,m),u}for(h=r(a,h);m<l.length;m++)null!==(g=p(h,a,m,l[m],s))&&(e&&null!==g.alternate&&h.delete(null===g.key?m:g.key),i=o(g,i,m),null===c?u=g:c.sibling=g,c=g);return e&&h.forEach(function(e){return t(a,e)}),Go&&Bo(a,m),u}function m(a,i,l,s){var u=Ce(l);if("function"!=typeof u)throw Error(G(150));if(null==(l=u.call(l)))throw Error(G(151));for(var c=u=null,h=i,m=i=0,g=null,y=l.next();null!==h&&!y.done;m++,y=l.next()){h.index>m?(g=h,h=null):g=h.sibling;var v=f(a,h,y.value,s);if(null===v){null===h&&(h=g);break}e&&h&&null===v.alternate&&t(a,h),i=o(v,i,m),null===c?u=v:c.sibling=v,c=v,h=g}if(y.done)return n(a,h),Go&&Bo(a,m),u;if(null===h){for(;!y.done;m++,y=l.next())null!==(y=d(a,y.value,s))&&(i=o(y,i,m),null===c?u=y:c.sibling=y,c=y);return Go&&Bo(a,m),u}for(h=r(a,h);!y.done;m++,y=l.next())null!==(y=p(h,a,m,y.value,s))&&(e&&null!==y.alternate&&h.delete(null===y.key?m:y.key),i=o(y,i,m),null===c?u=y:c.sibling=y,c=y);return e&&h.forEach(function(e){return t(a,e)}),Go&&Bo(a,m),u}return function e(r,o,l,s){if("object"==typeof l&&null!==l&&l.type===fe&&null===l.key&&(l=l.props.children),"object"==typeof l&&null!==l){switch(l.$$typeof){case ce:e:{for(var u=l.key,c=o;null!==c;){if(c.key===u){if((u=l.type)===fe){if(7===c.tag){n(r,c.sibling),(o=a(c,l.props.children)).return=r,r=o;break e}}else if(c.elementType===u||"object"==typeof u&&null!==u&&u.$$typeof===ke&&si(u)===c.type){n(r,c.sibling),(o=a(c,l.props)).ref=ii(r,c,l),o.return=r,r=o;break e}n(r,c);break}t(r,c),c=c.sibling}l.type===fe?((o=Cc(l.props.children,r.mode,s,l.key)).return=r,r=o):((s=xc(l.type,l.key,l.props,null,r.mode,s)).ref=ii(r,o,l),s.return=r,r=s)}return i(r);case de:e:{for(c=l.key;null!==o;){if(o.key===c){if(4===o.tag&&o.stateNode.containerInfo===l.containerInfo&&o.stateNode.implementation===l.implementation){n(r,o.sibling),(o=a(o,l.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Mc(l,r.mode,s)).return=r,r=o}return i(r);case ke:return e(r,o,(c=l._init)(l._payload),s)}if(We(l))return h(r,o,l,s);if(Ce(l))return m(r,o,l,s);li(r,l)}return"string"==typeof l&&""!==l||"number"==typeof l?(l=""+l,null!==o&&6===o.tag?(n(r,o.sibling),(o=a(o,l)).return=r,r=o):(n(r,o),(o=Ec(l,r.mode,s)).return=r,r=o),i(r)):n(r,o)}}var ci=ui(!0),di=ui(!1),fi=ho(null),pi=null,hi=null,mi=null;function gi(){mi=hi=pi=null}function yi(e){var t=fi.current;mo(fi),e._currentValue=t}function vi(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function bi(e,t){pi=e,mi=hi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ss=!0),e.firstContext=null)}function wi(e){var t=e._currentValue;if(mi!==e)if(e={context:e,memoizedValue:t,next:null},null===hi){if(null===pi)throw Error(G(308));hi=e,pi.dependencies={lanes:0,firstContext:e}}else hi=hi.next=e;return t}var ki=null;function Si(e){null===ki?ki=[e]:ki.push(e)}function xi(e,t,n,r){var a=t.interleaved;return null===a?(n.next=n,Si(t)):(n.next=a.next,a.next=n),t.interleaved=n,Ci(e,r)}function Ci(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var _i=!1;function Ei(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ni(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pi(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&yu){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Ci(e,n)}return null===(a=r.interleaved)?(t.next=t,Si(r)):(t.next=a.next,a.next=t),r.interleaved=t,Ci(e,n)}function Ri(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,sn(e,n)}}function Li(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ai(e,t,n,r){var a=e.updateQueue;_i=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(null!==l){a.shared.pending=null;var s=l,u=s.next;s.next=null,null===i?o=u:i.next=u,i=s;var c=e.alternate;null!==c&&((l=(c=c.updateQueue).lastBaseUpdate)!==i&&(null===l?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=s))}if(null!==o){var d=a.baseState;for(i=0,c=u=s=null,l=o;;){var f=l.lane,p=l.eventTime;if((r&f)===f){null!==c&&(c=c.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var h=e,m=l;switch(f=t,p=n,m.tag){case 1:if("function"==typeof(h=m.payload)){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=-65537&h.flags|128;case 0:if(null==(f="function"==typeof(h=m.payload)?h.call(p,d,f):h))break e;d=Ee({},d,f);break e;case 2:_i=!0}}null!==l.callback&&0!==l.lane&&(e.flags|=64,null===(f=a.effects)?a.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===c?(u=c=p,s=d):c=c.next=p,i|=f;if(null===(l=l.next)){if(null===(l=a.shared.pending))break;l=(f=l).next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}if(null===c&&(s=d),a.baseState=s,a.firstBaseUpdate=u,a.lastBaseUpdate=c,null!==(t=a.shared.interleaved)){a=t;do{i|=a.lane,a=a.next}while(a!==t)}else null===o&&(a.shared.lanes=0);_u|=i,e.lanes=i,e.memoizedState=d}}function Ti(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(G(191,a));a.call(r)}}}var zi={},Di=ho(zi),Ii=ho(zi),Oi=ho(zi);function Fi(e){if(e===zi)throw Error(G(174));return e}function ji(e,t){switch(go(Oi,t),go(Ii,e),go(Di,zi),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Xe(null,"");break;default:t=Xe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}mo(Di),go(Di,t)}function Ui(){mo(Di),mo(Ii),mo(Oi)}function $i(e){Fi(Oi.current);var t=Fi(Di.current),n=Xe(t,e.type);t!==n&&(go(Ii,e),go(Di,n))}function Bi(e){Ii.current===e&&(mo(Di),mo(Ii))}var Vi=ho(0);function Wi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Hi=[];function Ki(){for(var e=0;e<Hi.length;e++)Hi[e]._workInProgressVersionPrimary=null;Hi.length=0}var Qi=ue.ReactCurrentDispatcher,Gi=ue.ReactCurrentBatchConfig,qi=0,Yi=null,Xi=null,Ji=null,Zi=!1,el=!1,tl=0,nl=0;function rl(){throw Error(G(321))}function al(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yr(e[n],t[n]))return!1;return!0}function ol(e,t,n,r,a,o){if(qi=o,Yi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Qi.current=null===e||null===e.memoizedState?Bl:Vl,e=n(r,a),el){o=0;do{if(el=!1,tl=0,25<=o)throw Error(G(301));o+=1,Ji=Xi=null,t.updateQueue=null,Qi.current=Wl,e=n(r,a)}while(el)}if(Qi.current=$l,t=null!==Xi&&null!==Xi.next,qi=0,Ji=Xi=Yi=null,Zi=!1,t)throw Error(G(300));return e}function il(){var e=0!==tl;return tl=0,e}function ll(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ji?Yi.memoizedState=Ji=e:Ji=Ji.next=e,Ji}function sl(){if(null===Xi){var e=Yi.alternate;e=null!==e?e.memoizedState:null}else e=Xi.next;var t=null===Ji?Yi.memoizedState:Ji.next;if(null!==t)Ji=t,Xi=e;else{if(null===e)throw Error(G(310));e={memoizedState:(Xi=e).memoizedState,baseState:Xi.baseState,baseQueue:Xi.baseQueue,queue:Xi.queue,next:null},null===Ji?Yi.memoizedState=Ji=e:Ji=Ji.next=e}return Ji}function ul(e,t){return"function"==typeof t?t(e):t}function cl(e){var t=sl(),n=t.queue;if(null===n)throw Error(G(311));n.lastRenderedReducer=e;var r=Xi,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,n.pending=null}if(null!==a){o=a.next,r=r.baseState;var l=i=null,s=null,u=o;do{var c=u.lane;if((qi&c)===c)null!==s&&(s=s.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===s?(l=s=d,i=r):s=s.next=d,Yi.lanes|=c,_u|=c}u=u.next}while(null!==u&&u!==o);null===s?i=r:s.next=l,Yr(r,t.memoizedState)||(ss=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=s,n.lastRenderedState=r}if(null!==(e=n.interleaved)){a=e;do{o=a.lane,Yi.lanes|=o,_u|=o,a=a.next}while(a!==e)}else null===a&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function dl(e){var t=sl(),n=t.queue;if(null===n)throw Error(G(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{o=e(o,i.action),i=i.next}while(i!==a);Yr(o,t.memoizedState)||(ss=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function fl(){}function pl(e,t){var n=Yi,r=sl(),a=t(),o=!Yr(r.memoizedState,a);if(o&&(r.memoizedState=a,ss=!0),r=r.queue,_l(gl.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||null!==Ji&&1&Ji.memoizedState.tag){if(n.flags|=2048,wl(9,ml.bind(null,n,r,a,t),void 0,null),null===vu)throw Error(G(349));30&qi||hl(n,t,a)}return a}function hl(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Yi.updateQueue)?(t={lastEffect:null,stores:null},Yi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function ml(e,t,n,r){t.value=n,t.getSnapshot=r,yl(t)&&vl(e)}function gl(e,t,n){return n(function(){yl(t)&&vl(e)})}function yl(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yr(e,n)}catch(e){return!0}}function vl(e){var t=Ci(e,1);null!==t&&Hu(t,e,1,-1)}function bl(e){var t=ll();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ul,lastRenderedState:e},t.queue=e,e=e.dispatch=Ol.bind(null,Yi,e),[t.memoizedState,e]}function wl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Yi.updateQueue)?(t={lastEffect:null,stores:null},Yi.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function kl(){return sl().memoizedState}function Sl(e,t,n,r){var a=ll();Yi.flags|=e,a.memoizedState=wl(1|t,n,void 0,void 0===r?null:r)}function xl(e,t,n,r){var a=sl();r=void 0===r?null:r;var o=void 0;if(null!==Xi){var i=Xi.memoizedState;if(o=i.destroy,null!==r&&al(r,i.deps))return void(a.memoizedState=wl(t,n,o,r))}Yi.flags|=e,a.memoizedState=wl(1|t,n,o,r)}function Cl(e,t){return Sl(8390656,8,e,t)}function _l(e,t){return xl(2048,8,e,t)}function El(e,t){return xl(4,2,e,t)}function Ml(e,t){return xl(4,4,e,t)}function Nl(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Pl(e,t,n){return n=null!=n?n.concat([e]):null,xl(4,4,Nl.bind(null,t,e),n)}function Rl(){}function Ll(e,t){var n=sl();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&al(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Al(e,t){var n=sl();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&al(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Tl(e,t,n){return 21&qi?(Yr(n,t)||(n=an(),Yi.lanes|=n,_u|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ss=!0),e.memoizedState=n)}function zl(e,t){var n=un;un=0!==n&&4>n?n:4,e(!0);var r=Gi.transition;Gi.transition={};try{e(!1),t()}finally{un=n,Gi.transition=r}}function Dl(){return sl().memoizedState}function Il(e,t,n){var r=Wu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Fl(e))jl(t,n);else if(null!==(n=xi(e,t,n,r))){Hu(n,e,r,Vu()),Ul(n,t,r)}}function Ol(e,t,n){var r=Wu(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fl(e))jl(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var i=t.lastRenderedState,l=o(i,n);if(a.hasEagerState=!0,a.eagerState=l,Yr(l,i)){var s=t.interleaved;return null===s?(a.next=a,Si(t)):(a.next=s.next,s.next=a),void(t.interleaved=a)}}catch(e){}null!==(n=xi(e,t,a,r))&&(Hu(n,e,r,a=Vu()),Ul(n,t,r))}}function Fl(e){var t=e.alternate;return e===Yi||null!==t&&t===Yi}function jl(e,t){el=Zi=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ul(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,sn(e,n)}}var $l={readContext:wi,useCallback:rl,useContext:rl,useEffect:rl,useImperativeHandle:rl,useInsertionEffect:rl,useLayoutEffect:rl,useMemo:rl,useReducer:rl,useRef:rl,useState:rl,useDebugValue:rl,useDeferredValue:rl,useTransition:rl,useMutableSource:rl,useSyncExternalStore:rl,useId:rl,unstable_isNewReconciler:!1},Bl={readContext:wi,useCallback:function(e,t){return ll().memoizedState=[e,void 0===t?null:t],e},useContext:wi,useEffect:Cl,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Sl(4194308,4,Nl.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sl(4,2,e,t)},useMemo:function(e,t){var n=ll();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ll();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Il.bind(null,Yi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ll().memoizedState=e},useState:bl,useDebugValue:Rl,useDeferredValue:function(e){return ll().memoizedState=e},useTransition:function(){var e=bl(!1),t=e[0];return e=zl.bind(null,e[1]),ll().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Yi,a=ll();if(Go){if(void 0===n)throw Error(G(407));n=n()}else{if(n=t(),null===vu)throw Error(G(349));30&qi||hl(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Cl(gl.bind(null,r,o,e),[e]),r.flags|=2048,wl(9,ml.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ll(),t=vu.identifierPrefix;if(Go){var n=$o;t=":"+t+"R"+(n=(Uo&~(1<<32-qt(Uo)-1)).toString(32)+n),0<(n=tl++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=nl++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Vl={readContext:wi,useCallback:Ll,useContext:wi,useEffect:_l,useImperativeHandle:Pl,useInsertionEffect:El,useLayoutEffect:Ml,useMemo:Al,useReducer:cl,useRef:kl,useState:function(){return cl(ul)},useDebugValue:Rl,useDeferredValue:function(e){return Tl(sl(),Xi.memoizedState,e)},useTransition:function(){return[cl(ul)[0],sl().memoizedState]},useMutableSource:fl,useSyncExternalStore:pl,useId:Dl,unstable_isNewReconciler:!1},Wl={readContext:wi,useCallback:Ll,useContext:wi,useEffect:_l,useImperativeHandle:Pl,useInsertionEffect:El,useLayoutEffect:Ml,useMemo:Al,useReducer:dl,useRef:kl,useState:function(){return dl(ul)},useDebugValue:Rl,useDeferredValue:function(e){var t=sl();return null===Xi?t.memoizedState=e:Tl(t,Xi.memoizedState,e)},useTransition:function(){return[dl(ul)[0],sl().memoizedState]},useMutableSource:fl,useSyncExternalStore:pl,useId:Dl,unstable_isNewReconciler:!1};function Hl(e,t){if(e&&e.defaultProps){for(var n in t=Ee({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Kl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:Ee({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Ql={isMounted:function(e){return!!(e=e._reactInternals)&&Lt(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Vu(),a=Wu(e),o=Ni(r,a);o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Hu(t,e,a,r),Ri(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Vu(),a=Wu(e),o=Ni(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Hu(t,e,a,r),Ri(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vu(),r=Wu(e),a=Ni(n,r);a.tag=2,null!=t&&(a.callback=t),null!==(t=Pi(e,a,r))&&(Hu(t,e,r,n),Ri(t,e,r))}};function Gl(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!Xr(n,r)||!Xr(a,o))}function ql(e,t,n){var r=!1,a=yo,o=t.contextType;return"object"==typeof o&&null!==o?o=wi(o):(a=So(t)?wo:vo.current,o=(r=null!=(r=t.contextTypes))?ko(e,a):yo),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Ql,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Yl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ql.enqueueReplaceState(t,t.state,null)}function Xl(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Ei(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=wi(o):(o=So(t)?wo:vo.current,a.context=ko(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(Kl(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&Ql.enqueueReplaceState(a,a.state,null),Ai(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}function Jl(e,t){try{var n="",r=t;do{n+=Re(r),r=r.return}while(r);var a=n}catch(e){a="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:a,digest:null}}function Zl(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function es(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var ts="function"==typeof WeakMap?WeakMap:Map;function ns(e,t,n){(n=Ni(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Tu||(Tu=!0,zu=r),es(0,t)},n}function rs(e,t,n){(n=Ni(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){es(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){es(0,t),"function"!=typeof r&&(null===Du?Du=new Set([this]):Du.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function as(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new ts;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=hc.bind(null,e,t,n),t.then(e,e))}function os(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function is(e,t,n,r,a){return 1&e.mode?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Ni(-1,1)).tag=2,Pi(n,t,1))),n.lanes|=1),e)}var ls=ue.ReactCurrentOwner,ss=!1;function us(e,t,n,r){t.child=null===e?di(t,null,n,r):ci(t,e.child,n,r)}function cs(e,t,n,r,a){n=n.render;var o=t.ref;return bi(t,a),r=ol(e,t,n,r,o,a),n=il(),null===e||ss?(Go&&n&&Wo(t),t.flags|=1,us(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Ts(e,t,a))}function ds(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||kc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=xc(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,fs(e,t,o,r,a))}if(o=e.child,0===(e.lanes&a)){var i=o.memoizedProps;if((n=null!==(n=n.compare)?n:Xr)(i,r)&&e.ref===t.ref)return Ts(e,t,a)}return t.flags|=1,(e=Sc(o,r)).ref=t.ref,e.return=t,t.child=e}function fs(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(Xr(o,r)&&e.ref===t.ref){if(ss=!1,t.pendingProps=r=o,0===(e.lanes&a))return t.lanes=e.lanes,Ts(e,t,a);131072&e.flags&&(ss=!0)}}return ms(e,t,n,r,a)}function ps(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,go(Su,ku),ku|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,go(Su,ku),ku|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},go(Su,ku),ku|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,go(Su,ku),ku|=r;return us(e,t,a,n),t.child}function hs(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ms(e,t,n,r,a){var o=So(n)?wo:vo.current;return o=ko(t,o),bi(t,a),n=ol(e,t,n,r,o,a),r=il(),null===e||ss?(Go&&r&&Wo(t),t.flags|=1,us(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Ts(e,t,a))}function gs(e,t,n,r,a){if(So(n)){var o=!0;Eo(t)}else o=!1;if(bi(t,a),null===t.stateNode)As(e,t),ql(t,n,r),Xl(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,l=t.memoizedProps;i.props=l;var s=i.context,u=n.contextType;"object"==typeof u&&null!==u?u=wi(u):u=ko(t,u=So(n)?wo:vo.current);var c=n.getDerivedStateFromProps,d="function"==typeof c||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==r||s!==u)&&Yl(t,i,r,u),_i=!1;var f=t.memoizedState;i.state=f,Ai(t,r,i,a),s=t.memoizedState,l!==r||f!==s||bo.current||_i?("function"==typeof c&&(Kl(t,n,c,r),s=t.memoizedState),(l=_i||Gl(t,n,l,r,f,s,u))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=u,r=l):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Mi(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Hl(t.type,l),i.props=u,d=t.pendingProps,f=i.context,"object"==typeof(s=n.contextType)&&null!==s?s=wi(s):s=ko(t,s=So(n)?wo:vo.current);var p=n.getDerivedStateFromProps;(c="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==d||f!==s)&&Yl(t,i,r,s),_i=!1,f=t.memoizedState,i.state=f,Ai(t,r,i,a);var h=t.memoizedState;l!==d||f!==h||bo.current||_i?("function"==typeof p&&(Kl(t,n,p,r),h=t.memoizedState),(u=_i||Gl(t,n,u,r,f,h,s)||!1)?(c||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,h,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,h,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=s,r=u):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return ys(e,t,n,r,o,a)}function ys(e,t,n,r,a,o){hs(e,t);var i=!!(128&t.flags);if(!r&&!i)return a&&Mo(t,n,!1),Ts(e,t,o);r=t.stateNode,ls.current=t;var l=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=ci(t,e.child,null,o),t.child=ci(t,null,l,o)):us(e,t,l,o),t.memoizedState=r.state,a&&Mo(t,n,!0),t.child}function vs(e){var t=e.stateNode;t.pendingContext?Co(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Co(0,t.context,!1),ji(e,t.containerInfo)}function bs(e,t,n,r,a){return ri(),ai(a),t.flags|=256,us(e,t,n,r),t.child}var ws,ks,Ss,xs,Cs={dehydrated:null,treeContext:null,retryLane:0};function _s(e){return{baseLanes:e,cachePool:null,transitions:null}}function Es(e,t,n){var r,a=t.pendingProps,o=Vi.current,i=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&o)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),go(Vi,1&o),null===e)return Zo(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=a.children,e=a.fallback,i?(a=t.mode,i=t.child,l={mode:"hidden",children:l},1&a||null===i?i=_c(l,a,0,null):(i.childLanes=0,i.pendingProps=l),e=Cc(e,a,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=_s(n),t.memoizedState=Cs,e):Ms(t,l));if(null!==(o=e.memoizedState)&&null!==(r=o.dehydrated))return function(e,t,n,r,a,o,i){if(n)return 256&t.flags?(t.flags&=-257,Ns(e,t,i,r=Zl(Error(G(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=_c({mode:"visible",children:r.children},a,0,null),(o=Cc(o,a,i,null)).flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,1&t.mode&&ci(t,e.child,null,i),t.child.memoizedState=_s(i),t.memoizedState=Cs,o);if(!(1&t.mode))return Ns(e,t,i,null);if("$!"===a.data){if(r=a.nextSibling&&a.nextSibling.dataset)var l=r.dgst;return r=l,Ns(e,t,i,r=Zl(o=Error(G(419)),r,void 0))}if(l=0!==(i&e.childLanes),ss||l){if(null!==(r=vu)){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=0!==(a&(r.suspendedLanes|i))?0:a)&&a!==o.retryLane&&(o.retryLane=a,Ci(e,a),Hu(r,e,a,-1))}return ac(),Ns(e,t,i,r=Zl(Error(G(421))))}return"$?"===a.data?(t.flags|=128,t.child=e.child,t=gc.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Qo=Ja(a.nextSibling),Ko=t,Go=!0,qo=null,null!==e&&(Oo[Fo++]=Uo,Oo[Fo++]=$o,Oo[Fo++]=jo,Uo=e.id,$o=e.overflow,jo=t),t=Ms(t,r.children),t.flags|=4096,t)}(e,t,l,a,r,o,n);if(i){i=a.fallback,l=t.mode,r=(o=e.child).sibling;var s={mode:"hidden",children:a.children};return 1&l||t.child===o?(a=Sc(o,s)).subtreeFlags=14680064&o.subtreeFlags:((a=t.child).childLanes=0,a.pendingProps=s,t.deletions=null),null!==r?i=Sc(r,i):(i=Cc(i,l,n,null)).flags|=2,i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,l=null===(l=e.child.memoizedState)?_s(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},i.memoizedState=l,i.childLanes=e.childLanes&~n,t.memoizedState=Cs,a}return e=(i=e.child).sibling,a=Sc(i,{mode:"visible",children:a.children}),!(1&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=a,t.memoizedState=null,a}function Ms(e,t){return(t=_c({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ns(e,t,n,r){return null!==r&&ai(r),ci(t,e.child,null,n),(e=Ms(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ps(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),vi(e.return,t,n)}function Rs(e,t,n,r,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function Ls(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(us(e,t,r.children,n),2&(r=Vi.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ps(e,n,t);else if(19===e.tag)Ps(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(go(Vi,r),1&t.mode)switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===Wi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Rs(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===Wi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Rs(t,!0,n,null,o);break;case"together":Rs(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function As(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ts(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),_u|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(G(153));if(null!==t.child){for(n=Sc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Sc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function zs(e,t){if(!Go)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ds(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=14680064&a.subtreeFlags,r|=14680064&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Is(e,t,n){var r=t.pendingProps;switch(Ho(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ds(t),null;case 1:case 17:return So(t.type)&&xo(),Ds(t),null;case 3:return r=t.stateNode,Ui(),mo(bo),mo(vo),Ki(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ti(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==qo&&(qu(qo),qo=null))),ks(e,t),Ds(t),null;case 5:Bi(t);var a=Fi(Oi.current);if(n=t.type,null!==e&&null!=t.stateNode)Ss(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(G(166));return Ds(t),null}if(e=Fi(Di.current),ti(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[to]=t,r[no]=o,e=!!(1&t.mode),n){case"dialog":Na("cancel",r),Na("close",r);break;case"iframe":case"object":case"embed":Na("load",r);break;case"video":case"audio":for(a=0;a<Ca.length;a++)Na(Ca[a],r);break;case"source":Na("error",r);break;case"img":case"image":case"link":Na("error",r),Na("load",r);break;case"details":Na("toggle",r);break;case"input":je(r,o),Na("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Na("invalid",r);break;case"textarea":Qe(r,o),Na("invalid",r)}for(var i in lt(n,o),a=null,o)if(o.hasOwnProperty(i)){var l=o[i];"children"===i?"string"==typeof l?r.textContent!==l&&(!0!==o.suppressHydrationWarning&&$a(r.textContent,l,e),a=["children",l]):"number"==typeof l&&r.textContent!==""+l&&(!0!==o.suppressHydrationWarning&&$a(r.textContent,l,e),a=["children",""+l]):Y.hasOwnProperty(i)&&null!=l&&"onScroll"===i&&Na("scroll",r)}switch(n){case"input":De(r),Be(r,o,!0);break;case"textarea":De(r),qe(r);break;case"select":case"option":break;default:"function"==typeof o.onClick&&(r.onclick=Ba)}r=a,t.updateQueue=r,null!==r&&(t.flags|=4)}else{i=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Ye(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=i.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),"select"===n&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[to]=t,e[no]=r,ws(e,t,!1,!1),t.stateNode=e;e:{switch(i=st(n,r),n){case"dialog":Na("cancel",e),Na("close",e),a=r;break;case"iframe":case"object":case"embed":Na("load",e),a=r;break;case"video":case"audio":for(a=0;a<Ca.length;a++)Na(Ca[a],e);a=r;break;case"source":Na("error",e),a=r;break;case"img":case"image":case"link":Na("error",e),Na("load",e),a=r;break;case"details":Na("toggle",e),a=r;break;case"input":je(e,r),a=Fe(e,r),Na("invalid",e);break;case"option":default:a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Ee({},r,{value:void 0}),Na("invalid",e);break;case"textarea":Qe(e,r),a=Ke(e,r),Na("invalid",e)}for(o in lt(n,a),l=a)if(l.hasOwnProperty(o)){var s=l[o];"style"===o?ot(e,s):"dangerouslySetInnerHTML"===o?null!=(s=s?s.__html:void 0)&&et(e,s):"children"===o?"string"==typeof s?("textarea"!==n||""!==s)&&tt(e,s):"number"==typeof s&&tt(e,""+s):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(Y.hasOwnProperty(o)?null!=s&&"onScroll"===o&&Na("scroll",e):null!=s&&se(e,o,s,i))}switch(n){case"input":De(e),Be(e,r,!1);break;case"textarea":De(e),qe(e);break;case"option":null!=r.value&&e.setAttribute("value",""+Te(r.value));break;case"select":e.multiple=!!r.multiple,null!=(o=r.value)?He(e,!!r.multiple,o,!1):null!=r.defaultValue&&He(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Ba)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Ds(t),null;case 6:if(e&&null!=t.stateNode)xs(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(G(166));if(n=Fi(Oi.current),Fi(Di.current),ti(t)){if(r=t.stateNode,n=t.memoizedProps,r[to]=t,(o=r.nodeValue!==n)&&null!==(e=Ko))switch(e.tag){case 3:$a(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&$a(r.nodeValue,n,!!(1&e.mode))}o&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[to]=t,t.stateNode=r}return Ds(t),null;case 13:if(mo(Vi),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Go&&null!==Qo&&1&t.mode&&!(128&t.flags))ni(),ri(),t.flags|=98560,o=!1;else if(o=ti(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(G(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(G(317));o[to]=t}else ri(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Ds(t),o=!1}else null!==qo&&(qu(qo),qo=null),o=!0;if(!o)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Vi.current?0===xu&&(xu=3):ac())),null!==t.updateQueue&&(t.flags|=4),Ds(t),null);case 4:return Ui(),ks(e,t),null===e&&La(t.stateNode.containerInfo),Ds(t),null;case 10:return yi(t.type._context),Ds(t),null;case 19:if(mo(Vi),null===(o=t.memoizedState))return Ds(t),null;if(r=!!(128&t.flags),null===(i=o.rendering))if(r)zs(o,!1);else{if(0!==xu||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Wi(e))){for(t.flags|=128,zs(o,!1),null!==(r=i.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(o=n).flags&=14680066,null===(i=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return go(Vi,1&Vi.current|2),t.child}e=e.sibling}null!==o.tail&&Ut()>Lu&&(t.flags|=128,r=!0,zs(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=Wi(i))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),zs(o,!0),null===o.tail&&"hidden"===o.tailMode&&!i.alternate&&!Go)return Ds(t),null}else 2*Ut()-o.renderingStartTime>Lu&&1073741824!==n&&(t.flags|=128,r=!0,zs(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(null!==(n=o.last)?n.sibling=i:t.child=i,o.last=i)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ut(),t.sibling=null,n=Vi.current,go(Vi,r?1&n|2:1&n),t):(Ds(t),null);case 22:case 23:return ec(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&ku)&&(Ds(t),6&t.subtreeFlags&&(t.flags|=8192)):Ds(t),null;case 24:case 25:return null}throw Error(G(156,t.tag))}function Os(e,t){switch(Ho(t),t.tag){case 1:return So(t.type)&&xo(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ui(),mo(bo),mo(vo),Ki(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Bi(t),null;case 13:if(mo(Vi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(G(340));ri()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return mo(Vi),null;case 4:return Ui(),null;case 10:return yi(t.type._context),null;case 22:case 23:return ec(),null;default:return null}}ws=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ks=function(){},Ss=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Fi(Di.current);var o,i=null;switch(n){case"input":a=Fe(e,a),r=Fe(e,r),i=[];break;case"select":a=Ee({},a,{value:void 0}),r=Ee({},r,{value:void 0}),i=[];break;case"textarea":a=Ke(e,a),r=Ke(e,r),i=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Ba)}for(u in lt(n,r),n=null,a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&null!=a[u])if("style"===u){var l=a[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(Y.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var s=r[u];if(l=null!=a?a[u]:void 0,r.hasOwnProperty(u)&&s!==l&&(null!=s||null!=l))if("style"===u)if(l){for(o in l)!l.hasOwnProperty(o)||s&&s.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in s)s.hasOwnProperty(o)&&l[o]!==s[o]&&(n||(n={}),n[o]=s[o])}else n||(i||(i=[]),i.push(u,n)),n=s;else"dangerouslySetInnerHTML"===u?(s=s?s.__html:void 0,l=l?l.__html:void 0,null!=s&&l!==s&&(i=i||[]).push(u,s)):"children"===u?"string"!=typeof s&&"number"!=typeof s||(i=i||[]).push(u,""+s):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(Y.hasOwnProperty(u)?(null!=s&&"onScroll"===u&&Na("scroll",e),i||l===s||(i=[])):(i=i||[]).push(u,s))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}},xs=function(e,t,n,r){n!==r&&(t.flags|=4)};var Fs=!1,js=!1,Us="function"==typeof WeakSet?WeakSet:Set,$s=null;function Bs(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){pc(e,t,n)}else n.current=null}function Vs(e,t,n){try{n()}catch(n){pc(e,t,n)}}var Ws=!1;function Hs(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,void 0!==o&&Vs(t,n,o)}a=a.next}while(a!==r)}}function Ks(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Qs(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function Gs(e){var t=e.alternate;null!==t&&(e.alternate=null,Gs(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[to],delete t[no],delete t[ao],delete t[oo],delete t[io])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qs(e){return 5===e.tag||3===e.tag||4===e.tag}function Ys(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||qs(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Xs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Ba));else if(4!==r&&null!==(e=e.child))for(Xs(e,t,n),e=e.sibling;null!==e;)Xs(e,t,n),e=e.sibling}function Js(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(Js(e,t,n),e=e.sibling;null!==e;)Js(e,t,n),e=e.sibling}var Zs=null,eu=!1;function tu(e,t,n){for(n=n.child;null!==n;)nu(e,t,n),n=n.sibling}function nu(e,t,n){if(Gt&&"function"==typeof Gt.onCommitFiberUnmount)try{Gt.onCommitFiberUnmount(Qt,n)}catch(e){}switch(n.tag){case 5:js||Bs(n,t);case 6:var r=Zs,a=eu;Zs=null,tu(e,t,n),eu=a,null!==(Zs=r)&&(eu?(e=Zs,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):Zs.removeChild(n.stateNode));break;case 18:null!==Zs&&(eu?(e=Zs,n=n.stateNode,8===e.nodeType?Xa(e.parentNode,n):1===e.nodeType&&Xa(e,n),An(e)):Xa(Zs,n.stateNode));break;case 4:r=Zs,a=eu,Zs=n.stateNode.containerInfo,eu=!0,tu(e,t,n),Zs=r,eu=a;break;case 0:case 11:case 14:case 15:if(!js&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,void 0!==i&&(2&o||4&o)&&Vs(n,t,i),a=a.next}while(a!==r)}tu(e,t,n);break;case 1:if(!js&&(Bs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){pc(n,t,e)}tu(e,t,n);break;case 21:tu(e,t,n);break;case 22:1&n.mode?(js=(r=js)||null!==n.memoizedState,tu(e,t,n),js=r):tu(e,t,n);break;default:tu(e,t,n)}}function ru(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Us),t.forEach(function(t){var r=yc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function au(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];try{var o=e,i=t,l=i;e:for(;null!==l;){switch(l.tag){case 5:Zs=l.stateNode,eu=!1;break e;case 3:case 4:Zs=l.stateNode.containerInfo,eu=!0;break e}l=l.return}if(null===Zs)throw Error(G(160));nu(o,i,a),Zs=null,eu=!1;var s=a.alternate;null!==s&&(s.return=null),a.return=null}catch(e){pc(a,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)ou(t,e),t=t.sibling}function ou(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(au(t,e),iu(e),4&r){try{Hs(3,e,e.return),Ks(3,e)}catch(t){pc(e,e.return,t)}try{Hs(5,e,e.return)}catch(t){pc(e,e.return,t)}}break;case 1:au(t,e),iu(e),512&r&&null!==n&&Bs(n,n.return);break;case 5:if(au(t,e),iu(e),512&r&&null!==n&&Bs(n,n.return),32&e.flags){var a=e.stateNode;try{tt(a,"")}catch(t){pc(e,e.return,t)}}if(4&r&&null!=(a=e.stateNode)){var o=e.memoizedProps,i=null!==n?n.memoizedProps:o,l=e.type,s=e.updateQueue;if(e.updateQueue=null,null!==s)try{"input"===l&&"radio"===o.type&&null!=o.name&&Ue(a,o),st(l,i);var u=st(l,o);for(i=0;i<s.length;i+=2){var c=s[i],d=s[i+1];"style"===c?ot(a,d):"dangerouslySetInnerHTML"===c?et(a,d):"children"===c?tt(a,d):se(a,c,d,u)}switch(l){case"input":$e(a,o);break;case"textarea":Ge(a,o);break;case"select":var f=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var p=o.value;null!=p?He(a,!!o.multiple,p,!1):f!==!!o.multiple&&(null!=o.defaultValue?He(a,!!o.multiple,o.defaultValue,!0):He(a,!!o.multiple,o.multiple?[]:"",!1))}a[no]=o}catch(t){pc(e,e.return,t)}}break;case 6:if(au(t,e),iu(e),4&r){if(null===e.stateNode)throw Error(G(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){pc(e,e.return,t)}}break;case 3:if(au(t,e),iu(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{An(t.containerInfo)}catch(t){pc(e,e.return,t)}break;case 4:default:au(t,e),iu(e);break;case 13:au(t,e),iu(e),8192&(a=e.child).flags&&(o=null!==a.memoizedState,a.stateNode.isHidden=o,!o||null!==a.alternate&&null!==a.alternate.memoizedState||(Ru=Ut())),4&r&&ru(e);break;case 22:if(c=null!==n&&null!==n.memoizedState,1&e.mode?(js=(u=js)||c,au(t,e),js=u):au(t,e),iu(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!c&&1&e.mode)for($s=e,c=e.child;null!==c;){for(d=$s=c;null!==$s;){switch(p=(f=$s).child,f.tag){case 0:case 11:case 14:case 15:Hs(4,f,f.return);break;case 1:Bs(f,f.return);var h=f.stateNode;if("function"==typeof h.componentWillUnmount){r=f,n=f.return;try{t=r,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){pc(r,n,e)}}break;case 5:Bs(f,f.return);break;case 22:if(null!==f.memoizedState){cu(d);continue}}null!==p?(p.return=f,$s=p):cu(d)}c=c.sibling}e:for(c=null,d=e;;){if(5===d.tag){if(null===c){c=d;try{a=d.stateNode,u?"function"==typeof(o=a.style).setProperty?o.setProperty("display","none","important"):o.display="none":(l=d.stateNode,i=null!=(s=d.memoizedProps.style)&&s.hasOwnProperty("display")?s.display:null,l.style.display=at("display",i))}catch(t){pc(e,e.return,t)}}}else if(6===d.tag){if(null===c)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(t){pc(e,e.return,t)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:au(t,e),iu(e),4&r&&ru(e);case 21:}}function iu(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(qs(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var a=r.stateNode;32&r.flags&&(tt(a,""),r.flags&=-33),Js(e,Ys(e),a);break;case 3:case 4:var o=r.stateNode.containerInfo;Xs(e,Ys(e),o);break;default:throw Error(G(161))}}catch(t){pc(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function lu(e,t,n){$s=e,su(e)}function su(e,t,n){for(var r=!!(1&e.mode);null!==$s;){var a=$s,o=a.child;if(22===a.tag&&r){var i=null!==a.memoizedState||Fs;if(!i){var l=a.alternate,s=null!==l&&null!==l.memoizedState||js;l=Fs;var u=js;if(Fs=i,(js=s)&&!u)for($s=a;null!==$s;)s=(i=$s).child,22===i.tag&&null!==i.memoizedState?du(a):null!==s?(s.return=i,$s=s):du(a);for(;null!==o;)$s=o,su(o),o=o.sibling;$s=a,Fs=l,js=u}uu(e)}else 8772&a.subtreeFlags&&null!==o?(o.return=a,$s=o):uu(e)}}function uu(e){for(;null!==$s;){var t=$s;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:js||Ks(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!js)if(null===n)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Hl(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&Ti(t,o,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Ti(t,i,n)}break;case 5:var l=t.stateNode;if(null===n&&4&t.flags){n=l;var s=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":s.autoFocus&&n.focus();break;case"img":s.src&&(n.src=s.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var c=u.memoizedState;if(null!==c){var d=c.dehydrated;null!==d&&An(d)}}}break;default:throw Error(G(163))}js||512&t.flags&&Qs(t)}catch(e){pc(t,t.return,e)}}if(t===e){$s=null;break}if(null!==(n=t.sibling)){n.return=t.return,$s=n;break}$s=t.return}}function cu(e){for(;null!==$s;){var t=$s;if(t===e){$s=null;break}var n=t.sibling;if(null!==n){n.return=t.return,$s=n;break}$s=t.return}}function du(e){for(;null!==$s;){var t=$s;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ks(4,t)}catch(e){pc(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var a=t.return;try{r.componentDidMount()}catch(e){pc(t,a,e)}}var o=t.return;try{Qs(t)}catch(e){pc(t,o,e)}break;case 5:var i=t.return;try{Qs(t)}catch(e){pc(t,i,e)}}}catch(e){pc(t,t.return,e)}if(t===e){$s=null;break}var l=t.sibling;if(null!==l){l.return=t.return,$s=l;break}$s=t.return}}var fu,pu=Math.ceil,hu=ue.ReactCurrentDispatcher,mu=ue.ReactCurrentOwner,gu=ue.ReactCurrentBatchConfig,yu=0,vu=null,bu=null,wu=0,ku=0,Su=ho(0),xu=0,Cu=null,_u=0,Eu=0,Mu=0,Nu=null,Pu=null,Ru=0,Lu=1/0,Au=null,Tu=!1,zu=null,Du=null,Iu=!1,Ou=null,Fu=0,ju=0,Uu=null,$u=-1,Bu=0;function Vu(){return 6&yu?Ut():-1!==$u?$u:$u=Ut()}function Wu(e){return 1&e.mode?2&yu&&0!==wu?wu&-wu:null!==oi.transition?(0===Bu&&(Bu=an()),Bu):0!==(e=un)?e:e=void 0===(e=window.event)?16:Un(e.type):1}function Hu(e,t,n,r){if(50<ju)throw ju=0,Uu=null,Error(G(185));ln(e,n,r),2&yu&&e===vu||(e===vu&&(!(2&yu)&&(Eu|=n),4===xu&&Yu(e,wu)),Ku(e,r),1===n&&0===yu&&!(1&t.mode)&&(Lu=Ut()+500,Po&&Ao()))}function Ku(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-qt(o),l=1<<i,s=a[i];-1===s?0!==(l&n)&&0===(l&r)||(a[i]=nn(l,t)):s<=t&&(e.expiredLanes|=l),o&=~l}}(e,t);var r=tn(e,e===vu?wu:0);if(0===r)null!==n&&Ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ot(n),1===t)0===e.tag?function(e){Po=!0,Lo(e)}(Xu.bind(null,e)):Lo(Xu.bind(null,e)),qa(function(){!(6&yu)&&Ao()}),n=null;else{switch(cn(r)){case 1:n=Bt;break;case 4:n=Vt;break;case 16:default:n=Wt;break;case 536870912:n=Kt}n=vc(n,Qu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Qu(e,t){if($u=-1,Bu=0,6&yu)throw Error(G(327));var n=e.callbackNode;if(dc()&&e.callbackNode!==n)return null;var r=tn(e,e===vu?wu:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=oc(e,r);else{t=r;var a=yu;yu|=2;var o=rc();for(vu===e&&wu===t||(Au=null,Lu=Ut()+500,tc(e,t));;)try{lc();break}catch(t){nc(e,t)}gi(),hu.current=o,yu=a,null!==bu?t=0:(vu=null,wu=0,t=xu)}if(0!==t){if(2===t&&(0!==(a=rn(e))&&(r=a,t=Gu(e,a))),1===t)throw n=Cu,tc(e,0),Yu(e,r),Ku(e,Ut()),n;if(6===t)Yu(e,r);else{if(a=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Yr(o(),a))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(a)||(t=oc(e,r),2===t&&(o=rn(e),0!==o&&(r=o,t=Gu(e,o))),1!==t)))throw n=Cu,tc(e,0),Yu(e,r),Ku(e,Ut()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:case 5:cc(e,Pu,Au);break;case 3:if(Yu(e,r),(130023424&r)===r&&10<(t=Ru+500-Ut())){if(0!==tn(e,0))break;if(((a=e.suspendedLanes)&r)!==r){Vu(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ka(cc.bind(null,e,Pu,Au),t);break}cc(e,Pu,Au);break;case 4:if(Yu(e,r),(4194240&r)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-qt(r);o=1<<i,(i=t[i])>a&&(a=i),r&=~o}if(r=a,10<(r=(120>(r=Ut()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pu(r/1960))-r)){e.timeoutHandle=Ka(cc.bind(null,e,Pu,Au),r);break}cc(e,Pu,Au);break;default:throw Error(G(329))}}}return Ku(e,Ut()),e.callbackNode===n?Qu.bind(null,e):null}function Gu(e,t){var n=Nu;return e.current.memoizedState.isDehydrated&&(tc(e,t).flags|=256),2!==(e=oc(e,t))&&(t=Pu,Pu=n,null!==t&&qu(t)),e}function qu(e){null===Pu?Pu=e:Pu.push.apply(Pu,e)}function Yu(e,t){for(t&=~Mu,t&=~Eu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-qt(t),r=1<<n;e[n]=-1,t&=~r}}function Xu(e){if(6&yu)throw Error(G(327));dc();var t=tn(e,0);if(!(1&t))return Ku(e,Ut()),null;var n=oc(e,t);if(0!==e.tag&&2===n){var r=rn(e);0!==r&&(t=r,n=Gu(e,r))}if(1===n)throw n=Cu,tc(e,0),Yu(e,t),Ku(e,Ut()),n;if(6===n)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,cc(e,Pu,Au),Ku(e,Ut()),null}function Ju(e,t){var n=yu;yu|=1;try{return e(t)}finally{0===(yu=n)&&(Lu=Ut()+500,Po&&Ao())}}function Zu(e){null!==Ou&&0===Ou.tag&&!(6&yu)&&dc();var t=yu;yu|=1;var n=gu.transition,r=un;try{if(gu.transition=null,un=1,e)return e()}finally{un=r,gu.transition=n,!(6&(yu=t))&&Ao()}}function ec(){ku=Su.current,mo(Su)}function tc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Qa(n)),null!==bu)for(n=bu.return;null!==n;){var r=n;switch(Ho(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&xo();break;case 3:Ui(),mo(bo),mo(vo),Ki();break;case 5:Bi(r);break;case 4:Ui();break;case 13:case 19:mo(Vi);break;case 10:yi(r.type._context);break;case 22:case 23:ec()}n=n.return}if(vu=e,bu=e=Sc(e.current,null),wu=ku=t,xu=0,Cu=null,Mu=Eu=_u=0,Pu=Nu=null,null!==ki){for(t=0;t<ki.length;t++)if(null!==(r=(n=ki[t]).interleaved)){n.interleaved=null;var a=r.next,o=n.pending;if(null!==o){var i=o.next;o.next=a,r.next=i}n.pending=r}ki=null}return e}function nc(e,t){for(;;){var n=bu;try{if(gi(),Qi.current=$l,Zi){for(var r=Yi.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}Zi=!1}if(qi=0,Ji=Xi=Yi=null,el=!1,tl=0,mu.current=null,null===n||null===n.return){xu=1,Cu=t,bu=null;break}e:{var o=e,i=n.return,l=n,s=t;if(t=wu,l.flags|=32768,null!==s&&"object"==typeof s&&"function"==typeof s.then){var u=s,c=l,d=c.tag;if(!(1&c.mode||0!==d&&11!==d&&15!==d)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=os(i);if(null!==p){p.flags&=-257,is(p,i,l,0,t),1&p.mode&&as(o,u,t),s=u;var h=(t=p).updateQueue;if(null===h){var m=new Set;m.add(s),t.updateQueue=m}else h.add(s);break e}if(!(1&t)){as(o,u,t),ac();break e}s=Error(G(426))}else if(Go&&1&l.mode){var g=os(i);if(null!==g){!(65536&g.flags)&&(g.flags|=256),is(g,i,l,0,t),ai(Jl(s,l));break e}}o=s=Jl(s,l),4!==xu&&(xu=2),null===Nu?Nu=[o]:Nu.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t,Li(o,ns(0,s,t));break e;case 1:l=s;var y=o.type,v=o.stateNode;if(!(128&o.flags||"function"!=typeof y.getDerivedStateFromError&&(null===v||"function"!=typeof v.componentDidCatch||null!==Du&&Du.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t,Li(o,rs(o,l,t));break e}}o=o.return}while(null!==o)}uc(n)}catch(e){t=e,bu===n&&null!==n&&(bu=n=n.return);continue}break}}function rc(){var e=hu.current;return hu.current=$l,null===e?$l:e}function ac(){0!==xu&&3!==xu&&2!==xu||(xu=4),null===vu||!(268435455&_u)&&!(268435455&Eu)||Yu(vu,wu)}function oc(e,t){var n=yu;yu|=2;var r=rc();for(vu===e&&wu===t||(Au=null,tc(e,t));;)try{ic();break}catch(t){nc(e,t)}if(gi(),yu=n,hu.current=r,null!==bu)throw Error(G(261));return vu=null,wu=0,xu}function ic(){for(;null!==bu;)sc(bu)}function lc(){for(;null!==bu&&!Ft();)sc(bu)}function sc(e){var t=fu(e.alternate,e,ku);e.memoizedProps=e.pendingProps,null===t?uc(e):bu=t,mu.current=null}function uc(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Os(n,t)))return n.flags&=32767,void(bu=n);if(null===e)return xu=6,void(bu=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Is(n,t,ku)))return void(bu=n);if(null!==(t=t.sibling))return void(bu=t);bu=t=e}while(null!==t);0===xu&&(xu=5)}function cc(e,t,n){var r=un,a=gu.transition;try{gu.transition=null,un=1,function(e,t,n,r){do{dc()}while(null!==Ou);if(6&yu)throw Error(G(327));n=e.finishedWork;var a=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(G(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-qt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}(e,o),e===vu&&(bu=vu=null,wu=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Iu||(Iu=!0,vc(Wt,function(){return dc(),null})),o=!!(15990&n.flags),!!(15990&n.subtreeFlags)||o){o=gu.transition,gu.transition=null;var i=un;un=1;var l=yu;yu|=4,mu.current=null,function(e,t){if(Va=zn,na(e=ta())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var i=0,l=-1,s=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var p;d!==n||0!==a&&3!==d.nodeType||(l=i+a),d!==o||0!==r&&3!==d.nodeType||(s=i+r),3===d.nodeType&&(i+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++u===a&&(l=i),f===o&&++c===r&&(s=i),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}n=-1===l||-1===s?null:{start:l,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wa={focusedElem:e,selectionRange:n},zn=!1,$s=t;null!==$s;)if(e=(t=$s).child,1028&t.subtreeFlags&&null!==e)e.return=t,$s=e;else for(;null!==$s;){t=$s;try{var h=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==h){var m=h.memoizedProps,g=h.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:Hl(t.type,m),g);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(G(163))}}catch(e){pc(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,$s=e;break}$s=t.return}h=Ws,Ws=!1}(e,n),ou(n,e),ra(Wa),zn=!!Va,Wa=Va=null,e.current=n,lu(n),jt(),yu=l,un=i,gu.transition=o}else e.current=n;if(Iu&&(Iu=!1,Ou=e,Fu=a),o=e.pendingLanes,0===o&&(Du=null),function(e){if(Gt&&"function"==typeof Gt.onCommitFiberRoot)try{Gt.onCommitFiberRoot(Qt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),Ku(e,Ut()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Tu)throw Tu=!1,e=zu,zu=null,e;!!(1&Fu)&&0!==e.tag&&dc(),o=e.pendingLanes,1&o?e===Uu?ju++:(ju=0,Uu=e):ju=0,Ao()}(e,t,n,r)}finally{gu.transition=a,un=r}return null}function dc(){if(null!==Ou){var e=cn(Fu),t=gu.transition,n=un;try{if(gu.transition=null,un=16>e?16:e,null===Ou)var r=!1;else{if(e=Ou,Ou=null,Fu=0,6&yu)throw Error(G(331));var a=yu;for(yu|=4,$s=e.current;null!==$s;){var o=$s,i=o.child;if(16&$s.flags){var l=o.deletions;if(null!==l){for(var s=0;s<l.length;s++){var u=l[s];for($s=u;null!==$s;){var c=$s;switch(c.tag){case 0:case 11:case 15:Hs(8,c,o)}var d=c.child;if(null!==d)d.return=c,$s=d;else for(;null!==$s;){var f=(c=$s).sibling,p=c.return;if(Gs(c),c===u){$s=null;break}if(null!==f){f.return=p,$s=f;break}$s=p}}}var h=o.alternate;if(null!==h){var m=h.child;if(null!==m){h.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(null!==m)}}$s=o}}if(2064&o.subtreeFlags&&null!==i)i.return=o,$s=i;else e:for(;null!==$s;){if(2048&(o=$s).flags)switch(o.tag){case 0:case 11:case 15:Hs(9,o,o.return)}var y=o.sibling;if(null!==y){y.return=o.return,$s=y;break e}$s=o.return}}var v=e.current;for($s=v;null!==$s;){var b=(i=$s).child;if(2064&i.subtreeFlags&&null!==b)b.return=i,$s=b;else e:for(i=v;null!==$s;){if(2048&(l=$s).flags)try{switch(l.tag){case 0:case 11:case 15:Ks(9,l)}}catch(e){pc(l,l.return,e)}if(l===i){$s=null;break e}var w=l.sibling;if(null!==w){w.return=l.return,$s=w;break e}$s=l.return}}if(yu=a,Ao(),Gt&&"function"==typeof Gt.onPostCommitFiberRoot)try{Gt.onPostCommitFiberRoot(Qt,e)}catch(e){}r=!0}return r}finally{un=n,gu.transition=t}}return!1}function fc(e,t,n){e=Pi(e,t=ns(0,t=Jl(n,t),1),1),t=Vu(),null!==e&&(ln(e,1,t),Ku(e,t))}function pc(e,t,n){if(3===e.tag)fc(e,e,n);else for(;null!==t;){if(3===t.tag){fc(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Du||!Du.has(r))){t=Pi(t,e=rs(t,e=Jl(n,e),1),1),e=Vu(),null!==t&&(ln(t,1,e),Ku(t,e));break}}t=t.return}}function hc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Vu(),e.pingedLanes|=e.suspendedLanes&n,vu===e&&(wu&n)===n&&(4===xu||3===xu&&(130023424&wu)===wu&&500>Ut()-Ru?tc(e,0):Mu|=n),Ku(e,t)}function mc(e,t){0===t&&(1&e.mode?(t=Zt,!(130023424&(Zt<<=1))&&(Zt=4194304)):t=1);var n=Vu();null!==(e=Ci(e,t))&&(ln(e,t,n),Ku(e,n))}function gc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),mc(e,n)}function yc(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(G(314))}null!==r&&r.delete(t),mc(e,n)}function vc(e,t){return It(e,t)}function bc(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wc(e,t,n,r){return new bc(e,t,n,r)}function kc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Sc(e,t){var n=e.alternate;return null===n?((n=wc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xc(e,t,n,r,a,o){var i=2;if(r=e,"function"==typeof e)kc(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case fe:return Cc(n.children,a,o,t);case pe:i=8,a|=8;break;case he:return(e=wc(12,n,t,2|a)).elementType=he,e.lanes=o,e;case ve:return(e=wc(13,n,t,a)).elementType=ve,e.lanes=o,e;case be:return(e=wc(19,n,t,a)).elementType=be,e.lanes=o,e;case Se:return _c(n,a,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case me:i=10;break e;case ge:i=9;break e;case ye:i=11;break e;case we:i=14;break e;case ke:i=16,r=null;break e}throw Error(G(130,null==e?e:typeof e,""))}return(t=wc(i,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function Cc(e,t,n,r){return(e=wc(7,e,r,t)).lanes=n,e}function _c(e,t,n,r){return(e=wc(22,e,r,t)).elementType=Se,e.lanes=n,e.stateNode={isHidden:!1},e}function Ec(e,t,n){return(e=wc(6,e,null,t)).lanes=n,e}function Mc(e,t,n){return(t=wc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Nc(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=on(0),this.expirationTimes=on(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=on(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Pc(e,t,n,r,a,o,i,l,s){return e=new Nc(e,t,n,l,s),1===t?(t=1,!0===o&&(t|=8)):t=0,o=wc(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ei(o),e}function Rc(e){if(!e)return yo;e:{if(Lt(e=e._reactInternals)!==e||1!==e.tag)throw Error(G(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(So(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(G(171))}if(1===e.tag){var n=e.type;if(So(n))return _o(e,n,t)}return t}function Lc(e,t,n,r,a,o,i,l,s){return(e=Pc(n,r,!0,e,0,o,0,l,s)).context=Rc(null),n=e.current,(o=Ni(r=Vu(),a=Wu(n))).callback=null!=t?t:null,Pi(n,o,a),e.current.lanes=a,ln(e,a,r),Ku(e,r),e}function Ac(e,t,n,r){var a=t.current,o=Vu(),i=Wu(a);return n=Rc(n),null===t.context?t.context=n:t.pendingContext=n,(t=Ni(o,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Pi(a,t,i))&&(Hu(e,a,i,o),Ri(e,a,i)),i}function Tc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function zc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Dc(e,t){zc(e,t),(e=e.alternate)&&zc(e,t)}fu=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||bo.current)ss=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return ss=!1,function(e,t,n){switch(t.tag){case 3:vs(t),ri();break;case 5:$i(t);break;case 1:So(t.type)&&Eo(t);break;case 4:ji(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;go(fi,r._currentValue),r._currentValue=a;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(go(Vi,1&Vi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Es(e,t,n):(go(Vi,1&Vi.current),null!==(e=Ts(e,t,n))?e.sibling:null);go(Vi,1&Vi.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Ls(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),go(Vi,Vi.current),r)break;return null;case 22:case 23:return t.lanes=0,ps(e,t,n)}return Ts(e,t,n)}(e,t,n);ss=!!(131072&e.flags)}else ss=!1,Go&&1048576&t.flags&&Vo(t,Io,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;As(e,t),e=t.pendingProps;var a=ko(t,vo.current);bi(t,n),a=ol(null,t,r,e,a,n);var o=il();return t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,So(r)?(o=!0,Eo(t)):o=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,Ei(t),a.updater=Ql,t.stateNode=a,a._reactInternals=t,Xl(t,r,e,n),t=ys(null,t,r,!0,o,n)):(t.tag=0,Go&&o&&Wo(t),us(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(As(e,t),e=t.pendingProps,r=(a=r._init)(r._payload),t.type=r,a=t.tag=function(e){if("function"==typeof e)return kc(e)?1:0;if(null!=e){if((e=e.$$typeof)===ye)return 11;if(e===we)return 14}return 2}(r),e=Hl(r,e),a){case 0:t=ms(null,t,r,e,n);break e;case 1:t=gs(null,t,r,e,n);break e;case 11:t=cs(null,t,r,e,n);break e;case 14:t=ds(null,t,r,Hl(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,ms(e,t,r,a=t.elementType===r?a:Hl(r,a),n);case 1:return r=t.type,a=t.pendingProps,gs(e,t,r,a=t.elementType===r?a:Hl(r,a),n);case 3:e:{if(vs(t),null===e)throw Error(G(387));r=t.pendingProps,a=(o=t.memoizedState).element,Mi(e,t),Ai(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=bs(e,t,r,n,a=Jl(Error(G(423)),t));break e}if(r!==a){t=bs(e,t,r,n,a=Jl(Error(G(424)),t));break e}for(Qo=Ja(t.stateNode.containerInfo.firstChild),Ko=t,Go=!0,qo=null,n=di(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ri(),r===a){t=Ts(e,t,n);break e}us(e,t,r,n)}t=t.child}return t;case 5:return $i(t),null===e&&Zo(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,i=a.children,Ha(r,a)?i=null:null!==o&&Ha(r,o)&&(t.flags|=32),hs(e,t),us(e,t,i,n),t.child;case 6:return null===e&&Zo(t),null;case 13:return Es(e,t,n);case 4:return ji(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ci(t,null,r,n):us(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,cs(e,t,r,a=t.elementType===r?a:Hl(r,a),n);case 7:return us(e,t,t.pendingProps,n),t.child;case 8:case 12:return us(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,go(fi,r._currentValue),r._currentValue=i,null!==o)if(Yr(o.value,i)){if(o.children===a.children&&!bo.current){t=Ts(e,t,n);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var l=o.dependencies;if(null!==l){i=o.child;for(var s=l.firstContext;null!==s;){if(s.context===r){if(1===o.tag){(s=Ni(-1,n&-n)).tag=2;var u=o.updateQueue;if(null!==u){var c=(u=u.shared).pending;null===c?s.next=s:(s.next=c.next,c.next=s),u.pending=s}}o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),vi(o.return,n,t),l.lanes|=n;break}s=s.next}}else if(10===o.tag)i=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(i=o.return))throw Error(G(341));i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),vi(i,n,t),i=o.sibling}else i=o.child;if(null!==i)i.return=o;else for(i=o;null!==i;){if(i===t){i=null;break}if(null!==(o=i.sibling)){o.return=i.return,i=o;break}i=i.return}o=i}us(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,bi(t,n),r=r(a=wi(a)),t.flags|=1,us(e,t,r,n),t.child;case 14:return a=Hl(r=t.type,t.pendingProps),ds(e,t,r,a=Hl(r.type,a),n);case 15:return fs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Hl(r,a),As(e,t),t.tag=1,So(r)?(e=!0,Eo(t)):e=!1,bi(t,n),ql(t,r,a),Xl(t,r,a,n),ys(null,t,r,!0,e,n);case 19:return Ls(e,t,n);case 22:return ps(e,t,n)}throw Error(G(156,t.tag))};var Ic="function"==typeof reportError?reportError:function(e){console.error(e)};function Oc(e){this._internalRoot=e}function Fc(e){this._internalRoot=e}function jc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Uc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function $c(){}function Bc(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o;if("function"==typeof a){var l=a;a=function(){var e=Tc(i);l.call(e)}}Ac(t,i,e,a)}else i=function(e,t,n,r,a){if(a){if("function"==typeof r){var o=r;r=function(){var e=Tc(i);o.call(e)}}var i=Lc(t,r,e,0,null,!1,0,"",$c);return e._reactRootContainer=i,e[ro]=i.current,La(8===e.nodeType?e.parentNode:e),Zu(),i}for(;a=e.lastChild;)e.removeChild(a);if("function"==typeof r){var l=r;r=function(){var e=Tc(s);l.call(e)}}var s=Pc(e,0,!1,null,0,!1,0,"",$c);return e._reactRootContainer=s,e[ro]=s.current,La(8===e.nodeType?e.parentNode:e),Zu(function(){Ac(t,s,n,r)}),s}(n,t,e,a,r);return Tc(i)}Fc.prototype.render=Oc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(G(409));Ac(e,t,null,null)},Fc.prototype.unmount=Oc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Zu(function(){Ac(null,e,null,null)}),t[ro]=null}},Fc.prototype.unstable_scheduleHydration=function(e){if(e){var t=hn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xn.length&&0!==t&&t<xn[n].priority;n++);xn.splice(n,0,e),0===n&&Mn(e)}},dn=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=en(t.pendingLanes);0!==n&&(sn(t,1|n),Ku(t,Ut()),!(6&yu)&&(Lu=Ut()+500,Ao()))}break;case 13:Zu(function(){var t=Ci(e,1);if(null!==t){var n=Vu();Hu(t,e,1,n)}}),Dc(e,1)}},fn=function(e){if(13===e.tag){var t=Ci(e,134217728);if(null!==t)Hu(t,e,134217728,Vu());Dc(e,134217728)}},pn=function(e){if(13===e.tag){var t=Wu(e),n=Ci(e,t);if(null!==n)Hu(n,e,t,Vu());Dc(e,t)}},hn=function(){return un},mn=function(e,t){var n=un;try{return un=e,t()}finally{un=n}},dt=function(e,t,n){switch(t){case"input":if($e(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=co(r);if(!a)throw Error(G(90));Ie(r),$e(r,a)}}}break;case"textarea":Ge(e,n);break;case"select":null!=(t=n.value)&&He(e,!!n.multiple,t,!1)}},yt=Ju,vt=Zu;var Vc={usingClientEntryPoint:!1,Events:[so,uo,co,mt,gt,Ju]},Wc={findFiberByHostInstance:lo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Hc={bundleType:Wc.bundleType,version:Wc.version,rendererPackageName:Wc.rendererPackageName,rendererConfig:Wc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ue.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=zt(e))?null:e.stateNode},findFiberByHostInstance:Wc.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Kc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kc.isDisabled&&Kc.supportsFiber)try{Qt=Kc.inject(Hc),Gt=Kc}catch(Ze){}}B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vc,B.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!jc(t))throw Error(G(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:de,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},B.createRoot=function(e,t){if(!jc(e))throw Error(G(299));var n=!1,r="",a=Ic;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=Pc(e,1,!1,null,0,n,0,r,a),e[ro]=t.current,La(8===e.nodeType?e.parentNode:e),new Oc(t)},B.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(G(188));throw e=Object.keys(e).join(","),Error(G(268,e))}return e=null===(e=zt(t))?null:e.stateNode},B.flushSync=function(e){return Zu(e)},B.hydrate=function(e,t,n){if(!Uc(t))throw Error(G(200));return Bc(null,e,t,!0,n)},B.hydrateRoot=function(e,t,n){if(!jc(e))throw Error(G(405));var r=null!=n&&n.hydratedSources||null,a=!1,o="",i=Ic;if(null!=n&&(!0===n.unstable_strictMode&&(a=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=Lc(t,null,e,1,null!=n?n:null,a,0,o,i),e[ro]=t.current,La(e),r)for(e=0;e<r.length;e++)a=(a=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Fc(t)},B.render=function(e,t,n){if(!Uc(t))throw Error(G(200));return Bc(null,e,t,!1,n)},B.unmountComponentAtNode=function(e){if(!Uc(e))throw Error(G(40));return!!e._reactRootContainer&&(Zu(function(){Bc(null,null,e,!1,function(){e._reactRootContainer=null,e[ro]=null})}),!0)},B.unstable_batchedUpdates=Ju,B.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Uc(n))throw Error(G(200));if(null==e||void 0===e._reactInternals)throw Error(G(38));return Bc(e,t,n,!1,r)},B.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),$.exports=B;var Qc,Gc=$.exports;Qc=Gc.createRoot,Gc.hydrateRoot;var qc={exports:{}},Yc={},Xc=j,Jc=Symbol.for("react.element"),Zc=Symbol.for("react.fragment"),ed=Object.prototype.hasOwnProperty,td=Xc.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,nd={key:!0,ref:!0,__self:!0,__source:!0};function rd(e,t,n){var r,a={},o=null,i=null;for(r in void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),void 0!==t.ref&&(i=t.ref),t)ed.call(t,r)&&!nd.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:Jc,type:e,key:o,ref:i,props:a,_owner:td.current}}Yc.Fragment=Zc,Yc.jsx=rd,Yc.jsxs=rd,qc.exports=Yc;var ad=qc.exports;function od(e){return{title:e.title,snippet:e.content,relevance:e.score,documentId:e.documentId,fullContent:e.fullContent,downloadUrl:e.downloadUrl,documentName:e.documentName,sourceType:e.sourceType,chunkId:e.chunkId}}class id{constructor(e,t){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t}async chat(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}: ${n.statusText}`)}const r=await n.json();return{...r,sources:(r.sources||[]).map(od)}}async chatStream(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}`)}const r=n.body?.getReader();if(!r)throw new Error("Streaming not supported");const a=new TextDecoder;let o,i="",l="",s=[];try{for(;;){const{done:e,value:n}=await r.read();if(e)break;i+=a.decode(n,{stream:!0});const u=i.split("\n");i=u.pop()||"";for(const e of u)if(e.startsWith("event: "));else if(e.startsWith("data: "))try{const n=JSON.parse(e.slice(6));void 0!==n.text?(l+=n.text,t.onToken?.(n.text)):void 0!==n.sources?(s=(n.sources||[]).map(od),t.onSources?.(s)):void 0!==n.sessionId&&(o=n.sessionId)}catch{}}t.onComplete?.({fullText:l,sessionId:o,sources:s})}catch(e){t.onError?.(e)}}async getGeneralDocs(e){const t=new URLSearchParams;e&&t.set("since",e);const n=`${this.baseUrl}/api/external/docs${t.toString()?"?"+t:""}`,r=await fetch(n,{headers:{"X-API-Key":this.apiKey}});if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).documents}async getStatus(){const e=await fetch(`${this.baseUrl}/api/external/status`,{headers:{"X-API-Key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){const e=await fetch(`${this.baseUrl}/api/external/health`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}}let ld,sd;const ud=new WeakMap,cd=new WeakMap,dd=new WeakMap,fd=new WeakMap,pd=new WeakMap;let hd={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return cd.get(e);if("objectStoreNames"===t)return e.objectStoreNames||dd.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return yd(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function md(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(sd||(sd=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(vd(this),t),yd(ud.get(this))}:function(...t){return yd(e.apply(vd(this),t))}:function(t,...n){const r=e.call(vd(this),t,...n);return dd.set(r,t.sort?t.sort():[t]),yd(r)}}function gd(e){return"function"==typeof e?md(e):(e instanceof IDBTransaction&&function(e){if(cd.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});cd.set(e,t)}(e),t=e,(ld||(ld=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,hd):e);var t}function yd(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{t(yd(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",a),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&ud.set(t,e)}).catch(()=>{}),pd.set(t,e),t}(e);if(fd.has(e))return fd.get(e);const t=gd(e);return t!==e&&(fd.set(e,t),pd.set(t,e)),t}const vd=e=>pd.get(e);function bd(e,t,{blocked:n,upgrade:r,blocking:a,terminated:o}={}){const i=indexedDB.open(e,t),l=yd(i);return r&&i.addEventListener("upgradeneeded",e=>{r(yd(i.result),e.oldVersion,e.newVersion,yd(i.transaction),e)}),n&&i.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),l.then(e=>{o&&e.addEventListener("close",()=>o()),a&&e.addEventListener("versionchange",e=>a(e.oldVersion,e.newVersion,e))}).catch(()=>{}),l}const wd=["get","getKey","getAll","getAllKeys","count"],kd=["put","add","delete","clear"],Sd=new Map;function xd(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Sd.get(t))return Sd.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,a=kd.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!wd.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,a?"readwrite":"readonly");let i=o.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),a&&o.done]))[0]};return Sd.set(t,o),o}hd=(e=>({...e,get:(t,n,r)=>xd(t,n)||e.get(t,n,r),has:(t,n)=>!!xd(t,n)||e.has(t,n)}))(hd);class Cd{constructor(e){this.db=null,this.dbPromise=null,this.documentCount=0,this.lastSyncAt=null,this.config=e,"indexeddb"===e.storage&&"undefined"!=typeof indexedDB?this.dbPromise=this.initDB():"localstorage"===e.storage&&this.loadLocalStorageMetadata()}loadLocalStorageMetadata(){try{const e=localStorage.getItem("cybernetic-cache-meta");if(e){const t=JSON.parse(e);this.documentCount=t.documentCount||0,this.lastSyncAt=t.lastSyncAt||null}}catch{}}async initDB(){return this.db=await bd("cybernetic-cache",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){e.createObjectStore("documents",{keyPath:"id"}).createIndex("by-updated","updatedAt")}e.objectStoreNames.contains("metadata")||e.createObjectStore("metadata",{keyPath:"key"})}}),await this.loadMetadata(),this.db}async getDB(){if(this.db)return this.db;if(this.dbPromise)return this.dbPromise;throw new Error("Database not available")}async loadMetadata(){if(!this.db)return;const e=await this.db.get("metadata","documentCount");this.documentCount=e?.value||0;const t=await this.db.get("metadata","lastSyncAt");this.lastSyncAt=t?.value||null}async store(e){if("localstorage"===this.config.storage)return this.storeLocalStorage(e);const t=(await this.getDB()).transaction(["documents","metadata"],"readwrite");for(const n of e)await t.objectStore("documents").put(n);this.documentCount=await t.objectStore("documents").count(),this.lastSyncAt=(new Date).toISOString(),await t.objectStore("metadata").put({key:"documentCount",value:this.documentCount}),await t.objectStore("metadata").put({key:"lastSyncAt",value:this.lastSyncAt}),await t.done}async retrieve(){if("localstorage"===this.config.storage)return this.retrieveLocalStorage();return(await this.getDB()).getAll("documents")}async getLastSync(){return this.lastSyncAt}getStatus(){const e=Date.now()-(this.lastSyncAt?new Date(this.lastSyncAt).getTime():0)>this.config.maxAge;return{documentCount:this.documentCount,lastSyncAt:this.lastSyncAt,cacheSize:5e3*this.documentCount,isStale:e}}async clear(){if("localstorage"===this.config.storage)return localStorage.removeItem("cybernetic-cache-docs"),localStorage.removeItem("cybernetic-cache-meta"),this.documentCount=0,void(this.lastSyncAt=null);const e=(await this.getDB()).transaction(["documents","metadata"],"readwrite");await e.objectStore("documents").clear(),await e.objectStore("metadata").clear(),await e.done,this.documentCount=0,this.lastSyncAt=null}storeLocalStorage(e){try{localStorage.setItem("cybernetic-cache-docs",JSON.stringify(e)),this.documentCount=e.length,this.lastSyncAt=(new Date).toISOString(),localStorage.setItem("cybernetic-cache-meta",JSON.stringify({documentCount:this.documentCount,lastSyncAt:this.lastSyncAt}))}catch{localStorage.removeItem("cybernetic-cache-docs");const t=e.slice(0,50);localStorage.setItem("cybernetic-cache-docs",JSON.stringify(t)),this.documentCount=t.length}}retrieveLocalStorage(){try{const e=localStorage.getItem("cybernetic-cache-docs");return e?JSON.parse(e):[]}catch{return[]}}}class _d{constructor(){this.documents=[],this.idf=new Map,this.indexed=!1,this.loadedFromExport=!1,this.vocabulary=new Map}isIndexed(){return this.indexed&&this.documents.length>0}async index(e){this.documents=[],this.idf=new Map;const t=new Map;for(const n of e){const e=this.tokenize(n.content),r=new Set(e);for(const e of r)t.set(e,(t.get(e)||0)+1);this.documents.push({id:n.id,title:n.title,content:n.content,tokens:e,tfidf:new Map})}const n=e.length;for(const[e,r]of t)this.idf.set(e,Math.log((n+1)/(r+1))+1);for(const e of this.documents){const t=this.computeTermFrequency(e.tokens);for(const[n,r]of t){const t=this.idf.get(n)||1;e.tfidf.set(n,r*t)}}this.indexed=!0}async ask(e){if(!this.indexed||0===this.documents.length)return{answer:"I don't have any information available offline.",sources:[],topScore:0};const t=this.tokenize(e),n=this.computeTermFrequency(t),r=new Map;for(const[e,t]of n){const n=this.idf.get(e)||1;r.set(e,t*n)}const a=this.documents.map(e=>({doc:e,score:this.cosineSimilarity(r,e.tfidf)}));a.sort((e,t)=>t.score-e.score);const o=a.slice(0,3).filter(e=>e.score>.1);if(0===o.length)return{answer:"I couldn't find relevant information for your question in my offline data.",sources:[],topScore:a[0]?.score||0};const i=o[0].doc;return{answer:this.extractRelevantSnippet(i.content,t),sources:o.map(e=>({title:e.doc.title,snippet:e.doc.content.substring(0,200)+"...",score:e.score})),topScore:o[0].score}}reset(){this.documents=[],this.idf=new Map,this.vocabulary=new Map,this.indexed=!1,this.loadedFromExport=!1,this.exportVersion=void 0,this.exportedAt=void 0}async loadFromExport(e){this.reset(),this.idf=new Map(Object.entries(e.tfidfIndex.idf));let t=0;for(const e of this.idf.keys())this.vocabulary.set(e,t++);for(const t of e.documents){const e=new Map;for(const[n,r]of t.tfidfVector)for(const[t,a]of this.vocabulary)if(a===n){e.set(t,r);break}this.documents.push({id:t.id,title:t.title,content:t.content,tokens:[],tfidf:e})}this.indexed=!0,this.loadedFromExport=!0,this.exportVersion=e.version,this.exportedAt=e.meta.exportedAt,console.log(`[CyberneticLocalRAG] Loaded ${this.documents.length} documents from export (v${e.version})`)}getExportStatus(){return{loaded:this.indexed,loadedFromExport:this.loadedFromExport,documentCount:this.documents.length,chunkCount:this.documents.length,exportVersion:this.exportVersion,exportedAt:this.exportedAt}}tokenize(e){return e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>2&&!this.isStopWord(e))}computeTermFrequency(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)||0)+1);const n=Math.max(...t.values());if(n>0)for(const[e,r]of t)t.set(e,r/n);return t}cosineSimilarity(e,t){let n=0,r=0,a=0;for(const[a,o]of e){n+=o*(t.get(a)||0),r+=o*o}for(const e of t.values())a+=e*e;return 0===r||0===a?0:n/(Math.sqrt(r)*Math.sqrt(a))}extractRelevantSnippet(e,t){const n=e.split(/[.!?]+/).filter(e=>e.trim().length>0).map(e=>{const n=new Set(this.tokenize(e));let r=0;for(const e of t)n.has(e)&&r++;return{sentence:e.trim(),score:r}});n.sort((e,t)=>t.score-e.score);const r=n.slice(0,3).filter(e=>e.score>0);return 0===r.length?e.substring(0,300)+"...":r.map(e=>e.sentence).join(". ")+"."}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very"]).has(e)}}class Ed{constructor(){this.db=null,this.dbPromise=null,this.dbName="cybernetic-offline-vectors",this.dbVersion=1}async initDB(){return this.db?this.db:this.dbPromise?this.dbPromise:(this.dbPromise=bd(this.dbName,this.dbVersion,{upgrade(e){e.objectStoreNames.contains("vectors")||e.createObjectStore("vectors",{keyPath:"id"})}}),this.db=await this.dbPromise,this.db)}async store(e,t){const n=await this.getDB();await n.put("vectors",{id:e,exportVersion:t.version,exportedAt:t.meta.exportedAt,type:t.type,data:t}),console.log(`[CyberneticOfflineStorage] Stored ${t.meta.chunkCount} chunks`)}async retrieve(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?.data??null}async isValid(e,t){const n=await this.getDB(),r=await n.get("vectors",e);if(!r)return!1;const a=new Date(r.exportedAt).getTime();return Date.now()-a<t}async getMeta(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?{version:n.exportVersion,exportedAt:n.exportedAt,documentCount:n.data.meta.documentCount,chunkCount:n.data.meta.chunkCount,type:n.type}:null}async hasData(){const e=await this.getDB();return await e.count("vectors")>0}async getStoredIds(){return(await this.getDB()).getAllKeys("vectors")}async delete(e){const t=await this.getDB();await t.delete("vectors",e)}async clear(){const e=await this.getDB();await e.clear("vectors"),console.log("[CyberneticOfflineStorage] Cache cleared")}async getDB(){return this.db?this.db:this.initDB()}close(){this.db&&(this.db.close(),this.db=null,this.dbPromise=null)}}function Md(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;n&&(t+="=".repeat(4-n));const r=atob(t),a=new Uint8Array(r.length);for(let e=0;e<r.length;e++)a[e]=r.charCodeAt(e);return a}function Nd(e){const t=Md(e);return(new TextDecoder).decode(t)}async function Pd(e,t,n){try{const r=await async function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return crypto.subtle.importKey("spki",r.buffer,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}(n),a=(new TextEncoder).encode(e),o=new Uint8Array(t).buffer;return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,o,a)}catch(e){return console.warn("[License] Signature verification failed:",e),!1}}async function Rd(e,t){if(!e||""===e.trim())return{status:"missing",payload:null,error:"No license key provided",inGracePeriod:!1,daysRemaining:null};const n=function(e){try{const t=e.split(".");if(3!==t.length)return null;const[n,r,a]=t;return{header:JSON.parse(Nd(n)),payload:JSON.parse(Nd(r)),signature:Md(a),signedContent:`${n}.${r}`}}catch{return null}}(e);if(!n)return{status:"invalid",payload:null,error:"Invalid license key format",inGracePeriod:!1,daysRemaining:null};const r=function(e){return"string"!=typeof e.iss||"string"!=typeof e.sub||"string"!=typeof e.aud||"number"!=typeof e.iat||"number"!=typeof e.exp||"string"!=typeof e.plan||"number"!=typeof e.seats?null:Array.isArray(e.features)?"number"!=typeof e.licenseVersion?null:{iss:e.iss,sub:e.sub,aud:e.aud,iat:e.iat,exp:e.exp,plan:e.plan,org:"string"==typeof e.org?e.org:void 0,seats:e.seats,features:e.features,graceUntil:"number"==typeof e.graceUntil?e.graceUntil:void 0,licenseVersion:e.licenseVersion}:null}(n.payload);if(!r)return{status:"invalid",payload:null,error:"Invalid license payload structure",inGracePeriod:!1,daysRemaining:null};if("astermind"!==r.iss)return{status:"invalid",payload:null,error:"Invalid license issuer",inGracePeriod:!1,daysRemaining:null};if("cybernetic-chatbot"!==r.aud&&"*"!==r.aud)return{status:"invalid",payload:null,error:"License not valid for this product",inGracePeriod:!1,daysRemaining:null};if("undefined"!=typeof crypto&&crypto.subtle){const e=t||"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhLW7MXHQ0Fuk1OKt9D5CbRw7fUMN\nLJ5AZXvOhHaXdHzMuYKX5BpK4w7TqbPvJ6QPvKmLKvHh1VKcUJ6mJQgJJw==\n-----END PUBLIC KEY-----";if(!await Pd(n.signedContent,n.signature,e))return{status:"invalid",payload:null,error:"License signature verification failed",inGracePeriod:!1,daysRemaining:null}}const a=Math.floor(Date.now()/1e3),o=function(e){const t=e-Math.floor(Date.now()/1e3);return Math.floor(t/86400)}(r.exp);return r.exp<a?r.graceUntil&&r.graceUntil>a?{status:"valid",payload:r,inGracePeriod:!0,daysRemaining:o}:{status:"expired",payload:r,error:"License has expired",inGracePeriod:!1,daysRemaining:o}:"eval"===r.plan?{status:"eval",payload:r,inGracePeriod:!1,daysRemaining:o}:{status:"valid",payload:r,inGracePeriod:!1,daysRemaining:o}}const Ld="cybernetic-chatbot-client",Ad="agentic";class Td{constructor(e={}){this.state=null,this.verificationPromise=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures=new Set,this.config=e,this.environment=e.environment||function(){if("undefined"==typeof window)return"production"===process?.env?.NODE_ENV?"production":"development";const e=window.location?.hostname||"",t=["localhost","127.0.0.1","0.0.0.0",".local",".dev",".test",":3000",":5173",":8080",":4200"];for(const n of t)if(e.includes(n)||window.location?.port===n.replace(":",""))return"development";if("file:"===window.location?.protocol)return"development";const n=["staging.","preview.","-preview.",".vercel.app",".netlify.app",".pages.dev"];for(const t of n)if(e.includes(t))return"production";return"production"}(),this.enforcementMode="development"===this.environment?"soft":"hard"}async verify(){if(this.state)return this.state;if(this.verificationPromise)return this.verificationPromise;this.verificationPromise=Rd(this.config.licenseKey,this.config.publicKey);try{return this.state=await this.verificationPromise,this.config.onStatusChange?.(this.state),this.logLicenseStatus(),this.state}finally{this.verificationPromise=null}}getState(){return this.state}isValid(){return!!this.state&&("valid"===this.state.status||"eval"===this.state.status)}requiresAction(){return!this.state||("expired"===this.state.status||"missing"===this.state.status||"invalid"===this.state.status)}getEnvironment(){return this.environment}getEnforcementMode(){return this.enforcementMode}processResponse(e){return this.state?this.isValid()&&!this.state.inGracePeriod?e:"soft"===this.enforcementMode?(this.hasLoggedWarning||(this.logDevelopmentWarning(),this.hasLoggedWarning=!0),e):e+"\n\n---\n⚠️ License Notice: Your AsterMind license key needs to be updated. Please contact support@astermind.ai or visit https://astermind.ai/license to renew your license.":e}getStatusMessage(){if(!this.state)return"License not verified";switch(this.state.status){case"valid":return this.state.inGracePeriod?`License expired but in grace period (${Math.abs(this.state.daysRemaining||0)} days overdue)`:`License valid (${this.state.daysRemaining} days remaining)`;case"eval":return`Evaluation license (${this.state.daysRemaining} days remaining)`;case"expired":return`License expired ${Math.abs(this.state.daysRemaining||0)} days ago`;case"missing":return"No license key provided";case"invalid":return`Invalid license: ${this.state.error}`;default:return"Unknown license status"}}async reVerify(){return this.state=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures.clear(),this.verify()}hasFeature(e){return!!this.state?.payload&&this.state.payload.features.includes(e)}getFeatures(){return this.state?.payload?.features||[]}checkClientFeature(){return this.checkFeatureWithLog(Ld,"CyberneticClient")}checkAgenticFeature(){return this.checkFeatureWithLog(Ad,"Agentic capabilities")}checkFeatureWithLog(e,t){if(!this.state?.payload)return!0;const n=this.state.payload.features.includes(e);return n||this.loggedMissingFeatures.has(e)||(this.loggedMissingFeatures.add(e),this.logMissingFeature(e,t)),n}logMissingFeature(e,t){const n=this.getFeatures(),r=this.state?.payload?.plan||"unknown";console.warn(`[Cybernetic License] ${t} requires the '${e}' feature, which is not included in your license.`),console.info(`[Cybernetic License] Current license plan: ${r}`),console.info(`[Cybernetic License] Licensed features: ${n.length>0?n.join(", "):"(none)"}`),console.info("[Cybernetic License] To add this feature, upgrade your license at https://astermind.ai/license")}logLicenseStatus(){if(!this.state)return;const e="[Cybernetic License]";switch(this.state.status){case"valid":this.state.inGracePeriod?console.warn(`${e} License expired but in grace period. Please renew at https://astermind.ai/license`):null!==this.state.daysRemaining&&this.state.daysRemaining<=30&&console.info(`${e} License expires in ${this.state.daysRemaining} days`);break;case"eval":console.info(`${e} Evaluation license - ${this.state.daysRemaining} days remaining`);break;case"expired":console.error(`${e} License expired. Enforcement mode: ${this.enforcementMode}. Renew at https://astermind.ai/license`);break;case"missing":console.warn(`${e} No license key provided. Enforcement mode: ${this.enforcementMode}. Get a license at https://astermind.ai/license`);break;case"invalid":console.error(`${e} Invalid license: ${this.state.error}. Enforcement mode: ${this.enforcementMode}`)}}logDevelopmentWarning(){console.warn(`[Cybernetic License] Running in development mode with ${this.state?.status||"unknown"} license. In production, a warning will be appended to chatbot responses. Get a license at https://astermind.ai/license`)}}class zd{constructor(e){this.status="connecting",this.lastError=null,this.systemSettings=null,this.settingsLastChecked=0,this.SETTINGS_CHECK_INTERVAL=3e5,this.agenticCapabilities=null,this.offlineStorage=null,this.omegaRAG=null,this.offlineWarningShown=!1,this.config={apiUrl:e.apiUrl,apiKey:e.apiKey,fallback:{enabled:e.fallback?.enabled??!0,cacheMaxAge:e.fallback?.cacheMaxAge??864e5,cacheOnConnect:e.fallback?.cacheOnConnect??!0,cacheStorage:e.fallback?.cacheStorage??"indexeddb"},retry:{maxRetries:e.retry?.maxRetries??2,initialDelay:e.retry?.initialDelay??1e3,exponentialBackoff:e.retry?.exponentialBackoff??!0},agentic:e.agentic??null,offline:e.offline??null,sitemap:e.sitemap??null,sources:{enabled:e.sources?.enabled??!0,showSummary:e.sources?.showSummary??!0,showDownload:e.sources?.showDownload??!0,includeFullContent:e.sources?.includeFullContent??!1,maxSources:e.sources?.maxSources??5},onStatusChange:e.onStatusChange||(()=>{}),onError:e.onError||(()=>{})},this.apiClient=new id(this.config.apiUrl,this.config.apiKey),this.cache=new Cd({storage:this.config.fallback.cacheStorage,maxAge:this.config.fallback.cacheMaxAge}),this.localRAG=new _d,this.licenseManager=new Td({licenseKey:e.licenseKey}),this.licenseManager.verify().then(()=>{this.licenseManager.checkClientFeature()}).catch(()=>{}),this.monitorConnection(),this.config.fallback.enabled&&this.config.fallback.cacheOnConnect&&this.syncCache().catch(()=>{}),this.config.offline?.enabled&&this.initializeOffline(this.config.offline).catch(e=>{console.warn("[Cybernetic] Failed to initialize offline vectors:",e)})}registerAgentic(e){this.agenticCapabilities=e,console.log("[Cybernetic] Agentic capabilities registered")}isAgenticEnabled(){return null!==this.agenticCapabilities&&!0===this.config.agentic?.enabled&&(this.licenseManager.checkAgenticFeature(),!0)}getAgenticCapabilities(){return this.agenticCapabilities}getAgenticConfig(){return this.config.agentic}getSourcesConfig(){return{...this.config.sources}}isSourceFeatureAvailable(e){return!!this.config.sources.enabled&&("summary"===e?this.config.sources.showSummary:"download"===e&&(this.config.sources.showDownload&&"online"===this.status))}classifyIntent(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return null;const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).interpretIntent(e)}async executeAction(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return{success:!1,message:"Agentic capabilities not enabled"};const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).executeAction(e)}async smartAsk(e,t){const n=this.classifyIntent(e);if(n&&n.action&&!n.shouldEscalate){if(!1!==this.config.agentic?.requireConfirmation)return{action:n.action};const e=await this.executeAction(n.action);return{action:n.action,actionResult:e}}return{response:await this.ask(e,t)}}async initializeOffline(e){const t=e.storageMode??"hybrid",n=e.cacheMaxAge??6048e5;if("memory"!==t&&(this.offlineStorage=new Ed),this.offlineStorage&&"memory"!==t){const e="default";if(await this.offlineStorage.isValid(e,n)){console.log("[Cybernetic] Loading vectors from IndexedDB cache");const t=await this.offlineStorage.retrieve(e);if(t)return await this.localRAG.loadFromExport(t),void console.log("[Cybernetic] Loaded vectors from IndexedDB cache")}}if(e.vectorFileUrl)try{const n=await fetch(e.vectorFileUrl);if(!n.ok)throw new Error(`Failed to fetch vectors: ${n.status}`);const r=await n.json();return this.offlineStorage&&"memory"!==t&&await this.offlineStorage.store("default",r),await this.localRAG.loadFromExport(r),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded vectors from URL:",e.vectorFileUrl)}catch(e){console.error("[Cybernetic] Failed to load offline vectors from URL:",e)}if(e.vectorData)return await this.localRAG.loadFromExport(e.vectorData),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded inline vector data");this.offlineWarningShown||(console.warn("[Cybernetic] Offline functionality is enabled but no vectors are loaded. Offline responses will be limited. To enable full offline functionality, export vectors from the AsterMind admin panel and configure the vectorFileUrl or vectorData option."),this.offlineWarningShown=!0)}async initializeOmega(e){if(e.omega?.enabled)try{const{OmegaOfflineRAG:t}=await Promise.resolve().then(function(){return ff});this.omegaRAG=new t({reranking:e.omega.reranking,topK:5,verbose:!1}),e.omega.modelUrl?await this.omegaRAG.loadModelFromUrl(e.omega.modelUrl):e.omega.modelData&&await this.omegaRAG.loadModel(e.omega.modelData),console.log("[Cybernetic] Omega RAG initialized")}catch(e){console.warn("[Cybernetic] Failed to initialize Omega RAG:",e),this.omegaRAG=null}}async reloadOfflineVectors(){this.config.offline?.enabled?(this.localRAG.reset(),this.offlineStorage&&await this.offlineStorage.clear(),this.omegaRAG&&this.omegaRAG.clear(),await this.initializeOffline(this.config.offline)):console.warn("[Cybernetic] Offline mode is not enabled")}isOmegaOfflineEnabled(){return this.omegaRAG?.isReady()??!1}getOfflineModelInfo(){return this.omegaRAG?.getModelInfo()??null}getLocalRAGStatus(){return this.localRAG.getExportStatus()}getOfflineStorage(){return this.offlineStorage}async ask(e,t){if(!e||"string"!=typeof e)return this.createErrorResponse("Message is required","none");const n=await this.checkSystemStatus();if(n.maintenanceMode||n.forceOfflineClients)return console.log("[Cybernetic] Maintenance mode active, using cached data"),this.isCacheValid()?await this.fallbackAsk(e):{reply:n.maintenanceMessage||"The service is currently under maintenance. Please try again later.",confidence:"none",sources:[],offline:!0,degradedReason:"Maintenance mode active, no valid cache available"};try{const n=await this.apiWithRetry(e,t);this.setStatus("online");return{reply:this.licenseManager.processResponse(n.reply),confidence:"high",sources:n.sources||[],offline:!1,sessionId:n.sessionId}}catch(n){const r=this.normalizeError(n);return this.lastError=r,this.config.onError(r),"RATE_LIMIT"===r.code?{reply:"I'm receiving too many requests right now. Please try again in a moment.",confidence:"none",sources:[],offline:!1,retryAfter:r.retryAfter}:this.config.fallback.enabled&&!t?.skipFallback?await this.fallbackAsk(e):this.createErrorResponse("Unable to connect to the chatbot service. Please try again later.","none",r.retryAfter)}}async askStream(e,t,n){if(!e||"string"!=typeof e)return void t.onError?.({code:"LOCAL_RAG_ERROR",message:"Message is required"});const r=await this.checkSystemStatus();if(r.maintenanceMode||r.forceOfflineClients){console.log("[Cybernetic] Maintenance mode active, falling back to offline");const n=await this.fallbackAsk(e);return void t.onComplete?.(n)}try{await this.apiClient.chatStream(e,{sessionId:n?.sessionId,context:n?.context,onToken:t.onToken,onSources:t.onSources,onComplete:e=>{this.setStatus("online");const n=this.licenseManager.processResponse(e.fullText);t.onComplete?.({reply:n,confidence:"high",sources:e.sources||[],offline:!1,sessionId:e.sessionId})},onError:e=>{const n=this.normalizeError(e);this.config.onError(n),t.onError?.(n)}})}catch(r){const a=this.normalizeError(r);if(this.lastError=a,this.config.onError(a),this.config.fallback.enabled&&!n?.skipFallback){const n=await this.fallbackAsk(e);t.onComplete?.(n)}else t.onError?.(a)}}async syncCache(){try{const e=await this.cache.getLastSync(),t=await this.apiClient.getGeneralDocs(e);t.length>0&&(await this.cache.store(t),await this.localRAG.index(t),console.log(`[Cybernetic] Cache synced: ${t.length} documents`)),this.setStatus("online")}catch(e){console.warn("[Cybernetic] Cache sync failed:",e)}}getStatus(){return{connection:this.status,cache:this.cache.getStatus(),lastError:this.lastError,systemSettings:this.systemSettings,license:this.licenseManager.getState()}}getLicenseManager(){return this.licenseManager}async clearCache(){await this.cache.clear(),this.localRAG.reset()}async checkConnection(){try{return await this.apiClient.getStatus(),this.setStatus("online"),!0}catch{return this.setStatus("offline"),!1}}async checkSystemStatus(){if(this.systemSettings&&Date.now()-this.settingsLastChecked<this.SETTINGS_CHECK_INTERVAL)return this.systemSettings;try{const e=await this.apiClient.getStatus();return this.systemSettings={cacheRetentionHours:e.systemSettings?.cacheRetentionHours??168,maintenanceMode:e.systemSettings?.maintenanceMode??!1,maintenanceMessage:e.systemSettings?.maintenanceMessage,forceOfflineClients:e.systemSettings?.forceOfflineClients??!1},this.settingsLastChecked=Date.now(),this.systemSettings}catch{return this.systemSettings||{cacheRetentionHours:168,maintenanceMode:!1,forceOfflineClients:!1}}}isMaintenanceMode(){return this.systemSettings?.maintenanceMode??!1}getMaintenanceMessage(){return this.systemSettings?.maintenanceMessage}isCacheValid(){const e=this.cache.getStatus();if(!e.lastSyncAt)return!1;const t=60*(this.systemSettings?.cacheRetentionHours||168)*60*1e3,n=new Date(e.lastSyncAt).getTime();return Date.now()-n<t}async apiWithRetry(e,t){const{maxRetries:n,initialDelay:r,exponentialBackoff:a}=this.config.retry;let o=null;for(let i=0;i<=n;i++)try{return await this.apiClient.chat(e,{sessionId:t?.sessionId,context:t?.context})}catch(e){o=e;const t=this.normalizeError(e);if("AUTH_ERROR"===t.code||"RATE_LIMIT"===t.code)throw e;if(i<n){const e=a?r*Math.pow(2,i):r;await this.sleep(e)}}throw o}async fallbackAsk(e){if(this.setStatus("offline"),this.omegaRAG?.isReady())try{const t=await this.omegaRAG.ask(e);if(!t.degraded){return{reply:this.licenseManager.processResponse(t.answer),confidence:t.confidence,sources:t.sources.map(e=>({title:e.heading,snippet:e.content.substring(0,200)+"...",relevance:e.score})),offline:!0,degradedReason:"Omega hybrid retrieval (offline)"}}}catch(e){console.warn("[Cybernetic] Omega RAG failed, falling back to TF-IDF:",e)}const t=this.localRAG.getExportStatus();if(t.loaded&&t.documentCount>0)try{const n=await this.localRAG.ask(e);let r="medium";n.topScore<.3?r="low":n.topScore>.7&&(r="medium");return{reply:this.licenseManager.processResponse(n.answer),confidence:r,sources:n.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:t.loadedFromExport?"Using pre-exported vectors (offline)":"Processed locally with TF-IDF"}}catch(e){console.error("[Cybernetic] Local RAG error:",e)}const n=this.cache.getStatus();if(0===n.documentCount&&!t.loaded)return{reply:"I'm currently offline and don't have any cached information. Please check your connection and try again.",confidence:"none",sources:[],offline:!0,degradedReason:"No cached documents or offline vectors available"};try{const t=await this.cache.retrieve();this.localRAG.isIndexed()||await this.localRAG.index(t);const r=await this.localRAG.ask(e);let a="medium";r.topScore<.3?a="low":r.topScore>.7&&(a="medium");return{reply:this.licenseManager.processResponse(r.answer),confidence:a,sources:r.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:n.isStale?"Using stale cached data":"Processed locally without server"}}catch(e){return console.error("[Cybernetic] Local RAG error:",e),{reply:"I'm having trouble processing your request offline. Please try again when you're back online.",confidence:"none",sources:[],offline:!0,degradedReason:"Local RAG processing failed"}}}monitorConnection(){"undefined"!=typeof window&&(window.addEventListener("online",()=>{this.syncCache().catch(()=>{})}),window.addEventListener("offline",()=>{this.setStatus("offline")}),navigator.onLine||this.setStatus("offline"))}setStatus(e){this.status!==e&&(this.status=e,this.config.onStatusChange(e))}normalizeError(e){if(e instanceof Error){if(e.message.includes("401")||e.message.includes("Unauthorized"))return{code:"AUTH_ERROR",message:"Invalid or expired API key",originalError:e};if(e.message.includes("429")||e.message.includes("Rate limit")){const t=e.message.match(/retry after (\d+)/i);return{code:"RATE_LIMIT",message:"Rate limit exceeded",retryAfter:t?parseInt(t[1],10):60,originalError:e}}return e.message.includes("5")||e.message.includes("Server")?{code:"SERVER_ERROR",message:"Server error occurred",originalError:e}:{code:"NETWORK_ERROR",message:e.message||"Network error",originalError:e}}return{code:"NETWORK_ERROR",message:"Unknown error occurred"}}createErrorResponse(e,t,n){return{reply:e,confidence:t,sources:[],offline:!1,retryAfter:n}}sleep(e){return new Promise(t=>setTimeout(t,e))}}const Dd={hiddenUnits:50,activation:"relu",ridgeLambda:.01,weightInit:"xavier",seed:1337,dropout:0,log:{verbose:!0,toFile:!1,modelName:"Unnamed ELM Model",level:"info"}};function Id(e){let t=0,n=0;for(;0===t;)t=e();for(;0===n;)n=e();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*n)}Object.assign(Object.assign({},Dd),{useTokenizer:!1}),Object.assign(Object.assign({},Dd),{useTokenizer:!0,maxLen:30,charSet:"abcdefghijklmnopqrstuvwxyz",tokenizerDelimiter:/\s+/});class Od{constructor(e,t,n=1e-4){this.p=e,this.m=t,this.lambda=n,this.Ainv=new Float64Array(e*e),this.Beta=new Float64Array(e*t);const r=1/Math.max(1e-12,n);for(let t=0;t<e;t++)this.Ainv[t*e+t]=r}update(e,t){const{p:n,m:r,Ainv:a,Beta:o}=this,i=new Float64Array(n);for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}let l=1;for(let t=0;t<n;t++)l+=e[t]*i[t];l=Math.max(l,1e-12);const s=1/l;for(let e=0;e<n;e++){const t=i[e]*s;for(let r=0;r<n;r++)a[e*n+r]-=t*i[r]}for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}for(let e=0;e<n;e++){const n=i[e];for(let a=0;a<r;a++)o[e*r+a]+=n*t[a]}}predict(e){const{p:t,m:n,Beta:r}=this,a=new Float64Array(n);for(let o=0;o<n;o++){let i=0;for(let a=0;a<t;a++)i+=e[a]*r[a*n+o];a[o]=i}return a}}function Fd(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(Math.max(0,t))}function jd(e,t){var n,r;const a=Math.min(e.length,t.length);if(0===a)return 0;let o=0,i=0,l=0;for(let s=0;s<a;s++){const a=null!==(n=e[s])&&void 0!==n?n:0,u=null!==(r=t[s])&&void 0!==r?r:0;o+=a*u,i+=a*a,l+=u*u}const s=o/Math.sqrt(Math.max(i*l,1e-12));return Number.isFinite(s)?s:0}function Ud(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,l)}s((r=r.apply(e,t||[])).next())})}function $d(e){return e.replace(/\s+/g," ").split(/(?<=[.?!])\s+/).map(e=>e.trim()).filter(e=>e.length>8&&/\w/.test(e))}function Bd(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[[^\]]*\]\([^)]*\)/g,"").replace(/[-–>•→]/g," ").replace(/\s+/g," ").trim()}function Vd(e,t){return Ud(this,arguments,void 0,function*(e,t,n={}){if(!(null==t?void 0:t.length))return"No results found.";const{dim:r=64,features:a=32,sigma:o=1,rounds:i=3,topSentences:l=8,personality:s="neutral"}=n;let u=$d(t.map(e=>Bd(e.content)).join(" ")).filter(e=>!function(e){return/^(\*|#)/.test(e)||/chapter/i.test(e)||/part\s*\d+/i.test(e)||/section/i.test(e)||/^\s*[A-Z]\)\s*$/.test(e)||e.length<15}(e)).slice(0,120);if(0===u.length)return Bd(t[0].content).slice(0,400);const c=function(e,t,n=1,r=Math.random){const a=new Float64Array(t*e),o=new Float64Array(t),i=1/Math.max(1e-12,n);for(let n=0;n<t*e;n++)a[n]=Id(r)*i;for(let e=0;e<t;e++)o[e]=2*r()*Math.PI;return{W:a,b:o,D:t,d:e,sigma:n}}(r,a,o),d=new Od(2*a,1,.001),f=e=>{const t=new Float64Array(r),n=Math.min(e.length,r);for(let r=0;r<n;r++)t[r]=e.charCodeAt(r)/255;return function(e,t){const{W:n,b:r,D:a,d:o}=e,i=new Float64Array(2*a);for(let e=0;e<a;e++){let l=r[e];const s=e*o;for(let e=0;e<o;e++)l+=n[s+e]*(t[e]||0);i[e]=Math.cos(l),i[a+e]=Math.sin(l)}let l=0;for(let e=0;e<i.length;e++)l+=i[e]*i[e];const s=1/Math.sqrt(Math.max(l,1e-12));for(let e=0;e<i.length;e++)i[e]*=s;return i}(c,function(e,t=1e-12){const n=Fd(e);if(!(n>t&&Number.isFinite(n)))return new Float64Array(e.length);const r=new Float64Array(e.length),a=1/n;for(let t=0;t<e.length;t++)r[t]=e[t]*a;return r}(t))},p=f(e),h=e.toLowerCase().split(/\W+/).filter(e=>e.length>2),m=u.map(e=>{const t=f(e);let n=jd(t,p);const r=e.toLowerCase();for(const e of h)r.includes(e)&&(n+=.02);return{s:e,v:t,w:n}});m.sort((e,t)=>t.w-e.w);let g=m.slice(0,l).map(e=>e.s).join(" "),y=new Float64Array(2*a);for(let e=0;e<i;e++){const e=$d(g).slice(0,l),t=e.map(e=>f(e)),n=t.map(e=>jd(e,p));for(let e=0;e<t.length;e++)d.update(t[e],new Float64Array([n[e]]));y.fill(0);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<r.length;e++)y[e]+=r[e]*a}const r=Fd(y)||1;for(let e=0;e<y.length;e++)y[e]/=r;const a=e.map(e=>({s:e,w:jd(f(e),y)}));a.sort((e,t)=>t.w-e.w),g=a.slice(0,Math.max(3,Math.floor(l/2))).map(e=>e.s).join(" ")}g=function(e){return e.replace(/\s+[-–>•→]\s+/g," ").replace(/\s+\.\s+/g,". ").replace(/([a-z]) - ([a-z])/gi,"$1-$2").replace(/\s{2,}/g," ").trim()}(g);return`${"teacher"===s?"Here’s a simple way to think about it:\n\n":"scientist"===s?"From the retrieved material, we can infer:\n\n":""}${g.charAt(0).toUpperCase()+g.slice(1)}\n\n(${t[0].heading||"Answer"}, Ω-synthesized)`})}function Wd(e,t){let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function Hd(e,t,n,r){if("cosine"===n){const n=Wd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Wd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}function Kd(e,t,n,r,a){const o=function(e,t){const n=new Float64Array(t);for(const[t,r]of e)n[t]=r;return n}(e,t),i=new Float64Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i[e]=Hd(o,t,r,a)}const l=Math.hypot(...i);if(l>0)for(let e=0;e<i.length;e++)i[e]/=l;return i}"function"==typeof SuppressedError&&SuppressedError;const Qd=new Map;function Gd(e){const t=e,n=Qd.get(t);if(n)return n;let r=e.toLowerCase();if(r=r.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g,""),r.length<=2)return Qd.set(t,r),r;r.endsWith("ies")&&r.length>4?r=r.slice(0,-3)+"y":/(xes|ches|shes|zes|sses)$/.test(r)&&r.length>4?r=r.replace(/(xes|ches|shes|zes|sses)$/,e=>"sses"===e?"ss":e.replace(/es$/,"")):r.endsWith("s")&&!/(ss|us)$/.test(r)&&r.length>3&&(r=r.slice(0,-1));const a=[[/ization$|isation$/,"ize"],[/ational$/,"ate"],[/fulness$/,"ful"],[/ousness$/,"ous"],[/iveness$/,"ive"],[/ability$/,"able"],[/ness$/,""],[/ment$/,""],[/ations?$/,"ate"],[/izer$|iser$/,"ize"],[/ally$/,"al"],[/ically$/,"ic"],[/ingly$|edly$/,""],[/ing$|ed$/,""]];for(const[e,t]of a)if(e.test(r)&&r.length-t.length>=4){r=r.replace(e,t);break}return Qd.set(t,r),r}function qd(e,t){const n=Array.from(e,(e,t)=>t);return n.sort((t,n)=>e[n]-e[t]),n.slice(0,t)}function Yd(e){const{query:t,chunks:n,vocabMap:r,idf:a,tfidfDocs:o,denseDocs:i,landmarksIdx:l,landmarkMat:s,vocabSize:u,kernel:c,sigma:d,alpha:f,beta:p,ridge:h,headingW:m,useStem:g,expandQuery:y,topK:v,prefilter:b}=e,w=y?function(e){const t=[];return/\bmap\b/.test(e)&&t.push("dict key value make"),/\bchan|channel\b/.test(e)&&t.push("goroutine concurrency select buffer"),/\berror\b/.test(e)&&t.push("fmt wrap unwrap sentinel try catch"),/\bstruct\b/.test(e)&&t.push("field method receiver init zero value"),e+" "+t.join(" ")}(t):t,k=function(e,t){const n=e.toLowerCase().replace(/[`*_>~]/g," ").replace(/[^a-z0-9]+/g," ").split(/\s+/).filter(Boolean);if(!t)return n;const r=[];for(const e of n){const t=Gd(e);t&&t.length>1&&r.push(t)}return r}(w,g),S=function(e,t,n,r=1){const a=new Map;for(let t=0;t<e.length;t++){const o=e[t],i=n.get(o);if(void 0===i)continue;const l=t<8?r:1;a.set(i,(a.get(i)||0)+l)}const o=Math.max(1,...a.values()),i=new Map;for(const[e,n]of a){const r=.5+n/o*.5;i.set(e,r*(t[e]||0))}return i}(k,a,r,m),x=Kd(S,u,s,c,d),C=o.map(e=>function(e,t){let n=0,r=0,a=0;for(const[a,o]of e){r+=o*o;const e=t.get(a);e&&(n+=o*e)}for(const[,e]of t)a+=e*e;return r&&a?n/(Math.sqrt(r)*Math.sqrt(a)):0}(e,S)),_=i.map(e=>function(e,t,n,r){if("cosine"===n){const n=Wd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Wd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}(e,x,c,d)),E=function(e,t){const n=Array.from(new Set(t.toLowerCase().split(/\W+/).filter(e=>e.length>2))),r=/\b(define|declare|syntax|example|function|struct|map|interface)\b/i.test(t);return e.map(e=>{const t=e.rich||e.content||"",a=t.toLowerCase();let o=0;for(const e of n)a.includes(e)&&o++;return r&&/```/.test(t)&&(o+=5),Math.min(1,.03*o)})}(n,t),M=function(e,t,n){return Math.max(t,Math.min(n,e))}(f,0,1),N=null!=h?h:.08,P=_.map((e,t)=>{const n=C[t],r=p*E[t],a=1/(1+N*(e*e+n*n+.5*r*r))*(M*e+(1-M)*n+r);return Math.tanh(a)}),R=Math.max(v,null!=b?b:0),L=qd(P,R),A=qd(L.map(e=>P[e]),v).map(e=>L[e]);return{items:A.map(e=>{const t=n[e],r=t.rich&&t.rich.trim()||t.content&&t.content.trim()||"(see subsections)";return{score:P[e],heading:t.heading,content:r,index:e}}),scores:A.map(e=>P[e]),indices:A,tfidfScores:A.map(e=>C[e]),denseScores:A.map(e=>_[e])}}const Xd=new Set(["a","an","the","and","or","but","if","then","else","for","to","of","in","on","at","by","with","is","are","was","were","be","been","being","as","from","that","this","it","its","you","your","i","we","they","he","she","them","his","her","our","us","do","does","did","done","not","no","yes","can","could","should","would","may","might","into","about","over","under","between"]);function Jd(e){return e.toLowerCase().replace(/[`*_#>~=\[\]{}()!?.:,;'"<>|/\\+-]+/g," ").split(/\s+/).filter(e=>e&&!Xd.has(e))}function Zd(e){const t=new Map,n=[],r=[];let a=0;for(const o of e){const e=Jd(o);r.push(e.length);const i=new Map;for(const n of e){let e=t.get(n);void 0===e&&(e=a++,t.set(n,e)),i.set(e,(i.get(e)||0)+1)}n.push(i)}const o=e.length,i=Array(a).fill(0);for(const e of n)for(const t of e.keys())i[t]+=1;const l=i.map(e=>Math.log((o+1)/(e+1))+1),s=r.reduce((e,t)=>e+t,0)/Math.max(1,o);return{stats:{vocab:t,idf:l,avgLen:s,df:i},tf:n,docLens:r}}function ef(e,t){const n=new Map;let r=0;for(const[a,o]of e){const e=o*(t[a]||0);n.set(a,e),r+=e*e}const a=Math.sqrt(r)||1e-12;for(const[e,t]of n)n.set(e,t/a);return n}function tf(e,t){const[n,r]=e.size<t.size?[e,t]:[t,e];let a=0;for(const[e,t]of n){const n=r.get(e);void 0!==n&&(a+=t*n)}return a}function nf(e,t,n=1337){const r=new Float64Array(t);for(const[n,a]of e){let e=2654435761*n>>>0;for(let n=0;n<t;n++){e^=e<<13,e^=e>>>17,e^=e<<5;const t=(e>>>0)/4294967296*2-1;r[n]+=a*t}}let a=0;for(let e=0;e<t;e++)a+=r[e]*r[e];const o=Math.sqrt(a)||1e-12;for(let e=0;e<t;e++)r[e]/=o;return r}function rf(e){return/```+\s*go([\s\S]*?)```/i.test(e)||/\bfunc\s+\w+\s*\(.*\)\s*\w*\s*{/.test(e)}function af(e){return/```+/.test(e)||/{[^}]*}/.test(e)}function of(e,t){const n=(r=Jd(e),Array.from(new Set(r)));var r;const a=new Set(Jd(t));if(0===n.length||0===a.size)return 0;let o=0;for(const e of n)a.has(e)&&o++;return o/n.length}function lf(e,t,n,r,a,o,i,l,s,u){var c;const d=[],f=[],p=tf(n,r);d.push(p),f.push("cosine_tfidf");const h=function(e,t,n,r,a=1.5,o=.75){let i=0;for(const[l]of e){const e=t.get(l)||0;e<=0||(i+=Math.log(((n.df[l]||0)+.5)/(n.idf.length-(n.df[l]||0)+.5)+1)*(e*(a+1)/(e+a*(1-o+o*(r/(n.avgLen||1)))||1e-12)))}return i}(a,o,i,l);d.push(h),f.push("bm25");const m=of(t.heading||"",e);d.push(m),f.push("heading_match_frac");const g=function(e,t){const n=new Set(Jd(e)),r=new Set(Jd(t));let a=0;for(const e of n)r.has(e)&&a++;const o=n.size+r.size-a;return 0===o?0:a/o}(e,t.content||"");d.push(g),f.push("jaccard_tokens");const y=rf(t.rich||t.content||""),v=af(t.rich||t.content||"");var b;d.push(y?1:0),f.push("flag_go_code"),d.push(v?1:0),f.push("flag_any_code"),d.push((b=t.content||"",!/(golang\.org|go\.dev|pkg\.go\.dev)/i.test(b)?0:1)),f.push("flag_go_spec_link"),d.push(null!==(c=t.score_base)&&void 0!==c?c:0),f.push("prior_score_base");const w=(t.content||"").length;if(d.push(1/Math.sqrt(1+w)),f.push("len_inv_sqrt"),s&&u){let e=0,t=0;for(let n=0;n<s.length;n++)e+=s[n]*u[n],t+=Math.abs(s[n]-u[n]);d.push(e),f.push("proj_dot"),d.push(t/s.length),f.push("proj_l1mean")}return{names:f,values:d}}class sf{constructor(){this.w=null,this.mu=null,this.sigma=null}fit(e,t,n=.01){var r;const a=e.length,o=(null===(r=e[0])||void 0===r?void 0:r.length)||0;if(0===a||0===o)return void(this.w=new Float64Array(o));const i=new Float64Array(o),l=new Float64Array(o);for(let t=0;t<o;t++){let n=0;for(let r=0;r<a;r++)n+=e[r][t];n/=a,i[t]=n;let r=0;for(let o=0;o<a;o++){const a=e[o][t]-n;r+=a*a}l[t]=Math.sqrt(r/a)||1}const s=Array.from({length:a},(e,t)=>new Float64Array(o));for(let t=0;t<a;t++)for(let n=0;n<o;n++)s[t][n]=(e[t][n]-i[n])/l[n];const u=Array.from({length:o},()=>new Float64Array(o)),c=new Float64Array(o);for(let e=0;e<a;e++){const n=s[e],r=t[e];for(let e=0;e<o;e++){c[e]+=n[e]*r;const t=n[e];for(let r=0;r<=e;r++)u[e][r]+=t*n[r]}}for(let e=0;e<o;e++){for(let t=0;t<e;t++)u[t][e]=u[e][t];u[e][e]+=n}const d=Array.from({length:o},()=>new Float64Array(o));for(let e=0;e<o;e++)for(let t=0;t<=e;t++){let n=u[e][t];for(let r=0;r<t;r++)n-=d[e][r]*d[t][r];d[e][t]=e===t?Math.sqrt(Math.max(n,1e-12)):n/(d[t][t]||1e-12)}const f=new Float64Array(o);for(let e=0;e<o;e++){let t=c[e];for(let n=0;n<e;n++)t-=d[e][n]*f[n];f[e]=t/(d[e][e]||1e-12)}const p=new Float64Array(o);for(let e=o-1;e>=0;e--){let t=f[e];for(let n=e+1;n<o;n++)t-=d[n][e]*p[n];p[e]=t/(d[e][e]||1e-12)}this.w=p,this.mu=i,this.sigma=l}predict(e){if(!this.w||!this.mu||!this.sigma)return 0;let t=0;for(let n=0;n<this.w.length;n++){const r=(e[n]-this.mu[n])/this.sigma[n];t+=this.w[n]*r}return t}}function uf(e,t,n){var r;const a=t.rich||t.content||"";let o=0;/\bgo\b/.test(e.toLowerCase())&&/(define|declare|function|func)/i.test(e)&&rf(a)&&(o=Math.max(o,1));of(t.heading||"",e)>=.34&&af(a)&&(o=Math.max(o,.8));const i=n.names.indexOf("cosine_tfidf"),l=n.names.indexOf("bm25"),s=i>=0?n.values[i]:0,u=l>=0?n.values[l]:0;s>.25&&(o=Math.max(o,.6)),u>1&&(o=Math.max(o,.6));const c=n.names.indexOf("prior_score_base"),d=c>=0?n.values[c]:0;return(null!==(r=t.score_base)&&void 0!==r?r:0)>0&&(o=Math.max(o,Math.min(.6,.2+.5*d))),o}function cf(e,t,n={}){var r,a;const{lambdaRidge:o=.01,randomProjDim:i=32,exposeFeatures:l=!0,attachFeatureNames:s=!1}=n,u=[e,...t.map(e=>e.content||"")],{stats:c,tf:d,docLens:f}=Zd(u),p=d.map(e=>ef(e,c.idf)),h=d[0],m=p[0],g=i>0?nf(m,i):void 0,y=[],v=[],b=[];for(let n=0;n<t.length;n++){const r=t[n],a=d[n+1],o=p[n+1],l=i>0?nf(o,i,1337+n):void 0,s=lf(e,r,m,o,h,a,c,f[n+1]||1,g,l);b.push(s),y.push(s.values);const u=uf(e,r,s);v.push(u)}const w=v.every(e=>Math.abs(e-v[0])<1e-9);if(w){const e=b[0].names.indexOf("cosine_tfidf");if(e>=0)for(let t=0;t<v.length;t++)v[t]=Math.max(0,Math.min(1,.2+.6*y[t][e]))}const k=new sf;k.fit(y,v,o);let S=1/0,x=-1/0;const C=y.map(e=>k.predict(e));for(const e of C)e<S&&(S=e),e>x&&(x=e);const _=Math.max(1e-9,x-S),E=s?null!==(a=null===(r=b[0])||void 0===r?void 0:r.names)&&void 0!==a?a:[]:void 0,M=t.map((e,t)=>{const n=(C[t]-S)/_,r=function(e){if(e>=0)return 1/(1+Math.exp(-e));{const t=Math.exp(e);return t/(1+t)}}((C[t]-.5*(S+x))/(.2*_+1e-6)),a=Object.assign(Object.assign({},e),{score_rr:n,p_relevant:r});return l&&(a._features=y[t]),E&&(a._feature_names=E),a});return M.sort((e,t)=>t.score_rr-e.score_rr),M}function df(e,t={}){const{probThresh:n=.45,epsilonTop:r=.05,useMMR:a=!0,mmrLambda:o=.7,budgetChars:i=1200}=t;if(0===e.length)return[];const l=e[0].score_rr,s=e.filter(e=>e.p_relevant>=n&&e.score_rr>=l-r),u=s.length>0?s:[e[0]];if(!a){const e=[];let t=0;for(const n of u){const r=(n.content||"").length;if(t+r>i&&e.length>0)break;e.push(n),t+=r}return e}return function(e,t=.7,n=1200){const r=[],a=e.map(e=>e.content||""),{stats:o,tf:i}=Zd(a),l=i.map(e=>ef(e,o.idf)),s=new Set;let u=0;for(;s.size<e.length;){let a=-1,o=-1/0;for(let n=0;n<e.length;n++){if(s.has(n))continue;const r=e[n];let i=0;for(const e of s){const t=tf(l[n],l[e]);t>i&&(i=t)}const u=t*r.score_rr-(1-t)*i;u>o&&(o=u,a=n)}if(a<0)break;const i=e[a],c=(i.content||"").length;if(u+c>n&&r.length>0)break;r.push(i),u+=c,s.add(a)}return r}(e.map(e=>Object.assign(Object.assign({},e),{score_rr:u.includes(e)?e.score_rr+.01:e.score_rr})),o,i)}var ff=Object.freeze({__proto__:null,OmegaOfflineRAG:class{constructor(e){this.modelState=null,this.model=null,this.config={reranking:{enabled:e?.reranking?.enabled??!0,lambdaRidge:e?.reranking?.lambdaRidge??.1,useMMR:e?.reranking?.useMMR??!0,mmrLambda:e?.reranking?.mmrLambda??.5,probThresh:e?.reranking?.probThresh??.1},topK:e?.topK??5,verbose:e?.verbose??!1}}async loadModel(e){const t=performance.now();if(this.model=e,this.modelState=function(e){if("astermind-pro-v1"!==e.version&&"astermind-elm-v1"!==e.version)throw new Error(`Unsupported model version: ${e.version}. Expected 'astermind-pro-v1' or 'astermind-elm-v1'`);const t=JSON.parse(JSON.stringify(e.settings||{})),n=new Map(e.vocab),r=Float64Array.from(e.idf),a=e.chunks.map(e=>({heading:e.heading,content:e.content||"",rich:e.rich,level:e.level,secId:e.secId})),o=e.tfidfDocs.map(e=>{const t=new Map;for(const[n,r]of e)t.set(n,r);return t}),i=Array.from(e.landmarksIdx),l=e.landmarkMat.map(e=>Float64Array.from(e));let s;if(!e.denseDocs||e.denseDocs.length!==o.length)throw new Error("recomputeDense=true but buildDense function not provided");return s=e.denseDocs.map(e=>Float64Array.from(e)),{settings:t,vocabMap:n,idf:r,chunks:a,tfidfDocs:o,landmarksIdx:i,landmarkMat:l,denseDocs:s}}(e),this.config.verbose){const e=performance.now()-t;console.log(`[OmegaOfflineRAG] Model loaded in ${e.toFixed(0)}ms`),console.log(`[OmegaOfflineRAG] ${this.modelState.chunks.length} chunks, ${this.modelState.vocabMap.size} vocab`)}}async loadModelFromUrl(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch model from ${e}: ${t.status}`);const n=await t.json();await this.loadModel(n)}isReady(){return null!==this.modelState}getModelInfo(){return this.model&&this.modelState?{version:this.model.version,savedAt:this.model.savedAt,documentCount:this.modelState.chunks.length,vocabularySize:this.modelState.vocabMap.size,landmarkCount:this.modelState.landmarksIdx.length,hasDenseVectors:this.modelState.denseDocs.length>0,settings:this.model.settings}:null}async ask(e){const t=performance.now();if(!this.modelState||!this.model)return{answer:"Omega model not loaded. Please load a model first.",confidence:"none",sources:[],processingTime:0,degraded:!0,degradedReason:"Model not loaded"};try{const n=this.model.settings,r=n.kernel??"rbf",a=n.sigma??1,o=n.alpha??.5,i=n.beta??.3,l=n.ridge??.001,s=n.headingW??.2,u=n.useStem??!0,c=n.expandQuery??!1,d=n.prefilter??100,f=Yd({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:r,sigma:a,alpha:o,beta:i,ridge:l,headingW:s,useStem:u,expandQuery:c,topK:2*this.config.topK,prefilter:d});let p;if(this.config.reranking.enabled&&f.items.length>0){const t=function(e,t,n={}){return df(cf(e,t,n),n)}(e,f.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score_base:f.scores[t]})),{lambdaRidge:this.config.reranking.lambdaRidge,useMMR:this.config.reranking.useMMR,mmrLambda:this.config.reranking.mmrLambda,probThresh:this.config.reranking.probThresh});p=t.slice(0,this.config.topK).map(e=>({heading:e.heading,content:e.content,rich:e.rich,score:e.score_base??0,rerankScore:e.score_rr,probability:e.p_relevant}))}else p=f.items.slice(0,this.config.topK).map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:f.scores[t]}));const h=await Vd(e,p.map(e=>({heading:e.heading,content:e.content,score:e.score}))),m=performance.now()-t,g=p[0]?.score??0,y=this.determineConfidence(g,p.length);return{answer:h,confidence:y,sources:p,processingTime:m,degraded:!1,queryClassification:this.classifyQuery(e)}}catch(e){const n=performance.now()-t;return console.error("[OmegaOfflineRAG] Error during retrieval:",e),{answer:"An error occurred while processing your question offline.",confidence:"none",sources:[],processingTime:n,degraded:!0,degradedReason:e instanceof Error?e.message:"Unknown error"}}}async retrieve(e,t){if(!this.modelState||!this.model)return[];const n=t??this.config.topK,r=this.model.settings,a=r.kernel??"rbf",o=r.sigma??1,i=r.alpha??.5,l=r.beta??.3,s=r.ridge??.001,u=r.headingW??.2,c=r.useStem??!0,d=r.expandQuery??!1,f=r.prefilter??100,p=Yd({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:a,sigma:o,alpha:i,beta:l,ridge:s,headingW:u,useStem:c,expandQuery:d,topK:n,prefilter:f});return p.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:p.scores[t]}))}classifyQuery(e){const t=e.toLowerCase(),n=t.split(/\s+/),r=["what","who","when","where","which","is","are","was","were"],a=["how","steps","guide","tutorial","process","procedure"],o=["why","explain","describe","meaning","definition","concept"],i=["go to","navigate","find","page","link","take me","show me"];let l="unknown",s=.5;const u=[];for(const e of i)if(t.includes(e)){l="navigational",s=.8,u.push(e);break}if("unknown"===l){const e=n[0];a.includes(e)||a.some(e=>t.includes(e))?(l="procedural",s=.7,u.push(...a.filter(e=>t.includes(e)))):o.includes(e)||o.some(e=>t.includes(e))?(l="conceptual",s=.7,u.push(...o.filter(e=>t.includes(e)))):r.includes(e)&&(l="factual",s=.7,u.push(e))}return{type:l,confidence:s,keywords:u}}determineConfidence(e,t){return 0===t?"none":e>=.7||e>=.4?"medium":"low"}clear(){this.modelState=null,this.model=null}}});function pf({onClick:e,position:t,unreadCount:n=0}){return ad.jsxs("button",{className:`astermind-bubble astermind-bubble--${t}`,onClick:e,"aria-label":"Open chat",type:"button",children:[ad.jsx("svg",{className:"astermind-bubble__icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ad.jsx("path",{d:"M21 11.5C21.0034 12.8199 20.6951 14.1219 20.1 15.3C19.3944 16.7118 18.3098 17.8992 16.9674 18.7293C15.6251 19.5594 14.0782 19.9994 12.5 20C11.1801 20.0035 9.87812 19.6951 8.7 19.1L3 21L4.9 15.3C4.30493 14.1219 3.99656 12.8199 4 11.5C4.00061 9.92179 4.44061 8.37488 5.27072 7.03258C6.10083 5.69028 7.28825 4.6056 8.7 3.90003C9.87812 3.30496 11.1801 2.99659 12.5 3.00003H13C15.0843 3.11502 17.053 3.99479 18.5291 5.47089C20.0052 6.94699 20.885 8.91568 21 11V11.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n>0&&ad.jsx("span",{className:"astermind-bubble__badge",children:n})]})}function hf({title:e,subtitle:t,onClose:n,children:r}){return ad.jsxs("div",{className:"astermind-header",children:[ad.jsxs("div",{className:"astermind-header__info",children:[ad.jsx("h3",{className:"astermind-header__title",children:e}),t&&ad.jsx("p",{className:"astermind-header__subtitle",children:t})]}),ad.jsxs("div",{className:"astermind-header__actions",children:[r,ad.jsx("button",{className:"astermind-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:ad.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ad.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]})}function mf(e){if(!e)return"";return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\n/g,"<br />")}function gf(){return ad.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ad.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),ad.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function yf(){return ad.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ad.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),ad.jsx("polyline",{points:"7 10 12 15 17 10"}),ad.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function vf({source:e,showSummaryButton:t,showDownloadButton:n,onViewSummary:r,onDownload:a}){const[o,i]=j.useState(!1);return ad.jsxs("div",{className:"astermind-source",children:[ad.jsxs("div",{className:"astermind-source__header",children:[ad.jsx("span",{className:"astermind-source__title",children:e.documentName||e.title}),ad.jsxs("div",{className:"astermind-source__actions",children:[t&&ad.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),e.fullContent&&i(!o),r?.(e)},title:"View summary","aria-label":"View source summary",children:ad.jsx(gf,{})}),n&&ad.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),a?.(e)},title:"Download source","aria-label":"Download source file",children:ad.jsx(yf,{})}),ad.jsxs("span",{className:"astermind-source__relevance",children:[Math.round(100*e.relevance),"%"]})]})]}),ad.jsx("p",{className:"astermind-source__snippet",children:e.snippet}),o&&e.fullContent&&ad.jsx("div",{className:"astermind-source__full-content",dangerouslySetInnerHTML:{__html:mf(e.fullContent)}})]})}function bf({sources:e,config:t={},isOnline:n=!0,onViewSummary:r,onDownload:a}){const{enabled:o=!0,showSummary:i=!0,showDownload:l=!0}=t;return o&&0!==e.length?ad.jsx("div",{className:"astermind-sources",children:e.map((e,t)=>{const o=i&&!!e.fullContent,s=l&&n&&!!e.downloadUrl;return ad.jsx(vf,{source:e,showSummaryButton:o,showDownloadButton:s,onViewSummary:r,onDownload:a},e.chunkId||e.documentId||t)})}):null}function wf(e){const t=new Date,n=t.getTime()-e.getTime();if(n<6e4)return"Just now";if(n<36e5){return`${Math.floor(n/6e4)}m ago`}return e.toDateString()===t.toDateString()?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})}function kf({message:e,sourceConfig:t,isOnline:n=!0,onViewSourceSummary:r,onDownloadSource:a}){const[o,i]=j.useState(!1);return ad.jsxs("div",{className:`astermind-message astermind-message--${e.role}`,children:[ad.jsx("div",{className:"astermind-message__bubble",children:e.isStreaming&&!e.content?ad.jsxs("span",{className:"astermind-message__typing",children:[ad.jsx("span",{}),ad.jsx("span",{}),ad.jsx("span",{})]}):ad.jsx("div",{className:"astermind-message__content",dangerouslySetInnerHTML:{__html:mf(e.content)}})}),ad.jsxs("div",{className:"astermind-message__meta",children:[ad.jsx("span",{className:"astermind-message__time",children:wf(e.timestamp)}),e.offline&&ad.jsx("span",{className:"astermind-message__offline",title:"Offline response",children:"offline"}),e.confidence&&"high"!==e.confidence&&ad.jsx("span",{className:`astermind-message__confidence astermind-message__confidence--${e.confidence}`,title:`Confidence: ${e.confidence}`,children:e.confidence})]}),e.sources&&e.sources.length>0&&ad.jsxs("div",{className:"astermind-message__sources",children:[ad.jsxs("button",{className:"astermind-message__sources-toggle",onClick:()=>i(!o),type:"button",children:[o?"Hide":"Show"," sources (",e.sources.length,")"]}),o&&ad.jsx(bf,{sources:e.sources,config:t,isOnline:n,onViewSummary:r,onDownload:a})]})]})}function Sf(){return ad.jsxs("div",{className:"astermind-typing",children:[ad.jsx("span",{}),ad.jsx("span",{}),ad.jsx("span",{})]})}function xf({messages:e,isProcessing:t,sourceConfig:n,isOnline:r=!0,onViewSourceSummary:a,onDownloadSource:o}){const i=j.useRef(null);return j.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]),ad.jsxs("div",{className:"astermind-messages",ref:i,children:[e.map(e=>ad.jsx(kf,{message:e,sourceConfig:n,isOnline:r,onViewSourceSummary:a,onDownloadSource:o},e.id)),t&&""===e[e.length-1]?.content&&ad.jsx(Sf,{})]})}function Cf({placeholder:e,disabled:t=!1,onSend:n}){const[r,a]=j.useState(""),o=j.useRef(null),i=()=>{r.trim()&&!t&&(n(r.trim()),a(""),o.current?.focus())};return ad.jsxs("div",{className:"astermind-input",children:[ad.jsx("textarea",{ref:o,className:"astermind-input__textarea",value:r,onChange:e=>{const t=e.target;a(t.value),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),i())},placeholder:e,disabled:t,rows:1,"aria-label":"Message input"}),ad.jsx("button",{className:"astermind-input__send",onClick:i,disabled:t||!r.trim(),"aria-label":"Send message",type:"button",children:ad.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ad.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})}function _f({action:e,onConfirm:t,onCancel:n}){return ad.jsxs("div",{className:"astermind-action-card",children:[ad.jsxs("div",{className:"astermind-action-card__header",children:[ad.jsx("div",{className:"astermind-action-card__icon",children:(e=>{switch(e){case"navigate":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),ad.jsx("polyline",{points:"15,3 21,3 21,9"}),ad.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]});case"fillForm":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),ad.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"clickElement":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M15 15l-2 5L9 9l11 4-5 2z"}),ad.jsx("path",{d:"M15 15l5 5"})]});default:return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("circle",{cx:"12",cy:"12",r:"10"}),ad.jsx("polyline",{points:"12,6 12,12 16,14"})]})}})(e.type)}),ad.jsxs("div",{className:"astermind-action-card__title",children:[ad.jsx("span",{className:"astermind-action-card__label",children:(e=>{switch(e){case"navigate":return"Navigate to";case"fillForm":return"Fill form field";case"clickElement":return"Click";case"triggerModal":return"Open modal";case"scroll":return"Scroll to";case"highlight":return"Highlight";case"custom":return"Execute action";default:return"Perform action"}})(e.type)}),ad.jsx("span",{className:"astermind-action-card__target",children:e.target})]})]}),e.explanation&&ad.jsx("p",{className:"astermind-action-card__explanation",children:e.explanation}),ad.jsxs("div",{className:"astermind-action-card__confidence",children:[ad.jsx("div",{className:"astermind-action-card__confidence-bar",style:{width:100*e.confidence+"%"}}),ad.jsxs("span",{children:[Math.round(100*e.confidence),"% confident"]})]}),ad.jsxs("div",{className:"astermind-action-card__actions",children:[ad.jsx("button",{className:"astermind-action-card__cancel",onClick:n,type:"button",children:"Cancel"}),ad.jsx("button",{className:"astermind-action-card__confirm",onClick:t,type:"button",children:"Confirm"})]})]})}function Ef({status:e}){return ad.jsxs("div",{className:`astermind-status astermind-status--${e}`,children:[ad.jsx("span",{className:"astermind-status__dot"}),ad.jsx("span",{className:"astermind-status__label",children:(()=>{switch(e){case"online":return"Online";case"offline":return"Offline";case"connecting":return"Connecting...";case"error":return"Error";default:return"Unknown"}})()})]})}function Mf({messages:e,isProcessing:t,connectionStatus:n,pendingAction:r,headerTitle:a,headerSubtitle:o,placeholder:i,showPoweredBy:l,sourceConfig:s,onClose:u,onSendMessage:c,onActionConfirm:d,onActionCancel:f,onViewSourceSummary:p,onDownloadSource:h}){const m="online"===n;return ad.jsxs("div",{className:"astermind-window",children:[ad.jsx(hf,{title:a,subtitle:o,onClose:u,children:ad.jsx(Ef,{status:n})}),ad.jsxs("div",{className:"astermind-window__body",children:[ad.jsx(xf,{messages:e,isProcessing:t,sourceConfig:s,isOnline:m,onViewSourceSummary:p,onDownloadSource:h}),r&&ad.jsx(_f,{action:r,onConfirm:()=>d(r),onCancel:f})]}),ad.jsxs("div",{className:"astermind-window__footer",children:[ad.jsx(Cf,{placeholder:i,disabled:t||"error"===n,onSend:c}),l&&ad.jsxs("div",{className:"astermind-powered-by",children:["Powered by ",ad.jsx("a",{href:"https://astermind.ai",target:"_blank",rel:"noopener noreferrer",children:"AsterMind"})]})]})]})}const Nf={primaryColor:"#4F46E5",primaryHover:"#4338CA",backgroundColor:"#ffffff",surfaceColor:"#f3f4f6",textColor:"#1f2937",textMuted:"#6b7280",borderColor:"#e5e7eb",userBubbleBackground:"#4F46E5",userBubbleText:"#ffffff",botBubbleBackground:"#f3f4f6",botBubbleText:"#1f2937",widgetWidth:"380px",widgetHeight:"75vh",bubbleSize:"60px",borderRadius:"12px",fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSize:"14px",shadow:"0 4px 20px rgba(0, 0, 0, 0.15)"};const Pf=j.createContext(null);function Rf({theme:e,children:t}){const n=function(e){const t=j.useMemo(()=>({...Nf,...e}),[e]),n=j.useMemo(()=>({"--astermind-primary":t.primaryColor,"--astermind-primary-hover":t.primaryHover,"--astermind-background":t.backgroundColor,"--astermind-surface":t.surfaceColor,"--astermind-text":t.textColor,"--astermind-text-muted":t.textMuted,"--astermind-border":t.borderColor,"--astermind-user-bg":t.userBubbleBackground,"--astermind-user-text":t.userBubbleText,"--astermind-bot-bg":t.botBubbleBackground,"--astermind-bot-text":t.botBubbleText,"--astermind-widget-width":t.widgetWidth,"--astermind-widget-height":t.widgetHeight,"--astermind-bubble-size":t.bubbleSize,"--astermind-border-radius":t.borderRadius,"--astermind-font-family":t.fontFamily,"--astermind-font-size":t.fontSize,"--astermind-shadow":t.shadow}),[t]);return{theme:t,cssVariables:n}}(e);return ad.jsx(Pf.Provider,{value:n,children:ad.jsx("div",{style:n.cssVariables,children:t})})}function Lf(e){const n=j.useMemo(()=>function(){let e="",n="https://api.astermind.ai";try{t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("astermind-chatbot.min.js",document.baseURI).href}catch{}if(!e&&"undefined"!=typeof process&&process.env&&(e=process.env.REACT_APP_ASTERMIND_RAG_API_KEY||e,n=process.env.REACT_APP_ASTERMIND_RAG_API_SERVER_URL||n),"undefined"!=typeof window){const t=window.__ASTERMIND_CONFIG__;t&&"object"==typeof t&&(e=t.apiKey||e,n=t.apiUrl||n)}return{apiKey:e,apiUrl:n}}(),[]),{apiKey:r,apiUrl:a,throwOnMissingKey:o=!0,position:i="bottom-right",theme:l={},greeting:s="Hi! How can I help you today?",placeholder:u="Type your message...",fallback:c={enabled:!0},sourceDisplay:d,showPoweredBy:f=!0,headerTitle:p="AsterMind",headerSubtitle:h="AI Assistant",defaultOpen:m=!1,zIndex:g=9999,onReady:y,onMessage:v,onAction:b,onError:w,onToggle:k}=e,S=r||n.apiKey,x=a||n.apiUrl,[C,_]=j.useState(m),[E,M]=j.useState(null),[N,P]=j.useState([]),[R,L]=j.useState(!1),[A,T]=j.useState(),[z,D]=j.useState(),[I,O]=j.useState("connecting"),F=j.useMemo(()=>{const e=E?.getSourcesConfig?.()||{};return{enabled:d?.enabled??e.enabled??!0,showSummary:d?.showSummary??e.showSummary??!0,showDownload:d?.showDownload??e.showDownload??!0}},[E,d]),U=j.useCallback(e=>{console.log("[AsterMind] View source summary:",e.title)},[]),$=j.useCallback(async e=>{if(e.downloadUrl)try{const t=e.downloadUrl.startsWith("http")?e.downloadUrl:`${x}${e.downloadUrl}`,n=await fetch(t,{headers:{"X-API-Key":S}});if(!n.ok)return void console.error("[AsterMind] Download failed:",n.status,n.statusText);const r=n.headers.get("Content-Disposition");let a=e.documentName||e.title||"download";if(r){const e=r.match(/filename="?(.+?)"?$/);e&&(a=e[1])}const o=await n.blob(),i=window.URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=a,document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(i),document.body.removeChild(l)}catch(e){console.error("[AsterMind] Download error:",e)}else console.warn("[AsterMind] No download URL for source:",e.title)},[x,S]);j.useEffect(()=>{if(!S){const e='AsterMind API key is required. Configure using one of these methods:\n 1. Pass apiKey prop: <ChatbotWidget apiKey="am_..." />\n 2. Set VITE_ASTERMIND_RAG_API_KEY environment variable (Vite)\n 3. Set REACT_APP_ASTERMIND_RAG_API_KEY environment variable (CRA)\n 4. Set window.__ASTERMIND_CONFIG__ = { apiKey: "am_...", apiUrl: "..." }';if(o)throw new Error(e);console.warn("[AsterMind] "+e)}},[S,o]),j.useEffect(()=>{if(!S)return;const e=new zd({apiUrl:x,apiKey:S,fallback:{enabled:c?.enabled??!0,cacheOnConnect:!0},onStatusChange:e=>{O(e)},onError:e=>{w?.(new Error(e.message))}});if(M(e),s){const e={id:"greeting",role:"assistant",content:s,timestamp:new Date};P([e])}return y?.(),()=>{}},[S,x,c?.enabled,s,w,y]);const B=j.useCallback(()=>{const e=!C;_(e),k?.(e)},[C,k]),V=j.useCallback(()=>{_(!1),k?.(!1)},[k]),W=j.useCallback(async e=>{if(!E||!e.trim()||R)return;const t={id:`user-${Date.now()}`,role:"user",content:e.trim(),timestamp:new Date};P(e=>[...e,t]),v?.(t),L(!0);const n=`assistant-${Date.now()}`,r={id:n,role:"assistant",content:"",timestamp:new Date,isStreaming:!0};P(e=>[...e,r]);try{let t="";await E.askStream(e,{onToken:e=>{t+=e,P(e=>e.map(e=>e.id===n?{...e,content:t}:e))},onSources:e=>{P(t=>t.map(t=>t.id===n?{...t,sources:e}:t))},onComplete:e=>{const t={id:n,role:"assistant",content:e.reply,timestamp:new Date,sources:e.sources,confidence:e.confidence,offline:e.offline,isStreaming:!1};P(e=>e.map(e=>e.id===n?t:e)),T(e.sessionId),v?.(t)},onError:()=>{H(E,e,n)}},{sessionId:A})}catch{const e={id:n,role:"assistant",content:"I encountered an error processing your request. Please try again.",timestamp:new Date,isStreaming:!1};P(t=>t.map(t=>t.id===n?e:t)),w?.(new Error("Failed to process message"))}finally{L(!1)}},[E,R,A,v,w]),H=async(e,t,n)=>{try{const r=await e.ask(t,{sessionId:A}),a={id:n,role:"assistant",content:r.reply,timestamp:new Date,sources:r.sources,confidence:r.confidence,offline:r.offline,isStreaming:!1};P(e=>e.map(e=>e.id===n?a:e)),T(r.sessionId),v?.(a)}catch{const e={id:n,role:"assistant",content:"I'm having trouble connecting. Please try again later.",timestamp:new Date,isStreaming:!1};P(t=>t.map(t=>t.id===n?e:t))}},K=j.useCallback(async e=>{if(!z)return;const t={...z,status:"executed",result:{success:!0,message:`Action ${e.type} completed`}};D(void 0),b?.(t)},[z,b]),Q=j.useCallback(()=>{if(!z)return;const e={...z,status:"cancelled"};D(void 0),b?.(e)},[z,b]);return ad.jsx(Rf,{theme:l,children:ad.jsxs("div",{className:`astermind-chatbot astermind-chatbot--${i}`,style:{zIndex:g},children:[!C&&ad.jsx(pf,{onClick:B,position:i}),C&&ad.jsx(Mf,{messages:N,isProcessing:R,connectionStatus:I,pendingAction:z,headerTitle:p,headerSubtitle:h,placeholder:u,showPoweredBy:f,sourceConfig:F,onClose:V,onSendMessage:W,onActionConfirm:K,onActionCancel:Q,onViewSourceSummary:U,onDownloadSource:$})]})})}let Af=null;function Tf(e){const t=function(){if("undefined"==typeof document)return{};const e=document.querySelector("script[data-astermind-key]");if(!e)return{};const t={},n=e.getAttribute("data-astermind-key");n&&(t.apiKey=n);const r=e.getAttribute("data-astermind-url");r&&(t.apiUrl=r);const a=e.getAttribute("data-astermind-position");a&&["bottom-right","bottom-left","top-right","top-left"].includes(a)&&(t.position=a);const o=e.getAttribute("data-astermind-greeting");o&&(t.greeting=o);const i=e.getAttribute("data-astermind-title");i&&(t.headerTitle=i);const l=e.getAttribute("data-astermind-subtitle");return l&&(t.headerSubtitle=l),"true"===e.getAttribute("data-astermind-auto-open")&&(t.defaultOpen=!0),t}(),n={...t,...function(){if("undefined"==typeof window)return{};const e=window.astermindConfig;return e&&"object"==typeof e?e:{}}(),...e||{}},{container:r=document.body,...a}=n;a.apiKey||console.warn('[AsterMindChatbot] No API key found. Configure using one of these methods:\n 1. AsterMindChatbot.init({ apiKey: "am_..." })\n 2. window.astermindConfig = { apiKey: "am_..." }\n 3. <script data-astermind-key="am_..." ...>\n 4. Set VITE_ASTERMIND_RAG_API_KEY environment variable (if bundled)');const o="string"==typeof r?document.querySelector(r):r;if(!o)return void console.error("[AsterMindChatbot] Container not found:",r);const i=document.createElement("div");i.id="astermind-chatbot-root",o.appendChild(i),Af=Qc(i),Af.render(U.createElement(Lf,a)),console.log("[AsterMindChatbot] Initialized")}function zf(){Af&&(Af.unmount(),Af=null);const e=document.getElementById("astermind-chatbot-root");e&&e.remove(),console.log("[AsterMindChatbot] Destroyed")}function Df(){return null!==Af}return"undefined"!=typeof window&&(window.AsterMindChatbot={init:Tf,destroy:zf,isInitialized:Df}),e.destroy=zf,e.init=Tf,e.isInitialized=Df,e}({});
20
+ */function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Y=new Set,X={};function J(e,t){Z(e,t),Z(e+"Capture",t)}function Z(e,t){for(X[e]=t,e=0;e<t.length;e++)Y.add(t[e])}var ee=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),te=Object.prototype.hasOwnProperty,ne=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,re={},ae={};function oe(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new oe(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new oe(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new oe(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new oe(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new oe(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new oe(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){ie[e]=new oe(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){ie[e]=new oe(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){ie[e]=new oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var se=/[\-:]([a-z])/g;function le(e){return e[1].toUpperCase()}function ce(e,t,n,r){var a=ie.hasOwnProperty(t)?ie[t]:null;(null!==a?0!==a.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!te.call(ae,e)||!te.call(re,e)&&(ne.test(e)?ae[e]=!0:(re[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new oe(e,1,!1,e.toLowerCase(),null,!1,!1)}),ie.xlinkHref=new oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){ie[e]=new oe(e,1,!1,e.toLowerCase(),null,!0,!0)});var ue=q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,de=Symbol.for("react.element"),fe=Symbol.for("react.portal"),he=Symbol.for("react.fragment"),pe=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),ge=Symbol.for("react.provider"),ye=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),be=Symbol.for("react.suspense"),we=Symbol.for("react.suspense_list"),ke=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),xe=Symbol.for("react.offscreen"),Ce=Symbol.iterator;function Ee(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Ce&&e[Ce]||e["@@iterator"])?e:null}var _e,Me=Object.assign;function Re(e){if(void 0===_e)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||""}return"\n"+_e+e}var Ae=!1;function Pe(e,t){if(!e||Ae)return"";Ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,s=o.length-1;1<=i&&0<=s&&a[i]!==o[s];)s--;for(;1<=i&&0<=s;i--,s--)if(a[i]!==o[s]){if(1!==i||1!==s)do{if(i--,0>--s||a[i]!==o[s]){var l="\n"+a[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=i&&0<=s);break}}}finally{Ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Re(e):""}function Le(e){switch(e.tag){case 5:return Re(e.type);case 16:return Re("Lazy");case 13:return Re("Suspense");case 19:return Re("SuspenseList");case 0:case 2:case 15:return e=Pe(e.type,!1);case 11:return e=Pe(e.type.render,!1);case 1:return e=Pe(e.type,!0);default:return""}}function Te(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case he:return"Fragment";case fe:return"Portal";case me:return"Profiler";case pe:return"StrictMode";case be:return"Suspense";case we:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ye:return(e.displayName||"Context")+".Consumer";case ge:return(e._context.displayName||"Context")+".Provider";case ve:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ke:return null!==(t=e.displayName||null)?t:Te(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return Te(e(t))}catch(e){}}return null}function Ne(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Te(t);case 8:return t===pe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function De(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Ie(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ze(e){e._valueTracker||(e._valueTracker=function(e){var t=Ie(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Fe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ie(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Oe(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function $e(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function je(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=De(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ue(e,t){null!=(t=t.checked)&&ce(e,"checked",t,!1)}function Be(e,t){Ue(e,t);var n=De(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?We(e,t.type,n):t.hasOwnProperty("defaultValue")&&We(e,t.type,De(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ve(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function We(e,t,n){"number"===t&&Oe(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var He=Array.isArray;function Ke(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+De(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function qe(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Q(91));return Me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ge(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(Q(92));if(He(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:De(n)}}function Qe(e,t){var n=De(t.value),r=De(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Ye(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Xe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Je(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Xe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Ze,et,tt=(et=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Ze=Ze||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return et(e,t)})}:et);function nt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},at=["Webkit","ms","Moz","O"];function ot(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||rt.hasOwnProperty(e)&&rt[e]?(""+t).trim():t+"px"}function it(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=ot(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(rt).forEach(function(e){at.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rt[t]=rt[e]})});var st=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lt(e,t){if(t){if(st[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Q(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Q(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Q(62))}}function ct(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ut=null;function dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ft=null,ht=null,pt=null;function mt(e){if(e=co(e)){if("function"!=typeof ft)throw Error(Q(280));var t=e.stateNode;t&&(t=fo(t),ft(e.stateNode,e.type,t))}}function gt(e){ht?pt?pt.push(e):pt=[e]:ht=e}function yt(){if(ht){var e=ht,t=pt;if(pt=ht=null,mt(e),t)for(e=0;e<t.length;e++)mt(t[e])}}function vt(e,t){return e(t)}function bt(){}var wt=!1;function kt(e,t,n){if(wt)return e(t,n);wt=!0;try{return vt(e,t,n)}finally{wt=!1,(null!==ht||null!==pt)&&(bt(),yt())}}function St(e,t){var n=e.stateNode;if(null===n)return null;var r=fo(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(Q(231,t,typeof n));return n}var xt=!1;if(ee)try{var Ct={};Object.defineProperty(Ct,"passive",{get:function(){xt=!0}}),window.addEventListener("test",Ct,Ct),window.removeEventListener("test",Ct,Ct)}catch(et){xt=!1}function Et(e,t,n,r,a,o,i,s,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(e){this.onError(e)}}var _t=!1,Mt=null,Rt=!1,At=null,Pt={onError:function(e){_t=!0,Mt=e}};function Lt(e,t,n,r,a,o,i,s,l){_t=!1,Mt=null,Et.apply(Pt,arguments)}function Tt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Nt(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Dt(e){if(Tt(e)!==e)throw Error(Q(188))}function It(e){return e=function(e){var t=e.alternate;if(!t){if(null===(t=Tt(e)))throw Error(Q(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Dt(a),e;if(o===r)return Dt(a),t;o=o.sibling}throw Error(Q(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(3!==n.tag)throw Error(Q(188));return n.stateNode.current===n?e:t}(e),null!==e?zt(e):null}function zt(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=zt(e);if(null!==t)return t;e=e.sibling}return null}var Ft=G.unstable_scheduleCallback,Ot=G.unstable_cancelCallback,$t=G.unstable_shouldYield,jt=G.unstable_requestPaint,Ut=G.unstable_now,Bt=G.unstable_getCurrentPriorityLevel,Vt=G.unstable_ImmediatePriority,Wt=G.unstable_UserBlockingPriority,Ht=G.unstable_NormalPriority,Kt=G.unstable_LowPriority,qt=G.unstable_IdlePriority,Gt=null,Qt=null;var Yt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Xt(e)/Jt|0)|0},Xt=Math.log,Jt=Math.LN2;var Zt=64,en=4194304;function tn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nn(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=268435455&n;if(0!==i){var s=i&~a;0!==s?r=tn(s):0!==(o&=i)&&(r=tn(o))}else 0!==(i=n&~a)?r=tn(i):0!==o&&(r=tn(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(o=t&-t)||16===a&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-Yt(t)),r|=e[n],t&=~a;return r}function rn(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function an(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function on(){var e=Zt;return!(4194240&(Zt<<=1))&&(Zt=64),e}function sn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ln(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Yt(t)]=n}function cn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Yt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var un=0;function dn(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var fn,hn,pn,mn,gn,yn=!1,vn=[],bn=null,wn=null,kn=null,Sn=new Map,xn=new Map,Cn=[],En="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _n(e,t){switch(e){case"focusin":case"focusout":bn=null;break;case"dragenter":case"dragleave":wn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Sn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xn.delete(t.pointerId)}}function Mn(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=co(t))&&hn(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Rn(e){var t=lo(e.target);if(null!==t){var n=Tt(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Nt(n)))return e.blockedOn=t,void gn(e.priority,function(){pn(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function An(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=jn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=co(n))&&hn(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);ut=r,n.target.dispatchEvent(r),ut=null,t.shift()}return!0}function Pn(e,t,n){An(e)&&n.delete(t)}function Ln(){yn=!1,null!==bn&&An(bn)&&(bn=null),null!==wn&&An(wn)&&(wn=null),null!==kn&&An(kn)&&(kn=null),Sn.forEach(Pn),xn.forEach(Pn)}function Tn(e,t){e.blockedOn===t&&(e.blockedOn=null,yn||(yn=!0,G.unstable_scheduleCallback(G.unstable_NormalPriority,Ln)))}function Nn(e){function t(t){return Tn(t,e)}if(0<vn.length){Tn(vn[0],e);for(var n=1;n<vn.length;n++){var r=vn[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==bn&&Tn(bn,e),null!==wn&&Tn(wn,e),null!==kn&&Tn(kn,e),Sn.forEach(t),xn.forEach(t),n=0;n<Cn.length;n++)(r=Cn[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Cn.length&&null===(n=Cn[0]).blockedOn;)Rn(n),null===n.blockedOn&&Cn.shift()}var Dn=ue.ReactCurrentBatchConfig,In=!0;function zn(e,t,n,r){var a=un,o=Dn.transition;Dn.transition=null;try{un=1,On(e,t,n,r)}finally{un=a,Dn.transition=o}}function Fn(e,t,n,r){var a=un,o=Dn.transition;Dn.transition=null;try{un=4,On(e,t,n,r)}finally{un=a,Dn.transition=o}}function On(e,t,n,r){if(In){var a=jn(e,t,n,r);if(null===a)Da(e,t,r,$n,n),_n(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return bn=Mn(bn,e,t,n,r,a),!0;case"dragenter":return wn=Mn(wn,e,t,n,r,a),!0;case"mouseover":return kn=Mn(kn,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Sn.set(o,Mn(Sn.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,xn.set(o,Mn(xn.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(_n(e,r),4&t&&-1<En.indexOf(e)){for(;null!==a;){var o=co(a);if(null!==o&&fn(o),null===(o=jn(e,t,n,r))&&Da(e,t,r,$n,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else Da(e,t,r,null,n)}}var $n=null;function jn(e,t,n,r){if($n=null,null!==(e=lo(e=dt(r))))if(null===(t=Tt(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Nt(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return $n=e,null}function Un(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Bt()){case Vt:return 1;case Wt:return 4;case Ht:case Kt:return 16;case qt:return 536870912;default:return 16}default:return 16}}var Bn=null,Vn=null,Wn=null;function Hn(){if(Wn)return Wn;var e,t,n=Vn,r=n.length,a="value"in Bn?Bn.value:Bn.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return Wn=a.slice(e,1<t?1-t:void 0)}function Kn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function qn(){return!0}function Gn(){return!1}function Qn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?qn:Gn,this.isPropagationStopped=Gn,this}return Me(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=qn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=qn)},persist:function(){},isPersistent:qn}),t}var Yn,Xn,Jn,Zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},er=Qn(Zn),tr=Me({},Zn,{view:0,detail:0}),nr=Qn(tr),rr=Me({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mr,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Jn&&(Jn&&"mousemove"===e.type?(Yn=e.screenX-Jn.screenX,Xn=e.screenY-Jn.screenY):Xn=Yn=0,Jn=e),Yn)},movementY:function(e){return"movementY"in e?e.movementY:Xn}}),ar=Qn(rr),or=Qn(Me({},rr,{dataTransfer:0})),ir=Qn(Me({},tr,{relatedTarget:0})),sr=Qn(Me({},Zn,{animationName:0,elapsedTime:0,pseudoElement:0})),lr=Me({},Zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cr=Qn(lr),ur=Qn(Me({},Zn,{data:0})),dr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=hr[e])&&!!t[e]}function mr(){return pr}var gr=Me({},tr,{key:function(e){if(e.key){var t=dr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Kn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?fr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mr,charCode:function(e){return"keypress"===e.type?Kn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Kn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),yr=Qn(gr),vr=Qn(Me({},rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),br=Qn(Me({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mr})),wr=Qn(Me({},Zn,{propertyName:0,elapsedTime:0,pseudoElement:0})),kr=Me({},rr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Sr=Qn(kr),xr=[9,13,27,32],Cr=ee&&"CompositionEvent"in window,Er=null;ee&&"documentMode"in document&&(Er=document.documentMode);var _r=ee&&"TextEvent"in window&&!Er,Mr=ee&&(!Cr||Er&&8<Er&&11>=Er),Rr=String.fromCharCode(32),Ar=!1;function Pr(e,t){switch(e){case"keyup":return-1!==xr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Tr=!1;var Nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Nr[e.type]:"textarea"===t}function Ir(e,t,n,r){gt(r),0<(t=za(t,"onChange")).length&&(n=new er("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zr=null,Fr=null;function Or(e){Ra(e,0)}function $r(e){if(Fe(uo(e)))return e}function jr(e,t){if("change"===e)return t}var Ur=!1;if(ee){var Br;if(ee){var Vr="oninput"in document;if(!Vr){var Wr=document.createElement("div");Wr.setAttribute("oninput","return;"),Vr="function"==typeof Wr.oninput}Br=Vr}else Br=!1;Ur=Br&&(!document.documentMode||9<document.documentMode)}function Hr(){zr&&(zr.detachEvent("onpropertychange",Kr),Fr=zr=null)}function Kr(e){if("value"===e.propertyName&&$r(Fr)){var t=[];Ir(t,Fr,e,dt(e)),kt(Or,t)}}function qr(e,t,n){"focusin"===e?(Hr(),Fr=n,(zr=t).attachEvent("onpropertychange",Kr)):"focusout"===e&&Hr()}function Gr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return $r(Fr)}function Qr(e,t){if("click"===e)return $r(t)}function Yr(e,t){if("input"===e||"change"===e)return $r(t)}var Xr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Jr(e,t){if(Xr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!te.call(t,a)||!Xr(e[a],t[a]))return!1}return!0}function Zr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ea(e,t){var n,r=Zr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Zr(r)}}function ta(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ta(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function na(){for(var e=window,t=Oe();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Oe((e=t.contentWindow).document)}return t}function ra(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function aa(e){var t=na(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ta(n.ownerDocument.documentElement,n)){if(null!==r&&ra(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=void 0===r.end?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=ea(n,o);var i=ea(n,r);a&&i&&(1!==e.rangeCount||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var oa=ee&&"documentMode"in document&&11>=document.documentMode,ia=null,sa=null,la=null,ca=!1;function ua(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ca||null==ia||ia!==Oe(r)||("selectionStart"in(r=ia)&&ra(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},la&&Jr(la,r)||(la=r,0<(r=za(sa,"onSelect")).length&&(t=new er("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ia)))}function da(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fa={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionend:da("Transition","TransitionEnd")},ha={},pa={};function ma(e){if(ha[e])return ha[e];if(!fa[e])return e;var t,n=fa[e];for(t in n)if(n.hasOwnProperty(t)&&t in pa)return ha[e]=n[t];return e}ee&&(pa=document.createElement("div").style,"AnimationEvent"in window||(delete fa.animationend.animation,delete fa.animationiteration.animation,delete fa.animationstart.animation),"TransitionEvent"in window||delete fa.transitionend.transition);var ga=ma("animationend"),ya=ma("animationiteration"),va=ma("animationstart"),ba=ma("transitionend"),wa=new Map,ka="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sa(e,t){wa.set(e,t),J(t,[e])}for(var xa=0;xa<ka.length;xa++){var Ca=ka[xa];Sa(Ca.toLowerCase(),"on"+(Ca[0].toUpperCase()+Ca.slice(1)))}Sa(ga,"onAnimationEnd"),Sa(ya,"onAnimationIteration"),Sa(va,"onAnimationStart"),Sa("dblclick","onDoubleClick"),Sa("focusin","onFocus"),Sa("focusout","onBlur"),Sa(ba,"onTransitionEnd"),Z("onMouseEnter",["mouseout","mouseover"]),Z("onMouseLeave",["mouseout","mouseover"]),Z("onPointerEnter",["pointerout","pointerover"]),Z("onPointerLeave",["pointerout","pointerover"]),J("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),J("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),J("onBeforeInput",["compositionend","keypress","textInput","paste"]),J("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_a=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ea));function Ma(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,i,s,l){if(Lt.apply(this,arguments),_t){if(!_t)throw Error(Q(198));var c=Mt;_t=!1,Mt=null,Rt||(Rt=!0,At=c)}}(r,t,void 0,e),e.currentTarget=null}function Ra(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&a.isPropagationStopped())break e;Ma(a,s,c),o=l}else for(i=0;i<r.length;i++){if(l=(s=r[i]).instance,c=s.currentTarget,s=s.listener,l!==o&&a.isPropagationStopped())break e;Ma(a,s,c),o=l}}}if(Rt)throw e=At,Rt=!1,At=null,e}function Aa(e,t){var n=t[oo];void 0===n&&(n=t[oo]=new Set);var r=e+"__bubble";n.has(r)||(Na(t,e,2,!1),n.add(r))}function Pa(e,t,n){var r=0;t&&(r|=4),Na(n,e,r,t)}var La="_reactListening"+Math.random().toString(36).slice(2);function Ta(e){if(!e[La]){e[La]=!0,Y.forEach(function(t){"selectionchange"!==t&&(_a.has(t)||Pa(t,!1,e),Pa(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[La]||(t[La]=!0,Pa("selectionchange",!1,t))}}function Na(e,t,n,r){switch(Un(t)){case 1:var a=zn;break;case 4:a=Fn;break;default:a=On}n=a.bind(null,t,n,e),a=void 0,!xt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Da(e,t,n,r,a){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===a||8===s.nodeType&&s.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var l=i.tag;if((3===l||4===l)&&((l=i.stateNode.containerInfo)===a||8===l.nodeType&&l.parentNode===a))return;i=i.return}for(;null!==s;){if(null===(i=lo(s)))return;if(5===(l=i.tag)||6===l){r=o=i;continue e}s=s.parentNode}}r=r.return}kt(function(){var r=o,a=dt(n),i=[];e:{var s=wa.get(e);if(void 0!==s){var l=er,c=e;switch(e){case"keypress":if(0===Kn(n))break e;case"keydown":case"keyup":l=yr;break;case"focusin":c="focus",l=ir;break;case"focusout":c="blur",l=ir;break;case"beforeblur":case"afterblur":l=ir;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=ar;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=or;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=br;break;case ga:case ya:case va:l=sr;break;case ba:l=wr;break;case"scroll":l=nr;break;case"wheel":l=Sr;break;case"copy":case"cut":case"paste":l=cr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=vr}var u=!!(4&t),d=!u&&"scroll"===e,f=u?null!==s?s+"Capture":null:s;u=[];for(var h,p=r;null!==p;){var m=(h=p).stateNode;if(5===h.tag&&null!==m&&(h=m,null!==f&&(null!=(m=St(p,f))&&u.push(Ia(p,m,h)))),d)break;p=p.return}0<u.length&&(s=new l(s,c,null,n,a),i.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===ut||!(c=n.relatedTarget||n.fromElement)||!lo(c)&&!c[ao])&&(l||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?lo(c):null)&&(c!==(d=Tt(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=ar,m="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=vr,m="onPointerLeave",f="onPointerEnter",p="pointer"),d=null==l?s:uo(l),h=null==c?s:uo(c),(s=new u(m,p+"leave",l,n,a)).target=d,s.relatedTarget=h,m=null,lo(a)===r&&((u=new u(f,p+"enter",c,n,a)).target=h,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(f=c,p=0,h=u=l;h;h=Fa(h))p++;for(h=0,m=f;m;m=Fa(m))h++;for(;0<p-h;)u=Fa(u),p--;for(;0<h-p;)f=Fa(f),h--;for(;p--;){if(u===f||null!==f&&u===f.alternate)break e;u=Fa(u),f=Fa(f)}u=null}else u=null;null!==l&&Oa(i,s,l,u,!1),null!==c&&null!==d&&Oa(i,d,c,u,!0)}if("select"===(l=(s=r?uo(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=jr;else if(Dr(s))if(Ur)g=Yr;else{g=Gr;var y=qr}else(l=s.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(g=Qr);switch(g&&(g=g(e,r))?Ir(i,g,n,a):(y&&y(e,s,r),"focusout"===e&&(y=s._wrapperState)&&y.controlled&&"number"===s.type&&We(s,"number",s.value)),y=r?uo(r):window,e){case"focusin":(Dr(y)||"true"===y.contentEditable)&&(ia=y,sa=r,la=null);break;case"focusout":la=sa=ia=null;break;case"mousedown":ca=!0;break;case"contextmenu":case"mouseup":case"dragend":ca=!1,ua(i,n,a);break;case"selectionchange":if(oa)break;case"keydown":case"keyup":ua(i,n,a)}var v;if(Cr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Tr?Pr(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Mr&&"ko"!==n.locale&&(Tr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Tr&&(v=Hn()):(Vn="value"in(Bn=a)?Bn.value:Bn.textContent,Tr=!0)),0<(y=za(r,b)).length&&(b=new ur(b,e,null,n,a),i.push({event:b,listeners:y}),v?b.data=v:null!==(v=Lr(n))&&(b.data=v))),(v=_r?function(e,t){switch(e){case"compositionend":return Lr(t);case"keypress":return 32!==t.which?null:(Ar=!0,Rr);case"textInput":return(e=t.data)===Rr&&Ar?null:e;default:return null}}(e,n):function(e,t){if(Tr)return"compositionend"===e||!Cr&&Pr(e,t)?(e=Hn(),Wn=Vn=Bn=null,Tr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Mr&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=za(r,"onBeforeInput")).length&&(a=new ur("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Ra(i,t)})}function Ia(e,t,n){return{instance:e,listener:t,currentTarget:n}}function za(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=St(e,n))&&r.unshift(Ia(e,o,a)),null!=(o=St(e,t))&&r.push(Ia(e,o,a))),e=e.return}return r}function Fa(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Oa(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(null!==l&&l===r)break;5===s.tag&&null!==c&&(s=c,a?null!=(l=St(n,o))&&i.unshift(Ia(n,l,s)):a||null!=(l=St(n,o))&&i.push(Ia(n,l,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var $a=/\r\n?/g,ja=/\u0000|\uFFFD/g;function Ua(e){return("string"==typeof e?e:""+e).replace($a,"\n").replace(ja,"")}function Ba(e,t,n){if(t=Ua(t),Ua(e)!==t&&n)throw Error(Q(425))}function Va(){}var Wa=null,Ha=null;function Ka(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var qa="function"==typeof setTimeout?setTimeout:void 0,Ga="function"==typeof clearTimeout?clearTimeout:void 0,Qa="function"==typeof Promise?Promise:void 0,Ya="function"==typeof queueMicrotask?queueMicrotask:void 0!==Qa?function(e){return Qa.resolve(null).then(e).catch(Xa)}:qa;function Xa(e){setTimeout(function(){throw e})}function Ja(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)){if(0===r)return e.removeChild(a),void Nn(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=a}while(n);Nn(t)}function Za(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function eo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var to=Math.random().toString(36).slice(2),no="__reactFiber$"+to,ro="__reactProps$"+to,ao="__reactContainer$"+to,oo="__reactEvents$"+to,io="__reactListeners$"+to,so="__reactHandles$"+to;function lo(e){var t=e[no];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ao]||n[no]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=eo(e);null!==e;){if(n=e[no])return n;e=eo(e)}return t}n=(e=n).parentNode}return null}function co(e){return!(e=e[no]||e[ao])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function uo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Q(33))}function fo(e){return e[ro]||null}var ho=[],po=-1;function mo(e){return{current:e}}function go(e){0>po||(e.current=ho[po],ho[po]=null,po--)}function yo(e,t){po++,ho[po]=e.current,e.current=t}var vo={},bo=mo(vo),wo=mo(!1),ko=vo;function So(e,t){var n=e.type.contextTypes;if(!n)return vo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function xo(e){return null!=(e=e.childContextTypes)}function Co(){go(wo),go(bo)}function Eo(e,t,n){if(bo.current!==vo)throw Error(Q(168));yo(bo,t),yo(wo,n)}function _o(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(Q(108,Ne(e)||"Unknown",a));return Me({},n,r)}function Mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vo,ko=bo.current,yo(bo,e),yo(wo,wo.current),!0}function Ro(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=_o(e,t,ko),r.__reactInternalMemoizedMergedChildContext=e,go(wo),go(bo),yo(bo,e)):go(wo),yo(wo,n)}var Ao=null,Po=!1,Lo=!1;function To(e){null===Ao?Ao=[e]:Ao.push(e)}function No(){if(!Lo&&null!==Ao){Lo=!0;var e=0,t=un;try{var n=Ao;for(un=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Ao=null,Po=!1}catch(t){throw null!==Ao&&(Ao=Ao.slice(e+1)),Ft(Vt,No),t}finally{un=t,Lo=!1}}return null}var Do=[],Io=0,zo=null,Fo=0,Oo=[],$o=0,jo=null,Uo=1,Bo="";function Vo(e,t){Do[Io++]=Fo,Do[Io++]=zo,zo=e,Fo=t}function Wo(e,t,n){Oo[$o++]=Uo,Oo[$o++]=Bo,Oo[$o++]=jo,jo=e;var r=Uo;e=Bo;var a=32-Yt(r)-1;r&=~(1<<a),n+=1;var o=32-Yt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Uo=1<<32-Yt(t)+a|n<<a|r,Bo=o+e}else Uo=1<<o|n<<a|r,Bo=e}function Ho(e){null!==e.return&&(Vo(e,1),Wo(e,1,0))}function Ko(e){for(;e===zo;)zo=Do[--Io],Do[Io]=null,Fo=Do[--Io],Do[Io]=null;for(;e===jo;)jo=Oo[--$o],Oo[$o]=null,Bo=Oo[--$o],Oo[$o]=null,Uo=Oo[--$o],Oo[$o]=null}var qo=null,Go=null,Qo=!1,Yo=null;function Xo(e,t){var n=ku(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Jo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,qo=e,Go=Za(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,qo=e,Go=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==jo?{id:Uo,overflow:Bo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=ku(18,null,null,0)).stateNode=t,n.return=e,e.child=n,qo=e,Go=null,!0);default:return!1}}function Zo(e){return!(!(1&e.mode)||128&e.flags)}function ei(e){if(Qo){var t=Go;if(t){var n=t;if(!Jo(e,t)){if(Zo(e))throw Error(Q(418));t=Za(n.nextSibling);var r=qo;t&&Jo(e,t)?Xo(r,n):(e.flags=-4097&e.flags|2,Qo=!1,qo=e)}}else{if(Zo(e))throw Error(Q(418));e.flags=-4097&e.flags|2,Qo=!1,qo=e}}}function ti(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;qo=e}function ni(e){if(e!==qo)return!1;if(!Qo)return ti(e),Qo=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Ka(e.type,e.memoizedProps)),t&&(t=Go)){if(Zo(e))throw ri(),Error(Q(418));for(;t;)Xo(e,t),t=Za(t.nextSibling)}if(ti(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Go=Za(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Go=null}}else Go=qo?Za(e.stateNode.nextSibling):null;return!0}function ri(){for(var e=Go;e;)e=Za(e.nextSibling)}function ai(){Go=qo=null,Qo=!1}function oi(e){null===Yo?Yo=[e]:Yo.push(e)}var ii=ue.ReactCurrentBatchConfig;function si(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,e));var a=r,o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function li(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ci(e){return(0,e._init)(e._payload)}function ui(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=xu(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Mu(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===he?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===Se&&ci(o)===t.type)?((r=a(t,n.props)).ref=si(e,t,n),r.return=e,r):((r=Cu(n.type,n.key,n.props,null,e.mode,r)).ref=si(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ru(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function u(e,t,n,r,o){return null===t||7!==t.tag?((t=Eu(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Mu(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case de:return(n=Cu(t.type,t.key,t.props,null,e.mode,n)).ref=si(e,null,t),n.return=e,n;case fe:return(t=Ru(t,e.mode,n)).return=e,t;case Se:return d(e,(0,t._init)(t._payload),n)}if(He(t)||Ee(t))return(t=Eu(t,e.mode,n,null)).return=e,t;li(e,t)}return null}function f(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case de:return n.key===a?l(e,t,n,r):null;case fe:return n.key===a?c(e,t,n,r):null;case Se:return f(e,t,(a=n._init)(n._payload),r)}if(He(n)||Ee(n))return null!==a?null:u(e,t,n,r,null);li(e,n)}return null}function h(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case de:return l(t,e=e.get(null===r.key?n:r.key)||null,r,a);case fe:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case Se:return h(e,t,n,(0,r._init)(r._payload),a)}if(He(r)||Ee(r))return u(t,e=e.get(n)||null,r,a,null);li(t,r)}return null}function p(a,i,s,l){for(var c=null,u=null,p=i,m=i=0,g=null;null!==p&&m<s.length;m++){p.index>m?(g=p,p=null):g=p.sibling;var y=f(a,p,s[m],l);if(null===y){null===p&&(p=g);break}e&&p&&null===y.alternate&&t(a,p),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y,p=g}if(m===s.length)return n(a,p),Qo&&Vo(a,m),c;if(null===p){for(;m<s.length;m++)null!==(p=d(a,s[m],l))&&(i=o(p,i,m),null===u?c=p:u.sibling=p,u=p);return Qo&&Vo(a,m),c}for(p=r(a,p);m<s.length;m++)null!==(g=h(p,a,m,s[m],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?m:g.key),i=o(g,i,m),null===u?c=g:u.sibling=g,u=g);return e&&p.forEach(function(e){return t(a,e)}),Qo&&Vo(a,m),c}function m(a,i,s,l){var c=Ee(s);if("function"!=typeof c)throw Error(Q(150));if(null==(s=c.call(s)))throw Error(Q(151));for(var u=c=null,p=i,m=i=0,g=null,y=s.next();null!==p&&!y.done;m++,y=s.next()){p.index>m?(g=p,p=null):g=p.sibling;var v=f(a,p,y.value,l);if(null===v){null===p&&(p=g);break}e&&p&&null===v.alternate&&t(a,p),i=o(v,i,m),null===u?c=v:u.sibling=v,u=v,p=g}if(y.done)return n(a,p),Qo&&Vo(a,m),c;if(null===p){for(;!y.done;m++,y=s.next())null!==(y=d(a,y.value,l))&&(i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return Qo&&Vo(a,m),c}for(p=r(a,p);!y.done;m++,y=s.next())null!==(y=h(p,a,m,y.value,l))&&(e&&null!==y.alternate&&p.delete(null===y.key?m:y.key),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return e&&p.forEach(function(e){return t(a,e)}),Qo&&Vo(a,m),c}return function e(r,o,s,l){if("object"==typeof s&&null!==s&&s.type===he&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case de:e:{for(var c=s.key,u=o;null!==u;){if(u.key===c){if((c=s.type)===he){if(7===u.tag){n(r,u.sibling),(o=a(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===Se&&ci(c)===u.type){n(r,u.sibling),(o=a(u,s.props)).ref=si(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===he?((o=Eu(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=Cu(s.type,s.key,s.props,null,r.mode,l)).ref=si(r,o,s),l.return=r,r=l)}return i(r);case fe:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=a(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Ru(s,r.mode,l)).return=r,r=o}return i(r);case Se:return e(r,o,(u=s._init)(s._payload),l)}if(He(s))return p(r,o,s,l);if(Ee(s))return m(r,o,s,l);li(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=a(o,s)).return=r,r=o):(n(r,o),(o=Mu(s,r.mode,l)).return=r,r=o),i(r)):n(r,o)}}var di=ui(!0),fi=ui(!1),hi=mo(null),pi=null,mi=null,gi=null;function yi(){gi=mi=pi=null}function vi(e){var t=hi.current;go(hi),e._currentValue=t}function bi(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function wi(e,t){pi=e,gi=mi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(cl=!0),e.firstContext=null)}function ki(e){var t=e._currentValue;if(gi!==e)if(e={context:e,memoizedValue:t,next:null},null===mi){if(null===pi)throw Error(Q(308));mi=e,pi.dependencies={lanes:0,firstContext:e}}else mi=mi.next=e;return t}var Si=null;function xi(e){null===Si?Si=[e]:Si.push(e)}function Ci(e,t,n,r){var a=t.interleaved;return null===a?(n.next=n,xi(t)):(n.next=a.next,a.next=n),t.interleaved=n,Ei(e,r)}function Ei(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var _i=!1;function Mi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ri(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ai(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pi(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&vc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Ei(e,n)}return null===(a=r.interleaved)?(t.next=t,xi(r)):(t.next=a.next,a.next=t),r.interleaved=t,Ei(e,n)}function Li(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,cn(e,n)}}function Ti(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ni(e,t,n,r){var a=e.updateQueue;_i=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(null!==s){a.shared.pending=null;var l=s,c=l.next;l.next=null,null===i?o=c:i.next=c,i=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=a.baseState;for(i=0,u=c=l=null,s=o;;){var f=s.lane,h=s.eventTime;if((r&f)===f){null!==u&&(u=u.next={eventTime:h,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var p=e,m=s;switch(f=t,h=n,m.tag){case 1:if("function"==typeof(p=m.payload)){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(f="function"==typeof(p=m.payload)?p.call(h,d,f):p))break e;d=Me({},d,f);break e;case 2:_i=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(f=a.effects)?a.effects=[s]:f.push(s))}else h={eventTime:h,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(c=u=h,l=d):u=u.next=h,i|=f;if(null===(s=s.next)){if(null===(s=a.shared.pending))break;s=(f=s).next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}if(null===u&&(l=d),a.baseState=l,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null!==(t=a.shared.interleaved)){a=t;do{i|=a.lane,a=a.next}while(a!==t)}else null===o&&(a.shared.lanes=0);_c|=i,e.lanes=i,e.memoizedState=d}}function Di(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(Q(191,a));a.call(r)}}}var Ii={},zi=mo(Ii),Fi=mo(Ii),Oi=mo(Ii);function $i(e){if(e===Ii)throw Error(Q(174));return e}function ji(e,t){switch(yo(Oi,t),yo(Fi,e),yo(zi,Ii),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Je(null,"");break;default:t=Je(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}go(zi),yo(zi,t)}function Ui(){go(zi),go(Fi),go(Oi)}function Bi(e){$i(Oi.current);var t=$i(zi.current),n=Je(t,e.type);t!==n&&(yo(Fi,e),yo(zi,n))}function Vi(e){Fi.current===e&&(go(zi),go(Fi))}var Wi=mo(0);function Hi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ki=[];function qi(){for(var e=0;e<Ki.length;e++)Ki[e]._workInProgressVersionPrimary=null;Ki.length=0}var Gi=ue.ReactCurrentDispatcher,Qi=ue.ReactCurrentBatchConfig,Yi=0,Xi=null,Ji=null,Zi=null,es=!1,ts=!1,ns=0,rs=0;function as(){throw Error(Q(321))}function os(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xr(e[n],t[n]))return!1;return!0}function is(e,t,n,r,a,o){if(Yi=o,Xi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Gi.current=null===e||null===e.memoizedState?Vs:Ws,e=n(r,a),ts){o=0;do{if(ts=!1,ns=0,25<=o)throw Error(Q(301));o+=1,Zi=Ji=null,t.updateQueue=null,Gi.current=Hs,e=n(r,a)}while(ts)}if(Gi.current=Bs,t=null!==Ji&&null!==Ji.next,Yi=0,Zi=Ji=Xi=null,es=!1,t)throw Error(Q(300));return e}function ss(){var e=0!==ns;return ns=0,e}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Zi?Xi.memoizedState=Zi=e:Zi=Zi.next=e,Zi}function cs(){if(null===Ji){var e=Xi.alternate;e=null!==e?e.memoizedState:null}else e=Ji.next;var t=null===Zi?Xi.memoizedState:Zi.next;if(null!==t)Zi=t,Ji=e;else{if(null===e)throw Error(Q(310));e={memoizedState:(Ji=e).memoizedState,baseState:Ji.baseState,baseQueue:Ji.baseQueue,queue:Ji.queue,next:null},null===Zi?Xi.memoizedState=Zi=e:Zi=Zi.next=e}return Zi}function us(e,t){return"function"==typeof t?t(e):t}function ds(e){var t=cs(),n=t.queue;if(null===n)throw Error(Q(311));n.lastRenderedReducer=e;var r=Ji,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,n.pending=null}if(null!==a){o=a.next,r=r.baseState;var s=i=null,l=null,c=o;do{var u=c.lane;if((Yi&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(s=l=d,i=r):l=l.next=d,Xi.lanes|=u,_c|=u}c=c.next}while(null!==c&&c!==o);null===l?i=r:l.next=s,Xr(r,t.memoizedState)||(cl=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){a=e;do{o=a.lane,Xi.lanes|=o,_c|=o,a=a.next}while(a!==e)}else null===a&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function fs(e){var t=cs(),n=t.queue;if(null===n)throw Error(Q(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{o=e(o,i.action),i=i.next}while(i!==a);Xr(o,t.memoizedState)||(cl=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function hs(){}function ps(e,t){var n=Xi,r=cs(),a=t(),o=!Xr(r.memoizedState,a);if(o&&(r.memoizedState=a,cl=!0),r=r.queue,_s(ys.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||null!==Zi&&1&Zi.memoizedState.tag){if(n.flags|=2048,ks(9,gs.bind(null,n,r,a,t),void 0,null),null===bc)throw Error(Q(349));30&Yi||ms(n,t,a)}return a}function ms(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Xi.updateQueue)?(t={lastEffect:null,stores:null},Xi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function gs(e,t,n,r){t.value=n,t.getSnapshot=r,vs(t)&&bs(e)}function ys(e,t,n){return n(function(){vs(t)&&bs(e)})}function vs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xr(e,n)}catch(e){return!0}}function bs(e){var t=Ei(e,1);null!==t&&Kc(t,e,1,-1)}function ws(e){var t=ls();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:e},t.queue=e,e=e.dispatch=Os.bind(null,Xi,e),[t.memoizedState,e]}function ks(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Xi.updateQueue)?(t={lastEffect:null,stores:null},Xi.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ss(){return cs().memoizedState}function xs(e,t,n,r){var a=ls();Xi.flags|=e,a.memoizedState=ks(1|t,n,void 0,void 0===r?null:r)}function Cs(e,t,n,r){var a=cs();r=void 0===r?null:r;var o=void 0;if(null!==Ji){var i=Ji.memoizedState;if(o=i.destroy,null!==r&&os(r,i.deps))return void(a.memoizedState=ks(t,n,o,r))}Xi.flags|=e,a.memoizedState=ks(1|t,n,o,r)}function Es(e,t){return xs(8390656,8,e,t)}function _s(e,t){return Cs(2048,8,e,t)}function Ms(e,t){return Cs(4,2,e,t)}function Rs(e,t){return Cs(4,4,e,t)}function As(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ps(e,t,n){return n=null!=n?n.concat([e]):null,Cs(4,4,As.bind(null,t,e),n)}function Ls(){}function Ts(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ns(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ds(e,t,n){return 21&Yi?(Xr(n,t)||(n=on(),Xi.lanes|=n,_c|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,cl=!0),e.memoizedState=n)}function Is(e,t){var n=un;un=0!==n&&4>n?n:4,e(!0);var r=Qi.transition;Qi.transition={};try{e(!1),t()}finally{un=n,Qi.transition=r}}function zs(){return cs().memoizedState}function Fs(e,t,n){var r=Hc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},$s(e))js(t,n);else if(null!==(n=Ci(e,t,n,r))){Kc(n,e,r,Wc()),Us(n,t,r)}}function Os(e,t,n){var r=Hc(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if($s(e))js(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,Xr(s,i)){var l=t.interleaved;return null===l?(a.next=a,xi(t)):(a.next=l.next,l.next=a),void(t.interleaved=a)}}catch(e){}null!==(n=Ci(e,t,a,r))&&(Kc(n,e,r,a=Wc()),Us(n,t,r))}}function $s(e){var t=e.alternate;return e===Xi||null!==t&&t===Xi}function js(e,t){ts=es=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Us(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,cn(e,n)}}var Bs={readContext:ki,useCallback:as,useContext:as,useEffect:as,useImperativeHandle:as,useInsertionEffect:as,useLayoutEffect:as,useMemo:as,useReducer:as,useRef:as,useState:as,useDebugValue:as,useDeferredValue:as,useTransition:as,useMutableSource:as,useSyncExternalStore:as,useId:as,unstable_isNewReconciler:!1},Vs={readContext:ki,useCallback:function(e,t){return ls().memoizedState=[e,void 0===t?null:t],e},useContext:ki,useEffect:Es,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,xs(4194308,4,As.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xs(4194308,4,e,t)},useInsertionEffect:function(e,t){return xs(4,2,e,t)},useMemo:function(e,t){var n=ls();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ls();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Fs.bind(null,Xi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ls().memoizedState=e},useState:ws,useDebugValue:Ls,useDeferredValue:function(e){return ls().memoizedState=e},useTransition:function(){var e=ws(!1),t=e[0];return e=Is.bind(null,e[1]),ls().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Xi,a=ls();if(Qo){if(void 0===n)throw Error(Q(407));n=n()}else{if(n=t(),null===bc)throw Error(Q(349));30&Yi||ms(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Es(ys.bind(null,r,o,e),[e]),r.flags|=2048,ks(9,gs.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ls(),t=bc.identifierPrefix;if(Qo){var n=Bo;t=":"+t+"R"+(n=(Uo&~(1<<32-Yt(Uo)-1)).toString(32)+n),0<(n=ns++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=rs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ws={readContext:ki,useCallback:Ts,useContext:ki,useEffect:_s,useImperativeHandle:Ps,useInsertionEffect:Ms,useLayoutEffect:Rs,useMemo:Ns,useReducer:ds,useRef:Ss,useState:function(){return ds(us)},useDebugValue:Ls,useDeferredValue:function(e){return Ds(cs(),Ji.memoizedState,e)},useTransition:function(){return[ds(us)[0],cs().memoizedState]},useMutableSource:hs,useSyncExternalStore:ps,useId:zs,unstable_isNewReconciler:!1},Hs={readContext:ki,useCallback:Ts,useContext:ki,useEffect:_s,useImperativeHandle:Ps,useInsertionEffect:Ms,useLayoutEffect:Rs,useMemo:Ns,useReducer:fs,useRef:Ss,useState:function(){return fs(us)},useDebugValue:Ls,useDeferredValue:function(e){var t=cs();return null===Ji?t.memoizedState=e:Ds(t,Ji.memoizedState,e)},useTransition:function(){return[fs(us)[0],cs().memoizedState]},useMutableSource:hs,useSyncExternalStore:ps,useId:zs,unstable_isNewReconciler:!1};function Ks(e,t){if(e&&e.defaultProps){for(var n in t=Me({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function qs(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:Me({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Gs={isMounted:function(e){return!!(e=e._reactInternals)&&Tt(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wc(),a=Hc(e),o=Ai(r,a);o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Kc(t,e,a,r),Li(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wc(),a=Hc(e),o=Ai(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Kc(t,e,a,r),Li(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wc(),r=Hc(e),a=Ai(n,r);a.tag=2,null!=t&&(a.callback=t),null!==(t=Pi(e,a,r))&&(Kc(t,e,r,n),Li(t,e,r))}};function Qs(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!Jr(n,r)||!Jr(a,o))}function Ys(e,t,n){var r=!1,a=vo,o=t.contextType;return"object"==typeof o&&null!==o?o=ki(o):(a=xo(t)?ko:bo.current,o=(r=null!=(r=t.contextTypes))?So(e,a):vo),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Gs,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Xs(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Gs.enqueueReplaceState(t,t.state,null)}function Js(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Mi(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=ki(o):(o=xo(t)?ko:bo.current,a.context=So(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(qs(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&Gs.enqueueReplaceState(a,a.state,null),Ni(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}function Zs(e,t){try{var n="",r=t;do{n+=Le(r),r=r.return}while(r);var a=n}catch(e){a="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:a,digest:null}}function el(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function tl(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var nl="function"==typeof WeakMap?WeakMap:Map;function rl(e,t,n){(n=Ai(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Dc||(Dc=!0,Ic=r),tl(0,t)},n}function al(e,t,n){(n=Ai(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){tl(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){tl(0,t),"function"!=typeof r&&(null===zc?zc=new Set([this]):zc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function ol(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new nl;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=mu.bind(null,e,t,n),t.then(e,e))}function il(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function sl(e,t,n,r,a){return 1&e.mode?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Ai(-1,1)).tag=2,Pi(n,t,1))),n.lanes|=1),e)}var ll=ue.ReactCurrentOwner,cl=!1;function ul(e,t,n,r){t.child=null===e?fi(t,null,n,r):di(t,e.child,n,r)}function dl(e,t,n,r,a){n=n.render;var o=t.ref;return wi(t,a),r=is(e,t,n,r,o,a),n=ss(),null===e||cl?(Qo&&n&&Ho(t),t.flags|=1,ul(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function fl(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||Su(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Cu(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,hl(e,t,o,r,a))}if(o=e.child,0===(e.lanes&a)){var i=o.memoizedProps;if((n=null!==(n=n.compare)?n:Jr)(i,r)&&e.ref===t.ref)return Dl(e,t,a)}return t.flags|=1,(e=xu(o,r)).ref=t.ref,e.return=t,t.child=e}function hl(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(Jr(o,r)&&e.ref===t.ref){if(cl=!1,t.pendingProps=r=o,0===(e.lanes&a))return t.lanes=e.lanes,Dl(e,t,a);131072&e.flags&&(cl=!0)}}return gl(e,t,n,r,a)}function pl(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,yo(xc,Sc),Sc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,yo(xc,Sc),Sc|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},yo(xc,Sc),Sc|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,yo(xc,Sc),Sc|=r;return ul(e,t,a,n),t.child}function ml(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gl(e,t,n,r,a){var o=xo(n)?ko:bo.current;return o=So(t,o),wi(t,a),n=is(e,t,n,r,o,a),r=ss(),null===e||cl?(Qo&&r&&Ho(t),t.flags|=1,ul(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function yl(e,t,n,r,a){if(xo(n)){var o=!0;Mo(t)}else o=!1;if(wi(t,a),null===t.stateNode)Nl(e,t),Ys(t,n,r),Js(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,s=t.memoizedProps;i.props=s;var l=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=ki(c):c=So(t,c=xo(n)?ko:bo.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==r||l!==c)&&Xs(t,i,r,c),_i=!1;var f=t.memoizedState;i.state=f,Ni(t,r,i,a),l=t.memoizedState,s!==r||f!==l||wo.current||_i?("function"==typeof u&&(qs(t,n,u,r),l=t.memoizedState),(s=_i||Qs(t,n,s,r,f,l,c))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=c,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Ri(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:Ks(t.type,s),i.props=c,d=t.pendingProps,f=i.context,"object"==typeof(l=n.contextType)&&null!==l?l=ki(l):l=So(t,l=xo(n)?ko:bo.current);var h=n.getDerivedStateFromProps;(u="function"==typeof h||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==d||f!==l)&&Xs(t,i,r,l),_i=!1,f=t.memoizedState,i.state=f,Ni(t,r,i,a);var p=t.memoizedState;s!==d||f!==p||wo.current||_i?("function"==typeof h&&(qs(t,n,h,r),p=t.memoizedState),(c=_i||Qs(t,n,c,r,f,p,l)||!1)?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,l),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=l,r=c):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return vl(e,t,n,r,o,a)}function vl(e,t,n,r,a,o){ml(e,t);var i=!!(128&t.flags);if(!r&&!i)return a&&Ro(t,n,!1),Dl(e,t,o);r=t.stateNode,ll.current=t;var s=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=di(t,e.child,null,o),t.child=di(t,null,s,o)):ul(e,t,s,o),t.memoizedState=r.state,a&&Ro(t,n,!0),t.child}function bl(e){var t=e.stateNode;t.pendingContext?Eo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Eo(0,t.context,!1),ji(e,t.containerInfo)}function wl(e,t,n,r,a){return ai(),oi(a),t.flags|=256,ul(e,t,n,r),t.child}var kl,Sl,xl,Cl,El={dehydrated:null,treeContext:null,retryLane:0};function _l(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ml(e,t,n){var r,a=t.pendingProps,o=Wi.current,i=!1,s=!!(128&t.flags);if((r=s)||(r=(null===e||null!==e.memoizedState)&&!!(2&o)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),yo(Wi,1&o),null===e)return ei(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=a.children,e=a.fallback,i?(a=t.mode,i=t.child,s={mode:"hidden",children:s},1&a||null===i?i=_u(s,a,0,null):(i.childLanes=0,i.pendingProps=s),e=Eu(e,a,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=_l(n),t.memoizedState=El,e):Rl(t,s));if(null!==(o=e.memoizedState)&&null!==(r=o.dehydrated))return function(e,t,n,r,a,o,i){if(n)return 256&t.flags?(t.flags&=-257,Al(e,t,i,r=el(Error(Q(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=_u({mode:"visible",children:r.children},a,0,null),(o=Eu(o,a,i,null)).flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,1&t.mode&&di(t,e.child,null,i),t.child.memoizedState=_l(i),t.memoizedState=El,o);if(!(1&t.mode))return Al(e,t,i,null);if("$!"===a.data){if(r=a.nextSibling&&a.nextSibling.dataset)var s=r.dgst;return r=s,Al(e,t,i,r=el(o=Error(Q(419)),r,void 0))}if(s=0!==(i&e.childLanes),cl||s){if(null!==(r=bc)){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=0!==(a&(r.suspendedLanes|i))?0:a)&&a!==o.retryLane&&(o.retryLane=a,Ei(e,a),Kc(r,e,a,-1))}return ou(),Al(e,t,i,r=el(Error(Q(421))))}return"$?"===a.data?(t.flags|=128,t.child=e.child,t=yu.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Go=Za(a.nextSibling),qo=t,Qo=!0,Yo=null,null!==e&&(Oo[$o++]=Uo,Oo[$o++]=Bo,Oo[$o++]=jo,Uo=e.id,Bo=e.overflow,jo=t),t=Rl(t,r.children),t.flags|=4096,t)}(e,t,s,a,r,o,n);if(i){i=a.fallback,s=t.mode,r=(o=e.child).sibling;var l={mode:"hidden",children:a.children};return 1&s||t.child===o?(a=xu(o,l)).subtreeFlags=14680064&o.subtreeFlags:((a=t.child).childLanes=0,a.pendingProps=l,t.deletions=null),null!==r?i=xu(r,i):(i=Eu(i,s,n,null)).flags|=2,i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,s=null===(s=e.child.memoizedState)?_l(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=El,a}return e=(i=e.child).sibling,a=xu(i,{mode:"visible",children:a.children}),!(1&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=a,t.memoizedState=null,a}function Rl(e,t){return(t=_u({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Al(e,t,n,r){return null!==r&&oi(r),di(t,e.child,null,n),(e=Rl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Pl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),bi(e.return,t,n)}function Ll(e,t,n,r,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function Tl(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(ul(e,t,r.children,n),2&(r=Wi.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Pl(e,n,t);else if(19===e.tag)Pl(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(yo(Wi,r),1&t.mode)switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===Hi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Ll(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===Hi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Ll(t,!0,n,null,o);break;case"together":Ll(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Nl(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Dl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),_c|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Q(153));if(null!==t.child){for(n=xu(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=xu(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Il(e,t){if(!Qo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zl(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=14680064&a.subtreeFlags,r|=14680064&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fl(e,t,n){var r=t.pendingProps;switch(Ko(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zl(t),null;case 1:case 17:return xo(t.type)&&Co(),zl(t),null;case 3:return r=t.stateNode,Ui(),go(wo),go(bo),qi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ni(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Yo&&(Yc(Yo),Yo=null))),Sl(e,t),zl(t),null;case 5:Vi(t);var a=$i(Oi.current);if(n=t.type,null!==e&&null!=t.stateNode)xl(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(Q(166));return zl(t),null}if(e=$i(zi.current),ni(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[no]=t,r[ro]=o,e=!!(1&t.mode),n){case"dialog":Aa("cancel",r),Aa("close",r);break;case"iframe":case"object":case"embed":Aa("load",r);break;case"video":case"audio":for(a=0;a<Ea.length;a++)Aa(Ea[a],r);break;case"source":Aa("error",r);break;case"img":case"image":case"link":Aa("error",r),Aa("load",r);break;case"details":Aa("toggle",r);break;case"input":je(r,o),Aa("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Aa("invalid",r);break;case"textarea":Ge(r,o),Aa("invalid",r)}for(var i in lt(n,o),a=null,o)if(o.hasOwnProperty(i)){var s=o[i];"children"===i?"string"==typeof s?r.textContent!==s&&(!0!==o.suppressHydrationWarning&&Ba(r.textContent,s,e),a=["children",s]):"number"==typeof s&&r.textContent!==""+s&&(!0!==o.suppressHydrationWarning&&Ba(r.textContent,s,e),a=["children",""+s]):X.hasOwnProperty(i)&&null!=s&&"onScroll"===i&&Aa("scroll",r)}switch(n){case"input":ze(r),Ve(r,o,!0);break;case"textarea":ze(r),Ye(r);break;case"select":case"option":break;default:"function"==typeof o.onClick&&(r.onclick=Va)}r=a,t.updateQueue=r,null!==r&&(t.flags|=4)}else{i=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Xe(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=i.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),"select"===n&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[no]=t,e[ro]=r,kl(e,t,!1,!1),t.stateNode=e;e:{switch(i=ct(n,r),n){case"dialog":Aa("cancel",e),Aa("close",e),a=r;break;case"iframe":case"object":case"embed":Aa("load",e),a=r;break;case"video":case"audio":for(a=0;a<Ea.length;a++)Aa(Ea[a],e);a=r;break;case"source":Aa("error",e),a=r;break;case"img":case"image":case"link":Aa("error",e),Aa("load",e),a=r;break;case"details":Aa("toggle",e),a=r;break;case"input":je(e,r),a=$e(e,r),Aa("invalid",e);break;case"option":default:a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Me({},r,{value:void 0}),Aa("invalid",e);break;case"textarea":Ge(e,r),a=qe(e,r),Aa("invalid",e)}for(o in lt(n,a),s=a)if(s.hasOwnProperty(o)){var l=s[o];"style"===o?it(e,l):"dangerouslySetInnerHTML"===o?null!=(l=l?l.__html:void 0)&&tt(e,l):"children"===o?"string"==typeof l?("textarea"!==n||""!==l)&&nt(e,l):"number"==typeof l&&nt(e,""+l):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(X.hasOwnProperty(o)?null!=l&&"onScroll"===o&&Aa("scroll",e):null!=l&&ce(e,o,l,i))}switch(n){case"input":ze(e),Ve(e,r,!1);break;case"textarea":ze(e),Ye(e);break;case"option":null!=r.value&&e.setAttribute("value",""+De(r.value));break;case"select":e.multiple=!!r.multiple,null!=(o=r.value)?Ke(e,!!r.multiple,o,!1):null!=r.defaultValue&&Ke(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Va)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return zl(t),null;case 6:if(e&&null!=t.stateNode)Cl(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(Q(166));if(n=$i(Oi.current),$i(zi.current),ni(t)){if(r=t.stateNode,n=t.memoizedProps,r[no]=t,(o=r.nodeValue!==n)&&null!==(e=qo))switch(e.tag){case 3:Ba(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ba(r.nodeValue,n,!!(1&e.mode))}o&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[no]=t,t.stateNode=r}return zl(t),null;case 13:if(go(Wi),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Qo&&null!==Go&&1&t.mode&&!(128&t.flags))ri(),ai(),t.flags|=98560,o=!1;else if(o=ni(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(Q(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(Q(317));o[no]=t}else ai(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;zl(t),o=!1}else null!==Yo&&(Yc(Yo),Yo=null),o=!0;if(!o)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Wi.current?0===Cc&&(Cc=3):ou())),null!==t.updateQueue&&(t.flags|=4),zl(t),null);case 4:return Ui(),Sl(e,t),null===e&&Ta(t.stateNode.containerInfo),zl(t),null;case 10:return vi(t.type._context),zl(t),null;case 19:if(go(Wi),null===(o=t.memoizedState))return zl(t),null;if(r=!!(128&t.flags),null===(i=o.rendering))if(r)Il(o,!1);else{if(0!==Cc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Hi(e))){for(t.flags|=128,Il(o,!1),null!==(r=i.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(o=n).flags&=14680066,null===(i=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return yo(Wi,1&Wi.current|2),t.child}e=e.sibling}null!==o.tail&&Ut()>Tc&&(t.flags|=128,r=!0,Il(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=Hi(i))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Il(o,!0),null===o.tail&&"hidden"===o.tailMode&&!i.alternate&&!Qo)return zl(t),null}else 2*Ut()-o.renderingStartTime>Tc&&1073741824!==n&&(t.flags|=128,r=!0,Il(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(null!==(n=o.last)?n.sibling=i:t.child=i,o.last=i)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ut(),t.sibling=null,n=Wi.current,yo(Wi,r?1&n|2:1&n),t):(zl(t),null);case 22:case 23:return tu(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&Sc)&&(zl(t),6&t.subtreeFlags&&(t.flags|=8192)):zl(t),null;case 24:case 25:return null}throw Error(Q(156,t.tag))}function Ol(e,t){switch(Ko(t),t.tag){case 1:return xo(t.type)&&Co(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ui(),go(wo),go(bo),qi(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Vi(t),null;case 13:if(go(Wi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Q(340));ai()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return go(Wi),null;case 4:return Ui(),null;case 10:return vi(t.type._context),null;case 22:case 23:return tu(),null;default:return null}}kl=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Sl=function(){},xl=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,$i(zi.current);var o,i=null;switch(n){case"input":a=$e(e,a),r=$e(e,r),i=[];break;case"select":a=Me({},a,{value:void 0}),r=Me({},r,{value:void 0}),i=[];break;case"textarea":a=qe(e,a),r=qe(e,r),i=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Va)}for(c in lt(n,r),n=null,a)if(!r.hasOwnProperty(c)&&a.hasOwnProperty(c)&&null!=a[c])if("style"===c){var s=a[c];for(o in s)s.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(X.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(s=null!=a?a[c]:void 0,r.hasOwnProperty(c)&&l!==s&&(null!=l||null!=s))if("style"===c)if(s){for(o in s)!s.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&s[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,s=s?s.__html:void 0,null!=l&&s!==l&&(i=i||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(X.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Aa("scroll",e),i||s===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}},Cl=function(e,t,n,r){n!==r&&(t.flags|=4)};var $l=!1,jl=!1,Ul="function"==typeof WeakSet?WeakSet:Set,Bl=null;function Vl(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){pu(e,t,n)}else n.current=null}function Wl(e,t,n){try{n()}catch(n){pu(e,t,n)}}var Hl=!1;function Kl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,void 0!==o&&Wl(t,n,o)}a=a.next}while(a!==r)}}function ql(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gl(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function Ql(e){var t=e.alternate;null!==t&&(e.alternate=null,Ql(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[no],delete t[ro],delete t[oo],delete t[io],delete t[so])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yl(e){return 5===e.tag||3===e.tag||4===e.tag}function Xl(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Yl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Jl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Va));else if(4!==r&&null!==(e=e.child))for(Jl(e,t,n),e=e.sibling;null!==e;)Jl(e,t,n),e=e.sibling}function Zl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(Zl(e,t,n),e=e.sibling;null!==e;)Zl(e,t,n),e=e.sibling}var ec=null,tc=!1;function nc(e,t,n){for(n=n.child;null!==n;)rc(e,t,n),n=n.sibling}function rc(e,t,n){if(Qt&&"function"==typeof Qt.onCommitFiberUnmount)try{Qt.onCommitFiberUnmount(Gt,n)}catch(e){}switch(n.tag){case 5:jl||Vl(n,t);case 6:var r=ec,a=tc;ec=null,nc(e,t,n),tc=a,null!==(ec=r)&&(tc?(e=ec,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):ec.removeChild(n.stateNode));break;case 18:null!==ec&&(tc?(e=ec,n=n.stateNode,8===e.nodeType?Ja(e.parentNode,n):1===e.nodeType&&Ja(e,n),Nn(e)):Ja(ec,n.stateNode));break;case 4:r=ec,a=tc,ec=n.stateNode.containerInfo,tc=!0,nc(e,t,n),ec=r,tc=a;break;case 0:case 11:case 14:case 15:if(!jl&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,void 0!==i&&(2&o||4&o)&&Wl(n,t,i),a=a.next}while(a!==r)}nc(e,t,n);break;case 1:if(!jl&&(Vl(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){pu(n,t,e)}nc(e,t,n);break;case 21:nc(e,t,n);break;case 22:1&n.mode?(jl=(r=jl)||null!==n.memoizedState,nc(e,t,n),jl=r):nc(e,t,n);break;default:nc(e,t,n)}}function ac(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ul),t.forEach(function(t){var r=vu.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function oc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];try{var o=e,i=t,s=i;e:for(;null!==s;){switch(s.tag){case 5:ec=s.stateNode,tc=!1;break e;case 3:case 4:ec=s.stateNode.containerInfo,tc=!0;break e}s=s.return}if(null===ec)throw Error(Q(160));rc(o,i,a),ec=null,tc=!1;var l=a.alternate;null!==l&&(l.return=null),a.return=null}catch(e){pu(a,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)ic(t,e),t=t.sibling}function ic(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(oc(t,e),sc(e),4&r){try{Kl(3,e,e.return),ql(3,e)}catch(t){pu(e,e.return,t)}try{Kl(5,e,e.return)}catch(t){pu(e,e.return,t)}}break;case 1:oc(t,e),sc(e),512&r&&null!==n&&Vl(n,n.return);break;case 5:if(oc(t,e),sc(e),512&r&&null!==n&&Vl(n,n.return),32&e.flags){var a=e.stateNode;try{nt(a,"")}catch(t){pu(e,e.return,t)}}if(4&r&&null!=(a=e.stateNode)){var o=e.memoizedProps,i=null!==n?n.memoizedProps:o,s=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===s&&"radio"===o.type&&null!=o.name&&Ue(a,o),ct(s,i);var c=ct(s,o);for(i=0;i<l.length;i+=2){var u=l[i],d=l[i+1];"style"===u?it(a,d):"dangerouslySetInnerHTML"===u?tt(a,d):"children"===u?nt(a,d):ce(a,u,d,c)}switch(s){case"input":Be(a,o);break;case"textarea":Qe(a,o);break;case"select":var f=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var h=o.value;null!=h?Ke(a,!!o.multiple,h,!1):f!==!!o.multiple&&(null!=o.defaultValue?Ke(a,!!o.multiple,o.defaultValue,!0):Ke(a,!!o.multiple,o.multiple?[]:"",!1))}a[ro]=o}catch(t){pu(e,e.return,t)}}break;case 6:if(oc(t,e),sc(e),4&r){if(null===e.stateNode)throw Error(Q(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){pu(e,e.return,t)}}break;case 3:if(oc(t,e),sc(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Nn(t.containerInfo)}catch(t){pu(e,e.return,t)}break;case 4:default:oc(t,e),sc(e);break;case 13:oc(t,e),sc(e),8192&(a=e.child).flags&&(o=null!==a.memoizedState,a.stateNode.isHidden=o,!o||null!==a.alternate&&null!==a.alternate.memoizedState||(Lc=Ut())),4&r&&ac(e);break;case 22:if(u=null!==n&&null!==n.memoizedState,1&e.mode?(jl=(c=jl)||u,oc(t,e),jl=c):oc(t,e),sc(e),8192&r){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!u&&1&e.mode)for(Bl=e,u=e.child;null!==u;){for(d=Bl=u;null!==Bl;){switch(h=(f=Bl).child,f.tag){case 0:case 11:case 14:case 15:Kl(4,f,f.return);break;case 1:Vl(f,f.return);var p=f.stateNode;if("function"==typeof p.componentWillUnmount){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(e){pu(r,n,e)}}break;case 5:Vl(f,f.return);break;case 22:if(null!==f.memoizedState){dc(d);continue}}null!==h?(h.return=f,Bl=h):dc(d)}u=u.sibling}e:for(u=null,d=e;;){if(5===d.tag){if(null===u){u=d;try{a=d.stateNode,c?"function"==typeof(o=a.style).setProperty?o.setProperty("display","none","important"):o.display="none":(s=d.stateNode,i=null!=(l=d.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,s.style.display=ot("display",i))}catch(t){pu(e,e.return,t)}}}else if(6===d.tag){if(null===u)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(t){pu(e,e.return,t)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:oc(t,e),sc(e),4&r&&ac(e);case 21:}}function sc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(Yl(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var a=r.stateNode;32&r.flags&&(nt(a,""),r.flags&=-33),Zl(e,Xl(e),a);break;case 3:case 4:var o=r.stateNode.containerInfo;Jl(e,Xl(e),o);break;default:throw Error(Q(161))}}catch(t){pu(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function lc(e,t,n){Bl=e,cc(e)}function cc(e,t,n){for(var r=!!(1&e.mode);null!==Bl;){var a=Bl,o=a.child;if(22===a.tag&&r){var i=null!==a.memoizedState||$l;if(!i){var s=a.alternate,l=null!==s&&null!==s.memoizedState||jl;s=$l;var c=jl;if($l=i,(jl=l)&&!c)for(Bl=a;null!==Bl;)l=(i=Bl).child,22===i.tag&&null!==i.memoizedState?fc(a):null!==l?(l.return=i,Bl=l):fc(a);for(;null!==o;)Bl=o,cc(o),o=o.sibling;Bl=a,$l=s,jl=c}uc(e)}else 8772&a.subtreeFlags&&null!==o?(o.return=a,Bl=o):uc(e)}}function uc(e){for(;null!==Bl;){var t=Bl;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:jl||ql(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!jl)if(null===n)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Ks(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&Di(t,o,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Di(t,i,n)}break;case 5:var s=t.stateNode;if(null===n&&4&t.flags){n=s;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var u=c.memoizedState;if(null!==u){var d=u.dehydrated;null!==d&&Nn(d)}}}break;default:throw Error(Q(163))}jl||512&t.flags&&Gl(t)}catch(e){pu(t,t.return,e)}}if(t===e){Bl=null;break}if(null!==(n=t.sibling)){n.return=t.return,Bl=n;break}Bl=t.return}}function dc(e){for(;null!==Bl;){var t=Bl;if(t===e){Bl=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Bl=n;break}Bl=t.return}}function fc(e){for(;null!==Bl;){var t=Bl;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ql(4,t)}catch(e){pu(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var a=t.return;try{r.componentDidMount()}catch(e){pu(t,a,e)}}var o=t.return;try{Gl(t)}catch(e){pu(t,o,e)}break;case 5:var i=t.return;try{Gl(t)}catch(e){pu(t,i,e)}}}catch(e){pu(t,t.return,e)}if(t===e){Bl=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Bl=s;break}Bl=t.return}}var hc,pc=Math.ceil,mc=ue.ReactCurrentDispatcher,gc=ue.ReactCurrentOwner,yc=ue.ReactCurrentBatchConfig,vc=0,bc=null,wc=null,kc=0,Sc=0,xc=mo(0),Cc=0,Ec=null,_c=0,Mc=0,Rc=0,Ac=null,Pc=null,Lc=0,Tc=1/0,Nc=null,Dc=!1,Ic=null,zc=null,Fc=!1,Oc=null,$c=0,jc=0,Uc=null,Bc=-1,Vc=0;function Wc(){return 6&vc?Ut():-1!==Bc?Bc:Bc=Ut()}function Hc(e){return 1&e.mode?2&vc&&0!==kc?kc&-kc:null!==ii.transition?(0===Vc&&(Vc=on()),Vc):0!==(e=un)?e:e=void 0===(e=window.event)?16:Un(e.type):1}function Kc(e,t,n,r){if(50<jc)throw jc=0,Uc=null,Error(Q(185));ln(e,n,r),2&vc&&e===bc||(e===bc&&(!(2&vc)&&(Mc|=n),4===Cc&&Xc(e,kc)),qc(e,r),1===n&&0===vc&&!(1&t.mode)&&(Tc=Ut()+500,Po&&No()))}function qc(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Yt(o),s=1<<i,l=a[i];-1===l?0!==(s&n)&&0===(s&r)||(a[i]=rn(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}}(e,t);var r=nn(e,e===bc?kc:0);if(0===r)null!==n&&Ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ot(n),1===t)0===e.tag?function(e){Po=!0,To(e)}(Jc.bind(null,e)):To(Jc.bind(null,e)),Ya(function(){!(6&vc)&&No()}),n=null;else{switch(dn(r)){case 1:n=Vt;break;case 4:n=Wt;break;case 16:default:n=Ht;break;case 536870912:n=qt}n=bu(n,Gc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Gc(e,t){if(Bc=-1,Vc=0,6&vc)throw Error(Q(327));var n=e.callbackNode;if(fu()&&e.callbackNode!==n)return null;var r=nn(e,e===bc?kc:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=iu(e,r);else{t=r;var a=vc;vc|=2;var o=au();for(bc===e&&kc===t||(Nc=null,Tc=Ut()+500,nu(e,t));;)try{lu();break}catch(t){ru(e,t)}yi(),mc.current=o,vc=a,null!==wc?t=0:(bc=null,kc=0,t=Cc)}if(0!==t){if(2===t&&(0!==(a=an(e))&&(r=a,t=Qc(e,a))),1===t)throw n=Ec,nu(e,0),Xc(e,r),qc(e,Ut()),n;if(6===t)Xc(e,r);else{if(a=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Xr(o(),a))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(a)||(t=iu(e,r),2===t&&(o=an(e),0!==o&&(r=o,t=Qc(e,o))),1!==t)))throw n=Ec,nu(e,0),Xc(e,r),qc(e,Ut()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:case 5:du(e,Pc,Nc);break;case 3:if(Xc(e,r),(130023424&r)===r&&10<(t=Lc+500-Ut())){if(0!==nn(e,0))break;if(((a=e.suspendedLanes)&r)!==r){Wc(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=qa(du.bind(null,e,Pc,Nc),t);break}du(e,Pc,Nc);break;case 4:if(Xc(e,r),(4194240&r)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-Yt(r);o=1<<i,(i=t[i])>a&&(a=i),r&=~o}if(r=a,10<(r=(120>(r=Ut()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pc(r/1960))-r)){e.timeoutHandle=qa(du.bind(null,e,Pc,Nc),r);break}du(e,Pc,Nc);break;default:throw Error(Q(329))}}}return qc(e,Ut()),e.callbackNode===n?Gc.bind(null,e):null}function Qc(e,t){var n=Ac;return e.current.memoizedState.isDehydrated&&(nu(e,t).flags|=256),2!==(e=iu(e,t))&&(t=Pc,Pc=n,null!==t&&Yc(t)),e}function Yc(e){null===Pc?Pc=e:Pc.push.apply(Pc,e)}function Xc(e,t){for(t&=~Rc,t&=~Mc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Yt(t),r=1<<n;e[n]=-1,t&=~r}}function Jc(e){if(6&vc)throw Error(Q(327));fu();var t=nn(e,0);if(!(1&t))return qc(e,Ut()),null;var n=iu(e,t);if(0!==e.tag&&2===n){var r=an(e);0!==r&&(t=r,n=Qc(e,r))}if(1===n)throw n=Ec,nu(e,0),Xc(e,t),qc(e,Ut()),n;if(6===n)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,du(e,Pc,Nc),qc(e,Ut()),null}function Zc(e,t){var n=vc;vc|=1;try{return e(t)}finally{0===(vc=n)&&(Tc=Ut()+500,Po&&No())}}function eu(e){null!==Oc&&0===Oc.tag&&!(6&vc)&&fu();var t=vc;vc|=1;var n=yc.transition,r=un;try{if(yc.transition=null,un=1,e)return e()}finally{un=r,yc.transition=n,!(6&(vc=t))&&No()}}function tu(){Sc=xc.current,go(xc)}function nu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Ga(n)),null!==wc)for(n=wc.return;null!==n;){var r=n;switch(Ko(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Co();break;case 3:Ui(),go(wo),go(bo),qi();break;case 5:Vi(r);break;case 4:Ui();break;case 13:case 19:go(Wi);break;case 10:vi(r.type._context);break;case 22:case 23:tu()}n=n.return}if(bc=e,wc=e=xu(e.current,null),kc=Sc=t,Cc=0,Ec=null,Rc=Mc=_c=0,Pc=Ac=null,null!==Si){for(t=0;t<Si.length;t++)if(null!==(r=(n=Si[t]).interleaved)){n.interleaved=null;var a=r.next,o=n.pending;if(null!==o){var i=o.next;o.next=a,r.next=i}n.pending=r}Si=null}return e}function ru(e,t){for(;;){var n=wc;try{if(yi(),Gi.current=Bs,es){for(var r=Xi.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}es=!1}if(Yi=0,Zi=Ji=Xi=null,ts=!1,ns=0,gc.current=null,null===n||null===n.return){Cc=1,Ec=t,wc=null;break}e:{var o=e,i=n.return,s=n,l=t;if(t=kc,s.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,u=s,d=u.tag;if(!(1&u.mode||0!==d&&11!==d&&15!==d)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=il(i);if(null!==h){h.flags&=-257,sl(h,i,s,0,t),1&h.mode&&ol(o,c,t),l=c;var p=(t=h).updateQueue;if(null===p){var m=new Set;m.add(l),t.updateQueue=m}else p.add(l);break e}if(!(1&t)){ol(o,c,t),ou();break e}l=Error(Q(426))}else if(Qo&&1&s.mode){var g=il(i);if(null!==g){!(65536&g.flags)&&(g.flags|=256),sl(g,i,s,0,t),oi(Zs(l,s));break e}}o=l=Zs(l,s),4!==Cc&&(Cc=2),null===Ac?Ac=[o]:Ac.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t,Ti(o,rl(0,l,t));break e;case 1:s=l;var y=o.type,v=o.stateNode;if(!(128&o.flags||"function"!=typeof y.getDerivedStateFromError&&(null===v||"function"!=typeof v.componentDidCatch||null!==zc&&zc.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t,Ti(o,al(o,s,t));break e}}o=o.return}while(null!==o)}uu(n)}catch(e){t=e,wc===n&&null!==n&&(wc=n=n.return);continue}break}}function au(){var e=mc.current;return mc.current=Bs,null===e?Bs:e}function ou(){0!==Cc&&3!==Cc&&2!==Cc||(Cc=4),null===bc||!(268435455&_c)&&!(268435455&Mc)||Xc(bc,kc)}function iu(e,t){var n=vc;vc|=2;var r=au();for(bc===e&&kc===t||(Nc=null,nu(e,t));;)try{su();break}catch(t){ru(e,t)}if(yi(),vc=n,mc.current=r,null!==wc)throw Error(Q(261));return bc=null,kc=0,Cc}function su(){for(;null!==wc;)cu(wc)}function lu(){for(;null!==wc&&!$t();)cu(wc)}function cu(e){var t=hc(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?uu(e):wc=t,gc.current=null}function uu(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Ol(n,t)))return n.flags&=32767,void(wc=n);if(null===e)return Cc=6,void(wc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Fl(n,t,Sc)))return void(wc=n);if(null!==(t=t.sibling))return void(wc=t);wc=t=e}while(null!==t);0===Cc&&(Cc=5)}function du(e,t,n){var r=un,a=yc.transition;try{yc.transition=null,un=1,function(e,t,n,r){do{fu()}while(null!==Oc);if(6&vc)throw Error(Q(327));n=e.finishedWork;var a=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-Yt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}(e,o),e===bc&&(wc=bc=null,kc=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Fc||(Fc=!0,bu(Ht,function(){return fu(),null})),o=!!(15990&n.flags),!!(15990&n.subtreeFlags)||o){o=yc.transition,yc.transition=null;var i=un;un=1;var s=vc;vc|=4,gc.current=null,function(e,t){if(Wa=In,ra(e=na())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var i=0,s=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||0!==a&&3!==d.nodeType||(s=i+a),d!==o||0!==r&&3!==d.nodeType||(l=i+r),3===d.nodeType&&(i+=d.nodeValue.length),null!==(h=d.firstChild);)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===a&&(s=i),f===o&&++u===r&&(l=i),null!==(h=d.nextSibling))break;f=(d=f).parentNode}d=h}n=-1===s||-1===l?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ha={focusedElem:e,selectionRange:n},In=!1,Bl=t;null!==Bl;)if(e=(t=Bl).child,1028&t.subtreeFlags&&null!==e)e.return=t,Bl=e;else for(;null!==Bl;){t=Bl;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var m=p.memoizedProps,g=p.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ks(t.type,m),g);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(Q(163))}}catch(e){pu(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Bl=e;break}Bl=t.return}p=Hl,Hl=!1}(e,n),ic(n,e),aa(Ha),In=!!Wa,Ha=Wa=null,e.current=n,lc(n),jt(),vc=s,un=i,yc.transition=o}else e.current=n;if(Fc&&(Fc=!1,Oc=e,$c=a),o=e.pendingLanes,0===o&&(zc=null),function(e){if(Qt&&"function"==typeof Qt.onCommitFiberRoot)try{Qt.onCommitFiberRoot(Gt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),qc(e,Ut()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Dc)throw Dc=!1,e=Ic,Ic=null,e;!!(1&$c)&&0!==e.tag&&fu(),o=e.pendingLanes,1&o?e===Uc?jc++:(jc=0,Uc=e):jc=0,No()}(e,t,n,r)}finally{yc.transition=a,un=r}return null}function fu(){if(null!==Oc){var e=dn($c),t=yc.transition,n=un;try{if(yc.transition=null,un=16>e?16:e,null===Oc)var r=!1;else{if(e=Oc,Oc=null,$c=0,6&vc)throw Error(Q(331));var a=vc;for(vc|=4,Bl=e.current;null!==Bl;){var o=Bl,i=o.child;if(16&Bl.flags){var s=o.deletions;if(null!==s){for(var l=0;l<s.length;l++){var c=s[l];for(Bl=c;null!==Bl;){var u=Bl;switch(u.tag){case 0:case 11:case 15:Kl(8,u,o)}var d=u.child;if(null!==d)d.return=u,Bl=d;else for(;null!==Bl;){var f=(u=Bl).sibling,h=u.return;if(Ql(u),u===c){Bl=null;break}if(null!==f){f.return=h,Bl=f;break}Bl=h}}}var p=o.alternate;if(null!==p){var m=p.child;if(null!==m){p.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(null!==m)}}Bl=o}}if(2064&o.subtreeFlags&&null!==i)i.return=o,Bl=i;else e:for(;null!==Bl;){if(2048&(o=Bl).flags)switch(o.tag){case 0:case 11:case 15:Kl(9,o,o.return)}var y=o.sibling;if(null!==y){y.return=o.return,Bl=y;break e}Bl=o.return}}var v=e.current;for(Bl=v;null!==Bl;){var b=(i=Bl).child;if(2064&i.subtreeFlags&&null!==b)b.return=i,Bl=b;else e:for(i=v;null!==Bl;){if(2048&(s=Bl).flags)try{switch(s.tag){case 0:case 11:case 15:ql(9,s)}}catch(e){pu(s,s.return,e)}if(s===i){Bl=null;break e}var w=s.sibling;if(null!==w){w.return=s.return,Bl=w;break e}Bl=s.return}}if(vc=a,No(),Qt&&"function"==typeof Qt.onPostCommitFiberRoot)try{Qt.onPostCommitFiberRoot(Gt,e)}catch(e){}r=!0}return r}finally{un=n,yc.transition=t}}return!1}function hu(e,t,n){e=Pi(e,t=rl(0,t=Zs(n,t),1),1),t=Wc(),null!==e&&(ln(e,1,t),qc(e,t))}function pu(e,t,n){if(3===e.tag)hu(e,e,n);else for(;null!==t;){if(3===t.tag){hu(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===zc||!zc.has(r))){t=Pi(t,e=al(t,e=Zs(n,e),1),1),e=Wc(),null!==t&&(ln(t,1,e),qc(t,e));break}}t=t.return}}function mu(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Wc(),e.pingedLanes|=e.suspendedLanes&n,bc===e&&(kc&n)===n&&(4===Cc||3===Cc&&(130023424&kc)===kc&&500>Ut()-Lc?nu(e,0):Rc|=n),qc(e,t)}function gu(e,t){0===t&&(1&e.mode?(t=en,!(130023424&(en<<=1))&&(en=4194304)):t=1);var n=Wc();null!==(e=Ei(e,t))&&(ln(e,t,n),qc(e,n))}function yu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),gu(e,n)}function vu(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}null!==r&&r.delete(t),gu(e,n)}function bu(e,t){return Ft(e,t)}function wu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ku(e,t,n,r){return new wu(e,t,n,r)}function Su(e){return!(!(e=e.prototype)||!e.isReactComponent)}function xu(e,t){var n=e.alternate;return null===n?((n=ku(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Cu(e,t,n,r,a,o){var i=2;if(r=e,"function"==typeof e)Su(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case he:return Eu(n.children,a,o,t);case pe:i=8,a|=8;break;case me:return(e=ku(12,n,t,2|a)).elementType=me,e.lanes=o,e;case be:return(e=ku(13,n,t,a)).elementType=be,e.lanes=o,e;case we:return(e=ku(19,n,t,a)).elementType=we,e.lanes=o,e;case xe:return _u(n,a,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ge:i=10;break e;case ye:i=9;break e;case ve:i=11;break e;case ke:i=14;break e;case Se:i=16,r=null;break e}throw Error(Q(130,null==e?e:typeof e,""))}return(t=ku(i,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function Eu(e,t,n,r){return(e=ku(7,e,r,t)).lanes=n,e}function _u(e,t,n,r){return(e=ku(22,e,r,t)).elementType=xe,e.lanes=n,e.stateNode={isHidden:!1},e}function Mu(e,t,n){return(e=ku(6,e,null,t)).lanes=n,e}function Ru(e,t,n){return(t=ku(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Au(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sn(0),this.expirationTimes=sn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sn(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Pu(e,t,n,r,a,o,i,s,l){return e=new Au(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=ku(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mi(o),e}function Lu(e){if(!e)return vo;e:{if(Tt(e=e._reactInternals)!==e||1!==e.tag)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Q(171))}if(1===e.tag){var n=e.type;if(xo(n))return _o(e,n,t)}return t}function Tu(e,t,n,r,a,o,i,s,l){return(e=Pu(n,r,!0,e,0,o,0,s,l)).context=Lu(null),n=e.current,(o=Ai(r=Wc(),a=Hc(n))).callback=null!=t?t:null,Pi(n,o,a),e.current.lanes=a,ln(e,a,r),qc(e,r),e}function Nu(e,t,n,r){var a=t.current,o=Wc(),i=Hc(a);return n=Lu(n),null===t.context?t.context=n:t.pendingContext=n,(t=Ai(o,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Pi(a,t,i))&&(Kc(e,a,i,o),Li(e,a,i)),i}function Du(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Iu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function zu(e,t){Iu(e,t),(e=e.alternate)&&Iu(e,t)}hc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||wo.current)cl=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return cl=!1,function(e,t,n){switch(t.tag){case 3:bl(t),ai();break;case 5:Bi(t);break;case 1:xo(t.type)&&Mo(t);break;case 4:ji(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;yo(hi,r._currentValue),r._currentValue=a;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(yo(Wi,1&Wi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Ml(e,t,n):(yo(Wi,1&Wi.current),null!==(e=Dl(e,t,n))?e.sibling:null);yo(Wi,1&Wi.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Tl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),yo(Wi,Wi.current),r)break;return null;case 22:case 23:return t.lanes=0,pl(e,t,n)}return Dl(e,t,n)}(e,t,n);cl=!!(131072&e.flags)}else cl=!1,Qo&&1048576&t.flags&&Wo(t,Fo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Nl(e,t),e=t.pendingProps;var a=So(t,bo.current);wi(t,n),a=is(null,t,r,e,a,n);var o=ss();return t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xo(r)?(o=!0,Mo(t)):o=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,Mi(t),a.updater=Gs,t.stateNode=a,a._reactInternals=t,Js(t,r,e,n),t=vl(null,t,r,!0,o,n)):(t.tag=0,Qo&&o&&Ho(t),ul(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Nl(e,t),e=t.pendingProps,r=(a=r._init)(r._payload),t.type=r,a=t.tag=function(e){if("function"==typeof e)return Su(e)?1:0;if(null!=e){if((e=e.$$typeof)===ve)return 11;if(e===ke)return 14}return 2}(r),e=Ks(r,e),a){case 0:t=gl(null,t,r,e,n);break e;case 1:t=yl(null,t,r,e,n);break e;case 11:t=dl(null,t,r,e,n);break e;case 14:t=fl(null,t,r,Ks(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,gl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 1:return r=t.type,a=t.pendingProps,yl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 3:e:{if(bl(t),null===e)throw Error(Q(387));r=t.pendingProps,a=(o=t.memoizedState).element,Ri(e,t),Ni(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=wl(e,t,r,n,a=Zs(Error(Q(423)),t));break e}if(r!==a){t=wl(e,t,r,n,a=Zs(Error(Q(424)),t));break e}for(Go=Za(t.stateNode.containerInfo.firstChild),qo=t,Qo=!0,Yo=null,n=fi(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ai(),r===a){t=Dl(e,t,n);break e}ul(e,t,r,n)}t=t.child}return t;case 5:return Bi(t),null===e&&ei(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,i=a.children,Ka(r,a)?i=null:null!==o&&Ka(r,o)&&(t.flags|=32),ml(e,t),ul(e,t,i,n),t.child;case 6:return null===e&&ei(t),null;case 13:return Ml(e,t,n);case 4:return ji(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=di(t,null,r,n):ul(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,dl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 7:return ul(e,t,t.pendingProps,n),t.child;case 8:case 12:return ul(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,yo(hi,r._currentValue),r._currentValue=i,null!==o)if(Xr(o.value,i)){if(o.children===a.children&&!wo.current){t=Dl(e,t,n);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var s=o.dependencies;if(null!==s){i=o.child;for(var l=s.firstContext;null!==l;){if(l.context===r){if(1===o.tag){(l=Ai(-1,n&-n)).tag=2;var c=o.updateQueue;if(null!==c){var u=(c=c.shared).pending;null===u?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,null!==(l=o.alternate)&&(l.lanes|=n),bi(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(10===o.tag)i=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(i=o.return))throw Error(Q(341));i.lanes|=n,null!==(s=i.alternate)&&(s.lanes|=n),bi(i,n,t),i=o.sibling}else i=o.child;if(null!==i)i.return=o;else for(i=o;null!==i;){if(i===t){i=null;break}if(null!==(o=i.sibling)){o.return=i.return,i=o;break}i=i.return}o=i}ul(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,wi(t,n),r=r(a=ki(a)),t.flags|=1,ul(e,t,r,n),t.child;case 14:return a=Ks(r=t.type,t.pendingProps),fl(e,t,r,a=Ks(r.type,a),n);case 15:return hl(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ks(r,a),Nl(e,t),t.tag=1,xo(r)?(e=!0,Mo(t)):e=!1,wi(t,n),Ys(t,r,a),Js(t,r,a,n),vl(null,t,r,!0,e,n);case 19:return Tl(e,t,n);case 22:return pl(e,t,n)}throw Error(Q(156,t.tag))};var Fu="function"==typeof reportError?reportError:function(e){console.error(e)};function Ou(e){this._internalRoot=e}function $u(e){this._internalRoot=e}function ju(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Uu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Bu(){}function Vu(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o;if("function"==typeof a){var s=a;a=function(){var e=Du(i);s.call(e)}}Nu(t,i,e,a)}else i=function(e,t,n,r,a){if(a){if("function"==typeof r){var o=r;r=function(){var e=Du(i);o.call(e)}}var i=Tu(t,r,e,0,null,!1,0,"",Bu);return e._reactRootContainer=i,e[ao]=i.current,Ta(8===e.nodeType?e.parentNode:e),eu(),i}for(;a=e.lastChild;)e.removeChild(a);if("function"==typeof r){var s=r;r=function(){var e=Du(l);s.call(e)}}var l=Pu(e,0,!1,null,0,!1,0,"",Bu);return e._reactRootContainer=l,e[ao]=l.current,Ta(8===e.nodeType?e.parentNode:e),eu(function(){Nu(t,l,n,r)}),l}(n,t,e,a,r);return Du(i)}$u.prototype.render=Ou.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Q(409));Nu(e,t,null,null)},$u.prototype.unmount=Ou.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;eu(function(){Nu(null,e,null,null)}),t[ao]=null}},$u.prototype.unstable_scheduleHydration=function(e){if(e){var t=mn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cn.length&&0!==t&&t<Cn[n].priority;n++);Cn.splice(n,0,e),0===n&&Rn(e)}},fn=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tn(t.pendingLanes);0!==n&&(cn(t,1|n),qc(t,Ut()),!(6&vc)&&(Tc=Ut()+500,No()))}break;case 13:eu(function(){var t=Ei(e,1);if(null!==t){var n=Wc();Kc(t,e,1,n)}}),zu(e,1)}},hn=function(e){if(13===e.tag){var t=Ei(e,134217728);if(null!==t)Kc(t,e,134217728,Wc());zu(e,134217728)}},pn=function(e){if(13===e.tag){var t=Hc(e),n=Ei(e,t);if(null!==n)Kc(n,e,t,Wc());zu(e,t)}},mn=function(){return un},gn=function(e,t){var n=un;try{return un=e,t()}finally{un=n}},ft=function(e,t,n){switch(t){case"input":if(Be(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=fo(r);if(!a)throw Error(Q(90));Fe(r),Be(r,a)}}}break;case"textarea":Qe(e,n);break;case"select":null!=(t=n.value)&&Ke(e,!!n.multiple,t,!1)}},vt=Zc,bt=eu;var Wu={usingClientEntryPoint:!1,Events:[co,uo,fo,gt,yt,Zc]},Hu={findFiberByHostInstance:lo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ku={bundleType:Hu.bundleType,version:Hu.version,rendererPackageName:Hu.rendererPackageName,rendererConfig:Hu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ue.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=It(e))?null:e.stateNode},findFiberByHostInstance:Hu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qu.isDisabled&&qu.supportsFiber)try{Gt=qu.inject(Ku),Qt=qu}catch(et){}}V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wu,V.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!ju(t))throw Error(Q(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:fe,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},V.createRoot=function(e,t){if(!ju(e))throw Error(Q(299));var n=!1,r="",a=Fu;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=Pu(e,1,!1,null,0,n,0,r,a),e[ao]=t.current,Ta(8===e.nodeType?e.parentNode:e),new Ou(t)},V.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(Q(188));throw e=Object.keys(e).join(","),Error(Q(268,e))}return e=null===(e=It(t))?null:e.stateNode},V.flushSync=function(e){return eu(e)},V.hydrate=function(e,t,n){if(!Uu(t))throw Error(Q(200));return Vu(null,e,t,!0,n)},V.hydrateRoot=function(e,t,n){if(!ju(e))throw Error(Q(405));var r=null!=n&&n.hydratedSources||null,a=!1,o="",i=Fu;if(null!=n&&(!0===n.unstable_strictMode&&(a=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=Tu(t,null,e,1,null!=n?n:null,a,0,o,i),e[ao]=t.current,Ta(e),r)for(e=0;e<r.length;e++)a=(a=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new $u(t)},V.render=function(e,t,n){if(!Uu(t))throw Error(Q(200));return Vu(null,e,t,!1,n)},V.unmountComponentAtNode=function(e){if(!Uu(e))throw Error(Q(40));return!!e._reactRootContainer&&(eu(function(){Vu(null,null,e,!1,function(){e._reactRootContainer=null,e[ao]=null})}),!0)},V.unstable_batchedUpdates=Zc,V.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Uu(n))throw Error(Q(200));if(null==e||void 0===e._reactInternals)throw Error(Q(38));return Vu(e,t,n,!1,r)},V.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),B.exports=V;var Gu,Qu=B.exports;Gu=Qu.createRoot,Qu.hydrateRoot;var Yu={exports:{}},Xu={},Ju=j,Zu=Symbol.for("react.element"),ed=Symbol.for("react.fragment"),td=Object.prototype.hasOwnProperty,nd=Ju.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rd={key:!0,ref:!0,__self:!0,__source:!0};function ad(e,t,n){var r,a={},o=null,i=null;for(r in void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),void 0!==t.ref&&(i=t.ref),t)td.call(t,r)&&!rd.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:Zu,type:e,key:o,ref:i,props:a,_owner:nd.current}}Xu.Fragment=ed,Xu.jsx=ad,Xu.jsxs=ad,Yu.exports=Xu;var od=Yu.exports;function id(e){return{title:e.title,snippet:e.content,relevance:e.score,documentId:e.documentId,fullContent:e.fullContent,downloadUrl:e.downloadUrl,documentName:e.documentName,sourceType:e.sourceType,chunkId:e.chunkId}}class sd{constructor(e,t){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t}async chat(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}: ${n.statusText}`)}const r=await n.json();return{...r,sources:(r.sources||[]).map(id)}}async chatStream(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}`)}const r=n.body?.getReader();if(!r)throw new Error("Streaming not supported");const a=new TextDecoder;let o,i="",s="",l=[];try{for(;;){const{done:e,value:n}=await r.read();if(e)break;i+=a.decode(n,{stream:!0});const c=i.split("\n");i=c.pop()||"";for(const e of c)if(e.startsWith("event: "));else if(e.startsWith("data: "))try{const n=JSON.parse(e.slice(6));void 0!==n.text?(s+=n.text,t.onToken?.(n.text)):void 0!==n.sources?(l=(n.sources||[]).map(id),t.onSources?.(l)):void 0!==n.sessionId&&(o=n.sessionId)}catch{}}t.onComplete?.({fullText:s,sessionId:o,sources:l})}catch(e){t.onError?.(e)}}async getGeneralDocs(e){const t=new URLSearchParams;e&&t.set("since",e);const n=`${this.baseUrl}/api/external/docs${t.toString()?"?"+t:""}`,r=await fetch(n,{headers:{"X-API-Key":this.apiKey}});if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).documents}async getStatus(){const e=await fetch(`${this.baseUrl}/api/external/status`,{headers:{"X-API-Key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){const e=await fetch(`${this.baseUrl}/api/external/health`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}}let ld,cd;const ud=new WeakMap,dd=new WeakMap,fd=new WeakMap,hd=new WeakMap,pd=new WeakMap;let md={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return dd.get(e);if("objectStoreNames"===t)return e.objectStoreNames||fd.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return vd(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function gd(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(cd||(cd=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(bd(this),t),vd(ud.get(this))}:function(...t){return vd(e.apply(bd(this),t))}:function(t,...n){const r=e.call(bd(this),t,...n);return fd.set(r,t.sort?t.sort():[t]),vd(r)}}function yd(e){return"function"==typeof e?gd(e):(e instanceof IDBTransaction&&function(e){if(dd.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});dd.set(e,t)}(e),t=e,(ld||(ld=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,md):e);var t}function vd(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{t(vd(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",a),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&ud.set(t,e)}).catch(()=>{}),pd.set(t,e),t}(e);if(hd.has(e))return hd.get(e);const t=yd(e);return t!==e&&(hd.set(e,t),pd.set(t,e)),t}const bd=e=>pd.get(e);function wd(e,t,{blocked:n,upgrade:r,blocking:a,terminated:o}={}){const i=indexedDB.open(e,t),s=vd(i);return r&&i.addEventListener("upgradeneeded",e=>{r(vd(i.result),e.oldVersion,e.newVersion,vd(i.transaction),e)}),n&&i.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{o&&e.addEventListener("close",()=>o()),a&&e.addEventListener("versionchange",e=>a(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}const kd=["get","getKey","getAll","getAllKeys","count"],Sd=["put","add","delete","clear"],xd=new Map;function Cd(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(xd.get(t))return xd.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,a=Sd.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!kd.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,a?"readwrite":"readonly");let i=o.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),a&&o.done]))[0]};return xd.set(t,o),o}md=(e=>({...e,get:(t,n,r)=>Cd(t,n)||e.get(t,n,r),has:(t,n)=>!!Cd(t,n)||e.has(t,n)}))(md);class Ed{constructor(e){this.db=null,this.dbPromise=null,this.documentCount=0,this.lastSyncAt=null,this.config=e,"indexeddb"===e.storage&&"undefined"!=typeof indexedDB?this.dbPromise=this.initDB():"localstorage"===e.storage&&this.loadLocalStorageMetadata()}loadLocalStorageMetadata(){try{const e=localStorage.getItem("cybernetic-cache-meta");if(e){const t=JSON.parse(e);this.documentCount=t.documentCount||0,this.lastSyncAt=t.lastSyncAt||null}}catch{}}async initDB(){return this.db=await wd("cybernetic-cache",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){e.createObjectStore("documents",{keyPath:"id"}).createIndex("by-updated","updatedAt")}e.objectStoreNames.contains("metadata")||e.createObjectStore("metadata",{keyPath:"key"})}}),await this.loadMetadata(),this.db}async getDB(){if(this.db)return this.db;if(this.dbPromise)return this.dbPromise;throw new Error("Database not available")}async loadMetadata(){if(!this.db)return;const e=await this.db.get("metadata","documentCount");this.documentCount=e?.value||0;const t=await this.db.get("metadata","lastSyncAt");this.lastSyncAt=t?.value||null}async store(e){if("localstorage"===this.config.storage)return this.storeLocalStorage(e);const t=(await this.getDB()).transaction(["documents","metadata"],"readwrite");for(const n of e)await t.objectStore("documents").put(n);this.documentCount=await t.objectStore("documents").count(),this.lastSyncAt=(new Date).toISOString(),await t.objectStore("metadata").put({key:"documentCount",value:this.documentCount}),await t.objectStore("metadata").put({key:"lastSyncAt",value:this.lastSyncAt}),await t.done}async retrieve(){if("localstorage"===this.config.storage)return this.retrieveLocalStorage();return(await this.getDB()).getAll("documents")}async getLastSync(){return this.lastSyncAt}getStatus(){const e=Date.now()-(this.lastSyncAt?new Date(this.lastSyncAt).getTime():0)>this.config.maxAge;return{documentCount:this.documentCount,lastSyncAt:this.lastSyncAt,cacheSize:5e3*this.documentCount,isStale:e}}async clear(){if("localstorage"===this.config.storage)return localStorage.removeItem("cybernetic-cache-docs"),localStorage.removeItem("cybernetic-cache-meta"),this.documentCount=0,void(this.lastSyncAt=null);const e=(await this.getDB()).transaction(["documents","metadata"],"readwrite");await e.objectStore("documents").clear(),await e.objectStore("metadata").clear(),await e.done,this.documentCount=0,this.lastSyncAt=null}storeLocalStorage(e){try{localStorage.setItem("cybernetic-cache-docs",JSON.stringify(e)),this.documentCount=e.length,this.lastSyncAt=(new Date).toISOString(),localStorage.setItem("cybernetic-cache-meta",JSON.stringify({documentCount:this.documentCount,lastSyncAt:this.lastSyncAt}))}catch{localStorage.removeItem("cybernetic-cache-docs");const t=e.slice(0,50);localStorage.setItem("cybernetic-cache-docs",JSON.stringify(t)),this.documentCount=t.length}}retrieveLocalStorage(){try{const e=localStorage.getItem("cybernetic-cache-docs");return e?JSON.parse(e):[]}catch{return[]}}}class _d{constructor(){this.documents=[],this.idf=new Map,this.indexed=!1,this.loadedFromExport=!1,this.vocabulary=new Map}isIndexed(){return this.indexed&&this.documents.length>0}async index(e){this.documents=[],this.idf=new Map;const t=new Map;for(const n of e){const e=this.tokenize(n.content),r=new Set(e);for(const e of r)t.set(e,(t.get(e)||0)+1);this.documents.push({id:n.id,title:n.title,content:n.content,tokens:e,tfidf:new Map})}const n=e.length;for(const[e,r]of t)this.idf.set(e,Math.log((n+1)/(r+1))+1);for(const e of this.documents){const t=this.computeTermFrequency(e.tokens);for(const[n,r]of t){const t=this.idf.get(n)||1;e.tfidf.set(n,r*t)}}this.indexed=!0}async ask(e){if(!this.indexed||0===this.documents.length)return{answer:"I don't have any information available offline.",sources:[],topScore:0};const t=this.tokenize(e),n=this.computeTermFrequency(t),r=new Map;for(const[e,t]of n){const n=this.idf.get(e)||1;r.set(e,t*n)}const a=this.documents.map(e=>({doc:e,score:this.cosineSimilarity(r,e.tfidf)}));a.sort((e,t)=>t.score-e.score);const o=a.slice(0,3).filter(e=>e.score>.1);if(0===o.length)return{answer:"I couldn't find relevant information for your question in my offline data.",sources:[],topScore:a[0]?.score||0};const i=o[0].doc;return{answer:this.extractRelevantSnippet(i.content,t),sources:o.map(e=>({title:e.doc.title,snippet:e.doc.content.substring(0,200)+"...",score:e.score})),topScore:o[0].score}}reset(){this.documents=[],this.idf=new Map,this.vocabulary=new Map,this.indexed=!1,this.loadedFromExport=!1,this.exportVersion=void 0,this.exportedAt=void 0}async loadFromExport(e){this.reset(),this.idf=new Map(Object.entries(e.tfidfIndex.idf));let t=0;for(const e of this.idf.keys())this.vocabulary.set(e,t++);for(const t of e.documents){const e=new Map;for(const[n,r]of t.tfidfVector)for(const[t,a]of this.vocabulary)if(a===n){e.set(t,r);break}this.documents.push({id:t.id,title:t.title,content:t.content,tokens:[],tfidf:e})}this.indexed=!0,this.loadedFromExport=!0,this.exportVersion=e.version,this.exportedAt=e.meta.exportedAt,console.log(`[CyberneticLocalRAG] Loaded ${this.documents.length} documents from export (v${e.version})`)}getExportStatus(){return{loaded:this.indexed,loadedFromExport:this.loadedFromExport,documentCount:this.documents.length,chunkCount:this.documents.length,exportVersion:this.exportVersion,exportedAt:this.exportedAt}}tokenize(e){return e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>2&&!this.isStopWord(e))}computeTermFrequency(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)||0)+1);const n=Math.max(...t.values());if(n>0)for(const[e,r]of t)t.set(e,r/n);return t}cosineSimilarity(e,t){let n=0,r=0,a=0;for(const[a,o]of e){n+=o*(t.get(a)||0),r+=o*o}for(const e of t.values())a+=e*e;return 0===r||0===a?0:n/(Math.sqrt(r)*Math.sqrt(a))}extractRelevantSnippet(e,t){const n=e.split(/[.!?]+/).filter(e=>e.trim().length>0).map(e=>{const n=new Set(this.tokenize(e));let r=0;for(const e of t)n.has(e)&&r++;return{sentence:e.trim(),score:r}});n.sort((e,t)=>t.score-e.score);const r=n.slice(0,3).filter(e=>e.score>0);return 0===r.length?e.substring(0,300)+"...":r.map(e=>e.sentence).join(". ")+"."}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very"]).has(e)}}class Md{constructor(){this.db=null,this.dbPromise=null,this.dbName="cybernetic-offline-vectors",this.dbVersion=1}async initDB(){return this.db?this.db:this.dbPromise?this.dbPromise:(this.dbPromise=wd(this.dbName,this.dbVersion,{upgrade(e){e.objectStoreNames.contains("vectors")||e.createObjectStore("vectors",{keyPath:"id"})}}),this.db=await this.dbPromise,this.db)}async store(e,t){const n=await this.getDB();await n.put("vectors",{id:e,exportVersion:t.version,exportedAt:t.meta.exportedAt,type:t.type,data:t}),console.log(`[CyberneticOfflineStorage] Stored ${t.meta.chunkCount} chunks`)}async retrieve(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?.data??null}async isValid(e,t){const n=await this.getDB(),r=await n.get("vectors",e);if(!r)return!1;const a=new Date(r.exportedAt).getTime();return Date.now()-a<t}async getMeta(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?{version:n.exportVersion,exportedAt:n.exportedAt,documentCount:n.data.meta.documentCount,chunkCount:n.data.meta.chunkCount,type:n.type}:null}async hasData(){const e=await this.getDB();return await e.count("vectors")>0}async getStoredIds(){return(await this.getDB()).getAllKeys("vectors")}async delete(e){const t=await this.getDB();await t.delete("vectors",e)}async clear(){const e=await this.getDB();await e.clear("vectors"),console.log("[CyberneticOfflineStorage] Cache cleared")}async getDB(){return this.db?this.db:this.initDB()}close(){this.db&&(this.db.close(),this.db=null,this.dbPromise=null)}}function Rd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;n&&(t+="=".repeat(4-n));const r=atob(t),a=new Uint8Array(r.length);for(let e=0;e<r.length;e++)a[e]=r.charCodeAt(e);return a}function Ad(e){const t=Rd(e);return(new TextDecoder).decode(t)}async function Pd(e,t,n){try{const r=await async function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return crypto.subtle.importKey("spki",r.buffer,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}(n),a=(new TextEncoder).encode(e),o=new Uint8Array(t).buffer;return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,o,a)}catch(e){return console.warn("[License] Signature verification failed:",e),!1}}async function Ld(e,t){if(!e||""===e.trim())return{status:"missing",payload:null,error:"No license key provided",inGracePeriod:!1,daysRemaining:null};const n=function(e){try{const t=e.split(".");if(3!==t.length)return null;const[n,r,a]=t;return{header:JSON.parse(Ad(n)),payload:JSON.parse(Ad(r)),signature:Rd(a),signedContent:`${n}.${r}`}}catch{return null}}(e);if(!n)return{status:"invalid",payload:null,error:"Invalid license key format",inGracePeriod:!1,daysRemaining:null};const r=function(e){return"string"!=typeof e.iss||"string"!=typeof e.sub||"string"!=typeof e.aud||"number"!=typeof e.iat||"number"!=typeof e.exp||"string"!=typeof e.plan||"number"!=typeof e.seats?null:Array.isArray(e.features)?"number"!=typeof e.licenseVersion?null:{iss:e.iss,sub:e.sub,aud:e.aud,iat:e.iat,exp:e.exp,plan:e.plan,org:"string"==typeof e.org?e.org:void 0,seats:e.seats,features:e.features,graceUntil:"number"==typeof e.graceUntil?e.graceUntil:void 0,licenseVersion:e.licenseVersion}:null}(n.payload);if(!r)return{status:"invalid",payload:null,error:"Invalid license payload structure",inGracePeriod:!1,daysRemaining:null};if("astermind"!==r.iss)return{status:"invalid",payload:null,error:"Invalid license issuer",inGracePeriod:!1,daysRemaining:null};if("cybernetic-chatbot"!==r.aud&&"*"!==r.aud)return{status:"invalid",payload:null,error:"License not valid for this product",inGracePeriod:!1,daysRemaining:null};if("undefined"!=typeof crypto&&crypto.subtle){const e=t||"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhLW7MXHQ0Fuk1OKt9D5CbRw7fUMN\nLJ5AZXvOhHaXdHzMuYKX5BpK4w7TqbPvJ6QPvKmLKvHh1VKcUJ6mJQgJJw==\n-----END PUBLIC KEY-----";if(!await Pd(n.signedContent,n.signature,e))return{status:"invalid",payload:null,error:"License signature verification failed",inGracePeriod:!1,daysRemaining:null}}const a=Math.floor(Date.now()/1e3),o=function(e){const t=e-Math.floor(Date.now()/1e3);return Math.floor(t/86400)}(r.exp);return r.exp<a?r.graceUntil&&r.graceUntil>a?{status:"valid",payload:r,inGracePeriod:!0,daysRemaining:o}:{status:"expired",payload:r,error:"License has expired",inGracePeriod:!1,daysRemaining:o}:"eval"===r.plan?{status:"eval",payload:r,inGracePeriod:!1,daysRemaining:o}:{status:"valid",payload:r,inGracePeriod:!1,daysRemaining:o}}const Td="cybernetic-chatbot-client",Nd="agentic";class Dd{constructor(e={}){this.state=null,this.verificationPromise=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures=new Set,this.config=e,this.environment=e.environment||function(){if("undefined"==typeof window)return"production"===process?.env?.NODE_ENV?"production":"development";const e=window.location?.hostname||"",t=["localhost","127.0.0.1","0.0.0.0",".local",".dev",".test",":3000",":5173",":8080",":4200"];for(const n of t)if(e.includes(n)||window.location?.port===n.replace(":",""))return"development";if("file:"===window.location?.protocol)return"development";const n=["staging.","preview.","-preview.",".vercel.app",".netlify.app",".pages.dev"];for(const t of n)if(e.includes(t))return"production";return"production"}(),this.enforcementMode="development"===this.environment?"soft":"hard"}async verify(){if(this.state)return this.state;if(this.verificationPromise)return this.verificationPromise;this.verificationPromise=Ld(this.config.licenseKey,this.config.publicKey);try{return this.state=await this.verificationPromise,this.config.onStatusChange?.(this.state),this.logLicenseStatus(),this.state}finally{this.verificationPromise=null}}getState(){return this.state}isValid(){return!!this.state&&("valid"===this.state.status||"eval"===this.state.status)}requiresAction(){return!this.state||("expired"===this.state.status||"missing"===this.state.status||"invalid"===this.state.status)}getEnvironment(){return this.environment}getEnforcementMode(){return this.enforcementMode}processResponse(e){return this.state?this.isValid()&&!this.state.inGracePeriod?e:"soft"===this.enforcementMode?(this.hasLoggedWarning||(this.logDevelopmentWarning(),this.hasLoggedWarning=!0),e):e+"\n\n---\n⚠️ License Notice: Your AsterMind license key needs to be updated. Please contact support@astermind.ai or visit https://astermind.ai/license to renew your license.":e}getStatusMessage(){if(!this.state)return"License not verified";switch(this.state.status){case"valid":return this.state.inGracePeriod?`License expired but in grace period (${Math.abs(this.state.daysRemaining||0)} days overdue)`:`License valid (${this.state.daysRemaining} days remaining)`;case"eval":return`Evaluation license (${this.state.daysRemaining} days remaining)`;case"expired":return`License expired ${Math.abs(this.state.daysRemaining||0)} days ago`;case"missing":return"No license key provided";case"invalid":return`Invalid license: ${this.state.error}`;default:return"Unknown license status"}}async reVerify(){return this.state=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures.clear(),this.verify()}hasFeature(e){return!!this.state?.payload&&this.state.payload.features.includes(e)}getFeatures(){return this.state?.payload?.features||[]}checkClientFeature(){return this.checkFeatureWithLog(Td,"CyberneticClient")}checkAgenticFeature(){return this.checkFeatureWithLog(Nd,"Agentic capabilities")}checkFeatureWithLog(e,t){if(!this.state?.payload)return!0;const n=this.state.payload.features.includes(e);return n||this.loggedMissingFeatures.has(e)||(this.loggedMissingFeatures.add(e),this.logMissingFeature(e,t)),n}logMissingFeature(e,t){const n=this.getFeatures(),r=this.state?.payload?.plan||"unknown";console.warn(`[Cybernetic License] ${t} requires the '${e}' feature, which is not included in your license.`),console.info(`[Cybernetic License] Current license plan: ${r}`),console.info(`[Cybernetic License] Licensed features: ${n.length>0?n.join(", "):"(none)"}`),console.info("[Cybernetic License] To add this feature, upgrade your license at https://astermind.ai/license")}logLicenseStatus(){if(!this.state)return;const e="[Cybernetic License]";switch(this.state.status){case"valid":this.state.inGracePeriod?console.warn(`${e} License expired but in grace period. Please renew at https://astermind.ai/license`):null!==this.state.daysRemaining&&this.state.daysRemaining<=30&&console.info(`${e} License expires in ${this.state.daysRemaining} days`);break;case"eval":console.info(`${e} Evaluation license - ${this.state.daysRemaining} days remaining`);break;case"expired":console.error(`${e} License expired. Enforcement mode: ${this.enforcementMode}. Renew at https://astermind.ai/license`);break;case"missing":console.warn(`${e} No license key provided. Enforcement mode: ${this.enforcementMode}. Get a license at https://astermind.ai/license`);break;case"invalid":console.error(`${e} Invalid license: ${this.state.error}. Enforcement mode: ${this.enforcementMode}`)}}logDevelopmentWarning(){console.warn(`[Cybernetic License] Running in development mode with ${this.state?.status||"unknown"} license. In production, a warning will be appended to chatbot responses. Get a license at https://astermind.ai/license`)}}class Id{constructor(e){this.status="connecting",this.lastError=null,this.systemSettings=null,this.settingsLastChecked=0,this.SETTINGS_CHECK_INTERVAL=3e5,this.agenticCapabilities=null,this.offlineStorage=null,this.omegaRAG=null,this.offlineWarningShown=!1,this.config={apiUrl:e.apiUrl,apiKey:e.apiKey,fallback:{enabled:e.fallback?.enabled??!0,cacheMaxAge:e.fallback?.cacheMaxAge??864e5,cacheOnConnect:e.fallback?.cacheOnConnect??!0,cacheStorage:e.fallback?.cacheStorage??"indexeddb"},retry:{maxRetries:e.retry?.maxRetries??2,initialDelay:e.retry?.initialDelay??1e3,exponentialBackoff:e.retry?.exponentialBackoff??!0},agentic:e.agentic??null,offline:e.offline??null,sitemap:e.sitemap??null,sources:{enabled:e.sources?.enabled??!0,showSummary:e.sources?.showSummary??!0,showDownload:e.sources?.showDownload??!0,includeFullContent:e.sources?.includeFullContent??!1,maxSources:e.sources?.maxSources??5},onStatusChange:e.onStatusChange||(()=>{}),onError:e.onError||(()=>{})},this.apiClient=new sd(this.config.apiUrl,this.config.apiKey),this.cache=new Ed({storage:this.config.fallback.cacheStorage,maxAge:this.config.fallback.cacheMaxAge}),this.localRAG=new _d,this.licenseManager=new Dd({licenseKey:e.licenseKey}),this.licenseManager.verify().then(()=>{this.licenseManager.checkClientFeature()}).catch(()=>{}),this.monitorConnection(),this.config.fallback.enabled&&this.config.fallback.cacheOnConnect&&this.syncCache().catch(()=>{}),this.config.offline?.enabled&&this.initializeOffline(this.config.offline).catch(e=>{console.warn("[Cybernetic] Failed to initialize offline vectors:",e)})}registerAgentic(e){this.agenticCapabilities=e,console.log("[Cybernetic] Agentic capabilities registered")}isAgenticEnabled(){return null!==this.agenticCapabilities&&!0===this.config.agentic?.enabled&&(this.licenseManager.checkAgenticFeature(),!0)}getAgenticCapabilities(){return this.agenticCapabilities}getAgenticConfig(){return this.config.agentic}getSourcesConfig(){return{...this.config.sources}}isSourceFeatureAvailable(e){return!!this.config.sources.enabled&&("summary"===e?this.config.sources.showSummary:"download"===e&&(this.config.sources.showDownload&&"online"===this.status))}classifyIntent(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return null;const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).interpretIntent(e)}async executeAction(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return{success:!1,message:"Agentic capabilities not enabled"};const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).executeAction(e)}async smartAsk(e,t){const n=this.classifyIntent(e);if(n&&n.action&&!n.shouldEscalate){if(!1!==this.config.agentic?.requireConfirmation)return{action:n.action};const e=await this.executeAction(n.action);return{action:n.action,actionResult:e}}return{response:await this.ask(e,t)}}async initializeOffline(e){const t=e.storageMode??"hybrid",n=e.cacheMaxAge??6048e5;if("memory"!==t&&(this.offlineStorage=new Md),this.offlineStorage&&"memory"!==t){const e="default";if(await this.offlineStorage.isValid(e,n)){console.log("[Cybernetic] Loading vectors from IndexedDB cache");const t=await this.offlineStorage.retrieve(e);if(t)return await this.localRAG.loadFromExport(t),void console.log("[Cybernetic] Loaded vectors from IndexedDB cache")}}if(e.vectorFileUrl)try{const n=await fetch(e.vectorFileUrl);if(!n.ok)throw new Error(`Failed to fetch vectors: ${n.status}`);const r=await n.json();return this.offlineStorage&&"memory"!==t&&await this.offlineStorage.store("default",r),await this.localRAG.loadFromExport(r),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded vectors from URL:",e.vectorFileUrl)}catch(e){console.error("[Cybernetic] Failed to load offline vectors from URL:",e)}if(e.vectorData)return await this.localRAG.loadFromExport(e.vectorData),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded inline vector data");this.offlineWarningShown||(console.warn("[Cybernetic] Offline functionality is enabled but no vectors are loaded. Offline responses will be limited. To enable full offline functionality, export vectors from the AsterMind admin panel and configure the vectorFileUrl or vectorData option."),this.offlineWarningShown=!0)}async initializeOmega(e){if(e.omega?.enabled)try{const{OmegaOfflineRAG:t}=await Promise.resolve().then(function(){return yf});this.omegaRAG=new t({reranking:e.omega.reranking,topK:5,verbose:!1}),e.omega.modelUrl?await this.omegaRAG.loadModelFromUrl(e.omega.modelUrl):e.omega.modelData&&await this.omegaRAG.loadModel(e.omega.modelData),console.log("[Cybernetic] Omega RAG initialized")}catch(e){console.warn("[Cybernetic] Failed to initialize Omega RAG:",e),this.omegaRAG=null}}async reloadOfflineVectors(){this.config.offline?.enabled?(this.localRAG.reset(),this.offlineStorage&&await this.offlineStorage.clear(),this.omegaRAG&&this.omegaRAG.clear(),await this.initializeOffline(this.config.offline)):console.warn("[Cybernetic] Offline mode is not enabled")}isOmegaOfflineEnabled(){return this.omegaRAG?.isReady()??!1}getOfflineModelInfo(){return this.omegaRAG?.getModelInfo()??null}getLocalRAGStatus(){return this.localRAG.getExportStatus()}getOfflineStorage(){return this.offlineStorage}async ask(e,t){if(!e||"string"!=typeof e)return this.createErrorResponse("Message is required","none");const n=await this.checkSystemStatus();if(n.maintenanceMode||n.forceOfflineClients)return console.log("[Cybernetic] Maintenance mode active, using cached data"),this.isCacheValid()?await this.fallbackAsk(e):{reply:n.maintenanceMessage||"The service is currently under maintenance. Please try again later.",confidence:"none",sources:[],offline:!0,degradedReason:"Maintenance mode active, no valid cache available"};try{const n=await this.apiWithRetry(e,t);this.setStatus("online");return{reply:this.licenseManager.processResponse(n.reply),confidence:"high",sources:n.sources||[],offline:!1,sessionId:n.sessionId}}catch(n){const r=this.normalizeError(n);return this.lastError=r,this.config.onError(r),"RATE_LIMIT"===r.code?{reply:"I'm receiving too many requests right now. Please try again in a moment.",confidence:"none",sources:[],offline:!1,retryAfter:r.retryAfter}:this.config.fallback.enabled&&!t?.skipFallback?await this.fallbackAsk(e):this.createErrorResponse("Unable to connect to the chatbot service. Please try again later.","none",r.retryAfter)}}async askStream(e,t,n){if(!e||"string"!=typeof e)return void t.onError?.({code:"LOCAL_RAG_ERROR",message:"Message is required"});const r=await this.checkSystemStatus();if(r.maintenanceMode||r.forceOfflineClients){console.log("[Cybernetic] Maintenance mode active, falling back to offline");const n=await this.fallbackAsk(e);return void t.onComplete?.(n)}try{await this.apiClient.chatStream(e,{sessionId:n?.sessionId,context:n?.context,onToken:t.onToken,onSources:t.onSources,onComplete:e=>{this.setStatus("online");const n=this.licenseManager.processResponse(e.fullText);t.onComplete?.({reply:n,confidence:"high",sources:e.sources||[],offline:!1,sessionId:e.sessionId})},onError:e=>{const n=this.normalizeError(e);this.config.onError(n),t.onError?.(n)}})}catch(r){const a=this.normalizeError(r);if(this.lastError=a,this.config.onError(a),this.config.fallback.enabled&&!n?.skipFallback){const n=await this.fallbackAsk(e);t.onComplete?.(n)}else t.onError?.(a)}}async syncCache(){try{const e=await this.cache.getLastSync(),t=await this.apiClient.getGeneralDocs(e);t.length>0&&(await this.cache.store(t),await this.localRAG.index(t),console.log(`[Cybernetic] Cache synced: ${t.length} documents`)),this.setStatus("online")}catch(e){console.warn("[Cybernetic] Cache sync failed:",e)}}getStatus(){return{connection:this.status,cache:this.cache.getStatus(),lastError:this.lastError,systemSettings:this.systemSettings,license:this.licenseManager.getState()}}getLicenseManager(){return this.licenseManager}async clearCache(){await this.cache.clear(),this.localRAG.reset()}async checkConnection(){try{return await this.apiClient.getStatus(),this.setStatus("online"),!0}catch{return this.setStatus("offline"),!1}}async checkSystemStatus(){if(this.systemSettings&&Date.now()-this.settingsLastChecked<this.SETTINGS_CHECK_INTERVAL)return this.systemSettings;try{const e=await this.apiClient.getStatus();return this.systemSettings={cacheRetentionHours:e.systemSettings?.cacheRetentionHours??168,maintenanceMode:e.systemSettings?.maintenanceMode??!1,maintenanceMessage:e.systemSettings?.maintenanceMessage,forceOfflineClients:e.systemSettings?.forceOfflineClients??!1},this.settingsLastChecked=Date.now(),this.systemSettings}catch{return this.systemSettings||{cacheRetentionHours:168,maintenanceMode:!1,forceOfflineClients:!1}}}isMaintenanceMode(){return this.systemSettings?.maintenanceMode??!1}getMaintenanceMessage(){return this.systemSettings?.maintenanceMessage}isCacheValid(){const e=this.cache.getStatus();if(!e.lastSyncAt)return!1;const t=60*(this.systemSettings?.cacheRetentionHours||168)*60*1e3,n=new Date(e.lastSyncAt).getTime();return Date.now()-n<t}async apiWithRetry(e,t){const{maxRetries:n,initialDelay:r,exponentialBackoff:a}=this.config.retry;let o=null;for(let i=0;i<=n;i++)try{return await this.apiClient.chat(e,{sessionId:t?.sessionId,context:t?.context})}catch(e){o=e;const t=this.normalizeError(e);if("AUTH_ERROR"===t.code||"RATE_LIMIT"===t.code)throw e;if(i<n){const e=a?r*Math.pow(2,i):r;await this.sleep(e)}}throw o}async fallbackAsk(e){if(this.setStatus("offline"),this.omegaRAG?.isReady())try{const t=await this.omegaRAG.ask(e);if(!t.degraded){return{reply:this.licenseManager.processResponse(t.answer),confidence:t.confidence,sources:t.sources.map(e=>({title:e.heading,snippet:e.content.substring(0,200)+"...",relevance:e.score})),offline:!0,degradedReason:"Omega hybrid retrieval (offline)"}}}catch(e){console.warn("[Cybernetic] Omega RAG failed, falling back to TF-IDF:",e)}const t=this.localRAG.getExportStatus();if(t.loaded&&t.documentCount>0)try{const n=await this.localRAG.ask(e);let r="medium";n.topScore<.3?r="low":n.topScore>.7&&(r="medium");return{reply:this.licenseManager.processResponse(n.answer),confidence:r,sources:n.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:t.loadedFromExport?"Using pre-exported vectors (offline)":"Processed locally with TF-IDF"}}catch(e){console.error("[Cybernetic] Local RAG error:",e)}const n=this.cache.getStatus();if(0===n.documentCount&&!t.loaded)return{reply:"I'm currently offline and don't have any cached information. Please check your connection and try again.",confidence:"none",sources:[],offline:!0,degradedReason:"No cached documents or offline vectors available"};try{const t=await this.cache.retrieve();this.localRAG.isIndexed()||await this.localRAG.index(t);const r=await this.localRAG.ask(e);let a="medium";r.topScore<.3?a="low":r.topScore>.7&&(a="medium");return{reply:this.licenseManager.processResponse(r.answer),confidence:a,sources:r.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:n.isStale?"Using stale cached data":"Processed locally without server"}}catch(e){return console.error("[Cybernetic] Local RAG error:",e),{reply:"I'm having trouble processing your request offline. Please try again when you're back online.",confidence:"none",sources:[],offline:!0,degradedReason:"Local RAG processing failed"}}}monitorConnection(){"undefined"!=typeof window&&(window.addEventListener("online",()=>{this.syncCache().catch(()=>{})}),window.addEventListener("offline",()=>{this.setStatus("offline")}),navigator.onLine||this.setStatus("offline"))}setStatus(e){this.status!==e&&(this.status=e,this.config.onStatusChange(e))}normalizeError(e){if(e instanceof Error){if(e.message.includes("401")||e.message.includes("Unauthorized"))return{code:"AUTH_ERROR",message:"Invalid or expired API key",originalError:e};if(e.message.includes("429")||e.message.includes("Rate limit")){const t=e.message.match(/retry after (\d+)/i);return{code:"RATE_LIMIT",message:"Rate limit exceeded",retryAfter:t?parseInt(t[1],10):60,originalError:e}}return e.message.includes("5")||e.message.includes("Server")?{code:"SERVER_ERROR",message:"Server error occurred",originalError:e}:{code:"NETWORK_ERROR",message:e.message||"Network error",originalError:e}}return{code:"NETWORK_ERROR",message:"Unknown error occurred"}}createErrorResponse(e,t,n){return{reply:e,confidence:t,sources:[],offline:!1,retryAfter:n}}sleep(e){return new Promise(t=>setTimeout(t,e))}}class zd{constructor(e,t,n){this.staticEntries=[],this.discoveredEntries=[],this.backendEntries=[],this.backendCache=null,this.isInitialized=!1,this.initPromise=null,this.config=e,this.apiUrl=t,this.apiKey=n,e.static&&(this.staticEntries=this.enhanceEntries(e.static,"props"))}async initialize(){if(!this.isInitialized){if(this.initPromise)return this.initPromise;this.initPromise=this.performInitialization(),await this.initPromise,this.isInitialized=!0}}async performInitialization(){const e=[];!1!==this.config.discovery?.enabled&&e.push(this.discoverFromFramework()),!1!==this.config.backend?.enabled&&this.config.backend?.endpoint&&e.push(this.fetchFromBackend());const t=await Promise.allSettled(e);for(const e of t)if("fulfilled"===e.status){const{entries:t,source:n}=e.value;"discovery"===n?this.discoveredEntries=t:"backend"===n&&(this.backendEntries=t)}else console.warn("[SiteMapDiscovery] Source failed:",e.reason);const n=this.staticEntries.length+this.discoveredEntries.length+this.backendEntries.length;console.log(`[SiteMapDiscovery] Initialized with ${n} total entries (${this.staticEntries.length} static, ${this.discoveredEntries.length} discovered, ${this.backendEntries.length} backend)`)}getMergedEntries(){return this.mergeEntries(this.staticEntries,this.discoveredEntries,this.backendEntries)}getLegacyEntries(){return this.getMergedEntries().map(e=>({path:e.path,name:e.name,description:e.description,params:e.params,dynamicParams:e.dynamicParams,aliases:e.aliases}))}async discoverFromFramework(){const e=this.config.discovery||{},t=[];try{const n=e.framework||this.detectFramework();let r=[];switch(n){case"react-router":r=this.discoverReactRouter();break;case"vue-router":r=this.discoverVueRouter();break;case"next":r=this.discoverNextRoutes();break;case"angular":r=this.discoverAngularRoutes();break;default:!1!==e.domFallback&&(r=this.discoverFromDOM(e.navSelectors))}for(const n of r){if(this.shouldExcludeRoute(n.path,e.excludePaths))continue;let r;r=e.transformRoute?e.transformRoute(n):this.defaultRouteTransform(n),r&&t.push(this.enhanceEntry(r,"discovery"))}console.log(`[SiteMapDiscovery] Discovered ${t.length} routes from ${n}`)}catch(e){return console.warn("[SiteMapDiscovery] Framework discovery failed:",e),{entries:[],source:"discovery",timestamp:Date.now(),error:String(e)}}return{entries:t,source:"discovery",timestamp:Date.now()}}detectFramework(){if("undefined"==typeof window)return"generic";const e=window;return e.__REACT_ROUTER_DATA_ROUTER__||e.__reactRouterContext?"react-router":e.__VUE_ROUTER__||e.__VUE_APP__?.$router?"vue-router":e.__NEXT_DATA__?"next":e.ng||document.querySelector("[ng-version]")?"angular":"generic"}discoverReactRouter(){const e=[];if("undefined"==typeof window)return e;const t=window.__REACT_ROUTER_DATA_ROUTER__;return t?.routes?(this.extractRoutesFromConfig(t.routes,e,""),e):e}extractRoutesFromConfig(e,t,n){for(const r of e){const e=this.normalizePath(n,r.path||""),a={path:e,name:r.handle?.name||r.handle?.title||r.id,meta:r.handle||{},children:[]};(r.path||r.index)&&t.push(a),r.children&&this.extractRoutesFromConfig(r.children,t,e)}}discoverVueRouter(){const e=[];if("undefined"==typeof window)return e;const t=window,n=t.__VUE_APP__,r=n?.$router||t.__VUE_ROUTER__;if(r?.getRoutes){const t=r.getRoutes();for(const n of t)e.push({path:n.path,name:n.name?.toString(),meta:n.meta||{},component:n.components?.default?.name})}return e}discoverNextRoutes(){const e=[];if("undefined"==typeof window)return e;const t=window.__NEXT_DATA__;if(!t)return e;const n=t.buildManifest?.pages||{};for(const t of Object.keys(n))t.startsWith("/_")||e.push({path:t,name:this.pathToName(t)});return e}discoverAngularRoutes(){return[]}discoverFromDOM(e){const t=[];if("undefined"==typeof document)return t;const n=e||["nav a[href]",'[role="navigation"] a[href]',".nav a[href]",".navigation a[href]",".sidebar a[href]",".menu a[href]","header a[href]"],r=new Set;for(const e of n)try{const n=document.querySelectorAll(e);for(const e of n){const n=e.getAttribute("href");if(!n)continue;if(n.startsWith("http")&&!n.startsWith(window.location.origin))continue;const a=n.startsWith("/")?n:`/${n}`;if(r.has(a)||a.startsWith("/#")||"/"===a||a.includes("javascript:"))continue;r.add(a);const o=a.split("?")[0].split("#")[0];t.push({path:o,name:e.textContent?.trim()||this.pathToName(o)})}}catch(e){}return t}async fetchFromBackend(){const e=this.config.backend||{},t=e.endpoint||"/api/external/sitemap";if(this.backendCache&&Date.now()<this.backendCache.expiresAt)return{entries:this.backendCache.entries,source:"backend",timestamp:this.backendCache.fetchedAt};try{const n=new URL(t,this.apiUrl);!1!==e.tenantScoped&&n.searchParams.set("tenantScoped","true"),!1!==e.includeGeneral&&n.searchParams.set("includeGeneral","true");const r=await fetch(n.toString(),{method:"GET",headers:{"X-API-Key":this.apiKey,"Content-Type":"application/json",...e.headers}});if(!r.ok)throw new Error(`Backend sitemap fetch failed: ${r.status}`);const a=await r.json(),o=this.transformBackendResponse(a),i=e.cacheTtl||3e5;return this.backendCache={entries:o,fetchedAt:Date.now(),expiresAt:Date.now()+i},console.log(`[SiteMapDiscovery] Loaded ${o.length} routes from backend`),{entries:o,source:"backend",timestamp:Date.now()}}catch(e){return console.warn("[SiteMapDiscovery] Backend fetch failed:",e),{entries:this.backendCache?.entries||[],source:"backend",timestamp:Date.now(),error:String(e)}}}transformBackendResponse(e){return(Array.isArray(e)?e:e.entries||e.sitemap||e.routes||[]).map(e=>this.enhanceEntry({path:e.url||e.path,name:e.title||e.name,description:e.description,aliases:e.keywords||e.aliases,params:e.params,dynamicParams:e.dynamicParams},"backend"))}mergeEntries(...e){const t=this.config.merge||{},n=t.sourcePriority||["props","backend","discovery"],r=t.deduplication||"path",a=new Map;n.forEach((e,t)=>{a.set(e,n.length-t)});const o=[];for(const t of e)for(const e of t){const t=a.get(e._source||"props")||0;o.push({...e,_priority:t})}o.sort((e,t)=>(t._priority||0)-(e._priority||0));const i=new Map;for(const e of o){let n;switch(r){case"name":n=e.name.toLowerCase();break;case"both":n=`${e.path}|${e.name.toLowerCase()}`;break;default:n=this.normalizePath("",e.path)}if(i.has(n)){if(!1!==t.keepNonConflicting){const t=i.get(n);!t.description&&e.description&&(t.description=e.description),!t.aliases?.length&&e.aliases?.length&&(t.aliases=e.aliases)}}else i.set(n,e)}return Array.from(i.values())}enhanceEntries(e,t){return e.map(e=>this.enhanceEntry(e,t))}enhanceEntry(e,t){return{...e,_source:t,_discoveredAt:Date.now()}}defaultRouteTransform(e){return e.path&&"*"!==e.path&&"**"!==e.path?{path:e.path,name:e.name||e.meta?.title||this.pathToName(e.path),description:e.meta?.description,aliases:e.meta?.keywords||e.meta?.aliases,dynamicParams:e.path.includes(":")||e.path.includes("[")}:null}normalizePath(e,t){return t&&"/"!==t?t.startsWith("/")?t:e&&"/"!==e?`${e}/${t}`.replace(/\/+/g,"/"):`/${t}`:e||"/"}pathToName(e){const t=e.split("/").filter(Boolean);return(t[t.length-1]||"Home").replace(/[-_]/g," ").replace(/\[.*?\]/g,"").replace(/:/g,"").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ").trim()||"Page"}shouldExcludeRoute(e,t){if(!t?.length)return!1;for(const n of t){if(new RegExp("^"+n.replace(/\*/g,".*").replace(/\?/g,".")+"$").test(e))return!0}return!1}async refresh(){this.backendCache=null,this.isInitialized=!1,this.initPromise=null,await this.initialize()}isReady(){return this.isInitialized}getStats(){return{static:this.staticEntries.length,discovered:this.discoveredEntries.length,backend:this.backendEntries.length,merged:this.getMergedEntries().length}}}const Fd={navigate:[{pattern:/^(go to|navigate to|take me to|open|show me|bring up)\s+(.+)/i,type:"navigate",weight:.9},{pattern:/^(i want to see|i need to go to|let me see)\s+(.+)/i,type:"navigate",weight:.85},{pattern:/^(where is|how do i get to)\s+(.+)/i,type:"navigate",weight:.6}],fillForm:[{pattern:/^(search for|find|look up|search)\s+(.+)/i,type:"fillForm",weight:.88},{pattern:/^(filter by|set .+ to|change .+ to)\s+(.+)/i,type:"fillForm",weight:.85},{pattern:/^(enter|type|put)\s+(.+)\s+(in|into)\s+(.+)/i,type:"fillForm",weight:.9}],clickElement:[{pattern:/^(click|press|hit|tap)\s+(the\s+)?(.+)\s+(button|link)/i,type:"clickElement",weight:.9},{pattern:/^(submit|send|confirm|save|cancel|delete)/i,type:"clickElement",weight:.85}],triggerModal:[{pattern:/^(open|show|display)\s+(the\s+)?(.+)\s+(modal|dialog|popup|window)/i,type:"triggerModal",weight:.9},{pattern:/^(open|show)\s+(help|settings|preferences|options)/i,type:"triggerModal",weight:.85}],scroll:[{pattern:/^(scroll to|jump to|go to)\s+(the\s+)?(.+)\s+(section|area|part)/i,type:"scroll",weight:.85},{pattern:/^(show me|take me to)\s+(the\s+)?(bottom|top|end|beginning)/i,type:"scroll",weight:.8}],highlight:[{pattern:/^(highlight|show me|point to|where is)\s+(the\s+)?(.+)/i,type:"highlight",weight:.7}],custom:[{pattern:/^(export|download|refresh|reload|sync)/i,type:"custom",weight:.85}]};class Od{constructor(e,t="",n=""){this.categories=[],this.topicKeywords=new Map,this.siteMapDiscovery=null,this.config=e,this.siteMapIndex=new Map,this.formIndex=new Map,this.modalIndex=new Map,this.buildIndexes(),e.siteMapConfig&&(this.siteMapDiscovery=new zd(e.siteMapConfig,t,n))}buildIndexes(){if(this.config.siteMap)for(const e of this.config.siteMap){const t=[e.name.toLowerCase(),e.path.toLowerCase(),...(e.aliases||[]).map(e=>e.toLowerCase())];for(const n of t)this.siteMapIndex.set(n,e)}if(this.config.forms)for(const[e,t]of Object.entries(this.config.forms)){const n=[e.toLowerCase(),t.name.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.formIndex.set(e,t)}if(this.config.modals)for(const[e,t]of Object.entries(this.config.modals)){const n=[e.toLowerCase(),t.id.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.modalIndex.set(e,t)}}classify(e){if(!this.config.enabled)return{action:null,shouldEscalate:!0,rawConfidence:0};const t=e.trim().toLowerCase();for(const[t,n]of Object.entries(Fd))for(const{pattern:r,weight:a}of n){const n=e.match(r);if(n){const e=this.buildAction(t,n,a);if(e)return e}}const n=this.fuzzyMatchSiteMap(t);if(n)return n;const r=this.matchCustomAction(t);return r||{action:null,shouldEscalate:!0,rawConfidence:0,matchedPatterns:[]}}buildAction(e,t,n){const r=this.config.confidenceThreshold??.8;switch(e){case"navigate":{const e=this.extractTarget(t),a=this.findSiteMapMatch(e);if(a){const e=n*a.similarity;return{action:{id:`action-${Date.now()}`,type:"navigate",target:a.entry.path,confidence:e,explanation:`Navigate to ${a.entry.name}`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["navigate",a.entry.name]}}break}case"fillForm":{const e=this.extractTarget(t),{field:a,value:o}=this.parseFormIntent(t);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:a.selector,params:{value:o},confidence:e,explanation:`Fill "${a.name}" with "${o}"`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["fillForm",a.name]}}if(this.config.forms?.search){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:this.config.forms.search.selector,params:{value:e},confidence:t,explanation:`Search for "${e}"`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["fillForm","search"]}}break}case"clickElement":{const e=this.extractTarget(t),a=this.findButtonSelector(e);if(a){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"clickElement",target:a,confidence:t,explanation:`Click "${e}" button`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["clickElement",e]}}break}case"triggerModal":{const e=this.extractTarget(t),a=this.findModalConfig(e);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"triggerModal",target:a.trigger,confidence:e,explanation:`Open ${a.id} modal`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["triggerModal",a.id]}}break}case"scroll":{const e=this.extractTarget(t),a=this.findScrollTarget(e);if(a){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"scroll",target:a,confidence:t,explanation:`Scroll to ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["scroll",e]}}break}case"highlight":{const e=this.extractTarget(t),a=this.findElementByDescription(e);if(a){const t=.85*n;return{action:{id:`action-${Date.now()}`,type:"highlight",target:a,confidence:t,explanation:`Highlight ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["highlight",e]}}break}case"custom":{const e=t[1]?.toLowerCase();if(this.config.customActions?.[e]){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"custom",target:e,confidence:t,explanation:`Execute ${e} action`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["custom",e]}}break}}return null}extractTarget(e){for(let t=e.length-1;t>=1;t--)if(e[t])return e[t].trim();return""}findSiteMapMatch(e){const t=e.toLowerCase().replace(/[^a-z0-9\s]/g,""),n=this.siteMapIndex.get(t);if(n)return{entry:n,similarity:1};let r=null,a=0;for(const[e,n]of this.siteMapIndex){const o=this.calculateSimilarity(t,e);o>a&&o>.6&&(a=o,r=n)}return r?{entry:r,similarity:a}:null}fuzzyMatchSiteMap(e){const t=this.config.confidenceThreshold??.8;for(const[n,r]of this.siteMapIndex)if(e.includes(n)){const e=.75;return{action:{id:`action-${Date.now()}`,type:"navigate",target:r.path,confidence:e,explanation:`Navigate to ${r.name}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["fuzzy-sitemap",n]}}return null}matchCustomAction(e){if(!this.config.customActions)return null;const t=this.config.confidenceThreshold??.8;for(const n of Object.keys(this.config.customActions))if(e.includes(n.toLowerCase())){const e=.85;return{action:{id:`action-${Date.now()}`,type:"custom",target:n,confidence:e,explanation:`Execute ${n}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["custom",n]}}return null}parseFormIntent(e){const t=e[0];for(const[,e]of this.formIndex)if(t.toLowerCase().includes(e.name.toLowerCase())){const n=t.match(new RegExp(`${e.name}[^a-z]*(.+)`,"i"));return{field:e,value:n?.[1]?.trim()||""}}return{field:null,value:this.extractTarget(e)}}findButtonSelector(e){const t=e.toLowerCase();if("undefined"==typeof document)return`button:contains("${e}")`;const n=[`[data-action="${t}"]`,`[aria-label*="${t}" i]`,`.btn-${t}`,`#${t}-button`,`button.${t}`];for(const e of n)try{if(document.querySelector(e))return e}catch{}const r=document.querySelectorAll('button, [role="button"], a.btn');for(const e of r)if(e.textContent?.toLowerCase().includes(t))return this.generateUniqueSelector(e);return null}findModalConfig(e){return this.modalIndex.get(e.toLowerCase())||null}findScrollTarget(e){const t=e.toLowerCase();if("top"===t||"beginning"===t)return"body";if("bottom"===t||"end"===t)return"body:last-child";if("undefined"==typeof document)return`#${t.replace(/\s+/g,"-")}`;const n=[`#${t.replace(/\s+/g,"-")}`,`[data-section="${t}"]`,`.${t.replace(/\s+/g,"-")}-section`,`section[aria-label*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}findElementByDescription(e){const t=e.toLowerCase();if("undefined"==typeof document)return`[aria-label*="${t}" i]`;const n=[`[aria-label*="${t}" i]`,`[data-testid*="${t}" i]`,`[title*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}generateUniqueSelector(e){if(e.id)return`#${e.id}`;if(e.getAttribute("data-testid"))return`[data-testid="${e.getAttribute("data-testid")}"]`;const t=[];let n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.className&&"string"==typeof n.className){const t=n.className.split(" ").filter(e=>e&&!e.includes(" "));t.length>0&&(e+=`.${t.slice(0,2).join(".")}`)}t.unshift(e),n=n.parentElement}return t.join(" > ")}calculateSimilarity(e,t){const n=new Set(e.split(/\s+/)),r=new Set(t.split(/\s+/)),a=new Set([...n].filter(e=>r.has(e))),o=new Set([...n,...r]);return a.size/o.size}getConfig(){return this.config}async trainFromExport(e){if(e.categories){this.categories=e.categories;for(const t of e.categories)for(const e of t.keywords){const n=this.topicKeywords.get(t.name)||[];n.push(e.toLowerCase()),this.topicKeywords.set(t.name,n)}}const t=this.extractTopicsFromDocuments(e.documents);for(const[e,n]of t){const t=this.topicKeywords.get(e)||[];t.push(...n),this.topicKeywords.set(e,[...new Set(t)])}e.sitemap&&this.loadSitemapEntries(e.sitemap),console.log(`[CyberneticIntentClassifier] Trained with ${this.categories.length} categories, ${this.topicKeywords.size} topics`)}async loadSitemap(e){if(e.enabled)if(e.sitemapData)this.loadSitemapEntries(e.sitemapData);else if(e.sitemapUrl)try{const t=await fetch(e.sitemapUrl);if(!t.ok)throw new Error(`Failed to fetch sitemap: ${t.status}`);const n=await t.json();this.loadSitemapEntries(n)}catch(e){console.error("[CyberneticIntentClassifier] Failed to load sitemap:",e)}}loadSitemapEntries(e){for(const t of e){const e={path:t.url,name:t.title,description:t.description,aliases:t.keywords},n=[t.title.toLowerCase(),t.url.toLowerCase(),...(t.keywords||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4);n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}console.log(`[CyberneticIntentClassifier] Loaded ${e.length} sitemap entries`)}extractTopicsFromDocuments(e){const t=new Map;for(const n of e){const e=n.title.toLowerCase(),r=[];n.metadata?.keywords&&r.push(...n.metadata.keywords.map(e=>e.toLowerCase()));const a=n.title.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>3&&!this.isStopWord(e));r.push(...a);const o=n.content.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e)),i=new Map;for(const e of o)i.set(e,(i.get(e)||0)+1);const s=[...i.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e])=>e);r.push(...s),t.set(e,[...new Set(r)])}return t}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very","can","just","dont","now","here","there","also","your","you"]).has(e)}getCategories(){return this.categories}getTopicKeywords(){return this.topicKeywords}isTrained(){return this.categories.length>0||this.topicKeywords.size>0}async initializeDiscovery(){if(this.siteMapDiscovery)try{await this.siteMapDiscovery.initialize(),this.rebuildIndexesFromDiscovery(),console.log(`[CyberneticIntentClassifier] Discovery complete, indexed ${this.siteMapIndex.size} entries`)}catch(e){console.error("[CyberneticIntentClassifier] Discovery initialization failed:",e)}else console.log("[CyberneticIntentClassifier] No siteMapConfig provided, skipping discovery")}rebuildIndexesFromDiscovery(){if(!this.siteMapDiscovery)return;const e=this.siteMapDiscovery.getLegacyEntries();this.siteMapIndex.clear();for(const t of e){const e={path:t.path,name:t.name,description:t.description,params:t.params,aliases:t.aliases},n=[t.name.toLowerCase(),t.path.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e));n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}}isSiteMapReady(){return this.siteMapDiscovery?this.siteMapDiscovery.isReady():this.siteMapIndex.size>0||(this.config.siteMap?.length??0)>0}async ensureSiteMapReady(){this.isSiteMapReady()||await this.initializeDiscovery()}async refreshSiteMap(){this.siteMapDiscovery?(await this.siteMapDiscovery.refresh(),this.rebuildIndexesFromDiscovery()):console.log("[CyberneticIntentClassifier] No siteMapConfig provided, cannot refresh")}getSiteMapDiscovery(){return this.siteMapDiscovery}getSiteMapEntries(){return this.siteMapDiscovery?this.siteMapDiscovery.getLegacyEntries():this.config.siteMap||[]}}class $d{constructor(e){this.highlightOverlay=null,this.actionCount=0,this.lastActionReset=Date.now(),this.config=e,this.classifier=new Od(e),"undefined"!=typeof document&&this.injectStyles()}interpretIntent(e){return this.classifier.classify(e)}async executeAction(e){const t=Date.now();t-this.lastActionReset>6e4&&(this.actionCount=0,this.lastActionReset=t);const n=this.config.maxActionsPerTurn??5;if(this.actionCount>=n)return{success:!1,message:`Rate limit exceeded. Maximum ${n} actions per minute.`};if(!this.isActionAllowed(e))return{success:!1,message:`Action type "${e.type}" is not allowed`};switch(this.actionCount++,e.type){case"navigate":return this.navigate(e.target,e.params);case"fillForm":return this.fillForm(e.target,e.params?.value);case"clickElement":return this.clickElement(e.target);case"triggerModal":return this.triggerModal(e.target);case"scroll":return this.scrollToElement(e.target);case"highlight":return this.highlightElement(e.target);case"custom":return this.executeCustomAction(e.target,e.params);default:return{success:!1,message:`Unknown action type: ${e.type}`}}}isActionAllowed(e){const t=this.config.allowedActions;if(!t)return!0;const n={navigate:"navigate",fillForm:"fill",clickElement:"click",scroll:"scroll",highlight:"click",triggerModal:"click",custom:"click"}[e.type];return t.includes(n)}isSelectorAllowed(e){if(this.config.blockedSelectors)for(const t of this.config.blockedSelectors)if(e.includes(t))return!1;return!(this.config.allowedSelectors&&this.config.allowedSelectors.length>0)||this.config.allowedSelectors.some(t=>e.includes(t))}async navigate(e,t){try{if(!this.validateNavigationUrl(e))return{success:!1,message:"Invalid or blocked URL"};let n=e;if(t){const e=new URLSearchParams;for(const[n,r]of Object.entries(t))null!=r&&e.set(n,String(r));const r=e.toString();r&&(n+=(n.includes("?")?"&":"?")+r)}return"undefined"==typeof window?{success:!0,message:`Navigation to ${e} would be executed (server-side)`}:this.isInternalUrl(n)?this.tryClientSideNavigation(n)?{success:!0,message:`Navigated to ${e}`}:(window.location.href=n,{success:!0,message:`Navigating to ${e}...`}):(window.open(n,"_blank","noopener,noreferrer"),{success:!0,message:`Opened ${n} in new tab`})}catch(e){return{success:!1,message:"Navigation failed",error:String(e)}}}async fillForm(e,t){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const n=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Form fill would set "${n}" to "${t}" (server-side)`};try{const e=document.querySelector(n);if(!e)return{success:!1,message:`Element not found: ${n}`};if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return{success:!1,message:"Element is not a form field"};if(e.focus(),e instanceof HTMLSelectElement){const n=Array.from(e.options).find(e=>e.value.toLowerCase()===t.toLowerCase()||e.text.toLowerCase()===t.toLowerCase());if(!n)return{success:!1,message:`Option "${t}" not found`};e.value=n.value}else e.value=t;e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}));const r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;return r&&e instanceof HTMLInputElement&&(r.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),{success:!0,message:`Filled field with "${t}"`}}catch(e){return{success:!1,message:"Failed to fill form field",error:String(e)}}}async clickElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const t=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Click on "${t}" would be executed (server-side)`};try{const e=document.querySelector(t);return e?e instanceof HTMLElement?(e.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300),e.click(),{success:!0,message:"Element clicked"}):{success:!1,message:"Element is not clickable"}:{success:!1,message:`Element not found: ${t}`}}catch(e){return{success:!1,message:"Failed to click element",error:String(e)}}}async triggerModal(e){return this.clickElement(e)}async scrollToElement(e){if("undefined"==typeof window)return{success:!0,message:`Scroll to "${e}" would be executed (server-side)`};try{if("body"===e)return window.scrollTo({top:0,behavior:"smooth"}),{success:!0,message:"Scrolled to top"};if("body:last-child"===e)return window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"}),{success:!0,message:"Scrolled to bottom"};const t=document.querySelector(e);return t?(t.scrollIntoView({behavior:"smooth",block:"start"}),{success:!0,message:"Scrolled to element"}):{success:!1,message:`Element not found: ${e}`}}catch(e){return{success:!1,message:"Failed to scroll",error:String(e)}}}async highlightElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};if("undefined"==typeof document)return{success:!0,message:`Highlight on "${e}" would be shown (server-side)`};try{const t=document.querySelector(e);if(!t)return{success:!1,message:`Element not found: ${e}`};this.removeHighlight(),t.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300);const n=t.getBoundingClientRect(),r=document.createElement("div");return r.className="astermind-highlight-overlay",r.style.cssText=`\n position: fixed;\n top: ${n.top-4}px;\n left: ${n.left-4}px;\n width: ${n.width+8}px;\n height: ${n.height+8}px;\n border: 3px solid #4F46E5;\n border-radius: 4px;\n pointer-events: none;\n z-index: 999999;\n animation: astermind-highlight-pulse 1s ease-in-out 3;\n `,document.body.appendChild(r),this.highlightOverlay=r,setTimeout(()=>this.removeHighlight(),3e3),{success:!0,message:"Element highlighted"}}catch(e){return{success:!1,message:"Failed to highlight element",error:String(e)}}}async executeCustomAction(e,t){if(!this.isAllowedCustomAction(e))return{success:!1,message:`Custom action "${e}" not found`};const n=this.config.customActions[e];try{return await n(t)}catch(t){return{success:!1,message:`Custom action "${e}" failed`,error:String(t)}}}isInternalUrl(e){if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return!0;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!0}}tryClientSideNavigation(e){if("undefined"==typeof window)return!1;try{return window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate")),e.includes("#")&&window.dispatchEvent(new HashChangeEvent("hashchange")),!0}catch{return!1}}validateNavigationUrl(e){if(/^(javascript|data):/i.test(e))return!1;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin||e.startsWith("/")}catch{return e.startsWith("/")}}sanitizeSelector(e){return e.replace(/[<>'"]/g,"").replace(/javascript:/gi,"").replace(/data:/gi,"").trim()}isAllowedCustomAction(e){return void 0!==this.config.customActions&&Object.prototype.hasOwnProperty.call(this.config.customActions,e)}removeHighlight(){this.highlightOverlay&&(this.highlightOverlay.remove(),this.highlightOverlay=null)}injectStyles(){if("undefined"==typeof document)return;if(document.getElementById("astermind-agent-styles"))return;const e=document.createElement("style");e.id="astermind-agent-styles",e.textContent="\n @keyframes astermind-highlight-pulse {\n 0%, 100% {\n box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);\n }\n 50% {\n box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);\n }\n }\n\n .astermind-highlight-overlay {\n transition: all 0.2s ease-out;\n }\n ",document.head.appendChild(e)}sleep(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return this.config}getClassifier(){return this.classifier}resetActionCount(){this.actionCount=0,this.lastActionReset=Date.now()}}const jd={hiddenUnits:50,activation:"relu",ridgeLambda:.01,weightInit:"xavier",seed:1337,dropout:0,log:{verbose:!0,toFile:!1,modelName:"Unnamed ELM Model",level:"info"}};function Ud(e){let t=0,n=0;for(;0===t;)t=e();for(;0===n;)n=e();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*n)}Object.assign(Object.assign({},jd),{useTokenizer:!1}),Object.assign(Object.assign({},jd),{useTokenizer:!0,maxLen:30,charSet:"abcdefghijklmnopqrstuvwxyz",tokenizerDelimiter:/\s+/});class Bd{constructor(e,t,n=1e-4){this.p=e,this.m=t,this.lambda=n,this.Ainv=new Float64Array(e*e),this.Beta=new Float64Array(e*t);const r=1/Math.max(1e-12,n);for(let t=0;t<e;t++)this.Ainv[t*e+t]=r}update(e,t){const{p:n,m:r,Ainv:a,Beta:o}=this,i=new Float64Array(n);for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}let s=1;for(let t=0;t<n;t++)s+=e[t]*i[t];s=Math.max(s,1e-12);const l=1/s;for(let e=0;e<n;e++){const t=i[e]*l;for(let r=0;r<n;r++)a[e*n+r]-=t*i[r]}for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}for(let e=0;e<n;e++){const n=i[e];for(let a=0;a<r;a++)o[e*r+a]+=n*t[a]}}predict(e){const{p:t,m:n,Beta:r}=this,a=new Float64Array(n);for(let o=0;o<n;o++){let i=0;for(let a=0;a<t;a++)i+=e[a]*r[a*n+o];a[o]=i}return a}}function Vd(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(Math.max(0,t))}function Wd(e,t){var n,r;const a=Math.min(e.length,t.length);if(0===a)return 0;let o=0,i=0,s=0;for(let l=0;l<a;l++){const a=null!==(n=e[l])&&void 0!==n?n:0,c=null!==(r=t[l])&&void 0!==r?r:0;o+=a*c,i+=a*a,s+=c*c}const l=o/Math.sqrt(Math.max(i*s,1e-12));return Number.isFinite(l)?l:0}function Hd(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,s)}l((r=r.apply(e,t||[])).next())})}function Kd(e){return e.replace(/\s+/g," ").split(/(?<=[.?!])\s+/).map(e=>e.trim()).filter(e=>e.length>8&&/\w/.test(e))}function qd(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[[^\]]*\]\([^)]*\)/g,"").replace(/[-–>•→]/g," ").replace(/\s+/g," ").trim()}function Gd(e,t){return Hd(this,arguments,void 0,function*(e,t,n={}){if(!(null==t?void 0:t.length))return"No results found.";const{dim:r=64,features:a=32,sigma:o=1,rounds:i=3,topSentences:s=8,personality:l="neutral"}=n;let c=Kd(t.map(e=>qd(e.content)).join(" ")).filter(e=>!function(e){return/^(\*|#)/.test(e)||/chapter/i.test(e)||/part\s*\d+/i.test(e)||/section/i.test(e)||/^\s*[A-Z]\)\s*$/.test(e)||e.length<15}(e)).slice(0,120);if(0===c.length)return qd(t[0].content).slice(0,400);const u=function(e,t,n=1,r=Math.random){const a=new Float64Array(t*e),o=new Float64Array(t),i=1/Math.max(1e-12,n);for(let n=0;n<t*e;n++)a[n]=Ud(r)*i;for(let e=0;e<t;e++)o[e]=2*r()*Math.PI;return{W:a,b:o,D:t,d:e,sigma:n}}(r,a,o),d=new Bd(2*a,1,.001),f=e=>{const t=new Float64Array(r),n=Math.min(e.length,r);for(let r=0;r<n;r++)t[r]=e.charCodeAt(r)/255;return function(e,t){const{W:n,b:r,D:a,d:o}=e,i=new Float64Array(2*a);for(let e=0;e<a;e++){let s=r[e];const l=e*o;for(let e=0;e<o;e++)s+=n[l+e]*(t[e]||0);i[e]=Math.cos(s),i[a+e]=Math.sin(s)}let s=0;for(let e=0;e<i.length;e++)s+=i[e]*i[e];const l=1/Math.sqrt(Math.max(s,1e-12));for(let e=0;e<i.length;e++)i[e]*=l;return i}(u,function(e,t=1e-12){const n=Vd(e);if(!(n>t&&Number.isFinite(n)))return new Float64Array(e.length);const r=new Float64Array(e.length),a=1/n;for(let t=0;t<e.length;t++)r[t]=e[t]*a;return r}(t))},h=f(e),p=e.toLowerCase().split(/\W+/).filter(e=>e.length>2),m=c.map(e=>{const t=f(e);let n=Wd(t,h);const r=e.toLowerCase();for(const e of p)r.includes(e)&&(n+=.02);return{s:e,v:t,w:n}});m.sort((e,t)=>t.w-e.w);let g=m.slice(0,s).map(e=>e.s).join(" "),y=new Float64Array(2*a);for(let e=0;e<i;e++){const e=Kd(g).slice(0,s),t=e.map(e=>f(e)),n=t.map(e=>Wd(e,h));for(let e=0;e<t.length;e++)d.update(t[e],new Float64Array([n[e]]));y.fill(0);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<r.length;e++)y[e]+=r[e]*a}const r=Vd(y)||1;for(let e=0;e<y.length;e++)y[e]/=r;const a=e.map(e=>({s:e,w:Wd(f(e),y)}));a.sort((e,t)=>t.w-e.w),g=a.slice(0,Math.max(3,Math.floor(s/2))).map(e=>e.s).join(" ")}g=function(e){return e.replace(/\s+[-–>•→]\s+/g," ").replace(/\s+\.\s+/g,". ").replace(/([a-z]) - ([a-z])/gi,"$1-$2").replace(/\s{2,}/g," ").trim()}(g);return`${"teacher"===l?"Here’s a simple way to think about it:\n\n":"scientist"===l?"From the retrieved material, we can infer:\n\n":""}${g.charAt(0).toUpperCase()+g.slice(1)}\n\n(${t[0].heading||"Answer"}, Ω-synthesized)`})}function Qd(e,t){let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function Yd(e,t,n,r){if("cosine"===n){const n=Qd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Qd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}function Xd(e,t,n,r,a){const o=function(e,t){const n=new Float64Array(t);for(const[t,r]of e)n[t]=r;return n}(e,t),i=new Float64Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i[e]=Yd(o,t,r,a)}const s=Math.hypot(...i);if(s>0)for(let e=0;e<i.length;e++)i[e]/=s;return i}"function"==typeof SuppressedError&&SuppressedError;const Jd=new Map;function Zd(e){const t=e,n=Jd.get(t);if(n)return n;let r=e.toLowerCase();if(r=r.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g,""),r.length<=2)return Jd.set(t,r),r;r.endsWith("ies")&&r.length>4?r=r.slice(0,-3)+"y":/(xes|ches|shes|zes|sses)$/.test(r)&&r.length>4?r=r.replace(/(xes|ches|shes|zes|sses)$/,e=>"sses"===e?"ss":e.replace(/es$/,"")):r.endsWith("s")&&!/(ss|us)$/.test(r)&&r.length>3&&(r=r.slice(0,-1));const a=[[/ization$|isation$/,"ize"],[/ational$/,"ate"],[/fulness$/,"ful"],[/ousness$/,"ous"],[/iveness$/,"ive"],[/ability$/,"able"],[/ness$/,""],[/ment$/,""],[/ations?$/,"ate"],[/izer$|iser$/,"ize"],[/ally$/,"al"],[/ically$/,"ic"],[/ingly$|edly$/,""],[/ing$|ed$/,""]];for(const[e,t]of a)if(e.test(r)&&r.length-t.length>=4){r=r.replace(e,t);break}return Jd.set(t,r),r}function ef(e,t){const n=Array.from(e,(e,t)=>t);return n.sort((t,n)=>e[n]-e[t]),n.slice(0,t)}function tf(e){const{query:t,chunks:n,vocabMap:r,idf:a,tfidfDocs:o,denseDocs:i,landmarksIdx:s,landmarkMat:l,vocabSize:c,kernel:u,sigma:d,alpha:f,beta:h,ridge:p,headingW:m,useStem:g,expandQuery:y,topK:v,prefilter:b}=e,w=y?function(e){const t=[];return/\bmap\b/.test(e)&&t.push("dict key value make"),/\bchan|channel\b/.test(e)&&t.push("goroutine concurrency select buffer"),/\berror\b/.test(e)&&t.push("fmt wrap unwrap sentinel try catch"),/\bstruct\b/.test(e)&&t.push("field method receiver init zero value"),e+" "+t.join(" ")}(t):t,k=function(e,t){const n=e.toLowerCase().replace(/[`*_>~]/g," ").replace(/[^a-z0-9]+/g," ").split(/\s+/).filter(Boolean);if(!t)return n;const r=[];for(const e of n){const t=Zd(e);t&&t.length>1&&r.push(t)}return r}(w,g),S=function(e,t,n,r=1){const a=new Map;for(let t=0;t<e.length;t++){const o=e[t],i=n.get(o);if(void 0===i)continue;const s=t<8?r:1;a.set(i,(a.get(i)||0)+s)}const o=Math.max(1,...a.values()),i=new Map;for(const[e,n]of a){const r=.5+n/o*.5;i.set(e,r*(t[e]||0))}return i}(k,a,r,m),x=Xd(S,c,l,u,d),C=o.map(e=>function(e,t){let n=0,r=0,a=0;for(const[a,o]of e){r+=o*o;const e=t.get(a);e&&(n+=o*e)}for(const[,e]of t)a+=e*e;return r&&a?n/(Math.sqrt(r)*Math.sqrt(a)):0}(e,S)),E=i.map(e=>function(e,t,n,r){if("cosine"===n){const n=Qd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Qd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}(e,x,u,d)),_=function(e,t){const n=Array.from(new Set(t.toLowerCase().split(/\W+/).filter(e=>e.length>2))),r=/\b(define|declare|syntax|example|function|struct|map|interface)\b/i.test(t);return e.map(e=>{const t=e.rich||e.content||"",a=t.toLowerCase();let o=0;for(const e of n)a.includes(e)&&o++;return r&&/```/.test(t)&&(o+=5),Math.min(1,.03*o)})}(n,t),M=function(e,t,n){return Math.max(t,Math.min(n,e))}(f,0,1),R=null!=p?p:.08,A=E.map((e,t)=>{const n=C[t],r=h*_[t],a=1/(1+R*(e*e+n*n+.5*r*r))*(M*e+(1-M)*n+r);return Math.tanh(a)}),P=Math.max(v,null!=b?b:0),L=ef(A,P),T=ef(L.map(e=>A[e]),v).map(e=>L[e]);return{items:T.map(e=>{const t=n[e],r=t.rich&&t.rich.trim()||t.content&&t.content.trim()||"(see subsections)";return{score:A[e],heading:t.heading,content:r,index:e}}),scores:T.map(e=>A[e]),indices:T,tfidfScores:T.map(e=>C[e]),denseScores:T.map(e=>E[e])}}const nf=new Set(["a","an","the","and","or","but","if","then","else","for","to","of","in","on","at","by","with","is","are","was","were","be","been","being","as","from","that","this","it","its","you","your","i","we","they","he","she","them","his","her","our","us","do","does","did","done","not","no","yes","can","could","should","would","may","might","into","about","over","under","between"]);function rf(e){return e.toLowerCase().replace(/[`*_#>~=\[\]{}()!?.:,;'"<>|/\\+-]+/g," ").split(/\s+/).filter(e=>e&&!nf.has(e))}function af(e){const t=new Map,n=[],r=[];let a=0;for(const o of e){const e=rf(o);r.push(e.length);const i=new Map;for(const n of e){let e=t.get(n);void 0===e&&(e=a++,t.set(n,e)),i.set(e,(i.get(e)||0)+1)}n.push(i)}const o=e.length,i=Array(a).fill(0);for(const e of n)for(const t of e.keys())i[t]+=1;const s=i.map(e=>Math.log((o+1)/(e+1))+1),l=r.reduce((e,t)=>e+t,0)/Math.max(1,o);return{stats:{vocab:t,idf:s,avgLen:l,df:i},tf:n,docLens:r}}function of(e,t){const n=new Map;let r=0;for(const[a,o]of e){const e=o*(t[a]||0);n.set(a,e),r+=e*e}const a=Math.sqrt(r)||1e-12;for(const[e,t]of n)n.set(e,t/a);return n}function sf(e,t){const[n,r]=e.size<t.size?[e,t]:[t,e];let a=0;for(const[e,t]of n){const n=r.get(e);void 0!==n&&(a+=t*n)}return a}function lf(e,t,n=1337){const r=new Float64Array(t);for(const[n,a]of e){let e=2654435761*n>>>0;for(let n=0;n<t;n++){e^=e<<13,e^=e>>>17,e^=e<<5;const t=(e>>>0)/4294967296*2-1;r[n]+=a*t}}let a=0;for(let e=0;e<t;e++)a+=r[e]*r[e];const o=Math.sqrt(a)||1e-12;for(let e=0;e<t;e++)r[e]/=o;return r}function cf(e){return/```+\s*go([\s\S]*?)```/i.test(e)||/\bfunc\s+\w+\s*\(.*\)\s*\w*\s*{/.test(e)}function uf(e){return/```+/.test(e)||/{[^}]*}/.test(e)}function df(e,t){const n=(r=rf(e),Array.from(new Set(r)));var r;const a=new Set(rf(t));if(0===n.length||0===a.size)return 0;let o=0;for(const e of n)a.has(e)&&o++;return o/n.length}function ff(e,t,n,r,a,o,i,s,l,c){var u;const d=[],f=[],h=sf(n,r);d.push(h),f.push("cosine_tfidf");const p=function(e,t,n,r,a=1.5,o=.75){let i=0;for(const[s]of e){const e=t.get(s)||0;e<=0||(i+=Math.log(((n.df[s]||0)+.5)/(n.idf.length-(n.df[s]||0)+.5)+1)*(e*(a+1)/(e+a*(1-o+o*(r/(n.avgLen||1)))||1e-12)))}return i}(a,o,i,s);d.push(p),f.push("bm25");const m=df(t.heading||"",e);d.push(m),f.push("heading_match_frac");const g=function(e,t){const n=new Set(rf(e)),r=new Set(rf(t));let a=0;for(const e of n)r.has(e)&&a++;const o=n.size+r.size-a;return 0===o?0:a/o}(e,t.content||"");d.push(g),f.push("jaccard_tokens");const y=cf(t.rich||t.content||""),v=uf(t.rich||t.content||"");var b;d.push(y?1:0),f.push("flag_go_code"),d.push(v?1:0),f.push("flag_any_code"),d.push((b=t.content||"",!/(golang\.org|go\.dev|pkg\.go\.dev)/i.test(b)?0:1)),f.push("flag_go_spec_link"),d.push(null!==(u=t.score_base)&&void 0!==u?u:0),f.push("prior_score_base");const w=(t.content||"").length;if(d.push(1/Math.sqrt(1+w)),f.push("len_inv_sqrt"),l&&c){let e=0,t=0;for(let n=0;n<l.length;n++)e+=l[n]*c[n],t+=Math.abs(l[n]-c[n]);d.push(e),f.push("proj_dot"),d.push(t/l.length),f.push("proj_l1mean")}return{names:f,values:d}}class hf{constructor(){this.w=null,this.mu=null,this.sigma=null}fit(e,t,n=.01){var r;const a=e.length,o=(null===(r=e[0])||void 0===r?void 0:r.length)||0;if(0===a||0===o)return void(this.w=new Float64Array(o));const i=new Float64Array(o),s=new Float64Array(o);for(let t=0;t<o;t++){let n=0;for(let r=0;r<a;r++)n+=e[r][t];n/=a,i[t]=n;let r=0;for(let o=0;o<a;o++){const a=e[o][t]-n;r+=a*a}s[t]=Math.sqrt(r/a)||1}const l=Array.from({length:a},(e,t)=>new Float64Array(o));for(let t=0;t<a;t++)for(let n=0;n<o;n++)l[t][n]=(e[t][n]-i[n])/s[n];const c=Array.from({length:o},()=>new Float64Array(o)),u=new Float64Array(o);for(let e=0;e<a;e++){const n=l[e],r=t[e];for(let e=0;e<o;e++){u[e]+=n[e]*r;const t=n[e];for(let r=0;r<=e;r++)c[e][r]+=t*n[r]}}for(let e=0;e<o;e++){for(let t=0;t<e;t++)c[t][e]=c[e][t];c[e][e]+=n}const d=Array.from({length:o},()=>new Float64Array(o));for(let e=0;e<o;e++)for(let t=0;t<=e;t++){let n=c[e][t];for(let r=0;r<t;r++)n-=d[e][r]*d[t][r];d[e][t]=e===t?Math.sqrt(Math.max(n,1e-12)):n/(d[t][t]||1e-12)}const f=new Float64Array(o);for(let e=0;e<o;e++){let t=u[e];for(let n=0;n<e;n++)t-=d[e][n]*f[n];f[e]=t/(d[e][e]||1e-12)}const h=new Float64Array(o);for(let e=o-1;e>=0;e--){let t=f[e];for(let n=e+1;n<o;n++)t-=d[n][e]*h[n];h[e]=t/(d[e][e]||1e-12)}this.w=h,this.mu=i,this.sigma=s}predict(e){if(!this.w||!this.mu||!this.sigma)return 0;let t=0;for(let n=0;n<this.w.length;n++){const r=(e[n]-this.mu[n])/this.sigma[n];t+=this.w[n]*r}return t}}function pf(e,t,n){var r;const a=t.rich||t.content||"";let o=0;/\bgo\b/.test(e.toLowerCase())&&/(define|declare|function|func)/i.test(e)&&cf(a)&&(o=Math.max(o,1));df(t.heading||"",e)>=.34&&uf(a)&&(o=Math.max(o,.8));const i=n.names.indexOf("cosine_tfidf"),s=n.names.indexOf("bm25"),l=i>=0?n.values[i]:0,c=s>=0?n.values[s]:0;l>.25&&(o=Math.max(o,.6)),c>1&&(o=Math.max(o,.6));const u=n.names.indexOf("prior_score_base"),d=u>=0?n.values[u]:0;return(null!==(r=t.score_base)&&void 0!==r?r:0)>0&&(o=Math.max(o,Math.min(.6,.2+.5*d))),o}function mf(e,t,n={}){var r,a;const{lambdaRidge:o=.01,randomProjDim:i=32,exposeFeatures:s=!0,attachFeatureNames:l=!1}=n,c=[e,...t.map(e=>e.content||"")],{stats:u,tf:d,docLens:f}=af(c),h=d.map(e=>of(e,u.idf)),p=d[0],m=h[0],g=i>0?lf(m,i):void 0,y=[],v=[],b=[];for(let n=0;n<t.length;n++){const r=t[n],a=d[n+1],o=h[n+1],s=i>0?lf(o,i,1337+n):void 0,l=ff(e,r,m,o,p,a,u,f[n+1]||1,g,s);b.push(l),y.push(l.values);const c=pf(e,r,l);v.push(c)}const w=v.every(e=>Math.abs(e-v[0])<1e-9);if(w){const e=b[0].names.indexOf("cosine_tfidf");if(e>=0)for(let t=0;t<v.length;t++)v[t]=Math.max(0,Math.min(1,.2+.6*y[t][e]))}const k=new hf;k.fit(y,v,o);let S=1/0,x=-1/0;const C=y.map(e=>k.predict(e));for(const e of C)e<S&&(S=e),e>x&&(x=e);const E=Math.max(1e-9,x-S),_=l?null!==(a=null===(r=b[0])||void 0===r?void 0:r.names)&&void 0!==a?a:[]:void 0,M=t.map((e,t)=>{const n=(C[t]-S)/E,r=function(e){if(e>=0)return 1/(1+Math.exp(-e));{const t=Math.exp(e);return t/(1+t)}}((C[t]-.5*(S+x))/(.2*E+1e-6)),a=Object.assign(Object.assign({},e),{score_rr:n,p_relevant:r});return s&&(a._features=y[t]),_&&(a._feature_names=_),a});return M.sort((e,t)=>t.score_rr-e.score_rr),M}function gf(e,t={}){const{probThresh:n=.45,epsilonTop:r=.05,useMMR:a=!0,mmrLambda:o=.7,budgetChars:i=1200}=t;if(0===e.length)return[];const s=e[0].score_rr,l=e.filter(e=>e.p_relevant>=n&&e.score_rr>=s-r),c=l.length>0?l:[e[0]];if(!a){const e=[];let t=0;for(const n of c){const r=(n.content||"").length;if(t+r>i&&e.length>0)break;e.push(n),t+=r}return e}return function(e,t=.7,n=1200){const r=[],a=e.map(e=>e.content||""),{stats:o,tf:i}=af(a),s=i.map(e=>of(e,o.idf)),l=new Set;let c=0;for(;l.size<e.length;){let a=-1,o=-1/0;for(let n=0;n<e.length;n++){if(l.has(n))continue;const r=e[n];let i=0;for(const e of l){const t=sf(s[n],s[e]);t>i&&(i=t)}const c=t*r.score_rr-(1-t)*i;c>o&&(o=c,a=n)}if(a<0)break;const i=e[a],u=(i.content||"").length;if(c+u>n&&r.length>0)break;r.push(i),c+=u,l.add(a)}return r}(e.map(e=>Object.assign(Object.assign({},e),{score_rr:c.includes(e)?e.score_rr+.01:e.score_rr})),o,i)}var yf=Object.freeze({__proto__:null,OmegaOfflineRAG:class{constructor(e){this.modelState=null,this.model=null,this.config={reranking:{enabled:e?.reranking?.enabled??!0,lambdaRidge:e?.reranking?.lambdaRidge??.1,useMMR:e?.reranking?.useMMR??!0,mmrLambda:e?.reranking?.mmrLambda??.5,probThresh:e?.reranking?.probThresh??.1},topK:e?.topK??5,verbose:e?.verbose??!1}}async loadModel(e){const t=performance.now();if(this.model=e,this.modelState=function(e){if("astermind-pro-v1"!==e.version&&"astermind-elm-v1"!==e.version)throw new Error(`Unsupported model version: ${e.version}. Expected 'astermind-pro-v1' or 'astermind-elm-v1'`);const t=JSON.parse(JSON.stringify(e.settings||{})),n=new Map(e.vocab),r=Float64Array.from(e.idf),a=e.chunks.map(e=>({heading:e.heading,content:e.content||"",rich:e.rich,level:e.level,secId:e.secId})),o=e.tfidfDocs.map(e=>{const t=new Map;for(const[n,r]of e)t.set(n,r);return t}),i=Array.from(e.landmarksIdx),s=e.landmarkMat.map(e=>Float64Array.from(e));let l;if(!e.denseDocs||e.denseDocs.length!==o.length)throw new Error("recomputeDense=true but buildDense function not provided");return l=e.denseDocs.map(e=>Float64Array.from(e)),{settings:t,vocabMap:n,idf:r,chunks:a,tfidfDocs:o,landmarksIdx:i,landmarkMat:s,denseDocs:l}}(e),this.config.verbose){const e=performance.now()-t;console.log(`[OmegaOfflineRAG] Model loaded in ${e.toFixed(0)}ms`),console.log(`[OmegaOfflineRAG] ${this.modelState.chunks.length} chunks, ${this.modelState.vocabMap.size} vocab`)}}async loadModelFromUrl(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch model from ${e}: ${t.status}`);const n=await t.json();await this.loadModel(n)}isReady(){return null!==this.modelState}getModelInfo(){return this.model&&this.modelState?{version:this.model.version,savedAt:this.model.savedAt,documentCount:this.modelState.chunks.length,vocabularySize:this.modelState.vocabMap.size,landmarkCount:this.modelState.landmarksIdx.length,hasDenseVectors:this.modelState.denseDocs.length>0,settings:this.model.settings}:null}async ask(e){const t=performance.now();if(!this.modelState||!this.model)return{answer:"Omega model not loaded. Please load a model first.",confidence:"none",sources:[],processingTime:0,degraded:!0,degradedReason:"Model not loaded"};try{const n=this.model.settings,r=n.kernel??"rbf",a=n.sigma??1,o=n.alpha??.5,i=n.beta??.3,s=n.ridge??.001,l=n.headingW??.2,c=n.useStem??!0,u=n.expandQuery??!1,d=n.prefilter??100,f=tf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:r,sigma:a,alpha:o,beta:i,ridge:s,headingW:l,useStem:c,expandQuery:u,topK:2*this.config.topK,prefilter:d});let h;if(this.config.reranking.enabled&&f.items.length>0){const t=function(e,t,n={}){return gf(mf(e,t,n),n)}(e,f.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score_base:f.scores[t]})),{lambdaRidge:this.config.reranking.lambdaRidge,useMMR:this.config.reranking.useMMR,mmrLambda:this.config.reranking.mmrLambda,probThresh:this.config.reranking.probThresh});h=t.slice(0,this.config.topK).map(e=>({heading:e.heading,content:e.content,rich:e.rich,score:e.score_base??0,rerankScore:e.score_rr,probability:e.p_relevant}))}else h=f.items.slice(0,this.config.topK).map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:f.scores[t]}));const p=await Gd(e,h.map(e=>({heading:e.heading,content:e.content,score:e.score}))),m=performance.now()-t,g=h[0]?.score??0,y=this.determineConfidence(g,h.length);return{answer:p,confidence:y,sources:h,processingTime:m,degraded:!1,queryClassification:this.classifyQuery(e)}}catch(e){const n=performance.now()-t;return console.error("[OmegaOfflineRAG] Error during retrieval:",e),{answer:"An error occurred while processing your question offline.",confidence:"none",sources:[],processingTime:n,degraded:!0,degradedReason:e instanceof Error?e.message:"Unknown error"}}}async retrieve(e,t){if(!this.modelState||!this.model)return[];const n=t??this.config.topK,r=this.model.settings,a=r.kernel??"rbf",o=r.sigma??1,i=r.alpha??.5,s=r.beta??.3,l=r.ridge??.001,c=r.headingW??.2,u=r.useStem??!0,d=r.expandQuery??!1,f=r.prefilter??100,h=tf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:a,sigma:o,alpha:i,beta:s,ridge:l,headingW:c,useStem:u,expandQuery:d,topK:n,prefilter:f});return h.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:h.scores[t]}))}classifyQuery(e){const t=e.toLowerCase(),n=t.split(/\s+/),r=["what","who","when","where","which","is","are","was","were"],a=["how","steps","guide","tutorial","process","procedure"],o=["why","explain","describe","meaning","definition","concept"],i=["go to","navigate","find","page","link","take me","show me"];let s="unknown",l=.5;const c=[];for(const e of i)if(t.includes(e)){s="navigational",l=.8,c.push(e);break}if("unknown"===s){const e=n[0];a.includes(e)||a.some(e=>t.includes(e))?(s="procedural",l=.7,c.push(...a.filter(e=>t.includes(e)))):o.includes(e)||o.some(e=>t.includes(e))?(s="conceptual",l=.7,c.push(...o.filter(e=>t.includes(e)))):r.includes(e)&&(s="factual",l=.7,c.push(e))}return{type:s,confidence:l,keywords:c}}determineConfidence(e,t){return 0===t?"none":e>=.7||e>=.4?"medium":"low"}clear(){this.modelState=null,this.model=null}}});function vf({onClick:e,position:t,unreadCount:n=0}){return od.jsxs("button",{className:`astermind-bubble astermind-bubble--${t}`,onClick:e,"aria-label":"Open chat",type:"button",children:[od.jsx("svg",{className:"astermind-bubble__icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:od.jsx("path",{d:"M21 11.5C21.0034 12.8199 20.6951 14.1219 20.1 15.3C19.3944 16.7118 18.3098 17.8992 16.9674 18.7293C15.6251 19.5594 14.0782 19.9994 12.5 20C11.1801 20.0035 9.87812 19.6951 8.7 19.1L3 21L4.9 15.3C4.30493 14.1219 3.99656 12.8199 4 11.5C4.00061 9.92179 4.44061 8.37488 5.27072 7.03258C6.10083 5.69028 7.28825 4.6056 8.7 3.90003C9.87812 3.30496 11.1801 2.99659 12.5 3.00003H13C15.0843 3.11502 17.053 3.99479 18.5291 5.47089C20.0052 6.94699 20.885 8.91568 21 11V11.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n>0&&od.jsx("span",{className:"astermind-bubble__badge",children:n})]})}function bf({title:e,subtitle:t,onClose:n,children:r}){return od.jsxs("div",{className:"astermind-header",children:[od.jsxs("div",{className:"astermind-header__info",children:[od.jsx("h3",{className:"astermind-header__title",children:e}),t&&od.jsx("p",{className:"astermind-header__subtitle",children:t})]}),od.jsxs("div",{className:"astermind-header__actions",children:[r,od.jsx("button",{className:"astermind-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:od.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:od.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]})}function wf(e){if(!e)return"";return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\n/g,"<br />")}function kf(){return od.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[od.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),od.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Sf(){return od.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[od.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),od.jsx("polyline",{points:"7 10 12 15 17 10"}),od.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function xf({source:e,showSummaryButton:t,showDownloadButton:n,onViewSummary:r,onDownload:a}){const[o,i]=j.useState(!1);return od.jsxs("div",{className:"astermind-source",children:[od.jsxs("div",{className:"astermind-source__header",children:[od.jsx("span",{className:"astermind-source__title",children:e.documentName||e.title}),od.jsxs("div",{className:"astermind-source__actions",children:[t&&od.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),e.fullContent&&i(!o),r?.(e)},title:"View summary","aria-label":"View source summary",children:od.jsx(kf,{})}),n&&od.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),a?.(e)},title:"Download source","aria-label":"Download source file",children:od.jsx(Sf,{})}),od.jsxs("span",{className:"astermind-source__relevance",children:[Math.round(100*e.relevance),"%"]})]})]}),od.jsx("p",{className:"astermind-source__snippet",children:e.snippet}),o&&e.fullContent&&od.jsx("div",{className:"astermind-source__full-content",dangerouslySetInnerHTML:{__html:wf(e.fullContent)}})]})}function Cf({sources:e,config:t={},isOnline:n=!0,onViewSummary:r,onDownload:a}){const{enabled:o=!0,showSummary:i=!0,showDownload:s=!0}=t;return o&&0!==e.length?od.jsx("div",{className:"astermind-sources",children:e.map((e,t)=>{const o=i&&!!e.fullContent,l=s&&n&&!!e.downloadUrl;return od.jsx(xf,{source:e,showSummaryButton:o,showDownloadButton:l,onViewSummary:r,onDownload:a},e.chunkId||e.documentId||t)})}):null}function Ef(e){const t=new Date,n=t.getTime()-e.getTime();if(n<6e4)return"Just now";if(n<36e5){return`${Math.floor(n/6e4)}m ago`}return e.toDateString()===t.toDateString()?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})}function _f({message:e,sourceConfig:t,isOnline:n=!0,onViewSourceSummary:r,onDownloadSource:a}){const[o,i]=j.useState(!1);return od.jsxs("div",{className:`astermind-message astermind-message--${e.role}`,children:[od.jsx("div",{className:"astermind-message__bubble",children:e.isStreaming&&!e.content?od.jsxs("span",{className:"astermind-message__typing",children:[od.jsx("span",{}),od.jsx("span",{}),od.jsx("span",{})]}):od.jsx("div",{className:"astermind-message__content",dangerouslySetInnerHTML:{__html:wf(e.content)}})}),od.jsxs("div",{className:"astermind-message__meta",children:[od.jsx("span",{className:"astermind-message__time",children:Ef(e.timestamp)}),e.offline&&od.jsx("span",{className:"astermind-message__offline",title:"Offline response",children:"offline"}),e.confidence&&"high"!==e.confidence&&od.jsx("span",{className:`astermind-message__confidence astermind-message__confidence--${e.confidence}`,title:`Confidence: ${e.confidence}`,children:e.confidence})]}),e.sources&&e.sources.length>0&&od.jsxs("div",{className:"astermind-message__sources",children:[od.jsxs("button",{className:"astermind-message__sources-toggle",onClick:()=>i(!o),type:"button",children:[o?"Hide":"Show"," sources (",e.sources.length,")"]}),o&&od.jsx(Cf,{sources:e.sources,config:t,isOnline:n,onViewSummary:r,onDownload:a})]})]})}function Mf(){return od.jsxs("div",{className:"astermind-typing",children:[od.jsx("span",{}),od.jsx("span",{}),od.jsx("span",{})]})}function Rf({messages:e,isProcessing:t,sourceConfig:n,isOnline:r=!0,onViewSourceSummary:a,onDownloadSource:o}){const i=j.useRef(null);return j.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]),od.jsxs("div",{className:"astermind-messages",ref:i,children:[e.map(e=>od.jsx(_f,{message:e,sourceConfig:n,isOnline:r,onViewSourceSummary:a,onDownloadSource:o},e.id)),t&&""===e[e.length-1]?.content&&od.jsx(Mf,{})]})}function Af({placeholder:e,disabled:t=!1,onSend:n}){const[r,a]=j.useState(""),o=j.useRef(null),i=()=>{r.trim()&&!t&&(n(r.trim()),a(""),o.current?.focus())};return od.jsxs("div",{className:"astermind-input",children:[od.jsx("textarea",{ref:o,className:"astermind-input__textarea",value:r,onChange:e=>{const t=e.target;a(t.value),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),i())},placeholder:e,disabled:t,rows:1,"aria-label":"Message input"}),od.jsx("button",{className:"astermind-input__send",onClick:i,disabled:t||!r.trim(),"aria-label":"Send message",type:"button",children:od.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:od.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})}function Pf({action:e,onConfirm:t,onCancel:n}){return od.jsxs("div",{className:"astermind-action-card",children:[od.jsxs("div",{className:"astermind-action-card__header",children:[od.jsx("div",{className:"astermind-action-card__icon",children:(e=>{switch(e){case"navigate":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),od.jsx("polyline",{points:"15,3 21,3 21,9"}),od.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]});case"fillForm":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),od.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"clickElement":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M15 15l-2 5L9 9l11 4-5 2z"}),od.jsx("path",{d:"M15 15l5 5"})]});default:return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("circle",{cx:"12",cy:"12",r:"10"}),od.jsx("polyline",{points:"12,6 12,12 16,14"})]})}})(e.type)}),od.jsxs("div",{className:"astermind-action-card__title",children:[od.jsx("span",{className:"astermind-action-card__label",children:(e=>{switch(e){case"navigate":return"Navigate to";case"fillForm":return"Fill form field";case"clickElement":return"Click";case"triggerModal":return"Open modal";case"scroll":return"Scroll to";case"highlight":return"Highlight";case"custom":return"Execute action";default:return"Perform action"}})(e.type)}),od.jsx("span",{className:"astermind-action-card__target",children:e.target})]})]}),e.explanation&&od.jsx("p",{className:"astermind-action-card__explanation",children:e.explanation}),od.jsxs("div",{className:"astermind-action-card__confidence",children:[od.jsx("div",{className:"astermind-action-card__confidence-bar",style:{width:100*e.confidence+"%"}}),od.jsxs("span",{children:[Math.round(100*e.confidence),"% confident"]})]}),od.jsxs("div",{className:"astermind-action-card__actions",children:[od.jsx("button",{className:"astermind-action-card__cancel",onClick:n,type:"button",children:"Cancel"}),od.jsx("button",{className:"astermind-action-card__confirm",onClick:t,type:"button",children:"Confirm"})]})]})}function Lf({status:e}){return od.jsxs("div",{className:`astermind-status astermind-status--${e}`,children:[od.jsx("span",{className:"astermind-status__dot"}),od.jsx("span",{className:"astermind-status__label",children:(()=>{switch(e){case"online":return"Online";case"offline":return"Offline";case"connecting":return"Connecting...";case"error":return"Error";default:return"Unknown"}})()})]})}function Tf({messages:e,isProcessing:t,connectionStatus:n,pendingAction:r,headerTitle:a,headerSubtitle:o,placeholder:i,showPoweredBy:s,sourceConfig:l,onClose:c,onSendMessage:u,onActionConfirm:d,onActionCancel:f,onViewSourceSummary:h,onDownloadSource:p}){const m="online"===n;return od.jsxs("div",{className:"astermind-window",children:[od.jsx(bf,{title:a,subtitle:o,onClose:c,children:od.jsx(Lf,{status:n})}),od.jsxs("div",{className:"astermind-window__body",children:[od.jsx(Rf,{messages:e,isProcessing:t,sourceConfig:l,isOnline:m,onViewSourceSummary:h,onDownloadSource:p}),r&&od.jsx(Pf,{action:r,onConfirm:()=>d(r),onCancel:f})]}),od.jsxs("div",{className:"astermind-window__footer",children:[od.jsx(Af,{placeholder:i,disabled:t||"error"===n,onSend:u}),s&&od.jsxs("div",{className:"astermind-powered-by",children:["Powered by ",od.jsx("a",{href:"https://astermind.ai",target:"_blank",rel:"noopener noreferrer",children:"AsterMind"})]})]})]})}const Nf={primaryColor:"#4F46E5",primaryHover:"#4338CA",backgroundColor:"#ffffff",surfaceColor:"#f3f4f6",textColor:"#1f2937",textMuted:"#6b7280",borderColor:"#e5e7eb",userBubbleBackground:"#4F46E5",userBubbleText:"#ffffff",botBubbleBackground:"#f3f4f6",botBubbleText:"#1f2937",widgetWidth:"380px",widgetHeight:"75vh",bubbleSize:"60px",borderRadius:"12px",fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSize:"14px",shadow:"0 4px 20px rgba(0, 0, 0, 0.15)"};const Df=j.createContext(null);function If({theme:e,children:t}){const n=function(e){const t=j.useMemo(()=>({...Nf,...e}),[e]),n=j.useMemo(()=>({"--astermind-primary":t.primaryColor,"--astermind-primary-hover":t.primaryHover,"--astermind-background":t.backgroundColor,"--astermind-surface":t.surfaceColor,"--astermind-text":t.textColor,"--astermind-text-muted":t.textMuted,"--astermind-border":t.borderColor,"--astermind-user-bg":t.userBubbleBackground,"--astermind-user-text":t.userBubbleText,"--astermind-bot-bg":t.botBubbleBackground,"--astermind-bot-text":t.botBubbleText,"--astermind-widget-width":t.widgetWidth,"--astermind-widget-height":t.widgetHeight,"--astermind-bubble-size":t.bubbleSize,"--astermind-border-radius":t.borderRadius,"--astermind-font-family":t.fontFamily,"--astermind-font-size":t.fontSize,"--astermind-shadow":t.shadow}),[t]);return{theme:t,cssVariables:n}}(e);return od.jsx(Df.Provider,{value:n,children:od.jsx("div",{style:n.cssVariables,children:t})})}function zf(e){const r=j.useMemo(()=>function(){let e="",t="https://api.astermind.ai";try{n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("astermind-chatbot.min.js",document.baseURI).href}catch{}if(!e&&"undefined"!=typeof process&&process.env&&(e=process.env.REACT_APP_ASTERMIND_RAG_API_KEY||e,t=process.env.REACT_APP_ASTERMIND_RAG_API_SERVER_URL||t),"undefined"!=typeof window){const n=window.__ASTERMIND_CONFIG__;n&&"object"==typeof n&&(e=n.apiKey||e,t=n.apiUrl||t)}return{apiKey:e,apiUrl:t}}(),[]),{apiKey:a,apiUrl:o,throwOnMissingKey:i=!0,position:s="bottom-right",theme:l={},greeting:c="Hi! How can I help you today?",placeholder:u="Type your message...",agent:d,fallback:f={enabled:!0},sourceDisplay:h,showPoweredBy:p=!0,headerTitle:m="AsterMind",headerSubtitle:g="AI Assistant",defaultOpen:y=!1,zIndex:v=9999,onReady:b,onMessage:w,onAction:k,onError:S,onToggle:x}=e,C=a||r.apiKey,E=o||r.apiUrl,[_,M]=j.useState(y),[R,A]=j.useState(null),[P,L]=j.useState([]),[T,N]=j.useState(!1),[D,I]=j.useState(),[z,F]=j.useState(),[O,$]=j.useState("connecting"),U=d?.siteMapConfig?.discovery?.enabled??!1,{entries:B}=function(e={}){const{enabled:n=!0,transformRoute:r,excludePaths:a=[],navSelectors:o,disableDomFallback:i=!1}=e,[s,l]=t.useState({entries:[],isDiscovering:!1,error:null,framework:null}),c=t.useRef(!1),u=t.useRef(e);u.current=e;const d=t.useCallback(()=>{if("undefined"==typeof window)return"generic";const e=window;return e.__REACT_ROUTER_DATA_ROUTER__||e.__reactRouterContext?"react-router":e.__VUE_ROUTER__||e.__VUE_APP__?.$router?"vue-router":e.__NEXT_DATA__?"next":e.ng||document.querySelector("[ng-version]")?"angular":"generic"},[]),f=t.useCallback(e=>{const t=u.current.excludePaths||[];for(const n of t)if(new RegExp("^"+n.replace(/\*/g,".*")+"$").test(e))return!0;return!1},[]),h=t.useCallback(e=>{const t=e.split("/").filter(Boolean);return(t[t.length-1]||"Home").replace(/[-_:]/g," ").replace(/\[.*?\]/g,"").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ").trim()||"Page"},[]),p=t.useCallback(e=>e.path&&"*"!==e.path&&"**"!==e.path?{path:e.path,name:e.name||e.meta?.title||h(e.path),description:e.meta?.description,aliases:e.meta?.keywords||e.meta?.aliases,dynamicParams:e.path.includes(":")||e.path.includes("[")}:null,[h]),m=t.useCallback((e,t,n)=>{for(const r of e){let e=r.path||"";e&&!e.startsWith("/")?e=n?`${n}/${e}`.replace(/\/+/g,"/"):`/${e}`:!e&&n&&(e=n);const a={path:e,name:r.handle?.name||r.handle?.title||r.id,meta:r.handle||{}};r.path&&!f(e)&&t.push(a),r.children&&m(r.children,t,e)}},[f]),g=t.useCallback(()=>{if("undefined"==typeof document)return[];const e=u.current.navSelectors||["nav a[href]",'[role="navigation"] a[href]',".nav a[href]",".sidebar a[href]",".menu a[href]","header a[href]"],t=[],n=new Set;for(const r of e)try{const e=document.querySelectorAll(r);for(const r of e){const e=r.getAttribute("href");if(!e||e.startsWith("http")||e.startsWith("javascript:"))continue;const a=(e.startsWith("/")?e:`/${e}`).split("?")[0].split("#")[0];n.has(a)||"/"===a||f(a)||(n.add(a),t.push({path:a,name:r.textContent?.trim()||h(a)}))}}catch(e){}return t},[f,h]),y=t.useCallback(()=>{if(n&&"undefined"!=typeof window){l(e=>({...e,isDiscovering:!0,error:null}));try{const e=d(),t=[],n=window;if("react-router"===e&&n.__REACT_ROUTER_DATA_ROUTER__?.routes)m(n.__REACT_ROUTER_DATA_ROUTER__.routes,t,"");else if("vue-router"===e){const e=n.__VUE_APP__?.$router||n.__VUE_ROUTER__;if(e?.getRoutes)for(const n of e.getRoutes())f(n.path)||t.push({path:n.path,name:n.name?.toString(),meta:n.meta||{}})}else if("next"===e&&n.__NEXT_DATA__?.buildManifest?.pages)for(const e of Object.keys(n.__NEXT_DATA__.buildManifest.pages))e.startsWith("/_")||f(e)||t.push({path:e,name:h(e)});0!==t.length||i||t.push(...g());const r=u.current.transformRoute||p,a=[];for(const e of t){const t=r(e);t&&a.push(t)}l({entries:a,isDiscovering:!1,error:null,framework:e}),c.current=!0,console.log(`[useSiteMapDiscovery] Discovered ${a.length} routes from ${e}`)}catch(e){console.warn("[useSiteMapDiscovery] Discovery failed:",e),l(t=>({...t,isDiscovering:!1,error:String(e)}))}}},[n,d,m,g,p,f,h,i]);return t.useEffect(()=>{if(!n||c.current)return;const e=setTimeout(y,100);return()=>clearTimeout(e)},[n,y]),t.useEffect(()=>{if(!n||"undefined"==typeof window)return;const e=()=>{setTimeout(y,50)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[n,y]),{...s,refresh:y}}({enabled:U,excludePaths:d?.siteMapConfig?.discovery?.excludePaths,transformRoute:d?.siteMapConfig?.discovery?.transformRoute,navSelectors:d?.siteMapConfig?.discovery?.navSelectors,disableDomFallback:!1===d?.siteMapConfig?.discovery?.domFallback}),V=j.useMemo(()=>{const e=d?.siteMap||d?.siteMapConfig?.static||[],t=[...e],n=new Set(e.map(e=>e.path.toLowerCase()));for(const e of B)n.has(e.path.toLowerCase())||t.push(e);return t},[d?.siteMap,d?.siteMapConfig?.static,B]),W=j.useMemo(()=>{const e=R?.getSourcesConfig?.()||{};return{enabled:h?.enabled??e.enabled??!0,showSummary:h?.showSummary??e.showSummary??!0,showDownload:h?.showDownload??e.showDownload??!0}},[R,h]),H=j.useCallback(e=>{console.log("[AsterMind] View source summary:",e.title)},[]),K=j.useCallback(async e=>{if(e.downloadUrl)try{const t=e.downloadUrl.startsWith("http")?e.downloadUrl:`${E}${e.downloadUrl}`,n=await fetch(t,{headers:{"X-API-Key":C}});if(!n.ok)return void console.error("[AsterMind] Download failed:",n.status,n.statusText);const r=n.headers.get("Content-Disposition");let a=e.documentName||e.title||"download";if(r){const e=r.match(/filename="?(.+?)"?$/);e&&(a=e[1])}const o=await n.blob(),i=window.URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=a,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(i),document.body.removeChild(s)}catch(e){console.error("[AsterMind] Download error:",e)}else console.warn("[AsterMind] No download URL for source:",e.title)},[E,C]);j.useEffect(()=>{if(!C){const e='AsterMind API key is required. Configure using one of these methods:\n 1. Pass apiKey prop: <ChatbotWidget apiKey="am_..." />\n 2. Set VITE_ASTERMIND_RAG_API_KEY environment variable (Vite)\n 3. Set REACT_APP_ASTERMIND_RAG_API_KEY environment variable (CRA)\n 4. Set window.__ASTERMIND_CONFIG__ = { apiKey: "am_...", apiUrl: "..." }';if(i)throw new Error(e);console.warn("[AsterMind] "+e)}},[C,i]);const q=j.useMemo(()=>{if(d?.enabled)return{enabled:!0,confidenceThreshold:d.confidenceThreshold??.8,siteMap:V,siteMapConfig:d.siteMapConfig,customActions:d.customActions,requireConfirmation:!0}},[d,V]);j.useEffect(()=>{if(!C)return;const e=new Id({apiUrl:E,apiKey:C,fallback:{enabled:f?.enabled??!0,cacheOnConnect:!0},agentic:q,onStatusChange:e=>{$(e)},onError:e=>{S?.(new Error(e.message))}});if(q?.enabled){!function(e){const t={agent:$d,intentClassifier:Od};e.registerAgentic(t)}(e);const t=q.siteMap?.length??0;console.log(`[AsterMind] Agentic capabilities enabled with ${t} sitemap entries`),U&&console.log("[AsterMind] Sitemap auto-discovery enabled")}if(A(e),c){const e={id:"greeting",role:"assistant",content:c,timestamp:new Date};L([e])}return b?.(),()=>{}},[C,E,f?.enabled,q,c,S,b,U]);const G=j.useCallback(()=>{const e=!_;M(e),x?.(e)},[_,x]),Q=j.useCallback(()=>{M(!1),x?.(!1)},[x]),Y=j.useCallback(async e=>{if(!R||!e.trim()||T)return;const t={id:`user-${Date.now()}`,role:"user",content:e.trim(),timestamp:new Date};if(L(e=>[...e,t]),w?.(t),N(!0),R.isAgenticEnabled())try{const t=await R.smartAsk(e,{sessionId:D});if(t.action&&!t.response){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action.params,confidence:t.action.confidence,explanation:t.action.explanation,status:"pending"};return F(e),k?.(e),void N(!1)}if(t.actionResult){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action?.params,confidence:t.action.confidence,explanation:t.action?.explanation,status:t.actionResult.success?"executed":"failed",result:t.actionResult},n={id:`assistant-${Date.now()}`,role:"assistant",content:t.actionResult.success?`✓ ${t.action?.explanation||"Action completed"}`:`✗ ${t.actionResult.message}`,timestamp:new Date,isStreaming:!1};return L(e=>[...e,n]),k?.(e),void N(!1)}if(t.response){const e={id:`assistant-${Date.now()}`,role:"assistant",content:t.response.reply,timestamp:new Date,sources:t.response.sources,confidence:t.response.confidence,offline:t.response.offline,isStreaming:!1};return L(t=>[...t,e]),I(t.response.sessionId),w?.(e),void N(!1)}}catch(e){console.error("[AsterMind] smartAsk error, falling back to standard ask:",e)}const n=`assistant-${Date.now()}`,r={id:n,role:"assistant",content:"",timestamp:new Date,isStreaming:!0};L(e=>[...e,r]);try{let t="";await R.askStream(e,{onToken:e=>{t+=e,L(e=>e.map(e=>e.id===n?{...e,content:t}:e))},onSources:e=>{L(t=>t.map(t=>t.id===n?{...t,sources:e}:t))},onComplete:e=>{const t={id:n,role:"assistant",content:e.reply,timestamp:new Date,sources:e.sources,confidence:e.confidence,offline:e.offline,isStreaming:!1};L(e=>e.map(e=>e.id===n?t:e)),I(e.sessionId),w?.(t)},onError:()=>{X(R,e,n)}},{sessionId:D})}catch{const e={id:n,role:"assistant",content:"I encountered an error processing your request. Please try again.",timestamp:new Date,isStreaming:!1};L(t=>t.map(t=>t.id===n?e:t)),S?.(new Error("Failed to process message"))}finally{N(!1)}},[R,T,D,w,S,k]),X=async(e,t,n)=>{try{const r=await e.ask(t,{sessionId:D}),a={id:n,role:"assistant",content:r.reply,timestamp:new Date,sources:r.sources,confidence:r.confidence,offline:r.offline,isStreaming:!1};L(e=>e.map(e=>e.id===n?a:e)),I(r.sessionId),w?.(a)}catch{const e={id:n,role:"assistant",content:"I'm having trouble connecting. Please try again later.",timestamp:new Date,isStreaming:!1};L(t=>t.map(t=>t.id===n?e:t))}},J=j.useCallback(async e=>{if(!R)return;const t={...e,status:"confirmed"};F(t);try{const t=await R.executeAction({id:e.id,type:e.type,target:e.target,confidence:e.confidence,params:e.params}),n={...e,status:t.success?"executed":"failed",result:t},r={id:`assistant-${Date.now()}`,role:"assistant",content:t.success?`✓ ${e.explanation||t.message}`:`✗ ${t.message}${t.error?`: ${t.error}`:""}`,timestamp:new Date,isStreaming:!1};L(e=>[...e,r]),F(void 0),k?.(n)}catch(t){const n={...e,status:"failed",result:{success:!1,message:"Failed to execute action",error:String(t)}},r={id:`assistant-${Date.now()}`,role:"assistant",content:`✗ Failed to execute action: ${String(t)}`,timestamp:new Date,isStreaming:!1};L(e=>[...e,r]),F(void 0),k?.(n)}},[z,R,k]),Z=j.useCallback(()=>{if(!z)return;const e={...z,status:"cancelled"};F(void 0),k?.(e)},[z,k]);return od.jsx(If,{theme:l,children:od.jsxs("div",{className:`astermind-chatbot astermind-chatbot--${s}`,style:{zIndex:v},children:[!_&&od.jsx(vf,{onClick:G,position:s}),_&&od.jsx(Tf,{messages:P,isProcessing:T,connectionStatus:O,pendingAction:z,headerTitle:m,headerSubtitle:g,placeholder:u,showPoweredBy:p,sourceConfig:W,onClose:Q,onSendMessage:Y,onActionConfirm:J,onActionCancel:Z,onViewSourceSummary:H,onDownloadSource:K})]})})}let Ff=null;function Of(e){const t=function(){if("undefined"==typeof document)return{};const e=document.querySelector("script[data-astermind-key]");if(!e)return{};const t={},n=e.getAttribute("data-astermind-key");n&&(t.apiKey=n);const r=e.getAttribute("data-astermind-url");r&&(t.apiUrl=r);const a=e.getAttribute("data-astermind-position");a&&["bottom-right","bottom-left","top-right","top-left"].includes(a)&&(t.position=a);const o=e.getAttribute("data-astermind-greeting");o&&(t.greeting=o);const i=e.getAttribute("data-astermind-title");i&&(t.headerTitle=i);const s=e.getAttribute("data-astermind-subtitle");return s&&(t.headerSubtitle=s),"true"===e.getAttribute("data-astermind-auto-open")&&(t.defaultOpen=!0),t}(),n={...t,...function(){if("undefined"==typeof window)return{};const e=window.astermindConfig;return e&&"object"==typeof e?e:{}}(),...e||{}},{container:r=document.body,...a}=n;a.apiKey||console.warn('[AsterMindChatbot] No API key found. Configure using one of these methods:\n 1. AsterMindChatbot.init({ apiKey: "am_..." })\n 2. window.astermindConfig = { apiKey: "am_..." }\n 3. <script data-astermind-key="am_..." ...>\n 4. Set VITE_ASTERMIND_RAG_API_KEY environment variable (if bundled)');const o="string"==typeof r?document.querySelector(r):r;if(!o)return void console.error("[AsterMindChatbot] Container not found:",r);const i=document.createElement("div");i.id="astermind-chatbot-root",o.appendChild(i),Ff=Gu(i),Ff.render(U.createElement(zf,a)),console.log("[AsterMindChatbot] Initialized")}function $f(){Ff&&(Ff.unmount(),Ff=null);const e=document.getElementById("astermind-chatbot-root");e&&e.remove(),console.log("[AsterMindChatbot] Destroyed")}function jf(){return null!==Ff}return"undefined"!=typeof window&&(window.AsterMindChatbot={init:Of,destroy:$f,isInitialized:jf}),e.destroy=$f,e.init=Of,e.isInitialized=jf,e}({},react$1);
21
21
  //# sourceMappingURL=astermind-chatbot.min.js.map