From ade78d64562098fa80400263d54c84281ba5090a Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 19 Mar 2026 21:48:27 +0100 Subject: [PATCH] auto-git: [add] backend/libraries/kjhj/corpus.jsonl [add] backend/libraries/kjhj/stage/ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf [add] dist/assets/index-T4npynoj.js [change] backend/libraries/kjhj/library.json [change] dist/index.html [unlink] backend/libraries/kjhj/stage/87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf [unlink] dist/assets/index-Bl2Chmww.js --- backend/libraries/kjhj/corpus.jsonl | 0 backend/libraries/kjhj/library.json | 23 +++--- ...n-eu-ukraine--abl-l-161-vom-140529-neu.pdf | 1 - ...190422e044f5e60b00--66_Seduction_Codes.pdf | 1 + dist/assets/index-Bl2Chmww.js | 73 ------------------- dist/assets/index-T4npynoj.js | 73 +++++++++++++++++++ dist/index.html | 2 +- 7 files changed, 88 insertions(+), 85 deletions(-) create mode 100644 backend/libraries/kjhj/corpus.jsonl delete mode 120000 backend/libraries/kjhj/stage/87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf create mode 120000 backend/libraries/kjhj/stage/ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf delete mode 100644 dist/assets/index-Bl2Chmww.js create mode 100644 dist/assets/index-T4npynoj.js diff --git a/backend/libraries/kjhj/corpus.jsonl b/backend/libraries/kjhj/corpus.jsonl new file mode 100644 index 0000000..e69de29 diff --git a/backend/libraries/kjhj/library.json b/backend/libraries/kjhj/library.json index 8f6071e..8b1826e 100644 --- a/backend/libraries/kjhj/library.json +++ b/backend/libraries/kjhj/library.json @@ -5,18 +5,21 @@ "created_at": "2026-03-19T20:46:46Z", "files": [ { - "sha256": "87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d", - "path": "/Users/giers/Documents/assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf", - "rel": "87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf", - "name": "assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf", - "size": 11005066, - "added_at": "2026-03-19T20:46:52Z", - "sync_status": "failed", - "sync_error": "ModuleNotFoundError: No module named 'tqdm'" + "sha256": "ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00", + "path": "/Users/giers/Documents/66+Seduction+Codes.pdf", + "rel": "ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf", + "name": "66+Seduction+Codes.pdf", + "size": 195770, + "added_at": "2026-03-19T20:48:26Z", + "sync_status": "pending" } ], "pipeline": { - "pending_prepare_signature": "58262b48b89eeb46de1b5b9be22147c197479a7f75bbf8409f76963177ab1f95", - "pending_prepare_updated_at": "2026-03-19T20:46:52Z" + "pending_prepare_signature": "0cdcbf23686a755b07949829698856ba6dc63409ce4036f48ec55a80fdc5f757", + "pending_prepare_updated_at": "2026-03-19T20:48:26Z", + "corpus_signature": "0cdcbf23686a755b07949829698856ba6dc63409ce4036f48ec55a80fdc5f757", + "corpus_updated_at": "2026-03-19T20:48:27Z", + "enriched_signature": "0cdcbf23686a755b07949829698856ba6dc63409ce4036f48ec55a80fdc5f757", + "enriched_updated_at": "2026-03-19T20:48:27Z" } } \ No newline at end of file diff --git a/backend/libraries/kjhj/stage/87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf b/backend/libraries/kjhj/stage/87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf deleted file mode 120000 index c3fa6d9..0000000 --- a/backend/libraries/kjhj/stage/87b5e039fa580a8bbb84125fda96570462315b6b65090b43c7392edf53248c0d--assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf +++ /dev/null @@ -1 +0,0 @@ -/Users/giers/Documents/assoziierungsabkommen-eu-ukraine--abl-l-161-vom-140529-neu.pdf \ No newline at end of file diff --git a/backend/libraries/kjhj/stage/ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf b/backend/libraries/kjhj/stage/ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf new file mode 120000 index 0000000..91b0666 --- /dev/null +++ b/backend/libraries/kjhj/stage/ff8bc28fa4444fd4bf2b3c2f99698a9c5cfc055b215d57190422e044f5e60b00--66_Seduction_Codes.pdf @@ -0,0 +1 @@ +/Users/giers/Documents/66+Seduction+Codes.pdf \ No newline at end of file diff --git a/dist/assets/index-Bl2Chmww.js b/dist/assets/index-Bl2Chmww.js deleted file mode 100644 index 1631f8a..0000000 --- a/dist/assets/index-Bl2Chmww.js +++ /dev/null @@ -1,73 +0,0 @@ -(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 Np(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hc={exports:{}},xo={},mc={exports:{}},K={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var el=Symbol.for("react.element"),_p=Symbol.for("react.portal"),Lp=Symbol.for("react.fragment"),Pp=Symbol.for("react.strict_mode"),Rp=Symbol.for("react.profiler"),jp=Symbol.for("react.provider"),Tp=Symbol.for("react.context"),$p=Symbol.for("react.forward_ref"),Mp=Symbol.for("react.suspense"),zp=Symbol.for("react.memo"),Op=Symbol.for("react.lazy"),Ha=Symbol.iterator;function Fp(e){return e===null||typeof e!="object"?null:(e=Ha&&e[Ha]||e["@@iterator"],typeof e=="function"?e:null)}var gc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vc=Object.assign,yc={};function ar(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}ar.prototype.isReactComponent={};ar.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")};ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wc(){}wc.prototype=ar.prototype;function ks(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}var Es=ks.prototype=new wc;Es.constructor=ks;vc(Es,ar.prototype);Es.isPureReactComponent=!0;var Wa=Array.isArray,Sc=Object.prototype.hasOwnProperty,Cs={current:null},xc={key:!0,ref:!0,__self:!0,__source:!0};function kc(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)Sc.call(t,r)&&!xc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,fe=z[ee];if(0>>1;eel(xt,H))ktl(Ye,xt)?(z[ee]=Ye,z[kt]=H,ee=kt):(z[ee]=xt,z[ft]=H,ee=ft);else if(ktl(Ye,H))z[ee]=Ye,z[kt]=H,ee=kt;else break e}}return $}function l(z,$){var H=z.sortIndex-$.sortIndex;return H!==0?H:z.id-$.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=[],p=1,m=null,y=3,S=!1,x=!1,C=!1,_=typeof setTimeout=="function"?setTimeout:null,h=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(z){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=z)r(u),$.sortIndex=$.expirationTime,t(s,$);else break;$=n(u)}}function E(z){if(C=!1,d(z),!x)if(n(s)!==null)x=!0,Be(P);else{var $=n(u);$!==null&&wt(E,$.startTime-z)}}function P(z,$){x=!1,C&&(C=!1,h(F),F=-1),S=!0;var H=y;try{for(d($),m=n(s);m!==null&&(!(m.expirationTime>$)||z&&!A());){var ee=m.callback;if(typeof ee=="function"){m.callback=null,y=m.priorityLevel;var fe=ee(m.expirationTime<=$);$=e.unstable_now(),typeof fe=="function"?m.callback=fe:m===n(s)&&r(s),d($)}else r(s);m=n(s)}if(m!==null)var St=!0;else{var ft=n(u);ft!==null&&wt(E,ft.startTime-$),St=!1}return St}finally{m=null,y=H,S=!1}}var j=!1,T=null,F=-1,U=5,R=-1;function A(){return!(e.unstable_now()-Rz||125ee?(z.sortIndex=H,t(u,z),n(s)===null&&z===n(u)&&(C?(h(F),F=-1):C=!0,wt(E,H-ee))):(z.sortIndex=fe,t(s,z),x||S||(x=!0,Be(P))),z},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(z){var $=y;return function(){var H=y;y=$;try{return z.apply(this,arguments)}finally{y=H}}}})(Lc);_c.exports=Lc;var bp=_c.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Yp=v,Qe=bp;function L(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"),_i=Object.prototype.hasOwnProperty,Jp=/^[: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]*$/,Qa={},Ka={};function Gp(e){return _i.call(Ka,e)?!0:_i.call(Qa,e)?!1:Jp.test(e)?Ka[e]=!0:(Qa[e]=!0,!1)}function Xp(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 Zp(e,t,n,r){if(t===null||typeof t>"u"||Xp(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 Oe(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 Ee={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ee[e]=new Oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ee[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ee[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ee[e]=new Oe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ee[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ee[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ee[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ee[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ee[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var _s=/[\-:]([a-z])/g;function Ls(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(_s,Ls);Ee[t]=new Oe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_s,Ls);Ee[t]=new Oe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_s,Ls);Ee[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ee[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ee.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ee[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ps(e,t,n,r){var l=Ee.hasOwnProperty(t)?Ee[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{ei=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?kr(e):""}function qp(e){switch(e.tag){case 5:return kr(e.type);case 16:return kr("Lazy");case 13:return kr("Suspense");case 19:return kr("SuspenseList");case 0:case 2:case 15:return e=ti(e.type,!1),e;case 11:return e=ti(e.type.render,!1),e;case 1:return e=ti(e.type,!0),e;default:return""}}function ji(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 Dn:return"Fragment";case In:return"Portal";case Li:return"Profiler";case Rs:return"StrictMode";case Pi:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jc:return(e.displayName||"Context")+".Consumer";case Rc:return(e._context.displayName||"Context")+".Provider";case js:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ts:return t=e.displayName||null,t!==null?t:ji(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return ji(e(t))}catch{}}return null}function eh(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 ji(t);case 8:return t===Rs?"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 $c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function th(e){var t=$c(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 yl(e){e._valueTracker||(e._valueTracker=th(e))}function Mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$c(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jl(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 Ti(e,t){var n=t.checked;return ie({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ya(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 zc(e,t){t=t.checked,t!=null&&Ps(e,"checked",t,!1)}function $i(e,t){zc(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")?Mi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mi(e,t.type,rn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ja(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 Mi(e,t,n){(t!=="number"||Jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Er=Array.isArray;function Jn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _r={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},nh=["Webkit","ms","Moz","O"];Object.keys(_r).forEach(function(e){nh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_r[t]=_r[e]})});function Dc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||_r.hasOwnProperty(e)&&_r[e]?(""+t).trim():t+"px"}function Ac(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Dc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rh=ie({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 Fi(e,t){if(t){if(rh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function Ii(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 Di=null;function $s(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ai=null,Gn=null,Xn=null;function Za(e){if(e=rl(e)){if(typeof Ai!="function")throw Error(L(280));var t=e.stateNode;t&&(t=_o(t),Ai(e.stateNode,e.type,t))}}function Uc(e){Gn?Xn?Xn.push(e):Xn=[e]:Gn=e}function Bc(){if(Gn){var e=Gn,t=Xn;if(Xn=Gn=null,Za(e),t)for(e=0;e>>=0,e===0?32:31-(hh(e)/mh|0)|0}var Sl=64,xl=4194304;function Cr(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 ql(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=Cr(a):(o&=i,o!==0&&(r=Cr(o)))}else i=n&~l,i!==0?r=Cr(i):o!==0&&(r=Cr(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 tl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-st(t),e[t]=n}function wh(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=Pr),su=" ",au=!1;function af(e,t){switch(e){case"keyup":return bh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function Jh(e,t){switch(e){case"compositionend":return uf(t);case"keypress":return t.which!==32?null:(au=!0,su);case"textInput":return e=t.data,e===su&&au?null:e;default:return null}}function Gh(e,t){if(An)return e==="compositionend"||!Us&&af(e,t)?(e=of(),Il=Is=bt=null,An=!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=du(n)}}function pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hf(){for(var e=window,t=Jl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jl(e.document)}return t}function Bs(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 om(e){var t=hf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&pf(n.ownerDocument.documentElement,n)){if(r!==null&&Bs(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=pu(n,o);var i=pu(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,Un=null,Qi=null,jr=null,Ki=!1;function hu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ki||Un==null||Un!==Jl(r)||(r=Un,"selectionStart"in r&&Bs(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}),jr&&Hr(jr,r)||(jr=r,r=no(Qi,"onSelect"),0Wn||(e.current=Zi[Wn],Zi[Wn]=null,Wn--)}function G(e,t){Wn++,Zi[Wn]=e.current,e.current=t}var ln={},Re=sn(ln),De=sn(!1),Sn=ln;function nr(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 Ae(e){return e=e.childContextTypes,e!=null}function lo(){q(De),q(Re)}function xu(e,t,n){if(Re.current!==ln)throw Error(L(168));G(Re,t),G(De,n)}function Ef(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(L(108,eh(e)||"Unknown",l));return ie({},n,r)}function oo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,Sn=Re.current,G(Re,e),G(De,De.current),!0}function ku(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Ef(e,t,Sn),r.__reactInternalMemoizedMergedChildContext=e,q(De),q(Re),G(Re,e)):q(De),G(De,n)}var _t=null,Lo=!1,mi=!1;function Cf(e){_t===null?_t=[e]:_t.push(e)}function vm(e){Lo=!0,Cf(e)}function an(){if(!mi&&_t!==null){mi=!0;var e=0,t=J;try{var n=_t;for(J=1;e>=i,l-=i,Lt=1<<32-st(t)+l|n<F?(U=T,T=null):U=T.sibling;var R=y(h,T,d[F],E);if(R===null){T===null&&(T=U);break}e&&T&&R.alternate===null&&t(h,T),f=o(R,f,F),j===null?P=R:j.sibling=R,j=R,T=U}if(F===d.length)return n(h,T),te&&pn(h,F),P;if(T===null){for(;FF?(U=T,T=null):U=T.sibling;var A=y(h,T,R.value,E);if(A===null){T===null&&(T=U);break}e&&T&&A.alternate===null&&t(h,T),f=o(A,f,F),j===null?P=A:j.sibling=A,j=A,T=U}if(R.done)return n(h,T),te&&pn(h,F),P;if(T===null){for(;!R.done;F++,R=d.next())R=m(h,R.value,E),R!==null&&(f=o(R,f,F),j===null?P=R:j.sibling=R,j=R);return te&&pn(h,F),P}for(T=r(h,T);!R.done;F++,R=d.next())R=S(T,h,F,R.value,E),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?F:R.key),f=o(R,f,F),j===null?P=R:j.sibling=R,j=R);return e&&T.forEach(function(se){return t(h,se)}),te&&pn(h,F),P}function _(h,f,d,E){if(typeof d=="object"&&d!==null&&d.type===Dn&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case vl:e:{for(var P=d.key,j=f;j!==null;){if(j.key===P){if(P=d.type,P===Dn){if(j.tag===7){n(h,j.sibling),f=l(j,d.props.children),f.return=h,h=f;break e}}else if(j.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Wt&&Nu(P)===j.type){n(h,j.sibling),f=l(j,d.props),f.ref=yr(h,j,d),f.return=h,h=f;break e}n(h,j);break}else t(h,j);j=j.sibling}d.type===Dn?(f=wn(d.props.children,h.mode,E,d.key),f.return=h,h=f):(E=Ql(d.type,d.key,d.props,null,h.mode,E),E.ref=yr(h,f,d),E.return=h,h=E)}return i(h);case In:e:{for(j=d.key;f!==null;){if(f.key===j)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(h,f.sibling),f=l(f,d.children||[]),f.return=h,h=f;break e}else{n(h,f);break}else t(h,f);f=f.sibling}f=Ei(d,h.mode,E),f.return=h,h=f}return i(h);case Wt:return j=d._init,_(h,f,j(d._payload),E)}if(Er(d))return x(h,f,d,E);if(pr(d))return C(h,f,d,E);Pl(h,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(h,f.sibling),f=l(f,d),f.return=h,h=f):(n(h,f),f=ki(d,h.mode,E),f.return=h,h=f),i(h)):n(h,f)}return _}var lr=Pf(!0),Rf=Pf(!1),ao=sn(null),uo=null,Kn=null,Qs=null;function Ks(){Qs=Kn=uo=null}function bs(e){var t=ao.current;q(ao),e._currentValue=t}function ts(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 qn(e,t){uo=e,Qs=Kn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ie=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Qs!==e)if(e={context:e,memoizedValue:t,next:null},Kn===null){if(uo===null)throw Error(L(308));Kn=e,uo.dependencies={lanes:0,firstContext:e}}else Kn=Kn.next=e;return t}var gn=null;function Ys(e){gn===null?gn=[e]:gn.push(e)}function jf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ys(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 Vt=!1;function Js(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tf(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 Rt(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,b&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,Ys(r)):(t.next=l.next,l.next=t),r.interleaved=t,Mt(e,n)}function Al(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,zs(e,n)}}function _u(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 co(e,t,n,r){var l=e.updateQueue;Vt=!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 p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==i&&(a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=s))}if(o!==null){var m=l.baseState;i=0,p=u=s=null,a=o;do{var y=a.lane,S=a.eventTime;if((r&y)===y){p!==null&&(p=p.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,C=a;switch(y=t,S=n,C.tag){case 1:if(x=C.payload,typeof x=="function"){m=x.call(S,m,y);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=C.payload,y=typeof x=="function"?x.call(S,m,y):x,y==null)break e;m=ie({},m,y);break e;case 2:Vt=!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},p===null?(u=p=S,s=m):p=p.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(p===null&&(s=m),l.baseState=s,l.firstBaseUpdate=u,l.lastBaseUpdate=p,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);En|=i,e.lanes=i,e.memoizedState=m}}function Lu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=vi.transition;vi.transition={};try{e(!1),t()}finally{J=n,vi.transition=r}}function Yf(){return tt().memoizedState}function xm(e,t,n){var r=tn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jf(e))Gf(t,n);else if(n=jf(e,t,n,r),n!==null){var l=Me();at(n,e,r,l),Xf(n,t,r)}}function km(e,t,n){var r=tn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jf(e))Gf(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,ut(a,i)){var s=t.interleaved;s===null?(l.next=l,Ys(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=jf(e,t,l,r),n!==null&&(l=Me(),at(n,e,r,l),Xf(n,t,r))}}function Jf(e){var t=e.alternate;return e===le||t!==null&&t===le}function Gf(e,t){Tr=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zs(e,n)}}var ho={readContext:et,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useInsertionEffect:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useDeferredValue:_e,useTransition:_e,useMutableSource:_e,useSyncExternalStore:_e,useId:_e,unstable_isNewReconciler:!1},Em={readContext:et,useCallback:function(e,t){return ht().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:Ru,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,Wf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bl(4,2,e,t)},useMemo:function(e,t){var n=ht();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ht();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=xm.bind(null,le,e),[r.memoizedState,e]},useRef:function(e){var t=ht();return e={current:e},t.memoizedState=e},useState:Pu,useDebugValue:ra,useDeferredValue:function(e){return ht().memoizedState=e},useTransition:function(){var e=Pu(!1),t=e[0];return e=Sm.bind(null,e[1]),ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=le,l=ht();if(te){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),we===null)throw Error(L(349));kn&30||Of(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ru(If.bind(null,r,o,e),[e]),r.flags|=2048,Gr(9,Ff.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ht(),t=we.identifierPrefix;if(te){var n=Pt,r=Lt;n=(r&~(1<<32-st(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Yr++,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[mt]=t,e[Qr]=r,sd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ii(n,r),n){case"dialog":Z("cancel",e),Z("close",e),l=r;break;case"iframe":case"object":case"embed":Z("load",e),l=r;break;case"video":case"audio":for(l=0;lsr&&(t.flags|=128,r=!0,wr(o,!1),t.lanes=4194304)}else{if(!r)if(e=fo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),wr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!te)return Le(t),null}else 2*ce()-o.renderingStartTime>sr&&n!==1073741824&&(t.flags|=128,r=!0,wr(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=ce(),t.sibling=null,n=re.current,G(re,r?n&1|2:n&1),t):(Le(t),null);case 22:case 23:return ua(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?He&1073741824&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Tm(e,t){switch(Ws(t),t.tag){case 1:return Ae(t.type)&&lo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return or(),q(De),q(Re),Zs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xs(t),null;case 13:if(q(re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));rr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(re),null;case 4:return or(),null;case 10:return bs(t.type._context),null;case 22:case 23:return ua(),null;case 24:return null;default:return null}}var jl=!1,Pe=!1,$m=typeof WeakSet=="function"?WeakSet:Set,O=null;function bn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ae(e,t,r)}else n.current=null}function cs(e,t,n){try{n()}catch(r){ae(e,t,r)}}var Uu=!1;function Mm(e,t){if(bi=eo,e=hf(),Bs(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,p=0,m=e,y=null;t:for(;;){for(var S;m!==n||l!==0&&m.nodeType!==3||(a=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(S=m.firstChild)!==null;)y=m,m=S;for(;;){if(m===e)break t;if(y===n&&++u===l&&(a=i),y===o&&++p===r&&(s=i),(S=m.nextSibling)!==null)break;m=y,y=m.parentNode}m=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Yi={focusedElem:e,selectionRange:n},eo=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var C=x.memoizedProps,_=x.memoizedState,h=t.stateNode,f=h.getSnapshotBeforeUpdate(t.elementType===t.type?C:lt(t.type,C),_);h.__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(L(163))}}catch(E){ae(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return x=Uu,Uu=!1,x}function $r(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&&cs(t,n,o)}l=l.next}while(l!==r)}}function jo(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 fs(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[mt],delete t[Qr],delete t[Xi],delete t[mm],delete t[gm])),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 fd(e){return e.tag===5||e.tag===3||e.tag===4}function Bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fd(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 ds(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=ro));else if(r!==4&&(e=e.child,e!==null))for(ds(e,t,n),e=e.sibling;e!==null;)ds(e,t,n),e=e.sibling}function ps(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(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}var xe=null,ot=!1;function Ht(e,t,n){for(n=n.child;n!==null;)dd(e,t,n),n=n.sibling}function dd(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(ko,n)}catch{}switch(n.tag){case 5:Pe||bn(n,t);case 6:var r=xe,l=ot;xe=null,Ht(e,t,n),xe=r,ot=l,xe!==null&&(ot?(e=xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xe.removeChild(n.stateNode));break;case 18:xe!==null&&(ot?(e=xe,n=n.stateNode,e.nodeType===8?hi(e.parentNode,n):e.nodeType===1&&hi(e,n),Ur(e)):hi(xe,n.stateNode));break;case 4:r=xe,l=ot,xe=n.stateNode.containerInfo,ot=!0,Ht(e,t,n),xe=r,ot=l;break;case 0:case 11:case 14:case 15:if(!Pe&&(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)&&cs(n,t,i),l=l.next}while(l!==r)}Ht(e,t,n);break;case 1:if(!Pe&&(bn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ae(n,t,a)}Ht(e,t,n);break;case 21:Ht(e,t,n);break;case 22:n.mode&1?(Pe=(r=Pe)||n.memoizedState!==null,Ht(e,t,n),Pe=r):Ht(e,t,n);break;default:Ht(e,t,n)}}function Hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new $m),t.forEach(function(r){var l=Hm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function rt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=ce()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Om(r/1960))-r,10e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,vo=0,b&6)throw Error(L(331));var l=b;for(b|=4,O=e.current;O!==null;){var o=O,i=o.child;if(O.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sce()-sa?yn(e,0):ia|=n),Ue(e,t)}function Sd(e,t){t===0&&(e.mode&1?(t=xl,xl<<=1,!(xl&130023424)&&(xl=4194304)):t=1);var n=Me();e=Mt(e,t),e!==null&&(tl(e,t,n),Ue(e,n))}function Bm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sd(e,n)}function Hm(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(L(314))}r!==null&&r.delete(t),Sd(e,n)}var xd;xd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Ie=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ie=!1,Rm(e,t,n);Ie=!!(e.flags&131072)}else Ie=!1,te&&t.flags&1048576&&Nf(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hl(e,t),e=t.pendingProps;var l=nr(t,Re.current);qn(t,n),l=ea(null,t,r,e,l,n);var o=ta();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,Ae(r)?(o=!0,oo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Js(t),l.updater=Ro,t.stateNode=l,l._reactInternals=t,rs(t,r,e,n),t=is(null,t,r,!0,o,n)):(t.tag=0,te&&o&&Hs(t),$e(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vm(r),e=lt(r,e),l){case 0:t=os(null,t,r,e,n);break e;case 1:t=Iu(null,t,r,e,n);break e;case 11:t=Ou(null,t,r,e,n);break e;case 14:t=Fu(null,t,r,lt(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),os(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Iu(e,t,r,l,n);case 3:e:{if(ld(t),e===null)throw Error(L(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Tf(e,t),co(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=ir(Error(L(423)),t),t=Du(e,t,r,n,l);break e}else if(r!==l){l=ir(Error(L(424)),t),t=Du(e,t,r,n,l);break e}else for(We=Zt(t.stateNode.containerInfo.firstChild),Ve=t,te=!0,it=null,n=Rf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rr(),r===l){t=zt(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return $f(t),e===null&&es(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Ji(r,l)?i=null:o!==null&&Ji(r,o)&&(t.flags|=32),rd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&es(t),null;case 13:return od(e,t,n);case 4:return Gs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lr(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Ou(e,t,r,l,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(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,G(ao,r._currentValue),r._currentValue=i,o!==null)if(ut(o.value,i)){if(o.children===l.children&&!De.current){t=zt(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=Rt(-1,n&-n),s.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ts(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(L(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),ts(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}$e(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,qn(t,n),l=et(l),r=r(l),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,l=lt(r,t.pendingProps),l=lt(r.type,l),Fu(e,t,r,l,n);case 15:return td(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Hl(e,t),t.tag=1,Ae(r)?(e=!0,oo(t)):e=!1,qn(t,n),Zf(t,r,l),rs(t,r,l,n),is(null,t,r,!0,e,n);case 19:return id(e,t,n);case 22:return nd(e,t,n)}throw Error(L(156,t.tag))};function kd(e,t){return Yc(e,t)}function Wm(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 Ze(e,t,n,r){return new Wm(e,t,n,r)}function fa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vm(e){if(typeof e=="function")return fa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===js)return 11;if(e===Ts)return 14}return 2}function nn(e,t){var n=e.alternate;return n===null?(n=Ze(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 Ql(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")fa(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Dn:return wn(n.children,l,o,t);case Rs:i=8,l|=8;break;case Li:return e=Ze(12,n,t,l|2),e.elementType=Li,e.lanes=o,e;case Pi:return e=Ze(13,n,t,l),e.elementType=Pi,e.lanes=o,e;case Ri:return e=Ze(19,n,t,l),e.elementType=Ri,e.lanes=o,e;case Tc:return $o(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rc:i=10;break e;case jc:i=9;break e;case js:i=11;break e;case Ts:i=14;break e;case Wt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=Ze(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function wn(e,t,n,r){return e=Ze(7,e,r,t),e.lanes=n,e}function $o(e,t,n,r){return e=Ze(22,e,r,t),e.elementType=Tc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=Ze(6,e,null,t),e.lanes=n,e}function Ei(e,t,n){return t=Ze(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qm(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=ri(0),this.expirationTimes=ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function da(e,t,n,r,l,o,i,a,s){return e=new Qm(e,t,n,a,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Ze(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Js(o),e}function Km(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_d)}catch(e){console.error(e)}}_d(),Nc.exports=Ke;var Ld=Nc.exports,Pd,Gu=Ld;Pd=Gu.createRoot,Gu.hydrateRoot;/** - * react-router v7.8.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var Xu="popstate";function Xm(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=Ln(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ys("",{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:Zr(o))}function r(l,o){ct(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return qm(t,n,r,e)}function oe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ct(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Zm(){return Math.random().toString(36).substring(2,10)}function Zu(e,t){return{usr:e.state,key:e.key,idx:t}}function ys(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ln(t):t,state:n,key:t&&t.key||r||Zm()}}function Zr({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 Ln(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 qm(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,a="POP",s=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function m(){a="POP";let _=p(),h=_==null?null:_-u;u=_,s&&s({action:a,location:C.location,delta:h})}function y(_,h){a="PUSH";let f=ys(C.location,_,h);n&&n(f,_),u=p()+1;let d=Zu(f,u),E=C.createHref(f);try{i.pushState(d,"",E)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(E)}o&&s&&s({action:a,location:C.location,delta:1})}function S(_,h){a="REPLACE";let f=ys(C.location,_,h);n&&n(f,_),u=p();let d=Zu(f,u),E=C.createHref(f);i.replaceState(d,"",E),o&&s&&s({action:a,location:C.location,delta:0})}function x(_){return eg(_)}let C={get action(){return a},get location(){return e(l,i)},listen(_){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(Xu,m),s=_,()=>{l.removeEventListener(Xu,m),s=null}},createHref(_){return t(l,_)},createURL:x,encodeLocation(_){let h=x(_);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:y,replace:S,go(_){return i.go(_)}};return C}function eg(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),oe(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Zr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Rd(e,t,n="/"){return tg(e,t,n,!1)}function tg(e,t,n,r){let l=typeof t=="string"?Ln(t):t,o=Ot(l.pathname||"/",n);if(o==null)return null;let i=jd(e);ng(i);let a=null;for(let s=0;a==null&&s{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&s)return;oe(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let m=jt([r,p.relativePath]),y=n.concat(p);i.children&&i.children.length>0&&(oe(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),jd(i.children,t,y,m,s)),!(i.path==null&&!i.index)&&t.push({path:m,score:ug(m,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 Td(i.path))o(i,a,!0,u)}),t}function Td(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=Td(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 ng(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:cg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var rg=/^:[\w-]+$/,lg=3,og=2,ig=1,sg=10,ag=-2,qu=e=>e==="*";function ug(e,t){let n=e.split("/"),r=n.length;return n.some(qu)&&(r+=ag),t&&(r+=og),n.filter(l=>!qu(l)).reduce((l,o)=>l+(rg.test(o)?lg:o===""?ig:sg),r)}function cg(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 a=0;a{if(p==="*"){let x=a[y]||"";i=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const S=a[y];return m&&!S?u[p]=void 0:u[p]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function dg(e,t=!1,n=!0){ct(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 pg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ct(!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 hg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Ln(e):e;return{pathname:n?n.startsWith("/")?n:mg(n,t):t,search:yg(r),hash:wg(l)}}function mg(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 Ci(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 gg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function $d(e){let t=gg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Md(e,t,n,r=!1){let l;typeof e=="string"?l=Ln(e):(l={...e},oe(!l.pathname||!l.pathname.includes("?"),Ci("?","pathname","search",l)),oe(!l.pathname||!l.pathname.includes("#"),Ci("#","pathname","hash",l)),oe(!l.search||!l.search.includes("#"),Ci("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let y=i.split("/");for(;y[0]==="..";)y.shift(),m-=1;l.pathname=y.join("/")}a=m>=0?t[m]:"/"}let s=hg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var jt=e=>e.join("/").replace(/\/\/+/g,"/"),vg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),yg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Sg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var zd=["POST","PUT","PATCH","DELETE"];new Set(zd);var xg=["GET",...zd];new Set(xg);var fr=v.createContext(null);fr.displayName="DataRouter";var Io=v.createContext(null);Io.displayName="DataRouterState";v.createContext(!1);var Od=v.createContext({isTransitioning:!1});Od.displayName="ViewTransition";var kg=v.createContext(new Map);kg.displayName="Fetchers";var Eg=v.createContext(null);Eg.displayName="Await";var yt=v.createContext(null);yt.displayName="Navigation";var ol=v.createContext(null);ol.displayName="Location";var It=v.createContext({outlet:null,matches:[],isDataRoute:!1});It.displayName="Route";var ga=v.createContext(null);ga.displayName="RouteError";function Cg(e,{relative:t}={}){oe(il(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=v.useContext(yt),{hash:l,pathname:o,search:i}=sl(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:jt([n,o])),r.createHref({pathname:a,search:i,hash:l})}function il(){return v.useContext(ol)!=null}function Pn(){return oe(il(),"useLocation() may be used only in the context of a component."),v.useContext(ol).location}var Fd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Id(e){v.useContext(yt).static||v.useLayoutEffect(e)}function Ng(){let{isDataRoute:e}=v.useContext(It);return e?Dg():_g()}function _g(){oe(il(),"useNavigate() may be used only in the context of a component.");let e=v.useContext(fr),{basename:t,navigator:n}=v.useContext(yt),{matches:r}=v.useContext(It),{pathname:l}=Pn(),o=JSON.stringify($d(r)),i=v.useRef(!1);return Id(()=>{i.current=!0}),v.useCallback((s,u={})=>{if(ct(i.current,Fd),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Md(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:jt([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}v.createContext(null);function sl(e,{relative:t}={}){let{matches:n}=v.useContext(It),{pathname:r}=Pn(),l=JSON.stringify($d(n));return v.useMemo(()=>Md(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Lg(e,t){return Dd(e,t)}function Dd(e,t,n,r,l){var f;oe(il(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=v.useContext(yt),{matches:i}=v.useContext(It),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",m=a&&a.route;{let d=m&&m.path||"";Ad(u,!m||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=Pn(),S;if(t){let d=typeof t=="string"?Ln(t):t;oe(p==="/"||((f=d.pathname)==null?void 0:f.startsWith(p)),`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 "${p}" but pathname "${d.pathname}" was given in the \`location\` prop.`),S=d}else S=y;let x=S.pathname||"/",C=x;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+x.replace(/^\//,"").split("/").slice(d.length).join("/")}let _=Rd(e,{pathname:C});ct(m||_!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),ct(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.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 h=$g(_&&_.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:jt([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:jt([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?v.createElement(ol.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},h):h}function Pg(){let e=Ig(),t=Sg(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=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:l},n):null,i)}var Rg=v.createElement(Pg,null),jg=class extends v.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?v.createElement(It.Provider,{value:this.props.routeContext},v.createElement(ga.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Tg({routeContext:e,match:t,children:n}){let r=v.useContext(fr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(It.Provider,{value:e},n)}function $g(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(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);oe(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,p,m)=>{let y,S=!1,x=null,C=null;n&&(y=i&&p.route.id?i[p.route.id]:void 0,x=p.route.errorElement||Rg,a&&(s<0&&m===0?(Ad("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):s===m&&(S=!0,C=p.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,m+1)),h=()=>{let f;return y?f=x:S?f=C:p.route.Component?f=v.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,v.createElement(Tg,{match:p,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?v.createElement(jg,{location:n.location,revalidation:n.revalidation,component:x,error:y,children:h(),routeContext:{outlet:null,matches:_,isDataRoute:!0},unstable_onError:r}):h()},null)}function va(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mg(e){let t=v.useContext(fr);return oe(t,va(e)),t}function zg(e){let t=v.useContext(Io);return oe(t,va(e)),t}function Og(e){let t=v.useContext(It);return oe(t,va(e)),t}function ya(e){let t=Og(e),n=t.matches[t.matches.length-1];return oe(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Fg(){return ya("useRouteId")}function Ig(){var r;let e=v.useContext(ga),t=zg("useRouteError"),n=ya("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Dg(){let{router:e}=Mg("useNavigate"),t=ya("useNavigate"),n=v.useRef(!1);return Id(()=>{n.current=!0}),v.useCallback(async(l,o={})=>{ct(n.current,Fd),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var ec={};function Ad(e,t,n){!t&&!ec[e]&&(ec[e]=!0,ct(!1,n))}v.memo(Ag);function Ag({routes:e,future:t,state:n,unstable_onError:r}){return Dd(e,void 0,n,r,t)}function Ud(e){oe(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Ug({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){oe(!il(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),a=v.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=Ln(n));let{pathname:s="/",search:u="",hash:p="",state:m=null,key:y="default"}=n,S=v.useMemo(()=>{let x=Ot(s,i);return x==null?null:{location:{pathname:x,search:u,hash:p,state:m,key:y},navigationType:r}},[i,s,u,p,m,y,r]);return ct(S!=null,` is not able to match the URL "${s}${u}${p}" because it does not start with the basename, so the won't render anything.`),S==null?null:v.createElement(yt.Provider,{value:a},v.createElement(ol.Provider,{children:t,value:S}))}function Bg({children:e,location:t}){return Lg(ws(e),t)}function ws(e,t=[]){let n=[];return v.Children.forEach(e,(r,l)=>{if(!v.isValidElement(r))return;let o=[...t,l];if(r.type===v.Fragment){n.push.apply(n,ws(r.props.children,o));return}oe(r.type===Ud,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),oe(!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=ws(r.props.children,o)),n.push(i)}),n}var Kl="get",bl="application/x-www-form-urlencoded";function Do(e){return e!=null&&typeof e.tagName=="string"}function Hg(e){return Do(e)&&e.tagName.toLowerCase()==="button"}function Wg(e){return Do(e)&&e.tagName.toLowerCase()==="form"}function Vg(e){return Do(e)&&e.tagName.toLowerCase()==="input"}function Qg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Kg(e,t){return e.button===0&&(!t||t==="_self")&&!Qg(e)}var Ml=null;function bg(){if(Ml===null)try{new FormData(document.createElement("form"),0),Ml=!1}catch{Ml=!0}return Ml}var Yg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ni(e){return e!=null&&!Yg.has(e)?(ct(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${bl}"`),null):e}function Jg(e,t){let n,r,l,o,i;if(Wg(e)){let a=e.getAttribute("action");r=a?Ot(a,t):null,n=e.getAttribute("method")||Kl,l=Ni(e.getAttribute("enctype"))||bl,o=new FormData(e)}else if(Hg(e)||Vg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a `,x=`
${y}
`;return`
${S}${x}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function bv(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,p=i;return s?(u=a.substring(0,s.index).trim(),p+=a.substring(s.index+s[0].length)):u=a.trim(),{think:u||null,answer:p.trim()}}function Yv({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=Jd(e||""),[o,i]=Te.useState(!1),a=!!r;return g.jsxs("div",{className:"assistant-message",children:[a&&g.jsxs("div",{className:"assistant-thoughts",children:[g.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[g.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&g.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:cc(r)}})]}),g.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:cc(l||e||"")}}),Array.isArray(n)&&n.length>0&&g.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,m=!1;try{const y=new URL(s);if(y.protocol==="file:"){m=!0;const S=y.pathname.split("/").filter(Boolean);p=decodeURIComponent(S[S.length-1]||s)}else p=(y.hostname||s).replace(/^www\./i,"")}catch{}return g.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:y=>{var S,x;if(m){y.preventDefault();try{const C=new URL(s);(x=(S=window.electronAPI)==null?void 0:S.openPath)==null||x.call(S,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const fc="websearch.searxUrl",dc="websearch.engines",pc="chat.libraryBySession";let Jv="http://127.0.0.1:8000";const Gv=48,Xv=24;function Zv(){var Ba;const[e,t]=v.useState([]),[n,r]=v.useState(null),[l,o]=v.useState("chats"),[i,a]=v.useState("General"),[s,u]=v.useState(null),[p,m]=v.useState(null),[y,S]=v.useState([]),[x,C]=v.useState([]),[_,h]=v.useState(null),[f,d]=v.useState(()=>{try{const c=localStorage.getItem(pc);return c?JSON.parse(c):{}}catch{return{}}}),[E,P]=v.useState(!1),[j,T]=v.useState(""),[F,U]=v.useState(""),[R,A]=v.useState(!1),[se,ve]=v.useState(""),[Rn,al]=v.useState(""),Be=v.useRef(null),wt=v.useRef(null),z=v.useRef(null),[$,H]=v.useState(Jv),[ee,fe]=v.useState("Default"),[St,ft]=v.useState(!1),[xt,kt]=v.useState(localStorage.getItem(fc)||"http://localhost:8888"),[Ye,Gd]=v.useState(()=>{try{const c=localStorage.getItem(dc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});v.useEffect(()=>{localStorage.setItem(fc,xt||"")},[xt]),v.useEffect(()=>{try{localStorage.setItem(dc,JSON.stringify(Ye||[]))}catch{}},[Ye]);const[ul,Xd]=v.useState(!1),[Dt,Ao]=v.useState(!1),[ty,Uo]=v.useState(!0),[Zd,jn]=v.useState([]),[cl,ka]=v.useState({}),[qd,Bo]=v.useState(null),[Ho,fl]=v.useState("");function ep(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:k}=Jd(w);return(k||w).trim()}catch{return w.trim()}return w}async function Ea(c){try{await navigator.clipboard.writeText(ep(c))}catch(w){console.error("Failed to copy message:",w)}}function un(c,w,k,N={}){const{removeIfEmpty:M=!1}=N;t(D=>D.map(B=>{if(B.session_id!==c)return B;const I=[];for(const W of B.messages||[]){if(W.id!==w){I.push(W);continue}M&&!k||I.push({...W,content:k})}return{...B,messages:I}}))}function At(c){return(c==null?void 0:c.name)==="AbortError"}function Wo(c){return c instanceof Error&&c.message?c.message:String(c)}async function Ca(c,w,k){if(!c)return{contextBlock:null,sources:[]};const M=await(await fetch(`${$}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:k,body:JSON.stringify({prompt:w,top_k:5})})).json();return{contextBlock:typeof(M==null?void 0:M.context_block)=="string"&&M.context_block.trim()?M.context_block.trim():null,sources:Array.isArray(M==null?void 0:M.sources)?M.sources:[]}}function tp(c,w){Bo(c),fl(w||"")}function dl(){Bo(null),fl("")}async function np(c){var D;const w=(((D=zn[c])==null?void 0:D.content)||"").trim(),N=(Ho??"").trim();if(N.length===0){dl();return}if(N===w){dl();return}const M=n;if(M){t(B=>B.map(I=>{if(I.session_id!==M)return I;const Ne=(I.messages||[]).slice(0,c+1).map((he,Je)=>Je===c?{...he,content:N}:he);return{...I,messages:Ne}})),Bo(null),fl(""),requestAnimationFrame(()=>Go("auto",M));try{const B=await fetch(`${$}/sessions/${M}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!B.ok)throw new Error(`HTTP ${B.status}`)}catch(B){console.error("Failed to update message:",B),t(I=>I.map(W=>{if(W.session_id!==M)return W;const he=(W.messages||[]).map((Je,V)=>V===c?{...Je,content:w}:Je);return{...W,messages:he}}));return}await Na(c,N)}}async function Na(c,w=null){var Ne,he,Je,V,ue,Se;const k=n;if(Dt||!k||typeof c!="number")return;const N=((Ne=e.find(Y=>Y.session_id===k))==null?void 0:Ne.messages)||[];let M=c;for(let Y=c;Y>=0;Y--)if(((he=N[Y])==null?void 0:he.role)==="user"){M=Y;break}t(Y=>Y.map(ne=>ne.session_id===k?{...ne,messages:(ne.messages||[]).slice(0,M+1)}:ne));const D=Ta(k);let B=w??(((Je=N[M])==null?void 0:Je.content)||""),I=[];const W=[];try{const Y=Oa(k),ne=w??(((V=N[M])==null?void 0:V.content)||"");if((ue=Y==null?void 0:Y.states)!=null&&ue.is_indexed)try{const Q=await Ca(Y.slug,ne,D.signal);Q.contextBlock&&W.push(Q.contextBlock),Array.isArray(Q.sources)&&I.push(...Q.sources)}catch(Q){if(At(Q))throw Q;console.warn("local library enrichment (regenerate) failed",Q)}if(ul)try{const Q=N.slice(Math.max(0,M-7),M+1).map(de=>({role:de.role,content:de.content||""}));Q.length>0&&(Q[Q.length-1]={role:"user",content:ne});const X=await(await fetch(`${$}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({prompt:ne,model:se,messages:Q,history_limit:8,searx_url:xt||null,engines:Array.isArray(Ye)?Ye:null})})).json();X&&typeof X.context_block=="string"&&X.context_block.trim()&&W.push(X.context_block.trim()),Array.isArray(X==null?void 0:X.sources)&&I.push(...X.sources)}catch(Q){if(At(Q))throw Q;console.warn("web search enrichment (regenerate) failed",Q)}if(I=[...new Set(I)],W.length>0?B=`${ne} - -${W.join(` - -`)}`:B=null,St){const Q=`msg-${Date.now()}-${Math.random()}`;let Ct="";t(X=>X.map(de=>de.session_id===k?{...de,messages:[...de.messages||[],{id:Q,role:"assistant",content:"",sources:I}]}:de));try{const X=await fetch(`${$}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:se,stream:!0,enriched_message:B,sources:I||[]})});if(!X.ok)throw new Error(`HTTP ${X.status}`);const de=(Se=X.body)==null?void 0:Se.getReader();if(!de)throw new Error("Missing response body");const Bt=new TextDecoder;let dt=!1;for(;;){const{value:dn,done:Ep}=await de.read();if(Ep)break;const Cp=Bt.decode(dn,{stream:!0});Ct+=Cp,un(k,Q,Ct),!dt&&Ce.current!==k&&(dt=!0,cn(Xo=>({...Xo,[k]:Q})),jn(Xo=>[...new Set([...Xo,k])]))}Ce.current!==k?(cn(dn=>({...dn,[k]:Q})),jn(dn=>[...new Set([...dn,k])])):Tn.current[k]?$n(dn=>({...dn,[k]:Q})):requestAnimationFrame(()=>On(Q,"smooth",k))}catch(X){if(At(X)){un(k,Q,Ct,{removeIfEmpty:!0});return}console.error(X),un(k,Q,`Error: ${Wo(X)}`,{removeIfEmpty:!0});return}}else{const Q=await fetch(`${$}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:D.signal,body:JSON.stringify({index:c,model:se,stream:!1,enriched_message:B,sources:I||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const Ct=await Q.json(),X=`msg-${Date.now()}`;t(de=>de.map(Bt=>Bt.session_id===k?{...Bt,messages:[...Bt.messages||[],{role:"assistant",content:Ct.reply,id:X,sources:I}]}:Bt)),Ce.current!==k?(cn(de=>({...de,[k]:X})),jn(de=>[...new Set([...de,k])])):Tn.current[k]?$n(de=>({...de,[k]:X})):requestAnimationFrame(()=>On(X,"smooth",k))}}catch(Y){At(Y)||console.error(Y)}finally{Vo(D)}}const[_a,rp]=v.useState({}),Tn=v.useRef({}),[lp,cn]=v.useState({}),fn=v.useRef({}),La=v.useRef({}),[Pa,$n]=v.useState({}),[op,Ra]=v.useState({}),ja=(c,w,k)=>c!=null&&c.id?c.id:`${k}:${w}`;v.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(k=>k.session_id===n))==null?void 0:w.messages)||[];Ra(k=>{const N={};return c.forEach((M,D)=>{if(M.role!=="user")return;const B=ja(M,D,n),W=(M.content||"").split(/\r\n|\r|\n/).length>30;N[B]=W?k[B]??!0:!1}),N})},[e,n]);function ip(c){Ra(w=>({...w,[c]:!(w[c]??!0)}))}const dr=Te.useCallback((c,w)=>{rp(k=>{const N={...k,[c]:w};return Tn.current=N,N})},[]),Mn=v.useRef(null),sp=v.useRef(!1),ap=v.useRef(null),Ce=v.useRef(n);v.useEffect(()=>{Ce.current=n},[n]);const Ta=Te.useCallback(c=>{const w=new AbortController;return Mn.current={controller:w,sessionId:c},Ao(!0),w},[]),Vo=Te.useCallback(c=>{var w;((w=Mn.current)==null?void 0:w.controller)===c&&(Mn.current=null,Ao(!1))},[]),up=Te.useCallback(()=>{const c=Mn.current;c&&(Mn.current=null,c.controller.abort(),Ao(!1))},[]);v.useEffect(()=>()=>{var c;(c=Mn.current)==null||c.controller.abort()},[]);const Ut=v.useRef(null),[cp,fp]=v.useState(230),[pl,$a]=v.useState(!1),dp=Te.useCallback(c=>{$a(!0)},[]),Qo=Te.useCallback(()=>{$a(!1)},[]),Ko=Te.useCallback(c=>{if(pl){const w=Math.max(230,Math.min(500,c.clientX));fp(w)}},[pl]);Te.useEffect(()=>(window.addEventListener("mousemove",Ko),window.addEventListener("mouseup",Qo),()=>{window.removeEventListener("mousemove",Ko),window.removeEventListener("mouseup",Qo)}),[Ko,Qo]),Te.useEffect(()=>{pl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[pl]),Te.useEffect(()=>{const c=async w=>{const k=w.target.closest(".codeblock__copy");if(!k)return;const N=k.closest(".codeblock"),M=N==null?void 0:N.querySelector("pre > code");if(M)try{await navigator.clipboard.writeText(M.textContent||""),k.classList.add("copied"),setTimeout(()=>k.classList.remove("copied"),800)}catch(D){console.error("Copy failed:",D)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),v.useEffect(()=>{window.electronAPI.getSettings().then(w=>{H(w.ollamaApiUrl),fe(w.colorScheme||"Default"),ve(w.chatModel||""),ft(w.streamOutput||!1),ka(w.scrollPositions||{}),qr(w.colorScheme||"Default")});const c=()=>{var w;l==="chats"&&((w=wt.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),v.useEffect(()=>{qr(ee)},[ee]);const pp=c=>{!c||!$||fetch(`${$}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(k=>k.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function hl(){if($)try{const w=await(await fetch(`${$}/libraries`)).json(),k=Array.isArray(w.libraries)?w.libraries:[];if(S(k),k.length===0){h(null);return}k.some(N=>N.slug===_)||h(k[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function bo(){if($)try{const w=await(await fetch(`${$}/jobs`)).json();C(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function Ma(c=null){const k=(typeof c=="string"?c:j).trim();if(!k){U("Name is required.");return}try{U("");const N=await fetch(`${$}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})});if(!N.ok){const D=await N.text();throw new Error(D||`HTTP ${N.status}`)}const M=await N.json();P(!1),T(""),await hl(),M!=null&&M.slug&&h(M.slug)}catch(N){console.error("Failed to create library",N),U(String((N==null?void 0:N.message)||N))}}v.useEffect(()=>{$&&(Uo(!0),fetch(`${$}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(k=>({...k,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Uo(!1)}).catch(()=>{Uo(!1)}))},[$]),v.useEffect(()=>{$&&(hl(),bo())},[$]),v.useEffect(()=>{try{localStorage.setItem(pc,JSON.stringify(f||{}))}catch{}},[f]),v.useEffect(()=>{if(!$)return;const c=setInterval(()=>{hl(),bo()},3e3);return()=>clearInterval(c)},[$,l,_]),v.useEffect(()=>{pp(n)},[n]),v.useEffect(()=>{const c=new Set(y.map(w=>w.slug));d(w=>{let k=!1;const N={};for(const[M,D]of Object.entries(w||{}))c.has(D)?N[M]=D:k=!0;return k?N:w})},[y]);const Yo=c=>{o(c)},hp=c=>{wp(c)},zn=v.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),ml=v.useMemo(()=>y.find(c=>c.slug===_)||null,[_,y]),Et=n&&f[n]||null,nt=v.useMemo(()=>y.find(c=>c.slug===Et)||null,[Et,y]),za=v.useMemo(()=>Et?x.some(c=>c.slug===Et&&(c.status==="queued"||c.status==="running")):!1,[Et,x]),Jo=v.useMemo(()=>{var c,w;return nt?(c=nt.files)!=null&&c.length?(w=nt.states)!=null&&w.is_indexed?"":za?" (syncing)":" (needs sync)":" (empty)":""},[nt,za]);function mp(c){return c&&f[c]||null}function Oa(c){const w=mp(c);return w&&y.find(k=>k.slug===w)||null}function Fa(c){return c?x.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Ia(c,w){c&&d(k=>{const N={...k||{}};return w?N[c]=w:delete N[c],N})}function gp(c){c&&d(w=>{let k=!1;const N={};for(const[M,D]of Object.entries(w||{})){if(D===c){k=!0;continue}N[M]=D}return k?N:w})}v.useEffect(()=>{if(!R)return;const c=w=>{var k;(k=z.current)!=null&&k.contains(w.target)||A(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[R]),v.useEffect(()=>{A(!1)},[n,l]),v.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const k=typeof fn.current[c]=="number"?fn.current[c]:Be.current?Be.current.scrollTop:0;ka(N=>{const M={...N,[c]:k};return window.electronAPI.updateSettings({scrollPositions:M}),M})}}},[n,l]),v.useEffect(()=>{const c=Be.current;if(!c)return;const w=()=>{const{scrollTop:k,scrollHeight:N,clientHeight:M}=c,D=N-k-M<=Xv;if(n){const B=La.current[n],I=typeof B=="number"&&kc.removeEventListener("scroll",w)},[n,dr]),v.useEffect(()=>{const c=n;c&&_a[c]===!1&&$n(w=>{if(!(c in w))return w;const k={...w};return delete k[c],k})},[n,_a]),v.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=Be.current;if(!c)return;Ut.current=null;const w=()=>{if(Ut.current===n)return;const B=typeof fn.current[n]=="number"?fn.current[n]:void 0,I=typeof B=="number"?B:cl[n];if(typeof I=="number"){c.scrollTop=I,Ut.current=n;return}zn.length>0&&(c.scrollTop=c.scrollHeight,Ut.current=n)};w();const k=requestAnimationFrame(w),N=()=>{Ut.current!==n&&requestAnimationFrame(w)},M=new MutationObserver(N);M.observe(c,{childList:!0,subtree:!0});const D=new ResizeObserver(N);return D.observe(c),()=>{cancelAnimationFrame(k),M.disconnect(),D.disconnect()}},[n,l,zn.length,cl]),v.useEffect(()=>{if(l!=="chats"||!n||Ut.current===n)return;const c=typeof fn.current[n]=="number"?fn.current[n]:void 0;typeof(typeof c=="number"?c:cl[n])!="number"&&zn.length>0&&requestAnimationFrame(()=>{const k=Be.current;k&&(k.scrollTop=k.scrollHeight,Ut.current=n)})},[zn.length,n,l,cl]);const Go=(c="smooth",w=null)=>{const k=Be.current;if(!k)return;const N=w??Ce.current;Ce.current===N&&(k.scrollTo({top:k.scrollHeight,behavior:c}),dr(N,!1))},On=(c,w="auto",k=null)=>{const N=Be.current;if(!N)return;const M=k??Ce.current;if(Ce.current!==M)return;const D=document.getElementById(c);if(D){const B=Math.max(0,D.offsetTop-Gv);N.scrollTo({top:B,behavior:w})}},vp=()=>{const c=Ce.current,w=Pa[c];w&&(On(w,"smooth",c),$n(k=>{const{[c]:N,...M}=k;return M}))};async function Da(){var M,D,B;if(Dt||!Rn.trim()||!se)return;let c=n,w=!1;if(c){const I=e.find(W=>W.session_id===c);w=I&&I.name==="New Chat"&&I.messages.length===0}else{const I=await Aa();await new Promise(W=>setTimeout(W,200)),c=I.session_id,w=!0}const k={role:"user",content:Rn.trim(),id:`msg-${Date.now()}-${Math.random()}`};sp.current=!0,ap.current=c,dr(c,!1),Ce.current===c&&(Ut.current=Ce.current),Ld.flushSync(()=>{t(I=>I.map(W=>W.session_id===c?{...W,messages:[...W.messages||[],k]}:W)),al("")}),requestAnimationFrame(()=>Go("auto",c));const N=Ta(c);try{let I=[];try{I=[...(((M=e.find(Se=>Se.session_id===c))==null?void 0:M.messages)||[]).slice(-8).map(Se=>({role:Se.role,content:Se.content||""})),{role:"user",content:k.content}]}catch{}let W=k.content,Ne=[];const he=[],Je=Oa(c);if((D=Je==null?void 0:Je.states)!=null&&D.is_indexed)try{const V=await Ca(Je.slug,k.content,N.signal);V.contextBlock&&he.push(V.contextBlock),Array.isArray(V.sources)&&Ne.push(...V.sources)}catch(V){if(At(V))throw V;console.warn("local library enrichment failed",V)}if(ul)try{const ue=await(await fetch(`${$}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:k.content,model:se,messages:I,history_limit:8,searx_url:xt||null,engines:Array.isArray(Ye)?Ye:null})})).json();ue&&typeof ue.context_block=="string"&&ue.context_block.trim()&&he.push(ue.context_block.trim()),Array.isArray(ue==null?void 0:ue.sources)&&Ne.push(...ue.sources)}catch(V){if(At(V))throw V;console.warn("web search enrichment failed",V)}if(Ne=[...new Set(Ne)],he.length>0&&(W=`${k.content} - -${he.join(` - -`)}`),St){const V=`msg-${Date.now()}-${Math.random()}`;let ue="";const Se={role:"assistant",content:"",id:V,sources:Ne};t(Y=>Y.map(ne=>ne.session_id===c?{...ne,messages:[...ne.messages||[],Se]}:ne));try{const Y=await fetch(`${$}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:se,message:k.content,enriched_message:he.length>0?W:null,stream:!0,sources:Ne||[]})});if(!Y.ok)throw new Error(`HTTP ${Y.status}`);const ne=(B=Y.body)==null?void 0:B.getReader();if(!ne)throw new Error("Missing response body");const Q=new TextDecoder;let Ct=!1;for(;;){const{value:X,done:de}=await ne.read();if(de){un(c,V,ue),Ce.current===c?Tn.current[c]?$n(dt=>({...dt,[c]:V})):requestAnimationFrame(()=>On(V,"smooth",c)):(cn(dt=>({...dt,[c]:V})),jn(dt=>[...new Set([...dt,c])]));break}const Bt=Q.decode(X,{stream:!0});ue+=Bt,un(c,V,ue),Ce.current===c&&!Tn.current[c]&&Go("auto",c),Ce.current!==c&&!Ct&&(cn(dt=>({...dt,[c]:V})),Ct=!0)}}catch(Y){if(At(Y)){un(c,V,ue,{removeIfEmpty:!0});return}console.error("Failed to send message:",Y),un(c,V,"Error: "+Wo(Y),{removeIfEmpty:!0});return}}else{const V=await fetch(`${$}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:se,message:k.content,enriched_message:he.length>0?W:null,stream:!1,sources:Ne||[]})});if(!V.ok)throw new Error(`HTTP ${V.status}`);const ue=await V.json(),Se=`msg-${Date.now()}`,Y={role:"assistant",content:ue.reply,id:Se,sources:Ne};t(ne=>ne.map(Q=>Q.session_id===c?{...Q,messages:[...Q.messages||[],Y]}:Q)),Se&&(Ce.current===c?Tn.current[c]?$n(ne=>({...ne,[c]:Se})):requestAnimationFrame(()=>On(Se,"smooth",c)):cn(ne=>({...ne,[c]:Se})))}Ce.current!==c&&jn(V=>[...new Set([...V,c])]),w&&fetch(`${$}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:k.content,model:se})}).then(V=>V.json()).then(V=>{const ue=V.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(Se=>Se.map(Y=>Y.session_id===c?{...Y,name:ue}:Y))})}catch(I){if(At(I)){Vo(N);return}console.error("Failed to send message:",I);const W={role:"assistant",content:"Error: "+Wo(I),id:`msg-${Date.now()}-${Math.random()}`};t(Ne=>Ne.map(he=>he.session_id===c?{...he,messages:[...he.messages,W]}:he))}finally{Vo(N)}}function yp(){Xd(c=>!c)}async function Aa(){var M;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),k=await(await fetch(`${$}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...k,messages:[]};return t(D=>[N,...D]),r(k.session_id),(M=wt.current)==null||M.focus(),k}function wp(c){r(c),jn(k=>k.filter(N=>N!==c));const w=lp[c];w&&requestAnimationFrame(()=>{let k=12;const N=()=>{if(!Be.current)return;let D=document.getElementById(w);if(!D){const B=e.find(I=>I.session_id===c);if(B&&Array.isArray(B.messages))for(let I=B.messages.length-1;I>=0;I--){const W=B.messages[I];if(W.role==="assistant"&&W.id){D=document.getElementById(W.id);break}}}D?(On(D.id,"smooth",c),cn(B=>{const{[c]:I,...W}=B;return W})):k-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function Sp(c,w){fetch(`${$}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(k=>k.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function xp(c,w){const k=(w||"").trim(),N=y.find(M=>M.slug===c);if(!N){m(null);return}if(!k||k===N.name){m(null);return}fetch(`${$}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})}).then(()=>{S(M=>M.map(D=>D.slug===c?{...D,name:k}:D)),m(null)})}function Ua(c){fetch(`${$}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(k=>k.session_id!==c);t(w),d(k=>{const N={...k||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}v.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{Ua(w.session_id)})},[n,e,$]);const kp=c=>{var k;window.getSelection().toString().length>0||document.activeElement!==wt.current&&(c.target.closest(".msg")||(k=wt.current)==null||k.focus())};return g.jsxs("div",{className:"app",style:{gridTemplateColumns:`${cp}px 1fr`},children:[g.jsxs("div",{className:"sidebar",children:[g.jsxs("div",{className:"sidebar-header",children:[g.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Yo("chats"),children:"Chats"}),g.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Yo("dbs"),children:"DBs"}),g.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Yo("settings"),children:"Settings"})]}),g.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&g.jsx("div",{className:"chat-list",children:e.map(c=>g.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>hp(c.session_id),children:s===c.session_id?g.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?Sp(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:c.name}),g.jsxs("div",{className:"chat-item-buttons",children:[Zd.includes(c.session_id)&&g.jsx("div",{className:"unread-dot"}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:g.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:g.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ua(c.session_id)},children:g.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:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&g.jsx("div",{className:"db-list",children:y.length===0?g.jsx("div",{className:"empty-list-message",children:"No databases yet."}):y.map(c=>g.jsx("div",{className:`chat-item ${c.slug===_?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?g.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>m(null),onKeyDown:w=>{w.key==="Enter"?xp(c.slug,w.target.value):w.key==="Escape"&&m(null)},autoFocus:!0}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:c.name}),g.jsxs("div",{className:"chat-item-buttons",children:[Et===c.slug&&g.jsx("div",{className:"db-active-badge",children:"Chat"}),Fa(c.slug)&&g.jsx("div",{className:"db-active-badge",children:"Syncing"}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),m(c.slug)},children:g.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:g.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})})]})]})},c.slug))}),l==="settings"&&g.jsxs("div",{className:"settings-list",children:[g.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),g.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),g.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&g.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&g.jsx("button",{className:"button new-chat-button",onClick:Aa,children:"New Chat"}),l==="dbs"&&(E?g.jsxs("div",{className:"new-db-form",children:[g.jsx("input",{type:"text",className:"rename-input",value:j,onChange:c=>T(c.target.value),onKeyDown:c=>{c.key==="Enter"?Ma():c.key==="Escape"&&(P(!1),T(""),U(""))},placeholder:"Database name",autoFocus:!0}),F&&g.jsx("div",{className:"form-error",children:F}),g.jsxs("div",{className:"new-db-actions",children:[g.jsx("button",{className:"button new-db-button",onClick:()=>Ma(),children:"Create"}),g.jsx("button",{className:"button ghost",onClick:()=>{P(!1),T(""),U("")},children:"Cancel"})]})]}):g.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),U("")},children:"New Database"}))]}),g.jsx("div",{className:"resizer",onMouseDown:dp})]}),g.jsxs("div",{className:"main-content",children:[l==="chats"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"header",children:[g.jsxs("strong",{children:["Chat - ",((Ba=e.find(c=>c.session_id===n))==null?void 0:Ba.name)||"New Chat"]}),nt&&g.jsx("span",{className:"header-subtle",children:`DB: ${nt.name}${Jo}`})]}),g.jsx("div",{className:"chat",ref:Be,onClick:kp,children:zn.map((c,w)=>{const k=c.role==="user"&&qd===w;return g.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(k?" editing":""),children:c.role==="assistant"?g.jsxs("div",{className:"assistant-message-wrapper",children:[g.jsx(Yv,{content:c.content,streamOutput:St,sources:c.sources}),!Dt&&g.jsxs("div",{className:"message-options-bar assistant-options",children:[g.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:g.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:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),g.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>Na(w),children:g.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:g.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"})})})]})]}):g.jsxs("div",{className:"user-message-wrapper",children:[k?g.jsxs("div",{className:"msg-content msg-content--user editing",children:[g.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Ho}),g.jsx(sc,{className:"edit-message-input edit-overlay",value:Ho,onChange:N=>fl(N.target.value),onBlur:dl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),dl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),np(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",M=N.split(/\r\n|\r|\n/),D=M.length>30,B=ja(c,w,n),I=D?op[B]??!0:!1,W=I?M.slice(0,30).join(` -`)+` -…`:N;return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"msg-content msg-content--user",children:W}),D&&g.jsx("button",{className:"user-msg-expand",onClick:()=>ip(B),"aria-expanded":I?"false":"true",children:I?"Show entire message":"Collapse"})]})})(),!Dt&&!k&&g.jsxs("div",{className:"message-options-bar user-options",children:[g.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>tp(w,c.content),children:g.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:[g.jsx("path",{d:"M12 20h9"}),g.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),g.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:g.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:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.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),Pa[n]&&g.jsxs("button",{className:"new-msg-tip",onClick:vp,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",g.jsx("span",{style:{marginLeft:6},children:"↓"})]}),g.jsx("div",{className:"footer",children:g.jsxs("div",{className:"footer-content-wrapper",children:[g.jsx(sc,{ref:wt,className:"input",value:Rn,onChange:c=>al(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Da())},placeholder:"Ask any question...",maxRows:13}),g.jsxs("div",{className:"footer-tool-group",ref:z,children:[g.jsx("button",{type:"button",className:"db-picker-toggle"+(nt?" active":""),onClick:()=>{n&&A(c=>!c)},title:nt?`Database: ${nt.name}${Jo}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":R,disabled:!n,children:g.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:[g.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),g.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),g.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),R&&g.jsxs("div",{className:"db-picker-menu",role:"menu",children:[g.jsxs("button",{type:"button",className:"db-picker-option"+(Et?"":" selected"),onClick:()=>{Ia(n,null),A(!1)},children:[g.jsx("span",{children:"No database"}),!Et&&g.jsx("span",{className:"db-picker-status",children:"Selected"})]}),y.length===0?g.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):y.map(c=>{var M,D,B;const w=Et===c.slug,k=Fa(c.slug),N=(M=c.files)!=null&&M.length?(D=c.states)!=null&&D.is_indexed?"Ready":k?"Syncing":"Needs sync":"Empty";return g.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((B=c.files)!=null&&B.length),onClick:()=>{Ia(n,c.slug),A(!1)},children:[g.jsx("span",{children:c.name}),g.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),g.jsx("button",{type:"button",className:"websearch-toggle"+(ul?" active":""),onClick:yp,title:"Toggle web search","aria-pressed":ul,children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),g.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"})]})}),g.jsx("button",{className:"button",onClick:Dt?up:Da,title:Dt?"Cancel generation":"Send","aria-label":Dt?"Cancel generation":"Send",children:Dt?g.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"header",children:[g.jsx("strong",{children:(ml==null?void 0:ml.name)||"Databases"}),nt&&g.jsx("span",{className:"header-subtle",children:`Current chat DB: ${nt.name}${Jo}`})]}),g.jsx(Qv,{apiBase:$,library:ml,jobs:x,onRefresh:async()=>{await hl(),await bo()},onDeleted:c=>{if(_===c){const w=y.find(k=>k.slug!==c);h((w==null?void 0:w.slug)||null)}gp(c)}})]}),l==="settings"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"header",children:g.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&g.jsx(Dv,{onModelChange:ve,streamOutput:St,onStreamOutputChange:ft}),i==="Interface"&&g.jsx(Hv,{}),i==="Websearch"&&g.jsx(Kv,{searxUrl:xt,setSearxUrl:kt,engines:Ye,setEngines:Gd})]})]})]})}function qv(){return v.useEffect(()=>{window.electronAPI.getSettings().then(e=>{qr(e.colorScheme||"Default")})},[]),g.jsx(Te.StrictMode,{children:g.jsx(cv,{children:g.jsx(Bg,{children:g.jsx(Ud,{path:"/",element:g.jsx(Zv,{})})})})})}const ey=Pd(document.getElementById("root"));ey.render(g.jsx(qv,{})); diff --git a/dist/assets/index-T4npynoj.js b/dist/assets/index-T4npynoj.js new file mode 100644 index 0000000..882bb04 --- /dev/null +++ b/dist/assets/index-T4npynoj.js @@ -0,0 +1,73 @@ +(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 Np(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hc={exports:{}},xo={},mc={exports:{}},K={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tl=Symbol.for("react.element"),_p=Symbol.for("react.portal"),Lp=Symbol.for("react.fragment"),Pp=Symbol.for("react.strict_mode"),Rp=Symbol.for("react.profiler"),jp=Symbol.for("react.provider"),Tp=Symbol.for("react.context"),$p=Symbol.for("react.forward_ref"),Mp=Symbol.for("react.suspense"),zp=Symbol.for("react.memo"),Op=Symbol.for("react.lazy"),Ha=Symbol.iterator;function Fp(e){return e===null||typeof e!="object"?null:(e=Ha&&e[Ha]||e["@@iterator"],typeof e=="function"?e:null)}var gc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vc=Object.assign,yc={};function ur(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}ur.prototype.isReactComponent={};ur.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")};ur.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wc(){}wc.prototype=ur.prototype;function ks(e,t,n){this.props=e,this.context=t,this.refs=yc,this.updater=n||gc}var Es=ks.prototype=new wc;Es.constructor=ks;vc(Es,ur.prototype);Es.isPureReactComponent=!0;var Wa=Array.isArray,Sc=Object.prototype.hasOwnProperty,Cs={current:null},xc={key:!0,ref:!0,__self:!0,__source:!0};function kc(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)Sc.call(t,r)&&!xc.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,de=M[te];if(0>>1;tel(Et,H))Ctl(Ge,Et)?(M[te]=Ge,M[Ct]=H,te=Ct):(M[te]=Et,M[pt]=H,te=pt);else if(Ctl(Ge,H))M[te]=Ge,M[Ct]=H,te=Ct;else break e}}return T}function l(M,T){var H=M.sortIndex-T.sortIndex;return H!==0?H:M.id-T.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=[],p=1,m=null,v=3,S=!1,x=!1,C=!1,_=typeof setTimeout=="function"?setTimeout:null,h=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(M){for(var T=n(u);T!==null;){if(T.callback===null)r(u);else if(T.startTime<=M)r(u),T.sortIndex=T.expirationTime,t(s,T);else break;T=n(u)}}function E(M){if(C=!1,d(M),!x)if(n(s)!==null)x=!0,We(P);else{var T=n(u);T!==null&&xt(E,T.startTime-M)}}function P(M,T){x=!1,C&&(C=!1,h(O),O=-1),S=!0;var H=v;try{for(d(T),m=n(s);m!==null&&(!(m.expirationTime>T)||M&&!re());){var te=m.callback;if(typeof te=="function"){m.callback=null,v=m.priorityLevel;var de=te(m.expirationTime<=T);T=e.unstable_now(),typeof de=="function"?m.callback=de:m===n(s)&&r(s),d(T)}else r(s);m=n(s)}if(m!==null)var kt=!0;else{var pt=n(u);pt!==null&&xt(E,pt.startTime-T),kt=!1}return kt}finally{m=null,v=H,S=!1}}var R=!1,j=null,O=-1,U=5,D=-1;function re(){return!(e.unstable_now()-DM||125te?(M.sortIndex=H,t(u,M),n(s)===null&&M===n(u)&&(C?(h(O),O=-1):C=!0,xt(E,H-te))):(M.sortIndex=de,t(s,M),x||S||(x=!0,We(P))),M},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(M){var T=v;return function(){var H=v;v=T;try{return M.apply(this,arguments)}finally{v=H}}}})(Lc);_c.exports=Lc;var bp=_c.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Yp=y,be=bp;function L(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"),_i=Object.prototype.hasOwnProperty,Jp=/^[: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]*$/,Qa={},Ka={};function Gp(e){return _i.call(Ka,e)?!0:_i.call(Qa,e)?!1:Jp.test(e)?Ka[e]=!0:(Qa[e]=!0,!1)}function Xp(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 Zp(e,t,n,r){if(t===null||typeof t>"u"||Xp(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 Oe(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 Ee={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ee[e]=new Oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ee[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ee[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ee[e]=new Oe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ee[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ee[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ee[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ee[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ee[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var _s=/[\-:]([a-z])/g;function Ls(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(_s,Ls);Ee[t]=new Oe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_s,Ls);Ee[t]=new Oe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_s,Ls);Ee[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ee[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ee.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ee[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ps(e,t,n,r){var l=Ee.hasOwnProperty(t)?Ee[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{ei=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Er(e):""}function qp(e){switch(e.tag){case 5:return Er(e.type);case 16:return Er("Lazy");case 13:return Er("Suspense");case 19:return Er("SuspenseList");case 0:case 2:case 15:return e=ti(e.type,!1),e;case 11:return e=ti(e.type.render,!1),e;case 1:return e=ti(e.type,!0),e;default:return""}}function ji(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 An:return"Fragment";case Dn:return"Portal";case Li:return"Profiler";case Rs:return"StrictMode";case Pi:return"Suspense";case Ri:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jc:return(e.displayName||"Context")+".Consumer";case Rc:return(e._context.displayName||"Context")+".Provider";case js:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ts:return t=e.displayName||null,t!==null?t:ji(e.type)||"Memo";case Qt:t=e._payload,e=e._init;try{return ji(e(t))}catch{}}return null}function eh(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 ji(t);case 8:return t===Rs?"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 on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function th(e){var t=$c(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 yl(e){e._valueTracker||(e._valueTracker=th(e))}function Mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$c(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jl(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 Ti(e,t){var n=t.checked;return ae({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ya(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=on(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 zc(e,t){t=t.checked,t!=null&&Ps(e,"checked",t,!1)}function $i(e,t){zc(e,t);var n=on(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")?Mi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mi(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ja(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 Mi(e,t,n){(t!=="number"||Jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Cr=Array.isArray;function Gn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lr={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},nh=["Webkit","ms","Moz","O"];Object.keys(Lr).forEach(function(e){nh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Lr[t]=Lr[e]})});function Dc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Lr.hasOwnProperty(e)&&Lr[e]?(""+t).trim():t+"px"}function Ac(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Dc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rh=ae({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 Fi(e,t){if(t){if(rh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function Ii(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 Di=null;function $s(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ai=null,Xn=null,Zn=null;function Za(e){if(e=ll(e)){if(typeof Ai!="function")throw Error(L(280));var t=e.stateNode;t&&(t=_o(t),Ai(e.stateNode,e.type,t))}}function Uc(e){Xn?Zn?Zn.push(e):Zn=[e]:Xn=e}function Bc(){if(Xn){var e=Xn,t=Zn;if(Zn=Xn=null,Za(e),t)for(e=0;e>>=0,e===0?32:31-(hh(e)/mh|0)|0}var Sl=64,xl=4194304;function Nr(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 ql(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=Nr(a):(o&=i,o!==0&&(r=Nr(o)))}else i=n&~l,i!==0?r=Nr(i):o!==0&&(r=Nr(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 nl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ut(t),e[t]=n}function wh(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=Rr),su=" ",au=!1;function af(e,t){switch(e){case"keyup":return bh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function Jh(e,t){switch(e){case"compositionend":return uf(t);case"keypress":return t.which!==32?null:(au=!0,su);case"textInput":return e=t.data,e===su&&au?null:e;default:return null}}function Gh(e,t){if(Un)return e==="compositionend"||!Us&&af(e,t)?(e=of(),Il=Is=Jt=null,Un=!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=du(n)}}function pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hf(){for(var e=window,t=Jl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jl(e.document)}return t}function Bs(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 om(e){var t=hf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&pf(n.ownerDocument.documentElement,n)){if(r!==null&&Bs(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=pu(n,o);var i=pu(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,Bn=null,Qi=null,Tr=null,Ki=!1;function hu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ki||Bn==null||Bn!==Jl(r)||(r=Bn,"selectionStart"in r&&Bs(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}),Tr&&Wr(Tr,r)||(Tr=r,r=no(Qi,"onSelect"),0Vn||(e.current=Zi[Vn],Zi[Vn]=null,Vn--)}function X(e,t){Vn++,Zi[Vn]=e.current,e.current=t}var sn={},Re=un(sn),Ue=un(!1),kn=sn;function rr(e,t){var n=e.type.contextTypes;if(!n)return sn;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 lo(){ee(Ue),ee(Re)}function xu(e,t,n){if(Re.current!==sn)throw Error(L(168));X(Re,t),X(Ue,n)}function Ef(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(L(108,eh(e)||"Unknown",l));return ae({},n,r)}function oo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sn,kn=Re.current,X(Re,e),X(Ue,Ue.current),!0}function ku(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Ef(e,t,kn),r.__reactInternalMemoizedMergedChildContext=e,ee(Ue),ee(Re),X(Re,e)):ee(Ue),X(Ue,n)}var Pt=null,Lo=!1,mi=!1;function Cf(e){Pt===null?Pt=[e]:Pt.push(e)}function vm(e){Lo=!0,Cf(e)}function cn(){if(!mi&&Pt!==null){mi=!0;var e=0,t=G;try{var n=Pt;for(G=1;e>=i,l-=i,Rt=1<<32-ut(t)+l|n<O?(U=j,j=null):U=j.sibling;var D=v(h,j,d[O],E);if(D===null){j===null&&(j=U);break}e&&j&&D.alternate===null&&t(h,j),f=o(D,f,O),R===null?P=D:R.sibling=D,R=D,j=U}if(O===d.length)return n(h,j),ne&&mn(h,O),P;if(j===null){for(;OO?(U=j,j=null):U=j.sibling;var re=v(h,j,D.value,E);if(re===null){j===null&&(j=U);break}e&&j&&re.alternate===null&&t(h,j),f=o(re,f,O),R===null?P=re:R.sibling=re,R=re,j=U}if(D.done)return n(h,j),ne&&mn(h,O),P;if(j===null){for(;!D.done;O++,D=d.next())D=m(h,D.value,E),D!==null&&(f=o(D,f,O),R===null?P=D:R.sibling=D,R=D);return ne&&mn(h,O),P}for(j=r(h,j);!D.done;O++,D=d.next())D=S(j,h,O,D.value,E),D!==null&&(e&&D.alternate!==null&&j.delete(D.key===null?O:D.key),f=o(D,f,O),R===null?P=D:R.sibling=D,R=D);return e&&j.forEach(function(F){return t(h,F)}),ne&&mn(h,O),P}function _(h,f,d,E){if(typeof d=="object"&&d!==null&&d.type===An&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case vl:e:{for(var P=d.key,R=f;R!==null;){if(R.key===P){if(P=d.type,P===An){if(R.tag===7){n(h,R.sibling),f=l(R,d.props.children),f.return=h,h=f;break e}}else if(R.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Qt&&Nu(P)===R.type){n(h,R.sibling),f=l(R,d.props),f.ref=wr(h,R,d),f.return=h,h=f;break e}n(h,R);break}else t(h,R);R=R.sibling}d.type===An?(f=xn(d.props.children,h.mode,E,d.key),f.return=h,h=f):(E=Ql(d.type,d.key,d.props,null,h.mode,E),E.ref=wr(h,f,d),E.return=h,h=E)}return i(h);case Dn:e:{for(R=d.key;f!==null;){if(f.key===R)if(f.tag===4&&f.stateNode.containerInfo===d.containerInfo&&f.stateNode.implementation===d.implementation){n(h,f.sibling),f=l(f,d.children||[]),f.return=h,h=f;break e}else{n(h,f);break}else t(h,f);f=f.sibling}f=Ei(d,h.mode,E),f.return=h,h=f}return i(h);case Qt:return R=d._init,_(h,f,R(d._payload),E)}if(Cr(d))return x(h,f,d,E);if(hr(d))return C(h,f,d,E);Pl(h,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,f!==null&&f.tag===6?(n(h,f.sibling),f=l(f,d),f.return=h,h=f):(n(h,f),f=ki(d,h.mode,E),f.return=h,h=f),i(h)):n(h,f)}return _}var or=Pf(!0),Rf=Pf(!1),ao=un(null),uo=null,bn=null,Qs=null;function Ks(){Qs=bn=uo=null}function bs(e){var t=ao.current;ee(ao),e._currentValue=t}function ts(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 er(e,t){uo=e,Qs=bn=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(Qs!==e)if(e={context:e,memoizedValue:t,next:null},bn===null){if(uo===null)throw Error(L(308));bn=e,uo.dependencies={lanes:0,firstContext:e}}else bn=bn.next=e;return t}var yn=null;function Ys(e){yn===null?yn=[e]:yn.push(e)}function jf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ys(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ot(e,r)}function Ot(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 Kt=!1;function Js(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tf(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 Tt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,b&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ot(e,n)}return l=r.interleaved,l===null?(t.next=t,Ys(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ot(e,n)}function Al(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,zs(e,n)}}function _u(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 co(e,t,n,r){var l=e.updateQueue;Kt=!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 p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==i&&(a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=s))}if(o!==null){var m=l.baseState;i=0,p=u=s=null,a=o;do{var v=a.lane,S=a.eventTime;if((r&v)===v){p!==null&&(p=p.next={eventTime:S,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,C=a;switch(v=t,S=n,C.tag){case 1:if(x=C.payload,typeof x=="function"){m=x.call(S,m,v);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=C.payload,v=typeof x=="function"?x.call(S,m,v):x,v==null)break e;m=ae({},m,v);break e;case 2:Kt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,v=l.effects,v===null?l.effects=[a]:v.push(a))}else S={eventTime:S,lane:v,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(u=p=S,s=m):p=p.next=S,i|=v;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;v=a,a=v.next,v.next=null,l.lastBaseUpdate=v,l.shared.pending=null}}while(!0);if(p===null&&(s=m),l.baseState=s,l.firstBaseUpdate=u,l.lastBaseUpdate=p,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);Nn|=i,e.lanes=i,e.memoizedState=m}}function Lu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=vi.transition;vi.transition={};try{e(!1),t()}finally{G=n,vi.transition=r}}function Yf(){return rt().memoizedState}function xm(e,t,n){var r=rn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Jf(e))Gf(t,n);else if(n=jf(e,t,n,r),n!==null){var l=Me();ct(n,e,r,l),Xf(n,t,r)}}function km(e,t,n){var r=rn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jf(e))Gf(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,ft(a,i)){var s=t.interleaved;s===null?(l.next=l,Ys(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=jf(e,t,l,r),n!==null&&(l=Me(),ct(n,e,r,l),Xf(n,t,r))}}function Jf(e){var t=e.alternate;return e===ie||t!==null&&t===ie}function Gf(e,t){$r=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xf(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zs(e,n)}}var ho={readContext:nt,useCallback:_e,useContext:_e,useEffect:_e,useImperativeHandle:_e,useInsertionEffect:_e,useLayoutEffect:_e,useMemo:_e,useReducer:_e,useRef:_e,useState:_e,useDebugValue:_e,useDeferredValue:_e,useTransition:_e,useMutableSource:_e,useSyncExternalStore:_e,useId:_e,unstable_isNewReconciler:!1},Em={readContext:nt,useCallback:function(e,t){return gt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Ru,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,Wf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bl(4,2,e,t)},useMemo:function(e,t){var n=gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=gt();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=xm.bind(null,ie,e),[r.memoizedState,e]},useRef:function(e){var t=gt();return e={current:e},t.memoizedState=e},useState:Pu,useDebugValue:ra,useDeferredValue:function(e){return gt().memoizedState=e},useTransition:function(){var e=Pu(!1),t=e[0];return e=Sm.bind(null,e[1]),gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ie,l=gt();if(ne){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),we===null)throw Error(L(349));Cn&30||Of(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ru(If.bind(null,r,o,e),[e]),r.flags|=2048,Xr(9,Ff.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=gt(),t=we.identifierPrefix;if(ne){var n=jt,r=Rt;n=(r&~(1<<32-ut(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Jr++,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[vt]=t,e[Kr]=r,sd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ii(n,r),n){case"dialog":q("cancel",e),q("close",e),l=r;break;case"iframe":case"object":case"embed":q("load",e),l=r;break;case"video":case"audio":for(l=0;l<_r.length;l++)q(_r[l],e);l=r;break;case"source":q("error",e),l=r;break;case"img":case"image":case"link":q("error",e),q("load",e),l=r;break;case"details":q("toggle",e),l=r;break;case"input":Ya(e,r),l=Ti(e,r),q("invalid",e);break;case"option":l=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},l=ae({},r,{value:void 0}),q("invalid",e);break;case"textarea":Ga(e,r),l=zi(e,r),q("invalid",e);break;default:l=r}Fi(n,l),a=l;for(o in a)if(a.hasOwnProperty(o)){var s=a[o];o==="style"?Ac(e,s):o==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,s!=null&&Ic(e,s)):o==="children"?typeof s=="string"?(n!=="textarea"||s!=="")&&Ir(e,s):typeof s=="number"&&Ir(e,""+s):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Fr.hasOwnProperty(o)?s!=null&&o==="onScroll"&&q("scroll",e):s!=null&&Ps(e,o,s,i))}switch(n){case"input":yl(e),Ja(e,r,!1);break;case"textarea":yl(e),Xa(e);break;case"option":r.value!=null&&e.setAttribute("value",""+on(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Gn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Gn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=ro)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Le(t),null;case 6:if(e&&t.stateNode!=null)ud(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(n=wn(Yr.current),wn(wt.current),Ll(t)){if(r=t.stateNode,n=t.memoizedProps,r[vt]=t,(o=r.nodeValue!==n)&&(e=Ke,e!==null))switch(e.tag){case 3:_l(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&_l(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[vt]=t,t.stateNode=r}return Le(t),null;case 13:if(ee(oe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ne&&Qe!==null&&t.mode&1&&!(t.flags&128))Lf(),lr(),t.flags|=98560,o=!1;else if(o=Ll(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(L(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(L(317));o[vt]=t}else lr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Le(t),o=!1}else at!==null&&(vs(at),at=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||oe.current&1?ve===0&&(ve=3):ca())),t.updateQueue!==null&&(t.flags|=4),Le(t),null);case 4:return ir(),us(e,t),e===null&&Vr(t.stateNode.containerInfo),Le(t),null;case 10:return bs(t.type._context),Le(t),null;case 17:return Be(t.type)&&lo(),Le(t),null;case 19:if(ee(oe),o=t.memoizedState,o===null)return Le(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)Sr(o,!1);else{if(ve!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=fo(e),i!==null){for(t.flags|=128,Sr(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return X(oe,oe.current&1|2),t.child}e=e.sibling}o.tail!==null&&fe()>ar&&(t.flags|=128,r=!0,Sr(o,!1),t.lanes=4194304)}else{if(!r)if(e=fo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Sr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ne)return Le(t),null}else 2*fe()-o.renderingStartTime>ar&&n!==1073741824&&(t.flags|=128,r=!0,Sr(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=fe(),t.sibling=null,n=oe.current,X(oe,r?n&1|2:n&1),t):(Le(t),null);case 22:case 23:return ua(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ve&1073741824&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Tm(e,t){switch(Ws(t),t.tag){case 1:return Be(t.type)&&lo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(),ee(Ue),ee(Re),Zs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xs(t),null;case 13:if(ee(oe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ee(oe),null;case 4:return ir(),null;case 10:return bs(t.type._context),null;case 22:case 23:return ua(),null;case 24:return null;default:return null}}var jl=!1,Pe=!1,$m=typeof WeakSet=="function"?WeakSet:Set,z=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ue(e,t,r)}else n.current=null}function cs(e,t,n){try{n()}catch(r){ue(e,t,r)}}var Uu=!1;function Mm(e,t){if(bi=eo,e=hf(),Bs(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,p=0,m=e,v=null;t:for(;;){for(var S;m!==n||l!==0&&m.nodeType!==3||(a=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(S=m.firstChild)!==null;)v=m,m=S;for(;;){if(m===e)break t;if(v===n&&++u===l&&(a=i),v===o&&++p===r&&(s=i),(S=m.nextSibling)!==null)break;m=v,v=m.parentNode}m=S}n=a===-1||s===-1?null:{start:a,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Yi={focusedElem:e,selectionRange:n},eo=!1,z=t;z!==null;)if(t=z,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,z=e;else for(;z!==null;){t=z;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var C=x.memoizedProps,_=x.memoizedState,h=t.stateNode,f=h.getSnapshotBeforeUpdate(t.elementType===t.type?C:it(t.type,C),_);h.__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(L(163))}}catch(E){ue(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,z=e;break}z=t.return}return x=Uu,Uu=!1,x}function Mr(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&&cs(t,n,o)}l=l.next}while(l!==r)}}function jo(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 fs(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[vt],delete t[Kr],delete t[Xi],delete t[mm],delete t[gm])),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 fd(e){return e.tag===5||e.tag===3||e.tag===4}function Bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fd(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 ds(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=ro));else if(r!==4&&(e=e.child,e!==null))for(ds(e,t,n),e=e.sibling;e!==null;)ds(e,t,n),e=e.sibling}function ps(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(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}var xe=null,st=!1;function Vt(e,t,n){for(n=n.child;n!==null;)dd(e,t,n),n=n.sibling}function dd(e,t,n){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(ko,n)}catch{}switch(n.tag){case 5:Pe||Yn(n,t);case 6:var r=xe,l=st;xe=null,Vt(e,t,n),xe=r,st=l,xe!==null&&(st?(e=xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xe.removeChild(n.stateNode));break;case 18:xe!==null&&(st?(e=xe,n=n.stateNode,e.nodeType===8?hi(e.parentNode,n):e.nodeType===1&&hi(e,n),Br(e)):hi(xe,n.stateNode));break;case 4:r=xe,l=st,xe=n.stateNode.containerInfo,st=!0,Vt(e,t,n),xe=r,st=l;break;case 0:case 11:case 14:case 15:if(!Pe&&(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)&&cs(n,t,i),l=l.next}while(l!==r)}Vt(e,t,n);break;case 1:if(!Pe&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ue(n,t,a)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Pe=(r=Pe)||n.memoizedState!==null,Vt(e,t,n),Pe=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new $m),t.forEach(function(r){var l=Hm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ot(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Om(r/1960))-r,10e?16:e,Gt===null)var r=!1;else{if(e=Gt,Gt=null,vo=0,b&6)throw Error(L(331));var l=b;for(b|=4,z=e.current;z!==null;){var o=z,i=o.child;if(z.flags&16){var a=o.deletions;if(a!==null){for(var s=0;sfe()-sa?Sn(e,0):ia|=n),He(e,t)}function Sd(e,t){t===0&&(e.mode&1?(t=xl,xl<<=1,!(xl&130023424)&&(xl=4194304)):t=1);var n=Me();e=Ot(e,t),e!==null&&(nl(e,t,n),He(e,n))}function Bm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sd(e,n)}function Hm(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(L(314))}r!==null&&r.delete(t),Sd(e,n)}var xd;xd=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,Rm(e,t,n);Ae=!!(e.flags&131072)}else Ae=!1,ne&&t.flags&1048576&&Nf(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hl(e,t),e=t.pendingProps;var l=rr(t,Re.current);er(t,n),l=ea(null,t,r,e,l,n);var o=ta();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,oo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Js(t),l.updater=Ro,t.stateNode=l,l._reactInternals=t,rs(t,r,e,n),t=is(null,t,r,!0,o,n)):(t.tag=0,ne&&o&&Hs(t),$e(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vm(r),e=it(r,e),l){case 0:t=os(null,t,r,e,n);break e;case 1:t=Iu(null,t,r,e,n);break e;case 11:t=Ou(null,t,r,e,n);break e;case 14:t=Fu(null,t,r,it(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),os(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Iu(e,t,r,l,n);case 3:e:{if(ld(t),e===null)throw Error(L(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Tf(e,t),co(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=sr(Error(L(423)),t),t=Du(e,t,r,n,l);break e}else if(r!==l){l=sr(Error(L(424)),t),t=Du(e,t,r,n,l);break e}else for(Qe=en(t.stateNode.containerInfo.firstChild),Ke=t,ne=!0,at=null,n=Rf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===l){t=Ft(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return $f(t),e===null&&es(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Ji(r,l)?i=null:o!==null&&Ji(r,o)&&(t.flags|=32),rd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&es(t),null;case 13:return od(e,t,n);case 4:return Gs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Ou(e,t,r,l,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(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,X(ao,r._currentValue),r._currentValue=i,o!==null)if(ft(o.value,i)){if(o.children===l.children&&!Ue.current){t=Ft(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=Tt(-1,n&-n),s.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ts(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(L(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),ts(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}$e(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,er(t,n),l=nt(l),r=r(l),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,l=it(r,t.pendingProps),l=it(r.type,l),Fu(e,t,r,l,n);case 15:return td(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:it(r,l),Hl(e,t),t.tag=1,Be(r)?(e=!0,oo(t)):e=!1,er(t,n),Zf(t,r,l),rs(t,r,l,n),is(null,t,r,!0,e,n);case 19:return id(e,t,n);case 22:return nd(e,t,n)}throw Error(L(156,t.tag))};function kd(e,t){return Yc(e,t)}function Wm(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 Wm(e,t,n,r)}function fa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vm(e){if(typeof e=="function")return fa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===js)return 11;if(e===Ts)return 14}return 2}function ln(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 Ql(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")fa(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case An:return xn(n.children,l,o,t);case Rs:i=8,l|=8;break;case Li:return e=et(12,n,t,l|2),e.elementType=Li,e.lanes=o,e;case Pi:return e=et(13,n,t,l),e.elementType=Pi,e.lanes=o,e;case Ri:return e=et(19,n,t,l),e.elementType=Ri,e.lanes=o,e;case Tc:return $o(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rc:i=10;break e;case jc:i=9;break e;case js:i=11;break e;case Ts:i=14;break e;case Qt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=et(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function xn(e,t,n,r){return e=et(7,e,r,t),e.lanes=n,e}function $o(e,t,n,r){return e=et(22,e,r,t),e.elementType=Tc,e.lanes=n,e.stateNode={isHidden:!1},e}function ki(e,t,n){return e=et(6,e,null,t),e.lanes=n,e}function Ei(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 Qm(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=ri(0),this.expirationTimes=ri(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function da(e,t,n,r,l,o,i,a,s){return e=new Qm(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},Js(o),e}function Km(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_d)}catch(e){console.error(e)}}_d(),Nc.exports=Ye;var Ld=Nc.exports,Pd,Gu=Ld;Pd=Gu.createRoot,Gu.hydrateRoot;/** + * react-router v7.8.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */var Xu="popstate";function Xm(e={}){function t(l,o){let{pathname:i="/",search:a="",hash:s=""}=Rn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ys("",{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:qr(o))}function r(l,o){dt(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return qm(t,n,r,e)}function se(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function dt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Zm(){return Math.random().toString(36).substring(2,10)}function Zu(e,t){return{usr:e.state,key:e.key,idx:t}}function ys(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Rn(t):t,state:n,key:t&&t.key||r||Zm()}}function qr({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 Rn(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 qm(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,a="POP",s=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function m(){a="POP";let _=p(),h=_==null?null:_-u;u=_,s&&s({action:a,location:C.location,delta:h})}function v(_,h){a="PUSH";let f=ys(C.location,_,h);n&&n(f,_),u=p()+1;let d=Zu(f,u),E=C.createHref(f);try{i.pushState(d,"",E)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(E)}o&&s&&s({action:a,location:C.location,delta:1})}function S(_,h){a="REPLACE";let f=ys(C.location,_,h);n&&n(f,_),u=p();let d=Zu(f,u),E=C.createHref(f);i.replaceState(d,"",E),o&&s&&s({action:a,location:C.location,delta:0})}function x(_){return eg(_)}let C={get action(){return a},get location(){return e(l,i)},listen(_){if(s)throw new Error("A history only accepts one active listener");return l.addEventListener(Xu,m),s=_,()=>{l.removeEventListener(Xu,m),s=null}},createHref(_){return t(l,_)},createURL:x,encodeLocation(_){let h=x(_);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:v,replace:S,go(_){return i.go(_)}};return C}function eg(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),se(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:qr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Rd(e,t,n="/"){return tg(e,t,n,!1)}function tg(e,t,n,r){let l=typeof t=="string"?Rn(t):t,o=It(l.pathname||"/",n);if(o==null)return null;let i=jd(e);ng(i);let a=null;for(let s=0;a==null&&s{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:a,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&s)return;se(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let m=$t([r,p.relativePath]),v=n.concat(p);i.children&&i.children.length>0&&(se(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),jd(i.children,t,v,m,s)),!(i.path==null&&!i.index)&&t.push({path:m,score:ug(m,i.index),routesMeta:v})};return e.forEach((i,a)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))o(i,a);else for(let u of Td(i.path))o(i,a,!0,u)}),t}function Td(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=Td(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 ng(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:cg(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var rg=/^:[\w-]+$/,lg=3,og=2,ig=1,sg=10,ag=-2,qu=e=>e==="*";function ug(e,t){let n=e.split("/"),r=n.length;return n.some(qu)&&(r+=ag),t&&(r+=og),n.filter(l=>!qu(l)).reduce((l,o)=>l+(rg.test(o)?lg:o===""?ig:sg),r)}function cg(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 a=0;a{if(p==="*"){let x=a[v]||"";i=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const S=a[v];return m&&!S?u[p]=void 0:u[p]=(S||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function dg(e,t=!1,n=!0){dt(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 pg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return dt(!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 It(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 hg(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Rn(e):e;return{pathname:n?n.startsWith("/")?n:mg(n,t):t,search:yg(r),hash:wg(l)}}function mg(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 Ci(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 gg(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function $d(e){let t=gg(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Md(e,t,n,r=!1){let l;typeof e=="string"?l=Rn(e):(l={...e},se(!l.pathname||!l.pathname.includes("?"),Ci("?","pathname","search",l)),se(!l.pathname||!l.pathname.includes("#"),Ci("#","pathname","hash",l)),se(!l.search||!l.search.includes("#"),Ci("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,a;if(i==null)a=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),m-=1;l.pathname=v.join("/")}a=m>=0?t[m]:"/"}let s=hg(l,a),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(u||p)&&(s.pathname+="/"),s}var $t=e=>e.join("/").replace(/\/\/+/g,"/"),vg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),yg=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Sg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var zd=["POST","PUT","PATCH","DELETE"];new Set(zd);var xg=["GET",...zd];new Set(xg);var dr=y.createContext(null);dr.displayName="DataRouter";var Io=y.createContext(null);Io.displayName="DataRouterState";y.createContext(!1);var Od=y.createContext({isTransitioning:!1});Od.displayName="ViewTransition";var kg=y.createContext(new Map);kg.displayName="Fetchers";var Eg=y.createContext(null);Eg.displayName="Await";var St=y.createContext(null);St.displayName="Navigation";var il=y.createContext(null);il.displayName="Location";var At=y.createContext({outlet:null,matches:[],isDataRoute:!1});At.displayName="Route";var ga=y.createContext(null);ga.displayName="RouteError";function Cg(e,{relative:t}={}){se(sl(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=y.useContext(St),{hash:l,pathname:o,search:i}=al(e,{relative:t}),a=o;return n!=="/"&&(a=o==="/"?n:$t([n,o])),r.createHref({pathname:a,search:i,hash:l})}function sl(){return y.useContext(il)!=null}function jn(){return se(sl(),"useLocation() may be used only in the context of a component."),y.useContext(il).location}var Fd="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Id(e){y.useContext(St).static||y.useLayoutEffect(e)}function Ng(){let{isDataRoute:e}=y.useContext(At);return e?Dg():_g()}function _g(){se(sl(),"useNavigate() may be used only in the context of a component.");let e=y.useContext(dr),{basename:t,navigator:n}=y.useContext(St),{matches:r}=y.useContext(At),{pathname:l}=jn(),o=JSON.stringify($d(r)),i=y.useRef(!1);return Id(()=>{i.current=!0}),y.useCallback((s,u={})=>{if(dt(i.current,Fd),!i.current)return;if(typeof s=="number"){n.go(s);return}let p=Md(s,JSON.parse(o),l,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:$t([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,l,e])}y.createContext(null);function al(e,{relative:t}={}){let{matches:n}=y.useContext(At),{pathname:r}=jn(),l=JSON.stringify($d(n));return y.useMemo(()=>Md(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Lg(e,t){return Dd(e,t)}function Dd(e,t,n,r,l){var f;se(sl(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=y.useContext(St),{matches:i}=y.useContext(At),a=i[i.length-1],s=a?a.params:{},u=a?a.pathname:"/",p=a?a.pathnameBase:"/",m=a&&a.route;{let d=m&&m.path||"";Ad(u,!m||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 v=jn(),S;if(t){let d=typeof t=="string"?Rn(t):t;se(p==="/"||((f=d.pathname)==null?void 0:f.startsWith(p)),`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 "${p}" but pathname "${d.pathname}" was given in the \`location\` prop.`),S=d}else S=v;let x=S.pathname||"/",C=x;if(p!=="/"){let d=p.replace(/^\//,"").split("/");C="/"+x.replace(/^\//,"").split("/").slice(d.length).join("/")}let _=Rd(e,{pathname:C});dt(m||_!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),dt(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.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 h=$g(_&&_.map(d=>Object.assign({},d,{params:Object.assign({},s,d.params),pathname:$t([p,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?p:$t([p,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),i,n,r,l);return t&&h?y.createElement(il.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},h):h}function Pg(){let e=Ig(),t=Sg(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=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:o},"ErrorBoundary")," or"," ",y.createElement("code",{style:o},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},t),n?y.createElement("pre",{style:l},n):null,i)}var Rg=y.createElement(Pg,null),jg=class extends y.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?y.createElement(At.Provider,{value:this.props.routeContext},y.createElement(ga.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Tg({routeContext:e,match:t,children:n}){let r=y.useContext(dr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(At.Provider,{value:e},n)}function $g(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(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);se(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,p,m)=>{let v,S=!1,x=null,C=null;n&&(v=i&&p.route.id?i[p.route.id]:void 0,x=p.route.errorElement||Rg,a&&(s<0&&m===0?(Ad("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):s===m&&(S=!0,C=p.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,m+1)),h=()=>{let f;return v?f=x:S?f=C:p.route.Component?f=y.createElement(p.route.Component,null):p.route.element?f=p.route.element:f=u,y.createElement(Tg,{match:p,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:f})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?y.createElement(jg,{location:n.location,revalidation:n.revalidation,component:x,error:v,children:h(),routeContext:{outlet:null,matches:_,isDataRoute:!0},unstable_onError:r}):h()},null)}function va(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mg(e){let t=y.useContext(dr);return se(t,va(e)),t}function zg(e){let t=y.useContext(Io);return se(t,va(e)),t}function Og(e){let t=y.useContext(At);return se(t,va(e)),t}function ya(e){let t=Og(e),n=t.matches[t.matches.length-1];return se(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Fg(){return ya("useRouteId")}function Ig(){var r;let e=y.useContext(ga),t=zg("useRouteError"),n=ya("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Dg(){let{router:e}=Mg("useNavigate"),t=ya("useNavigate"),n=y.useRef(!1);return Id(()=>{n.current=!0}),y.useCallback(async(l,o={})=>{dt(n.current,Fd),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var ec={};function Ad(e,t,n){!t&&!ec[e]&&(ec[e]=!0,dt(!1,n))}y.memo(Ag);function Ag({routes:e,future:t,state:n,unstable_onError:r}){return Dd(e,void 0,n,r,t)}function Ud(e){se(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Ug({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){se(!sl(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),a=y.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=Rn(n));let{pathname:s="/",search:u="",hash:p="",state:m=null,key:v="default"}=n,S=y.useMemo(()=>{let x=It(s,i);return x==null?null:{location:{pathname:x,search:u,hash:p,state:m,key:v},navigationType:r}},[i,s,u,p,m,v,r]);return dt(S!=null,` is not able to match the URL "${s}${u}${p}" because it does not start with the basename, so the won't render anything.`),S==null?null:y.createElement(St.Provider,{value:a},y.createElement(il.Provider,{children:t,value:S}))}function Bg({children:e,location:t}){return Lg(ws(e),t)}function ws(e,t=[]){let n=[];return y.Children.forEach(e,(r,l)=>{if(!y.isValidElement(r))return;let o=[...t,l];if(r.type===y.Fragment){n.push.apply(n,ws(r.props.children,o));return}se(r.type===Ud,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),se(!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=ws(r.props.children,o)),n.push(i)}),n}var Kl="get",bl="application/x-www-form-urlencoded";function Do(e){return e!=null&&typeof e.tagName=="string"}function Hg(e){return Do(e)&&e.tagName.toLowerCase()==="button"}function Wg(e){return Do(e)&&e.tagName.toLowerCase()==="form"}function Vg(e){return Do(e)&&e.tagName.toLowerCase()==="input"}function Qg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Kg(e,t){return e.button===0&&(!t||t==="_self")&&!Qg(e)}var Ml=null;function bg(){if(Ml===null)try{new FormData(document.createElement("form"),0),Ml=!1}catch{Ml=!0}return Ml}var Yg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ni(e){return e!=null&&!Yg.has(e)?(dt(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${bl}"`),null):e}function Jg(e,t){let n,r,l,o,i;if(Wg(e)){let a=e.getAttribute("action");r=a?It(a,t):null,n=e.getAttribute("method")||Kl,l=Ni(e.getAttribute("enctype"))||bl,o=new FormData(e)}else if(Hg(e)||Vg(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a
`,x=`
${v}
`;return`
${S}${x}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function bv(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,p=i;return s?(u=a.substring(0,s.index).trim(),p+=a.substring(s.index+s[0].length)):u=a.trim(),{think:u||null,answer:p.trim()}}function Yv({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=Jd(e||""),[o,i]=Te.useState(!1),a=!!r;return g.jsxs("div",{className:"assistant-message",children:[a&&g.jsxs("div",{className:"assistant-thoughts",children:[g.jsxs("button",{className:"think-toggle",onClick:()=>i(s=>!s),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[g.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&g.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:cc(r)}})]}),g.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:cc(l||e||"")}}),Array.isArray(n)&&n.length>0&&g.jsx("div",{className:"msg-sources chips",children:n.map((s,u)=>{let p=s,m=!1;try{const v=new URL(s);if(v.protocol==="file:"){m=!0;const S=v.pathname.split("/").filter(Boolean);p=decodeURIComponent(S[S.length-1]||s)}else p=(v.hostname||s).replace(/^www\./i,"")}catch{}return g.jsx("a",{className:"chip",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:v=>{var S,x;if(m){v.preventDefault();try{const C=new URL(s);(x=(S=window.electronAPI)==null?void 0:S.openPath)==null||x.call(S,decodeURIComponent(C.pathname))}catch{}}},children:p},s+u)})})]})}const fc="websearch.searxUrl",dc="websearch.engines",pc="chat.libraryBySession";let Jv="http://127.0.0.1:8000";const Gv=48,Xv=24;function Zv(){var Ba;const[e,t]=y.useState([]),[n,r]=y.useState(null),[l,o]=y.useState("chats"),[i,a]=y.useState("General"),[s,u]=y.useState(null),[p,m]=y.useState(null),[v,S]=y.useState([]),[x,C]=y.useState([]),[_,h]=y.useState(null),[f,d]=y.useState(()=>{try{const c=localStorage.getItem(pc);return c?JSON.parse(c):{}}catch{return{}}}),[E,P]=y.useState(!1),[R,j]=y.useState(""),[O,U]=y.useState(""),[D,re]=y.useState(!1),[F,Y]=y.useState(""),[Fe,Ie]=y.useState(""),We=y.useRef(null),xt=y.useRef(null),M=y.useRef(null),[T,H]=y.useState(Jv),[te,de]=y.useState("Default"),[kt,pt]=y.useState(!1),[Et,Ct]=y.useState(localStorage.getItem(fc)||"http://localhost:8888"),[Ge,Gd]=y.useState(()=>{try{const c=localStorage.getItem(dc);if(c)return JSON.parse(c)}catch{}return["duckduckgo","bing","wikipedia","github","stack_overflow"]});y.useEffect(()=>{localStorage.setItem(fc,Et||"")},[Et]),y.useEffect(()=>{try{localStorage.setItem(dc,JSON.stringify(Ge||[]))}catch{}},[Ge]);const[ul,Xd]=y.useState(!1),[Ut,Ao]=y.useState(!1),[ty,Uo]=y.useState(!0),[Zd,Tn]=y.useState([]),[cl,ka]=y.useState({}),[qd,Bo]=y.useState(null),[Ho,fl]=y.useState("");function ep(c){const w=c.content||"";if(c.role==="assistant")try{const{answer:k}=Jd(w);return(k||w).trim()}catch{return w.trim()}return w}async function Ea(c){try{await navigator.clipboard.writeText(ep(c))}catch(w){console.error("Failed to copy message:",w)}}function fn(c,w,k,N={}){const{removeIfEmpty:$=!1}=N;t(A=>A.map(B=>{if(B.session_id!==c)return B;const I=[];for(const W of B.messages||[]){if(W.id!==w){I.push(W);continue}$&&!k||I.push({...W,content:k})}return{...B,messages:I}}))}function Bt(c){return(c==null?void 0:c.name)==="AbortError"}function Wo(c){return c instanceof Error&&c.message?c.message:String(c)}async function Ca(c,w,k){if(!c)return{contextBlock:null,sources:[]};const $=await(await fetch(`${T}/libraries/${c}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:k,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 tp(c,w){Bo(c),fl(w||"")}function dl(){Bo(null),fl("")}async function np(c){var A;const w=(((A=On[c])==null?void 0:A.content)||"").trim(),N=(Ho??"").trim();if(N.length===0){dl();return}if(N===w){dl();return}const $=n;if($){t(B=>B.map(I=>{if(I.session_id!==$)return I;const Ne=(I.messages||[]).slice(0,c+1).map((me,Xe)=>Xe===c?{...me,content:N}:me);return{...I,messages:Ne}})),Bo(null),fl(""),requestAnimationFrame(()=>Go("auto",$));try{const B=await fetch(`${T}/sessions/${$}/messages/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(!B.ok)throw new Error(`HTTP ${B.status}`)}catch(B){console.error("Failed to update message:",B),t(I=>I.map(W=>{if(W.session_id!==$)return W;const me=(W.messages||[]).map((Xe,V)=>V===c?{...Xe,content:w}:Xe);return{...W,messages:me}}));return}await Na(c,N)}}async function Na(c,w=null){var Ne,me,Xe,V,ce,Se;const k=n;if(Ut||!k||typeof c!="number")return;const N=((Ne=e.find(J=>J.session_id===k))==null?void 0:Ne.messages)||[];let $=c;for(let J=c;J>=0;J--)if(((me=N[J])==null?void 0:me.role)==="user"){$=J;break}t(J=>J.map(le=>le.session_id===k?{...le,messages:(le.messages||[]).slice(0,$+1)}:le));const A=Ta(k);let B=w??(((Xe=N[$])==null?void 0:Xe.content)||""),I=[];const W=[];try{const J=Oa(k),le=w??(((V=N[$])==null?void 0:V.content)||"");if((ce=J==null?void 0:J.states)!=null&&ce.is_indexed)try{const Q=await Ca(J.slug,le,A.signal);Q.contextBlock&&W.push(Q.contextBlock),Array.isArray(Q.sources)&&I.push(...Q.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("local library enrichment (regenerate) failed",Q)}if(ul)try{const Q=N.slice(Math.max(0,$-7),$+1).map(pe=>({role:pe.role,content:pe.content||""}));Q.length>0&&(Q[Q.length-1]={role:"user",content:le});const Z=await(await fetch(`${T}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({prompt:le,model:F,messages:Q,history_limit:8,searx_url:Et||null,engines:Array.isArray(Ge)?Ge:null})})).json();Z&&typeof Z.context_block=="string"&&Z.context_block.trim()&&W.push(Z.context_block.trim()),Array.isArray(Z==null?void 0:Z.sources)&&I.push(...Z.sources)}catch(Q){if(Bt(Q))throw Q;console.warn("web search enrichment (regenerate) failed",Q)}if(I=[...new Set(I)],W.length>0?B=`${le} + +${W.join(` + +`)}`:B=null,kt){const Q=`msg-${Date.now()}-${Math.random()}`;let _t="";t(Z=>Z.map(pe=>pe.session_id===k?{...pe,messages:[...pe.messages||[],{id:Q,role:"assistant",content:"",sources:I}]}:pe));try{const Z=await fetch(`${T}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:F,stream:!0,enriched_message:B,sources:I||[]})});if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const pe=(Se=Z.body)==null?void 0:Se.getReader();if(!pe)throw new Error("Missing response body");const Wt=new TextDecoder;let ht=!1;for(;;){const{value:hn,done:Ep}=await pe.read();if(Ep)break;const Cp=Wt.decode(hn,{stream:!0});_t+=Cp,fn(k,Q,_t),!ht&&Ce.current!==k&&(ht=!0,dn(Xo=>({...Xo,[k]:Q})),Tn(Xo=>[...new Set([...Xo,k])]))}Ce.current!==k?(dn(hn=>({...hn,[k]:Q})),Tn(hn=>[...new Set([...hn,k])])):$n.current[k]?Mn(hn=>({...hn,[k]:Q})):requestAnimationFrame(()=>Fn(Q,"smooth",k))}catch(Z){if(Bt(Z)){fn(k,Q,_t,{removeIfEmpty:!0});return}console.error(Z),fn(k,Q,`Error: ${Wo(Z)}`,{removeIfEmpty:!0});return}}else{const Q=await fetch(`${T}/sessions/${k}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:A.signal,body:JSON.stringify({index:c,model:F,stream:!1,enriched_message:B,sources:I||[]})});if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const _t=await Q.json(),Z=`msg-${Date.now()}`;t(pe=>pe.map(Wt=>Wt.session_id===k?{...Wt,messages:[...Wt.messages||[],{role:"assistant",content:_t.reply,id:Z,sources:I}]}:Wt)),Ce.current!==k?(dn(pe=>({...pe,[k]:Z})),Tn(pe=>[...new Set([...pe,k])])):$n.current[k]?Mn(pe=>({...pe,[k]:Z})):requestAnimationFrame(()=>Fn(Z,"smooth",k))}}catch(J){Bt(J)||console.error(J)}finally{Vo(A)}}const[_a,rp]=y.useState({}),$n=y.useRef({}),[lp,dn]=y.useState({}),pn=y.useRef({}),La=y.useRef({}),[Pa,Mn]=y.useState({}),[op,Ra]=y.useState({}),ja=(c,w,k)=>c!=null&&c.id?c.id:`${k}:${w}`;y.useEffect(()=>{var w;if(!n)return;const c=((w=e.find(k=>k.session_id===n))==null?void 0:w.messages)||[];Ra(k=>{const N={};return c.forEach(($,A)=>{if($.role!=="user")return;const B=ja($,A,n),W=($.content||"").split(/\r\n|\r|\n/).length>30;N[B]=W?k[B]??!0:!1}),N})},[e,n]);function ip(c){Ra(w=>({...w,[c]:!(w[c]??!0)}))}const pr=Te.useCallback((c,w)=>{rp(k=>{const N={...k,[c]:w};return $n.current=N,N})},[]),zn=y.useRef(null),sp=y.useRef(!1),ap=y.useRef(null),Ce=y.useRef(n);y.useEffect(()=>{Ce.current=n},[n]);const Ta=Te.useCallback(c=>{const w=new AbortController;return zn.current={controller:w,sessionId:c},Ao(!0),w},[]),Vo=Te.useCallback(c=>{var w;((w=zn.current)==null?void 0:w.controller)===c&&(zn.current=null,Ao(!1))},[]),up=Te.useCallback(()=>{const c=zn.current;c&&(zn.current=null,c.controller.abort(),Ao(!1))},[]);y.useEffect(()=>()=>{var c;(c=zn.current)==null||c.controller.abort()},[]);const Ht=y.useRef(null),[cp,fp]=y.useState(230),[pl,$a]=y.useState(!1),dp=Te.useCallback(c=>{$a(!0)},[]),Qo=Te.useCallback(()=>{$a(!1)},[]),Ko=Te.useCallback(c=>{if(pl){const w=Math.max(230,Math.min(500,c.clientX));fp(w)}},[pl]);Te.useEffect(()=>(window.addEventListener("mousemove",Ko),window.addEventListener("mouseup",Qo),()=>{window.removeEventListener("mousemove",Ko),window.removeEventListener("mouseup",Qo)}),[Ko,Qo]),Te.useEffect(()=>{pl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[pl]),Te.useEffect(()=>{const c=async w=>{const k=w.target.closest(".codeblock__copy");if(!k)return;const N=k.closest(".codeblock"),$=N==null?void 0:N.querySelector("pre > code");if($)try{await navigator.clipboard.writeText($.textContent||""),k.classList.add("copied"),setTimeout(()=>k.classList.remove("copied"),800)}catch(A){console.error("Copy failed:",A)}};return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[]),y.useEffect(()=>{window.electronAPI.getSettings().then(w=>{H(w.ollamaApiUrl),de(w.colorScheme||"Default"),Y(w.chatModel||""),pt(w.streamOutput||!1),ka(w.scrollPositions||{}),el(w.colorScheme||"Default")});const c=()=>{var w;l==="chats"&&((w=xt.current)==null||w.focus())};return window.electronAPI.onWindowFocus(c),()=>{}},[l]),y.useEffect(()=>{el(te)},[te]);const pp=c=>{!c||!T||fetch(`${T}/history?session_id=${encodeURIComponent(c)}`).then(w=>w.json()).then(w=>{t(k=>k.map(N=>N.session_id===c?{...N,messages:w.messages||[]}:N))}).catch(()=>{})};async function hl(){if(T)try{const w=await(await fetch(`${T}/libraries`)).json(),k=Array.isArray(w.libraries)?w.libraries:[];if(S(k),k.length===0){h(null);return}k.some(N=>N.slug===_)||h(k[0].slug)}catch(c){console.warn("Failed to load libraries",c)}}async function bo(){if(T)try{const w=await(await fetch(`${T}/jobs`)).json();C(Array.isArray(w.jobs)?w.jobs:[])}catch(c){console.warn("Failed to load library jobs",c)}}async function Ma(c=null){const k=(typeof c=="string"?c:R).trim();if(!k){U("Name is required.");return}try{U("");const N=await fetch(`${T}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})});if(!N.ok){const A=await N.text();throw new Error(A||`HTTP ${N.status}`)}const $=await N.json();P(!1),j(""),await hl(),$!=null&&$.slug&&h($.slug)}catch(N){console.error("Failed to create library",N),U(String((N==null?void 0:N.message)||N))}}y.useEffect(()=>{T&&(Uo(!0),fetch(`${T}/sessions`).then(c=>c.json()).then(c=>{const w=c.sessions.map(k=>({...k,messages:[]}));t(w),w.length>0?r(w[0].session_id):r(null),Uo(!1)}).catch(()=>{Uo(!1)}))},[T]),y.useEffect(()=>{T&&(hl(),bo())},[T]),y.useEffect(()=>{try{localStorage.setItem(pc,JSON.stringify(f||{}))}catch{}},[f]),y.useEffect(()=>{if(!T)return;const c=setInterval(()=>{hl(),bo()},3e3);return()=>clearInterval(c)},[T,l,_]),y.useEffect(()=>{pp(n)},[n]),y.useEffect(()=>{const c=new Set(v.map(w=>w.slug));d(w=>{let k=!1;const N={};for(const[$,A]of Object.entries(w||{}))c.has(A)?N[$]=A:k=!0;return k?N:w})},[v]);const Yo=c=>{o(c)},hp=c=>{wp(c)},On=y.useMemo(()=>{var c;return((c=e.find(w=>w.session_id===n))==null?void 0:c.messages)||[]},[n,e]),ml=y.useMemo(()=>v.find(c=>c.slug===_)||null,[_,v]),Nt=n&&f[n]||null,lt=y.useMemo(()=>v.find(c=>c.slug===Nt)||null,[Nt,v]),za=y.useMemo(()=>Nt?x.some(c=>c.slug===Nt&&(c.status==="queued"||c.status==="running")):!1,[Nt,x]),Jo=y.useMemo(()=>{var c,w;return lt?(c=lt.files)!=null&&c.length?(w=lt.states)!=null&&w.is_indexed?"":za?" (syncing)":" (needs sync)":" (empty)":""},[lt,za]);function mp(c){return c&&f[c]||null}function Oa(c){const w=mp(c);return w&&v.find(k=>k.slug===w)||null}function Fa(c){return c?x.some(w=>w.slug===c&&(w.status==="queued"||w.status==="running")):!1}function Ia(c,w){c&&d(k=>{const N={...k||{}};return w?N[c]=w:delete N[c],N})}function gp(c){c&&d(w=>{let k=!1;const N={};for(const[$,A]of Object.entries(w||{})){if(A===c){k=!0;continue}N[$]=A}return k?N:w})}y.useEffect(()=>{if(!D)return;const c=w=>{var k;(k=M.current)!=null&&k.contains(w.target)||re(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[D]),y.useEffect(()=>{re(!1)},[n,l]),y.useEffect(()=>{const c=n,w=l;return()=>{if(w==="chats"&&c){const k=typeof pn.current[c]=="number"?pn.current[c]:We.current?We.current.scrollTop:0;ka(N=>{const $={...N,[c]:k};return window.electronAPI.updateSettings({scrollPositions:$}),$})}}},[n,l]),y.useEffect(()=>{const c=We.current;if(!c)return;const w=()=>{const{scrollTop:k,scrollHeight:N,clientHeight:$}=c,A=N-k-$<=Xv;if(n){const B=La.current[n],I=typeof B=="number"&&kc.removeEventListener("scroll",w)},[n,pr]),y.useEffect(()=>{const c=n;c&&_a[c]===!1&&Mn(w=>{if(!(c in w))return w;const k={...w};return delete k[c],k})},[n,_a]),y.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const c=We.current;if(!c)return;Ht.current=null;const w=()=>{if(Ht.current===n)return;const B=typeof pn.current[n]=="number"?pn.current[n]:void 0,I=typeof B=="number"?B:cl[n];if(typeof I=="number"){c.scrollTop=I,Ht.current=n;return}On.length>0&&(c.scrollTop=c.scrollHeight,Ht.current=n)};w();const k=requestAnimationFrame(w),N=()=>{Ht.current!==n&&requestAnimationFrame(w)},$=new MutationObserver(N);$.observe(c,{childList:!0,subtree:!0});const A=new ResizeObserver(N);return A.observe(c),()=>{cancelAnimationFrame(k),$.disconnect(),A.disconnect()}},[n,l,On.length,cl]),y.useEffect(()=>{if(l!=="chats"||!n||Ht.current===n)return;const c=typeof pn.current[n]=="number"?pn.current[n]:void 0;typeof(typeof c=="number"?c:cl[n])!="number"&&On.length>0&&requestAnimationFrame(()=>{const k=We.current;k&&(k.scrollTop=k.scrollHeight,Ht.current=n)})},[On.length,n,l,cl]);const Go=(c="smooth",w=null)=>{const k=We.current;if(!k)return;const N=w??Ce.current;Ce.current===N&&(k.scrollTo({top:k.scrollHeight,behavior:c}),pr(N,!1))},Fn=(c,w="auto",k=null)=>{const N=We.current;if(!N)return;const $=k??Ce.current;if(Ce.current!==$)return;const A=document.getElementById(c);if(A){const B=Math.max(0,A.offsetTop-Gv);N.scrollTo({top:B,behavior:w})}},vp=()=>{const c=Ce.current,w=Pa[c];w&&(Fn(w,"smooth",c),Mn(k=>{const{[c]:N,...$}=k;return $}))};async function Da(){var $,A,B;if(Ut||!Fe.trim()||!F)return;let c=n,w=!1;if(c){const I=e.find(W=>W.session_id===c);w=I&&I.name==="New Chat"&&I.messages.length===0}else{const I=await Aa();await new Promise(W=>setTimeout(W,200)),c=I.session_id,w=!0}const k={role:"user",content:Fe.trim(),id:`msg-${Date.now()}-${Math.random()}`};sp.current=!0,ap.current=c,pr(c,!1),Ce.current===c&&(Ht.current=Ce.current),Ld.flushSync(()=>{t(I=>I.map(W=>W.session_id===c?{...W,messages:[...W.messages||[],k]}:W)),Ie("")}),requestAnimationFrame(()=>Go("auto",c));const N=Ta(c);try{let I=[];try{I=[...((($=e.find(Se=>Se.session_id===c))==null?void 0:$.messages)||[]).slice(-8).map(Se=>({role:Se.role,content:Se.content||""})),{role:"user",content:k.content}]}catch{}let W=k.content,Ne=[];const me=[],Xe=Oa(c);if((A=Xe==null?void 0:Xe.states)!=null&&A.is_indexed)try{const V=await Ca(Xe.slug,k.content,N.signal);V.contextBlock&&me.push(V.contextBlock),Array.isArray(V.sources)&&Ne.push(...V.sources)}catch(V){if(Bt(V))throw V;console.warn("local library enrichment failed",V)}if(ul)try{const ce=await(await fetch(`${T}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({prompt:k.content,model:F,messages:I,history_limit:8,searx_url:Et||null,engines:Array.isArray(Ge)?Ge:null})})).json();ce&&typeof ce.context_block=="string"&&ce.context_block.trim()&&me.push(ce.context_block.trim()),Array.isArray(ce==null?void 0:ce.sources)&&Ne.push(...ce.sources)}catch(V){if(Bt(V))throw V;console.warn("web search enrichment failed",V)}if(Ne=[...new Set(Ne)],me.length>0&&(W=`${k.content} + +${me.join(` + +`)}`),kt){const V=`msg-${Date.now()}-${Math.random()}`;let ce="";const Se={role:"assistant",content:"",id:V,sources:Ne};t(J=>J.map(le=>le.session_id===c?{...le,messages:[...le.messages||[],Se]}:le));try{const J=await fetch(`${T}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:F,message:k.content,enriched_message:me.length>0?W:null,stream:!0,sources:Ne||[]})});if(!J.ok)throw new Error(`HTTP ${J.status}`);const le=(B=J.body)==null?void 0:B.getReader();if(!le)throw new Error("Missing response body");const Q=new TextDecoder;let _t=!1;for(;;){const{value:Z,done:pe}=await le.read();if(pe){fn(c,V,ce),Ce.current===c?$n.current[c]?Mn(ht=>({...ht,[c]:V})):requestAnimationFrame(()=>Fn(V,"smooth",c)):(dn(ht=>({...ht,[c]:V})),Tn(ht=>[...new Set([...ht,c])]));break}const Wt=Q.decode(Z,{stream:!0});ce+=Wt,fn(c,V,ce),Ce.current===c&&!$n.current[c]&&Go("auto",c),Ce.current!==c&&!_t&&(dn(ht=>({...ht,[c]:V})),_t=!0)}}catch(J){if(Bt(J)){fn(c,V,ce,{removeIfEmpty:!0});return}console.error("Failed to send message:",J),fn(c,V,"Error: "+Wo(J),{removeIfEmpty:!0});return}}else{const V=await fetch(`${T}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:N.signal,body:JSON.stringify({session_id:c,model:F,message:k.content,enriched_message:me.length>0?W:null,stream:!1,sources:Ne||[]})});if(!V.ok)throw new Error(`HTTP ${V.status}`);const ce=await V.json(),Se=`msg-${Date.now()}`,J={role:"assistant",content:ce.reply,id:Se,sources:Ne};t(le=>le.map(Q=>Q.session_id===c?{...Q,messages:[...Q.messages||[],J]}:Q)),Se&&(Ce.current===c?$n.current[c]?Mn(le=>({...le,[c]:Se})):requestAnimationFrame(()=>Fn(Se,"smooth",c)):dn(le=>({...le,[c]:Se})))}Ce.current!==c&&Tn(V=>[...new Set([...V,c])]),w&&fetch(`${T}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c,message:k.content,model:F})}).then(V=>V.json()).then(V=>{const ce=V.title.replace(/[\s\S]*?<\/think(?:ing)?>/i,"").trim();t(Se=>Se.map(J=>J.session_id===c?{...J,name:ce}:J))})}catch(I){if(Bt(I)){Vo(N);return}console.error("Failed to send message:",I);const W={role:"assistant",content:"Error: "+Wo(I),id:`msg-${Date.now()}-${Math.random()}`};t(Ne=>Ne.map(me=>me.session_id===c?{...me,messages:[...me.messages,W]}:me))}finally{Vo(N)}}function yp(){Xd(c=>!c)}async function Aa(){var $;const c="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),k=await(await fetch(`${T}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:c})})).json(),N={...k,messages:[]};return t(A=>[N,...A]),r(k.session_id),($=xt.current)==null||$.focus(),k}function wp(c){r(c),Tn(k=>k.filter(N=>N!==c));const w=lp[c];w&&requestAnimationFrame(()=>{let k=12;const N=()=>{if(!We.current)return;let A=document.getElementById(w);if(!A){const B=e.find(I=>I.session_id===c);if(B&&Array.isArray(B.messages))for(let I=B.messages.length-1;I>=0;I--){const W=B.messages[I];if(W.role==="assistant"&&W.id){A=document.getElementById(W.id);break}}}A?(Fn(A.id,"smooth",c),dn(B=>{const{[c]:I,...W}=B;return W})):k-- >0&&requestAnimationFrame(N)};requestAnimationFrame(N)})}function Sp(c,w){fetch(`${T}/sessions/${c}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w})}).then(()=>{t(k=>k.map(N=>N.session_id===c?{...N,name:w}:N)),u(null)})}function xp(c,w){const k=(w||"").trim(),N=v.find($=>$.slug===c);if(!N){m(null);return}if(!k||k===N.name){m(null);return}fetch(`${T}/libraries/${c}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k})}).then(()=>{S($=>$.map(A=>A.slug===c?{...A,name:k}:A)),m(null)})}function Ua(c){fetch(`${T}/sessions/${c}`,{method:"DELETE"}).then(()=>{const w=e.filter(k=>k.session_id!==c);t(w),d(k=>{const N={...k||{}};return delete N[c],N}),n===c&&r(w.length>0?w[0].session_id:null)})}y.useEffect(()=>{const c=e.filter(w=>w.name==="New Chat"&&w.session_id!==n&&w.messages.length===0);c.length>0&&c.forEach(w=>{Ua(w.session_id)})},[n,e,T]);const kp=c=>{var k;window.getSelection().toString().length>0||document.activeElement!==xt.current&&(c.target.closest(".msg")||(k=xt.current)==null||k.focus())};return g.jsxs("div",{className:"app",style:{gridTemplateColumns:`${cp}px 1fr`},children:[g.jsxs("div",{className:"sidebar",children:[g.jsxs("div",{className:"sidebar-header",children:[g.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Yo("chats"),children:"Chats"}),g.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Yo("dbs"),children:"DBs"}),g.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Yo("settings"),children:"Settings"})]}),g.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&g.jsx("div",{className:"chat-list",children:e.map(c=>g.jsx("div",{className:`chat-item ${c.session_id===n?"active":""}`,onClick:()=>hp(c.session_id),children:s===c.session_id?g.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>u(null),onKeyDown:w=>{w.key==="Enter"?Sp(c.session_id,w.target.value):w.key==="Escape"&&u(null)},autoFocus:!0}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:c.name}),g.jsxs("div",{className:"chat-item-buttons",children:[Zd.includes(c.session_id)&&g.jsx("div",{className:"unread-dot"}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),u(c.session_id)},children:g.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:g.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),Ua(c.session_id)},children:g.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:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},c.session_id))}),l==="dbs"&&g.jsx("div",{className:"db-list",children:v.length===0?g.jsx("div",{className:"empty-list-message",children:"No databases yet."}):v.map(c=>g.jsx("div",{className:`chat-item ${c.slug===_?"active":""}`,onClick:()=>h(c.slug),children:p===c.slug?g.jsx("input",{type:"text",className:"rename-input",defaultValue:c.name,onBlur:()=>m(null),onKeyDown:w=>{w.key==="Enter"?xp(c.slug,w.target.value):w.key==="Escape"&&m(null)},autoFocus:!0}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:c.name}),g.jsxs("div",{className:"chat-item-buttons",children:[Nt===c.slug&&g.jsx("div",{className:"db-active-badge",children:"Chat"}),Fa(c.slug)&&g.jsx("div",{className:"db-active-badge",children:"Syncing"}),g.jsx("button",{className:"icon-button",onClick:w=>{w.stopPropagation(),m(c.slug)},children:g.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:g.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})})]})]})},c.slug))}),l==="settings"&&g.jsxs("div",{className:"settings-list",children:[g.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>a("General"),children:"General"}),g.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>a("Interface"),children:"Interface"}),g.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>a("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&g.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&g.jsx("button",{className:"button new-chat-button",onClick:Aa,children:"New Chat"}),l==="dbs"&&(E?g.jsxs("div",{className:"new-db-form",children:[g.jsx("input",{type:"text",className:"rename-input",value:R,onChange:c=>j(c.target.value),onKeyDown:c=>{c.key==="Enter"?Ma():c.key==="Escape"&&(P(!1),j(""),U(""))},placeholder:"Database name",autoFocus:!0}),O&&g.jsx("div",{className:"form-error",children:O}),g.jsxs("div",{className:"new-db-actions",children:[g.jsx("button",{className:"button new-db-button",onClick:()=>Ma(),children:"Create"}),g.jsx("button",{className:"button ghost",onClick:()=>{P(!1),j(""),U("")},children:"Cancel"})]})]}):g.jsx("button",{className:"button new-db-button",onClick:()=>{P(!0),U("")},children:"New Database"}))]}),g.jsx("div",{className:"resizer",onMouseDown:dp})]}),g.jsxs("div",{className:"main-content",children:[l==="chats"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"header",children:[g.jsxs("strong",{children:["Chat - ",((Ba=e.find(c=>c.session_id===n))==null?void 0:Ba.name)||"New Chat"]}),lt&&g.jsx("span",{className:"header-subtle",children:`DB: ${lt.name}${Jo}`})]}),g.jsx("div",{className:"chat",ref:We,onClick:kp,children:On.map((c,w)=>{const k=c.role==="user"&&qd===w;return g.jsx("div",{id:c.id,className:"msg "+(c.role==="user"?"user":"assistant")+(k?" editing":""),children:c.role==="assistant"?g.jsxs("div",{className:"assistant-message-wrapper",children:[g.jsx(Yv,{content:c.content,streamOutput:kt,sources:c.sources}),!Ut&&g.jsxs("div",{className:"message-options-bar assistant-options",children:[g.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:g.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:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),g.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>Na(w),children:g.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:g.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"})})})]})]}):g.jsxs("div",{className:"user-message-wrapper",children:[k?g.jsxs("div",{className:"msg-content msg-content--user editing",children:[g.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Ho}),g.jsx(sc,{className:"edit-message-input edit-overlay",value:Ho,onChange:N=>fl(N.target.value),onBlur:dl,onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),dl()),N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),np(w))},autoFocus:!0,minRows:1})]}):(()=>{const N=c.content||"",$=N.split(/\r\n|\r|\n/),A=$.length>30,B=ja(c,w,n),I=A?op[B]??!0:!1,W=I?$.slice(0,30).join(` +`)+` +…`:N;return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"msg-content msg-content--user",children:W}),A&&g.jsx("button",{className:"user-msg-expand",onClick:()=>ip(B),"aria-expanded":I?"false":"true",children:I?"Show entire message":"Collapse"})]})})(),!Ut&&!k&&g.jsxs("div",{className:"message-options-bar user-options",children:[g.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>tp(w,c.content),children:g.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:[g.jsx("path",{d:"M12 20h9"}),g.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),g.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>Ea(c),children:g.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:[g.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),g.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),Pa[n]&&g.jsxs("button",{className:"new-msg-tip",onClick:vp,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",g.jsx("span",{style:{marginLeft:6},children:"↓"})]}),g.jsx("div",{className:"footer",children:g.jsxs("div",{className:"footer-content-wrapper",children:[g.jsx(sc,{ref:xt,className:"input",value:Fe,onChange:c=>Ie(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),Da())},placeholder:"Ask any question...",maxRows:13}),g.jsxs("div",{className:"footer-tool-group",ref:M,children:[g.jsx("button",{type:"button",className:"db-picker-toggle"+(lt?" active":""),onClick:()=>{n&&re(c=>!c)},title:lt?`Database: ${lt.name}${Jo}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":D,disabled:!n,children:g.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:[g.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),g.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),g.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),D&&g.jsxs("div",{className:"db-picker-menu",role:"menu",children:[g.jsxs("button",{type:"button",className:"db-picker-option"+(Nt?"":" selected"),onClick:()=>{Ia(n,null),re(!1)},children:[g.jsx("span",{children:"No database"}),!Nt&&g.jsx("span",{className:"db-picker-status",children:"Selected"})]}),v.length===0?g.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):v.map(c=>{var $,A,B;const w=Nt===c.slug,k=Fa(c.slug),N=($=c.files)!=null&&$.length?(A=c.states)!=null&&A.is_indexed?"Ready":k?"Syncing":"Needs sync":"Empty";return g.jsxs("button",{type:"button",className:"db-picker-option"+(w?" selected":""),disabled:!((B=c.files)!=null&&B.length),onClick:()=>{Ia(n,c.slug),re(!1)},children:[g.jsx("span",{children:c.name}),g.jsx("span",{className:"db-picker-status",children:w?"Selected":N})]},c.slug)})]})]}),g.jsx("button",{type:"button",className:"websearch-toggle"+(ul?" active":""),onClick:yp,title:"Toggle web search","aria-pressed":ul,children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),g.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"})]})}),g.jsx("button",{className:"button",onClick:Ut?up:Da,title:Ut?"Cancel generation":"Send","aria-label":Ut?"Cancel generation":"Send",children:Ut?g.jsx("div",{className:"spinner"}):"Send"})]})})]}),l==="dbs"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"header",children:[g.jsx("strong",{children:(ml==null?void 0:ml.name)||"Databases"}),lt&&g.jsx("span",{className:"header-subtle",children:`Current chat DB: ${lt.name}${Jo}`})]}),g.jsx(Qv,{apiBase:T,library:ml,jobs:x,onRefresh:async()=>{await hl(),await bo()},onDeleted:c=>{if(_===c){const w=v.find(k=>k.slug!==c);h((w==null?void 0:w.slug)||null)}gp(c)}})]}),l==="settings"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"header",children:g.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&g.jsx(Dv,{onModelChange:Y,streamOutput:kt,onStreamOutputChange:pt}),i==="Interface"&&g.jsx(Hv,{}),i==="Websearch"&&g.jsx(Kv,{searxUrl:Et,setSearxUrl:Ct,engines:Ge,setEngines:Gd})]})]})]})}function qv(){return y.useEffect(()=>{window.electronAPI.getSettings().then(e=>{el(e.colorScheme||"Default")})},[]),g.jsx(Te.StrictMode,{children:g.jsx(cv,{children:g.jsx(Bg,{children:g.jsx(Ud,{path:"/",element:g.jsx(Zv,{})})})})})}const ey=Pd(document.getElementById("root"));ey.render(g.jsx(qv,{})); diff --git a/dist/index.html b/dist/index.html index 5a19a6e..21dd244 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ LLM Desktop - +