From 2cb4fe4b41656c37d9e483ff5939da2d23562232 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 17 Apr 2026 04:48:17 +0200 Subject: [PATCH] auto-git: [add] dist/assets/index-Ctu3w7qr.js [change] dist/index.html [change] src/App.jsx [unlink] dist/assets/index-DifKT69O.js --- dist/assets/index-Ctu3w7qr.js | 74 +++++++++++++++++++++++++++++++++++ dist/assets/index-DifKT69O.js | 74 ----------------------------------- dist/index.html | 2 +- src/App.jsx | 2 + 4 files changed, 77 insertions(+), 75 deletions(-) create mode 100644 dist/assets/index-Ctu3w7qr.js delete mode 100644 dist/assets/index-DifKT69O.js diff --git a/dist/assets/index-Ctu3w7qr.js b/dist/assets/index-Ctu3w7qr.js new file mode 100644 index 0000000..411fb51 --- /dev/null +++ b/dist/assets/index-Ctu3w7qr.js @@ -0,0 +1,74 @@ +(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 em(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xd={exports:{}},Xo={},kd={exports:{}},Y={};/** + * @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 vl=Symbol.for("react.element"),tm=Symbol.for("react.portal"),nm=Symbol.for("react.fragment"),rm=Symbol.for("react.strict_mode"),lm=Symbol.for("react.profiler"),om=Symbol.for("react.provider"),im=Symbol.for("react.context"),sm=Symbol.for("react.forward_ref"),am=Symbol.for("react.suspense"),um=Symbol.for("react.memo"),cm=Symbol.for("react.lazy"),bu=Symbol.iterator;function dm(e){return e===null||typeof e!="object"?null:(e=bu&&e[bu]||e["@@iterator"],typeof e=="function"?e:null)}var Ed={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Cd=Object.assign,Nd={};function wr(e,t,n){this.props=e,this.context=t,this.refs=Nd,this.updater=n||Ed}wr.prototype.isReactComponent={};wr.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")};wr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _d(){}_d.prototype=wr.prototype;function pa(e,t,n){this.props=e,this.context=t,this.refs=Nd,this.updater=n||Ed}var ha=pa.prototype=new _d;ha.constructor=pa;Cd(ha,wr.prototype);ha.isPureReactComponent=!0;var Bu=Array.isArray,jd=Object.prototype.hasOwnProperty,ma={current:null},Ld={key:!0,ref:!0,__self:!0,__source:!0};function Rd(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)jd.call(t,r)&&!Ld.hasOwnProperty(r)&&(l[r]=t[r]);var s=arguments.length-2;if(s===1)l.children=n;else if(1>>1,te=P[q];if(0>>1;ql(Gt,W))Ael(gt,Gt)?(P[q]=gt,P[Ae]=W,q=Ae):(P[q]=Gt,P[ut]=W,q=ut);else if(Ael(gt,W))P[q]=gt,P[Ae]=W,q=Ae;else break e}}return B}function l(P,B){var W=P.sortIndex-B.sortIndex;return W!==0?W:P.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var a=[],c=[],g=1,y=null,w=3,k=!1,E=!1,N=!1,j=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(P){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=P)r(c),B.sortIndex=B.expirationTime,t(a,B);else break;B=n(c)}}function C(P){if(N=!1,m(P),!E)if(n(a)!==null)E=!0,b(L);else{var B=n(c);B!==null&&X(C,B.startTime-P)}}function L(P,B){E=!1,N&&(N=!1,v(A),A=-1),k=!0;var W=w;try{for(m(B),y=n(a);y!==null&&(!(y.expirationTime>B)||P&&!le());){var q=y.callback;if(typeof q=="function"){y.callback=null,w=y.priorityLevel;var te=q(y.expirationTime<=B);B=e.unstable_now(),typeof te=="function"?y.callback=te:y===n(a)&&r(a),m(B)}else r(a);y=n(a)}if(y!==null)var ke=!0;else{var ut=n(c);ut!==null&&X(C,ut.startTime-B),ke=!1}return ke}finally{y=null,w=W,k=!1}}var I=!1,M=null,A=-1,H=5,U=-1;function le(){return!(e.unstable_now()-UP||125q?(P.sortIndex=W,t(c,P),n(a)===null&&P===n(c)&&(N?(v(A),A=-1):N=!0,X(C,W-q))):(P.sortIndex=te,t(a,P),E||k||(E=!0,b(L))),P},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(P){var B=w;return function(){var W=w;w=B;try{return P.apply(this,arguments)}finally{w=W}}}})(Md);$d.exports=Md;var km=$d.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 Em=f,it=km;function T(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"),hs=Object.prototype.hasOwnProperty,Cm=/^[: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]*$/,Wu={},Vu={};function Nm(e){return hs.call(Vu,e)?!0:hs.call(Wu,e)?!1:Cm.test(e)?Vu[e]=!0:(Wu[e]=!0,!1)}function _m(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 jm(e,t,n,r){if(t===null||typeof t>"u"||_m(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 Je(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 Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new Je(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new Je(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new Je(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new Je(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){Me[e]=new Je(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new Je(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Me[e]=new Je(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Me[e]=new Je(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Me[e]=new Je(e,5,!1,e.toLowerCase(),null,!1,!1)});var va=/[\-:]([a-z])/g;function ya(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(va,ya);Me[t]=new Je(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(va,ya);Me[t]=new Je(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(va,ya);Me[t]=new Je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new Je(e,1,!1,e.toLowerCase(),null,!1,!1)});Me.xlinkHref=new Je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Me[e]=new Je(e,1,!1,e.toLowerCase(),null,!0,!0)});function wa(e,t,n,r){var l=Me.hasOwnProperty(t)?Me[t]:null;(l!==null?l.type!==0:r||!(2s||l[i]!==o[s]){var a=` +`+l[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=s);break}}}finally{Di=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zr(e):""}function Lm(e){switch(e.tag){case 5:return zr(e.type);case 16:return zr("Lazy");case 13:return zr("Suspense");case 19:return zr("SuspenseList");case 0:case 2:case 15:return e=Oi(e.type,!1),e;case 11:return e=Oi(e.type.render,!1),e;case 1:return e=Oi(e.type,!0),e;default:return""}}function ys(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 Yn:return"Fragment";case Gn:return"Portal";case ms:return"Profiler";case Sa:return"StrictMode";case gs:return"Suspense";case vs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Od:return(e.displayName||"Context")+".Consumer";case Dd:return(e._context.displayName||"Context")+".Provider";case xa:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ka:return t=e.displayName||null,t!==null?t:ys(e.type)||"Memo";case Zt:t=e._payload,e=e._init;try{return ys(e(t))}catch{}}return null}function Rm(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 ys(t);case 8:return t===Sa?"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 hn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Tm(e){var t=zd(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 Vl(e){e._valueTracker||(e._valueTracker=Tm(e))}function Ud(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=zd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function No(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 ws(e,t){var n=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Qu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=hn(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 bd(e,t){t=t.checked,t!=null&&wa(e,"checked",t,!1)}function Ss(e,t){bd(e,t);var n=hn(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")?xs(e,t.type,n):t.hasOwnProperty("defaultValue")&&xs(e,t.type,hn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Gu(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 xs(e,t,n){(t!=="number"||No(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ur=Array.isArray;function ir(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Kl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Zr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hr={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},Pm=["Webkit","ms","Moz","O"];Object.keys(Hr).forEach(function(e){Pm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hr[t]=Hr[e]})});function Vd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hr.hasOwnProperty(e)&&Hr[e]?(""+t).trim():t+"px"}function Kd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Vd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Im=we({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 Cs(e,t){if(t){if(Im[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(T(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(T(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(T(61))}if(t.style!=null&&typeof t.style!="object")throw Error(T(62))}}function Ns(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 _s=null;function Ea(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var js=null,sr=null,ar=null;function Xu(e){if(e=Sl(e)){if(typeof js!="function")throw Error(T(280));var t=e.stateNode;t&&(t=ni(t),js(e.stateNode,e.type,t))}}function Qd(e){sr?ar?ar.push(e):ar=[e]:sr=e}function Gd(){if(sr){var e=sr,t=ar;if(ar=sr=null,Xu(e),t)for(e=0;e>>=0,e===0?32:31-(Hm(e)/Wm|0)|0}var Ql=64,Gl=4194304;function br(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 Ro(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var s=i&~l;s!==0?r=br(s):(o&=i,o!==0&&(r=br(o)))}else i=n&~l,i!==0?r=br(i):o!==0&&(r=br(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 yl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function Gm(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=Vr),ic=" ",sc=!1;function mf(e,t){switch(e){case"keyup":return kg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jn=!1;function Cg(e,t){switch(e){case"compositionend":return gf(t);case"keypress":return t.which!==32?null:(sc=!0,ic);case"textInput":return e=t.data,e===ic&&sc?null:e;default:return null}}function Ng(e,t){if(Jn)return e==="compositionend"||!Pa&&mf(e,t)?(e=pf(),po=La=rn=null,Jn=!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=dc(n)}}function Sf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xf(){for(var e=window,t=No();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=No(e.document)}return t}function Ia(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 Mg(e){var t=xf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Sf(n.ownerDocument.documentElement,n)){if(r!==null&&Ia(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=fc(n,o);var i=fc(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,Xn=null,$s=null,Qr=null,Ms=!1;function pc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ms||Xn==null||Xn!==No(r)||(r=Xn,"selectionStart"in r&&Ia(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}),Qr&&ol(Qr,r)||(Qr=r,r=Io($s,"onSelect"),0er||(e.current=Us[er],Us[er]=null,er--)}function ae(e,t){er++,Us[er]=e.current,e.current=t}var mn={},be=vn(mn),Ze=vn(!1),Pn=mn;function pr(e,t){var n=e.type.contextTypes;if(!n)return mn;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 et(e){return e=e.childContextTypes,e!=null}function Mo(){fe(Ze),fe(be)}function Sc(e,t,n){if(be.current!==mn)throw Error(T(168));ae(be,t),ae(Ze,n)}function Tf(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(T(108,Rm(e)||"Unknown",l));return we({},n,r)}function Ao(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mn,Pn=be.current,ae(be,e),ae(Ze,Ze.current),!0}function xc(e,t,n){var r=e.stateNode;if(!r)throw Error(T(169));n?(e=Tf(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,fe(Ze),fe(be),ae(be,e)):fe(Ze),ae(Ze,n)}var Dt=null,ri=!1,Xi=!1;function Pf(e){Dt===null?Dt=[e]:Dt.push(e)}function Kg(e){ri=!0,Pf(e)}function yn(){if(!Xi&&Dt!==null){Xi=!0;var e=0,t=re;try{var n=Dt;for(re=1;e>=i,l-=i,Ot=1<<32-Et(t)+l|n<A?(H=M,M=null):H=M.sibling;var U=w(v,M,m[A],C);if(U===null){M===null&&(M=H);break}e&&M&&U.alternate===null&&t(v,M),h=o(U,h,A),I===null?L=U:I.sibling=U,I=U,M=H}if(A===m.length)return n(v,M),pe&&Cn(v,A),L;if(M===null){for(;AA?(H=M,M=null):H=M.sibling;var le=w(v,M,U.value,C);if(le===null){M===null&&(M=H);break}e&&M&&le.alternate===null&&t(v,M),h=o(le,h,A),I===null?L=le:I.sibling=le,I=le,M=H}if(U.done)return n(v,M),pe&&Cn(v,A),L;if(M===null){for(;!U.done;A++,U=m.next())U=y(v,U.value,C),U!==null&&(h=o(U,h,A),I===null?L=U:I.sibling=U,I=U);return pe&&Cn(v,A),L}for(M=r(v,M);!U.done;A++,U=m.next())U=k(M,v,A,U.value,C),U!==null&&(e&&U.alternate!==null&&M.delete(U.key===null?A:U.key),h=o(U,h,A),I===null?L=U:I.sibling=U,I=U);return e&&M.forEach(function(he){return t(v,he)}),pe&&Cn(v,A),L}function j(v,h,m,C){if(typeof m=="object"&&m!==null&&m.type===Yn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Wl:e:{for(var L=m.key,I=h;I!==null;){if(I.key===L){if(L=m.type,L===Yn){if(I.tag===7){n(v,I.sibling),h=l(I,m.props.children),h.return=v,v=h;break e}}else if(I.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Zt&&Cc(L)===I.type){n(v,I.sibling),h=l(I,m.props),h.ref=Mr(v,I,m),h.return=v,v=h;break e}n(v,I);break}else t(v,I);I=I.sibling}m.type===Yn?(h=Tn(m.props.children,v.mode,C,m.key),h.return=v,v=h):(C=xo(m.type,m.key,m.props,null,v.mode,C),C.ref=Mr(v,h,m),C.return=v,v=C)}return i(v);case Gn:e:{for(I=m.key;h!==null;){if(h.key===I)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(v,h.sibling),h=l(h,m.children||[]),h.return=v,v=h;break e}else{n(v,h);break}else t(v,h);h=h.sibling}h=os(m,v.mode,C),h.return=v,v=h}return i(v);case Zt:return I=m._init,j(v,h,I(m._payload),C)}if(Ur(m))return E(v,h,m,C);if(Rr(m))return N(v,h,m,C);to(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(v,h.sibling),h=l(h,m),h.return=v,v=h):(n(v,h),h=ls(m,v.mode,C),h.return=v,v=h),i(v)):n(v,h)}return j}var mr=Af(!0),Df=Af(!1),Fo=vn(null),zo=null,rr=null,Da=null;function Oa(){Da=rr=zo=null}function Fa(e){var t=Fo.current;fe(Fo),e._currentValue=t}function Hs(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 cr(e,t){zo=e,Da=rr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qe=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(Da!==e)if(e={context:e,memoizedValue:t,next:null},rr===null){if(zo===null)throw Error(T(308));rr=e,zo.dependencies={lanes:0,firstContext:e}}else rr=rr.next=e;return t}var jn=null;function za(e){jn===null?jn=[e]:jn.push(e)}function Of(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,za(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ht(e,r)}function Ht(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 en=!1;function Ua(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ff(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 zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function cn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ht(e,n)}return l=r.interleaved,l===null?(t.next=t,za(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ht(e,n)}function mo(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,Na(e,n)}}function Nc(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 Uo(e,t,n,r){var l=e.updateQueue;en=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var a=s,c=a.next;a.next=null,i===null?o=c:i.next=c,i=a;var g=e.alternate;g!==null&&(g=g.updateQueue,s=g.lastBaseUpdate,s!==i&&(s===null?g.firstBaseUpdate=c:s.next=c,g.lastBaseUpdate=a))}if(o!==null){var y=l.baseState;i=0,g=c=a=null,s=o;do{var w=s.lane,k=s.eventTime;if((r&w)===w){g!==null&&(g=g.next={eventTime:k,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var E=e,N=s;switch(w=t,k=n,N.tag){case 1:if(E=N.payload,typeof E=="function"){y=E.call(k,y,w);break e}y=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=N.payload,w=typeof E=="function"?E.call(k,y,w):E,w==null)break e;y=we({},y,w);break e;case 2:en=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,w=l.effects,w===null?l.effects=[s]:w.push(s))}else k={eventTime:k,lane:w,tag:s.tag,payload:s.payload,callback:s.callback,next:null},g===null?(c=g=k,a=y):g=g.next=k,i|=w;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;w=s,s=w.next,w.next=null,l.lastBaseUpdate=w,l.shared.pending=null}}while(!0);if(g===null&&(a=y),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=g,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);Mn|=i,e.lanes=i,e.memoizedState=y}}function _c(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Zi.transition;Zi.transition={};try{e(!1),t()}finally{re=n,Zi.transition=r}}function tp(){return mt().memoizedState}function Jg(e,t,n){var r=fn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},np(e))rp(t,n);else if(n=Of(e,t,n,r),n!==null){var l=Ge();Ct(n,e,r,l),lp(n,t,r)}}function Xg(e,t,n){var r=fn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(np(e))rp(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,n);if(l.hasEagerState=!0,l.eagerState=s,Nt(s,i)){var a=t.interleaved;a===null?(l.next=l,za(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Of(e,t,l,r),n!==null&&(l=Ge(),Ct(n,e,r,l),lp(n,t,r))}}function np(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function rp(e,t){Gr=Bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Na(e,n)}}var Ho={readContext:ht,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},qg={readContext:ht,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:Lc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,vo(4194308,4,Jf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return vo(4194308,4,e,t)},useInsertionEffect:function(e,t){return vo(4,2,e,t)},useMemo:function(e,t){var n=Rt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Rt();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=Jg.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:jc,useDebugValue:Ga,useDeferredValue:function(e){return Rt().memoizedState=e},useTransition:function(){var e=jc(!1),t=e[0];return e=Yg.bind(null,e[1]),Rt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ve,l=Rt();if(pe){if(n===void 0)throw Error(T(407));n=n()}else{if(n=t(),Pe===null)throw Error(T(349));$n&30||Bf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Lc(Wf.bind(null,r,o,e),[e]),r.flags|=2048,pl(9,Hf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Rt(),t=Pe.identifierPrefix;if(pe){var n=Ft,r=Ot;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=dl++,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[Tt]=t,e[al]=r,hp(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ns(n,r),n){case"dialog":de("cancel",e),de("close",e),l=r;break;case"iframe":case"object":case"embed":de("load",e),l=r;break;case"video":case"audio":for(l=0;lyr&&(t.flags|=128,r=!0,Ar(o,!1),t.lanes=4194304)}else{if(!r)if(e=bo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ar(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!pe)return ze(t),null}else 2*xe()-o.renderingStartTime>yr&&n!==1073741824&&(t.flags|=128,r=!0,Ar(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=xe(),t.sibling=null,n=ge.current,ae(ge,r?n&1|2:n&1),t):(ze(t),null);case 22:case 23:return eu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?rt&1073741824&&(ze(t),t.subtreeFlags&6&&(t.flags|=8192)):ze(t),null;case 24:return null;case 25:return null}throw Error(T(156,t.tag))}function iv(e,t){switch(Ma(t),t.tag){case 1:return et(t.type)&&Mo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gr(),fe(Ze),fe(be),Ha(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ba(t),null;case 13:if(fe(ge),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(T(340));hr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(ge),null;case 4:return gr(),null;case 10:return Fa(t.type._context),null;case 22:case 23:return eu(),null;case 24:return null;default:return null}}var ro=!1,Ue=!1,sv=typeof WeakSet=="function"?WeakSet:Set,D=null;function lr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Se(e,t,r)}else n.current=null}function qs(e,t,n){try{n()}catch(r){Se(e,t,r)}}var zc=!1;function av(e,t){if(As=To,e=xf(),Ia(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,s=-1,a=-1,c=0,g=0,y=e,w=null;t:for(;;){for(var k;y!==n||l!==0&&y.nodeType!==3||(s=i+l),y!==o||r!==0&&y.nodeType!==3||(a=i+r),y.nodeType===3&&(i+=y.nodeValue.length),(k=y.firstChild)!==null;)w=y,y=k;for(;;){if(y===e)break t;if(w===n&&++c===l&&(s=i),w===o&&++g===r&&(a=i),(k=y.nextSibling)!==null)break;y=w,w=y.parentNode}y=k}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ds={focusedElem:e,selectionRange:n},To=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var N=E.memoizedProps,j=E.memoizedState,v=t.stateNode,h=v.getSnapshotBeforeUpdate(t.elementType===t.type?N:St(t.type,N),j);v.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(T(163))}}catch(C){Se(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return E=zc,zc=!1,E}function Yr(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&&qs(t,n,o)}l=l.next}while(l!==r)}}function ii(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 Zs(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 vp(e){var t=e.alternate;t!==null&&(e.alternate=null,vp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[al],delete t[zs],delete t[Wg],delete t[Vg])),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 yp(e){return e.tag===5||e.tag===3||e.tag===4}function Uc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yp(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 ea(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=$o));else if(r!==4&&(e=e.child,e!==null))for(ea(e,t,n),e=e.sibling;e!==null;)ea(e,t,n),e=e.sibling}function ta(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(ta(e,t,n),e=e.sibling;e!==null;)ta(e,t,n),e=e.sibling}var Ie=null,xt=!1;function qt(e,t,n){for(n=n.child;n!==null;)wp(e,t,n),n=n.sibling}function wp(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(qo,n)}catch{}switch(n.tag){case 5:Ue||lr(n,t);case 6:var r=Ie,l=xt;Ie=null,qt(e,t,n),Ie=r,xt=l,Ie!==null&&(xt?(e=Ie,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ie.removeChild(n.stateNode));break;case 18:Ie!==null&&(xt?(e=Ie,n=n.stateNode,e.nodeType===8?Ji(e.parentNode,n):e.nodeType===1&&Ji(e,n),rl(e)):Ji(Ie,n.stateNode));break;case 4:r=Ie,l=xt,Ie=n.stateNode.containerInfo,xt=!0,qt(e,t,n),Ie=r,xt=l;break;case 0:case 11:case 14:case 15:if(!Ue&&(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)&&qs(n,t,i),l=l.next}while(l!==r)}qt(e,t,n);break;case 1:if(!Ue&&(lr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Se(n,t,s)}qt(e,t,n);break;case 21:qt(e,t,n);break;case 22:n.mode&1?(Ue=(r=Ue)||n.memoizedState!==null,qt(e,t,n),Ue=r):qt(e,t,n);break;default:qt(e,t,n)}}function bc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new sv),t.forEach(function(r){var l=vv.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function wt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*cv(r/1960))-r,10e?16:e,ln===null)var r=!1;else{if(e=ln,ln=null,Ko=0,ee&6)throw Error(T(331));var l=ee;for(ee|=4,D=e.current;D!==null;){var o=D,i=o.child;if(D.flags&16){var s=o.deletions;if(s!==null){for(var a=0;axe()-qa?Rn(e,0):Xa|=n),tt(e,t)}function jp(e,t){t===0&&(e.mode&1?(t=Gl,Gl<<=1,!(Gl&130023424)&&(Gl=4194304)):t=1);var n=Ge();e=Ht(e,t),e!==null&&(yl(e,t,n),tt(e,n))}function gv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jp(e,n)}function vv(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(T(314))}r!==null&&r.delete(t),jp(e,n)}var Lp;Lp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ze.current)qe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qe=!1,lv(e,t,n);qe=!!(e.flags&131072)}else qe=!1,pe&&t.flags&1048576&&If(t,Oo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;yo(e,t),e=t.pendingProps;var l=pr(t,be.current);cr(t,n),l=Va(null,t,r,e,l,n);var o=Ka();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,et(r)?(o=!0,Ao(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ua(t),l.updater=oi,t.stateNode=l,l._reactInternals=t,Vs(t,r,e,n),t=Gs(null,t,r,!0,o,n)):(t.tag=0,pe&&o&&$a(t),Qe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(yo(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=wv(r),e=St(r,e),l){case 0:t=Qs(null,t,r,e,n);break e;case 1:t=Dc(null,t,r,e,n);break e;case 11:t=Mc(null,t,r,e,n);break e;case 14:t=Ac(null,t,r,St(r.type,e),n);break e}throw Error(T(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),Qs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),Dc(e,t,r,l,n);case 3:e:{if(dp(t),e===null)throw Error(T(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Ff(e,t),Uo(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=vr(Error(T(423)),t),t=Oc(e,t,r,n,l);break e}else if(r!==l){l=vr(Error(T(424)),t),t=Oc(e,t,r,n,l);break e}else for(lt=un(t.stateNode.containerInfo.firstChild),ot=t,pe=!0,kt=null,n=Df(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(hr(),r===l){t=Wt(e,t,n);break e}Qe(e,t,r,n)}t=t.child}return t;case 5:return zf(t),e===null&&Bs(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Os(r,l)?i=null:o!==null&&Os(r,o)&&(t.flags|=32),cp(e,t),Qe(e,t,i,n),t.child;case 6:return e===null&&Bs(t),null;case 13:return fp(e,t,n);case 4:return ba(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mr(t,null,r,n):Qe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),Mc(e,t,r,l,n);case 7:return Qe(e,t,t.pendingProps,n),t.child;case 8:return Qe(e,t,t.pendingProps.children,n),t.child;case 12:return Qe(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,ae(Fo,r._currentValue),r._currentValue=i,o!==null)if(Nt(o.value,i)){if(o.children===l.children&&!Ze.current){t=Wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){i=o.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=zt(-1,n&-n),a.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var g=c.pending;g===null?a.next=a:(a.next=g.next,g.next=a),c.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Hs(o.return,n,t),s.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(T(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Hs(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}Qe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,cr(t,n),l=ht(l),r=r(l),t.flags|=1,Qe(e,t,r,n),t.child;case 14:return r=t.type,l=St(r,t.pendingProps),l=St(r.type,l),Ac(e,t,r,l,n);case 15:return ap(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),yo(e,t),t.tag=1,et(r)?(e=!0,Ao(t)):e=!1,cr(t,n),op(t,r,l),Vs(t,r,l,n),Gs(null,t,r,!0,e,n);case 19:return pp(e,t,n);case 22:return up(e,t,n)}throw Error(T(156,t.tag))};function Rp(e,t){return tf(e,t)}function yv(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 ft(e,t,n,r){return new yv(e,t,n,r)}function nu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wv(e){if(typeof e=="function")return nu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xa)return 11;if(e===ka)return 14}return 2}function pn(e,t){var n=e.alternate;return n===null?(n=ft(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 xo(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")nu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Yn:return Tn(n.children,l,o,t);case Sa:i=8,l|=8;break;case ms:return e=ft(12,n,t,l|2),e.elementType=ms,e.lanes=o,e;case gs:return e=ft(13,n,t,l),e.elementType=gs,e.lanes=o,e;case vs:return e=ft(19,n,t,l),e.elementType=vs,e.lanes=o,e;case Fd:return ai(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dd:i=10;break e;case Od:i=9;break e;case xa:i=11;break e;case ka:i=14;break e;case Zt:i=16,r=null;break e}throw Error(T(130,e==null?e:typeof e,""))}return t=ft(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Tn(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function ai(e,t,n,r){return e=ft(22,e,r,t),e.elementType=Fd,e.lanes=n,e.stateNode={isHidden:!1},e}function ls(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function os(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Sv(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=zi(0),this.expirationTimes=zi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zi(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ru(e,t,n,r,l,o,i,s,a){return e=new Sv(e,t,n,s,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ft(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ua(o),e}function xv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($p)}catch(e){console.error(e)}}$p(),Id.exports=st;var Mp=Id.exports,Ap,Yc=Mp;Ap=Yc.createRoot,Yc.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 Jc="popstate";function _v(e={}){function t(l,o){let{pathname:i="/",search:s="",hash:a=""}=Fn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),ia("",{pathname:i,search:s,hash:a},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let a=l.location.href,c=a.indexOf("#");s=c===-1?a:a.slice(0,c)}return s+"#"+(typeof o=="string"?o:ml(o))}function r(l,o){_t(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Lv(t,n,r,e)}function ye(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _t(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function jv(){return Math.random().toString(36).substring(2,10)}function Xc(e,t){return{usr:e.state,key:e.key,idx:t}}function ia(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Fn(t):t,state:n,key:t&&t.key||r||jv()}}function ml({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 Fn(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 Lv(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,s="POP",a=null,c=g();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function g(){return(i.state||{idx:null}).idx}function y(){s="POP";let j=g(),v=j==null?null:j-c;c=j,a&&a({action:s,location:N.location,delta:v})}function w(j,v){s="PUSH";let h=ia(N.location,j,v);n&&n(h,j),c=g()+1;let m=Xc(h,c),C=N.createHref(h);try{i.pushState(m,"",C)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;l.location.assign(C)}o&&a&&a({action:s,location:N.location,delta:1})}function k(j,v){s="REPLACE";let h=ia(N.location,j,v);n&&n(h,j),c=g();let m=Xc(h,c),C=N.createHref(h);i.replaceState(m,"",C),o&&a&&a({action:s,location:N.location,delta:0})}function E(j){return Rv(j)}let N={get action(){return s},get location(){return e(l,i)},listen(j){if(a)throw new Error("A history only accepts one active listener");return l.addEventListener(Jc,y),a=j,()=>{l.removeEventListener(Jc,y),a=null}},createHref(j){return t(l,j)},createURL:E,encodeLocation(j){let v=E(j);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:w,replace:k,go(j){return i.go(j)}};return N}function Rv(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ye(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:ml(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Dp(e,t,n="/"){return Tv(e,t,n,!1)}function Tv(e,t,n,r){let l=typeof t=="string"?Fn(t):t,o=Vt(l.pathname||"/",n);if(o==null)return null;let i=Op(e);Pv(i);let s=null;for(let a=0;s==null&&a{let g={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&a)return;ye(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let y=Ut([r,g.relativePath]),w=n.concat(g);i.children&&i.children.length>0&&(ye(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),Op(i.children,t,w,y,a)),!(i.path==null&&!i.index)&&t.push({path:y,score:Fv(y,i.index),routesMeta:w})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let c of Fp(i.path))o(i,s,!0,c)}),t}function Fp(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=Fp(r.join("/")),s=[];return s.push(...i.map(a=>a===""?o:[o,a].join("/"))),l&&s.push(...i),s.map(a=>e.startsWith("/")&&a===""?"/":a)}function Pv(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:zv(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Iv=/^:[\w-]+$/,$v=3,Mv=2,Av=1,Dv=10,Ov=-2,qc=e=>e==="*";function Fv(e,t){let n=e.split("/"),r=n.length;return n.some(qc)&&(r+=Ov),t&&(r+=Mv),n.filter(l=>!qc(l)).reduce((l,o)=>l+(Iv.test(o)?$v:o===""?Av:Dv),r)}function zv(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 Uv(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let s=0;s{if(g==="*"){let E=s[w]||"";i=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const k=s[w];return y&&!k?c[g]=void 0:c[g]=(k||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:i,pattern:e}}function bv(e,t=!1,n=!0){_t(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,a)=>(r.push({paramName:s,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Bv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return _t(!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 Vt(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 Hv(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Fn(e):e;return{pathname:n?n.startsWith("/")?n:Wv(n,t):t,search:Qv(r),hash:Gv(l)}}function Wv(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 is(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 Vv(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zp(e){let t=Vv(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Up(e,t,n,r=!1){let l;typeof e=="string"?l=Fn(e):(l={...e},ye(!l.pathname||!l.pathname.includes("?"),is("?","pathname","search",l)),ye(!l.pathname||!l.pathname.includes("#"),is("#","pathname","hash",l)),ye(!l.search||!l.search.includes("#"),is("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,s;if(i==null)s=n;else{let y=t.length-1;if(!r&&i.startsWith("..")){let w=i.split("/");for(;w[0]==="..";)w.shift(),y-=1;l.pathname=w.join("/")}s=y>=0?t[y]:"/"}let a=Hv(l,s),c=i&&i!=="/"&&i.endsWith("/"),g=(o||i===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||g)&&(a.pathname+="/"),a}var Ut=e=>e.join("/").replace(/\/\/+/g,"/"),Kv=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Qv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Gv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Yv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var bp=["POST","PUT","PATCH","DELETE"];new Set(bp);var Jv=["GET",...bp];new Set(Jv);var kr=f.createContext(null);kr.displayName="DataRouter";var pi=f.createContext(null);pi.displayName="DataRouterState";f.createContext(!1);var Bp=f.createContext({isTransitioning:!1});Bp.displayName="ViewTransition";var Xv=f.createContext(new Map);Xv.displayName="Fetchers";var qv=f.createContext(null);qv.displayName="Await";var $t=f.createContext(null);$t.displayName="Navigation";var kl=f.createContext(null);kl.displayName="Location";var Qt=f.createContext({outlet:null,matches:[],isDataRoute:!1});Qt.displayName="Route";var su=f.createContext(null);su.displayName="RouteError";function Zv(e,{relative:t}={}){ye(El(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=f.useContext($t),{hash:l,pathname:o,search:i}=Cl(e,{relative:t}),s=o;return n!=="/"&&(s=o==="/"?n:Ut([n,o])),r.createHref({pathname:s,search:i,hash:l})}function El(){return f.useContext(kl)!=null}function zn(){return ye(El(),"useLocation() may be used only in the context of a component."),f.useContext(kl).location}var Hp="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Wp(e){f.useContext($t).static||f.useLayoutEffect(e)}function ey(){let{isDataRoute:e}=f.useContext(Qt);return e?py():ty()}function ty(){ye(El(),"useNavigate() may be used only in the context of a component.");let e=f.useContext(kr),{basename:t,navigator:n}=f.useContext($t),{matches:r}=f.useContext(Qt),{pathname:l}=zn(),o=JSON.stringify(zp(r)),i=f.useRef(!1);return Wp(()=>{i.current=!0}),f.useCallback((a,c={})=>{if(_t(i.current,Hp),!i.current)return;if(typeof a=="number"){n.go(a);return}let g=Up(a,JSON.parse(o),l,c.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ut([t,g.pathname])),(c.replace?n.replace:n.push)(g,c.state,c)},[t,n,o,l,e])}f.createContext(null);function Cl(e,{relative:t}={}){let{matches:n}=f.useContext(Qt),{pathname:r}=zn(),l=JSON.stringify(zp(n));return f.useMemo(()=>Up(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function ny(e,t){return Vp(e,t)}function Vp(e,t,n,r,l){var h;ye(El(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=f.useContext($t),{matches:i}=f.useContext(Qt),s=i[i.length-1],a=s?s.params:{},c=s?s.pathname:"/",g=s?s.pathnameBase:"/",y=s&&s.route;{let m=y&&y.path||"";Kp(c,!y||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${c}" (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 w=zn(),k;if(t){let m=typeof t=="string"?Fn(t):t;ye(g==="/"||((h=m.pathname)==null?void 0:h.startsWith(g)),`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 "${g}" but pathname "${m.pathname}" was given in the \`location\` prop.`),k=m}else k=w;let E=k.pathname||"/",N=E;if(g!=="/"){let m=g.replace(/^\//,"").split("/");N="/"+E.replace(/^\//,"").split("/").slice(m.length).join("/")}let j=Dp(e,{pathname:N});_t(y||j!=null,`No routes matched location "${k.pathname}${k.search}${k.hash}" `),_t(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${k.pathname}${k.search}${k.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 v=sy(j&&j.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:Ut([g,o.encodeLocation?o.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?g:Ut([g,o.encodeLocation?o.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),i,n,r,l);return t&&v?f.createElement(kl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...k},navigationType:"POP"}},v):v}function ry(){let e=fy(),t=Yv(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=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:o},"ErrorBoundary")," or"," ",f.createElement("code",{style:o},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:l},n):null,i)}var ly=f.createElement(ry,null),oy=class extends f.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?f.createElement(Qt.Provider,{value:this.props.routeContext},f.createElement(su.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function iy({routeContext:e,match:t,children:n}){let r=f.useContext(kr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(Qt.Provider,{value:e},n)}function sy(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 c=o.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);ye(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,a=-1;if(n)for(let c=0;c=0?o=o.slice(0,a+1):o=[o[0]];break}}}return o.reduceRight((c,g,y)=>{let w,k=!1,E=null,N=null;n&&(w=i&&g.route.id?i[g.route.id]:void 0,E=g.route.errorElement||ly,s&&(a<0&&y===0?(Kp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):a===y&&(k=!0,N=g.route.hydrateFallbackElement||null)));let j=t.concat(o.slice(0,y+1)),v=()=>{let h;return w?h=E:k?h=N:g.route.Component?h=f.createElement(g.route.Component,null):g.route.element?h=g.route.element:h=c,f.createElement(iy,{match:g,routeContext:{outlet:c,matches:j,isDataRoute:n!=null},children:h})};return n&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(oy,{location:n.location,revalidation:n.revalidation,component:E,error:w,children:v(),routeContext:{outlet:null,matches:j,isDataRoute:!0},unstable_onError:r}):v()},null)}function au(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ay(e){let t=f.useContext(kr);return ye(t,au(e)),t}function uy(e){let t=f.useContext(pi);return ye(t,au(e)),t}function cy(e){let t=f.useContext(Qt);return ye(t,au(e)),t}function uu(e){let t=cy(e),n=t.matches[t.matches.length-1];return ye(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function dy(){return uu("useRouteId")}function fy(){var r;let e=f.useContext(su),t=uy("useRouteError"),n=uu("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function py(){let{router:e}=ay("useNavigate"),t=uu("useNavigate"),n=f.useRef(!1);return Wp(()=>{n.current=!0}),f.useCallback(async(l,o={})=>{_t(n.current,Hp),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var Zc={};function Kp(e,t,n){!t&&!Zc[e]&&(Zc[e]=!0,_t(!1,n))}f.memo(hy);function hy({routes:e,future:t,state:n,unstable_onError:r}){return Vp(e,void 0,n,r,t)}function Qp(e){ye(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function my({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ye(!El(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),s=f.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=Fn(n));let{pathname:a="/",search:c="",hash:g="",state:y=null,key:w="default"}=n,k=f.useMemo(()=>{let E=Vt(a,i);return E==null?null:{location:{pathname:E,search:c,hash:g,state:y,key:w},navigationType:r}},[i,a,c,g,y,w,r]);return _t(k!=null,` is not able to match the URL "${a}${c}${g}" because it does not start with the basename, so the won't render anything.`),k==null?null:f.createElement($t.Provider,{value:s},f.createElement(kl.Provider,{children:t,value:k}))}function gy({children:e,location:t}){return ny(sa(e),t)}function sa(e,t=[]){let n=[];return f.Children.forEach(e,(r,l)=>{if(!f.isValidElement(r))return;let o=[...t,l];if(r.type===f.Fragment){n.push.apply(n,sa(r.props.children,o));return}ye(r.type===Qp,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),ye(!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=sa(r.props.children,o)),n.push(i)}),n}var ko="get",Eo="application/x-www-form-urlencoded";function hi(e){return e!=null&&typeof e.tagName=="string"}function vy(e){return hi(e)&&e.tagName.toLowerCase()==="button"}function yy(e){return hi(e)&&e.tagName.toLowerCase()==="form"}function wy(e){return hi(e)&&e.tagName.toLowerCase()==="input"}function Sy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xy(e,t){return e.button===0&&(!t||t==="_self")&&!Sy(e)}var io=null;function ky(){if(io===null)try{new FormData(document.createElement("form"),0),io=!1}catch{io=!0}return io}var Ey=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ss(e){return e!=null&&!Ey.has(e)?(_t(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Eo}"`),null):e}function Cy(e,t){let n,r,l,o,i;if(yy(e)){let s=e.getAttribute("action");r=s?Vt(s,t):null,n=e.getAttribute("method")||ko,l=ss(e.getAttribute("enctype"))||Eo,o=new FormData(e)}else if(vy(e)||wy(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a `,E=`
${w}
`;return`
${k}${E}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function O0(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r[\s\S]*?<\/think(?:ing)?>/gi,"").replace(/[*#]/g,"").replace(/\s+/g," ").trim()}function lh(e){if(!e)return{think:null,answer:""};const t=//i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let s=e.substring(l+o);const a=s.match(n);let c=null,g=i;return a?(c=s.substring(0,a.index).trim(),g+=s.substring(a.index+a[0].length)):c=s.trim(),{think:c||null,answer:g.trim()}}function z0({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=lh(e||""),[o,i]=Ke.useState(!1),s=!!r;return d.jsxs("div",{className:"assistant-message",children:[s&&d.jsxs("div",{className:"assistant-thoughts",children:[d.jsxs("button",{className:"think-toggle",onClick:()=>i(a=>!a),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[d.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&d.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:hd(r)}})]}),d.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:hd(l||e||"")}}),Array.isArray(n)&&n.length>0&&d.jsx("div",{className:"msg-sources chips",children:n.map((a,c)=>{let g=a,y=!1;try{const w=new URL(a);if(w.protocol==="file:"){y=!0;const k=w.pathname.split("/").filter(Boolean);g=decodeURIComponent(k[k.length-1]||a)}else g=(w.hostname||a).replace(/^www\./i,"")}catch{}return d.jsx("a",{className:"chip",href:a,target:"_blank",rel:"noreferrer",title:a,onClick:w=>{var k,E;if(y){w.preventDefault();try{const N=new URL(a);(E=(k=window.electronAPI)==null?void 0:k.openPath)==null||E.call(k,decodeURIComponent(N.pathname))}catch{}}},children:g},a+c)})})]})}function ds({attachments:e,className:t="",removable:n=!1,onRemove:r}){return!Array.isArray(e)||e.length===0?null:d.jsx("div",{className:`image-attachment-strip ${t}`.trim(),children:e.map((l,o)=>{const i=l==null?void 0:l.data_url;if(!i)return null;const s=l.id||`${l.name||"image"}-${o}-${i.length}`;return d.jsxs("div",{className:"image-attachment-card",children:[n&&d.jsx("button",{type:"button",className:"image-attachment-remove",onClick:()=>r==null?void 0:r(l.id),"aria-label":`Remove ${l.name||"image"}`,title:"Remove image",children:"×"}),d.jsx("img",{className:"image-attachment-thumb",src:i,alt:l.name||`Attachment ${o+1}`,loading:"lazy"})]},s)})})}const md="websearch.searxUrl",gd="websearch.engines",vd="chat.libraryBySession",yd="http://127.0.0.1:8888",fs=6,ps=20*1024*1024,U0=5*60*1e3,b0=200;let oh="http://127.0.0.1:8000";const B0=48,H0=24;function W0(e){return e.backendApiUrl||e.ollamaApiUrl||oh}function V0(e){const t=typeof e=="string"?e.trim():"";return!t||t==="http://localhost:8888"?yd:t}function ao(e){var n;return Array.from(((n=e==null?void 0:e.dataTransfer)==null?void 0:n.types)||[]).includes("Files")}function fa(e){return e?typeof e.type=="string"&&e.type.toLowerCase().startsWith("image/")?!0:/\.(png|jpe?g|gif|bmp|webp|tiff?|heic|avif)$/i.test(e.name||""):!1}function wd(e){var r,l;const t=Array.from(((r=e==null?void 0:e.dataTransfer)==null?void 0:r.items)||[]);return t.length>0?t.some(o=>{var i;return o.kind==="file"&&fa((i=o.getAsFile)==null?void 0:i.call(o))}):Array.from(((l=e==null?void 0:e.dataTransfer)==null?void 0:l.files)||[]).some(fa)}function Sd(e){return new Promise((t,n)=>{const r=new FileReader;r.onerror=()=>n(r.error||new Error(`Failed to read ${(e==null?void 0:e.name)||"image"}`)),r.onload=()=>t(String(r.result||"")),r.readAsDataURL(e)})}function K0(e,t){const n=String(t||"").trim();if(!n)return e||"";const r=String(e||"");if(!r.trim())return n;const l=/[\s\n]$/.test(r)?"":` +`;return`${r}${l}${n}`}function Q0(e){const t=Math.max(0,Math.floor(Number(e||0)/1e3)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function G0(){var Uu;const[e,t]=f.useState([]),[n,r]=f.useState(null),[l,o]=f.useState("chats"),[i,s]=f.useState("General"),[a,c]=f.useState(null),[g,y]=f.useState(null),[w,k]=f.useState([]),[E,N]=f.useState([]),[j,v]=f.useState(null),[h,m]=f.useState(()=>{try{const u=localStorage.getItem(vd);return u?JSON.parse(u):{}}catch{return{}}}),[C,L]=f.useState(!1),[I,M]=f.useState(""),[A,H]=f.useState(""),[U,le]=f.useState(!1),[he,Be]=f.useState(""),[ue,R]=f.useState(!1),[b,X]=f.useState(""),[P,B]=f.useState([]),[W,q]=f.useState(!1),te=f.useRef(null),ke=f.useRef(null),ut=f.useRef(null),Gt=f.useRef(null),Ae=f.useRef(0),[gt,Nl]=f.useState(!1),[_l,jl]=f.useState(""),[gi,Ll]=f.useState(""),[_e,Rl]=f.useState(!1),[He,vi]=f.useState(!1),[yi,Er]=f.useState(0),O=f.useRef(null),F=f.useRef(null),oe=f.useRef([]),Ee=f.useRef(null),Un=f.useRef(""),Tl=f.useRef(null),Pl=f.useRef(null),wi=f.useRef(0),Il=f.useRef(null),[Q,pu]=f.useState(oh),[hu,ih]=f.useState("Default"),[$l,mu]=f.useState(!1),[gu,Cr]=f.useState(""),[sh,Si]=f.useState(!1),[Nr,ah]=f.useState(()=>V0(localStorage.getItem(md))),[wn,uh]=f.useState(()=>A0(localStorage.getItem(gd)));f.useEffect(()=>{localStorage.setItem(md,Nr||"")},[Nr]),f.useEffect(()=>{try{localStorage.setItem(gd,JSON.stringify(Jo(wn)))}catch{}},[wn]);const[Ml,ch]=f.useState(!1),[vt,xi]=f.useState(!1),[vu,ki]=f.useState(!0),[dh,bn]=f.useState([]),[Al,yu]=f.useState({}),[wu,fh]=f.useState(!1),Su=f.useRef(!1),[ph,Ei]=f.useState(null),[Ci,Dl]=f.useState("");function hh(u){const p=u.content||"";if(u.role==="assistant")try{const{answer:S}=lh(p);return(S||p).trim()}catch{return p.trim()}return p}async function xu(u){try{await navigator.clipboard.writeText(hh(u))}catch(p){console.error("Failed to copy message:",p)}}function Sn(u,p,S,x={}){const{removeIfEmpty:_=!1}=x;t($=>$.map(z=>{if(z.session_id!==u)return z;const V=[];for(const Z of z.messages||[]){if(Z.id!==p){V.push(Z);continue}_&&!S||V.push({...Z,content:S})}return{...z,messages:V}}))}function jt(u){return(u==null?void 0:u.name)==="AbortError"}function Yt(u){return u instanceof Error&&u.message?u.message:String(u)}async function _r(u){const p=await u.json().catch(()=>null);if(u.ok)return p;const S=typeof(p==null?void 0:p.detail)=="string"?p.detail:typeof(p==null?void 0:p.message)=="string"?p.message:"";throw new Error(S||`HTTP ${u.status}`)}async function mh(u,p){const S=await fetch(`${Q}/models/capabilities?name=${encodeURIComponent(u)}`,{signal:p});return _r(S)}async function gh(){const u=await fetch(`${Q}/ollama/startup-status`);return _r(u)}async function vh(){const u=await fetch(`${Q}/startup/prepare-models`,{method:"POST"});return _r(u)}async function ku(u,p,S){if(!u)return{contextBlock:null,sources:[]};const _=await(await fetch(`${Q}/libraries/${u}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:S,body:JSON.stringify({prompt:p,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:[]}}async function Eu(u){const p=Array.from(u||[]).filter(fa);if(!p.length||!ue)return;const S=Math.max(0,fs-P.length);if(S<=0){window.alert(`You can attach up to ${fs} images per message.`);return}const x=p.slice(0,S),_=x.filter(z=>Number(z.size)>ps),$=x.filter(z=>Number(z.size)<=ps);if(_.length>0&&window.alert(`Images must be ${Math.round(ps/(1024*1024))} MB or smaller.`),!!$.length)try{const z=await Promise.all($.map(async(V,Z)=>({id:`attachment-${Date.now()}-${Z}-${Math.random().toString(36).slice(2)}`,name:V.name||"image",mime_type:V.type||"image/*",data_url:await Sd(V)})));B(V=>[...V,...z]),p.length>S&&window.alert(`Only the first ${fs} images can be attached.`)}catch(z){console.error("Failed to load image attachments",z),window.alert(`Image import failed: ${Yt(z)}`)}}function yh(u){B(p=>p.filter(S=>S.id!==u))}function wh(){var u;ue&&((u=Gt.current)==null||u.click())}function Ni(){Tl.current&&(window.clearInterval(Tl.current),Tl.current=null),Pl.current&&(window.clearTimeout(Pl.current),Pl.current=null)}function _i(u=F.current){Ni(),ua(u),F.current===u&&(F.current=null),O.current=null}async function Sh(u,p){if(!Q)throw new Error("The Heimgeist backend is not configured.");const S=new AbortController;Il.current=S,vi(!0);try{const x=await Sd(u),_=x.indexOf(",");if(_<=5)throw new Error("Recorded audio could not be encoded for upload.");const $=x.slice(0,_),z=x.slice(_+1);if(!/^data:[^,]+;base64$/i.test($)||!z)throw new Error("Recorded audio could not be encoded for upload.");const V=$.slice(5).replace(/;base64$/i,"").trim(),Z=await fetch(`${Q}/audio/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},signal:S.signal,body:JSON.stringify({mime_type:p||V||"audio/webm",audio_base64:z,language:gi||null})}),ie=await _r(Z),ne=String((ie==null?void 0:ie.text)||"").trim();if(!ne){window.alert("No speech was detected. Try again and speak closer to the selected microphone.");return}X(me=>K0(me,ne)),requestAnimationFrame(()=>{var me;return(me=ke.current)==null?void 0:me.focus()})}catch(x){if(jt(x))return;throw x}finally{Il.current===S&&(Il.current=null),vi(!1)}}async function Ol(u={}){const{shouldTranscribe:p=!0}=u,S=O.current,x=Ee.current,_=Un.current||(S==null?void 0:S.mimeType)||"audio/webm";if(!(!S||!x)){Rl(!1),Ni();try{S.state!=="inactive"&&S.stop();const $=await x;if(!p)return;if(!$||$.size<=0)throw new Error("Recorded audio was empty.");await Sh($,_)}catch($){p&&(console.error("Failed to stop microphone recording",$),window.alert(`Microphone transcription failed: ${Yt($)}`))}finally{Ee.current=null,oe.current=[],Un.current="",wi.current=0,Er(0)}}}async function xh(){if(!gt||_e||He||vt)return;if(!mi()){window.alert("Microphone capture is not available in this environment.");return}let u=null;try{u=await navigator.mediaDevices.getUserMedia(g0(_l))}catch(x){console.error("Failed to access microphone",x),window.alert(`Microphone access failed: ${Yt(x)}`);return}const p=y0();let S=null;try{S=p?new MediaRecorder(u,{mimeType:p}):new MediaRecorder(u)}catch(x){_i(u),console.error("Failed to create audio recorder",x),window.alert(`Microphone recording is not available: ${Yt(x)}`);return}F.current=u,O.current=S,oe.current=[],Un.current=S.mimeType||p||"audio/webm",wi.current=Date.now(),Er(0),Rl(!0),S.ondataavailable=x=>{x.data&&x.data.size>0&&oe.current.push(x.data)},Ee.current=new Promise((x,_)=>{S.onstop=()=>{const $=new Blob(oe.current,{type:S.mimeType||Un.current||"audio/webm"});_i(u),x($)},S.onerror=$=>{_i(u),_(($==null?void 0:$.error)||new Error("Audio recording failed."))}}),Tl.current=window.setInterval(()=>{Er(Date.now()-wi.current)},b0),Pl.current=window.setTimeout(()=>{Ol()},U0),S.start()}async function kh(){if(!He){if(_e){await Ol();return}await xh()}}async function Eh(u){var S;const p=(S=u.target)==null?void 0:S.files;try{await Eu(p)}finally{u.target&&(u.target.value="")}}function Ch(u,p){Ei(u),Dl(p||"")}function Fl(){Ei(null),Dl("")}async function Nh(u){var $;const p=((($=Vn[u])==null?void 0:$.content)||"").trim(),x=(Ci??"").trim();if(x.length===0){Fl();return}if(x===p){Fl();return}const _=n;if(_){t(z=>z.map(V=>{if(V.session_id!==_)return V;const ie=(V.messages||[]).slice(0,u+1).map((ne,me)=>me===u?{...ne,content:x}:ne);return{...V,messages:ie}})),Ei(null),Dl(""),requestAnimationFrame(()=>Ii("auto",_));try{const z=await fetch(`${Q}/sessions/${_}/messages/${u}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:x})});if(!z.ok)throw new Error(`HTTP ${z.status}`)}catch(z){console.error("Failed to update message:",z),t(V=>V.map(Z=>{if(Z.session_id!==_)return Z;const ne=(Z.messages||[]).map((me,Oe)=>Oe===u?{...me,content:p}:me);return{...Z,messages:ne}}));return}await Cu(u,x)}}async function Cu(u,p=null){var ie,ne,me,Oe,En,G;const S=n;if(vt||!S||typeof u!="number")return;const x=((ie=e.find(J=>J.session_id===S))==null?void 0:ie.messages)||[];let _=u;for(let J=u;J>=0;J--)if(((ne=x[J])==null?void 0:ne.role)==="user"){_=J;break}t(J=>J.map(ce=>ce.session_id===S?{...ce,messages:(ce.messages||[]).slice(0,_+1)}:ce));const $=Tu(S);let z=p??(((me=x[_])==null?void 0:me.content)||""),V=[];const Z=[];try{const J=Mu(S),ce=p??(((Oe=x[_])==null?void 0:Oe.content)||""),je=!!(ce||"").trim();if(je&&((En=J==null?void 0:J.states)!=null&&En.is_indexed))try{const K=await ku(J.slug,ce,$.signal);K.contextBlock&&Z.push(K.contextBlock),Array.isArray(K.sources)&&V.push(...K.sources)}catch(K){if(jt(K))throw K;console.warn("local library enrichment (regenerate) failed",K)}if(je&&Ml)try{const K=x.slice(Math.max(0,_-7),_+1).map(Ce=>({role:Ce.role,content:Ce.content||""}));K.length>0&&(K[K.length-1]={role:"user",content:ce});const se=await(await fetch(`${Q}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({prompt:ce,model:he,messages:K,history_limit:8,searx_url:Nr||null,engines:Array.isArray(wn)?wn:null})})).json();se&&typeof se.context_block=="string"&&se.context_block.trim()&&Z.push(se.context_block.trim()),Array.isArray(se==null?void 0:se.sources)&&V.push(...se.sources)}catch(K){if(jt(K))throw K;console.warn("web search enrichment (regenerate) failed",K)}if(V=[...new Set(V)],je&&Z.length>0?z=`${ce} + +${Z.join(` + +`)}`:z=null,$l){const K=`msg-${Date.now()}-${Math.random()}`;let nt="";t(se=>se.map(Ce=>Ce.session_id===S?{...Ce,messages:[...Ce.messages||[],{id:K,role:"assistant",content:"",sources:V}]}:Ce));try{const se=await fetch(`${Q}/sessions/${S}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({index:u,model:he,stream:!0,enriched_message:z,sources:V||[]})});if(!se.ok)throw new Error(`HTTP ${se.status}`);const Ce=(G=se.body)==null?void 0:G.getReader();if(!Ce)throw new Error("Missing response body");const Xt=new TextDecoder;let Bl=!1;for(;;){const{value:We,done:qh}=await Ce.read();if(qh)break;const Zh=Xt.decode(We,{stream:!0});nt+=Zh,Sn(S,K,nt),!Bl&&De.current!==S&&(Bl=!0,xn($i=>({...$i,[S]:K})),bn($i=>[...new Set([...$i,S])]))}De.current!==S?(xn(We=>({...We,[S]:K})),bn(We=>[...new Set([...We,S])])):Bn.current[S]?Hn(We=>({...We,[S]:K})):requestAnimationFrame(()=>Kn(K,"smooth",S))}catch(se){if(jt(se)){Sn(S,K,nt,{removeIfEmpty:!0});return}console.error(se),Sn(S,K,`Error: ${Yt(se)}`,{removeIfEmpty:!0});return}}else{const K=await fetch(`${Q}/sessions/${S}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({index:u,model:he,stream:!1,enriched_message:z,sources:V||[]})});if(!K.ok)throw new Error(`HTTP ${K.status}`);const nt=await K.json(),se=`msg-${Date.now()}`;t(Ce=>Ce.map(Xt=>Xt.session_id===S?{...Xt,messages:[...Xt.messages||[],{role:"assistant",content:nt.reply,id:se,sources:V}]}:Xt)),De.current!==S?(xn(Ce=>({...Ce,[S]:se})),bn(Ce=>[...new Set([...Ce,S])])):Bn.current[S]?Hn(Ce=>({...Ce,[S]:se})):requestAnimationFrame(()=>Kn(se,"smooth",S))}}catch(J){jt(J)||console.error(J)}finally{ji($)}}const[Nu,_h]=f.useState({}),Bn=f.useRef({}),[jh,xn]=f.useState({}),kn=f.useRef({}),_u=f.useRef({}),[ju,Hn]=f.useState({}),[Lh,Lu]=f.useState({}),Ru=(u,p,S)=>u!=null&&u.id?u.id:`${S}:${p}`;f.useEffect(()=>{var p;if(!n)return;const u=((p=e.find(S=>S.session_id===n))==null?void 0:p.messages)||[];Lu(S=>{const x={};return u.forEach((_,$)=>{if(_.role!=="user")return;const z=Ru(_,$,n),Z=(_.content||"").split(/\r\n|\r|\n/).length>30;x[z]=Z?S[z]??!0:!1}),x})},[e,n]);function Rh(u){Lu(p=>({...p,[u]:!(p[u]??!0)}))}const jr=Ke.useCallback((u,p)=>{_h(S=>{const x={...S,[u]:p};return Bn.current=x,x})},[]),Wn=f.useRef(null),Th=f.useRef(!1),Ph=f.useRef(null),De=f.useRef(n);f.useEffect(()=>{De.current=n},[n]);const Tu=Ke.useCallback(u=>{const p=new AbortController;return Wn.current={controller:p,sessionId:u},xi(!0),p},[]),ji=Ke.useCallback(u=>{var p;((p=Wn.current)==null?void 0:p.controller)===u&&(Wn.current=null,xi(!1))},[]),Ih=Ke.useCallback(()=>{const u=Wn.current;u&&(Wn.current=null,u.controller.abort(),xi(!1))},[]);f.useEffect(()=>()=>{var u;(u=Wn.current)==null||u.controller.abort()},[]);const Jt=f.useRef(null),[$h,Mh]=f.useState(230),[zl,Pu]=f.useState(!1),Ah=Ke.useCallback(u=>{Pu(!0)},[]),Li=Ke.useCallback(()=>{Pu(!1)},[]),Ri=Ke.useCallback(u=>{if(zl){const p=Math.max(230,Math.min(500,u.clientX));Mh(p)}},[zl]);Ke.useEffect(()=>(window.addEventListener("mousemove",Ri),window.addEventListener("mouseup",Li),()=>{window.removeEventListener("mousemove",Ri),window.removeEventListener("mouseup",Li)}),[Ri,Li]),Ke.useEffect(()=>{zl?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[zl]),Ke.useEffect(()=>{const u=async p=>{const S=p.target.closest(".codeblock__copy");if(!S)return;const x=S.closest(".codeblock"),_=x==null?void 0:x.querySelector("pre > code");if(_)try{await navigator.clipboard.writeText(_.textContent||""),S.classList.add("copied"),setTimeout(()=>S.classList.remove("copied"),800)}catch($){console.error("Copy failed:",$)}};return document.addEventListener("click",u),()=>document.removeEventListener("click",u)},[]),f.useEffect(()=>{window.electronAPI.getSettings().then(p=>{pu(W0(p)),ih(p.colorScheme||"Default"),Be(p.chatModel||""),mu(p.streamOutput||!1),Nl(p.audioInputEnabled===!0),jl(typeof p.audioInputDeviceId=="string"?p.audioInputDeviceId:""),Ll(typeof p.audioInputLanguage=="string"?p.audioInputLanguage:""),yu(p.scrollPositions||{}),gl(p.colorScheme||"Default")}).finally(()=>{fh(!0)});const u=()=>{var p;l==="chats"&&((p=ke.current)==null||p.focus())};return window.electronAPI.onWindowFocus(u),()=>{}},[l]),f.useEffect(()=>{let u=!1;const p=new AbortController;return!Q||!he?(R(!1),()=>{p.abort()}):((async()=>{try{const S=await mh(he,p.signal);u||R(!!(S!=null&&S.supports_vision))}catch(S){!u&&!jt(S)&&(console.warn("Failed to load model capabilities",S),R(!1))}})(),()=>{u=!0,p.abort()})},[Q,he]),f.useEffect(()=>{Ae.current=0,q(!1)},[ue,l]),f.useEffect(()=>{gt||!_e||Ol({shouldTranscribe:!1})},[gt,_e]),f.useEffect(()=>{l==="chats"||!_e||Ol()},[l,_e]),f.useEffect(()=>()=>{var p;(p=Il.current)==null||p.abort(),Ni();const u=O.current;if(u){u.ondataavailable=null,u.onstop=null,u.onerror=null;try{u.state!=="inactive"&&u.stop()}catch{}}ua(F.current)},[]),f.useEffect(()=>{if(!wu||vu||!Q||Su.current)return;Su.current=!0;let u=!1;const p=window.setTimeout(()=>{(async()=>{let S=!1;try{let x=await gh();if(u)return;if(!(x!=null&&x.ollama_running)&&(x!=null&&x.can_manage_locally)){const z=window.confirm(`Ollama is not running at ${x.ollama_url}. Start it in the background now with "ollama serve"?`);if(u)return;if(z){S=!0,Si(!0),Cr("Starting Ollama in the background...");const V=await fetch(`${Q}/ollama/start`,{method:"POST"});if(x=await _r(V),u)return}}const _=!(x!=null&&x.whisper_model_available),$=!!(x!=null&&x.ollama_running&&(x!=null&&x.can_manage_locally)&&!(x!=null&&x.embedding_model_available));if((_||$)&&(S=!0,Si(!0),Cr(_&&$?`Downloading Whisper ${(x==null?void 0:x.whisper_model)||"base"} and ${x.selected_embed_model}. This can take a while on first install.`:_?`Downloading Whisper ${(x==null?void 0:x.whisper_model)||"base"}. This can take a while on first install.`:`Downloading ${x.selected_embed_model} from Ollama. This can take a while on first install.`),await vh(),u))return}catch(x){u||(console.warn("startup Ollama check failed",x),S&&window.alert(`Startup action failed: ${Yt(x)}`))}finally{u||(Si(!1),Cr(""))}})()},1200);return()=>{u=!0,window.clearTimeout(p)}},[Q,vu,wu]),f.useEffect(()=>{gl(hu)},[hu]);const Dh=u=>{!u||!Q||fetch(`${Q}/history?session_id=${encodeURIComponent(u)}`).then(p=>p.json()).then(p=>{t(S=>S.map(x=>x.session_id===u?{...x,messages:p.messages||[]}:x))}).catch(()=>{})};async function Lr(){if(Q)try{const p=await(await fetch(`${Q}/libraries`)).json(),S=Array.isArray(p.libraries)?p.libraries:[];if(k(S),S.length===0){v(null);return}S.some(x=>x.slug===j)||v(S[0].slug)}catch(u){console.warn("Failed to load libraries",u)}}async function Ul(){if(Q)try{const p=await(await fetch(`${Q}/jobs`)).json();N(Array.isArray(p.jobs)?p.jobs:[])}catch(u){console.warn("Failed to load library jobs",u)}}async function Iu(u=null){const S=(typeof u=="string"?u:I).trim();if(!S){H("Name is required.");return}try{H("");const x=await fetch(`${Q}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S})});if(!x.ok){const $=await x.text();throw new Error($||`HTTP ${x.status}`)}const _=await x.json();L(!1),M(""),await Lr(),_!=null&&_.slug&&v(_.slug)}catch(x){console.error("Failed to create library",x),H(String((x==null?void 0:x.message)||x))}}async function Oh(){k([]),N([]),v(null),y(null),le(!1),m({}),await Lr(),await Ul()}f.useEffect(()=>{Q&&(ki(!0),fetch(`${Q}/sessions`).then(u=>u.json()).then(u=>{const p=u.sessions.map(S=>({...S,messages:[]}));t(p),p.length>0?r(p[0].session_id):r(null),ki(!1)}).catch(()=>{ki(!1)}))},[Q]),f.useEffect(()=>{Q&&(Lr(),Ul())},[Q]),f.useEffect(()=>{try{localStorage.setItem(vd,JSON.stringify(h||{}))}catch{}},[h]),f.useEffect(()=>{if(!Q)return;const u=setInterval(()=>{Lr(),Ul()},3e3);return()=>clearInterval(u)},[Q,l,j]),f.useEffect(()=>{Dh(n)},[n,Q]),f.useEffect(()=>{const u=new Set(w.map(p=>p.slug));m(p=>{let S=!1;const x={};for(const[_,$]of Object.entries(p||{}))u.has($)?x[_]=$:S=!0;return S?x:p})},[w]);const Ti=u=>{o(u)},Fh=u=>{Qh(u)},Vn=f.useMemo(()=>{var u;return((u=e.find(p=>p.session_id===n))==null?void 0:u.messages)||[]},[n,e]),bl=f.useMemo(()=>w.find(u=>u.slug===j)||null,[j,w]),Mt=n&&h[n]||null,yt=f.useMemo(()=>w.find(u=>u.slug===Mt)||null,[Mt,w]),$u=f.useMemo(()=>Mt?E.some(u=>u.slug===Mt&&(u.status==="queued"||u.status==="running")):!1,[Mt,E]),Pi=f.useMemo(()=>{var u,p;return yt?(u=yt.files)!=null&&u.length?(p=yt.states)!=null&&p.is_indexed?"":$u?" (syncing)":" (needs sync)":" (empty)":""},[yt,$u]);function zh(u){return u&&h[u]||null}function Mu(u){const p=zh(u);return p&&w.find(S=>S.slug===p)||null}function Au(u){return u?E.some(p=>p.slug===u&&(p.status==="queued"||p.status==="running")):!1}function Du(u,p){u&&m(S=>{const x={...S||{}};return p?x[u]=p:delete x[u],x})}function Uh(u){u&&m(p=>{let S=!1;const x={};for(const[_,$]of Object.entries(p||{})){if($===u){S=!0;continue}x[_]=$}return S?x:p})}f.useEffect(()=>{if(!U)return;const u=p=>{var S;(S=ut.current)!=null&&S.contains(p.target)||le(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[U]),f.useEffect(()=>{le(!1)},[n,l]),f.useEffect(()=>{const u=n,p=l;return()=>{if(p==="chats"&&u){const S=typeof kn.current[u]=="number"?kn.current[u]:te.current?te.current.scrollTop:0;yu(x=>{const _={...x,[u]:S};return window.electronAPI.updateSettings({scrollPositions:_}),_})}}},[n,l]),f.useEffect(()=>{const u=te.current;if(!u)return;const p=()=>{const{scrollTop:S,scrollHeight:x,clientHeight:_}=u,$=x-S-_<=H0;if(n){const z=_u.current[n],V=typeof z=="number"&&Su.removeEventListener("scroll",p)},[n,jr]),f.useEffect(()=>{const u=n;u&&Nu[u]===!1&&Hn(p=>{if(!(u in p))return p;const S={...p};return delete S[u],S})},[n,Nu]),f.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const u=te.current;if(!u)return;Jt.current=null;const p=()=>{if(Jt.current===n)return;const z=typeof kn.current[n]=="number"?kn.current[n]:void 0,V=typeof z=="number"?z:Al[n];if(typeof V=="number"){u.scrollTop=V,Jt.current=n;return}Vn.length>0&&(u.scrollTop=u.scrollHeight,Jt.current=n)};p();const S=requestAnimationFrame(p),x=()=>{Jt.current!==n&&requestAnimationFrame(p)},_=new MutationObserver(x);_.observe(u,{childList:!0,subtree:!0});const $=new ResizeObserver(x);return $.observe(u),()=>{cancelAnimationFrame(S),_.disconnect(),$.disconnect()}},[n,l,Vn.length,Al]),f.useEffect(()=>{if(l!=="chats"||!n||Jt.current===n)return;const u=typeof kn.current[n]=="number"?kn.current[n]:void 0;typeof(typeof u=="number"?u:Al[n])!="number"&&Vn.length>0&&requestAnimationFrame(()=>{const S=te.current;S&&(S.scrollTop=S.scrollHeight,Jt.current=n)})},[Vn.length,n,l,Al]);const Ii=(u="smooth",p=null)=>{const S=te.current;if(!S)return;const x=p??De.current;De.current===x&&(S.scrollTo({top:S.scrollHeight,behavior:u}),jr(x,!1))},Kn=(u,p="auto",S=null)=>{const x=te.current;if(!x)return;const _=S??De.current;if(De.current!==_)return;const $=document.getElementById(u);if($){const z=Math.max(0,$.offsetTop-B0);x.scrollTo({top:z,behavior:p})}},bh=()=>{const u=De.current,p=ju[u];p&&(Kn(p,"smooth",u),Hn(S=>{const{[u]:x,..._}=S;return _}))},Bh=u=>{l!=="chats"||!ao(u)||(u.preventDefault(),Ae.current+=1,ue&&wd(u)&&q(!0))},Hh=u=>{l!=="chats"||!ao(u)||(u.preventDefault(),u.dataTransfer.dropEffect=ue?"copy":"none",ue&&wd(u)&&!W&&q(!0))},Wh=u=>{l!=="chats"||!ao(u)||(Ae.current=Math.max(0,Ae.current-1),Ae.current===0&&q(!1))},Vh=async u=>{var p,S;l!=="chats"||!ao(u)||(u.preventDefault(),Ae.current=0,q(!1),ue&&(await Eu((p=u.dataTransfer)==null?void 0:p.files),(S=ke.current)==null||S.focus()))};async function Ou(){var z,V,Z;const u=b.trim();if(vt||!u&&P.length===0||!he)return;if(P.length>0&&!ue){window.alert("The selected model does not support image inputs.");return}let p=n,S=!1;if(p){const ie=e.find(ne=>ne.session_id===p);S=ie&&ie.name==="New Chat"&&ie.messages.length===0}else{const ie=await Fu();await new Promise(ne=>setTimeout(ne,200)),p=ie.session_id,S=!0}const x=P.map(({id:ie,...ne})=>({...ne})),_={role:"user",content:u,attachments:x,id:`msg-${Date.now()}-${Math.random()}`};Th.current=!0,Ph.current=p,jr(p,!1),De.current===p&&(Jt.current=De.current),Mp.flushSync(()=>{t(ie=>ie.map(ne=>ne.session_id===p?{...ne,messages:[...ne.messages||[],_]}:ne)),X(""),B([])}),requestAnimationFrame(()=>Ii("auto",p));const $=Tu(p);try{let ie=[];if(_.content)try{ie=[...(((z=e.find(ce=>ce.session_id===p))==null?void 0:z.messages)||[]).slice(-8).map(ce=>({role:ce.role,content:ce.content||""})),{role:"user",content:_.content}]}catch{}let ne=_.content||null,me=[];const Oe=[],En=Mu(p);if(_.content&&((V=En==null?void 0:En.states)!=null&&V.is_indexed))try{const G=await ku(En.slug,_.content,$.signal);G.contextBlock&&Oe.push(G.contextBlock),Array.isArray(G.sources)&&me.push(...G.sources)}catch(G){if(jt(G))throw G;console.warn("local library enrichment failed",G)}if(_.content&&Ml)try{const J=await(await fetch(`${Q}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({prompt:_.content,model:he,messages:ie,history_limit:8,searx_url:Nr||null,engines:Array.isArray(wn)?wn:null})})).json();J&&typeof J.context_block=="string"&&J.context_block.trim()&&Oe.push(J.context_block.trim()),Array.isArray(J==null?void 0:J.sources)&&me.push(...J.sources)}catch(G){if(jt(G))throw G;console.warn("web search enrichment failed",G)}if(me=[...new Set(me)],_.content&&Oe.length>0&&(ne=`${_.content} + +${Oe.join(` + +`)}`),$l){const G=`msg-${Date.now()}-${Math.random()}`;let J="";const ce={role:"assistant",content:"",id:G,sources:me};t(je=>je.map(K=>K.session_id===p?{...K,messages:[...K.messages||[],ce]}:K));try{const je=await fetch(`${Q}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({session_id:p,model:he,message:_.content,enriched_message:_.content&&Oe.length>0?ne:null,stream:!0,sources:me||[],attachments:x})});if(!je.ok)throw new Error(`HTTP ${je.status}`);const K=(Z=je.body)==null?void 0:Z.getReader();if(!K)throw new Error("Missing response body");const nt=new TextDecoder;let se=!1;for(;;){const{value:Ce,done:Xt}=await K.read();if(Xt){Sn(p,G,J),De.current===p?Bn.current[p]?Hn(We=>({...We,[p]:G})):requestAnimationFrame(()=>Kn(G,"smooth",p)):(xn(We=>({...We,[p]:G})),bn(We=>[...new Set([...We,p])]));break}const Bl=nt.decode(Ce,{stream:!0});J+=Bl,Sn(p,G,J),De.current===p&&!Bn.current[p]&&Ii("auto",p),De.current!==p&&!se&&(xn(We=>({...We,[p]:G})),se=!0)}}catch(je){if(jt(je)){Sn(p,G,J,{removeIfEmpty:!0});return}console.error("Failed to send message:",je),Sn(p,G,"Error: "+Yt(je),{removeIfEmpty:!0});return}}else{const G=await fetch(`${Q}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:$.signal,body:JSON.stringify({session_id:p,model:he,message:_.content,enriched_message:_.content&&Oe.length>0?ne:null,stream:!1,sources:me||[],attachments:x})});if(!G.ok)throw new Error(`HTTP ${G.status}`);const J=await G.json(),ce=`msg-${Date.now()}`,je={role:"assistant",content:J.reply,id:ce,sources:me};t(K=>K.map(nt=>nt.session_id===p?{...nt,messages:[...nt.messages||[],je]}:nt)),ce&&(De.current===p?Bn.current[p]?Hn(K=>({...K,[p]:ce})):requestAnimationFrame(()=>Kn(ce,"smooth",p)):xn(K=>({...K,[p]:ce})))}De.current!==p&&bn(G=>[...new Set([...G,p])]),S&&fetch(`${Q}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:p,message:_.content||(x.length>0?"Image attachment":_.content),model:he})}).then(G=>G.json()).then(G=>{const J=F0(G.title);t(ce=>ce.map(je=>je.session_id===p?{...je,name:J}:je))})}catch(ie){if(jt(ie)){ji($);return}console.error("Failed to send message:",ie);const ne={role:"assistant",content:"Error: "+Yt(ie),id:`msg-${Date.now()}-${Math.random()}`};t(me=>me.map(Oe=>Oe.session_id===p?{...Oe,messages:[...Oe.messages,ne]}:Oe))}finally{ji($)}}function Kh(){ch(u=>!u)}async function Fu(){var _;const u="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),S=await(await fetch(`${Q}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:u})})).json(),x={...S,messages:[]};return t($=>[x,...$]),r(S.session_id),(_=ke.current)==null||_.focus(),S}function Qh(u){r(u),bn(S=>S.filter(x=>x!==u));const p=jh[u];p&&requestAnimationFrame(()=>{let S=12;const x=()=>{if(!te.current)return;let $=document.getElementById(p);if(!$){const z=e.find(V=>V.session_id===u);if(z&&Array.isArray(z.messages))for(let V=z.messages.length-1;V>=0;V--){const Z=z.messages[V];if(Z.role==="assistant"&&Z.id){$=document.getElementById(Z.id);break}}}$?(Kn($.id,"smooth",u),xn(z=>{const{[u]:V,...Z}=z;return Z})):S-- >0&&requestAnimationFrame(x)};requestAnimationFrame(x)})}function Gh(u,p){fetch(`${Q}/sessions/${u}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:p})}).then(()=>{t(S=>S.map(x=>x.session_id===u?{...x,name:p}:x)),c(null)})}function Yh(u,p){const S=(p||"").trim(),x=w.find(_=>_.slug===u);if(!x){y(null);return}if(!S||S===x.name){y(null);return}fetch(`${Q}/libraries/${u}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S})}).then(()=>{k(_=>_.map($=>$.slug===u?{...$,name:S}:$)),y(null)})}function zu(u){fetch(`${Q}/sessions/${u}`,{method:"DELETE"}).then(()=>{const p=e.filter(S=>S.session_id!==u);t(p),m(S=>{const x={...S||{}};return delete x[u],x}),n===u&&r(p.length>0?p[0].session_id:null)})}function Jh(u){fetch(`${Q}/libraries/${u}`,{method:"DELETE"}).then(async p=>{var x;if(!p.ok){const _=await p.text();throw new Error(_||`HTTP ${p.status}`)}const S=w.filter(_=>_.slug!==u);k(S),N(_=>_.filter($=>$.slug!==u)),y(_=>_===u?null:_),j===u&&v(((x=S[0])==null?void 0:x.slug)||null),Uh(u)}).catch(p=>{console.error("Failed to delete library",p)})}f.useEffect(()=>{const u=e.filter(p=>p.name==="New Chat"&&p.session_id!==n&&p.messages.length===0);u.length>0&&u.forEach(p=>{zu(p.session_id)})},[n,e,Q]);const Xh=u=>{var S;window.getSelection().toString().length>0||document.activeElement!==ke.current&&(u.target.closest(".msg")||(S=ke.current)==null||S.focus())};return d.jsxs("div",{className:"app",style:{gridTemplateColumns:`${$h}px 1fr`},children:[d.jsxs("div",{className:"sidebar",children:[d.jsxs("div",{className:"sidebar-header",children:[d.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Ti("chats"),children:"Chats"}),d.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Ti("dbs"),children:"DBs"}),d.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Ti("settings"),children:"Settings"})]}),d.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&d.jsx("div",{className:"chat-list",children:e.map(u=>d.jsx("div",{className:`chat-item ${u.session_id===n?"active":""}`,onClick:()=>Fh(u.session_id),children:a===u.session_id?d.jsx("input",{type:"text",className:"rename-input",defaultValue:u.name,onBlur:()=>c(null),onKeyDown:p=>{p.key==="Enter"?Gh(u.session_id,p.target.value):p.key==="Escape"&&c(null)},autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.name}),d.jsxs("div",{className:"chat-item-buttons",children:[dh.includes(u.session_id)&&d.jsx("div",{className:"unread-dot"}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),c(u.session_id)},children:d.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:d.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),zu(u.session_id)},children:d.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:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},u.session_id))}),l==="dbs"&&d.jsx("div",{className:"db-list",children:w.length===0?d.jsx("div",{className:"empty-list-message",children:"No databases yet."}):w.map(u=>d.jsx("div",{className:`chat-item ${u.slug===j?"active":""}`,onClick:()=>v(u.slug),children:g===u.slug?d.jsx("input",{type:"text",className:"rename-input",defaultValue:u.name,onBlur:()=>y(null),onKeyDown:p=>{p.key==="Enter"?Yh(u.slug,p.target.value):p.key==="Escape"&&y(null)},autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.name}),d.jsxs("div",{className:"chat-item-buttons",children:[Mt===u.slug&&d.jsx("div",{className:"db-active-badge",children:"Chat"}),Au(u.slug)&&d.jsx("div",{className:"db-active-badge",children:"Syncing"}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),y(u.slug)},children:d.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:d.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),Jh(u.slug)},children:d.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:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},u.slug))}),l==="settings"&&d.jsxs("div",{className:"settings-list",children:[d.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>s("General"),children:"General"}),d.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>s("Interface"),children:"Interface"}),d.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>s("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&d.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&d.jsx("button",{className:"button new-chat-button",onClick:Fu,children:"New Chat"}),l==="dbs"&&(C?d.jsxs("div",{className:"new-db-form",children:[d.jsx("input",{type:"text",className:"rename-input",value:I,onChange:u=>M(u.target.value),onKeyDown:u=>{u.key==="Enter"?Iu():u.key==="Escape"&&(L(!1),M(""),H(""))},placeholder:"Database name",autoFocus:!0}),A&&d.jsx("div",{className:"form-error",children:A}),d.jsxs("div",{className:"new-db-actions",children:[d.jsx("button",{className:"button new-db-button",onClick:()=>Iu(),children:"Create"}),d.jsx("button",{className:"button ghost",onClick:()=>{L(!1),M(""),H("")},children:"Cancel"})]})]}):d.jsx("button",{className:"button new-db-button",onClick:()=>{L(!0),H("")},children:"New Database"}))]}),d.jsx("div",{className:"resizer",onMouseDown:Ah})]}),d.jsxs("div",{className:`main-content${l==="chats"&&W?" main-content--drag-active":""}`,onDragEnter:Bh,onDragOver:Hh,onDragLeave:Wh,onDrop:Vh,children:[gu&&d.jsxs("div",{className:"startup-task-banner",role:"status","aria-live":"polite",children:[sh&&d.jsx("div",{className:"spinner startup-task-banner__spinner"}),d.jsx("div",{className:"startup-task-banner__text",children:gu})]}),l==="chats"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"header",children:[d.jsxs("strong",{children:["Chat - ",((Uu=e.find(u=>u.session_id===n))==null?void 0:Uu.name)||"New Chat"]}),yt&&d.jsx("span",{className:"header-subtle",children:`DB: ${yt.name}${Pi}`})]}),d.jsx("div",{className:`chat${W?" chat--drag-active":""}`,ref:te,onClick:Xh,children:Vn.map((u,p)=>{const S=u.role==="user"&&ph===p;return d.jsx("div",{id:u.id,className:"msg "+(u.role==="user"?"user":"assistant")+(S?" editing":""),children:u.role==="assistant"?d.jsxs("div",{className:"assistant-message-wrapper",children:[d.jsx(z0,{content:u.content,streamOutput:$l,sources:u.sources}),!vt&&d.jsxs("div",{className:"message-options-bar assistant-options",children:[d.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>xu(u),children:d.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:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),d.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>Cu(p),children:d.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:d.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"})})})]})]}):d.jsxs("div",{className:"user-message-wrapper",children:[S?d.jsxs(d.Fragment,{children:[d.jsx(ds,{attachments:u.attachments,className:"message-attachment-strip"}),d.jsxs("div",{className:"msg-content msg-content--user editing",children:[d.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:Ci}),d.jsx(id,{className:"edit-message-input edit-overlay",value:Ci,onChange:x=>Dl(x.target.value),onBlur:Fl,onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),Fl()),x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),Nh(p))},autoFocus:!0,minRows:1})]})]}):(()=>{const x=u.content||"",_=Array.isArray(u.attachments)?u.attachments:[],$=x.split(/\r\n|\r|\n/),z=$.length>30,V=Ru(u,p,n),Z=z?Lh[V]??!0:!1,ie=Z?$.slice(0,30).join(` +`)+` +…`:x,ne=!!x.trim();return d.jsxs(d.Fragment,{children:[d.jsx(ds,{attachments:_,className:"message-attachment-strip"}),ne&&d.jsx("div",{className:"msg-content msg-content--user",children:ie}),ne&&z&&d.jsx("button",{className:"user-msg-expand",onClick:()=>Rh(V),"aria-expanded":Z?"false":"true",children:Z?"Show entire message":"Collapse"})]})})(),!vt&&!S&&d.jsxs("div",{className:"message-options-bar user-options",children:[d.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>Ch(p,u.content),children:d.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:[d.jsx("path",{d:"M12 20h9"}),d.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),d.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>xu(u),children:d.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:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},u.id||p)})},n),ju[n]&&d.jsxs("button",{className:"new-msg-tip",onClick:bh,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",d.jsx("span",{style:{marginLeft:6},children:"↓"})]}),d.jsx("div",{className:"footer",children:d.jsxs("div",{className:`footer-inner${W?" footer-inner--drag-active":""}`,children:[d.jsx("input",{ref:Gt,type:"file",accept:"image/*",multiple:!0,className:"composer-image-input",onChange:Eh,tabIndex:-1}),d.jsx(ds,{attachments:P,className:"composer-attachment-strip",removable:!0,onRemove:yh}),(_e||He)&&d.jsxs("div",{className:"composer-audio-status"+(_e?" composer-audio-status--recording":" composer-audio-status--transcribing"),role:"status","aria-live":"polite",children:[_e?d.jsx("span",{className:"composer-audio-status__dot","aria-hidden":"true"}):d.jsx("div",{className:"spinner composer-audio-status__spinner","aria-hidden":"true"}),d.jsx("span",{children:_e?`Listening ${Q0(yi)}`:"Transcribing audio…"})]}),d.jsxs("div",{className:"footer-content-wrapper",children:[d.jsx(id,{ref:ke,className:"input",value:b,onChange:u=>X(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!u.shiftKey&&!_e&&!He&&(u.preventDefault(),Ou())},placeholder:"Ask any question...",maxRows:13}),d.jsxs("div",{className:"footer-tool-group",ref:ut,children:[d.jsx("button",{type:"button",className:"db-picker-toggle"+(yt?" active":""),onClick:()=>{n&&le(u=>!u)},title:yt?`Database: ${yt.name}${Pi}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":U,disabled:!n,children:d.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:[d.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),d.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),d.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),U&&d.jsxs("div",{className:"db-picker-menu",role:"menu",children:[d.jsxs("button",{type:"button",className:"db-picker-option"+(Mt?"":" selected"),onClick:()=>{Du(n,null),le(!1)},children:[d.jsx("span",{children:"No database"}),!Mt&&d.jsx("span",{className:"db-picker-status",children:"Selected"})]}),w.length===0?d.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):w.map(u=>{var _,$,z;const p=Mt===u.slug,S=Au(u.slug),x=(_=u.files)!=null&&_.length?($=u.states)!=null&&$.is_indexed?"Ready":S?"Syncing":"Needs sync":"Empty";return d.jsxs("button",{type:"button",className:"db-picker-option"+(p?" selected":""),disabled:!((z=u.files)!=null&&z.length),onClick:()=>{Du(n,u.slug),le(!1)},children:[d.jsx("span",{children:u.name}),d.jsx("span",{className:"db-picker-status",children:p?"Selected":x})]},u.slug)})]})]}),ue&&d.jsx("button",{type:"button",className:"image-attach-toggle"+(P.length>0?" active":""),onClick:wh,title:"Attach images","aria-label":"Attach images",children:d.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:[d.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),d.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),d.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),gt&&d.jsx("button",{type:"button",className:"audio-input-toggle"+(_e||He?" active":"")+(_e?" recording":"")+(He?" transcribing":""),onClick:kh,title:_e?"Stop voice input":He?"Transcribing audio":"Start voice input","aria-label":_e?"Stop voice input":He?"Transcribing audio":"Start voice input","aria-pressed":_e,disabled:He||vt,children:He?d.jsx("div",{className:"spinner composer-audio-icon-spinner","aria-hidden":"true"}):d.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:[d.jsx("path",{d:"M12 3a3 3 0 0 1 3 3v6a3 3 0 0 1-6 0V6a3 3 0 0 1 3-3z"}),d.jsx("path",{d:"M19 10a7 7 0 0 1-14 0"}),d.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),d.jsx("line",{x1:"8",y1:"22",x2:"16",y2:"22"})]})}),d.jsx("button",{type:"button",className:"websearch-toggle"+(Ml?" active":""),onClick:Kh,title:"Toggle web search","aria-pressed":Ml,children:d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),d.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"})]})}),d.jsx("button",{className:"button",onClick:vt?Ih:Ou,title:vt?"Cancel generation":"Send","aria-label":vt?"Cancel generation":"Send",disabled:!vt&&(_e||He),children:vt?d.jsx("div",{className:"spinner"}):"Send"})]})]})})]}),l==="dbs"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"header",children:[d.jsx("strong",{children:(bl==null?void 0:bl.name)||"Databases"}),yt&&d.jsx("span",{className:"header-subtle",children:`Current chat DB: ${yt.name}${Pi}`})]}),d.jsx(I0,{apiBase:Q,library:bl,jobs:E,onRefresh:async()=>{await Lr(),await Ul()}})]}),l==="settings"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"header",children:d.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&d.jsx(N0,{onModelChange:Be,onBackendApiUrlChange:pu,streamOutput:$l,onStreamOutputChange:mu,onAudioInputEnabledChange:Nl,onAudioInputDeviceChange:jl,onAudioInputLanguageChange:Ll,onLibrariesPurged:Oh}),i==="Interface"&&d.jsx(T0,{}),i==="Websearch"&&d.jsx(D0,{searxUrl:Nr,setSearxUrl:ah,engines:wn,setEngines:u=>uh(Jo(u))})]})]})]})}function Y0(){return f.useEffect(()=>{window.electronAPI.getSettings().then(e=>{gl(e.colorScheme||"Default")})},[]),d.jsx(Ke.StrictMode,{children:d.jsx(zy,{children:d.jsx(gy,{children:d.jsx(Qp,{path:"/",element:d.jsx(G0,{})})})})})}const J0=Ap(document.getElementById("root"));J0.render(d.jsx(Y0,{})); diff --git a/dist/assets/index-DifKT69O.js b/dist/assets/index-DifKT69O.js deleted file mode 100644 index 6561bce..0000000 --- a/dist/assets/index-DifKT69O.js +++ /dev/null @@ -1,74 +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 Xh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yd={exports:{}},Go={},wd={exports:{}},G={};/** - * @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 gl=Symbol.for("react.element"),qh=Symbol.for("react.portal"),Zh=Symbol.for("react.fragment"),em=Symbol.for("react.strict_mode"),tm=Symbol.for("react.profiler"),nm=Symbol.for("react.provider"),rm=Symbol.for("react.context"),lm=Symbol.for("react.forward_ref"),om=Symbol.for("react.suspense"),im=Symbol.for("react.memo"),sm=Symbol.for("react.lazy"),zu=Symbol.iterator;function am(e){return e===null||typeof e!="object"?null:(e=zu&&e[zu]||e["@@iterator"],typeof e=="function"?e:null)}var Sd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xd=Object.assign,kd={};function wr(e,t,n){this.props=e,this.context=t,this.refs=kd,this.updater=n||Sd}wr.prototype.isReactComponent={};wr.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")};wr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ed(){}Ed.prototype=wr.prototype;function da(e,t,n){this.props=e,this.context=t,this.refs=kd,this.updater=n||Sd}var fa=da.prototype=new Ed;fa.constructor=da;xd(fa,wr.prototype);fa.isPureReactComponent=!0;var Uu=Array.isArray,Cd=Object.prototype.hasOwnProperty,pa={current:null},Nd={key:!0,ref:!0,__self:!0,__source:!0};function _d(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)Cd.call(t,r)&&!Nd.hasOwnProperty(r)&&(l[r]=t[r]);var s=arguments.length-2;if(s===1)l.children=n;else if(1>>1,re=L[ne];if(0>>1;nel(Yt,U))Pel(gt,Yt)?(L[ne]=gt,L[Pe]=U,ne=Pe):(L[ne]=Yt,L[ut]=U,ne=ut);else if(Pel(gt,U))L[ne]=gt,L[Pe]=U,ne=Pe;else break e}}return B}function l(L,B){var U=L.sortIndex-B.sortIndex;return U!==0?U:L.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var a=[],c=[],g=1,y=null,w=3,k=!1,E=!1,N=!1,j=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(L){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=L)r(c),B.sortIndex=B.expirationTime,t(a,B);else break;B=n(c)}}function C(L){if(N=!1,m(L),!E)if(n(a)!==null)E=!0,b(T);else{var B=n(c);B!==null&&q(C,B.startTime-L)}}function T(L,B){E=!1,N&&(N=!1,v(A),A=-1),k=!0;var U=w;try{for(m(B),y=n(a);y!==null&&(!(y.expirationTime>B)||L&&!X());){var ne=y.callback;if(typeof ne=="function"){y.callback=null,w=y.priorityLevel;var re=ne(y.expirationTime<=B);B=e.unstable_now(),typeof re=="function"?y.callback=re:y===n(a)&&r(a),m(B)}else r(a);y=n(a)}if(y!==null)var Ge=!0;else{var ut=n(c);ut!==null&&q(C,ut.startTime-B),Ge=!1}return Ge}finally{y=null,w=U,k=!1}}var $=!1,I=null,A=-1,V=5,F=-1;function X(){return!(e.unstable_now()-FL||125ne?(L.sortIndex=U,t(c,L),n(a)===null&&L===n(c)&&(N?(v(A),A=-1):N=!0,q(C,U-ne))):(L.sortIndex=re,t(a,L),E||k||(E=!0,b(T))),L},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(L){var B=w;return function(){var U=w;w=B;try{return L.apply(this,arguments)}finally{w=U}}}})(Pd);Ld.exports=Pd;var wm=Ld.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 Sm=f,it=wm;function R(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"),fs=Object.prototype.hasOwnProperty,xm=/^[: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]*$/,Bu={},Hu={};function km(e){return fs.call(Hu,e)?!0:fs.call(Bu,e)?!1:xm.test(e)?Hu[e]=!0:(Bu[e]=!0,!1)}function Em(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 Cm(e,t,n,r){if(t===null||typeof t>"u"||Em(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 Ye(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 Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new Ye(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new Ye(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new Ye(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new Ye(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){Me[e]=new Ye(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new Ye(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Me[e]=new Ye(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Me[e]=new Ye(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Me[e]=new Ye(e,5,!1,e.toLowerCase(),null,!1,!1)});var ma=/[\-:]([a-z])/g;function ga(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(ma,ga);Me[t]=new Ye(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(ma,ga);Me[t]=new Ye(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(ma,ga);Me[t]=new Ye(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new Ye(e,1,!1,e.toLowerCase(),null,!1,!1)});Me.xlinkHref=new Ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Me[e]=new Ye(e,1,!1,e.toLowerCase(),null,!0,!0)});function va(e,t,n,r){var l=Me.hasOwnProperty(t)?Me[t]:null;(l!==null?l.type!==0:r||!(2s||l[i]!==o[s]){var a=` -`+l[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=s);break}}}finally{Mi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fr(e):""}function Nm(e){switch(e.tag){case 5:return Fr(e.type);case 16:return Fr("Lazy");case 13:return Fr("Suspense");case 19:return Fr("SuspenseList");case 0:case 2:case 15:return e=Ai(e.type,!1),e;case 11:return e=Ai(e.type.render,!1),e;case 1:return e=Ai(e.type,!0),e;default:return""}}function gs(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 Gn:return"Fragment";case Yn:return"Portal";case ps:return"Profiler";case ya:return"StrictMode";case hs:return"Suspense";case ms:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Md:return(e.displayName||"Context")+".Consumer";case Id:return(e._context.displayName||"Context")+".Provider";case wa:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Sa:return t=e.displayName||null,t!==null?t:gs(e.type)||"Memo";case Zt:t=e._payload,e=e._init;try{return gs(e(t))}catch{}}return null}function _m(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 gs(t);case 8:return t===ya?"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 hn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Dd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jm(e){var t=Dd(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 Hl(e){e._valueTracker||(e._valueTracker=jm(e))}function Od(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Dd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Eo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function vs(e,t){var n=t.checked;return ye({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Vu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=hn(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 Fd(e,t){t=t.checked,t!=null&&va(e,"checked",t,!1)}function ys(e,t){Fd(e,t);var n=hn(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")?ws(e,t.type,n):t.hasOwnProperty("defaultValue")&&ws(e,t.type,hn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ku(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 ws(e,t,n){(t!=="number"||Eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zr=Array.isArray;function ir(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 qr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Br={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},Rm=["Webkit","ms","Moz","O"];Object.keys(Br).forEach(function(e){Rm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Br[t]=Br[e]})});function Bd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Br.hasOwnProperty(e)&&Br[e]?(""+t).trim():t+"px"}function Hd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Bd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Tm=ye({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 ks(e,t){if(t){if(Tm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(R(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(R(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(R(61))}if(t.style!=null&&typeof t.style!="object")throw Error(R(62))}}function Es(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 Cs=null;function xa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ns=null,sr=null,ar=null;function Gu(e){if(e=wl(e)){if(typeof Ns!="function")throw Error(R(280));var t=e.stateNode;t&&(t=ei(t),Ns(e.stateNode,e.type,t))}}function Wd(e){sr?ar?ar.push(e):ar=[e]:sr=e}function Vd(){if(sr){var e=sr,t=ar;if(ar=sr=null,Gu(e),t)for(e=0;e>>=0,e===0?32:31-(Um(e)/bm|0)|0}var Vl=64,Kl=4194304;function Ur(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 jo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var s=i&~l;s!==0?r=Ur(s):(o&=i,o!==0&&(r=Ur(o)))}else i=n&~l,i!==0?r=Ur(i):o!==0&&(r=Ur(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 vl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function Vm(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=Wr),lc=" ",oc=!1;function ff(e,t){switch(e){case"keyup":return wg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jn=!1;function xg(e,t){switch(e){case"compositionend":return pf(t);case"keypress":return t.which!==32?null:(oc=!0,lc);case"textInput":return e=t.data,e===lc&&oc?null:e;default:return null}}function kg(e,t){if(Jn)return e==="compositionend"||!Ta&&ff(e,t)?(e=cf(),co=_a=rn=null,Jn=!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=uc(n)}}function vf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yf(){for(var e=window,t=Eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Eo(e.document)}return t}function La(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 Pg(e){var t=yf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vf(n.ownerDocument.documentElement,n)){if(r!==null&&La(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=cc(n,o);var i=cc(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,Xn=null,Ps=null,Kr=null,$s=!1;function dc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$s||Xn==null||Xn!==Eo(r)||(r=Xn,"selectionStart"in r&&La(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}),Kr&&ll(Kr,r)||(Kr=r,r=Lo(Ps,"onSelect"),0er||(e.current=Fs[er],Fs[er]=null,er--)}function ue(e,t){er++,Fs[er]=e.current,e.current=t}var mn={},Ue=vn(mn),qe=vn(!1),Pn=mn;function pr(e,t){var n=e.type.contextTypes;if(!n)return mn;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 Ze(e){return e=e.childContextTypes,e!=null}function $o(){fe(qe),fe(Ue)}function yc(e,t,n){if(Ue.current!==mn)throw Error(R(168));ue(Ue,t),ue(qe,n)}function jf(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(R(108,_m(e)||"Unknown",l));return ye({},n,r)}function Io(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mn,Pn=Ue.current,ue(Ue,e),ue(qe,qe.current),!0}function wc(e,t,n){var r=e.stateNode;if(!r)throw Error(R(169));n?(e=jf(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,fe(qe),fe(Ue),ue(Ue,e)):fe(qe),ue(qe,n)}var Dt=null,ti=!1,Gi=!1;function Rf(e){Dt===null?Dt=[e]:Dt.push(e)}function Hg(e){ti=!0,Rf(e)}function yn(){if(!Gi&&Dt!==null){Gi=!0;var e=0,t=oe;try{var n=Dt;for(oe=1;e>=i,l-=i,Ot=1<<32-Et(t)+l|n<A?(V=I,I=null):V=I.sibling;var F=w(v,I,m[A],C);if(F===null){I===null&&(I=V);break}e&&I&&F.alternate===null&&t(v,I),h=o(F,h,A),$===null?T=F:$.sibling=F,$=F,I=V}if(A===m.length)return n(v,I),pe&&Cn(v,A),T;if(I===null){for(;AA?(V=I,I=null):V=I.sibling;var X=w(v,I,F.value,C);if(X===null){I===null&&(I=V);break}e&&I&&X.alternate===null&&t(v,I),h=o(X,h,A),$===null?T=X:$.sibling=X,$=X,I=V}if(F.done)return n(v,I),pe&&Cn(v,A),T;if(I===null){for(;!F.done;A++,F=m.next())F=y(v,F.value,C),F!==null&&(h=o(F,h,A),$===null?T=F:$.sibling=F,$=F);return pe&&Cn(v,A),T}for(I=r(v,I);!F.done;A++,F=m.next())F=k(I,v,A,F.value,C),F!==null&&(e&&F.alternate!==null&&I.delete(F.key===null?A:F.key),h=o(F,h,A),$===null?T=F:$.sibling=F,$=F);return e&&I.forEach(function(te){return t(v,te)}),pe&&Cn(v,A),T}function j(v,h,m,C){if(typeof m=="object"&&m!==null&&m.type===Gn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Bl:e:{for(var T=m.key,$=h;$!==null;){if($.key===T){if(T=m.type,T===Gn){if($.tag===7){n(v,$.sibling),h=l($,m.props.children),h.return=v,v=h;break e}}else if($.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Zt&&kc(T)===$.type){n(v,$.sibling),h=l($,m.props),h.ref=Ir(v,$,m),h.return=v,v=h;break e}n(v,$);break}else t(v,$);$=$.sibling}m.type===Gn?(h=Ln(m.props.children,v.mode,C,m.key),h.return=v,v=h):(C=wo(m.type,m.key,m.props,null,v.mode,C),C.ref=Ir(v,h,m),C.return=v,v=C)}return i(v);case Yn:e:{for($=m.key;h!==null;){if(h.key===$)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(v,h.sibling),h=l(h,m.children||[]),h.return=v,v=h;break e}else{n(v,h);break}else t(v,h);h=h.sibling}h=rs(m,v.mode,C),h.return=v,v=h}return i(v);case Zt:return $=m._init,j(v,h,$(m._payload),C)}if(zr(m))return E(v,h,m,C);if(Rr(m))return N(v,h,m,C);Zl(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(v,h.sibling),h=l(h,m),h.return=v,v=h):(n(v,h),h=ns(m,v.mode,C),h.return=v,v=h),i(v)):n(v,h)}return j}var mr=$f(!0),If=$f(!1),Do=vn(null),Oo=null,rr=null,Ma=null;function Aa(){Ma=rr=Oo=null}function Da(e){var t=Do.current;fe(Do),e._currentValue=t}function bs(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 cr(e,t){Oo=e,Ma=rr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xe=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(Ma!==e)if(e={context:e,memoizedValue:t,next:null},rr===null){if(Oo===null)throw Error(R(308));rr=e,Oo.dependencies={lanes:0,firstContext:e}}else rr=rr.next=e;return t}var jn=null;function Oa(e){jn===null?jn=[e]:jn.push(e)}function Mf(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Oa(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ht(e,r)}function Ht(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 en=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Af(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 zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function cn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ht(e,n)}return l=r.interleaved,l===null?(t.next=t,Oa(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ht(e,n)}function po(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,Ea(e,n)}}function Ec(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 Fo(e,t,n,r){var l=e.updateQueue;en=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var a=s,c=a.next;a.next=null,i===null?o=c:i.next=c,i=a;var g=e.alternate;g!==null&&(g=g.updateQueue,s=g.lastBaseUpdate,s!==i&&(s===null?g.firstBaseUpdate=c:s.next=c,g.lastBaseUpdate=a))}if(o!==null){var y=l.baseState;i=0,g=c=a=null,s=o;do{var w=s.lane,k=s.eventTime;if((r&w)===w){g!==null&&(g=g.next={eventTime:k,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var E=e,N=s;switch(w=t,k=n,N.tag){case 1:if(E=N.payload,typeof E=="function"){y=E.call(k,y,w);break e}y=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=N.payload,w=typeof E=="function"?E.call(k,y,w):E,w==null)break e;y=ye({},y,w);break e;case 2:en=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,w=l.effects,w===null?l.effects=[s]:w.push(s))}else k={eventTime:k,lane:w,tag:s.tag,payload:s.payload,callback:s.callback,next:null},g===null?(c=g=k,a=y):g=g.next=k,i|=w;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;w=s,s=w.next,w.next=null,l.lastBaseUpdate=w,l.shared.pending=null}}while(!0);if(g===null&&(a=y),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=g,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);Mn|=i,e.lanes=i,e.memoizedState=y}}function Cc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Xi.transition;Xi.transition={};try{e(!1),t()}finally{oe=n,Xi.transition=r}}function qf(){return mt().memoizedState}function Qg(e,t,n){var r=fn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Zf(e))ep(t,n);else if(n=Mf(e,t,n,r),n!==null){var l=Ke();Ct(n,e,r,l),tp(n,t,r)}}function Yg(e,t,n){var r=fn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Zf(e))ep(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,n);if(l.hasEagerState=!0,l.eagerState=s,Nt(s,i)){var a=t.interleaved;a===null?(l.next=l,Oa(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Mf(e,t,l,r),n!==null&&(l=Ke(),Ct(n,e,r,l),tp(n,t,r))}}function Zf(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function ep(e,t){Qr=Uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ea(e,n)}}var bo={readContext:ht,useCallback:Oe,useContext:Oe,useEffect:Oe,useImperativeHandle:Oe,useInsertionEffect:Oe,useLayoutEffect:Oe,useMemo:Oe,useReducer:Oe,useRef:Oe,useState:Oe,useDebugValue:Oe,useDeferredValue:Oe,useTransition:Oe,useMutableSource:Oe,useSyncExternalStore:Oe,useId:Oe,unstable_isNewReconciler:!1},Gg={readContext:ht,useCallback:function(e,t){return Tt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:_c,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mo(4194308,4,Qf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mo(4194308,4,e,t)},useInsertionEffect:function(e,t){return mo(4,2,e,t)},useMemo:function(e,t){var n=Tt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Tt();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=Qg.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=Tt();return e={current:e},t.memoizedState=e},useState:Nc,useDebugValue:Ka,useDeferredValue:function(e){return Tt().memoizedState=e},useTransition:function(){var e=Nc(!1),t=e[0];return e=Kg.bind(null,e[1]),Tt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ge,l=Tt();if(pe){if(n===void 0)throw Error(R(407));n=n()}else{if(n=t(),Le===null)throw Error(R(349));In&30||zf(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,_c(bf.bind(null,r,o,e),[e]),r.flags|=2048,fl(9,Uf.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Tt(),t=Le.identifierPrefix;if(pe){var n=Ft,r=Ot;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=cl++,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[Lt]=t,e[sl]=r,dp(e,t,!1,!1),t.stateNode=e;e:{switch(i=Es(n,r),n){case"dialog":de("cancel",e),de("close",e),l=r;break;case"iframe":case"object":case"embed":de("load",e),l=r;break;case"video":case"audio":for(l=0;lyr&&(t.flags|=128,r=!0,Mr(o,!1),t.lanes=4194304)}else{if(!r)if(e=zo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Mr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!pe)return Fe(t),null}else 2*ke()-o.renderingStartTime>yr&&n!==1073741824&&(t.flags|=128,r=!0,Mr(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=ke(),t.sibling=null,n=me.current,ue(me,r?n&1|2:n&1),t):(Fe(t),null);case 22:case 23:return qa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?rt&1073741824&&(Fe(t),t.subtreeFlags&6&&(t.flags|=8192)):Fe(t),null;case 24:return null;case 25:return null}throw Error(R(156,t.tag))}function rv(e,t){switch($a(t),t.tag){case 1:return Ze(t.type)&&$o(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gr(),fe(qe),fe(Ue),ba(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ua(t),null;case 13:if(fe(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));hr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(me),null;case 4:return gr(),null;case 10:return Da(t.type._context),null;case 22:case 23:return qa(),null;case 24:return null;default:return null}}var to=!1,ze=!1,lv=typeof WeakSet=="function"?WeakSet:Set,D=null;function lr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Se(e,t,r)}else n.current=null}function Js(e,t,n){try{n()}catch(r){Se(e,t,r)}}var Oc=!1;function ov(e,t){if(Is=Ro,e=yf(),La(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,s=-1,a=-1,c=0,g=0,y=e,w=null;t:for(;;){for(var k;y!==n||l!==0&&y.nodeType!==3||(s=i+l),y!==o||r!==0&&y.nodeType!==3||(a=i+r),y.nodeType===3&&(i+=y.nodeValue.length),(k=y.firstChild)!==null;)w=y,y=k;for(;;){if(y===e)break t;if(w===n&&++c===l&&(s=i),w===o&&++g===r&&(a=i),(k=y.nextSibling)!==null)break;y=w,w=y.parentNode}y=k}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ms={focusedElem:e,selectionRange:n},Ro=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var N=E.memoizedProps,j=E.memoizedState,v=t.stateNode,h=v.getSnapshotBeforeUpdate(t.elementType===t.type?N:St(t.type,N),j);v.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(R(163))}}catch(C){Se(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return E=Oc,Oc=!1,E}function Yr(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&&Js(t,n,o)}l=l.next}while(l!==r)}}function li(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 Xs(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 hp(e){var t=e.alternate;t!==null&&(e.alternate=null,hp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Lt],delete t[sl],delete t[Os],delete t[bg],delete t[Bg])),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 mp(e){return e.tag===5||e.tag===3||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mp(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 qs(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=Po));else if(r!==4&&(e=e.child,e!==null))for(qs(e,t,n),e=e.sibling;e!==null;)qs(e,t,n),e=e.sibling}function Zs(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(Zs(e,t,n),e=e.sibling;e!==null;)Zs(e,t,n),e=e.sibling}var $e=null,xt=!1;function qt(e,t,n){for(n=n.child;n!==null;)gp(e,t,n),n=n.sibling}function gp(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(Jo,n)}catch{}switch(n.tag){case 5:ze||lr(n,t);case 6:var r=$e,l=xt;$e=null,qt(e,t,n),$e=r,xt=l,$e!==null&&(xt?(e=$e,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):$e.removeChild(n.stateNode));break;case 18:$e!==null&&(xt?(e=$e,n=n.stateNode,e.nodeType===8?Yi(e.parentNode,n):e.nodeType===1&&Yi(e,n),nl(e)):Yi($e,n.stateNode));break;case 4:r=$e,l=xt,$e=n.stateNode.containerInfo,xt=!0,qt(e,t,n),$e=r,xt=l;break;case 0:case 11:case 14:case 15:if(!ze&&(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)&&Js(n,t,i),l=l.next}while(l!==r)}qt(e,t,n);break;case 1:if(!ze&&(lr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Se(n,t,s)}qt(e,t,n);break;case 21:qt(e,t,n);break;case 22:n.mode&1?(ze=(r=ze)||n.memoizedState!==null,qt(e,t,n),ze=r):qt(e,t,n);break;default:qt(e,t,n)}}function zc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lv),t.forEach(function(r){var l=hv.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function wt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sv(r/1960))-r,10e?16:e,ln===null)var r=!1;else{if(e=ln,ln=null,Wo=0,ee&6)throw Error(R(331));var l=ee;for(ee|=4,D=e.current;D!==null;){var o=D,i=o.child;if(D.flags&16){var s=o.deletions;if(s!==null){for(var a=0;ake()-Ja?Tn(e,0):Ga|=n),et(e,t)}function Cp(e,t){t===0&&(e.mode&1?(t=Kl,Kl<<=1,!(Kl&130023424)&&(Kl=4194304)):t=1);var n=Ke();e=Ht(e,t),e!==null&&(vl(e,t,n),et(e,n))}function pv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cp(e,n)}function hv(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(R(314))}r!==null&&r.delete(t),Cp(e,n)}var Np;Np=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||qe.current)Xe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xe=!1,tv(e,t,n);Xe=!!(e.flags&131072)}else Xe=!1,pe&&t.flags&1048576&&Tf(t,Ao,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;go(e,t),e=t.pendingProps;var l=pr(t,Ue.current);cr(t,n),l=Ha(null,t,r,e,l,n);var o=Wa();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,Ze(r)?(o=!0,Io(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Fa(t),l.updater=ri,t.stateNode=l,l._reactInternals=t,Hs(t,r,e,n),t=Ks(null,t,r,!0,o,n)):(t.tag=0,pe&&o&&Pa(t),Ve(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(go(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=gv(r),e=St(r,e),l){case 0:t=Vs(null,t,r,e,n);break e;case 1:t=Mc(null,t,r,e,n);break e;case 11:t=$c(null,t,r,e,n);break e;case 14:t=Ic(null,t,r,St(r.type,e),n);break e}throw Error(R(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),Vs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),Mc(e,t,r,l,n);case 3:e:{if(ap(t),e===null)throw Error(R(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Af(e,t),Fo(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=vr(Error(R(423)),t),t=Ac(e,t,r,n,l);break e}else if(r!==l){l=vr(Error(R(424)),t),t=Ac(e,t,r,n,l);break e}else for(lt=un(t.stateNode.containerInfo.firstChild),ot=t,pe=!0,kt=null,n=If(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(hr(),r===l){t=Wt(e,t,n);break e}Ve(e,t,r,n)}t=t.child}return t;case 5:return Df(t),e===null&&Us(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,As(r,l)?i=null:o!==null&&As(r,o)&&(t.flags|=32),sp(e,t),Ve(e,t,i,n),t.child;case 6:return e===null&&Us(t),null;case 13:return up(e,t,n);case 4:return za(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mr(t,null,r,n):Ve(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),$c(e,t,r,l,n);case 7:return Ve(e,t,t.pendingProps,n),t.child;case 8:return Ve(e,t,t.pendingProps.children,n),t.child;case 12:return Ve(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,ue(Do,r._currentValue),r._currentValue=i,o!==null)if(Nt(o.value,i)){if(o.children===l.children&&!qe.current){t=Wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){i=o.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=zt(-1,n&-n),a.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var g=c.pending;g===null?a.next=a:(a.next=g.next,g.next=a),c.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),bs(o.return,n,t),s.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(R(341));i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),bs(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}Ve(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,cr(t,n),l=ht(l),r=r(l),t.flags|=1,Ve(e,t,r,n),t.child;case 14:return r=t.type,l=St(r,t.pendingProps),l=St(r.type,l),Ic(e,t,r,l,n);case 15:return op(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:St(r,l),go(e,t),t.tag=1,Ze(r)?(e=!0,Io(t)):e=!1,cr(t,n),np(t,r,l),Hs(t,r,l,n),Ks(null,t,r,!0,e,n);case 19:return cp(e,t,n);case 22:return ip(e,t,n)}throw Error(R(156,t.tag))};function _p(e,t){return qd(e,t)}function mv(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 ft(e,t,n,r){return new mv(e,t,n,r)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gv(e){if(typeof e=="function")return eu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===wa)return 11;if(e===Sa)return 14}return 2}function pn(e,t){var n=e.alternate;return n===null?(n=ft(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 wo(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")eu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Gn:return Ln(n.children,l,o,t);case ya:i=8,l|=8;break;case ps:return e=ft(12,n,t,l|2),e.elementType=ps,e.lanes=o,e;case hs:return e=ft(13,n,t,l),e.elementType=hs,e.lanes=o,e;case ms:return e=ft(19,n,t,l),e.elementType=ms,e.lanes=o,e;case Ad:return ii(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Id:i=10;break e;case Md:i=9;break e;case wa:i=11;break e;case Sa:i=14;break e;case Zt:i=16,r=null;break e}throw Error(R(130,e==null?e:typeof e,""))}return t=ft(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Ln(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function ii(e,t,n,r){return e=ft(22,e,r,t),e.elementType=Ad,e.lanes=n,e.stateNode={isHidden:!1},e}function ns(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function rs(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vv(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=Oi(0),this.expirationTimes=Oi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oi(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function tu(e,t,n,r,l,o,i,s,a){return e=new vv(e,t,n,s,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ft(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fa(o),e}function yv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Lp)}catch(e){console.error(e)}}Lp(),Td.exports=st;var Pp=Td.exports,$p,Qc=Pp;$p=Qc.createRoot,Qc.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 Yc="popstate";function Ev(e={}){function t(l,o){let{pathname:i="/",search:s="",hash:a=""}=Fn(l.location.hash.substring(1));return!i.startsWith("/")&&!i.startsWith(".")&&(i="/"+i),la("",{pathname:i,search:s,hash:a},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(l,o){let i=l.document.querySelector("base"),s="";if(i&&i.getAttribute("href")){let a=l.location.href,c=a.indexOf("#");s=c===-1?a:a.slice(0,c)}return s+"#"+(typeof o=="string"?o:hl(o))}function r(l,o){_t(l.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(o)})`)}return Nv(t,n,r,e)}function ve(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _t(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Cv(){return Math.random().toString(36).substring(2,10)}function Gc(e,t){return{usr:e.state,key:e.key,idx:t}}function la(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Fn(t):t,state:n,key:t&&t.key||r||Cv()}}function hl({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 Fn(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 Nv(e,t,n,r={}){let{window:l=document.defaultView,v5Compat:o=!1}=r,i=l.history,s="POP",a=null,c=g();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function g(){return(i.state||{idx:null}).idx}function y(){s="POP";let j=g(),v=j==null?null:j-c;c=j,a&&a({action:s,location:N.location,delta:v})}function w(j,v){s="PUSH";let h=la(N.location,j,v);n&&n(h,j),c=g()+1;let m=Gc(h,c),C=N.createHref(h);try{i.pushState(m,"",C)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;l.location.assign(C)}o&&a&&a({action:s,location:N.location,delta:1})}function k(j,v){s="REPLACE";let h=la(N.location,j,v);n&&n(h,j),c=g();let m=Gc(h,c),C=N.createHref(h);i.replaceState(m,"",C),o&&a&&a({action:s,location:N.location,delta:0})}function E(j){return _v(j)}let N={get action(){return s},get location(){return e(l,i)},listen(j){if(a)throw new Error("A history only accepts one active listener");return l.addEventListener(Yc,y),a=j,()=>{l.removeEventListener(Yc,y),a=null}},createHref(j){return t(l,j)},createURL:E,encodeLocation(j){let v=E(j);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:w,replace:k,go(j){return i.go(j)}};return N}function _v(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ve(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:hl(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Ip(e,t,n="/"){return jv(e,t,n,!1)}function jv(e,t,n,r){let l=typeof t=="string"?Fn(t):t,o=Vt(l.pathname||"/",n);if(o==null)return null;let i=Mp(e);Rv(i);let s=null;for(let a=0;s==null&&a{let g={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&a)return;ve(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let y=Ut([r,g.relativePath]),w=n.concat(g);i.children&&i.children.length>0&&(ve(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),Mp(i.children,t,w,y,a)),!(i.path==null&&!i.index)&&t.push({path:y,score:Av(y,i.index),routesMeta:w})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let c of Ap(i.path))o(i,s,!0,c)}),t}function Ap(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=Ap(r.join("/")),s=[];return s.push(...i.map(a=>a===""?o:[o,a].join("/"))),l&&s.push(...i),s.map(a=>e.startsWith("/")&&a===""?"/":a)}function Rv(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Dv(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Tv=/^:[\w-]+$/,Lv=3,Pv=2,$v=1,Iv=10,Mv=-2,Jc=e=>e==="*";function Av(e,t){let n=e.split("/"),r=n.length;return n.some(Jc)&&(r+=Mv),t&&(r+=Pv),n.filter(l=>!Jc(l)).reduce((l,o)=>l+(Tv.test(o)?Lv:o===""?$v:Iv),r)}function Dv(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 Ov(e,t,n=!1){let{routesMeta:r}=e,l={},o="/",i=[];for(let s=0;s{if(g==="*"){let E=s[w]||"";i=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const k=s[w];return y&&!k?c[g]=void 0:c[g]=(k||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:i,pattern:e}}function Fv(e,t=!1,n=!0){_t(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,a)=>(r.push({paramName:s,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function zv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return _t(!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 Vt(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 Uv(e,t="/"){let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Fn(e):e;return{pathname:n?n.startsWith("/")?n:bv(n,t):t,search:Wv(r),hash:Vv(l)}}function bv(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 ls(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 Bv(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Dp(e){let t=Bv(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Op(e,t,n,r=!1){let l;typeof e=="string"?l=Fn(e):(l={...e},ve(!l.pathname||!l.pathname.includes("?"),ls("?","pathname","search",l)),ve(!l.pathname||!l.pathname.includes("#"),ls("#","pathname","hash",l)),ve(!l.search||!l.search.includes("#"),ls("#","search","hash",l)));let o=e===""||l.pathname==="",i=o?"/":l.pathname,s;if(i==null)s=n;else{let y=t.length-1;if(!r&&i.startsWith("..")){let w=i.split("/");for(;w[0]==="..";)w.shift(),y-=1;l.pathname=w.join("/")}s=y>=0?t[y]:"/"}let a=Uv(l,s),c=i&&i!=="/"&&i.endsWith("/"),g=(o||i===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||g)&&(a.pathname+="/"),a}var Ut=e=>e.join("/").replace(/\/\/+/g,"/"),Hv=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Wv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vv=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Kv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Fp=["POST","PUT","PATCH","DELETE"];new Set(Fp);var Qv=["GET",...Fp];new Set(Qv);var kr=f.createContext(null);kr.displayName="DataRouter";var di=f.createContext(null);di.displayName="DataRouterState";f.createContext(!1);var zp=f.createContext({isTransitioning:!1});zp.displayName="ViewTransition";var Yv=f.createContext(new Map);Yv.displayName="Fetchers";var Gv=f.createContext(null);Gv.displayName="Await";var It=f.createContext(null);It.displayName="Navigation";var xl=f.createContext(null);xl.displayName="Location";var Qt=f.createContext({outlet:null,matches:[],isDataRoute:!1});Qt.displayName="Route";var ou=f.createContext(null);ou.displayName="RouteError";function Jv(e,{relative:t}={}){ve(kl(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=f.useContext(It),{hash:l,pathname:o,search:i}=El(e,{relative:t}),s=o;return n!=="/"&&(s=o==="/"?n:Ut([n,o])),r.createHref({pathname:s,search:i,hash:l})}function kl(){return f.useContext(xl)!=null}function zn(){return ve(kl(),"useLocation() may be used only in the context of a component."),f.useContext(xl).location}var Up="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bp(e){f.useContext(It).static||f.useLayoutEffect(e)}function Xv(){let{isDataRoute:e}=f.useContext(Qt);return e?cy():qv()}function qv(){ve(kl(),"useNavigate() may be used only in the context of a component.");let e=f.useContext(kr),{basename:t,navigator:n}=f.useContext(It),{matches:r}=f.useContext(Qt),{pathname:l}=zn(),o=JSON.stringify(Dp(r)),i=f.useRef(!1);return bp(()=>{i.current=!0}),f.useCallback((a,c={})=>{if(_t(i.current,Up),!i.current)return;if(typeof a=="number"){n.go(a);return}let g=Op(a,JSON.parse(o),l,c.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ut([t,g.pathname])),(c.replace?n.replace:n.push)(g,c.state,c)},[t,n,o,l,e])}f.createContext(null);function El(e,{relative:t}={}){let{matches:n}=f.useContext(Qt),{pathname:r}=zn(),l=JSON.stringify(Dp(n));return f.useMemo(()=>Op(e,JSON.parse(l),r,t==="path"),[e,l,r,t])}function Zv(e,t){return Bp(e,t)}function Bp(e,t,n,r,l){var h;ve(kl(),"useRoutes() may be used only in the context of a component.");let{navigator:o}=f.useContext(It),{matches:i}=f.useContext(Qt),s=i[i.length-1],a=s?s.params:{},c=s?s.pathname:"/",g=s?s.pathnameBase:"/",y=s&&s.route;{let m=y&&y.path||"";Hp(c,!y||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${c}" (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 w=zn(),k;if(t){let m=typeof t=="string"?Fn(t):t;ve(g==="/"||((h=m.pathname)==null?void 0:h.startsWith(g)),`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 "${g}" but pathname "${m.pathname}" was given in the \`location\` prop.`),k=m}else k=w;let E=k.pathname||"/",N=E;if(g!=="/"){let m=g.replace(/^\//,"").split("/");N="/"+E.replace(/^\//,"").split("/").slice(m.length).join("/")}let j=Ip(e,{pathname:N});_t(y||j!=null,`No routes matched location "${k.pathname}${k.search}${k.hash}" `),_t(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${k.pathname}${k.search}${k.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 v=ly(j&&j.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:Ut([g,o.encodeLocation?o.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?g:Ut([g,o.encodeLocation?o.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),i,n,r,l);return t&&v?f.createElement(xl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...k},navigationType:"POP"}},v):v}function ey(){let e=uy(),t=Kv(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=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:o},"ErrorBoundary")," or"," ",f.createElement("code",{style:o},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:l},n):null,i)}var ty=f.createElement(ey,null),ny=class extends f.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?f.createElement(Qt.Provider,{value:this.props.routeContext},f.createElement(ou.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function ry({routeContext:e,match:t,children:n}){let r=f.useContext(kr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(Qt.Provider,{value:e},n)}function ly(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 c=o.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);ve(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,c+1))}let s=!1,a=-1;if(n)for(let c=0;c=0?o=o.slice(0,a+1):o=[o[0]];break}}}return o.reduceRight((c,g,y)=>{let w,k=!1,E=null,N=null;n&&(w=i&&g.route.id?i[g.route.id]:void 0,E=g.route.errorElement||ty,s&&(a<0&&y===0?(Hp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):a===y&&(k=!0,N=g.route.hydrateFallbackElement||null)));let j=t.concat(o.slice(0,y+1)),v=()=>{let h;return w?h=E:k?h=N:g.route.Component?h=f.createElement(g.route.Component,null):g.route.element?h=g.route.element:h=c,f.createElement(ry,{match:g,routeContext:{outlet:c,matches:j,isDataRoute:n!=null},children:h})};return n&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(ny,{location:n.location,revalidation:n.revalidation,component:E,error:w,children:v(),routeContext:{outlet:null,matches:j,isDataRoute:!0},unstable_onError:r}):v()},null)}function iu(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oy(e){let t=f.useContext(kr);return ve(t,iu(e)),t}function iy(e){let t=f.useContext(di);return ve(t,iu(e)),t}function sy(e){let t=f.useContext(Qt);return ve(t,iu(e)),t}function su(e){let t=sy(e),n=t.matches[t.matches.length-1];return ve(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ay(){return su("useRouteId")}function uy(){var r;let e=f.useContext(ou),t=iy("useRouteError"),n=su("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function cy(){let{router:e}=oy("useNavigate"),t=su("useNavigate"),n=f.useRef(!1);return bp(()=>{n.current=!0}),f.useCallback(async(l,o={})=>{_t(n.current,Up),n.current&&(typeof l=="number"?e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var Xc={};function Hp(e,t,n){!t&&!Xc[e]&&(Xc[e]=!0,_t(!1,n))}f.memo(dy);function dy({routes:e,future:t,state:n,unstable_onError:r}){return Bp(e,void 0,n,r,t)}function Wp(e){ve(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function fy({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:l,static:o=!1}){ve(!kl(),"You cannot render a inside another . You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),s=f.useMemo(()=>({basename:i,navigator:l,static:o,future:{}}),[i,l,o]);typeof n=="string"&&(n=Fn(n));let{pathname:a="/",search:c="",hash:g="",state:y=null,key:w="default"}=n,k=f.useMemo(()=>{let E=Vt(a,i);return E==null?null:{location:{pathname:E,search:c,hash:g,state:y,key:w},navigationType:r}},[i,a,c,g,y,w,r]);return _t(k!=null,` is not able to match the URL "${a}${c}${g}" because it does not start with the basename, so the won't render anything.`),k==null?null:f.createElement(It.Provider,{value:s},f.createElement(xl.Provider,{children:t,value:k}))}function py({children:e,location:t}){return Zv(oa(e),t)}function oa(e,t=[]){let n=[];return f.Children.forEach(e,(r,l)=>{if(!f.isValidElement(r))return;let o=[...t,l];if(r.type===f.Fragment){n.push.apply(n,oa(r.props.children,o));return}ve(r.type===Wp,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),ve(!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=oa(r.props.children,o)),n.push(i)}),n}var So="get",xo="application/x-www-form-urlencoded";function fi(e){return e!=null&&typeof e.tagName=="string"}function hy(e){return fi(e)&&e.tagName.toLowerCase()==="button"}function my(e){return fi(e)&&e.tagName.toLowerCase()==="form"}function gy(e){return fi(e)&&e.tagName.toLowerCase()==="input"}function vy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yy(e,t){return e.button===0&&(!t||t==="_self")&&!vy(e)}var lo=null;function wy(){if(lo===null)try{new FormData(document.createElement("form"),0),lo=!1}catch{lo=!0}return lo}var Sy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function os(e){return e!=null&&!Sy.has(e)?(_t(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${xo}"`),null):e}function xy(e,t){let n,r,l,o,i;if(my(e)){let s=e.getAttribute("action");r=s?Vt(s,t):null,n=e.getAttribute("method")||So,l=os(e.getAttribute("enctype"))||xo,o=new FormData(e)}else if(hy(e)||gy(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a
`,E=`
${w}
`;return`
${k}${E}
`}),i=i.replace(/
\s*(?=
]*>[\s\S]*?<\/div>)\s*
/g,"$1"),i}function $0(e){const t=e.split(/\r?\n/);let n=null;for(let r=0;r[\s\S]*?<\/think(?:ing)?>/gi,"").replace(/[*#]/g,"").replace(/\s+/g," ").trim()}function th(e){if(!e)return{think:null,answer:""};const t=//i,n=/<\/think(?:ing)?>/i,r=e.match(t);if(!r)return{think:null,answer:e};const l=r.index,o=r[0].length,i=e.substring(0,l).trim();let s=e.substring(l+o);const a=s.match(n);let c=null,g=i;return a?(c=s.substring(0,a.index).trim(),g+=s.substring(a.index+a[0].length)):c=s.trim(),{think:c||null,answer:g.trim()}}function M0({content:e,streamOutput:t,sources:n}){const{think:r,answer:l}=th(e||""),[o,i]=We.useState(!1),s=!!r;return d.jsxs("div",{className:"assistant-message",children:[s&&d.jsxs("div",{className:"assistant-thoughts",children:[d.jsxs("button",{className:"think-toggle",onClick:()=>i(a=>!a),"aria-expanded":o?"true":"false","aria-controls":"think-content",children:[d.jsx("span",{className:"think-toggle-icon","aria-hidden":"true",children:o?"▾":"▸"}),"Thoughts"]}),o&&d.jsx("div",{id:"think-content",className:"think-content",dangerouslySetInnerHTML:{__html:dd(r)}})]}),d.jsx("div",{className:"msg-content",dangerouslySetInnerHTML:{__html:dd(l||e||"")}}),Array.isArray(n)&&n.length>0&&d.jsx("div",{className:"msg-sources chips",children:n.map((a,c)=>{let g=a,y=!1;try{const w=new URL(a);if(w.protocol==="file:"){y=!0;const k=w.pathname.split("/").filter(Boolean);g=decodeURIComponent(k[k.length-1]||a)}else g=(w.hostname||a).replace(/^www\./i,"")}catch{}return d.jsx("a",{className:"chip",href:a,target:"_blank",rel:"noreferrer",title:a,onClick:w=>{var k,E;if(y){w.preventDefault();try{const N=new URL(a);(E=(k=window.electronAPI)==null?void 0:k.openPath)==null||E.call(k,decodeURIComponent(N.pathname))}catch{}}},children:g},a+c)})})]})}function us({attachments:e,className:t="",removable:n=!1,onRemove:r}){return!Array.isArray(e)||e.length===0?null:d.jsx("div",{className:`image-attachment-strip ${t}`.trim(),children:e.map((l,o)=>{const i=l==null?void 0:l.data_url;if(!i)return null;const s=l.id||`${l.name||"image"}-${o}-${i.length}`;return d.jsxs("div",{className:"image-attachment-card",children:[n&&d.jsx("button",{type:"button",className:"image-attachment-remove",onClick:()=>r==null?void 0:r(l.id),"aria-label":`Remove ${l.name||"image"}`,title:"Remove image",children:"×"}),d.jsx("img",{className:"image-attachment-thumb",src:i,alt:l.name||`Attachment ${o+1}`,loading:"lazy"})]},s)})})}const fd="websearch.searxUrl",pd="websearch.engines",hd="chat.libraryBySession",md="http://127.0.0.1:8888",cs=6,ds=20*1024*1024,A0=5*60*1e3,D0=200;let nh="http://127.0.0.1:8000";const O0=48,F0=24;function z0(e){return e.backendApiUrl||e.ollamaApiUrl||nh}function U0(e){const t=typeof e=="string"?e.trim():"";return!t||t==="http://localhost:8888"?md:t}function io(e){var n;return Array.from(((n=e==null?void 0:e.dataTransfer)==null?void 0:n.types)||[]).includes("Files")}function ca(e){return e?typeof e.type=="string"&&e.type.toLowerCase().startsWith("image/")?!0:/\.(png|jpe?g|gif|bmp|webp|tiff?|heic|avif)$/i.test(e.name||""):!1}function gd(e){var r,l;const t=Array.from(((r=e==null?void 0:e.dataTransfer)==null?void 0:r.items)||[]);return t.length>0?t.some(o=>{var i;return o.kind==="file"&&ca((i=o.getAsFile)==null?void 0:i.call(o))}):Array.from(((l=e==null?void 0:e.dataTransfer)==null?void 0:l.files)||[]).some(ca)}function vd(e){return new Promise((t,n)=>{const r=new FileReader;r.onerror=()=>n(r.error||new Error(`Failed to read ${(e==null?void 0:e.name)||"image"}`)),r.onload=()=>t(String(r.result||"")),r.readAsDataURL(e)})}function b0(e,t){const n=String(t||"").trim();if(!n)return e||"";const r=String(e||"");if(!r.trim())return n;const l=/[\s\n]$/.test(r)?"":` -`;return`${r}${l}${n}`}function B0(e){const t=Math.max(0,Math.floor(Number(e||0)/1e3)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function H0(){var Fu;const[e,t]=f.useState([]),[n,r]=f.useState(null),[l,o]=f.useState("chats"),[i,s]=f.useState("General"),[a,c]=f.useState(null),[g,y]=f.useState(null),[w,k]=f.useState([]),[E,N]=f.useState([]),[j,v]=f.useState(null),[h,m]=f.useState(()=>{try{const u=localStorage.getItem(hd);return u?JSON.parse(u):{}}catch{return{}}}),[C,T]=f.useState(!1),[$,I]=f.useState(""),[A,V]=f.useState(""),[F,X]=f.useState(!1),[te,be]=f.useState(""),[Re,P]=f.useState(!1),[b,q]=f.useState(""),[L,B]=f.useState([]),[U,ne]=f.useState(!1),re=f.useRef(null),Ge=f.useRef(null),ut=f.useRef(null),Yt=f.useRef(null),Pe=f.useRef(0),[gt,Cl]=f.useState(!1),[hi,Nl]=f.useState(""),[xe,mi]=f.useState(!1),[tt,_l]=f.useState(!1),[z,H]=f.useState(0),ie=f.useRef(null),we=f.useRef(null),Un=f.useRef([]),gi=f.useRef(null),jl=f.useRef(""),Rl=f.useRef(null),Tl=f.useRef(null),vi=f.useRef(0),Ll=f.useRef(null),[Q,du]=f.useState(nh),[fu,rh]=f.useState("Default"),[Pl,pu]=f.useState(!1),[hu,Er]=f.useState(""),[lh,yi]=f.useState(!1),[Cr,oh]=f.useState(()=>U0(localStorage.getItem(fd))),[wn,ih]=f.useState(()=>L0(localStorage.getItem(pd)));f.useEffect(()=>{localStorage.setItem(fd,Cr||"")},[Cr]),f.useEffect(()=>{try{localStorage.setItem(pd,JSON.stringify(Yo(wn)))}catch{}},[wn]);const[$l,sh]=f.useState(!1),[vt,wi]=f.useState(!1),[mu,Si]=f.useState(!0),[ah,bn]=f.useState([]),[Il,gu]=f.useState({}),[vu,uh]=f.useState(!1),yu=f.useRef(!1),[ch,xi]=f.useState(null),[ki,Ml]=f.useState("");function dh(u){const p=u.content||"";if(u.role==="assistant")try{const{answer:S}=th(p);return(S||p).trim()}catch{return p.trim()}return p}async function wu(u){try{await navigator.clipboard.writeText(dh(u))}catch(p){console.error("Failed to copy message:",p)}}function Sn(u,p,S,x={}){const{removeIfEmpty:_=!1}=x;t(M=>M.map(O=>{if(O.session_id!==u)return O;const W=[];for(const Z of O.messages||[]){if(Z.id!==p){W.push(Z);continue}_&&!S||W.push({...Z,content:S})}return{...O,messages:W}}))}function jt(u){return(u==null?void 0:u.name)==="AbortError"}function Gt(u){return u instanceof Error&&u.message?u.message:String(u)}async function Nr(u){const p=await u.json().catch(()=>null);if(u.ok)return p;const S=typeof(p==null?void 0:p.detail)=="string"?p.detail:typeof(p==null?void 0:p.message)=="string"?p.message:"";throw new Error(S||`HTTP ${u.status}`)}async function fh(u,p){const S=await fetch(`${Q}/models/capabilities?name=${encodeURIComponent(u)}`,{signal:p});return Nr(S)}async function ph(){const u=await fetch(`${Q}/ollama/startup-status`);return Nr(u)}async function hh(){const u=await fetch(`${Q}/startup/prepare-models`,{method:"POST"});return Nr(u)}async function Su(u,p,S){if(!u)return{contextBlock:null,sources:[]};const _=await(await fetch(`${Q}/libraries/${u}/context`,{method:"POST",headers:{"Content-Type":"application/json"},signal:S,body:JSON.stringify({prompt:p,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:[]}}async function xu(u){const p=Array.from(u||[]).filter(ca);if(!p.length||!Re)return;const S=Math.max(0,cs-L.length);if(S<=0){window.alert(`You can attach up to ${cs} images per message.`);return}const x=p.slice(0,S),_=x.filter(O=>Number(O.size)>ds),M=x.filter(O=>Number(O.size)<=ds);if(_.length>0&&window.alert(`Images must be ${Math.round(ds/(1024*1024))} MB or smaller.`),!!M.length)try{const O=await Promise.all(M.map(async(W,Z)=>({id:`attachment-${Date.now()}-${Z}-${Math.random().toString(36).slice(2)}`,name:W.name||"image",mime_type:W.type||"image/*",data_url:await vd(W)})));B(W=>[...W,...O]),p.length>S&&window.alert(`Only the first ${cs} images can be attached.`)}catch(O){console.error("Failed to load image attachments",O),window.alert(`Image import failed: ${Gt(O)}`)}}function mh(u){B(p=>p.filter(S=>S.id!==u))}function gh(){var u;Re&&((u=Yt.current)==null||u.click())}function Ei(){Rl.current&&(window.clearInterval(Rl.current),Rl.current=null),Tl.current&&(window.clearTimeout(Tl.current),Tl.current=null)}function Ci(u=we.current){Ei(),sa(u),we.current===u&&(we.current=null),ie.current=null}async function vh(u,p){if(!Q)throw new Error("The Heimgeist backend is not configured.");const S=new AbortController;Ll.current=S,_l(!0);try{const x=await vd(u),_=x.indexOf(",");if(_<=5)throw new Error("Recorded audio could not be encoded for upload.");const M=x.slice(0,_),O=x.slice(_+1);if(!/^data:[^,]+;base64$/i.test(M)||!O)throw new Error("Recorded audio could not be encoded for upload.");const W=M.slice(5).replace(/;base64$/i,"").trim(),Z=await fetch(`${Q}/audio/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},signal:S.signal,body:JSON.stringify({mime_type:p||W||"audio/webm",audio_base64:O})}),se=await Nr(Z),le=String((se==null?void 0:se.text)||"").trim();if(!le){window.alert("No speech was detected. Try again and speak closer to the selected microphone.");return}q(he=>b0(he,le)),requestAnimationFrame(()=>{var he;return(he=Ge.current)==null?void 0:he.focus()})}catch(x){if(jt(x))return;throw x}finally{Ll.current===S&&(Ll.current=null),_l(!1)}}async function Al(u={}){const{shouldTranscribe:p=!0}=u,S=ie.current,x=gi.current,_=jl.current||(S==null?void 0:S.mimeType)||"audio/webm";if(!(!S||!x)){mi(!1),Ei();try{S.state!=="inactive"&&S.stop();const M=await x;if(!p)return;if(!M||M.size<=0)throw new Error("Recorded audio was empty.");await vh(M,_)}catch(M){p&&(console.error("Failed to stop microphone recording",M),window.alert(`Microphone transcription failed: ${Gt(M)}`))}finally{gi.current=null,Un.current=[],jl.current="",vi.current=0,H(0)}}}async function yh(){if(!gt||xe||tt||vt)return;if(!pi()){window.alert("Microphone capture is not available in this environment.");return}let u=null;try{u=await navigator.mediaDevices.getUserMedia(d0(hi))}catch(x){console.error("Failed to access microphone",x),window.alert(`Microphone access failed: ${Gt(x)}`);return}const p=p0();let S=null;try{S=p?new MediaRecorder(u,{mimeType:p}):new MediaRecorder(u)}catch(x){Ci(u),console.error("Failed to create audio recorder",x),window.alert(`Microphone recording is not available: ${Gt(x)}`);return}we.current=u,ie.current=S,Un.current=[],jl.current=S.mimeType||p||"audio/webm",vi.current=Date.now(),H(0),mi(!0),S.ondataavailable=x=>{x.data&&x.data.size>0&&Un.current.push(x.data)},gi.current=new Promise((x,_)=>{S.onstop=()=>{const M=new Blob(Un.current,{type:S.mimeType||jl.current||"audio/webm"});Ci(u),x(M)},S.onerror=M=>{Ci(u),_((M==null?void 0:M.error)||new Error("Audio recording failed."))}}),Rl.current=window.setInterval(()=>{H(Date.now()-vi.current)},D0),Tl.current=window.setTimeout(()=>{Al()},A0),S.start()}async function wh(){if(!tt){if(xe){await Al();return}await yh()}}async function Sh(u){var S;const p=(S=u.target)==null?void 0:S.files;try{await xu(p)}finally{u.target&&(u.target.value="")}}function xh(u,p){xi(u),Ml(p||"")}function Dl(){xi(null),Ml("")}async function kh(u){var M;const p=(((M=Vn[u])==null?void 0:M.content)||"").trim(),x=(ki??"").trim();if(x.length===0){Dl();return}if(x===p){Dl();return}const _=n;if(_){t(O=>O.map(W=>{if(W.session_id!==_)return W;const se=(W.messages||[]).slice(0,u+1).map((le,he)=>he===u?{...le,content:x}:le);return{...W,messages:se}})),xi(null),Ml(""),requestAnimationFrame(()=>Li("auto",_));try{const O=await fetch(`${Q}/sessions/${_}/messages/${u}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:x})});if(!O.ok)throw new Error(`HTTP ${O.status}`)}catch(O){console.error("Failed to update message:",O),t(W=>W.map(Z=>{if(Z.session_id!==_)return Z;const le=(Z.messages||[]).map((he,De)=>De===u?{...he,content:p}:he);return{...Z,messages:le}}));return}await ku(u,x)}}async function ku(u,p=null){var se,le,he,De,En,Y;const S=n;if(vt||!S||typeof u!="number")return;const x=((se=e.find(J=>J.session_id===S))==null?void 0:se.messages)||[];let _=u;for(let J=u;J>=0;J--)if(((le=x[J])==null?void 0:le.role)==="user"){_=J;break}t(J=>J.map(ce=>ce.session_id===S?{...ce,messages:(ce.messages||[]).slice(0,_+1)}:ce));const M=Ru(S);let O=p??(((he=x[_])==null?void 0:he.content)||""),W=[];const Z=[];try{const J=$u(S),ce=p??(((De=x[_])==null?void 0:De.content)||""),Ne=!!(ce||"").trim();if(Ne&&((En=J==null?void 0:J.states)!=null&&En.is_indexed))try{const K=await Su(J.slug,ce,M.signal);K.contextBlock&&Z.push(K.contextBlock),Array.isArray(K.sources)&&W.push(...K.sources)}catch(K){if(jt(K))throw K;console.warn("local library enrichment (regenerate) failed",K)}if(Ne&&$l)try{const K=x.slice(Math.max(0,_-7),_+1).map(Ee=>({role:Ee.role,content:Ee.content||""}));K.length>0&&(K[K.length-1]={role:"user",content:ce});const ae=await(await fetch(`${Q}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({prompt:ce,model:te,messages:K,history_limit:8,searx_url:Cr||null,engines:Array.isArray(wn)?wn:null})})).json();ae&&typeof ae.context_block=="string"&&ae.context_block.trim()&&Z.push(ae.context_block.trim()),Array.isArray(ae==null?void 0:ae.sources)&&W.push(...ae.sources)}catch(K){if(jt(K))throw K;console.warn("web search enrichment (regenerate) failed",K)}if(W=[...new Set(W)],Ne&&Z.length>0?O=`${ce} - -${Z.join(` - -`)}`:O=null,Pl){const K=`msg-${Date.now()}-${Math.random()}`;let nt="";t(ae=>ae.map(Ee=>Ee.session_id===S?{...Ee,messages:[...Ee.messages||[],{id:K,role:"assistant",content:"",sources:W}]}:Ee));try{const ae=await fetch(`${Q}/sessions/${S}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({index:u,model:te,stream:!0,enriched_message:O,sources:W||[]})});if(!ae.ok)throw new Error(`HTTP ${ae.status}`);const Ee=(Y=ae.body)==null?void 0:Y.getReader();if(!Ee)throw new Error("Missing response body");const Xt=new TextDecoder;let Ul=!1;for(;;){const{value:Be,done:Gh}=await Ee.read();if(Gh)break;const Jh=Xt.decode(Be,{stream:!0});nt+=Jh,Sn(S,K,nt),!Ul&&Ae.current!==S&&(Ul=!0,xn(Pi=>({...Pi,[S]:K})),bn(Pi=>[...new Set([...Pi,S])]))}Ae.current!==S?(xn(Be=>({...Be,[S]:K})),bn(Be=>[...new Set([...Be,S])])):Bn.current[S]?Hn(Be=>({...Be,[S]:K})):requestAnimationFrame(()=>Kn(K,"smooth",S))}catch(ae){if(jt(ae)){Sn(S,K,nt,{removeIfEmpty:!0});return}console.error(ae),Sn(S,K,`Error: ${Gt(ae)}`,{removeIfEmpty:!0});return}}else{const K=await fetch(`${Q}/sessions/${S}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({index:u,model:te,stream:!1,enriched_message:O,sources:W||[]})});if(!K.ok)throw new Error(`HTTP ${K.status}`);const nt=await K.json(),ae=`msg-${Date.now()}`;t(Ee=>Ee.map(Xt=>Xt.session_id===S?{...Xt,messages:[...Xt.messages||[],{role:"assistant",content:nt.reply,id:ae,sources:W}]}:Xt)),Ae.current!==S?(xn(Ee=>({...Ee,[S]:ae})),bn(Ee=>[...new Set([...Ee,S])])):Bn.current[S]?Hn(Ee=>({...Ee,[S]:ae})):requestAnimationFrame(()=>Kn(ae,"smooth",S))}}catch(J){jt(J)||console.error(J)}finally{Ni(M)}}const[Eu,Eh]=f.useState({}),Bn=f.useRef({}),[Ch,xn]=f.useState({}),kn=f.useRef({}),Cu=f.useRef({}),[Nu,Hn]=f.useState({}),[Nh,_u]=f.useState({}),ju=(u,p,S)=>u!=null&&u.id?u.id:`${S}:${p}`;f.useEffect(()=>{var p;if(!n)return;const u=((p=e.find(S=>S.session_id===n))==null?void 0:p.messages)||[];_u(S=>{const x={};return u.forEach((_,M)=>{if(_.role!=="user")return;const O=ju(_,M,n),Z=(_.content||"").split(/\r\n|\r|\n/).length>30;x[O]=Z?S[O]??!0:!1}),x})},[e,n]);function _h(u){_u(p=>({...p,[u]:!(p[u]??!0)}))}const _r=We.useCallback((u,p)=>{Eh(S=>{const x={...S,[u]:p};return Bn.current=x,x})},[]),Wn=f.useRef(null),jh=f.useRef(!1),Rh=f.useRef(null),Ae=f.useRef(n);f.useEffect(()=>{Ae.current=n},[n]);const Ru=We.useCallback(u=>{const p=new AbortController;return Wn.current={controller:p,sessionId:u},wi(!0),p},[]),Ni=We.useCallback(u=>{var p;((p=Wn.current)==null?void 0:p.controller)===u&&(Wn.current=null,wi(!1))},[]),Th=We.useCallback(()=>{const u=Wn.current;u&&(Wn.current=null,u.controller.abort(),wi(!1))},[]);f.useEffect(()=>()=>{var u;(u=Wn.current)==null||u.controller.abort()},[]);const Jt=f.useRef(null),[Lh,Ph]=f.useState(230),[Ol,Tu]=f.useState(!1),$h=We.useCallback(u=>{Tu(!0)},[]),_i=We.useCallback(()=>{Tu(!1)},[]),ji=We.useCallback(u=>{if(Ol){const p=Math.max(230,Math.min(500,u.clientX));Ph(p)}},[Ol]);We.useEffect(()=>(window.addEventListener("mousemove",ji),window.addEventListener("mouseup",_i),()=>{window.removeEventListener("mousemove",ji),window.removeEventListener("mouseup",_i)}),[ji,_i]),We.useEffect(()=>{Ol?document.body.classList.add("no-select"):document.body.classList.remove("no-select")},[Ol]),We.useEffect(()=>{const u=async p=>{const S=p.target.closest(".codeblock__copy");if(!S)return;const x=S.closest(".codeblock"),_=x==null?void 0:x.querySelector("pre > code");if(_)try{await navigator.clipboard.writeText(_.textContent||""),S.classList.add("copied"),setTimeout(()=>S.classList.remove("copied"),800)}catch(M){console.error("Copy failed:",M)}};return document.addEventListener("click",u),()=>document.removeEventListener("click",u)},[]),f.useEffect(()=>{window.electronAPI.getSettings().then(p=>{du(z0(p)),rh(p.colorScheme||"Default"),be(p.chatModel||""),pu(p.streamOutput||!1),Cl(p.audioInputEnabled===!0),Nl(typeof p.audioInputDeviceId=="string"?p.audioInputDeviceId:""),gu(p.scrollPositions||{}),ml(p.colorScheme||"Default")}).finally(()=>{uh(!0)});const u=()=>{var p;l==="chats"&&((p=Ge.current)==null||p.focus())};return window.electronAPI.onWindowFocus(u),()=>{}},[l]),f.useEffect(()=>{let u=!1;const p=new AbortController;return!Q||!te?(P(!1),()=>{p.abort()}):((async()=>{try{const S=await fh(te,p.signal);u||P(!!(S!=null&&S.supports_vision))}catch(S){!u&&!jt(S)&&(console.warn("Failed to load model capabilities",S),P(!1))}})(),()=>{u=!0,p.abort()})},[Q,te]),f.useEffect(()=>{Pe.current=0,ne(!1)},[Re,l]),f.useEffect(()=>{gt||!xe||Al({shouldTranscribe:!1})},[gt,xe]),f.useEffect(()=>{l==="chats"||!xe||Al()},[l,xe]),f.useEffect(()=>()=>{var p;(p=Ll.current)==null||p.abort(),Ei();const u=ie.current;if(u){u.ondataavailable=null,u.onstop=null,u.onerror=null;try{u.state!=="inactive"&&u.stop()}catch{}}sa(we.current)},[]),f.useEffect(()=>{if(!vu||mu||!Q||yu.current)return;yu.current=!0;let u=!1;const p=window.setTimeout(()=>{(async()=>{let S=!1;try{let x=await ph();if(u)return;if(!(x!=null&&x.ollama_running)&&(x!=null&&x.can_manage_locally)){const O=window.confirm(`Ollama is not running at ${x.ollama_url}. Start it in the background now with "ollama serve"?`);if(u)return;if(O){S=!0,yi(!0),Er("Starting Ollama in the background...");const W=await fetch(`${Q}/ollama/start`,{method:"POST"});if(x=await Nr(W),u)return}}const _=!(x!=null&&x.whisper_model_available),M=!!(x!=null&&x.ollama_running&&(x!=null&&x.can_manage_locally)&&!(x!=null&&x.embedding_model_available));if((_||M)&&(S=!0,yi(!0),Er(_&&M?`Downloading Whisper ${(x==null?void 0:x.whisper_model)||"base"} and ${x.selected_embed_model}. This can take a while on first install.`:_?`Downloading Whisper ${(x==null?void 0:x.whisper_model)||"base"}. This can take a while on first install.`:`Downloading ${x.selected_embed_model} from Ollama. This can take a while on first install.`),await hh(),u))return}catch(x){u||(console.warn("startup Ollama check failed",x),S&&window.alert(`Startup action failed: ${Gt(x)}`))}finally{u||(yi(!1),Er(""))}})()},1200);return()=>{u=!0,window.clearTimeout(p)}},[Q,mu,vu]),f.useEffect(()=>{ml(fu)},[fu]);const Ih=u=>{!u||!Q||fetch(`${Q}/history?session_id=${encodeURIComponent(u)}`).then(p=>p.json()).then(p=>{t(S=>S.map(x=>x.session_id===u?{...x,messages:p.messages||[]}:x))}).catch(()=>{})};async function jr(){if(Q)try{const p=await(await fetch(`${Q}/libraries`)).json(),S=Array.isArray(p.libraries)?p.libraries:[];if(k(S),S.length===0){v(null);return}S.some(x=>x.slug===j)||v(S[0].slug)}catch(u){console.warn("Failed to load libraries",u)}}async function Fl(){if(Q)try{const p=await(await fetch(`${Q}/jobs`)).json();N(Array.isArray(p.jobs)?p.jobs:[])}catch(u){console.warn("Failed to load library jobs",u)}}async function Lu(u=null){const S=(typeof u=="string"?u:$).trim();if(!S){V("Name is required.");return}try{V("");const x=await fetch(`${Q}/libraries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S})});if(!x.ok){const M=await x.text();throw new Error(M||`HTTP ${x.status}`)}const _=await x.json();T(!1),I(""),await jr(),_!=null&&_.slug&&v(_.slug)}catch(x){console.error("Failed to create library",x),V(String((x==null?void 0:x.message)||x))}}async function Mh(){k([]),N([]),v(null),y(null),X(!1),m({}),await jr(),await Fl()}f.useEffect(()=>{Q&&(Si(!0),fetch(`${Q}/sessions`).then(u=>u.json()).then(u=>{const p=u.sessions.map(S=>({...S,messages:[]}));t(p),p.length>0?r(p[0].session_id):r(null),Si(!1)}).catch(()=>{Si(!1)}))},[Q]),f.useEffect(()=>{Q&&(jr(),Fl())},[Q]),f.useEffect(()=>{try{localStorage.setItem(hd,JSON.stringify(h||{}))}catch{}},[h]),f.useEffect(()=>{if(!Q)return;const u=setInterval(()=>{jr(),Fl()},3e3);return()=>clearInterval(u)},[Q,l,j]),f.useEffect(()=>{Ih(n)},[n,Q]),f.useEffect(()=>{const u=new Set(w.map(p=>p.slug));m(p=>{let S=!1;const x={};for(const[_,M]of Object.entries(p||{}))u.has(M)?x[_]=M:S=!0;return S?x:p})},[w]);const Ri=u=>{o(u)},Ah=u=>{Wh(u)},Vn=f.useMemo(()=>{var u;return((u=e.find(p=>p.session_id===n))==null?void 0:u.messages)||[]},[n,e]),zl=f.useMemo(()=>w.find(u=>u.slug===j)||null,[j,w]),Mt=n&&h[n]||null,yt=f.useMemo(()=>w.find(u=>u.slug===Mt)||null,[Mt,w]),Pu=f.useMemo(()=>Mt?E.some(u=>u.slug===Mt&&(u.status==="queued"||u.status==="running")):!1,[Mt,E]),Ti=f.useMemo(()=>{var u,p;return yt?(u=yt.files)!=null&&u.length?(p=yt.states)!=null&&p.is_indexed?"":Pu?" (syncing)":" (needs sync)":" (empty)":""},[yt,Pu]);function Dh(u){return u&&h[u]||null}function $u(u){const p=Dh(u);return p&&w.find(S=>S.slug===p)||null}function Iu(u){return u?E.some(p=>p.slug===u&&(p.status==="queued"||p.status==="running")):!1}function Mu(u,p){u&&m(S=>{const x={...S||{}};return p?x[u]=p:delete x[u],x})}function Oh(u){u&&m(p=>{let S=!1;const x={};for(const[_,M]of Object.entries(p||{})){if(M===u){S=!0;continue}x[_]=M}return S?x:p})}f.useEffect(()=>{if(!F)return;const u=p=>{var S;(S=ut.current)!=null&&S.contains(p.target)||X(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[F]),f.useEffect(()=>{X(!1)},[n,l]),f.useEffect(()=>{const u=n,p=l;return()=>{if(p==="chats"&&u){const S=typeof kn.current[u]=="number"?kn.current[u]:re.current?re.current.scrollTop:0;gu(x=>{const _={...x,[u]:S};return window.electronAPI.updateSettings({scrollPositions:_}),_})}}},[n,l]),f.useEffect(()=>{const u=re.current;if(!u)return;const p=()=>{const{scrollTop:S,scrollHeight:x,clientHeight:_}=u,M=x-S-_<=F0;if(n){const O=Cu.current[n],W=typeof O=="number"&&Su.removeEventListener("scroll",p)},[n,_r]),f.useEffect(()=>{const u=n;u&&Eu[u]===!1&&Hn(p=>{if(!(u in p))return p;const S={...p};return delete S[u],S})},[n,Eu]),f.useLayoutEffect(()=>{if(l!=="chats"||!n)return;const u=re.current;if(!u)return;Jt.current=null;const p=()=>{if(Jt.current===n)return;const O=typeof kn.current[n]=="number"?kn.current[n]:void 0,W=typeof O=="number"?O:Il[n];if(typeof W=="number"){u.scrollTop=W,Jt.current=n;return}Vn.length>0&&(u.scrollTop=u.scrollHeight,Jt.current=n)};p();const S=requestAnimationFrame(p),x=()=>{Jt.current!==n&&requestAnimationFrame(p)},_=new MutationObserver(x);_.observe(u,{childList:!0,subtree:!0});const M=new ResizeObserver(x);return M.observe(u),()=>{cancelAnimationFrame(S),_.disconnect(),M.disconnect()}},[n,l,Vn.length,Il]),f.useEffect(()=>{if(l!=="chats"||!n||Jt.current===n)return;const u=typeof kn.current[n]=="number"?kn.current[n]:void 0;typeof(typeof u=="number"?u:Il[n])!="number"&&Vn.length>0&&requestAnimationFrame(()=>{const S=re.current;S&&(S.scrollTop=S.scrollHeight,Jt.current=n)})},[Vn.length,n,l,Il]);const Li=(u="smooth",p=null)=>{const S=re.current;if(!S)return;const x=p??Ae.current;Ae.current===x&&(S.scrollTo({top:S.scrollHeight,behavior:u}),_r(x,!1))},Kn=(u,p="auto",S=null)=>{const x=re.current;if(!x)return;const _=S??Ae.current;if(Ae.current!==_)return;const M=document.getElementById(u);if(M){const O=Math.max(0,M.offsetTop-O0);x.scrollTo({top:O,behavior:p})}},Fh=()=>{const u=Ae.current,p=Nu[u];p&&(Kn(p,"smooth",u),Hn(S=>{const{[u]:x,..._}=S;return _}))},zh=u=>{l!=="chats"||!io(u)||(u.preventDefault(),Pe.current+=1,Re&&gd(u)&&ne(!0))},Uh=u=>{l!=="chats"||!io(u)||(u.preventDefault(),u.dataTransfer.dropEffect=Re?"copy":"none",Re&&gd(u)&&!U&&ne(!0))},bh=u=>{l!=="chats"||!io(u)||(Pe.current=Math.max(0,Pe.current-1),Pe.current===0&&ne(!1))},Bh=async u=>{var p,S;l!=="chats"||!io(u)||(u.preventDefault(),Pe.current=0,ne(!1),Re&&(await xu((p=u.dataTransfer)==null?void 0:p.files),(S=Ge.current)==null||S.focus()))};async function Au(){var O,W,Z;const u=b.trim();if(vt||!u&&L.length===0||!te)return;if(L.length>0&&!Re){window.alert("The selected model does not support image inputs.");return}let p=n,S=!1;if(p){const se=e.find(le=>le.session_id===p);S=se&&se.name==="New Chat"&&se.messages.length===0}else{const se=await Du();await new Promise(le=>setTimeout(le,200)),p=se.session_id,S=!0}const x=L.map(({id:se,...le})=>({...le})),_={role:"user",content:u,attachments:x,id:`msg-${Date.now()}-${Math.random()}`};jh.current=!0,Rh.current=p,_r(p,!1),Ae.current===p&&(Jt.current=Ae.current),Pp.flushSync(()=>{t(se=>se.map(le=>le.session_id===p?{...le,messages:[...le.messages||[],_]}:le)),q(""),B([])}),requestAnimationFrame(()=>Li("auto",p));const M=Ru(p);try{let se=[];if(_.content)try{se=[...(((O=e.find(ce=>ce.session_id===p))==null?void 0:O.messages)||[]).slice(-8).map(ce=>({role:ce.role,content:ce.content||""})),{role:"user",content:_.content}]}catch{}let le=_.content||null,he=[];const De=[],En=$u(p);if(_.content&&((W=En==null?void 0:En.states)!=null&&W.is_indexed))try{const Y=await Su(En.slug,_.content,M.signal);Y.contextBlock&&De.push(Y.contextBlock),Array.isArray(Y.sources)&&he.push(...Y.sources)}catch(Y){if(jt(Y))throw Y;console.warn("local library enrichment failed",Y)}if(_.content&&$l)try{const J=await(await fetch(`${Q}/websearch`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({prompt:_.content,model:te,messages:se,history_limit:8,searx_url:Cr||null,engines:Array.isArray(wn)?wn:null})})).json();J&&typeof J.context_block=="string"&&J.context_block.trim()&&De.push(J.context_block.trim()),Array.isArray(J==null?void 0:J.sources)&&he.push(...J.sources)}catch(Y){if(jt(Y))throw Y;console.warn("web search enrichment failed",Y)}if(he=[...new Set(he)],_.content&&De.length>0&&(le=`${_.content} - -${De.join(` - -`)}`),Pl){const Y=`msg-${Date.now()}-${Math.random()}`;let J="";const ce={role:"assistant",content:"",id:Y,sources:he};t(Ne=>Ne.map(K=>K.session_id===p?{...K,messages:[...K.messages||[],ce]}:K));try{const Ne=await fetch(`${Q}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({session_id:p,model:te,message:_.content,enriched_message:_.content&&De.length>0?le:null,stream:!0,sources:he||[],attachments:x})});if(!Ne.ok)throw new Error(`HTTP ${Ne.status}`);const K=(Z=Ne.body)==null?void 0:Z.getReader();if(!K)throw new Error("Missing response body");const nt=new TextDecoder;let ae=!1;for(;;){const{value:Ee,done:Xt}=await K.read();if(Xt){Sn(p,Y,J),Ae.current===p?Bn.current[p]?Hn(Be=>({...Be,[p]:Y})):requestAnimationFrame(()=>Kn(Y,"smooth",p)):(xn(Be=>({...Be,[p]:Y})),bn(Be=>[...new Set([...Be,p])]));break}const Ul=nt.decode(Ee,{stream:!0});J+=Ul,Sn(p,Y,J),Ae.current===p&&!Bn.current[p]&&Li("auto",p),Ae.current!==p&&!ae&&(xn(Be=>({...Be,[p]:Y})),ae=!0)}}catch(Ne){if(jt(Ne)){Sn(p,Y,J,{removeIfEmpty:!0});return}console.error("Failed to send message:",Ne),Sn(p,Y,"Error: "+Gt(Ne),{removeIfEmpty:!0});return}}else{const Y=await fetch(`${Q}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},signal:M.signal,body:JSON.stringify({session_id:p,model:te,message:_.content,enriched_message:_.content&&De.length>0?le:null,stream:!1,sources:he||[],attachments:x})});if(!Y.ok)throw new Error(`HTTP ${Y.status}`);const J=await Y.json(),ce=`msg-${Date.now()}`,Ne={role:"assistant",content:J.reply,id:ce,sources:he};t(K=>K.map(nt=>nt.session_id===p?{...nt,messages:[...nt.messages||[],Ne]}:nt)),ce&&(Ae.current===p?Bn.current[p]?Hn(K=>({...K,[p]:ce})):requestAnimationFrame(()=>Kn(ce,"smooth",p)):xn(K=>({...K,[p]:ce})))}Ae.current!==p&&bn(Y=>[...new Set([...Y,p])]),S&&fetch(`${Q}/generate-title`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:p,message:_.content||(x.length>0?"Image attachment":_.content),model:te})}).then(Y=>Y.json()).then(Y=>{const J=I0(Y.title);t(ce=>ce.map(Ne=>Ne.session_id===p?{...Ne,name:J}:Ne))})}catch(se){if(jt(se)){Ni(M);return}console.error("Failed to send message:",se);const le={role:"assistant",content:"Error: "+Gt(se),id:`msg-${Date.now()}-${Math.random()}`};t(he=>he.map(De=>De.session_id===p?{...De,messages:[...De.messages,le]}:De))}finally{Ni(M)}}function Hh(){sh(u=>!u)}async function Du(){var _;const u="sess-"+Math.random().toString(36).slice(2)+Date.now().toString(36),S=await(await fetch(`${Q}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:u})})).json(),x={...S,messages:[]};return t(M=>[x,...M]),r(S.session_id),(_=Ge.current)==null||_.focus(),S}function Wh(u){r(u),bn(S=>S.filter(x=>x!==u));const p=Ch[u];p&&requestAnimationFrame(()=>{let S=12;const x=()=>{if(!re.current)return;let M=document.getElementById(p);if(!M){const O=e.find(W=>W.session_id===u);if(O&&Array.isArray(O.messages))for(let W=O.messages.length-1;W>=0;W--){const Z=O.messages[W];if(Z.role==="assistant"&&Z.id){M=document.getElementById(Z.id);break}}}M?(Kn(M.id,"smooth",u),xn(O=>{const{[u]:W,...Z}=O;return Z})):S-- >0&&requestAnimationFrame(x)};requestAnimationFrame(x)})}function Vh(u,p){fetch(`${Q}/sessions/${u}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:p})}).then(()=>{t(S=>S.map(x=>x.session_id===u?{...x,name:p}:x)),c(null)})}function Kh(u,p){const S=(p||"").trim(),x=w.find(_=>_.slug===u);if(!x){y(null);return}if(!S||S===x.name){y(null);return}fetch(`${Q}/libraries/${u}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:S})}).then(()=>{k(_=>_.map(M=>M.slug===u?{...M,name:S}:M)),y(null)})}function Ou(u){fetch(`${Q}/sessions/${u}`,{method:"DELETE"}).then(()=>{const p=e.filter(S=>S.session_id!==u);t(p),m(S=>{const x={...S||{}};return delete x[u],x}),n===u&&r(p.length>0?p[0].session_id:null)})}function Qh(u){fetch(`${Q}/libraries/${u}`,{method:"DELETE"}).then(async p=>{var x;if(!p.ok){const _=await p.text();throw new Error(_||`HTTP ${p.status}`)}const S=w.filter(_=>_.slug!==u);k(S),N(_=>_.filter(M=>M.slug!==u)),y(_=>_===u?null:_),j===u&&v(((x=S[0])==null?void 0:x.slug)||null),Oh(u)}).catch(p=>{console.error("Failed to delete library",p)})}f.useEffect(()=>{const u=e.filter(p=>p.name==="New Chat"&&p.session_id!==n&&p.messages.length===0);u.length>0&&u.forEach(p=>{Ou(p.session_id)})},[n,e,Q]);const Yh=u=>{var S;window.getSelection().toString().length>0||document.activeElement!==Ge.current&&(u.target.closest(".msg")||(S=Ge.current)==null||S.focus())};return d.jsxs("div",{className:"app",style:{gridTemplateColumns:`${Lh}px 1fr`},children:[d.jsxs("div",{className:"sidebar",children:[d.jsxs("div",{className:"sidebar-header",children:[d.jsx("div",{className:`sidebar-tab ${l==="chats"?"active":""}`,onClick:()=>Ri("chats"),children:"Chats"}),d.jsx("div",{className:`sidebar-tab ${l==="dbs"?"active":""}`,onClick:()=>Ri("dbs"),children:"DBs"}),d.jsx("div",{className:`sidebar-tab ${l==="settings"?"active":""}`,onClick:()=>Ri("settings"),children:"Settings"})]}),d.jsxs("div",{className:"sidebar-content",children:[l==="chats"&&d.jsx("div",{className:"chat-list",children:e.map(u=>d.jsx("div",{className:`chat-item ${u.session_id===n?"active":""}`,onClick:()=>Ah(u.session_id),children:a===u.session_id?d.jsx("input",{type:"text",className:"rename-input",defaultValue:u.name,onBlur:()=>c(null),onKeyDown:p=>{p.key==="Enter"?Vh(u.session_id,p.target.value):p.key==="Escape"&&c(null)},autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.name}),d.jsxs("div",{className:"chat-item-buttons",children:[ah.includes(u.session_id)&&d.jsx("div",{className:"unread-dot"}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),c(u.session_id)},children:d.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:d.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),Ou(u.session_id)},children:d.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:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},u.session_id))}),l==="dbs"&&d.jsx("div",{className:"db-list",children:w.length===0?d.jsx("div",{className:"empty-list-message",children:"No databases yet."}):w.map(u=>d.jsx("div",{className:`chat-item ${u.slug===j?"active":""}`,onClick:()=>v(u.slug),children:g===u.slug?d.jsx("input",{type:"text",className:"rename-input",defaultValue:u.name,onBlur:()=>y(null),onKeyDown:p=>{p.key==="Enter"?Kh(u.slug,p.target.value):p.key==="Escape"&&y(null)},autoFocus:!0}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.name}),d.jsxs("div",{className:"chat-item-buttons",children:[Mt===u.slug&&d.jsx("div",{className:"db-active-badge",children:"Chat"}),Iu(u.slug)&&d.jsx("div",{className:"db-active-badge",children:"Syncing"}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),y(u.slug)},children:d.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:d.jsx("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),d.jsx("button",{className:"icon-button",onClick:p=>{p.stopPropagation(),Qh(u.slug)},children:d.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:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})},u.slug))}),l==="settings"&&d.jsxs("div",{className:"settings-list",children:[d.jsx("div",{className:`settings-item ${i==="General"?"active":""}`,onClick:()=>s("General"),children:"General"}),d.jsx("div",{className:`settings-item ${i==="Interface"?"active":""}`,onClick:()=>s("Interface"),children:"Interface"}),d.jsx("div",{className:`settings-item ${i==="Websearch"?"active":""}`,onClick:()=>s("Websearch"),children:"Websearch"})]})]}),l!=="settings"&&d.jsxs("div",{className:"sidebar-footer",children:[l==="chats"&&d.jsx("button",{className:"button new-chat-button",onClick:Du,children:"New Chat"}),l==="dbs"&&(C?d.jsxs("div",{className:"new-db-form",children:[d.jsx("input",{type:"text",className:"rename-input",value:$,onChange:u=>I(u.target.value),onKeyDown:u=>{u.key==="Enter"?Lu():u.key==="Escape"&&(T(!1),I(""),V(""))},placeholder:"Database name",autoFocus:!0}),A&&d.jsx("div",{className:"form-error",children:A}),d.jsxs("div",{className:"new-db-actions",children:[d.jsx("button",{className:"button new-db-button",onClick:()=>Lu(),children:"Create"}),d.jsx("button",{className:"button ghost",onClick:()=>{T(!1),I(""),V("")},children:"Cancel"})]})]}):d.jsx("button",{className:"button new-db-button",onClick:()=>{T(!0),V("")},children:"New Database"}))]}),d.jsx("div",{className:"resizer",onMouseDown:$h})]}),d.jsxs("div",{className:`main-content${l==="chats"&&U?" main-content--drag-active":""}`,onDragEnter:zh,onDragOver:Uh,onDragLeave:bh,onDrop:Bh,children:[hu&&d.jsxs("div",{className:"startup-task-banner",role:"status","aria-live":"polite",children:[lh&&d.jsx("div",{className:"spinner startup-task-banner__spinner"}),d.jsx("div",{className:"startup-task-banner__text",children:hu})]}),l==="chats"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"header",children:[d.jsxs("strong",{children:["Chat - ",((Fu=e.find(u=>u.session_id===n))==null?void 0:Fu.name)||"New Chat"]}),yt&&d.jsx("span",{className:"header-subtle",children:`DB: ${yt.name}${Ti}`})]}),d.jsx("div",{className:`chat${U?" chat--drag-active":""}`,ref:re,onClick:Yh,children:Vn.map((u,p)=>{const S=u.role==="user"&&ch===p;return d.jsx("div",{id:u.id,className:"msg "+(u.role==="user"?"user":"assistant")+(S?" editing":""),children:u.role==="assistant"?d.jsxs("div",{className:"assistant-message-wrapper",children:[d.jsx(M0,{content:u.content,streamOutput:Pl,sources:u.sources}),!vt&&d.jsxs("div",{className:"message-options-bar assistant-options",children:[d.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>wu(u),children:d.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:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),d.jsx("button",{className:"icon-button",title:"Regenerate response",onClick:()=>ku(p),children:d.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:d.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"})})})]})]}):d.jsxs("div",{className:"user-message-wrapper",children:[S?d.jsxs(d.Fragment,{children:[d.jsx(us,{attachments:u.attachments,className:"message-attachment-strip"}),d.jsxs("div",{className:"msg-content msg-content--user editing",children:[d.jsx("div",{className:"user-edit-shadow","aria-hidden":"true",children:ki}),d.jsx(ld,{className:"edit-message-input edit-overlay",value:ki,onChange:x=>Ml(x.target.value),onBlur:Dl,onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),Dl()),x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),kh(p))},autoFocus:!0,minRows:1})]})]}):(()=>{const x=u.content||"",_=Array.isArray(u.attachments)?u.attachments:[],M=x.split(/\r\n|\r|\n/),O=M.length>30,W=ju(u,p,n),Z=O?Nh[W]??!0:!1,se=Z?M.slice(0,30).join(` -`)+` -…`:x,le=!!x.trim();return d.jsxs(d.Fragment,{children:[d.jsx(us,{attachments:_,className:"message-attachment-strip"}),le&&d.jsx("div",{className:"msg-content msg-content--user",children:se}),le&&O&&d.jsx("button",{className:"user-msg-expand",onClick:()=>_h(W),"aria-expanded":Z?"false":"true",children:Z?"Show entire message":"Collapse"})]})})(),!vt&&!S&&d.jsxs("div",{className:"message-options-bar user-options",children:[d.jsx("button",{className:"icon-button",title:"Edit message",onClick:()=>xh(p,u.content),children:d.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:[d.jsx("path",{d:"M12 20h9"}),d.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),d.jsx("button",{className:"icon-button",title:"Copy message",onClick:()=>wu(u),children:d.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:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})},u.id||p)})},n),Nu[n]&&d.jsxs("button",{className:"new-msg-tip",onClick:Fh,title:"Jump to the new message","aria-label":"Jump to the new message",children:["New message",d.jsx("span",{style:{marginLeft:6},children:"↓"})]}),d.jsx("div",{className:"footer",children:d.jsxs("div",{className:`footer-inner${U?" footer-inner--drag-active":""}`,children:[d.jsx("input",{ref:Yt,type:"file",accept:"image/*",multiple:!0,className:"composer-image-input",onChange:Sh,tabIndex:-1}),d.jsx(us,{attachments:L,className:"composer-attachment-strip",removable:!0,onRemove:mh}),(xe||tt)&&d.jsxs("div",{className:"composer-audio-status"+(xe?" composer-audio-status--recording":" composer-audio-status--transcribing"),role:"status","aria-live":"polite",children:[xe?d.jsx("span",{className:"composer-audio-status__dot","aria-hidden":"true"}):d.jsx("div",{className:"spinner composer-audio-status__spinner","aria-hidden":"true"}),d.jsx("span",{children:xe?`Listening ${B0(z)}`:"Transcribing audio…"})]}),d.jsxs("div",{className:"footer-content-wrapper",children:[d.jsx(ld,{ref:Ge,className:"input",value:b,onChange:u=>q(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!u.shiftKey&&!xe&&!tt&&(u.preventDefault(),Au())},placeholder:"Ask any question...",maxRows:13}),d.jsxs("div",{className:"footer-tool-group",ref:ut,children:[d.jsx("button",{type:"button",className:"db-picker-toggle"+(yt?" active":""),onClick:()=>{n&&X(u=>!u)},title:yt?`Database: ${yt.name}${Ti}`:"Select database for this chat","aria-haspopup":"menu","aria-expanded":F,disabled:!n,children:d.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:[d.jsx("ellipse",{cx:"12",cy:"5",rx:"8",ry:"3"}),d.jsx("path",{d:"M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"}),d.jsx("path",{d:"M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"})]})}),F&&d.jsxs("div",{className:"db-picker-menu",role:"menu",children:[d.jsxs("button",{type:"button",className:"db-picker-option"+(Mt?"":" selected"),onClick:()=>{Mu(n,null),X(!1)},children:[d.jsx("span",{children:"No database"}),!Mt&&d.jsx("span",{className:"db-picker-status",children:"Selected"})]}),w.length===0?d.jsx("div",{className:"db-picker-empty",children:"No databases yet."}):w.map(u=>{var _,M,O;const p=Mt===u.slug,S=Iu(u.slug),x=(_=u.files)!=null&&_.length?(M=u.states)!=null&&M.is_indexed?"Ready":S?"Syncing":"Needs sync":"Empty";return d.jsxs("button",{type:"button",className:"db-picker-option"+(p?" selected":""),disabled:!((O=u.files)!=null&&O.length),onClick:()=>{Mu(n,u.slug),X(!1)},children:[d.jsx("span",{children:u.name}),d.jsx("span",{className:"db-picker-status",children:p?"Selected":x})]},u.slug)})]})]}),Re&&d.jsx("button",{type:"button",className:"image-attach-toggle"+(L.length>0?" active":""),onClick:gh,title:"Attach images","aria-label":"Attach images",children:d.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:[d.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),d.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),d.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),gt&&d.jsx("button",{type:"button",className:"audio-input-toggle"+(xe||tt?" active":"")+(xe?" recording":"")+(tt?" transcribing":""),onClick:wh,title:xe?"Stop voice input":tt?"Transcribing audio":"Start voice input","aria-label":xe?"Stop voice input":tt?"Transcribing audio":"Start voice input","aria-pressed":xe,disabled:tt||vt,children:tt?d.jsx("div",{className:"spinner composer-audio-icon-spinner","aria-hidden":"true"}):d.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:[d.jsx("path",{d:"M12 3a3 3 0 0 1 3 3v6a3 3 0 0 1-6 0V6a3 3 0 0 1 3-3z"}),d.jsx("path",{d:"M19 10a7 7 0 0 1-14 0"}),d.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),d.jsx("line",{x1:"8",y1:"22",x2:"16",y2:"22"})]})}),d.jsx("button",{type:"button",className:"websearch-toggle"+($l?" active":""),onClick:Hh,title:"Toggle web search","aria-pressed":$l,children:d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),d.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"})]})}),d.jsx("button",{className:"button",onClick:vt?Th:Au,title:vt?"Cancel generation":"Send","aria-label":vt?"Cancel generation":"Send",disabled:!vt&&(xe||tt),children:vt?d.jsx("div",{className:"spinner"}):"Send"})]})]})})]}),l==="dbs"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"header",children:[d.jsx("strong",{children:(zl==null?void 0:zl.name)||"Databases"}),yt&&d.jsx("span",{className:"header-subtle",children:`Current chat DB: ${yt.name}${Ti}`})]}),d.jsx(j0,{apiBase:Q,library:zl,jobs:E,onRefresh:async()=>{await jr(),await Fl()}})]}),l==="settings"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"header",children:d.jsxs("strong",{children:[i," Settings"]})}),i==="General"&&d.jsx(S0,{onModelChange:be,onBackendApiUrlChange:du,streamOutput:Pl,onStreamOutputChange:pu,onAudioInputEnabledChange:Cl,onAudioInputDeviceChange:Nl,onLibrariesPurged:Mh}),i==="Interface"&&d.jsx(N0,{}),i==="Websearch"&&d.jsx(P0,{searxUrl:Cr,setSearxUrl:oh,engines:wn,setEngines:u=>ih(Yo(u))})]})]})]})}function W0(){return f.useEffect(()=>{window.electronAPI.getSettings().then(e=>{ml(e.colorScheme||"Default")})},[]),d.jsx(We.StrictMode,{children:d.jsx(Dy,{children:d.jsx(py,{children:d.jsx(Wp,{path:"/",element:d.jsx(H0,{})})})})})}const V0=$p(document.getElementById("root"));V0.render(d.jsx(W0,{})); diff --git a/dist/index.html b/dist/index.html index 88e1a06..09436a4 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ LLM Desktop - + diff --git a/src/App.jsx b/src/App.jsx index d16a700..5dbca6c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -296,6 +296,8 @@ export default function App() { const [audioInputEnabled, setAudioInputEnabled] = useState(false) const [audioInputDeviceId, setAudioInputDeviceId] = useState('') const [audioInputLanguage, setAudioInputLanguage] = useState('') + const [audioInputRuntimeReady, setAudioInputRuntimeReady] = useState(true) + const [audioInputRuntimeMessage, setAudioInputRuntimeMessage] = useState('') const [isRecordingAudio, setIsRecordingAudio] = useState(false) const [isTranscribingAudio, setIsTranscribingAudio] = useState(false) const [audioRecordingMs, setAudioRecordingMs] = useState(0)