diff --git a/dist/assets/index-BlgdGsnZ.js b/dist/assets/index-CQocmVDK.js similarity index 51% rename from dist/assets/index-BlgdGsnZ.js rename to dist/assets/index-CQocmVDK.js index d1f5615..a5beed6 100644 --- a/dist/assets/index-BlgdGsnZ.js +++ b/dist/assets/index-CQocmVDK.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Qp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pc={exports:{}},_o={},jc={exports:{}},Y={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Jp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tc={exports:{}},Po={},$c={exports:{}},Y={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ol=Symbol.for("react.element"),Kp=Symbol.for("react.portal"),Yp=Symbol.for("react.fragment"),Jp=Symbol.for("react.strict_mode"),Gp=Symbol.for("react.profiler"),Xp=Symbol.for("react.provider"),Zp=Symbol.for("react.context"),qp=Symbol.for("react.forward_ref"),eh=Symbol.for("react.suspense"),th=Symbol.for("react.memo"),nh=Symbol.for("react.lazy"),Za=Symbol.iterator;function rh(e){return e===null||typeof e!="object"?null:(e=Za&&e[Za]||e["@@iterator"],typeof e=="function"?e:null)}var Rc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tc=Object.assign,$c={};function cr(e,t,n){this.props=e,this.context=t,this.refs=$c,this.updater=n||Rc}cr.prototype.isReactComponent={};cr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)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")};cr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Mc(){}Mc.prototype=cr.prototype;function js(e,t,n){this.props=e,this.context=t,this.refs=$c,this.updater=n||Rc}var Rs=js.prototype=new Mc;Rs.constructor=js;Tc(Rs,cr.prototype);Rs.isPureReactComponent=!0;var qa=Array.isArray,Oc=Object.prototype.hasOwnProperty,Ts={current:null},zc={key:!0,ref:!0,__self:!0,__source:!0};function Fc(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Oc.call(t,r)&&!zc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,pe=R[Z];if(0>>1;Zl(Rn,b))ltl(Tn,Rn)?(R[Z]=Tn,R[lt]=b,Z=lt):(R[Z]=Rn,R[ht]=b,Z=ht);else if(ltl(Tn,b))R[Z]=Tn,R[lt]=b,Z=lt;else break e}}return O}function l(R,O){var b=R.sortIndex-O.sortIndex;return b!==0?b:R.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var s=[],u=[],h=1,v=null,y=3,S=!1,E=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(R){for(var O=n(u);O!==null;){if(O.callback===null)r(u);else if(O.startTime<=R)r(u),O.sortIndex=O.expirationTime,t(s,O);else break;O=n(u)}}function C(R){if(k=!1,d(R),!E)if(n(s)!==null)E=!0,T(P);else{var O=n(u);O!==null&&H(C,O.startTime-R)}}function P(R,O){E=!1,k&&(k=!1,m(F),F=-1),S=!0;var b=y;try{for(d(O),v=n(s);v!==null&&(!(v.expirationTime>O)||R&&!q());){var Z=v.callback;if(typeof Z=="function"){v.callback=null,y=v.priorityLevel;var pe=Z(v.expirationTime<=O);O=e.unstable_now(),typeof pe=="function"?v.callback=pe:v===n(s)&&r(s),d(O)}else r(s);v=n(s)}if(v!==null)var kt=!0;else{var ht=n(u);ht!==null&&H(C,ht.startTime-O),kt=!1}return kt}finally{v=null,y=b,S=!1}}var M=!1,z=null,F=-1,B=5,A=-1;function q(){return!(e.unstable_now()-AR||125Z?(R.sortIndex=b,t(u,R),n(s)===null&&R===n(u)&&(k?(m(F),F=-1):k=!0,H(C,b-Z))):(R.sortIndex=pe,t(s,R),E||S||(E=!0,T(P))),R},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(R){var O=y;return function(){var b=y;y=O;try{return R.apply(this,arguments)}finally{y=b}}}})(Bc);Uc.exports=Bc;var hh=Uc.exports;/** + */(function(e){function t(R,z){var b=R.length;R.push(z);e:for(;0>>1,pe=R[Z];if(0>>1;Zl(Rn,b))ltl(Tn,Rn)?(R[Z]=Tn,R[lt]=b,Z=lt):(R[Z]=Rn,R[ht]=b,Z=ht);else if(ltl(Tn,b))R[Z]=Tn,R[lt]=b,Z=lt;else break e}}return z}function l(R,z){var b=R.sortIndex-z.sortIndex;return b!==0?b:R.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){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 a=[],u=[],h=1,v=null,y=3,S=!1,E=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(R){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=R)r(u),z.sortIndex=z.expirationTime,t(a,z);else break;z=n(u)}}function C(R){if(k=!1,d(R),!E)if(n(a)!==null)E=!0,T(P);else{var z=n(u);z!==null&&H(C,z.startTime-R)}}function P(R,z){E=!1,k&&(k=!1,m(F),F=-1),S=!0;var b=y;try{for(d(z),v=n(a);v!==null&&(!(v.expirationTime>z)||R&&!q());){var Z=v.callback;if(typeof Z=="function"){v.callback=null,y=v.priorityLevel;var pe=Z(v.expirationTime<=z);z=e.unstable_now(),typeof pe=="function"?v.callback=pe:v===n(a)&&r(a),d(z)}else r(a);v=n(a)}if(v!==null)var kt=!0;else{var ht=n(u);ht!==null&&H(C,ht.startTime-z),kt=!1}return kt}finally{v=null,y=b,S=!1}}var M=!1,O=null,F=-1,B=5,A=-1;function q(){return!(e.unstable_now()-AR||125Z?(R.sortIndex=b,t(u,R),n(a)===null&&R===n(u)&&(k?(m(F),F=-1):k=!0,H(C,b-Z))):(R.sortIndex=pe,t(a,R),E||S||(E=!0,T(P))),R},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(R){var z=y;return function(){var b=y;y=z;try{return R.apply(this,arguments)}finally{y=b}}}})(bc);Wc.exports=bc;var yh=Wc.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var mh=g,Ye=hh;function j(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mi=Object.prototype.hasOwnProperty,gh=/^[: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]*$/,tu={},nu={};function vh(e){return Mi.call(nu,e)?!0:Mi.call(tu,e)?!1:gh.test(e)?nu[e]=!0:(tu[e]=!0,!1)}function yh(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function wh(e,t,n,r){if(t===null||typeof t>"u"||yh(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ie(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ne[e]=new Ie(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ne[t]=new Ie(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ne[e]=new Ie(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ne[e]=new Ie(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){Ne[e]=new Ie(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ne[e]=new Ie(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ne[e]=new Ie(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ne[e]=new Ie(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ne[e]=new Ie(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ms=/[\-:]([a-z])/g;function Os(e){return e[1].toUpperCase()}"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(Ms,Os);Ne[t]=new Ie(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(Ms,Os);Ne[t]=new Ie(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(Ms,Os);Ne[t]=new Ie(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ne[e]=new Ie(e,1,!1,e.toLowerCase(),null,!1,!1)});Ne.xlinkHref=new Ie("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ne[e]=new Ie(e,1,!1,e.toLowerCase(),null,!0,!0)});function zs(e,t,n,r){var l=Ne.hasOwnProperty(t)?Ne[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oi=Object.prototype.hasOwnProperty,Sh=/^[: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]*$/,lu={},ou={};function xh(e){return Oi.call(ou,e)?!0:Oi.call(lu,e)?!1:Sh.test(e)?ou[e]=!0:(lu[e]=!0,!1)}function kh(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Eh(e,t,n,r){if(t===null||typeof t>"u"||kh(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ie(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ne[e]=new Ie(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ne[t]=new Ie(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ne[e]=new Ie(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ne[e]=new Ie(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){Ne[e]=new Ie(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ne[e]=new Ie(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ne[e]=new Ie(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ne[e]=new Ie(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ne[e]=new Ie(e,5,!1,e.toLowerCase(),null,!1,!1)});var Fs=/[\-:]([a-z])/g;function Is(e){return e[1].toUpperCase()}"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(Fs,Is);Ne[t]=new Ie(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(Fs,Is);Ne[t]=new Ie(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(Fs,Is);Ne[t]=new Ie(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ne[e]=new Ie(e,1,!1,e.toLowerCase(),null,!1,!1)});Ne.xlinkHref=new Ie("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ne[e]=new Ie(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ds(e,t,n,r){var l=Ne.hasOwnProperty(t)?Ne[t]:null;(l!==null?l.type!==0:r||!(2a||l[i]!==o[a]){var s=` -`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=a);break}}}finally{oi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Lr(e):""}function Sh(e){switch(e.tag){case 5:return Lr(e.type);case 16:return Lr("Lazy");case 13:return Lr("Suspense");case 19:return Lr("SuspenseList");case 0:case 2:case 15:return e=ii(e.type,!1),e;case 11:return e=ii(e.type.render,!1),e;case 1:return e=ii(e.type,!0),e;default:return""}}function Ii(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Un:return"Fragment";case An:return"Portal";case Oi:return"Profiler";case Fs:return"StrictMode";case zi:return"Suspense";case Fi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case bc:return(e.displayName||"Context")+".Consumer";case Wc:return(e._context.displayName||"Context")+".Provider";case Is:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ds:return t=e.displayName||null,t!==null?t:Ii(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return Ii(e(t))}catch{}}return null}function xh(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=t.render,e=e.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 Ii(t);case 8:return t===Fs?"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(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function rn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kh(e){var t=Qc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function El(e){e._valueTracker||(e._valueTracker=kh(e))}function Kc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Qc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function eo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Di(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=rn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Yc(e,t){t=t.checked,t!=null&&zs(e,"checked",t,!1)}function Ai(e,t){Yc(e,t);var n=rn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ui(e,t.type,rn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ou(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ui(e,t,n){(t!=="number"||eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Pr=Array.isArray;function Xn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Br(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Tr={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},Eh=["Webkit","ms","Moz","O"];Object.keys(Tr).forEach(function(e){Eh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tr[t]=Tr[e]})});function Zc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Tr.hasOwnProperty(e)&&Tr[e]?(""+t).trim():t+"px"}function qc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Zc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ch=ue({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 Wi(e,t){if(t){if(Ch[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function bi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Vi=null;function As(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qi=null,Zn=null,qn=null;function au(e){if(e=al(e)){if(typeof Qi!="function")throw Error(j(280));var t=e.stateNode;t&&(t=To(t),Qi(e.stateNode,e.type,t))}}function ef(e){Zn?qn?qn.push(e):qn=[e]:Zn=e}function tf(){if(Zn){var e=Zn,t=qn;if(qn=Zn=null,au(e),t)for(e=0;e>>=0,e===0?32:31-(zh(e)/Fh|0)|0}var Nl=64,_l=4194304;function jr(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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function lo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~l;a!==0?r=jr(a):(o&=i,o!==0&&(r=jr(o)))}else i=n&~l,i!==0?r=jr(i):o!==0&&(r=jr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function il(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function Uh(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=Mr),vu=" ",yu=!1;function kf(e,t){switch(e){case"keyup":return hm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ef(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function gm(e,t){switch(e){case"compositionend":return Ef(t);case"keypress":return t.which!==32?null:(yu=!0,vu);case"textInput":return e=t.data,e===vu&&yu?null:e;default:return null}}function vm(e,t){if(Bn)return e==="compositionend"||!Ks&&kf(e,t)?(e=Sf(),Hl=bs=Kt=null,Bn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ku(n)}}function Lf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pf(){for(var e=window,t=eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=eo(e.document)}return t}function Ys(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function _m(e){var t=Pf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lf(n.ownerDocument.documentElement,n)){if(r!==null&&Ys(n)){if(t=r.start,e=r.end,e===void 0&&(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,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=Eu(n,o);var i=Eu(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.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;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hn=null,Zi=null,zr=null,qi=!1;function Cu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qi||Hn==null||Hn!==eo(r)||(r=Hn,"selectionStart"in r&&Ys(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),zr&&Kr(zr,r)||(zr=r,r=so(Zi,"onSelect"),0Vn||(e.current=os[Vn],os[Vn]=null,Vn--)}function ee(e,t){Vn++,os[Vn]=e.current,e.current=t}var ln={},Te=sn(ln),Ue=sn(!1),xn=ln;function lr(e,t){var n=e.type.contextTypes;if(!n)return ln;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Be(e){return e=e.childContextTypes,e!=null}function uo(){re(Ue),re(Te)}function Tu(e,t,n){if(Te.current!==ln)throw Error(j(168));ee(Te,t),ee(Ue,n)}function If(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(j(108,xh(e)||"Unknown",l));return ue({},n,r)}function co(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,xn=Te.current,ee(Te,e),ee(Ue,Ue.current),!0}function $u(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=If(e,t,xn),r.__reactInternalMemoizedMergedChildContext=e,re(Ue),re(Te),ee(Te,e)):re(Ue),ee(Ue,n)}var _t=null,$o=!1,Si=!1;function Df(e){_t===null?_t=[e]:_t.push(e)}function Dm(e){$o=!0,Df(e)}function an(){if(!Si&&_t!==null){Si=!0;var e=0,t=X;try{var n=_t;for(X=1;e>=i,l-=i,Lt=1<<32-ct(t)+l|n<F?(B=z,z=null):B=z.sibling;var A=y(m,z,d[F],C);if(A===null){z===null&&(z=B);break}e&&z&&A.alternate===null&&t(m,z),f=o(A,f,F),M===null?P=A:M.sibling=A,M=A,z=B}if(F===d.length)return n(m,z),le&&hn(m,F),P;if(z===null){for(;FF?(B=z,z=null):B=z.sibling;var q=y(m,z,A.value,C);if(q===null){z===null&&(z=B);break}e&&z&&q.alternate===null&&t(m,z),f=o(q,f,F),M===null?P=q:M.sibling=q,M=q,z=B}if(A.done)return n(m,z),le&&hn(m,F),P;if(z===null){for(;!A.done;F++,A=d.next())A=v(m,A.value,C),A!==null&&(f=o(A,f,F),M===null?P=A:M.sibling=A,M=A);return le&&hn(m,F),P}for(z=r(m,z);!A.done;F++,A=d.next())A=S(z,m,F,A.value,C),A!==null&&(e&&A.alternate!==null&&z.delete(A.key===null?F:A.key),f=o(A,f,F),M===null?P=A:M.sibling=A,M=A);return e&&z.forEach(function(ge){return t(m,ge)}),le&&hn(m,F),P}function L(m,f,d,C){if(typeof d=="object"&&d!==null&&d.type===Un&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case kl:e:{for(var P=d.key,M=f;M!==null;){if(M.key===P){if(P=d.type,P===Un){if(M.tag===7){n(m,M.sibling),f=l(M,d.props.children),f.return=m,m=f;break e}}else if(M.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Wt&&zu(P)===M.type){n(m,M.sibling),f=l(M,d.props),f.ref=kr(m,M,d),f.return=m,m=f;break e}n(m,M);break}else t(m,M);M=M.sibling}d.type===Un?(f=Sn(d.props.children,m.mode,C,d.key),f.return=m,m=f):(C=Gl(d.type,d.key,d.props,null,m.mode,C),C.ref=kr(m,f,d),C.return=m,m=C)}return i(m);case An:e:{for(M=d.key;f!==null;){if(f.key===M)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(m,f.sibling),f=l(f,d.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=Pi(d,m.mode,C),f.return=m,m=f}return i(m);case Wt:return M=d._init,L(m,f,M(d._payload),C)}if(Pr(d))return E(m,f,d,C);if(vr(d))return k(m,f,d,C);Ml(m,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(m,f.sibling),f=l(f,d),f.return=m,m=f):(n(m,f),f=Li(d,m.mode,C),f.return=m,m=f),i(m)):n(m,f)}return L}var ir=Hf(!0),Wf=Hf(!1),ho=sn(null),mo=null,Yn=null,Zs=null;function qs(){Zs=Yn=mo=null}function ea(e){var t=ho.current;re(ho),e._currentValue=t}function as(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function tr(e,t){mo=e,Zs=Yn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ae=!0),e.firstContext=null)}function nt(e){var t=e._currentValue;if(Zs!==e)if(e={context:e,memoizedValue:t,next:null},Yn===null){if(mo===null)throw Error(j(308));Yn=e,mo.dependencies={lanes:0,firstContext:e}}else Yn=Yn.next=e;return t}var vn=null;function ta(e){vn===null?vn=[e]:vn.push(e)}function bf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ta(t)):(n.next=l.next,l.next=n),t.interleaved=n,Mt(e,r)}function Mt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var bt=!1;function na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vf(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 jt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Mt(e,n)}return l=r.interleaved,l===null?(t.next=t,ta(r)):(t.next=l.next,l.next=t),r.interleaved=t,Mt(e,n)}function bl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bs(e,n)}}function Fu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function go(e,t,n,r){var l=e.updateQueue;bt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var s=a,u=s.next;s.next=null,i===null?o=u:i.next=u,i=s;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==i&&(a===null?h.firstBaseUpdate=u:a.next=u,h.lastBaseUpdate=s))}if(o!==null){var v=l.baseState;i=0,h=u=s=null,a=o;do{var y=a.lane,S=a.eventTime;if((r&y)===y){h!==null&&(h=h.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var E=e,k=a;switch(y=t,S=n,k.tag){case 1:if(E=k.payload,typeof E=="function"){v=E.call(S,v,y);break e}v=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=k.payload,y=typeof E=="function"?E.call(S,v,y):E,y==null)break e;v=ue({},v,y);break e;case 2:bt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,y=l.effects,y===null?l.effects=[a]:y.push(a))}else S={eventTime:S,lane:y,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(u=h=S,s=v):h=h.next=S,i|=y;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;y=a,a=y.next,y.next=null,l.lastBaseUpdate=y,l.shared.pending=null}}while(!0);if(h===null&&(s=v),l.baseState=s,l.firstBaseUpdate=u,l.lastBaseUpdate=h,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Cn|=i,e.lanes=i,e.memoizedState=v}}function Iu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ki.transition;ki.transition={};try{e(!1),t()}finally{X=n,ki.transition=r}}function ad(){return rt().memoizedState}function Hm(e,t,n){var r=tn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ud(e))cd(t,n);else if(n=bf(e,t,n,r),n!==null){var l=ze();ft(n,e,r,l),fd(n,t,r)}}function Wm(e,t,n){var r=tn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ud(e))cd(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,n);if(l.hasEagerState=!0,l.eagerState=a,dt(a,i)){var s=t.interleaved;s===null?(l.next=l,ta(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=bf(e,t,l,r),n!==null&&(l=ze(),ft(n,e,r,l),fd(n,t,r))}}function ud(e){var t=e.alternate;return e===se||t!==null&&t===se}function cd(e,t){Fr=yo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bs(e,n)}}var wo={readContext:nt,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useInsertionEffect:Pe,useLayoutEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useMutableSource:Pe,useSyncExternalStore:Pe,useId:Pe,unstable_isNewReconciler:!1},bm={readContext:nt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Au,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ql(4194308,4,rd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ql(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ql(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?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=Hm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:Du,useDebugValue:ca,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=Du(!1),t=e[0];return e=Bm.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,l=vt();if(le){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),xe===null)throw Error(j(349));En&30||Jf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Au(Xf.bind(null,r,o,e),[e]),r.flags|=2048,tl(9,Gf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=vt(),t=xe.identifierPrefix;if(le){var n=Pt,r=Lt;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qr++,0s||l[i]!==o[s]){var a=` +`+l[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=s);break}}}finally{si=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Lr(e):""}function Ch(e){switch(e.tag){case 5:return Lr(e.type);case 16:return Lr("Lazy");case 13:return Lr("Suspense");case 19:return Lr("SuspenseList");case 0:case 2:case 15:return e=ai(e.type,!1),e;case 11:return e=ai(e.type.render,!1),e;case 1:return e=ai(e.type,!0),e;default:return""}}function Ai(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Un:return"Fragment";case An:return"Portal";case Fi:return"Profiler";case As:return"StrictMode";case Ii:return"Suspense";case Di:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Kc:return(e.displayName||"Context")+".Consumer";case Qc:return(e._context.displayName||"Context")+".Provider";case Us:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Bs:return t=e.displayName||null,t!==null?t:Ai(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return Ai(e(t))}catch{}}return null}function Nh(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=t.render,e=e.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 Ai(t);case 8:return t===As?"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(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function rn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _h(e){var t=Gc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function El(e){e._valueTracker||(e._valueTracker=_h(e))}function Jc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function to(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ui(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function su(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=rn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xc(e,t){t=t.checked,t!=null&&Ds(e,"checked",t,!1)}function Bi(e,t){Xc(e,t);var n=rn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hi(e,t.type,rn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function au(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Hi(e,t,n){(t!=="number"||to(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Pr=Array.isArray;function Xn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Br(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Tr={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},Lh=["Webkit","ms","Moz","O"];Object.keys(Tr).forEach(function(e){Lh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tr[t]=Tr[e]})});function tf(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Tr.hasOwnProperty(e)&&Tr[e]?(""+t).trim():t+"px"}function nf(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=tf(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ph=ue({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 Vi(e,t){if(t){if(Ph[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function Qi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Ki=null;function Hs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,Zn=null,qn=null;function fu(e){if(e=al(e)){if(typeof Yi!="function")throw Error(j(280));var t=e.stateNode;t&&(t=Mo(t),Yi(e.stateNode,e.type,t))}}function rf(e){Zn?qn?qn.push(e):qn=[e]:Zn=e}function lf(){if(Zn){var e=Zn,t=qn;if(qn=Zn=null,fu(e),t)for(e=0;e>>=0,e===0?32:31-(Ah(e)/Uh|0)|0}var Nl=64,_l=4194304;function jr(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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function oo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var s=i&~l;s!==0?r=jr(s):(o&=i,o!==0&&(r=jr(o)))}else i=n&~l,i!==0?r=jr(i):o!==0&&(r=jr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function il(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function bh(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=Mr),Su=" ",xu=!1;function Nf(e,t){switch(e){case"keyup":return ym.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _f(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function Sm(e,t){switch(e){case"compositionend":return _f(t);case"keypress":return t.which!==32?null:(xu=!0,Su);case"textInput":return e=t.data,e===Su&&xu?null:e;default:return null}}function xm(e,t){if(Bn)return e==="compositionend"||!Js&&Nf(e,t)?(e=Ef(),Wl=Ks=Kt=null,Bn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Nu(n)}}function Rf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tf(){for(var e=window,t=to();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=to(e.document)}return t}function Xs(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Rm(e){var t=Tf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Rf(n.ownerDocument.documentElement,n)){if(r!==null&&Xs(n)){if(t=r.start,e=r.end,e===void 0&&(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,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=_u(n,o);var i=_u(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.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;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hn=null,es=null,Or=null,ts=!1;function Lu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ts||Hn==null||Hn!==to(r)||(r=Hn,"selectionStart"in r&&Xs(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&Kr(Or,r)||(Or=r,r=ao(es,"onSelect"),0Vn||(e.current=ss[Vn],ss[Vn]=null,Vn--)}function ee(e,t){Vn++,ss[Vn]=e.current,e.current=t}var ln={},Te=sn(ln),Ue=sn(!1),xn=ln;function lr(e,t){var n=e.type.contextTypes;if(!n)return ln;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Be(e){return e=e.childContextTypes,e!=null}function co(){re(Ue),re(Te)}function zu(e,t,n){if(Te.current!==ln)throw Error(j(168));ee(Te,t),ee(Ue,n)}function Uf(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(j(108,Nh(e)||"Unknown",l));return ue({},n,r)}function fo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,xn=Te.current,ee(Te,e),ee(Ue,Ue.current),!0}function Ou(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=Uf(e,t,xn),r.__reactInternalMemoizedMergedChildContext=e,re(Ue),re(Te),ee(Te,e)):re(Ue),ee(Ue,n)}var _t=null,zo=!1,ki=!1;function Bf(e){_t===null?_t=[e]:_t.push(e)}function Hm(e){zo=!0,Bf(e)}function an(){if(!ki&&_t!==null){ki=!0;var e=0,t=X;try{var n=_t;for(X=1;e>=i,l-=i,Lt=1<<32-ct(t)+l|n<F?(B=O,O=null):B=O.sibling;var A=y(m,O,d[F],C);if(A===null){O===null&&(O=B);break}e&&O&&A.alternate===null&&t(m,O),f=o(A,f,F),M===null?P=A:M.sibling=A,M=A,O=B}if(F===d.length)return n(m,O),le&&hn(m,F),P;if(O===null){for(;FF?(B=O,O=null):B=O.sibling;var q=y(m,O,A.value,C);if(q===null){O===null&&(O=B);break}e&&O&&q.alternate===null&&t(m,O),f=o(q,f,F),M===null?P=q:M.sibling=q,M=q,O=B}if(A.done)return n(m,O),le&&hn(m,F),P;if(O===null){for(;!A.done;F++,A=d.next())A=v(m,A.value,C),A!==null&&(f=o(A,f,F),M===null?P=A:M.sibling=A,M=A);return le&&hn(m,F),P}for(O=r(m,O);!A.done;F++,A=d.next())A=S(O,m,F,A.value,C),A!==null&&(e&&A.alternate!==null&&O.delete(A.key===null?F:A.key),f=o(A,f,F),M===null?P=A:M.sibling=A,M=A);return e&&O.forEach(function(ge){return t(m,ge)}),le&&hn(m,F),P}function L(m,f,d,C){if(typeof d=="object"&&d!==null&&d.type===Un&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case kl:e:{for(var P=d.key,M=f;M!==null;){if(M.key===P){if(P=d.type,P===Un){if(M.tag===7){n(m,M.sibling),f=l(M,d.props.children),f.return=m,m=f;break e}}else if(M.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Wt&&Du(P)===M.type){n(m,M.sibling),f=l(M,d.props),f.ref=kr(m,M,d),f.return=m,m=f;break e}n(m,M);break}else t(m,M);M=M.sibling}d.type===Un?(f=Sn(d.props.children,m.mode,C,d.key),f.return=m,m=f):(C=Xl(d.type,d.key,d.props,null,m.mode,C),C.ref=kr(m,f,d),C.return=m,m=C)}return i(m);case An:e:{for(M=d.key;f!==null;){if(f.key===M)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(m,f.sibling),f=l(f,d.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=Ri(d,m.mode,C),f.return=m,m=f}return i(m);case Wt:return M=d._init,L(m,f,M(d._payload),C)}if(Pr(d))return E(m,f,d,C);if(vr(d))return k(m,f,d,C);Ml(m,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(m,f.sibling),f=l(f,d),f.return=m,m=f):(n(m,f),f=ji(d,m.mode,C),f.return=m,m=f),i(m)):n(m,f)}return L}var ir=Vf(!0),Qf=Vf(!1),mo=sn(null),go=null,Yn=null,ta=null;function na(){ta=Yn=go=null}function ra(e){var t=mo.current;re(mo),e._currentValue=t}function cs(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function tr(e,t){go=e,ta=Yn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ae=!0),e.firstContext=null)}function nt(e){var t=e._currentValue;if(ta!==e)if(e={context:e,memoizedValue:t,next:null},Yn===null){if(go===null)throw Error(j(308));Yn=e,go.dependencies={lanes:0,firstContext:e}}else Yn=Yn.next=e;return t}var vn=null;function la(e){vn===null?vn=[e]:vn.push(e)}function Kf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,la(t)):(n.next=l.next,l.next=n),t.interleaved=n,Mt(e,r)}function Mt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var bt=!1;function oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yf(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 jt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Mt(e,n)}return l=r.interleaved,l===null?(t.next=t,la(r)):(t.next=l.next,l.next=t),r.interleaved=t,Mt(e,n)}function Vl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bs(e,n)}}function Au(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function vo(e,t,n,r){var l=e.updateQueue;bt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var a=s,u=a.next;a.next=null,i===null?o=u:i.next=u,i=a;var h=e.alternate;h!==null&&(h=h.updateQueue,s=h.lastBaseUpdate,s!==i&&(s===null?h.firstBaseUpdate=u:s.next=u,h.lastBaseUpdate=a))}if(o!==null){var v=l.baseState;i=0,h=u=a=null,s=o;do{var y=s.lane,S=s.eventTime;if((r&y)===y){h!==null&&(h=h.next={eventTime:S,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var E=e,k=s;switch(y=t,S=n,k.tag){case 1:if(E=k.payload,typeof E=="function"){v=E.call(S,v,y);break e}v=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=k.payload,y=typeof E=="function"?E.call(S,v,y):E,y==null)break e;v=ue({},v,y);break e;case 2:bt=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,y=l.effects,y===null?l.effects=[s]:y.push(s))}else S={eventTime:S,lane:y,tag:s.tag,payload:s.payload,callback:s.callback,next:null},h===null?(u=h=S,a=v):h=h.next=S,i|=y;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;y=s,s=y.next,y.next=null,l.lastBaseUpdate=y,l.shared.pending=null}}while(!0);if(h===null&&(a=v),l.baseState=a,l.firstBaseUpdate=u,l.lastBaseUpdate=h,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);Cn|=i,e.lanes=i,e.memoizedState=v}}function Uu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ci.transition;Ci.transition={};try{e(!1),t()}finally{X=n,Ci.transition=r}}function fd(){return rt().memoizedState}function Qm(e,t,n){var r=tn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},dd(e))pd(t,n);else if(n=Kf(e,t,n,r),n!==null){var l=Oe();ft(n,e,r,l),hd(n,t,r)}}function Km(e,t,n){var r=tn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(dd(e))pd(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,n);if(l.hasEagerState=!0,l.eagerState=s,dt(s,i)){var a=t.interleaved;a===null?(l.next=l,la(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Kf(e,t,l,r),n!==null&&(l=Oe(),ft(n,e,r,l),hd(n,t,r))}}function dd(e){var t=e.alternate;return e===se||t!==null&&t===se}function pd(e,t){Fr=wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bs(e,n)}}var So={readContext:nt,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useInsertionEffect:Pe,useLayoutEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useMutableSource:Pe,useSyncExternalStore:Pe,useId:Pe,unstable_isNewReconciler:!1},Ym={readContext:nt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Hu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Kl(4194308,4,id.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Kl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Kl(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?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=Qm.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:Bu,useDebugValue:pa,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=Bu(!1),t=e[0];return e=Vm.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,l=vt();if(le){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),xe===null)throw Error(j(349));En&30||Zf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Hu(ed.bind(null,r,o,e),[e]),r.flags|=2048,tl(9,qf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=vt(),t=xe.identifierPrefix;if(le){var n=Pt,r=Lt;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[yt]=t,e[Gr]=r,xd(e,t,!1,!1),t.stateNode=e;e:{switch(i=bi(n,r),n){case"dialog":ne("cancel",e),ne("close",e),l=r;break;case"iframe":case"object":case"embed":ne("load",e),l=r;break;case"video":case"audio":for(l=0;lur&&(t.flags|=128,r=!0,Er(o,!1),t.lanes=4194304)}else{if(!r)if(e=vo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Er(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!le)return je(t),null}else 2*de()-o.renderingStartTime>ur&&n!==1073741824&&(t.flags|=128,r=!0,Er(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=de(),t.sibling=null,n=ie.current,ee(ie,r?n&1|2:n&1),t):(je(t),null);case 22:case 23:return ga(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ve&1073741824&&(je(t),t.subtreeFlags&6&&(t.flags|=8192)):je(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function Zm(e,t){switch(Gs(t),t.tag){case 1:return Be(t.type)&&uo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sr(),re(Ue),re(Te),oa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return la(t),null;case 13:if(re(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));or()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(ie),null;case 4:return sr(),null;case 10:return ea(t.type._context),null;case 22:case 23:return ga(),null;case 24:return null;default:return null}}var zl=!1,Re=!1,qm=typeof WeakSet=="function"?WeakSet:Set,I=null;function Jn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function vs(e,t,n){try{n()}catch(r){ce(e,t,r)}}var Gu=!1;function eg(e,t){if(es=oo,e=Pf(),Ys(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,a=-1,s=-1,u=0,h=0,v=e,y=null;t:for(;;){for(var S;v!==n||l!==0&&v.nodeType!==3||(a=i+l),v!==o||r!==0&&v.nodeType!==3||(s=i+r),v.nodeType===3&&(i+=v.nodeValue.length),(S=v.firstChild)!==null;)y=v,v=S;for(;;){if(v===e)break t;if(y===n&&++u===l&&(a=i),y===o&&++h===r&&(s=i),(S=v.nextSibling)!==null)break;v=y,y=v.parentNode}v=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(ts={focusedElem:e,selectionRange:n},oo=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var k=E.memoizedProps,L=E.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?k:st(t.type,k),L);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(C){ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return E=Gu,Gu=!1,E}function Ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&vs(t,n,o)}l=l.next}while(l!==r)}}function zo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==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 ys(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Cd(e){var t=e.alternate;t!==null&&(e.alternate=null,Cd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[yt],delete t[Gr],delete t[ls],delete t[Fm],delete t[Im])),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 Nd(e){return e.tag===5||e.tag===3||e.tag===4}function Xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Nd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ws(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ao));else if(r!==4&&(e=e.child,e!==null))for(ws(e,t,n),e=e.sibling;e!==null;)ws(e,t,n),e=e.sibling}function Ss(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}var Ee=null,at=!1;function Ht(e,t,n){for(n=n.child;n!==null;)_d(e,t,n),n=n.sibling}function _d(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Lo,n)}catch{}switch(n.tag){case 5:Re||Jn(n,t);case 6:var r=Ee,l=at;Ee=null,Ht(e,t,n),Ee=r,at=l,Ee!==null&&(at?(e=Ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ee.removeChild(n.stateNode));break;case 18:Ee!==null&&(at?(e=Ee,n=n.stateNode,e.nodeType===8?wi(e.parentNode,n):e.nodeType===1&&wi(e,n),Vr(e)):wi(Ee,n.stateNode));break;case 4:r=Ee,l=at,Ee=n.stateNode.containerInfo,at=!0,Ht(e,t,n),Ee=r,at=l;break;case 0:case 11:case 14:case 15:if(!Re&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&vs(n,t,i),l=l.next}while(l!==r)}Ht(e,t,n);break;case 1:if(!Re&&(Jn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ce(n,t,a)}Ht(e,t,n);break;case 21:Ht(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,Ht(e,t,n),Re=r):Ht(e,t,n);break;default:Ht(e,t,n)}}function Zu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qm),t.forEach(function(r){var l=ug.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=de()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ng(r/1960))-r,10e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,ko=0,J&6)throw Error(j(331));var l=J;for(J|=4,I=e.current;I!==null;){var o=I,i=o.child;if(I.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sde()-ha?wn(e,0):pa|=n),He(e,t)}function Od(e,t){t===0&&(e.mode&1?(t=_l,_l<<=1,!(_l&130023424)&&(_l=4194304)):t=1);var n=ze();e=Mt(e,t),e!==null&&(il(e,t,n),He(e,n))}function ag(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Od(e,n)}function ug(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),Od(e,n)}var zd;zd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)Ae=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ae=!1,Gm(e,t,n);Ae=!!(e.flags&131072)}else Ae=!1,le&&t.flags&1048576&&Af(t,po,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Kl(e,t),e=t.pendingProps;var l=lr(t,Te.current);tr(t,n),l=sa(null,t,r,e,l,n);var o=aa();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Be(r)?(o=!0,co(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,na(t),l.updater=Oo,t.stateNode=l,l._reactInternals=t,cs(t,r,e,n),t=ps(null,t,r,!0,o,n)):(t.tag=0,le&&o&&Js(t),Oe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Kl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=fg(r),e=st(r,e),l){case 0:t=ds(null,t,r,e,n);break e;case 1:t=Ku(null,t,r,e,n);break e;case 11:t=Vu(null,t,r,e,n);break e;case 14:t=Qu(null,t,r,st(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),ds(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Ku(e,t,r,l,n);case 3:e:{if(yd(t),e===null)throw Error(j(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Vf(e,t),go(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,t.flags&256){l=ar(Error(j(423)),t),t=Yu(e,t,r,n,l);break e}else if(r!==l){l=ar(Error(j(424)),t),t=Yu(e,t,r,n,l);break e}else for(Qe=Zt(t.stateNode.containerInfo.firstChild),Ke=t,le=!0,ut=null,n=Wf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(or(),r===l){t=Ot(e,t,n);break e}Oe(e,t,r,n)}t=t.child}return t;case 5:return Qf(t),e===null&&ss(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ns(r,l)?i=null:o!==null&&ns(r,o)&&(t.flags|=32),vd(e,t),Oe(e,t,i,n),t.child;case 6:return e===null&&ss(t),null;case 13:return wd(e,t,n);case 4:return ra(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ir(t,null,r,n):Oe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Vu(e,t,r,l,n);case 7:return Oe(e,t,t.pendingProps,n),t.child;case 8:return Oe(e,t,t.pendingProps.children,n),t.child;case 12:return Oe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,ee(ho,r._currentValue),r._currentValue=i,o!==null)if(dt(o.value,i)){if(o.children===l.children&&!Ue.current){t=Ot(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var s=a.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=jt(-1,n&-n),s.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?s.next=s:(s.next=h.next,h.next=s),u.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),as(o.return,n,t),a.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(j(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),as(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Oe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,tr(t,n),l=nt(l),r=r(l),t.flags|=1,Oe(e,t,r,n),t.child;case 14:return r=t.type,l=st(r,t.pendingProps),l=st(r.type,l),Qu(e,t,r,l,n);case 15:return md(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Kl(e,t),t.tag=1,Be(r)?(e=!0,co(t)):e=!1,tr(t,n),dd(t,r,l),cs(t,r,l,n),ps(null,t,r,!0,e,n);case 19:return Sd(e,t,n);case 22:return gd(e,t,n)}throw Error(j(156,t.tag))};function Fd(e,t){return uf(e,t)}function cg(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 et(e,t,n,r){return new cg(e,t,n,r)}function ya(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fg(e){if(typeof e=="function")return ya(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Is)return 11;if(e===Ds)return 14}return 2}function nn(e,t){var n=e.alternate;return n===null?(n=et(e.tag,t,e.key,e.mode),n.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=e.flags&14680064,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=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Gl(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ya(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Un:return Sn(n.children,l,o,t);case Fs:i=8,l|=8;break;case Oi:return e=et(12,n,t,l|2),e.elementType=Oi,e.lanes=o,e;case zi:return e=et(13,n,t,l),e.elementType=zi,e.lanes=o,e;case Fi:return e=et(19,n,t,l),e.elementType=Fi,e.lanes=o,e;case Vc:return Io(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wc:i=10;break e;case bc:i=9;break e;case Is:i=11;break e;case Ds:i=14;break e;case Wt:i=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=et(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Sn(e,t,n,r){return e=et(7,e,r,t),e.lanes=n,e}function Io(e,t,n,r){return e=et(22,e,r,t),e.elementType=Vc,e.lanes=n,e.stateNode={isHidden:!1},e}function Li(e,t,n){return e=et(6,e,null,t),e.lanes=n,e}function Pi(e,t,n){return t=et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dg(e,t,n,r,l){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=ai(0),this.expirationTimes=ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ai(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function wa(e,t,n,r,l,o,i,a,s){return e=new dg(e,t,n,a,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=et(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},na(o),e}function pg(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ud)}catch(e){console.error(e)}}Ud(),Ac.exports=Je;var Bd=Ac.exports,Hd,ic=Bd;Hd=ic.createRoot,ic.hydrateRoot;/** +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Li(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ps(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Xm=typeof WeakMap=="function"?WeakMap:Map;function gd(e,t,n){n=jt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ko||(ko=!0,Es=r),ps(e,t)},n}function vd(e,t,n){n=jt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){ps(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){ps(e,t),typeof r!="function"&&(en===null?en=new Set([this]):en.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Vu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xm;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=fg.bind(null,e,t,n),t.then(e,e))}function Qu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ku(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=jt(-1,1),t.tag=2,qt(n,t,1))),n.lanes|=1),e)}var Zm=Ft.ReactCurrentOwner,Ae=!1;function ze(e,t,n,r){t.child=e===null?Qf(t,null,n,r):ir(t,e.child,n,r)}function Yu(e,t,n,r,l){n=n.render;var o=t.ref;return tr(t,l),r=ca(e,t,n,r,o,l),n=fa(),e!==null&&!Ae?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,zt(e,t,l)):(le&&n&&Zs(t),t.flags|=1,ze(e,t,r,l),t.child)}function Gu(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!xa(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,yd(e,t,o,r,l)):(e=Xl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Kr,n(i,r)&&e.ref===t.ref)return zt(e,t,l)}return t.flags|=1,e=nn(o,r),e.ref=t.ref,e.return=t,t.child=e}function yd(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(Kr(o,r)&&e.ref===t.ref)if(Ae=!1,t.pendingProps=r=o,(e.lanes&l)!==0)e.flags&131072&&(Ae=!0);else return t.lanes=e.lanes,zt(e,t,l)}return hs(e,t,n,r,l)}function wd(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ee(Jn,Ve),Ve|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ee(Jn,Ve),Ve|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,ee(Jn,Ve),Ve|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,ee(Jn,Ve),Ve|=r;return ze(e,t,l,n),t.child}function Sd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function hs(e,t,n,r,l){var o=Be(n)?xn:Te.current;return o=lr(t,o),tr(t,l),n=ca(e,t,n,r,o,l),r=fa(),e!==null&&!Ae?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,zt(e,t,l)):(le&&r&&Zs(t),t.flags|=1,ze(e,t,n,l),t.child)}function Ju(e,t,n,r,l){if(Be(n)){var o=!0;fo(t)}else o=!1;if(tr(t,l),t.stateNode===null)Yl(e,t),md(t,n,r),ds(t,n,r,l),r=!0;else if(e===null){var i=t.stateNode,s=t.memoizedProps;i.props=s;var a=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=nt(u):(u=Be(n)?xn:Te.current,u=lr(t,u));var h=n.getDerivedStateFromProps,v=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function";v||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==r||a!==u)&&bu(t,i,r,u),bt=!1;var y=t.memoizedState;i.state=y,vo(t,r,i,l),a=t.memoizedState,s!==r||y!==a||Ue.current||bt?(typeof h=="function"&&(fs(t,n,h,r),a=t.memoizedState),(s=bt||Wu(t,n,s,r,y,a,u))?(v||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),i.props=r,i.state=a,i.context=u,r=s):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Yf(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:st(t.type,s),i.props=u,v=t.pendingProps,y=i.context,a=n.contextType,typeof a=="object"&&a!==null?a=nt(a):(a=Be(n)?xn:Te.current,a=lr(t,a));var S=n.getDerivedStateFromProps;(h=typeof S=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==v||y!==a)&&bu(t,i,r,a),bt=!1,y=t.memoizedState,i.state=y,vo(t,r,i,l);var E=t.memoizedState;s!==v||y!==E||Ue.current||bt?(typeof S=="function"&&(fs(t,n,S,r),E=t.memoizedState),(u=bt||Wu(t,n,u,r,y,E,a)||!1)?(h||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,E,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,E,a)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=E),i.props=r,i.state=E,i.context=a,r=u):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return ms(e,t,n,r,o,l)}function ms(e,t,n,r,l,o){Sd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return l&&Ou(t,n,!1),zt(e,t,o);r=t.stateNode,Zm.current=t;var s=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=ir(t,e.child,null,o),t.child=ir(t,null,s,o)):ze(e,t,s,o),t.memoizedState=r.state,l&&Ou(t,n,!0),t.child}function xd(e){var t=e.stateNode;t.pendingContext?zu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&zu(e,t.context,!1),ia(e,t.containerInfo)}function Xu(e,t,n,r,l){return or(),ea(l),t.flags|=256,ze(e,t,n,r),t.child}var gs={dehydrated:null,treeContext:null,retryLane:0};function vs(e){return{baseLanes:e,cachePool:null,transitions:null}}function kd(e,t,n){var r=t.pendingProps,l=ie.current,o=!1,i=(t.flags&128)!==0,s;if((s=i)||(s=e!==null&&e.memoizedState===null?!1:(l&2)!==0),s?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),ee(ie,l&1),e===null)return us(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=Ao(i,r,0,null),e=Sn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=vs(n),t.memoizedState=gs,e):ha(t,i));if(l=e.memoizedState,l!==null&&(s=l.dehydrated,s!==null))return qm(e,t,i,r,s,l,n);if(o){o=r.fallback,i=t.mode,l=e.child,s=l.sibling;var a={mode:"hidden",children:r.children};return!(i&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=nn(l,a),r.subtreeFlags=l.subtreeFlags&14680064),s!==null?o=nn(s,o):(o=Sn(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?vs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=gs,r}return o=e.child,e=o.sibling,r=nn(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ha(e,t){return t=Ao({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zl(e,t,n,r){return r!==null&&ea(r),ir(t,e.child,null,n),e=ha(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qm(e,t,n,r,l,o,i){if(n)return t.flags&256?(t.flags&=-257,r=Li(Error(j(422))),zl(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=Ao({mode:"visible",children:r.children},l,0,null),o=Sn(o,l,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&ir(t,e.child,null,i),t.child.memoizedState=vs(i),t.memoizedState=gs,o);if(!(t.mode&1))return zl(e,t,i,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var s=r.dgst;return r=s,o=Error(j(419)),r=Li(o,r,void 0),zl(e,t,i,r)}if(s=(i&e.childLanes)!==0,Ae||s){if(r=xe,r!==null){switch(i&-i){case 4:l=2;break;case 16:l=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:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|i)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,Mt(e,l),ft(r,e,l,-1))}return Sa(),r=Li(Error(j(421))),zl(e,t,i,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=dg.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,Qe=Zt(l.nextSibling),Ke=t,le=!0,ut=null,e!==null&&(Ze[qe++]=Lt,Ze[qe++]=Pt,Ze[qe++]=kn,Lt=e.id,Pt=e.overflow,kn=t),t=ha(t,r.children),t.flags|=4096,t)}function Zu(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),cs(e.return,t,n)}function Pi(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function Ed(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(ze(e,t,r.children,n),r=ie.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zu(e,n,t);else if(e.tag===19)Zu(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ee(ie,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&yo(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Pi(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&yo(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Pi(t,!0,n,null,o);break;case"together":Pi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Yl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function zt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Cn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(j(153));if(t.child!==null){for(e=t.child,n=nn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=nn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eg(e,t,n){switch(t.tag){case 3:xd(t),or();break;case 5:Gf(t);break;case 1:Be(t.type)&&fo(t);break;case 4:ia(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;ee(mo,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ee(ie,ie.current&1),t.flags|=128,null):n&t.child.childLanes?kd(e,t,n):(ee(ie,ie.current&1),e=zt(e,t,n),e!==null?e.sibling:null);ee(ie,ie.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ed(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),ee(ie,ie.current),r)break;return null;case 22:case 23:return t.lanes=0,wd(e,t,n)}return zt(e,t,n)}var Cd,ys,Nd,_d;Cd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ys=function(){};Nd=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,yn(St.current);var o=null;switch(n){case"input":l=Ui(e,l),r=Ui(e,r),o=[];break;case"select":l=ue({},l,{value:void 0}),r=ue({},r,{value:void 0}),o=[];break;case"textarea":l=Wi(e,l),r=Wi(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=uo)}Vi(n,r);var i;n=null;for(u in l)if(!r.hasOwnProperty(u)&&l.hasOwnProperty(u)&&l[u]!=null)if(u==="style"){var s=l[u];for(i in s)s.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ur.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in r){var a=r[u];if(s=l!=null?l[u]:void 0,r.hasOwnProperty(u)&&a!==s&&(a!=null||s!=null))if(u==="style")if(s){for(i in s)!s.hasOwnProperty(i)||a&&a.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in a)a.hasOwnProperty(i)&&s[i]!==a[i]&&(n||(n={}),n[i]=a[i])}else n||(o||(o=[]),o.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,s=s?s.__html:void 0,a!=null&&s!==a&&(o=o||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ur.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&ne("scroll",e),o||s===a||(o=[])):(o=o||[]).push(u,a))}n&&(o=o||[]).push("style",n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};_d=function(e,t,n,r){n!==r&&(t.flags|=4)};function Er(e,t){if(!le)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function tg(e,t,n){var r=t.pendingProps;switch(qs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return je(t),null;case 1:return Be(t.type)&&co(),je(t),null;case 3:return r=t.stateNode,sr(),re(Ue),re(Te),aa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&($l(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ut!==null&&(_s(ut),ut=null))),ys(e,t),je(t),null;case 5:sa(t);var l=yn(Zr.current);if(n=t.type,e!==null&&t.stateNode!=null)Nd(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(j(166));return je(t),null}if(e=yn(St.current),$l(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[yt]=t,r[Jr]=o,e=(t.mode&1)!==0,n){case"dialog":ne("cancel",r),ne("close",r);break;case"iframe":case"object":case"embed":ne("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[yt]=t,e[Jr]=r,Cd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Qi(n,r),n){case"dialog":ne("cancel",e),ne("close",e),l=r;break;case"iframe":case"object":case"embed":ne("load",e),l=r;break;case"video":case"audio":for(l=0;lur&&(t.flags|=128,r=!0,Er(o,!1),t.lanes=4194304)}else{if(!r)if(e=yo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Er(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!le)return je(t),null}else 2*de()-o.renderingStartTime>ur&&n!==1073741824&&(t.flags|=128,r=!0,Er(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=de(),t.sibling=null,n=ie.current,ee(ie,r?n&1|2:n&1),t):(je(t),null);case 22:case 23:return wa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ve&1073741824&&(je(t),t.subtreeFlags&6&&(t.flags|=8192)):je(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function ng(e,t){switch(qs(t),t.tag){case 1:return Be(t.type)&&co(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sr(),re(Ue),re(Te),aa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return sa(t),null;case 13:if(re(ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));or()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(ie),null;case 4:return sr(),null;case 10:return ra(t.type._context),null;case 22:case 23:return wa(),null;case 24:return null;default:return null}}var Ol=!1,Re=!1,rg=typeof WeakSet=="function"?WeakSet:Set,I=null;function Gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function ws(e,t,n){try{n()}catch(r){ce(e,t,r)}}var qu=!1;function lg(e,t){if(ns=io,e=Tf(),Xs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,s=-1,a=-1,u=0,h=0,v=e,y=null;t:for(;;){for(var S;v!==n||l!==0&&v.nodeType!==3||(s=i+l),v!==o||r!==0&&v.nodeType!==3||(a=i+r),v.nodeType===3&&(i+=v.nodeValue.length),(S=v.firstChild)!==null;)y=v,v=S;for(;;){if(v===e)break t;if(y===n&&++u===l&&(s=i),y===o&&++h===r&&(a=i),(S=v.nextSibling)!==null)break;v=y,y=v.parentNode}v=S}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(rs={focusedElem:e,selectionRange:n},io=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var k=E.memoizedProps,L=E.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?k:st(t.type,k),L);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(C){ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return E=qu,qu=!1,E}function Ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&ws(t,n,o)}l=l.next}while(l!==r)}}function Io(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==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 Ss(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ld(e){var t=e.alternate;t!==null&&(e.alternate=null,Ld(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[yt],delete t[Jr],delete t[is],delete t[Um],delete t[Bm])),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 Pd(e){return e.tag===5||e.tag===3||e.tag===4}function ec(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Pd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=uo));else if(r!==4&&(e=e.child,e!==null))for(xs(e,t,n),e=e.sibling;e!==null;)xs(e,t,n),e=e.sibling}function ks(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ks(e,t,n),e=e.sibling;e!==null;)ks(e,t,n),e=e.sibling}var Ee=null,at=!1;function Ht(e,t,n){for(n=n.child;n!==null;)jd(e,t,n),n=n.sibling}function jd(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(jo,n)}catch{}switch(n.tag){case 5:Re||Gn(n,t);case 6:var r=Ee,l=at;Ee=null,Ht(e,t,n),Ee=r,at=l,Ee!==null&&(at?(e=Ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ee.removeChild(n.stateNode));break;case 18:Ee!==null&&(at?(e=Ee,n=n.stateNode,e.nodeType===8?xi(e.parentNode,n):e.nodeType===1&&xi(e,n),Vr(e)):xi(Ee,n.stateNode));break;case 4:r=Ee,l=at,Ee=n.stateNode.containerInfo,at=!0,Ht(e,t,n),Ee=r,at=l;break;case 0:case 11:case 14:case 15:if(!Re&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ws(n,t,i),l=l.next}while(l!==r)}Ht(e,t,n);break;case 1:if(!Re&&(Gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){ce(n,t,s)}Ht(e,t,n);break;case 21:Ht(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,Ht(e,t,n),Re=r):Ht(e,t,n);break;default:Ht(e,t,n)}}function tc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rg),t.forEach(function(r){var l=pg.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=de()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ig(r/1960))-r,10e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,Eo=0,G&6)throw Error(j(331));var l=G;for(G|=4,I=e.current;I!==null;){var o=I,i=o.child;if(I.flags&16){var s=o.deletions;if(s!==null){for(var a=0;ade()-va?wn(e,0):ga|=n),He(e,t)}function Id(e,t){t===0&&(e.mode&1?(t=_l,_l<<=1,!(_l&130023424)&&(_l=4194304)):t=1);var n=Oe();e=Mt(e,t),e!==null&&(il(e,t,n),He(e,n))}function dg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Id(e,n)}function pg(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),Id(e,n)}var Dd;Dd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)Ae=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ae=!1,eg(e,t,n);Ae=!!(e.flags&131072)}else Ae=!1,le&&t.flags&1048576&&Hf(t,ho,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yl(e,t),e=t.pendingProps;var l=lr(t,Te.current);tr(t,n),l=ca(null,t,r,e,l,n);var o=fa();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Be(r)?(o=!0,fo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,oa(t),l.updater=Fo,t.stateNode=l,l._reactInternals=t,ds(t,r,e,n),t=ms(null,t,r,!0,o,n)):(t.tag=0,le&&o&&Zs(t),ze(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=mg(r),e=st(r,e),l){case 0:t=hs(null,t,r,e,n);break e;case 1:t=Ju(null,t,r,e,n);break e;case 11:t=Yu(null,t,r,e,n);break e;case 14:t=Gu(null,t,r,st(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),hs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Ju(e,t,r,l,n);case 3:e:{if(xd(t),e===null)throw Error(j(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Yf(e,t),vo(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,t.flags&256){l=ar(Error(j(423)),t),t=Xu(e,t,r,n,l);break e}else if(r!==l){l=ar(Error(j(424)),t),t=Xu(e,t,r,n,l);break e}else for(Qe=Zt(t.stateNode.containerInfo.firstChild),Ke=t,le=!0,ut=null,n=Qf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(or(),r===l){t=zt(e,t,n);break e}ze(e,t,r,n)}t=t.child}return t;case 5:return Gf(t),e===null&&us(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ls(r,l)?i=null:o!==null&&ls(r,o)&&(t.flags|=32),Sd(e,t),ze(e,t,i,n),t.child;case 6:return e===null&&us(t),null;case 13:return kd(e,t,n);case 4:return ia(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ir(t,null,r,n):ze(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Yu(e,t,r,l,n);case 7:return ze(e,t,t.pendingProps,n),t.child;case 8:return ze(e,t,t.pendingProps.children,n),t.child;case 12:return ze(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,ee(mo,r._currentValue),r._currentValue=i,o!==null)if(dt(o.value,i)){if(o.children===l.children&&!Ue.current){t=zt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){i=o.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=jt(-1,n&-n),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?a.next=a:(a.next=h.next,h.next=a),u.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),cs(o.return,n,t),s.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(j(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),cs(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ze(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,tr(t,n),l=nt(l),r=r(l),t.flags|=1,ze(e,t,r,n),t.child;case 14:return r=t.type,l=st(r,t.pendingProps),l=st(r.type,l),Gu(e,t,r,l,n);case 15:return yd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Yl(e,t),t.tag=1,Be(r)?(e=!0,fo(t)):e=!1,tr(t,n),md(t,r,l),ds(t,r,l,n),ms(null,t,r,!0,e,n);case 19:return Ed(e,t,n);case 22:return wd(e,t,n)}throw Error(j(156,t.tag))};function Ad(e,t){return df(e,t)}function hg(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 et(e,t,n,r){return new hg(e,t,n,r)}function xa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mg(e){if(typeof e=="function")return xa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Us)return 11;if(e===Bs)return 14}return 2}function nn(e,t){var n=e.alternate;return n===null?(n=et(e.tag,t,e.key,e.mode),n.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=e.flags&14680064,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=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")xa(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Un:return Sn(n.children,l,o,t);case As:i=8,l|=8;break;case Fi:return e=et(12,n,t,l|2),e.elementType=Fi,e.lanes=o,e;case Ii:return e=et(13,n,t,l),e.elementType=Ii,e.lanes=o,e;case Di:return e=et(19,n,t,l),e.elementType=Di,e.lanes=o,e;case Yc:return Ao(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qc:i=10;break e;case Kc:i=9;break e;case Us:i=11;break e;case Bs:i=14;break e;case Wt:i=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=et(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Sn(e,t,n,r){return e=et(7,e,r,t),e.lanes=n,e}function Ao(e,t,n,r){return e=et(22,e,r,t),e.elementType=Yc,e.lanes=n,e.stateNode={isHidden:!1},e}function ji(e,t,n){return e=et(6,e,null,t),e.lanes=n,e}function Ri(e,t,n){return t=et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gg(e,t,n,r,l){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=ci(0),this.expirationTimes=ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ci(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ka(e,t,n,r,l,o,i,s,a){return e=new gg(e,t,n,s,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=et(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},oa(o),e}function vg(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Wd)}catch(e){console.error(e)}}Wd(),Hc.exports=Ge;var bd=Hc.exports,Vd,uc=bd;Vd=uc.createRoot,uc.hydrateRoot;/** * react-router v7.8.2 * * Copyright (c) Remix Software Inc. @@ -46,28 +46,28 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */var sc="popstate";function yg(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=Pn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),Ns("",{pathname:i,search:a,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),a="";if(i&&i.getAttribute("href")){let s=l.location.href,u=s.indexOf("#");a=u===-1?s:s.slice(0,u)}return a+"#"+(typeof o=="string"?o:rl(o))}function r(l,o){pt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Sg(t,n,r,e)}function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function pt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wg(){return Math.random().toString(36).substring(2,10)}function ac(e,t){return{usr:e.state,key:e.key,idx:t}}function Ns(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pn(t):t,state:n,key:t&&t.key||r||wg()}}function rl({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Pn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Sg(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,a="POP",s=null,u=h();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function h(){return(i.state||{idx:null}).idx}function v(){a="POP";let L=h(),m=L==null?null:L-u;u=L,s&&s({action:a,location:k.location,delta:m})}function y(L,m){a="PUSH";let f=Ns(k.location,L,m);n&&n(f,L),u=h()+1;let d=ac(f,u),C=k.createHref(f);try{i.pushState(d,"",C)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(C)}o&&s&&s({action:a,location:k.location,delta:1})}function S(L,m){a="REPLACE";let f=Ns(k.location,L,m);n&&n(f,L),u=h();let d=ac(f,u),C=k.createHref(f);i.replaceState(d,"",C),o&&s&&s({action:a,location:k.location,delta:0})}function E(L){return xg(L)}let k={get action(){return a},get location(){return e(l,i)},listen(L){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(sc,v),s=L,()=>{l.removeEventListener(sc,v),s=null}},createHref(L){return t(l,L)},createURL:E,encodeLocation(L){let m=E(L);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:y,replace:S,go(L){return i.go(L)}};return k}function xg(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ae(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:rl(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Wd(e,t,n="/"){return kg(e,t,n,!1)}function kg(e,t,n,r){let l=typeof t=="string"?Pn(t):t,o=zt(l.pathname||"/",n);if(o==null)return null;let i=bd(e);Eg(i);let a=null;for(let s=0;a==null&&s{let h={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&s)return;ae(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let v=Rt([r,h.relativePath]),y=n.concat(h);i.children&&i.children.length>0&&(ae(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),bd(i.children,t,y,v,s)),!(i.path==null&&!i.index)&&t.push({path:v,score:Rg(v,i.index),routesMeta:y})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Vd(i.path))o(i,a,!0,u)}),t}function Vd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return l?[o,""]:[o];let i=Vd(r.join("/")),a=[];return a.push(...i.map(s=>s===""?o:[o,s].join("/"))),l&&a.push(...i),a.map(s=>e.startsWith("/")&&s===""?"/":s)}function Eg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Tg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Cg=/^:[\w-]+$/,Ng=3,_g=2,Lg=1,Pg=10,jg=-2,uc=e=>e==="*";function Rg(e,t){let n=e.split("/"),r=n.length;return n.some(uc)&&(r+=jg),t&&(r+=_g),n.filter(l=>!uc(l)).reduce((l,o)=>l+(Cg.test(o)?Ng:o===""?Lg:Pg),r)}function Tg(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function $g(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let a=0;a{if(h==="*"){let E=a[y]||"";i=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const S=a[y];return v&&!S?u[h]=void 0:u[h]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Mg(e,t=!1,n=!0){pt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,s)=>(r.push({paramName:a,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Og(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function zt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function zg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Pn(e):e;return{pathname:n?n.startsWith("/")?n:Fg(n,t):t,search:Ag(r),hash:Ug(l)}}function Fg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function ji(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Ig(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Qd(e){let t=Ig(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Kd(e,t,n,r=!1){let l;typeof e=="string"?l=Pn(e):(l={...e},ae(!l.pathname||!l.pathname.includes("?"),ji("?","pathname","search",l)),ae(!l.pathname||!l.pathname.includes("#"),ji("#","pathname","hash",l)),ae(!l.search||!l.search.includes("#"),ji("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let v=t.length-1;if(!r&&i.startsWith("..")){let y=i.split("/");for(;y[0]==="..";)y.shift(),v-=1;l.pathname=y.join("/")}a=v>=0?t[v]:"/"}let s=zg(l,a),u=i&&i!=="/"&&i.endsWith("/"),h=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||h)&&(s.pathname+="/"),s}var Rt=e=>e.join("/").replace(/\/\/+/g,"/"),Dg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ag=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ug=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Bg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Yd=["POST","PUT","PATCH","DELETE"];new Set(Yd);var Hg=["GET",...Yd];new Set(Hg);var pr=g.createContext(null);pr.displayName="DataRouter";var Ho=g.createContext(null);Ho.displayName="DataRouterState";g.createContext(!1);var Jd=g.createContext({isTransitioning:!1});Jd.displayName="ViewTransition";var Wg=g.createContext(new Map);Wg.displayName="Fetchers";var bg=g.createContext(null);bg.displayName="Await";var xt=g.createContext(null);xt.displayName="Navigation";var cl=g.createContext(null);cl.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var Ea=g.createContext(null);Ea.displayName="RouteError";function Vg(e,{relative:t}={}){ae(fl(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=g.useContext(xt),{hash:l,pathname:o,search:i}=dl(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:Rt([n,o])),r.createHref({pathname:a,search:i,hash:l})}function fl(){return g.useContext(cl)!=null}function jn(){return ae(fl(),"useLocation() may be used only in the context of a component."),g.useContext(cl).location}var Gd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Xd(e){g.useContext(xt).static||g.useLayoutEffect(e)}function Qg(){let{isDataRoute:e}=g.useContext(It);return e?ov():Kg()}function Kg(){ae(fl(),"useNavigate() may be used only in the context of a component.");let e=g.useContext(pr),{basename:t,navigator:n}=g.useContext(xt),{matches:r}=g.useContext(It),{pathname:l}=jn(),o=JSON.stringify(Qd(r)),i=g.useRef(!1);return Xd(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(pt(i.current,Gd),!i.current)return;if(typeof s=="number"){n.go(s);return}let h=Kd(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Rt([t,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[t,n,o,l,e])}g.createContext(null);function dl(e,{relative:t}={}){let{matches:n}=g.useContext(It),{pathname:r}=jn(),l=JSON.stringify(Qd(n));return g.useMemo(()=>Kd(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Yg(e,t){return Zd(e,t)}function Zd(e,t,n,r,l){var f;ae(fl(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=g.useContext(xt),{matches:i}=g.useContext(It),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",h=a?a.pathnameBase:"/",v=a&&a.route;{let d=v&&v.path||"";qd(u,!v||d.endsWith("*")||d.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + */var cc="popstate";function kg(e={}){function t(l,o){let{pathname:i="/",search:s="",hash:a=""}=Pn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),Ls("",{pathname:i,search:s,hash:a},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let a=l.location.href,u=a.indexOf("#");s=u===-1?a:a.slice(0,u)}return s+"#"+(typeof o=="string"?o:rl(o))}function r(l,o){pt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Cg(t,n,r,e)}function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function pt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Eg(){return Math.random().toString(36).substring(2,10)}function fc(e,t){return{usr:e.state,key:e.key,idx:t}}function Ls(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pn(t):t,state:n,key:t&&t.key||r||Eg()}}function rl({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Pn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Cg(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,s="POP",a=null,u=h();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function h(){return(i.state||{idx:null}).idx}function v(){s="POP";let L=h(),m=L==null?null:L-u;u=L,a&&a({action:s,location:k.location,delta:m})}function y(L,m){s="PUSH";let f=Ls(k.location,L,m);n&&n(f,L),u=h()+1;let d=fc(f,u),C=k.createHref(f);try{i.pushState(d,"",C)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(C)}o&&a&&a({action:s,location:k.location,delta:1})}function S(L,m){s="REPLACE";let f=Ls(k.location,L,m);n&&n(f,L),u=h();let d=fc(f,u),C=k.createHref(f);i.replaceState(d,"",C),o&&a&&a({action:s,location:k.location,delta:0})}function E(L){return Ng(L)}let k={get action(){return s},get location(){return e(l,i)},listen(L){if(a)throw new Error("A history only accepts one active listener");return l.addEventListener(cc,v),a=L,()=>{l.removeEventListener(cc,v),a=null}},createHref(L){return t(l,L)},createURL:E,encodeLocation(L){let m=E(L);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:y,replace:S,go(L){return i.go(L)}};return k}function Ng(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ae(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:rl(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Qd(e,t,n="/"){return _g(e,t,n,!1)}function _g(e,t,n,r){let l=typeof t=="string"?Pn(t):t,o=Ot(l.pathname||"/",n);if(o==null)return null;let i=Kd(e);Lg(i);let s=null;for(let a=0;s==null&&a{let h={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&a)return;ae(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let v=Rt([r,h.relativePath]),y=n.concat(h);i.children&&i.children.length>0&&(ae(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Kd(i.children,t,y,v,a)),!(i.path==null&&!i.index)&&t.push({path:v,score:zg(v,i.index),routesMeta:y})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let u of Yd(i.path))o(i,s,!0,u)}),t}function Yd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return l?[o,""]:[o];let i=Yd(r.join("/")),s=[];return s.push(...i.map(a=>a===""?o:[o,a].join("/"))),l&&s.push(...i),s.map(a=>e.startsWith("/")&&a===""?"/":a)}function Lg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Og(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Pg=/^:[\w-]+$/,jg=3,Rg=2,Tg=1,$g=10,Mg=-2,dc=e=>e==="*";function zg(e,t){let n=e.split("/"),r=n.length;return n.some(dc)&&(r+=Mg),t&&(r+=Rg),n.filter(l=>!dc(l)).reduce((l,o)=>l+(Pg.test(o)?jg:o===""?Tg:$g),r)}function Og(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function Fg(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let s=0;s{if(h==="*"){let E=s[y]||"";i=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const S=s[y];return v&&!S?u[h]=void 0:u[h]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Ig(e,t=!1,n=!0){pt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,a)=>(r.push({paramName:s,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Dg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ot(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Ag(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Pn(e):e;return{pathname:n?n.startsWith("/")?n:Ug(n,t):t,search:Wg(r),hash:bg(l)}}function Ug(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Ti(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Bg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Gd(e){let t=Bg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Jd(e,t,n,r=!1){let l;typeof e=="string"?l=Pn(e):(l={...e},ae(!l.pathname||!l.pathname.includes("?"),Ti("?","pathname","search",l)),ae(!l.pathname||!l.pathname.includes("#"),Ti("#","pathname","hash",l)),ae(!l.search||!l.search.includes("#"),Ti("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,s;if(i==null)s=n;else{let v=t.length-1;if(!r&&i.startsWith("..")){let y=i.split("/");for(;y[0]==="..";)y.shift(),v-=1;l.pathname=y.join("/")}s=v>=0?t[v]:"/"}let a=Ag(l,s),u=i&&i!=="/"&&i.endsWith("/"),h=(o||i===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||h)&&(a.pathname+="/"),a}var Rt=e=>e.join("/").replace(/\/\/+/g,"/"),Hg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Wg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Vg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Xd=["POST","PUT","PATCH","DELETE"];new Set(Xd);var Qg=["GET",...Xd];new Set(Qg);var pr=g.createContext(null);pr.displayName="DataRouter";var bo=g.createContext(null);bo.displayName="DataRouterState";g.createContext(!1);var Zd=g.createContext({isTransitioning:!1});Zd.displayName="ViewTransition";var Kg=g.createContext(new Map);Kg.displayName="Fetchers";var Yg=g.createContext(null);Yg.displayName="Await";var xt=g.createContext(null);xt.displayName="Navigation";var cl=g.createContext(null);cl.displayName="Location";var It=g.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var _a=g.createContext(null);_a.displayName="RouteError";function Gg(e,{relative:t}={}){ae(fl(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=g.useContext(xt),{hash:l,pathname:o,search:i}=dl(e,{relative:t}),s=o;return n!=="/"&&(s=o==="/"?n:Rt([n,o])),r.createHref({pathname:s,search:i,hash:l})}function fl(){return g.useContext(cl)!=null}function jn(){return ae(fl(),"useLocation() may be used only in the context of a component."),g.useContext(cl).location}var qd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ep(e){g.useContext(xt).static||g.useLayoutEffect(e)}function Jg(){let{isDataRoute:e}=g.useContext(It);return e?uv():Xg()}function Xg(){ae(fl(),"useNavigate() may be used only in the context of a component.");let e=g.useContext(pr),{basename:t,navigator:n}=g.useContext(xt),{matches:r}=g.useContext(It),{pathname:l}=jn(),o=JSON.stringify(Gd(r)),i=g.useRef(!1);return ep(()=>{i.current=!0}),g.useCallback((a,u={})=>{if(pt(i.current,qd),!i.current)return;if(typeof a=="number"){n.go(a);return}let h=Jd(a,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Rt([t,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[t,n,o,l,e])}g.createContext(null);function dl(e,{relative:t}={}){let{matches:n}=g.useContext(It),{pathname:r}=jn(),l=JSON.stringify(Gd(n));return g.useMemo(()=>Jd(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Zg(e,t){return tp(e,t)}function tp(e,t,n,r,l){var f;ae(fl(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=g.useContext(xt),{matches:i}=g.useContext(It),s=i[i.length-1],a=s?s.params:{},u=s?s.pathname:"/",h=s?s.pathnameBase:"/",v=s&&s.route;{let d=v&&v.path||"";np(u,!v||d.endsWith("*")||d.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${u}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let y=jn(),S;if(t){let d=typeof t=="string"?Pn(t):t;ae(h==="/"||((f=d.pathname)==null?void 0:f.startsWith(h)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${d.pathname}" was given in the \`location\` prop.`),S=d}else S=y;let E=S.pathname||"/",k=E;if(h!=="/"){let d=h.replace(/^\//,"").split("/");k="/"+E.replace(/^\//,"").split("/").slice(d.length).join("/")}let L=Wd(e,{pathname:k});pt(v||L!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),pt(L==null||L[L.length-1].route.element!==void 0||L[L.length-1].route.Component!==void 0||L[L.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let m=qg(L&&L.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:Rt([h,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?h:Rt([h,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&m?g.createElement(cl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},m):m}function Jg(){let e=lv(),t=Bg(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:l},n):null,i)}var Gg=g.createElement(Jg,null),Xg=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?g.createElement(It.Provider,{value:this.props.routeContext},g.createElement(Ea.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Zg({routeContext:e,match:t,children:n}){let r=g.useContext(pr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(It.Provider,{value:e},n)}function qg(e,t=[],n=null,r=null,l=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let u=o.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);ae(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let a=!1,s=-1;if(n)for(let u=0;u=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((u,h,v)=>{let y,S=!1,E=null,k=null;n&&(y=i&&h.route.id?i[h.route.id]:void 0,E=h.route.errorElement||Gg,a&&(s<0&&v===0?(qd("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,k=null):s===v&&(S=!0,k=h.route.hydrateFallbackElement||null)));let L=t.concat(o.slice(0,v+1)),m=()=>{let f;return y?f=E:S?f=k:h.route.Component?f=g.createElement(h.route.Component,null):h.route.element?f=h.route.element:f=u,g.createElement(Zg,{match:h,routeContext:{outlet:u,matches:L,isDataRoute:n!=null},children:f})};return n&&(h.route.ErrorBoundary||h.route.errorElement||v===0)?g.createElement(Xg,{location:n.location,revalidation:n.revalidation,component:E,error:y,children:m(),routeContext:{outlet:null,matches:L,isDataRoute:!0},unstable_onError:r}):m()},null)}function Ca(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ev(e){let t=g.useContext(pr);return ae(t,Ca(e)),t}function tv(e){let t=g.useContext(Ho);return ae(t,Ca(e)),t}function nv(e){let t=g.useContext(It);return ae(t,Ca(e)),t}function Na(e){let t=nv(e),n=t.matches[t.matches.length-1];return ae(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function rv(){return Na("useRouteId")}function lv(){var r;let e=g.useContext(Ea),t=tv("useRouteError"),n=Na("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function ov(){let{router:e}=ev("useNavigate"),t=Na("useNavigate"),n=g.useRef(!1);return Xd(()=>{n.current=!0}),g.useCallback(async(l,o={})=>{pt(n.current,Gd),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var cc={};function qd(e,t,n){!t&&!cc[e]&&(cc[e]=!0,pt(!1,n))}g.memo(iv);function iv({routes:e,future:t,state:n,unstable_onError:r}){return Zd(e,void 0,n,r,t)}function ep(e){ae(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function sv({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ae(!fl(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),a=g.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=Pn(n));let{pathname:s="/",search:u="",hash:h="",state:v=null,key:y="default"}=n,S=g.useMemo(()=>{let E=zt(s,i);return E==null?null:{location:{pathname:E,search:u,hash:h,state:v,key:y},navigationType:r}},[i,s,u,h,v,y,r]);return pt(S!=null,` is not able to match the URL "${s}${u}${h}" because it does not start with the basename, so the won't render anything.`),S==null?null:g.createElement(xt.Provider,{value:a},g.createElement(cl.Provider,{children:t,value:S}))}function av({children:e,location:t}){return Yg(_s(e),t)}function _s(e,t=[]){let n=[];return g.Children.forEach(e,(r,l)=>{if(!g.isValidElement(r))return;let o=[...t,l];if(r.type===g.Fragment){n.push.apply(n,_s(r.props.children,o));return}ae(r.type===ep,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),ae(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=_s(r.props.children,o)),n.push(i)}),n}var Xl="get",Zl="application/x-www-form-urlencoded";function Wo(e){return e!=null&&typeof e.tagName=="string"}function uv(e){return Wo(e)&&e.tagName.toLowerCase()==="button"}function cv(e){return Wo(e)&&e.tagName.toLowerCase()==="form"}function fv(e){return Wo(e)&&e.tagName.toLowerCase()==="input"}function dv(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pv(e,t){return e.button===0&&(!t||t==="_self")&&!dv(e)}var Dl=null;function hv(){if(Dl===null)try{new FormData(document.createElement("form"),0),Dl=!1}catch{Dl=!0}return Dl}var mv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ri(e){return e!=null&&!mv.has(e)?(pt(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Zl}"`),null):e}function gv(e,t){let n,r,l,o,i;if(cv(e)){let a=e.getAttribute("action");r=a?zt(a,t):null,n=e.getAttribute("method")||Xl,l=Ri(e.getAttribute("enctype"))||Zl,o=new FormData(e)}else if(uv(e)||fv(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a `,E=`
${y}
`;return`
${S}${E}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function vy(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r/g,">");l=l.replace(/^#### (.+)$/gm,"

$1

").replace(/^### (.+)$/gm,"

$1

").replace(/^## (.+)$/gm,"

$1

").replace(/^# (.+)$/gm,"

$1

"),l=l.replace(/(.*?<\/h[1-4]>)[ \t]*\n(?:[ \t]*\n)+/g,`$1 +`),l=l.replace(/(^|\n)([ \t]*> .+(?:\n[ \t]*> .+)*)/g,(s,a,u)=>{const h=u.split(/\n/).map(v=>v.replace(/^[ \t]*>\s*/,"").trim()).join(` +`);return`${a}
${h}
`}),l=l.replace(/(^|\n)([ \t]*[-*] .+(?:\n[ \t]*[-*] .+)*)/g,(s,a,u)=>{const h=u.split(/\n/).map(v=>v.replace(/^[ \t]*[-*]\s+/,"").trim()).map(v=>`
  • ${v}
  • `).join("");return`${a}
      ${h}
    `});const o=/(^\|[^\n]*\|?\s*\n\|\s*[:\-]+(?:\s*\|\s*[:\-]+)+\s*\|?\s*\n(?:\|[^\n]*\|?\s*(?:\n|$))*)/gm;l=l.replace(o,s=>{const a=/\n$/.test(s),u=s.replace(/\n$/,"").split(` +`),h=d=>d.replace(/^\||\|$/g,"").split("|").map(C=>C.trim()),v=h(u[0]),y=h(u[1]);if(v.length<2||y.length<2||!y.every(d=>/^[ :\-]+$/.test(d)&&/-/.test(d)))return s;const S=y.map(d=>{const C=d.replace(/\s+/g,""),P=C.startsWith(":"),M=C.endsWith(":");return P&&M?"center":M?"right":"left"}),E=u.slice(2).filter(d=>/^\|/.test(d.trim())),k=d=>` style="text-align:${S[d]||"left"};vertical-align:top;padding:.6rem .75rem"`,L=v.map((d,C)=>`${d}`).join(""),m=E.map(d=>`${h(d).map((M,O)=>`${M}`).join("")}`).join("");return`${L}${m}
    `+(a?` +`:"")}),l=l.replace(/^---\s*$/gm,"
    ");let i=l.replace(/\*\*(.+?)\*\*/g,"$1").replace(new RegExp("(?$1").replace(/`(.+?)`/g,"$1");return i=i.replace(/\[([^\]]+?)\]\(([^)]+?)\)/g,'$1 $2'),i=i.replace(/\n/g,"
    "),i=i.replace(/
    \s*(
      )/g,"$1").replace(/(<\/ul>)\s*
      /g,"$1").replace(/
      \s*(
      ]*>)/g,"$1").replace(/(<\/div>)\s*
      /g,"$1").replace(/
      \s*(]*>)/g,"$1").replace(/(<\/table>)\s*
      /g,"$1").replace(/
      \s*(
      )/g,"$1").replace(/(<\/blockquote>)\s*
      /g,"$1"),i=i.replace(/(
      )[ \t]+/g,"$1").replace(/(
      )(?:[ \t]*
      )+/g,"$1").replace(/(<\/blockquote>)(?:[ \t]*
      )+/g,"$1").replace(/(<\/ul>)(?:[ \t]*
      )+/g,"$1"),i=i.replace(/@@CODEBLOCK(\d+)@@/g,(s,a)=>{const{lang:u,code:h}=n[+a],v=u&&u.trim()?u.trim():"code",y=h.replace(/&/g,"&").replace(//g,">"),S=`
      ${v}
      `,E=`
      ${y}
      `;return`
      ${S}${E}
      `}),i=i.replace(/
      \s*(?=
      ]*>[\s\S]*?<\/div>)\s*
      /g,"$1"),i}function Cy(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r/i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let a=e.substring(l+o);const s=a.match(n);let u=null,h=i;return s?(u=a.substring(0,s.index).trim(),h+=a.substring(s.index+s[0].length)):u=a.trim(),{think:u||null,answer:h.trim()}}function yy({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=cp(e||""),[o,i]=Me.useState(!1),a=!!r;return p.jsxs("div",{className:"assistant-message",children:[a&&p.jsxs("div",{className:"assistant-thoughts",children:[p.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[p.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&p.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:Ec(r)}})]}),p.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:Ec(l||e||"")}}),Array.isArray(n)&&n.length>0&&p.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let h=s,v=!1;try{const y=new URL(s);if(y.protocol==="file:"){v=!0;const S=y.pathname.split("/").filter(Boolean);h=decodeURIComponent(S[S.length-1]||s)}else h=(y.hostname||s).replace(/^www\./i,"")}catch{}return p.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:y=>{var S,E;if(v){y.preventDefault();try{const k=new URL(s);(E=(S=window.electronAPI)==null?void 0:S.openPath)==null||E.call(S,decodeURIComponent(k.pathname))}catch{}}},children:h},s+u)})})]})}const Cc="websearch.searxUrl",Nc="websearch.engines",_c="chat.libraryBySession",Lc="http://127.0.0.1:8888";let fp="http://127.0.0.1:8000";const wy=48,Sy=24;function xy(e){return e.backendApiUrl||e.ollamaApiUrl||fp}function ky(e){const t=typeof e=="string"?e.trim():"";return!t||t==="http://localhost:8888"?Lc:t}function Ey(){var Xa;const[e,t]=g.useState([]),[n,r]=g.useState(null),[l,o]=g.useState("chats"),[i,a]=g.useState("General"),[s,u]=g.useState(null),[h,v]=g.useState(null),[y,S]=g.useState([]),[E,k]=g.useState([]),[L,m]=g.useState(null),[f,d]=g.useState(()=>{try{const c=localStorage.getItem(_c);return c?JSON.parse(c):{}}catch{return{}}}),[C,P]=g.useState(!1),[M,z]=g.useState(""),[F,B]=g.useState(""),[A,q]=g.useState(!1),[ge,We]=g.useState(""),[be,_]=g.useState(""),T=g.useRef(null),H=g.useRef(null),R=g.useRef(null),[O,b]=g.useState(fp),[Z,pe]=g.useState("Default"),[kt,ht]=g.useState(!1),[Rn,lt]=g.useState(""),[Tn,bo]=g.useState(!1),[hr,dp]=g.useState(()=>ky(localStorage.getItem(Cc))),[un,pp]=g.useState(()=>{try{const c=localStorage.getItem(Nc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});g.useEffect(()=>{localStorage.setItem(Cc,hr||"")},[hr]),g.useEffect(()=>{try{localStorage.setItem(Nc,JSON.stringify(un||[]))}catch{}},[un]);const[pl,hp]=g.useState(!1),[Dt,Vo]=g.useState(!1),[ja,Qo]=g.useState(!0),[mp,$n]=g.useState([]),[hl,Ra]=g.useState({}),[Ta,gp]=g.useState(!1),$a=g.useRef(!1),[vp,Ko]=g.useState(null),[Yo,ml]=g.useState("");function yp(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:x}=cp(w);return(x||w).trim()}catch{return w.trim()}return w}async function Ma(c){try{await navigator.clipboard.writeText(yp(c))}catch(w){console.error("Failed to copy message:",w)}}function cn(c,w,x,N={}){const{removeIfEmpty:$=!1}=N;t(D=>D.map(W=>{if(W.session_id!==c)return W;const U=[];for(const V of W.messages||[]){if(V.id!==w){U.push(V);continue}$&&!x||U.push({...V,content:x})}return{...W,messages:U}}))}function At(c){return(c==null?void 0:c.name)==="AbortError"}function gl(c){return c instanceof Error&&c.message?c.message:String(c)}async function Jo(c){const w=await c.json().catch(()=>null);if(c.ok)return w;const x=typeof(w==null?void 0:w.detail)=="string"?w.detail:typeof(w==null?void 0:w.message)=="string"?w.message:"";throw new Error(x||`HTTP ${c.status}`)}async function wp(){const c=await fetch(`${O}/ollama/startup-status`);return Jo(c)}async function Oa(c,w,x){if(!c)return{contextBlock:null,sources:[]};const $=await(await fetch(`${O}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:x,body:JSON.stringify({prompt:w,top_k:5})})).json();return{contextBlock:typeof($==null?void 0:$.context_block)=="string"&&$.context_block.trim()?$.context_block.trim():null,sources:Array.isArray($==null?void 0:$.sources)?$.sources:[]}}function Sp(c,w){Ko(c),ml(w||"")}function vl(){Ko(null),ml("")}async function xp(c){var D;const w=(((D=Fn[c])==null?void 0:D.content)||"").trim(),N=(Yo??"").trim();if(N.length===0){vl();return}if(N===w){vl();return}const $=n;if($){t(W=>W.map(U=>{if(U.session_id!==$)return U;const Le=(U.messages||[]).slice(0,c+1).map((ve,Xe)=>Xe===c?{...ve,content:N}:ve);return{...U,messages:Le}})),Ko(null),ml(""),requestAnimationFrame(()=>ti("auto",$));try{const W=await fetch(`${O}/sessions/${$}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!W.ok)throw new Error(`HTTP ${W.status}`)}catch(W){console.error("Failed to update message:",W),t(U=>U.map(V=>{if(V.session_id!==$)return V;const ve=(V.messages||[]).map((Xe,Q)=>Q===c?{...Xe,content:w}:Xe);return{...V,messages:ve}}));return}await za(c,N)}}async function za(c,w=null){var Le,ve,Xe,Q,fe,ke;const x=n;if(Dt||!x||typeof c!="number")return;const N=((Le=e.find(G=>G.session_id===x))==null?void 0:Le.messages)||[];let $=c;for(let G=c;G>=0;G--)if(((ve=N[G])==null?void 0:ve.role)==="user"){$=G;break}t(G=>G.map(oe=>oe.session_id===x?{...oe,messages:(oe.messages||[]).slice(0,$+1)}:oe));const D=Ba(x);let W=w??(((Xe=N[$])==null?void 0:Xe.content)||""),U=[];const V=[];try{const G=Va(x),oe=w??(((Q=N[$])==null?void 0:Q.content)||"");if((fe=G==null?void 0:G.states)!=null&&fe.is_indexed)try{const K=await Oa(G.slug,oe,D.signal);K.contextBlock&&V.push(K.contextBlock),Array.isArray(K.sources)&&U.push(...K.sources)}catch(K){if(At(K))throw K;console.warn("local library enrichment (regenerate) failed",K)}if(pl)try{const K=N.slice(Math.max(0,$-7),$+1).map(he=>({role:he.role,content:he.content||""}));K.length>0&&(K[K.length-1]={role:"user",content:oe});const te=await(await fetch(`${O}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({prompt:oe,model:ge,messages:K,history_limit:8,searx_url:hr||null,engines:Array.isArray(un)?un:null})})).json();te&&typeof te.context_block=="string"&&te.context_block.trim()&&V.push(te.context_block.trim()),Array.isArray(te==null?void 0:te.sources)&&U.push(...te.sources)}catch(K){if(At(K))throw K;console.warn("web search enrichment (regenerate) failed",K)}if(U=[...new Set(U)],V.length>0?W=`${oe} +`+r}return e}function hp(e){if(!e)return{think:null,answer:""};const t=//i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let s=e.substring(l+o);const a=s.match(n);let u=null,h=i;return a?(u=s.substring(0,a.index).trim(),h+=s.substring(a.index+a[0].length)):u=s.trim(),{think:u||null,answer:h.trim()}}function Ny({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=hp(e||""),[o,i]=Me.useState(!1),s=!!r;return p.jsxs("div",{className:"assistant-message",children:[s&&p.jsxs("div",{className:"assistant-thoughts",children:[p.jsxs("button",{className:"think-toggle",onClick:()=>i(a=>!a),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[p.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&p.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:_c(r)}})]}),p.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:_c(l||e||"")}}),Array.isArray(n)&&n.length>0&&p.jsx("div",{className:"msg-sources chips",children:n.map((a,u)=>{let h=a,v=!1;try{const y=new URL(a);if(y.protocol==="file:"){v=!0;const S=y.pathname.split("/").filter(Boolean);h=decodeURIComponent(S[S.length-1]||a)}else h=(y.hostname||a).replace(/^www\./i,"")}catch{}return p.jsx("a",{className:"chip",href:a,target:"_blank",rel:"noreferrer",title:a,onClick:y=>{var S,E;if(v){y.preventDefault();try{const k=new URL(a);(E=(S=window.electronAPI)==null?void 0:S.openPath)==null||E.call(S,decodeURIComponent(k.pathname))}catch{}}},children:h},a+u)})})]})}const Lc="websearch.searxUrl",Pc="websearch.engines",jc="chat.libraryBySession",Rc="http://127.0.0.1:8888";let mp="http://127.0.0.1:8000";const _y=48,Ly=24;function Py(e){return e.backendApiUrl||e.ollamaApiUrl||mp}function jy(e){const t=typeof e=="string"?e.trim():"";return!t||t==="http://localhost:8888"?Rc:t}function Ry(){var eu;const[e,t]=g.useState([]),[n,r]=g.useState(null),[l,o]=g.useState("chats"),[i,s]=g.useState("General"),[a,u]=g.useState(null),[h,v]=g.useState(null),[y,S]=g.useState([]),[E,k]=g.useState([]),[L,m]=g.useState(null),[f,d]=g.useState(()=>{try{const c=localStorage.getItem(jc);return c?JSON.parse(c):{}}catch{return{}}}),[C,P]=g.useState(!1),[M,O]=g.useState(""),[F,B]=g.useState(""),[A,q]=g.useState(!1),[ge,We]=g.useState(""),[be,_]=g.useState(""),T=g.useRef(null),H=g.useRef(null),R=g.useRef(null),[z,b]=g.useState(mp),[Z,pe]=g.useState("Default"),[kt,ht]=g.useState(!1),[Rn,lt]=g.useState(""),[Tn,Qo]=g.useState(!1),[hr,gp]=g.useState(()=>jy(localStorage.getItem(Lc))),[un,vp]=g.useState(()=>ky(localStorage.getItem(Pc)));g.useEffect(()=>{localStorage.setItem(Lc,hr||"")},[hr]),g.useEffect(()=>{try{localStorage.setItem(Pc,JSON.stringify(Lo(un)))}catch{}},[un]);const[pl,yp]=g.useState(!1),[Dt,Ko]=g.useState(!1),[$a,Yo]=g.useState(!0),[wp,$n]=g.useState([]),[hl,Ma]=g.useState({}),[za,Sp]=g.useState(!1),Oa=g.useRef(!1),[xp,Go]=g.useState(null),[Jo,ml]=g.useState("");function kp(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:x}=hp(w);return(x||w).trim()}catch{return w.trim()}return w}async function Fa(c){try{await navigator.clipboard.writeText(kp(c))}catch(w){console.error("Failed to copy message:",w)}}function cn(c,w,x,N={}){const{removeIfEmpty:$=!1}=N;t(D=>D.map(W=>{if(W.session_id!==c)return W;const U=[];for(const V of W.messages||[]){if(V.id!==w){U.push(V);continue}$&&!x||U.push({...V,content:x})}return{...W,messages:U}}))}function At(c){return(c==null?void 0:c.name)==="AbortError"}function gl(c){return c instanceof Error&&c.message?c.message:String(c)}async function Xo(c){const w=await c.json().catch(()=>null);if(c.ok)return w;const x=typeof(w==null?void 0:w.detail)=="string"?w.detail:typeof(w==null?void 0:w.message)=="string"?w.message:"";throw new Error(x||`HTTP ${c.status}`)}async function Ep(){const c=await fetch(`${z}/ollama/startup-status`);return Xo(c)}async function Ia(c,w,x){if(!c)return{contextBlock:null,sources:[]};const $=await(await fetch(`${z}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:x,body:JSON.stringify({prompt:w,top_k:5})})).json();return{contextBlock:typeof($==null?void 0:$.context_block)=="string"&&$.context_block.trim()?$.context_block.trim():null,sources:Array.isArray($==null?void 0:$.sources)?$.sources:[]}}function Cp(c,w){Go(c),ml(w||"")}function vl(){Go(null),ml("")}async function Np(c){var D;const w=(((D=Fn[c])==null?void 0:D.content)||"").trim(),N=(Jo??"").trim();if(N.length===0){vl();return}if(N===w){vl();return}const $=n;if($){t(W=>W.map(U=>{if(U.session_id!==$)return U;const Le=(U.messages||[]).slice(0,c+1).map((ve,Xe)=>Xe===c?{...ve,content:N}:ve);return{...U,messages:Le}})),Go(null),ml(""),requestAnimationFrame(()=>ri("auto",$));try{const W=await fetch(`${z}/sessions/${$}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!W.ok)throw new Error(`HTTP ${W.status}`)}catch(W){console.error("Failed to update message:",W),t(U=>U.map(V=>{if(V.session_id!==$)return V;const ve=(V.messages||[]).map((Xe,Q)=>Q===c?{...Xe,content:w}:Xe);return{...V,messages:ve}}));return}await Da(c,N)}}async function Da(c,w=null){var Le,ve,Xe,Q,fe,ke;const x=n;if(Dt||!x||typeof c!="number")return;const N=((Le=e.find(J=>J.session_id===x))==null?void 0:Le.messages)||[];let $=c;for(let J=c;J>=0;J--)if(((ve=N[J])==null?void 0:ve.role)==="user"){$=J;break}t(J=>J.map(oe=>oe.session_id===x?{...oe,messages:(oe.messages||[]).slice(0,$+1)}:oe));const D=ba(x);let W=w??(((Xe=N[$])==null?void 0:Xe.content)||""),U=[];const V=[];try{const J=Ya(x),oe=w??(((Q=N[$])==null?void 0:Q.content)||"");if((fe=J==null?void 0:J.states)!=null&&fe.is_indexed)try{const K=await Ia(J.slug,oe,D.signal);K.contextBlock&&V.push(K.contextBlock),Array.isArray(K.sources)&&U.push(...K.sources)}catch(K){if(At(K))throw K;console.warn("local library enrichment (regenerate) failed",K)}if(pl)try{const K=N.slice(Math.max(0,$-7),$+1).map(he=>({role:he.role,content:he.content||""}));K.length>0&&(K[K.length-1]={role:"user",content:oe});const te=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({prompt:oe,model:ge,messages:K,history_limit:8,searx_url:hr||null,engines:Array.isArray(un)?un:null})})).json();te&&typeof te.context_block=="string"&&te.context_block.trim()&&V.push(te.context_block.trim()),Array.isArray(te==null?void 0:te.sources)&&U.push(...te.sources)}catch(K){if(At(K))throw K;console.warn("web search enrichment (regenerate) failed",K)}if(U=[...new Set(U)],V.length>0?W=`${oe} ${V.join(` -`)}`:W=null,kt){const K=`msg-${Date.now()}-${Math.random()}`;let Ct="";t(te=>te.map(he=>he.session_id===x?{...he,messages:[...he.messages||[],{id:K,role:"assistant",content:"",sources:U}]}:he));try{const te=await fetch(`${O}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ge,stream:!0,enriched_message:W,sources:U||[]})});if(!te.ok)throw new Error(`HTTP ${te.status}`);const he=(ke=te.body)==null?void 0:ke.getReader();if(!he)throw new Error("Missing response body");const Bt=new TextDecoder;let mt=!1;for(;;){const{value:pn,done:bp}=await he.read();if(bp)break;const Vp=Bt.decode(pn,{stream:!0});Ct+=Vp,cn(x,K,Ct),!mt&&_e.current!==x&&(mt=!0,fn(ni=>({...ni,[x]:K})),$n(ni=>[...new Set([...ni,x])]))}_e.current!==x?(fn(pn=>({...pn,[x]:K})),$n(pn=>[...new Set([...pn,x])])):Mn.current[x]?On(pn=>({...pn,[x]:K})):requestAnimationFrame(()=>In(K,"smooth",x))}catch(te){if(At(te)){cn(x,K,Ct,{removeIfEmpty:!0});return}console.error(te),cn(x,K,`Error: ${gl(te)}`,{removeIfEmpty:!0});return}}else{const K=await fetch(`${O}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ge,stream:!1,enriched_message:W,sources:U||[]})});if(!K.ok)throw new Error(`HTTP ${K.status}`);const Ct=await K.json(),te=`msg-${Date.now()}`;t(he=>he.map(Bt=>Bt.session_id===x?{...Bt,messages:[...Bt.messages||[],{role:"assistant",content:Ct.reply,id:te,sources:U}]}:Bt)),_e.current!==x?(fn(he=>({...he,[x]:te})),$n(he=>[...new Set([...he,x])])):Mn.current[x]?On(he=>({...he,[x]:te})):requestAnimationFrame(()=>In(te,"smooth",x))}}catch(G){At(G)||console.error(G)}finally{Go(D)}}const[Fa,kp]=g.useState({}),Mn=g.useRef({}),[Ep,fn]=g.useState({}),dn=g.useRef({}),Ia=g.useRef({}),[Da,On]=g.useState({}),[Cp,Aa]=g.useState({}),Ua=(c,w,x)=>c!=null&&c.id?c.id:`${x}:${w}`;g.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(x=>x.session_id===n))==null?void 0:w.messages)||[];Aa(x=>{const N={};return c.forEach(($,D)=>{if($.role!=="user")return;const W=Ua($,D,n),V=($.content||"").split(/\r\n|\r|\n/).length>30;N[W]=V?x[W]??!0:!1}),N})},[e,n]);function Np(c){Aa(w=>({...w,[c]:!(w[c]??!0)}))}const mr=Me.useCallback((c,w)=>{kp(x=>{const N={...x,[c]:w};return Mn.current=N,N})},[]),zn=g.useRef(null),_p=g.useRef(!1),Lp=g.useRef(null),_e=g.useRef(n);g.useEffect(()=>{_e.current=n},[n]);const Ba=Me.useCallback(c=>{const w=new AbortController;return zn.current={controller:w,sessionId:c},Vo(!0),w},[]),Go=Me.useCallback(c=>{var w;((w=zn.current)==null?void 0:w.controller)===c&&(zn.current=null,Vo(!1))},[]),Pp=Me.useCallback(()=>{const c=zn.current;c&&(zn.current=null,c.controller.abort(),Vo(!1))},[]);g.useEffect(()=>()=>{var c;(c=zn.current)==null||c.controller.abort()},[]);const Ut=g.useRef(null),[jp,Rp]=g.useState(230),[yl,Ha]=g.useState(!1),Tp=Me.useCallback(c=>{Ha(!0)},[]),Xo=Me.useCallback(()=>{Ha(!1)},[]),Zo=Me.useCallback(c=>{if(yl){const w=Math.max(230,Math.min(500,c.clientX));Rp(w)}},[yl]);Me.useEffect(()=>(window.addEventListener("mousemove",Zo),window.addEventListener("mouseup",Xo),()=>{window.removeEventListener("mousemove",Zo),window.removeEventListener("mouseup",Xo)}),[Zo,Xo]),Me.useEffect(()=>{yl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[yl]),Me.useEffect(()=>{const c=async w=>{const x=w.target.closest(".codeblock__copy");if(!x)return;const N=x.closest(".codeblock"),$=N==null?void 0:N.querySelector("pre > code");if($)try{await navigator.clipboard.writeText($.textContent||""),x.classList.add("copied"),setTimeout(()=>x.classList.remove("copied"),800)}catch(D){console.error("Copy failed:",D)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),g.useEffect(()=>{window.electronAPI.getSettings().then(w=>{b(xy(w)),pe(w.colorScheme||"Default"),We(w.chatModel||""),ht(w.streamOutput||!1),Ra(w.scrollPositions||{}),ll(w.colorScheme||"Default")}).finally(()=>{gp(!0)});const c=()=>{var w;l==="chats"&&((w=H.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),g.useEffect(()=>{if(!Ta||ja||!O||$a.current)return;$a.current=!0;let c=!1;const w=window.setTimeout(()=>{(async()=>{let x=!1;try{let N=await wp();if(c)return;if(!(N!=null&&N.ollama_running)&&(N!=null&&N.can_manage_locally)){const $=window.confirm(`Ollama is not running at ${N.ollama_url}. Start it in the background now with "ollama serve"?`);if(c)return;if($){x=!0,bo(!0),lt("Starting Ollama in the background...");const D=await fetch(`${O}/ollama/start`,{method:"POST"});if(N=await Jo(D),c)return}}if(N!=null&&N.ollama_running&&!(N!=null&&N.embedding_model_available)&&(N!=null&&N.can_manage_locally)){const $=window.confirm(`The selected embedding model "${N.selected_embed_model}" is not installed in Ollama. Pull it now?`);if(c)return;if($){x=!0,bo(!0),lt(`Downloading ${N.selected_embed_model} from Ollama. This can take a while on first install.`);const D=await fetch(`${O}/ollama/pull`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:N.selected_embed_model})});if(await Jo(D),c)return}}}catch(N){c||(console.warn("startup Ollama check failed",N),x&&window.alert(`Startup action failed: ${gl(N)}`))}finally{c||(bo(!1),lt(""))}})()},1200);return()=>{c=!0,window.clearTimeout(w)}},[O,ja,Ta]),g.useEffect(()=>{ll(Z)},[Z]);const $p=c=>{!c||!O||fetch(`${O}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(x=>x.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function gr(){if(O)try{const w=await(await fetch(`${O}/libraries`)).json(),x=Array.isArray(w.libraries)?w.libraries:[];if(S(x),x.length===0){m(null);return}x.some(N=>N.slug===L)||m(x[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function wl(){if(O)try{const w=await(await fetch(`${O}/jobs`)).json();k(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function Wa(c=null){const x=(typeof c=="string"?c:M).trim();if(!x){B("Name is required.");return}try{B("");const N=await fetch(`${O}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})});if(!N.ok){const D=await N.text();throw new Error(D||`HTTP ${N.status}`)}const $=await N.json();P(!1),z(""),await gr(),$!=null&&$.slug&&m($.slug)}catch(N){console.error("Failed to create library",N),B(String((N==null?void 0:N.message)||N))}}async function Mp(){S([]),k([]),m(null),v(null),q(!1),d({}),await gr(),await wl()}g.useEffect(()=>{O&&(Qo(!0),fetch(`${O}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(x=>({...x,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Qo(!1)}).catch(()=>{Qo(!1)}))},[O]),g.useEffect(()=>{O&&(gr(),wl())},[O]),g.useEffect(()=>{try{localStorage.setItem(_c,JSON.stringify(f||{}))}catch{}},[f]),g.useEffect(()=>{if(!O)return;const c=setInterval(()=>{gr(),wl()},3e3);return()=>clearInterval(c)},[O,l,L]),g.useEffect(()=>{$p(n)},[n,O]),g.useEffect(()=>{const c=new Set(y.map(w=>w.slug));d(w=>{let x=!1;const N={};for(const[$,D]of Object.entries(w||{}))c.has(D)?N[$]=D:x=!0;return x?N:w})},[y]);const qo=c=>{o(c)},Op=c=>{Ap(c)},Fn=g.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),Sl=g.useMemo(()=>y.find(c=>c.slug===L)||null,[L,y]),Et=n&&f[n]||null,ot=g.useMemo(()=>y.find(c=>c.slug===Et)||null,[Et,y]),ba=g.useMemo(()=>Et?E.some(c=>c.slug===Et&&(c.status==="queued"||c.status==="running")):!1,[Et,E]),ei=g.useMemo(()=>{var c,w;return ot?(c=ot.files)!=null&&c.length?(w=ot.states)!=null&&w.is_indexed?"":ba?" (syncing)":" (needs sync)":" (empty)":""},[ot,ba]);function zp(c){return c&&f[c]||null}function Va(c){const w=zp(c);return w&&y.find(x=>x.slug===w)||null}function Qa(c){return c?E.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Ka(c,w){c&&d(x=>{const N={...x||{}};return w?N[c]=w:delete N[c],N})}function Fp(c){c&&d(w=>{let x=!1;const N={};for(const[$,D]of Object.entries(w||{})){if(D===c){x=!0;continue}N[$]=D}return x?N:w})}g.useEffect(()=>{if(!A)return;const c=w=>{var x;(x=R.current)!=null&&x.contains(w.target)||q(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[A]),g.useEffect(()=>{q(!1)},[n,l]),g.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const x=typeof dn.current[c]=="number"?dn.current[c]:T.current?T.current.scrollTop:0;Ra(N=>{const $={...N,[c]:x};return window.electronAPI.updateSettings({scrollPositions:$}),$})}}},[n,l]),g.useEffect(()=>{const c=T.current;if(!c)return;const w=()=>{const{scrollTop:x,scrollHeight:N,clientHeight:$}=c,D=N-x-$<=Sy;if(n){const W=Ia.current[n],U=typeof W=="number"&&xc.removeEventListener("scroll",w)},[n,mr]),g.useEffect(()=>{const c=n;c&&Fa[c]===!1&&On(w=>{if(!(c in w))return w;const x={...w};return delete x[c],x})},[n,Fa]),g.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=T.current;if(!c)return;Ut.current=null;const w=()=>{if(Ut.current===n)return;const W=typeof dn.current[n]=="number"?dn.current[n]:void 0,U=typeof W=="number"?W:hl[n];if(typeof U=="number"){c.scrollTop=U,Ut.current=n;return}Fn.length>0&&(c.scrollTop=c.scrollHeight,Ut.current=n)};w();const x=requestAnimationFrame(w),N=()=>{Ut.current!==n&&requestAnimationFrame(w)},$=new MutationObserver(N);$.observe(c,{childList:!0,subtree:!0});const D=new ResizeObserver(N);return D.observe(c),()=>{cancelAnimationFrame(x),$.disconnect(),D.disconnect()}},[n,l,Fn.length,hl]),g.useEffect(()=>{if(l!=="chats"||!n||Ut.current===n)return;const c=typeof dn.current[n]=="number"?dn.current[n]:void 0;typeof(typeof c=="number"?c:hl[n])!="number"&&Fn.length>0&&requestAnimationFrame(()=>{const x=T.current;x&&(x.scrollTop=x.scrollHeight,Ut.current=n)})},[Fn.length,n,l,hl]);const ti=(c="smooth",w=null)=>{const x=T.current;if(!x)return;const N=w??_e.current;_e.current===N&&(x.scrollTo({top:x.scrollHeight,behavior:c}),mr(N,!1))},In=(c,w="auto",x=null)=>{const N=T.current;if(!N)return;const $=x??_e.current;if(_e.current!==$)return;const D=document.getElementById(c);if(D){const W=Math.max(0,D.offsetTop-wy);N.scrollTo({top:W,behavior:w})}},Ip=()=>{const c=_e.current,w=Da[c];w&&(In(w,"smooth",c),On(x=>{const{[c]:N,...$}=x;return $}))};async function Ya(){var $,D,W;if(Dt||!be.trim()||!ge)return;let c=n,w=!1;if(c){const U=e.find(V=>V.session_id===c);w=U&&U.name==="New Chat"&&U.messages.length===0}else{const U=await Ja();await new Promise(V=>setTimeout(V,200)),c=U.session_id,w=!0}const x={role:"user",content:be.trim(),id:`msg-${Date.now()}-${Math.random()}`};_p.current=!0,Lp.current=c,mr(c,!1),_e.current===c&&(Ut.current=_e.current),Bd.flushSync(()=>{t(U=>U.map(V=>V.session_id===c?{...V,messages:[...V.messages||[],x]}:V)),_("")}),requestAnimationFrame(()=>ti("auto",c));const N=Ba(c);try{let U=[];try{U=[...((($=e.find(ke=>ke.session_id===c))==null?void 0:$.messages)||[]).slice(-8).map(ke=>({role:ke.role,content:ke.content||""})),{role:"user",content:x.content}]}catch{}let V=x.content,Le=[];const ve=[],Xe=Va(c);if((D=Xe==null?void 0:Xe.states)!=null&&D.is_indexed)try{const Q=await Oa(Xe.slug,x.content,N.signal);Q.contextBlock&&ve.push(Q.contextBlock),Array.isArray(Q.sources)&&Le.push(...Q.sources)}catch(Q){if(At(Q))throw Q;console.warn("local library enrichment failed",Q)}if(pl)try{const fe=await(await fetch(`${O}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:x.content,model:ge,messages:U,history_limit:8,searx_url:hr||null,engines:Array.isArray(un)?un:null})})).json();fe&&typeof fe.context_block=="string"&&fe.context_block.trim()&&ve.push(fe.context_block.trim()),Array.isArray(fe==null?void 0:fe.sources)&&Le.push(...fe.sources)}catch(Q){if(At(Q))throw Q;console.warn("web search enrichment failed",Q)}if(Le=[...new Set(Le)],ve.length>0&&(V=`${x.content} +`)}`:W=null,kt){const K=`msg-${Date.now()}-${Math.random()}`;let Ct="";t(te=>te.map(he=>he.session_id===x?{...he,messages:[...he.messages||[],{id:K,role:"assistant",content:"",sources:U}]}:he));try{const te=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ge,stream:!0,enriched_message:W,sources:U||[]})});if(!te.ok)throw new Error(`HTTP ${te.status}`);const he=(ke=te.body)==null?void 0:ke.getReader();if(!he)throw new Error("Missing response body");const Bt=new TextDecoder;let mt=!1;for(;;){const{value:pn,done:Yp}=await he.read();if(Yp)break;const Gp=Bt.decode(pn,{stream:!0});Ct+=Gp,cn(x,K,Ct),!mt&&_e.current!==x&&(mt=!0,fn(li=>({...li,[x]:K})),$n(li=>[...new Set([...li,x])]))}_e.current!==x?(fn(pn=>({...pn,[x]:K})),$n(pn=>[...new Set([...pn,x])])):Mn.current[x]?zn(pn=>({...pn,[x]:K})):requestAnimationFrame(()=>In(K,"smooth",x))}catch(te){if(At(te)){cn(x,K,Ct,{removeIfEmpty:!0});return}console.error(te),cn(x,K,`Error: ${gl(te)}`,{removeIfEmpty:!0});return}}else{const K=await fetch(`${z}/sessions/${x}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:ge,stream:!1,enriched_message:W,sources:U||[]})});if(!K.ok)throw new Error(`HTTP ${K.status}`);const Ct=await K.json(),te=`msg-${Date.now()}`;t(he=>he.map(Bt=>Bt.session_id===x?{...Bt,messages:[...Bt.messages||[],{role:"assistant",content:Ct.reply,id:te,sources:U}]}:Bt)),_e.current!==x?(fn(he=>({...he,[x]:te})),$n(he=>[...new Set([...he,x])])):Mn.current[x]?zn(he=>({...he,[x]:te})):requestAnimationFrame(()=>In(te,"smooth",x))}}catch(J){At(J)||console.error(J)}finally{Zo(D)}}const[Aa,_p]=g.useState({}),Mn=g.useRef({}),[Lp,fn]=g.useState({}),dn=g.useRef({}),Ua=g.useRef({}),[Ba,zn]=g.useState({}),[Pp,Ha]=g.useState({}),Wa=(c,w,x)=>c!=null&&c.id?c.id:`${x}:${w}`;g.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(x=>x.session_id===n))==null?void 0:w.messages)||[];Ha(x=>{const N={};return c.forEach(($,D)=>{if($.role!=="user")return;const W=Wa($,D,n),V=($.content||"").split(/\r\n|\r|\n/).length>30;N[W]=V?x[W]??!0:!1}),N})},[e,n]);function jp(c){Ha(w=>({...w,[c]:!(w[c]??!0)}))}const mr=Me.useCallback((c,w)=>{_p(x=>{const N={...x,[c]:w};return Mn.current=N,N})},[]),On=g.useRef(null),Rp=g.useRef(!1),Tp=g.useRef(null),_e=g.useRef(n);g.useEffect(()=>{_e.current=n},[n]);const ba=Me.useCallback(c=>{const w=new AbortController;return On.current={controller:w,sessionId:c},Ko(!0),w},[]),Zo=Me.useCallback(c=>{var w;((w=On.current)==null?void 0:w.controller)===c&&(On.current=null,Ko(!1))},[]),$p=Me.useCallback(()=>{const c=On.current;c&&(On.current=null,c.controller.abort(),Ko(!1))},[]);g.useEffect(()=>()=>{var c;(c=On.current)==null||c.controller.abort()},[]);const Ut=g.useRef(null),[Mp,zp]=g.useState(230),[yl,Va]=g.useState(!1),Op=Me.useCallback(c=>{Va(!0)},[]),qo=Me.useCallback(()=>{Va(!1)},[]),ei=Me.useCallback(c=>{if(yl){const w=Math.max(230,Math.min(500,c.clientX));zp(w)}},[yl]);Me.useEffect(()=>(window.addEventListener("mousemove",ei),window.addEventListener("mouseup",qo),()=>{window.removeEventListener("mousemove",ei),window.removeEventListener("mouseup",qo)}),[ei,qo]),Me.useEffect(()=>{yl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[yl]),Me.useEffect(()=>{const c=async w=>{const x=w.target.closest(".codeblock__copy");if(!x)return;const N=x.closest(".codeblock"),$=N==null?void 0:N.querySelector("pre > code");if($)try{await navigator.clipboard.writeText($.textContent||""),x.classList.add("copied"),setTimeout(()=>x.classList.remove("copied"),800)}catch(D){console.error("Copy failed:",D)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),g.useEffect(()=>{window.electronAPI.getSettings().then(w=>{b(Py(w)),pe(w.colorScheme||"Default"),We(w.chatModel||""),ht(w.streamOutput||!1),Ma(w.scrollPositions||{}),ll(w.colorScheme||"Default")}).finally(()=>{Sp(!0)});const c=()=>{var w;l==="chats"&&((w=H.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),g.useEffect(()=>{if(!za||$a||!z||Oa.current)return;Oa.current=!0;let c=!1;const w=window.setTimeout(()=>{(async()=>{let x=!1;try{let N=await Ep();if(c)return;if(!(N!=null&&N.ollama_running)&&(N!=null&&N.can_manage_locally)){const $=window.confirm(`Ollama is not running at ${N.ollama_url}. Start it in the background now with "ollama serve"?`);if(c)return;if($){x=!0,Qo(!0),lt("Starting Ollama in the background...");const D=await fetch(`${z}/ollama/start`,{method:"POST"});if(N=await Xo(D),c)return}}if(N!=null&&N.ollama_running&&!(N!=null&&N.embedding_model_available)&&(N!=null&&N.can_manage_locally)){const $=window.confirm(`The selected embedding model "${N.selected_embed_model}" is not installed in Ollama. Pull it now?`);if(c)return;if($){x=!0,Qo(!0),lt(`Downloading ${N.selected_embed_model} from Ollama. This can take a while on first install.`);const D=await fetch(`${z}/ollama/pull`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:N.selected_embed_model})});if(await Xo(D),c)return}}}catch(N){c||(console.warn("startup Ollama check failed",N),x&&window.alert(`Startup action failed: ${gl(N)}`))}finally{c||(Qo(!1),lt(""))}})()},1200);return()=>{c=!0,window.clearTimeout(w)}},[z,$a,za]),g.useEffect(()=>{ll(Z)},[Z]);const Fp=c=>{!c||!z||fetch(`${z}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(x=>x.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function gr(){if(z)try{const w=await(await fetch(`${z}/libraries`)).json(),x=Array.isArray(w.libraries)?w.libraries:[];if(S(x),x.length===0){m(null);return}x.some(N=>N.slug===L)||m(x[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function wl(){if(z)try{const w=await(await fetch(`${z}/jobs`)).json();k(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function Qa(c=null){const x=(typeof c=="string"?c:M).trim();if(!x){B("Name is required.");return}try{B("");const N=await fetch(`${z}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})});if(!N.ok){const D=await N.text();throw new Error(D||`HTTP ${N.status}`)}const $=await N.json();P(!1),O(""),await gr(),$!=null&&$.slug&&m($.slug)}catch(N){console.error("Failed to create library",N),B(String((N==null?void 0:N.message)||N))}}async function Ip(){S([]),k([]),m(null),v(null),q(!1),d({}),await gr(),await wl()}g.useEffect(()=>{z&&(Yo(!0),fetch(`${z}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(x=>({...x,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Yo(!1)}).catch(()=>{Yo(!1)}))},[z]),g.useEffect(()=>{z&&(gr(),wl())},[z]),g.useEffect(()=>{try{localStorage.setItem(jc,JSON.stringify(f||{}))}catch{}},[f]),g.useEffect(()=>{if(!z)return;const c=setInterval(()=>{gr(),wl()},3e3);return()=>clearInterval(c)},[z,l,L]),g.useEffect(()=>{Fp(n)},[n,z]),g.useEffect(()=>{const c=new Set(y.map(w=>w.slug));d(w=>{let x=!1;const N={};for(const[$,D]of Object.entries(w||{}))c.has(D)?N[$]=D:x=!0;return x?N:w})},[y]);const ti=c=>{o(c)},Dp=c=>{Wp(c)},Fn=g.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),Sl=g.useMemo(()=>y.find(c=>c.slug===L)||null,[L,y]),Et=n&&f[n]||null,ot=g.useMemo(()=>y.find(c=>c.slug===Et)||null,[Et,y]),Ka=g.useMemo(()=>Et?E.some(c=>c.slug===Et&&(c.status==="queued"||c.status==="running")):!1,[Et,E]),ni=g.useMemo(()=>{var c,w;return ot?(c=ot.files)!=null&&c.length?(w=ot.states)!=null&&w.is_indexed?"":Ka?" (syncing)":" (needs sync)":" (empty)":""},[ot,Ka]);function Ap(c){return c&&f[c]||null}function Ya(c){const w=Ap(c);return w&&y.find(x=>x.slug===w)||null}function Ga(c){return c?E.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Ja(c,w){c&&d(x=>{const N={...x||{}};return w?N[c]=w:delete N[c],N})}function Up(c){c&&d(w=>{let x=!1;const N={};for(const[$,D]of Object.entries(w||{})){if(D===c){x=!0;continue}N[$]=D}return x?N:w})}g.useEffect(()=>{if(!A)return;const c=w=>{var x;(x=R.current)!=null&&x.contains(w.target)||q(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[A]),g.useEffect(()=>{q(!1)},[n,l]),g.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const x=typeof dn.current[c]=="number"?dn.current[c]:T.current?T.current.scrollTop:0;Ma(N=>{const $={...N,[c]:x};return window.electronAPI.updateSettings({scrollPositions:$}),$})}}},[n,l]),g.useEffect(()=>{const c=T.current;if(!c)return;const w=()=>{const{scrollTop:x,scrollHeight:N,clientHeight:$}=c,D=N-x-$<=Ly;if(n){const W=Ua.current[n],U=typeof W=="number"&&xc.removeEventListener("scroll",w)},[n,mr]),g.useEffect(()=>{const c=n;c&&Aa[c]===!1&&zn(w=>{if(!(c in w))return w;const x={...w};return delete x[c],x})},[n,Aa]),g.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=T.current;if(!c)return;Ut.current=null;const w=()=>{if(Ut.current===n)return;const W=typeof dn.current[n]=="number"?dn.current[n]:void 0,U=typeof W=="number"?W:hl[n];if(typeof U=="number"){c.scrollTop=U,Ut.current=n;return}Fn.length>0&&(c.scrollTop=c.scrollHeight,Ut.current=n)};w();const x=requestAnimationFrame(w),N=()=>{Ut.current!==n&&requestAnimationFrame(w)},$=new MutationObserver(N);$.observe(c,{childList:!0,subtree:!0});const D=new ResizeObserver(N);return D.observe(c),()=>{cancelAnimationFrame(x),$.disconnect(),D.disconnect()}},[n,l,Fn.length,hl]),g.useEffect(()=>{if(l!=="chats"||!n||Ut.current===n)return;const c=typeof dn.current[n]=="number"?dn.current[n]:void 0;typeof(typeof c=="number"?c:hl[n])!="number"&&Fn.length>0&&requestAnimationFrame(()=>{const x=T.current;x&&(x.scrollTop=x.scrollHeight,Ut.current=n)})},[Fn.length,n,l,hl]);const ri=(c="smooth",w=null)=>{const x=T.current;if(!x)return;const N=w??_e.current;_e.current===N&&(x.scrollTo({top:x.scrollHeight,behavior:c}),mr(N,!1))},In=(c,w="auto",x=null)=>{const N=T.current;if(!N)return;const $=x??_e.current;if(_e.current!==$)return;const D=document.getElementById(c);if(D){const W=Math.max(0,D.offsetTop-_y);N.scrollTo({top:W,behavior:w})}},Bp=()=>{const c=_e.current,w=Ba[c];w&&(In(w,"smooth",c),zn(x=>{const{[c]:N,...$}=x;return $}))};async function Xa(){var $,D,W;if(Dt||!be.trim()||!ge)return;let c=n,w=!1;if(c){const U=e.find(V=>V.session_id===c);w=U&&U.name==="New Chat"&&U.messages.length===0}else{const U=await Za();await new Promise(V=>setTimeout(V,200)),c=U.session_id,w=!0}const x={role:"user",content:be.trim(),id:`msg-${Date.now()}-${Math.random()}`};Rp.current=!0,Tp.current=c,mr(c,!1),_e.current===c&&(Ut.current=_e.current),bd.flushSync(()=>{t(U=>U.map(V=>V.session_id===c?{...V,messages:[...V.messages||[],x]}:V)),_("")}),requestAnimationFrame(()=>ri("auto",c));const N=ba(c);try{let U=[];try{U=[...((($=e.find(ke=>ke.session_id===c))==null?void 0:$.messages)||[]).slice(-8).map(ke=>({role:ke.role,content:ke.content||""})),{role:"user",content:x.content}]}catch{}let V=x.content,Le=[];const ve=[],Xe=Ya(c);if((D=Xe==null?void 0:Xe.states)!=null&&D.is_indexed)try{const Q=await Ia(Xe.slug,x.content,N.signal);Q.contextBlock&&ve.push(Q.contextBlock),Array.isArray(Q.sources)&&Le.push(...Q.sources)}catch(Q){if(At(Q))throw Q;console.warn("local library enrichment failed",Q)}if(pl)try{const fe=await(await fetch(`${z}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:x.content,model:ge,messages:U,history_limit:8,searx_url:hr||null,engines:Array.isArray(un)?un:null})})).json();fe&&typeof fe.context_block=="string"&&fe.context_block.trim()&&ve.push(fe.context_block.trim()),Array.isArray(fe==null?void 0:fe.sources)&&Le.push(...fe.sources)}catch(Q){if(At(Q))throw Q;console.warn("web search enrichment failed",Q)}if(Le=[...new Set(Le)],ve.length>0&&(V=`${x.content} ${ve.join(` -`)}`),kt){const Q=`msg-${Date.now()}-${Math.random()}`;let fe="";const ke={role:"assistant",content:"",id:Q,sources:Le};t(G=>G.map(oe=>oe.session_id===c?{...oe,messages:[...oe.messages||[],ke]}:oe));try{const G=await fetch(`${O}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ge,message:x.content,enriched_message:ve.length>0?V:null,stream:!0,sources:Le||[]})});if(!G.ok)throw new Error(`HTTP ${G.status}`);const oe=(W=G.body)==null?void 0:W.getReader();if(!oe)throw new Error("Missing response body");const K=new TextDecoder;let Ct=!1;for(;;){const{value:te,done:he}=await oe.read();if(he){cn(c,Q,fe),_e.current===c?Mn.current[c]?On(mt=>({...mt,[c]:Q})):requestAnimationFrame(()=>In(Q,"smooth",c)):(fn(mt=>({...mt,[c]:Q})),$n(mt=>[...new Set([...mt,c])]));break}const Bt=K.decode(te,{stream:!0});fe+=Bt,cn(c,Q,fe),_e.current===c&&!Mn.current[c]&&ti("auto",c),_e.current!==c&&!Ct&&(fn(mt=>({...mt,[c]:Q})),Ct=!0)}}catch(G){if(At(G)){cn(c,Q,fe,{removeIfEmpty:!0});return}console.error("Failed to send message:",G),cn(c,Q,"Error: "+gl(G),{removeIfEmpty:!0});return}}else{const Q=await fetch(`${O}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ge,message:x.content,enriched_message:ve.length>0?V:null,stream:!1,sources:Le||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const fe=await Q.json(),ke=`msg-${Date.now()}`,G={role:"assistant",content:fe.reply,id:ke,sources:Le};t(oe=>oe.map(K=>K.session_id===c?{...K,messages:[...K.messages||[],G]}:K)),ke&&(_e.current===c?Mn.current[c]?On(oe=>({...oe,[c]:ke})):requestAnimationFrame(()=>In(ke,"smooth",c)):fn(oe=>({...oe,[c]:ke})))}_e.current!==c&&$n(Q=>[...new Set([...Q,c])]),w&&fetch(`${O}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:x.content,model:ge})}).then(Q=>Q.json()).then(Q=>{const fe=Q.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(ke=>ke.map(G=>G.session_id===c?{...G,name:fe}:G))})}catch(U){if(At(U)){Go(N);return}console.error("Failed to send message:",U);const V={role:"assistant",content:"Error: "+gl(U),id:`msg-${Date.now()}-${Math.random()}`};t(Le=>Le.map(ve=>ve.session_id===c?{...ve,messages:[...ve.messages,V]}:ve))}finally{Go(N)}}function Dp(){hp(c=>!c)}async function Ja(){var $;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),x=await(await fetch(`${O}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...x,messages:[]};return t(D=>[N,...D]),r(x.session_id),($=H.current)==null||$.focus(),x}function Ap(c){r(c),$n(x=>x.filter(N=>N!==c));const w=Ep[c];w&&requestAnimationFrame(()=>{let x=12;const N=()=>{if(!T.current)return;let D=document.getElementById(w);if(!D){const W=e.find(U=>U.session_id===c);if(W&&Array.isArray(W.messages))for(let U=W.messages.length-1;U>=0;U--){const V=W.messages[U];if(V.role==="assistant"&&V.id){D=document.getElementById(V.id);break}}}D?(In(D.id,"smooth",c),fn(W=>{const{[c]:U,...V}=W;return V})):x-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function Up(c,w){fetch(`${O}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(x=>x.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function Bp(c,w){const x=(w||"").trim(),N=y.find($=>$.slug===c);if(!N){v(null);return}if(!x||x===N.name){v(null);return}fetch(`${O}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})}).then(()=>{S($=>$.map(D=>D.slug===c?{...D,name:x}:D)),v(null)})}function Ga(c){fetch(`${O}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(x=>x.session_id!==c);t(w),d(x=>{const N={...x||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}function Hp(c){fetch(`${O}/libraries/${c}`,{method:"DELETE"}).then(async w=>{var N;if(!w.ok){const $=await w.text();throw new Error($||`HTTP ${w.status}`)}const x=y.filter($=>$.slug!==c);S(x),k($=>$.filter(D=>D.slug!==c)),v($=>$===c?null:$),L===c&&m(((N=x[0])==null?void 0:N.slug)||null),Fp(c)}).catch(w=>{console.error("Failed to delete library",w)})}g.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{Ga(w.session_id)})},[n,e,O]);const Wp=c=>{var x;window.getSelection().toString().length>0||document.activeElement!==H.current&&(c.target.closest(".msg")||(x=H.current)==null||x.focus())};return p.jsxs("div",{className:"app",style:{gridTemplateColumns:`${jp}px 1fr`},children:[p.jsxs("div",{className:"sidebar",children:[p.jsxs("div",{className:"sidebar-header",children:[p.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>qo("chats"),children:"Chats"}),p.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>qo("dbs"),children:"DBs"}),p.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>qo("settings"),children:"Settings"})]}),p.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&p.jsx("div",{className:"chat-list",children:e.map(c=>p.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>Op(c.session_id),children:s===c.session_id?p.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?Up(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):p.jsxs(p.Fragment,{children:[p.jsx("span",{children:c.name}),p.jsxs("div",{className:"chat-item-buttons",children:[mp.includes(c.session_id)&&p.jsx("div",{className:"unread-dot"}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:p.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ga(c.session_id)},children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&p.jsx("div",{className:"db-list",children:y.length===0?p.jsx("div",{className:"empty-list-message",children:"No databases yet."}):y.map(c=>p.jsx("div",{className:`chat-item ${c.slug===L?"active":""}`,onClick:()=>m(c.slug),children:h===c.slug?p.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>v(null),onKeyDown:w=>{w.key==="Enter"?Bp(c.slug,w.target.value):w.key==="Escape"&&v(null)},autoFocus:!0}):p.jsxs(p.Fragment,{children:[p.jsx("span",{children:c.name}),p.jsxs("div",{className:"chat-item-buttons",children:[Et===c.slug&&p.jsx("div",{className:"db-active-badge",children:"Chat"}),Qa(c.slug)&&p.jsx("div",{className:"db-active-badge",children:"Syncing"}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),v(c.slug)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:p.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Hp(c.slug)},children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.slug))}),l==="settings"&&p.jsxs("div",{className:"settings-list",children:[p.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),p.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),p.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&p.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&p.jsx("button",{className:"button new-chat-button",onClick:Ja,children:"New Chat"}),l==="dbs"&&(C?p.jsxs("div",{className:"new-db-form",children:[p.jsx("input",{type:"text",className:"rename-input",value:M,onChange:c=>z(c.target.value),onKeyDown:c=>{c.key==="Enter"?Wa():c.key==="Escape"&&(P(!1),z(""),B(""))},placeholder:"Database name",autoFocus:!0}),F&&p.jsx("div",{className:"form-error",children:F}),p.jsxs("div",{className:"new-db-actions",children:[p.jsx("button",{className:"button new-db-button",onClick:()=>Wa(),children:"Create"}),p.jsx("button",{className:"button ghost",onClick:()=>{P(!1),z(""),B("")},children:"Cancel"})]})]}):p.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),B("")},children:"New Database"}))]}),p.jsx("div",{className:"resizer",onMouseDown:Tp})]}),p.jsxs("div",{className:"main-content",children:[Rn&&p.jsxs("div",{className:"startup-task-banner",role:"status","aria-live":"polite",children:[Tn&&p.jsx("div",{className:"spinner startup-task-banner__spinner"}),p.jsx("div",{className:"startup-task-banner__text",children:Rn})]}),l==="chats"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"header",children:[p.jsxs("strong",{children:["Chat - ",((Xa=e.find(c=>c.session_id===n))==null?void 0:Xa.name)||"New Chat"]}),ot&&p.jsx("span",{className:"header-subtle",children:`DB: ${ot.name}${ei}`})]}),p.jsx("div",{className:"chat",ref:T,onClick:Wp,children:Fn.map((c,w)=>{const x=c.role==="user"&&vp===w;return p.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(x?" editing":""),children:c.role==="assistant"?p.jsxs("div",{className:"assistant-message-wrapper",children:[p.jsx(yy,{content:c.content,streamOutput:kt,sources:c.sources}),!Dt&&p.jsxs("div",{className:"message-options-bar assistant-options",children:[p.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ma(c),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),p.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),p.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>za(w),children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})})})]})]}):p.jsxs("div",{className:"user-message-wrapper",children:[x?p.jsxs("div",{className:"msg-content msg-content--user editing",children:[p.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Yo}),p.jsx(vc,{className:"edit-message-input edit-overlay",value:Yo,onChange:N=>ml(N.target.value),onBlur:vl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),vl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),xp(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",$=N.split(/\r\n|\r|\n/),D=$.length>30,W=Ua(c,w,n),U=D?Cp[W]??!0:!1,V=U?$.slice(0,30).join(` +`)}`),kt){const Q=`msg-${Date.now()}-${Math.random()}`;let fe="";const ke={role:"assistant",content:"",id:Q,sources:Le};t(J=>J.map(oe=>oe.session_id===c?{...oe,messages:[...oe.messages||[],ke]}:oe));try{const J=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ge,message:x.content,enriched_message:ve.length>0?V:null,stream:!0,sources:Le||[]})});if(!J.ok)throw new Error(`HTTP ${J.status}`);const oe=(W=J.body)==null?void 0:W.getReader();if(!oe)throw new Error("Missing response body");const K=new TextDecoder;let Ct=!1;for(;;){const{value:te,done:he}=await oe.read();if(he){cn(c,Q,fe),_e.current===c?Mn.current[c]?zn(mt=>({...mt,[c]:Q})):requestAnimationFrame(()=>In(Q,"smooth",c)):(fn(mt=>({...mt,[c]:Q})),$n(mt=>[...new Set([...mt,c])]));break}const Bt=K.decode(te,{stream:!0});fe+=Bt,cn(c,Q,fe),_e.current===c&&!Mn.current[c]&&ri("auto",c),_e.current!==c&&!Ct&&(fn(mt=>({...mt,[c]:Q})),Ct=!0)}}catch(J){if(At(J)){cn(c,Q,fe,{removeIfEmpty:!0});return}console.error("Failed to send message:",J),cn(c,Q,"Error: "+gl(J),{removeIfEmpty:!0});return}}else{const Q=await fetch(`${z}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:ge,message:x.content,enriched_message:ve.length>0?V:null,stream:!1,sources:Le||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const fe=await Q.json(),ke=`msg-${Date.now()}`,J={role:"assistant",content:fe.reply,id:ke,sources:Le};t(oe=>oe.map(K=>K.session_id===c?{...K,messages:[...K.messages||[],J]}:K)),ke&&(_e.current===c?Mn.current[c]?zn(oe=>({...oe,[c]:ke})):requestAnimationFrame(()=>In(ke,"smooth",c)):fn(oe=>({...oe,[c]:ke})))}_e.current!==c&&$n(Q=>[...new Set([...Q,c])]),w&&fetch(`${z}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:x.content,model:ge})}).then(Q=>Q.json()).then(Q=>{const fe=Q.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(ke=>ke.map(J=>J.session_id===c?{...J,name:fe}:J))})}catch(U){if(At(U)){Zo(N);return}console.error("Failed to send message:",U);const V={role:"assistant",content:"Error: "+gl(U),id:`msg-${Date.now()}-${Math.random()}`};t(Le=>Le.map(ve=>ve.session_id===c?{...ve,messages:[...ve.messages,V]}:ve))}finally{Zo(N)}}function Hp(){yp(c=>!c)}async function Za(){var $;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),x=await(await fetch(`${z}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...x,messages:[]};return t(D=>[N,...D]),r(x.session_id),($=H.current)==null||$.focus(),x}function Wp(c){r(c),$n(x=>x.filter(N=>N!==c));const w=Lp[c];w&&requestAnimationFrame(()=>{let x=12;const N=()=>{if(!T.current)return;let D=document.getElementById(w);if(!D){const W=e.find(U=>U.session_id===c);if(W&&Array.isArray(W.messages))for(let U=W.messages.length-1;U>=0;U--){const V=W.messages[U];if(V.role==="assistant"&&V.id){D=document.getElementById(V.id);break}}}D?(In(D.id,"smooth",c),fn(W=>{const{[c]:U,...V}=W;return V})):x-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function bp(c,w){fetch(`${z}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(x=>x.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function Vp(c,w){const x=(w||"").trim(),N=y.find($=>$.slug===c);if(!N){v(null);return}if(!x||x===N.name){v(null);return}fetch(`${z}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x})}).then(()=>{S($=>$.map(D=>D.slug===c?{...D,name:x}:D)),v(null)})}function qa(c){fetch(`${z}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(x=>x.session_id!==c);t(w),d(x=>{const N={...x||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}function Qp(c){fetch(`${z}/libraries/${c}`,{method:"DELETE"}).then(async w=>{var N;if(!w.ok){const $=await w.text();throw new Error($||`HTTP ${w.status}`)}const x=y.filter($=>$.slug!==c);S(x),k($=>$.filter(D=>D.slug!==c)),v($=>$===c?null:$),L===c&&m(((N=x[0])==null?void 0:N.slug)||null),Up(c)}).catch(w=>{console.error("Failed to delete library",w)})}g.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{qa(w.session_id)})},[n,e,z]);const Kp=c=>{var x;window.getSelection().toString().length>0||document.activeElement!==H.current&&(c.target.closest(".msg")||(x=H.current)==null||x.focus())};return p.jsxs("div",{className:"app",style:{gridTemplateColumns:`${Mp}px 1fr`},children:[p.jsxs("div",{className:"sidebar",children:[p.jsxs("div",{className:"sidebar-header",children:[p.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>ti("chats"),children:"Chats"}),p.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>ti("dbs"),children:"DBs"}),p.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>ti("settings"),children:"Settings"})]}),p.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&p.jsx("div",{className:"chat-list",children:e.map(c=>p.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>Dp(c.session_id),children:a===c.session_id?p.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?bp(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):p.jsxs(p.Fragment,{children:[p.jsx("span",{children:c.name}),p.jsxs("div",{className:"chat-item-buttons",children:[wp.includes(c.session_id)&&p.jsx("div",{className:"unread-dot"}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:p.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),qa(c.session_id)},children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&p.jsx("div",{className:"db-list",children:y.length===0?p.jsx("div",{className:"empty-list-message",children:"No databases yet."}):y.map(c=>p.jsx("div",{className:`chat-item ${c.slug===L?"active":""}`,onClick:()=>m(c.slug),children:h===c.slug?p.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>v(null),onKeyDown:w=>{w.key==="Enter"?Vp(c.slug,w.target.value):w.key==="Escape"&&v(null)},autoFocus:!0}):p.jsxs(p.Fragment,{children:[p.jsx("span",{children:c.name}),p.jsxs("div",{className:"chat-item-buttons",children:[Et===c.slug&&p.jsx("div",{className:"db-active-badge",children:"Chat"}),Ga(c.slug)&&p.jsx("div",{className:"db-active-badge",children:"Syncing"}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),v(c.slug)},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",children:p.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),p.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Qp(c.slug)},children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-x",children:[p.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),p.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.slug))}),l==="settings"&&p.jsxs("div",{className:"settings-list",children:[p.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>s("General"),children:"General"}),p.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>s("Interface"),children:"Interface"}),p.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>s("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&p.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&p.jsx("button",{className:"button new-chat-button",onClick:Za,children:"New Chat"}),l==="dbs"&&(C?p.jsxs("div",{className:"new-db-form",children:[p.jsx("input",{type:"text",className:"rename-input",value:M,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Enter"?Qa():c.key==="Escape"&&(P(!1),O(""),B(""))},placeholder:"Database name",autoFocus:!0}),F&&p.jsx("div",{className:"form-error",children:F}),p.jsxs("div",{className:"new-db-actions",children:[p.jsx("button",{className:"button new-db-button",onClick:()=>Qa(),children:"Create"}),p.jsx("button",{className:"button ghost",onClick:()=>{P(!1),O(""),B("")},children:"Cancel"})]})]}):p.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),B("")},children:"New Database"}))]}),p.jsx("div",{className:"resizer",onMouseDown:Op})]}),p.jsxs("div",{className:"main-content",children:[Rn&&p.jsxs("div",{className:"startup-task-banner",role:"status","aria-live":"polite",children:[Tn&&p.jsx("div",{className:"spinner startup-task-banner__spinner"}),p.jsx("div",{className:"startup-task-banner__text",children:Rn})]}),l==="chats"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"header",children:[p.jsxs("strong",{children:["Chat - ",((eu=e.find(c=>c.session_id===n))==null?void 0:eu.name)||"New Chat"]}),ot&&p.jsx("span",{className:"header-subtle",children:`DB: ${ot.name}${ni}`})]}),p.jsx("div",{className:"chat",ref:T,onClick:Kp,children:Fn.map((c,w)=>{const x=c.role==="user"&&xp===w;return p.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(x?" editing":""),children:c.role==="assistant"?p.jsxs("div",{className:"assistant-message-wrapper",children:[p.jsx(Ny,{content:c.content,streamOutput:kt,sources:c.sources}),!Dt&&p.jsxs("div",{className:"message-options-bar assistant-options",children:[p.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Fa(c),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),p.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),p.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>Da(w),children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"})})})]})]}):p.jsxs("div",{className:"user-message-wrapper",children:[x?p.jsxs("div",{className:"msg-content msg-content--user editing",children:[p.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Jo}),p.jsx(Sc,{className:"edit-message-input edit-overlay",value:Jo,onChange:N=>ml(N.target.value),onBlur:vl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),vl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Np(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",$=N.split(/\r\n|\r|\n/),D=$.length>30,W=Wa(c,w,n),U=D?Pp[W]??!0:!1,V=U?$.slice(0,30).join(` `)+` -…`:N;return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"msg-content msg-content--user",children:V}),D&&p.jsx("button",{className:"user-msg-expand",onClick:()=>Np(W),"aria-expanded":U?"false":"true",children:U?"Show entire message":"Collapse"})]})})(),!Dt&&!x&&p.jsxs("div",{className:"message-options-bar user-options",children:[p.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>Sp(w,c.content),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"M12 20h9"}),p.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),p.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ma(c),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),p.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},c.id||w)})},n),Da[n]&&p.jsxs("button",{className:"new-msg-tip",onClick:Ip,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",p.jsx("span",{style:{marginLeft:6},children:"↓"})]}),p.jsx("div",{className:"footer",children:p.jsxs("div",{className:"footer-content-wrapper",children:[p.jsx(vc,{ref:H,className:"input",value:be,onChange:c=>_(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Ya())},placeholder:"Ask any question...",maxRows:13}),p.jsxs("div",{className:"footer-tool-group",ref:R,children:[p.jsx("button",{type:"button",className:"db-picker-toggle"+(ot?" active":""),onClick:()=>{n&&q(c=>!c)},title:ot?`Database: ${ot.name}${ei}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":A,disabled:!n,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),p.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),p.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),A&&p.jsxs("div",{className:"db-picker-menu",role:"menu",children:[p.jsxs("button",{type:"button",className:"db-picker-option"+(Et?"":" selected"),onClick:()=>{Ka(n,null),q(!1)},children:[p.jsx("span",{children:"No database"}),!Et&&p.jsx("span",{className:"db-picker-status",children:"Selected"})]}),y.length===0?p.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):y.map(c=>{var $,D,W;const w=Et===c.slug,x=Qa(c.slug),N=($=c.files)!=null&&$.length?(D=c.states)!=null&&D.is_indexed?"Ready":x?"Syncing":"Needs sync":"Empty";return p.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((W=c.files)!=null&&W.length),onClick:()=>{Ka(n,c.slug),q(!1)},children:[p.jsx("span",{children:c.name}),p.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),p.jsx("button",{type:"button",className:"websearch-toggle"+(pl?" active":""),onClick:Dp,title:"Toggle web search","aria-pressed":pl,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),p.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),p.jsx("button",{className:"button",onClick:Dt?Pp:Ya,title:Dt?"Cancel generation":"Send","aria-label":Dt?"Cancel generation":"Send",children:Dt?p.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"header",children:[p.jsx("strong",{children:(Sl==null?void 0:Sl.name)||"Databases"}),ot&&p.jsx("span",{className:"header-subtle",children:`Current chat DB: ${ot.name}${ei}`})]}),p.jsx(my,{apiBase:O,library:Sl,jobs:E,onRefresh:async()=>{await gr(),await wl()}})]}),l==="settings"&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"header",children:p.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&p.jsx(uy,{onModelChange:We,streamOutput:kt,onStreamOutputChange:ht,onLibrariesPurged:Mp}),i==="Interface"&&p.jsx(py,{}),i==="Websearch"&&p.jsx(gy,{searxUrl:hr,setSearxUrl:dp,engines:un,setEngines:pp})]})]})]})}function Cy(){return g.useEffect(()=>{window.electronAPI.getSettings().then(e=>{ll(e.colorScheme||"Default")})},[]),p.jsx(Me.StrictMode,{children:p.jsx(Tv,{children:p.jsx(av,{children:p.jsx(ep,{path:"/",element:p.jsx(Ey,{})})})})})}const Ny=Hd(document.getElementById("root"));Ny.render(p.jsx(Cy,{})); +…`:N;return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"msg-content msg-content--user",children:V}),D&&p.jsx("button",{className:"user-msg-expand",onClick:()=>jp(W),"aria-expanded":U?"false":"true",children:U?"Show entire message":"Collapse"})]})})(),!Dt&&!x&&p.jsxs("div",{className:"message-options-bar user-options",children:[p.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>Cp(w,c.content),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"M12 20h9"}),p.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),p.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Fa(c),children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),p.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},c.id||w)})},n),Ba[n]&&p.jsxs("button",{className:"new-msg-tip",onClick:Bp,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",p.jsx("span",{style:{marginLeft:6},children:"↓"})]}),p.jsx("div",{className:"footer",children:p.jsxs("div",{className:"footer-content-wrapper",children:[p.jsx(Sc,{ref:H,className:"input",value:be,onChange:c=>_(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Xa())},placeholder:"Ask any question...",maxRows:13}),p.jsxs("div",{className:"footer-tool-group",ref:R,children:[p.jsx("button",{type:"button",className:"db-picker-toggle"+(ot?" active":""),onClick:()=>{n&&q(c=>!c)},title:ot?`Database: ${ot.name}${ni}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":A,disabled:!n,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),p.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),p.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),A&&p.jsxs("div",{className:"db-picker-menu",role:"menu",children:[p.jsxs("button",{type:"button",className:"db-picker-option"+(Et?"":" selected"),onClick:()=>{Ja(n,null),q(!1)},children:[p.jsx("span",{children:"No database"}),!Et&&p.jsx("span",{className:"db-picker-status",children:"Selected"})]}),y.length===0?p.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):y.map(c=>{var $,D,W;const w=Et===c.slug,x=Ga(c.slug),N=($=c.files)!=null&&$.length?(D=c.states)!=null&&D.is_indexed?"Ready":x?"Syncing":"Needs sync":"Empty";return p.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((W=c.files)!=null&&W.length),onClick:()=>{Ja(n,c.slug),q(!1)},children:[p.jsx("span",{children:c.name}),p.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),p.jsx("button",{type:"button",className:"websearch-toggle"+(pl?" active":""),onClick:Hp,title:"Toggle web search","aria-pressed":pl,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10"}),p.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),p.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),p.jsx("button",{className:"button",onClick:Dt?$p:Xa,title:Dt?"Cancel generation":"Send","aria-label":Dt?"Cancel generation":"Send",children:Dt?p.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"header",children:[p.jsx("strong",{children:(Sl==null?void 0:Sl.name)||"Databases"}),ot&&p.jsx("span",{className:"header-subtle",children:`Current chat DB: ${ot.name}${ni}`})]}),p.jsx(wy,{apiBase:z,library:Sl,jobs:E,onRefresh:async()=>{await gr(),await wl()}})]}),l==="settings"&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"header",children:p.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&p.jsx(py,{onModelChange:We,streamOutput:kt,onStreamOutputChange:ht,onLibrariesPurged:Ip}),i==="Interface"&&p.jsx(vy,{}),i==="Websearch"&&p.jsx(Ey,{searxUrl:hr,setSearxUrl:gp,engines:un,setEngines:c=>vp(Lo(c))})]})]})]})}function Ty(){return g.useEffect(()=>{window.electronAPI.getSettings().then(e=>{ll(e.colorScheme||"Default")})},[]),p.jsx(Me.StrictMode,{children:p.jsx(Ov,{children:p.jsx(dv,{children:p.jsx(rp,{path:"/",element:p.jsx(Ry,{})})})})})}const $y=Vd(document.getElementById("root"));$y.render(p.jsx(Ty,{})); diff --git a/dist/index.html b/dist/index.html index a37ede8..9dcfb34 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ LLM Desktop - + diff --git a/src/websearchEngines.js b/src/websearchEngines.js index e4ec1b4..9dc4645 100644 --- a/src/websearchEngines.js +++ b/src/websearchEngines.js @@ -60,7 +60,14 @@ export function loadStoredWebsearchEngines(rawValue) { try { const parsed = JSON.parse(rawValue) - return normalizeWebsearchEngines(parsed) + if (!Array.isArray(parsed)) return [...DEFAULT_WEBSEARCH_ENGINES] + + const normalized = normalizeWebsearchEngines(parsed) + if (parsed.length > 0 && normalized.length === 0) { + return [...DEFAULT_WEBSEARCH_ENGINES] + } + + return normalized } catch { return [...DEFAULT_WEBSEARCH_ENGINES] }