@thready-web/dsh-bot-plugin 0.1.0-beta.1 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,53 +9,53 @@ Error generating stack: `+a.message+`
9
9
  `).replace(Yv,"")}function og(e,t){return t=ug(t),ug(e)===t}function lt(e,t,l,a,o,f){switch(l){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||Cl(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&Cl(e,""+a);else return;break;case"className":Y(e,"class",a);break;case"tabIndex":Y(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Y(e,l,a);break;case"style":ua(e,a,f);return;case"data":if(t!=="object"){Y(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=We(a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(l==="formAction"?(t!=="input"&&lt(e,t,"name",o.name,o,null),lt(e,t,"formEncType",o.formEncType,o,null),lt(e,t,"formMethod",o.formMethod,o,null),lt(e,t,"formTarget",o.formTarget,o,null)):(lt(e,t,"encType",o.encType,o,null),lt(e,t,"method",o.method,o,null),lt(e,t,"target",o.target,o,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=We(a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Ge);return;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(l=a.__html,l!=null){if(o.children!=null)throw Error(u(60));f?.__html!==l&&(e.innerHTML=l)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=We(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),N(e,"popover",a);break;case"xlinkActuate":W(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":W(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":W(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":W(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":W(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":W(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":W(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":W(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":W(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":N(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=ku.get(l)||l,N(e,l,a);else return}Xe=!0}function xf(e,t,l,a,o,f){switch(l){case"style":ua(e,a,f);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(l=a.__html,l!=null){if(o.children!=null)throw Error(u(60));f?.__html!==l&&(e.innerHTML=l)}}break;case"children":if(typeof a=="string")Cl(e,a);else if(typeof a=="number"||typeof a=="bigint")Cl(e,""+a);else return;break;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"onClick":a!=null&&(e.onclick=Ge);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!ia.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(o=l.endsWith("Capture"),f=l.slice(2,o?l.length-7:void 0),t=e[Rt]||null,t=t!=null?t[l]:null,typeof t=="function"&&e.removeEventListener(f,t,o),typeof a=="function")){typeof t!="function"&&t!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(f,a,o);break e}Xe=!0,l in e?e[l]=a:a===!0?e.setAttribute(l,""):N(e,l,a)}return}Xe=!0}function Zt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var a=!1,o=!1,f;for(f in l)if(l.hasOwnProperty(f)){var b=l[f];if(b!=null)switch(f){case"src":a=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:lt(e,t,f,b,l,null)}}o&&lt(e,t,"srcSet",l.srcSet,l,null),a&&lt(e,t,"src",l.src,l,null);return;case"input":Ye("invalid",e);var x=f=b=o=null,T=null,D=null;for(a in l)if(l.hasOwnProperty(a)){var q=l[a];if(q!=null)switch(a){case"name":o=q;break;case"type":b=q;break;case"checked":T=q;break;case"defaultChecked":D=q;break;case"value":f=q;break;case"defaultValue":x=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(u(137,t));break;default:lt(e,t,a,q,l,null)}}fn(e,f,x,T,D,b,o,!1);return;case"select":Ye("invalid",e),a=b=f=null;for(o in l)if(l.hasOwnProperty(o)&&(x=l[o],x!=null))switch(o){case"value":f=x;break;case"defaultValue":b=x;break;case"multiple":a=x;default:lt(e,t,o,x,l,null)}t=f,l=b,e.multiple=!!a,t!=null?Yt(e,!!a,t,!1):l!=null&&Yt(e,!!a,l,!0);return;case"textarea":Ye("invalid",e),f=o=a=null;for(b in l)if(l.hasOwnProperty(b)&&(x=l[b],x!=null))switch(b){case"value":a=x;break;case"defaultValue":o=x;break;case"children":f=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(u(91));break;default:lt(e,t,b,x,l,null)}wu(e,a,o,f);return;case"option":for(T in l)l.hasOwnProperty(T)&&(a=l[T],a!=null)&&(T==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":lt(e,t,T,a,l,null));return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(a=0;a<Ia.length;a++)Ye(Ia[a],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(D in l)if(l.hasOwnProperty(D)&&(a=l[D],a!=null))switch(D){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:lt(e,t,D,a,l,null)}return;default:if(oa(t)){for(q in l)l.hasOwnProperty(q)&&(a=l[q],a!==void 0&&xf(e,t,q,a,l,void 0));return}}for(x in l)l.hasOwnProperty(x)&&(a=l[x],a!=null&&lt(e,t,x,a,l,null))}var Iv={};function Vv(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,f=null,b=null,x=null,T=null,D=null,q=null;for(B in l){var X=l[B];if(l.hasOwnProperty(B)&&X!=null)switch(B){case"checked":break;case"value":break;case"defaultValue":T=X;default:a.hasOwnProperty(B)||lt(e,t,B,null,a,X)}}for(var j in a){var B=a[j];if(X=l[j],a.hasOwnProperty(j)&&(B!=null||X!=null))switch(j){case"type":B!==X&&(Xe=!0),f=B;break;case"name":B!==X&&(Xe=!0),o=B;break;case"checked":B!==X&&(Xe=!0),D=B;break;case"defaultChecked":B!==X&&(Xe=!0),q=B;break;case"value":B!==X&&(Xe=!0),b=B;break;case"defaultValue":B!==X&&(Xe=!0),x=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(u(137,t));break;default:B!==X&&lt(e,t,j,B,a,X)}}xt(e,b,x,T,D,q,f,o);return;case"select":B=b=x=j=null;for(f in l)if(T=l[f],l.hasOwnProperty(f)&&T!=null)switch(f){case"value":break;case"multiple":B=T;default:a.hasOwnProperty(f)||lt(e,t,f,null,a,T)}for(o in a)if(f=a[o],T=l[o],a.hasOwnProperty(o)&&(f!=null||T!=null))switch(o){case"value":f!==T&&(Xe=!0),j=f;break;case"defaultValue":f!==T&&(Xe=!0),x=f;break;case"multiple":f!==T&&(Xe=!0),b=f;default:f!==T&&lt(e,t,o,f,a,T)}t=x,l=b,a=B,j!=null?Yt(e,!!l,j,!1):!!a!=!!l&&(t!=null?Yt(e,!!l,t,!0):Yt(e,!!l,l?[]:"",!1));return;case"textarea":B=j=null;for(x in l)if(o=l[x],l.hasOwnProperty(x)&&o!=null&&!a.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:lt(e,t,x,null,a,o)}for(b in a)if(o=a[b],f=l[b],a.hasOwnProperty(b)&&(o!=null||f!=null))switch(b){case"value":o!==f&&(Xe=!0),j=o;break;case"defaultValue":o!==f&&(Xe=!0),B=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(u(91));break;default:o!==f&&lt(e,t,b,o,a,f)}El(e,j,B);return;case"option":for(var ie in l)j=l[ie],l.hasOwnProperty(ie)&&j!=null&&!a.hasOwnProperty(ie)&&(ie==="selected"?e.selected=!1:lt(e,t,ie,null,a,j));for(T in a)j=a[T],B=l[T],a.hasOwnProperty(T)&&j!==B&&(j!=null||B!=null)&&(T==="selected"?(j!==B&&(Xe=!0),e.selected=j&&typeof j!="function"&&typeof j!="symbol"):lt(e,t,T,j,a,B));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var fe in l)j=l[fe],l.hasOwnProperty(fe)&&j!=null&&!a.hasOwnProperty(fe)&&lt(e,t,fe,null,a,j);for(D in a)if(j=a[D],B=l[D],a.hasOwnProperty(D)&&j!==B&&(j!=null||B!=null))switch(D){case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(u(137,t));break;default:lt(e,t,D,j,a,B)}return;default:if(oa(t)){for(var Re in l)j=l[Re],l.hasOwnProperty(Re)&&j!==void 0&&!a.hasOwnProperty(Re)&&xf(e,t,Re,void 0,a,j);for(q in a)j=a[q],B=l[q],!a.hasOwnProperty(q)||j===B||j===void 0&&B===void 0||xf(e,t,q,j,a,B);return}}for(var M in l)j=l[M],l.hasOwnProperty(M)&&j!=null&&!a.hasOwnProperty(M)&&lt(e,t,M,null,a,j);for(X in a)j=a[X],B=l[X],!a.hasOwnProperty(X)||j===B||j==null&&B==null||lt(e,t,X,j,a,B)}function sg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Gv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var o=l[a],f=o.transferSize,b=o.initiatorType,x=o.duration;if(f&&x&&sg(b)){for(b=0,x=o.responseEnd,a+=1;a<l.length;a++){var T=l[a],D=T.startTime;if(D>x)break;var q=T.transferSize,X=T.initiatorType;q&&sg(X)&&(T=T.responseEnd,b+=q*(T<x?1:(x-D)/(T-D)))}if(--a,t+=8*(f+b)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Sf=null,wf=null;function Ga(e){return e.nodeType===9?e:e.ownerDocument}function cg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function fg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function dg(e,t,l,a){return l=Ga(l).createElement(e),l[st]=a,l[Rt]=t,Zt(l,e,t),Tt(l),l}function kf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Tf=null;function Qv(){var e=window.event;return e&&e.type==="popstate"?e===Tf?!1:(Tf=e,!0):(Tf=null,!1)}var Ef=typeof setTimeout=="function"?setTimeout:void 0,Xv=typeof clearTimeout=="function"?clearTimeout:void 0,hg=typeof Promise=="function"?Promise:void 0,mg=typeof requestAnimationFrame=="function"?requestAnimationFrame:Ef,Zv=typeof queueMicrotask=="function"?queueMicrotask:typeof hg<"u"?function(e){return hg.resolve(null).then(e).catch(Fv)}:Ef;function Fv(e){setTimeout(function(){throw e})}function yi(e){return e==="head"}function pg(e,t){var l=t,a=0;do{var o=l.nextSibling;if(e.removeChild(l),o&&o.nodeType===8)if(l=o.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(o),Zr(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")Mf(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Mf(l);for(var f=l.firstChild;f;){var b=f.nextSibling,x=f.nodeName;f[kl]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&f.rel.toLowerCase()==="stylesheet"||l.removeChild(f),f=b}}else l==="body"&&Mf(e.ownerDocument.body);l=o}while(l);Zr(t)}function gg(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function yg(e,t,l){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,l!=null&&(e.style.viewTransitionClass=l),l=getComputedStyle(e),l.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var o=a=0;o<t.length;o++){var f=t[o];0<f.width&&0<f.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+l.paddingTop,e.marginBottom="-"+l.paddingBottom)}}function bg(e,t){e=e.style,t=t.style;var l=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(l=t.display,e.display=l==null||typeof l=="boolean"?"":l,l=t.margin,l!=null?e.margin=l:(l=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=l==null||typeof l=="boolean"?"":l,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Kv(e,t,l){return l=l.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=l.innerHeight&&e.left<=l.innerWidth}}function Cf(e){var t=e.getBoundingClientRect(),l=getComputedStyle(e);return Kv(t,l,e)}function Jv(e){return e.documentElement.clientHeight}function $v(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Wv(e,t,l,a,o,f,b,x,T){var D=t.nodeType===9?t:t.ownerDocument;try{var q=D.startViewTransition({update:function(){var j=D.defaultView,B=j.navigation&&j.navigation.transition,ie=D.fonts.status;a();var fe=[];if(ie==="loaded"&&(Jv(D),D.fonts.status==="loading"&&fe.push(D.fonts.ready)),ie=fe.length,e!==null)for(var Re=e.suspenseyImages,M=0,_=0;_<Re.length;_++){var L=Re[_];if(!L.complete){var Q=L.getBoundingClientRect();if(0<Q.bottom&&0<Q.right&&Q.top<j.innerHeight&&Q.left<j.innerWidth){if(M+=qg(L),M>Mo){fe.length=ie;break}L=new Promise($v.bind(L)),fe.push(L)}}}if(0<fe.length)return j=Promise.race([Promise.all(fe),new Promise(function(se){return setTimeout(se,500)})]).then(o,o),(B?Promise.allSettled([B.finished,j]):j).then(f,f);if(o(),B)return B.finished.then(f,f);f()},types:l});D.__reactViewTransition=q;var X=[];return q.ready.then(function(){for(var j=D.documentElement.getAnimations({subtree:!0}),B=0;B<j.length;B++){var ie=j[B],fe=ie.effect,Re=fe.pseudoElement;if(Re!=null&&Re.startsWith("::view-transition")){X.push(ie),ie=fe.getKeyframes();for(var M=Re=void 0,_=!0,L=0;L<ie.length;L++){var Q=ie[L],se=Q.width;if(Re===void 0)Re=se;else if(Re!==se){_=!1;break}if(se=Q.height,M===void 0)M=se;else if(M!==se){_=!1;break}delete Q.width,delete Q.height,Q.transform==="none"&&delete Q.transform}_&&Re!==void 0&&M!==void 0&&(fe.setKeyframes(ie),_=getComputedStyle(fe.target,fe.pseudoElement),_.width!==Re||_.height!==M)&&(_=ie[0],_.width=Re,_.height=M,_=ie[ie.length-1],_.width=Re,_.height=M,fe.setKeyframes(ie))}}b()},function(j){D.__reactViewTransition===q&&(D.__reactViewTransition=null);try{typeof j=="object"&&j!==null&&j.name==="InvalidStateError"&&(j.message==="View transition was skipped because document visibility state is hidden."||j.message==="Skipping view transition because document visibility state has become hidden."||j.message==="Skipping view transition because viewport size changed."||j.message==="Transition was aborted because of invalid state")&&(j=null),j!==null&&T(j)}finally{a(),o(),b()}}),q.finished.finally(function(){for(var j=0;j<X.length;j++)X[j].cancel();D.__reactViewTransition===q&&(D.__reactViewTransition=null),x()}),q}catch{return a(),o(),b(),null}}function Wi(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Wi.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:Z({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Wi.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,l=e.getAnimations({subtree:!0}),a=[],o=0;o<l.length;o++){var f=l[o].effect;f!==null&&f.target===e&&f.pseudoElement===t&&a.push(l[o])}return a},Wi.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function vg(e){return{name:e,group:new Wi("group",e),imagePair:new Wi("image-pair",e),old:new Wi("old",e),new:new Wi("new",e)}}function An(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}An.prototype.addEventListener=function(e,t,l){var a=null,o=null;if(!(l!=null&&typeof l!="boolean"&&(a=l.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var f=this._eventListeners;if(Sg(f,e,t,l)===-1){var b=this,x=t;l!=null&&typeof l!="boolean"&&l.once===!0&&(x=function(T){b.removeEventListener(e,t,l),typeof t=="function"?t.call(this,T):t.handleEvent(T)}),a!==null&&(o=b.removeEventListener.bind(b,e,t,l),a.addEventListener("abort",o,{once:!0}),o=a.removeEventListener.bind(a,"abort",o)),a=Yr(l),f.push({type:e,listener:t,optionsOrUseCapture:l,attachedListener:x,cleanup:o}),p(this._fragmentFiber.child,!1,Pv,e,x,a)}this._eventListeners=f}};function Pv(e,t,l,a){return R(e).addEventListener(t,l,a),!1}An.prototype.removeEventListener=function(e,t,l){var a=this._eventListeners;if(a!==null&&(t=Sg(a,e,t,l),t!==-1)){var o=a[t];l=o.attachedListener;var f=o.cleanup;o=Yr(o.optionsOrUseCapture),p(this._fragmentFiber.child,!1,ex,e,l,o),a.splice(t,1),f!==null&&f()}};function ex(e,t,l,a){return R(e).removeEventListener(t,l,a),!1}function Yr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function xg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Sg(e,t,l,a){if(e.length===0)return-1;a=xg(a);for(var o=0;o<e.length;o++){var f=e[o];if(f.type===t&&f.listener===l&&xg(f.optionsOrUseCapture)===a)return o}return-1}An.prototype.dispatchEvent=function(e){var t=S(this._fragmentFiber);if(t===null)return!0;t=R(t);var l=this._eventListeners;if(l!==null&&0<l.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(l)for(var o=0;o<l.length;o++){var f=l[o];a.addEventListener(f.type,f.attachedListener,Yr(f.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),l)for(o=0;o<l.length;o++)f=l[o],a.removeEventListener(f.type,f.attachedListener,Yr(f.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},An.prototype.focus=function(e){p(this._fragmentFiber.child,!0,wg,e,void 0,void 0)};function wg(e,t){return e.tag===6?!1:(e=R(e),dx(e,t))}An.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Af,t,void 0,void 0);for(var l=t.length-1;0<=l&&!wg(t[l],e);l--);};function Af(e,t){return t.push(e),!1}An.prototype.blur=function(){var e=S(this._fragmentFiber);e!==null&&(e=R(e),e=Ga(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,tx,e,void 0,void 0))};function tx(e,t){return e.tag===6?!1:(e=R(e),e===t||e.contains(t)?(t.blur(),!0):!1)}An.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,nx,e,void 0,void 0)};function nx(e,t){return e.tag===6||(e=R(e),t.observe(e)),!1}An.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,lx,e,void 0,void 0);for(var l=t=0;l<Wn.length;l++){var a=Wn[l];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Wn[t++]=a}Wn.length=t}};function lx(e,t){return e.tag===6||(e=R(e),t.unobserve(e)),!1}var Wn=[],Nf=!1;function ix(e,t,l){Wn.push({fragmentInstance:e,observer:t,instance:l}),Nf||(Nf=!0,hx(function(){Nf=!1;var a=Wn;Wn=[];for(var o=0;o<a.length;o++){var f=a[o];f.observer.unobserve(f.instance)}}))}An.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,rx,e,void 0,void 0),e};function rx(e,t){if(e.tag===6){e=e.stateNode;var l=e.ownerDocument.createRange();l.selectNodeContents(e),t.push.apply(t,l.getClientRects())}else e=R(e),t.push.apply(t,e.getClientRects());return!1}An.prototype.getRootNode=function(e){var t=S(this._fragmentFiber);return t===null?this:R(t).getRootNode(e)},An.prototype.compareDocumentPosition=function(e){var t=S(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];p(this._fragmentFiber.child,!1,Af,l,void 0,void 0);var a=R(t);if(l.length===0){if(l=a,v(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(l=t)}t=this._fragmentFiber;var o=a=l.compareDocumentPosition(e);return l===e?o=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=k(t)[1],l===null?o=Node.DOCUMENT_POSITION_PRECEDING:(e=R(l).compareDocumentPosition(e),o=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=R(l[0]),o=R(l[l.length-1]);var f=v(this._fragmentFiber)?t.parentElement:a;if(f==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=f.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,f=f.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var b=t.compareDocumentPosition(e),x=o.compareDocumentPosition(e),T=b&Node.DOCUMENT_POSITION_CONTAINED_BY||x&Node.DOCUMENT_POSITION_CONTAINED_BY;return x=a&&f&&b&Node.DOCUMENT_POSITION_FOLLOWING&&x&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||f&&o===e||T||x?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!f&&o===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:b,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||ax(t,this._fragmentFiber,l[0],l[l.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function ax(e,t,l,a,o){var f=Tl(o);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!f)e:{for(;f!==null;){if(f.tag===7&&(f===t||f.alternate===t)){l=!0;break e}f=f.return}l=!1}return l}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(f===null)return f=o.ownerDocument,o===f||o===f.documentElement||o===f.body;e:{for(f=t,t=S(t);f!==null;){if(!(f.tag!==5&&f.tag!==3&&f.tag!==27||f!==t&&f.alternate!==t)){f=!0;break e}f=f.return}f=!1}return f}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!f)&&!(t=f===l)&&(t=H(l,f,le),t===null?t=!1:(p(t,!0,G,f,l),f=C,C=null,t=f!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!f)&&!(t=f===a)&&(t=H(a,f,le),t===null?t=!1:(p(t,!0,ne,f,a),f=C,I=C=null,t=f!==null)),t):!1}function kg(e,t){var l=e.ownerDocument.createRange();l.selectNodeContents(e),e=l.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}An.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(u(566));var t=[];p(this._fragmentFiber.child,!1,Af,t,void 0,void 0);var l=e!==!1;if(t.length===0){var a=k(this._fragmentFiber);if(a=l?a[1]||a[0]||S(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=R(a),kg(e,l);return}if(a=R(a),a.nodeType!==9){if(a.nodeType===11){l="host"in a?a.host:null,l!==null&&l.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=l?t.length-1:0;a!==(l?-1:t.length);){var o=t[a];o.tag===6?(o=R(o),kg(o,l)):R(o).scrollIntoView(e),a+=l?-1:1}};function ux(e,t){return e=R(e),Tg(e,t),!1}function Tg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Eg(e,t){var l=t._eventListeners;if(l!==null)for(var a=0;a<l.length;a++){var o=l[a];e.addEventListener(o.type,o.attachedListener,Yr(o.optionsOrUseCapture))}e.nodeType!==3&&(l=t._observers,l!==null&&l.forEach(function(f){for(var b=0,x=0;x<Wn.length;x++){var T=Wn[x];(T.fragmentInstance!==t||T.observer!==f||T.instance!==e)&&(Wn[b++]=T)}Wn.length=b,f.observe(e)}),Tg(e,t))}function ox(e,t){var l=t._eventListeners;if(l!==null)for(var a=0;a<l.length;a++){var o=l[a];e.removeEventListener(o.type,o.attachedListener,Yr(o.optionsOrUseCapture))}e.nodeType!==3&&(l=t._observers,l!==null&&l.forEach(function(f){typeof f.rootMargin=="string"?ix(t,f,e):f.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function zf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":zf(l),dr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function sx(e,t,l,a){for(;e.nodeType===1;){var o=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[kl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=qn(e.nextSibling),e===null)break}return null}function cx(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=qn(e.nextSibling),e===null))return null;return e}function Cg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=qn(e.nextSibling),e===null))return null;return e}function Of(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function fx(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function qn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var jf=null;function Ag(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return qn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Ng(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function dx(e,t){function l(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",l,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",l,!0)}return a}function hx(e){mg(function(){mg(function(t){return e(t)})})}function zg(e,t,l){switch(t=Ga(l),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function Og(e,t,l){for(var a in l){var o=l[a];l.hasOwnProperty(a)&&o!=null&&lt(e,t,a,null,Iv,o)}l.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Ge&&(e.onclick=null),dr(e)}function Mf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dr(e)}var Hn=new Map,_g=new Set;function Qa(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var ql=pe.d;pe.d={f:mx,r:px,D:gx,C:yx,L:bx,m:vx,X:Sx,S:xx,M:wx};function mx(){var e=ql.f(),t=To();return e||t}function px(e){var t=Zl(e);t!==null&&t.tag===5&&t.type==="form"?Mm(t):ql.r(e)}var Ir=typeof document>"u"?null:document;function jg(e,t,l){var a=Ir;if(a&&typeof t=="string"&&t){var o=Ee(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof l=="string"&&(o+='[crossorigin="'+l+'"]'),_g.has(o)||(_g.add(o),e={rel:e,crossOrigin:l,href:t},a.querySelector(o)===null&&(t=a.createElement("link"),Zt(t,"link",e),Tt(t),a.head.appendChild(t)))}}function gx(e){ql.D(e),jg("dns-prefetch",e,null)}function yx(e,t){ql.C(e,t),jg("preconnect",e,t)}function bx(e,t,l){ql.L(e,t,l);var a=Ir;if(a&&e&&t){var o='link[rel="preload"][as="'+Ee(t)+'"]';t==="image"&&l&&l.imageSrcSet?(o+='[imagesrcset="'+Ee(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(o+='[imagesizes="'+Ee(l.imageSizes)+'"]')):o+='[href="'+Ee(e)+'"]';var f=o;switch(t){case"style":f=Vr(e);break;case"script":f=Gr(e)}if(!(Hn.has(f)||(e=Z({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Hn.set(f,e),a.querySelector(o)!==null||t==="style"&&a.querySelector(Xa(f))||t==="script"&&a.querySelector(Za(f))))){var b=a.createElement("link");Zt(b,"link",e),t==="style"&&(b[Oi]=!0,b.onload=b.onerror=function(){la(b)}),Tt(b),a.head.appendChild(b)}}}function vx(e,t){ql.m(e,t);var l=Ir;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ee(a)+'"][href="'+Ee(e)+'"]',f=o;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Gr(e)}if(!Hn.has(f)&&(e=Z({rel:"modulepreload",href:e},t),Hn.set(f,e),l.querySelector(o)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Za(f)))return}a=l.createElement("link"),Zt(a,"link",e),Tt(a),l.head.appendChild(a)}}}function xx(e,t,l){ql.S(e,t,l);var a=Ir;if(a&&e){var o=Fl(a).hoistableStyles,f=Vr(e);t=t||"default";var b=o.get(f);if(!b){var x={loading:0,preload:null};if(b=a.querySelector(Xa(f)))x.loading=5;else{e=Z({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Hn.get(f))&&Df(e,l);var T=b=a.createElement("link");Tt(T),Zt(T,"link",e),T._p=new Promise(function(D,q){T.onload=D,T.onerror=q}),T.addEventListener("load",function(){x.loading|=1}),T.addEventListener("error",function(){x.loading|=2}),x.loading|=4,_o(b,t,a)}b={type:"stylesheet",instance:b,count:1,state:x},o.set(f,b)}}}function Sx(e,t){ql.X(e,t);var l=Ir;if(l&&e){var a=Fl(l).hoistableScripts,o=Gr(e),f=a.get(o);f||(f=l.querySelector(Za(o)),f||(e=Z({src:e,async:!0},t),(t=Hn.get(o))&&Rf(e,t),f=l.createElement("script"),Tt(f),Zt(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},a.set(o,f))}}function wx(e,t){ql.M(e,t);var l=Ir;if(l&&e){var a=Fl(l).hoistableScripts,o=Gr(e),f=a.get(o);f||(f=l.querySelector(Za(o)),f||(e=Z({src:e,async:!0,type:"module"},t),(t=Hn.get(o))&&Rf(e,t),f=l.createElement("script"),Tt(f),Zt(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},a.set(o,f))}}function Mg(e,t,l,a){var o=(o=on.current)?Qa(o):null;if(!o)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=Vr(l.href),t=Fl(o).hoistableStyles,a=t.get(l),a||(a={type:"style",instance:null,count:0,state:null},t.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Vr(l.href);var f=Fl(o).hoistableStyles,b=f.get(e);if(b||(o=o.ownerDocument||o,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,b),(f=o.querySelector(Xa(e)))?f._p||(b.instance=f,b.state.loading=5):(f=Hn.get(e),f||(f={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Hn.set(e,f)),kx(o,e,f,b.state))),t&&a===null)throw Error(u(528,""));return b}if(t&&a!==null)throw Error(u(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(l=Gr(l),t=Fl(o).hoistableScripts,a=t.get(l),a||(a={type:"script",instance:null,count:0,state:null},t.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function Vr(e){return'href="'+Ee(e)+'"'}function Xa(e){return'link[rel="stylesheet"]['+e+"]"}function Dg(e){return Z({},e,{"data-precedence":e.precedence,precedence:null})}function kx(e,t,l,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Oi]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Oi]=!0,t.onload=t.onerror=la.bind(null,t),Zt(t,"link",l),Tt(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function Gr(e){return'[src="'+Ee(e)+'"]'}function Za(e){return"script[async]"+e}function Rg(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ee(l.href)+'"]');if(a)return t.instance=a,Tt(a),a;var o=Z({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Tt(a),Zt(a,"style",o),_o(a,l.precedence,e),t.instance=a;case"stylesheet":o=Vr(l.href);var f=e.querySelector(Xa(o));if(f)return t.state.loading|=4,t.instance=f,Tt(f),f;a=Dg(l),(o=Hn.get(o))&&Df(a,o),f=(e.ownerDocument||e).createElement("link"),Tt(f);var b=f;return b._p=new Promise(function(x,T){b.onload=x,b.onerror=T}),Zt(f,"link",a),t.state.loading|=4,_o(f,l.precedence,e),t.instance=f;case"script":return f=Gr(l.src),(o=e.querySelector(Za(f)))?(t.instance=o,Tt(o),o):(a=l,(o=Hn.get(f))&&(a=Z({},l),Rf(a,o)),e=e.ownerDocument||e,o=e.createElement("script"),Tt(o),Zt(o,"link",a),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,_o(a,l.precedence,e));return t.instance}function _o(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=a.length?a[a.length-1]:null,f=o,b=0;b<a.length;b++){var x=a[b];if(x.dataset.precedence===t)f=x;else if(f!==o)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Df(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Rf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var jo=null;function Lg(e,t,l){if(jo===null){var a=new Map,o=jo=new Map;o.set(l,a)}else o=jo,a=o.get(l),a||(a=new Map,o.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),o=0;o<l.length;o++){var f=l[o];if(!(f[kl]||f[st]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(t)||"";b=e+b;var x=a.get(b);x?x.push(f):a.set(b,[f])}}return a}function Lf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Tx(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Bg(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Ug(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qg(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Hg(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=qg(t),e.suspenseyImages.push(t)),e=Ax.bind(e),t.decode().then(e,e))}function Ex(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var o=Vr(a.href),f=t.querySelector(Xa(o));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Fa.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=f,Tt(f);return}f=t.ownerDocument||t,a=Dg(a),(o=Hn.get(o))&&Df(a,o),f=f.createElement("link"),Tt(f);var b=f;b._p=new Promise(function(x,T){b.onload=x,b.onerror=T}),Zt(f,"link",a),l.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Fa.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Mo=0;function Cx(e,t){return e.stylesheets&&e.count===0&&Ro(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&Ro(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&Mo===0&&(Mo=62500*Gv());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ro(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>Mo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(o)}}:null}function Yg(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Ro(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Fa(){this.count--,Yg(this)}function Ax(){this.imgCount--,Yg(this)}var Do=null;function Ro(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Do=new Map,t.forEach(Nx,e),Do=null,Fa.call(e))}function Nx(e,t){if(!(t.state.loading&4)){var l=Do.get(e);if(l)var a=l.get(null);else{l=new Map,Do.set(e,l);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<o.length;f++){var b=o[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),a=b)}a&&l.set(null,a)}o=t.instance,b=o.getAttribute("data-precedence"),f=l.get(b)||a,f===a&&l.set(null,o),l.set(b,o),this.count++,a=Fa.bind(this),o.addEventListener("load",a),o.addEventListener("error",a),f?f.parentNode.insertBefore(o,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Qr={$$typeof:be,Provider:null,Consumer:null,_currentValue:Ot,_currentValue2:Ot,_threadCount:0};function zx(e,t,l,a,o,f,b,x,T){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=or(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=or(0),this.hiddenUpdates=or(null),this.identifierPrefix=a,this.onUncaughtError=o,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function Ig(e,t,l,a,o,f,b,x,T,D,q,X){return e=new zx(e,t,l,b,T,D,q,X,x),t=1,f===!0&&(t|=24),f=dn(3,null,null,t),e.current=f,f.stateNode=e,t=Js(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:a,isDehydrated:l,cache:t},ec(f),e}function Vg(e){return e?(e=yr,e):yr}function Gg(e,t,l,a,o,f){o=Vg(o),a.context===null?a.context=o:a.pendingContext=o,a=ri(t),a.payload={element:l},f=f===void 0?null:f,f!==null&&(a.callback=f),l=ai(e,a,t),l!==null&&(gn(l,e,t),Ea(l,e,t))}function Qg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Bf(e,t){Qg(e,t),(e=e.alternate)&&Qg(e,t)}function Xg(e){if(e.tag===13||e.tag===31){var t=Ri(e,67108864);t!==null&&gn(t,e,67108864),Bf(e,67108864)}}function Zg(e){if(e.tag===13||e.tag===31){var t=Cn();t=cr(t);var l=Ri(e,t);l!==null&&gn(l,e,t),Bf(e,t)}}var Xr=!0;function Ox(e,t,l,a){var o=ce.T;ce.T=null;var f=pe.p;try{pe.p=2,Uf(e,t,l,a)}finally{pe.p=f,ce.T=o}}function _x(e,t,l,a){var o=ce.T;ce.T=null;var f=pe.p;try{pe.p=8,Uf(e,t,l,a)}finally{pe.p=f,ce.T=o}}function Uf(e,t,l,a){if(Xr){var o=qf(a);if(o===null)vf(e,t,a,Lo,l),Kg(e,a);else if(Mx(o,e,t,l,a))a.stopPropagation();else if(Kg(e,a),t&4&&-1<jx.indexOf(e)){for(;o!==null;){var f=Zl(o);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=_n(f.pendingLanes);if(b!==0){var x=f;for(x.pendingLanes|=2,x.entangledLanes|=2;b;){var T=1<<31-Ht(b);x.entanglements[1]|=T,b&=~T}bl(f),(Je&6)===0&&(So=kt()+500,Ya(0))}}break;case 31:case 13:x=Ri(f,2),x!==null&&gn(x,f,2),To(),Bf(f,2)}if(f=qf(a),f===null&&vf(e,t,a,Lo,l),f===o)break;o=f}o!==null&&a.stopPropagation()}else vf(e,t,a,null,l)}}function qf(e){return e=It(e),Hf(e)}var Lo=null;function Hf(e){if(Lo=null,e=Tl(e),e!==null){var t=c(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=d(t),e!==null)return e;e=null}else if(l===31){if(e=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Lo=e,null}function Fg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Mt()){case vn:return 2;case tn:return 8;case Ai:case Wr:return 32;case Ni:return 268435456;default:return 32}default:return 32}}var Yf=!1,bi=null,vi=null,xi=null,Ka=new Map,Ja=new Map,Si=[],jx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Kg(e,t){switch(e){case"focusin":case"focusout":bi=null;break;case"dragenter":case"dragleave":vi=null;break;case"mouseover":case"mouseout":xi=null;break;case"pointerover":case"pointerout":Ka.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ja.delete(t.pointerId)}}function $a(e,t,l,a,o,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:f,targetContainers:[o]},t!==null&&(t=Zl(t),t!==null&&Xg(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Mx(e,t,l,a,o){switch(t){case"focusin":return bi=$a(bi,e,t,l,a,o),!0;case"dragenter":return vi=$a(vi,e,t,l,a,o),!0;case"mouseover":return xi=$a(xi,e,t,l,a,o),!0;case"pointerover":var f=o.pointerId;return Ka.set(f,$a(Ka.get(f)||null,e,t,l,a,o)),!0;case"gotpointercapture":return f=o.pointerId,Ja.set(f,$a(Ja.get(f)||null,e,t,l,a,o)),!0}return!1}function Jg(e){var t=Tl(e.target);if(t!==null){var l=c(t);if(l!==null){if(t=l.tag,t===13){if(t=d(l),t!==null){e.blockedOn=t,vs(e.priority,function(){Zg(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,vs(e.priority,function(){Zg(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Bo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=qf(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);ul=a,l.target.dispatchEvent(a),ul=null}else return t=Zl(l),t!==null&&Xg(t),e.blockedOn=l,!1;t.shift()}return!0}function $g(e,t,l){Bo(e)&&l.delete(t)}function Dx(){Yf=!1,bi!==null&&Bo(bi)&&(bi=null),vi!==null&&Bo(vi)&&(vi=null),xi!==null&&Bo(xi)&&(xi=null),Ka.forEach($g),Ja.forEach($g)}function Uo(e,t){e.blockedOn===t&&(e.blockedOn=null,Yf||(Yf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Dx)))}var qo=null;function Wg(e){qo!==e&&(qo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){qo===e&&(qo=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],o=e[t+2];if(typeof a!="function"){if(Hf(a||l)===null)continue;break}var f=Zl(l);f!==null&&(e.splice(t,3),t-=3,Sc(f,{pending:!0,data:o,method:l.method,action:a},a,o))}}))}function Zr(e){function t(T){return Uo(T,e)}bi!==null&&Uo(bi,e),vi!==null&&Uo(vi,e),xi!==null&&Uo(xi,e),Ka.forEach(t),Ja.forEach(t);for(var l=0;l<Si.length;l++){var a=Si[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Si.length&&(l=Si[0],l.blockedOn===null);)Jg(l),l.blockedOn===null&&Si.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var o=l[a],f=l[a+1],b=o[Rt]||null;if(typeof f=="function")b||Wg(l);else if(b){var x=null;if(f&&f.hasAttribute("formAction")){if(o=f,b=f[Rt]||null)x=b.formAction;else if(Hf(o)!==null)continue}else x=b.action;typeof x=="function"?l[a+1]=x:(l.splice(a,3),a-=3),Wg(l)}}}function Pg(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return o=b})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function If(e){this._internalRoot=e}Ho.prototype.render=If.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var l=t.current,a=Cn();Gg(l,a,e,t,null,null)},Ho.prototype.unmount=If.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Gg(e.current,2,null,e,null,null),To(),t[Xl]=null}};function Ho(e){this._internalRoot=e}Ho.prototype.unstable_scheduleHydration=function(e){if(e){var t=xu();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Si.length&&t!==0&&t<Si[l].priority;l++);Si.splice(l,0,e),l===0&&Jg(e)}};var ey=i.version;if(ey!=="19.3.1")throw Error(u(527,ey,"19.3.1"));pe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Rx={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ce,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{nn=Yo.inject(Rx),qt=Yo}catch{}}return Pa.createRoot=function(e,t){if(!s(e))throw Error(u(299));var l=!1,a="",o=Vm,f=Gm,b=Qm;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Ig(e,1,!1,null,null,l,a,null,o,f,b,Pg),e[Xl]=t.current,bf(e),new If(t)},Pa.hydrateRoot=function(e,t,l){if(!s(e))throw Error(u(299));var a=!1,o="",f=Vm,b=Gm,x=Qm,T=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(o=l.identifierPrefix),l.onUncaughtError!==void 0&&(f=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(x=l.onRecoverableError),l.formState!==void 0&&(T=l.formState)),t=Ig(e,1,!0,t,l??null,a,o,T,f,b,x,Pg),t.context=Vg(null),l=t.current,a=Cn(),a=cr(a),o=ri(a),o.callback=null,ai(l,o,a),l=a,t.current.lanes=l,Gl(t,l),bl(t),e[Xl]=t.current,bf(e),new Ho(t)},Pa.version="19.3.1",Pa}var cy;function Qx(){if(cy)return Qf.exports;cy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Qf.exports=Gx(),Qf.exports}var Xx=Qx();async function Yn(n,i){const r=await fetch("/dsh-bot/api"+n,{...i,headers:{accept:"application/json",...i?.headers??{}}}),u=await r.json().catch(()=>({}));return{status:r.status,body:u&&typeof u=="object"?u:{}}}async function Zx(n,i){const r=n.headers.get("content-length"),u=r==null?null:Number(r),s=u!=null&&Number.isFinite(u)&&u>=0?u:null;if(!n.body){const p=await n.text();return i?.(new TextEncoder().encode(p).byteLength,s),JSON.parse(p||"null")}const c=n.body.getReader(),d=[];let h=0;for(;;){const p=await c.read();if(p.done)break;d.push(p.value),h+=p.value.byteLength,i?.(h,s)}const m=new Uint8Array(h);let g=0;for(const p of d)m.set(p,g),g+=p.byteLength;const y=new TextDecoder().decode(m);return y===""?null:JSON.parse(y)}const Fx=64*1024*1024;function v1(n,i){if(typeof i.seq!="number"||!Number.isFinite(i.seq)||typeof i.type!="string"||!i.type.includes("/")||i.type.includes("live-chunk")||i.type.includes("stream"))return null;const r=JSON.stringify(i);return{sessionId:n,seq:i.seq,type:i.type,...typeof i.time=="number"?{time:i.time}:{},event:i,bytes:new TextEncoder().encode(r).length}}function fy(){const n=new Map,i=[];let r=0;const u=new Map;return{async open(){return"ready"},async present(s){return new Set(s.filter(c=>n.has(c)))},async readChunks(s){const c=new Map;for(const d of s){const h=n.get(d);h&&c.set(d,h)}return c},async putChunks(s){for(const[c,d]of s){const h=n.get(c);h&&(r-=h.byteLength),n.set(c,d);const m=i.indexOf(c);m>=0&&i.splice(m,1),i.push(c),r+=d.byteLength}for(;r>Fx&&i.length>0;){const c=i.shift();if(!c)break;const d=n.get(c);d&&(r-=d.byteLength),n.delete(c)}},async readEvents(s){const c=u.get(s);return c?[...c.values()].sort((d,h)=>d.seq-h.seq):[]},async putEvents(s,c){const d=u.get(s)??new Map;u.set(s,d);for(const h of c)h.sessionId===s&&d.set(h.seq,h)}}}function Kx(n,i){return`${n}\0${i}`}function dy(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):null}function Kf(n){return new Promise((i,r)=>{n.onsuccess=()=>i(n.result),n.onerror=()=>r(n.error)})}function Jx(){let n=null;const i=()=>(n||(n=new Promise((r,u)=>{const s=indexedDB.open("dsh-bot",1);s.onupgradeneeded=()=>{const c=s.result;c.objectStoreNames.contains("chunks")||c.createObjectStore("chunks"),c.objectStoreNames.contains("events")||c.createObjectStore("events").createIndex("bySession","sessionId")},s.onsuccess=()=>r(s.result),s.onerror=()=>u(s.error)})),n);return{async open(){try{return await i(),"ready"}catch{return"unavailable"}},async present(r){const u=await i(),s=new Set,c=u.transaction("chunks","readonly").objectStore("chunks");return await Promise.all(r.map(async d=>{dy(await Kf(c.get(d)))&&s.add(d)})),s},async readChunks(r){const u=await i(),s=new Map,c=u.transaction("chunks","readonly").objectStore("chunks");return await Promise.all(r.map(async d=>{const h=dy(await Kf(c.get(d)));h&&s.set(d,h)})),s},async putChunks(r){const s=(await i()).transaction("chunks","readwrite"),c=s.objectStore("chunks");for(const[d,h]of r){const m=h.byteOffset===0&&h.byteLength===h.buffer.byteLength?h:h.slice();c.put(m,d)}await new Promise((d,h)=>{s.oncomplete=()=>d(),s.onerror=()=>h(s.error),s.onabort=()=>h(s.error)})},async readEvents(r){const c=(await i()).transaction("events","readonly").objectStore("events").index("bySession"),d=await Kf(c.getAll(r));return Array.isArray(d)?d.filter(h=>!!h&&typeof h=="object"&&typeof h.seq=="number").sort((h,m)=>h.seq-m.seq):[]},async putEvents(r,u){const c=(await i()).transaction("events","readwrite"),d=c.objectStore("events");for(const h of u)h.sessionId===r&&d.put(h,Kx(r,h.seq));await new Promise((h,m)=>{c.oncomplete=()=>h(),c.onerror=()=>m(c.error),c.onabort=()=>m(c.error)})}}}function $x(){if(typeof indexedDB>"u")return fy();const n=Jx(),i=fy();return{async open(){const r=await n.open();return r==="ready"?r:i.open()},async present(r){try{return await n.present(r)}catch{return i.present(r)}},async readChunks(r){try{return await n.readChunks(r)}catch{return i.readChunks(r)}},async putChunks(r){try{await n.putChunks(r)}catch{await i.putChunks(r)}},async readEvents(r){try{return await n.readEvents(r)}catch{return i.readEvents(r)}},async putEvents(r,u){try{await n.putEvents(r,u)}catch{await i.putEvents(r,u)}}}}async function ou(n,i){const r=await fetch(n,{...i,headers:{accept:"application/json",...i?.headers??{}}}),u=await r.json().catch(()=>({}));return{status:r.status,body:u&&typeof u=="object"?u:{}}}function x1(n,i){return typeof n.message=="string"&&n.message!==""?n.message:i}const Wx=/^(?:Name|名字)\s*[::]\s*(.+?)\s*$/i,Px=/^(?:Style|风格)\s*[::]\s*(.+?)\s*$/i,eS=/^(?:Task|任务)\s*[::]\s*(.+?)\s*$/i;function tS(n,i,r){const u=[];return n.trim()!==""&&u.push(`Name: ${n.trim()}`),i.trim()!==""&&u.push(`Style: ${i.trim()}`),r.trim()!==""&&u.push(`Task: ${r.trim()}`),u.join(`
10
10
 
11
11
  `)}function nS(n){const i={name:"",style:"",task:""};for(const r of n.split(`
12
- `)){const u=Wx.exec(r),s=Px.exec(r),c=eS.exec(r);u&&i.name===""?i.name=u[1]??"":s&&i.style===""?i.style=s[1]??"":c&&i.task===""&&(i.task=c[1]??"")}return i}const lS={"app.title":"DSH Bot","lang.switch":"中文","new.title":"New bot","new.close":"Close","new.lead":"The name shows in the list and is the bot's own name. Style and task become its persona.","new.name":"Bot name","new.style":"Bot style","new.task":"Bot task","new.namePlaceholder":"for example: Guide","new.stylePlaceholder":"for example: brief and direct","new.taskPlaceholder":"for example: turn the user's notes into short sentences","new.cancel":"Cancel","new.create":"Create","new.creating":"Creating","new.nameRequired":"Write this bot's name first.","new.created":'Created "{name}".',"new.createFailed":"Could not create the session.","new.personaFailed":"The session was created, but the persona was not applied.","session.search":"Search sessions","session.searchPlaceholder":"Search sessions","session.none":"No sessions yet.","session.noMatch":"No matching sessions.","session.running":"In progress","session.blank":"Blank","session.archived":"Archived","session.hide":"Hide","session.show":"Show","session.blankCount":"Blank sessions · {count}","session.archiveAll":"Archive all","session.purgeAll":"Delete all","session.archive":"Archive","session.purge":"Delete","session.archiveLabel":"Archive blank session {name}","session.purgeLabel":"Delete blank session {name}","session.archiveConfirm":"Archive {count} blank sessions? Sessions that already have messages stay. You can restore archived sessions from the official client.","session.purgeOneConfirm":'Delete "{name}" permanently? The log is removed from disk and cannot be restored from the archive.',"session.purgeAllConfirm":"Permanently delete {count} blank sessions? Logs are removed from disk and cannot be restored. Sessions that already have messages stay.","session.notBlankArchive":"This session already has content, so it cannot be removed as a blank session.","session.archiveFailed":"Could not remove this blank session.","session.archiveSomeFailed":"Some blank sessions could not be removed.","session.purgeNotBlank":"Only a blank session can be deleted permanently.","session.purgeFailed":"Could not delete this session permanently.","session.purgeSomeFailed":"Some blank sessions could not be deleted permanently.","session.listUnavailable":"The session list is unavailable.","session.unnamed":"New session","session.blankName":"Blank session","local.mark":"Me","local.here":"This machine","local.down":"Runtime unreachable","nav.back":"Back","nav.sessions":"Sessions","nav.botMessages":"Bot messages","nav.official":"Official client","nav.where":"Session location","nav.mainSession":"Main session","nav.worker":"Worker session","nav.pick":"Pick a session on the left, or create one.","nav.empty":"This session has no messages yet.","composer.mention":"Mention a bot","composer.noBot":"No matching bot","composer.interrupt":"Sending interrupts this reply","composer.mentionHint":"Message, or type @ to mention another bot","composer.task":"Message, or describe a task","composer.pick":"Choose a session","composer.add":"Add a file or a command","composer.command":"Insert a command","composer.filesLater":"Attaching files is not available yet.","composer.cancel":"Cancel","composer.send":"Send","composer.notSent":"The task was not sent.","composer.supplyFailed":"Not sent.","load.messages":"Loading messages…","load.messagesPct":"Loading messages… {pct}%","load.aria":"Loading messages","bot.waiting":"Waiting","bot.running":"Running","bot.stopped":"Stopped","bot.stoppedBackground":"This turn stopped. Background work is still running.","bot.retry":"Retry","bot.thinking":"Thinking","bot.replying":"Replying","bot.processed":"Done","bot.untitled":"Untitled","inbox.received":"sent a message","inbox.open":"Open bot messages, {who}: {line}","inbox.lead":"These are the words bots sent each other. They do not include the other bot's persona, memory, or permissions.","inbox.empty":"No bot messages yet.","inbox.other":"another bot","inbox.sentTo":"Sent to {name}","inbox.hop":"Hop {hop}","inbox.source":"Source","file.close":"Close","file.loading":"Reading the file…","file.error":"This file could not be opened","file.truncated":"Only the first 2000 lines are shown.","turn.rail":"Turns","turn.jump":"Jump to item {index}","work.status.accepted":"Accepted","work.status.enqueued":"Enqueued","work.status.started":"Started","work.status.needs_user":"Needs you","work.status.ready":"Candidate","work.status.delivered":"Delivered","work.status.cancelled":"Cancelled","work.status.failed":"Failed","work.ticket":"Ticket","work.preview.startedMany":"Started · {count}","work.placeholder.many":"Background work is running. You can say something else.","work.placeholder.started":"Background work has started. You can say something else.","work.placeholder.needsUser":"This box is still an ordinary message. Answer the ticket on the card above.","work.placeholder.ready":"Send a message. The result becomes delivered only after the assistant writes it into the chat.","work.placeholder.failed":"This ticket has failed. You can say something else.","work.fact.revision":"Generation {revision}","work.fact.accepted":"The ticket is recorded and is not on the execution queue yet.","work.fact.enqueued":"It is on the execution queue. The worker has not seen the task yet.","work.fact.elapsed":"Elapsed {time}","work.fact.wall":"Background limit is 10 minutes.","work.fact.needsUser":"This round has ended.","work.fact.ready":"This is not the reply in the chat yet.","work.fact.delivered":"The text is in the assistant reply.","work.fact.failed":"This ticket has failed.","work.fact.sameWorker":"It is still the same worker session.","work.fact.restart":"It returns to started after the worker sees the task again.","work.budgetFallback":"This one was not accepted. Unfinished tickets already hit the host concurrency limit.","work.openWorker":"Open the worker session","work.questionEmpty":"The worker asked a question.","work.questionStale":"The previous question is void.","work.answerLabel":"Reply to this ticket","work.answerSubmit":"Reply to this ticket","work.cancelTitle":"Cancellation note","work.taskTitle":"Task","work.generation":"Generation {revision}","work.duration":"Duration {value}","work.material":"Material {hash}","work.minutes":"{count} min","work.seconds":"{count} s","work.milliseconds":"{count} ms","basis.plain":"Ordinary session","basis.facts":"{head} · {count} facts","health.up":"Runtime is reachable","health.down":"Runtime is unreachable","health.modelReady":"The model catalog is available. You can send.","health.loading":"Reading the model catalog.","health.noProvider":"No model provider is configured, so execution is off.","health.catalogUnreadable":"The model catalog could not be read.","health.usageReady":"The usage endpoint returned data.","health.usageOff":"Usage is not connected.","health.sameSession":"The official client is at the site root. This page is /dsh-bot/. It is the same session.","health.primaryUnready":"This process has not issued a session cookie yet.","health.primaryDown":"The runtime could not be reached.","health.usageMissing":"The usage plugin is not installed.","health.usageUpstream":"The usage upstream is unavailable.","health.sessionUnreadable":"Could not tell whether the session is still running."},iS={"app.title":"DSH Bot","lang.switch":"English","new.title":"新建 BOT","new.close":"关闭","new.lead":"名字会显示在左侧列表里,也是这个 bot 自己的名字。风格和任务写进它的人格。","new.name":"Bot 名字","new.style":"Bot 风格","new.task":"Bot 任务","new.namePlaceholder":"例如:狗子","new.stylePlaceholder":"例如:幽默风趣","new.taskPlaceholder":"例如:把用户的话写成短句","new.cancel":"取消","new.create":"创建","new.creating":"正在创建","new.nameRequired":"先写上这个 bot 的名字。","new.created":"已创建「{name}」。","new.createFailed":"未能创建会话","new.personaFailed":"会话已创建,人格没有套上。","session.search":"搜索会话","session.searchPlaceholder":"搜索会话","session.none":"还没有会话。","session.noMatch":"没有匹配的会话。","session.running":"进行中","session.blank":"空白","session.archived":"已归档","session.hide":"收起","session.show":"展开","session.blankCount":"空白会话 · {count}","session.archiveAll":"全部归档","session.purgeAll":"全部彻底删除","session.archive":"归档","session.purge":"彻底删除","session.archiveLabel":"归档空白会话 {name}","session.purgeLabel":"彻底删除空白会话 {name}","session.archiveConfirm":"归档 {count} 个空白会话?已经有消息的会话会保留。归档后可以在原生界面的已归档列表里恢复。","session.purgeOneConfirm":"彻底删除「{name}」?日志会从磁盘去掉,不能从已归档列表恢复。","session.purgeAllConfirm":"彻底删除 {count} 个空白会话?日志会从磁盘去掉,不能恢复。已经有消息的会话会保留。","session.notBlankArchive":"这个会话已经有内容,不能当作空白会话删除。","session.archiveFailed":"没能删除这个空白会话。","session.archiveSomeFailed":"有的空白会话没能删除。","session.purgeNotBlank":"只有空白会话可以彻底删除。","session.purgeFailed":"没能彻底删除这个会话。","session.purgeSomeFailed":"有的空白会话没能彻底删除。","session.listUnavailable":"会话列表不可用","session.unnamed":"新会话","session.blankName":"空白会话","local.mark":"本","local.here":"本机","local.down":"主运行时不可达","nav.back":"返回","nav.sessions":"会话","nav.botMessages":"BOT 消息","nav.official":"原生界面","nav.where":"会话位置","nav.mainSession":"主会话","nav.worker":"执行会话","nav.pick":"从左边选一个会话,或新建一个。","nav.empty":"这个会话还没有消息。","composer.mention":"提及 BOT","composer.noBot":"没有匹配的 BOT","composer.interrupt":"发送会打断这一句","composer.mentionHint":"发消息,输入 @ 提及另一个 BOT","composer.task":"发消息,或描述一个任务","composer.pick":"选择一个会话","composer.add":"添加文件或调用指令","composer.command":"调用指令","composer.filesLater":"附带文件还不可用。","composer.cancel":"取消","composer.send":"发送","composer.notSent":"任务没有发送。","composer.supplyFailed":"没有送出。","load.messages":"正在加载消息…","load.messagesPct":"正在加载消息… {pct}%","load.aria":"正在加载消息","bot.waiting":"等待操作","bot.running":"运行中","bot.stopped":"已停下","bot.stoppedBackground":"这一轮已经停下。后台还在跑。","bot.retry":"重试","bot.thinking":"正在想","bot.replying":"正在回复","bot.processed":"已处理","bot.untitled":"未命名","inbox.received":"发来一条消息","inbox.open":"打开 BOT 消息,{who}:{line}","inbox.lead":"这里是 BOT 之间传来的正文,不带对方的人格、记忆或权限。","inbox.empty":"还没有 BOT 消息。","inbox.other":"另一个 BOT","inbox.sentTo":"发给 {name}","inbox.hop":"第 {hop} 跳","inbox.source":"来源","file.close":"关闭","file.loading":"正在读取文件…","file.error":"无法打开此文件","file.truncated":"只显示了前 2000 行。","turn.rail":"回合","turn.jump":"跳到第 {index} 处","work.status.accepted":"已受理","work.status.enqueued":"已派工","work.status.started":"已开始","work.status.needs_user":"需要用户","work.status.ready":"候选","work.status.delivered":"已交付","work.status.cancelled":"已取消","work.status.failed":"失败","work.ticket":"工单","work.preview.startedMany":"已开始 · {count} 张","work.placeholder.many":"后台都在跑,可以直接说别的","work.placeholder.started":"后台已开始,可以直接说别的","work.placeholder.needsUser":"这里仍是普通消息。回答工单用上面的卡片","work.placeholder.ready":"发消息。结果要由助手写进对话,才会变成已交付","work.placeholder.failed":"这张工单已经失败,可以直接说别的","work.fact.revision":"第 {revision} 代","work.fact.accepted":"工单已记下,还没进入执行队列","work.fact.enqueued":"已进入执行队列,执行会话还没有看到任务","work.fact.elapsed":"已进行 {time}","work.fact.wall":"后台上限 10 分钟","work.fact.needsUser":"这一轮已经结束","work.fact.ready":"这还不是对话里的答复","work.fact.delivered":"正文在对话里的助手回复中","work.fact.failed":"这张工单已经失败","work.fact.sameWorker":"还是原来的执行会话","work.fact.restart":"执行会话再次看到任务后,才会回到已开始","work.budgetFallback":"这张没有接住。未结束工单已经达到宿主并发上限。","work.openWorker":"打开执行会话","work.questionEmpty":"执行会话问了一个问题。","work.questionStale":"上一问已作废","work.answerLabel":"对这张工单的回答","work.answerSubmit":"回复这张工单","work.cancelTitle":"取消说明","work.taskTitle":"执行任务","work.generation":"第 {revision} 代","work.duration":"时长 {value}","work.material":"材料 {hash}","work.minutes":"{count} 分钟","work.seconds":"{count} 秒","work.milliseconds":"{count} 毫秒","basis.plain":"普通会话","basis.facts":"{head} · {count} 条事实","health.up":"主运行时可达","health.down":"主运行时不可达","health.modelReady":"模型目录可用,可以发送。","health.loading":"正在读取模型目录。","health.noProvider":"未配置模型提供方,执行已禁用","health.catalogUnreadable":"无法读取模型目录。","health.usageReady":"用量接口已返回数据。","health.usageOff":"用量未接入","health.sameSession":"原生界面在站点根路径,这里是 /dsh-bot/。同一个会话。","health.primaryUnready":"主运行时尚未交出启动令牌","health.primaryDown":"主运行时不可达","health.usageMissing":"用量插件未接入","health.usageUpstream":"用量上游不可用","health.sessionUnreadable":"无法读取会话是否仍在运行"},hy={en:lS,zh:iS},S1="dsh-bot.locale";function rS(){try{const n=localStorage.getItem(S1);if(n==="en"||n==="zh")return n}catch{}return"en"}function aS(n){try{localStorage.setItem(S1,n)}catch{}typeof document<"u"&&(document.documentElement.lang=n==="zh"?"zh-CN":"en")}function w1(n,i,r){const u=hy[n][i]??hy.en[i];return r?u.replace(/\{(\w+)\}/g,(s,c)=>r[c]??""):u}function Hl(n,i){return w1("en",n,i)}const uS={loading:"health.loading",no_provider:"health.noProvider",catalog_unreadable:"health.catalogUnreadable",primary_unready:"health.primaryUnready",primary_down:"health.primaryDown",usage_not_installed:"health.usageMissing",usage_unconfigured:"health.usageUpstream",session_unreadable:"health.sessionUnreadable"};function oS(n,i,r=Hl){const u=uS[n];return u?r(u):i}const k1=F.createContext({locale:"en",setLocale:()=>{},t:Hl});function sS({children:n}){const[i,r]=F.useState(()=>rS()),u=F.useCallback(d=>{aS(d),r(d)},[]),s=F.useCallback((d,h)=>w1(i,d,h),[i]),c=F.useMemo(()=>({locale:i,setLocale:u,t:s}),[i,u,s]);return w.jsx(k1.Provider,{value:c,children:n})}function wt(){return F.useContext(k1)}function rs({open:n,children:i,className:r}){const[u,s]=F.useState(n),[c,d]=F.useState(n);F.useLayoutEffect(()=>{if(n){s(!0);const g=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(g)}d(!1),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&s(!1)},[n]);function h(g){g.target!==g.currentTarget||g.propertyName!=="grid-template-rows"||n||s(!1)}const m=["coll-container",c?"expand":"",r].filter(Boolean).join(" ");return w.jsx("div",{className:m,onTransitionEnd:h,children:w.jsx("div",{children:u?i:null})})}function cS(n,i){const r={};return(n[n.length-1]===""?[...n,""]:n).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const fS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hS={};function my(n,i){return(hS.jsx?dS:fS).test(n)}const mS=/[ \t\n\f\r]/g;function pS(n){return typeof n=="object"?n.type==="text"?py(n.value):!1:py(n)}function py(n){return n.replace(mS,"")===""}class fu{constructor(i,r,u){this.normal=r,this.property=i,u&&(this.space=u)}}fu.prototype.normal={};fu.prototype.property={};fu.prototype.space=void 0;function T1(n,i){const r={},u={};for(const s of n)Object.assign(r,s.property),Object.assign(u,s.normal);return new fu(r,u,i)}function gd(n){return n.toLowerCase()}class bn{constructor(i,r){this.attribute=r,this.property=i}}bn.prototype.attribute="";bn.prototype.booleanish=!1;bn.prototype.boolean=!1;bn.prototype.commaOrSpaceSeparated=!1;bn.prototype.commaSeparated=!1;bn.prototype.defined=!1;bn.prototype.mustUseProperty=!1;bn.prototype.number=!1;bn.prototype.overloadedBoolean=!1;bn.prototype.property="";bn.prototype.spaceSeparated=!1;bn.prototype.space=void 0;let gS=0;const Oe=rr(),zt=rr(),yd=rr(),P=rr(),at=rr(),lr=rr(),Nn=rr();function rr(){return 2**++gS}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Oe,booleanish:zt,commaOrSpaceSeparated:Nn,commaSeparated:lr,number:P,overloadedBoolean:yd,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),Jf=Object.keys(bd);class Md extends bn{constructor(i,r,u,s){let c=-1;if(super(i,r),gy(this,"space",s),typeof u=="number")for(;++c<Jf.length;){const d=Jf[c];gy(this,Jf[c],(u&bd[d])===bd[d])}}}Md.prototype.defined=!0;function gy(n,i,r){r&&(n[i]=r)}function Jr(n){const i={},r={};for(const[u,s]of Object.entries(n.properties)){const c=new Md(u,n.transform(n.attributes||{},u),s,n.space);n.mustUseProperty&&n.mustUseProperty.includes(u)&&(c.mustUseProperty=!0),i[u]=c,r[gd(u)]=u,r[gd(c.attribute)]=u}return new fu(i,r,n.space)}const E1=Jr({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:P,ariaColIndex:P,ariaColSpan:P,ariaControls:at,ariaCurrent:null,ariaDescribedBy:at,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:at,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:at,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:at,ariaLevel:P,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:at,ariaPlaceholder:null,ariaPosInSet:P,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:at,ariaRowCount:P,ariaRowIndex:P,ariaRowSpan:P,ariaSelected:zt,ariaSetSize:P,ariaSort:null,ariaValueMax:P,ariaValueMin:P,ariaValueNow:P,ariaValueText:null,role:null},transform(n,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function C1(n,i){return i in n?n[i]:i}function A1(n,i){return C1(n,i.toLowerCase())}const yS=Jr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lr,acceptCharset:at,accessKey:at,action:null,allow:null,allowFullScreen:Oe,allowPaymentRequest:Oe,allowUserMedia:Oe,alpha:Oe,alt:null,as:null,async:Oe,autoCapitalize:null,autoComplete:at,autoFocus:Oe,autoPlay:Oe,blocking:at,capture:null,charSet:null,checked:Oe,cite:null,className:at,closedBy:null,colorSpace:null,cols:P,colSpan:P,command:null,commandFor:null,content:null,contentEditable:zt,controls:Oe,controlsList:at,coords:P|lr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Oe,defer:Oe,dir:null,dirName:null,disabled:Oe,download:yd,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Oe,formTarget:null,headers:at,height:P,hidden:yd,high:P,href:null,hrefLang:null,htmlFor:at,httpEquiv:at,id:null,imageSizes:null,imageSrcSet:null,inert:Oe,inputMode:null,integrity:null,is:null,isMap:Oe,itemId:null,itemProp:at,itemRef:at,itemScope:Oe,itemType:at,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Oe,low:P,manifest:null,max:null,maxLength:P,media:null,method:null,min:null,minLength:P,multiple:Oe,muted:Oe,name:null,nonce:null,noModule:Oe,noValidate:Oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Oe,optimum:P,pattern:null,ping:at,placeholder:null,playsInline:Oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Oe,referrerPolicy:null,rel:at,required:Oe,reversed:Oe,rows:P,rowSpan:P,sandbox:at,scope:null,scoped:Oe,seamless:Oe,selected:Oe,shadowRootClonable:Oe,shadowRootCustomElementRegistry:Oe,shadowRootDelegatesFocus:Oe,shadowRootMode:null,shadowRootSerializable:Oe,shape:null,size:P,sizes:null,slot:null,span:P,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:P,step:null,style:null,tabIndex:P,target:null,title:null,translate:null,type:null,typeMustMatch:Oe,useMap:null,value:zt,width:P,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:at,axis:null,background:null,bgColor:null,border:P,borderColor:null,bottomMargin:P,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Oe,declare:Oe,event:null,face:null,frame:null,frameBorder:null,hSpace:P,leftMargin:P,link:null,longDesc:null,lowSrc:null,marginHeight:P,marginWidth:P,noResize:Oe,noHref:Oe,noShade:Oe,noWrap:Oe,object:null,profile:null,prompt:null,rev:null,rightMargin:P,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:P,valueType:null,version:null,vAlign:null,vLink:null,vSpace:P,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Oe,disablePictureInPicture:Oe,disableRemotePlayback:Oe,exportParts:lr,part:at,prefix:null,property:null,results:P,security:null,unselectable:null},space:"html",transform:A1}),bS=Jr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Nn,accentHeight:P,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:P,amplitude:P,arabicForm:null,ascent:P,attributeName:null,attributeType:null,azimuth:P,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:P,by:null,calcMode:null,capHeight:P,className:at,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:P,diffuseConstant:P,direction:null,display:null,dur:null,divisor:P,dominantBaseline:null,download:Oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:P,enableBackground:null,end:null,event:null,exponent:P,externalResourcesRequired:null,fill:null,fillOpacity:P,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:lr,g2:lr,glyphName:lr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:P,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:P,horizOriginX:P,horizOriginY:P,id:null,ideographic:P,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:P,k:P,k1:P,k2:P,k3:P,k4:P,kernelMatrix:Nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:P,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:P,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:P,overlineThickness:P,paintOrder:null,panose1:null,path:null,pathLength:P,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:at,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:P,pointsAtY:P,pointsAtZ:P,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nn,rev:Nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nn,requiredFeatures:Nn,requiredFonts:Nn,requiredFormats:Nn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:P,specularExponent:P,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:P,strikethroughThickness:P,string:null,stroke:null,strokeDashArray:Nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:P,strokeOpacity:P,strokeWidth:null,style:null,surfaceScale:P,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Nn,tabIndex:P,tableValues:null,target:null,targetX:P,targetY:P,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:P,underlineThickness:P,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:P,values:null,vAlphabetic:P,vMathematical:P,vectorEffect:null,vHanging:P,vIdeographic:P,version:null,vertAdvY:P,vertOriginX:P,vertOriginY:P,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:P,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:C1}),N1=Jr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,i){return"xlink:"+i.slice(5).toLowerCase()}}),z1=Jr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:A1}),O1=Jr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,i){return"xml:"+i.slice(3).toLowerCase()}}),vS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xS=/[A-Z]/g,yy=/-[a-z]/g,SS=/^data[-\w.:]+$/i;function wS(n,i){const r=gd(i);let u=i,s=bn;if(r in n.normal)return n.property[n.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&SS.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(yy,TS);u="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!yy.test(c)){let d=c.replace(xS,kS);d.charAt(0)!=="-"&&(d="-"+d),i="data"+d}}s=Md}return new s(u,i)}function kS(n){return"-"+n.toLowerCase()}function TS(n){return n.charAt(1).toUpperCase()}const ES=T1([E1,yS,N1,z1,O1],"html"),Dd=T1([E1,bS,N1,z1,O1],"svg");function CS(n){return n.join(" ").trim()}var by=/\/\*(?:[^*]|\*(?!\/))*\*\//g,AS=/\n/g,NS=/^\s*/,zS=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,OS=/^:\s*/,_S=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,jS=/^[;\s]*/,MS=`
13
- `,vy="/",xy="*",eu="",DS="comment",RS="declaration";function LS(n,i){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];i=i||{};var r=1,u=1;function s(k){var A=k.match(AS);A&&(r+=A.length);var R=k.lastIndexOf(MS);u=~R?k.length-R:u+k.length}function c(){var k={line:r,column:u};return function(A){return A.position=new d(k),g(),A}}function d(k){this.start=k,this.end={line:r,column:u},this.source=i.source}d.prototype.content=n;function h(k){var A=new Error(i.source+":"+r+":"+u+": "+k);if(A.reason=k,A.filename=i.source,A.line=r,A.column=u,A.source=n,!i.silent)throw A}function m(k){var A=k.exec(n);if(A){var R=A[0];return s(R),n=n.slice(R.length),A}}function g(){m(NS)}function y(k){for(var A;A=p();)k.push(A);return k}function p(){var k=c();if(!(vy!=n.charAt(0)||xy!=n.charAt(1))){for(var A=2;eu!=n.charAt(A)&&(xy!=n.charAt(A)||vy!=n.charAt(A+1));)++A;if(A+=2,eu===n.charAt(A-1))return h("End of comment missing");var R=n.slice(2,A-2);return u+=2,s(R),n=n.slice(A),u+=2,k({type:DS,comment:R})}}function S(){var k=c(),A=m(zS);if(A){if(p(),!m(OS))return h("property missing ':'");var R=m(_S),C=k({type:RS,property:A[0].replace(by,eu).trim(),value:R?R[0].replace(by,eu).trim():eu});return m(jS),C}}function v(){var k=[];y(k);for(var A;A=S();)k.push(A),y(k);return k}return g(),v()}function BS(n,i){let r=null;if(!n||typeof n!="string")return r;const u=LS(n),s=typeof i=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;s?i(d,h,c):h&&(r=r??{},r[d]=h)}),r}const _1=j1("end"),Rd=j1("start");function j1(n){return i;function i(r){const u=r&&r.position&&r.position[n]||{};if(typeof u.line=="number"&&u.line>0&&typeof u.column=="number"&&u.column>0)return{line:u.line,column:u.column,offset:typeof u.offset=="number"&&u.offset>-1?u.offset:void 0}}}function US(n){const i=Rd(n),r=_1(n);if(i&&r)return{start:i,end:r}}function iu(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?Sy(n.position):"start"in n||"end"in n?Sy(n):"line"in n||"column"in n?vd(n):""}function vd(n){return wy(n&&n.line)+":"+wy(n&&n.column)}function Sy(n){return vd(n&&n.start)+"-"+vd(n&&n.end)}function wy(n){return n&&typeof n=="number"?n:1}class as extends Error{constructor(i,r,u){super(),typeof r=="string"&&(u=r,r=void 0);let s="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof i=="string"?s=i:!c.cause&&i&&(d=!0,s=i.message,c.cause=i),!c.ruleId&&!c.source&&typeof u=="string"){const m=u.indexOf(":");m===-1?c.ruleId=u:(c.source=u.slice(0,m),c.ruleId=u.slice(m+1))}if(!c.place&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const h=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=h?h.line:void 0,this.name=iu(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Object.defineProperties(as.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const Ld={}.hasOwnProperty,qS=new Map,HS=/[A-Z]/g,YS=/-([a-z])/g,IS=new Set(["table","tbody","thead","tfoot","tr"]),VS=new Set(["td","th"]),M1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function GS(n,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let u;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");u=WS(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");u=$S(r,i.jsx,i.jsxs)}const s={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:u,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Dd:ES,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},c=D1(s,n,void 0);return c&&typeof c!="string"?c:s.create(n,s.Fragment,{children:c||void 0},void 0)}function D1(n,i,r){if(i.type==="element")return QS(n,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return XS(n,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return FS(n,i,r);if(i.type==="mdxjsEsm")return ZS(n,i);if(i.type==="root")return KS(n,i,r);if(i.type==="text")return JS(n,i)}function QS(n,i,r){const u=n.schema;let s=u;i.tagName.toLowerCase()==="svg"&&u.space==="html"&&(s=Dd,n.schema=s),n.ancestors.push(i);const c=L1(n,i.tagName,!1),d=PS(n,i);let h=Ud(n,i);return IS.has(i.tagName)&&(h=h.filter(function(m){return typeof m=="string"?!pS(m):!0})),R1(n,d,c,i),Bd(d,h),n.ancestors.pop(),n.schema=u,n.create(i,c,d,r)}function XS(n,i){if(i.data&&i.data.estree&&n.evaluater){const u=i.data.estree.body[0];return u.type,n.evaluater.evaluateExpression(u.expression)}su(n,i.position)}function ZS(n,i){if(i.data&&i.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(i.data.estree);su(n,i.position)}function FS(n,i,r){const u=n.schema;let s=u;i.name==="svg"&&u.space==="html"&&(s=Dd,n.schema=s),n.ancestors.push(i);const c=i.name===null?n.Fragment:L1(n,i.name,!0),d=ew(n,i),h=Ud(n,i);return R1(n,d,c,i),Bd(d,h),n.ancestors.pop(),n.schema=u,n.create(i,c,d,r)}function KS(n,i,r){const u={};return Bd(u,Ud(n,i)),n.create(i,n.Fragment,u,r)}function JS(n,i){return i.value}function R1(n,i,r,u){typeof r!="string"&&r!==n.Fragment&&n.passNode&&(i.node=u)}function Bd(n,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(n.children=r)}}function $S(n,i,r){return u;function u(s,c,d,h){const g=Array.isArray(d.children)?r:i;return h?g(c,d,h):g(c,d)}}function WS(n,i){return r;function r(u,s,c,d){const h=Array.isArray(c.children),m=Rd(u);return i(s,c,d,h,{columnNumber:m?m.column-1:void 0,fileName:n,lineNumber:m?m.line:void 0},void 0)}}function PS(n,i){const r={};let u,s;for(s in i.properties)if(s!=="children"&&Ld.call(i.properties,s)){const c=tw(n,s,i.properties[s]);if(c){const[d,h]=c;n.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&VS.has(i.tagName)?u=h:r[d]=h}}if(u){const c=r.style||(r.style={});c[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=u}return r}function ew(n,i){const r={};for(const u of i.attributes)if(u.type==="mdxJsxExpressionAttribute")if(u.data&&u.data.estree&&n.evaluater){const c=u.data.estree.body[0];c.type;const d=c.expression;d.type;const h=d.properties[0];h.type,Object.assign(r,n.evaluater.evaluateExpression(h.argument))}else su(n,i.position);else{const{name:s}=u;let c;if(u.value&&typeof u.value=="object")if(u.value.data&&u.value.data.estree&&n.evaluater){const h=u.value.data.estree.body[0];h.type,c=n.evaluater.evaluateExpression(h.expression)}else su(n,i.position);else c=u.value===null?!0:u.value;r[s]=c}return r}function Ud(n,i){const r=[];let u=-1;const s=n.passKeys?new Map:qS;for(;++u<i.children.length;){const c=i.children[u];let d;if(n.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const g=s.get(m)||0;d=m+"-"+g,s.set(m,g+1)}}const h=D1(n,c,d);h!==void 0&&r.push(h)}return r}function tw(n,i,r){if(r==null||typeof r=="number"&&Number.isNaN(r))return;const u=wS(n.schema,i);return Array.isArray(r)&&(r=u.commaSeparated?cS(r):CS(r)),u.property==="style"?["style",typeof r=="object"?n.stylePropertyNameCase==="dom"?r:lw(r):nw(n,String(r))]:[n.elementAttributeNameCase==="react"&&u.space?vS[u.property]||u.property:u.attribute,r]}function nw(n,i){const r={};try{BS(i,function(u,s){if(u&&s){let c=u;c.slice(0,2)!=="--"&&(c=c.toLowerCase(),n.stylePropertyNameCase==="dom"&&(c.slice(0,4)==="-ms-"&&(c=c.slice(1)),c=c.replace(YS,aw))),r[c]=s}})}catch(u){if(n.ignoreInvalidStyle)return{};const s=u,c=new as("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=n.filePath||void 0,c.url=M1+"#cannot-parse-style-attribute",c}return r}function L1(n,i,r){let u;if(!r)u={type:"Literal",value:i};else if(i.includes(".")){const s=i.split(".");let c=-1,d;for(;++c<s.length;){const h=my(s[c])?{type:"Identifier",name:s[c]}:{type:"Literal",value:s[c]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}u=d}else u=my(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(u.type==="Literal"){const s=u.value;return Ld.call(n.components,s)?n.components[s]:s}if(n.evaluater)return n.evaluater.evaluateExpression(u);su(n)}function su(n,i){const r=new as("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=n.filePath||void 0,r.url=M1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function lw(n){const i={};let r;for(r in n)Ld.call(n,r)&&(i[iw(r)]=n[r]);return i}function iw(n){if(n.slice(0,2)==="--")return n;let i=n.replace(HS,rw);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function rw(n){return"-"+n.toLowerCase()}function aw(n,i){return i.toUpperCase()}const $f={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},uw={};function us(n,i){const r=uw,u=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return B1(n,u,s)}function B1(n,i,r){if(ow(n)){if("value"in n)return n.type==="html"&&!r?"":n.value;if(i&&"alt"in n&&n.alt)return n.alt;if("children"in n)return ky(n.children,i,r)}return Array.isArray(n)?ky(n,i,r):""}function ky(n,i,r){const u=[];let s=-1;for(;++s<n.length;)u[s]=B1(n[s],i,r);return u.join("")}function ow(n){return!!(n&&typeof n=="object")}const Ty=document.createElement("i");function qd(n){const i="&"+n+";";Ty.innerHTML=i;const r=Ty.textContent;return r.charCodeAt(r.length-1)===59&&n!=="semi"||r===i?!1:r}function Pn(n,i,r,u){const s=n.length;let c=0,d;if(i<0?i=-i>s?0:s+i:i=i>s?s:i,r=r>0?r:0,u.length<1e4)d=Array.from(u),d.unshift(i,r),n.splice(...d);else for(r&&n.splice(i,r);c<u.length;)d=u.slice(c,c+1e4),d.unshift(i,0),n.splice(...d),c+=1e4,i+=1e4}function In(n,i){return n.length>0?(Pn(n,n.length,0,i),n):i}const Ey={}.hasOwnProperty;function U1(n){const i={};let r=-1;for(;++r<n.length;)sw(i,n[r]);return i}function sw(n,i){let r;for(r in i){const s=(Ey.call(n,r)?n[r]:void 0)||(n[r]={}),c=i[r];let d;if(c)for(d in c){Ey.call(s,d)||(s[d]=[]);const h=c[d];cw(s[d],Array.isArray(h)?h:h?[h]:[])}}}function cw(n,i){let r=-1;const u=[];for(;++r<i.length;)(i[r].add==="after"?n:u).push(i[r]);Pn(n,0,0,u)}function q1(n,i){const r=Number.parseInt(n,i);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function el(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kt=Ei(/[A-Za-z]/),Jt=Ei(/[\dA-Za-z]/),fw=Ei(/[#-'*+\--9=?A-Z^-~]/);function Ko(n){return n!==null&&(n<32||n===127)}const xd=Ei(/\d/),dw=Ei(/[\dA-Fa-f]/),H1=Ei(/[!-/:-@[-`{-~]/);function Se(n){return n!==null&&n<-2}function ut(n){return n!==null&&(n<0||n===32)}function Be(n){return n===-2||n===-1||n===32}const du=Ei(new RegExp("\\p{P}|\\p{S}","u")),ir=Ei(/\s/);function Ei(n){return i;function i(r){return r!==null&&r>-1&&n.test(String.fromCharCode(r))}}function $r(n){const i=[];let r=-1,u=0,s=0;for(;++r<n.length;){const c=n.charCodeAt(r);let d="";if(c===37&&Jt(n.charCodeAt(r+1))&&Jt(n.charCodeAt(r+2)))s=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const h=n.charCodeAt(r+1);c<56320&&h>56319&&h<57344?(d=String.fromCharCode(c,h),s=1):d="�"}else d=String.fromCharCode(c);d&&(i.push(n.slice(u,r),encodeURIComponent(d)),u=r+s+1,d=""),s&&(r+=s,s=0)}return i.join("")+n.slice(u)}function Ke(n,i,r,u){const s=u?u-1:1/0;let c=0;return d;function d(m){return Be(m)?(n.enter(r),h(m)):i(m)}function h(m){return Be(m)&&c++<s?(n.consume(m),h):(n.exit(r),i(m))}}function Y1(n,i,r,u,s,c){let d=0;return h;function h(y){return Be(y)?(n.enter(u),m(y)):g(y)}function m(y){return Be(y)&&d<c?(n.consume(y),d++,m):(n.exit(u),g(y))}function g(y){return d>=s?i(y):r(y)}}const hw={tokenize:mw};function mw(n){const i=n.attempt(this.parser.constructs.contentInitial,u,s);let r;return i;function u(h){if(h===null){n.consume(h);return}return n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),Ke(n,i,"linePrefix")}function s(h){return n.enter("paragraph"),c(h)}function c(h){const m=n.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,d(h)}function d(h){if(h===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(h);return}return Se(h)?(n.consume(h),n.exit("chunkText"),c):(n.consume(h),d)}}let Jo=class{constructor(){this.index=new Map,this.map=[]}add(i,r,u){Cy(this,i,r,u,!1)}addBefore(i,r,u){Cy(this,i,r,u,!0)}consume(i){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const u=[];for(;r>0;)r-=1,u.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];u.push(i.slice()),i.length=0;let s=u.pop();for(;s;){for(const c of s)i.push(c);s=u.pop()}this.map.length=0,this.index.clear()}};function Cy(n,i,r,u,s){if(r===0&&u.length===0)return;const c=n.index.get(i);if(c){c[1]+=r,s?(u.push(...c[2]),c[2]=u):c[2].push(...u);return}const d=[i,r,u];n.map.push(d),n.index.set(i,d)}const pw={tokenize:gw},Ay={tokenize:yw};function gw(n){const i=this,r=[];let u=0,s,c,d;return h;function h(G){if(u<r.length){const ne=r[u];return i.containerState=ne[1],n.attempt(ne[0].continuation,m,g)(G)}return g(G)}function m(G){if(u++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,s&&I();const ne=i.events.length;let le=ne,H;for(;le--;)if(i.events[le][0]==="exit"&&i.events[le][1].type==="chunkFlow"){H=i.events[le][1].end;break}C(u);let Z=ne;for(;Z<i.events.length;)i.events[Z][1].end={...H},Z++;const K=new Jo;return K.add(le+1,0,i.events.slice(ne)),K.add(ne,Z-ne,[]),K.consume(i.events),g(G)}return h(G)}function g(G){if(u===r.length){if(!s)return S(G);if(s.currentConstruct&&s.currentConstruct.concrete)return k(G);i.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return i.containerState={},n.check(Ay,y,p)(G)}function y(G){return s&&I(),C(u),S(G)}function p(G){return i.parser.lazy[i.now().line]=u!==r.length,d=i.now().offset,k(G)}function S(G){return i.containerState={},n.attempt(Ay,v,k)(G)}function v(G){return u++,r.push([i.currentConstruct,i.containerState]),S(G)}function k(G){if(G===null){s&&I(),C(0),n.consume(G);return}return s=s||i.parser.flow(i.now()),n.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:c}),A(G)}function A(G){if(G===null){R(n.exit("chunkFlow"),!0),C(0),n.consume(G);return}return Se(G)?(n.consume(G),R(n.exit("chunkFlow")),u=0,i.interrupt=void 0,h):(n.consume(G),A)}function R(G,ne){const le=i.sliceStream(G);if(ne&&le.push(null),G.previous=c,c&&(c.next=G),c=G,s.defineSkip(G.start),s.write(le),i.parser.lazy[G.start.line]){let H=s.events.length;for(;H--;)if(s.events[H][1].start.offset<d&&(!s.events[H][1].end||s.events[H][1].end.offset>d))return;const Z=i.events.length;let K=Z,de,U;for(;K--;)if(i.events[K][0]==="exit"&&i.events[K][1].type==="chunkFlow"){if(de){U=i.events[K][1].end;break}de=!0}for(C(u),H=Z;H<i.events.length;)i.events[H][1].end={...U},H++;const $=new Jo;$.add(K+1,0,i.events.slice(Z)),$.add(Z,H-Z,[]),$.consume(i.events)}}function C(G){let ne=r.length;for(;ne-- >G;){const le=r[ne];i.containerState=le[1],le[0].exit.call(i,n)}r.length=G}function I(){s.write([null]),c=void 0,s=void 0,i.containerState._closeFlow=void 0}}function yw(n,i,r){return Ke(n,n.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ti(n){if(n===null||ut(n)||ir(n))return 1;if(du(n))return 2}function os(n,i,r){const u=[];let s=-1;for(;++s<n.length;){const c=n[s].resolveAll;c&&!u.includes(c)&&(i=c(i,r),u.push(c))}return i}const Sd={name:"attention",resolveAll:bw,tokenize:vw};function bw(n,i){let r=-1,u;for(;++r<n.length;)if(n[r][0]==="enter"&&n[r][1].type==="attentionSequence"&&n[r][1]._close){let s=r;for(;s--;)if(n[s][0]==="exit"&&n[s][1].type==="attentionSequence"&&n[s][1]._open&&i.sliceSerialize(n[s][1]).charCodeAt(0)===i.sliceSerialize(n[r][1]).charCodeAt(0)){if((n[s][1]._close||n[r][1]._open)&&(n[r][1].end.offset-n[r][1].start.offset)%3&&!((n[s][1].end.offset-n[s][1].start.offset+n[r][1].end.offset-n[r][1].start.offset)%3))continue;const c=n[s][1].end.offset-n[s][1].start.offset>1&&n[r][1].end.offset-n[r][1].start.offset>1?2:1,d={...n[s][1].end},h={...n[r][1].start};Ny(d,-c),Ny(h,c);const m={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...n[s][1].end}},g={type:c>1?"strongSequence":"emphasisSequence",start:{...n[r][1].start},end:h},y={type:c>1?"strongText":"emphasisText",start:{...n[s][1].end},end:{...n[r][1].start}},p={type:c>1?"strong":"emphasis",start:{...m.start},end:{...g.end}};n[s][1].end={...m.start},n[r][1].start={...g.end},u=[],n[s][1].end.offset-n[s][1].start.offset&&(u=In(u,[["enter",n[s][1],i],["exit",n[s][1],i]])),u=In(u,[["enter",p,i],["enter",m,i],["exit",m,i],["enter",y,i]]),u=In(u,os(i.parser.constructs.insideSpan.null,n.slice(s+1,r),i)),u=In(u,[["exit",y,i],["enter",g,i],["exit",g,i],["exit",p,i]]);let S=0;n[r][1].end.offset-n[r][1].start.offset&&(S=2,u=In(u,[["enter",n[r][1],i],["exit",n[r][1],i]])),Pn(n,s-1,r-s+3,u),r=s+u.length-S-2;break}}for(r=-1;++r<n.length;)n[r][1].type==="attentionSequence"&&(n[r][1].type="data");return n}function vw(n,i){const r=this.parser.constructs.attentionMarkers.null,u=this.previous,s=Ti(u);let c;return d;function d(m){return c=m,n.enter("attentionSequence"),h(m)}function h(m){if(m===c)return n.consume(m),h;const g=n.exit("attentionSequence"),y=Ti(m),p=!y||y===2&&s||r.includes(m)&&m!==42&&m!==95,S=!s||s===2&&y||r.includes(u)&&u!==42&&u!==95;return g._open=!!(c===42?p:p&&(s||!S)),g._close=!!(c===42?S:S&&(y||!p)),i(m)}}function Ny(n,i){n.column+=i,n.offset+=i,n._bufferIndex+=i}const xw={name:"autolink",tokenize:Sw};function Sw(n,i,r){let u=0;return s;function s(v){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),c}function c(v){return Kt(v)?(n.consume(v),d):v===64?r(v):g(v)}function d(v){return v===43||v===45||v===46||Jt(v)?(u=1,h(v)):g(v)}function h(v){return v===58?(n.consume(v),u=0,m):(v===43||v===45||v===46||Jt(v))&&u++<32?(n.consume(v),h):(u=0,g(v))}function m(v){return v===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.exit("autolink"),i):v===null||v===32||v===60||Ko(v)?r(v):(n.consume(v),m)}function g(v){return v===64?(n.consume(v),y):fw(v)?(n.consume(v),g):r(v)}function y(v){return Jt(v)?p(v):r(v)}function p(v){return v===46?(n.consume(v),u=0,y):v===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.exit("autolink"),i):S(v)}function S(v){if((v===45||Jt(v))&&u++<63){const k=v===45?S:p;return n.consume(v),k}return r(v)}}const hu={partial:!0,tokenize:ww};function ww(n,i,r){return u;function u(c){return Be(c)?Ke(n,s,"linePrefix")(c):s(c)}function s(c){return c===null||Se(c)?i(c):r(c)}}const I1={continuation:{tokenize:Tw},exit:Ew,name:"blockQuote",tokenize:kw};function kw(n,i,r){const u=this;return s;function s(d){if(d===62){const h=u.containerState;return h.open||(n.enter("blockQuote",{_container:!0}),h.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(d),n.exit("blockQuoteMarker"),c}return r(d)}function c(d){return Be(d)?(n.enter("blockQuotePrefixWhitespace"),n.consume(d),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),i):(n.exit("blockQuotePrefix"),i(d))}}function Tw(n,i,r){const u=this;return s;function s(d){return Be(d)?Ke(n,c,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return n.attempt(I1,i,r)(d)}}function Ew(n){n.exit("blockQuote")}const V1={name:"characterEscape",tokenize:Cw};function Cw(n,i,r){return u;function u(c){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(c),n.exit("escapeMarker"),s}function s(c){return H1(c)?(n.enter("characterEscapeValue"),n.consume(c),n.exit("characterEscapeValue"),n.exit("characterEscape"),i):r(c)}}const G1={name:"characterReference",tokenize:Aw};function Aw(n,i,r){const u=this;let s=0,c,d;return h;function h(p){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(p),n.exit("characterReferenceMarker"),m}function m(p){return p===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(p),n.exit("characterReferenceMarkerNumeric"),g):(n.enter("characterReferenceValue"),c=31,d=Jt,y(p))}function g(p){return p===88||p===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(p),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),c=6,d=dw,y):(n.enter("characterReferenceValue"),c=7,d=xd,y(p))}function y(p){if(p===59&&s){const S=n.exit("characterReferenceValue");return d===Jt&&!qd(u.sliceSerialize(S))?r(p):(n.enter("characterReferenceMarker"),n.consume(p),n.exit("characterReferenceMarker"),n.exit("characterReference"),i)}return d(p)&&s++<c?(n.consume(p),y):r(p)}}const wd={partial:!0,tokenize:Nw};function Nw(n,i,r){const u=this;return s;function s(d){return d===null?r(d):(n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),c)}function c(d){return u.parser.lazy[u.now().line]?r(d):i(d)}}const zy={concrete:!0,name:"codeFenced",tokenize:zw};function zw(n,i,r){const u=this,s={partial:!0,tokenize:le};let c=0,d=0,h;return m;function m(H){return g(H)}function g(H){const Z=u.events[u.events.length-1];return c=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,h=H,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),y(H)}function y(H){return H===h?(d++,n.consume(H),y):d<3?r(H):(n.exit("codeFencedFenceSequence"),Be(H)?Ke(n,p,"whitespace")(H):p(H))}function p(H){return H===null||Se(H)?(n.exit("codeFencedFence"),u.interrupt?i(H):n.check(wd,A,ne)(H)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),S(H))}function S(H){return H===null||Se(H)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),p(H)):Be(H)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),Ke(n,v,"whitespace")(H)):H===96&&H===h?r(H):(n.consume(H),S)}function v(H){return H===null||Se(H)?p(H):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),k(H))}function k(H){return H===null||Se(H)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),p(H)):H===96&&H===h?r(H):(n.consume(H),k)}function A(H){return n.attempt(s,ne,R)(H)}function R(H){return n.enter("lineEnding"),n.consume(H),n.exit("lineEnding"),C}function C(H){return c>0&&Be(H)?Ke(n,I,"linePrefix",c+1)(H):I(H)}function I(H){return H===null||Se(H)?n.check(wd,A,ne)(H):(n.enter("codeFlowValue"),G(H))}function G(H){return H===null||Se(H)?(n.exit("codeFlowValue"),I(H)):(n.consume(H),G)}function ne(H){return n.exit("codeFenced"),i(H)}function le(H,Z,K){let de=0;return U;function U(be){return H.enter("lineEnding"),H.consume(be),H.exit("lineEnding"),$}function $(be){return H.enter("codeFencedFence"),Be(be)?Ke(H,ue,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(be):ue(be)}function ue(be){return be===h?(H.enter("codeFencedFenceSequence"),Ce(be)):K(be)}function Ce(be){return be===h?(de++,H.consume(be),Ce):de>=d?(H.exit("codeFencedFenceSequence"),Be(be)?Ke(H,Ue,"whitespace")(be):Ue(be)):K(be)}function Ue(be){return be===null||Se(be)?(H.exit("codeFencedFence"),Z(be)):K(be)}}}const Wf={name:"codeIndented",tokenize:_w},Ow={partial:!0,tokenize:jw};function _w(n,i,r){return u;function u(h){return n.enter("codeIndented"),Y1(n,s,r,"linePrefix",4,4)(h)}function s(h){return h===null?d(h):Se(h)?n.attempt(Ow,s,d)(h):(n.enter("codeFlowValue"),c(h))}function c(h){return h===null||Se(h)?(n.exit("codeFlowValue"),s(h)):(n.consume(h),c)}function d(h){return n.exit("codeIndented"),i(h)}}function jw(n,i,r){const u=this;return s;function s(d){return u.parser.lazy[u.now().line]?r(d):Se(d)?(n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),s):Y1(n,i,c,"linePrefix",4,4)(d)}function c(d){return Se(d)?s(d):r(d)}}const Mw={name:"codeText",previous:Rw,resolve:Dw,tokenize:Lw};function Dw(n){let i=n.length-4,r=3,u,s;if((n[r][1].type==="lineEnding"||n[r][1].type==="space")&&(n[i][1].type==="lineEnding"||n[i][1].type==="space")){for(u=r;++u<i;)if(n[u][1].type==="codeTextData"){n[r][1].type="codeTextPadding",n[i][1].type="codeTextPadding",r+=2,i-=2;break}}for(u=r-1,i++;++u<=i;)s===void 0?u!==i&&n[u][1].type!=="lineEnding"&&(s=u):(u===i||n[u][1].type==="lineEnding")&&(n[s][1].type="codeTextData",u!==s+2&&(n[s][1].end=n[u-1][1].end,n.splice(s+2,u-s-2),i-=u-s-2,u=s+2),s=void 0);return n}function Rw(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Lw(n,i,r){let u=0,s,c;return d;function d(p){return n.enter("codeText"),n.enter("codeTextSequence"),h(p)}function h(p){return p===96?(n.consume(p),u++,h):(n.exit("codeTextSequence"),m(p))}function m(p){return p===null?r(p):p===32?(n.enter("space"),n.consume(p),n.exit("space"),m):p===96?(c=n.enter("codeTextSequence"),s=0,y(p)):Se(p)?(n.enter("lineEnding"),n.consume(p),n.exit("lineEnding"),m):(n.enter("codeTextData"),g(p))}function g(p){return p===null||p===32||p===96||Se(p)?(n.exit("codeTextData"),m(p)):(n.consume(p),g)}function y(p){return p===96?(n.consume(p),s++,y):s===u?(n.exit("codeTextSequence"),n.exit("codeText"),i(p)):(c.type="codeTextData",g(p))}}class Bw{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,r){const u=r??Number.POSITIVE_INFINITY;return u<this.left.length?this.left.slice(i,u):i>this.left.length?this.right.slice(this.right.length-u+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-u+this.left.length).reverse())}splice(i,r,u){const s=r||0;this.setCursor(Math.trunc(i));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return u&&tu(this.left,u),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),tu(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),tu(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const r=this.left.splice(i,Number.POSITIVE_INFINITY);tu(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);tu(this.left,r.reverse())}}}function tu(n,i){let r=0;if(i.length<1e4)n.push(...i);else for(;r<i.length;)n.push(...i.slice(r,r+1e4)),r+=1e4}function Q1(n){const i={};let r=-1,u,s,c,d,h,m,g;const y=new Bw(n);for(;++r<y.length;){for(;r in i;)r=i[r];if(u=y.get(r),r&&u[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=u[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(u[0]==="enter")u[1].contentType&&(Object.assign(i,Uw(y,r)),r=i[r],g=!0);else if(u[1]._container){for(c=r,s=void 0;c--;)if(d=y.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(s&&(y.get(s)[1].type="lineEndingBlank"),d[1].type="lineEnding",s=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;s&&(u[1].end={...y.get(s)[1].start},h=y.slice(s,r),h.unshift(u),y.splice(s,r-s+1,h))}}return Pn(n,0,Number.POSITIVE_INFINITY,y.slice(0)),!g}function Uw(n,i){const r=n.get(i)[1],u=n.get(i)[2];let s=i-1;const c=[];let d=r._tokenizer;d||(d=u.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,m=[],g={};let y,p,S=-1,v=r,k=0,A=0;const R=[A];for(;v;){for(;n.get(++s)[1]!==v;);c.push(s),v._tokenizer||(y=u.sliceStream(v),v.next||y.push(null),p&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(y),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),p=v,v=v.next}for(v=r;++S<h.length;)h[S][0]==="exit"&&h[S-1][0]==="enter"&&h[S][1].type===h[S-1][1].type&&h[S][1].start.line!==h[S][1].end.line&&(A=S+1,R.push(A),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):R.pop(),S=R.length;S--;){const C=h.slice(R[S],R[S+1]),I=c.pop();m.push([I,I+C.length-1]),n.splice(I,2,C)}for(m.reverse(),S=-1;++S<m.length;)g[k+m[S][0]]=k+m[S][1],k+=m[S][1]-m[S][0]-1;return g}const qw={resolve:Yw,tokenize:Iw},Hw={partial:!0,tokenize:Vw};function Yw(n){return Q1(n),n}function Iw(n,i){let r;return u;function u(h){return n.enter("content"),r=n.enter("chunkContent",{contentType:"content"}),s(h)}function s(h){return h===null?c(h):Se(h)?n.check(Hw,d,c)(h):(n.consume(h),s)}function c(h){return n.exit("chunkContent"),n.exit("content"),i(h)}function d(h){return n.consume(h),n.exit("chunkContent"),r.next=n.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function Vw(n,i,r){const u=this;return s;function s(d){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),Ke(n,c,"linePrefix")}function c(d){if(d===null||Se(d))return r(d);const h=u.events[u.events.length-1];return!u.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(d):n.interrupt(u.parser.constructs.flow,r,i)(d)}}function X1(n,i,r,u,s,c,d,h,m){const g=m||Number.POSITIVE_INFINITY;let y=0;return p;function p(C){return C===60?(n.enter(u),n.enter(s),n.enter(c),n.consume(C),n.exit(c),S):C===null||C===32||C===41||Ko(C)?r(C):(n.enter(u),n.enter(d),n.enter(h),n.enter("chunkString",{contentType:"string"}),A(C))}function S(C){return C===62?(n.enter(c),n.consume(C),n.exit(c),n.exit(s),n.exit(u),i):(n.enter(h),n.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(n.exit("chunkString"),n.exit(h),S(C)):C===null||C===60||Se(C)?r(C):(n.consume(C),C===92?k:v)}function k(C){return C===60||C===62||C===92?(n.consume(C),v):v(C)}function A(C){return!y&&(C===null||C===41||ut(C))?(n.exit("chunkString"),n.exit(h),n.exit(d),n.exit(u),i(C)):y<g&&C===40?(n.consume(C),y++,A):C===41?(n.consume(C),y--,A):C===null||C===32||C===40||Ko(C)?r(C):(n.consume(C),C===92?R:A)}function R(C){return C===40||C===41||C===92?(n.consume(C),A):A(C)}}function Z1(n,i,r,u,s,c){const d=this;let h=0,m;return g;function g(v){return n.enter(u),n.enter(s),n.consume(v),n.exit(s),n.enter(c),y}function y(v){return h>999||v===null||v===91||v===93&&!m||v===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(n.exit(c),n.enter(s),n.consume(v),n.exit(s),n.exit(u),i):Se(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),y):(n.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Se(v)||h++>999?(n.exit("chunkString"),y(v)):(n.consume(v),m||(m=!Be(v)),v===92?S:p)}function S(v){return v===91||v===92||v===93?(n.consume(v),h++,p):p(v)}}function F1(n,i,r,u,s,c){let d;return h;function h(S){return S===34||S===39||S===40?(n.enter(u),n.enter(s),n.consume(S),n.exit(s),d=S===40?41:S,m):r(S)}function m(S){return S===d?(n.enter(s),n.consume(S),n.exit(s),n.exit(u),i):(n.enter(c),g(S))}function g(S){return S===d?(n.exit(c),m(d)):S===null?r(S):Se(S)?(n.enter("lineEnding"),n.consume(S),n.exit("lineEnding"),Ke(n,g,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===d||S===null||Se(S)?(n.exit("chunkString"),g(S)):(n.consume(S),S===92?p:y)}function p(S){return S===d||S===92?(n.consume(S),y):y(S)}}function ru(n,i){let r;return u;function u(s){return Se(s)?(n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),r=!0,u):Be(s)?Ke(n,u,r?"linePrefix":"lineSuffix")(s):i(s)}}const Gw={name:"definition",tokenize:Xw},Qw={partial:!0,tokenize:Zw};function Xw(n,i,r){const u=this;let s;return c;function c(v){return n.enter("definition"),d(v)}function d(v){return Z1.call(u,n,h,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function h(v){return s=el(u.sliceSerialize(u.events[u.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),m):r(v)}function m(v){return ut(v)?ru(n,g)(v):g(v)}function g(v){return X1(n,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return n.attempt(Qw,p,p)(v)}function p(v){return Be(v)?Ke(n,S,"whitespace")(v):S(v)}function S(v){return v===null||Se(v)?(n.exit("definition"),u.parser.defined.push(s),i(v)):r(v)}}function Zw(n,i,r){return u;function u(h){return ut(h)?ru(n,s)(h):r(h)}function s(h){return F1(n,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return Be(h)?Ke(n,d,"whitespace")(h):d(h)}function d(h){return h===null||Se(h)?i(h):r(h)}}const Fw={name:"hardBreakEscape",tokenize:Kw};function Kw(n,i,r){return u;function u(c){return n.enter("hardBreakEscape"),n.consume(c),s}function s(c){return Se(c)?(n.exit("hardBreakEscape"),i(c)):r(c)}}const Jw={name:"headingAtx",resolve:$w,tokenize:Ww};function $w(n,i){let r=n.length-2,u=3;if(n[u][1].type==="whitespace"&&(u+=2),r-2>u&&n[r][1].type==="whitespace"&&(r-=2),n[r][1].type==="atxHeadingSequence"&&(u===r-1||r-4>u&&n[r-2][1].type==="whitespace")&&(r-=u+1===r?2:4),r>u){const s={type:"atxHeadingText",start:n[u][1].start,end:n[r][1].end},c={type:"chunkText",start:n[u][1].start,end:n[r][1].end,contentType:"text"};Pn(n,u,r-u+1,[["enter",s,i],["enter",c,i],["exit",c,i],["exit",s,i]])}return n}function Ww(n,i,r){let u=0;return s;function s(y){return n.enter("atxHeading"),c(y)}function c(y){return n.enter("atxHeadingSequence"),d(y)}function d(y){return y===35&&u++<6?(n.consume(y),d):y===null||ut(y)?(n.exit("atxHeadingSequence"),h(y)):r(y)}function h(y){return y===35?(n.enter("atxHeadingSequence"),m(y)):y===null||Se(y)?(n.exit("atxHeading"),i(y)):Be(y)?Ke(n,h,"whitespace")(y):(n.enter("atxHeadingText"),g(y))}function m(y){return y===35?(n.consume(y),m):(n.exit("atxHeadingSequence"),h(y))}function g(y){return y===null||y===35||ut(y)?(n.exit("atxHeadingText"),h(y)):(n.consume(y),g)}}const K1=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kd=["pre","script","style","textarea"],Pw={concrete:!0,name:"htmlFlow",resolveTo:tk,tokenize:nk},ek={partial:!0,tokenize:lk};function tk(n){let i=n.length;for(;i--&&!(n[i][0]==="enter"&&n[i][1].type==="htmlFlow"););return i>1&&n[i-2][1].type==="linePrefix"&&(n[i][1].start=n[i-2][1].start,n[i+1][1].start=n[i-2][1].start,n.splice(i-2,2)),n}function nk(n,i,r){const u=this;let s,c,d,h,m;return g;function g(O){return y(O)}function y(O){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(O),p}function p(O){return O===33?(n.consume(O),S):O===47?(n.consume(O),c=!0,A):O===63?(n.consume(O),s=3,u.interrupt?i:E):Kt(O)?(n.consume(O),d=String.fromCharCode(O),R):r(O)}function S(O){return O===45?(n.consume(O),s=2,v):O===91?(n.consume(O),s=5,h=0,k):Kt(O)?(n.consume(O),s=4,u.interrupt?i:E):r(O)}function v(O){return O===45?(n.consume(O),u.interrupt?i:E):r(O)}function k(O){const z="CDATA[";return O===z.charCodeAt(h++)?(n.consume(O),h===z.length?u.interrupt?i:ue:k):r(O)}function A(O){return Kt(O)?(n.consume(O),d=String.fromCharCode(O),R):r(O)}function R(O){if(O===null||O===47||O===62||ut(O)){const z=O===47,J=d.toLowerCase();return!z&&!c&&kd.includes(J)?(s=1,u.interrupt?i(O):ue(O)):K1.includes(d.toLowerCase())?(s=6,z?(n.consume(O),C):u.interrupt?i(O):ue(O)):(s=7,u.interrupt&&!u.parser.lazy[u.now().line]?r(O):c?I(O):G(O))}return O===45||Jt(O)?(n.consume(O),d+=String.fromCharCode(O),R):r(O)}function C(O){return O===62?(n.consume(O),u.interrupt?i:ue):r(O)}function I(O){return Be(O)?(n.consume(O),I):U(O)}function G(O){return O===47?(n.consume(O),U):O===58||O===95||Kt(O)?(n.consume(O),ne):Be(O)?(n.consume(O),G):U(O)}function ne(O){return O===45||O===46||O===58||O===95||Jt(O)?(n.consume(O),ne):le(O)}function le(O){return O===61?(n.consume(O),H):Be(O)?(n.consume(O),le):G(O)}function H(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(n.consume(O),m=O,Z):Be(O)?(n.consume(O),H):K(O)}function Z(O){return O===m?(n.consume(O),m=null,de):O===null||Se(O)?r(O):(n.consume(O),Z)}function K(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||ut(O)?le(O):(n.consume(O),K)}function de(O){return O===47||O===62||Be(O)?G(O):r(O)}function U(O){return O===62?(n.consume(O),$):r(O)}function $(O){return O===null||Se(O)?ue(O):Be(O)?(n.consume(O),$):r(O)}function ue(O){return O===45&&s===2?(n.consume(O),ee):O===60&&s===1?(n.consume(O),oe):O===62&&s===4?(n.consume(O),ot):O===63&&s===3?(n.consume(O),E):O===93&&s===5?(n.consume(O),Me):Se(O)&&(s===6||s===7)?(n.exit("htmlFlowData"),n.check(ek,mt,Ce)(O)):O===null||Se(O)?(n.exit("htmlFlowData"),Ce(O)):(n.consume(O),ue)}function Ce(O){return n.check(wd,Ue,mt)(O)}function Ue(O){return n.enter("lineEnding"),n.consume(O),n.exit("lineEnding"),be}function be(O){return O===null||Se(O)?Ce(O):(n.enter("htmlFlowData"),ue(O))}function ee(O){return O===45?(n.consume(O),E):ue(O)}function oe(O){return O===47?(n.consume(O),d="",me):ue(O)}function me(O){if(O===62){const z=d.toLowerCase();return kd.includes(z)?(n.consume(O),ot):ue(O)}return Kt(O)&&d.length<8?(n.consume(O),d+=String.fromCharCode(O),me):ue(O)}function Me(O){return O===93?(n.consume(O),E):ue(O)}function E(O){return O===62?(n.consume(O),ot):O===45&&s===2?(n.consume(O),E):ue(O)}function ot(O){return O===null||Se(O)?(n.exit("htmlFlowData"),mt(O)):(n.consume(O),ot)}function mt(O){return n.exit("htmlFlow"),i(O)}}function lk(n,i,r){return u;function u(s){return n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),n.attempt(hu,i,r)}}const ik={name:"htmlText",tokenize:rk};function rk(n,i,r){const u=this;let s,c,d;return h;function h(E){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(E),m}function m(E){return E===33?(n.consume(E),g):E===47?(n.consume(E),le):E===63?(n.consume(E),G):Kt(E)?(n.consume(E),K):r(E)}function g(E){return E===45?(n.consume(E),y):E===91?(n.consume(E),c=0,k):Kt(E)?(n.consume(E),I):r(E)}function y(E){return E===45?(n.consume(E),v):r(E)}function p(E){return E===null?r(E):E===45?(n.consume(E),S):Se(E)?(d=p,oe(E)):(n.consume(E),p)}function S(E){return E===45?(n.consume(E),v):p(E)}function v(E){return E===62?ee(E):E===45?S(E):p(E)}function k(E){const ot="CDATA[";return E===ot.charCodeAt(c++)?(n.consume(E),c===ot.length?A:k):r(E)}function A(E){return E===null?r(E):E===93?(n.consume(E),R):Se(E)?(d=A,oe(E)):(n.consume(E),A)}function R(E){return E===93?(n.consume(E),C):A(E)}function C(E){return E===62?ee(E):E===93?(n.consume(E),C):A(E)}function I(E){return E===null||E===62?ee(E):Se(E)?(d=I,oe(E)):(n.consume(E),I)}function G(E){return E===null?r(E):E===63?(n.consume(E),ne):Se(E)?(d=G,oe(E)):(n.consume(E),G)}function ne(E){return E===62?ee(E):G(E)}function le(E){return Kt(E)?(n.consume(E),H):r(E)}function H(E){return E===45||Jt(E)?(n.consume(E),H):Z(E)}function Z(E){return Se(E)?(d=Z,oe(E)):Be(E)?(n.consume(E),Z):ee(E)}function K(E){return E===45||Jt(E)?(n.consume(E),K):E===47||E===62||ut(E)?de(E):r(E)}function de(E){return E===47?(n.consume(E),ee):E===58||E===95||Kt(E)?(n.consume(E),U):Se(E)?(d=de,oe(E)):Be(E)?(n.consume(E),de):ee(E)}function U(E){return E===45||E===46||E===58||E===95||Jt(E)?(n.consume(E),U):$(E)}function $(E){return E===61?(n.consume(E),ue):Se(E)?(d=$,oe(E)):Be(E)?(n.consume(E),$):de(E)}function ue(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(n.consume(E),s=E,Ce):Se(E)?(d=ue,oe(E)):Be(E)?(n.consume(E),ue):(n.consume(E),Ue)}function Ce(E){return E===s?(n.consume(E),s=void 0,be):E===null?r(E):Se(E)?(d=Ce,oe(E)):(n.consume(E),Ce)}function Ue(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||ut(E)?de(E):(n.consume(E),Ue)}function be(E){return E===47||E===62||ut(E)?de(E):r(E)}function ee(E){return E===62?(n.consume(E),n.exit("htmlTextData"),n.exit("htmlText"),i):r(E)}function oe(E){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(E),n.exit("lineEnding"),me}function me(E){return Be(E)?Ke(n,Me,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):Me(E)}function Me(E){return n.enter("htmlTextData"),d(E)}}const Hd={name:"labelEnd",resolveAll:sk,resolveTo:ck,tokenize:fk},ak={tokenize:dk},uk={tokenize:hk},ok={tokenize:mk};function sk(n){let i=-1;const r=[];for(;++i<n.length;){const u=n[i][1];if(r.push(n[i]),u.type==="labelImage"||u.type==="labelLink"||u.type==="labelEnd"){const s=u.type==="labelImage"?4:2;u.type="data",i+=s}}return n.length!==r.length&&Pn(n,0,n.length,r),n}function ck(n,i){let r=n.length,u=0,s,c,d;for(;r--;){const y=n[r][1];if(s){if(y.type==="link"||y.type==="labelLink"&&y._inactive)break;n[r][0]==="enter"&&y.type==="labelLink"&&(y._inactive=!0)}else if(c){if(n[r][0]==="enter"&&(y.type==="labelImage"||y.type==="labelLink")&&!y._balanced&&(s=r,y.type!=="labelLink")){u=2;break}}else y.type==="labelEnd"&&(c=r)}const h={type:n[s][1].type==="labelLink"?"link":"image",start:{...n[s][1].start},end:{...n[n.length-1][1].end}},m={type:"label",start:{...n[s][1].start},end:{...n[c][1].end}},g={type:"labelText",start:{...n[s+u+2][1].end},end:{...n[c-2][1].start}};return d=[["enter",h,i],["enter",m,i]],d=In(d,n.slice(s+1,s+u+3)),d=In(d,[["enter",g,i]]),d=In(d,os(i.parser.constructs.insideSpan.null,n.slice(s+u+4,c-3),i)),d=In(d,[["exit",g,i],n[c-2],n[c-1],["exit",m,i]]),d=In(d,n.slice(c+1)),d=In(d,[["exit",h,i]]),Pn(n,s,n.length,d),n}function fk(n,i,r){const u=this,s=u._labelStarts;let c,d;if(s){for(;s.length>0&&s[s.length-1]._balanced;)s.pop();c=s[s.length-1]}return h;function h(S){return c?c._inactive?p(S):(d=u.parser.defined.includes(el(u.sliceSerialize({start:c.end,end:u.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(S),n.exit("labelMarker"),n.exit("labelEnd"),m):r(S)}function m(S){return S===40?n.attempt(ak,y,d?y:p)(S):S===91?n.attempt(uk,y,d?g:p)(S):d?y(S):p(S)}function g(S){return n.attempt(ok,y,p)(S)}function y(S){return s.pop(),i(S)}function p(S){return c._balanced=!0,r(S)}}function dk(n,i,r){return u;function u(p){return n.enter("resource"),n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),s}function s(p){return ut(p)?ru(n,c)(p):c(p)}function c(p){return p===41?y(p):X1(n,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function d(p){return ut(p)?ru(n,m)(p):y(p)}function h(p){return r(p)}function m(p){return p===34||p===39||p===40?F1(n,g,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):y(p)}function g(p){return ut(p)?ru(n,y)(p):y(p)}function y(p){return p===41?(n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),n.exit("resource"),i):r(p)}}function hk(n,i,r){const u=this;return s;function s(h){return Z1.call(u,n,c,d,"reference","referenceMarker","referenceString")(h)}function c(h){return u.parser.defined.includes(el(u.sliceSerialize(u.events[u.events.length-1][1]).slice(1,-1)))?i(h):r(h)}function d(h){return r(h)}}function mk(n,i,r){return u;function u(c){return n.enter("reference"),n.enter("referenceMarker"),n.consume(c),n.exit("referenceMarker"),s}function s(c){return c===93?(n.enter("referenceMarker"),n.consume(c),n.exit("referenceMarker"),n.exit("reference"),i):r(c)}}const pk={name:"labelStartImage",resolveAll:Hd.resolveAll,tokenize:gk};function gk(n,i,r){const u=this;let s;return c;function c(m){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(m),n.exit("labelImageMarker"),d}function d(m){return m===91?(n.enter("labelMarker"),n.consume(m),n.exit("labelMarker"),s=n.exit("labelImage"),h):r(m)}function h(m){return m===94&&"_hiddenFootnoteSupport"in u.parser.constructs?r(m):(u._labelStarts=u._labelStarts||[],u._labelStarts.push(s),i(m))}}const yk={name:"labelStartLink",resolveAll:Hd.resolveAll,tokenize:bk};function bk(n,i,r){const u=this;let s;return c;function c(h){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(h),n.exit("labelMarker"),s=n.exit("labelLink"),d}function d(h){return h===94&&"_hiddenFootnoteSupport"in u.parser.constructs?r(h):(u._labelStarts=u._labelStarts||[],u._labelStarts.push(s),i(h))}}const Pf={name:"lineEnding",tokenize:vk};function vk(n,i){return r;function r(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),Ke(n,i,"linePrefix")}}const Fo={name:"thematicBreak",tokenize:xk};function xk(n,i,r){let u=0,s;return c;function c(g){return n.enter("thematicBreak"),d(g)}function d(g){return s=g,h(g)}function h(g){return g===s?(n.enter("thematicBreakSequence"),m(g)):u>=3&&(g===null||Se(g))?(n.exit("thematicBreak"),i(g)):r(g)}function m(g){return g===s?(n.consume(g),u++,m):(n.exit("thematicBreakSequence"),Be(g)?Ke(n,h,"whitespace")(g):h(g))}}const yn={continuation:{tokenize:Tk},exit:Ck,name:"list",tokenize:kk},Sk={partial:!0,tokenize:Ak},wk={partial:!0,tokenize:Ek};function kk(n,i,r){const u=this,s=u.events[u.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,d=0;return h;function h(v){const k=u.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!u.containerState.marker||v===u.containerState.marker:xd(v)){if(u.containerState.type||(u.containerState.type=k,n.enter(k,{_container:!0})),k==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(Fo,r,g)(v):g(v);if(!u.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),m(v)}return r(v)}function m(v){return xd(v)&&++d<10?(n.consume(v),m):(!u.interrupt||d<2)&&(u.containerState.marker?v===u.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),g(v)):r(v)}function g(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),u.containerState.marker=u.containerState.marker||v,n.check(hu,u.interrupt?r:y,n.attempt(Sk,S,p))}function y(v){return u.containerState.initialBlankLine=!0,c++,S(v)}function p(v){return Be(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),S):r(v)}function S(v){return u.containerState.size=c+u.sliceSerialize(n.exit("listItemPrefix"),!0).length,i(v)}}function Tk(n,i,r){const u=this;return u.containerState._closeFlow=void 0,n.check(hu,s,c);function s(h){return u.containerState.furtherBlankLines=u.containerState.furtherBlankLines||u.containerState.initialBlankLine,Ke(n,i,"listItemIndent",u.containerState.size+1)(h)}function c(h){return u.containerState.furtherBlankLines||!Be(h)?(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,d(h)):(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,n.attempt(wk,i,d)(h))}function d(h){return u.containerState._closeFlow=!0,u.interrupt=void 0,Ke(n,n.attempt(yn,i,r),"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Ek(n,i,r){const u=this;return Ke(n,s,"listItemIndent",u.containerState.size+1);function s(c){const d=u.events[u.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===u.containerState.size?i(c):r(c)}}function Ck(n){n.exit(this.containerState.type)}function Ak(n,i,r){const u=this;return Ke(n,s,"listItemPrefixWhitespace",u.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const d=u.events[u.events.length-1];return!Be(c)&&d&&d[1].type==="listItemPrefixWhitespace"?i(c):r(c)}}const Oy={name:"setextUnderline",resolveTo:Nk,tokenize:zk};function Nk(n,i){const r=new Jo;let u=n.length,s,c,d;for(;u--;)if(n[u][0]==="enter"){if(n[u][1].type==="content"){s=u;break}n[u][1].type==="paragraph"&&(c=u)}else n[u][1].type==="content"&&r.add(u,1,[]),!d&&n[u][1].type==="definition"&&(d=u);const h={type:"setextHeading",start:{...n[s][1].start},end:{...n[n.length-1][1].end}};return n[c][1].type="setextHeadingText",d?(r.add(c,0,[["enter",h,i]]),r.add(d+1,0,[["exit",n[s][1],i]]),n[s][1].end={...n[d][1].end}):n[s][1]=h,r.add(n.length,0,[["exit",h,i]]),r.consume(n),n}function zk(n,i,r){const u=this;let s;return c;function c(g){let y=u.events.length,p;for(;y--;)if(u.events[y][1].type!=="lineEnding"&&u.events[y][1].type!=="linePrefix"&&u.events[y][1].type!=="content"){p=u.events[y][1].type==="paragraph";break}return!u.parser.lazy[u.now().line]&&(u.interrupt||p)?(n.enter("setextHeadingLine"),s=g,d(g)):r(g)}function d(g){return n.enter("setextHeadingLineSequence"),h(g)}function h(g){return g===s?(n.consume(g),h):(n.exit("setextHeadingLineSequence"),Be(g)?Ke(n,m,"lineSuffix")(g):m(g))}function m(g){return g===null||Se(g)?(n.exit("setextHeadingLine"),i(g)):r(g)}}const Ok={tokenize:_k};function _k(n){const i=this,r=n.attempt(hu,u,n.attempt(this.parser.constructs.flowInitial,s,Ke(n,n.attempt(this.parser.constructs.flow,s,n.attempt(qw,s)),"linePrefix")));return r;function u(c){if(c===null){n.consume(c);return}return n.enter("lineEndingBlank"),n.consume(c),n.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function s(c){if(c===null){n.consume(c);return}return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),i.currentConstruct=void 0,r}}const jk={resolveAll:$1()},Mk=J1("string"),Dk=J1("text");function J1(n){return{resolveAll:$1(n==="text"?Rk:void 0),tokenize:i};function i(r){const u=this,s=this.parser.constructs[n],c=r.attempt(s,d,h);return d;function d(y){return g(y)?c(y):h(y)}function h(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return g(y)?(r.exit("data"),c(y)):(r.consume(y),m)}function g(y){if(y===null)return!0;const p=s[y];let S=-1;if(p)for(;++S<p.length;){const v=p[S];if(!v.previous||v.previous.call(u,u.previous))return!0}return!1}}}function $1(n){return i;function i(r,u){let s=-1,c;for(;++s<=r.length;)c===void 0?r[s]&&r[s][1].type==="data"&&(c=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==c+2&&(r[c][1].end=r[s-1][1].end,r.splice(c+2,s-c-2),s=c+2),c=void 0);return n?n(r,u):r}}function Rk(n,i){const r=new Jo;let u=0;for(;++u<=n.length;)if((u===n.length||n[u][1].type==="lineEnding")&&n[u-1][1].type==="data"){const s=n[u-1][1],c=i.sliceStream(s);let d=c.length,h=-1,m=0,g;for(;d--;){const y=c[d];if(typeof y=="string"){for(h=y.length;y.charCodeAt(h-1)===32;)m++,h--;if(h)break;h=-1}else if(y===-2)g=!0,m++;else if(y!==-1){d++;break}}if(i._contentTypeTextTrailing&&u===n.length&&(m=0),m){const y={type:u===n.length||g||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?h:s.start._bufferIndex+h,_index:s.start._index+d,line:s.end.line,column:s.end.column-m,offset:s.end.offset-m},end:{...s.end}};s.end={...y.start},s.start.offset===s.end.offset?Object.assign(s,y):r.add(u,0,[["enter",y,i],["exit",y,i]])}u++}return r.consume(n),n}const Lk={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:I1},Bk={91:Gw},Uk={[-2]:Wf,[-1]:Wf,32:Wf},qk={35:Jw,42:Fo,45:[Oy,Fo],60:Pw,61:Oy,95:Fo,96:zy,126:zy},Hk={38:G1,92:V1},Yk={[-5]:Pf,[-4]:Pf,[-3]:Pf,33:pk,38:G1,42:Sd,60:[xw,ik],91:yk,92:[Fw,V1],93:Hd,95:Sd,96:Mw},Ik={null:[Sd,jk]},Vk={null:[42,95]},Gk={null:[]},Qk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Vk,contentInitial:Bk,disable:Gk,document:Lk,flow:qk,flowInitial:Uk,insideSpan:Ik,string:Hk,text:Yk},Symbol.toStringTag,{value:"Module"}));function Xk(n,i,r){let u={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},c=[];let d=[],h=[];const m={attempt:Z(le),check:Z(H),consume:I,enter:G,exit:ne,interrupt:Z(H,{interrupt:!0})},g={code:null,containerState:{},defineSkip:A,events:[],now:k,parser:n,previous:null,sliceSerialize:S,sliceStream:v,write:p};let y=i.tokenize.call(g,m);return i.resolveAll&&c.push(i),g;function p($){return d=In(d,$),R(),d[d.length-1]!==null?[]:(K(i,0),g.events=os(c,g.events,g),g.events)}function S($,ue){return Fk(v($),ue)}function v($){return Zk(d,$)}function k(){const{_bufferIndex:$,_index:ue,line:Ce,column:Ue,offset:be}=u;return{_bufferIndex:$,_index:ue,line:Ce,column:Ue,offset:be}}function A($){s[$.line]=$.column,U()}function R(){for(;u._index<d.length;){const $=d[u._index];if(typeof $=="string"){const ue=u._index;for(u._bufferIndex<0&&(u._bufferIndex=0);u._index===ue&&u._bufferIndex<$.length;)C($.charCodeAt(u._bufferIndex))}else C($)}}function C($){y=y($)}function I($){Se($)?(u.line++,u.column=1,u.offset+=$===-3?2:1,U()):$!==-1&&(u.column++,u.offset++),u._bufferIndex<0?u._index++:(u._bufferIndex++,u._bufferIndex===d[u._index].length&&(u._bufferIndex=-1,u._index++)),g.previous=$}function G($,ue){const Ce=ue||{};return Ce.type=$,Ce.start=k(),g.events.push(["enter",Ce,g]),h.push(Ce),Ce}function ne($){const ue=h.pop();return ue.end=k(),g.events.push(["exit",ue,g]),ue}function le($,ue){K($,ue.from)}function H($,ue){ue.restore()}function Z($,ue){return Ce;function Ce(Ue,be,ee){let oe,me,Me,E;return Array.isArray(Ue)?mt(Ue):"tokenize"in Ue?mt([Ue]):ot(Ue);function ot(re){return he;function he(Te){const _e=Te!==null&&re[Te],Ae=Te!==null&&re.null,ce=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return mt(ce)(Te)}}function mt(re){return oe=re,me=0,re.length===0?ee:O(re[me])}function O(re){return he;function he(Te){return E=de(),Me=re,re.partial||(g.currentConstruct=re),re.name&&g.parser.constructs.disable.null.includes(re.name)?J():re.tokenize.call(ue?Object.assign(Object.create(g),ue):g,m,z,J)(Te)}}function z(re){return $(Me,E),be}function J(re){return E.restore(),++me<oe.length?O(oe[me]):ee}}}function K($,ue){$.resolveAll&&!c.includes($)&&c.push($),$.resolve&&Pn(g.events,ue,g.events.length-ue,$.resolve(g.events.slice(ue),g)),$.resolveTo&&(g.events=$.resolveTo(g.events,g))}function de(){const $=k(),ue=g.previous,Ce=g.currentConstruct,Ue=g.events.length,be=Array.from(h);return{from:Ue,restore:ee};function ee(){u=$,g.previous=ue,g.currentConstruct=Ce,g.events.length=Ue,h=be,U()}}function U(){u.line in s&&u.column<2&&(u.column=s[u.line],u.offset+=s[u.line]-1)}}function Zk(n,i){const r=i.start._index,u=i.start._bufferIndex,s=i.end._index,c=i.end._bufferIndex;let d;if(r===s)d=[n[r].slice(u,c)];else{if(d=n.slice(r,s),u>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(u):d.shift()}c>0&&d.push(n[s].slice(0,c))}return d}function Fk(n,i){let r=-1;const u=[];let s;for(;++r<n.length;){const c=n[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
12
+ `)){const u=Wx.exec(r),s=Px.exec(r),c=eS.exec(r);u&&i.name===""?i.name=u[1]??"":s&&i.style===""?i.style=s[1]??"":c&&i.task===""&&(i.task=c[1]??"")}return i}const lS={"app.title":"DSH Bot","lang.switch":"中文","new.title":"New bot","new.close":"Close","new.lead":"The name shows in the list and is the bot's own name. Style and task become its persona.","new.name":"Bot name","new.style":"Bot style","new.task":"Bot task","new.namePlaceholder":"for example: Guide","new.stylePlaceholder":"for example: brief and direct","new.taskPlaceholder":"for example: turn the user's notes into short sentences","new.cancel":"Cancel","new.create":"Create","new.creating":"Creating","new.nameRequired":"Write this bot's name first.","new.created":'Created "{name}".',"new.createFailed":"Could not create the session.","new.personaFailed":"The session was created, but the persona was not applied.","session.search":"Search sessions","session.searchPlaceholder":"Search sessions","session.none":"No sessions yet.","session.noMatch":"No matching sessions.","session.running":"In progress","session.blank":"Blank","session.archived":"Archived","session.hide":"Hide","session.show":"Show","session.blankCount":"Blank sessions · {count}","session.archiveAll":"Archive all","session.purgeAll":"Delete all","session.archive":"Archive","session.purge":"Delete","session.archiveLabel":"Archive blank session {name}","session.purgeLabel":"Delete blank session {name}","session.archiveConfirm":"Archive {count} blank sessions? Sessions that already have messages stay. You can restore archived sessions from the official client.","session.purgeOneConfirm":'Delete "{name}" permanently? The log is removed from disk and cannot be restored from the archive.',"session.purgeAllConfirm":"Permanently delete {count} blank sessions? Logs are removed from disk and cannot be restored. Sessions that already have messages stay.","session.notBlankArchive":"This session already has content, so it cannot be removed as a blank session.","session.archiveFailed":"Could not remove this blank session.","session.archiveSomeFailed":"Some blank sessions could not be removed.","session.purgeNotBlank":"Only a blank session can be deleted permanently.","session.purgeFailed":"Could not delete this session permanently.","session.purgeSomeFailed":"Some blank sessions could not be deleted permanently.","session.listUnavailable":"The session list is unavailable.","session.unnamed":"New session","session.blankName":"Blank session","local.mark":"Me","local.here":"This machine","local.down":"Runtime unreachable","nav.back":"Back","nav.sessions":"Sessions","nav.botMessages":"Bot messages","nav.official":"Official client","nav.where":"Session location","nav.mainSession":"Main session","nav.worker":"Worker session","nav.pick":"Pick a session on the left, or create one.","nav.empty":"This session has no messages yet.","composer.mention":"Mention a bot","composer.noBot":"No matching bot","composer.interrupt":"Sending interrupts this reply","composer.mentionHint":"Message, or type @ to mention another bot","composer.task":"Message, or describe a task","composer.pick":"Choose a session","composer.add":"Add a file or a command","composer.command":"Insert a command","composer.filesLater":"Attaching files is not available yet.","composer.cancel":"Cancel","composer.send":"Send","composer.notSent":"The task was not sent.","composer.supplyFailed":"Not sent.","load.messages":"Loading messages…","load.messagesPct":"Loading messages… {pct}%","load.aria":"Loading messages","bot.waiting":"Waiting","bot.running":"Running","bot.stopped":"Stopped","bot.stoppedBackground":"This turn stopped. Background work is still running.","bot.retry":"Retry","bot.thinking":"Thinking","bot.replying":"Replying","bot.processed":"Done","bot.untitled":"Untitled","inbox.received":"sent a message","inbox.open":"Open bot messages, {who}: {line}","inbox.lead":"These are the words bots sent each other. They do not include the other bot's persona, memory, or permissions.","inbox.empty":"No bot messages yet.","inbox.other":"another bot","inbox.sentTo":"Sent to {name}","inbox.hop":"Hop {hop}","inbox.source":"Source","file.close":"Close","file.loading":"Reading the file…","file.error":"This file could not be opened","file.truncated":"Only the first 2000 lines are shown.","turn.rail":"Turns","turn.jump":"Jump to item {index}","work.status.accepted":"Accepted","work.status.enqueued":"Enqueued","work.status.started":"Started","work.status.needs_user":"Needs you","work.status.ready":"Candidate","work.status.delivered":"Delivered","work.status.cancelled":"Cancelled","work.status.failed":"Failed","work.ticket":"Ticket","work.preview.startedMany":"Started · {count}","work.placeholder.many":"Background work is running. You can say something else.","work.placeholder.started":"Background work has started. You can say something else.","work.placeholder.needsUser":"This box is still an ordinary message. Answer the ticket on the card above.","work.placeholder.ready":"Send a message. The result becomes delivered only after the assistant writes it into the chat.","work.placeholder.failed":"This ticket has failed. You can say something else.","work.fact.revision":"Generation {revision}","work.fact.accepted":"The ticket is recorded and is not on the execution queue yet.","work.fact.enqueued":"It is on the execution queue. The worker has not seen the task yet.","work.fact.elapsed":"Elapsed {time}","work.fact.wall":"Background limit is 10 minutes.","work.fact.needsUser":"This round has ended.","work.fact.ready":"This is not the reply in the chat yet.","work.fact.delivered":"The text is in the assistant reply.","work.fact.failed":"This ticket has failed.","work.fact.sameWorker":"It is still the same worker session.","work.fact.restart":"It returns to started after the worker sees the task again.","work.budgetFallback":"This one was not accepted. Unfinished tickets already hit the host concurrency limit.","work.openWorker":"Open the worker session","work.questionEmpty":"The worker asked a question.","work.questionStale":"The previous question is void.","work.answerLabel":"Reply to this ticket","work.answerSubmit":"Reply to this ticket","work.cancelTitle":"Cancellation note","work.taskTitle":"Task","work.generation":"Generation {revision}","work.duration":"Duration {value}","work.material":"Material {hash}","work.minutes":"{count} min","work.seconds":"{count} s","work.milliseconds":"{count} ms","basis.plain":"Ordinary session","basis.facts":"{head} · {count} facts","health.up":"Runtime is reachable","health.down":"Runtime is unreachable","health.modelReady":"The model catalog is available. You can send.","health.loading":"Reading the model catalog.","health.noProvider":"No model provider is configured, so execution is off.","health.catalogUnreadable":"The model catalog could not be read.","health.usageReady":"The usage endpoint returned data.","health.usageOff":"Usage is not connected.","health.sameSession":"The official client is at the site root. This page is /dsh-bot/. It is the same session.","health.primaryUnready":"This process has not issued a session cookie yet.","health.primaryDown":"The runtime could not be reached.","health.usageMissing":"The usage plugin is not installed.","health.usageUpstream":"The usage upstream is unavailable.","health.sessionUnreadable":"Could not tell whether the session is still running."},iS={"app.title":"DSH Bot","lang.switch":"English","new.title":"新建 BOT","new.close":"关闭","new.lead":"名字会显示在左侧列表里,也是这个 bot 自己的名字。风格和任务写进它的人格。","new.name":"Bot 名字","new.style":"Bot 风格","new.task":"Bot 任务","new.namePlaceholder":"例如:狗子","new.stylePlaceholder":"例如:幽默风趣","new.taskPlaceholder":"例如:把用户的话写成短句","new.cancel":"取消","new.create":"创建","new.creating":"正在创建","new.nameRequired":"先写上这个 bot 的名字。","new.created":"已创建「{name}」。","new.createFailed":"未能创建会话","new.personaFailed":"会话已创建,人格没有套上。","session.search":"搜索会话","session.searchPlaceholder":"搜索会话","session.none":"还没有会话。","session.noMatch":"没有匹配的会话。","session.running":"进行中","session.blank":"空白","session.archived":"已归档","session.hide":"收起","session.show":"展开","session.blankCount":"空白会话 · {count}","session.archiveAll":"全部归档","session.purgeAll":"全部彻底删除","session.archive":"归档","session.purge":"彻底删除","session.archiveLabel":"归档空白会话 {name}","session.purgeLabel":"彻底删除空白会话 {name}","session.archiveConfirm":"归档 {count} 个空白会话?已经有消息的会话会保留。归档后可以在原生界面的已归档列表里恢复。","session.purgeOneConfirm":"彻底删除「{name}」?日志会从磁盘去掉,不能从已归档列表恢复。","session.purgeAllConfirm":"彻底删除 {count} 个空白会话?日志会从磁盘去掉,不能恢复。已经有消息的会话会保留。","session.notBlankArchive":"这个会话已经有内容,不能当作空白会话删除。","session.archiveFailed":"没能删除这个空白会话。","session.archiveSomeFailed":"有的空白会话没能删除。","session.purgeNotBlank":"只有空白会话可以彻底删除。","session.purgeFailed":"没能彻底删除这个会话。","session.purgeSomeFailed":"有的空白会话没能彻底删除。","session.listUnavailable":"会话列表不可用","session.unnamed":"新会话","session.blankName":"空白会话","local.mark":"本","local.here":"本机","local.down":"主运行时不可达","nav.back":"返回","nav.sessions":"会话","nav.botMessages":"BOT 消息","nav.official":"原生界面","nav.where":"会话位置","nav.mainSession":"主会话","nav.worker":"执行会话","nav.pick":"从左边选一个会话,或新建一个。","nav.empty":"这个会话还没有消息。","composer.mention":"提及 BOT","composer.noBot":"没有匹配的 BOT","composer.interrupt":"发送会打断这一句","composer.mentionHint":"发消息,输入 @ 提及另一个 BOT","composer.task":"发消息,或描述一个任务","composer.pick":"选择一个会话","composer.add":"添加文件或调用指令","composer.command":"调用指令","composer.filesLater":"附带文件还不可用。","composer.cancel":"取消","composer.send":"发送","composer.notSent":"任务没有发送。","composer.supplyFailed":"没有送出。","load.messages":"正在加载消息…","load.messagesPct":"正在加载消息… {pct}%","load.aria":"正在加载消息","bot.waiting":"等待操作","bot.running":"运行中","bot.stopped":"已停下","bot.stoppedBackground":"这一轮已经停下。后台还在跑。","bot.retry":"重试","bot.thinking":"正在想","bot.replying":"正在回复","bot.processed":"已处理","bot.untitled":"未命名","inbox.received":"发来一条消息","inbox.open":"打开 BOT 消息,{who}:{line}","inbox.lead":"这里是 BOT 之间传来的正文,不带对方的人格、记忆或权限。","inbox.empty":"还没有 BOT 消息。","inbox.other":"另一个 BOT","inbox.sentTo":"发给 {name}","inbox.hop":"第 {hop} 跳","inbox.source":"来源","file.close":"关闭","file.loading":"正在读取文件…","file.error":"无法打开此文件","file.truncated":"只显示了前 2000 行。","turn.rail":"回合","turn.jump":"跳到第 {index} 处","work.status.accepted":"已受理","work.status.enqueued":"已派工","work.status.started":"已开始","work.status.needs_user":"需要用户","work.status.ready":"候选","work.status.delivered":"已交付","work.status.cancelled":"已取消","work.status.failed":"失败","work.ticket":"工单","work.preview.startedMany":"已开始 · {count} 张","work.placeholder.many":"后台都在跑,可以直接说别的","work.placeholder.started":"后台已开始,可以直接说别的","work.placeholder.needsUser":"这里仍是普通消息。回答工单用上面的卡片","work.placeholder.ready":"发消息。结果要由助手写进对话,才会变成已交付","work.placeholder.failed":"这张工单已经失败,可以直接说别的","work.fact.revision":"第 {revision} 代","work.fact.accepted":"工单已记下,还没进入执行队列","work.fact.enqueued":"已进入执行队列,执行会话还没有看到任务","work.fact.elapsed":"已进行 {time}","work.fact.wall":"后台上限 10 分钟","work.fact.needsUser":"这一轮已经结束","work.fact.ready":"这还不是对话里的答复","work.fact.delivered":"正文在对话里的助手回复中","work.fact.failed":"这张工单已经失败","work.fact.sameWorker":"还是原来的执行会话","work.fact.restart":"执行会话再次看到任务后,才会回到已开始","work.budgetFallback":"这张没有接住。未结束工单已经达到宿主并发上限。","work.openWorker":"打开执行会话","work.questionEmpty":"执行会话问了一个问题。","work.questionStale":"上一问已作废","work.answerLabel":"对这张工单的回答","work.answerSubmit":"回复这张工单","work.cancelTitle":"取消说明","work.taskTitle":"执行任务","work.generation":"第 {revision} 代","work.duration":"时长 {value}","work.material":"材料 {hash}","work.minutes":"{count} 分钟","work.seconds":"{count} 秒","work.milliseconds":"{count} 毫秒","basis.plain":"普通会话","basis.facts":"{head} · {count} 条事实","health.up":"主运行时可达","health.down":"主运行时不可达","health.modelReady":"模型目录可用,可以发送。","health.loading":"正在读取模型目录。","health.noProvider":"未配置模型提供方,执行已禁用","health.catalogUnreadable":"无法读取模型目录。","health.usageReady":"用量接口已返回数据。","health.usageOff":"用量未接入","health.sameSession":"原生界面在站点根路径,这里是 /dsh-bot/。同一个会话。","health.primaryUnready":"主运行时尚未交出启动令牌","health.primaryDown":"主运行时不可达","health.usageMissing":"用量插件未接入","health.usageUpstream":"用量上游不可用","health.sessionUnreadable":"无法读取会话是否仍在运行"},hy={en:lS,zh:iS},S1="dsh-bot.locale";function rS(){try{const n=localStorage.getItem(S1);if(n==="en"||n==="zh")return n}catch{}return"en"}function aS(n){try{localStorage.setItem(S1,n)}catch{}typeof document<"u"&&(document.documentElement.lang=n==="zh"?"zh-CN":"en")}function w1(n,i,r){const u=hy[n][i]??hy.en[i];return r?u.replace(/\{(\w+)\}/g,(s,c)=>r[c]??""):u}function Hl(n,i){return w1("en",n,i)}const uS={loading:"health.loading",no_provider:"health.noProvider",catalog_unreadable:"health.catalogUnreadable",primary_unready:"health.primaryUnready",primary_down:"health.primaryDown",usage_not_installed:"health.usageMissing",usage_unconfigured:"health.usageUpstream",session_unreadable:"health.sessionUnreadable"};function oS(n,i,r=Hl){const u=uS[n];return u?r(u):i}const k1=F.createContext({locale:"en",setLocale:()=>{},t:Hl});function sS({children:n}){const[i,r]=F.useState(()=>rS()),u=F.useCallback(d=>{aS(d),r(d)},[]),s=F.useCallback((d,h)=>w1(i,d,h),[i]),c=F.useMemo(()=>({locale:i,setLocale:u,t:s}),[i,u,s]);return w.jsx(k1.Provider,{value:c,children:n})}function wt(){return F.useContext(k1)}const cS={accepted:"work.status.accepted",enqueued:"work.status.enqueued",started:"work.status.started",needs_user:"work.status.needs_user",ready:"work.status.ready",delivered:"work.status.delivered",cancelled:"work.status.cancelled",failed:"work.status.failed"},fS=new Set(["delivered","cancelled"]),dS=new Set(["accepted","enqueued","started","needs_user"]);function T1(n,i=Hl){const r=cS[n];return r?i(r):n}function E1(n){return n.replace(/^\uFEFF/,"").trimStart().startsWith("[foundations:ticket]")}function Md(n){const i=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
13
+ `).trimStart();if(!i.startsWith("[foundations:briefing]"))return null;const r=i.slice(22).replace(/^\n/,""),u=r.indexOf(`
14
+ ---
15
+ `);if(u<0)return null;const s=[],c={};for(const g of r.slice(0,u).split(`
16
+ `)){const y=/^(briefing_revision|budget_wall_ms|budget_max_tokens|material_sha256):\s*(.*)$/.exec(g);y?.[1]?c[y[1]]=(y[2]??"").trim():g.trim()!==""&&s.push(g.trim())}const d=Number(c.briefing_revision),h=Number(c.budget_wall_ms),m=Number(c.budget_max_tokens);return{revision:Number.isFinite(d)&&d>0?d:1,wallMs:Number.isFinite(h)&&h>0?h:null,maxTokens:Number.isFinite(m)&&m>0?m:null,material:c.material_sha256??"",notes:s,body:r.slice(u+5).trim(),cancel:s.some(g=>g.startsWith("This is a cancellation note")||g.startsWith("这是取消说明"))}}function er(n){return n.startsWith("worker-")&&n.length>7}function hS(n){return er(n)?n.slice(7):""}function mS(n){const i=n.signals;if(!i||typeof i!="object"||Array.isArray(i))return{};const r={};for(const[u,s]of Object.entries(i))r[u]=Array.isArray(s)?s.filter(c=>typeof c=="string"):[];return r}function pS(n){const i=n.cards;if(!i||typeof i!="object"||Array.isArray(i))return{};const r={};for(const[u,s]of Object.entries(i))r[u]=yS({cards:s});return r}function gS(n){const i=n.work&&typeof n.work=="object"&&!Array.isArray(n.work)?n.work:n;return!("signals"in i)&&!("cards"in i)?null:{signals:mS(i),cards:pS(i)}}function yS(n){return Array.isArray(n.cards)?n.cards.flatMap(i=>{if(!i||typeof i!="object")return[];const r=i,u=typeof r.summary=="string"?r.summary:"",s=bS(r,u);return s?[s]:[]}):[]}function bS(n,i="",r=Hl){const u=n.ticket;if(!u||typeof u!="object")return null;const s=u;if(typeof s.id!="string"||typeof s.status!="string")return null;const c=Array.isArray(n.attempts)?n.attempts:[],d=typeof s.active_attempt_id=="string"?s.active_attempt_id:"",h=c.find(p=>p&&typeof p=="object"&&p.id===d),m=Array.isArray(n.events)?n.events.flatMap(zS):[],g=typeof s.child_session_id=="string"?s.child_session_id:"",y=i.trim()||r("work.ticket");return{id:s.id,status:s.status,revision:typeof s.briefing_revision=="number"?s.briefing_revision:1,summary:y,childSessionId:g.startsWith("worker-")?g:null,startedAt:typeof h?.started_at=="string"?h.started_at:null,events:m}}function C1(n){const i=n.filter(u=>!fS.has(u.status)),r=n.find(u=>u.status==="delivered");return r?[...i,r]:i}function A1(n){return n.some(i=>dS.has(i.status))}function my(n,i,r=!1){return r?!1:n&&!A1(i)}function vS(n,i=Hl){return i(n==="Replying"?"bot.replying":"bot.thinking")}function xS(n){return n.length>0&&n.every(i=>i.kind==="think"||i.kind==="tool"&&(i.name??"").startsWith("foundations_"))}const SS=new Set(["accepted","enqueued","started"]);function wS(n,i=!1){if(i)return"run";let r=!1,u=!1;for(const s of n)s.status==="delivered"||s.status==="cancelled"||(s.status==="needs_user"?r=!0:SS.has(s.status)&&(u=!0));return r?"wait":u?"run":null}function Jf(n,i=Date.now(),r=Hl){const u=n.filter(d=>d.status==="started");if(u.length>1)return r("work.preview.startedMany",{count:String(u.length)});const s=O1(n);if(!s||s.status==="ready")return"";const c=T1(s.status,r);if(s.status==="started"){const d=z1(s.startedAt,i);return d?`${c} · ${d}`:c}return c}function kS(n,i=Hl){if(n.filter(s=>s.status==="started").length>1)return i("work.placeholder.many");const u=O1(n);return u?u.status==="started"?i("work.placeholder.started"):u.status==="needs_user"?i("work.placeholder.needsUser"):u.status==="ready"?i("work.placeholder.ready"):u.status==="failed"?i("work.placeholder.failed"):null:null}function TS(n,i,r=Hl){const u=[r("work.fact.revision",{revision:String(n.revision)})];if(n.status==="accepted"&&u.push(r("work.fact.accepted")),n.status==="enqueued"&&u.push(r("work.fact.enqueued")),n.status==="started"){const c=z1(n.startedAt,i);c&&u.push(r("work.fact.elapsed",{time:c})),u.push(r("work.fact.wall"))}n.status==="needs_user"&&u.push(r("work.fact.needsUser")),n.status==="ready"&&u.push(r("work.fact.ready")),n.status==="delivered"&&u.push(r("work.fact.delivered")),n.status==="failed"&&u.push(r("work.fact.failed")),n.revision>1&&(n.status==="enqueued"||n.status==="accepted")&&(u.push(r("work.fact.sameWorker")),u.push(r("work.fact.restart")));const s=NS(n);return s&&u.push(s),u}function ES(n){const i=n.events.filter(r=>r.kind==="question"&&r.text.trim()!=="");if(n.status==="needs_user")return{text:i.filter(u=>u.revision===n.revision&&u.applyStatus!=="stale").at(-1)?.text??"",stale:!1};if(n.revision>1&&(n.status==="enqueued"||n.status==="accepted"||n.status==="started")){const r=[...i].reverse().find(u=>u.applyStatus==="stale");if(r)return{text:r.text,stale:!0}}return null}function N1(n){if(n.name!=="foundations_dispatch"||n.result.trim()==="")return null;const i=Dd(n.result);return i?i.ok===!1?null:typeof i.ticketId=="string"&&i.ticketId!==""?i.ticketId:null:/"ticketId"\s*:\s*"([^"]+)"/.exec(n.result)?.[1]??null}function CS(n){if(n.name!=="foundations_dispatch"||n.result.trim()==="")return!1;const i=Dd(n.result);return i?i.ok===!1&&i.code==="BUDGET":n.result.includes('"BUDGET"')||/concurrency limit/i.test(n.result)}function AS(n,i=Hl){const r=Dd(n);return r&&typeof r.message=="string"&&r.message!==""?r.message:i("work.budgetFallback")}function z1(n,i){if(!n)return"";const r=Date.parse(n);if(!Number.isFinite(r))return"";const u=Math.max(0,Math.floor((i-r)/1e3)),s=Math.floor(u/60),c=u%60;return`${s}:${String(c).padStart(2,"0")}`}function O1(n){const i=C1(n),r=["needs_user","started","enqueued","accepted","ready","failed"];for(const u of r){const s=i.find(c=>c.status===u);if(s)return s}return i[0]??null}function NS(n){return n.events.filter(r=>r.kind==="progress"&&r.applyStatus==="applied"&&r.revision===n.revision&&r.text.trim()!=="").at(-1)?.text??""}function zS(n){if(!n||typeof n!="object")return[];const i=n;return typeof i.event_id!="string"||typeof i.kind!="string"?[]:[{eventId:i.event_id,kind:i.kind,applyStatus:typeof i.apply_status=="string"?i.apply_status:"",revision:typeof i.briefing_revision=="number"?i.briefing_revision:0,text:typeof i.text=="string"?i.text:""}]}function Dd(n){try{const i=JSON.parse(n);return!i||typeof i!="object"||Array.isArray(i)?null:i}catch{return null}}var OS=b1();function _S({sessionId:n,path:i,line:r,onClose:u}){const[s,c]=F.useState({status:"loading",text:"",eof:!0}),{t:d}=wt(),h=i.split("/").filter(Boolean).at(-1)??i,m=MS(h);return F.useEffect(()=>{const g=document.body.style.overflow;document.body.style.overflow="hidden";const y=p=>{p.key==="Escape"&&u()};return document.addEventListener("keydown",y),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",y)}},[u]),F.useEffect(()=>{const g=new AbortController;c({status:"loading",text:"",eof:!0});const y=`/file?sessionId=${encodeURIComponent(n)}&path=${encodeURIComponent(i)}`;return Yn(y,{signal:g.signal}).then(p=>{if(g.signal.aborted)return;const S=typeof p.body.text=="string"?p.body.text:"";if(p.status!==200){c({status:"error",text:"",eof:!0});return}c({status:"ready",text:S,eof:p.body.eof!==!1})}).catch(()=>{g.signal.aborted||c({status:"error",text:"",eof:!0})}),()=>g.abort()},[n,i]),OS.createPortal(w.jsxs("div",{className:"file-modal",role:"presentation",children:[w.jsx("div",{className:"file-modal-mask",onClick:u}),w.jsxs("div",{className:"file-modal-card",role:"dialog","aria-modal":"true","aria-label":h,tabIndex:-1,children:[w.jsxs("header",{className:"file-modal-head",children:[w.jsxs("div",{className:"file-modal-title",children:[w.jsx("strong",{children:h}),i!==h?w.jsx("span",{children:i}):null]}),w.jsx("button",{type:"button",className:"file-modal-close","aria-label":d("file.close"),onClick:u,children:w.jsx(DS,{})})]}),w.jsx(jS,{state:s,language:m,line:r})]})]}),document.body)}function jS({state:n,language:i,line:r}){const{t:u}=wt(),[s,c]=F.useState(!1);if(n.status==="loading")return w.jsx("p",{className:"file-modal-status",children:u("file.loading")});if(n.status==="error")return w.jsx("p",{className:"file-modal-status",children:u("file.error")});const d=n.text===""?[]:n.text.split(`
17
+ `);return w.jsxs("div",{className:"file-preview","data-code-preview":"",children:[w.jsxs("div",{className:"file-preview-banner",children:[w.jsx("span",{className:"file-preview-lang",children:i||"Code"}),w.jsx("button",{type:"button",className:"diff-copy","aria-label":s?"Copied":"Copy",onClick:()=>{navigator.clipboard.writeText(n.text).then(()=>{c(!0),window.setTimeout(()=>c(!1),1e3)})},children:s?w.jsx(LS,{}):w.jsx(RS,{})})]}),w.jsx("div",{className:"file-preview-scroll",children:w.jsx("pre",{children:w.jsx("code",{style:{"--line-width":`${Math.max(2,String(d.length).length)}ch`},children:d.map((h,m)=>w.jsx("span",{className:r===m+1?"source-line current":"source-line",children:h},m))})})}),n.eof?null:w.jsx("p",{className:"file-modal-note",children:u("file.truncated")})]})}function MS(n){const i=n.split(".").pop()?.toLowerCase()??"";return{py:"python",ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",md:"markdown",css:"css",html:"html",json:"json",sh:"bash",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",rb:"ruby",c:"c"}[i]??""}function DS(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4.2 4.2L11.8 11.8M11.8 4.2L4.2 11.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function RS(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("rect",{x:"5.2",y:"5.2",width:"7.2",height:"7.6",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M10.2 5.2V3.8A1.3 1.3 0 0 0 8.9 2.5H3.8A1.3 1.3 0 0 0 2.5 3.8v5.1A1.3 1.3 0 0 0 3.8 10.2H5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function LS(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.5 8.2L6.4 11.1L12.5 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function BS({onClose:n,onCreated:i}){const[r,u]=F.useState(""),[s,c]=F.useState(""),[d,h]=F.useState(""),[m,g]=F.useState(!1),[y,p]=F.useState(""),{locale:S,setLocale:v,t:k}=wt();function A(C){u(C)}async function R(){if(m)return;const C=r.trim();if(C===""){p(k("new.nameRequired"));return}g(!0),p("");const I=await Yn("/sessions",{method:"POST",headers:{"content-type":"application/json","idempotency-key":crypto.randomUUID()},body:JSON.stringify({name:C})}),G=typeof I.body.sessionId=="string"?I.body.sessionId:"";if(!G){const Z=I.body.upstream;p(Z?.message||String(I.body.error||k("new.createFailed"))),g(!1);return}const ne=tS(C,s,d),le=await ou("/dsh-bot/api/sessions/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:G,personaText:ne,idempotencyKey:crypto.randomUUID()})}),H=le.body.ok===!0?k("new.created",{name:C}):x1(le.body,k("new.personaFailed"));i(G,H,C)}return w.jsx("div",{className:"setup-mask",role:"presentation",onMouseDown:n,children:w.jsxs("form",{className:"setup-card",role:"dialog","aria-labelledby":"new-session-title",onMouseDown:C=>C.stopPropagation(),onSubmit:C=>{C.preventDefault(),R()},children:[w.jsxs("div",{className:"setup-head",children:[w.jsx("h2",{id:"new-session-title",children:k("new.title")}),w.jsx("button",{type:"button",className:"setup-close","aria-label":k("new.close"),onClick:n,children:"×"})]}),w.jsx("p",{className:"setup-lead",children:k("new.lead")}),w.jsx("label",{htmlFor:"setup-name",children:k("new.name")}),w.jsx("input",{id:"setup-name",value:r,placeholder:k("new.namePlaceholder"),onChange:C=>A(C.target.value)}),w.jsx("label",{htmlFor:"setup-style",children:k("new.style")}),w.jsx("input",{id:"setup-style",value:s,placeholder:k("new.stylePlaceholder"),onChange:C=>c(C.target.value)}),w.jsx("label",{htmlFor:"setup-task",children:k("new.task")}),w.jsx("textarea",{id:"setup-task",rows:3,value:d,placeholder:k("new.taskPlaceholder"),onChange:C=>h(C.target.value)}),y?w.jsx("p",{className:"setup-error",children:y}):null,w.jsxs("div",{className:"setup-actions",children:[w.jsx("button",{type:"button",onClick:()=>v(S==="en"?"zh":"en"),children:k("lang.switch")}),w.jsx("button",{type:"button",onClick:n,children:k("new.cancel")}),w.jsx("button",{type:"submit",className:"primary",disabled:m||r.trim()==="",children:k(m?"new.creating":"new.create")})]})]})})}function US(n,i){const{t:r}=wt(),[u,s]=F.useState("");return F.useEffect(()=>{if(n===""){s("");return}let c=!1;return(async()=>{const d=await ou(`/dsh-bot/api/status?sessionId=${encodeURIComponent(n)}`),h=await ou(`/dsh-bot/api/memory?sessionId=${encodeURIComponent(n)}`);if(c||d.body.ok!==!0)return;const m=d.body.binding;if((m&&typeof m=="object"?m.kind:d.body.kind)!=="bot"){s(r("basis.plain"));return}const y=typeof d.body.personaText=="string"?d.body.personaText.trim():"",p=nS(y),S=[p.name,p.style,p.task].filter(A=>A!=="").join(" · "),k=(Array.isArray(h.body.facts)?h.body.facts:[]).filter(A=>A&&typeof A=="object"&&A.status==="active").length;s(k>0?r("basis.facts",{head:S||"BOT",count:String(k)}):S||"BOT")})(),()=>{c=!0}},[n,i,r]),u}function rs(n){const i=n.replace(/\r\n/g,`
18
+ `);if(!i.startsWith("[foundations:message]"))return null;const r=i.slice(21).replace(/^\n/,""),u=r.indexOf(`
19
+ ---
20
+ `);if(u<0)return null;const s={},c=[];for(const d of r.slice(0,u).split(`
21
+ `)){const h=/^(id|from|correlation|causation|hop):\s*(.*)$/.exec(d);h?.[1]?s[h[1]]=(h[2]??"").trim():d.trim()!==""&&c.push(d.trim())}return s.from?{id:s.id??"",from:s.from,correlation:s.correlation??"",causation:s.causation??"",hop:s.hop??"",note:c.join(" "),body:r.slice(u+5).trim()}:null}function _1(n,i){return i!==""&&i!==n?i:n.startsWith("session-")&&n.length>18?`${n.slice(0,12)}…${n.slice(-4)}`:n}const qS=new Set(["foundations_send","foundations_reply"]);function j1(n){const i=[];for(const r of n){if(r.kind==="user"){const s=rs(r.text);if(!s)continue;i.push({kind:"in",id:r.id,seq:r.seq,time:r.time,mail:s});continue}if(r.kind!=="tool"||!qS.has(r.name))continue;const u=VS(r);u&&i.push(u)}return i.sort((r,u)=>r.seq-u.seq||(r.kind===u.kind?0:r.kind==="in"?-1:1)),i}function HS(n){const i=j1(n);if(!i.some(s=>s.kind==="in"))return n.slice();const u=new Set(i.filter(s=>s.kind==="out").map(s=>s.id));return n.filter(s=>!u.has(s.id))}function YS(n,i){const r=n.filter(c=>c.kind==="in"),u=r.at(-1);if(!u)return null;const s=u.mail.body.replace(/\s+/g," ").trim();return{who:i(u.mail.from)||"BOT",preview:s.length>72?`${s.slice(0,71)}…`:s,count:r.length}}function IS(n,i){if(n.target)return n.target;if(!n.correlation)return"";for(let r=i.length-1;r>=0;r-=1){const u=i[r];if(!(!u||u.seq>n.seq)&&u.kind==="in"&&u.mail.correlation===n.correlation)return u.mail.from}return""}function VS(n){let i;try{const u=JSON.parse(n.args);if(!u||typeof u!="object"||Array.isArray(u))return null;i=u}catch{return null}const r=typeof i.text=="string"?i.text.trim():"";return r?{kind:"out",id:n.id,seq:n.seq,text:r,target:typeof i.targetSessionId=="string"?i.targetSessionId:"",correlation:typeof i.correlationId=="string"?i.correlationId:""}:null}function GS(n,i){const r={};return(n[n.length-1]===""?[...n,""]:n).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const QS=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZS={};function py(n,i){return(ZS.jsx?XS:QS).test(n)}const FS=/[ \t\n\f\r]/g;function KS(n){return typeof n=="object"?n.type==="text"?gy(n.value):!1:gy(n)}function gy(n){return n.replace(FS,"")===""}class fu{constructor(i,r,u){this.normal=r,this.property=i,u&&(this.space=u)}}fu.prototype.normal={};fu.prototype.property={};fu.prototype.space=void 0;function M1(n,i){const r={},u={};for(const s of n)Object.assign(r,s.property),Object.assign(u,s.normal);return new fu(r,u,i)}function gd(n){return n.toLowerCase()}class bn{constructor(i,r){this.attribute=r,this.property=i}}bn.prototype.attribute="";bn.prototype.booleanish=!1;bn.prototype.boolean=!1;bn.prototype.commaOrSpaceSeparated=!1;bn.prototype.commaSeparated=!1;bn.prototype.defined=!1;bn.prototype.mustUseProperty=!1;bn.prototype.number=!1;bn.prototype.overloadedBoolean=!1;bn.prototype.property="";bn.prototype.spaceSeparated=!1;bn.prototype.space=void 0;let JS=0;const Oe=rr(),zt=rr(),yd=rr(),P=rr(),at=rr(),lr=rr(),Nn=rr();function rr(){return 2**++JS}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Oe,booleanish:zt,commaOrSpaceSeparated:Nn,commaSeparated:lr,number:P,overloadedBoolean:yd,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),$f=Object.keys(bd);class Rd extends bn{constructor(i,r,u,s){let c=-1;if(super(i,r),yy(this,"space",s),typeof u=="number")for(;++c<$f.length;){const d=$f[c];yy(this,$f[c],(u&bd[d])===bd[d])}}}Rd.prototype.defined=!0;function yy(n,i,r){r&&(n[i]=r)}function Jr(n){const i={},r={};for(const[u,s]of Object.entries(n.properties)){const c=new Rd(u,n.transform(n.attributes||{},u),s,n.space);n.mustUseProperty&&n.mustUseProperty.includes(u)&&(c.mustUseProperty=!0),i[u]=c,r[gd(u)]=u,r[gd(c.attribute)]=u}return new fu(i,r,n.space)}const D1=Jr({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:P,ariaColIndex:P,ariaColSpan:P,ariaControls:at,ariaCurrent:null,ariaDescribedBy:at,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:at,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:at,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:at,ariaLevel:P,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:at,ariaPlaceholder:null,ariaPosInSet:P,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:at,ariaRowCount:P,ariaRowIndex:P,ariaRowSpan:P,ariaSelected:zt,ariaSetSize:P,ariaSort:null,ariaValueMax:P,ariaValueMin:P,ariaValueNow:P,ariaValueText:null,role:null},transform(n,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function R1(n,i){return i in n?n[i]:i}function L1(n,i){return R1(n,i.toLowerCase())}const $S=Jr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lr,acceptCharset:at,accessKey:at,action:null,allow:null,allowFullScreen:Oe,allowPaymentRequest:Oe,allowUserMedia:Oe,alpha:Oe,alt:null,as:null,async:Oe,autoCapitalize:null,autoComplete:at,autoFocus:Oe,autoPlay:Oe,blocking:at,capture:null,charSet:null,checked:Oe,cite:null,className:at,closedBy:null,colorSpace:null,cols:P,colSpan:P,command:null,commandFor:null,content:null,contentEditable:zt,controls:Oe,controlsList:at,coords:P|lr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Oe,defer:Oe,dir:null,dirName:null,disabled:Oe,download:yd,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Oe,formTarget:null,headers:at,height:P,hidden:yd,high:P,href:null,hrefLang:null,htmlFor:at,httpEquiv:at,id:null,imageSizes:null,imageSrcSet:null,inert:Oe,inputMode:null,integrity:null,is:null,isMap:Oe,itemId:null,itemProp:at,itemRef:at,itemScope:Oe,itemType:at,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Oe,low:P,manifest:null,max:null,maxLength:P,media:null,method:null,min:null,minLength:P,multiple:Oe,muted:Oe,name:null,nonce:null,noModule:Oe,noValidate:Oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Oe,optimum:P,pattern:null,ping:at,placeholder:null,playsInline:Oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Oe,referrerPolicy:null,rel:at,required:Oe,reversed:Oe,rows:P,rowSpan:P,sandbox:at,scope:null,scoped:Oe,seamless:Oe,selected:Oe,shadowRootClonable:Oe,shadowRootCustomElementRegistry:Oe,shadowRootDelegatesFocus:Oe,shadowRootMode:null,shadowRootSerializable:Oe,shape:null,size:P,sizes:null,slot:null,span:P,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:P,step:null,style:null,tabIndex:P,target:null,title:null,translate:null,type:null,typeMustMatch:Oe,useMap:null,value:zt,width:P,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:at,axis:null,background:null,bgColor:null,border:P,borderColor:null,bottomMargin:P,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Oe,declare:Oe,event:null,face:null,frame:null,frameBorder:null,hSpace:P,leftMargin:P,link:null,longDesc:null,lowSrc:null,marginHeight:P,marginWidth:P,noResize:Oe,noHref:Oe,noShade:Oe,noWrap:Oe,object:null,profile:null,prompt:null,rev:null,rightMargin:P,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:P,valueType:null,version:null,vAlign:null,vLink:null,vSpace:P,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Oe,disablePictureInPicture:Oe,disableRemotePlayback:Oe,exportParts:lr,part:at,prefix:null,property:null,results:P,security:null,unselectable:null},space:"html",transform:L1}),WS=Jr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Nn,accentHeight:P,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:P,amplitude:P,arabicForm:null,ascent:P,attributeName:null,attributeType:null,azimuth:P,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:P,by:null,calcMode:null,capHeight:P,className:at,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:P,diffuseConstant:P,direction:null,display:null,dur:null,divisor:P,dominantBaseline:null,download:Oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:P,enableBackground:null,end:null,event:null,exponent:P,externalResourcesRequired:null,fill:null,fillOpacity:P,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:lr,g2:lr,glyphName:lr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:P,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:P,horizOriginX:P,horizOriginY:P,id:null,ideographic:P,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:P,k:P,k1:P,k2:P,k3:P,k4:P,kernelMatrix:Nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:P,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:P,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:P,overlineThickness:P,paintOrder:null,panose1:null,path:null,pathLength:P,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:at,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:P,pointsAtY:P,pointsAtZ:P,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nn,rev:Nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nn,requiredFeatures:Nn,requiredFonts:Nn,requiredFormats:Nn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:P,specularExponent:P,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:P,strikethroughThickness:P,string:null,stroke:null,strokeDashArray:Nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:P,strokeOpacity:P,strokeWidth:null,style:null,surfaceScale:P,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Nn,tabIndex:P,tableValues:null,target:null,targetX:P,targetY:P,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:P,underlineThickness:P,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:P,values:null,vAlphabetic:P,vMathematical:P,vectorEffect:null,vHanging:P,vIdeographic:P,version:null,vertAdvY:P,vertOriginX:P,vertOriginY:P,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:P,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:R1}),B1=Jr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,i){return"xlink:"+i.slice(5).toLowerCase()}}),U1=Jr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:L1}),q1=Jr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,i){return"xml:"+i.slice(3).toLowerCase()}}),PS={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ew=/[A-Z]/g,by=/-[a-z]/g,tw=/^data[-\w.:]+$/i;function nw(n,i){const r=gd(i);let u=i,s=bn;if(r in n.normal)return n.property[n.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tw.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(by,iw);u="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!by.test(c)){let d=c.replace(ew,lw);d.charAt(0)!=="-"&&(d="-"+d),i="data"+d}}s=Rd}return new s(u,i)}function lw(n){return"-"+n.toLowerCase()}function iw(n){return n.charAt(1).toUpperCase()}const rw=M1([D1,$S,B1,U1,q1],"html"),Ld=M1([D1,WS,B1,U1,q1],"svg");function aw(n){return n.join(" ").trim()}var vy=/\/\*(?:[^*]|\*(?!\/))*\*\//g,uw=/\n/g,ow=/^\s*/,sw=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,cw=/^:\s*/,fw=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,dw=/^[;\s]*/,hw=`
22
+ `,xy="/",Sy="*",eu="",mw="comment",pw="declaration";function gw(n,i){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];i=i||{};var r=1,u=1;function s(k){var A=k.match(uw);A&&(r+=A.length);var R=k.lastIndexOf(hw);u=~R?k.length-R:u+k.length}function c(){var k={line:r,column:u};return function(A){return A.position=new d(k),g(),A}}function d(k){this.start=k,this.end={line:r,column:u},this.source=i.source}d.prototype.content=n;function h(k){var A=new Error(i.source+":"+r+":"+u+": "+k);if(A.reason=k,A.filename=i.source,A.line=r,A.column=u,A.source=n,!i.silent)throw A}function m(k){var A=k.exec(n);if(A){var R=A[0];return s(R),n=n.slice(R.length),A}}function g(){m(ow)}function y(k){for(var A;A=p();)k.push(A);return k}function p(){var k=c();if(!(xy!=n.charAt(0)||Sy!=n.charAt(1))){for(var A=2;eu!=n.charAt(A)&&(Sy!=n.charAt(A)||xy!=n.charAt(A+1));)++A;if(A+=2,eu===n.charAt(A-1))return h("End of comment missing");var R=n.slice(2,A-2);return u+=2,s(R),n=n.slice(A),u+=2,k({type:mw,comment:R})}}function S(){var k=c(),A=m(sw);if(A){if(p(),!m(cw))return h("property missing ':'");var R=m(fw),C=k({type:pw,property:A[0].replace(vy,eu).trim(),value:R?R[0].replace(vy,eu).trim():eu});return m(dw),C}}function v(){var k=[];y(k);for(var A;A=S();)k.push(A),y(k);return k}return g(),v()}function yw(n,i){let r=null;if(!n||typeof n!="string")return r;const u=gw(n),s=typeof i=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;s?i(d,h,c):h&&(r=r??{},r[d]=h)}),r}const H1=Y1("end"),Bd=Y1("start");function Y1(n){return i;function i(r){const u=r&&r.position&&r.position[n]||{};if(typeof u.line=="number"&&u.line>0&&typeof u.column=="number"&&u.column>0)return{line:u.line,column:u.column,offset:typeof u.offset=="number"&&u.offset>-1?u.offset:void 0}}}function bw(n){const i=Bd(n),r=H1(n);if(i&&r)return{start:i,end:r}}function iu(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?wy(n.position):"start"in n||"end"in n?wy(n):"line"in n||"column"in n?vd(n):""}function vd(n){return ky(n&&n.line)+":"+ky(n&&n.column)}function wy(n){return vd(n&&n.start)+"-"+vd(n&&n.end)}function ky(n){return n&&typeof n=="number"?n:1}class as extends Error{constructor(i,r,u){super(),typeof r=="string"&&(u=r,r=void 0);let s="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof i=="string"?s=i:!c.cause&&i&&(d=!0,s=i.message,c.cause=i),!c.ruleId&&!c.source&&typeof u=="string"){const m=u.indexOf(":");m===-1?c.ruleId=u:(c.source=u.slice(0,m),c.ruleId=u.slice(m+1))}if(!c.place&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const h=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=h?h.line:void 0,this.name=iu(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Object.defineProperties(as.prototype,{file:{configurable:!0,enumerable:!0,value:"",writable:!0},name:{configurable:!0,enumerable:!0,value:"",writable:!0},reason:{configurable:!0,enumerable:!0,value:"",writable:!0},message:{configurable:!0,enumerable:!0,value:"",writable:!0},stack:{configurable:!0,enumerable:!0,value:"",writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});const Ud={}.hasOwnProperty,vw=new Map,xw=/[A-Z]/g,Sw=/-([a-z])/g,ww=new Set(["table","tbody","thead","tfoot","tr"]),kw=new Set(["td","th"]),I1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Tw(n,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let u;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");u=jw(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");u=_w(r,i.jsx,i.jsxs)}const s={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:u,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Ld:rw,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},c=V1(s,n,void 0);return c&&typeof c!="string"?c:s.create(n,s.Fragment,{children:c||void 0},void 0)}function V1(n,i,r){if(i.type==="element")return Ew(n,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return Cw(n,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return Nw(n,i,r);if(i.type==="mdxjsEsm")return Aw(n,i);if(i.type==="root")return zw(n,i,r);if(i.type==="text")return Ow(n,i)}function Ew(n,i,r){const u=n.schema;let s=u;i.tagName.toLowerCase()==="svg"&&u.space==="html"&&(s=Ld,n.schema=s),n.ancestors.push(i);const c=Q1(n,i.tagName,!1),d=Mw(n,i);let h=Hd(n,i);return ww.has(i.tagName)&&(h=h.filter(function(m){return typeof m=="string"?!KS(m):!0})),G1(n,d,c,i),qd(d,h),n.ancestors.pop(),n.schema=u,n.create(i,c,d,r)}function Cw(n,i){if(i.data&&i.data.estree&&n.evaluater){const u=i.data.estree.body[0];return u.type,n.evaluater.evaluateExpression(u.expression)}su(n,i.position)}function Aw(n,i){if(i.data&&i.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(i.data.estree);su(n,i.position)}function Nw(n,i,r){const u=n.schema;let s=u;i.name==="svg"&&u.space==="html"&&(s=Ld,n.schema=s),n.ancestors.push(i);const c=i.name===null?n.Fragment:Q1(n,i.name,!0),d=Dw(n,i),h=Hd(n,i);return G1(n,d,c,i),qd(d,h),n.ancestors.pop(),n.schema=u,n.create(i,c,d,r)}function zw(n,i,r){const u={};return qd(u,Hd(n,i)),n.create(i,n.Fragment,u,r)}function Ow(n,i){return i.value}function G1(n,i,r,u){typeof r!="string"&&r!==n.Fragment&&n.passNode&&(i.node=u)}function qd(n,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(n.children=r)}}function _w(n,i,r){return u;function u(s,c,d,h){const g=Array.isArray(d.children)?r:i;return h?g(c,d,h):g(c,d)}}function jw(n,i){return r;function r(u,s,c,d){const h=Array.isArray(c.children),m=Bd(u);return i(s,c,d,h,{columnNumber:m?m.column-1:void 0,fileName:n,lineNumber:m?m.line:void 0},void 0)}}function Mw(n,i){const r={};let u,s;for(s in i.properties)if(s!=="children"&&Ud.call(i.properties,s)){const c=Rw(n,s,i.properties[s]);if(c){const[d,h]=c;n.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&kw.has(i.tagName)?u=h:r[d]=h}}if(u){const c=r.style||(r.style={});c[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=u}return r}function Dw(n,i){const r={};for(const u of i.attributes)if(u.type==="mdxJsxExpressionAttribute")if(u.data&&u.data.estree&&n.evaluater){const c=u.data.estree.body[0];c.type;const d=c.expression;d.type;const h=d.properties[0];h.type,Object.assign(r,n.evaluater.evaluateExpression(h.argument))}else su(n,i.position);else{const{name:s}=u;let c;if(u.value&&typeof u.value=="object")if(u.value.data&&u.value.data.estree&&n.evaluater){const h=u.value.data.estree.body[0];h.type,c=n.evaluater.evaluateExpression(h.expression)}else su(n,i.position);else c=u.value===null?!0:u.value;r[s]=c}return r}function Hd(n,i){const r=[];let u=-1;const s=n.passKeys?new Map:vw;for(;++u<i.children.length;){const c=i.children[u];let d;if(n.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const g=s.get(m)||0;d=m+"-"+g,s.set(m,g+1)}}const h=V1(n,c,d);h!==void 0&&r.push(h)}return r}function Rw(n,i,r){if(r==null||typeof r=="number"&&Number.isNaN(r))return;const u=nw(n.schema,i);return Array.isArray(r)&&(r=u.commaSeparated?GS(r):aw(r)),u.property==="style"?["style",typeof r=="object"?n.stylePropertyNameCase==="dom"?r:Bw(r):Lw(n,String(r))]:[n.elementAttributeNameCase==="react"&&u.space?PS[u.property]||u.property:u.attribute,r]}function Lw(n,i){const r={};try{yw(i,function(u,s){if(u&&s){let c=u;c.slice(0,2)!=="--"&&(c=c.toLowerCase(),n.stylePropertyNameCase==="dom"&&(c.slice(0,4)==="-ms-"&&(c=c.slice(1)),c=c.replace(Sw,Hw))),r[c]=s}})}catch(u){if(n.ignoreInvalidStyle)return{};const s=u,c=new as("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=n.filePath||void 0,c.url=I1+"#cannot-parse-style-attribute",c}return r}function Q1(n,i,r){let u;if(!r)u={type:"Literal",value:i};else if(i.includes(".")){const s=i.split(".");let c=-1,d;for(;++c<s.length;){const h=py(s[c])?{type:"Identifier",name:s[c]}:{type:"Literal",value:s[c]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}u=d}else u=py(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(u.type==="Literal"){const s=u.value;return Ud.call(n.components,s)?n.components[s]:s}if(n.evaluater)return n.evaluater.evaluateExpression(u);su(n)}function su(n,i){const r=new as("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=n.filePath||void 0,r.url=I1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Bw(n){const i={};let r;for(r in n)Ud.call(n,r)&&(i[Uw(r)]=n[r]);return i}function Uw(n){if(n.slice(0,2)==="--")return n;let i=n.replace(xw,qw);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function qw(n){return"-"+n.toLowerCase()}function Hw(n,i){return i.toUpperCase()}const Wf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Yw={};function us(n,i){const r=Yw,u=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return X1(n,u,s)}function X1(n,i,r){if(Iw(n)){if("value"in n)return n.type==="html"&&!r?"":n.value;if(i&&"alt"in n&&n.alt)return n.alt;if("children"in n)return Ty(n.children,i,r)}return Array.isArray(n)?Ty(n,i,r):""}function Ty(n,i,r){const u=[];let s=-1;for(;++s<n.length;)u[s]=X1(n[s],i,r);return u.join("")}function Iw(n){return!!(n&&typeof n=="object")}const Ey=document.createElement("i");function Yd(n){const i="&"+n+";";Ey.innerHTML=i;const r=Ey.textContent;return r.charCodeAt(r.length-1)===59&&n!=="semi"||r===i?!1:r}function Pn(n,i,r,u){const s=n.length;let c=0,d;if(i<0?i=-i>s?0:s+i:i=i>s?s:i,r=r>0?r:0,u.length<1e4)d=Array.from(u),d.unshift(i,r),n.splice(...d);else for(r&&n.splice(i,r);c<u.length;)d=u.slice(c,c+1e4),d.unshift(i,0),n.splice(...d),c+=1e4,i+=1e4}function In(n,i){return n.length>0?(Pn(n,n.length,0,i),n):i}const Cy={}.hasOwnProperty;function Z1(n){const i={};let r=-1;for(;++r<n.length;)Vw(i,n[r]);return i}function Vw(n,i){let r;for(r in i){const s=(Cy.call(n,r)?n[r]:void 0)||(n[r]={}),c=i[r];let d;if(c)for(d in c){Cy.call(s,d)||(s[d]=[]);const h=c[d];Gw(s[d],Array.isArray(h)?h:h?[h]:[])}}}function Gw(n,i){let r=-1;const u=[];for(;++r<i.length;)(i[r].add==="after"?n:u).push(i[r]);Pn(n,0,0,u)}function F1(n,i){const r=Number.parseInt(n,i);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function el(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kt=Ei(/[A-Za-z]/),Jt=Ei(/[\dA-Za-z]/),Qw=Ei(/[#-'*+\--9=?A-Z^-~]/);function Ko(n){return n!==null&&(n<32||n===127)}const xd=Ei(/\d/),Xw=Ei(/[\dA-Fa-f]/),K1=Ei(/[!-/:-@[-`{-~]/);function Se(n){return n!==null&&n<-2}function ut(n){return n!==null&&(n<0||n===32)}function Be(n){return n===-2||n===-1||n===32}const du=Ei(new RegExp("\\p{P}|\\p{S}","u")),ir=Ei(/\s/);function Ei(n){return i;function i(r){return r!==null&&r>-1&&n.test(String.fromCharCode(r))}}function $r(n){const i=[];let r=-1,u=0,s=0;for(;++r<n.length;){const c=n.charCodeAt(r);let d="";if(c===37&&Jt(n.charCodeAt(r+1))&&Jt(n.charCodeAt(r+2)))s=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const h=n.charCodeAt(r+1);c<56320&&h>56319&&h<57344?(d=String.fromCharCode(c,h),s=1):d="�"}else d=String.fromCharCode(c);d&&(i.push(n.slice(u,r),encodeURIComponent(d)),u=r+s+1,d=""),s&&(r+=s,s=0)}return i.join("")+n.slice(u)}function Ke(n,i,r,u){const s=u?u-1:1/0;let c=0;return d;function d(m){return Be(m)?(n.enter(r),h(m)):i(m)}function h(m){return Be(m)&&c++<s?(n.consume(m),h):(n.exit(r),i(m))}}function J1(n,i,r,u,s,c){let d=0;return h;function h(y){return Be(y)?(n.enter(u),m(y)):g(y)}function m(y){return Be(y)&&d<c?(n.consume(y),d++,m):(n.exit(u),g(y))}function g(y){return d>=s?i(y):r(y)}}const Zw={tokenize:Fw};function Fw(n){const i=n.attempt(this.parser.constructs.contentInitial,u,s);let r;return i;function u(h){if(h===null){n.consume(h);return}return n.enter("lineEnding"),n.consume(h),n.exit("lineEnding"),Ke(n,i,"linePrefix")}function s(h){return n.enter("paragraph"),c(h)}function c(h){const m=n.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,d(h)}function d(h){if(h===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(h);return}return Se(h)?(n.consume(h),n.exit("chunkText"),c):(n.consume(h),d)}}let Jo=class{constructor(){this.index=new Map,this.map=[]}add(i,r,u){Ay(this,i,r,u,!1)}addBefore(i,r,u){Ay(this,i,r,u,!0)}consume(i){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const u=[];for(;r>0;)r-=1,u.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];u.push(i.slice()),i.length=0;let s=u.pop();for(;s;){for(const c of s)i.push(c);s=u.pop()}this.map.length=0,this.index.clear()}};function Ay(n,i,r,u,s){if(r===0&&u.length===0)return;const c=n.index.get(i);if(c){c[1]+=r,s?(u.push(...c[2]),c[2]=u):c[2].push(...u);return}const d=[i,r,u];n.map.push(d),n.index.set(i,d)}const Kw={tokenize:Jw},Ny={tokenize:$w};function Jw(n){const i=this,r=[];let u=0,s,c,d;return h;function h(G){if(u<r.length){const ne=r[u];return i.containerState=ne[1],n.attempt(ne[0].continuation,m,g)(G)}return g(G)}function m(G){if(u++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,s&&I();const ne=i.events.length;let le=ne,H;for(;le--;)if(i.events[le][0]==="exit"&&i.events[le][1].type==="chunkFlow"){H=i.events[le][1].end;break}C(u);let Z=ne;for(;Z<i.events.length;)i.events[Z][1].end={...H},Z++;const K=new Jo;return K.add(le+1,0,i.events.slice(ne)),K.add(ne,Z-ne,[]),K.consume(i.events),g(G)}return h(G)}function g(G){if(u===r.length){if(!s)return S(G);if(s.currentConstruct&&s.currentConstruct.concrete)return k(G);i.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return i.containerState={},n.check(Ny,y,p)(G)}function y(G){return s&&I(),C(u),S(G)}function p(G){return i.parser.lazy[i.now().line]=u!==r.length,d=i.now().offset,k(G)}function S(G){return i.containerState={},n.attempt(Ny,v,k)(G)}function v(G){return u++,r.push([i.currentConstruct,i.containerState]),S(G)}function k(G){if(G===null){s&&I(),C(0),n.consume(G);return}return s=s||i.parser.flow(i.now()),n.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:c}),A(G)}function A(G){if(G===null){R(n.exit("chunkFlow"),!0),C(0),n.consume(G);return}return Se(G)?(n.consume(G),R(n.exit("chunkFlow")),u=0,i.interrupt=void 0,h):(n.consume(G),A)}function R(G,ne){const le=i.sliceStream(G);if(ne&&le.push(null),G.previous=c,c&&(c.next=G),c=G,s.defineSkip(G.start),s.write(le),i.parser.lazy[G.start.line]){let H=s.events.length;for(;H--;)if(s.events[H][1].start.offset<d&&(!s.events[H][1].end||s.events[H][1].end.offset>d))return;const Z=i.events.length;let K=Z,de,U;for(;K--;)if(i.events[K][0]==="exit"&&i.events[K][1].type==="chunkFlow"){if(de){U=i.events[K][1].end;break}de=!0}for(C(u),H=Z;H<i.events.length;)i.events[H][1].end={...U},H++;const $=new Jo;$.add(K+1,0,i.events.slice(Z)),$.add(Z,H-Z,[]),$.consume(i.events)}}function C(G){let ne=r.length;for(;ne-- >G;){const le=r[ne];i.containerState=le[1],le[0].exit.call(i,n)}r.length=G}function I(){s.write([null]),c=void 0,s=void 0,i.containerState._closeFlow=void 0}}function $w(n,i,r){return Ke(n,n.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ti(n){if(n===null||ut(n)||ir(n))return 1;if(du(n))return 2}function os(n,i,r){const u=[];let s=-1;for(;++s<n.length;){const c=n[s].resolveAll;c&&!u.includes(c)&&(i=c(i,r),u.push(c))}return i}const Sd={name:"attention",resolveAll:Ww,tokenize:Pw};function Ww(n,i){let r=-1,u;for(;++r<n.length;)if(n[r][0]==="enter"&&n[r][1].type==="attentionSequence"&&n[r][1]._close){let s=r;for(;s--;)if(n[s][0]==="exit"&&n[s][1].type==="attentionSequence"&&n[s][1]._open&&i.sliceSerialize(n[s][1]).charCodeAt(0)===i.sliceSerialize(n[r][1]).charCodeAt(0)){if((n[s][1]._close||n[r][1]._open)&&(n[r][1].end.offset-n[r][1].start.offset)%3&&!((n[s][1].end.offset-n[s][1].start.offset+n[r][1].end.offset-n[r][1].start.offset)%3))continue;const c=n[s][1].end.offset-n[s][1].start.offset>1&&n[r][1].end.offset-n[r][1].start.offset>1?2:1,d={...n[s][1].end},h={...n[r][1].start};zy(d,-c),zy(h,c);const m={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...n[s][1].end}},g={type:c>1?"strongSequence":"emphasisSequence",start:{...n[r][1].start},end:h},y={type:c>1?"strongText":"emphasisText",start:{...n[s][1].end},end:{...n[r][1].start}},p={type:c>1?"strong":"emphasis",start:{...m.start},end:{...g.end}};n[s][1].end={...m.start},n[r][1].start={...g.end},u=[],n[s][1].end.offset-n[s][1].start.offset&&(u=In(u,[["enter",n[s][1],i],["exit",n[s][1],i]])),u=In(u,[["enter",p,i],["enter",m,i],["exit",m,i],["enter",y,i]]),u=In(u,os(i.parser.constructs.insideSpan.null,n.slice(s+1,r),i)),u=In(u,[["exit",y,i],["enter",g,i],["exit",g,i],["exit",p,i]]);let S=0;n[r][1].end.offset-n[r][1].start.offset&&(S=2,u=In(u,[["enter",n[r][1],i],["exit",n[r][1],i]])),Pn(n,s-1,r-s+3,u),r=s+u.length-S-2;break}}for(r=-1;++r<n.length;)n[r][1].type==="attentionSequence"&&(n[r][1].type="data");return n}function Pw(n,i){const r=this.parser.constructs.attentionMarkers.null,u=this.previous,s=Ti(u);let c;return d;function d(m){return c=m,n.enter("attentionSequence"),h(m)}function h(m){if(m===c)return n.consume(m),h;const g=n.exit("attentionSequence"),y=Ti(m),p=!y||y===2&&s||r.includes(m)&&m!==42&&m!==95,S=!s||s===2&&y||r.includes(u)&&u!==42&&u!==95;return g._open=!!(c===42?p:p&&(s||!S)),g._close=!!(c===42?S:S&&(y||!p)),i(m)}}function zy(n,i){n.column+=i,n.offset+=i,n._bufferIndex+=i}const ek={name:"autolink",tokenize:tk};function tk(n,i,r){let u=0;return s;function s(v){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),c}function c(v){return Kt(v)?(n.consume(v),d):v===64?r(v):g(v)}function d(v){return v===43||v===45||v===46||Jt(v)?(u=1,h(v)):g(v)}function h(v){return v===58?(n.consume(v),u=0,m):(v===43||v===45||v===46||Jt(v))&&u++<32?(n.consume(v),h):(u=0,g(v))}function m(v){return v===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.exit("autolink"),i):v===null||v===32||v===60||Ko(v)?r(v):(n.consume(v),m)}function g(v){return v===64?(n.consume(v),y):Qw(v)?(n.consume(v),g):r(v)}function y(v){return Jt(v)?p(v):r(v)}function p(v){return v===46?(n.consume(v),u=0,y):v===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(v),n.exit("autolinkMarker"),n.exit("autolink"),i):S(v)}function S(v){if((v===45||Jt(v))&&u++<63){const k=v===45?S:p;return n.consume(v),k}return r(v)}}const hu={partial:!0,tokenize:nk};function nk(n,i,r){return u;function u(c){return Be(c)?Ke(n,s,"linePrefix")(c):s(c)}function s(c){return c===null||Se(c)?i(c):r(c)}}const $1={continuation:{tokenize:ik},exit:rk,name:"blockQuote",tokenize:lk};function lk(n,i,r){const u=this;return s;function s(d){if(d===62){const h=u.containerState;return h.open||(n.enter("blockQuote",{_container:!0}),h.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(d),n.exit("blockQuoteMarker"),c}return r(d)}function c(d){return Be(d)?(n.enter("blockQuotePrefixWhitespace"),n.consume(d),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),i):(n.exit("blockQuotePrefix"),i(d))}}function ik(n,i,r){const u=this;return s;function s(d){return Be(d)?Ke(n,c,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return n.attempt($1,i,r)(d)}}function rk(n){n.exit("blockQuote")}const W1={name:"characterEscape",tokenize:ak};function ak(n,i,r){return u;function u(c){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(c),n.exit("escapeMarker"),s}function s(c){return K1(c)?(n.enter("characterEscapeValue"),n.consume(c),n.exit("characterEscapeValue"),n.exit("characterEscape"),i):r(c)}}const P1={name:"characterReference",tokenize:uk};function uk(n,i,r){const u=this;let s=0,c,d;return h;function h(p){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(p),n.exit("characterReferenceMarker"),m}function m(p){return p===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(p),n.exit("characterReferenceMarkerNumeric"),g):(n.enter("characterReferenceValue"),c=31,d=Jt,y(p))}function g(p){return p===88||p===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(p),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),c=6,d=Xw,y):(n.enter("characterReferenceValue"),c=7,d=xd,y(p))}function y(p){if(p===59&&s){const S=n.exit("characterReferenceValue");return d===Jt&&!Yd(u.sliceSerialize(S))?r(p):(n.enter("characterReferenceMarker"),n.consume(p),n.exit("characterReferenceMarker"),n.exit("characterReference"),i)}return d(p)&&s++<c?(n.consume(p),y):r(p)}}const wd={partial:!0,tokenize:ok};function ok(n,i,r){const u=this;return s;function s(d){return d===null?r(d):(n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),c)}function c(d){return u.parser.lazy[u.now().line]?r(d):i(d)}}const Oy={concrete:!0,name:"codeFenced",tokenize:sk};function sk(n,i,r){const u=this,s={partial:!0,tokenize:le};let c=0,d=0,h;return m;function m(H){return g(H)}function g(H){const Z=u.events[u.events.length-1];return c=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,h=H,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),y(H)}function y(H){return H===h?(d++,n.consume(H),y):d<3?r(H):(n.exit("codeFencedFenceSequence"),Be(H)?Ke(n,p,"whitespace")(H):p(H))}function p(H){return H===null||Se(H)?(n.exit("codeFencedFence"),u.interrupt?i(H):n.check(wd,A,ne)(H)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),S(H))}function S(H){return H===null||Se(H)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),p(H)):Be(H)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),Ke(n,v,"whitespace")(H)):H===96&&H===h?r(H):(n.consume(H),S)}function v(H){return H===null||Se(H)?p(H):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),k(H))}function k(H){return H===null||Se(H)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),p(H)):H===96&&H===h?r(H):(n.consume(H),k)}function A(H){return n.attempt(s,ne,R)(H)}function R(H){return n.enter("lineEnding"),n.consume(H),n.exit("lineEnding"),C}function C(H){return c>0&&Be(H)?Ke(n,I,"linePrefix",c+1)(H):I(H)}function I(H){return H===null||Se(H)?n.check(wd,A,ne)(H):(n.enter("codeFlowValue"),G(H))}function G(H){return H===null||Se(H)?(n.exit("codeFlowValue"),I(H)):(n.consume(H),G)}function ne(H){return n.exit("codeFenced"),i(H)}function le(H,Z,K){let de=0;return U;function U(be){return H.enter("lineEnding"),H.consume(be),H.exit("lineEnding"),$}function $(be){return H.enter("codeFencedFence"),Be(be)?Ke(H,ue,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(be):ue(be)}function ue(be){return be===h?(H.enter("codeFencedFenceSequence"),Ce(be)):K(be)}function Ce(be){return be===h?(de++,H.consume(be),Ce):de>=d?(H.exit("codeFencedFenceSequence"),Be(be)?Ke(H,Ue,"whitespace")(be):Ue(be)):K(be)}function Ue(be){return be===null||Se(be)?(H.exit("codeFencedFence"),Z(be)):K(be)}}}const Pf={name:"codeIndented",tokenize:fk},ck={partial:!0,tokenize:dk};function fk(n,i,r){return u;function u(h){return n.enter("codeIndented"),J1(n,s,r,"linePrefix",4,4)(h)}function s(h){return h===null?d(h):Se(h)?n.attempt(ck,s,d)(h):(n.enter("codeFlowValue"),c(h))}function c(h){return h===null||Se(h)?(n.exit("codeFlowValue"),s(h)):(n.consume(h),c)}function d(h){return n.exit("codeIndented"),i(h)}}function dk(n,i,r){const u=this;return s;function s(d){return u.parser.lazy[u.now().line]?r(d):Se(d)?(n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),s):J1(n,i,c,"linePrefix",4,4)(d)}function c(d){return Se(d)?s(d):r(d)}}const hk={name:"codeText",previous:pk,resolve:mk,tokenize:gk};function mk(n){let i=n.length-4,r=3,u,s;if((n[r][1].type==="lineEnding"||n[r][1].type==="space")&&(n[i][1].type==="lineEnding"||n[i][1].type==="space")){for(u=r;++u<i;)if(n[u][1].type==="codeTextData"){n[r][1].type="codeTextPadding",n[i][1].type="codeTextPadding",r+=2,i-=2;break}}for(u=r-1,i++;++u<=i;)s===void 0?u!==i&&n[u][1].type!=="lineEnding"&&(s=u):(u===i||n[u][1].type==="lineEnding")&&(n[s][1].type="codeTextData",u!==s+2&&(n[s][1].end=n[u-1][1].end,n.splice(s+2,u-s-2),i-=u-s-2,u=s+2),s=void 0);return n}function pk(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gk(n,i,r){let u=0,s,c;return d;function d(p){return n.enter("codeText"),n.enter("codeTextSequence"),h(p)}function h(p){return p===96?(n.consume(p),u++,h):(n.exit("codeTextSequence"),m(p))}function m(p){return p===null?r(p):p===32?(n.enter("space"),n.consume(p),n.exit("space"),m):p===96?(c=n.enter("codeTextSequence"),s=0,y(p)):Se(p)?(n.enter("lineEnding"),n.consume(p),n.exit("lineEnding"),m):(n.enter("codeTextData"),g(p))}function g(p){return p===null||p===32||p===96||Se(p)?(n.exit("codeTextData"),m(p)):(n.consume(p),g)}function y(p){return p===96?(n.consume(p),s++,y):s===u?(n.exit("codeTextSequence"),n.exit("codeText"),i(p)):(c.type="codeTextData",g(p))}}class yk{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,r){const u=r??Number.POSITIVE_INFINITY;return u<this.left.length?this.left.slice(i,u):i>this.left.length?this.right.slice(this.right.length-u+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-u+this.left.length).reverse())}splice(i,r,u){const s=r||0;this.setCursor(Math.trunc(i));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return u&&tu(this.left,u),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),tu(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),tu(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const r=this.left.splice(i,Number.POSITIVE_INFINITY);tu(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);tu(this.left,r.reverse())}}}function tu(n,i){let r=0;if(i.length<1e4)n.push(...i);else for(;r<i.length;)n.push(...i.slice(r,r+1e4)),r+=1e4}function e0(n){const i={};let r=-1,u,s,c,d,h,m,g;const y=new yk(n);for(;++r<y.length;){for(;r in i;)r=i[r];if(u=y.get(r),r&&u[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=u[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(u[0]==="enter")u[1].contentType&&(Object.assign(i,bk(y,r)),r=i[r],g=!0);else if(u[1]._container){for(c=r,s=void 0;c--;)if(d=y.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(s&&(y.get(s)[1].type="lineEndingBlank"),d[1].type="lineEnding",s=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;s&&(u[1].end={...y.get(s)[1].start},h=y.slice(s,r),h.unshift(u),y.splice(s,r-s+1,h))}}return Pn(n,0,Number.POSITIVE_INFINITY,y.slice(0)),!g}function bk(n,i){const r=n.get(i)[1],u=n.get(i)[2];let s=i-1;const c=[];let d=r._tokenizer;d||(d=u.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,m=[],g={};let y,p,S=-1,v=r,k=0,A=0;const R=[A];for(;v;){for(;n.get(++s)[1]!==v;);c.push(s),v._tokenizer||(y=u.sliceStream(v),v.next||y.push(null),p&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(y),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),p=v,v=v.next}for(v=r;++S<h.length;)h[S][0]==="exit"&&h[S-1][0]==="enter"&&h[S][1].type===h[S-1][1].type&&h[S][1].start.line!==h[S][1].end.line&&(A=S+1,R.push(A),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):R.pop(),S=R.length;S--;){const C=h.slice(R[S],R[S+1]),I=c.pop();m.push([I,I+C.length-1]),n.splice(I,2,C)}for(m.reverse(),S=-1;++S<m.length;)g[k+m[S][0]]=k+m[S][1],k+=m[S][1]-m[S][0]-1;return g}const vk={resolve:Sk,tokenize:wk},xk={partial:!0,tokenize:kk};function Sk(n){return e0(n),n}function wk(n,i){let r;return u;function u(h){return n.enter("content"),r=n.enter("chunkContent",{contentType:"content"}),s(h)}function s(h){return h===null?c(h):Se(h)?n.check(xk,d,c)(h):(n.consume(h),s)}function c(h){return n.exit("chunkContent"),n.exit("content"),i(h)}function d(h){return n.consume(h),n.exit("chunkContent"),r.next=n.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function kk(n,i,r){const u=this;return s;function s(d){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),Ke(n,c,"linePrefix")}function c(d){if(d===null||Se(d))return r(d);const h=u.events[u.events.length-1];return!u.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(d):n.interrupt(u.parser.constructs.flow,r,i)(d)}}function t0(n,i,r,u,s,c,d,h,m){const g=m||Number.POSITIVE_INFINITY;let y=0;return p;function p(C){return C===60?(n.enter(u),n.enter(s),n.enter(c),n.consume(C),n.exit(c),S):C===null||C===32||C===41||Ko(C)?r(C):(n.enter(u),n.enter(d),n.enter(h),n.enter("chunkString",{contentType:"string"}),A(C))}function S(C){return C===62?(n.enter(c),n.consume(C),n.exit(c),n.exit(s),n.exit(u),i):(n.enter(h),n.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(n.exit("chunkString"),n.exit(h),S(C)):C===null||C===60||Se(C)?r(C):(n.consume(C),C===92?k:v)}function k(C){return C===60||C===62||C===92?(n.consume(C),v):v(C)}function A(C){return!y&&(C===null||C===41||ut(C))?(n.exit("chunkString"),n.exit(h),n.exit(d),n.exit(u),i(C)):y<g&&C===40?(n.consume(C),y++,A):C===41?(n.consume(C),y--,A):C===null||C===32||C===40||Ko(C)?r(C):(n.consume(C),C===92?R:A)}function R(C){return C===40||C===41||C===92?(n.consume(C),A):A(C)}}function n0(n,i,r,u,s,c){const d=this;let h=0,m;return g;function g(v){return n.enter(u),n.enter(s),n.consume(v),n.exit(s),n.enter(c),y}function y(v){return h>999||v===null||v===91||v===93&&!m||v===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(n.exit(c),n.enter(s),n.consume(v),n.exit(s),n.exit(u),i):Se(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),y):(n.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Se(v)||h++>999?(n.exit("chunkString"),y(v)):(n.consume(v),m||(m=!Be(v)),v===92?S:p)}function S(v){return v===91||v===92||v===93?(n.consume(v),h++,p):p(v)}}function l0(n,i,r,u,s,c){let d;return h;function h(S){return S===34||S===39||S===40?(n.enter(u),n.enter(s),n.consume(S),n.exit(s),d=S===40?41:S,m):r(S)}function m(S){return S===d?(n.enter(s),n.consume(S),n.exit(s),n.exit(u),i):(n.enter(c),g(S))}function g(S){return S===d?(n.exit(c),m(d)):S===null?r(S):Se(S)?(n.enter("lineEnding"),n.consume(S),n.exit("lineEnding"),Ke(n,g,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===d||S===null||Se(S)?(n.exit("chunkString"),g(S)):(n.consume(S),S===92?p:y)}function p(S){return S===d||S===92?(n.consume(S),y):y(S)}}function ru(n,i){let r;return u;function u(s){return Se(s)?(n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),r=!0,u):Be(s)?Ke(n,u,r?"linePrefix":"lineSuffix")(s):i(s)}}const Tk={name:"definition",tokenize:Ck},Ek={partial:!0,tokenize:Ak};function Ck(n,i,r){const u=this;let s;return c;function c(v){return n.enter("definition"),d(v)}function d(v){return n0.call(u,n,h,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function h(v){return s=el(u.sliceSerialize(u.events[u.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),m):r(v)}function m(v){return ut(v)?ru(n,g)(v):g(v)}function g(v){return t0(n,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return n.attempt(Ek,p,p)(v)}function p(v){return Be(v)?Ke(n,S,"whitespace")(v):S(v)}function S(v){return v===null||Se(v)?(n.exit("definition"),u.parser.defined.push(s),i(v)):r(v)}}function Ak(n,i,r){return u;function u(h){return ut(h)?ru(n,s)(h):r(h)}function s(h){return l0(n,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return Be(h)?Ke(n,d,"whitespace")(h):d(h)}function d(h){return h===null||Se(h)?i(h):r(h)}}const Nk={name:"hardBreakEscape",tokenize:zk};function zk(n,i,r){return u;function u(c){return n.enter("hardBreakEscape"),n.consume(c),s}function s(c){return Se(c)?(n.exit("hardBreakEscape"),i(c)):r(c)}}const Ok={name:"headingAtx",resolve:_k,tokenize:jk};function _k(n,i){let r=n.length-2,u=3;if(n[u][1].type==="whitespace"&&(u+=2),r-2>u&&n[r][1].type==="whitespace"&&(r-=2),n[r][1].type==="atxHeadingSequence"&&(u===r-1||r-4>u&&n[r-2][1].type==="whitespace")&&(r-=u+1===r?2:4),r>u){const s={type:"atxHeadingText",start:n[u][1].start,end:n[r][1].end},c={type:"chunkText",start:n[u][1].start,end:n[r][1].end,contentType:"text"};Pn(n,u,r-u+1,[["enter",s,i],["enter",c,i],["exit",c,i],["exit",s,i]])}return n}function jk(n,i,r){let u=0;return s;function s(y){return n.enter("atxHeading"),c(y)}function c(y){return n.enter("atxHeadingSequence"),d(y)}function d(y){return y===35&&u++<6?(n.consume(y),d):y===null||ut(y)?(n.exit("atxHeadingSequence"),h(y)):r(y)}function h(y){return y===35?(n.enter("atxHeadingSequence"),m(y)):y===null||Se(y)?(n.exit("atxHeading"),i(y)):Be(y)?Ke(n,h,"whitespace")(y):(n.enter("atxHeadingText"),g(y))}function m(y){return y===35?(n.consume(y),m):(n.exit("atxHeadingSequence"),h(y))}function g(y){return y===null||y===35||ut(y)?(n.exit("atxHeadingText"),h(y)):(n.consume(y),g)}}const i0=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kd=["pre","script","style","textarea"],Mk={concrete:!0,name:"htmlFlow",resolveTo:Rk,tokenize:Lk},Dk={partial:!0,tokenize:Bk};function Rk(n){let i=n.length;for(;i--&&!(n[i][0]==="enter"&&n[i][1].type==="htmlFlow"););return i>1&&n[i-2][1].type==="linePrefix"&&(n[i][1].start=n[i-2][1].start,n[i+1][1].start=n[i-2][1].start,n.splice(i-2,2)),n}function Lk(n,i,r){const u=this;let s,c,d,h,m;return g;function g(O){return y(O)}function y(O){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(O),p}function p(O){return O===33?(n.consume(O),S):O===47?(n.consume(O),c=!0,A):O===63?(n.consume(O),s=3,u.interrupt?i:E):Kt(O)?(n.consume(O),d=String.fromCharCode(O),R):r(O)}function S(O){return O===45?(n.consume(O),s=2,v):O===91?(n.consume(O),s=5,h=0,k):Kt(O)?(n.consume(O),s=4,u.interrupt?i:E):r(O)}function v(O){return O===45?(n.consume(O),u.interrupt?i:E):r(O)}function k(O){const z="CDATA[";return O===z.charCodeAt(h++)?(n.consume(O),h===z.length?u.interrupt?i:ue:k):r(O)}function A(O){return Kt(O)?(n.consume(O),d=String.fromCharCode(O),R):r(O)}function R(O){if(O===null||O===47||O===62||ut(O)){const z=O===47,J=d.toLowerCase();return!z&&!c&&kd.includes(J)?(s=1,u.interrupt?i(O):ue(O)):i0.includes(d.toLowerCase())?(s=6,z?(n.consume(O),C):u.interrupt?i(O):ue(O)):(s=7,u.interrupt&&!u.parser.lazy[u.now().line]?r(O):c?I(O):G(O))}return O===45||Jt(O)?(n.consume(O),d+=String.fromCharCode(O),R):r(O)}function C(O){return O===62?(n.consume(O),u.interrupt?i:ue):r(O)}function I(O){return Be(O)?(n.consume(O),I):U(O)}function G(O){return O===47?(n.consume(O),U):O===58||O===95||Kt(O)?(n.consume(O),ne):Be(O)?(n.consume(O),G):U(O)}function ne(O){return O===45||O===46||O===58||O===95||Jt(O)?(n.consume(O),ne):le(O)}function le(O){return O===61?(n.consume(O),H):Be(O)?(n.consume(O),le):G(O)}function H(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(n.consume(O),m=O,Z):Be(O)?(n.consume(O),H):K(O)}function Z(O){return O===m?(n.consume(O),m=null,de):O===null||Se(O)?r(O):(n.consume(O),Z)}function K(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||ut(O)?le(O):(n.consume(O),K)}function de(O){return O===47||O===62||Be(O)?G(O):r(O)}function U(O){return O===62?(n.consume(O),$):r(O)}function $(O){return O===null||Se(O)?ue(O):Be(O)?(n.consume(O),$):r(O)}function ue(O){return O===45&&s===2?(n.consume(O),ee):O===60&&s===1?(n.consume(O),oe):O===62&&s===4?(n.consume(O),ot):O===63&&s===3?(n.consume(O),E):O===93&&s===5?(n.consume(O),Me):Se(O)&&(s===6||s===7)?(n.exit("htmlFlowData"),n.check(Dk,mt,Ce)(O)):O===null||Se(O)?(n.exit("htmlFlowData"),Ce(O)):(n.consume(O),ue)}function Ce(O){return n.check(wd,Ue,mt)(O)}function Ue(O){return n.enter("lineEnding"),n.consume(O),n.exit("lineEnding"),be}function be(O){return O===null||Se(O)?Ce(O):(n.enter("htmlFlowData"),ue(O))}function ee(O){return O===45?(n.consume(O),E):ue(O)}function oe(O){return O===47?(n.consume(O),d="",me):ue(O)}function me(O){if(O===62){const z=d.toLowerCase();return kd.includes(z)?(n.consume(O),ot):ue(O)}return Kt(O)&&d.length<8?(n.consume(O),d+=String.fromCharCode(O),me):ue(O)}function Me(O){return O===93?(n.consume(O),E):ue(O)}function E(O){return O===62?(n.consume(O),ot):O===45&&s===2?(n.consume(O),E):ue(O)}function ot(O){return O===null||Se(O)?(n.exit("htmlFlowData"),mt(O)):(n.consume(O),ot)}function mt(O){return n.exit("htmlFlow"),i(O)}}function Bk(n,i,r){return u;function u(s){return n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),n.attempt(hu,i,r)}}const Uk={name:"htmlText",tokenize:qk};function qk(n,i,r){const u=this;let s,c,d;return h;function h(E){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(E),m}function m(E){return E===33?(n.consume(E),g):E===47?(n.consume(E),le):E===63?(n.consume(E),G):Kt(E)?(n.consume(E),K):r(E)}function g(E){return E===45?(n.consume(E),y):E===91?(n.consume(E),c=0,k):Kt(E)?(n.consume(E),I):r(E)}function y(E){return E===45?(n.consume(E),v):r(E)}function p(E){return E===null?r(E):E===45?(n.consume(E),S):Se(E)?(d=p,oe(E)):(n.consume(E),p)}function S(E){return E===45?(n.consume(E),v):p(E)}function v(E){return E===62?ee(E):E===45?S(E):p(E)}function k(E){const ot="CDATA[";return E===ot.charCodeAt(c++)?(n.consume(E),c===ot.length?A:k):r(E)}function A(E){return E===null?r(E):E===93?(n.consume(E),R):Se(E)?(d=A,oe(E)):(n.consume(E),A)}function R(E){return E===93?(n.consume(E),C):A(E)}function C(E){return E===62?ee(E):E===93?(n.consume(E),C):A(E)}function I(E){return E===null||E===62?ee(E):Se(E)?(d=I,oe(E)):(n.consume(E),I)}function G(E){return E===null?r(E):E===63?(n.consume(E),ne):Se(E)?(d=G,oe(E)):(n.consume(E),G)}function ne(E){return E===62?ee(E):G(E)}function le(E){return Kt(E)?(n.consume(E),H):r(E)}function H(E){return E===45||Jt(E)?(n.consume(E),H):Z(E)}function Z(E){return Se(E)?(d=Z,oe(E)):Be(E)?(n.consume(E),Z):ee(E)}function K(E){return E===45||Jt(E)?(n.consume(E),K):E===47||E===62||ut(E)?de(E):r(E)}function de(E){return E===47?(n.consume(E),ee):E===58||E===95||Kt(E)?(n.consume(E),U):Se(E)?(d=de,oe(E)):Be(E)?(n.consume(E),de):ee(E)}function U(E){return E===45||E===46||E===58||E===95||Jt(E)?(n.consume(E),U):$(E)}function $(E){return E===61?(n.consume(E),ue):Se(E)?(d=$,oe(E)):Be(E)?(n.consume(E),$):de(E)}function ue(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(n.consume(E),s=E,Ce):Se(E)?(d=ue,oe(E)):Be(E)?(n.consume(E),ue):(n.consume(E),Ue)}function Ce(E){return E===s?(n.consume(E),s=void 0,be):E===null?r(E):Se(E)?(d=Ce,oe(E)):(n.consume(E),Ce)}function Ue(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||ut(E)?de(E):(n.consume(E),Ue)}function be(E){return E===47||E===62||ut(E)?de(E):r(E)}function ee(E){return E===62?(n.consume(E),n.exit("htmlTextData"),n.exit("htmlText"),i):r(E)}function oe(E){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(E),n.exit("lineEnding"),me}function me(E){return Be(E)?Ke(n,Me,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):Me(E)}function Me(E){return n.enter("htmlTextData"),d(E)}}const Id={name:"labelEnd",resolveAll:Vk,resolveTo:Gk,tokenize:Qk},Hk={tokenize:Xk},Yk={tokenize:Zk},Ik={tokenize:Fk};function Vk(n){let i=-1;const r=[];for(;++i<n.length;){const u=n[i][1];if(r.push(n[i]),u.type==="labelImage"||u.type==="labelLink"||u.type==="labelEnd"){const s=u.type==="labelImage"?4:2;u.type="data",i+=s}}return n.length!==r.length&&Pn(n,0,n.length,r),n}function Gk(n,i){let r=n.length,u=0,s,c,d;for(;r--;){const y=n[r][1];if(s){if(y.type==="link"||y.type==="labelLink"&&y._inactive)break;n[r][0]==="enter"&&y.type==="labelLink"&&(y._inactive=!0)}else if(c){if(n[r][0]==="enter"&&(y.type==="labelImage"||y.type==="labelLink")&&!y._balanced&&(s=r,y.type!=="labelLink")){u=2;break}}else y.type==="labelEnd"&&(c=r)}const h={type:n[s][1].type==="labelLink"?"link":"image",start:{...n[s][1].start},end:{...n[n.length-1][1].end}},m={type:"label",start:{...n[s][1].start},end:{...n[c][1].end}},g={type:"labelText",start:{...n[s+u+2][1].end},end:{...n[c-2][1].start}};return d=[["enter",h,i],["enter",m,i]],d=In(d,n.slice(s+1,s+u+3)),d=In(d,[["enter",g,i]]),d=In(d,os(i.parser.constructs.insideSpan.null,n.slice(s+u+4,c-3),i)),d=In(d,[["exit",g,i],n[c-2],n[c-1],["exit",m,i]]),d=In(d,n.slice(c+1)),d=In(d,[["exit",h,i]]),Pn(n,s,n.length,d),n}function Qk(n,i,r){const u=this,s=u._labelStarts;let c,d;if(s){for(;s.length>0&&s[s.length-1]._balanced;)s.pop();c=s[s.length-1]}return h;function h(S){return c?c._inactive?p(S):(d=u.parser.defined.includes(el(u.sliceSerialize({start:c.end,end:u.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(S),n.exit("labelMarker"),n.exit("labelEnd"),m):r(S)}function m(S){return S===40?n.attempt(Hk,y,d?y:p)(S):S===91?n.attempt(Yk,y,d?g:p)(S):d?y(S):p(S)}function g(S){return n.attempt(Ik,y,p)(S)}function y(S){return s.pop(),i(S)}function p(S){return c._balanced=!0,r(S)}}function Xk(n,i,r){return u;function u(p){return n.enter("resource"),n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),s}function s(p){return ut(p)?ru(n,c)(p):c(p)}function c(p){return p===41?y(p):t0(n,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function d(p){return ut(p)?ru(n,m)(p):y(p)}function h(p){return r(p)}function m(p){return p===34||p===39||p===40?l0(n,g,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):y(p)}function g(p){return ut(p)?ru(n,y)(p):y(p)}function y(p){return p===41?(n.enter("resourceMarker"),n.consume(p),n.exit("resourceMarker"),n.exit("resource"),i):r(p)}}function Zk(n,i,r){const u=this;return s;function s(h){return n0.call(u,n,c,d,"reference","referenceMarker","referenceString")(h)}function c(h){return u.parser.defined.includes(el(u.sliceSerialize(u.events[u.events.length-1][1]).slice(1,-1)))?i(h):r(h)}function d(h){return r(h)}}function Fk(n,i,r){return u;function u(c){return n.enter("reference"),n.enter("referenceMarker"),n.consume(c),n.exit("referenceMarker"),s}function s(c){return c===93?(n.enter("referenceMarker"),n.consume(c),n.exit("referenceMarker"),n.exit("reference"),i):r(c)}}const Kk={name:"labelStartImage",resolveAll:Id.resolveAll,tokenize:Jk};function Jk(n,i,r){const u=this;let s;return c;function c(m){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(m),n.exit("labelImageMarker"),d}function d(m){return m===91?(n.enter("labelMarker"),n.consume(m),n.exit("labelMarker"),s=n.exit("labelImage"),h):r(m)}function h(m){return m===94&&"_hiddenFootnoteSupport"in u.parser.constructs?r(m):(u._labelStarts=u._labelStarts||[],u._labelStarts.push(s),i(m))}}const $k={name:"labelStartLink",resolveAll:Id.resolveAll,tokenize:Wk};function Wk(n,i,r){const u=this;let s;return c;function c(h){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(h),n.exit("labelMarker"),s=n.exit("labelLink"),d}function d(h){return h===94&&"_hiddenFootnoteSupport"in u.parser.constructs?r(h):(u._labelStarts=u._labelStarts||[],u._labelStarts.push(s),i(h))}}const ed={name:"lineEnding",tokenize:Pk};function Pk(n,i){return r;function r(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),Ke(n,i,"linePrefix")}}const Fo={name:"thematicBreak",tokenize:eT};function eT(n,i,r){let u=0,s;return c;function c(g){return n.enter("thematicBreak"),d(g)}function d(g){return s=g,h(g)}function h(g){return g===s?(n.enter("thematicBreakSequence"),m(g)):u>=3&&(g===null||Se(g))?(n.exit("thematicBreak"),i(g)):r(g)}function m(g){return g===s?(n.consume(g),u++,m):(n.exit("thematicBreakSequence"),Be(g)?Ke(n,h,"whitespace")(g):h(g))}}const yn={continuation:{tokenize:iT},exit:aT,name:"list",tokenize:lT},tT={partial:!0,tokenize:uT},nT={partial:!0,tokenize:rT};function lT(n,i,r){const u=this,s=u.events[u.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,d=0;return h;function h(v){const k=u.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!u.containerState.marker||v===u.containerState.marker:xd(v)){if(u.containerState.type||(u.containerState.type=k,n.enter(k,{_container:!0})),k==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(Fo,r,g)(v):g(v);if(!u.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),m(v)}return r(v)}function m(v){return xd(v)&&++d<10?(n.consume(v),m):(!u.interrupt||d<2)&&(u.containerState.marker?v===u.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),g(v)):r(v)}function g(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),u.containerState.marker=u.containerState.marker||v,n.check(hu,u.interrupt?r:y,n.attempt(tT,S,p))}function y(v){return u.containerState.initialBlankLine=!0,c++,S(v)}function p(v){return Be(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),S):r(v)}function S(v){return u.containerState.size=c+u.sliceSerialize(n.exit("listItemPrefix"),!0).length,i(v)}}function iT(n,i,r){const u=this;return u.containerState._closeFlow=void 0,n.check(hu,s,c);function s(h){return u.containerState.furtherBlankLines=u.containerState.furtherBlankLines||u.containerState.initialBlankLine,Ke(n,i,"listItemIndent",u.containerState.size+1)(h)}function c(h){return u.containerState.furtherBlankLines||!Be(h)?(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,d(h)):(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,n.attempt(nT,i,d)(h))}function d(h){return u.containerState._closeFlow=!0,u.interrupt=void 0,Ke(n,n.attempt(yn,i,r),"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function rT(n,i,r){const u=this;return Ke(n,s,"listItemIndent",u.containerState.size+1);function s(c){const d=u.events[u.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===u.containerState.size?i(c):r(c)}}function aT(n){n.exit(this.containerState.type)}function uT(n,i,r){const u=this;return Ke(n,s,"listItemPrefixWhitespace",u.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const d=u.events[u.events.length-1];return!Be(c)&&d&&d[1].type==="listItemPrefixWhitespace"?i(c):r(c)}}const _y={name:"setextUnderline",resolveTo:oT,tokenize:sT};function oT(n,i){const r=new Jo;let u=n.length,s,c,d;for(;u--;)if(n[u][0]==="enter"){if(n[u][1].type==="content"){s=u;break}n[u][1].type==="paragraph"&&(c=u)}else n[u][1].type==="content"&&r.add(u,1,[]),!d&&n[u][1].type==="definition"&&(d=u);const h={type:"setextHeading",start:{...n[s][1].start},end:{...n[n.length-1][1].end}};return n[c][1].type="setextHeadingText",d?(r.add(c,0,[["enter",h,i]]),r.add(d+1,0,[["exit",n[s][1],i]]),n[s][1].end={...n[d][1].end}):n[s][1]=h,r.add(n.length,0,[["exit",h,i]]),r.consume(n),n}function sT(n,i,r){const u=this;let s;return c;function c(g){let y=u.events.length,p;for(;y--;)if(u.events[y][1].type!=="lineEnding"&&u.events[y][1].type!=="linePrefix"&&u.events[y][1].type!=="content"){p=u.events[y][1].type==="paragraph";break}return!u.parser.lazy[u.now().line]&&(u.interrupt||p)?(n.enter("setextHeadingLine"),s=g,d(g)):r(g)}function d(g){return n.enter("setextHeadingLineSequence"),h(g)}function h(g){return g===s?(n.consume(g),h):(n.exit("setextHeadingLineSequence"),Be(g)?Ke(n,m,"lineSuffix")(g):m(g))}function m(g){return g===null||Se(g)?(n.exit("setextHeadingLine"),i(g)):r(g)}}const cT={tokenize:fT};function fT(n){const i=this,r=n.attempt(hu,u,n.attempt(this.parser.constructs.flowInitial,s,Ke(n,n.attempt(this.parser.constructs.flow,s,n.attempt(vk,s)),"linePrefix")));return r;function u(c){if(c===null){n.consume(c);return}return n.enter("lineEndingBlank"),n.consume(c),n.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function s(c){if(c===null){n.consume(c);return}return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),i.currentConstruct=void 0,r}}const dT={resolveAll:a0()},hT=r0("string"),mT=r0("text");function r0(n){return{resolveAll:a0(n==="text"?pT:void 0),tokenize:i};function i(r){const u=this,s=this.parser.constructs[n],c=r.attempt(s,d,h);return d;function d(y){return g(y)?c(y):h(y)}function h(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return g(y)?(r.exit("data"),c(y)):(r.consume(y),m)}function g(y){if(y===null)return!0;const p=s[y];let S=-1;if(p)for(;++S<p.length;){const v=p[S];if(!v.previous||v.previous.call(u,u.previous))return!0}return!1}}}function a0(n){return i;function i(r,u){let s=-1,c;for(;++s<=r.length;)c===void 0?r[s]&&r[s][1].type==="data"&&(c=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==c+2&&(r[c][1].end=r[s-1][1].end,r.splice(c+2,s-c-2),s=c+2),c=void 0);return n?n(r,u):r}}function pT(n,i){const r=new Jo;let u=0;for(;++u<=n.length;)if((u===n.length||n[u][1].type==="lineEnding")&&n[u-1][1].type==="data"){const s=n[u-1][1],c=i.sliceStream(s);let d=c.length,h=-1,m=0,g;for(;d--;){const y=c[d];if(typeof y=="string"){for(h=y.length;y.charCodeAt(h-1)===32;)m++,h--;if(h)break;h=-1}else if(y===-2)g=!0,m++;else if(y!==-1){d++;break}}if(i._contentTypeTextTrailing&&u===n.length&&(m=0),m){const y={type:u===n.length||g||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?h:s.start._bufferIndex+h,_index:s.start._index+d,line:s.end.line,column:s.end.column-m,offset:s.end.offset-m},end:{...s.end}};s.end={...y.start},s.start.offset===s.end.offset?Object.assign(s,y):r.add(u,0,[["enter",y,i],["exit",y,i]])}u++}return r.consume(n),n}const gT={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:$1},yT={91:Tk},bT={[-2]:Pf,[-1]:Pf,32:Pf},vT={35:Ok,42:Fo,45:[_y,Fo],60:Mk,61:_y,95:Fo,96:Oy,126:Oy},xT={38:P1,92:W1},ST={[-5]:ed,[-4]:ed,[-3]:ed,33:Kk,38:P1,42:Sd,60:[ek,Uk],91:$k,92:[Nk,W1],93:Id,95:Sd,96:hk},wT={null:[Sd,dT]},kT={null:[42,95]},TT={null:[]},ET=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kT,contentInitial:yT,disable:TT,document:gT,flow:vT,flowInitial:bT,insideSpan:wT,string:xT,text:ST},Symbol.toStringTag,{value:"Module"}));function CT(n,i,r){let u={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},c=[];let d=[],h=[];const m={attempt:Z(le),check:Z(H),consume:I,enter:G,exit:ne,interrupt:Z(H,{interrupt:!0})},g={code:null,containerState:{},defineSkip:A,events:[],now:k,parser:n,previous:null,sliceSerialize:S,sliceStream:v,write:p};let y=i.tokenize.call(g,m);return i.resolveAll&&c.push(i),g;function p($){return d=In(d,$),R(),d[d.length-1]!==null?[]:(K(i,0),g.events=os(c,g.events,g),g.events)}function S($,ue){return NT(v($),ue)}function v($){return AT(d,$)}function k(){const{_bufferIndex:$,_index:ue,line:Ce,column:Ue,offset:be}=u;return{_bufferIndex:$,_index:ue,line:Ce,column:Ue,offset:be}}function A($){s[$.line]=$.column,U()}function R(){for(;u._index<d.length;){const $=d[u._index];if(typeof $=="string"){const ue=u._index;for(u._bufferIndex<0&&(u._bufferIndex=0);u._index===ue&&u._bufferIndex<$.length;)C($.charCodeAt(u._bufferIndex))}else C($)}}function C($){y=y($)}function I($){Se($)?(u.line++,u.column=1,u.offset+=$===-3?2:1,U()):$!==-1&&(u.column++,u.offset++),u._bufferIndex<0?u._index++:(u._bufferIndex++,u._bufferIndex===d[u._index].length&&(u._bufferIndex=-1,u._index++)),g.previous=$}function G($,ue){const Ce=ue||{};return Ce.type=$,Ce.start=k(),g.events.push(["enter",Ce,g]),h.push(Ce),Ce}function ne($){const ue=h.pop();return ue.end=k(),g.events.push(["exit",ue,g]),ue}function le($,ue){K($,ue.from)}function H($,ue){ue.restore()}function Z($,ue){return Ce;function Ce(Ue,be,ee){let oe,me,Me,E;return Array.isArray(Ue)?mt(Ue):"tokenize"in Ue?mt([Ue]):ot(Ue);function ot(re){return he;function he(Te){const _e=Te!==null&&re[Te],Ae=Te!==null&&re.null,ce=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return mt(ce)(Te)}}function mt(re){return oe=re,me=0,re.length===0?ee:O(re[me])}function O(re){return he;function he(Te){return E=de(),Me=re,re.partial||(g.currentConstruct=re),re.name&&g.parser.constructs.disable.null.includes(re.name)?J():re.tokenize.call(ue?Object.assign(Object.create(g),ue):g,m,z,J)(Te)}}function z(re){return $(Me,E),be}function J(re){return E.restore(),++me<oe.length?O(oe[me]):ee}}}function K($,ue){$.resolveAll&&!c.includes($)&&c.push($),$.resolve&&Pn(g.events,ue,g.events.length-ue,$.resolve(g.events.slice(ue),g)),$.resolveTo&&(g.events=$.resolveTo(g.events,g))}function de(){const $=k(),ue=g.previous,Ce=g.currentConstruct,Ue=g.events.length,be=Array.from(h);return{from:Ue,restore:ee};function ee(){u=$,g.previous=ue,g.currentConstruct=Ce,g.events.length=Ue,h=be,U()}}function U(){u.line in s&&u.column<2&&(u.column=s[u.line],u.offset+=s[u.line]-1)}}function AT(n,i){const r=i.start._index,u=i.start._bufferIndex,s=i.end._index,c=i.end._bufferIndex;let d;if(r===s)d=[n[r].slice(u,c)];else{if(d=n.slice(r,s),u>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(u):d.shift()}c>0&&d.push(n[s].slice(0,c))}return d}function NT(n,i){let r=-1;const u=[];let s;for(;++r<n.length;){const c=n[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
14
23
  `;break}case-3:{d=`\r
15
- `;break}case-2:{d=i?" ":" ";break}case-1:{if(!i&&s)continue;d=" ";break}default:d=String.fromCharCode(c)}s=c===-2,u.push(d)}return u.join("")}function Kk(n){const u={constructs:U1([Qk,...(n||{}).extensions||[]]),content:s(hw),defined:[],document:s(pw),flow:s(Ok),lazy:{},string:s(Mk),text:s(Dk)};return u;function s(c){return d;function d(h){return Xk(u,c,h)}}}function Jk(n){for(;!Q1(n););return n}const _y=/[\0\t\n\r]/g;function $k(){let n=1,i="",r=!0,u;return s;function s(c,d,h){c=i+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c));const m=[];let g=0;for(i="",r&&(c.charCodeAt(0)===65279&&g++,r=void 0);g<c.length;){_y.lastIndex=g;const y=_y.exec(c),p=y&&y.index!==void 0?y.index:c.length,S=c.charCodeAt(p);if(!y){i=c.slice(g);break}if(S===10&&g===p&&u)m.push(-3),u=void 0;else switch(u&&(m.push(-5),u=void 0),g<p&&(m.push(c.slice(g,p)),n+=p-g),S){case 0:{m.push(65533),n++;break}case 9:{const v=Math.ceil(n/4)*4;for(m.push(-2);n++<v;)m.push(-1);break}case 10:{m.push(-4),n=1;break}default:u=!0,n=1}g=p+1}return h&&(u&&m.push(-5),i&&m.push(i),m.push(null)),m}}const Wk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pk(n){return n.replace(Wk,eT)}function eT(n,i,r){if(i)return i;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),c=s===120||s===88;return q1(r.slice(c?2:1),c?16:10)}return qd(r)||n}const W1={}.hasOwnProperty;function tT(n,i,r){return i&&typeof i=="object"&&(r=i,i=void 0),nT(r)(Jk(Kk(r).document().write($k()(n,i,!0))))}function nT(n){const i={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d($t),autolinkProtocol:U,autolinkEmail:U,atxHeading:d(en),blockQuote:d(ce),characterEscape:U,characterReference:U,codeFenced:d(pe),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:d(pe,h),codeText:d(Ot,h),codeTextData:U,data:U,codeFlowValue:U,definition:d(tl),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:d(nl),hardBreakEscape:d(gt),hardBreakTrailing:d(gt),htmlFlow:d(Fe,h),htmlFlowData:U,htmlText:d(Fe,h),htmlTextData:U,image:d(dt),label:h,link:d($t),listItem:d(Vn),listItemValue:v,listOrdered:d(on,S),listUnordered:d(on),paragraph:d(Il),reference:z,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:d(en),strong:d(ll),thematicBreak:d(il)},exit:{atxHeading:g(),atxHeadingSequence:H,autolink:g(),autolinkEmail:Ae,autolinkProtocol:_e,blockQuote:g(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:he,characterReference:Te,codeFenced:g(C),codeFencedFence:R,codeFencedFenceInfo:k,codeFencedFenceMeta:A,codeFlowValue:$,codeIndented:g(I),codeText:g(ee),codeTextData:$,data:$,definition:g(),definitionDestinationString:le,definitionLabelString:G,definitionTitleString:ne,emphasis:g(),hardBreakEscape:g(Ce),hardBreakTrailing:g(Ce),htmlFlow:g(Ue),htmlFlowData:$,htmlText:g(be),htmlTextData:$,image:g(me),label:E,labelText:Me,lineEnding:ue,link:g(oe),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:J,resourceDestinationString:ot,resourceTitleString:mt,resource:O,setextHeading:g(de),setextHeadingLineSequence:K,setextHeadingText:Z,strong:g(),thematicBreak:g()}};P1(i,(n||{}).mdastExtensions||[]);const r={};return u;function u(V){let te={type:"root",children:[],position:void 0};const ve={stack:[te],tokenStack:[],config:i,enter:m,exit:y,buffer:h,resume:p,data:r},Ne=[],vt=[];let et=-1;for(;++et<V.length;)if(vt.push(V[et]),V[et][1].type==="listOrdered"||V[et][1].type==="listUnordered")if(V[et][0]==="enter")Ne.push(vt.length-1);else{const jt=Ne.pop();c(vt,jt)}for(V=vt,et=-1;++et<V.length;){const jt=i[V[et][0]];V[et][0]==="enter"&&i.beforeEnter.length>0&&s(i.beforeEnter,{...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1]),W1.call(jt,V[et][1].type)&&jt[V[et][1].type].call({...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1]),V[et][0]==="exit"&&i.afterExit.length>0&&s(i.afterExit,{...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1])}if(ve.tokenStack.length>0){const jt=ve.tokenStack[ve.tokenStack.length-1];(jt[1]||jy).call(ve,void 0,jt[0])}for(te.position={start:ki(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:ki(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<i.transforms.length;)te=i.transforms[et](te)||te;return te}function s(V,te,ve){let Ne=-1;for(;++Ne<V.length;)V[Ne].call(te,ve)}function c(V,te){const ve=V.length-1;let Ne=te-1,vt=-1,et=!1,jt,Wt,sn,Gn;const zn=[];for(;++Ne<=ve;){const Mt=V[Ne];switch(Mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Mt[0]==="enter"?vt++:vt--,Gn=void 0;break}case"lineEndingBlank":{Mt[0]==="enter"&&(jt&&!Gn&&!vt&&!sn&&(sn=Ne),Gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gn=void 0}if(!vt&&Mt[0]==="enter"&&Mt[1].type==="listItemPrefix"||vt===-1&&Mt[0]==="exit"&&(Mt[1].type==="listUnordered"||Mt[1].type==="listOrdered")){if(jt){let vn=Ne;for(Wt=void 0;vn--;){const tn=V[vn];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;Wt&&(V[Wt][1].type="lineEndingBlank",et=!0),tn[1].type="lineEnding",Wt=vn}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}sn&&(!Wt||sn<Wt)&&(jt._spread=!0),jt.end=Object.assign({},Wt?V[Wt][1].start:Mt[1].end),zn.push({at:Wt||Ne,event:["exit",jt,Mt[2]]})}if(Mt[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},Mt[1].start),end:void 0};jt=vn,zn.push({at:Ne,event:["enter",vn,Mt[2]]}),sn=void 0,Gn=!0}}}const Ci=V.splice(te);let kt=0;for(Ne=-1;++Ne<Ci.length;){for(;kt<zn.length&&zn[kt].at===te+Ne;)V.push(zn[kt++].event);V.push(Ci[Ne])}V[te][1]._spread=et}function d(V,te){return ve;function ve(Ne){m.call(this,V(Ne),Ne),te&&te.call(this,Ne)}}function h(){this.stack.push({type:"fragment",children:[]})}function m(V,te,ve){this.stack[this.stack.length-1].children.push(V),this.stack.push(V),this.tokenStack.push([te,ve||void 0]),V.position={start:ki(te.start),end:void 0}}function g(V){return te;function te(ve){V&&V.call(this,ve),y.call(this,ve)}}function y(V,te){const ve=this.stack.pop(),Ne=this.tokenStack.pop();if(!Ne)throw new Error("Cannot close `"+V.type+"` ("+iu({start:V.start,end:V.end})+"): it’s not open");Ne[0].type!==V.type&&(te?te.call(this,V,Ne[0]):(Ne[1]||jy).call(this,V,Ne[0])),ve.position.end=ki(V.end)}function p(){return us(this.stack.pop())}function S(){this.data.expectingFirstListItemValue=!0}function v(V){if(this.data.expectingFirstListItemValue){const te=this.stack[this.stack.length-2];te.start=Number.parseInt(this.sliceSerialize(V),10),this.data.expectingFirstListItemValue=void 0}}function k(){const V=this.resume(),te=this.stack[this.stack.length-1];te.lang=V}function A(){const V=this.resume(),te=this.stack[this.stack.length-1];te.meta=V}function R(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function I(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V.replace(/(\r?\n|\r)$/g,"")}function G(V){const te=this.resume(),ve=this.stack[this.stack.length-1];ve.label=te,ve.identifier=el(this.sliceSerialize(V)).toLowerCase()}function ne(){const V=this.resume(),te=this.stack[this.stack.length-1];te.title=V}function le(){const V=this.resume(),te=this.stack[this.stack.length-1];te.url=V}function H(V){const te=this.stack[this.stack.length-1];if(!te.depth){const ve=this.sliceSerialize(V).length;te.depth=ve}}function Z(){this.data.setextHeadingSlurpLineEnding=!0}function K(V){const te=this.stack[this.stack.length-1];te.depth=this.sliceSerialize(V).codePointAt(0)===61?1:2}function de(){this.data.setextHeadingSlurpLineEnding=void 0}function U(V){const ve=this.stack[this.stack.length-1].children;let Ne=ve[ve.length-1];(!Ne||Ne.type!=="text")&&(Ne=_t(),Ne.position={start:ki(V.start),end:void 0},ve.push(Ne)),this.stack.push(Ne)}function $(V){const te=this.stack.pop();te.value+=this.sliceSerialize(V),te.position.end=ki(V.end)}function ue(V){const te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=te.children[te.children.length-1];ve.position.end=ki(V.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(te.type)&&(U.call(this,V),$.call(this,V))}function Ce(){this.data.atHardBreak=!0}function Ue(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function be(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function ee(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function oe(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=te,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function me(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=te,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function Me(V){const te=this.sliceSerialize(V),ve=this.stack[this.stack.length-2];ve.label=Pk(te),ve.identifier=el(te).toLowerCase()}function E(){const V=this.stack[this.stack.length-1],te=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Ne=V.children;ve.children=Ne}else ve.alt=te}function ot(){const V=this.resume(),te=this.stack[this.stack.length-1];te.url=V}function mt(){const V=this.resume(),te=this.stack[this.stack.length-1];te.title=V}function O(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function J(V){const te=this.resume(),ve=this.stack[this.stack.length-1];ve.label=te,ve.identifier=el(this.sliceSerialize(V)).toLowerCase(),this.data.referenceType="full"}function re(V){this.data.characterReferenceType=V.type}function he(V){const te=this.sliceSerialize(V),ve=this.data.characterReferenceType;let Ne;ve?(Ne=q1(te,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=qd(te);const vt=this.stack[this.stack.length-1];vt.value+=Ne}function Te(V){const te=this.stack.pop();te.position.end=ki(V.end)}function _e(V){$.call(this,V);const te=this.stack[this.stack.length-1];te.url=this.sliceSerialize(V)}function Ae(V){$.call(this,V);const te=this.stack[this.stack.length-1];te.url="mailto:"+this.sliceSerialize(V)}function ce(){return{type:"blockquote",children:[],position:void 0}}function pe(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ot(){return{type:"inlineCode",value:"",position:void 0}}function tl(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function nl(){return{type:"emphasis",children:[],position:void 0}}function en(){return{type:"heading",depth:0,children:[],position:void 0}}function gt(){return{type:"break",position:void 0}}function Fe(){return{type:"html",value:"",position:void 0}}function dt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function $t(){return{type:"link",title:null,url:"",children:[],position:void 0}}function on(V){return{type:"list",ordered:V.type==="listOrdered",start:null,spread:V._spread,children:[],position:void 0}}function Vn(V){return{type:"listItem",spread:V._spread,checked:null,children:[],position:void 0}}function Il(){return{type:"paragraph",children:[],position:void 0}}function ll(){return{type:"strong",children:[],position:void 0}}function _t(){return{type:"text",value:"",position:void 0}}function il(){return{type:"thematicBreak",position:void 0}}}function ki(n){return{line:n.line,column:n.column,offset:n.offset}}function P1(n,i){let r=-1;for(;++r<i.length;){const u=i[r];Array.isArray(u)?P1(n,u):lT(n,u)}}function lT(n,i){let r;for(r in i)if(W1.call(i,r))switch(r){case"canContainEols":{const u=i[r];u&&n[r].push(...u);break}case"transforms":{const u=i[r];u&&n[r].push(...u);break}case"afterExit":case"beforeEnter":{const u=i[r];u&&n[r].push(u);break}case"enter":case"exit":{const u=i[r];u&&Object.assign(n[r],u);break}}}function jy(n,i){throw n?new Error("Cannot close `"+n.type+"` ("+iu({start:n.start,end:n.end})+"): a different token (`"+i.type+"`, "+iu({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+iu({start:i.start,end:i.end})+") is still open")}function iT(n){const i=this;i.parser=r;function r(u){return tT(u,{...i.data("settings"),...n,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function rT(n,i){const r={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(i),!0)};return n.patch(i,r),n.applyData(i,r)}function aT(n,i){const r={type:"element",tagName:"br",properties:{},children:[]};return n.patch(i,r),[n.applyData(i,r),{type:"text",value:`
16
- `}]}function uT(n,i){const r=i.value?i.value+`
17
- `:"",u={},s=i.lang?i.lang.split(/\s+/):[];s.length>0&&(u.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:u,children:[{type:"text",value:r}]};return i.meta&&(c.data={meta:i.meta}),n.patch(i,c),c=n.applyData(i,c),c={type:"element",tagName:"pre",properties:{},children:[c]},n.patch(i,c),c}function oT(n,i){const r={type:"element",tagName:"del",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function sT(n,i){const r={type:"element",tagName:"em",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function cT(n,i){const r=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",u=String(i.identifier).toUpperCase(),s=$r(u.toLowerCase()),c=n.footnoteOrder.indexOf(u);let d,h=n.footnoteCounts.get(u);h===void 0?(h=0,n.footnoteOrder.push(u),d=n.footnoteOrder.length):d=c+1,h+=1,n.footnoteCounts.set(u,h);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};n.patch(i,m);const g={type:"element",tagName:"sup",properties:{},children:[m]};return n.patch(i,g),n.applyData(i,g)}function fT(n,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function dT(n,i){if(n.options.allowDangerousHtml){const r={type:"raw",value:i.value};return n.patch(i,r),n.applyData(i,r)}}function e0(n,i){const r=i.referenceType;let u="]";if(r==="collapsed"?u+="[]":r==="full"&&(u+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+u}];const s=n.all(i),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const d=s[s.length-1];return d&&d.type==="text"?d.value+=u:s.push({type:"text",value:u}),s}function hT(n,i){const r=String(i.identifier).toUpperCase(),u=n.definitionById.get(r);if(!u)return e0(n,i);const s={src:$r(u.url||""),alt:i.alt};u.title!==null&&u.title!==void 0&&(s.title=u.title);const c={type:"element",tagName:"img",properties:s,children:[]};return n.patch(i,c),n.applyData(i,c)}function mT(n,i){const r={src:$r(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const u={type:"element",tagName:"img",properties:r,children:[]};return n.patch(i,u),n.applyData(i,u)}function pT(n,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};n.patch(i,r);const u={type:"element",tagName:"code",properties:{},children:[r]};return n.patch(i,u),n.applyData(i,u)}function gT(n,i){const r=String(i.identifier).toUpperCase(),u=n.definitionById.get(r);if(!u)return e0(n,i);const s={href:$r(u.url||"")};u.title!==null&&u.title!==void 0&&(s.title=u.title);const c={type:"element",tagName:"a",properties:s,children:n.all(i)};return n.patch(i,c),n.applyData(i,c)}function yT(n,i){const r={href:$r(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const u={type:"element",tagName:"a",properties:r,children:n.all(i)};return n.patch(i,u),n.applyData(i,u)}function bT(n,i,r){const u=n.all(i),s=r?vT(r):t0(i),c={},d=[];if(typeof i.checked=="boolean"){const y=u[0];let p;y&&y.type==="element"&&y.tagName==="p"?p=y:(p={type:"element",tagName:"p",properties:{},children:[]},u.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<u.length;){const y=u[h];(s||h!==0||y.type!=="element"||y.tagName!=="p")&&d.push({type:"text",value:`
24
+ `;break}case-2:{d=i?" ":" ";break}case-1:{if(!i&&s)continue;d=" ";break}default:d=String.fromCharCode(c)}s=c===-2,u.push(d)}return u.join("")}function zT(n){const u={constructs:Z1([ET,...(n||{}).extensions||[]]),content:s(Zw),defined:[],document:s(Kw),flow:s(cT),lazy:{},string:s(hT),text:s(mT)};return u;function s(c){return d;function d(h){return CT(u,c,h)}}}function OT(n){for(;!e0(n););return n}const jy=/[\0\t\n\r]/g;function _T(){let n=1,i="",r=!0,u;return s;function s(c,d,h){c=i+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c));const m=[];let g=0;for(i="",r&&(c.charCodeAt(0)===65279&&g++,r=void 0);g<c.length;){jy.lastIndex=g;const y=jy.exec(c),p=y&&y.index!==void 0?y.index:c.length,S=c.charCodeAt(p);if(!y){i=c.slice(g);break}if(S===10&&g===p&&u)m.push(-3),u=void 0;else switch(u&&(m.push(-5),u=void 0),g<p&&(m.push(c.slice(g,p)),n+=p-g),S){case 0:{m.push(65533),n++;break}case 9:{const v=Math.ceil(n/4)*4;for(m.push(-2);n++<v;)m.push(-1);break}case 10:{m.push(-4),n=1;break}default:u=!0,n=1}g=p+1}return h&&(u&&m.push(-5),i&&m.push(i),m.push(null)),m}}const jT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MT(n){return n.replace(jT,DT)}function DT(n,i,r){if(i)return i;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),c=s===120||s===88;return F1(r.slice(c?2:1),c?16:10)}return Yd(r)||n}const u0={}.hasOwnProperty;function RT(n,i,r){return i&&typeof i=="object"&&(r=i,i=void 0),LT(r)(OT(zT(r).document().write(_T()(n,i,!0))))}function LT(n){const i={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d($t),autolinkProtocol:U,autolinkEmail:U,atxHeading:d(en),blockQuote:d(ce),characterEscape:U,characterReference:U,codeFenced:d(pe),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:d(pe,h),codeText:d(Ot,h),codeTextData:U,data:U,codeFlowValue:U,definition:d(tl),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:d(nl),hardBreakEscape:d(gt),hardBreakTrailing:d(gt),htmlFlow:d(Fe,h),htmlFlowData:U,htmlText:d(Fe,h),htmlTextData:U,image:d(dt),label:h,link:d($t),listItem:d(Vn),listItemValue:v,listOrdered:d(on,S),listUnordered:d(on),paragraph:d(Il),reference:z,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:d(en),strong:d(ll),thematicBreak:d(il)},exit:{atxHeading:g(),atxHeadingSequence:H,autolink:g(),autolinkEmail:Ae,autolinkProtocol:_e,blockQuote:g(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:he,characterReference:Te,codeFenced:g(C),codeFencedFence:R,codeFencedFenceInfo:k,codeFencedFenceMeta:A,codeFlowValue:$,codeIndented:g(I),codeText:g(ee),codeTextData:$,data:$,definition:g(),definitionDestinationString:le,definitionLabelString:G,definitionTitleString:ne,emphasis:g(),hardBreakEscape:g(Ce),hardBreakTrailing:g(Ce),htmlFlow:g(Ue),htmlFlowData:$,htmlText:g(be),htmlTextData:$,image:g(me),label:E,labelText:Me,lineEnding:ue,link:g(oe),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:J,resourceDestinationString:ot,resourceTitleString:mt,resource:O,setextHeading:g(de),setextHeadingLineSequence:K,setextHeadingText:Z,strong:g(),thematicBreak:g()}};o0(i,(n||{}).mdastExtensions||[]);const r={};return u;function u(V){let te={type:"root",children:[],position:void 0};const ve={stack:[te],tokenStack:[],config:i,enter:m,exit:y,buffer:h,resume:p,data:r},Ne=[],vt=[];let et=-1;for(;++et<V.length;)if(vt.push(V[et]),V[et][1].type==="listOrdered"||V[et][1].type==="listUnordered")if(V[et][0]==="enter")Ne.push(vt.length-1);else{const jt=Ne.pop();c(vt,jt)}for(V=vt,et=-1;++et<V.length;){const jt=i[V[et][0]];V[et][0]==="enter"&&i.beforeEnter.length>0&&s(i.beforeEnter,{...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1]),u0.call(jt,V[et][1].type)&&jt[V[et][1].type].call({...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1]),V[et][0]==="exit"&&i.afterExit.length>0&&s(i.afterExit,{...ve,sliceSerialize:V[et][2].sliceSerialize},V[et][1])}if(ve.tokenStack.length>0){const jt=ve.tokenStack[ve.tokenStack.length-1];(jt[1]||My).call(ve,void 0,jt[0])}for(te.position={start:ki(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:ki(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<i.transforms.length;)te=i.transforms[et](te)||te;return te}function s(V,te,ve){let Ne=-1;for(;++Ne<V.length;)V[Ne].call(te,ve)}function c(V,te){const ve=V.length-1;let Ne=te-1,vt=-1,et=!1,jt,Wt,sn,Gn;const zn=[];for(;++Ne<=ve;){const Mt=V[Ne];switch(Mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Mt[0]==="enter"?vt++:vt--,Gn=void 0;break}case"lineEndingBlank":{Mt[0]==="enter"&&(jt&&!Gn&&!vt&&!sn&&(sn=Ne),Gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gn=void 0}if(!vt&&Mt[0]==="enter"&&Mt[1].type==="listItemPrefix"||vt===-1&&Mt[0]==="exit"&&(Mt[1].type==="listUnordered"||Mt[1].type==="listOrdered")){if(jt){let vn=Ne;for(Wt=void 0;vn--;){const tn=V[vn];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;Wt&&(V[Wt][1].type="lineEndingBlank",et=!0),tn[1].type="lineEnding",Wt=vn}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}sn&&(!Wt||sn<Wt)&&(jt._spread=!0),jt.end=Object.assign({},Wt?V[Wt][1].start:Mt[1].end),zn.push({at:Wt||Ne,event:["exit",jt,Mt[2]]})}if(Mt[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},Mt[1].start),end:void 0};jt=vn,zn.push({at:Ne,event:["enter",vn,Mt[2]]}),sn=void 0,Gn=!0}}}const Ci=V.splice(te);let kt=0;for(Ne=-1;++Ne<Ci.length;){for(;kt<zn.length&&zn[kt].at===te+Ne;)V.push(zn[kt++].event);V.push(Ci[Ne])}V[te][1]._spread=et}function d(V,te){return ve;function ve(Ne){m.call(this,V(Ne),Ne),te&&te.call(this,Ne)}}function h(){this.stack.push({type:"fragment",children:[]})}function m(V,te,ve){this.stack[this.stack.length-1].children.push(V),this.stack.push(V),this.tokenStack.push([te,ve||void 0]),V.position={start:ki(te.start),end:void 0}}function g(V){return te;function te(ve){V&&V.call(this,ve),y.call(this,ve)}}function y(V,te){const ve=this.stack.pop(),Ne=this.tokenStack.pop();if(!Ne)throw new Error("Cannot close `"+V.type+"` ("+iu({start:V.start,end:V.end})+"): it’s not open");Ne[0].type!==V.type&&(te?te.call(this,V,Ne[0]):(Ne[1]||My).call(this,V,Ne[0])),ve.position.end=ki(V.end)}function p(){return us(this.stack.pop())}function S(){this.data.expectingFirstListItemValue=!0}function v(V){if(this.data.expectingFirstListItemValue){const te=this.stack[this.stack.length-2];te.start=Number.parseInt(this.sliceSerialize(V),10),this.data.expectingFirstListItemValue=void 0}}function k(){const V=this.resume(),te=this.stack[this.stack.length-1];te.lang=V}function A(){const V=this.resume(),te=this.stack[this.stack.length-1];te.meta=V}function R(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function I(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V.replace(/(\r?\n|\r)$/g,"")}function G(V){const te=this.resume(),ve=this.stack[this.stack.length-1];ve.label=te,ve.identifier=el(this.sliceSerialize(V)).toLowerCase()}function ne(){const V=this.resume(),te=this.stack[this.stack.length-1];te.title=V}function le(){const V=this.resume(),te=this.stack[this.stack.length-1];te.url=V}function H(V){const te=this.stack[this.stack.length-1];if(!te.depth){const ve=this.sliceSerialize(V).length;te.depth=ve}}function Z(){this.data.setextHeadingSlurpLineEnding=!0}function K(V){const te=this.stack[this.stack.length-1];te.depth=this.sliceSerialize(V).codePointAt(0)===61?1:2}function de(){this.data.setextHeadingSlurpLineEnding=void 0}function U(V){const ve=this.stack[this.stack.length-1].children;let Ne=ve[ve.length-1];(!Ne||Ne.type!=="text")&&(Ne=_t(),Ne.position={start:ki(V.start),end:void 0},ve.push(Ne)),this.stack.push(Ne)}function $(V){const te=this.stack.pop();te.value+=this.sliceSerialize(V),te.position.end=ki(V.end)}function ue(V){const te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=te.children[te.children.length-1];ve.position.end=ki(V.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(te.type)&&(U.call(this,V),$.call(this,V))}function Ce(){this.data.atHardBreak=!0}function Ue(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function be(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function ee(){const V=this.resume(),te=this.stack[this.stack.length-1];te.value=V}function oe(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=te,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function me(){const V=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";V.type+="Reference",V.referenceType=te,delete V.url,delete V.title}else delete V.identifier,delete V.label;this.data.referenceType=void 0}function Me(V){const te=this.sliceSerialize(V),ve=this.stack[this.stack.length-2];ve.label=MT(te),ve.identifier=el(te).toLowerCase()}function E(){const V=this.stack[this.stack.length-1],te=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Ne=V.children;ve.children=Ne}else ve.alt=te}function ot(){const V=this.resume(),te=this.stack[this.stack.length-1];te.url=V}function mt(){const V=this.resume(),te=this.stack[this.stack.length-1];te.title=V}function O(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function J(V){const te=this.resume(),ve=this.stack[this.stack.length-1];ve.label=te,ve.identifier=el(this.sliceSerialize(V)).toLowerCase(),this.data.referenceType="full"}function re(V){this.data.characterReferenceType=V.type}function he(V){const te=this.sliceSerialize(V),ve=this.data.characterReferenceType;let Ne;ve?(Ne=F1(te,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=Yd(te);const vt=this.stack[this.stack.length-1];vt.value+=Ne}function Te(V){const te=this.stack.pop();te.position.end=ki(V.end)}function _e(V){$.call(this,V);const te=this.stack[this.stack.length-1];te.url=this.sliceSerialize(V)}function Ae(V){$.call(this,V);const te=this.stack[this.stack.length-1];te.url="mailto:"+this.sliceSerialize(V)}function ce(){return{type:"blockquote",children:[],position:void 0}}function pe(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ot(){return{type:"inlineCode",value:"",position:void 0}}function tl(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function nl(){return{type:"emphasis",children:[],position:void 0}}function en(){return{type:"heading",depth:0,children:[],position:void 0}}function gt(){return{type:"break",position:void 0}}function Fe(){return{type:"html",value:"",position:void 0}}function dt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function $t(){return{type:"link",title:null,url:"",children:[],position:void 0}}function on(V){return{type:"list",ordered:V.type==="listOrdered",start:null,spread:V._spread,children:[],position:void 0}}function Vn(V){return{type:"listItem",spread:V._spread,checked:null,children:[],position:void 0}}function Il(){return{type:"paragraph",children:[],position:void 0}}function ll(){return{type:"strong",children:[],position:void 0}}function _t(){return{type:"text",value:"",position:void 0}}function il(){return{type:"thematicBreak",position:void 0}}}function ki(n){return{line:n.line,column:n.column,offset:n.offset}}function o0(n,i){let r=-1;for(;++r<i.length;){const u=i[r];Array.isArray(u)?o0(n,u):BT(n,u)}}function BT(n,i){let r;for(r in i)if(u0.call(i,r))switch(r){case"canContainEols":{const u=i[r];u&&n[r].push(...u);break}case"transforms":{const u=i[r];u&&n[r].push(...u);break}case"afterExit":case"beforeEnter":{const u=i[r];u&&n[r].push(u);break}case"enter":case"exit":{const u=i[r];u&&Object.assign(n[r],u);break}}}function My(n,i){throw n?new Error("Cannot close `"+n.type+"` ("+iu({start:n.start,end:n.end})+"): a different token (`"+i.type+"`, "+iu({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+iu({start:i.start,end:i.end})+") is still open")}function UT(n){const i=this;i.parser=r;function r(u){return RT(u,{...i.data("settings"),...n,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function qT(n,i){const r={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(i),!0)};return n.patch(i,r),n.applyData(i,r)}function HT(n,i){const r={type:"element",tagName:"br",properties:{},children:[]};return n.patch(i,r),[n.applyData(i,r),{type:"text",value:`
25
+ `}]}function YT(n,i){const r=i.value?i.value+`
26
+ `:"",u={},s=i.lang?i.lang.split(/\s+/):[];s.length>0&&(u.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:u,children:[{type:"text",value:r}]};return i.meta&&(c.data={meta:i.meta}),n.patch(i,c),c=n.applyData(i,c),c={type:"element",tagName:"pre",properties:{},children:[c]},n.patch(i,c),c}function IT(n,i){const r={type:"element",tagName:"del",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function VT(n,i){const r={type:"element",tagName:"em",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function GT(n,i){const r=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",u=String(i.identifier).toUpperCase(),s=$r(u.toLowerCase()),c=n.footnoteOrder.indexOf(u);let d,h=n.footnoteCounts.get(u);h===void 0?(h=0,n.footnoteOrder.push(u),d=n.footnoteOrder.length):d=c+1,h+=1,n.footnoteCounts.set(u,h);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};n.patch(i,m);const g={type:"element",tagName:"sup",properties:{},children:[m]};return n.patch(i,g),n.applyData(i,g)}function QT(n,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function XT(n,i){if(n.options.allowDangerousHtml){const r={type:"raw",value:i.value};return n.patch(i,r),n.applyData(i,r)}}function s0(n,i){const r=i.referenceType;let u="]";if(r==="collapsed"?u+="[]":r==="full"&&(u+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+u}];const s=n.all(i),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const d=s[s.length-1];return d&&d.type==="text"?d.value+=u:s.push({type:"text",value:u}),s}function ZT(n,i){const r=String(i.identifier).toUpperCase(),u=n.definitionById.get(r);if(!u)return s0(n,i);const s={src:$r(u.url||""),alt:i.alt};u.title!==null&&u.title!==void 0&&(s.title=u.title);const c={type:"element",tagName:"img",properties:s,children:[]};return n.patch(i,c),n.applyData(i,c)}function FT(n,i){const r={src:$r(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const u={type:"element",tagName:"img",properties:r,children:[]};return n.patch(i,u),n.applyData(i,u)}function KT(n,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};n.patch(i,r);const u={type:"element",tagName:"code",properties:{},children:[r]};return n.patch(i,u),n.applyData(i,u)}function JT(n,i){const r=String(i.identifier).toUpperCase(),u=n.definitionById.get(r);if(!u)return s0(n,i);const s={href:$r(u.url||"")};u.title!==null&&u.title!==void 0&&(s.title=u.title);const c={type:"element",tagName:"a",properties:s,children:n.all(i)};return n.patch(i,c),n.applyData(i,c)}function $T(n,i){const r={href:$r(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const u={type:"element",tagName:"a",properties:r,children:n.all(i)};return n.patch(i,u),n.applyData(i,u)}function WT(n,i,r){const u=n.all(i),s=r?PT(r):c0(i),c={},d=[];if(typeof i.checked=="boolean"){const y=u[0];let p;y&&y.type==="element"&&y.tagName==="p"?p=y:(p={type:"element",tagName:"p",properties:{},children:[]},u.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<u.length;){const y=u[h];(s||h!==0||y.type!=="element"||y.tagName!=="p")&&d.push({type:"text",value:`
18
27
  `}),y.type==="element"&&y.tagName==="p"&&!s?d.push(...y.children):d.push(y)}const m=u[u.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
19
- `});const g={type:"element",tagName:"li",properties:c,children:d};return n.patch(i,g),n.applyData(i,g)}function vT(n){let i=!1;if(n.type==="list"){i=n.spread||!1;const r=n.children;let u=-1;for(;!i&&++u<r.length;)i=t0(r[u])}return i}function t0(n){const i=n.spread;return i??n.children.length>1}function xT(n,i){const r={},u=n.all(i);let s=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++s<u.length;){const d=u[s];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:n.wrap(u,!0)};return n.patch(i,c),n.applyData(i,c)}function ST(n,i){const r={type:"element",tagName:"p",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function wT(n,i){const r={type:"root",children:n.wrap(n.all(i))};return n.patch(i,r),n.applyData(i,r)}function kT(n,i){const r={type:"element",tagName:"strong",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function TT(n,i){const r=n.all(i),u=r.shift(),s=[];if(u){const d={type:"element",tagName:"thead",properties:{},children:n.wrap([u],!0)};n.patch(i.children[0],d),s.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:n.wrap(r,!0)},h=Rd(i.children[1]),m=_1(i.children[i.children.length-1]);h&&m&&(d.position={start:h,end:m}),s.push(d)}const c={type:"element",tagName:"table",properties:{},children:n.wrap(s,!0)};return n.patch(i,c),n.applyData(i,c)}function ET(n,i,r){const u=r?r.children:void 0,c=(u?u.indexOf(i):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,h=d?d.length:i.children.length;let m=-1;const g=[];for(;++m<h;){const p=i.children[m],S={},v=d?d[m]:void 0;v&&(S.align=v);let k={type:"element",tagName:c,properties:S,children:[]};p&&(k.children=n.all(p),n.patch(p,k),k=n.applyData(p,k)),g.push(k)}const y={type:"element",tagName:"tr",properties:{},children:n.wrap(g,!0)};return n.patch(i,y),n.applyData(i,y)}function CT(n,i){const r={type:"element",tagName:"td",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}const My=9,Dy=32;function AT(n){const i=String(n),r=/\r?\n|\r/g;let u=r.exec(i),s=0;const c=[];for(;u;)c.push(Ry(i.slice(s,u.index),s>0,!0),u[0]),s=u.index+u[0].length,u=r.exec(i);return c.push(Ry(i.slice(s),s>0,!1)),c.join("")}function Ry(n,i,r){let u=0,s=n.length;if(i){let c=n.codePointAt(u);for(;c===My||c===Dy;)u++,c=n.codePointAt(u)}if(r){let c=n.codePointAt(s-1);for(;c===My||c===Dy;)s--,c=n.codePointAt(s-1)}return s>u?n.slice(u,s):""}function NT(n,i){const r={type:"text",value:AT(String(i.value))};return n.patch(i,r),n.applyData(i,r)}function zT(n,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(i,r),n.applyData(i,r)}const OT={blockquote:rT,break:aT,code:uT,delete:oT,emphasis:sT,footnoteReference:cT,heading:fT,html:dT,imageReference:hT,image:mT,inlineCode:pT,linkReference:gT,link:yT,listItem:bT,list:xT,paragraph:ST,root:wT,strong:kT,table:TT,tableCell:CT,tableRow:ET,text:NT,thematicBreak:zT,toml:Io,yaml:Io,definition:Io,footnoteDefinition:Io};function Io(){}const n0=-1,ss=0,au=1,$o=2,Yd=3,Id=4,Vd=5,Gd=6,l0=7,i0=8,{defineProperty:_T}=Object,r0=typeof self=="object"?self:globalThis,Ly=(n,i)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new r0[n](i)},jT=(n,i)=>{const r=(s,c)=>(n.set(c,s),s),u=s=>{if(n.has(s))return n.get(s);const[c,d]=i[s];switch(c){case ss:case n0:return r(d,s);case au:{const h=r([],s);for(const m of d)h.push(u(m));return h}case $o:{const h=r({},s);for(const[m,g]of d){const y=u(m),p=u(g);y==="__proto__"?_T(h,y,{value:p,configurable:!0,enumerable:!0,writable:!0}):h[y]=p}return h}case Yd:return r(new Date(d),s);case Id:{const{source:h,flags:m}=d;return r(new RegExp(h,m),s)}case Vd:{const h=r(new Map,s);for(const[m,g]of d)h.set(u(m),u(g));return h}case Gd:{const h=r(new Set,s);for(const m of d)h.add(u(m));return h}case l0:{const{name:h,message:m}=d;return r(typeof r0[h]=="function"?Ly(h,m):new Error(m),s)}case i0:return r(BigInt(d),s);case"BigInt":return r(Object(BigInt(d)),s);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return r(new DataView(h),d)}case"-0":return-0}return r(Ly(c,d),s)};return u},By=n=>jT(new Map,n)(0),er="",{toString:MT}={},{keys:DT,is:RT}=Object,nu=n=>{const i=typeof n;if(i!=="object"||!n)return[ss,i];const r=MT.call(n).slice(8,-1);switch(r){case"Array":return[au,er];case"Object":return[$o,er];case"Date":return[Yd,er];case"RegExp":return[Id,er];case"Map":return[Vd,er];case"Set":return[Gd,er];case"DataView":return[au,r]}return r.includes("Array")?[au,r]:n instanceof Error?[l0,n.name||"Error"]:[$o,r]},Vo=([n,i])=>n===ss&&(i==="function"||i==="symbol"),LT=(n,i,r,u)=>{const s=(d,h)=>{const m=u.push(d)-1;return r.set(h,m),m},c=d=>{if(r.has(d))return r.get(d);let[h,m]=nu(d);switch(h){case ss:{let y=d;switch(m){case"bigint":h=i0,y=d.toString();break;case"number":if(!d&&RT(d,-0))return u.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return s([n0],d)}return s([h,y],d)}case au:{if(m){let S=d;return m==="DataView"?S=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(S=new Uint8Array(d)),s([m,[...S]],d)}const y=[],p=s([h,y],d);for(const S of d)y.push(c(S));return p}case $o:{if(m)switch(m){case"BigInt":return s([m,d.toString()],d);case"Boolean":case"Number":case"String":return s([m,d.valueOf()],d)}if(i&&"toJSON"in d)return c(d.toJSON());const y=[],p=s([h,y],d);for(const S of DT(d))(n||!Vo(nu(d[S])))&&y.push([c(S),c(d[S])]);return p}case Yd:return s([h,isNaN(d.getTime())?er:d.toISOString()],d);case Id:{const{source:y,flags:p}=d;return s([h,{source:y,flags:p}],d)}case Vd:{const y=[],p=s([h,y],d);for(const[S,v]of d)(n||!(Vo(nu(S))||Vo(nu(v))))&&y.push([c(S),c(v)]);return p}case Gd:{const y=[],p=s([h,y],d);for(const S of d)(n||!Vo(nu(S)))&&y.push(c(S));return p}}const{message:g}=d;return s([h,{name:m,message:g}],d)};return c},Uy=(n,{json:i,lossy:r}={})=>{const u=[];return LT(!(i||r),!!i,new Map,u)(n),u},Wo=typeof structuredClone=="function"?(n,i)=>i&&("json"in i||"lossy"in i)?By(Uy(n,i)):structuredClone(n):(n,i)=>By(Uy(n,i));function BT(n,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function UT(n,i){return"Back to reference "+(n+1)+(i>1?"-"+i:"")}function qT(n){const i=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",r=n.options.footnoteBackContent||BT,u=n.options.footnoteBackLabel||UT,s=n.options.footnoteLabel||"Footnotes",c=n.options.footnoteLabelTagName||"h2",d=n.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let m=-1;for(;++m<n.footnoteOrder.length;){const g=n.footnoteById.get(n.footnoteOrder[m]);if(!g)continue;const y=n.all(g),p=String(g.identifier).toUpperCase(),S=$r(p.toLowerCase());let v=0;const k=[],A=n.footnoteCounts.get(p);for(;A!==void 0&&++v<=A;){k.length>0&&k.push({type:"text",value:" "});let I=typeof r=="string"?r:r(m,v);typeof I=="string"&&(I={type:"text",value:I}),k.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+S+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof u=="string"?u:u(m,v),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const R=y[y.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const I=R.children[R.children.length-1];I&&I.type==="text"?I.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(...k)}else y.push(...k);const C={type:"element",tagName:"li",properties:{id:i+"fn-"+S},children:n.wrap(y,!0)};n.patch(g,C),h.push(C)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Wo(d),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
28
+ `});const g={type:"element",tagName:"li",properties:c,children:d};return n.patch(i,g),n.applyData(i,g)}function PT(n){let i=!1;if(n.type==="list"){i=n.spread||!1;const r=n.children;let u=-1;for(;!i&&++u<r.length;)i=c0(r[u])}return i}function c0(n){const i=n.spread;return i??n.children.length>1}function eE(n,i){const r={},u=n.all(i);let s=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++s<u.length;){const d=u[s];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:n.wrap(u,!0)};return n.patch(i,c),n.applyData(i,c)}function tE(n,i){const r={type:"element",tagName:"p",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function nE(n,i){const r={type:"root",children:n.wrap(n.all(i))};return n.patch(i,r),n.applyData(i,r)}function lE(n,i){const r={type:"element",tagName:"strong",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}function iE(n,i){const r=n.all(i),u=r.shift(),s=[];if(u){const d={type:"element",tagName:"thead",properties:{},children:n.wrap([u],!0)};n.patch(i.children[0],d),s.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:n.wrap(r,!0)},h=Bd(i.children[1]),m=H1(i.children[i.children.length-1]);h&&m&&(d.position={start:h,end:m}),s.push(d)}const c={type:"element",tagName:"table",properties:{},children:n.wrap(s,!0)};return n.patch(i,c),n.applyData(i,c)}function rE(n,i,r){const u=r?r.children:void 0,c=(u?u.indexOf(i):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,h=d?d.length:i.children.length;let m=-1;const g=[];for(;++m<h;){const p=i.children[m],S={},v=d?d[m]:void 0;v&&(S.align=v);let k={type:"element",tagName:c,properties:S,children:[]};p&&(k.children=n.all(p),n.patch(p,k),k=n.applyData(p,k)),g.push(k)}const y={type:"element",tagName:"tr",properties:{},children:n.wrap(g,!0)};return n.patch(i,y),n.applyData(i,y)}function aE(n,i){const r={type:"element",tagName:"td",properties:{},children:n.all(i)};return n.patch(i,r),n.applyData(i,r)}const Dy=9,Ry=32;function uE(n){const i=String(n),r=/\r?\n|\r/g;let u=r.exec(i),s=0;const c=[];for(;u;)c.push(Ly(i.slice(s,u.index),s>0,!0),u[0]),s=u.index+u[0].length,u=r.exec(i);return c.push(Ly(i.slice(s),s>0,!1)),c.join("")}function Ly(n,i,r){let u=0,s=n.length;if(i){let c=n.codePointAt(u);for(;c===Dy||c===Ry;)u++,c=n.codePointAt(u)}if(r){let c=n.codePointAt(s-1);for(;c===Dy||c===Ry;)s--,c=n.codePointAt(s-1)}return s>u?n.slice(u,s):""}function oE(n,i){const r={type:"text",value:uE(String(i.value))};return n.patch(i,r),n.applyData(i,r)}function sE(n,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(i,r),n.applyData(i,r)}const cE={blockquote:qT,break:HT,code:YT,delete:IT,emphasis:VT,footnoteReference:GT,heading:QT,html:XT,imageReference:ZT,image:FT,inlineCode:KT,linkReference:JT,link:$T,listItem:WT,list:eE,paragraph:tE,root:nE,strong:lE,table:iE,tableCell:aE,tableRow:rE,text:oE,thematicBreak:sE,toml:Io,yaml:Io,definition:Io,footnoteDefinition:Io};function Io(){}const f0=-1,ss=0,au=1,$o=2,Vd=3,Gd=4,Qd=5,Xd=6,d0=7,h0=8,{defineProperty:fE}=Object,m0=typeof self=="object"?self:globalThis,By=(n,i)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new m0[n](i)},dE=(n,i)=>{const r=(s,c)=>(n.set(c,s),s),u=s=>{if(n.has(s))return n.get(s);const[c,d]=i[s];switch(c){case ss:case f0:return r(d,s);case au:{const h=r([],s);for(const m of d)h.push(u(m));return h}case $o:{const h=r({},s);for(const[m,g]of d){const y=u(m),p=u(g);y==="__proto__"?fE(h,y,{value:p,configurable:!0,enumerable:!0,writable:!0}):h[y]=p}return h}case Vd:return r(new Date(d),s);case Gd:{const{source:h,flags:m}=d;return r(new RegExp(h,m),s)}case Qd:{const h=r(new Map,s);for(const[m,g]of d)h.set(u(m),u(g));return h}case Xd:{const h=r(new Set,s);for(const m of d)h.add(u(m));return h}case d0:{const{name:h,message:m}=d;return r(typeof m0[h]=="function"?By(h,m):new Error(m),s)}case h0:return r(BigInt(d),s);case"BigInt":return r(Object(BigInt(d)),s);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return r(new DataView(h),d)}case"-0":return-0}return r(By(c,d),s)};return u},Uy=n=>dE(new Map,n)(0),tr="",{toString:hE}={},{keys:mE,is:pE}=Object,nu=n=>{const i=typeof n;if(i!=="object"||!n)return[ss,i];const r=hE.call(n).slice(8,-1);switch(r){case"Array":return[au,tr];case"Object":return[$o,tr];case"Date":return[Vd,tr];case"RegExp":return[Gd,tr];case"Map":return[Qd,tr];case"Set":return[Xd,tr];case"DataView":return[au,r]}return r.includes("Array")?[au,r]:n instanceof Error?[d0,n.name||"Error"]:[$o,r]},Vo=([n,i])=>n===ss&&(i==="function"||i==="symbol"),gE=(n,i,r,u)=>{const s=(d,h)=>{const m=u.push(d)-1;return r.set(h,m),m},c=d=>{if(r.has(d))return r.get(d);let[h,m]=nu(d);switch(h){case ss:{let y=d;switch(m){case"bigint":h=h0,y=d.toString();break;case"number":if(!d&&pE(d,-0))return u.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return s([f0],d)}return s([h,y],d)}case au:{if(m){let S=d;return m==="DataView"?S=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(S=new Uint8Array(d)),s([m,[...S]],d)}const y=[],p=s([h,y],d);for(const S of d)y.push(c(S));return p}case $o:{if(m)switch(m){case"BigInt":return s([m,d.toString()],d);case"Boolean":case"Number":case"String":return s([m,d.valueOf()],d)}if(i&&"toJSON"in d)return c(d.toJSON());const y=[],p=s([h,y],d);for(const S of mE(d))(n||!Vo(nu(d[S])))&&y.push([c(S),c(d[S])]);return p}case Vd:return s([h,isNaN(d.getTime())?tr:d.toISOString()],d);case Gd:{const{source:y,flags:p}=d;return s([h,{source:y,flags:p}],d)}case Qd:{const y=[],p=s([h,y],d);for(const[S,v]of d)(n||!(Vo(nu(S))||Vo(nu(v))))&&y.push([c(S),c(v)]);return p}case Xd:{const y=[],p=s([h,y],d);for(const S of d)(n||!Vo(nu(S)))&&y.push(c(S));return p}}const{message:g}=d;return s([h,{name:m,message:g}],d)};return c},qy=(n,{json:i,lossy:r}={})=>{const u=[];return gE(!(i||r),!!i,new Map,u)(n),u},Wo=typeof structuredClone=="function"?(n,i)=>i&&("json"in i||"lossy"in i)?Uy(qy(n,i)):structuredClone(n):(n,i)=>Uy(qy(n,i));function yE(n,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function bE(n,i){return"Back to reference "+(n+1)+(i>1?"-"+i:"")}function vE(n){const i=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",r=n.options.footnoteBackContent||yE,u=n.options.footnoteBackLabel||bE,s=n.options.footnoteLabel||"Footnotes",c=n.options.footnoteLabelTagName||"h2",d=n.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let m=-1;for(;++m<n.footnoteOrder.length;){const g=n.footnoteById.get(n.footnoteOrder[m]);if(!g)continue;const y=n.all(g),p=String(g.identifier).toUpperCase(),S=$r(p.toLowerCase());let v=0;const k=[],A=n.footnoteCounts.get(p);for(;A!==void 0&&++v<=A;){k.length>0&&k.push({type:"text",value:" "});let I=typeof r=="string"?r:r(m,v);typeof I=="string"&&(I={type:"text",value:I}),k.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+S+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof u=="string"?u:u(m,v),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const R=y[y.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const I=R.children[R.children.length-1];I&&I.type==="text"?I.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(...k)}else y.push(...k);const C={type:"element",tagName:"li",properties:{id:i+"fn-"+S},children:n.wrap(y,!0)};n.patch(g,C),h.push(C)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Wo(d),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
20
29
  `},{type:"element",tagName:"ol",properties:{},children:n.wrap(h,!0)},{type:"text",value:`
21
- `}]}}const cs=(function(n){if(n==null)return VT;if(typeof n=="function")return fs(n);if(typeof n=="object")return Array.isArray(n)?HT(n):YT(n);if(typeof n=="string")return IT(n);throw new Error("Expected function, string, or object as test")});function HT(n){const i=[];let r=-1;for(;++r<n.length;)i[r]=cs(n[r]);return fs(u);function u(...s){let c=-1;for(;++c<i.length;)if(i[c].apply(this,s))return!0;return!1}}function YT(n){const i=n;return fs(r);function r(u){const s=u;let c;for(c in n)if(s[c]!==i[c])return!1;return!0}}function IT(n){return fs(i);function i(r){return r&&r.type===n}}function fs(n){return i;function i(r,u,s){return!!(GT(r)&&n.call(this,r,typeof u=="number"?u:void 0,s||void 0))}}function VT(){return!0}function GT(n){return n!==null&&typeof n=="object"&&"type"in n}const a0=[],QT=!0,uu=!1,Td="skip";function Ed(n,i,r,u){if(!n||typeof n!="object")throw new Error("Unexpected value `"+n+"` for `tree`, expected node");let s=!0,c,d,h,m;if(typeof r=="function"||r&&typeof r=="object"?(c=i,d=r,u&&(s=!1)):(d=i,r&&(s=!1)),typeof d=="function")h=d;else if(d&&typeof d=="object"){if(!(d.enter===null||d.enter===void 0))if(typeof d.enter=="function")h=d.enter;else throw new Error("Unexpected value `"+d.enter+"` for `visitors.enter`, expected optional visitor");if(typeof d.exit=="function")m=d.exit;else throw new Error("Unexpected value `"+d.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+d+"` for `enter` or `visitors`, expected visitor or object with visitors");const g=cs(c),y=s?1:-1;p(n,void 0,[])();function p(S,v,k){const A=S&&typeof S=="object"?S:{};if(typeof A.type=="string"){const C=typeof A.tagName=="string"?A.tagName:typeof A.name=="string"?A.name:void 0;Object.defineProperty(R,"name",{value:"node ("+(S.type+(C?"<"+C+">":""))+")"})}return R;function R(){const C=!c||g(S,v,k[k.length-1]||void 0);let I=a0;if(h&&C&&(I=qy(h(S,k,v)),I[0]===uu))return I;if("children"in S&&S.children){const G=S;if(G.children&&I[0]!==Td){let ne=(s?-1:G.children.length)+y;const le=[...k,G];for(;ne>-1&&ne<G.children.length;){const H=G.children[ne],Z=p(H,ne,le)();if(Z[0]===uu)return Z;ne=typeof Z[1]=="number"?Z[1]:ne+y}}}if(m&&C){const G=qy(m(S,k,v));if(G[0]===Td)throw new Error("Unexpected value `"+G[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(G[0]===uu||typeof G[1]=="number")return G}return I}}}function qy(n){return Array.isArray(n)?n:typeof n=="number"?[QT,n]:n==null?a0:[n]}function ds(n,i,r,u){let s,c,d;c=i,d=r,typeof c=="function"?Ed(n,s,Cd(c),d):Ed(n,s,XT(c),d)}function XT(n){return!n||typeof n!="object"?n:{enter:typeof n.enter=="function"?Cd(n.enter):n.enter,exit:typeof n.exit=="function"?Cd(n.exit):n.exit}}function Cd(n){return i;function i(r,u,s){return n(r,s,u[u.length-1])}}const Ad={}.hasOwnProperty,ZT={};function FT(n,i){const r=i||ZT,u=new Map,s=new Map,c=new Map,d={...OT,...r.handlers},h={all:g,applyData:JT,definitionById:u,footnoteById:s,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:KT,wrap:WT};return ds(n,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const p=y.type==="definition"?u:s,S=String(y.identifier).toUpperCase();p.has(S)||p.set(S,y)}}),h;function m(y,p){const S=y.type,v=h.handlers[S];if(Ad.call(h.handlers,S)&&v)return v(h,y,p);if(h.options.passThrough&&h.options.passThrough.includes(S)){if("children"in y){const{children:A,...R}=y,C=Wo(R);return C.children=h.all(y),C}return Wo(y)}return(h.options.unknownHandler||$T)(h,y,p)}function g(y){const p=[];if("children"in y){const S=y.children;let v=-1;for(;++v<S.length;){const k=h.one(S[v],y);if(k){if(v&&S[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Hy(k.value)),!Array.isArray(k)&&k.type==="element")){const A=k.children[0];A&&A.type==="text"&&(A.value=Hy(A.value))}Array.isArray(k)?p.push(...k):p.push(k)}}}return p}}function KT(n,i){n.position&&(i.position=US(n))}function JT(n,i){let r=i;if(n&&n.data){const u=n.data.hName,s=n.data.hChildren,c=n.data.hProperties;if(typeof u=="string")if(r.type==="element")r.tagName=u;else{const d="children"in r?r.children:[r];r={type:"element",tagName:u,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,Wo(c)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function $T(n,i){const r=i.data||{},u="value"in i&&!(Ad.call(r,"hProperties")||Ad.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:n.all(i)};return n.patch(i,u),n.applyData(i,u)}function WT(n,i){const r=[];let u=-1;for(i&&r.push({type:"text",value:`
30
+ `}]}}const cs=(function(n){if(n==null)return kE;if(typeof n=="function")return fs(n);if(typeof n=="object")return Array.isArray(n)?xE(n):SE(n);if(typeof n=="string")return wE(n);throw new Error("Expected function, string, or object as test")});function xE(n){const i=[];let r=-1;for(;++r<n.length;)i[r]=cs(n[r]);return fs(u);function u(...s){let c=-1;for(;++c<i.length;)if(i[c].apply(this,s))return!0;return!1}}function SE(n){const i=n;return fs(r);function r(u){const s=u;let c;for(c in n)if(s[c]!==i[c])return!1;return!0}}function wE(n){return fs(i);function i(r){return r&&r.type===n}}function fs(n){return i;function i(r,u,s){return!!(TE(r)&&n.call(this,r,typeof u=="number"?u:void 0,s||void 0))}}function kE(){return!0}function TE(n){return n!==null&&typeof n=="object"&&"type"in n}const p0=[],EE=!0,uu=!1,Td="skip";function Ed(n,i,r,u){if(!n||typeof n!="object")throw new Error("Unexpected value `"+n+"` for `tree`, expected node");let s=!0,c,d,h,m;if(typeof r=="function"||r&&typeof r=="object"?(c=i,d=r,u&&(s=!1)):(d=i,r&&(s=!1)),typeof d=="function")h=d;else if(d&&typeof d=="object"){if(!(d.enter===null||d.enter===void 0))if(typeof d.enter=="function")h=d.enter;else throw new Error("Unexpected value `"+d.enter+"` for `visitors.enter`, expected optional visitor");if(typeof d.exit=="function")m=d.exit;else throw new Error("Unexpected value `"+d.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+d+"` for `enter` or `visitors`, expected visitor or object with visitors");const g=cs(c),y=s?1:-1;p(n,void 0,[])();function p(S,v,k){const A=S&&typeof S=="object"?S:{};if(typeof A.type=="string"){const C=typeof A.tagName=="string"?A.tagName:typeof A.name=="string"?A.name:void 0;Object.defineProperty(R,"name",{value:"node ("+(S.type+(C?"<"+C+">":""))+")"})}return R;function R(){const C=!c||g(S,v,k[k.length-1]||void 0);let I=p0;if(h&&C&&(I=Hy(h(S,k,v)),I[0]===uu))return I;if("children"in S&&S.children){const G=S;if(G.children&&I[0]!==Td){let ne=(s?-1:G.children.length)+y;const le=[...k,G];for(;ne>-1&&ne<G.children.length;){const H=G.children[ne],Z=p(H,ne,le)();if(Z[0]===uu)return Z;ne=typeof Z[1]=="number"?Z[1]:ne+y}}}if(m&&C){const G=Hy(m(S,k,v));if(G[0]===Td)throw new Error("Unexpected value `"+G[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(G[0]===uu||typeof G[1]=="number")return G}return I}}}function Hy(n){return Array.isArray(n)?n:typeof n=="number"?[EE,n]:n==null?p0:[n]}function ds(n,i,r,u){let s,c,d;c=i,d=r,typeof c=="function"?Ed(n,s,Cd(c),d):Ed(n,s,CE(c),d)}function CE(n){return!n||typeof n!="object"?n:{enter:typeof n.enter=="function"?Cd(n.enter):n.enter,exit:typeof n.exit=="function"?Cd(n.exit):n.exit}}function Cd(n){return i;function i(r,u,s){return n(r,s,u[u.length-1])}}const Ad={}.hasOwnProperty,AE={};function NE(n,i){const r=i||AE,u=new Map,s=new Map,c=new Map,d={...cE,...r.handlers},h={all:g,applyData:OE,definitionById:u,footnoteById:s,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:zE,wrap:jE};return ds(n,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const p=y.type==="definition"?u:s,S=String(y.identifier).toUpperCase();p.has(S)||p.set(S,y)}}),h;function m(y,p){const S=y.type,v=h.handlers[S];if(Ad.call(h.handlers,S)&&v)return v(h,y,p);if(h.options.passThrough&&h.options.passThrough.includes(S)){if("children"in y){const{children:A,...R}=y,C=Wo(R);return C.children=h.all(y),C}return Wo(y)}return(h.options.unknownHandler||_E)(h,y,p)}function g(y){const p=[];if("children"in y){const S=y.children;let v=-1;for(;++v<S.length;){const k=h.one(S[v],y);if(k){if(v&&S[v-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Yy(k.value)),!Array.isArray(k)&&k.type==="element")){const A=k.children[0];A&&A.type==="text"&&(A.value=Yy(A.value))}Array.isArray(k)?p.push(...k):p.push(k)}}}return p}}function zE(n,i){n.position&&(i.position=bw(n))}function OE(n,i){let r=i;if(n&&n.data){const u=n.data.hName,s=n.data.hChildren,c=n.data.hProperties;if(typeof u=="string")if(r.type==="element")r.tagName=u;else{const d="children"in r?r.children:[r];r={type:"element",tagName:u,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,Wo(c)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function _E(n,i){const r=i.data||{},u="value"in i&&!(Ad.call(r,"hProperties")||Ad.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:n.all(i)};return n.patch(i,u),n.applyData(i,u)}function jE(n,i){const r=[];let u=-1;for(i&&r.push({type:"text",value:`
22
31
  `});++u<n.length;)u&&r.push({type:"text",value:`
23
32
  `}),r.push(n[u]);return i&&n.length>0&&r.push({type:"text",value:`
24
- `}),r}function Hy(n){let i=0,r=n.charCodeAt(i);for(;r===9||r===32;)i++,r=n.charCodeAt(i);return n.slice(i)}function Yy(n,i){const r=FT(n,i),u=r.one(n,void 0),s=qT(r),c=Array.isArray(u)?{type:"root",children:u}:u||{type:"root",children:[]};return s&&c.children.push({type:"text",value:`
25
- `},s),c}function PT(n,i){return n&&"run"in n?async function(r,u){const s=Yy(r,{file:u,...i});await n.run(s,u)}:function(r,u){return Yy(r,{file:u,...n||i})}}function Iy(n){if(n)throw n}var ed,Vy;function eE(){if(Vy)return ed;Vy=1;var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s=function(g){return typeof Array.isArray=="function"?Array.isArray(g):i.call(g)==="[object Array]"},c=function(g){if(!g||i.call(g)!=="[object Object]")return!1;var y=n.call(g,"constructor"),p=g.constructor&&g.constructor.prototype&&n.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!y&&!p)return!1;var S;for(S in g);return typeof S>"u"||n.call(g,S)},d=function(g,y){r&&y.name==="__proto__"?r(g,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):g[y.name]=y.newValue},h=function(g,y){if(y==="__proto__")if(n.call(g,y)){if(u)return u(g,y).value}else return;return g[y]};return ed=function m(){var g,y,p,S,v,k,A=arguments[0],R=1,C=arguments.length,I=!1;for(typeof A=="boolean"&&(I=A,A=arguments[1]||{},R=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});R<C;++R)if(g=arguments[R],g!=null)for(y in g)p=h(A,y),S=h(g,y),A!==S&&(I&&S&&(c(S)||(v=s(S)))?(v?(v=!1,k=p&&s(p)?p:[]):k=p&&c(p)?p:{},d(A,{name:y,newValue:m(I,k,S)})):typeof S<"u"&&d(A,{name:y,newValue:S}));return A},ed}var tE=eE();const td=Bx(tE);function Nd(n){if(typeof n!="object"||n===null)return!1;const i=Object.getPrototypeOf(n);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function nE(){const n=[],i={run:r,use:u};return i;function r(...s){let c=-1;const d=s.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...s);function h(m,...g){const y=n[++c];let p=-1;if(m){d(m);return}for(;++p<s.length;)(g[p]===null||g[p]===void 0)&&(g[p]=s[p]);s=g,y?lE(y,h)(...g):d(null,...g)}}function u(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return n.push(s),i}}function lE(n,i){let r;return u;function u(...d){const h=n.length>d.length;let m;h&&d.push(s);try{m=n.apply(this,d)}catch(g){const y=g;if(h&&r)throw y;return s(y)}h||(m&&m.then&&typeof m.then=="function"?m.then(c,s):m instanceof Error?s(m):c(m))}function s(d,...h){r||(r=!0,i(d,...h))}function c(d){s(null,d)}}const vl={basename:iE,dirname:rE,extname:aE,join:uE,sep:"/"};function iE(n,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');mu(n);let r=0,u=-1,s=n.length,c;if(i===void 0||i.length===0||i.length>n.length){for(;s--;)if(n.codePointAt(s)===47){if(c){r=s+1;break}}else u<0&&(c=!0,u=s+1);return u<0?"":n.slice(r,u)}if(i===n)return"";let d=-1,h=i.length-1;for(;s--;)if(n.codePointAt(s)===47){if(c){r=s+1;break}}else d<0&&(c=!0,d=s+1),h>-1&&(n.codePointAt(s)===i.codePointAt(h--)?h<0&&(u=s):(h=-1,u=d));return r===u?u=d:u<0&&(u=n.length),n.slice(r,u)}function rE(n){if(mu(n),n.length===0)return".";let i=-1,r=n.length,u;for(;--r;)if(n.codePointAt(r)===47){if(u){i=r;break}}else u||(u=!0);return i<0?n.codePointAt(0)===47?"/":".":i===1&&n.codePointAt(0)===47?"//":n.slice(0,i)}function aE(n){mu(n);let i=n.length,r=-1,u=0,s=-1,c=0,d;for(;i--;){const h=n.codePointAt(i);if(h===47){if(d){u=i+1;break}continue}r<0&&(d=!0,r=i+1),h===46?s<0?s=i:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||r<0||c===0||c===1&&s===r-1&&s===u+1?"":n.slice(s,r)}function uE(...n){let i=-1,r;for(;++i<n.length;)mu(n[i]),n[i]&&(r=r===void 0?n[i]:r+"/"+n[i]);return r===void 0?".":oE(r)}function oE(n){mu(n);const i=n.codePointAt(0)===47;let r=sE(n,!i);return r.length===0&&!i&&(r="."),r.length>0&&n.codePointAt(n.length-1)===47&&(r+="/"),i?"/"+r:r}function sE(n,i){let r="",u=0,s=-1,c=0,d=-1,h,m;for(;++d<=n.length;){if(d<n.length)h=n.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(s===d-1||c===1))if(s!==d-1&&c===2){if(r.length<2||u!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",u=0):(r=r.slice(0,m),u=r.length-1-r.lastIndexOf("/")),s=d,c=0;continue}}else if(r.length>0){r="",u=0,s=d,c=0;continue}}i&&(r=r.length>0?r+"/..":"..",u=2)}else r.length>0?r+="/"+n.slice(s+1,d):r=n.slice(s+1,d),u=d-s-1;s=d,c=0}else h===46&&c>-1?c++:c=-1}return r}function mu(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const cE={cwd:fE};function fE(){return"/"}function zd(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function dE(n){if(typeof n=="string")n=new URL(n);else if(!zd(n)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(n.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return hE(n)}function hE(n){if(n.hostname!==""){const u=new TypeError('File URL host must be "localhost" or empty on darwin');throw u.code="ERR_INVALID_FILE_URL_HOST",u}const i=n.pathname;let r=-1;for(;++r<i.length;)if(i.codePointAt(r)===37&&i.codePointAt(r+1)===50){const u=i.codePointAt(r+2);if(u===70||u===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(i)}const nd=["history","path","basename","stem","extname","dirname"];class u0{constructor(i){let r;i?zd(i)?r={path:i}:typeof i=="string"||mE(i)?r={value:i}:r=i:r={},this.cwd="cwd"in r?"":cE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let u=-1;for(;++u<nd.length;){const c=nd[u];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let s;for(s in r)nd.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?vl.basename(this.path):void 0}set basename(i){id(i,"basename"),ld(i,"basename"),this.path=vl.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?vl.dirname(this.path):void 0}set dirname(i){Gy(this.basename,"dirname"),this.path=vl.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?vl.extname(this.path):void 0}set extname(i){if(ld(i,"extname"),Gy(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=vl.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){zd(i)&&(i=dE(i)),id(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?vl.basename(this.path,this.extname):void 0}set stem(i){id(i,"stem"),ld(i,"stem"),this.path=vl.join(this.dirname||"",i+(this.extname||""))}fail(i,r,u){const s=this.message(i,r,u);throw s.fatal=!0,s}info(i,r,u){const s=this.message(i,r,u);return s.fatal=void 0,s}message(i,r,u){const s=new as(i,r,u);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function ld(n,i){if(n&&n.includes(vl.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+vl.sep+"`")}function id(n,i){if(!n)throw new Error("`"+i+"` cannot be empty")}function Gy(n,i){if(!n)throw new Error("Setting `"+i+"` requires `path` to be set too")}function mE(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const pE=(function(n){const u=this.constructor.prototype,s=u[n],c=function(){return s.apply(c,arguments)};return Object.setPrototypeOf(c,u),c}),gE={}.hasOwnProperty;class Qd extends pE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=nE()}copy(){const i=new Qd;let r=-1;for(;++r<this.attachers.length;){const u=this.attachers[r];i.use(...u)}return i.data(td(!0,{},this.namespace)),i}data(i,r){return typeof i=="string"?arguments.length===2?(ud("data",this.frozen),this.namespace[i]=r,this):gE.call(this.namespace,i)&&this.namespace[i]||void 0:i?(ud("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...u]=this.attachers[this.freezeIndex];if(u[0]===!1)continue;u[0]===!0&&(u[0]=void 0);const s=r.call(i,...u);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const r=Go(i),u=this.parser||this.Parser;return rd("parse",u),u(String(r),r)}process(i,r){const u=this;return this.freeze(),rd("process",this.parser||this.Parser),ad("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(c,d){const h=Go(i),m=u.parse(h);u.run(m,h,function(y,p,S){if(y||!p||!S)return g(y);const v=p,k=u.stringify(v,S);vE(k)?S.value=k:S.result=k,g(y,S)});function g(y,p){y||!p?d(y):c?c(p):r(void 0,p)}}}processSync(i){let r=!1,u;return this.freeze(),rd("processSync",this.parser||this.Parser),ad("processSync",this.compiler||this.Compiler),this.process(i,s),Xy("processSync","process",r),u;function s(c,d){r=!0,Iy(c),u=d}}run(i,r,u){Qy(i),this.freeze();const s=this.transformers;return!u&&typeof r=="function"&&(u=r,r=void 0),u?c(void 0,u):new Promise(c);function c(d,h){const m=Go(r);s.run(i,m,g);function g(y,p,S){const v=p||i;y?h(y):d?d(v):u(void 0,v,S)}}}runSync(i,r){let u=!1,s;return this.run(i,r,c),Xy("runSync","run",u),s;function c(d,h){Iy(d),s=h,u=!0}}stringify(i,r){this.freeze();const u=Go(r),s=this.compiler||this.Compiler;return ad("stringify",s),Qy(i),s(i,u)}use(i,...r){const u=this.attachers,s=this.namespace;if(ud("use",this.frozen),i!=null)if(typeof i=="function")m(i,r);else if(typeof i=="object")Array.isArray(i)?h(i):d(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function c(g){if(typeof g=="function")m(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[y,...p]=g;m(y,p)}else d(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function d(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(g.plugins),g.settings&&(s.settings=td(!0,s.settings,g.settings))}function h(g){let y=-1;if(g!=null)if(Array.isArray(g))for(;++y<g.length;){const p=g[y];c(p)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function m(g,y){let p=-1,S=-1;for(;++p<u.length;)if(u[p][0]===g){S=p;break}if(S===-1)u.push([g,...y]);else if(y.length>0){let[v,...k]=y;const A=u[S][1];Nd(A)&&Nd(v)&&(v=td(!0,A,v)),u[S]=[g,v,...k]}}}}const yE=new Qd().freeze();function rd(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function ad(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function ud(n,i){if(i)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Qy(n){if(!Nd(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Xy(n,i,r){if(!r)throw new Error("`"+n+"` finished async. Use `"+i+"` instead")}function Go(n){return bE(n)?n:new u0(n)}function bE(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function vE(n){return typeof n=="string"||xE(n)}function xE(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const SE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Zy=[],Fy={allowDangerousHtml:!0},wE=/^(https?|ircs?|mailto|xmpp)$/i,kE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function TE(n){const i=EE(n),r=CE(n);return AE(i.runSync(i.parse(r),r),n)}function EE(n){const i=n.rehypePlugins||Zy,r=n.remarkPlugins||Zy,u=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...Fy}:Fy;return yE().use(iT).use(r).use(PT,u).use(i)}function CE(n){const i=n.children||"",r=new u0;return typeof i=="string"&&(r.value=i),r}function AE(n,i){const r=i.allowedElements,u=i.allowElement,s=i.components,c=i.disallowedElements,d=i.skipHtml,h=i.unwrapDisallowed,m=i.urlTransform||NE;for(const y of kE)Object.hasOwn(i,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+SE+y.id,void 0);return ds(n,g),GS(n,{Fragment:w.Fragment,components:s,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function g(y,p,S){if(y.type==="raw"&&S&&typeof p=="number")return d?S.children.splice(p,1):S.children[p]={type:"text",value:y.value},p;if(y.type==="element"){let v;for(v in $f)if(Object.hasOwn($f,v)&&Object.hasOwn(y.properties,v)){const k=y.properties[v],A=$f[v];(A===null||A.includes(y.tagName))&&(y.properties[v]=m(String(k||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):c?c.includes(y.tagName):!1;if(!v&&u&&typeof p=="number"&&(v=!u(y,p,S)),v&&S&&typeof p=="number")return h&&y.children?S.children.splice(p,1,...y.children):S.children.splice(p,1),p}}}function NE(n){const i=n.indexOf(":"),r=n.indexOf("?"),u=n.indexOf("#"),s=n.indexOf("/");return i===-1||s!==-1&&i>s||r!==-1&&i>r||u!==-1&&i>u||wE.test(n.slice(0,i))?n:""}function Ky(n,i){const r=String(n);if(typeof i!="string")throw new TypeError("Expected character");let u=0,s=r.indexOf(i);for(;s!==-1;)u++,s=r.indexOf(i,s+i.length);return u}function zE(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function OE(n,i,r){const s=cs((r||{}).ignore||[]),c=_E(i);let d=-1;for(;++d<c.length;)Ed(n,h);function h(g,y,p){if(g.type==="text"&&typeof p=="number")return m(g,y,p);if(s(g,p,y[y.length-1]))return Td}function m(g,y,p){const S=y[y.length-1],v=c[d][0],k=c[d][1];let A=0,R=!1,C=[];v.lastIndex=0;let I=v.exec(g.value);for(;I;){const ne=I.index,le={index:I.index,input:I.input,stack:[...y,g]};let H=k(...I,le);if(typeof H=="string"&&(H=H.length>0?{type:"text",value:H}:void 0),H===!1)v.lastIndex=ne+1;else{if(A!==ne&&G({type:"text",value:g.value.slice(A,ne)}),Array.isArray(H))for(const Z of H)G(Z);else H&&G(H);A=ne+I[0].length,R=!0}if(!v.global)break;I=v.exec(g.value)}return R?(A<g.value.length&&G({type:"text",value:g.value.slice(A)}),S.children.splice(p,1,...C)):C=[g],p+C.length;function G(ne){const le=C[C.length-1];le&&le.type==="text"&&ne.type==="text"?le.value+=ne.value:C.push(ne)}}}function _E(n){if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const i=[],r=!n[0]||Array.isArray(n[0])?n:[n];let u=-1;for(;++u<r.length;){const s=r[u];i.push([jE(s[0]),ME(s[1])])}return i}function jE(n){return typeof n=="string"?new RegExp(zE(n),"g"):n}function ME(n){return typeof n=="function"?n:function(){return n}}const od="phrasing",sd=["autolink","link","image","label"];function DE(){return{transforms:[YE],enter:{literalAutolink:LE,literalAutolinkEmail:cd,literalAutolinkHttp:cd,literalAutolinkWww:cd},exit:{literalAutolink:HE,literalAutolinkEmail:qE,literalAutolinkHttp:BE,literalAutolinkWww:UE}}}function RE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:od,notInConstruct:sd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:od,notInConstruct:sd},{character:":",before:"[ps]",after:"\\/",inConstruct:od,notInConstruct:sd}]}}function LE(n){this.enter({type:"link",title:null,url:"",children:[],position:void 0},n)}function cd(n){this.config.enter.autolinkProtocol.call(this,n)}function BE(n){this.config.exit.autolinkProtocol.call(this,n)}function UE(n){this.config.exit.data.call(this,n);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(n)}function qE(n){this.config.exit.autolinkEmail.call(this,n)}function HE(n){this.exit(n)}function YE(n){OE(n,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),IE],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),QE],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),GE],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),VE]],{ignore:["link","linkReference"]})}function IE(n,i,r,u,s){if(!FE(s))return!1;let c="";if(/^w/i.test(i)&&(r=i+r,i="",c="http://"),du(r.charCodeAt(0))||!XE(r))return!1;const d=ZE(r+u),h={type:"link",title:null,url:c+i+d[0],children:[{type:"text",value:i+d[0],position:void 0}],position:void 0};return d[1]?[h,{type:"text",value:d[1],position:void 0}]:h}function VE(n,i,r){return/[\d\-_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+r,children:[{type:"text",value:i+"@"+r,position:void 0}],position:void 0}}function GE(n,i,r){if(/[\d\-_]$/.test(r))return!1;const u="mailto:"+i+"@"+r;return{type:"link",title:null,url:u,children:[{type:"text",value:u,position:void 0}],position:void 0}}function QE(n,i,r,u,s){if(/[\d\-_]$/.test(r)||u&&(!/[A-Za-z]$/.test(u)||s.input.charAt(s.index+n.length)==="@"))return!1;const c="xmpp:"+i+"@"+r+(u||"");return{type:"link",title:null,url:c,children:[{type:"text",value:c,position:void 0}],position:void 0}}function XE(n){const i=n.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[\dA-Za-z]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[\dA-Za-z]/.test(i[i.length-2])))}function ZE(n){let i=n.length;for(;i>0;){const d=n.charCodeAt(i-1);if(d===33||d===34||d===38||d===39||d===41||d===44||d===46||d===58||d===59||d===60||d===62||d===63||d===93||d===125)i--;else break}if(i===n.length)return[n,void 0];let r=n.slice(i);n=n.slice(0,i);let u=r.indexOf(")");const s=Ky(n,"(");let c=Ky(n,")");for(;u!==-1&&s>c;)n+=r.slice(0,u+1),r=r.slice(u+1),u=r.indexOf(")"),c++;return[n,r]}function FE(n){const i=n.input.charCodeAt(n.index-1);return n.index===0||ir(i)||du(i)}o0.peek=l2;function KE(){this.buffer()}function JE(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function $E(){this.buffer()}function WE(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function PE(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=el(this.sliceSerialize(n)).toLowerCase(),r.label=i}function e2(n){this.exit(n)}function t2(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=el(this.sliceSerialize(n)).toLowerCase(),r.label=i}function n2(n){this.exit(n)}function l2(){return"["}function o0(n,i,r,u){const s=r.createTracker(u);let c=s.move("[^");const d=r.enter("footnoteReference"),h=r.enter("reference");return c+=s.move(r.safe(r.associationId(n),{after:"]",before:c})),h(),d(),c+=s.move("]"),c}function i2(){return{enter:{gfmFootnoteCallString:KE,gfmFootnoteCall:JE,gfmFootnoteDefinitionLabelString:$E,gfmFootnoteDefinition:WE},exit:{gfmFootnoteCallString:PE,gfmFootnoteCall:e2,gfmFootnoteDefinitionLabelString:t2,gfmFootnoteDefinition:n2}}}function r2(n){let i=!1;return n&&n.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:o0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(u,s,c,d){const h=c.createTracker(d);let m=h.move("[^");const g=c.enter("footnoteDefinition"),y=c.enter("label");return m+=h.move(c.safe(c.associationId(u),{before:m,after:"]"})),y(),m+=h.move("]:"),u.children&&u.children.length>0&&(h.shift(4),m+=h.move((i?`
26
- `:" ")+c.indentLines(c.containerFlow(u,h.current()),i?s0:a2))),g(),m}}function a2(n,i,r){return i===0?n:s0(n,i,r)}function s0(n,i,r){return(r?"":" ")+n}const u2=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Xd.attention=d2;Xd.peek=h2;function o2(){return{canContainEols:["delete"],enter:{strikethrough:c2},exit:{strikethrough:f2}}}function s2(){return{handlers:{delete:Xd},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u2}]}}function c2(n){this.enter({type:"delete",children:[],position:void 0},n)}function f2(n){this.exit(n)}function Xd(n,i,r,u){const s=r.createTracker(u),c=r.stack.includes("strikethrough")?"~":"~~",d=r.enter("strikethrough");let h=s.move(c);return h+=r.containerPhrasing(n,{...s.current(),before:h,after:"~"}),h+=s.move(c),d(),h}function d2(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function h2(){return"~"}function m2(n){return n.length}function p2(n,i){const r=i||{},u=(r.align||[]).concat(),s=r.stringLength||m2,c=[],d=[],h=[],m=[];let g=0,y=-1;for(;++y<n.length;){const A=[],R=[];let C=-1;for(n[y].length>g&&(g=n[y].length);++C<n[y].length;){const I=g2(n[y][C]);if(r.alignDelimiters!==!1){const G=s(I);R[C]=G,(m[C]===void 0||G>m[C])&&(m[C]=G)}A.push(I)}d[y]=A,h[y]=R}let p=-1;if(typeof u=="object"&&"length"in u)for(;++p<g;)c[p]=Jy(u[p]);else{const A=Jy(u);for(;++p<g;)c[p]=A}p=-1;const S=[],v=[];for(;++p<g;){const A=c[p];let R="",C="";A===99?(R=":",C=":"):A===108?R=":":A===114&&(C=":");let I=r.alignDelimiters===!1?1:Math.max(1,m[p]-R.length-C.length);const G=R+"-".repeat(I)+C;r.alignDelimiters!==!1&&(I=R.length+I+C.length,I>m[p]&&(m[p]=I),v[p]=I),S[p]=G}d.splice(1,0,S),h.splice(1,0,v),y=-1;const k=[];for(;++y<d.length;){const A=d[y],R=h[y],C=r.fillRows===!1?Math.max(1,d[y===1?0:y].length):g;p=-1;const I=[];for(;++p<C;){const G=A[p]||"";let ne="",le="";if(r.alignDelimiters!==!1){const H=m[p]-(R[p]||0),Z=c[p];if(Z===114)ne=" ".repeat(H);else if(Z===99){const K=H/2;H%2?(ne=" ".repeat(K+.5),le=" ".repeat(K-.5)):(ne=" ".repeat(K),le=ne)}else le=" ".repeat(H)}r.delimiterStart!==!1&&!p&&I.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&G==="")&&(r.delimiterStart!==!1||p)&&I.push(" "),r.alignDelimiters!==!1&&I.push(ne),I.push(G),r.alignDelimiters!==!1&&I.push(le),r.padding!==!1&&I.push(" "),(r.delimiterEnd!==!1||p!==C-1)&&I.push("|")}k.push(r.delimiterEnd===!1?I.join("").replace(/ +$/,""):I.join(""))}return k.join(`
27
- `)}function g2(n){return n==null?"":String(n)}function Jy(n){const i=typeof n=="string"?n.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}const y2=cs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function b2(n,i,r,u){const s=r.enter("blockquote"),c=r.createTracker(u);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(n,c.current()),v2);return s(),d}function v2(n,i,r){return">"+(r?"":" ")+n}function x2(n,i){return $y(n,i.inConstruct,!0)&&!$y(n,i.notInConstruct,!1)}function $y(n,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let u=-1;for(;++u<i.length;)if(n.includes(i[u]))return!0;return!1}function Wy(n,i,r,u){let s=-1;for(;++s<r.unsafe.length;){const c=r.unsafe[s];if(c.character===`
28
- `&&!c.before&&!c.after&&x2(r.stack,c))return/[\t ]/.test(u.before)?"":" "}return`\\
29
- `}function S2(n,i){const r=String(n);let u=r.indexOf(i),s=u,c=0,d=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;u!==-1;)u===s?++c>d&&(d=c):c=1,s=u+i.length,u=r.indexOf(i,s);return d}function w2(n,i){return!!(i.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function k2(n){const i=n.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function T2(n,i,r,u){const s=k2(r),c=n.value||"";if(w2(n,r)){const p=r.enter("codeIndented"),S=r.indentLines(c,E2);return p(),S}const d=r.createTracker(u),h=s.repeat(Math.max(S2(c,s)+1,3)),m=r.enter("codeFenced"),g=s==="`"?"GraveAccent":"Tilde";let y=d.move(h);if(n.lang){const p=r.enter(`codeFencedLang${g}`);y+=d.move(r.safe(n.lang,{before:y,after:" ",encode:["`"],...d.current()})),p()}if(n.lang&&n.meta){const p=r.enter(`codeFencedMeta${g}`);y+=d.move(" "),y+=d.move(r.safe(n.meta,{before:y,after:`
33
+ `}),r}function Yy(n){let i=0,r=n.charCodeAt(i);for(;r===9||r===32;)i++,r=n.charCodeAt(i);return n.slice(i)}function Iy(n,i){const r=NE(n,i),u=r.one(n,void 0),s=vE(r),c=Array.isArray(u)?{type:"root",children:u}:u||{type:"root",children:[]};return s&&c.children.push({type:"text",value:`
34
+ `},s),c}function ME(n,i){return n&&"run"in n?async function(r,u){const s=Iy(r,{file:u,...i});await n.run(s,u)}:function(r,u){return Iy(r,{file:u,...n||i})}}function Vy(n){if(n)throw n}var td,Gy;function DE(){if(Gy)return td;Gy=1;var n=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s=function(g){return typeof Array.isArray=="function"?Array.isArray(g):i.call(g)==="[object Array]"},c=function(g){if(!g||i.call(g)!=="[object Object]")return!1;var y=n.call(g,"constructor"),p=g.constructor&&g.constructor.prototype&&n.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!y&&!p)return!1;var S;for(S in g);return typeof S>"u"||n.call(g,S)},d=function(g,y){r&&y.name==="__proto__"?r(g,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):g[y.name]=y.newValue},h=function(g,y){if(y==="__proto__")if(n.call(g,y)){if(u)return u(g,y).value}else return;return g[y]};return td=function m(){var g,y,p,S,v,k,A=arguments[0],R=1,C=arguments.length,I=!1;for(typeof A=="boolean"&&(I=A,A=arguments[1]||{},R=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});R<C;++R)if(g=arguments[R],g!=null)for(y in g)p=h(A,y),S=h(g,y),A!==S&&(I&&S&&(c(S)||(v=s(S)))?(v?(v=!1,k=p&&s(p)?p:[]):k=p&&c(p)?p:{},d(A,{name:y,newValue:m(I,k,S)})):typeof S<"u"&&d(A,{name:y,newValue:S}));return A},td}var RE=DE();const nd=Bx(RE);function Nd(n){if(typeof n!="object"||n===null)return!1;const i=Object.getPrototypeOf(n);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function LE(){const n=[],i={run:r,use:u};return i;function r(...s){let c=-1;const d=s.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...s);function h(m,...g){const y=n[++c];let p=-1;if(m){d(m);return}for(;++p<s.length;)(g[p]===null||g[p]===void 0)&&(g[p]=s[p]);s=g,y?BE(y,h)(...g):d(null,...g)}}function u(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return n.push(s),i}}function BE(n,i){let r;return u;function u(...d){const h=n.length>d.length;let m;h&&d.push(s);try{m=n.apply(this,d)}catch(g){const y=g;if(h&&r)throw y;return s(y)}h||(m&&m.then&&typeof m.then=="function"?m.then(c,s):m instanceof Error?s(m):c(m))}function s(d,...h){r||(r=!0,i(d,...h))}function c(d){s(null,d)}}const vl={basename:UE,dirname:qE,extname:HE,join:YE,sep:"/"};function UE(n,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');mu(n);let r=0,u=-1,s=n.length,c;if(i===void 0||i.length===0||i.length>n.length){for(;s--;)if(n.codePointAt(s)===47){if(c){r=s+1;break}}else u<0&&(c=!0,u=s+1);return u<0?"":n.slice(r,u)}if(i===n)return"";let d=-1,h=i.length-1;for(;s--;)if(n.codePointAt(s)===47){if(c){r=s+1;break}}else d<0&&(c=!0,d=s+1),h>-1&&(n.codePointAt(s)===i.codePointAt(h--)?h<0&&(u=s):(h=-1,u=d));return r===u?u=d:u<0&&(u=n.length),n.slice(r,u)}function qE(n){if(mu(n),n.length===0)return".";let i=-1,r=n.length,u;for(;--r;)if(n.codePointAt(r)===47){if(u){i=r;break}}else u||(u=!0);return i<0?n.codePointAt(0)===47?"/":".":i===1&&n.codePointAt(0)===47?"//":n.slice(0,i)}function HE(n){mu(n);let i=n.length,r=-1,u=0,s=-1,c=0,d;for(;i--;){const h=n.codePointAt(i);if(h===47){if(d){u=i+1;break}continue}r<0&&(d=!0,r=i+1),h===46?s<0?s=i:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||r<0||c===0||c===1&&s===r-1&&s===u+1?"":n.slice(s,r)}function YE(...n){let i=-1,r;for(;++i<n.length;)mu(n[i]),n[i]&&(r=r===void 0?n[i]:r+"/"+n[i]);return r===void 0?".":IE(r)}function IE(n){mu(n);const i=n.codePointAt(0)===47;let r=VE(n,!i);return r.length===0&&!i&&(r="."),r.length>0&&n.codePointAt(n.length-1)===47&&(r+="/"),i?"/"+r:r}function VE(n,i){let r="",u=0,s=-1,c=0,d=-1,h,m;for(;++d<=n.length;){if(d<n.length)h=n.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(s===d-1||c===1))if(s!==d-1&&c===2){if(r.length<2||u!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",u=0):(r=r.slice(0,m),u=r.length-1-r.lastIndexOf("/")),s=d,c=0;continue}}else if(r.length>0){r="",u=0,s=d,c=0;continue}}i&&(r=r.length>0?r+"/..":"..",u=2)}else r.length>0?r+="/"+n.slice(s+1,d):r=n.slice(s+1,d),u=d-s-1;s=d,c=0}else h===46&&c>-1?c++:c=-1}return r}function mu(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const GE={cwd:QE};function QE(){return"/"}function zd(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function XE(n){if(typeof n=="string")n=new URL(n);else if(!zd(n)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(n.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return ZE(n)}function ZE(n){if(n.hostname!==""){const u=new TypeError('File URL host must be "localhost" or empty on darwin');throw u.code="ERR_INVALID_FILE_URL_HOST",u}const i=n.pathname;let r=-1;for(;++r<i.length;)if(i.codePointAt(r)===37&&i.codePointAt(r+1)===50){const u=i.codePointAt(r+2);if(u===70||u===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(i)}const ld=["history","path","basename","stem","extname","dirname"];class g0{constructor(i){let r;i?zd(i)?r={path:i}:typeof i=="string"||FE(i)?r={value:i}:r=i:r={},this.cwd="cwd"in r?"":GE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let u=-1;for(;++u<ld.length;){const c=ld[u];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let s;for(s in r)ld.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?vl.basename(this.path):void 0}set basename(i){rd(i,"basename"),id(i,"basename"),this.path=vl.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?vl.dirname(this.path):void 0}set dirname(i){Qy(this.basename,"dirname"),this.path=vl.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?vl.extname(this.path):void 0}set extname(i){if(id(i,"extname"),Qy(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=vl.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){zd(i)&&(i=XE(i)),rd(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?vl.basename(this.path,this.extname):void 0}set stem(i){rd(i,"stem"),id(i,"stem"),this.path=vl.join(this.dirname||"",i+(this.extname||""))}fail(i,r,u){const s=this.message(i,r,u);throw s.fatal=!0,s}info(i,r,u){const s=this.message(i,r,u);return s.fatal=void 0,s}message(i,r,u){const s=new as(i,r,u);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function id(n,i){if(n&&n.includes(vl.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+vl.sep+"`")}function rd(n,i){if(!n)throw new Error("`"+i+"` cannot be empty")}function Qy(n,i){if(!n)throw new Error("Setting `"+i+"` requires `path` to be set too")}function FE(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const KE=(function(n){const u=this.constructor.prototype,s=u[n],c=function(){return s.apply(c,arguments)};return Object.setPrototypeOf(c,u),c}),JE={}.hasOwnProperty;class Zd extends KE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=LE()}copy(){const i=new Zd;let r=-1;for(;++r<this.attachers.length;){const u=this.attachers[r];i.use(...u)}return i.data(nd(!0,{},this.namespace)),i}data(i,r){return typeof i=="string"?arguments.length===2?(od("data",this.frozen),this.namespace[i]=r,this):JE.call(this.namespace,i)&&this.namespace[i]||void 0:i?(od("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...u]=this.attachers[this.freezeIndex];if(u[0]===!1)continue;u[0]===!0&&(u[0]=void 0);const s=r.call(i,...u);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const r=Go(i),u=this.parser||this.Parser;return ad("parse",u),u(String(r),r)}process(i,r){const u=this;return this.freeze(),ad("process",this.parser||this.Parser),ud("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(c,d){const h=Go(i),m=u.parse(h);u.run(m,h,function(y,p,S){if(y||!p||!S)return g(y);const v=p,k=u.stringify(v,S);PE(k)?S.value=k:S.result=k,g(y,S)});function g(y,p){y||!p?d(y):c?c(p):r(void 0,p)}}}processSync(i){let r=!1,u;return this.freeze(),ad("processSync",this.parser||this.Parser),ud("processSync",this.compiler||this.Compiler),this.process(i,s),Zy("processSync","process",r),u;function s(c,d){r=!0,Vy(c),u=d}}run(i,r,u){Xy(i),this.freeze();const s=this.transformers;return!u&&typeof r=="function"&&(u=r,r=void 0),u?c(void 0,u):new Promise(c);function c(d,h){const m=Go(r);s.run(i,m,g);function g(y,p,S){const v=p||i;y?h(y):d?d(v):u(void 0,v,S)}}}runSync(i,r){let u=!1,s;return this.run(i,r,c),Zy("runSync","run",u),s;function c(d,h){Vy(d),s=h,u=!0}}stringify(i,r){this.freeze();const u=Go(r),s=this.compiler||this.Compiler;return ud("stringify",s),Xy(i),s(i,u)}use(i,...r){const u=this.attachers,s=this.namespace;if(od("use",this.frozen),i!=null)if(typeof i=="function")m(i,r);else if(typeof i=="object")Array.isArray(i)?h(i):d(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function c(g){if(typeof g=="function")m(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[y,...p]=g;m(y,p)}else d(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function d(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(g.plugins),g.settings&&(s.settings=nd(!0,s.settings,g.settings))}function h(g){let y=-1;if(g!=null)if(Array.isArray(g))for(;++y<g.length;){const p=g[y];c(p)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function m(g,y){let p=-1,S=-1;for(;++p<u.length;)if(u[p][0]===g){S=p;break}if(S===-1)u.push([g,...y]);else if(y.length>0){let[v,...k]=y;const A=u[S][1];Nd(A)&&Nd(v)&&(v=nd(!0,A,v)),u[S]=[g,v,...k]}}}}const $E=new Zd().freeze();function ad(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function ud(n,i){if(typeof i!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function od(n,i){if(i)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Xy(n){if(!Nd(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Zy(n,i,r){if(!r)throw new Error("`"+n+"` finished async. Use `"+i+"` instead")}function Go(n){return WE(n)?n:new g0(n)}function WE(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function PE(n){return typeof n=="string"||e2(n)}function e2(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const t2="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fy=[],Ky={allowDangerousHtml:!0},n2=/^(https?|ircs?|mailto|xmpp)$/i,l2=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function i2(n){const i=r2(n),r=a2(n);return u2(i.runSync(i.parse(r),r),n)}function r2(n){const i=n.rehypePlugins||Fy,r=n.remarkPlugins||Fy,u=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...Ky}:Ky;return $E().use(UT).use(r).use(ME,u).use(i)}function a2(n){const i=n.children||"",r=new g0;return typeof i=="string"&&(r.value=i),r}function u2(n,i){const r=i.allowedElements,u=i.allowElement,s=i.components,c=i.disallowedElements,d=i.skipHtml,h=i.unwrapDisallowed,m=i.urlTransform||o2;for(const y of l2)Object.hasOwn(i,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+t2+y.id,void 0);return ds(n,g),Tw(n,{Fragment:w.Fragment,components:s,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function g(y,p,S){if(y.type==="raw"&&S&&typeof p=="number")return d?S.children.splice(p,1):S.children[p]={type:"text",value:y.value},p;if(y.type==="element"){let v;for(v in Wf)if(Object.hasOwn(Wf,v)&&Object.hasOwn(y.properties,v)){const k=y.properties[v],A=Wf[v];(A===null||A.includes(y.tagName))&&(y.properties[v]=m(String(k||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):c?c.includes(y.tagName):!1;if(!v&&u&&typeof p=="number"&&(v=!u(y,p,S)),v&&S&&typeof p=="number")return h&&y.children?S.children.splice(p,1,...y.children):S.children.splice(p,1),p}}}function o2(n){const i=n.indexOf(":"),r=n.indexOf("?"),u=n.indexOf("#"),s=n.indexOf("/");return i===-1||s!==-1&&i>s||r!==-1&&i>r||u!==-1&&i>u||n2.test(n.slice(0,i))?n:""}function Jy(n,i){const r=String(n);if(typeof i!="string")throw new TypeError("Expected character");let u=0,s=r.indexOf(i);for(;s!==-1;)u++,s=r.indexOf(i,s+i.length);return u}function s2(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function c2(n,i,r){const s=cs((r||{}).ignore||[]),c=f2(i);let d=-1;for(;++d<c.length;)Ed(n,h);function h(g,y,p){if(g.type==="text"&&typeof p=="number")return m(g,y,p);if(s(g,p,y[y.length-1]))return Td}function m(g,y,p){const S=y[y.length-1],v=c[d][0],k=c[d][1];let A=0,R=!1,C=[];v.lastIndex=0;let I=v.exec(g.value);for(;I;){const ne=I.index,le={index:I.index,input:I.input,stack:[...y,g]};let H=k(...I,le);if(typeof H=="string"&&(H=H.length>0?{type:"text",value:H}:void 0),H===!1)v.lastIndex=ne+1;else{if(A!==ne&&G({type:"text",value:g.value.slice(A,ne)}),Array.isArray(H))for(const Z of H)G(Z);else H&&G(H);A=ne+I[0].length,R=!0}if(!v.global)break;I=v.exec(g.value)}return R?(A<g.value.length&&G({type:"text",value:g.value.slice(A)}),S.children.splice(p,1,...C)):C=[g],p+C.length;function G(ne){const le=C[C.length-1];le&&le.type==="text"&&ne.type==="text"?le.value+=ne.value:C.push(ne)}}}function f2(n){if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const i=[],r=!n[0]||Array.isArray(n[0])?n:[n];let u=-1;for(;++u<r.length;){const s=r[u];i.push([d2(s[0]),h2(s[1])])}return i}function d2(n){return typeof n=="string"?new RegExp(s2(n),"g"):n}function h2(n){return typeof n=="function"?n:function(){return n}}const sd="phrasing",cd=["autolink","link","image","label"];function m2(){return{transforms:[S2],enter:{literalAutolink:g2,literalAutolinkEmail:fd,literalAutolinkHttp:fd,literalAutolinkWww:fd},exit:{literalAutolink:x2,literalAutolinkEmail:v2,literalAutolinkHttp:y2,literalAutolinkWww:b2}}}function p2(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sd,notInConstruct:cd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sd,notInConstruct:cd},{character:":",before:"[ps]",after:"\\/",inConstruct:sd,notInConstruct:cd}]}}function g2(n){this.enter({type:"link",title:null,url:"",children:[],position:void 0},n)}function fd(n){this.config.enter.autolinkProtocol.call(this,n)}function y2(n){this.config.exit.autolinkProtocol.call(this,n)}function b2(n){this.config.exit.data.call(this,n);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(n)}function v2(n){this.config.exit.autolinkEmail.call(this,n)}function x2(n){this.exit(n)}function S2(n){c2(n,[[new RegExp("(?<![\\da-z])(https?:\\/\\/|www(?=\\.))([\\w-]*\\.[\\w\\-.]*)([^\\t\\n\\r ]*)","gi"),w2],[new RegExp("(?<![\\w+\\-.@])xmpp:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)(\\/(?:[\\w\\-/]|\\.(?=[\\dA-Za-z]))*)?","g"),E2],[new RegExp("(?<![\\w+\\-.@])mailto:([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),T2],[new RegExp("(?<![\\w+\\-.]|(?:^|[^\\d@A-Za-z])(?:mailto|xmpp):)([\\w+\\-.]+)@([\\w-]+(?:\\.[\\w-]+)+)","g"),k2]],{ignore:["link","linkReference"]})}function w2(n,i,r,u,s){if(!N2(s))return!1;let c="";if(/^w/i.test(i)&&(r=i+r,i="",c="http://"),du(r.charCodeAt(0))||!C2(r))return!1;const d=A2(r+u),h={type:"link",title:null,url:c+i+d[0],children:[{type:"text",value:i+d[0],position:void 0}],position:void 0};return d[1]?[h,{type:"text",value:d[1],position:void 0}]:h}function k2(n,i,r){return/[\d\-_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+r,children:[{type:"text",value:i+"@"+r,position:void 0}],position:void 0}}function T2(n,i,r){if(/[\d\-_]$/.test(r))return!1;const u="mailto:"+i+"@"+r;return{type:"link",title:null,url:u,children:[{type:"text",value:u,position:void 0}],position:void 0}}function E2(n,i,r,u,s){if(/[\d\-_]$/.test(r)||u&&(!/[A-Za-z]$/.test(u)||s.input.charAt(s.index+n.length)==="@"))return!1;const c="xmpp:"+i+"@"+r+(u||"");return{type:"link",title:null,url:c,children:[{type:"text",value:c,position:void 0}],position:void 0}}function C2(n){const i=n.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[\dA-Za-z]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[\dA-Za-z]/.test(i[i.length-2])))}function A2(n){let i=n.length;for(;i>0;){const d=n.charCodeAt(i-1);if(d===33||d===34||d===38||d===39||d===41||d===44||d===46||d===58||d===59||d===60||d===62||d===63||d===93||d===125)i--;else break}if(i===n.length)return[n,void 0];let r=n.slice(i);n=n.slice(0,i);let u=r.indexOf(")");const s=Jy(n,"(");let c=Jy(n,")");for(;u!==-1&&s>c;)n+=r.slice(0,u+1),r=r.slice(u+1),u=r.indexOf(")"),c++;return[n,r]}function N2(n){const i=n.input.charCodeAt(n.index-1);return n.index===0||ir(i)||du(i)}y0.peek=B2;function z2(){this.buffer()}function O2(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function _2(){this.buffer()}function j2(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function M2(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=el(this.sliceSerialize(n)).toLowerCase(),r.label=i}function D2(n){this.exit(n)}function R2(n){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=el(this.sliceSerialize(n)).toLowerCase(),r.label=i}function L2(n){this.exit(n)}function B2(){return"["}function y0(n,i,r,u){const s=r.createTracker(u);let c=s.move("[^");const d=r.enter("footnoteReference"),h=r.enter("reference");return c+=s.move(r.safe(r.associationId(n),{after:"]",before:c})),h(),d(),c+=s.move("]"),c}function U2(){return{enter:{gfmFootnoteCallString:z2,gfmFootnoteCall:O2,gfmFootnoteDefinitionLabelString:_2,gfmFootnoteDefinition:j2},exit:{gfmFootnoteCallString:M2,gfmFootnoteCall:D2,gfmFootnoteDefinitionLabelString:R2,gfmFootnoteDefinition:L2}}}function q2(n){let i=!1;return n&&n.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:y0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(u,s,c,d){const h=c.createTracker(d);let m=h.move("[^");const g=c.enter("footnoteDefinition"),y=c.enter("label");return m+=h.move(c.safe(c.associationId(u),{before:m,after:"]"})),y(),m+=h.move("]:"),u.children&&u.children.length>0&&(h.shift(4),m+=h.move((i?`
35
+ `:" ")+c.indentLines(c.containerFlow(u,h.current()),i?b0:H2))),g(),m}}function H2(n,i,r){return i===0?n:b0(n,i,r)}function b0(n,i,r){return(r?"":" ")+n}const Y2=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fd.attention=X2;Fd.peek=Z2;function I2(){return{canContainEols:["delete"],enter:{strikethrough:G2},exit:{strikethrough:Q2}}}function V2(){return{handlers:{delete:Fd},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Y2}]}}function G2(n){this.enter({type:"delete",children:[],position:void 0},n)}function Q2(n){this.exit(n)}function Fd(n,i,r,u){const s=r.createTracker(u),c=r.stack.includes("strikethrough")?"~":"~~",d=r.enter("strikethrough");let h=s.move(c);return h+=r.containerPhrasing(n,{...s.current(),before:h,after:"~"}),h+=s.move(c),d(),h}function X2(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function Z2(){return"~"}function F2(n){return n.length}function K2(n,i){const r=i||{},u=(r.align||[]).concat(),s=r.stringLength||F2,c=[],d=[],h=[],m=[];let g=0,y=-1;for(;++y<n.length;){const A=[],R=[];let C=-1;for(n[y].length>g&&(g=n[y].length);++C<n[y].length;){const I=J2(n[y][C]);if(r.alignDelimiters!==!1){const G=s(I);R[C]=G,(m[C]===void 0||G>m[C])&&(m[C]=G)}A.push(I)}d[y]=A,h[y]=R}let p=-1;if(typeof u=="object"&&"length"in u)for(;++p<g;)c[p]=$y(u[p]);else{const A=$y(u);for(;++p<g;)c[p]=A}p=-1;const S=[],v=[];for(;++p<g;){const A=c[p];let R="",C="";A===99?(R=":",C=":"):A===108?R=":":A===114&&(C=":");let I=r.alignDelimiters===!1?1:Math.max(1,m[p]-R.length-C.length);const G=R+"-".repeat(I)+C;r.alignDelimiters!==!1&&(I=R.length+I+C.length,I>m[p]&&(m[p]=I),v[p]=I),S[p]=G}d.splice(1,0,S),h.splice(1,0,v),y=-1;const k=[];for(;++y<d.length;){const A=d[y],R=h[y],C=r.fillRows===!1?Math.max(1,d[y===1?0:y].length):g;p=-1;const I=[];for(;++p<C;){const G=A[p]||"";let ne="",le="";if(r.alignDelimiters!==!1){const H=m[p]-(R[p]||0),Z=c[p];if(Z===114)ne=" ".repeat(H);else if(Z===99){const K=H/2;H%2?(ne=" ".repeat(K+.5),le=" ".repeat(K-.5)):(ne=" ".repeat(K),le=ne)}else le=" ".repeat(H)}r.delimiterStart!==!1&&!p&&I.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&G==="")&&(r.delimiterStart!==!1||p)&&I.push(" "),r.alignDelimiters!==!1&&I.push(ne),I.push(G),r.alignDelimiters!==!1&&I.push(le),r.padding!==!1&&I.push(" "),(r.delimiterEnd!==!1||p!==C-1)&&I.push("|")}k.push(r.delimiterEnd===!1?I.join("").replace(/ +$/,""):I.join(""))}return k.join(`
36
+ `)}function J2(n){return n==null?"":String(n)}function $y(n){const i=typeof n=="string"?n.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}const $2=cs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function W2(n,i,r,u){const s=r.enter("blockquote"),c=r.createTracker(u);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(n,c.current()),P2);return s(),d}function P2(n,i,r){return">"+(r?"":" ")+n}function eC(n,i){return Wy(n,i.inConstruct,!0)&&!Wy(n,i.notInConstruct,!1)}function Wy(n,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let u=-1;for(;++u<i.length;)if(n.includes(i[u]))return!0;return!1}function Py(n,i,r,u){let s=-1;for(;++s<r.unsafe.length;){const c=r.unsafe[s];if(c.character===`
37
+ `&&!c.before&&!c.after&&eC(r.stack,c))return/[\t ]/.test(u.before)?"":" "}return`\\
38
+ `}function tC(n,i){const r=String(n);let u=r.indexOf(i),s=u,c=0,d=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;u!==-1;)u===s?++c>d&&(d=c):c=1,s=u+i.length,u=r.indexOf(i,s);return d}function nC(n,i){return!!(i.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function lC(n){const i=n.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function iC(n,i,r,u){const s=lC(r),c=n.value||"";if(nC(n,r)){const p=r.enter("codeIndented"),S=r.indentLines(c,rC);return p(),S}const d=r.createTracker(u),h=s.repeat(Math.max(tC(c,s)+1,3)),m=r.enter("codeFenced"),g=s==="`"?"GraveAccent":"Tilde";let y=d.move(h);if(n.lang){const p=r.enter(`codeFencedLang${g}`);y+=d.move(r.safe(n.lang,{before:y,after:" ",encode:["`"],...d.current()})),p()}if(n.lang&&n.meta){const p=r.enter(`codeFencedMeta${g}`);y+=d.move(" "),y+=d.move(r.safe(n.meta,{before:y,after:`
30
39
  `,encode:["`"],...d.current()})),p()}return y+=d.move(`
31
40
  `),c&&(y+=d.move(c+`
32
- `)),y+=d.move(h),m(),y}function E2(n,i,r){return(r?"":" ")+n}function Zd(n){const i=n.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function C2(n,i,r,u){const s=Zd(r),c=s==='"'?"Quote":"Apostrophe",d=r.enter("definition");let h=r.enter("label");const m=r.createTracker(u);let g=m.move("[");return g+=m.move(r.safe(r.associationId(n),{before:g,after:"]",...m.current()})),g+=m.move("]: "),h(),!n.url||/[\0- \u007F]/.test(n.url)?(h=r.enter("destinationLiteral"),g+=m.move("<"),g+=m.move(r.safe(n.url,{before:g,after:">",...m.current()})),g+=m.move(">")):(h=r.enter("destinationRaw"),g+=m.move(r.safe(n.url,{before:g,after:n.title?" ":`
33
- `,...m.current()}))),h(),n.title&&(h=r.enter(`title${c}`),g+=m.move(" "+s),g+=m.move(r.safe(n.title,{before:g,after:s,...m.current()})),g+=m.move(s),h()),d(),g}function A2(n){const i=n.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function Po(n){const i=n.codePointAt(0);return i===void 0?"":String.fromCodePoint(i)}function Kr(n){const i=n.codePointAt(n.length-2);return i!==void 0&&i>65535?n.slice(-2):n.slice(-1)}function c0(n){return"&#x"+n.toString(16).toUpperCase()+";"}function Py(n,i,r){const u=Ti(n),s=Ti(i);return u===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:u===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function N2(n){if(n.charCodeAt(0)!==60)return;const i=n.charCodeAt(1);if(i===33){const h=n.charCodeAt(2);return h===45?2:h===91?5:Kt(h)?4:void 0}if(i===63)return 3;const r=i===47,u=r?2:1;let s=u,c=n.charCodeAt(s);if(!Kt(c))return;for(;c===45||Jt(c);)c=n.charCodeAt(++s);const d=n.slice(u,s).toLowerCase();return!r&&c!==47&&kd.includes(d)?1:K1.includes(d)?6:7}const f0=new Map([["*",!1],["_",!0]]);function z2(n,i,r){const u=new Set;for(const c of n){const d=r.get(c);if(d&&c.attention&&i.some(h=>h.attention===c.attention))for(const h of d.tokens)u.add(h.attention)}const s=[];for(const c of n)c.attention&&u.delete(c.attention)&&s.push(c.attention);return s.reverse(),s}function d0(n,i,r){const u=[],s=new Map,c=new Map;let d=0;for(;d<n.length;){if(!n[d].attention){d++;continue}const h=n[d].value.charAt(0),m=f0.get(h);let g=d+1;for(;g<n.length&&n[g].attention&&n[g].value.charAt(0)===h;)g++;const y=d?n[d-1].value:i,p=Ti(y.charCodeAt(y.length-1)),S=Ti((g<n.length?n[g].value:r).charCodeAt(0)),v=!S||S===2&&!!p,k=!p||p===2&&!!S,A={tokens:n.slice(d,g),markers:[],start:0,end:0,open:m?v&&(!!p||!k):v,close:m?k&&(!!S||!v):k,split:m!==void 0};for(const R of A.tokens){s.set(R,[...A.tokens]),c.set(R,A);let C=R.value.length;for(;C--;)A.markers.push(R)}A.end=A.markers.length,u.push(A),d=g}for(_2(u,s),d=-1;++d<n.length;){const h=s.get(n[d]);if(h)return{attention:z2(n,h,c),index:d}}}function Qo(n,i){const r=n[i?0:n.length-1];if(!r||r.attention)return;const u=i?Po(r.value):Kr(r.value),s=c0(u.codePointAt(0));if(i)r.value=s+r.value.slice(u.length);else{let c=r.value.slice(0,r.value.length-u.length),d=0;for(;c.charCodeAt(c.length-1-d)===92;)d++;d%2&&(c+="\\"),r.value=c+s}}function O2(n,i,r,u,s){for(const c of r.attention){const d=i.get(c)||c.sequences[0];for(const h of c.sequences){if(h===d)continue;const m=new Map(i);m.set(c,h);const g=hs(n,m,u,s),y=d0(g,u,s);if(!y||y.index>r.index)return{chosen:m,mistake:y,tokens:g}}}}function _2(n,i){const r=new Map;for(const u of n){const s=u.tokens[0].value.charAt(0);let c=r.get(s);c||(c=[],r.set(s,c));let d=u.close?c.length:0;for(;d--&&u.start<u.end;){const h=c[d],m=h.end-h.start,g=u.end-u.start;if(u.split?(h.close||u.open)&&g%3&&!((m+g)%3):m!==h.markers.length||m!==g)continue;const y=u.split?m>1&&g>1?2:1:g,p=h.markers.slice(h.end-y,h.end),S=u.markers.slice(u.start,u.start+y),v=p[0],k=S[0];if(v===p[y-1]&&v.value.length===y&&k===S[y-1]&&k.value.length===y&&v.attention===k.attention)i.delete(v),i.delete(k);else{const A=[...new Set([...p,...S])];for(const R of A){const C=i.get(R);C&&C.push(...A)}}h.end-=y,u.start+=y,h.start===h.end&&c.splice(d,1),d=c.length}u.open&&u.start<u.end&&c.push(u)}}function j2(n,i,r){if(i.length===0)throw new Error("Cannot serialize `"+n+"` as attention without markers, expected one or more markers");if(r.length===0)throw new Error("Cannot serialize `"+n+"` as attention without sizes, expected one or more sizes");for(const s of r)if(!Number.isSafeInteger(s)||s<1)throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as size, expected positive integer");const u=[];for(const s of i){if(s.length!==1)throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as marker, expected a single ascii character");if(!H1(s.charCodeAt(0)))throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as marker, expected ascii punctuation");for(const c of r)u.push(s.repeat(c))}return u}function M2(n,i,r){const u=i.indexStack,s=n.children||[],c=[];let d=-1,h=r.before;u.push(-1);let m=i.createTracker(r);for(;++d<s.length;){const g=s[d];let y;if(u[u.length-1]=d,d+1<s.length){let v=i.handle.handlers[s[d+1].type];v&&v.peek&&(v=v.peek),y=v?Po(v(s[d+1],n,i,{before:"",after:"",...m.current()})):""}else y=r.after;const p=c[c.length-1];typeof p=="string"&&(h==="\r"||h===`
34
- `)&&g.type==="html"&&N2(g.value)!==7&&(c[c.length-1]=p.replace(/(\r?\n|\r)$/," "),h=" ",m=i.createTracker(r),m.move(ms(c,r.before,r.after)));const S=i.handle.handlers[g.type];if(S&&S.attention){const v=Fd(g,S.attention,i,m);if(!v)continue;c.push(v),h=Kr(v.sequences[0])}else{const v=i.handle(g,n,i,{...m.current(),after:y,before:h});if(!v)continue;m.move(v),c.push(v),h=Kr(v)}}return u.pop(),c}function Fd(n,i,r,u){const{construct:s,markers:c,sizes:d}=i(n,r),h=j2(n.type,c,d),m=h[0],g=r.enter(s),y=r.createTracker(u.current());y.move(m);const p=M2(n,r,{...y.current(),before:m,after:m});if(g(),p.length!==0)return u.move(m),u.move(ms(p,m,m)),u.move(m),{children:p,sequences:h}}function e1(n,i,r,u){let s=hs(n,i,r,u),c=d0(s,r,u);for(;c;){const d=O2(n,i,c,r,u);if(!d)return;i=d.chosen,s=d.tokens,c=d.mistake}return s}function h0(n,i,r,u){let s=r,c=-1;for(;++c<n.length;){const d=n[c];if(typeof d=="string"){s="";continue}const h=c===n.length-1?u:"",m=d.sequences.find(function(g){const y=g.charAt(0);return y!==s.charAt(0)&&y!==h.charAt(0)||n.length===1&&f0.has(y)&&g.length>r.length})||d.sequences[0];m!==d.sequences[0]&&i.set(d,m),h0(d.children,i,m,m),s=m}}function hs(n,i,r,u){const s=[];let c,d=Kr(r),h=-1;for(;++h<n.length;){const m=n[h];if(typeof m=="string"){const G={value:m,attention:void 0};c&&c===Po(m)&&Qo([G],!0),c=void 0,s.push(G),G.value&&(d=Kr(G.value));continue}const g=i.get(m)||m.sequences[0],y=g.charAt(0),p=n[h+1],S=d,v=Po(p===void 0?u:typeof p=="string"?p:i.get(p)||p.sequences[0]),k=hs(m.children,i,g,g),A=k[0].value,R=Py(S.charCodeAt(S.length-1),A.charCodeAt(0),y);R.inside&&Qo(k,!0);const C=Kr(k[k.length-1].value),I=Py(v.charCodeAt(0),C.charCodeAt(C.length-1),y);I.inside&&Qo(k,!1),R.outside&&S!==`
35
- `&&S!=="\r"&&Qo(s,!1),I.outside&&(c=v),s.push({value:g,attention:m},...k,{value:g,attention:m}),d=g.charAt(g.length-1)}return s}function ms(n,i,r){const u=new Map;h0(n,u,i,r);const s=(u.size>0?e1(n,u,i,r):void 0)||e1(n,new Map,i,r)||hs(n,new Map,i,r);let c="";for(const d of s)c+=d.value;return c}Kd.attention=m0;Kd.peek=D2;function Kd(n,i,r,u){const s=r.enter("phrasing"),c=Fd(n,m0,r,r.createTracker(u)),d=c?ms([c],u.before,u.after):"";return s(),d}function m0(n,i){return{construct:"emphasis",markers:A2(i)==="*"?["*","_"]:["_","*"],sizes:[1]}}function D2(n,i,r){return r.options.emphasis||"*"}function R2(n,i){let r=!1;return ds(n,function(u){if("value"in u&&/\r?\n|\r/.test(u.value)||u.type==="break")return r=!0,uu}),!!((!n.depth||n.depth<3)&&us(n)&&(i.options.setext||r))}function L2(n,i,r,u){const s=Math.max(Math.min(6,n.depth||1),1),c=r.createTracker(u);if(R2(n,r)){const p=r.enter("headingSetext"),S=r.enter("phrasing"),v=r.containerPhrasing(n,{...c.current(),before:`
41
+ `)),y+=d.move(h),m(),y}function rC(n,i,r){return(r?"":" ")+n}function Kd(n){const i=n.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function aC(n,i,r,u){const s=Kd(r),c=s==='"'?"Quote":"Apostrophe",d=r.enter("definition");let h=r.enter("label");const m=r.createTracker(u);let g=m.move("[");return g+=m.move(r.safe(r.associationId(n),{before:g,after:"]",...m.current()})),g+=m.move("]: "),h(),!n.url||/[\0- \u007F]/.test(n.url)?(h=r.enter("destinationLiteral"),g+=m.move("<"),g+=m.move(r.safe(n.url,{before:g,after:">",...m.current()})),g+=m.move(">")):(h=r.enter("destinationRaw"),g+=m.move(r.safe(n.url,{before:g,after:n.title?" ":`
42
+ `,...m.current()}))),h(),n.title&&(h=r.enter(`title${c}`),g+=m.move(" "+s),g+=m.move(r.safe(n.title,{before:g,after:s,...m.current()})),g+=m.move(s),h()),d(),g}function uC(n){const i=n.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function Po(n){const i=n.codePointAt(0);return i===void 0?"":String.fromCodePoint(i)}function Kr(n){const i=n.codePointAt(n.length-2);return i!==void 0&&i>65535?n.slice(-2):n.slice(-1)}function v0(n){return"&#x"+n.toString(16).toUpperCase()+";"}function e1(n,i,r){const u=Ti(n),s=Ti(i);return u===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:u===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function oC(n){if(n.charCodeAt(0)!==60)return;const i=n.charCodeAt(1);if(i===33){const h=n.charCodeAt(2);return h===45?2:h===91?5:Kt(h)?4:void 0}if(i===63)return 3;const r=i===47,u=r?2:1;let s=u,c=n.charCodeAt(s);if(!Kt(c))return;for(;c===45||Jt(c);)c=n.charCodeAt(++s);const d=n.slice(u,s).toLowerCase();return!r&&c!==47&&kd.includes(d)?1:i0.includes(d)?6:7}const x0=new Map([["*",!1],["_",!0]]);function sC(n,i,r){const u=new Set;for(const c of n){const d=r.get(c);if(d&&c.attention&&i.some(h=>h.attention===c.attention))for(const h of d.tokens)u.add(h.attention)}const s=[];for(const c of n)c.attention&&u.delete(c.attention)&&s.push(c.attention);return s.reverse(),s}function S0(n,i,r){const u=[],s=new Map,c=new Map;let d=0;for(;d<n.length;){if(!n[d].attention){d++;continue}const h=n[d].value.charAt(0),m=x0.get(h);let g=d+1;for(;g<n.length&&n[g].attention&&n[g].value.charAt(0)===h;)g++;const y=d?n[d-1].value:i,p=Ti(y.charCodeAt(y.length-1)),S=Ti((g<n.length?n[g].value:r).charCodeAt(0)),v=!S||S===2&&!!p,k=!p||p===2&&!!S,A={tokens:n.slice(d,g),markers:[],start:0,end:0,open:m?v&&(!!p||!k):v,close:m?k&&(!!S||!v):k,split:m!==void 0};for(const R of A.tokens){s.set(R,[...A.tokens]),c.set(R,A);let C=R.value.length;for(;C--;)A.markers.push(R)}A.end=A.markers.length,u.push(A),d=g}for(fC(u,s),d=-1;++d<n.length;){const h=s.get(n[d]);if(h)return{attention:sC(n,h,c),index:d}}}function Qo(n,i){const r=n[i?0:n.length-1];if(!r||r.attention)return;const u=i?Po(r.value):Kr(r.value),s=v0(u.codePointAt(0));if(i)r.value=s+r.value.slice(u.length);else{let c=r.value.slice(0,r.value.length-u.length),d=0;for(;c.charCodeAt(c.length-1-d)===92;)d++;d%2&&(c+="\\"),r.value=c+s}}function cC(n,i,r,u,s){for(const c of r.attention){const d=i.get(c)||c.sequences[0];for(const h of c.sequences){if(h===d)continue;const m=new Map(i);m.set(c,h);const g=hs(n,m,u,s),y=S0(g,u,s);if(!y||y.index>r.index)return{chosen:m,mistake:y,tokens:g}}}}function fC(n,i){const r=new Map;for(const u of n){const s=u.tokens[0].value.charAt(0);let c=r.get(s);c||(c=[],r.set(s,c));let d=u.close?c.length:0;for(;d--&&u.start<u.end;){const h=c[d],m=h.end-h.start,g=u.end-u.start;if(u.split?(h.close||u.open)&&g%3&&!((m+g)%3):m!==h.markers.length||m!==g)continue;const y=u.split?m>1&&g>1?2:1:g,p=h.markers.slice(h.end-y,h.end),S=u.markers.slice(u.start,u.start+y),v=p[0],k=S[0];if(v===p[y-1]&&v.value.length===y&&k===S[y-1]&&k.value.length===y&&v.attention===k.attention)i.delete(v),i.delete(k);else{const A=[...new Set([...p,...S])];for(const R of A){const C=i.get(R);C&&C.push(...A)}}h.end-=y,u.start+=y,h.start===h.end&&c.splice(d,1),d=c.length}u.open&&u.start<u.end&&c.push(u)}}function dC(n,i,r){if(i.length===0)throw new Error("Cannot serialize `"+n+"` as attention without markers, expected one or more markers");if(r.length===0)throw new Error("Cannot serialize `"+n+"` as attention without sizes, expected one or more sizes");for(const s of r)if(!Number.isSafeInteger(s)||s<1)throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as size, expected positive integer");const u=[];for(const s of i){if(s.length!==1)throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as marker, expected a single ascii character");if(!K1(s.charCodeAt(0)))throw new Error("Cannot serialize `"+n+"` as attention with `"+s+"` as marker, expected ascii punctuation");for(const c of r)u.push(s.repeat(c))}return u}function hC(n,i,r){const u=i.indexStack,s=n.children||[],c=[];let d=-1,h=r.before;u.push(-1);let m=i.createTracker(r);for(;++d<s.length;){const g=s[d];let y;if(u[u.length-1]=d,d+1<s.length){let v=i.handle.handlers[s[d+1].type];v&&v.peek&&(v=v.peek),y=v?Po(v(s[d+1],n,i,{before:"",after:"",...m.current()})):""}else y=r.after;const p=c[c.length-1];typeof p=="string"&&(h==="\r"||h===`
43
+ `)&&g.type==="html"&&oC(g.value)!==7&&(c[c.length-1]=p.replace(/(\r?\n|\r)$/," "),h=" ",m=i.createTracker(r),m.move(ms(c,r.before,r.after)));const S=i.handle.handlers[g.type];if(S&&S.attention){const v=Jd(g,S.attention,i,m);if(!v)continue;c.push(v),h=Kr(v.sequences[0])}else{const v=i.handle(g,n,i,{...m.current(),after:y,before:h});if(!v)continue;m.move(v),c.push(v),h=Kr(v)}}return u.pop(),c}function Jd(n,i,r,u){const{construct:s,markers:c,sizes:d}=i(n,r),h=dC(n.type,c,d),m=h[0],g=r.enter(s),y=r.createTracker(u.current());y.move(m);const p=hC(n,r,{...y.current(),before:m,after:m});if(g(),p.length!==0)return u.move(m),u.move(ms(p,m,m)),u.move(m),{children:p,sequences:h}}function t1(n,i,r,u){let s=hs(n,i,r,u),c=S0(s,r,u);for(;c;){const d=cC(n,i,c,r,u);if(!d)return;i=d.chosen,s=d.tokens,c=d.mistake}return s}function w0(n,i,r,u){let s=r,c=-1;for(;++c<n.length;){const d=n[c];if(typeof d=="string"){s="";continue}const h=c===n.length-1?u:"",m=d.sequences.find(function(g){const y=g.charAt(0);return y!==s.charAt(0)&&y!==h.charAt(0)||n.length===1&&x0.has(y)&&g.length>r.length})||d.sequences[0];m!==d.sequences[0]&&i.set(d,m),w0(d.children,i,m,m),s=m}}function hs(n,i,r,u){const s=[];let c,d=Kr(r),h=-1;for(;++h<n.length;){const m=n[h];if(typeof m=="string"){const G={value:m,attention:void 0};c&&c===Po(m)&&Qo([G],!0),c=void 0,s.push(G),G.value&&(d=Kr(G.value));continue}const g=i.get(m)||m.sequences[0],y=g.charAt(0),p=n[h+1],S=d,v=Po(p===void 0?u:typeof p=="string"?p:i.get(p)||p.sequences[0]),k=hs(m.children,i,g,g),A=k[0].value,R=e1(S.charCodeAt(S.length-1),A.charCodeAt(0),y);R.inside&&Qo(k,!0);const C=Kr(k[k.length-1].value),I=e1(v.charCodeAt(0),C.charCodeAt(C.length-1),y);I.inside&&Qo(k,!1),R.outside&&S!==`
44
+ `&&S!=="\r"&&Qo(s,!1),I.outside&&(c=v),s.push({value:g,attention:m},...k,{value:g,attention:m}),d=g.charAt(g.length-1)}return s}function ms(n,i,r){const u=new Map;w0(n,u,i,r);const s=(u.size>0?t1(n,u,i,r):void 0)||t1(n,new Map,i,r)||hs(n,new Map,i,r);let c="";for(const d of s)c+=d.value;return c}$d.attention=k0;$d.peek=mC;function $d(n,i,r,u){const s=r.enter("phrasing"),c=Jd(n,k0,r,r.createTracker(u)),d=c?ms([c],u.before,u.after):"";return s(),d}function k0(n,i){return{construct:"emphasis",markers:uC(i)==="*"?["*","_"]:["_","*"],sizes:[1]}}function mC(n,i,r){return r.options.emphasis||"*"}function pC(n,i){let r=!1;return ds(n,function(u){if("value"in u&&/\r?\n|\r/.test(u.value)||u.type==="break")return r=!0,uu}),!!((!n.depth||n.depth<3)&&us(n)&&(i.options.setext||r))}function gC(n,i,r,u){const s=Math.max(Math.min(6,n.depth||1),1),c=r.createTracker(u);if(pC(n,r)){const p=r.enter("headingSetext"),S=r.enter("phrasing"),v=r.containerPhrasing(n,{...c.current(),before:`
36
45
  `,after:`
37
46
  `});return S(),p(),v+`
38
47
  `+(s===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
39
48
  `))+1))}const d="#".repeat(s),h=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let g=r.containerPhrasing(n,{before:"# ",after:`
40
- `,...c.current()});const y=g.charCodeAt(0);return(y===9||y===32)&&(g=c0(y)+g.slice(1)),g=g?d+" "+g:d,r.options.closeAtx&&(g+=" "+d),m(),h(),g}p0.peek=B2;function p0(n){return n.value||""}function B2(){return"<"}g0.peek=U2;function g0(n,i,r,u){const s=Zd(r),c=s==='"'?"Quote":"Apostrophe",d=r.enter("image");let h=r.enter("label");const m=r.createTracker(u);let g=m.move("![");return g+=m.move(r.safe(n.alt,{before:g,after:"]",...m.current()})),g+=m.move("]("),h(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(h=r.enter("destinationLiteral"),g+=m.move("<"),g+=m.move(r.safe(n.url,{before:g,after:">",...m.current()})),g+=m.move(">")):(h=r.enter("destinationRaw"),g+=m.move(r.safe(n.url,{before:g,after:n.title?" ":")",...m.current()}))),h(),n.title&&(h=r.enter(`title${c}`),g+=m.move(" "+s),g+=m.move(r.safe(n.title,{before:g,after:s,...m.current()})),g+=m.move(s),h()),g+=m.move(")"),d(),g}function U2(){return"!"}y0.peek=q2;function y0(n,i,r,u){const s=n.referenceType,c=r.enter("imageReference");let d=r.enter("label");const h=r.createTracker(u);let m=h.move("![");const g=r.safe(n.alt,{before:m,after:"]",...h.current()});m+=h.move(g+"]["),d();const y=r.stack;r.stack=y.filter(function(S){return S!=="phrasing"}),d=r.enter("reference");const p=r.safe(r.associationId(n),{before:m,after:"]",...h.current()});return d(),r.stack=y,c(),s==="full"||!g||g!==p?m+=h.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function q2(){return"!"}b0.peek=H2;function b0(n,i,r){let u=n.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(u);)s+="`";for(/[^\n\r ]/.test(u)&&(/^[\n\r ]/.test(u)&&/[\n\r ]$/.test(u)||/^`|`$/.test(u))&&(u=" "+u+" ");++c<r.unsafe.length;){const d=r.unsafe[c],h=r.compilePattern(d);if(!d.atBreak)continue;let m;for(;m=h.exec(u);){let g=m.index;u.charCodeAt(g)===10&&u.charCodeAt(g-1)===13&&g--,u=u.slice(0,g)+" "+u.slice(m.index+1)}}return s+u+s}function H2(){return"`"}function v0(n,i){const r=us(n);return!!(!i.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(r===n.url||"mailto:"+r===n.url)&&/^[a-z][+\-.a-z]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}x0.peek=Y2;function x0(n,i,r,u){const s=Zd(r),c=s==='"'?"Quote":"Apostrophe",d=r.createTracker(u);if(v0(n,r)){const k=r.stack;r.stack=k.filter(function(C){return C!=="phrasing"});const A=r.enter("autolink");let R=d.move("<");return R+=d.move(r.containerPhrasing(n,{before:R,after:">",...d.current()})),R+=d.move(">"),A(),r.stack=k,R}const h=r.enter("link");let m=r.enter("label"),g=d.move("[");const y=r.containerPhrasing(n,{before:g,after:"](",...d.current()});g+=d.move(y),m(),g+=d.move("](");const p=/[\0- \u007F]/.test(n.url),S=u.before.charAt(u.before.length-1);let v=n.title||void 0;if(!v&&!p&&(S===`
41
- `||S==="\r")){let k=0;for(;k<y.length&&y.charCodeAt(k)!==93;)k+=y.charCodeAt(k)===92?2:1;y.charCodeAt(k+1)===58&&(v="")}return!n.url&&typeof v=="string"||p?(m=r.enter("destinationLiteral"),g+=d.move("<"),g+=d.move(r.safe(n.url,{before:g,after:">",...d.current()})),g+=d.move(">")):(m=r.enter("destinationRaw"),g+=d.move(r.safe(n.url,{before:g,after:typeof v=="string"?" ":")",...d.current()}))),m(),typeof v=="string"&&(m=r.enter(`title${c}`),g+=d.move(" "+s),g+=d.move(r.safe(v,{before:g,after:s,...d.current()})),g+=d.move(s),m()),g+=d.move(")"),h(),g}function Y2(n,i,r){return v0(n,r)?"<":"["}S0.peek=I2;function S0(n,i,r,u){const s=n.referenceType,c=r.enter("linkReference");let d=r.enter("label");const h=r.createTracker(u);let m=h.move("[");const g=r.containerPhrasing(n,{before:m,after:"]",...h.current()});m+=h.move(g+"]["),d();const y=r.stack;r.stack=y.filter(function(S){return S!=="phrasing"}),d=r.enter("reference");const p=r.safe(r.associationId(n),{before:m,after:"]",...h.current()});return d(),r.stack=y,c(),s==="full"||!g||g!==p?m+=h.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function I2(){return"["}function Jd(n){const i=n.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function V2(n){const i=Jd(n),r=n.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function G2(n){const i=n.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function w0(n){const i=n.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function Q2(n,i,r,u){const s=r.enter("list"),c=r.bulletCurrent;let d=n.ordered?G2(r):Jd(r);const h=n.ordered?d==="."?")":".":V2(r);let m=i&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!n.ordered){const y=n.children?n.children[0]:void 0;if((d==="*"||d==="-")&&y&&(!y.children||!y.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),w0(r)===d&&y){let p=-1;for(;++p<n.children.length;){const S=n.children[p];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=h),r.bulletCurrent=d;const g=r.containerFlow(n,u);return r.bulletLastUsed=d,r.bulletCurrent=c,s(),g}function X2(n){const i=n.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function Z2(n,i,r,u){const s=X2(r);let c=r.bulletCurrent||Jd(r);i&&i.type==="list"&&i.ordered&&(c=(typeof i.start=="number"&&i.start>-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(n))+c);let d=c.length+1;(s==="tab"||s==="mixed"&&(i&&i.type==="list"&&i.spread||n.spread))&&(d=Math.ceil(d/4)*4);const h=r.createTracker(u);h.move(c+" ".repeat(d-c.length)),h.shift(d);const m=r.enter("listItem"),g=r.indentLines(r.containerFlow(n,h.current()),y);return m(),g;function y(p,S,v){return S?(v?"":" ".repeat(d))+p:(v?c:c+" ".repeat(d-c.length))+p}}function F2(n,i,r,u){const s=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(n,u);return c(),s(),d}function K2(n,i,r,u){if(!n.children.some(function(h){return y2(h)}))return r.containerFlow(n,u);const c=r.enter("phrasing"),d=r.containerPhrasing(n,u);return c(),d}function J2(n){const i=n.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}$d.attention=k0;$d.peek=$2;function $d(n,i,r,u){const s=r.enter("phrasing"),c=Fd(n,k0,r,r.createTracker(u)),d=c?ms([c],u.before,u.after):"";return s(),d}function k0(n,i){return{construct:"strong",markers:J2(i)==="*"?["*","_"]:["_","*"],sizes:[2]}}function $2(n,i,r){return r.options.strong||"*"}function W2(n,i,r,u){const s=i?i.children:[],c=r.indexStack[r.indexStack.length-1];return r.safe(n.value,{...u,afterNode:s[c+1],beforeNode:s[c-1]})}function P2(n){const i=n.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function eC(n,i,r){const u=(w0(r)+(r.options.ruleSpaces?" ":"")).repeat(P2(r));return r.options.ruleSpaces?u.slice(0,-1):u}const Od={blockquote:b2,break:Wy,code:T2,definition:C2,emphasis:Kd,hardBreak:Wy,heading:L2,html:p0,image:g0,imageReference:y0,inlineCode:b0,link:x0,linkReference:S0,list:Q2,listItem:Z2,paragraph:F2,root:K2,strong:$d,text:W2,thematicBreak:eC};function tC(){return{enter:{table:nC,tableData:t1,tableHeader:t1,tableRow:iC},exit:{codeText:rC,table:lC,tableData:fd,tableHeader:fd,tableRow:fd}}}function nC(n){const i=n._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[],position:void 0},n),this.data.inTable=!0}function lC(n){this.exit(n),this.data.inTable=void 0}function iC(n){this.enter({type:"tableRow",children:[],position:void 0},n)}function fd(n){this.exit(n)}function t1(n){this.enter({type:"tableCell",children:[],position:void 0},n)}function rC(n){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,aC));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(n)}function aC(n,i){return i==="|"?i:n}function uC(n){const i=n||{},{tableCellPadding:r,tablePipeAlign:u,stringLength:s}=i,c=r?" ":"|";return{handlers:{inlineCode:S,table:d,tableCell:m,tableRow:h},join:[oC],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
49
+ `,...c.current()});const y=g.charCodeAt(0);return(y===9||y===32)&&(g=v0(y)+g.slice(1)),g=g?d+" "+g:d,r.options.closeAtx&&(g+=" "+d),m(),h(),g}T0.peek=yC;function T0(n){return n.value||""}function yC(){return"<"}E0.peek=bC;function E0(n,i,r,u){const s=Kd(r),c=s==='"'?"Quote":"Apostrophe",d=r.enter("image");let h=r.enter("label");const m=r.createTracker(u);let g=m.move("![");return g+=m.move(r.safe(n.alt,{before:g,after:"]",...m.current()})),g+=m.move("]("),h(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(h=r.enter("destinationLiteral"),g+=m.move("<"),g+=m.move(r.safe(n.url,{before:g,after:">",...m.current()})),g+=m.move(">")):(h=r.enter("destinationRaw"),g+=m.move(r.safe(n.url,{before:g,after:n.title?" ":")",...m.current()}))),h(),n.title&&(h=r.enter(`title${c}`),g+=m.move(" "+s),g+=m.move(r.safe(n.title,{before:g,after:s,...m.current()})),g+=m.move(s),h()),g+=m.move(")"),d(),g}function bC(){return"!"}C0.peek=vC;function C0(n,i,r,u){const s=n.referenceType,c=r.enter("imageReference");let d=r.enter("label");const h=r.createTracker(u);let m=h.move("![");const g=r.safe(n.alt,{before:m,after:"]",...h.current()});m+=h.move(g+"]["),d();const y=r.stack;r.stack=y.filter(function(S){return S!=="phrasing"}),d=r.enter("reference");const p=r.safe(r.associationId(n),{before:m,after:"]",...h.current()});return d(),r.stack=y,c(),s==="full"||!g||g!==p?m+=h.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function vC(){return"!"}A0.peek=xC;function A0(n,i,r){let u=n.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(u);)s+="`";for(/[^\n\r ]/.test(u)&&(/^[\n\r ]/.test(u)&&/[\n\r ]$/.test(u)||/^`|`$/.test(u))&&(u=" "+u+" ");++c<r.unsafe.length;){const d=r.unsafe[c],h=r.compilePattern(d);if(!d.atBreak)continue;let m;for(;m=h.exec(u);){let g=m.index;u.charCodeAt(g)===10&&u.charCodeAt(g-1)===13&&g--,u=u.slice(0,g)+" "+u.slice(m.index+1)}}return s+u+s}function xC(){return"`"}function N0(n,i){const r=us(n);return!!(!i.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(r===n.url||"mailto:"+r===n.url)&&/^[a-z][+\-.a-z]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}z0.peek=SC;function z0(n,i,r,u){const s=Kd(r),c=s==='"'?"Quote":"Apostrophe",d=r.createTracker(u);if(N0(n,r)){const k=r.stack;r.stack=k.filter(function(C){return C!=="phrasing"});const A=r.enter("autolink");let R=d.move("<");return R+=d.move(r.containerPhrasing(n,{before:R,after:">",...d.current()})),R+=d.move(">"),A(),r.stack=k,R}const h=r.enter("link");let m=r.enter("label"),g=d.move("[");const y=r.containerPhrasing(n,{before:g,after:"](",...d.current()});g+=d.move(y),m(),g+=d.move("](");const p=/[\0- \u007F]/.test(n.url),S=u.before.charAt(u.before.length-1);let v=n.title||void 0;if(!v&&!p&&(S===`
50
+ `||S==="\r")){let k=0;for(;k<y.length&&y.charCodeAt(k)!==93;)k+=y.charCodeAt(k)===92?2:1;y.charCodeAt(k+1)===58&&(v="")}return!n.url&&typeof v=="string"||p?(m=r.enter("destinationLiteral"),g+=d.move("<"),g+=d.move(r.safe(n.url,{before:g,after:">",...d.current()})),g+=d.move(">")):(m=r.enter("destinationRaw"),g+=d.move(r.safe(n.url,{before:g,after:typeof v=="string"?" ":")",...d.current()}))),m(),typeof v=="string"&&(m=r.enter(`title${c}`),g+=d.move(" "+s),g+=d.move(r.safe(v,{before:g,after:s,...d.current()})),g+=d.move(s),m()),g+=d.move(")"),h(),g}function SC(n,i,r){return N0(n,r)?"<":"["}O0.peek=wC;function O0(n,i,r,u){const s=n.referenceType,c=r.enter("linkReference");let d=r.enter("label");const h=r.createTracker(u);let m=h.move("[");const g=r.containerPhrasing(n,{before:m,after:"]",...h.current()});m+=h.move(g+"]["),d();const y=r.stack;r.stack=y.filter(function(S){return S!=="phrasing"}),d=r.enter("reference");const p=r.safe(r.associationId(n),{before:m,after:"]",...h.current()});return d(),r.stack=y,c(),s==="full"||!g||g!==p?m+=h.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function wC(){return"["}function Wd(n){const i=n.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function kC(n){const i=Wd(n),r=n.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function TC(n){const i=n.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function _0(n){const i=n.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function EC(n,i,r,u){const s=r.enter("list"),c=r.bulletCurrent;let d=n.ordered?TC(r):Wd(r);const h=n.ordered?d==="."?")":".":kC(r);let m=i&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!n.ordered){const y=n.children?n.children[0]:void 0;if((d==="*"||d==="-")&&y&&(!y.children||!y.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),_0(r)===d&&y){let p=-1;for(;++p<n.children.length;){const S=n.children[p];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=h),r.bulletCurrent=d;const g=r.containerFlow(n,u);return r.bulletLastUsed=d,r.bulletCurrent=c,s(),g}function CC(n){const i=n.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function AC(n,i,r,u){const s=CC(r);let c=r.bulletCurrent||Wd(r);i&&i.type==="list"&&i.ordered&&(c=(typeof i.start=="number"&&i.start>-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(n))+c);let d=c.length+1;(s==="tab"||s==="mixed"&&(i&&i.type==="list"&&i.spread||n.spread))&&(d=Math.ceil(d/4)*4);const h=r.createTracker(u);h.move(c+" ".repeat(d-c.length)),h.shift(d);const m=r.enter("listItem"),g=r.indentLines(r.containerFlow(n,h.current()),y);return m(),g;function y(p,S,v){return S?(v?"":" ".repeat(d))+p:(v?c:c+" ".repeat(d-c.length))+p}}function NC(n,i,r,u){const s=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(n,u);return c(),s(),d}function zC(n,i,r,u){if(!n.children.some(function(h){return $2(h)}))return r.containerFlow(n,u);const c=r.enter("phrasing"),d=r.containerPhrasing(n,u);return c(),d}function OC(n){const i=n.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}Pd.attention=j0;Pd.peek=_C;function Pd(n,i,r,u){const s=r.enter("phrasing"),c=Jd(n,j0,r,r.createTracker(u)),d=c?ms([c],u.before,u.after):"";return s(),d}function j0(n,i){return{construct:"strong",markers:OC(i)==="*"?["*","_"]:["_","*"],sizes:[2]}}function _C(n,i,r){return r.options.strong||"*"}function jC(n,i,r,u){const s=i?i.children:[],c=r.indexStack[r.indexStack.length-1];return r.safe(n.value,{...u,afterNode:s[c+1],beforeNode:s[c-1]})}function MC(n){const i=n.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function DC(n,i,r){const u=(_0(r)+(r.options.ruleSpaces?" ":"")).repeat(MC(r));return r.options.ruleSpaces?u.slice(0,-1):u}const Od={blockquote:W2,break:Py,code:iC,definition:aC,emphasis:$d,hardBreak:Py,heading:gC,html:T0,image:E0,imageReference:C0,inlineCode:A0,link:z0,linkReference:O0,list:EC,listItem:AC,paragraph:NC,root:zC,strong:Pd,text:jC,thematicBreak:DC};function RC(){return{enter:{table:LC,tableData:n1,tableHeader:n1,tableRow:UC},exit:{codeText:qC,table:BC,tableData:dd,tableHeader:dd,tableRow:dd}}}function LC(n){const i=n._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[],position:void 0},n),this.data.inTable=!0}function BC(n){this.exit(n),this.data.inTable=void 0}function UC(n){this.enter({type:"tableRow",children:[],position:void 0},n)}function dd(n){this.exit(n)}function n1(n){this.enter({type:"tableCell",children:[],position:void 0},n)}function qC(n){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,HC));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(n)}function HC(n,i){return i==="|"?i:n}function YC(n){const i=n||{},{tableCellPadding:r,tablePipeAlign:u,stringLength:s}=i,c=r?" ":"|";return{handlers:{inlineCode:S,table:d,tableCell:m,tableRow:h},join:[IC],unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
42
51
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}]};function d(v,k,A,R){const C=y(v,A,R),I=C[0];if(I){let G=v.align?v.align.length:0,ne=-1;if(!G)for(;++ne<C.length;)C[ne].length>G&&(G=C[ne].length);for(;I.length<G;)I.push("")}return g(C,v.align)}function h(v,k,A,R){const C=p(v,A,R),I=g([C]);return I.slice(0,I.indexOf(`
43
- `))}function m(v,k,A,R){const C=A.enter("tableCell"),I=A.enter("phrasing"),G=A.containerPhrasing(v,{...R,before:c,after:c});return I(),C(),G}function g(v,k){return p2(v,{align:k,alignDelimiters:u,fillRows:!1,padding:r,stringLength:s})}function y(v,k,A){const{children:R}=v;let C=-1;const I=[],G=k.enter("table");for(;++C<R.length;)I[C]=p(R[C],k,A);return G(),I}function p(v,k,A){const{children:R}=v;let C=-1;const I=[],G=k.enter("tableRow");for(;++C<R.length;)I[C]=m(R[C],v,k,A);return G(),I}function S(v,k,A){const R=Od.inlineCode(v,k,A);if(!A.stack.includes("tableCell"))return R;const C=[];let I=0,G=R.indexOf("|");for(;G!==-1;){let ne=G;for(;ne>I&&R.charCodeAt(ne-1)===92;)ne--;C.push(R.slice(I,G)),(G-ne)%2===0&&C.push("\\"),I=G,G=R.indexOf("|",G+1)}return C.push(R.slice(I)),C.join("")}}function oC(n,i,r,u){if(n.type==="table"&&r.type==="listItem"&&r.spread===!1&&(i.type==="definition"||i.type==="heading"&&sC(i,u)||i.type==="paragraph"||i.type==="table"))return 1}function sC(n,i){let r=!1;return ds(n,function(u){if(u.type==="break"||"value"in u&&/\r?\n|\r/.test(u.value))return r=!0,uu}),!!((!n.depth||n.depth<3)&&us(n)&&(i.options.setext||r))}function cC(){return{exit:{taskListCheckValueChecked:n1,taskListCheckValueUnchecked:n1,paragraph:dC}}}function fC(){return{handlers:{paragraph:hC},join:[mC]}}function n1(n){const i=this.stack[this.stack.length-2];i.type,i.checked=n.type==="taskListCheckValueChecked"}function dC(n){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const u=r.children[0];if(u&&u.type==="text"){const s=i.children;let c=-1,d;for(;++c<s.length;){const h=s[c];if(h.type==="paragraph"){d=h;break}}d===r&&(u.value=u.value.slice(1),u.value.length===0?r.children.shift():r.position&&u.position&&typeof u.position.start.offset=="number"&&(u.position.start.column++,u.position.start.offset++,r.position.start={...u.position.start}))}}this.exit(n)}function hC(n,i,r,u){if(!i||i.type!=="listItem"||T0(i)!==n)return Od.paragraph(n,i,r,u);const s="["+(i.checked?"x":" ")+"] ",c=r.createTracker(u);c.move(s);const d=Od.paragraph(n.children.length>0?n:{type:"paragraph",children:[{type:"text",value:" "}]},i,r,{...u,...c.current()});return s+d}function mC(n,i,r){if(!(n.type==="definition"&&r.type==="listItem"))return;const u=T0(r);if(u&&r.children.indexOf(n)<r.children.indexOf(u))return 0}function T0(n){if(typeof n.checked=="boolean")for(const i of n.children){if(i.type==="paragraph")return i;if(i.type!=="definition")return}}function pC(){return[DE(),i2(),o2(),tC(),cC()]}function gC(n){return{extensions:[RE(),r2(n),s2(),uC(n),fC()]}}const yC={tokenize:kC,partial:!0},E0={tokenize:TC,partial:!0},C0={tokenize:EC,partial:!0},A0={tokenize:CC,partial:!0},bC={tokenize:AC,partial:!0},N0={name:"wwwAutolink",tokenize:SC,previous:O0},z0={name:"protocolAutolink",tokenize:wC,previous:_0},Yl={name:"emailAutolink",tokenize:xC,previous:j0},xl={};function vC(){return{text:xl}}let Pi=48;for(;Pi<123;)xl[Pi]=Yl,Pi++,Pi===58?Pi=65:Pi===91&&(Pi=97);xl[43]=Yl;xl[45]=Yl;xl[46]=Yl;xl[95]=Yl;xl[72]=[Yl,z0];xl[104]=[Yl,z0];xl[87]=[Yl,N0];xl[119]=[Yl,N0];function xC(n,i,r){const u=this;let s,c;return d;function d(p){return!_d(p)||!j0.call(u,u.previous)||Wd(u.events)?r(p):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),h(p))}function h(p){return _d(p)?(n.consume(p),h):p===64?(n.consume(p),m):r(p)}function m(p){return p===46?n.check(bC,y,g)(p):p===45||p===95||Jt(p)?(c=!0,n.consume(p),m):y(p)}function g(p){return n.consume(p),s=!0,m}function y(p){return c&&s&&Kt(u.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),i(p)):r(p)}}function SC(n,i,r){const u=this;return s;function s(d){return d!==87&&d!==119||!O0.call(u,u.previous)||Wd(u.events)?r(d):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check(yC,n.attempt(E0,n.attempt(C0,c),r),r)(d))}function c(d){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),i(d)}}function wC(n,i,r){const u=this;let s="",c=!1;return d;function d(p){return(p===72||p===104)&&_0.call(u,u.previous)&&!Wd(u.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),n.consume(p),h):r(p)}function h(p){if(Kt(p)&&s.length<5)return s+=String.fromCodePoint(p),n.consume(p),h;if(p===58){const S=s.toLowerCase();if(S==="http"||S==="https")return n.consume(p),m}return r(p)}function m(p){return p===47?(n.consume(p),c?g:(c=!0,m)):r(p)}function g(p){return p===null||Ko(p)||ut(p)||ir(p)||du(p)?r(p):n.attempt(E0,n.attempt(C0,y),r)(p)}function y(p){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),i(p)}}function kC(n,i,r){let u=0;return s;function s(d){return(d===87||d===119)&&u<3?(u++,n.consume(d),s):d===46&&u===3?(n.consume(d),c):r(d)}function c(d){return d===null?r(d):i(d)}}function TC(n,i,r){let u,s,c;return d;function d(g){return g===46||g===95?n.check(A0,m,h)(g):g===null||ut(g)||ir(g)||g!==45&&du(g)?m(g):(c=!0,n.consume(g),d)}function h(g){return g===95?u=!0:(s=u,u=void 0),n.consume(g),d}function m(g){return s||u||!c?r(g):i(g)}}function EC(n,i){let r=0,u=0;return s;function s(d){return d===40?(r++,n.consume(d),s):d===41&&u<r?c(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?n.check(A0,i,c)(d):d===null||ut(d)||ir(d)?i(d):(n.consume(d),s)}function c(d){return d===41&&u++,n.consume(d),s}}function CC(n,i,r){return u;function u(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(n.consume(h),u):h===38?(n.consume(h),c):h===93?(n.consume(h),s):h===60||h===null||ut(h)||ir(h)?i(h):r(h)}function s(h){return h===null||h===40||h===91||ut(h)||ir(h)?i(h):u(h)}function c(h){return Kt(h)?d(h):r(h)}function d(h){return h===59?(n.consume(h),u):Kt(h)?(n.consume(h),d):r(h)}}function AC(n,i,r){return u;function u(c){return n.consume(c),s}function s(c){return Jt(c)?r(c):i(c)}}function O0(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||ut(n)}function _0(n){return!Kt(n)}function j0(n){return!(n===47||_d(n))}function _d(n){return n===43||n===45||n===46||n===95||Jt(n)}function Wd(n){let i=n.length,r=!1;for(;i--;){const u=n[i][1];if((u.type==="labelLink"||u.type==="labelImage")&&!u._balanced){r=!0;break}if(u._gfmAutolinkLiteralWalkedInto){r=!1;break}}return n.length>0&&!r&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const NC={tokenize:LC,partial:!0};function zC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:MC,continuation:{tokenize:DC},exit:RC}},text:{91:{name:"gfmFootnoteCall",tokenize:jC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:OC,resolveTo:_C}}}}function OC(n,i,r){const u=this;let s=u.events.length;const c=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let d;for(;s--;){const m=u.events[s][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return h;function h(m){if(!d||!d._balanced)return r(m);const g=el(u.sliceSerialize({start:d.end,end:u.now()}));return g.codePointAt(0)!==94||!c.includes(g.slice(1))?r(m):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(m),n.exit("gfmFootnoteCallLabelMarker"),i(m))}}function _C(n,i){let r=n.length;for(;r--;)if(n[r][1].type==="labelImage"&&n[r][0]==="enter"){n[r][1];break}n[r+1][1].type="data",n[r+3][1].type="gfmFootnoteCallLabelMarker";const u={type:"gfmFootnoteCall",start:Object.assign({},n[r+3][1].start),end:Object.assign({},n[n.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},n[r+3][1].end),end:Object.assign({},n[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},n[n.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[n[r+1],n[r+2],["enter",u,i],n[r+3],n[r+4],["enter",s,i],["exit",s,i],["enter",c,i],["enter",d,i],["exit",d,i],["exit",c,i],n[n.length-2],n[n.length-1],["exit",u,i]];return n.splice(r,n.length-r+1,...h),n}function jC(n,i,r){const u=this,s=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c=0,d;return h;function h(p){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(p),n.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?r(p):(n.enter("gfmFootnoteCallMarker"),n.consume(p),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",g)}function g(p){if(c>999||p===93&&!d||p===null||p===91||ut(p))return r(p);if(p===93){n.exit("chunkString");const S=n.exit("gfmFootnoteCallString");return s.includes(el(u.sliceSerialize(S)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(p),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),i):r(p)}return ut(p)||(d=!0),c++,n.consume(p),p===92?y:g}function y(p){return p===91||p===92||p===93?(n.consume(p),c++,g):g(p)}}function MC(n,i,r){const u=this,s=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c,d=0,h;return m;function m(k){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(k){return k===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",y):r(k)}function y(k){if(d>999||k===93&&!h||k===null||k===91||ut(k))return r(k);if(k===93){n.exit("chunkString");const A=n.exit("gfmFootnoteDefinitionLabelString");return c=el(u.sliceSerialize(A)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),S}return ut(k)||(h=!0),d++,n.consume(k),k===92?p:y}function p(k){return k===91||k===92||k===93?(n.consume(k),d++,y):y(k)}function S(k){return k===58?(n.enter("definitionMarker"),n.consume(k),n.exit("definitionMarker"),s.includes(c)||s.push(c),Ke(n,v,"gfmFootnoteDefinitionWhitespace")):r(k)}function v(k){return i(k)}}function DC(n,i,r){return n.check(hu,i,n.attempt(NC,i,r))}function RC(n){n.exit("gfmFootnoteDefinition")}function LC(n,i,r){const u=this;return Ke(n,s,"gfmFootnoteDefinitionIndent",5);function s(c){const d=u.events[u.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?i(c):r(c)}}function BC(n){let r=(n||{}).singleTilde;const u={name:"strikethrough",tokenize:c,resolveAll:s};return r==null&&(r=!0),{text:{126:u},insideSpan:{null:[u]},attentionMarkers:{null:[126]}};function s(d,h){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let g=m;for(;g--;)if(d[g][0]==="exit"&&d[g][1].type==="strikethroughSequenceTemporary"&&d[g][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[g][1].end.offset-d[g][1].start.offset){d[m][1].type="strikethroughSequence",d[g][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},d[g][1].start),end:Object.assign({},d[m][1].end)},p={type:"strikethroughText",start:Object.assign({},d[g][1].end),end:Object.assign({},d[m][1].start)},S=[["enter",y,h],["enter",d[g][1],h],["exit",d[g][1],h],["enter",p,h]],v=h.parser.constructs.insideSpan.null;v&&Pn(S,S.length,0,os(v,d.slice(g+1,m),h)),Pn(S,S.length,0,[["exit",p,h],["enter",d[m][1],h],["exit",d[m][1],h],["exit",y,h]]),Pn(d,g-1,m-g+3,S),m=g+S.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function c(d,h,m){const g=this.previous,y=this.events;let p=0;return S;function S(k){return g===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(d.enter("strikethroughSequenceTemporary"),v(k))}function v(k){const A=Ti(g);if(k===126)return p>1?m(k):(d.consume(k),p++,v);if(p<2&&!r)return m(k);const R=d.exit("strikethroughSequenceTemporary"),C=Ti(k);return R._open=!C||C===2&&!!A,R._close=!A||A===2&&!!C,h(k)}}}class UC{constructor(){this.map=[],this.index=new Map}add(i,r,u){qC(this,i,r,u)}consume(i){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const u=[];for(;r>0;)r-=1,u.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];u.push(i.slice()),i.length=0;let s=u.pop();for(;s;){for(const c of s)i.push(c);s=u.pop()}this.map.length=0,this.index.clear()}}function qC(n,i,r,u){if(r===0&&u.length===0)return;const s=n.index.get(i);if(s){s[1]+=r,s[2].push(...u);return}const c=[i,r,u];n.map.push(c),n.index.set(i,c)}function HC(n,i){let r=!1;const u=[];for(;i<n.length;){const s=n[i];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&u.push(n[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(n[i-1][1].type==="tableDelimiterMarker"){const c=u.length-1;u[c]=u[c]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);i+=1}return u}function YC(){return{flow:{null:{name:"table",tokenize:IC,resolveAll:VC}}}}function IC(n,i,r){const u=this;let s=0,c=0,d;return h;function h(U){let $=u.events.length-1;for(;$>-1;){const{type:Ue}=u.events[$][1];if(Ue==="lineEnding"||Ue==="linePrefix")$--;else break}const ue=$>-1?u.events[$][1].type:null,Ce=ue==="tableHead"||ue==="tableRow"?H:m;return Ce===H&&u.parser.lazy[u.now().line]?r(U):Ce(U)}function m(U){return n.enter("tableHead"),n.enter("tableRow"),g(U)}function g(U){return U===124||(d=!0,c+=1),y(U)}function y(U){return U===null?r(U):Se(U)?c>1?(c=0,u.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(U),n.exit("lineEnding"),v):r(U):Be(U)?Ke(n,y,"whitespace")(U):(c+=1,d&&(d=!1,s+=1),U===124?(n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),d=!0,y):(n.enter("data"),p(U)))}function p(U){return U===null||U===124||ut(U)?(n.exit("data"),y(U)):(n.consume(U),U===92?S:p)}function S(U){return U===92||U===124?(n.consume(U),p):p(U)}function v(U){return u.interrupt=!1,u.parser.lazy[u.now().line]?r(U):(n.enter("tableDelimiterRow"),d=!1,Be(U)?Ke(n,k,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):k(U))}function k(U){return U===45||U===58?R(U):U===124?(d=!0,n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),A):le(U)}function A(U){return Be(U)?Ke(n,R,"whitespace")(U):R(U)}function R(U){return U===58?(c+=1,d=!0,n.enter("tableDelimiterMarker"),n.consume(U),n.exit("tableDelimiterMarker"),C):U===45?(c+=1,C(U)):U===null||Se(U)?ne(U):le(U)}function C(U){return U===45?(n.enter("tableDelimiterFiller"),I(U)):le(U)}function I(U){return U===45?(n.consume(U),I):U===58?(d=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(U),n.exit("tableDelimiterMarker"),G):(n.exit("tableDelimiterFiller"),G(U))}function G(U){return Be(U)?Ke(n,ne,"whitespace")(U):ne(U)}function ne(U){return U===124?k(U):U===null||Se(U)?!d||s!==c?le(U):(n.exit("tableDelimiterRow"),n.exit("tableHead"),i(U)):le(U)}function le(U){return r(U)}function H(U){return n.enter("tableRow"),Z(U)}function Z(U){return U===124?(n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),Z):U===null||Se(U)?(n.exit("tableRow"),i(U)):Be(U)?Ke(n,Z,"whitespace")(U):(n.enter("data"),K(U))}function K(U){return U===null||U===124||ut(U)?(n.exit("data"),Z(U)):(n.consume(U),U===92?de:K)}function de(U){return U===92||U===124?(n.consume(U),K):K(U)}}function VC(n,i){let r=-1,u=!0,s=0,c=[0,0,0,0],d=[0,0,0,0],h=!1,m=0,g,y,p;const S=new UC;for(;++r<n.length;){const v=n[r],k=v[1];v[0]==="enter"?k.type==="tableHead"?(h=!1,m!==0&&(l1(S,i,m,g,y),y=void 0,m=0),g={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},S.add(r,0,[["enter",g,i]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(u=!0,p=void 0,c=[0,0,0,0],d=[0,r+1,0,0],h&&(h=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},S.add(r,0,[["enter",y,i]])),s=k.type==="tableDelimiterRow"?2:y?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(u=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],p=Xo(S,i,c,s,void 0,p),c=[0,0,0,0]),d[2]=r)):k.type==="tableCellDivider"&&(u?u=!1:(c[1]!==0&&(d[0]=d[1],p=Xo(S,i,c,s,void 0,p)),c=d,d=[c[1],r,0,0])):k.type==="tableHead"?(h=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],p=Xo(S,i,c,s,r,p)):d[1]!==0&&(p=Xo(S,i,d,s,r,p)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&l1(S,i,m,g,y),S.consume(i.events),r=-1;++r<i.events.length;){const v=i.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=HC(i.events,r))}return n}function Xo(n,i,r,u,s,c){const d=u===1?"tableHeader":u===2?"tableDelimiter":"tableData",h="tableContent";r[0]!==0&&(c.end=Object.assign({},Fr(i.events,r[0])),n.add(r[0],0,[["exit",c,i]]));const m=Fr(i.events,r[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},n.add(r[1],0,[["enter",c,i]]),r[2]!==0){const g=Fr(i.events,r[2]),y=Fr(i.events,r[3]),p={type:h,start:Object.assign({},g),end:Object.assign({},y)};if(n.add(r[2],0,[["enter",p,i]]),u!==2){const S=i.events[r[2]],v=i.events[r[3]];if(S[1].end=Object.assign({},v[1].end),S[1].type="chunkText",S[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,A=r[3]-r[2]-1;n.add(k,A,[])}}n.add(r[3]+1,0,[["exit",p,i]])}return s!==void 0&&(c.end=Object.assign({},Fr(i.events,s)),n.add(s,0,[["exit",c,i]]),c=void 0),c}function l1(n,i,r,u,s){const c=[],d=Fr(i.events,r);s&&(s.end=Object.assign({},d),c.push(["exit",s,i])),u.end=Object.assign({},d),c.push(["exit",u,i]),n.add(r+1,0,c)}function Fr(n,i){const r=n[i],u=r[0]==="enter"?"start":"end";return r[1][u]}const GC={name:"tasklistCheck",tokenize:XC};function QC(){return{text:{91:GC}}}function XC(n,i,r){const u=this;return s;function s(m){return u.previous!==null||!u._gfmTasklistFirstContentOfListItem?r(m):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),c)}function c(m){return ut(m)?(n.enter("taskListCheckValueUnchecked"),n.consume(m),n.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(n.enter("taskListCheckValueChecked"),n.consume(m),n.exit("taskListCheckValueChecked"),d):r(m)}function d(m){return m===93?(n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),h):r(m)}function h(m){return Se(m)?i(m):Be(m)?n.check({tokenize:ZC},i,r)(m):r(m)}}function ZC(n,i,r){return Ke(n,u,"whitespace");function u(s){return s===null?r(s):i(s)}}function FC(n){return U1([vC(),zC(),BC(n),YC(),QC()])}const KC={};function JC(n){const i=this,r=n||KC,u=i.data(),s=u.micromarkExtensions||(u.micromarkExtensions=[]),c=u.fromMarkdownExtensions||(u.fromMarkdownExtensions=[]),d=u.toMarkdownExtensions||(u.toMarkdownExtensions=[]);s.push(FC(r)),c.push(pC()),d.push(gC(r))}function $C({text:n,language:i}){const[r,u]=F.useState(!1);return w.jsxs("div",{className:"code-block",children:[w.jsxs("div",{className:"code-banner",children:[w.jsx("span",{className:"code-lang",children:i||"Code block"}),w.jsx("button",{type:"button",className:"code-copy","aria-label":r?"Copied":"Copy",onClick:()=>{navigator.clipboard.writeText(n).then(()=>{u(!0),window.setTimeout(()=>u(!1),1e3)})},children:r?"Copied":"Copy"})]}),w.jsx("pre",{children:w.jsx("code",{children:n})})]})}function WC({children:n}){const i=F.Children.toArray(n)[0];if(F.isValidElement(i)){const r=i,u=String(r.props.children??"").replace(/\n$/,""),s=/language-([\w-]+)/.exec(r.props.className??"");return w.jsx($C,{text:u,language:s?.[1]})}return w.jsx("pre",{children:n})}function PC(n){if(!n||/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("#")||n.startsWith("//")||n.startsWith("?"))return null;const i=n.indexOf("#"),r=i<0?n:n.slice(0,i);if(r.includes("?"))return null;let u;try{u=decodeURIComponent(r)}catch{return null}const s=/:(\d+)$/.exec(u);if(s&&(u=u.slice(0,-s[0].length)),!u||/[\u0000-\u001f\\]/.test(u)||u.split("/").includes(".."))return null;const c=s?Number(s[1]):void 0;return c!=null&&Number.isSafeInteger(c)&&c>0?{path:u,line:c}:{path:u}}function eA(n,i){return{pre:WC,code({className:r,children:u}){return w.jsx("code",{className:r,children:u})},table({children:r}){return w.jsx("div",{className:"table-scroll",children:w.jsx("table",{children:r})})},a({href:r,children:u}){const s=n?null:PC(r);return s&&i?w.jsx("button",{type:"button",className:"file-mention",title:s.path,onClick:()=>i(s.path,s.line),children:u}):w.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:u})}}}function tA(n,i){if(!i)return n;const r=n.match(/```/g);return r&&r.length%2===1?`${n}
44
- \`\`\``:n}function Pd({text:n,streaming:i=!1,onOpenFile:r}){const u=F.useMemo(()=>eA(i,r),[i,r]);return w.jsx("div",{className:i?"markdown streaming":"markdown",children:w.jsx(TE,{remarkPlugins:[JC],components:u,children:tA(n,i)})})}const nA={accepted:"work.status.accepted",enqueued:"work.status.enqueued",started:"work.status.started",needs_user:"work.status.needs_user",ready:"work.status.ready",delivered:"work.status.delivered",cancelled:"work.status.cancelled",failed:"work.status.failed"},lA=new Set(["delivered","cancelled"]),iA=new Set(["accepted","enqueued","started","needs_user"]);function M0(n,i=Hl){const r=nA[n];return r?i(r):n}function D0(n){return n.replace(/^\uFEFF/,"").trimStart().startsWith("[foundations:ticket]")}function eh(n){const i=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
45
- `).trimStart();if(!i.startsWith("[foundations:briefing]"))return null;const r=i.slice(22).replace(/^\n/,""),u=r.indexOf(`
46
- ---
47
- `);if(u<0)return null;const s=[],c={};for(const g of r.slice(0,u).split(`
48
- `)){const y=/^(briefing_revision|budget_wall_ms|budget_max_tokens|material_sha256):\s*(.*)$/.exec(g);y?.[1]?c[y[1]]=(y[2]??"").trim():g.trim()!==""&&s.push(g.trim())}const d=Number(c.briefing_revision),h=Number(c.budget_wall_ms),m=Number(c.budget_max_tokens);return{revision:Number.isFinite(d)&&d>0?d:1,wallMs:Number.isFinite(h)&&h>0?h:null,maxTokens:Number.isFinite(m)&&m>0?m:null,material:c.material_sha256??"",notes:s,body:r.slice(u+5).trim(),cancel:s.some(g=>g.startsWith("This is a cancellation note")||g.startsWith("这是取消说明"))}}function tr(n){return n.startsWith("worker-")&&n.length>7}function rA(n){return tr(n)?n.slice(7):""}function aA(n){const i=n.signals;if(!i||typeof i!="object"||Array.isArray(i))return{};const r={};for(const[u,s]of Object.entries(i))r[u]=Array.isArray(s)?s.filter(c=>typeof c=="string"):[];return r}function uA(n){const i=n.cards;if(!i||typeof i!="object"||Array.isArray(i))return{};const r={};for(const[u,s]of Object.entries(i))r[u]=sA({cards:s});return r}function oA(n){const i=n.work&&typeof n.work=="object"&&!Array.isArray(n.work)?n.work:n;return!("signals"in i)&&!("cards"in i)?null:{signals:aA(i),cards:uA(i)}}function sA(n){return Array.isArray(n.cards)?n.cards.flatMap(i=>{if(!i||typeof i!="object")return[];const r=i,u=typeof r.summary=="string"?r.summary:"",s=cA(r,u);return s?[s]:[]}):[]}function cA(n,i="",r=Hl){const u=n.ticket;if(!u||typeof u!="object")return null;const s=u;if(typeof s.id!="string"||typeof s.status!="string")return null;const c=Array.isArray(n.attempts)?n.attempts:[],d=typeof s.active_attempt_id=="string"?s.active_attempt_id:"",h=c.find(p=>p&&typeof p=="object"&&p.id===d),m=Array.isArray(n.events)?n.events.flatMap(SA):[],g=typeof s.child_session_id=="string"?s.child_session_id:"",y=i.trim()||r("work.ticket");return{id:s.id,status:s.status,revision:typeof s.briefing_revision=="number"?s.briefing_revision:1,summary:y,childSessionId:g.startsWith("worker-")?g:null,startedAt:typeof h?.started_at=="string"?h.started_at:null,events:m}}function R0(n){const i=n.filter(u=>!lA.has(u.status)),r=n.find(u=>u.status==="delivered");return r?[...i,r]:i}function L0(n){return n.some(i=>iA.has(i.status))}function i1(n,i,r=!1){return r?!1:n&&!L0(i)}function fA(n,i=Hl){return i(n==="Replying"?"bot.replying":"bot.thinking")}function dA(n){return n.length>0&&n.every(i=>i.kind==="think"||i.kind==="tool"&&(i.name??"").startsWith("foundations_"))}const hA=new Set(["accepted","enqueued","started"]);function mA(n,i=!1){if(i)return"run";let r=!1,u=!1;for(const s of n)s.status==="delivered"||s.status==="cancelled"||(s.status==="needs_user"?r=!0:hA.has(s.status)&&(u=!0));return r?"wait":u?"run":null}function dd(n,i=Date.now(),r=Hl){const u=n.filter(d=>d.status==="started");if(u.length>1)return r("work.preview.startedMany",{count:String(u.length)});const s=q0(n);if(!s||s.status==="ready")return"";const c=M0(s.status,r);if(s.status==="started"){const d=U0(s.startedAt,i);return d?`${c} · ${d}`:c}return c}function pA(n,i=Hl){if(n.filter(s=>s.status==="started").length>1)return i("work.placeholder.many");const u=q0(n);return u?u.status==="started"?i("work.placeholder.started"):u.status==="needs_user"?i("work.placeholder.needsUser"):u.status==="ready"?i("work.placeholder.ready"):u.status==="failed"?i("work.placeholder.failed"):null:null}function gA(n,i,r=Hl){const u=[r("work.fact.revision",{revision:String(n.revision)})];if(n.status==="accepted"&&u.push(r("work.fact.accepted")),n.status==="enqueued"&&u.push(r("work.fact.enqueued")),n.status==="started"){const c=U0(n.startedAt,i);c&&u.push(r("work.fact.elapsed",{time:c})),u.push(r("work.fact.wall"))}n.status==="needs_user"&&u.push(r("work.fact.needsUser")),n.status==="ready"&&u.push(r("work.fact.ready")),n.status==="delivered"&&u.push(r("work.fact.delivered")),n.status==="failed"&&u.push(r("work.fact.failed")),n.revision>1&&(n.status==="enqueued"||n.status==="accepted")&&(u.push(r("work.fact.sameWorker")),u.push(r("work.fact.restart")));const s=xA(n);return s&&u.push(s),u}function yA(n){const i=n.events.filter(r=>r.kind==="question"&&r.text.trim()!=="");if(n.status==="needs_user")return{text:i.filter(u=>u.revision===n.revision&&u.applyStatus!=="stale").at(-1)?.text??"",stale:!1};if(n.revision>1&&(n.status==="enqueued"||n.status==="accepted"||n.status==="started")){const r=[...i].reverse().find(u=>u.applyStatus==="stale");if(r)return{text:r.text,stale:!0}}return null}function B0(n){if(n.name!=="foundations_dispatch"||n.result.trim()==="")return null;const i=th(n.result);return i?i.ok===!1?null:typeof i.ticketId=="string"&&i.ticketId!==""?i.ticketId:null:/"ticketId"\s*:\s*"([^"]+)"/.exec(n.result)?.[1]??null}function bA(n){if(n.name!=="foundations_dispatch"||n.result.trim()==="")return!1;const i=th(n.result);return i?i.ok===!1&&i.code==="BUDGET":n.result.includes('"BUDGET"')||/concurrency limit/i.test(n.result)}function vA(n,i=Hl){const r=th(n);return r&&typeof r.message=="string"&&r.message!==""?r.message:i("work.budgetFallback")}function U0(n,i){if(!n)return"";const r=Date.parse(n);if(!Number.isFinite(r))return"";const u=Math.max(0,Math.floor((i-r)/1e3)),s=Math.floor(u/60),c=u%60;return`${s}:${String(c).padStart(2,"0")}`}function q0(n){const i=R0(n),r=["needs_user","started","enqueued","accepted","ready","failed"];for(const u of r){const s=i.find(c=>c.status===u);if(s)return s}return i[0]??null}function xA(n){return n.events.filter(r=>r.kind==="progress"&&r.applyStatus==="applied"&&r.revision===n.revision&&r.text.trim()!=="").at(-1)?.text??""}function SA(n){if(!n||typeof n!="object")return[];const i=n;return typeof i.event_id!="string"||typeof i.kind!="string"?[]:[{eventId:i.event_id,kind:i.kind,applyStatus:typeof i.apply_status=="string"?i.apply_status:"",revision:typeof i.briefing_revision=="number"?i.briefing_revision:0,text:typeof i.text=="string"?i.text:""}]}function th(n){try{const i=JSON.parse(n);return!i||typeof i!="object"||Array.isArray(i)?null:i}catch{return null}}function H0({ticket:n,now:i,onSupply:r,onOpen:u}){const{t:s}=wt(),[c,d]=F.useState(""),[h,m]=F.useState(""),[g,y]=F.useState(!1),p=yA(n),S=n.status==="started"||n.status==="needs_user";return w.jsxs("article",{className:"work-card",children:[w.jsxs("header",{children:[w.jsx("h3",{children:n.summary}),n.status==="ready"?null:w.jsx("span",{className:S?"work-status live":"work-status",children:M0(n.status,s)})]}),gA(n,i,s).map(v=>w.jsx("p",{children:v},v)),n.childSessionId?w.jsx("button",{type:"button",className:"work-open",onClick:()=>u(n.childSessionId??""),children:s("work.openWorker")}):null,p?w.jsx("p",{className:p.stale?"stale":"work-question",children:p.text||s("work.questionEmpty")}):null,p?.stale?w.jsx("p",{className:"work-quiet",children:s("work.questionStale")}):null,n.status==="needs_user"?w.jsxs("form",{className:"work-reply",onSubmit:v=>{v.preventDefault();const k=c.trim();!k||g||(y(!0),m(""),r(n.id,k).then(A=>{y(!1),A?m(A):d("")}))},children:[w.jsxs("label",{children:[w.jsx("span",{children:s("work.answerLabel")}),w.jsx("textarea",{value:c,rows:2,disabled:g,onChange:v=>d(v.target.value)})]}),h?w.jsx("p",{className:"work-error",children:h}):null,w.jsx("button",{type:"submit",disabled:g||c.trim()==="",children:s("work.answerSubmit")})]}):null]})}function wA({briefing:n,time:i,mark:r,onOpenFile:u}){const{t:s}=wt(),[c,d]=F.useState(!1),h=n.body.split(`
49
- `).map(g=>g.trim()).find(Boolean)??"",m=[n.wallMs!=null?s("work.duration",{value:kA(n.wallMs,s)}):"",n.maxTokens!=null?`token ${n.maxTokens.toLocaleString("en-US")}`:"",n.material?s("work.material",{hash:n.material.slice(0,8)}):""].filter(Boolean);return w.jsxs("div",{className:"briefing-row","data-turn":r,children:[w.jsxs("article",{className:c?"briefing-card open":"briefing-card",children:[w.jsxs("button",{type:"button",className:"briefing-toggle","aria-expanded":c,onClick:()=>d(g=>!g),children:[w.jsx("span",{className:"briefing-title",children:n.cancel?s("work.cancelTitle"):s("work.taskTitle")}),w.jsx("span",{className:"briefing-rev",children:s("work.generation",{revision:String(n.revision)})}),w.jsx(TA,{}),h&&!c?w.jsx("span",{className:"briefing-preview",children:h}):null]}),w.jsx(rs,{open:c,children:w.jsxs("div",{className:"briefing-body",children:[n.body?w.jsx(Pd,{text:n.body,onOpenFile:u}):null,m.length?w.jsx("p",{className:"briefing-facts",children:m.join(" · ")}):null,n.notes.map(g=>w.jsx("p",{className:"briefing-note",children:g},g))]})})]}),i?w.jsx("time",{children:i}):null]})}function kA(n,i){return n%6e4===0?i("work.minutes",{count:String(n/6e4)}):n%1e3===0?i("work.seconds",{count:String(n/1e3)}):i("work.milliseconds",{count:String(n)})}function TA(){return w.jsx("svg",{className:"briefing-chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4 6.5L8 10.5L12 6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function EA({text:n}){return w.jsx("p",{className:"work-refused",children:n})}var CA=b1();function AA({sessionId:n,path:i,line:r,onClose:u}){const[s,c]=F.useState({status:"loading",text:"",eof:!0}),{t:d}=wt(),h=i.split("/").filter(Boolean).at(-1)??i,m=zA(h);return F.useEffect(()=>{const g=document.body.style.overflow;document.body.style.overflow="hidden";const y=p=>{p.key==="Escape"&&u()};return document.addEventListener("keydown",y),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",y)}},[u]),F.useEffect(()=>{const g=new AbortController;c({status:"loading",text:"",eof:!0});const y=`/file?sessionId=${encodeURIComponent(n)}&path=${encodeURIComponent(i)}`;return Yn(y,{signal:g.signal}).then(p=>{if(g.signal.aborted)return;const S=typeof p.body.text=="string"?p.body.text:"";if(p.status!==200){c({status:"error",text:"",eof:!0});return}c({status:"ready",text:S,eof:p.body.eof!==!1})}).catch(()=>{g.signal.aborted||c({status:"error",text:"",eof:!0})}),()=>g.abort()},[n,i]),CA.createPortal(w.jsxs("div",{className:"file-modal",role:"presentation",children:[w.jsx("div",{className:"file-modal-mask",onClick:u}),w.jsxs("div",{className:"file-modal-card",role:"dialog","aria-modal":"true","aria-label":h,tabIndex:-1,children:[w.jsxs("header",{className:"file-modal-head",children:[w.jsxs("div",{className:"file-modal-title",children:[w.jsx("strong",{children:h}),i!==h?w.jsx("span",{children:i}):null]}),w.jsx("button",{type:"button",className:"file-modal-close","aria-label":d("file.close"),onClick:u,children:w.jsx(OA,{})})]}),w.jsx(NA,{state:s,language:m,line:r})]})]}),document.body)}function NA({state:n,language:i,line:r}){const{t:u}=wt(),[s,c]=F.useState(!1);if(n.status==="loading")return w.jsx("p",{className:"file-modal-status",children:u("file.loading")});if(n.status==="error")return w.jsx("p",{className:"file-modal-status",children:u("file.error")});const d=n.text===""?[]:n.text.split(`
50
- `);return w.jsxs("div",{className:"file-preview","data-code-preview":"",children:[w.jsxs("div",{className:"file-preview-banner",children:[w.jsx("span",{className:"file-preview-lang",children:i||"Code"}),w.jsx("button",{type:"button",className:"diff-copy","aria-label":s?"Copied":"Copy",onClick:()=>{navigator.clipboard.writeText(n.text).then(()=>{c(!0),window.setTimeout(()=>c(!1),1e3)})},children:s?w.jsx(jA,{}):w.jsx(_A,{})})]}),w.jsx("div",{className:"file-preview-scroll",children:w.jsx("pre",{children:w.jsx("code",{style:{"--line-width":`${Math.max(2,String(d.length).length)}ch`},children:d.map((h,m)=>w.jsx("span",{className:r===m+1?"source-line current":"source-line",children:h},m))})})}),n.eof?null:w.jsx("p",{className:"file-modal-note",children:u("file.truncated")})]})}function zA(n){const i=n.split(".").pop()?.toLowerCase()??"";return{py:"python",ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",md:"markdown",css:"css",html:"html",json:"json",sh:"bash",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",rb:"ruby",c:"c"}[i]??""}function OA(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4.2 4.2L11.8 11.8M11.8 4.2L4.2 11.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function _A(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("rect",{x:"5.2",y:"5.2",width:"7.2",height:"7.6",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M10.2 5.2V3.8A1.3 1.3 0 0 0 8.9 2.5H3.8A1.3 1.3 0 0 0 2.5 3.8v5.1A1.3 1.3 0 0 0 3.8 10.2H5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function jA(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.5 8.2L6.4 11.1L12.5 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function MA({onClose:n,onCreated:i}){const[r,u]=F.useState(""),[s,c]=F.useState(""),[d,h]=F.useState(""),[m,g]=F.useState(!1),[y,p]=F.useState(""),{locale:S,setLocale:v,t:k}=wt();function A(C){u(C)}async function R(){if(m)return;const C=r.trim();if(C===""){p(k("new.nameRequired"));return}g(!0),p("");const I=await Yn("/sessions",{method:"POST",headers:{"content-type":"application/json","idempotency-key":crypto.randomUUID()},body:JSON.stringify({name:C})}),G=typeof I.body.sessionId=="string"?I.body.sessionId:"";if(!G){const Z=I.body.upstream;p(Z?.message||String(I.body.error||k("new.createFailed"))),g(!1);return}const ne=tS(C,s,d),le=await ou("/dsh-bot/api/sessions/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:G,personaText:ne,idempotencyKey:crypto.randomUUID()})}),H=le.body.ok===!0?k("new.created",{name:C}):x1(le.body,k("new.personaFailed"));i(G,H,C)}return w.jsx("div",{className:"setup-mask",role:"presentation",onMouseDown:n,children:w.jsxs("form",{className:"setup-card",role:"dialog","aria-labelledby":"new-session-title",onMouseDown:C=>C.stopPropagation(),onSubmit:C=>{C.preventDefault(),R()},children:[w.jsxs("div",{className:"setup-head",children:[w.jsx("h2",{id:"new-session-title",children:k("new.title")}),w.jsx("button",{type:"button",className:"setup-close","aria-label":k("new.close"),onClick:n,children:"×"})]}),w.jsx("p",{className:"setup-lead",children:k("new.lead")}),w.jsx("label",{htmlFor:"setup-name",children:k("new.name")}),w.jsx("input",{id:"setup-name",value:r,placeholder:k("new.namePlaceholder"),onChange:C=>A(C.target.value)}),w.jsx("label",{htmlFor:"setup-style",children:k("new.style")}),w.jsx("input",{id:"setup-style",value:s,placeholder:k("new.stylePlaceholder"),onChange:C=>c(C.target.value)}),w.jsx("label",{htmlFor:"setup-task",children:k("new.task")}),w.jsx("textarea",{id:"setup-task",rows:3,value:d,placeholder:k("new.taskPlaceholder"),onChange:C=>h(C.target.value)}),y?w.jsx("p",{className:"setup-error",children:y}):null,w.jsxs("div",{className:"setup-actions",children:[w.jsx("button",{type:"button",onClick:()=>v(S==="en"?"zh":"en"),children:k("lang.switch")}),w.jsx("button",{type:"button",onClick:n,children:k("new.cancel")}),w.jsx("button",{type:"submit",className:"primary",disabled:m||r.trim()==="",children:k(m?"new.creating":"new.create")})]})]})})}function DA(n,i){const{t:r}=wt(),[u,s]=F.useState("");return F.useEffect(()=>{if(n===""){s("");return}let c=!1;return(async()=>{const d=await ou(`/dsh-bot/api/status?sessionId=${encodeURIComponent(n)}`),h=await ou(`/dsh-bot/api/memory?sessionId=${encodeURIComponent(n)}`);if(c||d.body.ok!==!0)return;const m=d.body.binding;if((m&&typeof m=="object"?m.kind:d.body.kind)!=="bot"){s(r("basis.plain"));return}const y=typeof d.body.personaText=="string"?d.body.personaText.trim():"",p=nS(y),S=[p.name,p.style,p.task].filter(A=>A!=="").join(" · "),k=(Array.isArray(h.body.facts)?h.body.facts:[]).filter(A=>A&&typeof A=="object"&&A.status==="active").length;s(k>0?r("basis.facts",{head:S||"BOT",count:String(k)}):S||"BOT")})(),()=>{c=!0}},[n,i,r]),u}function ps(n){const i=n.replace(/\r\n/g,`
51
- `);if(!i.startsWith("[foundations:message]"))return null;const r=i.slice(21).replace(/^\n/,""),u=r.indexOf(`
52
- ---
53
- `);if(u<0)return null;const s={},c=[];for(const d of r.slice(0,u).split(`
54
- `)){const h=/^(id|from|correlation|causation|hop):\s*(.*)$/.exec(d);h?.[1]?s[h[1]]=(h[2]??"").trim():d.trim()!==""&&c.push(d.trim())}return s.from?{id:s.id??"",from:s.from,correlation:s.correlation??"",causation:s.causation??"",hop:s.hop??"",note:c.join(" "),body:r.slice(u+5).trim()}:null}function Y0(n,i){return i!==""&&i!==n?i:n.startsWith("session-")&&n.length>18?`${n.slice(0,12)}…${n.slice(-4)}`:n}const RA=new Set(["foundations_send","foundations_reply"]);function I0(n){const i=[];for(const r of n){if(r.kind==="user"){const s=ps(r.text);if(!s)continue;i.push({kind:"in",id:r.id,seq:r.seq,time:r.time,mail:s});continue}if(r.kind!=="tool"||!RA.has(r.name))continue;const u=qA(r);u&&i.push(u)}return i.sort((r,u)=>r.seq-u.seq||(r.kind===u.kind?0:r.kind==="in"?-1:1)),i}function LA(n){const i=I0(n);if(!i.some(s=>s.kind==="in"))return n.slice();const u=new Set(i.filter(s=>s.kind==="out").map(s=>s.id));return n.filter(s=>!u.has(s.id))}function BA(n,i){const r=n.filter(c=>c.kind==="in"),u=r.at(-1);if(!u)return null;const s=u.mail.body.replace(/\s+/g," ").trim();return{who:i(u.mail.from)||"BOT",preview:s.length>72?`${s.slice(0,71)}…`:s,count:r.length}}function UA(n,i){if(n.target)return n.target;if(!n.correlation)return"";for(let r=i.length-1;r>=0;r-=1){const u=i[r];if(!(!u||u.seq>n.seq)&&u.kind==="in"&&u.mail.correlation===n.correlation)return u.mail.from}return""}function qA(n){let i;try{const u=JSON.parse(n.args);if(!u||typeof u!="object"||Array.isArray(u))return null;i=u}catch{return null}const r=typeof i.text=="string"?i.text.trim():"";return r?{kind:"out",id:n.id,seq:n.seq,text:r,target:typeof i.targetSessionId=="string"?i.targetSessionId:"",correlation:typeof i.correlationId=="string"?i.correlationId:""}:null}function HA({mail:n,label:i,onOpenFile:r}){const{t:u}=wt(),s=Y0(n.from,i),c=/^\d+$/.test(n.hop)?n.hop:"",d=[n.id?`id ${n.id}`:"",`from ${n.from}`,n.correlation?`correlation ${n.correlation}`:"",n.causation?`causation ${n.causation}`:""].filter(Boolean).join(`
55
- `);return w.jsxs("article",{className:"mail-card",children:[w.jsxs("header",{className:"mail-head",children:[w.jsx("span",{className:"bot-badge",children:"BOT"}),w.jsxs("span",{className:"mail-who",children:[w.jsx("strong",{children:s}),w.jsx("span",{children:u("inbox.received")})]}),c?w.jsx("span",{className:"mail-hop",children:u("inbox.hop",{hop:c})}):null]}),n.body?w.jsx("div",{className:"mail-body",children:w.jsx(Pd,{text:n.body,onOpenFile:r})}):null,w.jsx("p",{className:"mail-note",children:u("inbox.lead")}),d?w.jsxs("details",{className:"mail-details",children:[w.jsx("summary",{children:u("inbox.source")}),w.jsx("pre",{children:d})]}):null]})}function YA({who:n,preview:i,time:r,mark:u,onOpen:s}){const{t:c}=wt(),d=i||c("inbox.received");return w.jsxs("div",{className:"inbox-line","data-turn":u,children:[w.jsxs("button",{type:"button",className:"inbox-entry",onClick:s,"aria-label":c("inbox.open",{who:n,line:d}),children:[w.jsx("span",{className:"inbox-icon",children:w.jsx(XA,{})}),w.jsxs("span",{className:"inbox-copy",children:[w.jsx("strong",{children:n}),w.jsx("span",{children:d})]})]}),r?w.jsx("time",{children:r}):null]})}function IA({items:n,botLabel:i,onOpenFile:r}){const{locale:u}=wt();return w.jsxs("div",{className:"bot-chat",children:[w.jsx(GA,{}),n.length===0?w.jsx(QA,{}):null,n.map(s=>s.kind==="in"?w.jsxs("div",{className:"mail-row",children:[w.jsx(HA,{mail:s.mail,label:i(s.mail.from),onOpenFile:r}),es(s.time,u)?w.jsx("time",{children:es(s.time,u)}):null]},s.id):w.jsx(VA,{item:s,items:n,botLabel:i},s.id))]})}function VA({item:n,items:i,botLabel:r}){const{t:u,locale:s}=wt(),c=UA(n,i),d=c?Y0(c,r(c)):u("inbox.other");return w.jsxs("div",{className:"bot-out",children:[w.jsx("div",{className:"user-bubble",children:n.text}),w.jsx("span",{children:u("inbox.sentTo",{name:d})}),es(n.time,s)?w.jsx("time",{children:es(n.time,s)}):null]})}function GA(){const{t:n}=wt();return w.jsx("p",{className:"bot-chat-lead",children:n("inbox.lead")})}function QA(){const{t:n}=wt();return w.jsx("p",{className:"empty-thread",children:n("inbox.empty")})}function es(n,i){if(!n)return"";const r=new Date(n);return Number.isNaN(r.getTime())?"":r.toLocaleTimeString(i==="zh"?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"})}function XA(){return w.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[w.jsx("path",{d:"M4 13.2 6.4 5.5h11.2L20 13.2",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),w.jsx("path",{d:"M4 13.2h4.1l1.1 2h5.6l1.1-2H20V19a1.4 1.4 0 0 1-1.4 1.4H5.4A1.4 1.4 0 0 1 4 19Z",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})}function ZA({root:n,marks:i,busyId:r}){const u=F.useRef(null),[s,c]=F.useState(i.at(-1)?.id??""),[d,h]=F.useState(null),[m,g]=F.useState({top:!1,bottom:!1}),y=i.map(v=>v.id).join("\0");F.useEffect(()=>{const v=n.current;if(!v||i.length<2)return;const k=()=>{const A=v.getBoundingClientRect().top,R=v.scrollHeight-v.scrollTop-v.clientHeight<48;let C=i[0]?.id??"";if(R)C=i.at(-1)?.id??C;else for(const I of i){const G=v.querySelector(`[data-turn="${CSS.escape(I.id)}"]`);G instanceof HTMLElement&&G.getBoundingClientRect().top-A<=36&&(C=I.id)}c(I=>I===C?I:C)};return k(),v.addEventListener("scroll",k,{passive:!0}),()=>v.removeEventListener("scroll",k)},[n,i,y]),F.useEffect(()=>{const v=u.current,k=v?.querySelector('[aria-current="true"]');if(!v||!k)return;const A=k.offsetTop-(v.clientHeight-k.offsetHeight)/2;v.scrollTop=Math.max(0,A);const R=v.scrollTop>1,C=v.scrollTop<v.scrollHeight-v.clientHeight-1;g(I=>I.top===R&&I.bottom===C?I:{top:R,bottom:C})},[s,y]);const{t:p}=wt();if(i.length<2)return null;const S=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;return w.jsx("nav",{ref:u,className:["turn-rail",m.top?"fade-top":"",m.bottom?"fade-bottom":""].filter(Boolean).join(" "),"aria-label":p("turn.rail"),onMouseLeave:()=>h(null),children:i.map((v,k)=>{const A=v.id===s;return w.jsx("button",{type:"button",className:["turn-mark",A?"active":"",v.id===d?"preview":"",v.id===r?"busy":""].filter(Boolean).join(" "),"aria-current":A?"true":void 0,"aria-label":p("turn.jump",{index:String(k+1)}),onMouseEnter:()=>h(v.id),onFocus:()=>h(v.id),onBlur:()=>h(R=>R===v.id?null:R),onClick:()=>{n.current?.querySelector(`[data-turn="${CSS.escape(v.id)}"]`)?.scrollIntoView({block:"start",behavior:S?"auto":"smooth"})}},v.id)})})}function FA(n){const i=[],r=new Set;for(const u of n){if(u.kind==="user"){i.push({id:u.id});continue}const s=u.turn??-1;r.has(s)||(r.add(s),i.push({id:`turn:${s}`}))}return i}function V0(n){return Array.isArray(n)?n.filter(i=>i?.type==="text"&&typeof i.text=="string").map(i=>i.text??"").join(`
56
- `).trim():""}function nh(n){const i=n.message;return i&&typeof i=="object"?i:Array.isArray(n.content)||typeof n.toolCallId=="string"?n:null}function ts(n){if(typeof n=="string")return n;if(n&&typeof n=="object")try{return JSON.stringify(n)}catch{return""}return""}function Qe(n){return typeof n=="number"?n:void 0}function KA(n){if(!n||typeof n!="object")return null;const i=n;if(i.kind==="error"){const r=typeof i.error?.message=="string"&&i.error.message!==""?i.error.message:"This turn failed",u=typeof i.error?.code=="string"?i.error.code:void 0;return{message:r,...u?{code:u}:{}}}return i.kind==="interrupted"?{message:"The DSH process exited before this turn finished.",code:"INTERRUPTED"}:i.kind==="aborted"&&i.reason?.kind==="hook"&&i.reason.reason==="deepseek-account/signed-out"?{message:"Stopped because you signed out of DeepSeek.",code:"ACCOUNT_SIGNED_OUT"}:null}function gs(n,i){return`${n??""}:${i??""}`}function G0(n){const i=[];return nr(n,i),i.flatMap(r=>typeof r.seq!="number"||typeof r.type!="string"?[]:[r])}function nr(n,i){if(!n||typeof n!="object")return;if(Array.isArray(n)){for(const u of n)nr(u,i);return}const r=n;if(typeof r.type=="string"&&r.type.includes("/")&&("data"in r||"seq"in r)){i.push(r);return}r.event&&nr(r.event,i),r.value&&r.value!==n&&nr(r.value,i),Array.isArray(r.events)&&nr(r.events,i),Array.isArray(r.records)&&nr(r.records,i)}function ys(n){return n.sort((i,r)=>i.seq-r.seq)}function JA(n,i){const r=n.findIndex(u=>u.kind==="user"&&u.optimistic&&u.text.trim()===i.text.trim());if(r>=0){const u=n.slice(),s=u[r];return!s||s.kind!=="user"?n:(u[r]={...s,optimistic:!1,time:i.time??s.time,seq:i.seq,turn:i.turn},u)}return ys([...n,i])}function bs(n,i){const r=i.trim();if(!r)return"";try{const u=JSON.parse(r),s=typeof u.command=="string"?u.command:"",c=typeof u.description=="string"?u.description:"",d=["path","file_path","file","target_file","target"].map(m=>u[m]).find(m=>typeof m=="string"),h=typeof u.query=="string"?u.query:typeof u.pattern=="string"?u.pattern:typeof u.prompt=="string"?u.prompt:"";return(s||(typeof d=="string"?d:"")||h||c||n).replace(/\s+/g," ").trim()}catch{return r.replace(/\s+/g," ").trim()}}function Q0(n){const i=n.toLowerCase();return i==="bash"||i==="shell"||i.includes("command")||i.includes("exec")?"commands":i.includes("image")?"readImage":i.includes("read")||i==="cat"?"read":i.includes("edit")||i.includes("patch")||i.includes("replace")?"edit":i.includes("write")?"write":i.includes("grep")||i.includes("glob")||i.includes("search")||i.includes("find")?"search":i.includes("webfetch")||i.includes("fetch")||i.includes("browse")?"webFetch":i.includes("web")?"webSearch":i.includes("plan")?"plan":i.includes("agent")||i.includes("task")?"subagents":"tools"}const X0={commands:"Running commands",read:"Reading files",readImage:"Reading images",write:"Writing files",edit:"Editing files",search:"Searching code",webSearch:"Searching the web",webFetch:"Visiting web pages",plan:"Updating the plan",subagents:"Coordinating subagents",tools:"Calling tools",thinking:"Thinking"},Z0={commands:"Ran commands",read:"Read files",readImage:"Read images",write:"Wrote files",edit:"Edited files",search:"Searched code",webSearch:"Searched the web",webFetch:"Visited web pages",plan:"Updated the plan",subagents:"Coordinated subagents",tools:"Called tools",thinking:"Analysis completed"},$A={bash:"Bash",shell:"Bash",write:"Write",edit:"Edit",apply_patch:"Edit",str_replace_editor:"Edit",read:"Read",grep:"Grep",glob:"Glob",web_search:"Search",websearch:"Search",webfetch:"Fetch",web_fetch:"Fetch"};function F0(n){const i=Q0(n.name);return n.running?X0[i]??"Calling tools":$A[n.name.toLowerCase()]??(n.name&&n.name!=="tool"?n.name:Z0[i]??"Called tools")}function WA(n,i=!1){const r=new Set;for(const m of n)m.kind==="tool"&&r.add(Q0(m.name));r.size===0&&r.add("thinking");const u=i?X0:Z0,c=["commands","write","edit","read","readImage","search","webSearch","webFetch","tools","thinking"].filter(m=>r.has(m)).slice(0,3).map(m=>u[m]??m),d=c[0];if(!d)return"Analysis completed";if(c.length===1)return d;const h=c.slice(1).map(m=>m.charAt(0).toLowerCase()+m.slice(1));return c.length===2?`${d} and ${h[0]}`:[d,...h].join(", ")}function K0(n){const i=[];let r=[];const u=()=>{const s=r[0];s&&(i.push({type:"activity",id:s.id,segments:r}),r=[])};for(const s of n)s.kind==="assistant"?(u(),i.push({type:"text",segment:s})):(s.kind==="think"||s.kind==="tool")&&r.push(s);return u(),i}function PA(n){let i;try{const s=JSON.parse(n.args);if(!s||typeof s!="object")return null;i=s}catch{return null}const r=n.name.toLowerCase(),u=e3(i,["file_path","path","file"]);if(!u)return null;if(r==="write"){const s=typeof i.content=="string"?i.content:"",c=ns(s).map(d=>({kind:"add",text:d}));return r1(u,s.length,c,c.length,0)}if(r==="edit"||r==="apply_patch"||r==="str_replace_editor"){const s=typeof i.old_string=="string"?i.old_string:typeof i.old_str=="string"?i.old_str:null,c=typeof i.new_string=="string"?i.new_string:typeof i.new_str=="string"?i.new_str:typeof i.content=="string"?i.content:typeof i.file_text=="string"?i.file_text:"",d=s==null||s===""?ns(c).map(g=>({kind:"add",text:g})):t3(s,c),h=d.filter(g=>g.kind==="add").length,m=d.filter(g=>g.kind==="del").length;return r1(u,c.length,d,h,m)}return null}function r1(n,i,r,u,s){const c=n.split("/").filter(Boolean).at(-1)??n;return{path:n,name:c,language:n3(c),kilobytes:Math.max(1,Math.ceil(i/1024)),added:u,removed:s,lines:r}}function e3(n,i){for(const r of i){const u=n[r];if(typeof u=="string"&&u.trim())return u.trim()}return""}function ns(n){return n===""?[]:(n.endsWith(`
52
+ `))}function m(v,k,A,R){const C=A.enter("tableCell"),I=A.enter("phrasing"),G=A.containerPhrasing(v,{...R,before:c,after:c});return I(),C(),G}function g(v,k){return K2(v,{align:k,alignDelimiters:u,fillRows:!1,padding:r,stringLength:s})}function y(v,k,A){const{children:R}=v;let C=-1;const I=[],G=k.enter("table");for(;++C<R.length;)I[C]=p(R[C],k,A);return G(),I}function p(v,k,A){const{children:R}=v;let C=-1;const I=[],G=k.enter("tableRow");for(;++C<R.length;)I[C]=m(R[C],v,k,A);return G(),I}function S(v,k,A){const R=Od.inlineCode(v,k,A);if(!A.stack.includes("tableCell"))return R;const C=[];let I=0,G=R.indexOf("|");for(;G!==-1;){let ne=G;for(;ne>I&&R.charCodeAt(ne-1)===92;)ne--;C.push(R.slice(I,G)),(G-ne)%2===0&&C.push("\\"),I=G,G=R.indexOf("|",G+1)}return C.push(R.slice(I)),C.join("")}}function IC(n,i,r,u){if(n.type==="table"&&r.type==="listItem"&&r.spread===!1&&(i.type==="definition"||i.type==="heading"&&VC(i,u)||i.type==="paragraph"||i.type==="table"))return 1}function VC(n,i){let r=!1;return ds(n,function(u){if(u.type==="break"||"value"in u&&/\r?\n|\r/.test(u.value))return r=!0,uu}),!!((!n.depth||n.depth<3)&&us(n)&&(i.options.setext||r))}function GC(){return{exit:{taskListCheckValueChecked:l1,taskListCheckValueUnchecked:l1,paragraph:XC}}}function QC(){return{handlers:{paragraph:ZC},join:[FC]}}function l1(n){const i=this.stack[this.stack.length-2];i.type,i.checked=n.type==="taskListCheckValueChecked"}function XC(n){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const u=r.children[0];if(u&&u.type==="text"){const s=i.children;let c=-1,d;for(;++c<s.length;){const h=s[c];if(h.type==="paragraph"){d=h;break}}d===r&&(u.value=u.value.slice(1),u.value.length===0?r.children.shift():r.position&&u.position&&typeof u.position.start.offset=="number"&&(u.position.start.column++,u.position.start.offset++,r.position.start={...u.position.start}))}}this.exit(n)}function ZC(n,i,r,u){if(!i||i.type!=="listItem"||M0(i)!==n)return Od.paragraph(n,i,r,u);const s="["+(i.checked?"x":" ")+"] ",c=r.createTracker(u);c.move(s);const d=Od.paragraph(n.children.length>0?n:{type:"paragraph",children:[{type:"text",value:" "}]},i,r,{...u,...c.current()});return s+d}function FC(n,i,r){if(!(n.type==="definition"&&r.type==="listItem"))return;const u=M0(r);if(u&&r.children.indexOf(n)<r.children.indexOf(u))return 0}function M0(n){if(typeof n.checked=="boolean")for(const i of n.children){if(i.type==="paragraph")return i;if(i.type!=="definition")return}}function KC(){return[m2(),U2(),I2(),RC(),GC()]}function JC(n){return{extensions:[p2(),q2(n),V2(),YC(n),QC()]}}const $C={tokenize:lA,partial:!0},D0={tokenize:iA,partial:!0},R0={tokenize:rA,partial:!0},L0={tokenize:aA,partial:!0},WC={tokenize:uA,partial:!0},B0={name:"wwwAutolink",tokenize:tA,previous:q0},U0={name:"protocolAutolink",tokenize:nA,previous:H0},Yl={name:"emailAutolink",tokenize:eA,previous:Y0},xl={};function PC(){return{text:xl}}let Pi=48;for(;Pi<123;)xl[Pi]=Yl,Pi++,Pi===58?Pi=65:Pi===91&&(Pi=97);xl[43]=Yl;xl[45]=Yl;xl[46]=Yl;xl[95]=Yl;xl[72]=[Yl,U0];xl[104]=[Yl,U0];xl[87]=[Yl,B0];xl[119]=[Yl,B0];function eA(n,i,r){const u=this;let s,c;return d;function d(p){return!_d(p)||!Y0.call(u,u.previous)||eh(u.events)?r(p):(n.enter("literalAutolink"),n.enter("literalAutolinkEmail"),h(p))}function h(p){return _d(p)?(n.consume(p),h):p===64?(n.consume(p),m):r(p)}function m(p){return p===46?n.check(WC,y,g)(p):p===45||p===95||Jt(p)?(c=!0,n.consume(p),m):y(p)}function g(p){return n.consume(p),s=!0,m}function y(p){return c&&s&&Kt(u.previous)?(n.exit("literalAutolinkEmail"),n.exit("literalAutolink"),i(p)):r(p)}}function tA(n,i,r){const u=this;return s;function s(d){return d!==87&&d!==119||!q0.call(u,u.previous)||eh(u.events)?r(d):(n.enter("literalAutolink"),n.enter("literalAutolinkWww"),n.check($C,n.attempt(D0,n.attempt(R0,c),r),r)(d))}function c(d){return n.exit("literalAutolinkWww"),n.exit("literalAutolink"),i(d)}}function nA(n,i,r){const u=this;let s="",c=!1;return d;function d(p){return(p===72||p===104)&&H0.call(u,u.previous)&&!eh(u.events)?(n.enter("literalAutolink"),n.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),n.consume(p),h):r(p)}function h(p){if(Kt(p)&&s.length<5)return s+=String.fromCodePoint(p),n.consume(p),h;if(p===58){const S=s.toLowerCase();if(S==="http"||S==="https")return n.consume(p),m}return r(p)}function m(p){return p===47?(n.consume(p),c?g:(c=!0,m)):r(p)}function g(p){return p===null||Ko(p)||ut(p)||ir(p)||du(p)?r(p):n.attempt(D0,n.attempt(R0,y),r)(p)}function y(p){return n.exit("literalAutolinkHttp"),n.exit("literalAutolink"),i(p)}}function lA(n,i,r){let u=0;return s;function s(d){return(d===87||d===119)&&u<3?(u++,n.consume(d),s):d===46&&u===3?(n.consume(d),c):r(d)}function c(d){return d===null?r(d):i(d)}}function iA(n,i,r){let u,s,c;return d;function d(g){return g===46||g===95?n.check(L0,m,h)(g):g===null||ut(g)||ir(g)||g!==45&&du(g)?m(g):(c=!0,n.consume(g),d)}function h(g){return g===95?u=!0:(s=u,u=void 0),n.consume(g),d}function m(g){return s||u||!c?r(g):i(g)}}function rA(n,i){let r=0,u=0;return s;function s(d){return d===40?(r++,n.consume(d),s):d===41&&u<r?c(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?n.check(L0,i,c)(d):d===null||ut(d)||ir(d)?i(d):(n.consume(d),s)}function c(d){return d===41&&u++,n.consume(d),s}}function aA(n,i,r){return u;function u(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(n.consume(h),u):h===38?(n.consume(h),c):h===93?(n.consume(h),s):h===60||h===null||ut(h)||ir(h)?i(h):r(h)}function s(h){return h===null||h===40||h===91||ut(h)||ir(h)?i(h):u(h)}function c(h){return Kt(h)?d(h):r(h)}function d(h){return h===59?(n.consume(h),u):Kt(h)?(n.consume(h),d):r(h)}}function uA(n,i,r){return u;function u(c){return n.consume(c),s}function s(c){return Jt(c)?r(c):i(c)}}function q0(n){return n===null||n===40||n===42||n===95||n===91||n===93||n===126||ut(n)}function H0(n){return!Kt(n)}function Y0(n){return!(n===47||_d(n))}function _d(n){return n===43||n===45||n===46||n===95||Jt(n)}function eh(n){let i=n.length,r=!1;for(;i--;){const u=n[i][1];if((u.type==="labelLink"||u.type==="labelImage")&&!u._balanced){r=!0;break}if(u._gfmAutolinkLiteralWalkedInto){r=!1;break}}return n.length>0&&!r&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const oA={tokenize:gA,partial:!0};function sA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hA,continuation:{tokenize:mA},exit:pA}},text:{91:{name:"gfmFootnoteCall",tokenize:dA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:cA,resolveTo:fA}}}}function cA(n,i,r){const u=this;let s=u.events.length;const c=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let d;for(;s--;){const m=u.events[s][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return h;function h(m){if(!d||!d._balanced)return r(m);const g=el(u.sliceSerialize({start:d.end,end:u.now()}));return g.codePointAt(0)!==94||!c.includes(g.slice(1))?r(m):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(m),n.exit("gfmFootnoteCallLabelMarker"),i(m))}}function fA(n,i){let r=n.length;for(;r--;)if(n[r][1].type==="labelImage"&&n[r][0]==="enter"){n[r][1];break}n[r+1][1].type="data",n[r+3][1].type="gfmFootnoteCallLabelMarker";const u={type:"gfmFootnoteCall",start:Object.assign({},n[r+3][1].start),end:Object.assign({},n[n.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},n[r+3][1].end),end:Object.assign({},n[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},n[n.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[n[r+1],n[r+2],["enter",u,i],n[r+3],n[r+4],["enter",s,i],["exit",s,i],["enter",c,i],["enter",d,i],["exit",d,i],["exit",c,i],n[n.length-2],n[n.length-1],["exit",u,i]];return n.splice(r,n.length-r+1,...h),n}function dA(n,i,r){const u=this,s=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c=0,d;return h;function h(p){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(p),n.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?r(p):(n.enter("gfmFootnoteCallMarker"),n.consume(p),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",g)}function g(p){if(c>999||p===93&&!d||p===null||p===91||ut(p))return r(p);if(p===93){n.exit("chunkString");const S=n.exit("gfmFootnoteCallString");return s.includes(el(u.sliceSerialize(S)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(p),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),i):r(p)}return ut(p)||(d=!0),c++,n.consume(p),p===92?y:g}function y(p){return p===91||p===92||p===93?(n.consume(p),c++,g):g(p)}}function hA(n,i,r){const u=this,s=u.parser.gfmFootnotes||(u.parser.gfmFootnotes=[]);let c,d=0,h;return m;function m(k){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(k){return k===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",y):r(k)}function y(k){if(d>999||k===93&&!h||k===null||k===91||ut(k))return r(k);if(k===93){n.exit("chunkString");const A=n.exit("gfmFootnoteDefinitionLabelString");return c=el(u.sliceSerialize(A)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(k),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),S}return ut(k)||(h=!0),d++,n.consume(k),k===92?p:y}function p(k){return k===91||k===92||k===93?(n.consume(k),d++,y):y(k)}function S(k){return k===58?(n.enter("definitionMarker"),n.consume(k),n.exit("definitionMarker"),s.includes(c)||s.push(c),Ke(n,v,"gfmFootnoteDefinitionWhitespace")):r(k)}function v(k){return i(k)}}function mA(n,i,r){return n.check(hu,i,n.attempt(oA,i,r))}function pA(n){n.exit("gfmFootnoteDefinition")}function gA(n,i,r){const u=this;return Ke(n,s,"gfmFootnoteDefinitionIndent",5);function s(c){const d=u.events[u.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?i(c):r(c)}}function yA(n){let r=(n||{}).singleTilde;const u={name:"strikethrough",tokenize:c,resolveAll:s};return r==null&&(r=!0),{text:{126:u},insideSpan:{null:[u]},attentionMarkers:{null:[126]}};function s(d,h){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let g=m;for(;g--;)if(d[g][0]==="exit"&&d[g][1].type==="strikethroughSequenceTemporary"&&d[g][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[g][1].end.offset-d[g][1].start.offset){d[m][1].type="strikethroughSequence",d[g][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},d[g][1].start),end:Object.assign({},d[m][1].end)},p={type:"strikethroughText",start:Object.assign({},d[g][1].end),end:Object.assign({},d[m][1].start)},S=[["enter",y,h],["enter",d[g][1],h],["exit",d[g][1],h],["enter",p,h]],v=h.parser.constructs.insideSpan.null;v&&Pn(S,S.length,0,os(v,d.slice(g+1,m),h)),Pn(S,S.length,0,[["exit",p,h],["enter",d[m][1],h],["exit",d[m][1],h],["exit",y,h]]),Pn(d,g-1,m-g+3,S),m=g+S.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function c(d,h,m){const g=this.previous,y=this.events;let p=0;return S;function S(k){return g===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(d.enter("strikethroughSequenceTemporary"),v(k))}function v(k){const A=Ti(g);if(k===126)return p>1?m(k):(d.consume(k),p++,v);if(p<2&&!r)return m(k);const R=d.exit("strikethroughSequenceTemporary"),C=Ti(k);return R._open=!C||C===2&&!!A,R._close=!A||A===2&&!!C,h(k)}}}class bA{constructor(){this.map=[],this.index=new Map}add(i,r,u){vA(this,i,r,u)}consume(i){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const u=[];for(;r>0;)r-=1,u.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];u.push(i.slice()),i.length=0;let s=u.pop();for(;s;){for(const c of s)i.push(c);s=u.pop()}this.map.length=0,this.index.clear()}}function vA(n,i,r,u){if(r===0&&u.length===0)return;const s=n.index.get(i);if(s){s[1]+=r,s[2].push(...u);return}const c=[i,r,u];n.map.push(c),n.index.set(i,c)}function xA(n,i){let r=!1;const u=[];for(;i<n.length;){const s=n[i];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&u.push(n[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(n[i-1][1].type==="tableDelimiterMarker"){const c=u.length-1;u[c]=u[c]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);i+=1}return u}function SA(){return{flow:{null:{name:"table",tokenize:wA,resolveAll:kA}}}}function wA(n,i,r){const u=this;let s=0,c=0,d;return h;function h(U){let $=u.events.length-1;for(;$>-1;){const{type:Ue}=u.events[$][1];if(Ue==="lineEnding"||Ue==="linePrefix")$--;else break}const ue=$>-1?u.events[$][1].type:null,Ce=ue==="tableHead"||ue==="tableRow"?H:m;return Ce===H&&u.parser.lazy[u.now().line]?r(U):Ce(U)}function m(U){return n.enter("tableHead"),n.enter("tableRow"),g(U)}function g(U){return U===124||(d=!0,c+=1),y(U)}function y(U){return U===null?r(U):Se(U)?c>1?(c=0,u.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(U),n.exit("lineEnding"),v):r(U):Be(U)?Ke(n,y,"whitespace")(U):(c+=1,d&&(d=!1,s+=1),U===124?(n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),d=!0,y):(n.enter("data"),p(U)))}function p(U){return U===null||U===124||ut(U)?(n.exit("data"),y(U)):(n.consume(U),U===92?S:p)}function S(U){return U===92||U===124?(n.consume(U),p):p(U)}function v(U){return u.interrupt=!1,u.parser.lazy[u.now().line]?r(U):(n.enter("tableDelimiterRow"),d=!1,Be(U)?Ke(n,k,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):k(U))}function k(U){return U===45||U===58?R(U):U===124?(d=!0,n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),A):le(U)}function A(U){return Be(U)?Ke(n,R,"whitespace")(U):R(U)}function R(U){return U===58?(c+=1,d=!0,n.enter("tableDelimiterMarker"),n.consume(U),n.exit("tableDelimiterMarker"),C):U===45?(c+=1,C(U)):U===null||Se(U)?ne(U):le(U)}function C(U){return U===45?(n.enter("tableDelimiterFiller"),I(U)):le(U)}function I(U){return U===45?(n.consume(U),I):U===58?(d=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(U),n.exit("tableDelimiterMarker"),G):(n.exit("tableDelimiterFiller"),G(U))}function G(U){return Be(U)?Ke(n,ne,"whitespace")(U):ne(U)}function ne(U){return U===124?k(U):U===null||Se(U)?!d||s!==c?le(U):(n.exit("tableDelimiterRow"),n.exit("tableHead"),i(U)):le(U)}function le(U){return r(U)}function H(U){return n.enter("tableRow"),Z(U)}function Z(U){return U===124?(n.enter("tableCellDivider"),n.consume(U),n.exit("tableCellDivider"),Z):U===null||Se(U)?(n.exit("tableRow"),i(U)):Be(U)?Ke(n,Z,"whitespace")(U):(n.enter("data"),K(U))}function K(U){return U===null||U===124||ut(U)?(n.exit("data"),Z(U)):(n.consume(U),U===92?de:K)}function de(U){return U===92||U===124?(n.consume(U),K):K(U)}}function kA(n,i){let r=-1,u=!0,s=0,c=[0,0,0,0],d=[0,0,0,0],h=!1,m=0,g,y,p;const S=new bA;for(;++r<n.length;){const v=n[r],k=v[1];v[0]==="enter"?k.type==="tableHead"?(h=!1,m!==0&&(i1(S,i,m,g,y),y=void 0,m=0),g={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},S.add(r,0,[["enter",g,i]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(u=!0,p=void 0,c=[0,0,0,0],d=[0,r+1,0,0],h&&(h=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},S.add(r,0,[["enter",y,i]])),s=k.type==="tableDelimiterRow"?2:y?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(u=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],p=Xo(S,i,c,s,void 0,p),c=[0,0,0,0]),d[2]=r)):k.type==="tableCellDivider"&&(u?u=!1:(c[1]!==0&&(d[0]=d[1],p=Xo(S,i,c,s,void 0,p)),c=d,d=[c[1],r,0,0])):k.type==="tableHead"?(h=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],p=Xo(S,i,c,s,r,p)):d[1]!==0&&(p=Xo(S,i,d,s,r,p)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&i1(S,i,m,g,y),S.consume(i.events),r=-1;++r<i.events.length;){const v=i.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=xA(i.events,r))}return n}function Xo(n,i,r,u,s,c){const d=u===1?"tableHeader":u===2?"tableDelimiter":"tableData",h="tableContent";r[0]!==0&&(c.end=Object.assign({},Fr(i.events,r[0])),n.add(r[0],0,[["exit",c,i]]));const m=Fr(i.events,r[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},n.add(r[1],0,[["enter",c,i]]),r[2]!==0){const g=Fr(i.events,r[2]),y=Fr(i.events,r[3]),p={type:h,start:Object.assign({},g),end:Object.assign({},y)};if(n.add(r[2],0,[["enter",p,i]]),u!==2){const S=i.events[r[2]],v=i.events[r[3]];if(S[1].end=Object.assign({},v[1].end),S[1].type="chunkText",S[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,A=r[3]-r[2]-1;n.add(k,A,[])}}n.add(r[3]+1,0,[["exit",p,i]])}return s!==void 0&&(c.end=Object.assign({},Fr(i.events,s)),n.add(s,0,[["exit",c,i]]),c=void 0),c}function i1(n,i,r,u,s){const c=[],d=Fr(i.events,r);s&&(s.end=Object.assign({},d),c.push(["exit",s,i])),u.end=Object.assign({},d),c.push(["exit",u,i]),n.add(r+1,0,c)}function Fr(n,i){const r=n[i],u=r[0]==="enter"?"start":"end";return r[1][u]}const TA={name:"tasklistCheck",tokenize:CA};function EA(){return{text:{91:TA}}}function CA(n,i,r){const u=this;return s;function s(m){return u.previous!==null||!u._gfmTasklistFirstContentOfListItem?r(m):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),c)}function c(m){return ut(m)?(n.enter("taskListCheckValueUnchecked"),n.consume(m),n.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(n.enter("taskListCheckValueChecked"),n.consume(m),n.exit("taskListCheckValueChecked"),d):r(m)}function d(m){return m===93?(n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),h):r(m)}function h(m){return Se(m)?i(m):Be(m)?n.check({tokenize:AA},i,r)(m):r(m)}}function AA(n,i,r){return Ke(n,u,"whitespace");function u(s){return s===null?r(s):i(s)}}function NA(n){return Z1([PC(),sA(),yA(n),SA(),EA()])}const zA={};function OA(n){const i=this,r=n||zA,u=i.data(),s=u.micromarkExtensions||(u.micromarkExtensions=[]),c=u.fromMarkdownExtensions||(u.fromMarkdownExtensions=[]),d=u.toMarkdownExtensions||(u.toMarkdownExtensions=[]);s.push(NA(r)),c.push(KC()),d.push(JC(r))}function _A({text:n,language:i}){const[r,u]=F.useState(!1);return w.jsxs("div",{className:"code-block",children:[w.jsxs("div",{className:"code-banner",children:[w.jsx("span",{className:"code-lang",children:i||"Code block"}),w.jsx("button",{type:"button",className:"code-copy","aria-label":r?"Copied":"Copy",onClick:()=>{navigator.clipboard.writeText(n).then(()=>{u(!0),window.setTimeout(()=>u(!1),1e3)})},children:r?"Copied":"Copy"})]}),w.jsx("pre",{children:w.jsx("code",{children:n})})]})}function jA({children:n}){const i=F.Children.toArray(n)[0];if(F.isValidElement(i)){const r=i,u=String(r.props.children??"").replace(/\n$/,""),s=/language-([\w-]+)/.exec(r.props.className??"");return w.jsx(_A,{text:u,language:s?.[1]})}return w.jsx("pre",{children:n})}function MA(n){if(!n||/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("#")||n.startsWith("//")||n.startsWith("?"))return null;const i=n.indexOf("#"),r=i<0?n:n.slice(0,i);if(r.includes("?"))return null;let u;try{u=decodeURIComponent(r)}catch{return null}const s=/:(\d+)$/.exec(u);if(s&&(u=u.slice(0,-s[0].length)),!u||/[\u0000-\u001f\\]/.test(u)||u.split("/").includes(".."))return null;const c=s?Number(s[1]):void 0;return c!=null&&Number.isSafeInteger(c)&&c>0?{path:u,line:c}:{path:u}}function DA(n,i){return{pre:jA,code({className:r,children:u}){return w.jsx("code",{className:r,children:u})},table({children:r}){return w.jsx("div",{className:"table-scroll",children:w.jsx("table",{children:r})})},a({href:r,children:u}){const s=n?null:MA(r);return s&&i?w.jsx("button",{type:"button",className:"file-mention",title:s.path,onClick:()=>i(s.path,s.line),children:u}):w.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:u})}}}function RA(n,i){if(!i)return n;const r=n.match(/```/g);return r&&r.length%2===1?`${n}
53
+ \`\`\``:n}function th({text:n,streaming:i=!1,onOpenFile:r}){const u=F.useMemo(()=>DA(i,r),[i,r]);return w.jsx("div",{className:i?"markdown streaming":"markdown",children:w.jsx(i2,{remarkPlugins:[OA],components:u,children:RA(n,i)})})}function LA({mail:n,label:i,onOpenFile:r}){const{t:u}=wt(),s=_1(n.from,i),c=/^\d+$/.test(n.hop)?n.hop:"",d=[n.id?`id ${n.id}`:"",`from ${n.from}`,n.correlation?`correlation ${n.correlation}`:"",n.causation?`causation ${n.causation}`:""].filter(Boolean).join(`
54
+ `);return w.jsxs("article",{className:"mail-card",children:[w.jsxs("header",{className:"mail-head",children:[w.jsx("span",{className:"bot-badge",children:"BOT"}),w.jsxs("span",{className:"mail-who",children:[w.jsx("strong",{children:s}),w.jsx("span",{children:u("inbox.received")})]}),c?w.jsx("span",{className:"mail-hop",children:u("inbox.hop",{hop:c})}):null]}),n.body?w.jsx("div",{className:"mail-body",children:w.jsx(th,{text:n.body,onOpenFile:r})}):null,w.jsx("p",{className:"mail-note",children:u("inbox.lead")}),d?w.jsxs("details",{className:"mail-details",children:[w.jsx("summary",{children:u("inbox.source")}),w.jsx("pre",{children:d})]}):null]})}function BA({who:n,preview:i,time:r,mark:u,onOpen:s}){const{t:c}=wt(),d=i||c("inbox.received");return w.jsxs("div",{className:"inbox-line","data-turn":u,children:[w.jsxs("button",{type:"button",className:"inbox-entry",onClick:s,"aria-label":c("inbox.open",{who:n,line:d}),children:[w.jsx("span",{className:"inbox-icon",children:w.jsx(IA,{})}),w.jsxs("span",{className:"inbox-copy",children:[w.jsx("strong",{children:n}),w.jsx("span",{children:d})]})]}),r?w.jsx("time",{children:r}):null]})}function UA({items:n,botLabel:i,onOpenFile:r}){const{locale:u}=wt();return w.jsxs("div",{className:"bot-chat",children:[w.jsx(HA,{}),n.length===0?w.jsx(YA,{}):null,n.map(s=>s.kind==="in"?w.jsxs("div",{className:"mail-row",children:[w.jsx(LA,{mail:s.mail,label:i(s.mail.from),onOpenFile:r}),es(s.time,u)?w.jsx("time",{children:es(s.time,u)}):null]},s.id):w.jsx(qA,{item:s,items:n,botLabel:i},s.id))]})}function qA({item:n,items:i,botLabel:r}){const{t:u,locale:s}=wt(),c=IS(n,i),d=c?_1(c,r(c)):u("inbox.other");return w.jsxs("div",{className:"bot-out",children:[w.jsx("div",{className:"user-bubble",children:n.text}),w.jsx("span",{children:u("inbox.sentTo",{name:d})}),es(n.time,s)?w.jsx("time",{children:es(n.time,s)}):null]})}function HA(){const{t:n}=wt();return w.jsx("p",{className:"bot-chat-lead",children:n("inbox.lead")})}function YA(){const{t:n}=wt();return w.jsx("p",{className:"empty-thread",children:n("inbox.empty")})}function es(n,i){if(!n)return"";const r=new Date(n);return Number.isNaN(r.getTime())?"":r.toLocaleTimeString(i==="zh"?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"})}function IA(){return w.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[w.jsx("path",{d:"M4 13.2 6.4 5.5h11.2L20 13.2",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),w.jsx("path",{d:"M4 13.2h4.1l1.1 2h5.6l1.1-2H20V19a1.4 1.4 0 0 1-1.4 1.4H5.4A1.4 1.4 0 0 1 4 19Z",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})}function VA({root:n,marks:i,busyId:r}){const u=F.useRef(null),[s,c]=F.useState(i.at(-1)?.id??""),[d,h]=F.useState(null),[m,g]=F.useState({top:!1,bottom:!1}),y=i.map(v=>v.id).join("\0");F.useEffect(()=>{const v=n.current;if(!v||i.length<2)return;const k=()=>{const A=v.getBoundingClientRect().top,R=v.scrollHeight-v.scrollTop-v.clientHeight<48;let C=i[0]?.id??"";if(R)C=i.at(-1)?.id??C;else for(const I of i){const G=v.querySelector(`[data-turn="${CSS.escape(I.id)}"]`);G instanceof HTMLElement&&G.getBoundingClientRect().top-A<=36&&(C=I.id)}c(I=>I===C?I:C)};return k(),v.addEventListener("scroll",k,{passive:!0}),()=>v.removeEventListener("scroll",k)},[n,i,y]),F.useEffect(()=>{const v=u.current,k=v?.querySelector('[aria-current="true"]');if(!v||!k)return;const A=k.offsetTop-(v.clientHeight-k.offsetHeight)/2;v.scrollTop=Math.max(0,A);const R=v.scrollTop>1,C=v.scrollTop<v.scrollHeight-v.clientHeight-1;g(I=>I.top===R&&I.bottom===C?I:{top:R,bottom:C})},[s,y]);const{t:p}=wt();if(i.length<2)return null;const S=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;return w.jsx("nav",{ref:u,className:["turn-rail",m.top?"fade-top":"",m.bottom?"fade-bottom":""].filter(Boolean).join(" "),"aria-label":p("turn.rail"),onMouseLeave:()=>h(null),children:i.map((v,k)=>{const A=v.id===s;return w.jsx("button",{type:"button",className:["turn-mark",A?"active":"",v.id===d?"preview":"",v.id===r?"busy":""].filter(Boolean).join(" "),"aria-current":A?"true":void 0,"aria-label":p("turn.jump",{index:String(k+1)}),onMouseEnter:()=>h(v.id),onFocus:()=>h(v.id),onBlur:()=>h(R=>R===v.id?null:R),onClick:()=>{n.current?.querySelector(`[data-turn="${CSS.escape(v.id)}"]`)?.scrollIntoView({block:"start",behavior:S?"auto":"smooth"})}},v.id)})})}function GA(n){const i=[],r=new Set;for(const u of n){if(u.kind==="user"){i.push({id:u.id});continue}const s=u.turn??-1;r.has(s)||(r.add(s),i.push({id:`turn:${s}`}))}return i}function I0(n){return Array.isArray(n)?n.filter(i=>i?.type==="text"&&typeof i.text=="string").map(i=>i.text??"").join(`
55
+ `).trim():""}function nh(n){const i=n.message;return i&&typeof i=="object"?i:Array.isArray(n.content)||typeof n.toolCallId=="string"?n:null}function ts(n){if(typeof n=="string")return n;if(n&&typeof n=="object")try{return JSON.stringify(n)}catch{return""}return""}function Qe(n){return typeof n=="number"?n:void 0}function QA(n){if(!n||typeof n!="object")return null;const i=n;if(i.kind==="error"){const r=typeof i.error?.message=="string"&&i.error.message!==""?i.error.message:"This turn failed",u=typeof i.error?.code=="string"?i.error.code:void 0;return{message:r,...u?{code:u}:{}}}return i.kind==="interrupted"?{message:"The DSH process exited before this turn finished.",code:"INTERRUPTED"}:i.kind==="aborted"&&i.reason?.kind==="hook"&&i.reason.reason==="deepseek-account/signed-out"?{message:"Stopped because you signed out of DeepSeek.",code:"ACCOUNT_SIGNED_OUT"}:null}function ps(n,i){return`${n??""}:${i??""}`}function V0(n){const i=[];return nr(n,i),i.flatMap(r=>typeof r.seq!="number"||typeof r.type!="string"?[]:[r])}function nr(n,i){if(!n||typeof n!="object")return;if(Array.isArray(n)){for(const u of n)nr(u,i);return}const r=n;if(typeof r.type=="string"&&r.type.includes("/")&&("data"in r||"seq"in r)){i.push(r);return}r.event&&nr(r.event,i),r.value&&r.value!==n&&nr(r.value,i),Array.isArray(r.events)&&nr(r.events,i),Array.isArray(r.records)&&nr(r.records,i)}function gs(n){return n.sort((i,r)=>i.seq-r.seq)}function XA(n,i){const r=n.findIndex(u=>u.kind==="user"&&u.optimistic&&u.text.trim()===i.text.trim());if(r>=0){const u=n.slice(),s=u[r];return!s||s.kind!=="user"?n:(u[r]={...s,optimistic:!1,time:i.time??s.time,seq:i.seq,turn:i.turn},u)}return gs([...n,i])}function ys(n,i){const r=i.trim();if(!r)return"";try{const u=JSON.parse(r),s=typeof u.command=="string"?u.command:"",c=typeof u.description=="string"?u.description:"",d=["path","file_path","file","target_file","target"].map(m=>u[m]).find(m=>typeof m=="string"),h=typeof u.query=="string"?u.query:typeof u.pattern=="string"?u.pattern:typeof u.prompt=="string"?u.prompt:"";return(s||(typeof d=="string"?d:"")||h||c||n).replace(/\s+/g," ").trim()}catch{return r.replace(/\s+/g," ").trim()}}function G0(n){const i=n.toLowerCase();return i==="bash"||i==="shell"||i.includes("command")||i.includes("exec")?"commands":i.includes("image")?"readImage":i.includes("read")||i==="cat"?"read":i.includes("edit")||i.includes("patch")||i.includes("replace")?"edit":i.includes("write")?"write":i.includes("grep")||i.includes("glob")||i.includes("search")||i.includes("find")?"search":i.includes("webfetch")||i.includes("fetch")||i.includes("browse")?"webFetch":i.includes("web")?"webSearch":i.includes("plan")?"plan":i.includes("agent")||i.includes("task")?"subagents":"tools"}const Q0={commands:"Running commands",read:"Reading files",readImage:"Reading images",write:"Writing files",edit:"Editing files",search:"Searching code",webSearch:"Searching the web",webFetch:"Visiting web pages",plan:"Updating the plan",subagents:"Coordinating subagents",tools:"Calling tools",thinking:"Thinking"},X0={commands:"Ran commands",read:"Read files",readImage:"Read images",write:"Wrote files",edit:"Edited files",search:"Searched code",webSearch:"Searched the web",webFetch:"Visited web pages",plan:"Updated the plan",subagents:"Coordinated subagents",tools:"Called tools",thinking:"Analysis completed"},ZA={bash:"Bash",shell:"Bash",write:"Write",edit:"Edit",apply_patch:"Edit",str_replace_editor:"Edit",read:"Read",grep:"Grep",glob:"Glob",web_search:"Search",websearch:"Search",webfetch:"Fetch",web_fetch:"Fetch"};function Z0(n){const i=G0(n.name);return n.running?Q0[i]??"Calling tools":ZA[n.name.toLowerCase()]??(n.name&&n.name!=="tool"?n.name:X0[i]??"Called tools")}function FA(n,i=!1){const r=new Set;for(const m of n)m.kind==="tool"&&r.add(G0(m.name));r.size===0&&r.add("thinking");const u=i?Q0:X0,c=["commands","write","edit","read","readImage","search","webSearch","webFetch","tools","thinking"].filter(m=>r.has(m)).slice(0,3).map(m=>u[m]??m),d=c[0];if(!d)return"Analysis completed";if(c.length===1)return d;const h=c.slice(1).map(m=>m.charAt(0).toLowerCase()+m.slice(1));return c.length===2?`${d} and ${h[0]}`:[d,...h].join(", ")}function F0(n){const i=[];let r=[];const u=()=>{const s=r[0];s&&(i.push({type:"activity",id:s.id,segments:r}),r=[])};for(const s of n)s.kind==="assistant"?(u(),i.push({type:"text",segment:s})):(s.kind==="think"||s.kind==="tool")&&r.push(s);return u(),i}function KA(n){let i;try{const s=JSON.parse(n.args);if(!s||typeof s!="object")return null;i=s}catch{return null}const r=n.name.toLowerCase(),u=JA(i,["file_path","path","file"]);if(!u)return null;if(r==="write"){const s=typeof i.content=="string"?i.content:"",c=ns(s).map(d=>({kind:"add",text:d}));return r1(u,s.length,c,c.length,0)}if(r==="edit"||r==="apply_patch"||r==="str_replace_editor"){const s=typeof i.old_string=="string"?i.old_string:typeof i.old_str=="string"?i.old_str:null,c=typeof i.new_string=="string"?i.new_string:typeof i.new_str=="string"?i.new_str:typeof i.content=="string"?i.content:typeof i.file_text=="string"?i.file_text:"",d=s==null||s===""?ns(c).map(g=>({kind:"add",text:g})):$A(s,c),h=d.filter(g=>g.kind==="add").length,m=d.filter(g=>g.kind==="del").length;return r1(u,c.length,d,h,m)}return null}function r1(n,i,r,u,s){const c=n.split("/").filter(Boolean).at(-1)??n;return{path:n,name:c,language:WA(c),kilobytes:Math.max(1,Math.ceil(i/1024)),added:u,removed:s,lines:r}}function JA(n,i){for(const r of i){const u=n[r];if(typeof u=="string"&&u.trim())return u.trim()}return""}function ns(n){return n===""?[]:(n.endsWith(`
57
56
  `)?n.slice(0,-1):n).split(`
58
- `)}function t3(n,i){const r=ns(n),u=ns(i);if(r.length>180||u.length>180)return[...r.map(y=>({kind:"del",text:y})),...u.map(y=>({kind:"add",text:y}))];const s=r.length+1,c=u.length+1,d=Array.from({length:s},()=>Array(c).fill(0));for(let y=r.length-1;y>=0;y-=1)for(let p=u.length-1;p>=0;p-=1){const S=d[y],v=d[y+1];!S||!v||(S[p]=r[y]===u[p]?(v[p+1]??0)+1:Math.max(v[p]??0,S[p+1]??0))}const h=[];let m=0,g=0;for(;m<r.length&&g<u.length;)r[m]===u[g]?(h.push({kind:"context",text:r[m]??""}),m+=1,g+=1):(d[m+1]?.[g]??0)>=(d[m]?.[g+1]??0)?(h.push({kind:"del",text:r[m]??""}),m+=1):(h.push({kind:"add",text:u[g]??""}),g+=1);for(;m<r.length;)h.push({kind:"del",text:r[m]??""}),m+=1;for(;g<u.length;)h.push({kind:"add",text:u[g]??""}),g+=1;return h}function n3(n){const i=n.split(".").pop()?.toLowerCase()??"";return{py:"python",ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",md:"markdown",css:"css",html:"html",json:"json",sh:"bash",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",rb:"ruby"}[i]??""}function J0(n){return(n.split(`
59
- `).map(r=>r.trim()).find(Boolean)??"").replaceAll("**","")}function l3(n){if(!n.drafting)return"";const i=[...n.segments].reverse().find(r=>r.kind==="tool"&&r.running);if(i){const r=bs(i.name,i.args),u=F0(i);return r?`${u} · ${r}`:u}return n.segments.some(r=>r.kind==="assistant"&&r.streaming)?"Replying":n.segments.some(r=>r.kind==="think"&&r.running)?"Thinking":"Analyzing the request"}function i3(n){const i=l3(n);return i===n.activity?n:{...n,activity:i}}function $0(n,i){const r=n.findIndex(u=>u.kind==="tool"&&u.callId===i.callId);if(r>=0){const u=n.slice(),s=u[r];if(!s||s.kind!=="tool")return n;const c=i.result||s.result;return u[r]={...s,name:i.name||s.name,args:i.args||s.args,result:c,error:i.error||s.error,running:c?!1:i.running||s.running,turn:i.turn??s.turn,step:i.step??s.step},u}return ys([...n,i])}function r3(n,i,r,u,s,c){const d=`live:${i}:`,h=n.segments.filter(y=>y.id.startsWith(d));let m=n.segments.filter(y=>!y.id.startsWith(d));const g=[];for(const y of r){const p=u+y.index/100;if(y.kind==="reasoning"&&y.text.trim())g.push({kind:"think",id:`${d}think:${y.index}`,text:y.text,running:!0,seq:p,turn:s,step:c});else if(y.kind==="text"&&y.text)g.push({kind:"assistant",id:`${d}text:${y.index}`,text:y.text,streaming:!0,seq:p,turn:s,step:c});else if(y.kind==="tool-call"&&(y.name||y.args||y.id)){const S=y.id||`${d}tool:${y.index}`,v=[...m,...h].find(A=>A.kind==="tool"&&A.callId===S),k=m.findIndex(A=>A.kind==="tool"&&A.callId===S);if(k>=0){const A=m[k];if(A&&A.kind==="tool"){const R=m.slice();R[k]={...A,name:y.name||A.name,args:y.args||A.args,running:!A.result},m=R}}else g.push({kind:"tool",id:`${d}tool:${y.index}`,callId:S,name:y.name||v?.name||"tool",args:y.args||v?.args||"",result:v?.result??"",error:v?.error??!1,running:!v?.result,seq:v?.seq??p,turn:s,step:c})}}return ys([...m,...g])}function W0(n,i,r){const u=n.find(s=>s.index===i);return u?u.kind===r?n:n.map(s=>s.index===i?{...s,kind:r}:s):[...n,{index:i,kind:r,text:"",id:"",name:"",args:""}].sort((s,c)=>s.index-c.index)}function Zo(n,i,r,u){return W0(n,i,r).map(c=>c.index===i?u({...c,kind:r}):c)}function a3(n,i){const r=Qe(i.index)??0,u=typeof i.type=="string"?i.type:"";if(u==="block-start"){const s=i.blockType==="reasoning"||i.blockType==="tool-call"||i.blockType==="text"?i.blockType:"text";return W0(n,r,s)}if(u==="text-delta"||u==="text-chunks"){const s=typeof i.text=="string"?i.text:a1(i.texts);return Zo(n,r,"text",c=>({...c,text:c.text+s}))}if(u==="reasoning-delta"||u==="reasoning-chunks"){const s=typeof i.text=="string"?i.text:a1(i.texts);return Zo(n,r,"reasoning",c=>({...c,text:c.text+s}))}if(u==="tool-call-delta"||u==="tool-call-chunks"){const s=typeof i.argumentsDelta=="string"?i.argumentsDelta:ts(i.args??i.arguments);return Zo(n,r,"tool-call",c=>({...c,id:typeof i.id=="string"&&i.id?i.id:c.id,name:typeof i.name=="string"&&i.name?i.name:c.name,args:u==="tool-call-chunks"&&s?s:c.args+s}))}if(u==="block-end"&&i.block&&typeof i.block=="object"){const s=i.block,c=s.type==="reasoning"||s.type==="tool-call"||s.type==="text"?s.type:"text";return Zo(n,r,c,d=>({...d,kind:c,text:typeof s.text=="string"?s.text:d.text,id:s.id||d.id,name:s.name||d.name,args:ts(s.arguments)||d.args}))}return n}function a1(n){return Array.isArray(n)?n.filter(i=>typeof i=="string").join(""):""}function P0(n,i){const r=i.data??{},u=r.chunk;if(!u||typeof u!="object")return n;const s=Qe(r.turn),c=Qe(r.step),d=gs(s,c),h=n.live[d]??{seq:i.seq??0,blocks:[]},m=a3(h.blocks,u),g={...n.live,[d]:{seq:h.seq||i.seq||0,blocks:m}},y=h.seq||i.seq||0;return{...n,live:g,drafting:!0,turn:s??n.turn,segments:r3({...n},d,m,y,s,c)}}function eb(n,i){const r=i.data??{},u=nh(r),s=u?.content??[],c=Qe(r.turn),d=Qe(r.step),h=gs(c,d),m={...n.live};delete m[h];let g=n.segments.filter(p=>!p.id.startsWith(`live:${h}:`));g=g.filter(p=>!((p.kind==="think"||p.kind==="assistant")&&p.turn===c&&p.step===d));const y=i.seq??0;return s.forEach((p,S)=>{const v=y+S/100;if(p.type==="reasoning"&&p.text?.trim())g.push({kind:"think",id:`think:${h}:${S}`,text:p.text,running:!1,seq:v,turn:c,step:d});else if(p.type==="text"&&p.text)g.push({kind:"assistant",id:`text:${h}:${S}`,text:p.text,streaming:!1,time:i.time,seq:v,turn:c,step:d,messageId:u?.id});else if(p.type==="tool-call"){const k=p.id||`call:${h}:${S}`,A=g.find(R=>R.kind==="tool"&&R.callId===k);g=g.filter(R=>!(R.kind==="tool"&&R.callId===k)),g.push({kind:"tool",id:`tool:${k}`,callId:k,name:p.name||(A?.kind==="tool"?A.name:"")||"tool",args:ts(p.arguments)||(A?.kind==="tool"?A.args:""),result:A?.kind==="tool"?A.result:"",error:A?.kind==="tool"?A.error:!1,running:A?.kind==="tool"?A.running&&!A.result:!0,seq:A?.seq??v,turn:c,step:d})}}),{...n,live:m,segments:ys(g)}}function u3(n,i){const r=i.data??{},u=typeof r.callId=="string"?r.callId:"";if(!u)return n;const s=Qe(r.turn),c=Qe(r.step);return{...n,segments:$0(n.segments,{kind:"tool",id:`tool:${u}`,callId:u,name:typeof r.name=="string"?r.name:"tool",args:ts(r.arguments),result:"",error:!1,running:!0,seq:i.seq??Number.MAX_SAFE_INTEGER,turn:s,step:c})}}function o3(n,i){const r=i.data??{},u=nh(r),s=u?.toolCallId??(typeof r.callId=="string"?r.callId:"");if(!s)return n;const c=V0(u?.content),d=Qe(r.turn),h=Qe(r.step),m=n.segments.find(g=>g.kind==="tool"&&g.callId===s);return{...n,segments:$0(n.segments,{kind:"tool",id:`tool:${s}`,callId:s,name:m?.kind==="tool"?m.name:"tool",args:m?.kind==="tool"?m.args:"",result:c,error:u?.isError===!0,running:!1,seq:m?.seq??i.seq??Number.MAX_SAFE_INTEGER,turn:d??(m?.kind==="tool"?m.turn:void 0),step:h??(m?.kind==="tool"?m.step:void 0)})}}function s3(n){return lh(n)?.type==="snapshot"}function c3(n){const i=lh(n);if(!i||i.type!=="snapshot")return null;const r=Array.isArray(i.records)?i.records:[];let u=0,s=!1;for(const c of G0(r))typeof c.seq=="number"&&((!s||c.seq<u)&&(u=c.seq),s=!0);return u}function lh(n){if(!n||typeof n!="object")return null;const i=n,r=i.value;if(r&&typeof r=="object"&&!Array.isArray(r)){const u=r;if(typeof u.type=="string")return u}return typeof i.type=="string"?i:null}function tb(n,i){let r=i;for(const u of n.segments)u.seq>r&&(r=u.seq);return r+.5}function f3(n){if(!Array.isArray(n))return[];const i=[];for(const r of n){if(!r||typeof r!="object")continue;const u=r;if(u.type==="chunk"&&u.chunk&&typeof u.chunk=="object"){i.push({time:Qe(u.time)??0,chunk:u.chunk});continue}const s=Qe(u.index)??0,c=Array.isArray(u.texts)?u.texts:Array.isArray(u.args)?u.args:null;if(!c)continue;let d=Qe(u.time0)??0;const h=Array.isArray(u.dt)?u.dt:[];c.forEach((m,g)=>{g>0&&(d+=Qe(h[g-1])??0);const y=typeof m=="string"?m:"";u.type==="text-chunks"?i.push({time:d,chunk:{type:"text-delta",index:s,text:y}}):u.type==="reasoning-chunks"?i.push({time:d,chunk:{type:"reasoning-delta",index:s,text:y}}):u.type==="tool-call-chunks"&&i.push({time:d,chunk:{type:"tool-call-delta",index:s,id:typeof u.id=="string"?u.id:"",...typeof u.name=="string"?{name:u.name}:{},argumentsDelta:y}})})}return i}function nb(n,i,r,u,s,c){return P0(n,{seq:c,data:{turn:i,step:r,chunk:s}})}function u1(n,i,r,u=!1){const s=gs(i,r),c={...n.live};return delete c[s],{...n,live:c,segments:n.segments.filter(d=>!(d.id.startsWith(`live:${s}:`)||u&&d.kind!=="user"&&d.turn===i&&d.step===r&&(d.kind==="assistant"||d.kind==="think")))}}function d3(n,i){const r=n.streamAttempt;if(!r||i.surfaceOp!=null&&i.surfaceOp!=="append")return!1;const u=i.data??{};return Qe(u.turn)!==r.turn||Qe(u.step)!==r.step?!1:i.seq==null||i.seq>r.startedAfterSeq}function lu(n){const i=n.pendingAssistant;return{...i?eb(n,i):n,pendingAssistant:null,streamAttempt:null}}function h3(n,i,r){return{...n,streamAttempt:null,pendingAssistant:null,segments:n.segments.map(u=>u.kind==="user"||u.turn!==i||u.step!==r?u:u.kind==="think"?{...u,running:!1}:u.kind==="tool"?{...u,running:!1}:u.kind==="assistant"?{...u,streaming:!1}:u)}}function m3(n,i){const r=Qe(i.revision)??n.streamRevision;let u={...n,streamRevision:r};const s=i.activeAttempt;if(!s||typeof s!="object")return{...u,streamAttempt:null};const c=s,d=typeof c.attemptId=="string"?c.attemptId:"",h=Qe(c.turn),m=Qe(c.step),g=Qe(c.startedAfterSeq)??r;if(!d||h==null||m==null)return{...u,streamAttempt:null};const y=f3(c.stream),p=Math.min(Qe(c.nextIndex)??y.length,y.length),S=tb(u,g);for(let v=0;v<p;v+=1){const k=y[v];k&&(u=nb(u,h,m,k.time,k.chunk,S))}return{...u,drafting:p>0||u.drafting,streamAttempt:{attemptId:d,turn:h,step:m,nextIndex:p,startedAfterSeq:g}}}function p3(n,i){const r=typeof i.type=="string"?i.type:"",u=Qe(i.revision),s=typeof i.attemptId=="string"?i.attemptId:"";if(u==null||!s)return n;if(r==="start"){const d=Qe(i.turn),h=Qe(i.step);if(d==null||h==null)return n;const m=n.pendingAssistant?lu(n):n;return{...u1(m,d,h,!0),drafting:!0,streamRevision:u,streamAttempt:{attemptId:s,turn:d,step:h,nextIndex:0,startedAfterSeq:Qe(i.startedAfterSeq)??n.streamRevision}}}if(u!==n.streamRevision+1)return{...lu(n),streamRevision:u};const c=n.streamAttempt;if(!c||c.attemptId!==s)return{...n,streamRevision:u};if(r==="chunk"){const d=Qe(i.index),h=i.chunk;if(d==null||!h||typeof h!="object")return{...n,streamRevision:u};if(d!==c.nextIndex)return{...lu(n),streamRevision:u};const m=gs(c.turn,c.step),g=n.live[m]?.seq||tb(n,c.startedAfterSeq);return{...nb(n,c.turn,c.step,Qe(i.time)??0,h,g),streamRevision:u,streamAttempt:{...c,nextIndex:c.nextIndex+1}}}if(r==="end"){const d=i.outcome&&typeof i.outcome=="object"?i.outcome:{},h={...n,streamRevision:u};return d.kind==="abandoned"?{...u1(h,c.turn,c.step),streamAttempt:null,pendingAssistant:null}:d.kind==="committed"&&d.eventType==="assistant/message"?{...lu(h),streamRevision:u}:{...h3(h,c.turn,c.step),streamRevision:u}}return{...n,streamRevision:u}}function g3(n,i){const r=Qe(n.pendingAssistant?.data?.turn),u=n.pendingAssistant&&(i==null||r===i)?lu(n):n,s=Object.fromEntries(Object.entries(u.live).filter(([c])=>!c.startsWith(`${i??""}:`)));return{...u,live:s,segments:u.segments.filter(c=>!(typeof i=="number"&&c.id.startsWith(`live:${i}:`))).map(c=>c.turn!==i?c:c.kind==="think"?{...c,running:!1}:c.kind==="tool"?{...c,running:!1}:c.kind==="assistant"?{...c,streaming:!1}:c)}}function y3(n,i){const r=i.projections,u=r&&typeof r=="object"?r.values??{}:{},s={...n};typeof u.title=="string"&&(s.title=u.title);const c=u.modelSelection&&typeof u.modelSelection=="object"?u.modelSelection.lastUsed:void 0;c?.model&&(s.model=c.model);const d=u.permissions;if(d&&typeof d=="object"){const m=d,g=m.currentValue??m.preset??m.sandbox;typeof g=="string"&&(s.preset=g)}const h=u.sessionStats;if(h&&typeof h=="object"){const m=h.turns,g=h.steps;typeof m=="number"&&(s.turns=m),typeof g=="number"&&(s.steps=g)}return s}function b3(n,i,r){let u=n;const s=lh(i);s?.type==="snapshot"&&(u=y3(u,s));const c=[];nr(i,c);for(const d of c){if(typeof d.type!="string")continue;if(d.seq!=null){if(r.has(d.seq))continue;r.add(d.seq)}const h=d.data??{};if(d.type==="session/title"&&typeof h.title=="string"){const m=h.source&&typeof h.source=="object"?h.source.kind:"";u.title&&m!=="provider"||(u={...u,title:h.title});continue}if(d.type==="request/context"){const m=typeof h.model=="string"?h.model:"";m&&(u={...u,model:m});continue}if(d.type==="turn/start"){const m=Qe(h.turn);if(m!=null&&u.turnEnds?.[m]||m!=null&&u.turn!=null&&m<u.turn)continue;u={...u,drafting:!0,turn:m??u.turn,turnStartedAt:typeof d.time=="number"?d.time:Date.now()};continue}if(d.type==="turn/end"){const m=Qe(h.turn)??u.turn,g={...u.completed};m!=null&&u.turn===m&&u.turnStartedAt!=null&&typeof d.time=="number"&&(g[m]=Math.max(1,Math.round((d.time-u.turnStartedAt)/1e3)));const y=m==null?null:KA(h.reason),p=y==null||m==null?u.failures:{...u.failures,[m]:y},S=h.reason&&typeof h.reason=="object"&&typeof h.reason.kind=="string"?h.reason.kind:"",v=m==null?u.turnEnds??{}:{...u.turnEnds??{},[m]:S||u.turnEnds?.[m]||"ended"};u=g3(u,m),u={...u,drafting:u.turn===m?!1:u.drafting,completed:g,failures:p,turnEnds:v,turnStartedAt:u.turn===m?null:u.turnStartedAt};continue}if(d.type==="llm/retry"){const m=Qe(h.turn),g=typeof h.retryId=="string"?h.retryId:"",y=Qe(h.retry);if(m==null||g===""||y==null)continue;const p=h.failure&&typeof h.failure=="object"?h.failure:{},S={retryId:g,retry:y,maxRetries:Qe(h.maxRetries)??null,delayMs:typeof h.delayMs=="number"?h.delayMs:0,message:typeof p.message=="string"?p.message:"Request failed.",...typeof p.code=="string"?{code:p.code}:{},state:"scheduled"},v=u.retries[m]??[];u={...u,retries:{...u.retries,[m]:[...v.filter(k=>k.retryId!==g||k.retry!==y),S]}};continue}if(d.type==="llm/retry-started"){const m=Qe(h.turn),g=typeof h.retryId=="string"?h.retryId:"",y=Qe(h.retry);if(m==null||g===""||y==null)continue;const p=u.retries[m];if(!p)continue;u={...u,retries:{...u.retries,[m]:p.map(S=>S.retryId===g&&S.retry===y?{...S,state:"started"}:S)}};continue}if(d.type==="assistant/live-chunk"){u=P0(u,d);continue}if(d.type==="user/message"){const m=nh(h);if(!m||m.source?.kind!=="user")continue;const g=V0(m.content);if(!g)continue;u={...u,segments:JA(u.segments,{kind:"user",id:`user:${d.seq??g}`,text:g,time:d.time,seq:d.seq??Number.MAX_SAFE_INTEGER,turn:Qe(h.turn)})};continue}if(d.type==="assistant/message"){d3(u,d)?u={...u,pendingAssistant:d}:u=eb(u,d);continue}if(d.type==="tool/call"){u=u3(u,d);continue}d.type==="tool/result"&&(u=o3(u,d))}if(s?.type==="snapshot"){const d=s.assistantStream;d&&typeof d=="object"&&(u=m3(u,d))}if(s?.type==="assistant-stream"){const d=s.frame;d&&typeof d=="object"&&(u=p3(u,d))}return u}function v3(n,i,r){return i3(b3(n,i,r))}function x3(n){for(let i=n.length-1;i>=0;i-=1){const r=n[i];if(!r||r.kind==="user"&&D0(r.text))continue;const u=r.kind==="user"?ps(r.text):null,s=r.kind==="user"?eh(r.text):null,d=(u?u.body:s?.body?s.body:r.kind==="user"||r.kind==="assistant"?r.text:r.kind==="tool"?r.result||bs(r.name,r.args):J0(r.text)).replace(/```[\s\S]*?```/g," ").replace(/^#{1,6}\s+/gm,"").replace(/[|*_`>]/g," ").replace(/\s+/g," ").trim();if(d)return d.slice(0,80)}return""}const o1=4;function ls(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function s1(n,i){if(!ls(n))return;if(i==="ticket.id"){const u=n.ticket;if(!ls(u))return;const s=u.id;return typeof s=="string"&&s!==""?s:void 0}const r=n[i];if(typeof r=="string"&&r!=="")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r)}function cu(n,i){if(!ls(i)||i.t!=="v"&&i.t!=="o"&&i.t!=="l")return n;const r=i;return r.t==="v"?r.v:r.t==="o"?S3(n,r):w3(n,r)}function S3(n,i){const r=ls(n)?{...n}:{};for(const u of i.d??[])delete r[u];for(const[u,s]of Object.entries(i.s))r[u]=cu(r[u],s);return r}function w3(n,i){const r=i.id,u=Array.isArray(n)?n.slice():[],s=new Set(i.d??[]),c=[],d=new Map;for(const m of u){const g=s1(m,r);g!==void 0&&s.has(g)||(g!==void 0&&d.set(g,c.length),c.push(m))}for(const[m,g]of Object.entries(i.s??{})){const y=d.get(m);if(y===void 0){c.push(cu(void 0,g));continue}c[y]=cu(c[y],g)}if(!i.order)return c;const h=new Map;for(const m of c){const g=s1(m,r);g!==void 0&&h.set(g,m)}return i.order.filter(m=>h.has(m)).map(m=>h.get(m))}function k3(n){const i=atob(n),r=new Uint8Array(i.length);for(let u=0;u<i.length;u+=1)r[u]=i.charCodeAt(u);return r}function T3(n){return!Array.isArray(n)||n.some(i=>typeof i!="string"||i==="")?null:n}function E3(n,i){if(!(!i||typeof i!="object"||Array.isArray(i))){for(const[r,u]of Object.entries(i))if(!(typeof u!="string"||u===""))try{n.set(r,k3(u))}catch{}}}function C3(n,i,r){let u=0;const s=[];for(const h of n){const m=i.get(h);if(!m)return null;s.push(m),u+=m.length}if(typeof r=="number"&&u!==r)return null;const c=new Uint8Array(u);let d=0;for(const h of s)c.set(h,d),d+=h.length;try{const h=JSON.parse(new TextDecoder().decode(c));return Array.isArray(h)?h:!h||typeof h!="object"?null:h}catch{return null}}function c1(n,i){const r=[],u=new Set;for(const s of n)s===""||i.has(s)||u.has(s)||(u.add(s),r.push(s));return r}function A3(n,i=32){const r=[];for(let u=0;u<n.length;u+=i)r.push(n.slice(u,u+i));return r}function N3(n,i){return Array.isArray(n)?n.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const u=v1(i,r);return u?[u]:[]}):[]}function z3(n,i){return i==null?n:n.filter(r=>r.seq<i)}async function lb(n,i,r,u,s=0,c,d){const h=`&tailMessages=${d}`,m=await r(`/snapshot?sessionId=${encodeURIComponent(n)}${h}`),g=typeof m.body.beforeSeq=="number"?m.body.beforeSeq:c??null;if(m.status!==200||m.body.ok!==!0)return{events:null,beforeSeq:g};const y=T3(m.body.hashes),p=m.body.totalSize;if(!y||typeof p!="number")return{events:null,beforeSeq:g};const S=m.body.count;if(typeof S=="number")try{const Z=await i.readEvents(n),K=z3(Z,g);if(K.length===S)return{events:K.map(de=>de.event),beforeSeq:g}}catch{}if(y.length===0)return u?.({loaded:0,total:p}),{events:[],beforeSeq:g};const v=await i.present(y),k=c1(y,v),A=await i.readChunks(y.filter(Z=>v.has(Z)));let R=0;for(const Z of y)v.has(Z)&&(R+=A.get(Z)?.byteLength??0);let C=0;const I=(Z=0)=>{C=Math.max(C,Math.min(p,R+Z)),u?.({loaded:C,total:p})};I();let G=k.length;for(const Z of A3(k,1)){const K=Z.map(Ce=>`hash=${encodeURIComponent(Ce)}`).join("&"),de=Math.max(0,p-R),U=G===0?0:de*(Z.length/G),$=await r(`/snapshot/chunks?sessionId=${encodeURIComponent(n)}&${K}`,(Ce,Ue)=>{const be=Ue!=null&&Ue>0?Math.min(1,Ce/Ue):Math.min(.9,Ce/Math.max(U,1));I(U*be)});if($.status===409&&s===0)return lb(n,i,r,u,1,c,d);if($.status!==200||$.body.ok!==!0)return{events:null,beforeSeq:g};const ue=new Map;if(E3(ue,$.body.chunks),c1(Z,new Set(ue.keys())).length>0)return{events:null,beforeSeq:g};await i.putChunks(ue);for(const Ce of Z)R+=ue.get(Ce)?.byteLength??0;G-=Z.length,I()}const ne=await i.readChunks(y),le=C3(y,ne,p);if(!Array.isArray(le))return{events:null,beforeSeq:g};const H=N3(le,n);return H.length>0&&await i.putEvents(n,H),{events:le,beforeSeq:g}}async function f1(n,i,r,u){const s=r!=null?`&beforeSeq=${r}`:"",c=await u(`/snapshot/range?sessionId=${encodeURIComponent(n)}&fromSeq=${i}${s}`);return c.status!==200||c.body.ok!==!0||!Array.isArray(c.body.events)?null:c.body.events}function O3(n,i){const r=Math.max(0,Math.min(i,n.length)),u=/(?:^|\s)@([^\s@()]*)$/.exec(n.slice(0,r));if(!u||u.index==null)return null;const s=u[1]??"";return{start:u.index+u[0].length-s.length-1,query:s}}function _3(n){return n.replace(/[@()\r\n]/g," ").replace(/\s+/g," ").trim()||"Untitled"}function j3(n,i){return`@${_3(n)} (${i})`}function M3(n,i,r,u,s){const c=Math.max(0,Math.min(i,n.length)),d=`${j3(u,s)} `;return{text:n.slice(0,r)+d+n.slice(c),cursor:r+d.length}}function D3(n,i){const r=i.trim().toLowerCase();return n.filter(u=>r===""?!0:u.label.toLowerCase().includes(r)||u.sessionId.toLowerCase().includes(r)).slice(0,8)}function d1({segment:n}){const[i,r]=F.useState(!1),u=J0(n.text);return w.jsxs("div",{className:i?"official-row open":"official-row","data-variant":"think","data-state":n.running?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":i,onClick:()=>r(s=>!s),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[w.jsx(I3,{}),w.jsx(ih,{})]}),w.jsx("span",{className:n.running?"official-label shimmer":"official-label",children:"Think"}),u?w.jsx("span",{className:"official-dot"}):null,u?w.jsx("span",{className:n.running?"official-summary streaming":"official-summary",children:u}):null]}),w.jsx(rs,{open:i,children:w.jsx("div",{className:"think-body",children:n.text})})]})}function R3({segments:n,quiet:i=!1}){const{t:r}=wt(),[u,s]=F.useState(!1),c=n.some(h=>h.running);if(i&&dA(n))return null;if(n.every(h=>h.kind==="think"))return n.map(h=>w.jsx(d1,{segment:h},h.id));const d=i?r(c?"bot.thinking":"bot.processed"):WA(n,c);return w.jsxs("div",{className:u?"activity-group open":"activity-group","data-state":c?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":u,onClick:()=>s(h=>!h),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[c?w.jsx(rb,{}):w.jsx(ab,{}),w.jsx(ih,{})]}),w.jsx("span",{className:c?"official-label shimmer":"official-label",children:d})]}),w.jsx(rs,{open:u,children:w.jsx("div",{className:"activity-body",children:n.map(h=>h.kind==="think"?w.jsx(d1,{segment:h},h.id):w.jsx(L3,{segment:h},h.id))})})]})}function L3({segment:n}){const[i,r]=F.useState(!1),u=PA(n),s=u?.name||Y3(n)||bs(n.name,n.args),c=!!(u||n.result||n.args);return w.jsxs("div",{className:i?"official-row open":"official-row","data-state":n.error?"error":n.running?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":i,disabled:!c,onClick:()=>r(d=>!d),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[w.jsx(rb,{}),w.jsx(ih,{})]}),w.jsx("span",{className:n.running?"official-label shimmer":"official-label",children:F0(n)}),s?w.jsx("span",{className:"official-dot"}):null,s?w.jsx("span",{className:"official-summary",children:s}):null,u?w.jsxs("span",{className:"official-size",children:[u.kilobytes,"KB"]}):null,u?w.jsx(H3,{added:u.added,removed:u.removed}):null]}),c?w.jsx(rs,{open:i,children:w.jsx(B3,{segment:n,change:u})}):null]})}function B3({segment:n,change:i}){if(i)return w.jsx(U3,{change:i});const r=bs(n.name,n.args);return w.jsxs("div",{className:"diff-card",children:[w.jsxs("div",{className:"diff-head",children:[w.jsx("span",{className:"diff-lang",children:r||n.name}),w.jsx(ib,{text:n.result||r})]}),n.result?w.jsx("pre",{className:"diff-output",children:n.result}):null]})}function U3({change:n}){const i=n.lines.map(r=>`${r.kind==="del"?"- ":r.kind==="add"?"+ ":" "}${r.text}`).join(`
60
- `);return w.jsxs("div",{className:"diff-card","data-diff":"",children:[w.jsxs("div",{className:"diff-head",children:[w.jsxs("span",{className:"diff-heading",children:[w.jsx("span",{className:"diff-lang",children:n.language||"Code block"}),w.jsx("span",{className:"diff-file",children:n.name})]}),w.jsx(ib,{text:i})]}),w.jsx("div",{className:"diff-body",children:n.lines.map((r,u)=>w.jsx("div",{className:q3(r.kind),children:r.text},u))})]})}function q3(n){return n==="add"?"diff-line added":n==="del"?"diff-line removed":"diff-line same"}function H3({added:n,removed:i}){return w.jsxs("span",{className:"diff-counts",children:[w.jsxs("span",{className:"diff-plus",children:["+",n]}),w.jsxs("span",{className:"diff-minus",children:["-",i]})]})}function ib({text:n}){const[i,r]=F.useState(!1);return w.jsx("button",{type:"button",className:"diff-copy","aria-label":i?"Copied":"Copy",onClick:u=>{u.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{r(!0),window.setTimeout(()=>r(!1),1e3)})},children:i?w.jsx(ab,{}):w.jsx(V3,{})})}function Y3(n){try{const i=JSON.parse(n.args);if(typeof i.description=="string"&&i.description.trim())return i.description.trim();if(typeof i.command=="string")return i.command.replace(/\s+/g," ").trim()}catch{return""}return""}function ih(){return w.jsx("svg",{className:"chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4 6.5L8 10.5L12 6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function I3(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M8 1.8c2.8 0 5 2 5 4.6 0 1.6-.8 3-2 3.8-.4.3-.6.7-.6 1.1V12H5.6v-.7c0-.4-.2-.8-.6-1.1-1.2-.8-2-2.2-2-3.8 0-2.6 2.2-4.6 5-4.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M6.2 13.6h3.6",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function rb(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.2 4.2h9.6M3.2 8h9.6M3.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function V3(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("rect",{x:"5.2",y:"5.2",width:"7.2",height:"7.6",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M10.2 5.2V3.8A1.3 1.3 0 0 0 8.9 2.5H3.8A1.3 1.3 0 0 0 2.5 3.8v5.1A1.3 1.3 0 0 0 3.8 10.2H5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function ab(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.5 8.2L6.4 11.1L12.5 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const hd=()=>({segments:[],live:{},activity:"",completed:{},failures:{},retries:{},title:"",model:"",preset:"",turns:null,steps:null,drafting:!1,turn:null,turnStartedAt:null,streamAttempt:null,streamRevision:0,pendingAssistant:null,turnEnds:{}});function h1(){const n=location.hash.replace(/^#\/?/,"").split("/");for(let i=0;i<n.length-1;i+=1){const r=n[i],u=n[i+1];if(r==="s"&&u)return decodeURIComponent(u)}return""}function md(n){try{const i=JSON.parse(sessionStorage.getItem(n)||"{}");return i&&typeof i=="object"?i:{}}catch{return{}}}function m1(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const i={};for(const[r,u]of Object.entries(n))typeof u=="string"&&u!==""&&(i[r]=u);return i}function pd(n){fetch("/dsh-bot/api/sessions/previews",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(n),keepalive:!0})}function p1(n){return(n??"").split("/").filter(Boolean).at(-1)??""}function G3(){return new Promise(n=>{const i=location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${i}//${location.host}/api/remote.mux`),u=window.setTimeout(()=>{r.close(),n([])},4e3),s=c=>{window.clearTimeout(u),r.close(),n(c)};r.addEventListener("open",()=>{r.send(JSON.stringify({type:"open",streamId:"archive",endpoint:"workspace/follow",payload:{args:{}}}))}),r.addEventListener("message",c=>{try{const d=JSON.parse(String(c.data)),h=d.value?.type==="baseline"?d.value.value?.archivedSessionIds:void 0;if(!Array.isArray(h))return;s(h.filter(m=>typeof m=="string"))}catch{}}),r.addEventListener("error",()=>s([]))})}function Q3(n){return n==="workspace-write"?"Workspace Write":n==="read-only"||n==="readonly"?"Read Only":n==="danger-full-access"?"Full access":n==="auto"?"Auto review":n}function X3(n,i){if(!n)return"";const r=new Date(n);return Number.isNaN(r.getTime())?"":r.toLocaleTimeString(i==="zh"?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"})}function is(n,i,r){return oS(n,i,r)}function Z3({active:n,progress:i}){const{t:r}=wt(),[u,s]=F.useState(n),[c,d]=F.useState(!1);if(F.useEffect(()=>{if(n){s(!0);return}d(!1)},[n]),F.useEffect(()=>{if(!u||!n)return;const g=window.requestAnimationFrame(()=>d(!0));return()=>window.cancelAnimationFrame(g)},[u,n]),F.useEffect(()=>{if(n||!u)return;const g=window.setTimeout(()=>s(!1),280);return()=>window.clearTimeout(g)},[n,u]),!u)return null;const h=i!=null&&i.total>0,m=h?Math.min(100,Math.round(i.loaded/i.total*100)):0;return w.jsx("div",{className:c?"chunk-loading visible":"chunk-loading",role:"status",children:w.jsxs("div",{className:"chunk-loading-card",children:[w.jsx("p",{children:w.jsx("span",{className:"shimmer",children:h?r("load.messagesPct",{pct:String(m)}):r("load.messages")})}),w.jsx("div",{className:"chunk-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":h?i.total:1,"aria-valuenow":h?i.loaded:0,"aria-label":r("load.aria"),children:w.jsx("div",{className:h?"chunk-progress-fill":"chunk-progress-fill indeterminate",style:h?{width:`${m}%`}:void 0})})]})})}function F3(){const{t:n,locale:i,setLocale:r}=wt(),[u,s]=F.useState(h1),[c,d]=F.useState([]),[h,m]=F.useState(""),[g,y]=F.useState(""),[p,S]=F.useState(!1),[v,k]=F.useState(()=>md("dsh-bot.titles")),[A,R]=F.useState(()=>md("dsh-bot.previews")),[C,I]=F.useState(hd),[G,ne]=F.useState(""),[le,H]=F.useState(null),[Z,K]=F.useState(u);Z!==u&&(K(u),I(hd()));const[de,U]=F.useState(null),[$,ue]=F.useState({ready:!1,reason:"loading"}),[Ce,Ue]=F.useState(null),[be,ee]=F.useState(null),[oe,me]=F.useState(!1),[Me,E]=F.useState(""),[ot,mt]=F.useState(0),[O,z]=F.useState(0),[J,re]=F.useState(""),[he,Te]=F.useState(""),[_e,Ae]=F.useState(!1),[ce,pe]=F.useState(null),[Ot,tl]=F.useState(()=>new Set),[nl,en]=F.useState(!1),[gt,Fe]=F.useState(!1),[dt,$t]=F.useState(!1),[on,Vn]=F.useState(""),[Il,ll]=F.useState(0),[_t,il]=F.useState(()=>new Set),[V,te]=F.useState({}),[ve,Ne]=F.useState({}),[vt,et]=F.useState(!1),[jt,Wt]=F.useState({}),[sn,Gn]=F.useState(()=>Date.now()),[zn,Ci]=F.useState(""),kt=DA(u,Il),Mt=F.useRef(null),vn=F.useRef(null),tn=F.useRef(null),Ai=F.useRef(0),Wr=F.useRef(new Map),Ni=F.useRef(0),pu=F.useRef(new Map),gu=F.useRef(!1),nn=F.useRef(u),qt=F.useRef(()=>{}),On=F.useRef(()=>{}),Ht=F.useRef(async()=>null),yu=F.useRef($x());nn.current=u;function Sl(N){return V[N.sessionId]||v[N.sessionId]||N.title||p1(N.cwd)||n("session.unnamed")}function Pr(N){const Y=c.find(W=>W.sessionId===N);return Y?Sl(Y):V[N]||v[N]||""}const ar=I0(C.segments),Qn=u!==""&&G!==u,Vl=le!=null&&le.total>0&&le.loaded<le.total,_n=F.useMemo(()=>LA(C.segments),[C.segments]),ur=F.useMemo(()=>FA(_n),[_n]),zi=u?Sl({sessionId:u,cwd:c.find(N=>N.sessionId===u)?.cwd,title:C.title||null}):n("app.title"),bu=u?`/#/s/${encodeURIComponent(u)}`:"/";function wl(N){$t(!1),s(N),Ae(!1),pe(null),U(null),Te(""),Vn("");const Y=N?`#/s/${encodeURIComponent(N)}`:"#/";location.hash!==Y&&history.replaceState(null,"",Y)}function vu(N){if(!N||N===u)return;const Y=u;$t(!1),s(N),Ae(!1),pe(null),U(null),Te(""),Vn("");const W=`#/s/${encodeURIComponent(N)}`;location.hash!==W&&history.pushState({kind:"worker",owner:Y},"",W)}function or(){if($t(!1),Ae(!1),pe(null),history.state?.kind==="worker"){history.back();return}zn&&wl(zn)}F.useEffect(()=>{let N=!1;return G3().then(Y=>{N||tl(new Set(Y))}),()=>{N=!0}},[]);function Gl(N){const Y=oA(N);Y&&(Wt(Y.signals),Ne(Y.cards),et(!0));const W=N.desk;if(!W||typeof W!="object"||Array.isArray(W))return;const ae=W,xe=ae.sessions;if(xe&&typeof xe=="object"&&!Array.isArray(xe)){const we=xe,Ee=we.result;if(Ee?.ok!==!0)m(Ee?.error?.message||String(we.error||n("session.listUnavailable")));else if(m(""),d(Ee.value?.items??[]),cr(we.previews),!gu.current){gu.current=!0;const xt=m1(we.previews),fn={};for(const[$e,Yt]of Object.entries(md("dsh-bot.previews")))!xt[$e]&&Yt&&(fn[$e]=Yt);Object.keys(fn).length>0&&pd({previews:fn})}}const ge=ae.bots;if(ge&&typeof ge=="object"&&!Array.isArray(ge)&&ge.ok===!0){const we=ge,Ee=Array.isArray(we.bots)?we.bots:[],xt=Ee.flatMap($e=>{if(!$e||typeof $e!="object")return[];const Yt=$e.sessionId;return typeof Yt=="string"?[Yt]:[]}),fn={};for(const $e of Ee){if(!$e||typeof $e!="object")continue;const Yt=$e.sessionId,El=$e.name;typeof Yt=="string"&&typeof El=="string"&&El!==""&&(fn[Yt]=El)}if(xt.length===0&&Array.isArray(we.sessionIds))for(const $e of we.sessionIds)typeof $e=="string"&&xt.push($e);il(new Set(xt)),te(fn)}const qe=ae.health;if(qe&&typeof qe=="object"&&!Array.isArray(qe)){const we=qe;Ue(we),we.execution&&ue({ready:we.execution.ready===!0,reason:we.execution.reason||(we.execution.ready===!0?"":"catalog_unreadable")})}const je=ae.usage;je&&typeof je=="object"&&!Array.isArray(je)&&ee(je)}F.useEffect(()=>{let N=!1;return(async()=>{try{const Y=await Yn("/sessions");if(N)return;const W=Y.body.result;W?.ok===!0?(m(""),d(W.value?.items??[]),cr(Y.body.previews)):Y.status!==200&&m(W?.error?.message||n("session.listUnavailable"))}catch{}try{const Y=await Yn("/sessions/bots");if(N||Y.body.ok!==!0)return;const W=Array.isArray(Y.body.bots)?Y.body.bots:[],ae=W.flatMap(ge=>{if(!ge||typeof ge!="object")return[];const qe=ge.sessionId;return typeof qe=="string"?[qe]:[]}),xe={};for(const ge of W){if(!ge||typeof ge!="object")continue;const qe=ge.sessionId,je=ge.name;typeof qe=="string"&&typeof je=="string"&&je!==""&&(xe[qe]=je)}if(ae.length===0&&Array.isArray(Y.body.sessionIds))for(const ge of Y.body.sessionIds)typeof ge=="string"&&ae.push(ge);il(new Set(ae)),te(xe)}catch{}})(),()=>{N=!0}},[]),F.useEffect(()=>{let N=!1,Y=null,W=0,ae,xe;const ge=je=>{let we;try{we=JSON.parse(String(je.data))}catch{return null}return we.ok===!0?we:null},qe=()=>{Y?.close(),ae=void 0,xe=void 0;const je=new EventSource("/dsh-bot/api/live");Y=je,je.addEventListener("snapshot",we=>{if(N||Y!==je)return;const Ee=ge(we);Ee&&(Ee.desk!==void 0&&(ae=Ee.desk),Ee.work!==void 0&&(xe=Ee.work),Gl(Ee))}),je.addEventListener("delta",we=>{if(N||Y!==je)return;const Ee=ge(we);if(!Ee)return;const xt={ok:!0};Ee.desk!==void 0&&ae!==void 0&&(ae=cu(ae,Ee.desk),xt.desk=ae),Ee.work!==void 0&&xe!==void 0&&(xe=cu(xe,Ee.work),xt.work=xe),(xt.desk!==void 0||xt.work!==void 0)&&Gl(xt)}),je.addEventListener("error",()=>{N||Y!==je||(je.close(),Y===je&&(Y=null),W=window.setTimeout(qe,2e3))})};return qe(),()=>{N=!0,window.clearTimeout(W),Y?.close()}},[]),F.useEffect(()=>{const N=()=>{$t(!1),Ae(!1),pe(null),U(null),Te(""),Vn(""),s(h1())};return window.addEventListener("hashchange",N),()=>window.removeEventListener("hashchange",N)},[]),F.useEffect(()=>{let N=!1,Y=null,W=0,ae=0,xe="",ge=0,qe=new Set,je=[],we=0,Ee="",xt=!1,fn=null,$e=null;const Yt=We=>{if($e){const Ge=$e;$e=null,Ge(null)}Ee=We,xt=!1,fn=null},El=(We,Ge)=>{if(We!==Ee||xt||(xt=!0,fn=Ge,!$e))return;const ul=$e;$e=null,ul(Ge)},wu=We=>We===Ee&&xt?Promise.resolve(fn):new Promise(Ge=>{if(We===Ee&&xt){Ge(fn);return}$e&&$e(null),$e=Ge,Ee=We}),Cl=()=>{if(we=0,N)return;const We=je;je=[];const Ge=nn.current,ul=We.some(It=>s3(It));if(I(It=>We.reduce((xn,ol)=>v3(xn,ol,qe),It)),ul&&Ge){ne(Ge);for(const It of We){const xn=c3(It);if(xn!=null){El(Ge,xn);break}}}if(Ge){const It=We.flatMap(xn=>G0(xn).flatMap(ol=>{const sa=v1(Ge,ol);return sa?[sa]:[]}));It.length>0&&yu.current.putEvents(Ge,It).catch(()=>{})}},ws=()=>{je=[],we&&window.cancelAnimationFrame(we),we=0,qe=new Set},aa=We=>!Y||Y.readyState!==WebSocket.OPEN?!1:(Y.send(JSON.stringify(We)),!0),ua=We=>{if(!We)return;ge+=1;const Ge=`follow-${ge}`;xe=aa({type:"open",streamId:Ge,endpoint:"session/follow",payload:{args:{request:{address:{kind:"session",sessionId:We},maxMessages:o1,assistantStream:!0}}}})?Ge:""},oa=We=>{Yt(We),ws(),xe&&aa({type:"cancel",streamId:xe}),xe="",ua(We)},ku=()=>{const We=location.protocol==="https:"?"wss:":"ws:",Ge=new WebSocket(`${We}//${location.host}/api/remote.mux`);Y=Ge,Ge.addEventListener("open",()=>{N||Y!==Ge||(W=0,xe="",ua(nn.current))}),Ge.addEventListener("message",ul=>{let It;try{It=JSON.parse(String(ul.data))}catch{return}It.streamId!==xe||It.type!=="item"||(je.push(It),we||(we=window.requestAnimationFrame(Cl)))}),Ge.addEventListener("close",()=>{N||Y!==Ge||(xe="",W+=1,W<=3?ae=window.setTimeout(ku,1e3):El(nn.current,null))})},ks=We=>{N||We.length===0||(je.push(...We),we||(we=window.requestAnimationFrame(Cl)))};return qt.current=oa,On.current=ks,Ht.current=wu,ku(),()=>{N=!0,qt.current=()=>{},On.current=()=>{},Ht.current=async()=>null,$e&&$e(null),window.clearTimeout(ae),we&&window.cancelAnimationFrame(we),Y?.close()}},[]),F.useEffect(()=>{if(u&&I(hd()),H(null),qt.current(u),!u)return;const N=Ht.current(u);let Y=!1;const W=ae=>{Y||nn.current!==u||ae.length===0||(On.current(ae),ne(u))};return(async()=>{const ae=yu.current;try{await ae.open()}catch{return}if(Y||nn.current!==u)return;try{const ge=await ae.readEvents(u);W(ge.map(qe=>qe.event))}catch{}const xe=async(ge,qe)=>{if(!qe)return Yn(ge);const je=await fetch("/dsh-bot/api"+ge,{headers:{accept:"application/json"}});let we=null;try{we=await Zx(je,qe)}catch{we=null}const Ee=we&&typeof we=="object"&&!Array.isArray(we)?we:{};return{status:je.status,body:Ee}};try{const ge=await lb(u,ae,xe,Ee=>{Y||nn.current!==u||H(Ee.loaded<Ee.total?Ee:null)},0,void 0,o1);if(Y||nn.current!==u)return;H(null),ge.events?.length&&W(ge.events);const qe=await N;if(Y||nn.current!==u)return;const je=ge.beforeSeq,we=typeof qe=="number"&&je!=null&&qe>je?await f1(u,je,qe,xe):qe==null&&je!=null&&je>0?await f1(u,je,void 0,xe):null;we?.length&&W(we)}catch{}})(),()=>{Y=!0}},[u]),F.useEffect(()=>{!u||Z!==u||!C.title||V[u]||k(N=>{if(N[u]===C.title)return N;const Y={...N,[u]:C.title};return sessionStorage.setItem("dsh-bot.titles",JSON.stringify(Y)),Y})},[u,Z,C.title,V]);const Ql=!!u&&_t.has(u),cn=Ql&&vt?ve[u]??[]:[],sr=Ql&&vt?u:"";F.useEffect(()=>{if(!u||!tr(u)){Ci("");return}let N=!1;const Y=rA(u);return ou(`/dsh-bot/api/work/ticket?id=${encodeURIComponent(Y)}`).then(W=>{if(N||W.body.ok!==!0||!W.body.ticket||typeof W.body.ticket!="object")return;const ae=W.body.ticket.owner_session_id;typeof ae=="string"&&Ci(ae)}),()=>{N=!0}},[u]);const ea=cn.some(N=>N.status==="started");F.useEffect(()=>{if(!ea)return;const N=window.setInterval(()=>Gn(Date.now()),1e3);return()=>window.clearInterval(N)},[ea]);function cr(N){const Y=m1(N);Object.keys(Y).length!==0&&R(W=>{let ae=!1;const xe={...W};for(const[ge,qe]of Object.entries(Y))xe[ge]||(xe[ge]=qe,ae=!0);return ae?(sessionStorage.setItem("dsh-bot.previews",JSON.stringify(xe)),xe):W})}function fr(){window.clearTimeout(Ni.current),Ni.current=0;const N=[...Wr.current];if(Wr.current.clear(),N.length!==0){if(N.length===1){const[Y,W]=N[0]??[];Y&&W&&pd({sessionId:Y,preview:W});return}pd({previews:Object.fromEntries(N)})}}F.useEffect(()=>()=>{fr()},[]),F.useEffect(()=>{if(!u||Z!==u)return;const N=x3(C.segments);!N||pu.current.get(u)===N||(pu.current.set(u,N),R(Y=>{if(Y[u]===N)return Y;const W={...Y,[u]:N};return sessionStorage.setItem("dsh-bot.previews",JSON.stringify(W)),W}),Wr.current.set(u,N),window.clearTimeout(Ni.current),Ni.current=window.setTimeout(fr,400))},[u,Z,C.segments]),F.useEffect(()=>{if(!_e)return;const N=W=>{const ae=W.target;ae instanceof Node&&tn.current?.contains(ae)||Ae(!1)},Y=W=>{W.key==="Escape"&&Ae(!1)};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",Y)}},[_e]),F.useEffect(()=>{$t(!1)},[u]);const xu=cn.map(N=>`${N.id}:${N.status}:${N.revision}`).join(`
61
- `);F.useEffect(()=>{const N=Mt.current;N&&(N.scrollTop=N.scrollHeight)},[C.segments,C.drafting,C.activity,u,dt,xu]);const jn=F.useMemo(()=>{const N=g.trim().toLowerCase();return c.filter(Y=>tr(Y.sessionId)||Ot.has(Y.sessionId)?!1:N?[Sl(Y),Y.cwd??"",A[Y.sessionId]??""].join(" ").toLowerCase().includes(N):!0)},[c,g,v,A,Ot,V]).filter(N=>!N.blank),st=F.useMemo(()=>{const N=g.trim().toLowerCase();return c.filter(Y=>Y.blank!==!0||tr(Y.sessionId)?!1:N?[Sl(Y),Y.cwd??""].join(" ").toLowerCase().includes(N):!0)},[c,g,v,V]),Rt=nl||g.trim()!=="",Xl=F.useMemo(()=>!u||!_t.has(u)?[]:c.flatMap(N=>!_t.has(N.sessionId)||N.sessionId===u||Ot.has(N.sessionId)||tr(N.sessionId)?[]:[{sessionId:N.sessionId,label:Sl(N)}]),[c,_t,u,Ot,V,v]),Xn=u&&_t.has(u)?O3(Me,ot):null,ta=Xn?`${Xn.start}:${Xn.query}`:"",rl=Xn?D3(Xl,Xn.query):[],na=Xn!=null&&J!==ta,kl=Math.min(O,Math.max(rl.length-1,0));F.useEffect(()=>{z(0)},[ta]);function Oi(N,Y){const W=new Set(Ot);for(const ae of Y)W.add(ae);if(Array.isArray(N))for(const ae of N)typeof ae=="string"&&W.add(ae);tl(W),Y.includes(u)&&wl("")}async function dr(N){const Y=await Yn(`/sessions/${encodeURIComponent(N)}/archive`,{method:"POST"});if(Y.status!==200){const W=Y.body.upstream;m(W?.message||(Y.body.error==="not_blank"?n("session.notBlankArchive"):n("session.archiveFailed")));return}m(""),Oi(Y.body.archivedSessionIds,[N])}async function Tl(){if(st.length===0||!window.confirm(n("session.archiveConfirm",{count:String(st.length)})))return;const N=[];let Y=[];for(const W of st){const ae=await Yn(`/sessions/${encodeURIComponent(W.sessionId)}/archive`,{method:"POST"});if(ae.status!==200){const xe=ae.body.upstream;m(xe?.message||n("session.archiveSomeFailed"));break}N.push(W.sessionId),Y=ae.body.archivedSessionIds}N.length>0&&Oi(Y,N)}async function Zl(N){const Y=c.find(xe=>xe.sessionId===N),W=v[N]||p1(Y?.cwd)||n("session.blankName");if(!window.confirm(n("session.purgeOneConfirm",{name:W})))return;const ae=await Yn(`/sessions/${encodeURIComponent(N)}/purge`,{method:"POST"});if(ae.status!==200){m(ae.body.error==="not_blank"?n("session.purgeNotBlank"):n("session.purgeFailed"));return}d(xe=>xe.filter(ge=>ge.sessionId!==N)),tl(xe=>{const ge=new Set(xe);return ge.delete(N),ge}),u===N&&wl("")}async function _i(){const N=st.filter(ae=>ae.blank===!0);if(N.length===0||!window.confirm(n("session.purgeAllConfirm",{count:String(N.length)})))return;const Y=[];for(const ae of N){if((await Yn(`/sessions/${encodeURIComponent(ae.sessionId)}/purge`,{method:"POST"})).status!==200){m(n("session.purgeSomeFailed"));break}Y.push(ae.sessionId)}if(Y.length===0)return;const W=new Set(Y);d(ae=>ae.filter(xe=>!W.has(xe.sessionId))),tl(ae=>{const xe=new Set(ae);for(const ge of Y)xe.delete(ge);return xe}),W.has(u)&&wl("")}async function Fl(N,Y,W){Fe(!1),W!==""&&(te(ge=>({...ge,[N]:W})),il(ge=>new Set([...ge,N])),k(ge=>{const qe={...ge,[N]:W};return sessionStorage.setItem("dsh-bot.titles",JSON.stringify(qe)),qe}));const xe=(await Yn("/sessions")).body.result;d(xe?.value?.items??[]),wl(N),Vn(Y),ll(ge=>ge+1)}function Tt(N,Y){E(N),mt(Y),window.requestAnimationFrame(()=>{const W=vn.current;W&&(W.focus(),W.setSelectionRange(Y,Y))})}function la(N){if(!Xn)return;const Y=M3(Me,ot,Xn.start,N.label,N.sessionId);Tt(Y.text,Y.cursor)}function ji(N="/"){Ae(!1),E(Y=>{const W=Y.replace(/\s+$/,"");return W===""?N==="/"?"/":`${N} `:`${W} ${N==="/"?"/":`${N} `}`}),window.requestAnimationFrame(()=>vn.current?.focus())}async function ia(N){const Y=de?.status==="accepted"&&C.drafting,W=sr===u?cn:[];if(!u||!N||!$.ready||i1(Y,W,_t.has(u)))return;const ae=C.drafting;E(""),Te(""),Ai.current+=1;const xe=Number.MAX_SAFE_INTEGER-Ai.current;I(je=>({...je,drafting:!0,segments:[...je.segments,{kind:"user",id:`optimistic:${xe}`,text:N,time:Date.now(),seq:xe,optimistic:!0}]}));const ge=await Yn("/tasks",{method:"POST",headers:{"content-type":"application/json","idempotency-key":crypto.randomUUID()},body:JSON.stringify({sessionId:u,text:N})}),qe=ge.body.task;if(U(qe??null),ge.status!==202){I(we=>({...we,drafting:ae?we.drafting:!1,segments:we.segments.filter(Ee=>!(Ee.kind==="user"&&Ee.optimistic&&Ee.text===N))}));const je=ge.body.execution;Te(je?.reason||is(String(ge.body.error||""),n("composer.notSent"),n))}}async function al(){const N=Me.trim();N&&await ia(N)}async function Kl(N,Y){const W=await ou("/dsh-bot/api/work/supply",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:u,ticketId:N,text:Y})});return W.status!==200||W.body.ok===!1?x1(W.body,n("composer.supplyFailed")):""}async function xs(){if(!de||de.status!=="accepted")return;const Y=(await Yn(`/tasks/${de.id}/cancel?sessionId=${encodeURIComponent(de.sessionId??"")}`,{method:"POST"})).body.task??de;U(Y),Y.status==="cancelled"&&I(W=>({...W,drafting:!1}))}const Jl=de?.status==="accepted"&&C.drafting,Su=i1(Jl,sr===u?cn:[],Ql),Xe=!!u&&$.ready&&Me.trim()!==""&&!Su;function ra(N){if(!_t.has(N.sessionId))return null;const Y=N.running===!0||N.sessionId===u&&(Jl||C.drafting),W=N.sessionId===u&&sr===u?cn:(jt[N.sessionId]??[]).map(ae=>({status:ae}));return mA(W,Y)}return w.jsxs("div",{className:u?"shell in-chat":"shell",children:[w.jsxs("aside",{className:"side",children:[w.jsxs("div",{className:"side-top",children:[w.jsx("strong",{className:"brand",children:n("app.title")}),w.jsxs("span",{className:"side-actions",children:[w.jsx("button",{type:"button",className:"icon-btn","aria-label":n("session.search"),onClick:()=>S(N=>!N),children:w.jsx(lN,{})}),w.jsx("button",{type:"button",className:"icon-btn","aria-label":n("new.title"),onClick:()=>Fe(!0),children:w.jsx(y1,{})})]})]}),p?w.jsx("input",{className:"filter",value:g,placeholder:n("session.searchPlaceholder"),onChange:N=>y(N.target.value)}):null,h?w.jsx("p",{className:"note",children:h}):null,on?w.jsx("p",{className:"note ok",children:on}):null,w.jsxs("ul",{className:"sessions",children:[jn.length===0&&st.length===0?w.jsx("li",{className:"empty",children:c.length?n("session.noMatch"):n("session.none")}):null,jn.map(N=>{const Y=Sl(N);return w.jsx("li",{children:w.jsxs("button",{type:"button",className:N.sessionId===u?"session selected":"session",title:N.cwd||N.sessionId,onClick:()=>wl(N.sessionId),children:[w.jsxs("span",{className:_t.has(N.sessionId)?"mark bot-mark":"mark",children:[_t.has(N.sessionId)?"BOT":Array.from(Y)[0],w.jsx(g1,{signal:ra(N)})]}),w.jsxs("span",{className:"copy",children:[w.jsx("span",{className:"name",children:Y}),w.jsx("span",{className:"preview",children:(N.sessionId===u?dd(cn,sn,n):"")||A[N.sessionId]||(N.running?n("session.running"):"")})]})]})},N.sessionId)}),st.length>0?w.jsxs("li",{className:"blank-head",children:[w.jsxs("button",{type:"button","aria-expanded":Rt,onClick:()=>en(N=>!N),children:[n(Rt?"session.hide":"session.show")," ",n("session.blankCount",{count:String(st.length)})]}),w.jsx("button",{type:"button",onClick:()=>{Tl()},children:n("session.archiveAll")}),w.jsx("button",{type:"button",onClick:()=>{_i()},children:n("session.purgeAll")})]}):null,Rt?st.map(N=>{const Y=Sl(N);return w.jsxs("li",{className:"session-row",children:[w.jsxs("button",{type:"button",className:N.sessionId===u?"session selected":"session",title:N.cwd||N.sessionId,onClick:()=>wl(N.sessionId),children:[w.jsx("span",{className:_t.has(N.sessionId)?"mark bot-mark":"mark",children:_t.has(N.sessionId)?"BOT":Array.from(Y)[0]}),w.jsxs("span",{className:"copy",children:[w.jsx("span",{className:"name",children:Y}),w.jsx("span",{className:"preview",children:Ot.has(N.sessionId)?n("session.archived"):n("session.blank")})]})]}),Ot.has(N.sessionId)?null:w.jsx("button",{type:"button",className:"session-delete","aria-label":n("session.archiveLabel",{name:Y}),onClick:()=>{dr(N.sessionId)},children:n("session.archive")}),w.jsx("button",{type:"button",className:"session-delete purge","aria-label":n("session.purgeLabel",{name:Y}),onClick:()=>{Zl(N.sessionId)},children:n("session.purge")})]},N.sessionId)}):null]}),oe?w.jsx(nN,{health:Ce,usage:be,execution:$,model:C.model}):null,w.jsxs("div",{className:"me-row",children:[w.jsxs("button",{type:"button",className:"me",onClick:()=>me(N=>!N),children:[w.jsx("span",{className:"mark me-mark",children:n("local.mark")}),w.jsx("span",{children:Ce?.primary?.reachable===!1?n("local.down"):n("local.here")})]}),w.jsx("button",{type:"button",className:"lang-switch",onClick:()=>r(i==="en"?"zh":"en"),children:n("lang.switch")})]})]}),w.jsxs("section",{className:"chat",children:[w.jsxs("header",{className:"chat-head",children:[dt?w.jsx("button",{type:"button",className:"bot-chat-back",onClick:()=>$t(!1),children:n("nav.back")}):tr(u)?w.jsx("button",{type:"button",className:"back",onClick:or,children:n("nav.back")}):w.jsx("button",{type:"button",className:"back",onClick:()=>s(""),children:n("nav.sessions")}),u&&_t.has(u)?w.jsxs("span",{className:"bot-badge",children:["BOT",w.jsx(g1,{signal:ra({sessionId:u,running:c.find(N=>N.sessionId===u)?.running})})]}):null,w.jsx("h1",{children:dt?n("nav.botMessages"):zi}),!dt&&dd(cn,sn,n)?w.jsx("span",{className:"work-chip",children:dd(cn,sn,n)}):null,w.jsx("a",{href:bu,children:n("nav.official")})]}),tr(u)&&!dt?w.jsxs("nav",{className:"work-crumb","aria-label":n("nav.where"),children:[w.jsx("button",{type:"button",onClick:or,children:zn&&Pr(zn)||n("nav.mainSession")}),w.jsx("span",{"aria-hidden":"true",children:"/"}),w.jsx("span",{children:n("nav.worker")})]}):null,kt&&!dt?w.jsx("p",{className:"basis",children:kt}):null,w.jsxs("div",{className:"chat-body",children:[w.jsx(Z3,{active:Qn||Vl,progress:le}),w.jsx("div",{className:"scroll",ref:Mt,"aria-busy":Qn||Vl||void 0,children:w.jsxs("div",{className:"column",children:[u?null:w.jsx("p",{className:"empty-thread",children:n("nav.pick")}),u&&!Qn&&!Vl&&!dt&&_n.length===0&&cn.length===0?w.jsx("p",{className:"empty-thread",children:n("nav.empty")}):null,Qn?null:dt?w.jsx(IA,{items:ar,botLabel:Pr,onOpenFile:(N,Y)=>pe({path:N,line:Y})}):w.jsx(J3,{segments:_n,completed:C.completed,failures:C.failures,retries:C.retries,turnEnds:C.turnEnds,tickets:cn,now:sn,canRetry:!!u&&$.ready&&!Jl,onRetry:N=>{ia(N)},onSupply:Kl,onOpenSession:vu,onOpenFile:(N,Y)=>pe({path:N,line:Y}),onOpenInbox:()=>$t(!0),botLabel:Pr,chat:Ql}),C.drafting&&!dt&&!Qn?w.jsx("p",{className:"live-status",children:w.jsx("span",{className:"shimmer",children:Ql?fA(C.activity,n):C.activity||"Analyzing the request"})}):null]})}),dt||Qn?null:w.jsx(ZA,{root:Mt,marks:ur,busyId:C.drafting&&C.turn!=null?`turn:${C.turn}`:void 0})]}),w.jsx("div",{className:"composer-wrap",hidden:dt,children:w.jsxs("form",{className:"column",onSubmit:N=>{N.preventDefault(),al()},children:[w.jsxs("div",{className:"card",children:[na?w.jsx("div",{className:"mention-menu",role:"listbox","aria-label":n("composer.mention"),children:rl.length===0?w.jsx("p",{className:"mention-empty",children:n("composer.noBot")}):rl.map((N,Y)=>w.jsxs("button",{type:"button",role:"option","aria-selected":Y===kl,className:Y===kl?"active":"",onMouseDown:W=>{W.preventDefault(),la(N)},children:[w.jsx("span",{className:"bot-badge",children:"BOT"}),w.jsx("span",{className:"mention-name",children:N.label})]},N.sessionId))}):null,w.jsx("textarea",{ref:vn,value:Me,rows:1,placeholder:u?pA(cn,n)??(Ql&&Jl?n("composer.interrupt"):_t.has(u)?n("composer.mentionHint"):n("composer.task")):n("composer.pick"),disabled:!u,onChange:N=>{E(N.target.value),mt(N.target.selectionStart??N.target.value.length)},onSelect:N=>mt(N.currentTarget.selectionStart??0),onKeyDown:N=>{if(!N.nativeEvent.isComposing){if(na&&rl.length>0){if(N.key==="ArrowDown"){N.preventDefault(),z(Y=>(Y+1)%rl.length);return}if(N.key==="ArrowUp"){N.preventDefault(),z(Y=>(Y-1+rl.length)%rl.length);return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault();const Y=rl[kl];Y&&la(Y);return}if(N.key==="Escape"){N.preventDefault(),re(ta);return}}N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),al())}}}),w.jsxs("div",{className:"card-row",children:[w.jsxs("div",{className:"tools",ref:tn,children:[w.jsx("button",{type:"button",className:"add","aria-label":n("composer.add"),"aria-haspopup":"menu","aria-expanded":_e,disabled:!u,onClick:()=>Ae(N=>!N),children:w.jsx(y1,{})}),_e?w.jsxs("div",{className:"plus-menu",role:"menu",children:[w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji(),children:n("composer.command")}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission read-only"),children:"Read Only"}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission workspace-write"),children:"Workspace Write"}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission danger-full-access"),children:"Full access"}),w.jsx("p",{className:"plus-note",children:n("composer.filesLater")})]}):null,C.preset?w.jsxs("span",{className:"chip",children:[w.jsx(iN,{preset:C.preset}),Q3(C.preset)]}):null]}),w.jsxs("div",{className:"trailing",children:[C.model?w.jsx("span",{className:"model",children:C.model}):null,Jl?w.jsx("button",{type:"button",className:"stop","aria-label":n("composer.cancel"),onClick:()=>{xs()},children:w.jsx("span",{className:"stop-icon"})}):null,Su?null:w.jsx("button",{type:"submit",className:"send","aria-label":n("composer.send"),disabled:!Xe,children:w.jsx(rN,{})})]})]})]}),w.jsx("p",{className:"stats",children:he||($.ready?K3(C):is($.reason,$.reason,n))})]})})]}),u&&ce?w.jsx(AA,{sessionId:u,path:ce.path,line:ce.line,onClose:()=>pe(null)}):null,gt?w.jsx(MA,{onClose:()=>Fe(!1),onCreated:(N,Y,W)=>{Fl(N,Y,W)}}):null]})}function g1({signal:n}){const{t:i}=wt();if(!n)return null;const r=n==="wait";return w.jsx("span",{className:r?"bot-dot wait":"bot-dot",role:"img","aria-label":i(r?"bot.waiting":"bot.running")})}function K3(n){const i=[];return n.turns!=null&&i.push(`${n.turns} turns`),n.steps!=null&&i.push(`${n.steps} steps`),i.join(" · ")}function J3({segments:n,completed:i,failures:r,retries:u,turnEnds:s,tickets:c,now:d,canRetry:h,onRetry:m,onSupply:g,onOpenSession:y,onOpenFile:p,onOpenInbox:S,botLabel:v,chat:k=!1}){const A=[];let R=null;const C=()=>{R&&(R.segments.length||r[R.turn]||u[R.turn]?.length)&&A.push(R),R=null};for(const K of n){if(K.kind==="user"){C(),D0(K.text)||A.push({type:"user",segment:K});continue}const de=K.turn??-1;(!R||R.turn!==de)&&(C(),R={type:"turn",turn:de,seconds:i[de],segments:[]}),R.segments.push(K)}C();const I=new Set(A.flatMap(K=>K.type==="turn"?[K.turn]:[]));for(const K of Object.keys(r)){const de=Number(K);I.has(de)||A.push({type:"turn",turn:de,seconds:i[de],segments:[]})}const G=R0(c),ne=new Map(c.map(K=>[K.id,K])),le=new Map;for(const K of A)if(K.type==="turn"){for(const de of K0(K.segments))if(de.type==="activity")for(const U of de.segments){if(U.kind!=="tool")continue;const $=B0(U);$&&ne.has($)&&!le.has($)&&le.set($,U.id)}}const H=A.reduce((K,de)=>de.type==="turn"?Math.max(K,de.turn):K,-1),Z=L0(c);return w.jsxs(w.Fragment,{children:[A.map((K,de)=>K.type==="user"?w.jsx($3,{segment:K.segment,botLabel:v,onOpenInbox:S,onOpenFile:p},K.segment.id):w.jsx(tN,{block:K,index:de,blocks:A,failures:r,retries:u,turnEnds:s,latestTurn:H,background:Z,byId:ne,anchorAt:le,now:d,canRetry:h,onRetry:m,onSupply:g,onOpenSession:y,onOpenFile:p,chat:k},`turn-${K.turn}-${K.segments[0]?.id??"failed"}`)),G.filter(K=>!le.has(K.id)).map(K=>w.jsx(H0,{ticket:K,now:d,onSupply:g,onOpen:y},K.id))]})}function $3({segment:n,botLabel:i,onOpenInbox:r,onOpenFile:u}){const s=ps(n.text),c=eh(n.text),{locale:d}=wt(),h=X3(n.time,d);if(c)return w.jsx(wA,{briefing:c,time:h,mark:n.id,onOpenFile:u});if(s){const m=BA([{kind:"in",id:n.id,seq:n.seq,time:n.time,mail:s}],i);return w.jsx(YA,{who:m?.who??"BOT",preview:m?.preview??"",time:h,mark:n.id,onOpen:r})}return w.jsxs("div",{className:"user-row","data-turn":n.id,children:[w.jsx("div",{className:"user-bubble",children:n.text}),h?w.jsx("time",{children:h}):null]})}function W3(n,i,r){for(let u=i-1;u>=0;u-=1){const s=n[u];if(s?.type==="user"&&s.segment&&s.segment.text.trim()!==""){if(ps(s.segment.text)||eh(s.segment.text))continue;if(s.segment.turn==null||s.segment.turn===r)return s.segment.text;break}}return""}function P3(n,i){return n.slice(i+1).some(r=>r.type==="user")}function eN({seconds:n,failure:i,retries:r,prompt:u,continued:s,canRetry:c,onRetry:d,showLabel:h}){const{t:m}=wt(),[g,y]=F.useState(!1);if(!i&&r.length===0)return null;const p=g||s;return w.jsxs("div",{className:"turn-failure",children:[h?w.jsxs("p",{className:"turn-failed-label",children:["Failed",n!=null?w.jsxs(w.Fragment,{children:[" · ",w.jsxs("span",{className:"duration",children:[n,"s"]})]}):null]}):null,r.map(S=>w.jsxs("details",{className:"retry-row",open:S.state==="scheduled",children:[w.jsxs("summary",{children:[S.state==="started"?"Retried model request":"Retrying model request"," (",S.retry,"/",S.maxRetries??"∞",") · ",Math.max(1,Math.ceil(S.delayMs/1e3)),"s"]}),w.jsxs("p",{children:["Retry delay: ",Math.round(S.delayMs),"ms"]}),w.jsxs("p",{children:["Failure reason: ",S.message]})]},`${S.retryId}:${S.retry}`)),i?w.jsxs("p",{className:"turn-error",role:"status",children:[w.jsx("span",{className:"turn-error-title",children:"This turn failed"}),w.jsx("span",{children:i.message}),i.code?w.jsx("code",{children:i.code}):null]}):null,i&&u&&!p?w.jsx("button",{type:"button",className:"retry-turn",disabled:!c,onClick:()=>{y(!0),d(u)},children:m("bot.retry")}):null]})}function tN({block:n,index:i,blocks:r,failures:u,retries:s,turnEnds:c,latestTurn:d,background:h,byId:m,anchorAt:g,now:y,canRetry:p,onRetry:S,onSupply:v,onOpenSession:k,onOpenFile:A,chat:R=!1}){const{t:C}=wt(),I=K0(n.segments),G=I.some(le=>le.type==="activity"),ne=R&&c[n.turn]==="aborted"&&!u[n.turn]&&!(n.turn===d&&h);return w.jsx("div",{children:w.jsxs("div",{"data-turn":`turn:${n.turn}`,children:[I.map(le=>{if(le.type==="text")return w.jsx("div",{className:le.segment.streaming?"assistant streaming":"assistant",children:w.jsx(Pd,{text:le.segment.text,streaming:le.segment.streaming,onOpenFile:A})},le.segment.id);const H=le.segments.filter(Z=>Z.kind==="tool");return w.jsxs(F.Fragment,{children:[w.jsx(R3,{segments:le.segments,quiet:R}),H.filter(Z=>bA(Z)).map(Z=>w.jsx(EA,{text:vA(Z.result,C)},Z.id)),H.flatMap(Z=>{const K=B0(Z),de=K?m.get(K):void 0;return!K||!de||g.get(K)!==Z.id?[]:[w.jsx(H0,{ticket:de,now:y,onSupply:v,onOpen:k},de.id)]})]},le.id)}),ne?w.jsx("p",{className:"work-note",children:C("bot.stopped")}):null,w.jsx(eN,{seconds:n.seconds,failure:u[n.turn],retries:s[n.turn]??[],prompt:W3(r,i,n.turn),continued:P3(r,i),canRetry:p,onRetry:S,showLabel:!G}),n.turn===d&&c[n.turn]==="aborted"&&h?w.jsx("p",{className:"work-note",children:C("bot.stoppedBackground")}):null]})})}function nN({health:n,usage:i,execution:r,model:u}){const{t:s}=wt(),c=n?.primary?.reachable===!0,d=i&&"code"in i&&typeof i.code=="string"?i.code:"";return w.jsxs("div",{className:"status",children:[w.jsx("p",{children:s(c?"health.up":"health.down")}),u?w.jsx("p",{className:"muted",children:u}):null,w.jsx("p",{className:r.ready?"":"muted",children:r.ready?s("health.modelReady"):is(r.reason,r.reason,s)}),w.jsx("p",{className:i?.connected?"":"muted",children:i?.connected?s("health.usageReady"):is(d,i?.error||s("health.usageOff"),s)}),w.jsx("p",{className:"muted",children:s("health.sameSession")})]})}function lN(){return w.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[w.jsx("circle",{cx:"11",cy:"11",r:"6.25",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),w.jsx("path",{d:"M16 16.5L20 20.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function y1(){return w.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:w.jsx("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function iN({preset:n}){return n==="read-only"||n==="readonly"||n==="danger-full-access"||n==="auto"?w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M6.6 2.15C7.5 1.81 8.5 1.81 9.4 2.15L13.92 3.84V7.12C13.92 11.61 10.56 13.6 8 14.58C5.44 13.6 2.08 11.61 2.08 7.12V3.84L6.6 2.15Z",fill:"none",stroke:"currentColor",strokeLinejoin:"round"}),n==="danger-full-access"?w.jsx("path",{d:"M8 4.4V9.9M8 10.8V11.8",fill:"none",stroke:"currentColor"}):null,n==="read-only"||n==="readonly"?w.jsx("path",{d:"M5.09 8.14L7.18 10.24C7.27 10.32 7.4 10.31 7.48 10.23L11.51 5.61",fill:"none",stroke:"currentColor"}):null]}):w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M6.42 1.68C7.44 1.3 8.56 1.3 9.58 1.68L14.1 3.38C14.29 3.45 14.42 3.63 14.42 3.84V6.49L9.23 2.62C8.44 2.32 7.56 2.32 6.77 2.62L2.58 4.19V7.12C2.58 11.18 5.52 13.06 8 14.04C8.28 13.93 8.56 13.81 8.84 13.67C9.07 13.95 9.33 14.19 9.62 14.41C9.12 14.66 8.64 14.87 8.18 15.04C8.06 15.09 7.94 15.09 7.82 15.04C5.22 14.05 1.58 11.94 1.58 7.12V3.84C1.58 3.63 1.7 3.45 1.9 3.38L6.42 1.68Z",fill:"currentColor"}),w.jsx("path",{d:"M5.26 6.6H10.74M5.26 9.87H8.33",fill:"none",stroke:"currentColor"}),w.jsx("path",{d:"M10.03 13.22C12.15 11.95 14.58 8.9 14.78 8.64C14.41 8.37 13.68 7.83 13.5 8.1C12.4 9.72 11.31 11.34 10.21 12.95C10.15 13.04 10.09 13.13 10.03 13.22Z",fill:"currentColor"})]})}function rN(){return w.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:w.jsx("path",{d:"M12 17V7M7 11.5L12 6.5l5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}const ub=document.querySelector("#root");if(!ub)throw new Error("missing root");Xx.createRoot(ub).render(w.jsx(F.StrictMode,{children:w.jsx(sS,{children:w.jsx(F3,{})})}));
57
+ `)}function $A(n,i){const r=ns(n),u=ns(i);if(r.length>180||u.length>180)return[...r.map(y=>({kind:"del",text:y})),...u.map(y=>({kind:"add",text:y}))];const s=r.length+1,c=u.length+1,d=Array.from({length:s},()=>Array(c).fill(0));for(let y=r.length-1;y>=0;y-=1)for(let p=u.length-1;p>=0;p-=1){const S=d[y],v=d[y+1];!S||!v||(S[p]=r[y]===u[p]?(v[p+1]??0)+1:Math.max(v[p]??0,S[p+1]??0))}const h=[];let m=0,g=0;for(;m<r.length&&g<u.length;)r[m]===u[g]?(h.push({kind:"context",text:r[m]??""}),m+=1,g+=1):(d[m+1]?.[g]??0)>=(d[m]?.[g+1]??0)?(h.push({kind:"del",text:r[m]??""}),m+=1):(h.push({kind:"add",text:u[g]??""}),g+=1);for(;m<r.length;)h.push({kind:"del",text:r[m]??""}),m+=1;for(;g<u.length;)h.push({kind:"add",text:u[g]??""}),g+=1;return h}function WA(n){const i=n.split(".").pop()?.toLowerCase()??"";return{py:"python",ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",md:"markdown",css:"css",html:"html",json:"json",sh:"bash",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",rb:"ruby"}[i]??""}function K0(n){return(n.split(`
58
+ `).map(r=>r.trim()).find(Boolean)??"").replaceAll("**","")}function PA(n){if(!n.drafting)return"";const i=[...n.segments].reverse().find(r=>r.kind==="tool"&&r.running);if(i){const r=ys(i.name,i.args),u=Z0(i);return r?`${u} · ${r}`:u}return n.segments.some(r=>r.kind==="assistant"&&r.streaming)?"Replying":n.segments.some(r=>r.kind==="think"&&r.running)?"Thinking":"Analyzing the request"}function e3(n){const i=PA(n);return i===n.activity?n:{...n,activity:i}}function J0(n,i){const r=n.findIndex(u=>u.kind==="tool"&&u.callId===i.callId);if(r>=0){const u=n.slice(),s=u[r];if(!s||s.kind!=="tool")return n;const c=i.result||s.result;return u[r]={...s,name:i.name||s.name,args:i.args||s.args,result:c,error:i.error||s.error,running:c?!1:i.running||s.running,turn:i.turn??s.turn,step:i.step??s.step},u}return gs([...n,i])}function t3(n,i,r,u,s,c){const d=`live:${i}:`,h=n.segments.filter(y=>y.id.startsWith(d));let m=n.segments.filter(y=>!y.id.startsWith(d));const g=[];for(const y of r){const p=u+y.index/100;if(y.kind==="reasoning"&&y.text.trim())g.push({kind:"think",id:`${d}think:${y.index}`,text:y.text,running:!0,seq:p,turn:s,step:c});else if(y.kind==="text"&&y.text)g.push({kind:"assistant",id:`${d}text:${y.index}`,text:y.text,streaming:!0,seq:p,turn:s,step:c});else if(y.kind==="tool-call"&&(y.name||y.args||y.id)){const S=y.id||`${d}tool:${y.index}`,v=[...m,...h].find(A=>A.kind==="tool"&&A.callId===S),k=m.findIndex(A=>A.kind==="tool"&&A.callId===S);if(k>=0){const A=m[k];if(A&&A.kind==="tool"){const R=m.slice();R[k]={...A,name:y.name||A.name,args:y.args||A.args,running:!A.result},m=R}}else g.push({kind:"tool",id:`${d}tool:${y.index}`,callId:S,name:y.name||v?.name||"tool",args:y.args||v?.args||"",result:v?.result??"",error:v?.error??!1,running:!v?.result,seq:v?.seq??p,turn:s,step:c})}}return gs([...m,...g])}function $0(n,i,r){const u=n.find(s=>s.index===i);return u?u.kind===r?n:n.map(s=>s.index===i?{...s,kind:r}:s):[...n,{index:i,kind:r,text:"",id:"",name:"",args:""}].sort((s,c)=>s.index-c.index)}function Zo(n,i,r,u){return $0(n,i,r).map(c=>c.index===i?u({...c,kind:r}):c)}function n3(n,i){const r=Qe(i.index)??0,u=typeof i.type=="string"?i.type:"";if(u==="block-start"){const s=i.blockType==="reasoning"||i.blockType==="tool-call"||i.blockType==="text"?i.blockType:"text";return $0(n,r,s)}if(u==="text-delta"||u==="text-chunks"){const s=typeof i.text=="string"?i.text:a1(i.texts);return Zo(n,r,"text",c=>({...c,text:c.text+s}))}if(u==="reasoning-delta"||u==="reasoning-chunks"){const s=typeof i.text=="string"?i.text:a1(i.texts);return Zo(n,r,"reasoning",c=>({...c,text:c.text+s}))}if(u==="tool-call-delta"||u==="tool-call-chunks"){const s=typeof i.argumentsDelta=="string"?i.argumentsDelta:ts(i.args??i.arguments);return Zo(n,r,"tool-call",c=>({...c,id:typeof i.id=="string"&&i.id?i.id:c.id,name:typeof i.name=="string"&&i.name?i.name:c.name,args:u==="tool-call-chunks"&&s?s:c.args+s}))}if(u==="block-end"&&i.block&&typeof i.block=="object"){const s=i.block,c=s.type==="reasoning"||s.type==="tool-call"||s.type==="text"?s.type:"text";return Zo(n,r,c,d=>({...d,kind:c,text:typeof s.text=="string"?s.text:d.text,id:s.id||d.id,name:s.name||d.name,args:ts(s.arguments)||d.args}))}return n}function a1(n){return Array.isArray(n)?n.filter(i=>typeof i=="string").join(""):""}function W0(n,i){const r=i.data??{},u=r.chunk;if(!u||typeof u!="object")return n;const s=Qe(r.turn),c=Qe(r.step),d=ps(s,c),h=n.live[d]??{seq:i.seq??0,blocks:[]},m=n3(h.blocks,u),g={...n.live,[d]:{seq:h.seq||i.seq||0,blocks:m}},y=h.seq||i.seq||0;return{...n,live:g,drafting:!0,turn:s??n.turn,segments:t3({...n},d,m,y,s,c)}}function P0(n,i){const r=i.data??{},u=nh(r),s=u?.content??[],c=Qe(r.turn),d=Qe(r.step),h=ps(c,d),m={...n.live};delete m[h];let g=n.segments.filter(p=>!p.id.startsWith(`live:${h}:`));g=g.filter(p=>!((p.kind==="think"||p.kind==="assistant")&&p.turn===c&&p.step===d));const y=i.seq??0;return s.forEach((p,S)=>{const v=y+S/100;if(p.type==="reasoning"&&p.text?.trim())g.push({kind:"think",id:`think:${h}:${S}`,text:p.text,running:!1,seq:v,turn:c,step:d});else if(p.type==="text"&&p.text)g.push({kind:"assistant",id:`text:${h}:${S}`,text:p.text,streaming:!1,time:i.time,seq:v,turn:c,step:d,messageId:u?.id});else if(p.type==="tool-call"){const k=p.id||`call:${h}:${S}`,A=g.find(R=>R.kind==="tool"&&R.callId===k);g=g.filter(R=>!(R.kind==="tool"&&R.callId===k)),g.push({kind:"tool",id:`tool:${k}`,callId:k,name:p.name||(A?.kind==="tool"?A.name:"")||"tool",args:ts(p.arguments)||(A?.kind==="tool"?A.args:""),result:A?.kind==="tool"?A.result:"",error:A?.kind==="tool"?A.error:!1,running:A?.kind==="tool"?A.running&&!A.result:!0,seq:A?.seq??v,turn:c,step:d})}}),{...n,live:m,segments:gs(g)}}function l3(n,i){const r=i.data??{},u=typeof r.callId=="string"?r.callId:"";if(!u)return n;const s=Qe(r.turn),c=Qe(r.step);return{...n,segments:J0(n.segments,{kind:"tool",id:`tool:${u}`,callId:u,name:typeof r.name=="string"?r.name:"tool",args:ts(r.arguments),result:"",error:!1,running:!0,seq:i.seq??Number.MAX_SAFE_INTEGER,turn:s,step:c})}}function i3(n,i){const r=i.data??{},u=nh(r),s=u?.toolCallId??(typeof r.callId=="string"?r.callId:"");if(!s)return n;const c=I0(u?.content),d=Qe(r.turn),h=Qe(r.step),m=n.segments.find(g=>g.kind==="tool"&&g.callId===s);return{...n,segments:J0(n.segments,{kind:"tool",id:`tool:${s}`,callId:s,name:m?.kind==="tool"?m.name:"tool",args:m?.kind==="tool"?m.args:"",result:c,error:u?.isError===!0,running:!1,seq:m?.seq??i.seq??Number.MAX_SAFE_INTEGER,turn:d??(m?.kind==="tool"?m.turn:void 0),step:h??(m?.kind==="tool"?m.step:void 0)})}}function r3(n){return lh(n)?.type==="snapshot"}function a3(n){const i=lh(n);if(!i||i.type!=="snapshot")return null;const r=Array.isArray(i.records)?i.records:[];let u=0,s=!1;for(const c of V0(r))typeof c.seq=="number"&&((!s||c.seq<u)&&(u=c.seq),s=!0);return u}function lh(n){if(!n||typeof n!="object")return null;const i=n,r=i.value;if(r&&typeof r=="object"&&!Array.isArray(r)){const u=r;if(typeof u.type=="string")return u}return typeof i.type=="string"?i:null}function eb(n,i){let r=i;for(const u of n.segments)u.seq>r&&(r=u.seq);return r+.5}function u3(n){if(!Array.isArray(n))return[];const i=[];for(const r of n){if(!r||typeof r!="object")continue;const u=r;if(u.type==="chunk"&&u.chunk&&typeof u.chunk=="object"){i.push({time:Qe(u.time)??0,chunk:u.chunk});continue}const s=Qe(u.index)??0,c=Array.isArray(u.texts)?u.texts:Array.isArray(u.args)?u.args:null;if(!c)continue;let d=Qe(u.time0)??0;const h=Array.isArray(u.dt)?u.dt:[];c.forEach((m,g)=>{g>0&&(d+=Qe(h[g-1])??0);const y=typeof m=="string"?m:"";u.type==="text-chunks"?i.push({time:d,chunk:{type:"text-delta",index:s,text:y}}):u.type==="reasoning-chunks"?i.push({time:d,chunk:{type:"reasoning-delta",index:s,text:y}}):u.type==="tool-call-chunks"&&i.push({time:d,chunk:{type:"tool-call-delta",index:s,id:typeof u.id=="string"?u.id:"",...typeof u.name=="string"?{name:u.name}:{},argumentsDelta:y}})})}return i}function tb(n,i,r,u,s,c){return W0(n,{seq:c,data:{turn:i,step:r,chunk:s}})}function u1(n,i,r,u=!1){const s=ps(i,r),c={...n.live};return delete c[s],{...n,live:c,segments:n.segments.filter(d=>!(d.id.startsWith(`live:${s}:`)||u&&d.kind!=="user"&&d.turn===i&&d.step===r&&(d.kind==="assistant"||d.kind==="think")))}}function o3(n,i){const r=n.streamAttempt;if(!r||i.surfaceOp!=null&&i.surfaceOp!=="append")return!1;const u=i.data??{};return Qe(u.turn)!==r.turn||Qe(u.step)!==r.step?!1:i.seq==null||i.seq>r.startedAfterSeq}function lu(n){const i=n.pendingAssistant;return{...i?P0(n,i):n,pendingAssistant:null,streamAttempt:null}}function s3(n,i,r){return{...n,streamAttempt:null,pendingAssistant:null,segments:n.segments.map(u=>u.kind==="user"||u.turn!==i||u.step!==r?u:u.kind==="think"?{...u,running:!1}:u.kind==="tool"?{...u,running:!1}:u.kind==="assistant"?{...u,streaming:!1}:u)}}function c3(n,i){const r=Qe(i.revision)??n.streamRevision;let u={...n,streamRevision:r};const s=i.activeAttempt;if(!s||typeof s!="object")return{...u,streamAttempt:null};const c=s,d=typeof c.attemptId=="string"?c.attemptId:"",h=Qe(c.turn),m=Qe(c.step),g=Qe(c.startedAfterSeq)??r;if(!d||h==null||m==null)return{...u,streamAttempt:null};const y=u3(c.stream),p=Math.min(Qe(c.nextIndex)??y.length,y.length),S=eb(u,g);for(let v=0;v<p;v+=1){const k=y[v];k&&(u=tb(u,h,m,k.time,k.chunk,S))}return{...u,drafting:p>0||u.drafting,streamAttempt:{attemptId:d,turn:h,step:m,nextIndex:p,startedAfterSeq:g}}}function f3(n,i){const r=typeof i.type=="string"?i.type:"",u=Qe(i.revision),s=typeof i.attemptId=="string"?i.attemptId:"";if(u==null||!s)return n;if(r==="start"){const d=Qe(i.turn),h=Qe(i.step);if(d==null||h==null)return n;const m=n.pendingAssistant?lu(n):n;return{...u1(m,d,h,!0),drafting:!0,streamRevision:u,streamAttempt:{attemptId:s,turn:d,step:h,nextIndex:0,startedAfterSeq:Qe(i.startedAfterSeq)??n.streamRevision}}}if(u!==n.streamRevision+1)return{...lu(n),streamRevision:u};const c=n.streamAttempt;if(!c||c.attemptId!==s)return{...n,streamRevision:u};if(r==="chunk"){const d=Qe(i.index),h=i.chunk;if(d==null||!h||typeof h!="object")return{...n,streamRevision:u};if(d!==c.nextIndex)return{...lu(n),streamRevision:u};const m=ps(c.turn,c.step),g=n.live[m]?.seq||eb(n,c.startedAfterSeq);return{...tb(n,c.turn,c.step,Qe(i.time)??0,h,g),streamRevision:u,streamAttempt:{...c,nextIndex:c.nextIndex+1}}}if(r==="end"){const d=i.outcome&&typeof i.outcome=="object"?i.outcome:{},h={...n,streamRevision:u};return d.kind==="abandoned"?{...u1(h,c.turn,c.step),streamAttempt:null,pendingAssistant:null}:d.kind==="committed"&&d.eventType==="assistant/message"?{...lu(h),streamRevision:u}:{...s3(h,c.turn,c.step),streamRevision:u}}return{...n,streamRevision:u}}function d3(n,i){const r=Qe(n.pendingAssistant?.data?.turn),u=n.pendingAssistant&&(i==null||r===i)?lu(n):n,s=Object.fromEntries(Object.entries(u.live).filter(([c])=>!c.startsWith(`${i??""}:`)));return{...u,live:s,segments:u.segments.filter(c=>!(typeof i=="number"&&c.id.startsWith(`live:${i}:`))).map(c=>c.turn!==i?c:c.kind==="think"?{...c,running:!1}:c.kind==="tool"?{...c,running:!1}:c.kind==="assistant"?{...c,streaming:!1}:c)}}function h3(n,i){const r=i.projections,u=r&&typeof r=="object"?r.values??{}:{},s={...n};typeof u.title=="string"&&(s.title=u.title);const c=u.modelSelection&&typeof u.modelSelection=="object"?u.modelSelection.lastUsed:void 0;c?.model&&(s.model=c.model);const d=u.permissions;if(d&&typeof d=="object"){const m=d,g=m.currentValue??m.preset??m.sandbox;typeof g=="string"&&(s.preset=g)}const h=u.sessionStats;if(h&&typeof h=="object"){const m=h.turns,g=h.steps;typeof m=="number"&&(s.turns=m),typeof g=="number"&&(s.steps=g)}return s}function m3(n,i,r){let u=n;const s=lh(i);s?.type==="snapshot"&&(u=h3(u,s));const c=[];nr(i,c);for(const d of c){if(typeof d.type!="string")continue;if(d.seq!=null){if(r.has(d.seq))continue;r.add(d.seq)}const h=d.data??{};if(d.type==="session/title"&&typeof h.title=="string"){const m=h.source&&typeof h.source=="object"?h.source.kind:"";u.title&&m!=="provider"||(u={...u,title:h.title});continue}if(d.type==="request/context"){const m=typeof h.model=="string"?h.model:"";m&&(u={...u,model:m});continue}if(d.type==="turn/start"){const m=Qe(h.turn);if(m!=null&&u.turnEnds?.[m]||m!=null&&u.turn!=null&&m<u.turn)continue;u={...u,drafting:!0,turn:m??u.turn,turnStartedAt:typeof d.time=="number"?d.time:Date.now()};continue}if(d.type==="turn/end"){const m=Qe(h.turn)??u.turn,g={...u.completed};m!=null&&u.turn===m&&u.turnStartedAt!=null&&typeof d.time=="number"&&(g[m]=Math.max(1,Math.round((d.time-u.turnStartedAt)/1e3)));const y=m==null?null:QA(h.reason),p=y==null||m==null?u.failures:{...u.failures,[m]:y},S=h.reason&&typeof h.reason=="object"&&typeof h.reason.kind=="string"?h.reason.kind:"",v=m==null?u.turnEnds??{}:{...u.turnEnds??{},[m]:S||u.turnEnds?.[m]||"ended"};u=d3(u,m),u={...u,drafting:u.turn===m?!1:u.drafting,completed:g,failures:p,turnEnds:v,turnStartedAt:u.turn===m?null:u.turnStartedAt};continue}if(d.type==="llm/retry"){const m=Qe(h.turn),g=typeof h.retryId=="string"?h.retryId:"",y=Qe(h.retry);if(m==null||g===""||y==null)continue;const p=h.failure&&typeof h.failure=="object"?h.failure:{},S={retryId:g,retry:y,maxRetries:Qe(h.maxRetries)??null,delayMs:typeof h.delayMs=="number"?h.delayMs:0,message:typeof p.message=="string"?p.message:"Request failed.",...typeof p.code=="string"?{code:p.code}:{},state:"scheduled"},v=u.retries[m]??[];u={...u,retries:{...u.retries,[m]:[...v.filter(k=>k.retryId!==g||k.retry!==y),S]}};continue}if(d.type==="llm/retry-started"){const m=Qe(h.turn),g=typeof h.retryId=="string"?h.retryId:"",y=Qe(h.retry);if(m==null||g===""||y==null)continue;const p=u.retries[m];if(!p)continue;u={...u,retries:{...u.retries,[m]:p.map(S=>S.retryId===g&&S.retry===y?{...S,state:"started"}:S)}};continue}if(d.type==="assistant/live-chunk"){u=W0(u,d);continue}if(d.type==="user/message"){const m=nh(h);if(!m||m.source?.kind!=="user")continue;const g=I0(m.content);if(!g)continue;u={...u,segments:XA(u.segments,{kind:"user",id:`user:${d.seq??g}`,text:g,time:d.time,seq:d.seq??Number.MAX_SAFE_INTEGER,turn:Qe(h.turn)})};continue}if(d.type==="assistant/message"){o3(u,d)?u={...u,pendingAssistant:d}:u=P0(u,d);continue}if(d.type==="tool/call"){u=l3(u,d);continue}d.type==="tool/result"&&(u=i3(u,d))}if(s?.type==="snapshot"){const d=s.assistantStream;d&&typeof d=="object"&&(u=c3(u,d))}if(s?.type==="assistant-stream"){const d=s.frame;d&&typeof d=="object"&&(u=f3(u,d))}return u}function p3(n,i,r){return e3(m3(n,i,r))}function g3(n){for(let i=n.length-1;i>=0;i-=1){const r=n[i];if(!r||r.kind==="user"&&E1(r.text))continue;const u=r.kind==="user"?rs(r.text):null,s=r.kind==="user"?Md(r.text):null,d=(u?u.body:s?.body?s.body:r.kind==="user"||r.kind==="assistant"?r.text:r.kind==="tool"?r.result||ys(r.name,r.args):K0(r.text)).replace(/```[\s\S]*?```/g," ").replace(/^#{1,6}\s+/gm,"").replace(/[|*_`>]/g," ").replace(/\s+/g," ").trim();if(d)return d.slice(0,80)}return""}const o1=4;function ls(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function s1(n,i){if(!ls(n))return;if(i==="ticket.id"){const u=n.ticket;if(!ls(u))return;const s=u.id;return typeof s=="string"&&s!==""?s:void 0}const r=n[i];if(typeof r=="string"&&r!=="")return r;if(typeof r=="number"&&Number.isFinite(r))return String(r)}function cu(n,i){if(!ls(i)||i.t!=="v"&&i.t!=="o"&&i.t!=="l")return n;const r=i;return r.t==="v"?r.v:r.t==="o"?y3(n,r):b3(n,r)}function y3(n,i){const r=ls(n)?{...n}:{};for(const u of i.d??[])delete r[u];for(const[u,s]of Object.entries(i.s))r[u]=cu(r[u],s);return r}function b3(n,i){const r=i.id,u=Array.isArray(n)?n.slice():[],s=new Set(i.d??[]),c=[],d=new Map;for(const m of u){const g=s1(m,r);g!==void 0&&s.has(g)||(g!==void 0&&d.set(g,c.length),c.push(m))}for(const[m,g]of Object.entries(i.s??{})){const y=d.get(m);if(y===void 0){c.push(cu(void 0,g));continue}c[y]=cu(c[y],g)}if(!i.order)return c;const h=new Map;for(const m of c){const g=s1(m,r);g!==void 0&&h.set(g,m)}return i.order.filter(m=>h.has(m)).map(m=>h.get(m))}function v3(n){const i=atob(n),r=new Uint8Array(i.length);for(let u=0;u<i.length;u+=1)r[u]=i.charCodeAt(u);return r}function x3(n){return!Array.isArray(n)||n.some(i=>typeof i!="string"||i==="")?null:n}function S3(n,i){if(!(!i||typeof i!="object"||Array.isArray(i))){for(const[r,u]of Object.entries(i))if(!(typeof u!="string"||u===""))try{n.set(r,v3(u))}catch{}}}function w3(n,i,r){let u=0;const s=[];for(const h of n){const m=i.get(h);if(!m)return null;s.push(m),u+=m.length}if(typeof r=="number"&&u!==r)return null;const c=new Uint8Array(u);let d=0;for(const h of s)c.set(h,d),d+=h.length;try{const h=JSON.parse(new TextDecoder().decode(c));return Array.isArray(h)?h:!h||typeof h!="object"?null:h}catch{return null}}function c1(n,i){const r=[],u=new Set;for(const s of n)s===""||i.has(s)||u.has(s)||(u.add(s),r.push(s));return r}function k3(n,i=32){const r=[];for(let u=0;u<n.length;u+=i)r.push(n.slice(u,u+i));return r}function T3(n,i){return Array.isArray(n)?n.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return[];const u=v1(i,r);return u?[u]:[]}):[]}function E3(n,i){return i==null?n:n.filter(r=>r.seq<i)}async function nb(n,i,r,u,s=0,c,d){const h=`&tailMessages=${d}`,m=await r(`/snapshot?sessionId=${encodeURIComponent(n)}${h}`),g=typeof m.body.beforeSeq=="number"?m.body.beforeSeq:c??null;if(m.status!==200||m.body.ok!==!0)return{events:null,beforeSeq:g};const y=x3(m.body.hashes),p=m.body.totalSize;if(!y||typeof p!="number")return{events:null,beforeSeq:g};const S=m.body.count;if(typeof S=="number")try{const Z=await i.readEvents(n),K=E3(Z,g);if(K.length===S)return{events:K.map(de=>de.event),beforeSeq:g}}catch{}if(y.length===0)return u?.({loaded:0,total:p}),{events:[],beforeSeq:g};const v=await i.present(y),k=c1(y,v),A=await i.readChunks(y.filter(Z=>v.has(Z)));let R=0;for(const Z of y)v.has(Z)&&(R+=A.get(Z)?.byteLength??0);let C=0;const I=(Z=0)=>{C=Math.max(C,Math.min(p,R+Z)),u?.({loaded:C,total:p})};I();let G=k.length;for(const Z of k3(k,1)){const K=Z.map(Ce=>`hash=${encodeURIComponent(Ce)}`).join("&"),de=Math.max(0,p-R),U=G===0?0:de*(Z.length/G),$=await r(`/snapshot/chunks?sessionId=${encodeURIComponent(n)}&${K}`,(Ce,Ue)=>{const be=Ue!=null&&Ue>0?Math.min(1,Ce/Ue):Math.min(.9,Ce/Math.max(U,1));I(U*be)});if($.status===409&&s===0)return nb(n,i,r,u,1,c,d);if($.status!==200||$.body.ok!==!0)return{events:null,beforeSeq:g};const ue=new Map;if(S3(ue,$.body.chunks),c1(Z,new Set(ue.keys())).length>0)return{events:null,beforeSeq:g};await i.putChunks(ue);for(const Ce of Z)R+=ue.get(Ce)?.byteLength??0;G-=Z.length,I()}const ne=await i.readChunks(y),le=w3(y,ne,p);if(!Array.isArray(le))return{events:null,beforeSeq:g};const H=T3(le,n);return H.length>0&&await i.putEvents(n,H),{events:le,beforeSeq:g}}async function f1(n,i,r,u){const s=r!=null?`&beforeSeq=${r}`:"",c=await u(`/snapshot/range?sessionId=${encodeURIComponent(n)}&fromSeq=${i}${s}`);return c.status!==200||c.body.ok!==!0||!Array.isArray(c.body.events)?null:c.body.events}function C3(n,i){const r=Math.max(0,Math.min(i,n.length)),u=/(?:^|\s)@([^\s@()]*)$/.exec(n.slice(0,r));if(!u||u.index==null)return null;const s=u[1]??"";return{start:u.index+u[0].length-s.length-1,query:s}}function A3(n){return n.replace(/[@()\r\n]/g," ").replace(/\s+/g," ").trim()||"Untitled"}function N3(n,i){return`@${A3(n)} (${i})`}function z3(n,i,r,u,s){const c=Math.max(0,Math.min(i,n.length)),d=`${N3(u,s)} `;return{text:n.slice(0,r)+d+n.slice(c),cursor:r+d.length}}function O3(n,i){const r=i.trim().toLowerCase();return n.filter(u=>r===""?!0:u.label.toLowerCase().includes(r)||u.sessionId.toLowerCase().includes(r)).slice(0,8)}const hd=()=>({segments:[],live:{},activity:"",completed:{},failures:{},retries:{},title:"",model:"",preset:"",turns:null,steps:null,drafting:!1,turn:null,turnStartedAt:null,streamAttempt:null,streamRevision:0,pendingAssistant:null,turnEnds:{}});function is(n,i,r){return oS(n,i,r)}function _3({active:n,progress:i}){const{t:r}=wt(),[u,s]=F.useState(n),[c,d]=F.useState(!1);if(F.useEffect(()=>{if(n){s(!0);return}d(!1)},[n]),F.useEffect(()=>{if(!u||!n)return;const g=window.requestAnimationFrame(()=>d(!0));return()=>window.cancelAnimationFrame(g)},[u,n]),F.useEffect(()=>{if(n||!u)return;const g=window.setTimeout(()=>s(!1),280);return()=>window.clearTimeout(g)},[n,u]),!u)return null;const h=i!=null&&i.total>0,m=h?Math.min(100,Math.round(i.loaded/i.total*100)):0;return w.jsx("div",{className:c?"chunk-loading visible":"chunk-loading",role:"status",children:w.jsxs("div",{className:"chunk-loading-card",children:[w.jsx("p",{children:w.jsx("span",{className:"shimmer",children:h?r("load.messagesPct",{pct:String(m)}):r("load.messages")})}),w.jsx("div",{className:"chunk-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":h?i.total:1,"aria-valuenow":h?i.loaded:0,"aria-label":r("load.aria"),children:w.jsx("div",{className:h?"chunk-progress-fill":"chunk-progress-fill indeterminate",style:h?{width:`${m}%`}:void 0})})]})})}function d1({signal:n}){const{t:i}=wt();if(!n)return null;const r=n==="wait";return w.jsx("span",{className:r?"bot-dot wait":"bot-dot",role:"img","aria-label":i(r?"bot.waiting":"bot.running")})}function j3(n){const i=[];return n.turns!=null&&i.push(`${n.turns} turns`),n.steps!=null&&i.push(`${n.steps} steps`),i.join(" · ")}function M3({health:n,usage:i,execution:r,model:u}){const{t:s}=wt(),c=n?.primary?.reachable===!0,d=i&&"code"in i&&typeof i.code=="string"?i.code:"";return w.jsxs("div",{className:"status",children:[w.jsx("p",{children:s(c?"health.up":"health.down")}),u?w.jsx("p",{className:"muted",children:u}):null,w.jsx("p",{className:r.ready?"":"muted",children:r.ready?s("health.modelReady"):is(r.reason,r.reason,s)}),w.jsx("p",{className:i?.connected?"":"muted",children:i?.connected?s("health.usageReady"):is(d,i?.error||s("health.usageOff"),s)}),w.jsx("p",{className:"muted",children:s("health.sameSession")})]})}function D3(){return w.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[w.jsx("circle",{cx:"11",cy:"11",r:"6.25",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),w.jsx("path",{d:"M16 16.5L20 20.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function h1(){return w.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:w.jsx("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function R3({preset:n}){return n==="read-only"||n==="readonly"||n==="danger-full-access"||n==="auto"?w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M6.6 2.15C7.5 1.81 8.5 1.81 9.4 2.15L13.92 3.84V7.12C13.92 11.61 10.56 13.6 8 14.58C5.44 13.6 2.08 11.61 2.08 7.12V3.84L6.6 2.15Z",fill:"none",stroke:"currentColor",strokeLinejoin:"round"}),n==="danger-full-access"?w.jsx("path",{d:"M8 4.4V9.9M8 10.8V11.8",fill:"none",stroke:"currentColor"}):null,n==="read-only"||n==="readonly"?w.jsx("path",{d:"M5.09 8.14L7.18 10.24C7.27 10.32 7.4 10.31 7.48 10.23L11.51 5.61",fill:"none",stroke:"currentColor"}):null]}):w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M6.42 1.68C7.44 1.3 8.56 1.3 9.58 1.68L14.1 3.38C14.29 3.45 14.42 3.63 14.42 3.84V6.49L9.23 2.62C8.44 2.32 7.56 2.32 6.77 2.62L2.58 4.19V7.12C2.58 11.18 5.52 13.06 8 14.04C8.28 13.93 8.56 13.81 8.84 13.67C9.07 13.95 9.33 14.19 9.62 14.41C9.12 14.66 8.64 14.87 8.18 15.04C8.06 15.09 7.94 15.09 7.82 15.04C5.22 14.05 1.58 11.94 1.58 7.12V3.84C1.58 3.63 1.7 3.45 1.9 3.38L6.42 1.68Z",fill:"currentColor"}),w.jsx("path",{d:"M5.26 6.6H10.74M5.26 9.87H8.33",fill:"none",stroke:"currentColor"}),w.jsx("path",{d:"M10.03 13.22C12.15 11.95 14.58 8.9 14.78 8.64C14.41 8.37 13.68 7.83 13.5 8.1C12.4 9.72 11.31 11.34 10.21 12.95C10.15 13.04 10.09 13.13 10.03 13.22Z",fill:"currentColor"})]})}function L3(){return w.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:w.jsx("path",{d:"M12 17V7M7 11.5L12 6.5l5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function bs({open:n,children:i,className:r}){const[u,s]=F.useState(n),[c,d]=F.useState(n);F.useLayoutEffect(()=>{if(n){s(!0);const g=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(g)}d(!1),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&s(!1)},[n]);function h(g){g.target!==g.currentTarget||g.propertyName!=="grid-template-rows"||n||s(!1)}const m=["coll-container",c?"expand":"",r].filter(Boolean).join(" ");return w.jsx("div",{className:m,onTransitionEnd:h,children:w.jsx("div",{children:u?i:null})})}function lb({ticket:n,now:i,onSupply:r,onOpen:u}){const{t:s}=wt(),[c,d]=F.useState(""),[h,m]=F.useState(""),[g,y]=F.useState(!1),p=ES(n),S=n.status==="started"||n.status==="needs_user";return w.jsxs("article",{className:"work-card",children:[w.jsxs("header",{children:[w.jsx("h3",{children:n.summary}),n.status==="ready"?null:w.jsx("span",{className:S?"work-status live":"work-status",children:T1(n.status,s)})]}),TS(n,i,s).map(v=>w.jsx("p",{children:v},v)),n.childSessionId?w.jsx("button",{type:"button",className:"work-open",onClick:()=>u(n.childSessionId??""),children:s("work.openWorker")}):null,p?w.jsx("p",{className:p.stale?"stale":"work-question",children:p.text||s("work.questionEmpty")}):null,p?.stale?w.jsx("p",{className:"work-quiet",children:s("work.questionStale")}):null,n.status==="needs_user"?w.jsxs("form",{className:"work-reply",onSubmit:v=>{v.preventDefault();const k=c.trim();!k||g||(y(!0),m(""),r(n.id,k).then(A=>{y(!1),A?m(A):d("")}))},children:[w.jsxs("label",{children:[w.jsx("span",{children:s("work.answerLabel")}),w.jsx("textarea",{value:c,rows:2,disabled:g,onChange:v=>d(v.target.value)})]}),h?w.jsx("p",{className:"work-error",children:h}):null,w.jsx("button",{type:"submit",disabled:g||c.trim()==="",children:s("work.answerSubmit")})]}):null]})}function B3({briefing:n,time:i,mark:r,onOpenFile:u}){const{t:s}=wt(),[c,d]=F.useState(!1),h=n.body.split(`
59
+ `).map(g=>g.trim()).find(Boolean)??"",m=[n.wallMs!=null?s("work.duration",{value:U3(n.wallMs,s)}):"",n.maxTokens!=null?`token ${n.maxTokens.toLocaleString("en-US")}`:"",n.material?s("work.material",{hash:n.material.slice(0,8)}):""].filter(Boolean);return w.jsxs("div",{className:"briefing-row","data-turn":r,children:[w.jsxs("article",{className:c?"briefing-card open":"briefing-card",children:[w.jsxs("button",{type:"button",className:"briefing-toggle","aria-expanded":c,onClick:()=>d(g=>!g),children:[w.jsx("span",{className:"briefing-title",children:n.cancel?s("work.cancelTitle"):s("work.taskTitle")}),w.jsx("span",{className:"briefing-rev",children:s("work.generation",{revision:String(n.revision)})}),w.jsx(q3,{}),h&&!c?w.jsx("span",{className:"briefing-preview",children:h}):null]}),w.jsx(bs,{open:c,children:w.jsxs("div",{className:"briefing-body",children:[n.body?w.jsx(th,{text:n.body,onOpenFile:u}):null,m.length?w.jsx("p",{className:"briefing-facts",children:m.join(" · ")}):null,n.notes.map(g=>w.jsx("p",{className:"briefing-note",children:g},g))]})})]}),i?w.jsx("time",{children:i}):null]})}function U3(n,i){return n%6e4===0?i("work.minutes",{count:String(n/6e4)}):n%1e3===0?i("work.seconds",{count:String(n/1e3)}):i("work.milliseconds",{count:String(n)})}function q3(){return w.jsx("svg",{className:"briefing-chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4 6.5L8 10.5L12 6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function H3({text:n}){return w.jsx("p",{className:"work-refused",children:n})}function m1({segment:n}){const[i,r]=F.useState(!1),u=K0(n.text);return w.jsxs("div",{className:i?"official-row open":"official-row","data-variant":"think","data-state":n.running?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":i,onClick:()=>r(s=>!s),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[w.jsx(F3,{}),w.jsx(ih,{})]}),w.jsx("span",{className:n.running?"official-label shimmer":"official-label",children:"Think"}),u?w.jsx("span",{className:"official-dot"}):null,u?w.jsx("span",{className:n.running?"official-summary streaming":"official-summary",children:u}):null]}),w.jsx(bs,{open:i,children:w.jsx("div",{className:"think-body",children:n.text})})]})}function Y3({segments:n,quiet:i=!1}){const{t:r}=wt(),[u,s]=F.useState(!1),c=n.some(h=>h.running);if(i&&xS(n))return null;if(n.every(h=>h.kind==="think"))return n.map(h=>w.jsx(m1,{segment:h},h.id));const d=i?r(c?"bot.thinking":"bot.processed"):FA(n,c);return w.jsxs("div",{className:u?"activity-group open":"activity-group","data-state":c?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":u,onClick:()=>s(h=>!h),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[c?w.jsx(rb,{}):w.jsx(ab,{}),w.jsx(ih,{})]}),w.jsx("span",{className:c?"official-label shimmer":"official-label",children:d})]}),w.jsx(bs,{open:u,children:w.jsx("div",{className:"activity-body",children:n.map(h=>h.kind==="think"?w.jsx(m1,{segment:h},h.id):w.jsx(I3,{segment:h},h.id))})})]})}function I3({segment:n}){const[i,r]=F.useState(!1),u=KA(n),s=u?.name||Z3(n)||ys(n.name,n.args),c=!!(u||n.result||n.args);return w.jsxs("div",{className:i?"official-row open":"official-row","data-state":n.error?"error":n.running?"running":"ok",children:[w.jsxs("button",{type:"button",className:"official-title","aria-expanded":i,disabled:!c,onClick:()=>r(d=>!d),children:[w.jsxs("span",{className:"official-leading","aria-hidden":"true",children:[w.jsx(rb,{}),w.jsx(ih,{})]}),w.jsx("span",{className:n.running?"official-label shimmer":"official-label",children:Z0(n)}),s?w.jsx("span",{className:"official-dot"}):null,s?w.jsx("span",{className:"official-summary",children:s}):null,u?w.jsxs("span",{className:"official-size",children:[u.kilobytes,"KB"]}):null,u?w.jsx(X3,{added:u.added,removed:u.removed}):null]}),c?w.jsx(bs,{open:i,children:w.jsx(V3,{segment:n,change:u})}):null]})}function V3({segment:n,change:i}){if(i)return w.jsx(G3,{change:i});const r=ys(n.name,n.args);return w.jsxs("div",{className:"diff-card",children:[w.jsxs("div",{className:"diff-head",children:[w.jsx("span",{className:"diff-lang",children:r||n.name}),w.jsx(ib,{text:n.result||r})]}),n.result?w.jsx("pre",{className:"diff-output",children:n.result}):null]})}function G3({change:n}){const i=n.lines.map(r=>`${r.kind==="del"?"- ":r.kind==="add"?"+ ":" "}${r.text}`).join(`
60
+ `);return w.jsxs("div",{className:"diff-card","data-diff":"",children:[w.jsxs("div",{className:"diff-head",children:[w.jsxs("span",{className:"diff-heading",children:[w.jsx("span",{className:"diff-lang",children:n.language||"Code block"}),w.jsx("span",{className:"diff-file",children:n.name})]}),w.jsx(ib,{text:i})]}),w.jsx("div",{className:"diff-body",children:n.lines.map((r,u)=>w.jsx("div",{className:Q3(r.kind),children:r.text},u))})]})}function Q3(n){return n==="add"?"diff-line added":n==="del"?"diff-line removed":"diff-line same"}function X3({added:n,removed:i}){return w.jsxs("span",{className:"diff-counts",children:[w.jsxs("span",{className:"diff-plus",children:["+",n]}),w.jsxs("span",{className:"diff-minus",children:["-",i]})]})}function ib({text:n}){const[i,r]=F.useState(!1);return w.jsx("button",{type:"button",className:"diff-copy","aria-label":i?"Copied":"Copy",onClick:u=>{u.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{r(!0),window.setTimeout(()=>r(!1),1e3)})},children:i?w.jsx(ab,{}):w.jsx(K3,{})})}function Z3(n){try{const i=JSON.parse(n.args);if(typeof i.description=="string"&&i.description.trim())return i.description.trim();if(typeof i.command=="string")return i.command.replace(/\s+/g," ").trim()}catch{return""}return""}function ih(){return w.jsx("svg",{className:"chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M4 6.5L8 10.5L12 6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function F3(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("path",{d:"M8 1.8c2.8 0 5 2 5 4.6 0 1.6-.8 3-2 3.8-.4.3-.6.7-.6 1.1V12H5.6v-.7c0-.4-.2-.8-.6-1.1-1.2-.8-2-2.2-2-3.8 0-2.6 2.2-4.6 5-4.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M6.2 13.6h3.6",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function rb(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.2 4.2h9.6M3.2 8h9.6M3.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function K3(){return w.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[w.jsx("rect",{x:"5.2",y:"5.2",width:"7.2",height:"7.6",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),w.jsx("path",{d:"M10.2 5.2V3.8A1.3 1.3 0 0 0 8.9 2.5H3.8A1.3 1.3 0 0 0 2.5 3.8v5.1A1.3 1.3 0 0 0 3.8 10.2H5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function ab(){return w.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:w.jsx("path",{d:"M3.5 8.2L6.4 11.1L12.5 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function J3(n,i){if(!n)return"";const r=new Date(n);return Number.isNaN(r.getTime())?"":r.toLocaleTimeString(i==="zh"?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"})}function $3({segments:n,completed:i,failures:r,retries:u,turnEnds:s,tickets:c,now:d,canRetry:h,onRetry:m,onSupply:g,onOpenSession:y,onOpenFile:p,onOpenInbox:S,botLabel:v,chat:k=!1}){const A=[];let R=null;const C=()=>{R&&(R.segments.length||r[R.turn]||u[R.turn]?.length)&&A.push(R),R=null};for(const K of n){if(K.kind==="user"){C(),E1(K.text)||A.push({type:"user",segment:K});continue}const de=K.turn??-1;(!R||R.turn!==de)&&(C(),R={type:"turn",turn:de,seconds:i[de],segments:[]}),R.segments.push(K)}C();const I=new Set(A.flatMap(K=>K.type==="turn"?[K.turn]:[]));for(const K of Object.keys(r)){const de=Number(K);I.has(de)||A.push({type:"turn",turn:de,seconds:i[de],segments:[]})}const G=C1(c),ne=new Map(c.map(K=>[K.id,K])),le=new Map;for(const K of A)if(K.type==="turn"){for(const de of F0(K.segments))if(de.type==="activity")for(const U of de.segments){if(U.kind!=="tool")continue;const $=N1(U);$&&ne.has($)&&!le.has($)&&le.set($,U.id)}}const H=A.reduce((K,de)=>de.type==="turn"?Math.max(K,de.turn):K,-1),Z=A1(c);return w.jsxs(w.Fragment,{children:[A.map((K,de)=>K.type==="user"?w.jsx(W3,{segment:K.segment,botLabel:v,onOpenInbox:S,onOpenFile:p},K.segment.id):w.jsx(nN,{block:K,index:de,blocks:A,failures:r,retries:u,turnEnds:s,latestTurn:H,background:Z,byId:ne,anchorAt:le,now:d,canRetry:h,onRetry:m,onSupply:g,onOpenSession:y,onOpenFile:p,chat:k},`turn-${K.turn}-${K.segments[0]?.id??"failed"}`)),G.filter(K=>!le.has(K.id)).map(K=>w.jsx(lb,{ticket:K,now:d,onSupply:g,onOpen:y},K.id))]})}function W3({segment:n,botLabel:i,onOpenInbox:r,onOpenFile:u}){const s=rs(n.text),c=Md(n.text),{locale:d}=wt(),h=J3(n.time,d);if(c)return w.jsx(B3,{briefing:c,time:h,mark:n.id,onOpenFile:u});if(s){const m=YS([{kind:"in",id:n.id,seq:n.seq,time:n.time,mail:s}],i);return w.jsx(BA,{who:m?.who??"BOT",preview:m?.preview??"",time:h,mark:n.id,onOpen:r})}return w.jsxs("div",{className:"user-row","data-turn":n.id,children:[w.jsx("div",{className:"user-bubble",children:n.text}),h?w.jsx("time",{children:h}):null]})}function P3(n,i,r){for(let u=i-1;u>=0;u-=1){const s=n[u];if(s?.type==="user"&&s.segment&&s.segment.text.trim()!==""){if(rs(s.segment.text)||Md(s.segment.text))continue;if(s.segment.turn==null||s.segment.turn===r)return s.segment.text;break}}return""}function eN(n,i){return n.slice(i+1).some(r=>r.type==="user")}function tN({seconds:n,failure:i,retries:r,prompt:u,continued:s,canRetry:c,onRetry:d,showLabel:h}){const{t:m}=wt(),[g,y]=F.useState(!1);if(!i&&r.length===0)return null;const p=g||s;return w.jsxs("div",{className:"turn-failure",children:[h?w.jsxs("p",{className:"turn-failed-label",children:["Failed",n!=null?w.jsxs(w.Fragment,{children:[" ","· ",w.jsxs("span",{className:"duration",children:[n,"s"]})]}):null]}):null,r.map(S=>w.jsxs("details",{className:"retry-row",open:S.state==="scheduled",children:[w.jsxs("summary",{children:[S.state==="started"?"Retried model request":"Retrying model request"," (",S.retry,"/",S.maxRetries??"∞",") · ",Math.max(1,Math.ceil(S.delayMs/1e3)),"s"]}),w.jsxs("p",{children:["Retry delay: ",Math.round(S.delayMs),"ms"]}),w.jsxs("p",{children:["Failure reason: ",S.message]})]},`${S.retryId}:${S.retry}`)),i?w.jsxs("p",{className:"turn-error",role:"status",children:[w.jsx("span",{className:"turn-error-title",children:"This turn failed"}),w.jsx("span",{children:i.message}),i.code?w.jsx("code",{children:i.code}):null]}):null,i&&u&&!p?w.jsx("button",{type:"button",className:"retry-turn",disabled:!c,onClick:()=>{y(!0),d(u)},children:m("bot.retry")}):null]})}function nN({block:n,index:i,blocks:r,failures:u,retries:s,turnEnds:c,latestTurn:d,background:h,byId:m,anchorAt:g,now:y,canRetry:p,onRetry:S,onSupply:v,onOpenSession:k,onOpenFile:A,chat:R=!1}){const{t:C}=wt(),I=F0(n.segments),G=I.some(le=>le.type==="activity"),ne=R&&c[n.turn]==="aborted"&&!u[n.turn]&&!(n.turn===d&&h);return w.jsx("div",{children:w.jsxs("div",{"data-turn":`turn:${n.turn}`,children:[I.map(le=>{if(le.type==="text")return w.jsx("div",{className:le.segment.streaming?"assistant streaming":"assistant",children:w.jsx(th,{text:le.segment.text,streaming:le.segment.streaming,onOpenFile:A})},le.segment.id);const H=le.segments.filter(Z=>Z.kind==="tool");return w.jsxs(F.Fragment,{children:[w.jsx(Y3,{segments:le.segments,quiet:R}),H.filter(Z=>CS(Z)).map(Z=>w.jsx(H3,{text:AS(Z.result,C)},Z.id)),H.flatMap(Z=>{const K=N1(Z),de=K?m.get(K):void 0;return!K||!de||g.get(K)!==Z.id?[]:[w.jsx(lb,{ticket:de,now:y,onSupply:v,onOpen:k},de.id)]})]},le.id)}),ne?w.jsx("p",{className:"work-note",children:C("bot.stopped")}):null,w.jsx(tN,{seconds:n.seconds,failure:u[n.turn],retries:s[n.turn]??[],prompt:P3(r,i,n.turn),continued:eN(r,i),canRetry:p,onRetry:S,showLabel:!G}),n.turn===d&&c[n.turn]==="aborted"&&h?w.jsx("p",{className:"work-note",children:C("bot.stoppedBackground")}):null]})})}function p1(){const n=location.hash.replace(/^#\/?/,"").split("/");for(let i=0;i<n.length-1;i+=1){const r=n[i],u=n[i+1];if(r==="s"&&u)return decodeURIComponent(u)}return""}function md(n){try{const i=JSON.parse(sessionStorage.getItem(n)||"{}");return i&&typeof i=="object"?i:{}}catch{return{}}}function g1(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const i={};for(const[r,u]of Object.entries(n))typeof u=="string"&&u!==""&&(i[r]=u);return i}function pd(n){fetch("/dsh-bot/api/sessions/previews",{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(n),keepalive:!0})}function y1(n){return(n??"").split("/").filter(Boolean).at(-1)??""}function lN(){return new Promise(n=>{const i=location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${i}//${location.host}/api/remote.mux`),u=window.setTimeout(()=>{r.close(),n([])},4e3),s=c=>{window.clearTimeout(u),r.close(),n(c)};r.addEventListener("open",()=>{r.send(JSON.stringify({type:"open",streamId:"archive",endpoint:"workspace/follow",payload:{args:{}}}))}),r.addEventListener("message",c=>{try{const d=JSON.parse(String(c.data)),h=d.value?.type==="baseline"?d.value.value?.archivedSessionIds:void 0;if(!Array.isArray(h))return;s(h.filter(m=>typeof m=="string"))}catch{}}),r.addEventListener("error",()=>s([]))})}function iN(n){return n==="workspace-write"?"Workspace Write":n==="read-only"||n==="readonly"?"Read Only":n==="danger-full-access"?"Full access":n==="auto"?"Auto review":n}function rN(){const{t:n,locale:i,setLocale:r}=wt(),[u,s]=F.useState(p1),[c,d]=F.useState([]),[h,m]=F.useState(""),[g,y]=F.useState(""),[p,S]=F.useState(!1),[v,k]=F.useState(()=>md("dsh-bot.titles")),[A,R]=F.useState(()=>md("dsh-bot.previews")),[C,I]=F.useState(hd),[G,ne]=F.useState(""),[le,H]=F.useState(null),[Z,K]=F.useState(u);Z!==u&&(K(u),I(hd()));const[de,U]=F.useState(null),[$,ue]=F.useState({ready:!1,reason:"loading"}),[Ce,Ue]=F.useState(null),[be,ee]=F.useState(null),[oe,me]=F.useState(!1),[Me,E]=F.useState(""),[ot,mt]=F.useState(0),[O,z]=F.useState(0),[J,re]=F.useState(""),[he,Te]=F.useState(""),[_e,Ae]=F.useState(!1),[ce,pe]=F.useState(null),[Ot,tl]=F.useState(()=>new Set),[nl,en]=F.useState(!1),[gt,Fe]=F.useState(!1),[dt,$t]=F.useState(!1),[on,Vn]=F.useState(""),[Il,ll]=F.useState(0),[_t,il]=F.useState(()=>new Set),[V,te]=F.useState({}),[ve,Ne]=F.useState({}),[vt,et]=F.useState(!1),[jt,Wt]=F.useState({}),[sn,Gn]=F.useState(()=>Date.now()),[zn,Ci]=F.useState(""),kt=US(u,Il),Mt=F.useRef(null),vn=F.useRef(null),tn=F.useRef(null),Ai=F.useRef(0),Wr=F.useRef(new Map),Ni=F.useRef(0),pu=F.useRef(new Map),gu=F.useRef(!1),nn=F.useRef(u),qt=F.useRef(()=>{}),On=F.useRef(()=>{}),Ht=F.useRef(async()=>null),yu=F.useRef($x());nn.current=u;function Sl(N){return V[N.sessionId]||v[N.sessionId]||N.title||y1(N.cwd)||n("session.unnamed")}function Pr(N){const Y=c.find(W=>W.sessionId===N);return Y?Sl(Y):V[N]||v[N]||""}const ar=j1(C.segments),Qn=u!==""&&G!==u,Vl=le!=null&&le.total>0&&le.loaded<le.total,_n=F.useMemo(()=>HS(C.segments),[C.segments]),ur=F.useMemo(()=>GA(_n),[_n]),zi=u?Sl({sessionId:u,cwd:c.find(N=>N.sessionId===u)?.cwd,title:C.title||null}):n("app.title"),bu=u?`/#/s/${encodeURIComponent(u)}`:"/";function wl(N){$t(!1),s(N),Ae(!1),pe(null),U(null),Te(""),Vn("");const Y=N?`#/s/${encodeURIComponent(N)}`:"#/";location.hash!==Y&&history.replaceState(null,"",Y)}function vu(N){if(!N||N===u)return;const Y=u;$t(!1),s(N),Ae(!1),pe(null),U(null),Te(""),Vn("");const W=`#/s/${encodeURIComponent(N)}`;location.hash!==W&&history.pushState({kind:"worker",owner:Y},"",W)}function or(){if($t(!1),Ae(!1),pe(null),history.state?.kind==="worker"){history.back();return}zn&&wl(zn)}F.useEffect(()=>{let N=!1;return lN().then(Y=>{N||tl(new Set(Y))}),()=>{N=!0}},[]);function Gl(N){const Y=gS(N);Y&&(Wt(Y.signals),Ne(Y.cards),et(!0));const W=N.desk;if(!W||typeof W!="object"||Array.isArray(W))return;const ae=W,xe=ae.sessions;if(xe&&typeof xe=="object"&&!Array.isArray(xe)){const we=xe,Ee=we.result;if(Ee?.ok!==!0)m(Ee?.error?.message||String(we.error||n("session.listUnavailable")));else if(m(""),d(Ee.value?.items??[]),cr(we.previews),!gu.current){gu.current=!0;const xt=g1(we.previews),fn={};for(const[$e,Yt]of Object.entries(md("dsh-bot.previews")))!xt[$e]&&Yt&&(fn[$e]=Yt);Object.keys(fn).length>0&&pd({previews:fn})}}const ge=ae.bots;if(ge&&typeof ge=="object"&&!Array.isArray(ge)&&ge.ok===!0){const we=ge,Ee=Array.isArray(we.bots)?we.bots:[],xt=Ee.flatMap($e=>{if(!$e||typeof $e!="object")return[];const Yt=$e.sessionId;return typeof Yt=="string"?[Yt]:[]}),fn={};for(const $e of Ee){if(!$e||typeof $e!="object")continue;const Yt=$e.sessionId,El=$e.name;typeof Yt=="string"&&typeof El=="string"&&El!==""&&(fn[Yt]=El)}if(xt.length===0&&Array.isArray(we.sessionIds))for(const $e of we.sessionIds)typeof $e=="string"&&xt.push($e);il(new Set(xt)),te(fn)}const qe=ae.health;if(qe&&typeof qe=="object"&&!Array.isArray(qe)){const we=qe;Ue(we),we.execution&&ue({ready:we.execution.ready===!0,reason:we.execution.reason||(we.execution.ready===!0?"":"catalog_unreadable")})}const je=ae.usage;je&&typeof je=="object"&&!Array.isArray(je)&&ee(je)}F.useEffect(()=>{let N=!1;return(async()=>{try{const Y=await Yn("/sessions");if(N)return;const W=Y.body.result;W?.ok===!0?(m(""),d(W.value?.items??[]),cr(Y.body.previews)):Y.status!==200&&m(W?.error?.message||n("session.listUnavailable"))}catch{}try{const Y=await Yn("/sessions/bots");if(N||Y.body.ok!==!0)return;const W=Array.isArray(Y.body.bots)?Y.body.bots:[],ae=W.flatMap(ge=>{if(!ge||typeof ge!="object")return[];const qe=ge.sessionId;return typeof qe=="string"?[qe]:[]}),xe={};for(const ge of W){if(!ge||typeof ge!="object")continue;const qe=ge.sessionId,je=ge.name;typeof qe=="string"&&typeof je=="string"&&je!==""&&(xe[qe]=je)}if(ae.length===0&&Array.isArray(Y.body.sessionIds))for(const ge of Y.body.sessionIds)typeof ge=="string"&&ae.push(ge);il(new Set(ae)),te(xe)}catch{}})(),()=>{N=!0}},[]),F.useEffect(()=>{let N=!1,Y=null,W=0,ae,xe;const ge=je=>{let we;try{we=JSON.parse(String(je.data))}catch{return null}return we.ok===!0?we:null},qe=()=>{Y?.close(),ae=void 0,xe=void 0;const je=new EventSource("/dsh-bot/api/live");Y=je,je.addEventListener("snapshot",we=>{if(N||Y!==je)return;const Ee=ge(we);Ee&&(Ee.desk!==void 0&&(ae=Ee.desk),Ee.work!==void 0&&(xe=Ee.work),Gl(Ee))}),je.addEventListener("delta",we=>{if(N||Y!==je)return;const Ee=ge(we);if(!Ee)return;const xt={ok:!0};Ee.desk!==void 0&&ae!==void 0&&(ae=cu(ae,Ee.desk),xt.desk=ae),Ee.work!==void 0&&xe!==void 0&&(xe=cu(xe,Ee.work),xt.work=xe),(xt.desk!==void 0||xt.work!==void 0)&&Gl(xt)}),je.addEventListener("error",()=>{N||Y!==je||(je.close(),Y===je&&(Y=null),W=window.setTimeout(qe,2e3))})};return qe(),()=>{N=!0,window.clearTimeout(W),Y?.close()}},[]),F.useEffect(()=>{const N=()=>{$t(!1),Ae(!1),pe(null),U(null),Te(""),Vn(""),s(p1())};return window.addEventListener("hashchange",N),()=>window.removeEventListener("hashchange",N)},[]),F.useEffect(()=>{let N=!1,Y=null,W=0,ae=0,xe="",ge=0,qe=new Set,je=[],we=0,Ee="",xt=!1,fn=null,$e=null;const Yt=We=>{if($e){const Ge=$e;$e=null,Ge(null)}Ee=We,xt=!1,fn=null},El=(We,Ge)=>{if(We!==Ee||xt||(xt=!0,fn=Ge,!$e))return;const ul=$e;$e=null,ul(Ge)},wu=We=>We===Ee&&xt?Promise.resolve(fn):new Promise(Ge=>{if(We===Ee&&xt){Ge(fn);return}$e&&$e(null),$e=Ge,Ee=We}),Cl=()=>{if(we=0,N)return;const We=je;je=[];const Ge=nn.current,ul=We.some(It=>r3(It));if(I(It=>We.reduce((xn,ol)=>p3(xn,ol,qe),It)),ul&&Ge){ne(Ge);for(const It of We){const xn=a3(It);if(xn!=null){El(Ge,xn);break}}}if(Ge){const It=We.flatMap(xn=>V0(xn).flatMap(ol=>{const sa=v1(Ge,ol);return sa?[sa]:[]}));It.length>0&&yu.current.putEvents(Ge,It).catch(()=>{})}},ws=()=>{je=[],we&&window.cancelAnimationFrame(we),we=0,qe=new Set},aa=We=>!Y||Y.readyState!==WebSocket.OPEN?!1:(Y.send(JSON.stringify(We)),!0),ua=We=>{if(!We)return;ge+=1;const Ge=`follow-${ge}`;xe=aa({type:"open",streamId:Ge,endpoint:"session/follow",payload:{args:{request:{address:{kind:"session",sessionId:We},maxMessages:o1,assistantStream:!0}}}})?Ge:""},oa=We=>{Yt(We),ws(),xe&&aa({type:"cancel",streamId:xe}),xe="",ua(We)},ku=()=>{const We=location.protocol==="https:"?"wss:":"ws:",Ge=new WebSocket(`${We}//${location.host}/api/remote.mux`);Y=Ge,Ge.addEventListener("open",()=>{N||Y!==Ge||(W=0,xe="",ua(nn.current))}),Ge.addEventListener("message",ul=>{let It;try{It=JSON.parse(String(ul.data))}catch{return}It.streamId!==xe||It.type!=="item"||(je.push(It),we||(we=window.requestAnimationFrame(Cl)))}),Ge.addEventListener("close",()=>{N||Y!==Ge||(xe="",W+=1,W<=3?ae=window.setTimeout(ku,1e3):El(nn.current,null))})},ks=We=>{N||We.length===0||(je.push(...We),we||(we=window.requestAnimationFrame(Cl)))};return qt.current=oa,On.current=ks,Ht.current=wu,ku(),()=>{N=!0,qt.current=()=>{},On.current=()=>{},Ht.current=async()=>null,$e&&$e(null),window.clearTimeout(ae),we&&window.cancelAnimationFrame(we),Y?.close()}},[]),F.useEffect(()=>{if(u&&I(hd()),H(null),qt.current(u),!u)return;const N=Ht.current(u);let Y=!1;const W=ae=>{Y||nn.current!==u||ae.length===0||(On.current(ae),ne(u))};return(async()=>{const ae=yu.current;try{await ae.open()}catch{return}if(Y||nn.current!==u)return;try{const ge=await ae.readEvents(u);W(ge.map(qe=>qe.event))}catch{}const xe=async(ge,qe)=>{if(!qe)return Yn(ge);const je=await fetch("/dsh-bot/api"+ge,{headers:{accept:"application/json"}});let we=null;try{we=await Zx(je,qe)}catch{we=null}const Ee=we&&typeof we=="object"&&!Array.isArray(we)?we:{};return{status:je.status,body:Ee}};try{const ge=await nb(u,ae,xe,Ee=>{Y||nn.current!==u||H(Ee.loaded<Ee.total?Ee:null)},0,void 0,o1);if(Y||nn.current!==u)return;H(null),ge.events?.length&&W(ge.events);const qe=await N;if(Y||nn.current!==u)return;const je=ge.beforeSeq,we=typeof qe=="number"&&je!=null&&qe>je?await f1(u,je,qe,xe):qe==null&&je!=null&&je>0?await f1(u,je,void 0,xe):null;we?.length&&W(we)}catch{}})(),()=>{Y=!0}},[u]),F.useEffect(()=>{!u||Z!==u||!C.title||V[u]||k(N=>{if(N[u]===C.title)return N;const Y={...N,[u]:C.title};return sessionStorage.setItem("dsh-bot.titles",JSON.stringify(Y)),Y})},[u,Z,C.title,V]);const Ql=!!u&&_t.has(u),cn=Ql&&vt?ve[u]??[]:[],sr=Ql&&vt?u:"";F.useEffect(()=>{if(!u||!er(u)){Ci("");return}let N=!1;const Y=hS(u);return ou(`/dsh-bot/api/work/ticket?id=${encodeURIComponent(Y)}`).then(W=>{if(N||W.body.ok!==!0||!W.body.ticket||typeof W.body.ticket!="object")return;const ae=W.body.ticket.owner_session_id;typeof ae=="string"&&Ci(ae)}),()=>{N=!0}},[u]);const ea=cn.some(N=>N.status==="started");F.useEffect(()=>{if(!ea)return;const N=window.setInterval(()=>Gn(Date.now()),1e3);return()=>window.clearInterval(N)},[ea]);function cr(N){const Y=g1(N);Object.keys(Y).length!==0&&R(W=>{let ae=!1;const xe={...W};for(const[ge,qe]of Object.entries(Y))xe[ge]||(xe[ge]=qe,ae=!0);return ae?(sessionStorage.setItem("dsh-bot.previews",JSON.stringify(xe)),xe):W})}function fr(){window.clearTimeout(Ni.current),Ni.current=0;const N=[...Wr.current];if(Wr.current.clear(),N.length!==0){if(N.length===1){const[Y,W]=N[0]??[];Y&&W&&pd({sessionId:Y,preview:W});return}pd({previews:Object.fromEntries(N)})}}F.useEffect(()=>()=>{fr()},[]),F.useEffect(()=>{if(!u||Z!==u)return;const N=g3(C.segments);!N||pu.current.get(u)===N||(pu.current.set(u,N),R(Y=>{if(Y[u]===N)return Y;const W={...Y,[u]:N};return sessionStorage.setItem("dsh-bot.previews",JSON.stringify(W)),W}),Wr.current.set(u,N),window.clearTimeout(Ni.current),Ni.current=window.setTimeout(fr,400))},[u,Z,C.segments]),F.useEffect(()=>{if(!_e)return;const N=W=>{const ae=W.target;ae instanceof Node&&tn.current?.contains(ae)||Ae(!1)},Y=W=>{W.key==="Escape"&&Ae(!1)};return document.addEventListener("pointerdown",N),document.addEventListener("keydown",Y),()=>{document.removeEventListener("pointerdown",N),document.removeEventListener("keydown",Y)}},[_e]),F.useEffect(()=>{$t(!1)},[u]);const xu=cn.map(N=>`${N.id}:${N.status}:${N.revision}`).join(`
61
+ `);F.useEffect(()=>{const N=Mt.current;N&&(N.scrollTop=N.scrollHeight)},[C.segments,C.drafting,C.activity,u,dt,xu]);const jn=F.useMemo(()=>{const N=g.trim().toLowerCase();return c.filter(Y=>er(Y.sessionId)||Ot.has(Y.sessionId)?!1:N?[Sl(Y),Y.cwd??"",A[Y.sessionId]??""].join(" ").toLowerCase().includes(N):!0)},[c,g,v,A,Ot,V]).filter(N=>!N.blank),st=F.useMemo(()=>{const N=g.trim().toLowerCase();return c.filter(Y=>Y.blank!==!0||er(Y.sessionId)?!1:N?[Sl(Y),Y.cwd??""].join(" ").toLowerCase().includes(N):!0)},[c,g,v,V]),Rt=nl||g.trim()!=="",Xl=F.useMemo(()=>!u||!_t.has(u)?[]:c.flatMap(N=>!_t.has(N.sessionId)||N.sessionId===u||Ot.has(N.sessionId)||er(N.sessionId)?[]:[{sessionId:N.sessionId,label:Sl(N)}]),[c,_t,u,Ot,V,v]),Xn=u&&_t.has(u)?C3(Me,ot):null,ta=Xn?`${Xn.start}:${Xn.query}`:"",rl=Xn?O3(Xl,Xn.query):[],na=Xn!=null&&J!==ta,kl=Math.min(O,Math.max(rl.length-1,0));F.useEffect(()=>{z(0)},[ta]);function Oi(N,Y){const W=new Set(Ot);for(const ae of Y)W.add(ae);if(Array.isArray(N))for(const ae of N)typeof ae=="string"&&W.add(ae);tl(W),Y.includes(u)&&wl("")}async function dr(N){const Y=await Yn(`/sessions/${encodeURIComponent(N)}/archive`,{method:"POST"});if(Y.status!==200){const W=Y.body.upstream;m(W?.message||(Y.body.error==="not_blank"?n("session.notBlankArchive"):n("session.archiveFailed")));return}m(""),Oi(Y.body.archivedSessionIds,[N])}async function Tl(){if(st.length===0||!window.confirm(n("session.archiveConfirm",{count:String(st.length)})))return;const N=[];let Y=[];for(const W of st){const ae=await Yn(`/sessions/${encodeURIComponent(W.sessionId)}/archive`,{method:"POST"});if(ae.status!==200){const xe=ae.body.upstream;m(xe?.message||n("session.archiveSomeFailed"));break}N.push(W.sessionId),Y=ae.body.archivedSessionIds}N.length>0&&Oi(Y,N)}async function Zl(N){const Y=c.find(xe=>xe.sessionId===N),W=v[N]||y1(Y?.cwd)||n("session.blankName");if(!window.confirm(n("session.purgeOneConfirm",{name:W})))return;const ae=await Yn(`/sessions/${encodeURIComponent(N)}/purge`,{method:"POST"});if(ae.status!==200){m(ae.body.error==="not_blank"?n("session.purgeNotBlank"):n("session.purgeFailed"));return}d(xe=>xe.filter(ge=>ge.sessionId!==N)),tl(xe=>{const ge=new Set(xe);return ge.delete(N),ge}),u===N&&wl("")}async function _i(){const N=st.filter(ae=>ae.blank===!0);if(N.length===0||!window.confirm(n("session.purgeAllConfirm",{count:String(N.length)})))return;const Y=[];for(const ae of N){if((await Yn(`/sessions/${encodeURIComponent(ae.sessionId)}/purge`,{method:"POST"})).status!==200){m(n("session.purgeSomeFailed"));break}Y.push(ae.sessionId)}if(Y.length===0)return;const W=new Set(Y);d(ae=>ae.filter(xe=>!W.has(xe.sessionId))),tl(ae=>{const xe=new Set(ae);for(const ge of Y)xe.delete(ge);return xe}),W.has(u)&&wl("")}async function Fl(N,Y,W){Fe(!1),W!==""&&(te(ge=>({...ge,[N]:W})),il(ge=>new Set([...ge,N])),k(ge=>{const qe={...ge,[N]:W};return sessionStorage.setItem("dsh-bot.titles",JSON.stringify(qe)),qe}));const xe=(await Yn("/sessions")).body.result;d(xe?.value?.items??[]),wl(N),Vn(Y),ll(ge=>ge+1)}function Tt(N,Y){E(N),mt(Y),window.requestAnimationFrame(()=>{const W=vn.current;W&&(W.focus(),W.setSelectionRange(Y,Y))})}function la(N){if(!Xn)return;const Y=z3(Me,ot,Xn.start,N.label,N.sessionId);Tt(Y.text,Y.cursor)}function ji(N="/"){Ae(!1),E(Y=>{const W=Y.replace(/\s+$/,"");return W===""?N==="/"?"/":`${N} `:`${W} ${N==="/"?"/":`${N} `}`}),window.requestAnimationFrame(()=>vn.current?.focus())}async function ia(N){const Y=de?.status==="accepted"&&C.drafting,W=sr===u?cn:[];if(!u||!N||!$.ready||my(Y,W,_t.has(u)))return;const ae=C.drafting;E(""),Te(""),Ai.current+=1;const xe=Number.MAX_SAFE_INTEGER-Ai.current;I(je=>({...je,drafting:!0,segments:[...je.segments,{kind:"user",id:`optimistic:${xe}`,text:N,time:Date.now(),seq:xe,optimistic:!0}]}));const ge=await Yn("/tasks",{method:"POST",headers:{"content-type":"application/json","idempotency-key":crypto.randomUUID()},body:JSON.stringify({sessionId:u,text:N})}),qe=ge.body.task;if(U(qe??null),ge.status!==202){I(we=>({...we,drafting:ae?we.drafting:!1,segments:we.segments.filter(Ee=>!(Ee.kind==="user"&&Ee.optimistic&&Ee.text===N))}));const je=ge.body.execution;Te(je?.reason||is(String(ge.body.error||""),n("composer.notSent"),n))}}async function al(){const N=Me.trim();N&&await ia(N)}async function Kl(N,Y){const W=await ou("/dsh-bot/api/work/supply",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:u,ticketId:N,text:Y})});return W.status!==200||W.body.ok===!1?x1(W.body,n("composer.supplyFailed")):""}async function xs(){if(!de||de.status!=="accepted")return;const Y=(await Yn(`/tasks/${de.id}/cancel?sessionId=${encodeURIComponent(de.sessionId??"")}`,{method:"POST"})).body.task??de;U(Y),Y.status==="cancelled"&&I(W=>({...W,drafting:!1}))}const Jl=de?.status==="accepted"&&C.drafting,Su=my(Jl,sr===u?cn:[],Ql),Xe=!!u&&$.ready&&Me.trim()!==""&&!Su;function ra(N){if(!_t.has(N.sessionId))return null;const Y=N.running===!0||N.sessionId===u&&(Jl||C.drafting),W=N.sessionId===u&&sr===u?cn:(jt[N.sessionId]??[]).map(ae=>({status:ae}));return wS(W,Y)}return w.jsxs("div",{className:u?"shell in-chat":"shell",children:[w.jsxs("aside",{className:"side",children:[w.jsxs("div",{className:"side-top",children:[w.jsx("strong",{className:"brand",children:n("app.title")}),w.jsxs("span",{className:"side-actions",children:[w.jsx("button",{type:"button",className:"icon-btn","aria-label":n("session.search"),onClick:()=>S(N=>!N),children:w.jsx(D3,{})}),w.jsx("button",{type:"button",className:"icon-btn","aria-label":n("new.title"),onClick:()=>Fe(!0),children:w.jsx(h1,{})})]})]}),p?w.jsx("input",{className:"filter",value:g,placeholder:n("session.searchPlaceholder"),onChange:N=>y(N.target.value)}):null,h?w.jsx("p",{className:"note",children:h}):null,on?w.jsx("p",{className:"note ok",children:on}):null,w.jsxs("ul",{className:"sessions",children:[jn.length===0&&st.length===0?w.jsx("li",{className:"empty",children:c.length?n("session.noMatch"):n("session.none")}):null,jn.map(N=>{const Y=Sl(N);return w.jsx("li",{children:w.jsxs("button",{type:"button",className:N.sessionId===u?"session selected":"session",title:N.cwd||N.sessionId,onClick:()=>wl(N.sessionId),children:[w.jsxs("span",{className:_t.has(N.sessionId)?"mark bot-mark":"mark",children:[_t.has(N.sessionId)?"BOT":Array.from(Y)[0],w.jsx(d1,{signal:ra(N)})]}),w.jsxs("span",{className:"copy",children:[w.jsx("span",{className:"name",children:Y}),w.jsx("span",{className:"preview",children:(N.sessionId===u?Jf(cn,sn,n):"")||A[N.sessionId]||(N.running?n("session.running"):"")})]})]})},N.sessionId)}),st.length>0?w.jsxs("li",{className:"blank-head",children:[w.jsxs("button",{type:"button","aria-expanded":Rt,onClick:()=>en(N=>!N),children:[n(Rt?"session.hide":"session.show")," ",n("session.blankCount",{count:String(st.length)})]}),w.jsx("button",{type:"button",onClick:()=>{Tl()},children:n("session.archiveAll")}),w.jsx("button",{type:"button",onClick:()=>{_i()},children:n("session.purgeAll")})]}):null,Rt?st.map(N=>{const Y=Sl(N);return w.jsxs("li",{className:"session-row",children:[w.jsxs("button",{type:"button",className:N.sessionId===u?"session selected":"session",title:N.cwd||N.sessionId,onClick:()=>wl(N.sessionId),children:[w.jsx("span",{className:_t.has(N.sessionId)?"mark bot-mark":"mark",children:_t.has(N.sessionId)?"BOT":Array.from(Y)[0]}),w.jsxs("span",{className:"copy",children:[w.jsx("span",{className:"name",children:Y}),w.jsx("span",{className:"preview",children:Ot.has(N.sessionId)?n("session.archived"):n("session.blank")})]})]}),Ot.has(N.sessionId)?null:w.jsx("button",{type:"button",className:"session-delete","aria-label":n("session.archiveLabel",{name:Y}),onClick:()=>{dr(N.sessionId)},children:n("session.archive")}),w.jsx("button",{type:"button",className:"session-delete purge","aria-label":n("session.purgeLabel",{name:Y}),onClick:()=>{Zl(N.sessionId)},children:n("session.purge")})]},N.sessionId)}):null]}),oe?w.jsx(M3,{health:Ce,usage:be,execution:$,model:C.model}):null,w.jsxs("div",{className:"me-row",children:[w.jsxs("button",{type:"button",className:"me",onClick:()=>me(N=>!N),children:[w.jsx("span",{className:"mark me-mark",children:n("local.mark")}),w.jsx("span",{children:Ce?.primary?.reachable===!1?n("local.down"):n("local.here")})]}),w.jsx("button",{type:"button",className:"lang-switch",onClick:()=>r(i==="en"?"zh":"en"),children:n("lang.switch")})]})]}),w.jsxs("section",{className:"chat",children:[w.jsxs("header",{className:"chat-head",children:[dt?w.jsx("button",{type:"button",className:"bot-chat-back",onClick:()=>$t(!1),children:n("nav.back")}):er(u)?w.jsx("button",{type:"button",className:"back",onClick:or,children:n("nav.back")}):w.jsx("button",{type:"button",className:"back",onClick:()=>s(""),children:n("nav.sessions")}),u&&_t.has(u)?w.jsxs("span",{className:"bot-badge",children:["BOT",w.jsx(d1,{signal:ra({sessionId:u,running:c.find(N=>N.sessionId===u)?.running})})]}):null,w.jsx("h1",{children:dt?n("nav.botMessages"):zi}),!dt&&Jf(cn,sn,n)?w.jsx("span",{className:"work-chip",children:Jf(cn,sn,n)}):null,w.jsx("a",{href:bu,children:n("nav.official")})]}),er(u)&&!dt?w.jsxs("nav",{className:"work-crumb","aria-label":n("nav.where"),children:[w.jsx("button",{type:"button",onClick:or,children:zn&&Pr(zn)||n("nav.mainSession")}),w.jsx("span",{"aria-hidden":"true",children:"/"}),w.jsx("span",{children:n("nav.worker")})]}):null,kt&&!dt?w.jsx("p",{className:"basis",children:kt}):null,w.jsxs("div",{className:"chat-body",children:[w.jsx(_3,{active:Qn||Vl,progress:le}),w.jsx("div",{className:"scroll",ref:Mt,"aria-busy":Qn||Vl||void 0,children:w.jsxs("div",{className:"column",children:[u?null:w.jsx("p",{className:"empty-thread",children:n("nav.pick")}),u&&!Qn&&!Vl&&!dt&&_n.length===0&&cn.length===0?w.jsx("p",{className:"empty-thread",children:n("nav.empty")}):null,Qn?null:dt?w.jsx(UA,{items:ar,botLabel:Pr,onOpenFile:(N,Y)=>pe({path:N,line:Y})}):w.jsx($3,{segments:_n,completed:C.completed,failures:C.failures,retries:C.retries,turnEnds:C.turnEnds,tickets:cn,now:sn,canRetry:!!u&&$.ready&&!Jl,onRetry:N=>{ia(N)},onSupply:Kl,onOpenSession:vu,onOpenFile:(N,Y)=>pe({path:N,line:Y}),onOpenInbox:()=>$t(!0),botLabel:Pr,chat:Ql}),C.drafting&&!dt&&!Qn?w.jsx("p",{className:"live-status",children:w.jsx("span",{className:"shimmer",children:Ql?vS(C.activity,n):C.activity||"Analyzing the request"})}):null]})}),dt||Qn?null:w.jsx(VA,{root:Mt,marks:ur,busyId:C.drafting&&C.turn!=null?`turn:${C.turn}`:void 0})]}),w.jsx("div",{className:"composer-wrap",hidden:dt,children:w.jsxs("form",{className:"column",onSubmit:N=>{N.preventDefault(),al()},children:[w.jsxs("div",{className:"card",children:[na?w.jsx("div",{className:"mention-menu",role:"listbox","aria-label":n("composer.mention"),children:rl.length===0?w.jsx("p",{className:"mention-empty",children:n("composer.noBot")}):rl.map((N,Y)=>w.jsxs("button",{type:"button",role:"option","aria-selected":Y===kl,className:Y===kl?"active":"",onMouseDown:W=>{W.preventDefault(),la(N)},children:[w.jsx("span",{className:"bot-badge",children:"BOT"}),w.jsx("span",{className:"mention-name",children:N.label})]},N.sessionId))}):null,w.jsx("textarea",{ref:vn,value:Me,rows:1,placeholder:u?kS(cn,n)??(Ql&&Jl?n("composer.interrupt"):_t.has(u)?n("composer.mentionHint"):n("composer.task")):n("composer.pick"),disabled:!u,onChange:N=>{E(N.target.value),mt(N.target.selectionStart??N.target.value.length)},onSelect:N=>mt(N.currentTarget.selectionStart??0),onKeyDown:N=>{if(!N.nativeEvent.isComposing){if(na&&rl.length>0){if(N.key==="ArrowDown"){N.preventDefault(),z(Y=>(Y+1)%rl.length);return}if(N.key==="ArrowUp"){N.preventDefault(),z(Y=>(Y-1+rl.length)%rl.length);return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault();const Y=rl[kl];Y&&la(Y);return}if(N.key==="Escape"){N.preventDefault(),re(ta);return}}N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),al())}}}),w.jsxs("div",{className:"card-row",children:[w.jsxs("div",{className:"tools",ref:tn,children:[w.jsx("button",{type:"button",className:"add","aria-label":n("composer.add"),"aria-haspopup":"menu","aria-expanded":_e,disabled:!u,onClick:()=>Ae(N=>!N),children:w.jsx(h1,{})}),_e?w.jsxs("div",{className:"plus-menu",role:"menu",children:[w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji(),children:n("composer.command")}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission read-only"),children:"Read Only"}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission workspace-write"),children:"Workspace Write"}),w.jsx("button",{type:"button",role:"menuitem",onClick:()=>ji("/permission danger-full-access"),children:"Full access"}),w.jsx("p",{className:"plus-note",children:n("composer.filesLater")})]}):null,C.preset?w.jsxs("span",{className:"chip",children:[w.jsx(R3,{preset:C.preset}),iN(C.preset)]}):null]}),w.jsxs("div",{className:"trailing",children:[C.model?w.jsx("span",{className:"model",children:C.model}):null,Jl?w.jsx("button",{type:"button",className:"stop","aria-label":n("composer.cancel"),onClick:()=>{xs()},children:w.jsx("span",{className:"stop-icon"})}):null,Su?null:w.jsx("button",{type:"submit",className:"send","aria-label":n("composer.send"),disabled:!Xe,children:w.jsx(L3,{})})]})]})]}),w.jsx("p",{className:"stats",children:he||($.ready?j3(C):is($.reason,$.reason,n))})]})})]}),u&&ce?w.jsx(_S,{sessionId:u,path:ce.path,line:ce.line,onClose:()=>pe(null)}):null,gt?w.jsx(BS,{onClose:()=>Fe(!1),onCreated:(N,Y,W)=>{Fl(N,Y,W)}}):null]})}const ub=document.querySelector("#root");if(!ub)throw new Error("missing root");Xx.createRoot(ub).render(w.jsx(F.StrictMode,{children:w.jsx(sS,{children:w.jsx(rN,{})})}));