var tp=Object.defineProperty;var Yu=e=>{throw TypeError(e)};var np=(e,t,n)=>t in e?tp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var G=(e,t,n)=>np(e,typeof t!="symbol"?t+"":t,n),rp=(e,t,n)=>t.has(e)||Yu("Cannot "+n);var Xu=(e,t,n)=>t.has(e)?Yu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var El=(e,t,n)=>(rp(e,t,"access private method"),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function lp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kc={exports:{}},Li={},wc={exports:{}},U={};/** * @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 fl=Symbol.for("react.element"),ip=Symbol.for("react.portal"),op=Symbol.for("react.fragment"),sp=Symbol.for("react.strict_mode"),up=Symbol.for("react.profiler"),ap=Symbol.for("react.provider"),cp=Symbol.for("react.context"),fp=Symbol.for("react.forward_ref"),dp=Symbol.for("react.suspense"),pp=Symbol.for("react.memo"),hp=Symbol.for("react.lazy"),Ku=Symbol.iterator;function mp(e){return e===null||typeof e!="object"?null:(e=Ku&&e[Ku]||e["@@iterator"],typeof e=="function"?e:null)}var Sc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ec=Object.assign,xc={};function or(e,t,n){this.props=e,this.context=t,this.refs=xc,this.updater=n||Sc}or.prototype.isReactComponent={};or.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};or.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _c(){}_c.prototype=or.prototype;function Ps(e,t,n){this.props=e,this.context=t,this.refs=xc,this.updater=n||Sc}var Os=Ps.prototype=new _c;Os.constructor=Ps;Ec(Os,or.prototype);Os.isPureReactComponent=!0;var Zu=Array.isArray,Tc=Object.prototype.hasOwnProperty,Is={current:null},Cc={key:!0,ref:!0,__self:!0,__source:!0};function Nc(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Tc.call(t,r)&&!Cc.hasOwnProperty(r)&&(l[r]=t[r]);var s=arguments.length-2;if(s===1)l.children=n;else if(1>>1,K=C[D];if(0>>1;Dl(V,I))yel(Xe,V)?(C[D]=Xe,C[ye]=I,D=ye):(C[D]=V,C[je]=I,D=je);else if(yel(Xe,I))C[D]=Xe,C[ye]=I,D=ye;else break e}}return E}function l(C,E){var I=C.sortIndex-E.sortIndex;return I!==0?I:C.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var u=[],a=[],m=1,g=null,d=3,y=!1,w=!1,k=!1,O=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(C){for(var E=n(a);E!==null;){if(E.callback===null)r(a);else if(E.startTime<=C)r(a),E.sortIndex=E.expirationTime,t(u,E);else break;E=n(a)}}function v(C){if(k=!1,h(C),!w)if(n(u)!==null)w=!0,ln(T);else{var E=n(a);E!==null&&on(v,E.startTime-C)}}function T(C,E){w=!1,k&&(k=!1,p(L),L=-1),y=!0;var I=d;try{for(h(E),g=n(u);g!==null&&(!(g.expirationTime>E)||C&&!B());){var D=g.callback;if(typeof D=="function"){g.callback=null,d=g.priorityLevel;var K=D(g.expirationTime<=E);E=e.unstable_now(),typeof K=="function"?g.callback=K:g===n(u)&&r(u),h(E)}else r(u);g=n(u)}if(g!==null)var J=!0;else{var je=n(a);je!==null&&on(v,je.startTime-E),J=!1}return J}finally{g=null,d=I,y=!1}}var N=!1,A=null,L=-1,X=5,j=-1;function B(){return!(e.unstable_now()-jC||125D?(C.sortIndex=I,t(a,C),n(u)===null&&C===n(a)&&(k?(p(L),L=-1):k=!0,on(v,I-D))):(C.sortIndex=K,t(u,C),w||y||(w=!0,ln(T))),C},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(C){var E=d;return function(){var I=d;d=E;try{return C.apply(this,arguments)}finally{d=I}}}})(Oc);Pc.exports=Oc;var Np=Pc.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 Rp=M,We=Np;function S(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"),Do=Object.prototype.hasOwnProperty,Ap=/^[: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]*$/,Ju={},bu={};function Lp(e){return Do.call(bu,e)?!0:Do.call(Ju,e)?!1:Ap.test(e)?bu[e]=!0:(Ju[e]=!0,!1)}function Pp(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 Op(e,t,n,r){if(t===null||typeof t>"u"||Pp(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 Le(e,t,n,r,l,i,o){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=i,this.removeEmptyString=o}var ge={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ge[e]=new Le(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ge[t]=new Le(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ge[e]=new Le(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ge[e]=new Le(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){ge[e]=new Le(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ge[e]=new Le(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ge[e]=new Le(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ge[e]=new Le(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ge[e]=new Le(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ds=/[\-:]([a-z])/g;function Ms(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(Ds,Ms);ge[t]=new Le(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(Ds,Ms);ge[t]=new Le(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(Ds,Ms);ge[t]=new Le(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ge[e]=new Le(e,1,!1,e.toLowerCase(),null,!1,!1)});ge.xlinkHref=new Le("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ge[e]=new Le(e,1,!1,e.toLowerCase(),null,!0,!0)});function js(e,t,n,r){var l=ge.hasOwnProperty(t)?ge[t]:null;(l!==null?l.type!==0:r||!(2s||l[o]!==i[s]){var u=` `+l[o].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=s);break}}}finally{no=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Or(e):""}function Ip(e){switch(e.tag){case 5:return Or(e.type);case 16:return Or("Lazy");case 13:return Or("Suspense");case 19:return Or("SuspenseList");case 0:case 2:case 15:return e=ro(e.type,!1),e;case 11:return e=ro(e.type.render,!1),e;case 1:return e=ro(e.type,!0),e;default:return""}}function Uo(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 Mn:return"Fragment";case Dn:return"Portal";case Mo:return"Profiler";case Fs:return"StrictMode";case jo:return"Suspense";case Fo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Dc:return(e.displayName||"Context")+".Consumer";case zc:return(e._context.displayName||"Context")+".Provider";case Us:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $s:return t=e.displayName||null,t!==null?t:Uo(e.type)||"Memo";case Ut:t=e._payload,e=e._init;try{return Uo(e(t))}catch{}}return null}function zp(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 Uo(t);case 8:return t===Fs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function bt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dp(e){var t=jc(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,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Tl(e){e._valueTracker||(e._valueTracker=Dp(e))}function Fc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=jc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function li(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 $o(e,t){var n=t.checked;return re({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ta(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=bt(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 Uc(e,t){t=t.checked,t!=null&&js(e,"checked",t,!1)}function Ho(e,t){Uc(e,t);var n=bt(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")?Bo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Bo(e,t.type,bt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function na(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 Bo(e,t,n){(t!=="number"||li(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ir=Array.isArray;function Yn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Cl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mr={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},Mp=["Webkit","ms","Moz","O"];Object.keys(Mr).forEach(function(e){Mp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mr[t]=Mr[e]})});function Wc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mr.hasOwnProperty(e)&&Mr[e]?(""+t).trim():t+"px"}function Vc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Wc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var jp=re({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 Qo(e,t){if(t){if(jp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function Go(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 Yo=null;function Hs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xo=null,Xn=null,Kn=null;function ia(e){if(e=hl(e)){if(typeof Xo!="function")throw Error(S(280));var t=e.stateNode;t&&(t=Di(t),Xo(e.stateNode,e.type,t))}}function Qc(e){Xn?Kn?Kn.push(e):Kn=[e]:Xn=e}function Gc(){if(Xn){var e=Xn,t=Kn;if(Kn=Xn=null,ia(e),t)for(e=0;e>>=0,e===0?32:31-(Xp(e)/Kp|0)|0}var Nl=64,Rl=4194304;function zr(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 ui(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~l;s!==0?r=zr(s):(i&=o,i!==0&&(r=zr(i)))}else o=n&~l,o!==0?r=zr(o):i!==0&&(r=zr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function dl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function bp(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=Fr),ha=" ",ma=!1;function pf(e,t){switch(e){case"keyup":return Nh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jn=!1;function Ah(e,t){switch(e){case"compositionend":return hf(t);case"keypress":return t.which!==32?null:(ma=!0,ha);case"textInput":return e=t.data,e===ha&&ma?null:e;default:return null}}function Lh(e,t){if(jn)return e==="compositionend"||!Ks&&pf(e,t)?(e=ff(),Yl=Gs=Wt=null,jn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ka(n)}}function vf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kf(){for(var e=window,t=li();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=li(e.document)}return t}function Zs(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 Uh(e){var t=kf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&vf(n.ownerDocument.documentElement,n)){if(r!==null&&Zs(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,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=wa(n,i);var o=wa(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Fn=null,es=null,$r=null,ts=!1;function Sa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ts||Fn==null||Fn!==li(r)||(r=Fn,"selectionStart"in r&&Zs(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}),$r&&el($r,r)||($r=r,r=fi(es,"onSelect"),0Hn||(e.current=ss[Hn],ss[Hn]=null,Hn--)}function Y(e,t){Hn++,ss[Hn]=e.current,e.current=t}var en={},xe=nn(en),ze=nn(!1),yn=en;function er(e,t){var n=e.type.contextTypes;if(!n)return en;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function De(e){return e=e.childContextTypes,e!=null}function pi(){q(ze),q(xe)}function Ra(e,t,n){if(xe.current!==en)throw Error(S(168));Y(xe,t),Y(ze,n)}function Rf(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(S(108,zp(e)||"Unknown",l));return re({},n,r)}function hi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||en,yn=xe.current,Y(xe,e),Y(ze,ze.current),!0}function Aa(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=Rf(e,t,yn),r.__reactInternalMemoizedMergedChildContext=e,q(ze),q(xe),Y(xe,e)):q(ze),Y(ze,n)}var Rt=null,Mi=!1,vo=!1;function Af(e){Rt===null?Rt=[e]:Rt.push(e)}function qh(e){Mi=!0,Af(e)}function rn(){if(!vo&&Rt!==null){vo=!0;var e=0,t=W;try{var n=Rt;for(W=1;e>=o,l-=o,At=1<<32-ct(t)+l|n<L?(X=A,A=null):X=A.sibling;var j=d(p,A,h[L],v);if(j===null){A===null&&(A=X);break}e&&A&&j.alternate===null&&t(p,A),c=i(j,c,L),N===null?T=j:N.sibling=j,N=j,A=X}if(L===h.length)return n(p,A),ee&&cn(p,L),T;if(A===null){for(;LL?(X=A,A=null):X=A.sibling;var B=d(p,A,j.value,v);if(B===null){A===null&&(A=X);break}e&&A&&B.alternate===null&&t(p,A),c=i(B,c,L),N===null?T=B:N.sibling=B,N=B,A=X}if(j.done)return n(p,A),ee&&cn(p,L),T;if(A===null){for(;!j.done;L++,j=h.next())j=g(p,j.value,v),j!==null&&(c=i(j,c,L),N===null?T=j:N.sibling=j,N=j);return ee&&cn(p,L),T}for(A=r(p,A);!j.done;L++,j=h.next())j=y(A,p,L,j.value,v),j!==null&&(e&&j.alternate!==null&&A.delete(j.key===null?L:j.key),c=i(j,c,L),N===null?T=j:N.sibling=j,N=j);return e&&A.forEach(function(Ge){return t(p,Ge)}),ee&&cn(p,L),T}function O(p,c,h,v){if(typeof h=="object"&&h!==null&&h.type===Mn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case _l:e:{for(var T=h.key,N=c;N!==null;){if(N.key===T){if(T=h.type,T===Mn){if(N.tag===7){n(p,N.sibling),c=l(N,h.props.children),c.return=p,p=c;break e}}else if(N.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ut&&Oa(T)===N.type){n(p,N.sibling),c=l(N,h.props),c.ref=xr(p,N,h),c.return=p,p=c;break e}n(p,N);break}else t(p,N);N=N.sibling}h.type===Mn?(c=gn(h.props.children,p.mode,v,h.key),c.return=p,p=c):(v=ti(h.type,h.key,h.props,null,p.mode,v),v.ref=xr(p,c,h),v.return=p,p=v)}return o(p);case Dn:e:{for(N=h.key;c!==null;){if(c.key===N)if(c.tag===4&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){n(p,c.sibling),c=l(c,h.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=Co(h,p.mode,v),c.return=p,p=c}return o(p);case Ut:return N=h._init,O(p,c,N(h._payload),v)}if(Ir(h))return w(p,c,h,v);if(vr(h))return k(p,c,h,v);Dl(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,c!==null&&c.tag===6?(n(p,c.sibling),c=l(c,h),c.return=p,p=c):(n(p,c),c=To(h,p.mode,v),c.return=p,p=c),o(p)):n(p,c)}return O}var nr=If(!0),zf=If(!1),yi=nn(null),vi=null,Vn=null,eu=null;function tu(){eu=Vn=vi=null}function nu(e){var t=yi.current;q(yi),e._currentValue=t}function cs(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qn(e,t){vi=e,eu=Vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ie=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(eu!==e)if(e={context:e,memoizedValue:t,next:null},Vn===null){if(vi===null)throw Error(S(308));Vn=e,vi.dependencies={lanes:0,firstContext:e}}else Vn=Vn.next=e;return t}var pn=null;function ru(e){pn===null?pn=[e]:pn.push(e)}function Df(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ru(t)):(n.next=l.next,l.next=n),t.interleaved=n,zt(e,r)}function zt(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 $t=!1;function lu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(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 Pt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Kt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,zt(e,n)}return l=r.interleaved,l===null?(t.next=t,ru(r)):(t.next=l.next,l.next=t),r.interleaved=t,zt(e,n)}function Kl(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,Ws(e,n)}}function Ia(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,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 ki(e,t,n,r){var l=e.updateQueue;$t=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var u=s,a=u.next;u.next=null,o===null?i=a:o.next=a,o=u;var m=e.alternate;m!==null&&(m=m.updateQueue,s=m.lastBaseUpdate,s!==o&&(s===null?m.firstBaseUpdate=a:s.next=a,m.lastBaseUpdate=u))}if(i!==null){var g=l.baseState;o=0,m=a=u=null,s=i;do{var d=s.lane,y=s.eventTime;if((r&d)===d){m!==null&&(m=m.next={eventTime:y,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var w=e,k=s;switch(d=t,y=n,k.tag){case 1:if(w=k.payload,typeof w=="function"){g=w.call(y,g,d);break e}g=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=k.payload,d=typeof w=="function"?w.call(y,g,d):w,d==null)break e;g=re({},g,d);break e;case 2:$t=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,d=l.effects,d===null?l.effects=[s]:d.push(s))}else y={eventTime:y,lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},m===null?(a=m=y,u=g):m=m.next=y,o|=d;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;d=s,s=d.next,d.next=null,l.lastBaseUpdate=d,l.shared.pending=null}}while(!0);if(m===null&&(u=g),l.baseState=u,l.firstBaseUpdate=a,l.lastBaseUpdate=m,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);wn|=o,e.lanes=o,e.memoizedState=g}}function za(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=wo.transition;wo.transition={};try{e(!1),t()}finally{W=n,wo.transition=r}}function bf(){return tt().memoizedState}function tm(e,t,n){var r=qt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ed(e))td(t,n);else if(n=Df(e,t,n,r),n!==null){var l=Ce();ft(n,e,r,l),nd(n,t,r)}}function nm(e,t,n){var r=qt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ed(e))td(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,n);if(l.hasEagerState=!0,l.eagerState=s,dt(s,o)){var u=t.interleaved;u===null?(l.next=l,ru(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Df(e,t,l,r),n!==null&&(l=Ce(),ft(n,e,r,l),nd(n,t,r))}}function ed(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function td(e,t){Hr=Si=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function nd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ws(e,n)}}var Ei={readContext:et,useCallback:we,useContext:we,useEffect:we,useImperativeHandle:we,useInsertionEffect:we,useLayoutEffect:we,useMemo:we,useReducer:we,useRef:we,useState:we,useDebugValue:we,useDeferredValue:we,useTransition:we,useMutableSource:we,useSyncExternalStore:we,useId:we,unstable_isNewReconciler:!1},rm={readContext:et,useCallback:function(e,t){return yt().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:Ma,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ql(4194308,4,Xf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ql(4194308,4,e,t)},useInsertionEffect:function(e,t){return ql(4,2,e,t)},useMemo:function(e,t){var n=yt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=yt();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=tm.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=yt();return e={current:e},t.memoizedState=e},useState:Da,useDebugValue:du,useDeferredValue:function(e){return yt().memoizedState=e},useTransition:function(){var e=Da(!1),t=e[0];return e=em.bind(null,e[1]),yt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,l=yt();if(ee){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),de===null)throw Error(S(349));kn&30||$f(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ma(Bf.bind(null,r,i,e),[e]),r.flags|=2048,ul(9,Hf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=yt(),t=de.identifierPrefix;if(ee){var n=Lt,r=At;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ol++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[vt]=t,e[rl]=r,dd(e,t,!1,!1),t.stateNode=e;e:{switch(o=Go(n,r),n){case"dialog":Z("cancel",e),Z("close",e),l=r;break;case"iframe":case"object":case"embed":Z("load",e),l=r;break;case"video":case"audio":for(l=0;lir&&(t.flags|=128,r=!0,_r(i,!1),t.lanes=4194304)}else{if(!r)if(e=wi(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),_r(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ee)return Se(t),null}else 2*ie()-i.renderingStartTime>ir&&n!==1073741824&&(t.flags|=128,r=!0,_r(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ie(),t.sibling=null,n=te.current,Y(te,r?n&1|2:n&1),t):(Se(t),null);case 22:case 23:return vu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ue&1073741824&&(Se(t),t.subtreeFlags&6&&(t.flags|=8192)):Se(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function fm(e,t){switch(Js(t),t.tag){case 1:return De(t.type)&&pi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rr(),q(ze),q(xe),su(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ou(t),null;case 13:if(q(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));tr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(te),null;case 4:return rr(),null;case 10:return nu(t.type._context),null;case 22:case 23:return vu(),null;case 24:return null;default:return null}}var jl=!1,Ee=!1,dm=typeof WeakSet=="function"?WeakSet:Set,R=null;function Qn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){le(e,t,r)}else n.current=null}function ks(e,t,n){try{n()}catch(r){le(e,t,r)}}var Ya=!1;function pm(e,t){if(ns=ai,e=kf(),Zs(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,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,s=-1,u=-1,a=0,m=0,g=e,d=null;t:for(;;){for(var y;g!==n||l!==0&&g.nodeType!==3||(s=o+l),g!==i||r!==0&&g.nodeType!==3||(u=o+r),g.nodeType===3&&(o+=g.nodeValue.length),(y=g.firstChild)!==null;)d=g,g=y;for(;;){if(g===e)break t;if(d===n&&++a===l&&(s=o),d===i&&++m===r&&(u=o),(y=g.nextSibling)!==null)break;g=d,d=g.parentNode}g=y}n=s===-1||u===-1?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(rs={focusedElem:e,selectionRange:n},ai=!1,R=t;R!==null;)if(t=R,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,R=e;else for(;R!==null;){t=R;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var k=w.memoizedProps,O=w.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?k:st(t.type,k),O);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(v){le(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,R=e;break}R=t.return}return w=Ya,Ya=!1,w}function Br(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 i=l.destroy;l.destroy=void 0,i!==void 0&&ks(t,n,i)}l=l.next}while(l!==r)}}function Ui(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 ws(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 md(e){var t=e.alternate;t!==null&&(e.alternate=null,md(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vt],delete t[rl],delete t[os],delete t[Kh],delete t[Zh])),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 gd(e){return e.tag===5||e.tag===3||e.tag===4}function Xa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gd(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 Ss(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=di));else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}function Es(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(Es(e,t,n),e=e.sibling;e!==null;)Es(e,t,n),e=e.sibling}var he=null,ut=!1;function Ft(e,t,n){for(n=n.child;n!==null;)yd(e,t,n),n=n.sibling}function yd(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Pi,n)}catch{}switch(n.tag){case 5:Ee||Qn(n,t);case 6:var r=he,l=ut;he=null,Ft(e,t,n),he=r,ut=l,he!==null&&(ut?(e=he,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):he.removeChild(n.stateNode));break;case 18:he!==null&&(ut?(e=he,n=n.stateNode,e.nodeType===8?yo(e.parentNode,n):e.nodeType===1&&yo(e,n),Jr(e)):yo(he,n.stateNode));break;case 4:r=he,l=ut,he=n.stateNode.containerInfo,ut=!0,Ft(e,t,n),he=r,ut=l;break;case 0:case 11:case 14:case 15:if(!Ee&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&ks(n,t,o),l=l.next}while(l!==r)}Ft(e,t,n);break;case 1:if(!Ee&&(Qn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){le(n,t,s)}Ft(e,t,n);break;case 21:Ft(e,t,n);break;case 22:n.mode&1?(Ee=(r=Ee)||n.memoizedState!==null,Ft(e,t,n),Ee=r):Ft(e,t,n);break;default:Ft(e,t,n)}}function Ka(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dm),t.forEach(function(r){var l=Em.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ot(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mm(r/1960))-r,10e?16:e,Vt===null)var r=!1;else{if(e=Vt,Vt=null,Ti=0,$&6)throw Error(S(331));var l=$;for($|=4,R=e.current;R!==null;){var i=R,o=i.child;if(R.flags&16){var s=i.deletions;if(s!==null){for(var u=0;uie()-gu?mn(e,0):mu|=n),Me(e,t)}function Td(e,t){t===0&&(e.mode&1?(t=Rl,Rl<<=1,!(Rl&130023424)&&(Rl=4194304)):t=1);var n=Ce();e=zt(e,t),e!==null&&(dl(e,t,n),Me(e,n))}function Sm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Td(e,n)}function Em(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(S(314))}r!==null&&r.delete(t),Td(e,n)}var Cd;Cd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Ie=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ie=!1,am(e,t,n);Ie=!!(e.flags&131072)}else Ie=!1,ee&&t.flags&1048576&&Lf(t,gi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Jl(e,t),e=t.pendingProps;var l=er(t,xe.current);qn(t,n),l=au(null,t,r,e,l,n);var i=cu();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,De(r)?(i=!0,hi(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,lu(t),l.updater=Fi,t.stateNode=l,l._reactInternals=t,ds(t,r,e,n),t=ms(null,t,r,!0,i,n)):(t.tag=0,ee&&i&&qs(t),Te(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Jl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=_m(r),e=st(r,e),l){case 0:t=hs(null,t,r,e,n);break e;case 1:t=Va(null,t,r,e,n);break e;case 11:t=Ba(null,t,r,e,n);break e;case 14:t=Wa(null,t,r,st(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),hs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Va(e,t,r,l,n);case 3:e:{if(ad(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Mf(e,t),ki(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=lr(Error(S(423)),t),t=Qa(e,t,r,n,l);break e}else if(r!==l){l=lr(Error(S(424)),t),t=Qa(e,t,r,n,l);break e}else for(He=Xt(t.stateNode.containerInfo.firstChild),Be=t,ee=!0,at=null,n=zf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tr(),r===l){t=Dt(e,t,n);break e}Te(e,t,r,n)}t=t.child}return t;case 5:return jf(t),e===null&&as(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,ls(r,l)?o=null:i!==null&&ls(r,i)&&(t.flags|=32),ud(e,t),Te(e,t,o,n),t.child;case 6:return e===null&&as(t),null;case 13:return cd(e,t,n);case 4:return iu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=nr(t,null,r,n):Te(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Ba(e,t,r,l,n);case 7:return Te(e,t,t.pendingProps,n),t.child;case 8:return Te(e,t,t.pendingProps.children,n),t.child;case 12:return Te(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,Y(yi,r._currentValue),r._currentValue=o,i!==null)if(dt(i.value,o)){if(i.children===l.children&&!ze.current){t=Dt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var u=s.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=Pt(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var m=a.pending;m===null?u.next=u:(u.next=m.next,m.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),cs(i.return,n,t),s.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),cs(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Te(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,qn(t,n),l=et(l),r=r(l),t.flags|=1,Te(e,t,r,n),t.child;case 14:return r=t.type,l=st(r,t.pendingProps),l=st(r.type,l),Wa(e,t,r,l,n);case 15:return od(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:st(r,l),Jl(e,t),t.tag=1,De(r)?(e=!0,hi(t)):e=!1,qn(t,n),rd(t,r,l),ds(t,r,l,n),ms(null,t,r,!0,e,n);case 19:return fd(e,t,n);case 22:return sd(e,t,n)}throw Error(S(156,t.tag))};function Nd(e,t){return bc(e,t)}function xm(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 Je(e,t,n,r){return new xm(e,t,n,r)}function wu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _m(e){if(typeof e=="function")return wu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Us)return 11;if(e===$s)return 14}return 2}function Jt(e,t){var n=e.alternate;return n===null?(n=Je(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 ti(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")wu(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Mn:return gn(n.children,l,i,t);case Fs:o=8,l|=8;break;case Mo:return e=Je(12,n,t,l|2),e.elementType=Mo,e.lanes=i,e;case jo:return e=Je(13,n,t,l),e.elementType=jo,e.lanes=i,e;case Fo:return e=Je(19,n,t,l),e.elementType=Fo,e.lanes=i,e;case Mc:return Hi(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case zc:o=10;break e;case Dc:o=9;break e;case Us:o=11;break e;case $s:o=14;break e;case Ut:o=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Je(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function gn(e,t,n,r){return e=Je(7,e,r,t),e.lanes=n,e}function Hi(e,t,n,r){return e=Je(22,e,r,t),e.elementType=Mc,e.lanes=n,e.stateNode={isHidden:!1},e}function To(e,t,n){return e=Je(6,e,null,t),e.lanes=n,e}function Co(e,t,n){return t=Je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Tm(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=io(0),this.expirationTimes=io(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=io(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Su(e,t,n,r,l,i,o,s,u){return e=new Tm(e,t,n,s,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Je(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},lu(i),e}function Cm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Pd)}catch(e){console.error(e)}}Pd(),Lc.exports=Ve;var Pm=Lc.exports,rc=Pm;zo.createRoot=rc.createRoot,zo.hydrateRoot=rc.hydrateRoot;function Om({chats:e,currentChatId:t,onSelectChat:n,onNewChat:r,onDeleteChat:l,server:i,onServerChange:o,apiKey:s,onApiKeyChange:u,models:a,selectedModel:m,onModelChange:g,status:d,onRefreshModels:y}){const[w,k]=M.useState(!1);return _.jsxs("aside",{className:"sidebar",children:[_.jsxs("div",{className:"sidebar-header",children:[_.jsxs("div",{className:"sidebar-brand",children:[_.jsx("span",{className:"brand-icon",children:"⚡"}),_.jsx("span",{className:"brand-name",children:"ForgeLM"})]}),_.jsx("button",{className:"icon-btn",onClick:()=>k(!w),title:"Settings",children:"⚙"})]}),w&&_.jsxs("div",{className:"settings-panel",children:[_.jsx("label",{className:"settings-label",children:"Server URL"}),_.jsx("input",{className:"settings-input",type:"text",value:i,onChange:O=>o(O.target.value),onBlur:y,placeholder:"http://127.0.0.1:8080"}),_.jsx("label",{className:"settings-label",children:"API Key (optional)"}),_.jsx("input",{className:"settings-input",type:"password",value:s,onChange:O=>u(O.target.value),placeholder:"sk-…"})]}),_.jsx("div",{className:"model-section",children:_.jsxs("div",{className:"model-row",children:[_.jsx("div",{className:`status-dot status-${d}`,title:d}),_.jsx("select",{className:"model-select",value:m,onChange:O=>g(O.target.value),disabled:a.length===0,children:a.length===0?_.jsx("option",{value:"",children:"No models"}):a.map(O=>_.jsx("option",{value:O.id,children:O.id},O.id))}),_.jsx("button",{className:"icon-btn",onClick:y,title:"Refresh models",children:"↻"})]})}),_.jsx("div",{className:"sidebar-actions",children:_.jsxs("button",{className:"new-chat-btn",onClick:r,children:[_.jsx("span",{children:"+"})," New Chat"]})}),_.jsxs("nav",{className:"chat-list",children:[e.length===0&&_.jsx("div",{className:"chat-list-empty",children:"No chats yet"}),e.map(O=>_.jsxs("div",{className:`chat-item ${O.id===t?"active":""}`,onClick:()=>n(O.id),children:[_.jsx("span",{className:"chat-item-icon",children:"💬"}),_.jsx("span",{className:"chat-item-title",children:O.title}),_.jsx("button",{className:"chat-item-del",onClick:p=>{p.stopPropagation(),l(O.id)},title:"Delete",children:"✕"})]},O.id))]}),_.jsx("div",{className:"sidebar-footer",children:_.jsx("span",{className:"footer-version",children:"ForgeLM Chat v0.1"})})]})}function Tu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Cn=Tu();function Od(e){Cn=e}const Id=/[&<>"']/,Im=new RegExp(Id.source,"g"),zd=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,zm=new RegExp(zd.source,"g"),Dm={"&":"&","<":"<",">":">",'"':""","'":"'"},lc=e=>Dm[e];function $e(e,t){if(t){if(Id.test(e))return e.replace(Im,lc)}else if(zd.test(e))return e.replace(zm,lc);return e}const Mm=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function jm(e){return e.replace(Mm,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const Fm=/(^|[^\[])\^/g;function Q(e,t){let n=typeof e=="string"?e:e.source;t=t||"";const r={replace:(l,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Fm,"$1"),n=n.replace(l,o),r},getRegex:()=>new RegExp(n,t)};return r}function ic(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const Qr={exec:()=>null};function oc(e,t){const n=e.replace(/\|/g,(i,o,s)=>{let u=!1,a=o;for(;--a>=0&&s[a]==="\\";)u=!u;return u?"|":" |"}),r=n.split(/ \|/);let l=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length{const i=l.match(/^\s+/);if(i===null)return l;const[o]=i;return o.length>=r.length?l.slice(r.length):l}).join(` `)}class Ri{constructor(t){G(this,"options");G(this,"rules");G(this,"lexer");this.options=t||Cn}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:$l(r,` `)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const r=n[0],l=$m(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:l}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let r=n[2].trim();if(/#$/.test(r)){const l=$l(r,"#");(this.options.pedantic||!l||/ $/.test(l))&&(r=l.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){let r=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,` $1`);r=$l(r.replace(/^ *>[ \t]?/gm,""),` `);const l=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(r);return this.lexer.state.top=l,{type:"blockquote",raw:n[0],tokens:i,text:r}}}list(t){let n=this.rules.block.list.exec(t);if(n){let r=n[1].trim();const l=r.length>1,i={type:"list",raw:"",ordered:l,start:l?+r.slice(0,-1):"",loose:!1,items:[]};r=l?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=l?r:"[*+-]");const o=new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`);let s="",u="",a=!1;for(;t;){let m=!1;if(!(n=o.exec(t))||this.rules.block.hr.test(t))break;s=n[0],t=t.substring(s.length);let g=n[2].split(` `,1)[0].replace(/^\t+/,p=>" ".repeat(3*p.length)),d=t.split(` `,1)[0],y=0;this.options.pedantic?(y=2,u=g.trimStart()):(y=n[2].search(/[^ ]/),y=y>4?1:y,u=g.slice(y),y+=n[1].length);let w=!1;if(!g&&/^ *$/.test(d)&&(s+=d+` `,t=t.substring(d.length+1),m=!0),!m){const p=new RegExp(`^ {0,${Math.min(3,y-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),c=new RegExp(`^ {0,${Math.min(3,y-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),h=new RegExp(`^ {0,${Math.min(3,y-1)}}(?:\`\`\`|~~~)`),v=new RegExp(`^ {0,${Math.min(3,y-1)}}#`);for(;t;){const T=t.split(` `,1)[0];if(d=T,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),h.test(d)||v.test(d)||p.test(d)||c.test(t))break;if(d.search(/[^ ]/)>=y||!d.trim())u+=` `+d.slice(y);else{if(w||g.search(/[^ ]/)>=4||h.test(g)||v.test(g)||c.test(g))break;u+=` `+d}!w&&!d.trim()&&(w=!0),s+=T+` `,t=t.substring(T.length+1),g=d.slice(y)}}i.loose||(a?i.loose=!0:/\n *\n *$/.test(s)&&(a=!0));let k=null,O;this.options.gfm&&(k=/^\[[ xX]\] /.exec(u),k&&(O=k[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:s,task:!!k,checked:O,loose:!1,text:u,tokens:[]}),i.raw+=s}i.items[i.items.length-1].raw=s.trimEnd(),i.items[i.items.length-1].text=u.trimEnd(),i.raw=i.raw.trimEnd();for(let m=0;my.type==="space"),d=g.length>0&&g.some(y=>/\n.*\n/.test(y.raw));i.loose=d}if(i.loose)for(let m=0;m$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:l,title:i}}}table(t){const n=this.rules.block.table.exec(t);if(!n||!/[:|]/.test(n[2]))return;const r=oc(n[1]),l=n[2].replace(/^\||\| *$/g,"").split("|"),i=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(` `):[],o={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===l.length){for(const s of l)/^ *-+: *$/.test(s)?o.align.push("right"):/^ *:-+: *$/.test(s)?o.align.push("center"):/^ *:-+ *$/.test(s)?o.align.push("left"):o.align.push(null);for(const s of r)o.header.push({text:s,tokens:this.lexer.inline(s)});for(const s of i)o.rows.push(oc(s,o.header.length).map(u=>({text:u,tokens:this.lexer.inline(u)})));return o}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const r=n[1].charAt(n[1].length-1)===` `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:$e(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;const o=$l(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=Um(n[2],"()");if(o>-1){const u=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,u).trim(),n[3]=""}}let l=n[2],i="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(l);o&&(l=o[1],i=o[3])}else i=n[3]?n[3].slice(1,-1):"";return l=l.trim(),/^$/.test(r)?l=l.slice(1):l=l.slice(1,-1)),sc(n,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer)}}reflink(t,n){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const l=(r[2]||r[1]).replace(/\s+/g," "),i=n[l.toLowerCase()];if(!i){const o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return sc(r,i,r[0],this.lexer)}}emStrong(t,n,r=""){let l=this.rules.inline.emStrongLDelim.exec(t);if(!l||l[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(l[1]||l[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const o=[...l[0]].length-1;let s,u,a=o,m=0;const g=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,n=n.slice(-1*t.length+o);(l=g.exec(n))!=null;){if(s=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!s)continue;if(u=[...s].length,l[3]||l[4]){a+=u;continue}else if((l[5]||l[6])&&o%3&&!((o+u)%3)){m+=u;continue}if(a-=u,a>0)continue;u=Math.min(u,u+a+m);const d=[...l[0]][0].length,y=t.slice(0,o+l.index+d+u);if(Math.min(o,u)%2){const k=y.slice(1,-1);return{type:"em",raw:y,text:k,tokens:this.lexer.inlineTokens(k)}}const w=y.slice(2,-2);return{type:"strong",raw:y,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let r=n[2].replace(/\n/g," ");const l=/[^ ]/.test(r),i=/^ /.test(r)&&/ $/.test(r);return l&&i&&(r=r.substring(1,r.length-1)),r=$e(r,!0),{type:"codespan",raw:n[0],text:r}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let r,l;return n[2]==="@"?(r=$e(n[1]),l="mailto:"+r):(r=$e(n[1]),l=r),{type:"link",raw:n[0],text:r,href:l,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let n;if(n=this.rules.inline.url.exec(t)){let l,i;if(n[2]==="@")l=$e(n[0]),i="mailto:"+l;else{let o;do o=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(o!==n[0]);l=$e(n[0]),n[1]==="www."?i="http://"+n[0]:i=n[0]}return{type:"link",raw:n[0],text:l,href:i,tokens:[{type:"text",raw:l,text:l}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){let r;return this.lexer.state.inRawBlock?r=n[0]:r=$e(n[0]),{type:"text",raw:n[0],text:r}}}}const Hm=/^(?: *(?:\n|$))+/,Bm=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Wm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Dd=/(?:[*+-]|\d{1,9}[.)])/,Md=Q(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Dd).replace(/blockCode/g,/ {4}/).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/).getRegex(),Cu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qm=/^[^\n]+/,Nu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Gm=Q(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Nu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ym=Q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Dd).getRegex(),Gi="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",Ru=/|$))/,Xm=Q("^ {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",Ru).replace("tag",Gi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jd=Q(Cu).replace("hr",gl).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",Gi).getRegex(),Km=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jd).getRegex(),Au={blockquote:Km,code:Bm,def:Gm,fences:Wm,heading:Vm,hr:gl,html:Xm,lheading:Md,list:Ym,newline:Hm,paragraph:jd,table:Qr,text:Qm},uc=Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Gi).getRegex(),Zm={...Au,table:uc,paragraph:Q(Cu).replace("hr",gl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uc).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",Gi).getRegex()},qm={...Au,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ru).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:Qr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(Cu).replace("hr",gl).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",Md).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Fd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Jm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ud=/^( {2,}|\\)\n(?!\s*$)/,bm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,ng=Q(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,yl).getRegex(),rg=Q("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,yl).getRegex(),lg=Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,yl).getRegex(),ig=Q(/\\([punct])/,"gu").replace(/punct/g,yl).getRegex(),og=Q(/^<(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(),sg=Q(Ru).replace("(?:-->|$)","-->").getRegex(),ug=Q("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",sg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ai=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ag=Q(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ai).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$d=Q(/^!?\[(label)\]\[(ref)\]/).replace("label",Ai).replace("ref",Nu).getRegex(),Hd=Q(/^!?\[(ref)\](?:\[\])?/).replace("ref",Nu).getRegex(),cg=Q("reflink|nolink(?!\\()","g").replace("reflink",$d).replace("nolink",Hd).getRegex(),Lu={_backpedal:Qr,anyPunctuation:ig,autolink:og,blockSkip:tg,br:Ud,code:Jm,del:Qr,emStrongLDelim:ng,emStrongRDelimAst:rg,emStrongRDelimUnd:lg,escape:Fd,link:ag,nolink:Hd,punctuation:eg,reflink:$d,reflinkSearch:cg,tag:ug,text:bm,url:Qr},fg={...Lu,link:Q(/^!?\[(label)\]\((.*?)\)/).replace("label",Ai).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ai).getRegex()},Ns={...Lu,escape:Q(Fd).replace("])","~|])").getRegex(),url:Q(/^((?: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\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\u+" ".repeat(a.length));let r,l,i,o;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(r=s.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=` `:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length),l=n[n.length-1],l&&(l.type==="paragraph"||l.type==="text")?(l.raw+=` `+r.raw,l.text+=` `+r.text,this.inlineQueue[this.inlineQueue.length-1].src=l.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length),l=n[n.length-1],l&&(l.type==="paragraph"||l.type==="text")?(l.raw+=` `+r.raw,l.text+=` `+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=l.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(i=t,this.options.extensions&&this.options.extensions.startBlock){let s=1/0;const u=t.slice(1);let a;this.options.extensions.startBlock.forEach(m=>{a=m.call({lexer:this},u),typeof a=="number"&&a>=0&&(s=Math.min(s,a))}),s<1/0&&s>=0&&(i=t.substring(0,s+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){l=n[n.length-1],o&&l.type==="paragraph"?(l.raw+=` `+r.raw,l.text+=` `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):n.push(r),o=i.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length),l=n[n.length-1],l&&l.type==="text"?(l.raw+=` `+r.raw,l.text+=` `+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):n.push(r);continue}if(t){const s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let r,l,i,o=t,s,u,a;if(this.tokens.links){const m=Object.keys(this.tokens.links);if(m.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)m.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,s.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(u||(a=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(m=>(r=m.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(t)){t=t.substring(r.raw.length),l=n[n.length-1],l&&r.type==="text"&&l.type==="text"?(l.raw+=r.raw,l.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(r.raw.length),l=n[n.length-1],l&&r.type==="text"&&l.type==="text"?(l.raw+=r.raw,l.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(t,o,a)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(t)){t=t.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(t))){t=t.substring(r.raw.length),n.push(r);continue}if(i=t,this.options.extensions&&this.options.extensions.startInline){let m=1/0;const g=t.slice(1);let d;this.options.extensions.startInline.forEach(y=>{d=y.call({lexer:this},g),typeof d=="number"&&d>=0&&(m=Math.min(m,d))}),m<1/0&&m>=0&&(i=t.substring(0,m+1))}if(r=this.tokenizer.inlineText(i)){t=t.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(a=r.raw.slice(-1)),u=!0,l=n[n.length-1],l&&l.type==="text"?(l.raw+=r.raw,l.text+=r.text):n.push(r);continue}if(t){const m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}}class cl{constructor(t){G(this,"options");this.options=t||Cn}code(t,n,r){var i;const l=(i=(n||"").match(/^\S*/))==null?void 0:i[0];return t=t.replace(/\n$/,"")+` `,l?'
'+(r?t:$e(t,!0))+`
`:"
"+(r?t:$e(t,!0))+`
`}blockquote(t){return`
${t}
`}html(t,n){return t}heading(t,n,r){return`${t} `}hr(){return`
`}list(t,n,r){const l=n?"ol":"ul",i=n&&r!==1?' start="'+r+'"':"";return"<"+l+i+`> `+t+" `}listitem(t,n,r){return`
  • ${t}
  • `}checkbox(t){return"'}paragraph(t){return`

    ${t}

    `}table(t,n){return n&&(n=`${n}`),` `+t+` `+n+`
    `}tablerow(t){return` ${t} `}tablecell(t,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+t+` `}strong(t){return`${t}`}em(t){return`${t}`}codespan(t){return`${t}`}br(){return"
    "}del(t){return`${t}`}link(t,n,r){const l=ic(t);if(l===null)return r;t=l;let i='
    ",i}image(t,n,r){const l=ic(t);if(l===null)return r;t=l;let i=`${r}0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=O+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&d.tokens[0].tokens[0].type==="text"&&(d.tokens[0].tokens[0].text=O+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:O+" "}):k+=O+" "}k+=this.parse(d.tokens,a),m+=this.renderer.listitem(k,w,!!y)}r+=this.renderer.list(m,s,u);continue}case"html":{const o=i;r+=this.renderer.html(o.text,o.block);continue}case"paragraph":{const o=i;r+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{let o=i,s=o.tokens?this.parseInline(o.tokens):o.text;for(;l+1{const a=s[u].flat(1/0);r=r.concat(this.walkTokens(a,n))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const l={...r};if(l.async=this.defaults.async||l.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const o=n.renderers[i.name];o?n.renderers[i.name]=function(...s){let u=i.renderer.apply(this,s);return u===!1&&(u=o.apply(this,s)),u}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=n[i.level];o?o.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),l.extensions=n),r.renderer){const i=this.defaults.renderer||new cl(this.defaults);for(const o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(o==="options")continue;const s=o,u=r.renderer[s],a=i[s];i[s]=(...m)=>{let g=u.apply(i,m);return g===!1&&(g=a.apply(i,m)),g||""}}l.renderer=i}if(r.tokenizer){const i=this.defaults.tokenizer||new Ri(this.defaults);for(const o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const s=o,u=r.tokenizer[s],a=i[s];i[s]=(...m)=>{let g=u.apply(i,m);return g===!1&&(g=a.apply(i,m)),g}}l.tokenizer=i}if(r.hooks){const i=this.defaults.hooks||new Gr;for(const o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(o==="options")continue;const s=o,u=r.hooks[s],a=i[s];Gr.passThroughHooks.has(o)?i[s]=m=>{if(this.defaults.async)return Promise.resolve(u.call(i,m)).then(d=>a.call(i,d));const g=u.call(i,m);return a.call(i,g)}:i[s]=(...m)=>{let g=u.apply(i,m);return g===!1&&(g=a.apply(i,m)),g}}l.hooks=i}if(r.walkTokens){const i=this.defaults.walkTokens,o=r.walkTokens;l.walkTokens=function(s){let u=[];return u.push(o.call(this,s)),i&&(u=u.concat(i.call(this,s))),u}}this.defaults={...this.defaults,...l}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return kt.lex(t,n??this.defaults)}parser(t,n){return wt.parse(t,n??this.defaults)}}xn=new WeakSet,Rs=function(t,n){return(r,l)=>{const i={...l},o={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);const s=El(this,xn,Bd).call(this,!!o.silent,!!o.async);if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(u=>t(u,o)).then(u=>o.hooks?o.hooks.processAllTokens(u):u).then(u=>o.walkTokens?Promise.all(this.walkTokens(u,o.walkTokens)).then(()=>u):u).then(u=>n(u,o)).then(u=>o.hooks?o.hooks.postprocess(u):u).catch(s);try{o.hooks&&(r=o.hooks.preprocess(r));let u=t(r,o);o.hooks&&(u=o.hooks.processAllTokens(u)),o.walkTokens&&this.walkTokens(u,o.walkTokens);let a=n(u,o);return o.hooks&&(a=o.hooks.postprocess(a)),a}catch(u){return s(u)}}},Bd=function(t,n){return r=>{if(r.message+=` Please report this to https://github.com/markedjs/marked.`,t){const l="

    An error occurred:

    "+$e(r.message+"",!0)+"
    ";return n?Promise.resolve(l):l}if(n)return Promise.reject(r);throw r}};const En=new pg;function H(e,t){return En.parse(e,t)}H.options=H.setOptions=function(e){return En.setOptions(e),H.defaults=En.defaults,Od(H.defaults),H};H.getDefaults=Tu;H.defaults=Cn;H.use=function(...e){return En.use(...e),H.defaults=En.defaults,Od(H.defaults),H};H.walkTokens=function(e,t){return En.walkTokens(e,t)};H.parseInline=En.parseInline;H.Parser=wt;H.parser=wt.parse;H.Renderer=cl;H.TextRenderer=Pu;H.Lexer=kt;H.lexer=kt.lex;H.Tokenizer=Ri;H.Hooks=Gr;H.parse=H;H.options;H.setOptions;H.use;H.walkTokens;H.parseInline;wt.parse;kt.lex;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:Wd,setPrototypeOf:ac,isFrozen:hg,getPrototypeOf:mg,getOwnPropertyDescriptor:gg}=Object;let{freeze:Ne,seal:nt,create:ni}=Object,{apply:As,construct:Ls}=typeof Reflect<"u"&&Reflect;Ne||(Ne=function(t){return t});nt||(nt=function(t){return t});As||(As=function(t,n){for(var r=arguments.length,l=new Array(r>2?r-2:0),i=2;i1?n-1:0),l=1;l1?n-1:0),l=1;l2&&arguments[2]!==void 0?arguments[2]:ri;ac&&ac(e,null);let r=t.length;for(;r--;){let l=t[r];if(typeof l=="string"){const i=n(l);i!==l&&(hg(t)||(t[r]=i),l=i)}e[l]=!0}return e}function Eg(e){for(let t=0;t/gm),Ng=nt(/\$\{[\w\W]*/gm),Rg=nt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ag=nt(/^aria-[\-\w]+$/),Vd=nt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lg=nt(/^(?:\w+script|data):/i),Pg=nt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qd=nt(/^html$/i),Og=nt(/^[a-z][.\w]*(-[.\w]+)+$/i);var mc=Object.freeze({__proto__:null,ARIA_ATTR:Ag,ATTR_WHITESPACE:Pg,CUSTOM_ELEMENT:Og,DATA_ATTR:Rg,DOCTYPE_NAME:Qd,ERB_EXPR:Cg,IS_ALLOWED_URI:Vd,IS_SCRIPT_OR_DATA:Lg,MUSTACHE_EXPR:Tg,TMPLIT_EXPR:Ng});const Pr={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ig=function(){return typeof window>"u"?null:window},zg=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(r=n.getAttribute(l));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},gc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Gd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ig();const t=z=>Gd(z);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==Pr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,l=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:u,NodeFilter:a,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:d,trustedTypes:y}=e,w=u.prototype,k=Lr(w,"cloneNode"),O=Lr(w,"remove"),p=Lr(w,"nextSibling"),c=Lr(w,"childNodes"),h=Lr(w,"parentNode");if(typeof o=="function"){const z=n.createElement("template");z.content&&z.content.ownerDocument&&(n=z.content.ownerDocument)}let v,T="";const{implementation:N,createNodeIterator:A,createDocumentFragment:L,getElementsByTagName:X}=n,{importNode:j}=r;let B=gc();t.isSupported=typeof Wd=="function"&&typeof h=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ge,ERB_EXPR:Ye,TMPLIT_EXPR:xt,DATA_ATTR:ar,ARIA_ATTR:ln,IS_SCRIPT_OR_DATA:on,ATTR_WHITESPACE:C,CUSTOM_ELEMENT:E}=mc;let{IS_ALLOWED_URI:I}=mc,D=null;const K=F({},[...fc,...Ao,...Lo,...Po,...dc]);let J=null;const je=F({},[...pc,...Oo,...hc,...Wl]);let V=Object.seal(ni(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}})),ye=null,Xe=null;const rt=Object.seal(ni(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let cr=!0,Nn=!0,fr=!1,Ke=!0,lt=!1,it=!0,ve=!1,dr=!1,sn=!1,jt=!1,Rn=!1,un=!1,pr=!0,hr=!1;const mr="user-content-";let An=!0,gr=!1,Ln={},pt=null;const Yi=F({},["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 Ou=null;const Iu=F({},["audio","video","img","source","image","track"]);let Xi=null;const zu=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vl="http://www.w3.org/1998/Math/MathML",kl="http://www.w3.org/2000/svg",_t="http://www.w3.org/1999/xhtml";let Pn=_t,Ki=!1,Zi=null;const Xd=F({},[vl,kl,_t],No);let wl=F({},["mi","mo","mn","ms","mtext"]),Sl=F({},["annotation-xml"]);const Kd=F({},["title","style","font","a","script"]);let yr=null;const Zd=["application/xhtml+xml","text/html"],qd="text/html";let ue=null,On=null;const Jd=n.createElement("form"),Du=function(f){return f instanceof RegExp||f instanceof Function},qi=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(On&&On===f)){if((!f||typeof f!="object")&&(f={}),f=gt(f),yr=Zd.indexOf(f.PARSER_MEDIA_TYPE)===-1?qd:f.PARSER_MEDIA_TYPE,ue=yr==="application/xhtml+xml"?No:ri,D=Fe(f,"ALLOWED_TAGS")?F({},f.ALLOWED_TAGS,ue):K,J=Fe(f,"ALLOWED_ATTR")?F({},f.ALLOWED_ATTR,ue):je,Zi=Fe(f,"ALLOWED_NAMESPACES")?F({},f.ALLOWED_NAMESPACES,No):Xd,Xi=Fe(f,"ADD_URI_SAFE_ATTR")?F(gt(zu),f.ADD_URI_SAFE_ATTR,ue):zu,Ou=Fe(f,"ADD_DATA_URI_TAGS")?F(gt(Iu),f.ADD_DATA_URI_TAGS,ue):Iu,pt=Fe(f,"FORBID_CONTENTS")?F({},f.FORBID_CONTENTS,ue):Yi,ye=Fe(f,"FORBID_TAGS")?F({},f.FORBID_TAGS,ue):gt({}),Xe=Fe(f,"FORBID_ATTR")?F({},f.FORBID_ATTR,ue):gt({}),Ln=Fe(f,"USE_PROFILES")?f.USE_PROFILES:!1,cr=f.ALLOW_ARIA_ATTR!==!1,Nn=f.ALLOW_DATA_ATTR!==!1,fr=f.ALLOW_UNKNOWN_PROTOCOLS||!1,Ke=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,lt=f.SAFE_FOR_TEMPLATES||!1,it=f.SAFE_FOR_XML!==!1,ve=f.WHOLE_DOCUMENT||!1,jt=f.RETURN_DOM||!1,Rn=f.RETURN_DOM_FRAGMENT||!1,un=f.RETURN_TRUSTED_TYPE||!1,sn=f.FORCE_BODY||!1,pr=f.SANITIZE_DOM!==!1,hr=f.SANITIZE_NAMED_PROPS||!1,An=f.KEEP_CONTENT!==!1,gr=f.IN_PLACE||!1,I=f.ALLOWED_URI_REGEXP||Vd,Pn=f.NAMESPACE||_t,wl=f.MATHML_TEXT_INTEGRATION_POINTS||wl,Sl=f.HTML_INTEGRATION_POINTS||Sl,V=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Du(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Du(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),lt&&(Nn=!1),Rn&&(jt=!0),Ln&&(D=F({},dc),J=ni(null),Ln.html===!0&&(F(D,fc),F(J,pc)),Ln.svg===!0&&(F(D,Ao),F(J,Oo),F(J,Wl)),Ln.svgFilters===!0&&(F(D,Lo),F(J,Oo),F(J,Wl)),Ln.mathMl===!0&&(F(D,Po),F(J,hc),F(J,Wl))),Fe(f,"ADD_TAGS")||(rt.tagCheck=null),Fe(f,"ADD_ATTR")||(rt.attributeCheck=null),f.ADD_TAGS&&(typeof f.ADD_TAGS=="function"?rt.tagCheck=f.ADD_TAGS:(D===K&&(D=gt(D)),F(D,f.ADD_TAGS,ue))),f.ADD_ATTR&&(typeof f.ADD_ATTR=="function"?rt.attributeCheck=f.ADD_ATTR:(J===je&&(J=gt(J)),F(J,f.ADD_ATTR,ue))),f.ADD_URI_SAFE_ATTR&&F(Xi,f.ADD_URI_SAFE_ATTR,ue),f.FORBID_CONTENTS&&(pt===Yi&&(pt=gt(pt)),F(pt,f.FORBID_CONTENTS,ue)),f.ADD_FORBID_CONTENTS&&(pt===Yi&&(pt=gt(pt)),F(pt,f.ADD_FORBID_CONTENTS,ue)),An&&(D["#text"]=!0),ve&&F(D,["html","head","body"]),D.table&&(F(D,["tbody"]),delete ye.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=f.TRUSTED_TYPES_POLICY,T=v.createHTML("")}else v===void 0&&(v=zg(y,l)),v!==null&&typeof T=="string"&&(T=v.createHTML(""));Ne&&Ne(f),On=f}},Mu=F({},[...Ao,...Lo,...xg]),ju=F({},[...Po,..._g]),bd=function(f){let x=h(f);(!x||!x.tagName)&&(x={namespaceURI:Pn,tagName:"template"});const P=ri(f.tagName),b=ri(x.tagName);return Zi[f.namespaceURI]?f.namespaceURI===kl?x.namespaceURI===_t?P==="svg":x.namespaceURI===vl?P==="svg"&&(b==="annotation-xml"||wl[b]):!!Mu[P]:f.namespaceURI===vl?x.namespaceURI===_t?P==="math":x.namespaceURI===kl?P==="math"&&Sl[b]:!!ju[P]:f.namespaceURI===_t?x.namespaceURI===kl&&!Sl[b]||x.namespaceURI===vl&&!wl[b]?!1:!ju[P]&&(Kd[P]||!Mu[P]):!!(yr==="application/xhtml+xml"&&Zi[f.namespaceURI]):!1},ht=function(f){Nr(t.removed,{element:f});try{h(f).removeChild(f)}catch{O(f)}},an=function(f,x){try{Nr(t.removed,{attribute:x.getAttributeNode(f),from:x})}catch{Nr(t.removed,{attribute:null,from:x})}if(x.removeAttribute(f),f==="is")if(jt||Rn)try{ht(x)}catch{}else try{x.setAttribute(f,"")}catch{}},Fu=function(f){let x=null,P=null;if(sn)f=""+f;else{const oe=Ro(f,/^[\r\n\t ]+/);P=oe&&oe[0]}yr==="application/xhtml+xml"&&Pn===_t&&(f=''+f+"");const b=v?v.createHTML(f):f;if(Pn===_t)try{x=new d().parseFromString(b,yr)}catch{}if(!x||!x.documentElement){x=N.createDocument(Pn,"template",null);try{x.documentElement.innerHTML=Ki?T:b}catch{}}const ke=x.body||x.documentElement;return f&&P&&ke.insertBefore(n.createTextNode(P),ke.childNodes[0]||null),Pn===_t?X.call(x,ve?"html":"body")[0]:ve?x.documentElement:ke},Uu=function(f){return A.call(f.ownerDocument||f,f,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},Ji=function(f){return f instanceof g&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof m)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},$u=function(f){return typeof s=="function"&&f instanceof s};function Tt(z,f,x){Bl(z,P=>{P.call(t,f,x,On)})}const Hu=function(f){let x=null;if(Tt(B.beforeSanitizeElements,f,null),Ji(f))return ht(f),!0;const P=ue(f.nodeName);if(Tt(B.uponSanitizeElement,f,{tagName:P,allowedTags:D}),it&&f.hasChildNodes()&&!$u(f.firstElementChild)&&_e(/<[/\w!]/g,f.innerHTML)&&_e(/<[/\w!]/g,f.textContent)||f.nodeType===Pr.progressingInstruction||it&&f.nodeType===Pr.comment&&_e(/<[/\w]/g,f.data))return ht(f),!0;if(!(rt.tagCheck instanceof Function&&rt.tagCheck(P))&&(!D[P]||ye[P])){if(!ye[P]&&Wu(P)&&(V.tagNameCheck instanceof RegExp&&_e(V.tagNameCheck,P)||V.tagNameCheck instanceof Function&&V.tagNameCheck(P)))return!1;if(An&&!pt[P]){const b=h(f)||f.parentNode,ke=c(f)||f.childNodes;if(ke&&b){const oe=ke.length;for(let Pe=oe-1;Pe>=0;--Pe){const Ct=k(ke[Pe],!0);Ct.__removalCount=(f.__removalCount||0)+1,b.insertBefore(Ct,p(f))}}}return ht(f),!0}return f instanceof u&&!bd(f)||(P==="noscript"||P==="noembed"||P==="noframes")&&_e(/<\/no(script|embed|frames)/i,f.innerHTML)?(ht(f),!0):(lt&&f.nodeType===Pr.text&&(x=f.textContent,Bl([Ge,Ye,xt],b=>{x=Rr(x,b," ")}),f.textContent!==x&&(Nr(t.removed,{element:f.cloneNode()}),f.textContent=x)),Tt(B.afterSanitizeElements,f,null),!1)},Bu=function(f,x,P){if(Xe[x]||pr&&(x==="id"||x==="name")&&(P in n||P in Jd))return!1;if(!(Nn&&!Xe[x]&&_e(ar,x))){if(!(cr&&_e(ln,x))){if(!(rt.attributeCheck instanceof Function&&rt.attributeCheck(x,f))){if(!J[x]||Xe[x]){if(!(Wu(f)&&(V.tagNameCheck instanceof RegExp&&_e(V.tagNameCheck,f)||V.tagNameCheck instanceof Function&&V.tagNameCheck(f))&&(V.attributeNameCheck instanceof RegExp&&_e(V.attributeNameCheck,x)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(x,f))||x==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&_e(V.tagNameCheck,P)||V.tagNameCheck instanceof Function&&V.tagNameCheck(P))))return!1}else if(!Xi[x]){if(!_e(I,Rr(P,C,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&f!=="script"&&kg(P,"data:")===0&&Ou[f])){if(!(fr&&!_e(on,Rr(P,C,"")))){if(P)return!1}}}}}}}return!0},Wu=function(f){return f!=="annotation-xml"&&Ro(f,E)},Vu=function(f){Tt(B.beforeSanitizeAttributes,f,null);const{attributes:x}=f;if(!x||Ji(f))return;const P={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let b=x.length;for(;b--;){const ke=x[b],{name:oe,namespaceURI:Pe,value:Ct}=ke,In=ue(oe),bi=Ct;let pe=oe==="value"?bi:wg(bi);if(P.attrName=In,P.attrValue=pe,P.keepAttr=!0,P.forceKeepAttr=void 0,Tt(B.uponSanitizeAttribute,f,P),pe=P.attrValue,hr&&(In==="id"||In==="name")&&(an(oe,f),pe=mr+pe),it&&_e(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pe)){an(oe,f);continue}if(In==="attributename"&&Ro(pe,"href")){an(oe,f);continue}if(P.forceKeepAttr)continue;if(!P.keepAttr){an(oe,f);continue}if(!Ke&&_e(/\/>/i,pe)){an(oe,f);continue}lt&&Bl([Ge,Ye,xt],Gu=>{pe=Rr(pe,Gu," ")});const Qu=ue(f.nodeName);if(!Bu(Qu,In,pe)){an(oe,f);continue}if(v&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Pe)switch(y.getAttributeType(Qu,In)){case"TrustedHTML":{pe=v.createHTML(pe);break}case"TrustedScriptURL":{pe=v.createScriptURL(pe);break}}if(pe!==bi)try{Pe?f.setAttributeNS(Pe,oe,pe):f.setAttribute(oe,pe),Ji(f)?ht(f):cc(t.removed)}catch{an(oe,f)}}Tt(B.afterSanitizeAttributes,f,null)},ep=function z(f){let x=null;const P=Uu(f);for(Tt(B.beforeSanitizeShadowDOM,f,null);x=P.nextNode();)Tt(B.uponSanitizeShadowNode,x,null),Hu(x),Vu(x),x.content instanceof i&&z(x.content);Tt(B.afterSanitizeShadowDOM,f,null)};return t.sanitize=function(z){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,P=null,b=null,ke=null;if(Ki=!z,Ki&&(z=""),typeof z!="string"&&!$u(z))if(typeof z.toString=="function"){if(z=z.toString(),typeof z!="string")throw Ar("dirty is not a string, aborting")}else throw Ar("toString is not a function");if(!t.isSupported)return z;if(dr||qi(f),t.removed=[],typeof z=="string"&&(gr=!1),gr){if(z.nodeName){const Ct=ue(z.nodeName);if(!D[Ct]||ye[Ct])throw Ar("root node is forbidden and cannot be sanitized in-place")}}else if(z instanceof s)x=Fu(""),P=x.ownerDocument.importNode(z,!0),P.nodeType===Pr.element&&P.nodeName==="BODY"||P.nodeName==="HTML"?x=P:x.appendChild(P);else{if(!jt&&!lt&&!ve&&z.indexOf("<")===-1)return v&&un?v.createHTML(z):z;if(x=Fu(z),!x)return jt?null:un?T:""}x&&sn&&ht(x.firstChild);const oe=Uu(gr?z:x);for(;b=oe.nextNode();)Hu(b),Vu(b),b.content instanceof i&&ep(b.content);if(gr)return z;if(jt){if(Rn)for(ke=L.call(x.ownerDocument);x.firstChild;)ke.appendChild(x.firstChild);else ke=x;return(J.shadowroot||J.shadowrootmode)&&(ke=j.call(r,ke,!0)),ke}let Pe=ve?x.outerHTML:x.innerHTML;return ve&&D["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&_e(Qd,x.ownerDocument.doctype.name)&&(Pe=" `+Pe),lt&&Bl([Ge,Ye,xt],Ct=>{Pe=Rr(Pe,Ct," ")}),v&&un?v.createHTML(Pe):Pe},t.setConfig=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qi(z),dr=!0},t.clearConfig=function(){On=null,dr=!1},t.isValidAttribute=function(z,f,x){On||qi({});const P=ue(z),b=ue(f);return Bu(P,b,x)},t.addHook=function(z,f){typeof f=="function"&&Nr(B[z],f)},t.removeHook=function(z,f){if(f!==void 0){const x=yg(B[z],f);return x===-1?void 0:vg(B[z],x,1)[0]}return cc(B[z])},t.removeHooks=function(z){B[z]=[]},t.removeAllHooks=function(){B=gc()},t}var Dg=Gd();let Io=!1;async function Mg(){if(Io||window.hljs){Io=!0;return}const e=["javascript","typescript","python","rust","bash","json","sql","css","xml","go","cpp","c"],t="https://cdn.jsdelivr.net/npm/highlight.js@11/lib";await yc(`${t}/core.min.js`),await Promise.all(e.map(n=>yc(`${t}/languages/${n}.min.js`))),Io=!0}function yc(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`)){t();return}const r=document.createElement("script");r.src=e,r.onload=()=>t(),r.onerror=n,document.head.appendChild(r)})}const Yd=new cl;Yd.code=function(e,t){var i;const n=t&&((i=window.hljs)!=null&&i.getLanguage(t))?t:"plaintext";let r=e;try{window.hljs&&(r=n!=="plaintext"?window.hljs.highlight(e,{language:n}).value:window.hljs.highlightAuto(e).value)}catch{}const l=e.replace(/&/g,"&").replace(/'/g,"'");return`
    ${n}
    ${r}
    `};H.setOptions({breaks:!0,gfm:!0});H.use({renderer:Yd});function vc(e){const t=H.parse(e);return Dg.sanitize(t,{ADD_TAGS:["div","span","button","pre","code"],ADD_ATTR:["class","data-code"],FORCE_BODY:!1})}function jg({message:e,onDelete:t,onEditAndResend:n,onEditAssistant:r,renderMarkdown:l}){const[i,o]=M.useState(!1),[s,u]=M.useState(e.content),[a,m]=M.useState(!1),g=M.useRef(null),d=M.useRef(null);M.useEffect(()=>{if(!d.current)return;d.current.querySelectorAll(".copy-code-btn").forEach(h=>{h.onclick=()=>{const v=h.getAttribute("data-code")||"";navigator.clipboard.writeText(v).then(()=>{h.textContent="Copied!",h.style.color="var(--success)",setTimeout(()=>{h.textContent="Copy",h.style.color=""},2e3)})}})});const y=()=>{const c=g.current;c&&(c.style.height="auto",c.style.height=Math.min(c.scrollHeight,300)+"px")},w=()=>{u(e.content),o(!0),setTimeout(()=>{var c;(c=g.current)==null||c.focus(),y()},0)},k=()=>o(!1),O=c=>{const h=s.trim();h&&(o(!1),c&&n?n(e,h):r&&r(e.id,h))},p=()=>{navigator.clipboard.writeText(e.content).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)})};return _.jsx("div",{className:`msg-wrapper ${e.role}`,children:i?_.jsxs("div",{className:"msg-edit-container",children:[_.jsx("textarea",{ref:g,className:"msg-edit-textarea",value:s,onChange:c=>{u(c.target.value),y()},onKeyDown:c=>{c.key==="Escape"&&k(),c.key==="Enter"&&c.ctrlKey&&O(!1)}}),_.jsxs("div",{className:"msg-edit-actions",children:[n&&_.jsx("button",{className:"btn-primary",onClick:()=>O(!0),children:"Save & Resend"}),_.jsx("button",{className:"btn-secondary",onClick:()=>O(!1),children:"Save only"}),_.jsx("button",{className:"btn-ghost",onClick:k,children:"Cancel"})]})]}):_.jsxs(_.Fragment,{children:[e.role==="assistant"?_.jsx("div",{ref:d,className:"msg-bubble",dangerouslySetInnerHTML:{__html:l(e.content)}}):_.jsx("div",{className:"msg-bubble",children:e.content}),_.jsxs("div",{className:"msg-actions",children:[_.jsx("button",{className:`action-btn ${a?"copied":""}`,onClick:p,children:a?"✓ Copied":"⎘ Copy"}),_.jsxs("button",{className:"action-btn",onClick:w,children:["✎ Edit",n?" & Resend":""]}),_.jsx("button",{className:"action-btn danger",onClick:()=>t(e.id),children:"✕ Delete"})]})]})})}const Fg=20;function Ug({db:e,chatId:t,server:n,apiKey:r,model:l,onChatCreated:i,onChatUpdated:o}){const[s,u]=M.useState([]),[a,m]=M.useState(""),[g,d]=M.useState(!1),[y,w]=M.useState(null),[k,O]=M.useState(null),[p,c]=M.useState(!0),[h,v]=M.useState(!0),T=M.useRef(null),N=M.useRef(null),A=M.useRef(null);M.useEffect(()=>{Mg()},[]);const L=M.useCallback(()=>{if(!t){u([]);return}const E=e.query("SELECT * FROM messages WHERE chat_id = ? ORDER BY created_at ASC",[t]);u(E)},[e,t]);M.useEffect(()=>{L()},[L]),M.useEffect(()=>{var E;(E=T.current)==null||E.scrollIntoView({behavior:"smooth"})},[s,y]);const X=()=>{const E=N.current;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,200)+"px")},j=M.useCallback(()=>{if(t)return t;e.run("INSERT INTO chats (title) VALUES ('New Chat')");const I=e.get("SELECT last_insert_rowid() as id").id;return i(I),I},[t,e,i]),B=M.useCallback((E,I)=>{const D=I.slice(0,50)+(I.length>50?"…":"");e.run("UPDATE chats SET title = ?, updated_at = strftime('%s','now') WHERE id = ?",[D,E]),o()},[e,o]),Ge=M.useCallback(E=>{const I=h?Fg:1;return e.query("SELECT role, content FROM messages WHERE chat_id = ? ORDER BY created_at DESC LIMIT ?",[E,I]).reverse()},[e,h]),Ye=M.useCallback(async(E,I)=>{var V,ye,Xe,rt,cr,Nn,fr;if(!E.trim()||g)return;if(!l){alert("No model selected");return}d(!0),w(null);const D=I??j();e.run("INSERT INTO messages (chat_id, role, content) VALUES (?, 'user', ?)",[D,E]);const K=e.get("SELECT COUNT(*) as c FROM messages WHERE chat_id = ?",[D]);(K==null?void 0:K.c)===1&&B(D,E),L();const J=Ge(D),je={"Content-Type":"application/json"};r&&(je.Authorization=`Bearer ${r}`),A.current=new AbortController;try{const Ke=await fetch(`${n}/v1/chat/completions`,{method:"POST",headers:je,signal:A.current.signal,body:JSON.stringify({model:l,messages:J,stream:p,stream_options:p?{include_usage:!0}:void 0,max_tokens:2048})});if(!Ke.ok){const ve=await Ke.json().catch(()=>({}));throw new Error(((V=ve==null?void 0:ve.error)==null?void 0:V.message)||`HTTP ${Ke.status}`)}let lt="",it=null;if(p){const ve=Ke.body.getReader(),dr=new TextDecoder;let sn="";for(;;){const{done:jt,value:Rn}=await ve.read();if(jt)break;sn+=dr.decode(Rn,{stream:!0});const un=sn.split(` `);sn=un.pop();for(const pr of un){if(!pr.startsWith("data: "))continue;const hr=pr.slice(6).trim();if(hr!=="[DONE]")try{const mr=JSON.parse(hr),An=(rt=(Xe=(ye=mr.choices)==null?void 0:ye[0])==null?void 0:Xe.delta)==null?void 0:rt.content;An&&(lt+=An,w(lt)),mr.usage&&(it=mr.usage)}catch{}}}}else{const ve=await Ke.json();lt=((fr=(Nn=(cr=ve.choices)==null?void 0:cr[0])==null?void 0:Nn.message)==null?void 0:fr.content)||"",it=ve.usage}e.run("INSERT INTO messages (chat_id, role, content) VALUES (?, 'assistant', ?)",[D,lt]),e.run("UPDATE chats SET updated_at = strftime('%s','now') WHERE id = ?",[D]),it!=null&&it.tokens_per_second&&O(it.tokens_per_second),o()}catch(Ke){Ke instanceof Error&&Ke.name!=="AbortError"&&e.run("INSERT INTO messages (chat_id, role, content) VALUES (?, 'assistant', ?)",[D,`⚠️ Error: ${Ke.message}`])}finally{d(!1),w(null),L(),A.current=null}},[g,l,n,r,p,e,j,B,Ge,L,o]),xt=()=>{const E=a.trim();E&&(m(""),N.current&&(N.current.style.height="auto"),Ye(E))},ar=()=>{var E;(E=A.current)==null||E.abort()},ln=E=>{e.run("DELETE FROM messages WHERE id = ?",[E]),L()},on=(E,I)=>{e.run("UPDATE messages SET content = ? WHERE id = ?",[I,E.id]),e.run("DELETE FROM messages WHERE chat_id = ? AND id > ?",[E.chat_id,E.id]),L(),Ye(I,E.chat_id)},C=(E,I)=>{e.run("UPDATE messages SET content = ? WHERE id = ?",[I,E]),L()};return _.jsxs("div",{className:"chat-view",children:[_.jsxs("div",{className:"chat-topbar",children:[_.jsx("div",{className:"chat-topbar-left",children:k!==null&&_.jsxs("span",{className:"tps-badge",children:[k.toFixed(1)," tok/s"]})}),_.jsxs("div",{className:"chat-topbar-right",children:[_.jsxs("label",{className:"toggle-label",children:[_.jsx("input",{type:"checkbox",checked:p,onChange:E=>c(E.target.checked)}),"Streaming"]}),_.jsxs("label",{className:"toggle-label",children:[_.jsx("input",{type:"checkbox",checked:h,onChange:E=>v(E.target.checked)}),"Memory"]})]})]}),_.jsxs("div",{className:"messages-area",children:[!t&&s.length===0&&_.jsxs("div",{className:"empty-state",children:[_.jsx("div",{className:"empty-icon",children:"⚡"}),_.jsx("h2",{children:"ForgeLM Chat"}),_.jsx("p",{children:"Start a conversation. Supports full Markdown, code highlighting, and persistent history."})]}),s.map(E=>_.jsx(jg,{message:E,onDelete:ln,onEditAndResend:E.role==="user"?on:void 0,onEditAssistant:E.role==="assistant"?C:void 0,renderMarkdown:vc},E.id)),g&&y!==null&&_.jsx("div",{className:"msg-wrapper assistant",children:_.jsx("div",{className:"msg-bubble",dangerouslySetInnerHTML:{__html:vc(y)}})}),g&&y===null&&_.jsx("div",{className:"msg-wrapper assistant",children:_.jsxs("div",{className:"thinking",children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]})}),_.jsx("div",{ref:T})]}),_.jsxs("div",{className:"input-area",children:[_.jsxs("div",{className:"input-row",children:[_.jsx("textarea",{ref:N,className:"input-textarea",value:a,onChange:E=>{m(E.target.value),X()},onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),xt())},placeholder:"Message… (Enter to send, Shift+Enter for new line)",rows:1,disabled:g}),g?_.jsx("button",{className:"stop-btn",onClick:ar,children:"■ Stop"}):_.jsx("button",{className:"send-btn",onClick:xt,disabled:!a.trim(),children:"Send ↑"})]}),_.jsx("div",{className:"input-meta",children:_.jsxs("span",{className:"char-count",children:[a.length," chars"]})})]})]})}class $g{constructor(t){G(this,"inner");this.inner=t}run(t,n=[]){this.inner.run(t,n),this.persist()}query(t,n=[]){const r=this.inner.prepare(t);r.bind(n);const l=[];for(;r.step();)l.push(r.getAsObject());return r.free(),l}get(t,n=[]){return this.query(t,n)[0]??null}persist(){try{const t=this.inner.export(),n=btoa(String.fromCharCode(...t));localStorage.setItem("forgelm_db_v2",n)}catch{}}}async function Hg(){window.initSqlJs||await new Promise((l,i)=>{const o=document.createElement("script");o.src="https://cdn.jsdelivr.net/npm/sql.js@1.12.0/dist/sql-wasm.js",o.onload=()=>l(),o.onerror=i,document.head.appendChild(o)});const e=await window.initSqlJs({locateFile:l=>`https://cdn.jsdelivr.net/npm/sql.js@1.12.0/dist/${l}`}),t=localStorage.getItem("forgelm_db_v2");let n;if(t){const l=Uint8Array.from(atob(t),i=>i.charCodeAt(0));n=new e.Database(l)}else n=new e.Database;const r=new $g(n);return r.run(` CREATE TABLE IF NOT EXISTS chats ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL DEFAULT 'New Chat', created_at INTEGER NOT NULL DEFAULT (strftime('%s','now')), updated_at INTEGER NOT NULL DEFAULT (strftime('%s','now')) ) `),r.run(` CREATE TABLE IF NOT EXISTS messages ( id INTEGER PRIMARY KEY AUTOINCREMENT, chat_id INTEGER NOT NULL, role TEXT NOT NULL, content TEXT NOT NULL, created_at INTEGER NOT NULL DEFAULT (strftime('%s','now')) ) `),r.run("CREATE INDEX IF NOT EXISTS idx_msg_chat ON messages(chat_id, created_at)"),r}function Bg(){const[e,t]=M.useState(null),[n,r]=M.useState(!1);return M.useEffect(()=>{Hg().then(l=>{t(l),r(!0)})},[]),{db:e,ready:n}}function Wg(e,t){const[n,r]=M.useState([]),[l,i]=M.useState(""),[o,s]=M.useState("loading"),u=M.useCallback(async()=>{s("loading");try{const a={};t&&(a.Authorization=`Bearer ${t}`);const d=(await(await fetch(`${e}/v1/models`,{headers:a})).json()).data||[];r(d),d.length>0&&!l&&i(d[0].id),s("ok")}catch{s("error")}},[e,t,l]);return M.useEffect(()=>{u();const a=setInterval(u,3e4);return()=>clearInterval(a)},[u]),{models:n,selectedModel:l,setSelectedModel:i,status:o,refresh:u}}function Vg(){const{db:e,ready:t}=Bg(),[n,r]=M.useState(null),[l,i]=M.useState([]),[o,s]=M.useState(()=>localStorage.getItem("forgelm_server")||"http://127.0.0.1:8080"),[u,a]=M.useState(()=>localStorage.getItem("forgelm_apikey")||""),{models:m,selectedModel:g,setSelectedModel:d,status:y,refresh:w}=Wg(o,u);M.useEffect(()=>{localStorage.setItem("forgelm_server",o)},[o]),M.useEffect(()=>{localStorage.setItem("forgelm_apikey",u)},[u]);const k=M.useCallback(()=>{if(!e)return;const c=e.query("SELECT * FROM chats ORDER BY updated_at DESC");i(c)},[e]);M.useEffect(()=>{k()},[k]);const O=M.useCallback(()=>{if(!e)return;e.run("INSERT INTO chats (title) VALUES ('New Chat')");const c=e.get("SELECT last_insert_rowid() as id");c&&(r(c.id),k())},[e,k]),p=M.useCallback(c=>{e&&(e.run("DELETE FROM chats WHERE id = ?",[c]),n===c&&r(null),k())},[e,n,k]);return t?_.jsxs("div",{className:"app-layout",children:[_.jsx(Om,{chats:l,currentChatId:n,onSelectChat:r,onNewChat:O,onDeleteChat:p,server:o,onServerChange:s,apiKey:u,onApiKeyChange:a,models:m,selectedModel:g,onModelChange:d,status:y,onRefreshModels:w}),_.jsx(Ug,{db:e,chatId:n,server:o,apiKey:u,model:g,onChatCreated:c=>{r(c),k()},onChatUpdated:k})]}):_.jsxs("div",{className:"app-loading",children:[_.jsx("div",{className:"loading-spinner"}),_.jsx("span",{children:"Initializing…"})]})}zo.createRoot(document.getElementById("root")).render(_.jsx(wp.StrictMode,{children:_.jsx(Vg,{})}));