var Ep=Object.defineProperty;var _p=(c,s,i)=>s in c?Ep(c,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[s]=i;var Be=(c,s,i)=>_p(c,typeof s!="symbol"?s+"":s,i);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const h of f)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function i(f){const h={};return f.integrity&&(h.integrity=f.integrity),f.referrerPolicy&&(h.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?h.credentials="include":f.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function u(f){if(f.ep)return;f.ep=!0;const h=i(f);fetch(f.href,h)}})();function Tp(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var Qs={exports:{}},jl={},Gs={exports:{}},_e={};/** * @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 Bc;function Cp(){if(Bc)return _e;Bc=1;var c=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),E=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),M=Symbol.iterator;function I(v){return v===null||typeof v!="object"?null:(v=M&&v[M]||v["@@iterator"],typeof v=="function"?v:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F=Object.assign,U={};function Q(v,R,H){this.props=v,this.context=R,this.refs=U,this.updater=H||D}Q.prototype.isReactComponent={},Q.prototype.setState=function(v,R){if(typeof v!="object"&&typeof v!="function"&&v!=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,v,R,"setState")},Q.prototype.forceUpdate=function(v){this.updater.enqueueForceUpdate(this,v,"forceUpdate")};function ye(){}ye.prototype=Q.prototype;function ve(v,R,H){this.props=v,this.context=R,this.refs=U,this.updater=H||D}var Se=ve.prototype=new ye;Se.constructor=ve,F(Se,Q.prototype),Se.isPureReactComponent=!0;var ie=Array.isArray,Ee=Object.prototype.hasOwnProperty,fe={current:null},re={key:!0,ref:!0,__self:!0,__source:!0};function ue(v,R,H){var te,G={},de=null,K=null;if(R!=null)for(te in R.ref!==void 0&&(K=R.ref),R.key!==void 0&&(de=""+R.key),R)Ee.call(R,te)&&!re.hasOwnProperty(te)&&(G[te]=R[te]);var oe=arguments.length-2;if(oe===1)G.children=H;else if(1>>1,R=N[v];if(0>>1;vf(G,z))def(K,G)?(N[v]=K,N[de]=z,v=de):(N[v]=G,N[te]=z,v=te);else if(def(K,z))N[v]=K,N[de]=z,v=de;else break e}}return L}function f(N,L){var z=N.sortIndex-L.sortIndex;return z!==0?z:N.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;c.unstable_now=function(){return h.now()}}else{var m=Date,y=m.now();c.unstable_now=function(){return m.now()-y}}var k=[],E=[],T=1,M=null,I=3,D=!1,F=!1,U=!1,Q=typeof setTimeout=="function"?setTimeout:null,ye=typeof clearTimeout=="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Se(N){for(var L=i(E);L!==null;){if(L.callback===null)u(E);else if(L.startTime<=N)u(E),L.sortIndex=L.expirationTime,s(k,L);else break;L=i(E)}}function ie(N){if(U=!1,Se(N),!F)if(i(k)!==null)F=!0,Pe(Ee);else{var L=i(E);L!==null&&je(ie,L.startTime-N)}}function Ee(N,L){F=!1,U&&(U=!1,ye(ue),ue=-1),D=!0;var z=I;try{for(Se(L),M=i(k);M!==null&&(!(M.expirationTime>L)||N&&!ce());){var v=M.callback;if(typeof v=="function"){M.callback=null,I=M.priorityLevel;var R=v(M.expirationTime<=L);L=c.unstable_now(),typeof R=="function"?M.callback=R:M===i(k)&&u(k),Se(L)}else u(k);M=i(k)}if(M!==null)var H=!0;else{var te=i(E);te!==null&&je(ie,te.startTime-L),H=!1}return H}finally{M=null,I=z,D=!1}}var fe=!1,re=null,ue=-1,$e=5,qe=-1;function ce(){return!(c.unstable_now()-qe<$e)}function Fe(){if(re!==null){var N=c.unstable_now();qe=N;var L=!0;try{L=re(!0,N)}finally{L?Le():(fe=!1,re=null)}}else fe=!1}var Le;if(typeof ve=="function")Le=function(){ve(Fe)};else if(typeof MessageChannel<"u"){var De=new MessageChannel,He=De.port2;De.port1.onmessage=Fe,Le=function(){He.postMessage(null)}}else Le=function(){Q(Fe,0)};function Pe(N){re=N,fe||(fe=!0,Le())}function je(N,L){ue=Q(function(){N(c.unstable_now())},L)}c.unstable_IdlePriority=5,c.unstable_ImmediatePriority=1,c.unstable_LowPriority=4,c.unstable_NormalPriority=3,c.unstable_Profiling=null,c.unstable_UserBlockingPriority=2,c.unstable_cancelCallback=function(N){N.callback=null},c.unstable_continueExecution=function(){F||D||(F=!0,Pe(Ee))},c.unstable_forceFrameRate=function(N){0>N||125v?(N.sortIndex=z,s(E,N),i(k)===null&&N===i(E)&&(U?(ye(ue),ue=-1):U=!0,je(ie,z-v))):(N.sortIndex=R,s(k,N),F||D||(F=!0,Pe(Ee))),N},c.unstable_shouldYield=ce,c.unstable_wrapCallback=function(N){var L=I;return function(){var z=I;I=L;try{return N.apply(this,arguments)}finally{I=z}}}}(Xs)),Xs}var Gc;function Mp(){return Gc||(Gc=1,Ks.exports=Lp()),Ks.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 Yc;function Ap(){if(Yc)return Pt;Yc=1;var c=ua(),s=Mp();function i(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"),k=Object.prototype.hasOwnProperty,E=/^[: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]*$/,T={},M={};function I(e){return k.call(M,e)?!0:k.call(T,e)?!1:E.test(e)?M[e]=!0:(T[e]=!0,!1)}function D(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 F(e,t,n,r){if(t===null||typeof t>"u"||D(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 U(e,t,n,r,l,o,a){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=a}var Q={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Q[e]=new U(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Q[t]=new U(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Q[e]=new U(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Q[e]=new U(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){Q[e]=new U(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Q[e]=new U(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Q[e]=new U(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Q[e]=new U(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Q[e]=new U(e,5,!1,e.toLowerCase(),null,!1,!1)});var ye=/[\-:]([a-z])/g;function ve(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(ye,ve);Q[t]=new U(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(ye,ve);Q[t]=new U(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(ye,ve);Q[t]=new U(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Q[e]=new U(e,1,!1,e.toLowerCase(),null,!1,!1)}),Q.xlinkHref=new U("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Q[e]=new U(e,1,!1,e.toLowerCase(),null,!0,!0)});function Se(e,t,n,r){var l=Q.hasOwnProperty(t)?Q[t]:null;(l!==null?l.type!==0:r||!(2d||l[a]!==o[d]){var g=` `+l[a].replace(" at new "," at ");return e.displayName&&g.includes("")&&(g=g.replace("",e.displayName)),g}while(1<=a&&0<=d);break}}}finally{H=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?R(e):""}function G(e){switch(e.tag){case 5:return R(e.type);case 16:return R("Lazy");case 13:return R("Suspense");case 19:return R("SuspenseList");case 0:case 2:case 15:return e=te(e.type,!1),e;case 11:return e=te(e.type.render,!1),e;case 1:return e=te(e.type,!0),e;default:return""}}function de(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 re:return"Fragment";case fe:return"Portal";case $e:return"Profiler";case ue:return"StrictMode";case Le:return"Suspense";case De:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ce:return(e.displayName||"Context")+".Consumer";case qe:return(e._context.displayName||"Context")+".Provider";case Fe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case He:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case Pe:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}function K(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 de(t);case 8:return t===ue?"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 oe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ke(e){var t=Te(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(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ht(e){e._valueTracker||(e._valueTracker=Ke(e))}function A(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Te(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function W(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 q(e,t){var n=t.checked;return z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function me(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=oe(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 Ue(e,t){t=t.checked,t!=null&&Se(e,"checked",t,!1)}function le(e,t){Ue(e,t);var n=oe(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")?ge(e,t.type,n):t.hasOwnProperty("defaultValue")&&ge(e,t.type,oe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function he(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 ge(e,t,n){(t!=="number"||W(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var xe=Array.isArray;function Re(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ct.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nn={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},Er=["Webkit","ms","Moz","O"];Object.keys(Nn).forEach(function(e){Er.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nn[t]=Nn[e]})});function tr(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Nn.hasOwnProperty(e)&&Nn[e]?(""+t).trim():t+"px"}function $t(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=tr(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Rn=z({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 nr(e,t){if(t){if(Rn[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function rr(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 Xr=null;function Ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mn=null,An=null,Ft=null;function Gl(e){if(e=yl(e)){if(typeof Mn!="function")throw Error(i(280));var t=e.stateNode;t&&(t=vo(t),Mn(e.stateNode,e.type,t))}}function Yl(e){An?Ft?Ft.push(e):Ft=[e]:An=e}function tt(){if(An){var e=An,t=Ft;if(Ft=An=null,Gl(e),t)for(e=0;e>>=0,e===0?32:31-($f(e)/Ff|0)|0}var Zl=64,ql=4194304;function el(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 eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var d=a&~l;d!==0?r=el(d):(o&=a,o!==0&&(r=el(o)))}else a=n&~l,a!==0?r=el(a):o!==0&&(r=el(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function tl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-en(t),e[t]=n}function Wf(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=ul),Oa=" ",Da=!1;function za(e,t){switch(e){case"keyup":return yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ba(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Lr=!1;function wd(e,t){switch(e){case"compositionend":return ba(t);case"keypress":return t.which!==32?null:(Da=!0,Oa);case"textInput":return e=t.data,e===Oa&&Da?null:e;default:return null}}function kd(e,t){if(Lr)return e==="compositionend"||!Ci&&za(e,t)?(e=La(),oo=wi=$n=null,Lr=!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=Va(n)}}function Ga(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ga(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ya(){for(var e=window,t=W();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=W(e.document)}return t}function Li(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 Md(e){var t=Ya(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ga(n.ownerDocument.documentElement,n)){if(r!==null&&Li(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=Qa(n,o);var a=Qa(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.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,Mr=null,Mi=null,pl=null,Ai=!1;function Ka(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ai||Mr==null||Mr!==W(r)||(r=Mr,"selectionStart"in r&&Li(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}),pl&&dl(pl,r)||(pl=r,r=ho(Mi,"onSelect"),0Or||(e.current=Hi[Or],Hi[Or]=null,Or--)}function Ve(e,t){Or++,Hi[Or]=e.current,e.current=t}var Hn={},gt=Bn(Hn),Nt=Bn(!1),cr=Hn;function Dr(e,t){var n=e.type.contextTypes;if(!n)return Hn;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 Rt(e){return e=e.childContextTypes,e!=null}function yo(){Ye(Nt),Ye(gt)}function cu(e,t,n){if(gt.current!==Hn)throw Error(i(168));Ve(gt,t),Ve(Nt,n)}function fu(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(i(108,K(e)||"Unknown",l));return z({},n,r)}function xo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Hn,cr=gt.current,Ve(gt,e),Ve(Nt,Nt.current),!0}function du(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=fu(e,t,cr),r.__reactInternalMemoizedMergedChildContext=e,Ye(Nt),Ye(gt),Ve(gt,e)):Ye(Nt),Ve(Nt,n)}var xn=null,wo=!1,Wi=!1;function pu(e){xn===null?xn=[e]:xn.push(e)}function Bd(e){wo=!0,pu(e)}function Wn(){if(!Wi&&xn!==null){Wi=!0;var e=0,t=ze;try{var n=xn;for(ze=1;e>=a,l-=a,wn=1<<32-en(t)+l|n<pe?(ft=ae,ae=null):ft=ae.sibling;var Ie=P(S,ae,_[pe],$);if(Ie===null){ae===null&&(ae=ft);break}e&&ae&&Ie.alternate===null&&t(S,ae),w=o(Ie,w,pe),se===null?ee=Ie:se.sibling=Ie,se=Ie,ae=ft}if(pe===_.length)return n(S,ae),Xe&&dr(S,pe),ee;if(ae===null){for(;pe<_.length;pe++)ae=O(S,_[pe],$),ae!==null&&(w=o(ae,w,pe),se===null?ee=ae:se.sibling=ae,se=ae);return Xe&&dr(S,pe),ee}for(ae=r(S,ae);pe<_.length;pe++)ft=V(ae,S,pe,_[pe],$),ft!==null&&(e&&ft.alternate!==null&&ae.delete(ft.key===null?pe:ft.key),w=o(ft,w,pe),se===null?ee=ft:se.sibling=ft,se=ft);return e&&ae.forEach(function(qn){return t(S,qn)}),Xe&&dr(S,pe),ee}function Z(S,w,_,$){var ee=L(_);if(typeof ee!="function")throw Error(i(150));if(_=ee.call(_),_==null)throw Error(i(151));for(var se=ee=null,ae=w,pe=w=0,ft=null,Ie=_.next();ae!==null&&!Ie.done;pe++,Ie=_.next()){ae.index>pe?(ft=ae,ae=null):ft=ae.sibling;var qn=P(S,ae,Ie.value,$);if(qn===null){ae===null&&(ae=ft);break}e&&ae&&qn.alternate===null&&t(S,ae),w=o(qn,w,pe),se===null?ee=qn:se.sibling=qn,se=qn,ae=ft}if(Ie.done)return n(S,ae),Xe&&dr(S,pe),ee;if(ae===null){for(;!Ie.done;pe++,Ie=_.next())Ie=O(S,Ie.value,$),Ie!==null&&(w=o(Ie,w,pe),se===null?ee=Ie:se.sibling=Ie,se=Ie);return Xe&&dr(S,pe),ee}for(ae=r(S,ae);!Ie.done;pe++,Ie=_.next())Ie=V(ae,S,pe,Ie.value,$),Ie!==null&&(e&&Ie.alternate!==null&&ae.delete(Ie.key===null?pe:Ie.key),w=o(Ie,w,pe),se===null?ee=Ie:se.sibling=Ie,se=Ie);return e&&ae.forEach(function(Sp){return t(S,Sp)}),Xe&&dr(S,pe),ee}function nt(S,w,_,$){if(typeof _=="object"&&_!==null&&_.type===re&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Ee:e:{for(var ee=_.key,se=w;se!==null;){if(se.key===ee){if(ee=_.type,ee===re){if(se.tag===7){n(S,se.sibling),w=l(se,_.props.children),w.return=S,S=w;break e}}else if(se.elementType===ee||typeof ee=="object"&&ee!==null&&ee.$$typeof===Pe&&xu(ee)===se.type){n(S,se.sibling),w=l(se,_.props),w.ref=xl(S,se,_),w.return=S,S=w;break e}n(S,se);break}else t(S,se);se=se.sibling}_.type===re?(w=wr(_.props.children,S.mode,$,_.key),w.return=S,S=w):($=Yo(_.type,_.key,_.props,null,S.mode,$),$.ref=xl(S,w,_),$.return=S,S=$)}return a(S);case fe:e:{for(se=_.key;w!==null;){if(w.key===se)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){n(S,w.sibling),w=l(w,_.children||[]),w.return=S,S=w;break e}else{n(S,w);break}else t(S,w);w=w.sibling}w=Us(_,S.mode,$),w.return=S,S=w}return a(S);case Pe:return se=_._init,nt(S,w,se(_._payload),$)}if(xe(_))return X(S,w,_,$);if(L(_))return Z(S,w,_,$);_o(S,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(n(S,w.sibling),w=l(w,_),w.return=S,S=w):(n(S,w),w=Fs(_,S.mode,$),w.return=S,S=w),a(S)):n(S,w)}return nt}var Fr=wu(!0),ku=wu(!1),To=Bn(null),Co=null,Ur=null,Xi=null;function Ji(){Xi=Ur=Co=null}function Zi(e){var t=To.current;Ye(To),e._currentValue=t}function qi(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 Br(e,t){Co=e,Xi=Ur=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Lt=!0),e.firstContext=null)}function Vt(e){var t=e._currentValue;if(Xi!==e)if(e={context:e,memoizedValue:t,next:null},Ur===null){if(Co===null)throw Error(i(308));Ur=e,Co.dependencies={lanes:0,firstContext:e}}else Ur=Ur.next=e;return t}var pr=null;function es(e){pr===null?pr=[e]:pr.push(e)}function Su(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,es(t)):(n.next=l.next,l.next=n),t.interleaved=n,Sn(e,r)}function Sn(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 Vn=!1;function ts(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Eu(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 En(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Qn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Ae&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Sn(e,n)}return l=r.interleaved,l===null?(t.next=t,es(r)):(t.next=l.next,l.next=t),r.interleaved=t,Sn(e,n)}function No(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,mi(e,n)}}function _u(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=a:o=o.next=a,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 Ro(e,t,n,r){var l=e.updateQueue;Vn=!1;var o=l.firstBaseUpdate,a=l.lastBaseUpdate,d=l.shared.pending;if(d!==null){l.shared.pending=null;var g=d,C=g.next;g.next=null,a===null?o=C:a.next=C,a=g;var j=e.alternate;j!==null&&(j=j.updateQueue,d=j.lastBaseUpdate,d!==a&&(d===null?j.firstBaseUpdate=C:d.next=C,j.lastBaseUpdate=g))}if(o!==null){var O=l.baseState;a=0,j=C=g=null,d=o;do{var P=d.lane,V=d.eventTime;if((r&P)===P){j!==null&&(j=j.next={eventTime:V,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var X=e,Z=d;switch(P=t,V=n,Z.tag){case 1:if(X=Z.payload,typeof X=="function"){O=X.call(V,O,P);break e}O=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=Z.payload,P=typeof X=="function"?X.call(V,O,P):X,P==null)break e;O=z({},O,P);break e;case 2:Vn=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,P=l.effects,P===null?l.effects=[d]:P.push(d))}else V={eventTime:V,lane:P,tag:d.tag,payload:d.payload,callback:d.callback,next:null},j===null?(C=j=V,g=O):j=j.next=V,a|=P;if(d=d.next,d===null){if(d=l.shared.pending,d===null)break;P=d,d=P.next,P.next=null,l.lastBaseUpdate=P,l.shared.pending=null}}while(!0);if(j===null&&(g=O),l.baseState=g,l.firstBaseUpdate=C,l.lastBaseUpdate=j,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);gr|=a,e.lanes=a,e.memoizedState=O}}function Tu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=is.transition;is.transition={};try{e(!1),t()}finally{ze=n,is.transition=r}}function Wu(){return Qt().memoizedState}function Qd(e,t,n){var r=Xn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vu(e))Qu(t,n);else if(n=Su(e,t,n,r),n!==null){var l=kt();sn(n,e,r,l),Gu(n,t,r)}}function Gd(e,t,n){var r=Xn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vu(e))Qu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,d=o(a,n);if(l.hasEagerState=!0,l.eagerState=d,tn(d,a)){var g=t.interleaved;g===null?(l.next=l,es(t)):(l.next=g.next,g.next=l),t.interleaved=l;return}}catch{}finally{}n=Su(e,t,l,r),n!==null&&(l=kt(),sn(n,e,r,l),Gu(n,t,r))}}function Vu(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function Qu(e,t){El=Ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Gu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mi(e,n)}}var Io={readContext:Vt,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useInsertionEffect:vt,useLayoutEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useMutableSource:vt,useSyncExternalStore:vt,useId:vt,unstable_isNewReconciler:!1},Yd={readContext:Vt,useCallback:function(e,t){return pn().memoizedState=[e,t===void 0?null:t],e},useContext:Vt,useEffect:Du,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Po(4194308,4,$u.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Po(4194308,4,e,t)},useInsertionEffect:function(e,t){return Po(4,2,e,t)},useMemo:function(e,t){var n=pn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=pn();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=Qd.bind(null,Ze,e),[r.memoizedState,e]},useRef:function(e){var t=pn();return e={current:e},t.memoizedState=e},useState:Iu,useDebugValue:ps,useDeferredValue:function(e){return pn().memoizedState=e},useTransition:function(){var e=Iu(!1),t=e[0];return e=Vd.bind(null,e[1]),pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ze,l=pn();if(Xe){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ct===null)throw Error(i(349));(mr&30)!==0||Lu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Du(Au.bind(null,r,o,e),[e]),r.flags|=2048,Cl(9,Mu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=pn(),t=ct.identifierPrefix;if(Xe){var n=kn,r=wn;n=(r&~(1<<32-en(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=_l++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[fn]=t,e[vl]=r,pc(e,t,!1,!1),t.stateNode=e;e:{switch(a=rr(n,r),n){case"dialog":Ge("cancel",e),Ge("close",e),l=r;break;case"iframe":case"object":case"embed":Ge("load",e),l=r;break;case"video":case"audio":for(l=0;lGr&&(t.flags|=128,r=!0,Nl(o,!1),t.lanes=4194304)}else{if(!r)if(e=Lo(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Nl(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Xe)return yt(t),null}else 2*ke()-o.renderingStartTime>Gr&&n!==1073741824&&(t.flags|=128,r=!0,Nl(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ke(),t.sibling=null,n=Je.current,Ve(Je,r?n&1|2:n&1),t):(yt(t),null);case 22:case 23:return zs(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(bt&1073741824)!==0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function np(e,t){switch(Qi(t),t.tag){case 1:return Rt(t.type)&&yo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hr(),Ye(Nt),Ye(gt),os(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return rs(t),null;case 13:if(Ye(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));$r()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ye(Je),null;case 4:return Hr(),null;case 10:return Zi(t.type._context),null;case 22:case 23:return zs(),null;case 24:return null;default:return null}}var bo=!1,xt=!1,rp=typeof WeakSet=="function"?WeakSet:Set,Y=null;function Vr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){et(e,t,r)}else n.current=null}function Ts(e,t,n){try{n()}catch(r){et(e,t,r)}}var gc=!1;function lp(e,t){if(zi=ro,e=Ya(),Li(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 a=0,d=-1,g=-1,C=0,j=0,O=e,P=null;t:for(;;){for(var V;O!==n||l!==0&&O.nodeType!==3||(d=a+l),O!==o||r!==0&&O.nodeType!==3||(g=a+r),O.nodeType===3&&(a+=O.nodeValue.length),(V=O.firstChild)!==null;)P=O,O=V;for(;;){if(O===e)break t;if(P===n&&++C===l&&(d=a),P===o&&++j===r&&(g=a),(V=O.nextSibling)!==null)break;O=P,P=O.parentNode}O=V}n=d===-1||g===-1?null:{start:d,end:g}}else n=null}n=n||{start:0,end:0}}else n=null;for(bi={focusedElem:e,selectionRange:n},ro=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var X=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(X!==null){var Z=X.memoizedProps,nt=X.memoizedState,S=t.stateNode,w=S.getSnapshotBeforeUpdate(t.elementType===t.type?Z:rn(t.type,Z),nt);S.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch($){et(t,t.return,$)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return X=gc,gc=!1,X}function Rl(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&&Ts(t,n,o)}l=l.next}while(l!==r)}}function $o(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 Cs(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 vc(e){var t=e.alternate;t!==null&&(e.alternate=null,vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[fn],delete t[vl],delete t[Bi],delete t[Fd],delete t[Ud])),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 yc(e){return e.tag===5||e.tag===3||e.tag===4}function xc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yc(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 Ns(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=go));else if(r!==4&&(e=e.child,e!==null))for(Ns(e,t,n),e=e.sibling;e!==null;)Ns(e,t,n),e=e.sibling}function Rs(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(Rs(e,t,n),e=e.sibling;e!==null;)Rs(e,t,n),e=e.sibling}var dt=null,ln=!1;function Gn(e,t,n){for(n=n.child;n!==null;)wc(e,t,n),n=n.sibling}function wc(e,t,n){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(ar,n)}catch{}switch(n.tag){case 5:xt||Vr(n,t);case 6:var r=dt,l=ln;dt=null,Gn(e,t,n),dt=r,ln=l,dt!==null&&(ln?(e=dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):dt.removeChild(n.stateNode));break;case 18:dt!==null&&(ln?(e=dt,n=n.stateNode,e.nodeType===8?Ui(e.parentNode,n):e.nodeType===1&&Ui(e,n),il(e)):Ui(dt,n.stateNode));break;case 4:r=dt,l=ln,dt=n.stateNode.containerInfo,ln=!0,Gn(e,t,n),dt=r,ln=l;break;case 0:case 11:case 14:case 15:if(!xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,a=o.destroy;o=o.tag,a!==void 0&&((o&2)!==0||(o&4)!==0)&&Ts(n,t,a),l=l.next}while(l!==r)}Gn(e,t,n);break;case 1:if(!xt&&(Vr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(d){et(n,t,d)}Gn(e,t,n);break;case 21:Gn(e,t,n);break;case 22:n.mode&1?(xt=(r=xt)||n.memoizedState!==null,Gn(e,t,n),xt=r):Gn(e,t,n);break;default:Gn(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rp),t.forEach(function(r){var l=pp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function on(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),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*ip(r/1960))-r,10e?16:e,Kn===null)var r=!1;else{if(e=Kn,Kn=null,Wo=0,(Ae&6)!==0)throw Error(i(331));var l=Ae;for(Ae|=4,Y=e.current;Y!==null;){var o=Y,a=o.child;if((Y.flags&16)!==0){var d=o.deletions;if(d!==null){for(var g=0;gke()-As?yr(e,0):Ms|=n),At(e,t)}function Ic(e,t){t===0&&((e.mode&1)===0?t=1:(t=ql,ql<<=1,(ql&130023424)===0&&(ql=4194304)));var n=kt();e=Sn(e,t),e!==null&&(tl(e,t,n),At(e,n))}function dp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ic(e,n)}function pp(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(i(314))}r!==null&&r.delete(t),Ic(e,n)}var Oc;Oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Nt.current)Lt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Lt=!1,ep(e,t,n);Lt=(e.flags&131072)!==0}else Lt=!1,Xe&&(t.flags&1048576)!==0&&hu(t,So,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zo(e,t),e=t.pendingProps;var l=Dr(t,gt.current);Br(t,n),l=as(null,t,r,e,l,n);var o=us();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,Rt(r)?(o=!0,xo(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ts(t),l.updater=Oo,t.stateNode=l,l._reactInternals=t,ms(t,r,e,n),t=xs(null,t,r,!0,o,n)):(t.tag=0,Xe&&o&&Vi(t),wt(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zo(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=mp(r),e=rn(r,e),l){case 0:t=ys(null,t,r,e,n);break e;case 1:t=sc(null,t,r,e,n);break e;case 11:t=nc(null,t,r,e,n);break e;case 14:t=rc(null,t,r,rn(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rn(r,l),ys(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rn(r,l),sc(e,t,r,l,n);case 3:e:{if(ac(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,l=o.element,Eu(e,t),Ro(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Wr(Error(i(423)),t),t=uc(e,t,r,n,l);break e}else if(r!==l){l=Wr(Error(i(424)),t),t=uc(e,t,r,n,l);break e}else for(zt=Un(t.stateNode.containerInfo.firstChild),Dt=t,Xe=!0,nn=null,n=ku(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($r(),r===l){t=_n(e,t,n);break e}wt(e,t,r,n)}t=t.child}return t;case 5:return Cu(t),e===null&&Yi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,$i(r,l)?a=null:o!==null&&$i(r,o)&&(t.flags|=32),ic(e,t),wt(e,t,a,n),t.child;case 6:return e===null&&Yi(t),null;case 13:return cc(e,t,n);case 4:return ns(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fr(t,null,r,n):wt(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rn(r,l),nc(e,t,r,l,n);case 7:return wt(e,t,t.pendingProps,n),t.child;case 8:return wt(e,t,t.pendingProps.children,n),t.child;case 12:return wt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,a=l.value,Ve(To,r._currentValue),r._currentValue=a,o!==null)if(tn(o.value,a)){if(o.children===l.children&&!Nt.current){t=_n(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var d=o.dependencies;if(d!==null){a=o.child;for(var g=d.firstContext;g!==null;){if(g.context===r){if(o.tag===1){g=En(-1,n&-n),g.tag=2;var C=o.updateQueue;if(C!==null){C=C.shared;var j=C.pending;j===null?g.next=g:(g.next=j.next,j.next=g),C.pending=g}}o.lanes|=n,g=o.alternate,g!==null&&(g.lanes|=n),qi(o.return,n,t),d.lanes|=n;break}g=g.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(i(341));a.lanes|=n,d=a.alternate,d!==null&&(d.lanes|=n),qi(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}wt(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Br(t,n),l=Vt(l),r=r(l),t.flags|=1,wt(e,t,r,n),t.child;case 14:return r=t.type,l=rn(r,t.pendingProps),l=rn(r.type,l),rc(e,t,r,l,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rn(r,l),zo(e,t),t.tag=1,Rt(r)?(e=!0,xo(t)):e=!1,Br(t,n),Ku(t,r,l),ms(t,r,l,n),xs(null,t,r,!0,e,n);case 19:return dc(e,t,n);case 22:return oc(e,t,n)}throw Error(i(156,t.tag))};function Dc(e,t){return b(e,t)}function hp(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 Yt(e,t,n,r){return new hp(e,t,n,r)}function $s(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mp(e){if(typeof e=="function")return $s(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fe)return 11;if(e===He)return 14}return 2}function Zn(e,t){var n=e.alternate;return n===null?(n=Yt(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 Yo(e,t,n,r,l,o){var a=2;if(r=e,typeof e=="function")$s(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case re:return wr(n.children,l,o,t);case ue:a=8,l|=8;break;case $e:return e=Yt(12,n,t,l|2),e.elementType=$e,e.lanes=o,e;case Le:return e=Yt(13,n,t,l),e.elementType=Le,e.lanes=o,e;case De:return e=Yt(19,n,t,l),e.elementType=De,e.lanes=o,e;case je:return Ko(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qe:a=10;break e;case ce:a=9;break e;case Fe:a=11;break e;case He:a=14;break e;case Pe:a=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Yt(a,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function wr(e,t,n,r){return e=Yt(7,e,r,t),e.lanes=n,e}function Ko(e,t,n,r){return e=Yt(22,e,r,t),e.elementType=je,e.lanes=n,e.stateNode={isHidden:!1},e}function Fs(e,t,n){return e=Yt(6,e,null,t),e.lanes=n,e}function Us(e,t,n){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gp(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=hi(0),this.expirationTimes=hi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hi(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bs(e,t,n,r,l,o,a,d,g){return e=new gp(e,t,n,d,g),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Yt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ts(o),e}function vp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(s){console.error(s)}}return c(),Ys.exports=Ap(),Ys.exports}var Xc;function jp(){if(Xc)return ni;Xc=1;var c=Pp();return ni.createRoot=c.createRoot,ni.hydrateRoot=c.hydrateRoot,ni}var Ip=jp();function ca(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Sr=ca();function kf(c){Sr=c}const Wl={exec:()=>null};function Oe(c,s=""){let i=typeof c=="string"?c:c.source;const u={replace:(f,h)=>{let m=typeof h=="string"?h:h.source;return m=m.replace(Et.caret,"$1"),i=i.replace(f,m),u},getRegex:()=>new RegExp(i,s)};return u}const Et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:c=>new RegExp(`^( {0,3}${c})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}#`),htmlBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}<(?:[a-z].*>|!--)`,"i")},Op=/^(?:[ \t]*(?:\n|$))+/,Dp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ql=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fa=/(?:[*+-]|\d{1,9}[.)])/,Sf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ef=Oe(Sf).replace(/bull/g,fa).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),$p=Oe(Sf).replace(/bull/g,fa).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),da=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Fp=/^[^\n]+/,pa=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Up=Oe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pa).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bp=Oe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fa).getRegex(),ci="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ha=/|$))/,Hp=Oe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ha).replace("tag",ci).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_f=Oe(da).replace("hr",Ql).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),Wp=Oe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_f).getRegex(),ma={blockquote:Wp,code:Dp,def:Up,fences:zp,heading:bp,hr:Ql,html:Hp,lheading:Ef,list:Bp,newline:Op,paragraph:_f,table:Wl,text:Fp},Jc=Oe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ql).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),Vp={...ma,lheading:$p,table:Jc,paragraph:Oe(da).replace("hr",Ql).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex()},Qp={...ma,html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ha).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Oe(da).replace("hr",Ql).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",Ef).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Gp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Yp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tf=/^( {2,}|\\)\n(?!\s*$)/,Kp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,Rf=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,eh=Oe(Rf,"u").replace(/punct/g,fi).getRegex(),th=Oe(Rf,"u").replace(/punct/g,Nf).getRegex(),Lf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nh=Oe(Lf,"gu").replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,ga).replace(/punct/g,fi).getRegex(),rh=Oe(Lf,"gu").replace(/notPunctSpace/g,Zp).replace(/punctSpace/g,Jp).replace(/punct/g,Nf).getRegex(),lh=Oe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,ga).replace(/punct/g,fi).getRegex(),oh=Oe(/\\(punct)/,"gu").replace(/punct/g,fi).getRegex(),ih=Oe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),sh=Oe(ha).replace("(?:-->|$)","-->").getRegex(),ah=Oe("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",sh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),si=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,uh=Oe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",si).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Mf=Oe(/^!?\[(label)\]\[(ref)\]/).replace("label",si).replace("ref",pa).getRegex(),Af=Oe(/^!?\[(ref)\](?:\[\])?/).replace("ref",pa).getRegex(),ch=Oe("reflink|nolink(?!\\()","g").replace("reflink",Mf).replace("nolink",Af).getRegex(),va={_backpedal:Wl,anyPunctuation:oh,autolink:ih,blockSkip:qp,br:Tf,code:Yp,del:Wl,emStrongLDelim:eh,emStrongRDelimAst:nh,emStrongRDelimUnd:lh,escape:Gp,link:uh,nolink:Af,punctuation:Xp,reflink:Mf,reflinkSearch:ch,tag:ah,text:Kp,url:Wl},fh={...va,link:Oe(/^!?\[(label)\]\((.*?)\)/).replace("label",si).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",si).getRegex()},la={...va,emStrongRDelimAst:rh,emStrongLDelim:th,url:Oe(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Zc=c=>ph[c];function mn(c,s){if(s){if(Et.escapeTest.test(c))return c.replace(Et.escapeReplace,Zc)}else if(Et.escapeTestNoEncode.test(c))return c.replace(Et.escapeReplaceNoEncode,Zc);return c}function qc(c){try{c=encodeURI(c).replace(Et.percentDecode,"%")}catch{return null}return c}function ef(c,s){var h;const i=c.replace(Et.findPipe,(m,y,k)=>{let E=!1,T=y;for(;--T>=0&&k[T]==="\\";)E=!E;return E?"|":" |"}),u=i.split(Et.splitPipe);let f=0;if(u[0].trim()||u.shift(),u.length>0&&!((h=u.at(-1))!=null&&h.trim())&&u.pop(),s)if(u.length>s)u.splice(s);else for(;u.length0?-2:-1}function tf(c,s,i,u,f){const h=s.href,m=s.title||null,y=c[1].replace(f.other.outputLinkReplace,"$1");u.state.inLink=!0;const k={type:c[0].charAt(0)==="!"?"image":"link",raw:i,href:h,title:m,text:y,tokens:u.inlineTokens(y)};return u.state.inLink=!1,k}function mh(c,s,i){const u=c.match(i.other.indentCodeCompensation);if(u===null)return s;const f=u[1];return s.split(` `).map(h=>{const m=h.match(i.other.beginningSpace);if(m===null)return h;const[y]=m;return y.length>=f.length?h.slice(f.length):h}).join(` `)}class ai{constructor(s){Be(this,"options");Be(this,"rules");Be(this,"lexer");this.options=s||Sr}space(s){const i=this.rules.block.newline.exec(s);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(s){const i=this.rules.block.code.exec(s);if(i){const u=i[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?u:Ol(u,` `)}}}fences(s){const i=this.rules.block.fences.exec(s);if(i){const u=i[0],f=mh(u,i[3]||"",this.rules);return{type:"code",raw:u,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:f}}}heading(s){const i=this.rules.block.heading.exec(s);if(i){let u=i[2].trim();if(this.rules.other.endingHash.test(u)){const f=Ol(u,"#");(this.options.pedantic||!f||this.rules.other.endingSpaceChar.test(f))&&(u=f.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:u,tokens:this.lexer.inline(u)}}}hr(s){const i=this.rules.block.hr.exec(s);if(i)return{type:"hr",raw:Ol(i[0],` `)}}blockquote(s){const i=this.rules.block.blockquote.exec(s);if(i){let u=Ol(i[0],` `).split(` `),f="",h="";const m=[];for(;u.length>0;){let y=!1;const k=[];let E;for(E=0;E1,h={type:"list",raw:"",ordered:f,start:f?+u.slice(0,-1):"",loose:!1,items:[]};u=f?`\\d{1,9}\\${u.slice(-1)}`:`\\${u}`,this.options.pedantic&&(u=f?u:"[*+-]");const m=this.rules.other.listItemRegex(u);let y=!1;for(;s;){let E=!1,T="",M="";if(!(i=m.exec(s))||this.rules.block.hr.test(s))break;T=i[0],s=s.substring(T.length);let I=i[2].split(` `,1)[0].replace(this.rules.other.listReplaceTabs,ve=>" ".repeat(3*ve.length)),D=s.split(` `,1)[0],F=!I.trim(),U=0;if(this.options.pedantic?(U=2,M=I.trimStart()):F?U=i[1].length+1:(U=i[2].search(this.rules.other.nonSpaceChar),U=U>4?1:U,M=I.slice(U),U+=i[1].length),F&&this.rules.other.blankLine.test(D)&&(T+=D+` `,s=s.substring(D.length+1),E=!0),!E){const ve=this.rules.other.nextBulletRegex(U),Se=this.rules.other.hrRegex(U),ie=this.rules.other.fencesBeginRegex(U),Ee=this.rules.other.headingBeginRegex(U),fe=this.rules.other.htmlBeginRegex(U);for(;s;){const re=s.split(` `,1)[0];let ue;if(D=re,this.options.pedantic?(D=D.replace(this.rules.other.listReplaceNesting," "),ue=D):ue=D.replace(this.rules.other.tabCharGlobal," "),ie.test(D)||Ee.test(D)||fe.test(D)||ve.test(D)||Se.test(D))break;if(ue.search(this.rules.other.nonSpaceChar)>=U||!D.trim())M+=` `+ue.slice(U);else{if(F||I.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ie.test(I)||Ee.test(I)||Se.test(I))break;M+=` `+D}!F&&!D.trim()&&(F=!0),T+=re+` `,s=s.substring(re.length+1),I=ue.slice(U)}}h.loose||(y?h.loose=!0:this.rules.other.doubleBlankLine.test(T)&&(y=!0));let Q=null,ye;this.options.gfm&&(Q=this.rules.other.listIsTask.exec(M),Q&&(ye=Q[0]!=="[ ] ",M=M.replace(this.rules.other.listReplaceTask,""))),h.items.push({type:"list_item",raw:T,task:!!Q,checked:ye,loose:!1,text:M,tokens:[]}),h.raw+=T}const k=h.items.at(-1);if(k)k.raw=k.raw.trimEnd(),k.text=k.text.trimEnd();else return;h.raw=h.raw.trimEnd();for(let E=0;EI.type==="space"),M=T.length>0&&T.some(I=>this.rules.other.anyLine.test(I.raw));h.loose=M}if(h.loose)for(let E=0;E({text:E,tokens:this.lexer.inline(E),header:!1,align:m.align[T]})));return m}}lheading(s){const i=this.rules.block.lheading.exec(s);if(i)return{type:"heading",raw:i[0],depth:i[2].charAt(0)==="="?1:2,text:i[1],tokens:this.lexer.inline(i[1])}}paragraph(s){const i=this.rules.block.paragraph.exec(s);if(i){const u=i[1].charAt(i[1].length-1)===` `?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:u,tokens:this.lexer.inline(u)}}}text(s){const i=this.rules.block.text.exec(s);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(s){const i=this.rules.inline.escape.exec(s);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(s){const i=this.rules.inline.tag.exec(s);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(s){const i=this.rules.inline.link.exec(s);if(i){const u=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(u)){if(!this.rules.other.endAngleBracket.test(u))return;const m=Ol(u.slice(0,-1),"\\");if((u.length-m.length)%2===0)return}else{const m=hh(i[2],"()");if(m===-2)return;if(m>-1){const k=(i[0].indexOf("!")===0?5:4)+i[1].length+m;i[2]=i[2].substring(0,m),i[0]=i[0].substring(0,k).trim(),i[3]=""}}let f=i[2],h="";if(this.options.pedantic){const m=this.rules.other.pedanticHrefTitle.exec(f);m&&(f=m[1],h=m[3])}else h=i[3]?i[3].slice(1,-1):"";return f=f.trim(),this.rules.other.startAngleBracket.test(f)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(u)?f=f.slice(1):f=f.slice(1,-1)),tf(i,{href:f&&f.replace(this.rules.inline.anyPunctuation,"$1"),title:h&&h.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(s,i){let u;if((u=this.rules.inline.reflink.exec(s))||(u=this.rules.inline.nolink.exec(s))){const f=(u[2]||u[1]).replace(this.rules.other.multipleSpaceGlobal," "),h=i[f.toLowerCase()];if(!h){const m=u[0].charAt(0);return{type:"text",raw:m,text:m}}return tf(u,h,u[0],this.lexer,this.rules)}}emStrong(s,i,u=""){let f=this.rules.inline.emStrongLDelim.exec(s);if(!f||f[3]&&u.match(this.rules.other.unicodeAlphaNumeric))return;if(!(f[1]||f[2]||"")||!u||this.rules.inline.punctuation.exec(u)){const m=[...f[0]].length-1;let y,k,E=m,T=0;const M=f[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(M.lastIndex=0,i=i.slice(-1*s.length+m);(f=M.exec(i))!=null;){if(y=f[1]||f[2]||f[3]||f[4]||f[5]||f[6],!y)continue;if(k=[...y].length,f[3]||f[4]){E+=k;continue}else if((f[5]||f[6])&&m%3&&!((m+k)%3)){T+=k;continue}if(E-=k,E>0)continue;k=Math.min(k,k+E+T);const I=[...f[0]][0].length,D=s.slice(0,m+f.index+I+k);if(Math.min(m,k)%2){const U=D.slice(1,-1);return{type:"em",raw:D,text:U,tokens:this.lexer.inlineTokens(U)}}const F=D.slice(2,-2);return{type:"strong",raw:D,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(s){const i=this.rules.inline.code.exec(s);if(i){let u=i[2].replace(this.rules.other.newLineCharGlobal," ");const f=this.rules.other.nonSpaceChar.test(u),h=this.rules.other.startingSpaceChar.test(u)&&this.rules.other.endingSpaceChar.test(u);return f&&h&&(u=u.substring(1,u.length-1)),{type:"codespan",raw:i[0],text:u}}}br(s){const i=this.rules.inline.br.exec(s);if(i)return{type:"br",raw:i[0]}}del(s){const i=this.rules.inline.del.exec(s);if(i)return{type:"del",raw:i[0],text:i[2],tokens:this.lexer.inlineTokens(i[2])}}autolink(s){const i=this.rules.inline.autolink.exec(s);if(i){let u,f;return i[2]==="@"?(u=i[1],f="mailto:"+u):(u=i[1],f=u),{type:"link",raw:i[0],text:u,href:f,tokens:[{type:"text",raw:u,text:u}]}}}url(s){var u;let i;if(i=this.rules.inline.url.exec(s)){let f,h;if(i[2]==="@")f=i[0],h="mailto:"+f;else{let m;do m=i[0],i[0]=((u=this.rules.inline._backpedal.exec(i[0]))==null?void 0:u[0])??"";while(m!==i[0]);f=i[0],i[1]==="www."?h="http://"+i[0]:h=i[0]}return{type:"link",raw:i[0],text:f,href:h,tokens:[{type:"text",raw:f,text:f}]}}}inlineText(s){const i=this.rules.inline.text.exec(s);if(i){const u=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:u}}}}class Kt{constructor(s){Be(this,"tokens");Be(this,"options");Be(this,"state");Be(this,"tokenizer");Be(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Sr,this.options.tokenizer=this.options.tokenizer||new ai,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const i={other:Et,block:ri.normal,inline:Il.normal};this.options.pedantic?(i.block=ri.pedantic,i.inline=Il.pedantic):this.options.gfm&&(i.block=ri.gfm,this.options.breaks?i.inline=Il.breaks:i.inline=Il.gfm),this.tokenizer.rules=i}static get rules(){return{block:ri,inline:Il}}static lex(s,i){return new Kt(i).lex(s)}static lexInline(s,i){return new Kt(i).inlineTokens(s)}lex(s){s=s.replace(Et.carriageReturn,` `),this.blockTokens(s,this.tokens);for(let i=0;i(y=E.call({lexer:this},s,i))?(s=s.substring(y.raw.length),i.push(y),!0):!1))continue;if(y=this.tokenizer.space(s)){s=s.substring(y.raw.length);const E=i.at(-1);y.raw.length===1&&E!==void 0?E.raw+=` `:i.push(y);continue}if(y=this.tokenizer.code(s)){s=s.substring(y.raw.length);const E=i.at(-1);(E==null?void 0:E.type)==="paragraph"||(E==null?void 0:E.type)==="text"?(E.raw+=` `+y.raw,E.text+=` `+y.text,this.inlineQueue.at(-1).src=E.text):i.push(y);continue}if(y=this.tokenizer.fences(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.heading(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.hr(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.blockquote(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.list(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.html(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.def(s)){s=s.substring(y.raw.length);const E=i.at(-1);(E==null?void 0:E.type)==="paragraph"||(E==null?void 0:E.type)==="text"?(E.raw+=` `+y.raw,E.text+=` `+y.raw,this.inlineQueue.at(-1).src=E.text):this.tokens.links[y.tag]||(this.tokens.links[y.tag]={href:y.href,title:y.title});continue}if(y=this.tokenizer.table(s)){s=s.substring(y.raw.length),i.push(y);continue}if(y=this.tokenizer.lheading(s)){s=s.substring(y.raw.length),i.push(y);continue}let k=s;if((m=this.options.extensions)!=null&&m.startBlock){let E=1/0;const T=s.slice(1);let M;this.options.extensions.startBlock.forEach(I=>{M=I.call({lexer:this},T),typeof M=="number"&&M>=0&&(E=Math.min(E,M))}),E<1/0&&E>=0&&(k=s.substring(0,E+1))}if(this.state.top&&(y=this.tokenizer.paragraph(k))){const E=i.at(-1);u&&(E==null?void 0:E.type)==="paragraph"?(E.raw+=` `+y.raw,E.text+=` `+y.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=E.text):i.push(y),u=k.length!==s.length,s=s.substring(y.raw.length);continue}if(y=this.tokenizer.text(s)){s=s.substring(y.raw.length);const E=i.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=` `+y.raw,E.text+=` `+y.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=E.text):i.push(y);continue}if(s){const E="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(E);break}else throw new Error(E)}}return this.state.top=!0,i}inline(s,i=[]){return this.inlineQueue.push({src:s,tokens:i}),i}inlineTokens(s,i=[]){var y,k,E;let u=s,f=null;if(this.tokens.links){const T=Object.keys(this.tokens.links);if(T.length>0)for(;(f=this.tokenizer.rules.inline.reflinkSearch.exec(u))!=null;)T.includes(f[0].slice(f[0].lastIndexOf("[")+1,-1))&&(u=u.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(f=this.tokenizer.rules.inline.anyPunctuation.exec(u))!=null;)u=u.slice(0,f.index)+"++"+u.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(f=this.tokenizer.rules.inline.blockSkip.exec(u))!=null;)u=u.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let h=!1,m="";for(;s;){h||(m=""),h=!1;let T;if((k=(y=this.options.extensions)==null?void 0:y.inline)!=null&&k.some(I=>(T=I.call({lexer:this},s,i))?(s=s.substring(T.raw.length),i.push(T),!0):!1))continue;if(T=this.tokenizer.escape(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.tag(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.link(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.reflink(s,this.tokens.links)){s=s.substring(T.raw.length);const I=i.at(-1);T.type==="text"&&(I==null?void 0:I.type)==="text"?(I.raw+=T.raw,I.text+=T.text):i.push(T);continue}if(T=this.tokenizer.emStrong(s,u,m)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.codespan(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.br(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.del(s)){s=s.substring(T.raw.length),i.push(T);continue}if(T=this.tokenizer.autolink(s)){s=s.substring(T.raw.length),i.push(T);continue}if(!this.state.inLink&&(T=this.tokenizer.url(s))){s=s.substring(T.raw.length),i.push(T);continue}let M=s;if((E=this.options.extensions)!=null&&E.startInline){let I=1/0;const D=s.slice(1);let F;this.options.extensions.startInline.forEach(U=>{F=U.call({lexer:this},D),typeof F=="number"&&F>=0&&(I=Math.min(I,F))}),I<1/0&&I>=0&&(M=s.substring(0,I+1))}if(T=this.tokenizer.inlineText(M)){s=s.substring(T.raw.length),T.raw.slice(-1)!=="_"&&(m=T.raw.slice(-1)),h=!0;const I=i.at(-1);(I==null?void 0:I.type)==="text"?(I.raw+=T.raw,I.text+=T.text):i.push(T);continue}if(s){const I="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(I);break}else throw new Error(I)}}return i}}class ui{constructor(s){Be(this,"options");Be(this,"parser");this.options=s||Sr}space(s){return""}code({text:s,lang:i,escaped:u}){var m;const f=(m=(i||"").match(Et.notSpaceStart))==null?void 0:m[0],h=s.replace(Et.endingNewline,"")+` `;return f?'
'+(u?h:mn(h,!0))+`
`:"
"+(u?h:mn(h,!0))+`
`}blockquote({tokens:s}){return`
${this.parser.parse(s)}
`}html({text:s}){return s}heading({tokens:s,depth:i}){return`${this.parser.parseInline(s)} `}hr(s){return`
`}list(s){const i=s.ordered,u=s.start;let f="";for(let y=0;y `+f+" `}listitem(s){var u;let i="";if(s.task){const f=this.checkbox({checked:!!s.checked});s.loose?((u=s.tokens[0])==null?void 0:u.type)==="paragraph"?(s.tokens[0].text=f+" "+s.tokens[0].text,s.tokens[0].tokens&&s.tokens[0].tokens.length>0&&s.tokens[0].tokens[0].type==="text"&&(s.tokens[0].tokens[0].text=f+" "+mn(s.tokens[0].tokens[0].text),s.tokens[0].tokens[0].escaped=!0)):s.tokens.unshift({type:"text",raw:f+" ",text:f+" ",escaped:!0}):i+=f+" "}return i+=this.parser.parse(s.tokens,!!s.loose),`
  • ${i}
  • `}checkbox({checked:s}){return"'}paragraph({tokens:s}){return`

    ${this.parser.parseInline(s)}

    `}table(s){let i="",u="";for(let h=0;h${f}`),` `+i+` `+f+`
    `}tablerow({text:s}){return` ${s} `}tablecell(s){const i=this.parser.parseInline(s.tokens),u=s.header?"th":"td";return(s.align?`<${u} align="${s.align}">`:`<${u}>`)+i+` `}strong({tokens:s}){return`${this.parser.parseInline(s)}`}em({tokens:s}){return`${this.parser.parseInline(s)}`}codespan({text:s}){return`${mn(s,!0)}`}br(s){return"
    "}del({tokens:s}){return`${this.parser.parseInline(s)}`}link({href:s,title:i,tokens:u}){const f=this.parser.parseInline(u),h=qc(s);if(h===null)return f;s=h;let m='
    ",m}image({href:s,title:i,text:u,tokens:f}){f&&(u=this.parser.parseInline(f,this.parser.textRenderer));const h=qc(s);if(h===null)return mn(u);s=h;let m=`${u}{const E=y[k].flat(1/0);u=u.concat(this.walkTokens(E,i))}):y.tokens&&(u=u.concat(this.walkTokens(y.tokens,i)))}}return u}use(...s){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(u=>{const f={...u};if(f.async=this.defaults.async||f.async||!1,u.extensions&&(u.extensions.forEach(h=>{if(!h.name)throw new Error("extension name required");if("renderer"in h){const m=i.renderers[h.name];m?i.renderers[h.name]=function(...y){let k=h.renderer.apply(this,y);return k===!1&&(k=m.apply(this,y)),k}:i.renderers[h.name]=h.renderer}if("tokenizer"in h){if(!h.level||h.level!=="block"&&h.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const m=i[h.level];m?m.unshift(h.tokenizer):i[h.level]=[h.tokenizer],h.start&&(h.level==="block"?i.startBlock?i.startBlock.push(h.start):i.startBlock=[h.start]:h.level==="inline"&&(i.startInline?i.startInline.push(h.start):i.startInline=[h.start]))}"childTokens"in h&&h.childTokens&&(i.childTokens[h.name]=h.childTokens)}),f.extensions=i),u.renderer){const h=this.defaults.renderer||new ui(this.defaults);for(const m in u.renderer){if(!(m in h))throw new Error(`renderer '${m}' does not exist`);if(["options","parser"].includes(m))continue;const y=m,k=u.renderer[y],E=h[y];h[y]=(...T)=>{let M=k.apply(h,T);return M===!1&&(M=E.apply(h,T)),M||""}}f.renderer=h}if(u.tokenizer){const h=this.defaults.tokenizer||new ai(this.defaults);for(const m in u.tokenizer){if(!(m in h))throw new Error(`tokenizer '${m}' does not exist`);if(["options","rules","lexer"].includes(m))continue;const y=m,k=u.tokenizer[y],E=h[y];h[y]=(...T)=>{let M=k.apply(h,T);return M===!1&&(M=E.apply(h,T)),M}}f.tokenizer=h}if(u.hooks){const h=this.defaults.hooks||new Vl;for(const m in u.hooks){if(!(m in h))throw new Error(`hook '${m}' does not exist`);if(["options","block"].includes(m))continue;const y=m,k=u.hooks[y],E=h[y];Vl.passThroughHooks.has(m)?h[y]=T=>{if(this.defaults.async)return Promise.resolve(k.call(h,T)).then(I=>E.call(h,I));const M=k.call(h,T);return E.call(h,M)}:h[y]=(...T)=>{let M=k.apply(h,T);return M===!1&&(M=E.apply(h,T)),M}}f.hooks=h}if(u.walkTokens){const h=this.defaults.walkTokens,m=u.walkTokens;f.walkTokens=function(y){let k=[];return k.push(m.call(this,y)),h&&(k=k.concat(h.call(this,y))),k}}this.defaults={...this.defaults,...f}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,i){return Kt.lex(s,i??this.defaults)}parser(s,i){return Xt.parse(s,i??this.defaults)}parseMarkdown(s){return(u,f)=>{const h={...f},m={...this.defaults,...h},y=this.onError(!!m.silent,!!m.async);if(this.defaults.async===!0&&h.async===!1)return y(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof u>"u"||u===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof u!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(u)+", string expected"));m.hooks&&(m.hooks.options=m,m.hooks.block=s);const k=m.hooks?m.hooks.provideLexer():s?Kt.lex:Kt.lexInline,E=m.hooks?m.hooks.provideParser():s?Xt.parse:Xt.parseInline;if(m.async)return Promise.resolve(m.hooks?m.hooks.preprocess(u):u).then(T=>k(T,m)).then(T=>m.hooks?m.hooks.processAllTokens(T):T).then(T=>m.walkTokens?Promise.all(this.walkTokens(T,m.walkTokens)).then(()=>T):T).then(T=>E(T,m)).then(T=>m.hooks?m.hooks.postprocess(T):T).catch(y);try{m.hooks&&(u=m.hooks.preprocess(u));let T=k(u,m);m.hooks&&(T=m.hooks.processAllTokens(T)),m.walkTokens&&this.walkTokens(T,m.walkTokens);let M=E(T,m);return m.hooks&&(M=m.hooks.postprocess(M)),M}catch(T){return y(T)}}}onError(s,i){return u=>{if(u.message+=` Please report this to https://github.com/markedjs/marked.`,s){const f="

    An error occurred:

    "+mn(u.message+"",!0)+"
    ";return i?Promise.resolve(f):f}if(i)return Promise.reject(u);throw u}}}const kr=new gh;function be(c,s){return kr.parse(c,s)}be.options=be.setOptions=function(c){return kr.setOptions(c),be.defaults=kr.defaults,kf(be.defaults),be};be.getDefaults=ca;be.defaults=Sr;be.use=function(...c){return kr.use(...c),be.defaults=kr.defaults,kf(be.defaults),be};be.walkTokens=function(c,s){return kr.walkTokens(c,s)};be.parseInline=kr.parseInline;be.Parser=Xt;be.parser=Xt.parse;be.Renderer=ui;be.TextRenderer=ya;be.Lexer=Kt;be.lexer=Kt.lex;be.Tokenizer=ai;be.Hooks=Vl;be.parse=be;be.options;be.setOptions;be.use;be.walkTokens;be.parseInline;Xt.parse;Kt.lex;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Pf,setPrototypeOf:nf,isFrozen:vh,getPrototypeOf:yh,getOwnPropertyDescriptor:xh}=Object;let{freeze:_t,seal:Jt,create:jf}=Object,{apply:oa,construct:ia}=typeof Reflect<"u"&&Reflect;_t||(_t=function(s){return s});Jt||(Jt=function(s){return s});oa||(oa=function(s,i,u){return s.apply(i,u)});ia||(ia=function(s,i){return new s(...i)});const li=Tt(Array.prototype.forEach),wh=Tt(Array.prototype.lastIndexOf),rf=Tt(Array.prototype.pop),Dl=Tt(Array.prototype.push),kh=Tt(Array.prototype.splice),ii=Tt(String.prototype.toLowerCase),Js=Tt(String.prototype.toString),lf=Tt(String.prototype.match),zl=Tt(String.prototype.replace),Sh=Tt(String.prototype.indexOf),Eh=Tt(String.prototype.trim),an=Tt(Object.prototype.hasOwnProperty),St=Tt(RegExp.prototype.test),bl=_h(TypeError);function Tt(c){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var i=arguments.length,u=new Array(i>1?i-1:0),f=1;f2&&arguments[2]!==void 0?arguments[2]:ii;nf&&nf(c,null);let u=s.length;for(;u--;){let f=s[u];if(typeof f=="string"){const h=i(f);h!==f&&(vh(s)||(s[u]=h),f=h)}c[f]=!0}return c}function Th(c){for(let s=0;s/gm),Mh=Jt(/\$\{[\w\W]*/gm),Ah=Jt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ph=Jt(/^aria-[\-\w]+$/),If=Jt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jh=Jt(/^(?:\w+script|data):/i),Ih=Jt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Of=Jt(/^html$/i),Oh=Jt(/^[a-z][.\w]*(-[.\w]+)+$/i);var cf=Object.freeze({__proto__:null,ARIA_ATTR:Ph,ATTR_WHITESPACE:Ih,CUSTOM_ELEMENT:Oh,DATA_ATTR:Ah,DOCTYPE_NAME:Of,ERB_EXPR:Lh,IS_ALLOWED_URI:If,IS_SCRIPT_OR_DATA:jh,MUSTACHE_EXPR:Rh,TMPLIT_EXPR:Mh});const Fl={element:1,text:3,progressingInstruction:7,comment:8,document:9},Dh=function(){return typeof window>"u"?null:window},zh=function(s,i){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let u=null;const f="data-tt-policy-suffix";i&&i.hasAttribute(f)&&(u=i.getAttribute(f));const h="dompurify"+(u?"#"+u:"");try{return s.createPolicy(h,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+h+" could not be created."),null}},ff=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Df(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Dh();const s=ne=>Df(ne);if(s.version="3.2.6",s.removed=[],!c||!c.document||c.document.nodeType!==Fl.document||!c.Element)return s.isSupported=!1,s;let{document:i}=c;const u=i,f=u.currentScript,{DocumentFragment:h,HTMLTemplateElement:m,Node:y,Element:k,NodeFilter:E,NamedNodeMap:T=c.NamedNodeMap||c.MozNamedAttrMap,HTMLFormElement:M,DOMParser:I,trustedTypes:D}=c,F=k.prototype,U=$l(F,"cloneNode"),Q=$l(F,"remove"),ye=$l(F,"nextSibling"),ve=$l(F,"childNodes"),Se=$l(F,"parentNode");if(typeof m=="function"){const ne=i.createElement("template");ne.content&&ne.content.ownerDocument&&(i=ne.content.ownerDocument)}let ie,Ee="";const{implementation:fe,createNodeIterator:re,createDocumentFragment:ue,getElementsByTagName:$e}=i,{importNode:qe}=u;let ce=ff();s.isSupported=typeof Pf=="function"&&typeof Se=="function"&&fe&&fe.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Fe,ERB_EXPR:Le,TMPLIT_EXPR:De,DATA_ATTR:He,ARIA_ATTR:Pe,IS_SCRIPT_OR_DATA:je,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:L}=cf;let{IS_ALLOWED_URI:z}=cf,v=null;const R=Ne({},[...of,...Zs,...qs,...ea,...sf]);let H=null;const te=Ne({},[...af,...ta,...uf,...oi]);let G=Object.seal(jf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,K=null,oe=!0,Te=!0,Ke=!1,ht=!0,A=!1,W=!0,q=!1,me=!1,Ue=!1,le=!1,he=!1,ge=!1,xe=!0,Re=!1;const Qe="user-content-";let we=!0,Ce=!1,Me={},rt=null;const jt=Ne({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ct=null;const Zt=Ne({},["audio","video","img","source","image","track"]);let gn=null;const Nn=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Er="http://www.w3.org/1998/Math/MathML",tr="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let Rn=$t,nr=!1,rr=null;const Xr=Ne({},[Er,tr,$t],Js);let Ln=Ne({},["mi","mo","mn","ms","mtext"]),Mn=Ne({},["annotation-xml"]);const An=Ne({},["title","style","font","a","script"]);let Ft=null;const Gl=["application/xhtml+xml","text/html"],Yl="text/html";let tt=null,vn=null;const Kl=i.createElement("form"),_r=function(x){return x instanceof RegExp||x instanceof Function},Tr=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(vn&&vn===x)){if((!x||typeof x!="object")&&(x={}),x=Cn(x),Ft=Gl.indexOf(x.PARSER_MEDIA_TYPE)===-1?Yl:x.PARSER_MEDIA_TYPE,tt=Ft==="application/xhtml+xml"?Js:ii,v=an(x,"ALLOWED_TAGS")?Ne({},x.ALLOWED_TAGS,tt):R,H=an(x,"ALLOWED_ATTR")?Ne({},x.ALLOWED_ATTR,tt):te,rr=an(x,"ALLOWED_NAMESPACES")?Ne({},x.ALLOWED_NAMESPACES,Js):Xr,gn=an(x,"ADD_URI_SAFE_ATTR")?Ne(Cn(Nn),x.ADD_URI_SAFE_ATTR,tt):Nn,Ct=an(x,"ADD_DATA_URI_TAGS")?Ne(Cn(Zt),x.ADD_DATA_URI_TAGS,tt):Zt,rt=an(x,"FORBID_CONTENTS")?Ne({},x.FORBID_CONTENTS,tt):jt,de=an(x,"FORBID_TAGS")?Ne({},x.FORBID_TAGS,tt):Cn({}),K=an(x,"FORBID_ATTR")?Ne({},x.FORBID_ATTR,tt):Cn({}),Me=an(x,"USE_PROFILES")?x.USE_PROFILES:!1,oe=x.ALLOW_ARIA_ATTR!==!1,Te=x.ALLOW_DATA_ATTR!==!1,Ke=x.ALLOW_UNKNOWN_PROTOCOLS||!1,ht=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,A=x.SAFE_FOR_TEMPLATES||!1,W=x.SAFE_FOR_XML!==!1,q=x.WHOLE_DOCUMENT||!1,le=x.RETURN_DOM||!1,he=x.RETURN_DOM_FRAGMENT||!1,ge=x.RETURN_TRUSTED_TYPE||!1,Ue=x.FORCE_BODY||!1,xe=x.SANITIZE_DOM!==!1,Re=x.SANITIZE_NAMED_PROPS||!1,we=x.KEEP_CONTENT!==!1,Ce=x.IN_PLACE||!1,z=x.ALLOWED_URI_REGEXP||If,Rn=x.NAMESPACE||$t,Ln=x.MATHML_TEXT_INTEGRATION_POINTS||Ln,Mn=x.HTML_INTEGRATION_POINTS||Mn,G=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&_r(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&_r(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),A&&(Te=!1),he&&(le=!0),Me&&(v=Ne({},sf),H=[],Me.html===!0&&(Ne(v,of),Ne(H,af)),Me.svg===!0&&(Ne(v,Zs),Ne(H,ta),Ne(H,oi)),Me.svgFilters===!0&&(Ne(v,qs),Ne(H,ta),Ne(H,oi)),Me.mathMl===!0&&(Ne(v,ea),Ne(H,uf),Ne(H,oi))),x.ADD_TAGS&&(v===R&&(v=Cn(v)),Ne(v,x.ADD_TAGS,tt)),x.ADD_ATTR&&(H===te&&(H=Cn(H)),Ne(H,x.ADD_ATTR,tt)),x.ADD_URI_SAFE_ATTR&&Ne(gn,x.ADD_URI_SAFE_ATTR,tt),x.FORBID_CONTENTS&&(rt===jt&&(rt=Cn(rt)),Ne(rt,x.FORBID_CONTENTS,tt)),we&&(v["#text"]=!0),q&&Ne(v,["html","head","body"]),v.table&&(Ne(v,["tbody"]),delete de.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw bl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw bl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ie=x.TRUSTED_TYPES_POLICY,Ee=ie.createHTML("")}else ie===void 0&&(ie=zh(D,f)),ie!==null&&typeof Ee=="string"&&(Ee=ie.createHTML(""));_t&&_t(x),vn=x}},Pn=Ne({},[...Zs,...qs,...Ch]),Cr=Ne({},[...ea,...Nh]),lr=function(x){let b=Se(x);(!b||!b.tagName)&&(b={namespaceURI:Rn,tagName:"template"});const J=ii(x.tagName),We=ii(b.tagName);return rr[x.namespaceURI]?x.namespaceURI===tr?b.namespaceURI===$t?J==="svg":b.namespaceURI===Er?J==="svg"&&(We==="annotation-xml"||Ln[We]):!!Pn[J]:x.namespaceURI===Er?b.namespaceURI===$t?J==="math":b.namespaceURI===tr?J==="math"&&Mn[We]:!!Cr[J]:x.namespaceURI===$t?b.namespaceURI===tr&&!Mn[We]||b.namespaceURI===Er&&!Ln[We]?!1:!Cr[J]&&(An[J]||!Pn[J]):!!(Ft==="application/xhtml+xml"&&rr[x.namespaceURI]):!1},Ut=function(x){Dl(s.removed,{element:x});try{Se(x).removeChild(x)}catch{Q(x)}},Bt=function(x,b){try{Dl(s.removed,{attribute:b.getAttributeNode(x),from:b})}catch{Dl(s.removed,{attribute:null,from:b})}if(b.removeAttribute(x),x==="is")if(le||he)try{Ut(b)}catch{}else try{b.setAttribute(x,"")}catch{}},or=function(x){let b=null,J=null;if(Ue)x=""+x;else{const ke=lf(x,/^[\r\n\t ]+/);J=ke&&ke[0]}Ft==="application/xhtml+xml"&&Rn===$t&&(x=''+x+"");const We=ie?ie.createHTML(x):x;if(Rn===$t)try{b=new I().parseFromString(We,Ft)}catch{}if(!b||!b.documentElement){b=fe.createDocument(Rn,"template",null);try{b.documentElement.innerHTML=nr?Ee:We}catch{}}const st=b.body||b.documentElement;return x&&J&&st.insertBefore(i.createTextNode(J),st.childNodes[0]||null),Rn===$t?$e.call(b,q?"html":"body")[0]:q?b.documentElement:st},ir=function(x){return re.call(x.ownerDocument||x,x,E.SHOW_ELEMENT|E.SHOW_COMMENT|E.SHOW_TEXT|E.SHOW_PROCESSING_INSTRUCTION|E.SHOW_CDATA_SECTION,null)},sr=function(x){return x instanceof M&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof T)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},Xl=function(x){return typeof y=="function"&&x instanceof y};function qt(ne,x,b){li(ne,J=>{J.call(s,x,b,vn)})}const Jl=function(x){let b=null;if(qt(ce.beforeSanitizeElements,x,null),sr(x))return Ut(x),!0;const J=tt(x.nodeName);if(qt(ce.uponSanitizeElement,x,{tagName:J,allowedTags:v}),W&&x.hasChildNodes()&&!Xl(x.firstElementChild)&&St(/<[/\w!]/g,x.innerHTML)&&St(/<[/\w!]/g,x.textContent)||x.nodeType===Fl.progressingInstruction||W&&x.nodeType===Fl.comment&&St(/<[/\w]/g,x.data))return Ut(x),!0;if(!v[J]||de[J]){if(!de[J]&&Jr(J)&&(G.tagNameCheck instanceof RegExp&&St(G.tagNameCheck,J)||G.tagNameCheck instanceof Function&&G.tagNameCheck(J)))return!1;if(we&&!rt[J]){const We=Se(x)||x.parentNode,st=ve(x)||x.childNodes;if(st&&We){const ke=st.length;for(let mt=ke-1;mt>=0;--mt){const It=U(st[mt],!0);It.__removalCount=(x.__removalCount||0)+1,We.insertBefore(It,ye(x))}}}return Ut(x),!0}return x instanceof k&&!lr(x)||(J==="noscript"||J==="noembed"||J==="noframes")&&St(/<\/no(script|embed|frames)/i,x.innerHTML)?(Ut(x),!0):(A&&x.nodeType===Fl.text&&(b=x.textContent,li([Fe,Le,De],We=>{b=zl(b,We," ")}),x.textContent!==b&&(Dl(s.removed,{element:x.cloneNode()}),x.textContent=b)),qt(ce.afterSanitizeElements,x,null),!1)},un=function(x,b,J){if(xe&&(b==="id"||b==="name")&&(J in i||J in Kl))return!1;if(!(Te&&!K[b]&&St(He,b))){if(!(oe&&St(Pe,b))){if(!H[b]||K[b]){if(!(Jr(x)&&(G.tagNameCheck instanceof RegExp&&St(G.tagNameCheck,x)||G.tagNameCheck instanceof Function&&G.tagNameCheck(x))&&(G.attributeNameCheck instanceof RegExp&&St(G.attributeNameCheck,b)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(b))||b==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&St(G.tagNameCheck,J)||G.tagNameCheck instanceof Function&&G.tagNameCheck(J))))return!1}else if(!gn[b]){if(!St(z,zl(J,N,""))){if(!((b==="src"||b==="xlink:href"||b==="href")&&x!=="script"&&Sh(J,"data:")===0&&Ct[x])){if(!(Ke&&!St(je,zl(J,N,"")))){if(J)return!1}}}}}}return!0},Jr=function(x){return x!=="annotation-xml"&&lf(x,L)},Zr=function(x){qt(ce.beforeSanitizeAttributes,x,null);const{attributes:b}=x;if(!b||sr(x))return;const J={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let We=b.length;for(;We--;){const st=b[We],{name:ke,namespaceURI:mt,value:It}=st,jn=tt(ke),In=It;let at=ke==="value"?In:Eh(In);if(J.attrName=jn,J.attrValue=at,J.keepAttr=!0,J.forceKeepAttr=void 0,qt(ce.uponSanitizeAttribute,x,J),at=J.attrValue,Re&&(jn==="id"||jn==="name")&&(Bt(ke,x),at=Qe+at),W&&St(/((--!?|])>)|<\/(style|title)/i,at)){Bt(ke,x);continue}if(J.forceKeepAttr)continue;if(!J.keepAttr){Bt(ke,x);continue}if(!ht&&St(/\/>/i,at)){Bt(ke,x);continue}A&&li([Fe,Le,De],ar=>{at=zl(at,ar," ")});const qr=tt(x.nodeName);if(!un(qr,jn,at)){Bt(ke,x);continue}if(ie&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!mt)switch(D.getAttributeType(qr,jn)){case"TrustedHTML":{at=ie.createHTML(at);break}case"TrustedScriptURL":{at=ie.createScriptURL(at);break}}if(at!==In)try{mt?x.setAttributeNS(mt,ke,at):x.setAttribute(ke,at),sr(x)?Ut(x):rf(s.removed)}catch{Bt(ke,x)}}qt(ce.afterSanitizeAttributes,x,null)},di=function ne(x){let b=null;const J=ir(x);for(qt(ce.beforeSanitizeShadowDOM,x,null);b=J.nextNode();)qt(ce.uponSanitizeShadowNode,b,null),Jl(b),Zr(b),b.content instanceof h&&ne(b.content);qt(ce.afterSanitizeShadowDOM,x,null)};return s.sanitize=function(ne){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=null,J=null,We=null,st=null;if(nr=!ne,nr&&(ne=""),typeof ne!="string"&&!Xl(ne))if(typeof ne.toString=="function"){if(ne=ne.toString(),typeof ne!="string")throw bl("dirty is not a string, aborting")}else throw bl("toString is not a function");if(!s.isSupported)return ne;if(me||Tr(x),s.removed=[],typeof ne=="string"&&(Ce=!1),Ce){if(ne.nodeName){const It=tt(ne.nodeName);if(!v[It]||de[It])throw bl("root node is forbidden and cannot be sanitized in-place")}}else if(ne instanceof y)b=or(""),J=b.ownerDocument.importNode(ne,!0),J.nodeType===Fl.element&&J.nodeName==="BODY"||J.nodeName==="HTML"?b=J:b.appendChild(J);else{if(!le&&!A&&!q&&ne.indexOf("<")===-1)return ie&&ge?ie.createHTML(ne):ne;if(b=or(ne),!b)return le?null:ge?Ee:""}b&&Ue&&Ut(b.firstChild);const ke=ir(Ce?ne:b);for(;We=ke.nextNode();)Jl(We),Zr(We),We.content instanceof h&&di(We.content);if(Ce)return ne;if(le){if(he)for(st=ue.call(b.ownerDocument);b.firstChild;)st.appendChild(b.firstChild);else st=b;return(H.shadowroot||H.shadowrootmode)&&(st=qe.call(u,st,!0)),st}let mt=q?b.outerHTML:b.innerHTML;return q&&v["!doctype"]&&b.ownerDocument&&b.ownerDocument.doctype&&b.ownerDocument.doctype.name&&St(Of,b.ownerDocument.doctype.name)&&(mt=" `+mt),A&&li([Fe,Le,De],It=>{mt=zl(mt,It," ")}),ie&&ge?ie.createHTML(mt):mt},s.setConfig=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tr(ne),me=!0},s.clearConfig=function(){vn=null,me=!1},s.isValidAttribute=function(ne,x,b){vn||Tr({});const J=tt(ne),We=tt(x);return un(J,We,b)},s.addHook=function(ne,x){typeof x=="function"&&Dl(ce[ne],x)},s.removeHook=function(ne,x){if(x!==void 0){const b=wh(ce[ne],x);return b===-1?void 0:kh(ce[ne],b,1)[0]}return rf(ce[ne])},s.removeHooks=function(ne){ce[ne]=[]},s.removeAllHooks=function(){ce=ff()},s}var bh=Df();function zf(c){return p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M16 6v3.33M16 6c0-2.65 3.25-4.3 5.4-2.62 1.2.95 1.6 2.65.95 4.04a3.63 3.63 0 0 1 4.61.16 3.45 3.45 0 0 1 .46 4.37 5.32 5.32 0 0 1 1.87 4.75c-.22 1.66-1.39 3.6-3.07 4.14M16 6c0-2.65-3.25-4.3-5.4-2.62a3.37 3.37 0 0 0-.95 4.04 3.65 3.65 0 0 0-4.6.16 3.37 3.37 0 0 0-.49 4.27 5.57 5.57 0 0 0-1.85 4.85 5.3 5.3 0 0 0 3.07 4.15M16 9.33v17.34m0-17.34c0 2.18 1.82 4 4 4m6.22 7.5c.67 1.3.56 2.91-.27 4.11a4.05 4.05 0 0 1-4.62 1.5c0 1.53-1.05 2.9-2.66 2.9A2.7 2.7 0 0 1 16 26.66m10.22-5.83a4.05 4.05 0 0 0-3.55-2.17m-16.9 2.18a4.05 4.05 0 0 0 .28 4.1c1 1.44 2.92 2.09 4.59 1.5 0 1.52 1.12 2.88 2.7 2.88A2.7 2.7 0 0 0 16 26.67M5.78 20.85a4.04 4.04 0 0 1 3.55-2.18"})})}function Kr({className:c}){return p.jsx("svg",{className:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})}var sa=function(){return(sa=Object.assign||function(c){for(var s,i=1,u=arguments.length;i\s*(\{[\s\S]*?\})\s*<\/tool_call>/g,i=[];let u;for(;(u=s.exec(c))!==null;)try{const f=JSON.parse(u[1]);f.name&&f.arguments!==void 0&&i.push({name:f.name,arguments:typeof f.arguments=="string"?f.arguments:JSON.stringify(f.arguments,null,2),raw:u[0]})}catch(f){console.warn("Failed to parse JSON from content:",u[1],f),i.push({name:"Malformed Tool Call",arguments:u[1],raw:u[0],error:!0})}return i}function Bh(c,s,i){if(!c)return"";let u=c;for(const f of s)u=u.replace(f.raw,"");if(i){const f=u.indexOf("");f!==-1&&(u=u.substring(0,f))}return u.trim()}function Hh({role:c,content:s,name:i,isStreamingActiveForThisMessage:u=!1,onRetryFailedToolCall:f,isRetrying:h,toolRetryFailed:m,toolErrorDetails:y}){const[k,E]=B.useState(!1),[T,M]=B.useState({}),[I,D]=B.useState(!1),[F,U]=B.useState(null),Q=B.useRef(null),ye=B.useRef(!1),[ve,Se]=B.useState(!1),ie=B.useRef(null),Ee=B.useRef(null),[fe,re]=B.useState(0);B.useEffect(()=>{m&&c==="assistant"&&re(K=>K+1)},[m,c]);const ue=s||"";let $e="",qe=ue;const ce="",Fe="",Le=ue.indexOf(ce),De=ue.indexOf(Fe);Le!==-1&&De!==-1&&De>Le?($e=ue.substring(Le+ce.length,De).trim(),qe=ue.substring(De+Fe.length)):Le!==-1&&($e=ue.substring(Le+ce.length).trim(),qe="");const He=$e.length>0,Pe=He&&Le!==-1&&!(De!==-1&&De>Le),je=He&&Le!==-1&&De!==-1&&De>Le;B.useEffect(()=>{if(He){if(Pe)ye.current||(Q.current=new Date,ye.current=!0),E(!0);else if(je&&ye.current){const oe=Math.round((new Date-Q.current)/1e3);U(oe),E(!1),ye.current=!1}}},[He,Pe,je]);let N=[],L="";c==="assistant"&&(N=Uh(qe),L=Bh(qe,N,u).trim());const z=N.length>0,v=L.length>0;let R=!1,H="",te={};if(c==="tool")try{const K=JSON.parse(ue);K.error?(R=!0,H=K.error,K.details&&(te.details=K.details)):H=typeof K=="string"?K:JSON.stringify(K,null,2)}catch{H=ue}const G=c==="assistant"?L:c==="user"?ue:"";B.useEffect(()=>{if(ie.current&&clearTimeout(ie.current),u&&c==="assistant")Se(!1);else if(!u&&G.length>0&&c==="assistant"){const K=G.length*10+100;ie.current=setTimeout(()=>Se(!0),K)}else Se(!0);return()=>clearTimeout(ie.current)},[u,G,c]),B.useEffect(()=>{k&&Pe&&Ee.current&&(Ee.current.scrollTop=Ee.current.scrollHeight)},[$e,k,Pe]);const de=K=>{M(oe=>({...oe,[K]:!oe[K]}))};return p.jsxs("div",{className:`flex gap-4 ${c==="tool"?"ml-10":""}`,children:[" ",c==="assistant"?p.jsx("div",{className:"flex-1",children:p.jsxs("div",{className:`bg-transparent rounded-lg p-1 pt-0 ${h?"opacity-70":""}`,children:[He&&p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>E(K=>(!K&&Pe&&Ee.current&&(Ee.current.innerHTML=""),!K)),children:[p.jsx(zf,{className:`h-4 w-4 text-gray-600 dark:text-gray-300 ${Pe?"animate-pulse":""}`}),p.jsx("span",{className:`text-sm text-gray-700 dark:text-gray-300 ${Pe?"thinking-glow-sweep":""}`,children:Pe?"Thinking...":`${k?"Hide":"Show"} thinking${F&&!k?` (${F}s)`:""}`})]}),k&&p.jsx("div",{ref:Ee,className:`mt-2 text-gray-800 dark:text-gray-400 p-2 border-l-2 border-gray-300 dark:border-gray-700 pl-3 ${Pe?"thinking-fade-container thinking-monologue-streaming":"markdown"}`,children:Pe?p.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:$e}):p.jsx(hf,{dynamic:!0,dangerouslySetInnerHTML:{__html:mf($e)}})})]}),z&&N.map((K,oe)=>p.jsxs("div",{className:"p-1 bg-neutral dark:bg-transparent rounded-lg inline-block max-w-full tool-call-fade-in",children:[p.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>de(oe),children:[p.jsx(Kr,{className:`h-4 w-4 text-gray-600 dark:text-neutral-100 ${h&&oe===N.length-1?"animate-pulse":""}`}),p.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Tool Call: ",K.name]}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:T[oe]?"(Hide)":"(Show)"})]}),T[oe]&&p.jsx("pre",{className:"mt-1.5 p-2 bg-neutral-100 dark:bg-neutral-800 text-neutral-800 dark:text-neutral-100 rounded text-xs overflow-x-auto scrollbar-thin",children:K.arguments}),p.jsx("div",{className:"min-h-[2em]",children:m&&!h&&oe===N.length-1&&f&&p.jsxs("div",{className:`mt-2 ${m?"tool-call-failed-shake":""}`,children:[p.jsx("button",{onClick:f,className:"px-2 py-0.5 text-xs bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700/50 rounded hover:bg-red-100 dark:hover:bg-red-800/50 text-red-600 dark:text-red-300 transition-colors",children:"Retry Tool Call"}),y&&y.errorMessage&&p.jsxs("span",{className:"ml-2 text-xs text-red-500 dark:text-red-400",children:["(",y.errorMessage,")"]})]},`error-${fe}`)})]},oe)),v&&p.jsx(hf,{dynamic:!0,children:u||!ve&&c==="assistant"?p.jsx("span",{className:"markdown",children:[...L].map((K,oe)=>K===` `?p.jsx("br",{},`br-${oe}`):p.jsx("span",{className:"token-char-animate",style:{animationDelay:`${oe*.01}s`},children:K},`char-${oe}`))}):p.jsx("span",{className:"markdown",dangerouslySetInnerHTML:{__html:mf(L)}})})]})}):c==="tool"?p.jsxs(p.Fragment,{children:[p.jsx(Kr,{className:`h-5 w-5 min-h-5 min-w-5 my-1 text-gray-500 dark:text-gray-400 ${R?"text-red-500 dark:text-red-400":"text-blue-500 dark:text-blue-400"}`}),p.jsx("div",{className:"flex-1",children:p.jsxs("div",{className:`rounded-lg p-3 text-xs ${R?"bg-red-100 dark:bg-red-900/30 border border-red-300 dark:border-red-700/50":"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700/40"}`,children:[p.jsxs("div",{className:`font-medium mb-1 ${R?"text-red-700 dark:text-red-300":"text-blue-700 dark:text-blue-300"}`,children:["Tool Result: ",i," ",R?"(Failed)":"(Success)",p.jsx("span",{className:"ml-2 cursor-pointer hover:underline",onClick:()=>D(K=>!K),children:I?"(hide details)":"(show details)"})]}),I&&p.jsxs("pre",{className:`whitespace-pre-wrap scrollbar-thin overflow-x-auto p-2 rounded mt-1 ${R?"text-red-600 dark:text-red-300 bg-red-50 dark:bg-red-800/30":"text-blue-600 dark:text-blue-300 bg-blue-50 dark:bg-blue-800/20"}`,children:[H,R&&te.details&&` Details: ${te.details}`]})]})})]}):c==="user"?p.jsx(p.Fragment,{children:p.jsx("div",{className:"bg-neutral-300 dark:bg-neutral-700 text-gray-800 dark:text-gray-100 rounded-lg p-4 flex",children:p.jsx("p",{className:"min-h-6 overflow-wrap-anywhere",children:ue})})}):null]})}function Wh({messages:c,isRunning:s,isExecutingTool:i,onRetryFailedToolCall:u}){const f=c.length===0,[h,m]=B.useState(!1);return B.useEffect(()=>{if(i){m(!0);return}if(!s){const k=setTimeout(()=>{m(!1)},300);return()=>clearTimeout(k)}if(c.length===0){m(!1);return}const y=c[c.length-1];if(y.role==="user"||y.role==="tool")m(!0);else if(y.role==="assistant"){const k=y.content&&y.content.trim().length>0;m(!k)}else m(!1)},[s,c,i]),p.jsx("div",{className:`flex-1 p-6 max-w-[960px] w-full ${f?"flex flex-col items-center justify-end":"space-y-4"}`,children:p.jsx($h,{children:f?null:p.jsxs(p.Fragment,{children:[c.map((y,k)=>{const E=k===c.length-1,T=y.role==="assistant"&&E&&s,M=y.role==="assistant"&&y.toolRetryFailed&&!y.isRetrying&&u;return p.jsx(Hh,{...y,isStreamingActiveForThisMessage:T,onRetryFailedToolCall:M?()=>u(k,y):void 0},`message-${k}`)}),p.jsx("div",{className:`flex items-center pl-3 space-x-2 mt-2 text-neutral-500 dark:text-neutral-400 transition-opacity duration-300 ease-in-out ${h?"opacity-100":"opacity-0 h-0 overflow-hidden"}`,children:p.jsx("div",{className:"w-5 h-5",children:p.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[p.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),p.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})]})})})}function gf(c){return p.jsxs("svg",{...c,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"M12 19V5"}),p.jsx("path",{d:"m5 12 7-7 7 7"})]})}function Vh(c){return p.jsxs("svg",{...c,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("path",{d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),p.jsx("path",{fill:"currentColor",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})]})}function Qh(c){const s=c==0?0:Math.floor(Math.log(c)/Math.log(1024));return+(c/Math.pow(1024,s)).toFixed(2)*1+["B","kB","MB","GB","TB"][s]}function Gh({text:c,percentage:s,total:i}){s??(s=0);const u=Math.max(0,Math.min(100,s));return p.jsxs("div",{className:"w-full mb-1",children:[p.jsx("div",{className:"bg-neutral-200 dark:bg-neutral-700 rounded-full h-2.5 overflow-hidden",children:p.jsx("div",{className:"bg-gradient-to-r from-neutral-500 to-neutral-400 h-2.5 rounded-full transition-all duration-300 ease-out",style:{width:`${u}%`}})}),p.jsxs("div",{className:"text-xs text-neutral-600 dark:text-neutral-400 mt-1 text-center",children:[c,": ",u.toFixed(1),"%"]}),!isNaN(i)&&i>0&&p.jsxs("div",{className:"text-xs text-neutral-500 dark:text-neutral-500 mt-0.5 text-center",children:["(",Qh(i),")"]})]})}function na({isEnabled:c,onToggle:s,size:i="sm",activeColor:u="bg-blue-500",disabled:f=!1}){let h,m,y,k;switch(i){case"xs":h="w-7",m="h-4",y="h-2.5 w-2.5",k="translate-x-3";break;case"sm":h="w-9",m="h-5",y="h-3.5 w-3.5",k="translate-x-4";break;default:h="w-11",m="h-6",y="h-4 w-4",k="translate-x-5";break}const E=f?"opacity-50 cursor-not-allowed":"cursor-pointer",T=c?f?"bg-neutral-600":u:"bg-gray-600 dark:bg-neutral-500";return p.jsxs("button",{type:"button",className:`relative inline-flex flex-shrink-0 ${m} ${h} border-2 border-transparent rounded-full transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-500 dark:focus:ring-offset-neutral-800 ${T} ${E}`,role:"switch","aria-checked":c,onClick:f?void 0:s,disabled:f,children:[p.jsx("span",{className:"sr-only",children:"Use setting"}),p.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block ${y} rounded-full bg-white shadow-lg transform ring-0 transition ease-in-out duration-200 ${c?k:"translate-x-0.5"}`})]})}const Yh=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}),Kh=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})}),Xh=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12.56 0c.342.052.682.107 1.022.166m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})}),vf=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})}),yf=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),Jh=c=>p.jsx("svg",{...c,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})});function Zh({isOpen:c,onClose:s,servers:i=[],toolsData:u={},onAddServer:f,onRemoveServer:h,onForceReconnect:m,onToggleServer:y,onToggleTool:k,onToggleToolDescription:E,currentToolSchemaTokens:T,maxToolSchemaTokens:M,isToolSchemaOverLimit:I}){const[D,F]=B.useState(""),[U,Q]=B.useState("servers"),[ye,ve]=B.useState(!1),[Se,ie]=B.useState({}),[Ee,fe]=B.useState(null),[re,ue]=B.useState(""),$e=B.useRef(null),qe=B.useRef(null),ce=B.useRef(null),Fe=B.useRef();B.useEffect(()=>{const N=Fe.current;return c?(F(""),setTimeout(()=>{var L;return(L=$e.current)==null?void 0:L.focus()},300),fe(null),ie(L=>{const z={};return i.forEach(v=>{const R=v.url,H=N==null?void 0:N.find(te=>te.url===R);if(L.hasOwnProperty(R)){let te=L[R];H&&H.status==="error"&&v.status==="connected"&&te===!0&&!ye?z[R]=!1:z[R]=te}else z[R]=ye}),z})):(ie({}),fe(null),ue("")),Fe.current=i,()=>clearTimeout(qe.current)},[c,i,ye]),B.useEffect(()=>{const N=L=>{c&&!L.target.closest(".mcp-tool-drawer")&&!L.target.closest('button[title="Manage Tool Connections"]')&&s()};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[c,s]),B.useEffect(()=>{const N=L=>{c&&L.key==="Escape"&&s()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[c,s]);const Le=()=>{var N;D.trim()&&(f(D.trim()),F(""),(N=$e.current)==null||N.focus())},De=N=>{ie(L=>({...L,[N]:!L[N]}))},He=N=>{navigator.clipboard.writeText(N).then(()=>{fe(N),clearTimeout(qe.current),qe.current=setTimeout(()=>{fe(null)},2e3)}).catch(L=>{console.error("Failed to copy URL: ",L)})},Pe=()=>i.reduce((N,L)=>L.isEnabled&&L.status==="connected"&&u[L.url]?N+u[L.url].length:N,0),je=()=>i.reduce((N,L)=>L.isEnabled&&L.status==="connected"&&u[L.url]?N+u[L.url].filter(z=>z.isEnabled!==!1).length:N,0);return p.jsx("div",{className:`mcp-tool-drawer absolute left-0 right-0 bottom-full mb-1 z-10 transition-all duration-300 ease-in-out rounded-xl shadow-lg border border-neutral-700 bg-neutral-800 ${c?"opacity-100 transform-none":"opacity-0 pointer-events-none translate-y-4"}`,children:p.jsxs("div",{className:"flex flex-col max-h-[500px]",children:[p.jsxs("div",{className:"flex justify-between items-center p-4 border-b border-neutral-700 bg-neutral-900 rounded-t-xl",children:[p.jsxs("h3",{className:"text-lg font-semibold text-neutral-200 flex items-center",children:[p.jsx(Kr,{className:"h-5 w-5 mr-2 text-neutral-200"}),"MCP Tool Manager"]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:`text-xs px-2 py-1 rounded-full ${I?"bg-red-900 text-red-200":"bg-neutral-800 text-neutral-400"}`,title:I?"Tool schema token limit exceeded! Disable tools or descriptions.":"Current tool schema token count vs limit",children:["Tokens: ",T,"/",M]}),p.jsx("button",{onClick:s,className:"text-neutral-400 hover:text-neutral-200 p-1 rounded-full hover:bg-neutral-700",children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:p.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),p.jsxs("div",{className:"flex border-b border-neutral-700",children:[p.jsxs("button",{onClick:()=>Q("servers"),className:`flex-1 py-2 text-sm font-medium ${U==="servers"?"text-neutral-200 border-b-2 border-neutral-400":"text-neutral-400 hover:text-neutral-300"}`,children:["Servers (",i.length," configured)"]}),p.jsx("button",{onClick:()=>Q("add"),className:`flex-1 py-2 text-sm font-medium ${U==="add"?"text-neutral-200 border-b-2 border-neutral-400":"text-neutral-400 hover:text-neutral-300"}`,children:"Add Server"})]}),p.jsxs("div",{className:"p-4 flex flex-col gap-4 overflow-auto scrollbar-thin scrollbar-thumb-neutral-600 scrollbar-track-neutral-800",children:[U==="add"&&p.jsxs("div",{className:"bg-neutral-800 rounded-lg p-3",children:[p.jsx("h4",{className:"text-sm font-medium text-neutral-200 mb-2",children:"Add New MCP Server"}),p.jsxs("div",{className:"flex items-center",children:[p.jsx("input",{ref:$e,type:"text",value:D,onChange:N=>F(N.target.value),placeholder:"Enter MCP Server URL (e.g., http://localhost:3000/mcp)",className:"flex-grow border border-neutral-600 rounded-lg p-2 text-sm bg-neutral-900 text-neutral-200 focus:outline-none focus:ring-1 focus:ring-neutral-500 placeholder-neutral-500",onKeyDown:N=>N.key==="Enter"&&D.trim()&&Le()}),p.jsxs("button",{onClick:Le,disabled:!D.trim(),className:"ml-2 px-4 py-2 rounded-lg text-sm bg-neutral-700 text-white hover:bg-neutral-600 disabled:bg-neutral-800 disabled:text-neutral-400 disabled:cursor-not-allowed transition-colors flex items-center",children:[p.jsx(yf,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),U==="servers"&&p.jsxs("div",{className:"space-y-4",children:[I&&p.jsxs("div",{className:"p-3 bg-red-900/30 border border-red-700/50 rounded-lg text-center",children:[p.jsx("p",{className:"text-sm text-red-300 font-medium",children:"Tool Schema Token Limit Exceeded!"}),p.jsxs("p",{className:"text-xs text-red-400 mt-1",children:["Please disable some tools or their descriptions to reduce the token count below ",M,"."]})]}),p.jsxs("div",{className:"relative",children:[p.jsx(vf,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-neutral-500"}),p.jsx("input",{ref:ce,type:"text",placeholder:"Search tools by name or description...",value:re,onChange:N=>ue(N.target.value),className:"w-full pl-10 pr-4 py-2 bg-neutral-900 border border-neutral-700 rounded-lg text-sm text-neutral-200 focus:outline-none focus:ring-1 focus:ring-neutral-500"}),re&&p.jsx("button",{onClick:()=>ue(""),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-neutral-500 hover:text-neutral-300",children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:p.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsx("div",{className:"text-sm text-neutral-400",children:Pe()===0?"No tools available":p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-neutral-300 font-medium",children:je()})," of ",p.jsx("span",{className:"font-medium",children:Pe()})," tools enabled"]})}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("button",{onClick:()=>{Object.entries(u).forEach(([N,L])=>{L.forEach(z=>{const v=L.some(R=>R.isEnabled===!1);k(N,z.name,v)})})},className:"text-xs px-2 py-1 bg-neutral-700 hover:bg-neutral-600 text-neutral-300 rounded",children:"Toggle All"}),p.jsxs("select",{className:"text-xs bg-neutral-700 text-neutral-300 rounded px-2 py-1 border-none focus:ring-1 focus:ring-neutral-500",onChange:N=>{const L=N.target.value;L==="all"?ue(""):L==="enabled"?ue("enabled:true"):L==="disabled"&&ue("enabled:false")},value:re===""?"all":re==="enabled:true"?"enabled":re==="enabled:false"?"disabled":"all",children:[p.jsx("option",{value:"all",children:"All Tools"}),p.jsx("option",{value:"enabled",children:"Enabled Only"}),p.jsx("option",{value:"disabled",children:"Disabled Only"})]})]})]}),p.jsx("div",{className:"space-y-3",children:i.map(N=>{const L=N.url,z=u[L]||[],v=re.startsWith("enabled:")?z.filter(A=>{const W=A.isEnabled!==!1;return re==="enabled:true"?W:!W}):z.filter(A=>re===""||A.name.toLowerCase().includes(re.toLowerCase())||A.description&&A.description.toLowerCase().includes(re.toLowerCase())),R=L.toLowerCase().includes(re.toLowerCase());if(!(re===""||R||v.length>0)&&N.status!=="error"&&N.status!=="connecting")return null;const te=N.isEnabled!==!1,G=N.status==="connected"&&te,de=N.status==="connecting"&&te,K=N.status==="error"&&te,oe=!te;let Te="Disabled",Ke="bg-neutral-700/30 text-neutral-400",ht="bg-neutral-500";return oe?Te="Disabled by User":de?(Te="Connecting...",Ke="bg-yellow-900/30 text-yellow-400",ht="bg-yellow-400 animate-pulse"):K?(Te="Error",Ke="bg-red-900/30 text-red-400",ht="bg-red-400"):G?(Te="Connected",Ke="bg-green-900/30 text-green-400",ht="bg-green-400"):(N.status==="offline"||N.status==="disconnected")&&(Te="Disconnected",Ke="bg-orange-900/30 text-orange-400",ht="bg-orange-400"),p.jsxs("div",{className:`border border-neutral-700 rounded-lg overflow-hidden transition-all duration-200 ${oe?"opacity-60":""}`,children:[p.jsxs("div",{className:"bg-neutral-750 p-3 flex justify-between items-center",children:[p.jsxs("div",{className:"flex-grow mr-2 min-w-0",children:[p.jsx("div",{className:`font-mono text-xs cursor-pointer hover:text-neutral-300 transition-colors duration-150 flex items-center ${oe?"text-neutral-500":"text-neutral-300"}`,onClick:()=>He(L),title:"Copy URL",children:Ee===L?p.jsx("span",{className:"text-green-400",children:"✓ Copied!"}):p.jsx("span",{className:"max-w-[300px] truncate",children:L})}),p.jsxs("div",{className:"flex items-center mt-1 space-x-2",children:[p.jsxs("div",{className:`inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] ${Ke}`,children:[p.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full mr-1 ${ht}`}),Te]}),G&&z.length>0&&p.jsxs("span",{className:"text-xs text-neutral-400 flex items-center",children:[p.jsx(Kr,{className:"h-3 w-3 mr-1 text-neutral-400"}),v.length," tool",v.length!==1?"s":"",v.length!==z.length?` (of ${z.length} total)`:""]})]}),K&&N.error&&p.jsxs("div",{className:"mt-1 text-xs text-red-400 truncate",title:typeof N.error=="string"?N.error:JSON.stringify(N.error),children:["Error: ",typeof N.error=="string"?N.error:N.error.message||JSON.stringify(N.error)]})]}),p.jsxs("div",{className:"flex items-center space-x-1.5",children:[K&&p.jsx("button",{onClick:()=>m(L),className:"p-1 text-neutral-400 hover:text-neutral-100 hover:bg-neutral-700 rounded",title:"Force Reconnect",children:p.jsx(Jh,{className:"w-3.5 h-3.5"})}),p.jsx("button",{onClick:()=>De(L),className:"p-1 text-neutral-400 hover:text-neutral-200 bg-neutral-800 hover:bg-neutral-700 rounded","aria-label":Se[L]?"Hide details":"Show details",title:Se[L]?"Hide details":"Show details",disabled:oe||de||K&&!G,children:Se[L]?p.jsx(Kh,{className:"w-4 h-4"}):p.jsx(Yh,{className:"w-4 h-4"})}),p.jsx(na,{isEnabled:te,onToggle:()=>y(L),activeColor:"bg-neutral-600"}),p.jsx("button",{onClick:()=>h(L),className:"p-1 text-neutral-500 hover:text-red-400 hover:bg-neutral-700 disabled:text-neutral-600 disabled:cursor-not-allowed transition-colors rounded","aria-label":"Remove server",title:"Remove Server",children:p.jsx(Xh,{className:"w-4 h-4"})})]})]}),te&&Se[L]&&(de||G&&z.length>0)&&p.jsxs("div",{className:"border-t border-neutral-700 bg-neutral-800 p-3",children:[de&&p.jsx("div",{className:"text-sm text-neutral-400 text-center py-2",children:"Connecting to server..."}),G&&z.length>0&&p.jsxs("div",{className:"space-y-2",children:[v.length===0&&re&&p.jsx("div",{className:"text-sm text-neutral-500 text-center py-2",children:"No tools match your search for this server."}),v.length===0&&!re&&p.jsx("div",{className:"text-sm text-neutral-500 text-center py-2",children:"This server reported no tools."}),v.map((A,W)=>{const q=A.isEnabled===!1?"opacity-20":"";return p.jsxs("div",{className:`bg-neutral-750 p-2 rounded border ${A.isEnabled!==!1?"border-neutral-700":"border-neutral-800"}`,children:[p.jsxs("div",{className:"flex items-center justify-between mb-1",children:[p.jsx("div",{className:`font-medium text-neutral-300 text-sm truncate max-w-[250px] ${q}`,title:A.name,children:A.name}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"text-[10px] text-neutral-500 mr-1",children:"DESC"}),p.jsx(na,{isEnabled:A.showDescription!==!1,onToggle:()=>E(L,A.name),size:"xs",activeColor:"bg-neutral-600"})]}),p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"text-[10px] text-neutral-500 mr-1",children:"ON"}),p.jsx(na,{isEnabled:A.isEnabled!==!1,onToggle:()=>k(L,A.name),size:"xs",activeColor:"bg-neutral-600"})]})]})]}),A.showDescription!==!1&&A.description&&p.jsx("div",{className:`text-neutral-400 mt-1 text-xs ${q}`,children:A.description}),A.inputSchema&&A.inputSchema.properties&&p.jsxs("div",{className:`mt-2 border-t border-neutral-800 pt-2 ${q}`,children:[p.jsx("div",{className:"text-[10px] text-neutral-500 mb-1 uppercase tracking-wide",children:"Parameters"}),p.jsx("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(A.inputSchema.properties).map(([me,Ue])=>{var le;return p.jsxs("div",{className:"flex items-center",children:[p.jsx("span",{className:"text-neutral-300 text-[10px] font-mono",children:me}),p.jsxs("span",{className:"text-neutral-500 ml-1 text-[10px]",children:["(",Ue.type,")",((le=A.inputSchema.required)==null?void 0:le.includes(me))&&p.jsx("span",{className:"text-red-400 ml-0.5",children:"*"})]})]},me)})})]})]},W)})]})]})]},L)})}),i.length===0&&p.jsxs("div",{className:"text-center py-6 text-neutral-400 bg-neutral-800/50 rounded-lg border border-neutral-700",children:[p.jsx("div",{className:"flex justify-center mb-2",children:p.jsx(Kr,{className:"h-8 w-8 text-neutral-500"})}),p.jsx("p",{children:"No MCP servers configured"}),p.jsx("p",{className:"text-sm mt-1",children:"Add a server to get started"}),p.jsxs("button",{onClick:()=>Q("add"),className:"mt-3 px-4 py-2 rounded-lg text-sm bg-neutral-700 text-white hover:bg-neutral-600 inline-flex items-center",children:[p.jsx(yf,{className:"w-4 h-4 mr-1"}),"Add Server"]})]}),i.length>0&&!i.some(N=>{const L=u[N.url]||[],z=re.startsWith("enabled:")?L.filter(R=>{const H=R.isEnabled!==!1;return re==="enabled:true"?H:!H}):L.filter(R=>re===""||R.name.toLowerCase().includes(re.toLowerCase())||R.description&&R.description.toLowerCase().includes(re.toLowerCase())),v=N.url.toLowerCase().includes(re.toLowerCase());return re===""||v||z.length>0})&&p.jsxs("div",{className:"text-center py-6 text-neutral-400 bg-neutral-800/50 rounded-lg border border-neutral-700",children:[p.jsx("div",{className:"flex justify-center mb-2",children:p.jsx(vf,{className:"h-8 w-8 text-neutral-500"})}),p.jsx("p",{children:"No servers or tools match your search"}),p.jsx("p",{className:"text-sm mt-1",children:"Try different search terms or clear the filter"}),p.jsx("button",{onClick:()=>ue(""),className:"mt-3 px-4 py-2 rounded-lg text-sm bg-neutral-700 text-white hover:bg-neutral-600",children:"Clear Search"})]})]})]})]})})}function qh({className:c,style:s}){return p.jsx("svg",{className:c,style:s,width:"20",height:"20",fill:"none",viewBox:"0 0 24 24",children:p.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 9l6 6 6-6"})})}function em({reasonEnabled:c,onToggleReason:s,thinkingBudget:i,onBudgetChange:u,min:f=50,max:h=16384,step:m=50}){const[y,k]=B.useState(!1),[E,T]=B.useState(!1),M=B.useRef(null),I=B.useRef(null),D=180;return B.useEffect(()=>{if(y)T(!0);else if(E){const F=setTimeout(()=>T(!1),D);return()=>clearTimeout(F)}},[y,E]),B.useEffect(()=>{function F(U){y&&M.current&&!M.current.contains(U.target)&&I.current&&!I.current.contains(U.target)&&k(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[y]),p.jsxs("div",{className:"relative flex items-center",children:[p.jsx("button",{onClick:s,className:`flex items-center px-3 py-1.5 rounded-lg transition-all duration-200 font-medium focus:outline-none ${c?"bg-neutral-100 dark:bg-neutral-700 text-neutral-900 dark:text-white shadow w-11":"bg-transparent text-neutral-700 dark:text-neutral-200 w-10"}`,style:{minWidth:c?44:40,maxWidth:44},children:p.jsx("span",{className:`transition-all duration-200 ${c?"scale-110":"scale-100"}`,children:p.jsx(zf,{className:"h-5 w-5"})})}),c&&p.jsx("span",{ref:I,className:"ml-1 flex items-center cursor-pointer user-select-none",onClick:F=>{F.stopPropagation(),k(U=>!U)},children:p.jsx(qh,{className:"h-4 w-4 transition-transform duration-200",style:{transform:y?"rotate(-180deg)":"rotate(0deg)"}})}),E&&c&&p.jsxs("div",{ref:M,className:`absolute left-1/2 bottom-12 -translate-x-1/2 z-50 w-80 bg-neutral-900 text-white rounded-xl shadow-xl p-5 transition-opacity duration-200 ${y?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,style:{minWidth:320,transition:`opacity ${D}ms`},children:[p.jsx("div",{className:"font-semibold text-base mb-1",children:"Thinking budget"}),p.jsx("div",{className:"text-sm text-neutral-300 mb-4",children:"Control the maximum length of thinking."}),p.jsx("input",{type:"range",min:f,max:h,step:m,value:i,onChange:F=>u(parseInt(F.target.value)),className:"w-full accent-white h-2 rounded-lg appearance-none cursor-pointer bg-neutral-700",style:{background:"#444"}}),p.jsx("div",{className:"mt-3 flex justify-between items-center",children:p.jsxs("span",{className:"text-lg font-bold text-white",children:[i.toLocaleString()," tokens"]})})]})]})}const tm=!!navigator.gpu,nm=120,xf="mcpServerUrls",ra=3e3;function rm(){const c=B.useRef(null),s=B.useRef(null),i=B.useRef(null),[u,f]=B.useState(null),[h,m]=B.useState(null),[y,k]=B.useState(""),[E,T]=B.useState([]),[M,I]=B.useState(!1),[D,F]=B.useState(!1),[U,Q]=B.useState(""),[ye,ve]=B.useState([]),[Se,ie]=B.useState(null),[Ee,fe]=B.useState(null),[re,ue]=B.useState(!1),[$e,qe]=B.useState(()=>{const A=localStorage.getItem("thinkingBudget");return A?parseInt(A):1024}),[ce,Fe]=B.useState(()=>{const A=localStorage.getItem(xf);if(A)try{return JSON.parse(A).map(me=>typeof me=="string"?{url:me,status:"pending",error:null,toolsCount:0,isEnabled:!0,tools:[]}:{url:me.url,status:me.status||"pending",error:me.error||null,toolsCount:me.toolsCount||0,isEnabled:me.isEnabled!==void 0?me.isEnabled:!0,tools:me.tools||[]})}catch(W){return console.error("Failed to parse MCP servers from localStorage:",W),[]}return[]}),[Le,De]=B.useState(!1),[He,Pe]=B.useState({name:"",url:null}),[je,N]=B.useState(0),[L,z]=B.useState(!1),v=()=>{const A={};return ce.forEach(W=>{W.status==="connected"&&W.tools&&W.tools.length>0&&(A[W.url]=W.tools)}),A};B.useEffect(()=>{localStorage.setItem(xf,JSON.stringify(ce))},[ce]),B.useEffect(()=>{localStorage.setItem("thinkingBudget",$e.toString())},[$e]);const R=A=>{!A.trim()||u!=="ready"||M||L||(I(!0),ve(W=>[...W,{role:"user",content:A.trim()}]),Q(""))};B.useEffect(()=>{if(!c.current){c.current=new Worker(new URL("/assets/worker-CIlXVsA_.js",import.meta.url),{type:"module"}),c.current.postMessage({type:"check"});const A=ce.map(W=>W.url);A.length>0&&c.current.postMessage({type:"initialize_mcp_servers",data:{urls:A}})}c.current&&u===null&&(c.current.postMessage({type:"load"}),f("loading"),m(null))},[ce,u]),B.useEffect(()=>{c.current&&u==="ready"&&c.current.postMessage({type:"update_tool_configs_and_recalculate_tokens",data:{allServerConfigsFromApp:ce}})},[ce,u]),B.useEffect(()=>{if(!c.current)return;const A=q=>{const me=q.data.type,Ue=q.data.status;if(me==="model_loaded_info"){Pe(q.data.data);return}if(me==="tool_schema_token_update"){const{currentToolSchemaTokens:le,error:he}=q.data.data;he?(console.error("[App.jsx] Worker reported error calculating tool schema tokens:",he),N(0),z(!1)):(N(le||0),z((le||0)>ra));return}if(me==="mcp_server_status"){const{url:le,success:he,error:ge,tools:xe,toolsCount:Re}=q.data.data;Fe(Qe=>Qe.map(we=>{if(we.url===le)if(he){const Ce=(xe||[]).map(Me=>{const rt=(we.tools||[]).find(Zt=>Zt.name===Me.name),jt=(rt==null?void 0:rt.isEnabled)!==void 0?rt.isEnabled:Me.isEnabled,Ct=(rt==null?void 0:rt.showDescription)!==void 0?rt.showDescription:Me.showDescription;return c.current&&(jt!==Me.isEnabled&&c.current.postMessage({type:"toggle_tool",data:{serverUrl:le,toolName:Me.name,isEnabled:jt}}),Ct!==Me.showDescription&&c.current.postMessage({type:"toggle_tool_description",data:{serverUrl:le,toolName:Me.name}})),{...Me,isEnabled:jt,showDescription:Ct}});return{...we,status:"connected",error:null,tools:Ce,toolsCount:Ce.length}}else return{...we,status:"error",error:ge||"Unknown connection error from worker",tools:we.tools||[],toolsCount:(we.tools||[]).length};return we}));return}if(Ue==="tool_execution_start"){F(!0);return}if(Ue==="tool_retry_execution_success_generating_response"){const{messageIndex:le}=q.data.data;ve(he=>{const ge=[...he];if(ge[le]){const xe={...ge[le]};xe.isRetrying=!1,xe.isToolCallFailure=!1,xe.toolErrorDetails=null,xe.toolRetryFailed=!1,xe.toolRetrySuccess=!0,ge[le]=xe,ge[le]=xe}return ge}),F(!1);return}if(Ue==="tool_retry_failed"){const{messageIndex:le,error:he}=q.data.data;ve(ge=>{const xe=[...ge];if(xe[le]){const Re={...xe[le]};Re.isRetrying=!1,Re.toolRetryFailed=!0,Re.toolErrorDetails?Re.toolErrorDetails.errorMessage=`Retry failed: ${he}`:Re.toolErrorDetails={errorMessage:`Retry failed: ${he}`},xe[le]=Re}return xe}),I(!1),F(!1);return}switch(Ue){case"loading":f("loading"),k(q.data.data),F(!1);break;case"initiate":T(le=>[...le,q.data]);break;case"progress":T(le=>le.map(he=>he.file===q.data.file?{...he,...q.data}:he));break;case"done":T(le=>le.filter(he=>he.file!==q.data.file));break;case"ready":f("ready");break;case"start":ve(le=>[...le,{role:"assistant",content:""}]),F(!1);break;case"update":F(!1);{const{output:le,tps:he,numTokens:ge,state:xe,toolCallInProgress:Re,isDefinitivelyToolCall:Qe}=q.data;ie(he),fe(ge),ve(we=>{const Ce=[...we];if(Ce.length===0)return we;const Me={...Ce.at(-1)};if(Qe?Me.isUsingTool=!0:le&&(Me.content+=le,Me.isUsingTool=Re||!1),re){const rt="",jt="",Ct=Me.content.indexOf(rt),Zt=Me.content.indexOf(jt);Ct!==-1&&Zt!==-1&&Zt>Ct?Me.answerIndex=Zt+jt.length:Ct!==-1?Me.answerIndex=void 0:Me.answerIndex=0}else Me.answerIndex=0;return Ce[Ce.length-1]=Me,Ce})}break;case"complete":I(!1),F(!1);break;case"error":m(q.data.data),I(!1),F(!1);break;case"tool_execution_error":{F(!1);const{errorDetails:le}=q.data;ve(he=>{const ge=[...he];let xe=-1;for(let Re=ge.length-1;Re>=0;Re--)if(ge[Re].role==="assistant"){xe=Re;break}if(xe!==-1){const Re={...ge[xe]};Re.toolRetryFailed=!0,Re.isToolCallFailure=!0,Re.toolErrorDetails={functionName:le.functionName,errorMessage:le.errorMessage},Re.isRetrying=!1,ge[xe]=Re}else console.warn("[App.jsx] tool_execution_error: Could not find a preceding assistant message to mark for retry.");return ge}),I(!1)}break}},W=q=>{console.error("Worker error:",q),m("A worker error occurred. Check console."),I(!1)};return c.current.addEventListener("message",A),c.current.addEventListener("error",W),()=>{c.current.removeEventListener("message",A),c.current.removeEventListener("error",W)}},[re,ce]),B.useEffect(()=>{if(ye.filter(W=>W.role==="user").length===0||ye.at(-1).role==="assistant")return;ie(null);const A=ce.filter(W=>W.isEnabled).map(W=>W.url);c.current.postMessage({type:"generate",data:{messages:ye,reasonEnabled:re,mcpServerUrls:A,maxThinkingBudget:re?$e:void 0}})},[ye,M,re,ce,$e]),B.useEffect(()=>{if(!i.current||!M)return;const A=i.current;A.scrollHeight-A.scrollTop-A.clientHeight{if(!ce.find(W=>W.url===A))Fe(W=>[...W,{url:A,status:"connecting",error:null,toolsCount:0,isEnabled:!0,tools:[]}]),c.current.postMessage({type:"add_mcp_server",data:{url:A}});else{const W=ce.find(q=>q.url===A);W&&W.status==="error"&&G(A)}},te=A=>{const W=ce.filter(me=>me.url!==A);Fe(W);const q=W.filter(me=>me.isEnabled).map(me=>me.url);c.current.postMessage({type:"synchronize_mcp_servers",data:{urls:q}})},G=A=>{Fe(W=>W.map(q=>q.url===A?{...q,status:"connecting",error:null,isEnabled:!0,tools:[],toolsCount:0}:q)),c.current.postMessage({type:"add_mcp_server",data:{url:A}})},de=A=>{Fe(W=>W.map(q=>{if(q.url===A){const me=!q.isEnabled;return me&&q.status!=="connected"&&c.current.postMessage({type:"add_mcp_server",data:{url:A}}),{...q,isEnabled:me}}return q}))},K=(A,W,q)=>{if(ce.findIndex(xe=>xe.url===A)===-1)return;[...ce];const Ue=v()[A];if(!Ue)return;const le=Ue.findIndex(xe=>xe.name===W);if(le===-1)return;const he=[...Ue],ge=q!==void 0?q:!he[le].isEnabled;he[le]={...he[le],isEnabled:ge},c.current.postMessage({type:"toggle_tool",data:{serverUrl:A,toolName:W,isEnabled:ge}}),Fe(xe=>{const Re=xe.findIndex(Ce=>Ce.url===A);if(Re===-1)return xe;const Qe=[...xe],we={...Qe[Re]};if(we.tools&&Array.isArray(we.tools)){const Ce=we.tools.findIndex(Me=>Me.name===W);Ce!==-1&&(we.tools=[...we.tools],we.tools[Ce]={...we.tools[Ce],isEnabled:ge},Qe[Re]=we)}return Qe})},oe=(A,W)=>{ce.findIndex(me=>me.url===A)!==-1&&(c.current.postMessage({type:"toggle_tool_description",data:{serverUrl:A,toolName:W}}),Fe(me=>{const Ue=me.findIndex(ge=>ge.url===A);if(Ue===-1)return me;const le=[...me],he={...le[Ue]};if(he.tools&&Array.isArray(he.tools)){const ge=he.tools.findIndex(xe=>xe.name===W);ge!==-1&&(he.tools=[...he.tools],he.tools[ge]={...he.tools[ge],showDescription:!he.tools[ge].showDescription},le[Ue]=he)}return le}))},Te=()=>{c.current&&(c.current.postMessage({type:"interrupt"}),I(!1),F(!1),ve(A=>{const W=[...A];if(W.length>0&&W.at(-1).role==="assistant"){const q={...W.at(-1)};return q.content+=" [Interrupted]",q.isUsingTool=!1,W[W.length-1]=q,W}return A}))},Ke=(A,W)=>{if(!c.current||!W)return;const q=W.content||"";let Ue=/\s*(\{[\s\S]*?\})\s*<\/tool_call>/g.exec(q);if(!Ue||!Ue[1]){console.error("[App.jsx] retryFailedToolCall: Could not parse from message content:",q),ve(Qe=>Qe.map((we,Ce)=>Ce===A?{...we,toolRetryFailed:!0,isRetrying:!1,toolErrorDetails:{...we.toolErrorDetails||{},errorMessage:"Could not parse original tool call for retry."}}:we)),F(!1);return}let le,he,ge;try{le=JSON.parse(Ue[1]),he=le.name,ge=le.arguments,typeof ge=="string"&&(ge=JSON.parse(ge))}catch(Qe){console.error("[App.jsx] retryFailedToolCall: Failed to parse JSON from tool_call for retry:",Ue[1],Qe),ve(we=>we.map((Ce,Me)=>Me===A?{...Ce,toolRetryFailed:!0,isRetrying:!1,toolErrorDetails:{...Ce.toolErrorDetails||{},errorMessage:"Failed to parse tool call arguments for retry."}}:Ce)),F(!1);return}if(!he){console.error("[App.jsx] retryFailedToolCall: No function name found in parsed tool_call."),ve(Qe=>Qe.map((we,Ce)=>Ce===A?{...we,toolRetryFailed:!0,isRetrying:!1,toolErrorDetails:{...we.toolErrorDetails||{},errorMessage:"Function name missing in tool call for retry."}}:we)),F(!1);return}F(!0),ve(Qe=>{const we=[...Qe];if(we[A]){const Ce={...we[A]};Ce.isRetrying=!0,Ce.toolRetryFailed=!1,Ce.isToolCallFailure=!1,Ce.toolErrorDetails=null,we[A]=Ce}return we});const xe=ce.filter(Qe=>Qe.isEnabled).map(Qe=>Qe.url),Re=ye.slice(0,A+1);I(!0),c.current.postMessage({type:"retry_tool_call",data:{messageIndex:A,functionName:he,args:ge,originalFailedMessageContent:W.content,messagesSnapshot:Re,mcpServerUrls:xe,reasonEnabled:re,maxThinkingBudget:$e}})},ht=ce.filter(A=>A.status==="connected"&&A.isEnabled).length;return tm?p.jsxs("div",{className:"flex flex-col h-screen mx-auto items-center justify-end text-gray-800 dark:text-gray-200 bg-neutral-100 dark:bg-neutral-900",children:[u==="loading"||u===null&&ye.length===0?p.jsx("div",{className:"h-full w-full flex flex-col justify-center items-center p-4",children:p.jsxs("div",{className:"w-full max-w-md text-center space-y-6",children:[h&&p.jsxs("div",{className:"text-red-500 text-center p-3 bg-red-100 dark:bg-red-800 dark:text-red-300 rounded-lg shadow-md",children:[p.jsx("p",{className:"mb-1 font-semibold text-lg",children:"Loading Error"}),p.jsx("p",{className:"text-sm",children:h})]}),p.jsx("p",{className:"text-xl font-semibold text-gray-700 dark:text-gray-300 thinking-glow-sweep",children:y||"Initializing Model..."}),E.length>0&&p.jsx("div",{className:"space-y-3 pt-2",children:E.map(({file:A,progress:W,total:q},me)=>p.jsx(Gh,{text:A,percentage:W,total:q},me))})]})}):p.jsx("div",{ref:i,className:"overflow-y-auto scrollbar-thin w-full flex flex-col items-center h-full pt-4",children:p.jsx(Wh,{messages:ye,isRunning:M,isExecutingTool:D,onRetryFailedToolCall:Ke})}),(u==="ready"||u!=="loading"&&u!==null)&&p.jsxs("div",{className:"w-[600px] max-w-[80%] mx-auto mt-2 mb-3 relative animate-fade-in-up",children:[p.jsx(Zh,{isOpen:Le,onClose:()=>De(!1),servers:ce,toolsData:v(),currentToolSchemaTokens:je,maxToolSchemaTokens:ra,isToolSchemaOverLimit:L,onAddServer:H,onRemoveServer:te,onForceReconnect:G,onToggleServer:de,onToggleTool:K,onToggleToolDescription:oe}),p.jsxs("div",{className:`input-area-wrapper border border-neutral-600 dark:border-neutral-700 bg-neutral-200 dark:bg-neutral-800 rounded-2xl max-h-[250px] relative flex flex-col ${L?"fade-active":""}`,children:[p.jsx("textarea",{ref:s,className:"scrollbar-thin flex-grow pl-4 pr-16 py-4 rounded-2xl bg-transparent border-none outline-none text-gray-800 disabled:text-gray-400 dark:text-neutral-200 placeholder-neutral-600 dark:placeholder-neutral-400 disabled:placeholder-neutral-200 dark:disabled:placeholder-neutral-500 resize-none disabled:cursor-not-allowed min-h-[80px]",placeholder:"What's on your mind?",type:"text",rows:2,value:U,disabled:u!=="ready"||M||L,title:u==="ready"?M?"Model is generating...":L?`Tool schema too large (${je}/${ra}). Disable tools/descriptions.`:"Model is ready":"Model not loaded yet",onKeyDown:A=>{U.length>0&&!M&&!L&&A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),R(U))},onInput:A=>Q(A.target.value)}),M?p.jsx("div",{className:"cursor-pointer absolute right-3 top-4 group",onClick:Te,children:p.jsx(Vh,{className:"h-8 w-8 p-1 rounded-md text-gray-800 dark:text-gray-100 transition-all duration-200 group-hover:text-red-500 dark:group-hover:text-red-300 group-hover:filter group-hover:brightness-125"})}):U.length>0?p.jsx("div",{className:"cursor-pointer absolute right-3 top-4 group",onClick:()=>R(U),children:p.jsx(gf,{className:"h-8 w-8 p-1 bg-neutral-700 dark:bg-neutral-300 text-white dark:text-neutral-900 rounded-md transition-all duration-200 group-hover:bg-neutral-600 dark:group-hover:bg-neutral-400 group-hover:filter group-hover:brightness-110"})}):p.jsx("div",{className:"absolute right-3 top-4",children:p.jsx(gf,{className:"h-8 w-8 p-1 bg-neutral-300 dark:bg-neutral-700 text-gray-50 dark:text-neutral-800 rounded-md"})}),p.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-neutral-300 dark:border-neutral-600",children:[p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsxs("button",{onClick:()=>De(!Le),className:`p-1.5 rounded-md transition-colors relative group ${Le?"bg-neutral-600":"hover:bg-neutral-200 dark:hover:bg-neutral-700"}`,title:"Manage Tool Connections",disabled:u!=="ready",children:[p.jsx(Kr,{className:`h-5 w-5 transition-all duration-200 ${L?"text-red-500 dark:text-red-400":Le?"text-white":"text-neutral-500 dark:text-neutral-300 group-hover:text-neutral-700 dark:group-hover:text-neutral-100"}`}),(L||ht>0)&&p.jsx("span",{className:`absolute -top-1 -right-1 text-[10px] rounded-full h-4 w-4 flex items-center justify-center ${L?"bg-white text-red-500 font-bold":"bg-neutral-500 text-white"}`,children:L?"!":ht})]}),p.jsx(em,{reasonEnabled:re,onToggleReason:()=>ue(A=>!A),thinkingBudget:$e,onBudgetChange:qe,min:50,max:16384,step:50})]}),He.url?p.jsx("a",{href:He.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-neutral-500 dark:text-neutral-300 hover:text-neutral-700 dark:hover:text-neutral-100 hover:underline",title:`View ${He.name} on Hugging Face`,children:He.name}):p.jsx("div",{className:"text-sm text-neutral-500 dark:text-neutral-300",children:He.name})]})]})]}),p.jsx("p",{className:"text-xs text-gray-400 text-center mb-3",children:"Disclaimer: Generated content may be inaccurate or false."})]}):p.jsx("div",{className:"fixed w-screen h-screen bg-black z-10 bg-opacity-[92%] text-white text-2xl font-semibold flex justify-center items-center text-center",children:"WebGPU is not supported by this browser :("})}Ip.createRoot(document.getElementById("root")).render(p.jsx(B.StrictMode,{children:p.jsx(rm,{})}));